@ecopages/core 0.2.0-alpha.11 → 0.2.0-alpha.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/CHANGELOG.md +7 -10
  2. package/README.md +5 -4
  3. package/package.json +30 -6
  4. package/src/adapters/bun/hmr-manager.js +2 -2
  5. package/src/adapters/node/node-hmr-manager.js +2 -2
  6. package/src/adapters/node/server-adapter.d.ts +2 -2
  7. package/src/adapters/node/server-adapter.js +5 -5
  8. package/src/build/build-adapter.d.ts +8 -6
  9. package/src/build/build-adapter.js +44 -7
  10. package/src/eco/eco.js +18 -118
  11. package/src/eco/eco.utils.d.ts +1 -40
  12. package/src/eco/eco.utils.js +5 -35
  13. package/src/hmr/hmr-strategy.d.ts +8 -6
  14. package/src/integrations/ghtml/ghtml-renderer.d.ts +6 -1
  15. package/src/integrations/ghtml/ghtml-renderer.js +29 -28
  16. package/src/plugins/foreign-jsx-override-plugin.d.ts +31 -0
  17. package/src/plugins/foreign-jsx-override-plugin.js +35 -0
  18. package/src/plugins/integration-plugin.d.ts +90 -29
  19. package/src/plugins/integration-plugin.js +62 -19
  20. package/src/route-renderer/GRAPH.md +54 -84
  21. package/src/route-renderer/README.md +11 -19
  22. package/src/route-renderer/orchestration/component-render-context.d.ts +83 -0
  23. package/src/route-renderer/orchestration/component-render-context.js +147 -0
  24. package/src/route-renderer/orchestration/integration-renderer.d.ts +219 -81
  25. package/src/route-renderer/orchestration/integration-renderer.js +415 -171
  26. package/src/route-renderer/orchestration/queued-boundary-runtime.service.d.ts +93 -0
  27. package/src/route-renderer/orchestration/queued-boundary-runtime.service.js +155 -0
  28. package/src/route-renderer/orchestration/render-execution.service.d.ts +8 -70
  29. package/src/route-renderer/orchestration/render-execution.service.js +28 -113
  30. package/src/route-renderer/orchestration/render-output.utils.d.ts +46 -0
  31. package/src/route-renderer/orchestration/render-output.utils.js +65 -0
  32. package/src/route-renderer/orchestration/render-preparation.service.d.ts +0 -6
  33. package/src/route-renderer/orchestration/render-preparation.service.js +5 -13
  34. package/src/route-renderer/orchestration/template-serialization.d.ts +38 -0
  35. package/src/route-renderer/orchestration/template-serialization.js +45 -0
  36. package/src/route-renderer/page-loading/dependency-resolver.js +10 -8
  37. package/src/router/client/navigation-coordinator.js +2 -2
  38. package/src/router/server/fs-router-scanner.js +6 -1
  39. package/src/services/module-loading/node-bootstrap-plugin.js +14 -1
  40. package/src/services/module-loading/page-module-import.service.js +1 -1
  41. package/src/services/runtime-state/dev-graph.service.d.ts +5 -5
  42. package/src/services/runtime-state/dev-graph.service.js +10 -10
  43. package/src/types/public-types.d.ts +18 -3
  44. package/src/utils/html-escaping.d.ts +7 -0
  45. package/src/utils/html-escaping.js +6 -0
  46. package/src/eco/component-render-context.d.ts +0 -105
  47. package/src/eco/component-render-context.js +0 -94
  48. package/src/route-renderer/component-graph/component-graph-executor.d.ts +0 -33
  49. package/src/route-renderer/component-graph/component-graph-executor.js +0 -30
  50. package/src/route-renderer/component-graph/component-graph.d.ts +0 -53
  51. package/src/route-renderer/component-graph/component-graph.js +0 -94
  52. package/src/route-renderer/component-graph/component-marker.d.ts +0 -52
  53. package/src/route-renderer/component-graph/component-marker.js +0 -46
  54. package/src/route-renderer/component-graph/component-reference.d.ts +0 -11
  55. package/src/route-renderer/component-graph/component-reference.js +0 -39
  56. package/src/route-renderer/component-graph/marker-graph-resolver.d.ts +0 -79
  57. package/src/route-renderer/component-graph/marker-graph-resolver.js +0 -117
