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

Function rollupBundleOf

ark/aot/unplugin.ts:3199–3222  ·  view source on GitHub ↗
(context: RollupContext)

Source from the content-addressed store, hash-verified

3197
3198// Rolldown's module info has no isExternal, but no code for an external
3199const rollupBundleOf = (context: RollupContext): BundleModules => {
3200 const bundle: BundleModules = { externals: [], files: [], importerOf: {} }
3201 const seen = new Set<string>()
3202 const add = (id: string) => {
3203 if (seen.has(id)) return
3204 seen.add(id)
3205 const info = context.getModuleInfo(id)
3206 if (!info || (info.isExternal ?? info.code === null))
3207 bundle.externals.push(id)
3208 else bundle.files.push(id)
3209 }
3210 for (const id of context.getModuleIds()) {
3211 add(id)
3212 const info = context.getModuleInfo(id)
3213 for (const target of [
3214 ...(info?.importedIds ?? []),
3215 ...(info?.dynamicallyImportedIds ?? [])
3216 ]) {
3217 add(target)
3218 bundle.importerOf[target] ??= id
3219 }
3220 }
3221 return bundle
3222}
3223
3224const esbuildBundleOf = (metafile: Metafile, cwd: string): BundleModules => ({
3225 externals: Object.values(metafile.outputs).flatMap(

Callers 1

buildEndFunction · 0.85

Calls 1

addFunction · 0.70

Tested by

no test coverage detected