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

Function checkEsbuildBundle

ark/aot/unplugin.ts:1157–1182  ·  view source on GitHub ↗
(build: EsbuildPluginBuild, cwd: string)

Source from the content-addressed store, hash-verified

1155 // a standalone bundle's externals, and the calls its folded helpers left,
1156 // checked once it's written
1157 const checkEsbuildBundle = (build: EsbuildPluginBuild, cwd: string) => {
1158 build.initialOptions.metafile = true
1159 build.onEnd(async result => {
1160 if (!result.metafile || result.errors.length) return
1161 const warnings: { text: string }[] = []
1162 try {
1163 await checkBundledExternals(
1164 esbuildBundleOf(result.metafile, cwd),
1165 warning => warnings.push({ text: warning })
1166 )
1167 } catch (e) {
1168 return rejectEsbuild(build, cwd, result.metafile, (e as Error).message)
1169 }
1170 const problem =
1171 foldedHelpersById.size &&
1172 unfoldedCallProblemOf(
1173 foldedHelpersById,
1174 esbuildImportsOf(result.metafile, cwd),
1175 isTransformedId,
1176 realCwd()
1177 )
1178 // it wrote calls that throw at runtime
1179 if (problem) return rejectEsbuild(build, cwd, result.metafile, problem)
1180 return { warnings }
1181 })
1182 }
1183 // the scan's facts hold only while the bundle is what it read
1184 const scanEsbuildBundle = (
1185 build: EsbuildPluginBuild,

Callers 1

unplugin.tsFile · 0.85

Calls 7

unfoldedCallProblemOfFunction · 0.90
checkBundledExternalsFunction · 0.85
esbuildBundleOfFunction · 0.85
rejectEsbuildFunction · 0.85
esbuildImportsOfFunction · 0.85
realCwdFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected