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

Method exportedDefinitionOf

ark/aot/graph.ts:6126–6151  ·  view source on GitHub ↗
(
		module: SourceModule,
		name: string,
		seen: Set<string>
	)

Source from the content-addressed store, hash-verified

6124 }
6125
6126 private exportedDefinitionOf(
6127 module: SourceModule,
6128 name: string,
6129 seen: Set<string>
6130 ): [Node, SourceModule] | undefined {
6131 const key = `${module.id}\0${name}`
6132 if (seen.has(key)) return
6133 seen.add(key)
6134 const entry = module.scopes.exportsByName[name]
6135 if (entry?.kind === "reexport") {
6136 const target = this.packageModuleOf(entry.specifier, module)
6137 return target && this.exportedDefinitionOf(target, entry.name, seen)
6138 }
6139 const value =
6140 entry?.kind === "binding" ? entry.binding.id
6141 : entry?.kind === "expression" ? entry.node
6142 : entry ? undefined
6143 : commonExportOf(module, name)
6144 if (value) return this.definitionOf(value, module, seen)
6145 if (entry) return
6146 for (const specifier of module.scopes.starExports) {
6147 const target = this.packageModuleOf(specifier, module)
6148 const result = target && this.exportedDefinitionOf(target, name, seen)
6149 if (result) return result
6150 }
6151 }
6152
6153 // a module of a package, which the build reads only for what its
6154 // functions may write

Callers 1

definitionOfMethod · 0.95

Calls 5

packageModuleOfMethod · 0.95
definitionOfMethod · 0.95
commonExportOfFunction · 0.85
hasMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected