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

Function unfoldedCallProblemOf

ark/aot/scan.ts:741–764  ·  view source on GitHub ↗
(
	foldedHelpersById: ReadonlyMap<string, string[]>,
	imports: Imports,
	isTransformed: (id: string) => boolean,
	cwd: string
)

Source from the content-addressed store, hash-verified

739
740// a folded helper's call runs only where the plugin transforms it
741export const unfoldedCallProblemOf = (
742 foldedHelpersById: ReadonlyMap<string, string[]>,
743 imports: Imports,
744 isTransformed: (id: string) => boolean,
745 cwd: string
746): string | undefined => {
747 const pathOf = (id: string) =>
748 isAbsolute(id) ? printablePathOf(cwd, fileOf(id)) : id
749 for (const entry of imports.entries) {
750 const [helper] =
751 (entry !== undefined && foldedHelpersById.get(fileOf(entry))) || []
752 if (helper) return writeEntryHelperMessage(pathOf(entry!), helper)
753 }
754 for (const [importer, target] of imports.edges) {
755 const [helper] = foldedHelpersById.get(fileOf(target)) ?? []
756 if (helper && (importer === undefined || !isTransformed(importer))) {
757 return writeUntransformedHelperMessage(
758 importer === undefined ? "a module it can't read" : pathOf(importer),
759 pathOf(target),
760 helper
761 )
762 }
763 }
764}
765
766export const writeUntransformedHelperMessage = (
767 importer: string,

Callers 3

keepCompilerFunction · 0.90
checkEsbuildBundleFunction · 0.90
buildEndFunction · 0.90

Calls 6

fileOfFunction · 0.90
writeEntryHelperMessageFunction · 0.85
pathOfFunction · 0.70
isTransformedFunction · 0.70
getMethod · 0.65

Tested by

no test coverage detected