@@ -1,53 +0,0 @@
1
- import type { ComponentMarker, MarkerNodeId } from './component-marker.js';
2
- /**
3
- * Maps a parent slot reference to child marker node ids discovered in that slot.
4
- *
5
- * Keys are `slotRef` values emitted in marker payloads.
6
- */
7
- export type SlotChildrenRegistry = Record<string, MarkerNodeId[]>;
8
- /**
9
- * Serializable props captured for deferred marker nodes.
10
- *
11
- * The graph builder reads this registry to discover child markers that were not
12
- * emitted into the outer HTML stream because they were captured inside a
13
- * deferred parent's serialized `children` prop.
14
- */
15
- export type PropsRegistry = Record<string, Record<string, unknown>>;
16
- /**
17
- * Graph node enriched with source-order information for deterministic traversal.
18
- */
19
- export type ComponentGraphNode = ComponentMarker & {
20
- order: number;
21
- };
22
- /**
23
- * Directed acyclic graph representation for component marker orchestration.
24
- *
25
- * `levels` are topological layers from roots to leaves.
26
- */
27
- export type ComponentGraph = {
28
- nodes: Map<MarkerNodeId, ComponentGraphNode>;
29
- edges: Map<MarkerNodeId, Set<MarkerNodeId>>;
30
- reverseEdges: Map<MarkerNodeId, Set<MarkerNodeId>>;
31
- levels: MarkerNodeId[][];
32
- };
33
- /**
34
- * Extracts marker graph metadata from rendered HTML and slot linkage data.
35
- *
36
- * This is the canonical graph builder used by marker execution.
37
- *
38
- * Algorithm summary:
39
- * 1. Parse markers from HTML in source order.
40
- * 2. Discover nested child markers captured inside serialized `children` props.
41
- * 3. Create nodes and derive edges from `slotChildrenRegistry`.
42
- * 3. Compute deterministic topological levels.
43
- *
44
- * Unknown child node ids in `slotChildrenRegistry` are ignored to keep the
45
- * extractor tolerant to stale references.
46
- *
47
- * @param html Rendered HTML containing `eco-marker` tokens.
48
- * @param slotChildrenRegistry Optional slot -> child linkage map.
49
- * @param propsRegistry Optional props registry used to discover nested markers
50
- * captured inside deferred parent `children` props.
51
- * @returns Component graph structure with levels ready for execution.
52
- */
53
- export declare function extractComponentGraph(html: string, slotChildrenRegistry?: SlotChildrenRegistry, propsRegistry?: PropsRegistry): ComponentGraph;
@@ -1,94 +0,0 @@
1
- import { parseComponentMarkers } from "./component-marker.js";
2
- function readNestedChildMarkers(marker, propsRegistry) {
3
- const children = propsRegistry[marker.propsRef]?.children;
4
- if (typeof children !== "string" || !children.includes("<eco-marker")) {
5
- return [];
6
- }
7
- return parseComponentMarkers(children);
8
- }
9
- function ensureEdgeMaps(edges, reverseEdges, from, to) {
10
- if (!edges.has(from)) {
11
- edges.set(from, /* @__PURE__ */ new Set());
12
- }
13
- if (!reverseEdges.has(to)) {
14
- reverseEdges.set(to, /* @__PURE__ */ new Set());
15
- }
16
- edges.get(from)?.add(to);
17
- reverseEdges.get(to)?.add(from);
18
- }
19
- function computeLevels(nodes, edges, reverseEdges) {
20
- const indegree = /* @__PURE__ */ new Map();
21
- for (const nodeId of nodes.keys()) {
22
- indegree.set(nodeId, reverseEdges.get(nodeId)?.size ?? 0);
23
- }
24
- const levels = [];
25
- let frontier = [...nodes.values()].filter((node) => (indegree.get(node.nodeId) ?? 0) === 0).sort((a, b) => a.order - b.order).map((node) => node.nodeId);
26
- const visited = /* @__PURE__ */ new Set();
27
- while (frontier.length > 0) {
28
- levels.push(frontier);
29
- const next = [];
30
- for (const current of frontier) {
31
- visited.add(current);
32
- for (const child of edges.get(current) ?? []) {
33
- const nextInDegree = (indegree.get(child) ?? 0) - 1;
34
- indegree.set(child, nextInDegree);
35
- if (nextInDegree === 0) {
36
- next.push(child);
37
- }
38
- }
39
- }
40
- frontier = next.filter((nodeId, index) => next.indexOf(nodeId) === index).sort((a, b) => {
41
- const orderA = nodes.get(a)?.order ?? 0;
42
- const orderB = nodes.get(b)?.order ?? 0;
43
- return orderA - orderB;
44
- });
45
- }
46
- if (visited.size !== nodes.size) {
47
- throw new Error("[ecopages] Component marker graph contains a cycle or unresolved dependency links.");
48
- }
49
- return levels;
50
- }
51
- function extractComponentGraph(html, slotChildrenRegistry = {}, propsRegistry = {}) {
52
- const markers = parseComponentMarkers(html);
53
- const nodes = /* @__PURE__ */ new Map();
54
- const edges = /* @__PURE__ */ new Map();
55
- const reverseEdges = /* @__PURE__ */ new Map();
56
- const discoveredMarkers = [];
57
- const registerMarker = (marker) => {
58
- if (nodes.has(marker.nodeId)) {
59
- return false;
60
- }
61
- discoveredMarkers.push(marker);
62
- nodes.set(marker.nodeId, {
63
- ...marker,
64
- order: discoveredMarkers.length - 1
65
- });
66
- return true;
67
- };
68
- for (const marker of markers) {
69
- registerMarker(marker);
70
- }
71
- for (let index = 0; index < discoveredMarkers.length; index += 1) {
72
- const marker = discoveredMarkers[index];
73
- for (const nestedMarker of readNestedChildMarkers(marker, propsRegistry)) {
74
- registerMarker(nestedMarker);
75
- }
76
- }
77
- for (const marker of discoveredMarkers) {
78
- if (!marker.slotRef) {
79
- continue;
80
- }
81
- const linkedChildren = slotChildrenRegistry[marker.slotRef] ?? [];
82
- for (const childNodeId of linkedChildren) {
83
- if (!nodes.has(childNodeId)) {
84
- continue;
85
- }
86
- ensureEdgeMaps(edges, reverseEdges, marker.nodeId, childNodeId);
87
- }
88
- }
89
- const levels = computeLevels(nodes, edges, reverseEdges);
90
- return { nodes, edges, reverseEdges, levels };
91
- }
92
- export {
93
- extractComponentGraph
94
- };
@@ -1,52 +0,0 @@
1
- /**
2
- * Stable marker node identifier used during one render graph resolution pass.
3
- *
4
- * @example
5
- * `n_12`
6
- */
7
- export type MarkerNodeId = `n_${string}`;
8
- /**
9
- * Marker payload used by graph extraction and execution.
10
- *
11
- * Each marker references:
12
- * - the owning integration renderer (`integration`)
13
- * - a component definition key (`componentRef`)
14
- * - a serialized props key (`propsRef`)
15
- * - optional child-slot linkage (`slotRef`)
16
- */
17
- export type ComponentMarker = {
18
- nodeId: MarkerNodeId;
19
- integration: string;
20
- componentRef: string;
21
- propsRef: string;
22
- slotRef?: string;
23
- };
24
- /**
25
- * Input contract for marker emission.
26
- *
27
- * This shape is intentionally close to `ComponentMarker` to keep emission and
28
- * parsing symmetric.
29
- */
30
- export type MarkerRenderInput = {
31
- nodeId: MarkerNodeId;
32
- integration: string;
33
- componentRef: string;
34
- propsRef: string;
35
- slotRef?: string;
36
- };
37
- /**
38
- * Creates the canonical `<eco-marker>` token used for deferred component rendering.
39
- *
40
- * @param input Marker payload fields.
41
- * @returns Serialized marker HTML token.
42
- */
43
- export declare function createComponentMarker(input: MarkerRenderInput): string;
44
- /**
45
- * Parses all valid `<eco-marker>` tokens from HTML output.
46
- *
47
- * Invalid markers (missing required attributes) are ignored by design.
48
- *
49
- * @param html Rendered HTML fragment or document.
50
- * @returns Parsed marker payloads in source order.
51
- */
52
- export declare function parseComponentMarkers(html: string): ComponentMarker[];
@@ -1,46 +0,0 @@
1
- function escapeAttribute(value) {
2
- return value.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
3
- }
4
- function readAttribute(tag, name) {
5
- const match = tag.match(new RegExp(`${name}="([^"]*)"`));
6
- return match?.[1];
7
- }
8
- function createComponentMarker(input) {
9
- const attributes = [
10
- `data-eco-node-id="${escapeAttribute(input.nodeId)}"`,
11
- `data-eco-integration="${escapeAttribute(input.integration)}"`,
12
- `data-eco-component-ref="${escapeAttribute(input.componentRef)}"`,
13
- `data-eco-props-ref="${escapeAttribute(input.propsRef)}"`
14
- ];
15
- if (input.slotRef) {
16
- attributes.push(`data-eco-slot-ref="${escapeAttribute(input.slotRef)}"`);
17
- }
18
- return `<eco-marker ${attributes.join(" ")}></eco-marker>`;
19
- }
20
- function parseComponentMarkers(html) {
21
- const markerRegex = /<eco-marker\b[^>]*><\/eco-marker>/g;
22
- const results = [];
23
- for (let match = markerRegex.exec(html); match; match = markerRegex.exec(html)) {
24
- const tag = match[0];
25
- const nodeId = readAttribute(tag, "data-eco-node-id");
26
- const integration = readAttribute(tag, "data-eco-integration");
27
- const componentRef = readAttribute(tag, "data-eco-component-ref");
28
- const propsRef = readAttribute(tag, "data-eco-props-ref");
29
- const slotRef = readAttribute(tag, "data-eco-slot-ref");
30
- if (!nodeId || !integration || !componentRef || !propsRef) {
31
- continue;
32
- }
33
- results.push({
34
- nodeId,
35
- integration,
36
- componentRef,
37
- propsRef,
38
- slotRef
39
- });
40
- }
41
- return results;
42
- }
43
- export {
44
- createComponentMarker,
45
- parseComponentMarkers
46
- };
@@ -1,11 +0,0 @@
1
- import type { EcoComponent } from '../../types/public-types.js';
2
- export declare function registerRuntimeComponentHint(component: EcoComponent, hint: string): void;
3
- /**
4
- * Resolves a stable component reference for marker emission and lookup.
5
- *
6
- * Build-time metadata remains the preferred source. When a component is
7
- * imported directly from source on the server and metadata has not been
8
- * injected, fall back to a process-local stable runtime reference so explicit
9
- * request-time rendering can still resolve deferred boundaries.
10
- */
11
- export declare function getComponentReference(component: EcoComponent): string;
@@ -1,39 +0,0 @@
1
- import { rapidhash } from "../../utils/hash.js";
2
- const runtimeComponentRefs = /* @__PURE__ */ new WeakMap();
3
- const runtimeComponentHints = /* @__PURE__ */ new WeakMap();
4
- const runtimeComponentHintSymbol = /* @__PURE__ */ Symbol.for("ecopages.runtimeComponentHint");
5
- let nextRuntimeComponentRef = 0;
6
- function registerRuntimeComponentHint(component, hint) {
7
- runtimeComponentHints.set(component, hint);
8
- component[runtimeComponentHintSymbol] = hint;
9
- }
10
- function getComponentReference(component) {
11
- const metadataRef = component.config?.__eco?.id ?? component.config?.__eco?.file;
12
- if (metadataRef) {
13
- return metadataRef;
14
- }
15
- const existingRef = runtimeComponentRefs.get(component);
16
- if (existingRef) {
17
- return existingRef;
18
- }
19
- const runtimeHint = runtimeComponentHints.get(component);
20
- if (runtimeHint) {
21
- const hintedRef = `eco-runtime-component-${rapidhash(runtimeHint).toString(36)}`;
22
- runtimeComponentRefs.set(component, hintedRef);
23
- return hintedRef;
24
- }
25
- const componentHint = component[runtimeComponentHintSymbol];
26
- if (componentHint) {
27
- const hintedRef = `eco-runtime-component-${rapidhash(componentHint).toString(36)}`;
28
- runtimeComponentRefs.set(component, hintedRef);
29
- return hintedRef;
30
- }
31
- nextRuntimeComponentRef += 1;
32
- const runtimeRef = `eco-runtime-component-${nextRuntimeComponentRef}`;
33
- runtimeComponentRefs.set(component, runtimeRef);
34
- return runtimeRef;
35
- }
36
- export {
37
- getComponentReference,
38
- registerRuntimeComponentHint
39
- };
@@ -1,79 +0,0 @@
1
- import type { ComponentRenderInput, ComponentRenderResult, EcoComponent } from '../../types/public-types.js';
2
- import type { ProcessedAsset } from '../../services/assets/asset-processing-service/index.js';
3
- import type { MarkerNodeId } from './component-marker.js';
4
- /**
5
- * Serializable graph-context payload used during post-render marker resolution.
6
- *
7
- * `propsByRef` stores serialized props captured during the first render pass,
8
- * while `slotChildrenByRef` preserves parent-child marker relationships for
9
- * slot-like composition.
10
- */
11
- export type MarkerGraphContext = {
12
- propsByRef?: Record<string, Record<string, unknown>>;
13
- slotChildrenByRef?: Record<string, MarkerNodeId[]>;
14
- };
15
- /**
16
- * Minimal renderer contract needed for deferred component resolution.
17
- *
18
- * The marker graph resolver intentionally depends only on component-level render
19
- * capabilities, not on the full integration renderer abstraction.
20
- */
21
- export interface MarkerGraphComponentRenderer {
22
- renderComponentForMarkerGraph(input: ComponentRenderInput): Promise<ComponentRenderResult>;
23
- }
24
- export interface MarkerGraphResolverOptions {
25
- html: string;
26
- componentsToResolve: EcoComponent[];
27
- graphContext: MarkerGraphContext;
28
- resolveRenderer: (integrationName: string) => MarkerGraphComponentRenderer;
29
- applyAttributesToFirstElement: (html: string, attributes: Record<string, string>) => string;
30
- instanceIdScope?: string;
31
- }
32
- /**
33
- * Resolves deferred `eco-marker` tokens after the first render pass.
34
- *
35
- * This service owns the second-stage orchestration for cross-integration
36
- * component rendering. It builds a component reference registry, constructs a
37
- * deterministic marker DAG, resolves leaf nodes before parents, and collects any
38
- * component-level assets emitted during that process.
39
- *
40
- * Responsibility split:
41
- * - core resolves marker structure, refs, child ordering, and renderer dispatch
42
- * - the target integration renderer resolves the actual component render through
43
- * `renderComponent()` once the marker has been decoded into component input
44
- */
45
- export declare class MarkerGraphResolver {
46
- private restoreSerializedChildren;
47
- /**
48
- * Resolves every marker in the supplied HTML and returns the final HTML plus
49
- * any assets produced by nested component renders.
50
- *
51
- * The resolver is intentionally fail-fast: missing component refs or props refs
52
- * indicate a broken render graph and should surface immediately instead of
53
- * producing partial output.
54
- *
55
- * The resolver does not render integration-specific HTML itself. Instead, it
56
- * reconstructs `ComponentRenderInput` from the marker payload and then delegates
57
- * the actual rendering to the target integration renderer.
58
- *
59
- * @param options Marker graph resolution inputs for one render pass.
60
- * @returns Resolved HTML and collected component assets.
61
- */
62
- resolve(options: MarkerGraphResolverOptions): Promise<{
63
- html: string;
64
- assets: ProcessedAsset[];
65
- }>;
66
- /**
67
- * Builds a reference registry from the root component set and all nested
68
- * declared component dependencies.
69
- *
70
- * Component refs are keyed by build metadata when available, falling back to a
71
- * stable runtime reference for source-imported components. Traversal is depth-
72
- * first and deduplicated by component identity to remain stable in shared
73
- * dependency graphs.
74
- *
75
- * @param components Root components participating in resolution.
76
- * @returns Lookup table from component ref to component definition.
77
- */
78
- private buildComponentRefRegistry;
79
- }
@@ -1,117 +0,0 @@
1
- import { getComponentReference } from "./component-reference.js";
2
- import { extractComponentGraph } from "./component-graph.js";
3
- import { resolveComponentGraph } from "./component-graph-executor.js";
4
- class MarkerGraphResolver {
5
- restoreSerializedChildren(serializedChildren, childNodeIds, resolvedNodeHtml) {
6
- let restoredChildren = serializedChildren;
7
- for (const childNodeId of childNodeIds) {
8
- const resolvedChildHtml = resolvedNodeHtml.get(childNodeId);
9
- if (!resolvedChildHtml) {
10
- continue;
11
- }
12
- const markerRegex = new RegExp(
13
- `<eco-marker\\b(?=[^>]*data-eco-node-id="${childNodeId}")[^>]*><\\/eco-marker>`,
14
- "g"
15
- );
16
- restoredChildren = restoredChildren.replace(markerRegex, resolvedChildHtml);
17
- }
18
- return restoredChildren;
19
- }
20
- /**
21
- * Resolves every marker in the supplied HTML and returns the final HTML plus
22
- * any assets produced by nested component renders.
23
- *
24
- * The resolver is intentionally fail-fast: missing component refs or props refs
25
- * indicate a broken render graph and should surface immediately instead of
26
- * producing partial output.
27
- *
28
- * The resolver does not render integration-specific HTML itself. Instead, it
29
- * reconstructs `ComponentRenderInput` from the marker payload and then delegates
30
- * the actual rendering to the target integration renderer.
31
- *
32
- * @param options Marker graph resolution inputs for one render pass.
33
- * @returns Resolved HTML and collected component assets.
34
- */
35
- async resolve(options) {
36
- const registry = this.buildComponentRefRegistry(options.componentsToResolve);
37
- const graph = extractComponentGraph(
38
- options.html,
39
- options.graphContext.slotChildrenByRef ?? {},
40
- options.graphContext.propsByRef ?? {}
41
- );
42
- const resolvedNodeHtml = /* @__PURE__ */ new Map();
43
- const assets = [];
44
- const resolvedHtml = await resolveComponentGraph(options.html, graph, async (marker) => {
45
- const component = registry.get(marker.componentRef);
46
- if (!component) {
47
- throw new Error(`[ecopages] Missing component reference for marker: ${marker.componentRef}`);
48
- }
49
- const props = options.graphContext.propsByRef?.[marker.propsRef];
50
- if (!props) {
51
- throw new Error(`[ecopages] Missing props reference for marker: ${marker.propsRef}`);
52
- }
53
- const normalizedProps = { ...props };
54
- let children;
55
- if (marker.slotRef) {
56
- const childNodeIds = options.graphContext.slotChildrenByRef?.[marker.slotRef] ?? [];
57
- if (childNodeIds.length > 0) {
58
- const serializedChildren = normalizedProps.children;
59
- children = typeof serializedChildren === "string" ? this.restoreSerializedChildren(serializedChildren, childNodeIds, resolvedNodeHtml) : childNodeIds.map((childNodeId) => resolvedNodeHtml.get(childNodeId) ?? "").join("");
60
- }
61
- }
62
- const renderer = options.resolveRenderer(marker.integration);
63
- const componentInstanceId = options.instanceIdScope ? `${options.instanceIdScope}_${marker.nodeId}` : marker.nodeId;
64
- const componentRender = await renderer.renderComponentForMarkerGraph({
65
- component,
66
- props: normalizedProps,
67
- children,
68
- integrationContext: {
69
- componentInstanceId
70
- }
71
- });
72
- if (componentRender.assets?.length) {
73
- assets.push(...componentRender.assets);
74
- }
75
- const htmlWithAttributes = componentRender.canAttachAttributes && componentRender.rootAttributes ? options.applyAttributesToFirstElement(componentRender.html, componentRender.rootAttributes) : componentRender.html;
76
- resolvedNodeHtml.set(marker.nodeId, htmlWithAttributes);
77
- return { html: htmlWithAttributes };
78
- });
79
- return {
80
- html: resolvedHtml,
81
- assets
82
- };
83
- }
84
- /**
85
- * Builds a reference registry from the root component set and all nested
86
- * declared component dependencies.
87
- *
88
- * Component refs are keyed by build metadata when available, falling back to a
89
- * stable runtime reference for source-imported components. Traversal is depth-
90
- * first and deduplicated by component identity to remain stable in shared
91
- * dependency graphs.
92
- *
93
- * @param components Root components participating in resolution.
94
- * @returns Lookup table from component ref to component definition.
95
- */
96
- buildComponentRefRegistry(components) {
97
- const registry = /* @__PURE__ */ new Map();
98
- const stack = [...components];
99
- const seen = /* @__PURE__ */ new Set();
100
- while (stack.length > 0) {
101
- const current = stack.pop();
102
- if (!current || seen.has(current)) {
103
- continue;
104
- }
105
- seen.add(current);
106
- registry.set(getComponentReference(current), current);
107
- const nested = current.config?.dependencies?.components ?? [];
108
- for (const component of nested) {
109
- stack.push(component);
110
- }
111
- }
112
- return registry;
113
- }
114
- }
115
- export {
116
- MarkerGraphResolver
117
- };