flatten_template_registries
Stable function · Flatten
Tier: stable · Kind: function · Topic: Flatten
| Julia | TypeScript | Python | Rust | Go |
|---|---|---|---|---|
| not exported | flattenTemplateRegistries | flatten_template_registries | not exported | not exported |
Julia
Julia does not export this function.
TypeScript
function flattenTemplateRegistries(loaded: object): FlattenedTemplateRegistries
The flatten-time template-registry merge (esm-spec §9.6.4 rule 7, §10.7;
esm-libraries-spec §4.7.5 step 4). Given an Option-B loaded multi-component
document loaded, merge every component’s match-less expression_templates
registry into a single document-scoped merged registry:
- Deep-equal dedup at first occurrence — two components importing one stencil produce identical folded bodies, kept once under the bare name.
- Non-deep-equal same-name collision — both entries are renamed
deterministically to
<ComponentPath>.<name>and theirapply_expression_templatereferences are rewritten in lockstep. - Collisions propagate along the reference DAG — a declaration that
references a colliding name collides too (see
registryCollisionNames), so a byte-identical wrapper over a per-component leaf is renamed per owner rather than deduped into one body whose nested reference no longer resolves.
Returns the rewritten document root (component reference sites updated) and
the merged registry (the FlattenedSystem’s first-class registry field).
match rules are not merged (only match-less templates are referenceable).
Mirrors the Julia reference flatten_template_registries.
Python
flatten_template_registries(loaded: Any) -> tuple[dict, dict]
The flatten-time template-registry merge (esm-spec §9.6.4 rule 7, §10.7;
esm-libraries-spec §4.7.5 step 4). Given an Option-B loaded multi-component
document loaded, merge every component’s expression_templates
registry into a single document-scoped merged registry:
- Deep-equal dedup at first occurrence — two components importing one stencil produce identical folded bodies, kept once under the bare name.
- Non-deep-equal same-name collision — both entries are renamed
deterministically to
<ComponentPath>.<name>and theirapply_expression_templatereferences are rewritten in lockstep (total, deterministic; no new diagnostic). - Collisions propagate along the reference DAG — a declaration that
references a colliding name collides too (see
_registry_collision_names), so a byte-identical wrapper over a per-component leaf is renamed per owner rather than deduped into one body whose nested reference no longer resolves.
Returns the rewritten document root (component reference sites updated)
and the merged registry as a dict (the FlattenedSystem’s first-class
registry field). match rules are not merged (only match-less templates
are referenceable, §9.6.2).
Rust
Rust does not export this function.
Go
Go does not export this function.