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

Function namesAskedOf

ark/aot/unplugin.ts:2189–2210  ·  view source on GitHub ↗
(
	graph: BundlerModuleGraph,
	module: unknown,
	seen = new Set([module])
)

Source from the content-addressed store, hash-verified

2187// what's asked of a module, true for all of its exports. A star re-export asks
2188// for what's asked of it. Where a dependency doesn't say, it asks for all
2189const namesAskedOf = (
2190 graph: BundlerModuleGraph,
2191 module: unknown,
2192 seen = new Set([module])
2193): Set<string> | true => {
2194 const names = new Set<string>()
2195 for (const { dependency } of graph.getIncomingConnections(module as never)) {
2196 if (!dependency) continue
2197 const { forwardId, lazyRole } = dependency as BuiltDependency
2198 if (forwardId === null) continue
2199 if (lazyRole === "*") {
2200 const parent = graph.getParentModule?.(dependency as never)
2201 if (seen.has(parent)) continue
2202 seen.add(parent)
2203 const asked = namesAskedOf(graph, parent, seen)
2204 if (asked === true) return true
2205 for (const name of asked) names.add(name)
2206 } else if (typeof forwardId === "string") names.add(forwardId)
2207 else return true
2208 }
2209 return names
2210}
2211
2212// an export of a module it wrote that's asked for yet unbuilt, as askAgainOf
2213// keeps from happening unless webpack comes to defer them otherwise. Nothing

Callers 1

unbuiltReadOfFunction · 0.85

Calls 2

hasMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected