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

Function unsharedExternalOf

ark/aot/unplugin.ts:3241–3257  ·  view source on GitHub ↗
({
	externals,
	files
}: BundleModules)

Source from the content-addressed store, hash-verified

3239// an external the runtime can't share: arktype as an entry, or a package the
3240// bundle holds a copy of too
3241const unsharedExternalOf = ({
3242 externals,
3243 files
3244}: BundleModules): string | undefined => {
3245 const entry = externals.find(specifier =>
3246 runtimeSpecifiers.includes(specifier)
3247 )
3248 if (entry) return entry
3249 const shared = externals.filter(specifier =>
3250 externalizableSpecifiers.includes(specifier)
3251 )
3252 if (!shared.length) return
3253 const bundled = new Set(
3254 files.flatMap(file => (isAbsolute(file) ? packageOfFile(file) : []))
3255 )
3256 return shared.find(specifier => bundled.has(packageNameOf(specifier)))
3257}
3258
3259const packagesByDir = new Map<string, string | undefined>()
3260

Callers 1

checkBundledExternalsFunction · 0.85

Calls 5

packageNameOfFunction · 0.90
packageOfFileFunction · 0.85
findMethod · 0.80
filterMethod · 0.80
hasMethod · 0.45

Tested by

no test coverage detected