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

Method resolveExportedType

ark/aot/graph.ts:2902–2940  ·  view source on GitHub ↗
(
		specifier: string,
		name: string,
		importer: SourceModule,
		localOnly: boolean,
		seen?: Set<string>
	)

Source from the content-addressed store, hash-verified

2900 }
2901
2902 private resolveExportedType(
2903 specifier: string,
2904 name: string,
2905 importer: SourceModule,
2906 localOnly: boolean,
2907 seen?: Set<string>
2908 ): ExportedType {
2909 if (localOnly && !localSpecifier.test(specifier)) {
2910 return {
2911 kind: "kind",
2912 value:
2913 arkTypesSpecifier.test(specifier) && name in arkTypeNames ?
2914 arkTypeKindOf(name)
2915 : kinds.data
2916 }
2917 }
2918 if (!localOnly && arkTypesSpecifier.test(specifier))
2919 return { kind: "opaque" }
2920 const cacheKey = `${localOnly ? "1" : "0"}\0${specifier}\0${name}`
2921 let bySpec = this.exportedTypesByModule.get(importer)
2922 const cached = bySpec?.get(cacheKey)
2923 if (cached) return cached
2924 const isRoot = !seen
2925 const result = this.findExportedType(
2926 specifier,
2927 name,
2928 importer,
2929 localOnly,
2930 seen ?? new Set()
2931 )
2932 if (isRoot) {
2933 if (!bySpec) {
2934 bySpec = new Map()
2935 this.exportedTypesByModule.set(importer, bySpec)
2936 }
2937 bySpec.set(cacheKey, result)
2938 }
2939 return result
2940 }
2941
2942 private findExportedType(
2943 specifier: string,

Callers 3

exportedTypeKindOfMethod · 0.95
exportedLocalTypeOfMethod · 0.95
findExportedTypeMethod · 0.95

Calls 5

findExportedTypeMethod · 0.95
arkTypeKindOfFunction · 0.85
testMethod · 0.80
getMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected