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

Function handler

ark/aot/unplugin.ts:1076–1104  ·  view source on GitHub ↗
(code, id)

Source from the content-addressed store, hash-verified

1074 code: /\bimport\b/
1075 },
1076 async handler(code, id) {
1077 const isOwn =
1078 transformedFilter.include.test(id) &&
1079 !transformedFilter.exclude.test(id)
1080 // webpack and Rspack say what they built, and a query there may
1081 // name a script
1082 const built = (
1083 this.getNativeBuildContext?.() as NativeBuild | undefined
1084 )?.loaderContext?._module
1085 const isInert = built ? !isScriptModule(built) : isAsset(id)
1086 // read once the bundle is built, against what its scan wrote
1087 if (!isOwn && !isInert)
1088 othersByBuild.get(buildOf(this))?.set(fileOf(id), code)
1089 if (!isStandalone || opts?.shadow || isOwn || isInert) return
1090 const map = (
1091 this as { getCombinedSourcemap?: () => { mappings: string } }
1092 ).getCombinedSourcemap?.()
1093 reportDiagnostics(
1094 (await requestResolving(
1095 bundlerResolveOf(this, isTransformedId),
1096 "checkUnwritten",
1097 code,
1098 fileOf(id),
1099 map?.mappings
1100 )) as RenderedDiagnostics,
1101 warning => this.warn(warning),
1102 throwBuildError
1103 )
1104 }
1105 }
1106 }
1107 // Vitest's, which Vite's Plugin type declares only where Vitest is installed

Callers 2

fallingBackToFunction · 0.85
writesWithoutFallbackMethod · 0.85

Calls 15

isAssetFunction · 0.90
fileOfFunction · 0.90
reportDiagnosticsFunction · 0.90
addLoadedFunction · 0.90
variantSpecifierOfFunction · 0.90
resolvesToRuntimeFunction · 0.90
readsNodesFunction · 0.90
runsOnArktypeFunction · 0.90
isScriptModuleFunction · 0.85
buildOfFunction · 0.85
requestResolvingFunction · 0.85
bundlerResolveOfFunction · 0.85

Tested by

no test coverage detected