rune-langium / core/src / collectNamespaceDependencies
Function: collectNamespaceDependencies()
ts
function collectNamespaceDependencies(documents): Map<string, Set<string>>;Defined in: packages/core/src/analysis/cross-namespace-refs.ts:86
Walk every parsed document and return a per-namespace dependency map: Map<sourceNamespace, Set<targetNamespace>>. A key S lists every namespace T ≠ S that some type in S directly references.
The auto-select cascade in the Download modal computes the transitive closure on top of this map — a fixed-point set-union that terminates naturally when no new namespaces are added (cycles absorb cleanly).
Walks the spec §5.2 reference set in full:
- Data
superType(extends) - Data
attributes[].typeCall.type(attribute type refs) - RosettaTypeAlias
typeCall.type(alias target refs) - Choice
attributes[].typeCall.type(choice arm refs) - RosettaFunction
inputs[].typeCall.type+output.typeCall.type+superFunction(function I/O refs)
NOT walked yet:
- Function body operation type refs (the §5.2 "rule conditions" bullet). The Langium AST's
Operation/Conditionshapes have many possible type-bearing children, and the body refs are typically subset of the function's input/output anyway. If a real deselection test ever produces a broken emit because of a body-only reference, extend here.
Parameters
| Parameter | Type |
|---|---|
documents | readonly LangiumDocument<AstNode>[] |
Returns
Map<string, Set<string>>