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

Function rollupEntriesOf

ark/aot/unplugin.ts:2595–2617  ·  view source on GitHub ↗
(
	context: RollupContext,
	inputs: string[],
	res: Map<string, RollupResolution>,
	cwd: string
)

Source from the content-addressed store, hash-verified

2593// the bundle's entries as modules, reading a page's module scripts as Vite
2594// builds them, or why one can't be scanned
2595const rollupEntriesOf = async (
2596 context: RollupContext,
2597 inputs: string[],
2598 res: Map<string, RollupResolution>,
2599 cwd: string
2600): Promise<ScanEntry[] | string> => {
2601 const entries: ScanEntry[] = []
2602 for (const input of inputs) {
2603 const resolved = await context.resolve(input, undefined, { isEntry: true })
2604 if (!resolved || resolved.external)
2605 return `the entry "${input}" doesn't resolve to a module`
2606 res.set(resolved.id, resolved)
2607 if (!htmlId.test(resolved.id)) {
2608 entries.push({ id: resolved.id })
2609 continue
2610 }
2611 const source = scriptsOf(readFileSync(resolved.id, "utf8"))
2612 if (source === undefined)
2613 return `${printablePathOf(cwd, resolved.id)} holds an inline module script, which it can't read before the build writes it as a module`
2614 entries.push({ id: resolved.id, source })
2615 }
2616 return entries
2617}
2618
2619const htmlId = /\.html$/
2620

Callers 1

rollupScanOfFunction · 0.85

Calls 6

printablePathOfFunction · 0.90
scriptsOfFunction · 0.85
testMethod · 0.80
resolveMethod · 0.65
setMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected