@ecopages/react 0.2.0-beta.26 → 0.2.0-beta.28

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 (98) hide show
  1. package/README.md +17 -9
  2. package/package.json +42 -34
  3. package/src/{services/react-bundle.service.d.ts → bundling/bundle.d.ts} +7 -7
  4. package/src/{services/react-bundle.service.js → bundling/bundle.js} +9 -11
  5. package/src/{utils → bundling}/discover-layout-runtime-modules.js +2 -2
  6. package/src/{utils/react-runtime-alias-map.d.ts → bundling/runtime-alias-map.d.ts} +3 -3
  7. package/src/{services/react-runtime-bundle.service.d.ts → bundling/runtime-bundle.d.ts} +5 -5
  8. package/src/{services/react-runtime-bundle.service.js → bundling/runtime-bundle.js} +4 -4
  9. package/src/bundling/runtime-mode.d.ts +9 -0
  10. package/src/bundling/runtime-mode.js +6 -0
  11. package/src/{utils/client-graph-ast-transform.d.ts → client-graph/ast-transform.d.ts} +1 -1
  12. package/src/{utils/client-graph-ast-transform.js → client-graph/ast-transform.js} +1 -1
  13. package/src/{utils/client-graph-boundary-cache.d.ts → client-graph/boundary-cache.d.ts} +0 -5
  14. package/src/{utils/client-graph-boundary-cache.js → client-graph/boundary-cache.js} +1 -3
  15. package/src/{utils/client-graph-boundary-plugin.d.ts → client-graph/boundary-plugin.d.ts} +1 -1
  16. package/src/{utils/client-graph-boundary-plugin.js → client-graph/boundary-plugin.js} +3 -3
  17. package/src/{utils/client-graph-reachability.d.ts → client-graph/specifier-classification.d.ts} +1 -1
  18. package/src/{react-hmr-strategy.d.ts → hmr/hmr-strategy.d.ts} +3 -6
  19. package/src/{react-hmr-strategy.js → hmr/hmr-strategy.js} +11 -20
  20. package/src/{services/react-hmr-page-metadata-cache.d.ts → hmr/page-metadata-cache.d.ts} +5 -1
  21. package/src/{services/react-hmr-page-metadata-cache.js → hmr/page-metadata-cache.js} +8 -2
  22. package/src/{services/react-hydration-asset.service.d.ts → hydration/hydration-asset.d.ts} +33 -33
  23. package/src/{services/react-hydration-asset.service.js → hydration/hydration-asset.js} +59 -54
  24. package/src/{utils → hydration}/hydration-scripts.d.ts +34 -41
  25. package/src/hydration/hydration-scripts.js +353 -0
  26. package/src/{utils → hydration}/hydration-scripts.test.browser.js +6 -4
  27. package/src/hydration/page-data-manifest.d.ts +58 -0
  28. package/src/hydration/page-data-manifest.js +53 -0
  29. package/src/hydration/page-data-reader.d.ts +31 -0
  30. package/src/hydration/page-data-reader.js +64 -0
  31. package/src/hydration/page-payload.d.ts +67 -0
  32. package/src/hydration/page-payload.js +104 -0
  33. package/src/hydration/serialize-page-data-script.d.ts +27 -0
  34. package/src/hydration/serialize-page-data-script.js +31 -0
  35. package/src/{services/react-mdx-config-dependency.service.d.ts → mdx/mdx-config-dependency.d.ts} +5 -5
  36. package/src/{services/react-mdx-config-dependency.service.js → mdx/mdx-config-dependency.js} +3 -3
  37. package/src/{services/react-page-module.service.d.ts → page/page-module.d.ts} +4 -7
  38. package/src/{services/react-page-module.service.js → page/page-module.js} +5 -9
  39. package/src/{react.plugin.d.ts → plugin/react.plugin.d.ts} +7 -3
  40. package/src/{react.plugin.js → plugin/react.plugin.js} +32 -30
  41. package/src/{react.types.d.ts → plugin/react.types.d.ts} +23 -8
  42. package/src/render/component-ownership.d.ts +50 -0
  43. package/src/render/component-ownership.js +23 -0
  44. package/src/render/component-ssr.d.ts +113 -0
  45. package/src/render/component-ssr.js +202 -0
  46. package/src/render/errors.d.ts +16 -0
  47. package/src/render/errors.js +18 -0
  48. package/src/{layout-compose.d.ts → render/layout-compose.d.ts} +8 -0
  49. package/src/{layout-compose.js → render/layout-compose.js} +14 -6
  50. package/src/render/react-renderer.d.ts +138 -0
  51. package/src/render/react-renderer.js +482 -0
  52. package/src/render/react-runtime.d.ts +13 -0
  53. package/src/render/react-runtime.js +21 -0
  54. package/src/render/unified-layout-composition.d.ts +53 -0
  55. package/src/render/unified-layout-composition.js +89 -0
  56. package/src/react-renderer.d.ts +0 -254
  57. package/src/react-renderer.js +0 -726
  58. package/src/serialize-page-data-script.d.ts +0 -8
  59. package/src/serialize-page-data-script.js +0 -10
  60. package/src/services/pages-index.d.ts +0 -64
  61. package/src/services/pages-index.js +0 -73
  62. package/src/services/react-page-payload.service.d.ts +0 -46
  63. package/src/services/react-page-payload.service.js +0 -67
  64. package/src/utils/hydration-scripts.js +0 -371
  65. /package/src/{utils → app}/client-only.d.ts +0 -0
  66. /package/src/{utils → app}/client-only.js +0 -0
  67. /package/src/{utils → app}/dynamic.d.ts +0 -0
  68. /package/src/{utils → app}/dynamic.js +0 -0
  69. /package/src/{utils → app}/dynamic.test.browser.d.ts +0 -0
  70. /package/src/{utils → app}/dynamic.test.browser.js +0 -0
  71. /package/src/{utils → bundling}/discover-layout-runtime-modules.d.ts +0 -0
  72. /package/src/{utils/react-runtime-alias-map.js → bundling/runtime-alias-map.js} +0 -0
  73. /package/src/{utils/react-dom-runtime-interop-plugin.d.ts → bundling/runtime-interop-plugin.d.ts} +0 -0
  74. /package/src/{utils/react-dom-runtime-interop-plugin.js → bundling/runtime-interop-plugin.js} +0 -0
  75. /package/src/{utils/react-plugin-runtime-modules.d.ts → bundling/runtime-modules.d.ts} +0 -0
  76. /package/src/{utils/react-plugin-runtime-modules.js → bundling/runtime-modules.js} +0 -0
  77. /package/src/{utils → client-graph}/component-config-traversal.d.ts +0 -0
  78. /package/src/{utils → client-graph}/component-config-traversal.js +0 -0
  79. /package/src/{utils → client-graph}/declared-modules.d.ts +0 -0
  80. /package/src/{utils → client-graph}/declared-modules.js +0 -0
  81. /package/src/{utils → client-graph}/reachability-analyzer.d.ts +0 -0
  82. /package/src/{utils → client-graph}/reachability-analyzer.js +0 -0
  83. /package/src/{utils/client-graph-reachability.js → client-graph/specifier-classification.js} +0 -0
  84. /package/src/{declarations.d.ts → contracts/declarations.d.ts} +0 -0
  85. /package/src/{router-adapter.d.ts → contracts/router-adapter.d.ts} +0 -0
  86. /package/src/{router-adapter.js → contracts/router-adapter.js} +0 -0
  87. /package/src/{utils → hmr}/hmr-scripts.d.ts +0 -0
  88. /package/src/{utils → hmr}/hmr-scripts.js +0 -0
  89. /package/src/{utils → hydration}/hydration-scripts.test.browser.d.ts +0 -0
  90. /package/src/{utils/react-mdx-loader-plugin.d.ts → mdx/mdx-loader-plugin.d.ts} +0 -0
  91. /package/src/{utils/react-mdx-loader-plugin.js → mdx/mdx-loader-plugin.js} +0 -0
  92. /package/src/{react.constants.d.ts → plugin/react.constants.d.ts} +0 -0
  93. /package/src/{react.constants.js → plugin/react.constants.js} +0 -0
  94. /package/src/{react.types.js → plugin/react.types.js} +0 -0
  95. /package/src/{eco-embed.d.ts → render/eco-embed.d.ts} +0 -0
  96. /package/src/{eco-embed.js → render/eco-embed.js} +0 -0
  97. /package/src/{utils → render}/html-boundary.d.ts +0 -0
  98. /package/src/{utils → render}/html-boundary.js +0 -0
@@ -0,0 +1,202 @@
1
+ import { isValidElement } from "react";
2
+ import { hasSingleRootElement } from "./html-boundary.js";
3
+ import { getIslandComponentKey } from "../hydration/hydration-asset.js";
4
+ import { asNonReactShellComponent, asReactComponent } from "./component-ownership.js";
5
+ import { ReactRenderError } from "./errors.js";
6
+ function buildHydrationProps(props) {
7
+ if (!props || !Object.prototype.hasOwnProperty.call(props, "locals")) {
8
+ return props ?? {};
9
+ }
10
+ const { locals: _locals, ...hydrationProps } = props;
11
+ return hydrationProps;
12
+ }
13
+ async function renderNonReactShellComponent(Component, props, label) {
14
+ const output = await Component(props);
15
+ if (typeof output === "string") {
16
+ return output;
17
+ }
18
+ throw new ReactRenderError(`${label} must return a string when used as a mixed shell for React pages.`);
19
+ }
20
+ function renderComponentHtml(options) {
21
+ const { input, context, runtimeContext, runtime, normalizeUnresolvedMarkerArtifactHtml } = options;
22
+ const { react, reactDomServer } = runtime;
23
+ if (input.children === void 0) {
24
+ return normalizeUnresolvedMarkerArtifactHtml(
25
+ reactDomServer.renderToString(react.createElement(asReactComponent(input.component), input.props))
26
+ );
27
+ }
28
+ if (isValidElement(input.children)) {
29
+ return normalizeUnresolvedMarkerArtifactHtml(
30
+ reactDomServer.renderToString(
31
+ react.createElement(asReactComponent(input.component), input.props, input.children)
32
+ )
33
+ );
34
+ }
35
+ const resolvedChildHtml = typeof input.children === "string" ? input.children : String(input.children ?? "");
36
+ const rawChildrenToken = `__ECO_RAW_HTML_CHILD_${context.componentInstanceId ?? "component"}__`;
37
+ if (runtimeContext) {
38
+ runtimeContext.rawChildrenToken = rawChildrenToken;
39
+ runtimeContext.rawChildrenHtml = resolvedChildHtml;
40
+ }
41
+ const html = reactDomServer.renderToString(
42
+ react.createElement(asReactComponent(input.component), input.props, rawChildrenToken)
43
+ );
44
+ return normalizeUnresolvedMarkerArtifactHtml(html.split(rawChildrenToken).join(resolvedChildHtml));
45
+ }
46
+ function toReactNode(children, integrationName) {
47
+ if (children === null || typeof children === "string" || typeof children === "number" || typeof children === "boolean" || isValidElement(children) || Array.isArray(children)) {
48
+ return children;
49
+ }
50
+ throw new TypeError(`[ecopages] ${integrationName} renderer expected a React node child.`);
51
+ }
52
+ function restoreRuntimeChildHtml(html, runtimeContext) {
53
+ if (!runtimeContext?.rawChildrenToken || runtimeContext.rawChildrenHtml === void 0) {
54
+ return html;
55
+ }
56
+ return html.split(runtimeContext.rawChildrenToken).join(runtimeContext.rawChildrenHtml);
57
+ }
58
+ async function renderQueuedChildrenToHtml(options) {
59
+ const {
60
+ children,
61
+ runtimeContext,
62
+ queuedResolutionsByToken,
63
+ resolveToken,
64
+ runtime,
65
+ integrationName,
66
+ normalizeUnresolvedMarkerArtifactHtml,
67
+ resolveQueuedTokens
68
+ } = options;
69
+ if (children === void 0) {
70
+ return void 0;
71
+ }
72
+ const { react, reactDomServer } = runtime;
73
+ let html = normalizeUnresolvedMarkerArtifactHtml(
74
+ reactDomServer.renderToString(
75
+ react.createElement(react.Fragment, null, toReactNode(children, integrationName))
76
+ )
77
+ );
78
+ html = restoreRuntimeChildHtml(html, runtimeContext);
79
+ return await resolveQueuedTokens(html, queuedResolutionsByToken, resolveToken);
80
+ }
81
+ async function renderReactQueuedForeignSubtreeChildren(options) {
82
+ const { currentRuntimeContext, ...rest } = options;
83
+ const renderedHtml = await renderQueuedChildrenToHtml({
84
+ ...rest,
85
+ runtimeContext: currentRuntimeContext
86
+ });
87
+ if (renderedHtml === void 0) {
88
+ return { assets: [] };
89
+ }
90
+ return {
91
+ assets: [],
92
+ html: renderedHtml
93
+ };
94
+ }
95
+ async function renderForeignComponentWithSerializedHtml(options) {
96
+ const {
97
+ input,
98
+ runtimeContext,
99
+ integrationName,
100
+ canResolveAssets,
101
+ processComponentDependencies,
102
+ dedupeProcessedAssets,
103
+ getRootTagName,
104
+ resolveQueuedForeignSubtreeHtml
105
+ } = options;
106
+ let props = input.props;
107
+ if (input.children !== void 0) {
108
+ props = {
109
+ ...input.props,
110
+ children: typeof input.children === "string" ? input.children : String(input.children ?? "")
111
+ };
112
+ }
113
+ const html = await renderNonReactShellComponent(
114
+ asNonReactShellComponent(input.component),
115
+ props,
116
+ "Component"
117
+ );
118
+ const hasDependencies = Boolean(input.component.config?.dependencies);
119
+ const assets = hasDependencies && canResolveAssets ? await processComponentDependencies([input.component]) : void 0;
120
+ const queuedForeignSubtreeResolution = await resolveQueuedForeignSubtreeHtml(html, runtimeContext);
121
+ const mergedAssets = dedupeProcessedAssets([...assets ?? [], ...queuedForeignSubtreeResolution.assets]);
122
+ return {
123
+ html: queuedForeignSubtreeResolution.html,
124
+ canAttachAttributes: true,
125
+ rootTag: getRootTagName(queuedForeignSubtreeResolution.html),
126
+ integrationName,
127
+ assets: mergedAssets.length > 0 ? mergedAssets : void 0
128
+ };
129
+ }
130
+ async function renderReactManagedComponent(options) {
131
+ const {
132
+ input,
133
+ runtimeContext,
134
+ runtime,
135
+ integrationName,
136
+ normalizeUnresolvedMarkerArtifactHtml,
137
+ resolveQueuedForeignSubtreeHtml,
138
+ getRootTagName,
139
+ dedupeProcessedAssets,
140
+ hydrationAssetService,
141
+ canBuildIslandAssets
142
+ } = options;
143
+ const componentConfig = input.component.config;
144
+ const context = {
145
+ componentInstanceId: input.integrationContext?.componentInstanceId
146
+ };
147
+ const hasResolvedChildHtml = input.children !== void 0;
148
+ let html = renderComponentHtml({
149
+ input,
150
+ context,
151
+ runtimeContext,
152
+ runtime,
153
+ normalizeUnresolvedMarkerArtifactHtml
154
+ });
155
+ const queuedForeignSubtreeResolution = await resolveQueuedForeignSubtreeHtml(html, runtimeContext);
156
+ html = queuedForeignSubtreeResolution.html;
157
+ const canAttachAttributes = hasSingleRootElement(html);
158
+ const rootTag = getRootTagName(html);
159
+ const componentFile = componentConfig?.__eco?.file;
160
+ let rootAttributes;
161
+ let assets;
162
+ if (canAttachAttributes && componentFile && context.componentInstanceId && canBuildIslandAssets && !hasResolvedChildHtml) {
163
+ const componentInstanceId = context.componentInstanceId;
164
+ assets = await hydrationAssetService.buildComponentRenderAssets(componentFile, componentConfig);
165
+ rootAttributes = {
166
+ "data-eco-component-id": componentInstanceId,
167
+ "data-eco-component-key": getIslandComponentKey(componentFile, componentConfig),
168
+ "data-eco-props": btoa(JSON.stringify(buildHydrationProps(input.props)))
169
+ };
170
+ }
171
+ const mergedAssets = dedupeProcessedAssets([...assets ?? [], ...queuedForeignSubtreeResolution.assets]);
172
+ return {
173
+ html,
174
+ canAttachAttributes,
175
+ rootTag,
176
+ integrationName,
177
+ rootAttributes,
178
+ assets: mergedAssets.length > 0 ? mergedAssets : void 0
179
+ };
180
+ }
181
+ function createForeignSubtreeRuntimeContext(options) {
182
+ return {
183
+ rendererCache: options.rendererCache,
184
+ componentInstanceScope: options.componentInstanceScope,
185
+ nextForeignSubtreeId: 0,
186
+ queuedResolutions: [],
187
+ rawChildrenToken: void 0,
188
+ rawChildrenHtml: void 0
189
+ };
190
+ }
191
+ export {
192
+ buildHydrationProps,
193
+ createForeignSubtreeRuntimeContext,
194
+ renderComponentHtml,
195
+ renderForeignComponentWithSerializedHtml,
196
+ renderNonReactShellComponent,
197
+ renderQueuedChildrenToHtml,
198
+ renderReactManagedComponent,
199
+ renderReactQueuedForeignSubtreeChildren,
200
+ restoreRuntimeChildHtml,
201
+ toReactNode
202
+ };
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Errors thrown by the React integration renderer and bundling paths.
3
+ */
4
+ /**
5
+ * Error thrown when an error occurs while rendering a React component.
6
+ */
7
+ export declare class ReactRenderError extends Error {
8
+ constructor(message: string);
9
+ }
10
+ /**
11
+ * Error thrown when an error occurs while bundling a React component.
12
+ */
13
+ export declare class BundleError extends Error {
14
+ readonly logs: string[];
15
+ constructor(message: string, logs: string[]);
16
+ }
@@ -0,0 +1,18 @@
1
+ class ReactRenderError extends Error {
2
+ constructor(message) {
3
+ super(message);
4
+ this.name = "ReactRenderError";
5
+ }
6
+ }
7
+ class BundleError extends Error {
8
+ logs;
9
+ constructor(message, logs) {
10
+ super(message);
11
+ this.name = "BundleError";
12
+ this.logs = logs;
13
+ }
14
+ }
15
+ export {
16
+ BundleError,
17
+ ReactRenderError
18
+ };
@@ -8,6 +8,14 @@ export type LayoutComposeOptions = {
8
8
  context?: LayoutComposeContext;
9
9
  /** @remarks Pass the app-resolved React runtime during SSR so composition matches `renderToString`. */
10
10
  react?: ReactRuntime;
11
+ /**
12
+ * Optional resolver that substitutes cached layout instances and React keys
13
+ * for SPA layout persistence.
14
+ */
15
+ resolvePersistedTier?: (layout: EcoComponent, index: number) => {
16
+ layout: EcoComponent;
17
+ key?: string;
18
+ };
11
19
  };
12
20
  export type LayoutShellEntry = {
13
21
  component: EcoComponent;
@@ -58,19 +58,27 @@ function composeLayoutPageTree(Page, pageProps, options) {
58
58
  const context = options?.context ?? resolveLayoutContext(pageProps);
59
59
  const pageElement = createElement(Page, pageProps);
60
60
  const layoutEntries = Page.config?.layoutEntries;
61
+ const resolvePersistedTier = options?.resolvePersistedTier;
61
62
  if (layoutEntries && layoutEntries.length > 0) {
62
- return [...layoutEntries].reverse().reduce((children, entry) => {
63
+ return [...layoutEntries].reverse().reduce((children, entry, reverseIndex) => {
64
+ const index = layoutEntries.length - 1 - reverseIndex;
63
65
  const layoutProps = resolveLayoutEntryProps(entry, context);
64
- return createElement(toReactComponent(entry.component), layoutProps, children);
66
+ const tier = resolvePersistedTier?.(entry.component, index);
67
+ const Layout = toReactComponent(tier?.layout ?? entry.component);
68
+ const elementProps = tier?.key ? { key: tier.key, ...layoutProps } : layoutProps;
69
+ return createElement(Layout, elementProps, children);
65
70
  }, pageElement);
66
71
  }
67
72
  const layouts = Page.config?.layouts;
68
73
  if (layouts && layouts.length > 0) {
69
74
  const layoutProps = context.locals ? { locals: context.locals } : {};
70
- return [...layouts].reverse().reduce(
71
- (children, Layout) => createElement(toReactComponent(Layout), layoutProps, children),
72
- pageElement
73
- );
75
+ return [...layouts].reverse().reduce((children, Layout, reverseIndex) => {
76
+ const index = layouts.length - 1 - reverseIndex;
77
+ const tier = resolvePersistedTier?.(Layout, index);
78
+ const ResolvedLayout = toReactComponent(tier?.layout ?? Layout);
79
+ const elementProps = tier?.key ? { key: tier.key, ...layoutProps } : layoutProps;
80
+ return createElement(ResolvedLayout, elementProps, children);
81
+ }, pageElement);
74
82
  }
75
83
  return pageElement;
76
84
  }
@@ -0,0 +1,138 @@
1
+ /**
2
+ * React IntegrationRenderer orchestrator.
3
+ *
4
+ * @remarks
5
+ * Wires services and delegates SSR / layout composition / ownership details to
6
+ * focused modules under `render/`. Prefer changing those modules for
7
+ * implementation work; keep this file as the IntegrationRenderer seam.
8
+ *
9
+ * @module
10
+ */
11
+ import type { ComponentRenderInput, ComponentRenderResult, EcoComponent, EcoPageFile, IntegrationRendererRenderOptions, PageMetadataProps, RouteRendererBody } from '@ecopages/core';
12
+ import { IntegrationRenderer, type HtmlDocumentContribution, type HtmlDocumentContributionContext, type PageBrowserGraphContributionContext, type RenderToResponseContext } from '@ecopages/core/route-renderer/orchestration/integration-renderer';
13
+ import type { AssetDefinition, ProcessedAsset } from '@ecopages/core/services/asset-processing-service';
14
+ import type { ReactNode } from 'react';
15
+ import type { ReactRendererConfig } from '../plugin/react.types.js';
16
+ import { BundleService } from '../bundling/bundle.js';
17
+ import { MdxConfigDependencyService } from '../mdx/mdx-config-dependency.js';
18
+ import { PageModuleService } from '../page/page-module.js';
19
+ import { PagePayloadService } from '../hydration/page-payload.js';
20
+ import { HydrationAssetService } from '../hydration/hydration-asset.js';
21
+ import { type DocumentShellLayoutInput } from '@ecopages/core/route-renderer/orchestration/document-shell/document-shell-render.service';
22
+ import { type ReactRuntimeModules } from './react-runtime.js';
23
+ export type { ReactRendererConfig } from '../plugin/react.types.js';
24
+ export { BundleError, ReactRenderError } from './errors.js';
25
+ export type ReactRendererOptions = ConstructorParameters<typeof IntegrationRenderer>[0] & {
26
+ reactConfig?: ReactRendererConfig;
27
+ };
28
+ /**
29
+ * Renderer for React components.
30
+ * @extends IntegrationRenderer
31
+ */
32
+ export declare class ReactRenderer extends IntegrationRenderer<ReactNode> {
33
+ name: string;
34
+ componentDirectory: string;
35
+ private reactRuntimeModules?;
36
+ private readonly routerAdapter?;
37
+ private readonly mdxCompilerOptions?;
38
+ private readonly mdxExtensions;
39
+ private readonly hmrPageMetadataCache?;
40
+ /**
41
+ * When true, always emit page browser graph / hydration assets for React pages.
42
+ *
43
+ * Mapped from the public `explicitGraph` plugin option. Does not disable the
44
+ * client-graph AST boundary.
45
+ */
46
+ private readonly forceBrowserGraph;
47
+ /** @internal */
48
+ readonly bundleService: BundleService;
49
+ /** @internal */
50
+ readonly pageModuleService: PageModuleService;
51
+ /** @internal */
52
+ readonly hydrationAssetService: HydrationAssetService;
53
+ /** @internal */
54
+ readonly pagePayloadService: PagePayloadService;
55
+ /** @internal */
56
+ readonly mdxConfigDependencyService: MdxConfigDependencyService;
57
+ constructor(options: ReactRendererOptions);
58
+ private getRouterDocumentAttributes;
59
+ protected resolveReactRuntimeModules(): ReactRuntimeModules;
60
+ private getReactRuntimeModules;
61
+ /**
62
+ * Appends route hydration assets for a concrete page/view file to the current
63
+ * HTML transformer state.
64
+ */
65
+ private appendHydrationAssetsForFile;
66
+ private resolveOwningRenderer;
67
+ private resolveReactQueuedForeignSubtreeHtml;
68
+ /**
69
+ * Renders a React component for component-level orchestration.
70
+ *
71
+ * Behavior:
72
+ * - SSR always returns the component's own root HTML (no synthetic wrapper).
73
+ * - When an explicit component instance id is provided, a stable
74
+ * `data-eco-component-id` attribute is attached so island hydration can target it.
75
+ * - Without an explicit instance id, component renders remain plain SSR output.
76
+ * - When resolved child HTML is provided, that foreign subtree is treated as a pure SSR
77
+ * composition step and does not emit hydration assets for the parent wrapper.
78
+ *
79
+ * This preserves DOM shape for global CSS/layout selectors while keeping a
80
+ * deterministic mount target per component instance.
81
+ */
82
+ renderComponent(input: ComponentRenderInput): Promise<ComponentRenderResult>;
83
+ protected createForeignChildRuntime(options: {
84
+ renderInput: ComponentRenderInput;
85
+ rendererCache: Map<string, IntegrationRenderer<any>>;
86
+ }): import("@ecopages/core").ForeignChildRuntime;
87
+ /**
88
+ * Checks if the given file path corresponds to an MDX file based on configured extensions.
89
+ * @param filePath - The file path to check
90
+ * @returns True if the file is an MDX file
91
+ */
92
+ isMdxFile(filePath: string): boolean;
93
+ protected normalizeImportedPageFile<TPageModule extends EcoPageFile>(file: string, pageModule: TPageModule): TPageModule;
94
+ protected collectPageBrowserGraphContribution(context: PageBrowserGraphContributionContext): Promise<{
95
+ dependencies?: AssetDefinition[];
96
+ assets?: ProcessedAsset[];
97
+ }>;
98
+ private composeReactLayoutPageChildrenForShell;
99
+ protected renderPageWithDocumentShell(input: {
100
+ page: {
101
+ component: EcoComponent;
102
+ props: Record<string, unknown>;
103
+ };
104
+ layout?: DocumentShellLayoutInput;
105
+ layouts?: DocumentShellLayoutInput[];
106
+ htmlTemplate: EcoComponent;
107
+ metadata: PageMetadataProps;
108
+ pageProps: Record<string, unknown>;
109
+ documentProps?: Record<string, unknown>;
110
+ transformDocumentHtml?: (html: string) => string;
111
+ }): Promise<string>;
112
+ /**
113
+ * Renders a full route response for the filesystem page pipeline.
114
+ *
115
+ * This path receives already-resolved route metadata, layout, locals, and HTML
116
+ * template instances from the shared renderer orchestration. Its main job is to
117
+ * serialize only the browser-safe page payload, compose the mixed React/non-
118
+ * React shell tree, and hand the result back as a document body.
119
+ */
120
+ render({ params, query, props, locals, pageLocals, metadata, Page, Layout, HtmlTemplate, pageProps, pagePackage, }: IntegrationRendererRenderOptions<ReactNode>): Promise<RouteRendererBody>;
121
+ protected getHtmlDocumentContributions(options: HtmlDocumentContributionContext<ReactNode>): HtmlDocumentContribution[] | undefined;
122
+ protected getDocumentAttributes(): Record<string, string> | undefined;
123
+ protected renderViewWithDocumentShell<P>(input: {
124
+ view: EcoComponent<P>;
125
+ props: P;
126
+ ctx: RenderToResponseContext;
127
+ layout?: EcoComponent;
128
+ }): Promise<Response>;
129
+ /**
130
+ * Renders an arbitrary React view through the application's HTML shell.
131
+ *
132
+ * Unlike route rendering, this path starts from a single component rather than a
133
+ * page module discovered by the router. It still needs to resolve metadata,
134
+ * layout dependencies, and hydration assets so direct `ctx.render()` calls match
135
+ * normal page responses.
136
+ */
137
+ renderToResponse<P = Record<string, unknown>>(view: EcoComponent<P>, props: P, ctx: RenderToResponseContext): Promise<Response>;
138
+ }