MCPcopy Create free account
hub / github.com/arktypeio/arktype / bundledDependentProblemOf

Function bundledDependentProblemOf

ark/aot/unplugin.ts:466–495  ·  view source on GitHub ↗
(
		bundle: BundleModules,
		noExternal: string | undefined
	)

Source from the content-addressed store, hash-verified

464 else throwBuildError(withAllowUnsafe(problem))
465 }
466 const bundledDependentProblemOf = async (
467 bundle: BundleModules,
468 noExternal: string | undefined
469 ) => {
470 for (const external of bundle.externals) {
471 if (externalizableSpecifiers.includes(external)) continue
472 const importer = bundle.importerOf[external]
473 const modules = externalModulesLoadingArktype(
474 external,
475 importer && isAbsolute(importer) ? dirname(importer) : realCwd()
476 )
477 if (!modules.length) continue
478 const name = externalPackageOf(external)
479 const bundling = writeBundledDependentMessage(name, noExternal)
480 // what bundling it would then fail with, for one defining Types
481 const [refusal] = (
482 await Promise.all(
483 modules
484 .filter(module => dependencyOf(module)?.[1] === name)
485 .map(readDependency)
486 )
487 ).flatMap(({ errors, warnings }) => [...errors, ...warnings])
488 // the setting it names has Vite's server bundle the package too
489 return (
490 !refusal ? bundling
491 : noExternal ? refusal
492 : `${bundling}\n${refusal}`
493 )
494 }
495 }
496 // read once each, as each rebuild leaves the same dependencies external
497 const modulesLoadingArktypeByExternal: Record<string, string[]> = {}
498 const externalModulesLoadingArktype = (specifier: string, from: string) =>

Callers 1

checkBundledExternalsFunction · 0.85

Calls 6

dependencyOfFunction · 0.90
realCwdFunction · 0.85
externalPackageOfFunction · 0.85
filterMethod · 0.80
mapMethod · 0.65

Tested by

no test coverage detected