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

Function referencedFilesOf

ark/aot/declareNative.ts:596–624  ·  view source on GitHub ↗
(
	api: tsgo.API,
	references: readonly { path: string }[] | undefined,
	canonical: (path: string) => string
)

Source from the content-addressed store, hash-verified

594const portabilityCodes: ReadonlySet<number> = new Set([2742, 2883])
595
596const referencedFilesOf = (
597 api: tsgo.API,
598 references: readonly { path: string }[] | undefined,
599 canonical: (path: string) => string
600): Set<string> | undefined => {
601 if (!references?.length) return
602 const excluded = new Set<string>()
603 const visited = new Set<string>()
604 const visit = (refs: readonly { path: string }[] | undefined) => {
605 if (!refs?.length) return
606 for (const { path } of refs) {
607 const refConfig =
608 /\.json$/i.test(path) ? path : join(path, "tsconfig.json")
609 const key = canonical(refConfig)
610 if (visited.has(key)) continue
611 visited.add(key)
612 try {
613 const refParsed = api.parseConfigFile(refConfig)
614 for (const fileName of refParsed.fileNames)
615 excluded.add(canonical(fileName))
616 visit(refParsed.projectReferences)
617 } catch {
618 // unreadable reference is reported by the checker itself
619 }
620 }
621 }
622 visit(references)
623 return excluded
624}
625
626const nativeOverlayFs = (
627 overlay: VirtualDeclarations,

Callers 1

openNativeFunction · 0.70

Calls 1

visitFunction · 0.70

Tested by

no test coverage detected