@ecopages/react 0.2.1-beta.0 → 0.3.0

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 (181) hide show
  1. package/README.md +164 -28
  2. package/package.json +67 -30
  3. package/src/app/client-only.js +10 -0
  4. package/src/app/dynamic.js +9 -0
  5. package/src/app/dynamic.test.browser.js +38 -0
  6. package/src/bundling/bootstrap-package-paths.d.ts +5 -0
  7. package/src/bundling/bootstrap-package-paths.js +5 -0
  8. package/src/{services/react-bundle.service.d.ts → bundling/bundle.d.ts} +29 -11
  9. package/src/bundling/bundle.js +130 -0
  10. package/src/bundling/runtime-alias-map.d.ts +12 -0
  11. package/src/bundling/runtime-alias-map.js +110 -0
  12. package/src/bundling/runtime-bundle.d.ts +70 -0
  13. package/src/bundling/runtime-bundle.js +233 -0
  14. package/src/{utils/react-dom-runtime-interop-plugin.d.ts → bundling/runtime-interop-plugin.d.ts} +1 -1
  15. package/src/bundling/runtime-interop-plugin.js +32 -0
  16. package/src/bundling/runtime-mode.d.ts +1 -0
  17. package/src/bundling/runtime-mode.js +10 -0
  18. package/src/bundling/runtime-modules.d.ts +21 -0
  19. package/src/bundling/runtime-modules.js +28 -0
  20. package/src/client-graph/ast-transform-eco-page.d.ts +10 -0
  21. package/src/client-graph/ast-transform-eco-page.js +71 -0
  22. package/src/client-graph/ast-transform-import-edits.d.ts +13 -0
  23. package/src/client-graph/ast-transform-import-edits.js +75 -0
  24. package/src/client-graph/ast-transform-walk-imports.d.ts +20 -0
  25. package/src/client-graph/ast-transform-walk-imports.js +105 -0
  26. package/src/client-graph/ast-transform.d.ts +12 -0
  27. package/src/client-graph/ast-transform.js +91 -0
  28. package/src/client-graph/ast-walk.d.ts +10 -0
  29. package/src/client-graph/ast-walk.js +26 -0
  30. package/src/client-graph/boundary-plugin-read-file-inline.d.ts +7 -0
  31. package/src/client-graph/boundary-plugin-read-file-inline.js +43 -0
  32. package/src/client-graph/boundary-plugin-transform.d.ts +16 -0
  33. package/src/client-graph/boundary-plugin-transform.js +31 -0
  34. package/src/client-graph/boundary-plugin.d.ts +23 -0
  35. package/src/client-graph/boundary-plugin.js +177 -0
  36. package/src/client-graph/component-config-traversal.js +77 -0
  37. package/src/client-graph/declared-modules.js +69 -0
  38. package/src/client-graph/module-classification.d.ts +3 -0
  39. package/src/client-graph/module-classification.js +43 -0
  40. package/src/client-graph/reachability-analyzer.d.ts +26 -0
  41. package/src/client-graph/reachability-analyzer.js +55 -0
  42. package/src/client-graph/reachability-client-roots.d.ts +8 -0
  43. package/src/client-graph/reachability-client-roots.js +59 -0
  44. package/src/client-graph/reachability-export-names.d.ts +5 -0
  45. package/src/client-graph/reachability-export-names.js +34 -0
  46. package/src/client-graph/reachability-fallback-roots.d.ts +3 -0
  47. package/src/client-graph/reachability-fallback-roots.js +71 -0
  48. package/src/client-graph/reachability-preload.d.ts +10 -0
  49. package/src/client-graph/reachability-preload.js +30 -0
  50. package/src/client-graph/reachability-top-level-index.d.ts +14 -0
  51. package/src/client-graph/reachability-top-level-index.js +93 -0
  52. package/src/client-graph/reachability-traverse.d.ts +7 -0
  53. package/src/client-graph/reachability-traverse.js +201 -0
  54. package/src/client-graph/specifier-classification.d.ts +74 -0
  55. package/src/client-graph/specifier-classification.js +191 -0
  56. package/src/content/collection-component-cache.d.ts +25 -0
  57. package/src/content/collection-component-cache.js +62 -0
  58. package/src/contracts/router-adapter.js +6 -0
  59. package/src/dev-transform/react-dev-transform-contributor.d.ts +17 -0
  60. package/src/dev-transform/react-dev-transform-contributor.js +22 -0
  61. package/src/hmr/hmr-strategy-process.d.ts +34 -0
  62. package/src/hmr/hmr-strategy-process.js +83 -0
  63. package/src/hmr/hmr-strategy.d.ts +67 -0
  64. package/src/hmr/hmr-strategy.js +306 -0
  65. package/src/{services/react-hmr-page-metadata-cache.d.ts → hmr/page-metadata-cache.d.ts} +5 -1
  66. package/src/hmr/page-metadata-cache.js +44 -0
  67. package/src/hmr/react-hmr-dev-transform-plugins.d.ts +22 -0
  68. package/src/hmr/react-hmr-dev-transform-plugins.js +19 -0
  69. package/src/hydration/assert-no-bare-ecopages-imports.d.ts +4 -0
  70. package/src/hydration/assert-no-bare-ecopages-imports.js +7 -0
  71. package/src/hydration/bootstrap-imports.d.ts +25 -0
  72. package/src/hydration/bootstrap-imports.js +33 -0
  73. package/src/hydration/browser/island-hydration.d.ts +82 -0
  74. package/src/hydration/browser/island-hydration.js +251 -0
  75. package/src/hydration/browser/page-hydration-hmr.d.ts +11 -0
  76. package/src/hydration/browser/page-hydration-hmr.js +56 -0
  77. package/src/hydration/browser/page-hydration-module.d.ts +8 -0
  78. package/src/hydration/browser/page-hydration-module.js +17 -0
  79. package/src/hydration/browser/page-hydration.d.ts +54 -0
  80. package/src/hydration/browser/page-hydration.js +177 -0
  81. package/src/hydration/compiled-page-hydration-options.d.ts +20 -0
  82. package/src/hydration/hydration-asset.d.ts +127 -0
  83. package/src/hydration/hydration-asset.js +379 -0
  84. package/src/hydration/hydration-lifecycle.test.browser.d.ts +1 -0
  85. package/src/hydration/hydration-lifecycle.test.browser.js +461 -0
  86. package/src/hydration/hydration-page-entry-source.d.ts +5 -0
  87. package/src/hydration/hydration-page-entry-source.js +87 -0
  88. package/src/hydration/hydration-script-compiler.d.ts +48 -0
  89. package/src/hydration/hydration-script-compiler.js +213 -0
  90. package/src/hydration/page-data-manifest.d.ts +58 -0
  91. package/src/hydration/page-data-manifest.js +97 -0
  92. package/src/hydration/page-data-reader.d.ts +17 -0
  93. package/src/hydration/page-data-reader.js +31 -0
  94. package/src/hydration/page-payload.d.ts +68 -0
  95. package/src/hydration/page-payload.js +106 -0
  96. package/src/hydration/serialize-page-data-script.d.ts +27 -0
  97. package/src/hydration/serialize-page-data-script.js +30 -0
  98. package/src/{services/react-mdx-config-dependency.service.d.ts → mdx/mdx-config-dependency.d.ts} +9 -8
  99. package/src/mdx/mdx-config-dependency.js +107 -0
  100. package/src/mdx/mdx-loader-plugin.d.ts +8 -0
  101. package/src/mdx/mdx-loader-plugin.js +11 -0
  102. package/src/page/page-module.d.ts +46 -0
  103. package/src/page/page-module.js +74 -0
  104. package/src/plugin/react.constants.js +1 -0
  105. package/src/{react.plugin.d.ts → plugin/react.plugin.d.ts} +21 -27
  106. package/src/plugin/react.plugin.js +210 -0
  107. package/src/plugin/react.types.d.ts +106 -0
  108. package/src/plugin/react.types.js +1 -0
  109. package/src/render/component-ownership.d.ts +49 -0
  110. package/src/render/component-ownership.js +47 -0
  111. package/src/render/component-ssr.d.ts +59 -0
  112. package/src/render/component-ssr.js +76 -0
  113. package/src/render/eco-embed.js +9 -0
  114. package/src/render/errors.d.ts +16 -0
  115. package/src/render/errors.js +23 -0
  116. package/src/render/html-boundary.js +59 -0
  117. package/src/render/layout-compose.d.ts +66 -0
  118. package/src/render/layout-compose.js +134 -0
  119. package/src/render/react-renderer.d.ts +114 -0
  120. package/src/render/react-renderer.js +490 -0
  121. package/src/render/react-runtime.d.ts +13 -0
  122. package/src/render/react-runtime.js +26 -0
  123. package/src/render/unified-layout-composition.d.ts +22 -0
  124. package/src/render/unified-layout-composition.js +31 -0
  125. package/src/runtime/use-sync-external-store-with-selector.js +52 -54
  126. package/src/eco-embed.js +0 -11
  127. package/src/react-hmr-strategy.d.ts +0 -230
  128. package/src/react-hmr-strategy.js +0 -657
  129. package/src/react-renderer.d.ts +0 -233
  130. package/src/react-renderer.js +0 -622
  131. package/src/react.constants.js +0 -4
  132. package/src/react.plugin.js +0 -205
  133. package/src/react.types.d.ts +0 -88
  134. package/src/react.types.js +0 -0
  135. package/src/router-adapter.js +0 -0
  136. package/src/services/pages-index.d.ts +0 -64
  137. package/src/services/pages-index.js +0 -73
  138. package/src/services/react-bundle.service.js +0 -86
  139. package/src/services/react-hmr-page-metadata-cache.js +0 -35
  140. package/src/services/react-hydration-asset.service.d.ts +0 -84
  141. package/src/services/react-hydration-asset.service.js +0 -217
  142. package/src/services/react-mdx-config-dependency.service.js +0 -122
  143. package/src/services/react-page-module.service.d.ts +0 -88
  144. package/src/services/react-page-module.service.js +0 -166
  145. package/src/services/react-page-payload.service.d.ts +0 -46
  146. package/src/services/react-page-payload.service.js +0 -67
  147. package/src/services/react-runtime-bundle.service.d.ts +0 -45
  148. package/src/services/react-runtime-bundle.service.js +0 -186
  149. package/src/utils/client-graph-boundary-cache.d.ts +0 -108
  150. package/src/utils/client-graph-boundary-cache.js +0 -116
  151. package/src/utils/client-graph-boundary-plugin.d.ts +0 -51
  152. package/src/utils/client-graph-boundary-plugin.js +0 -552
  153. package/src/utils/client-only.js +0 -19
  154. package/src/utils/component-config-traversal.js +0 -54
  155. package/src/utils/declared-modules.js +0 -47
  156. package/src/utils/dynamic.js +0 -12
  157. package/src/utils/dynamic.test.browser.js +0 -33
  158. package/src/utils/hmr-scripts.d.ts +0 -18
  159. package/src/utils/hmr-scripts.js +0 -31
  160. package/src/utils/html-boundary.js +0 -55
  161. package/src/utils/hydration-scripts.d.ts +0 -92
  162. package/src/utils/hydration-scripts.js +0 -358
  163. package/src/utils/hydration-scripts.test.browser.js +0 -198
  164. package/src/utils/reachability-analyzer.d.ts +0 -66
  165. package/src/utils/reachability-analyzer.js +0 -339
  166. package/src/utils/react-dom-runtime-interop-plugin.js +0 -38
  167. package/src/utils/react-mdx-loader-plugin.d.ts +0 -3
  168. package/src/utils/react-mdx-loader-plugin.js +0 -45
  169. package/src/utils/react-runtime-alias-map.d.ts +0 -8
  170. package/src/utils/react-runtime-alias-map.js +0 -90
  171. /package/src/{utils → app}/client-only.d.ts +0 -0
  172. /package/src/{utils → app}/dynamic.d.ts +0 -0
  173. /package/src/{utils → app}/dynamic.test.browser.d.ts +0 -0
  174. /package/src/{utils → client-graph}/component-config-traversal.d.ts +0 -0
  175. /package/src/{utils → client-graph}/declared-modules.d.ts +0 -0
  176. /package/src/{declarations.d.ts → contracts/declarations.d.ts} +0 -0
  177. /package/src/{router-adapter.d.ts → contracts/router-adapter.d.ts} +0 -0
  178. /package/src/{utils/hydration-scripts.test.browser.d.ts → hydration/compiled-page-hydration-options.js} +0 -0
  179. /package/src/{react.constants.d.ts → plugin/react.constants.d.ts} +0 -0
  180. /package/src/{eco-embed.d.ts → render/eco-embed.d.ts} +0 -0
  181. /package/src/{utils → render}/html-boundary.d.ts +0 -0
@@ -0,0 +1,177 @@
1
+ /**
2
+ * Browser-side React page lifecycle.
3
+ *
4
+ * @remarks
5
+ * The entry module supplies the page tree and module resolution details. This
6
+ * module owns document state, navigation ownership, cleanup, and HMR so those
7
+ * behaviors stay identical for readable and compiled bootstraps.
8
+ */
9
+ export { resolvePageModule } from './page-hydration-module.js';
10
+ import { handlePageHmr } from './page-hydration-hmr.js';
11
+ /** Returns and lazily initializes the shared page runtime on `window`. */
12
+ function getRuntime() {
13
+ const pageWindow = window;
14
+ const runtime = (pageWindow.__ECO_PAGES__ ??= {});
15
+ runtime.react ??= {};
16
+ return runtime;
17
+ }
18
+ /** Records the development hydration duration when the dev marker is present. */
19
+ function recordHydrationTiming() {
20
+ const pageWindow = window;
21
+ if (pageWindow.__ECO_DEV_HYDRATION_STARTED__ == null)
22
+ return;
23
+ pageWindow.__ECO_DEV_HYDRATION_MS__ = Math.round(performance.now() - pageWindow.__ECO_DEV_HYDRATION_STARTED__);
24
+ }
25
+ /** Reads the current page-data document through the shared reader contract. */
26
+ function readPageData(options) {
27
+ return options.pageDataReader.readPageDataDocument();
28
+ }
29
+ /** Publishes the current module URL and props for router/navigation consumers. */
30
+ function setPageState(options, pageData) {
31
+ const runtime = getRuntime();
32
+ runtime.page = {
33
+ module: pageData.moduleUrl || options.pageModuleUrl,
34
+ props: pageData.props,
35
+ };
36
+ }
37
+ /**
38
+ * Invalidates pending startup, releases the page root, and hands navigation
39
+ * ownership back to the document runtime.
40
+ *
41
+ * @remarks
42
+ * Incrementing the generation prevents an already-running preload from
43
+ * hydrating after cleanup. The pending promise is cleared so a later page can
44
+ * start independently while the old preload settles.
45
+ */
46
+ function cleanupPageRoot(root) {
47
+ const runtime = getRuntime();
48
+ if (runtime.react) {
49
+ runtime.react.mountGeneration = (runtime.react.mountGeneration ?? 0) + 1;
50
+ delete runtime.react.mountPromise;
51
+ }
52
+ const activeRoot = runtime.react?.pageRoot || root;
53
+ runtime.react.pageRoot = null;
54
+ runtime.navigation?.releaseOwnership?.('react-router');
55
+ delete runtime.page;
56
+ activeRoot?.unmount();
57
+ }
58
+ /** Registers React Router as the page navigation owner when this page uses it. */
59
+ function registerRouterOwnership(options) {
60
+ if (!options.hasRouter)
61
+ return;
62
+ const runtime = getRuntime();
63
+ const ownerState = runtime.navigation?.getOwnerState?.();
64
+ if (ownerState?.owner === 'react-router' && ownerState.canHandleSpaNavigation)
65
+ return;
66
+ runtime.navigation?.register?.({
67
+ owner: 'react-router',
68
+ cleanupBeforeHandoff: async () => cleanupPageRoot(runtime.react?.pageRoot ?? null),
69
+ });
70
+ runtime.navigation?.claimOwnership?.('react-router');
71
+ }
72
+ /**
73
+ * Checks whether asynchronous work still belongs to the current page instance.
74
+ *
75
+ * @remarks
76
+ * Cleanup increments this token before unmounting. Any import or preload that
77
+ * settles afterward must leave the document alone, even if a new page has
78
+ * already mounted a root in the same global runtime slot.
79
+ */
80
+ function isCurrentMountGeneration(generation) {
81
+ return (getRuntime().react?.mountGeneration ?? 0) === generation;
82
+ }
83
+ /**
84
+ * Registers HMR before initial preload and binds it to this page generation.
85
+ *
86
+ * @remarks
87
+ * The global handler index can outlive the page. Capturing the generation here
88
+ * makes retained callbacks inert after cleanup, including calls that begin only
89
+ * after another page has mounted. Reactivation renews this binding for the
90
+ * new generation.
91
+ */
92
+ function registerHmr(options) {
93
+ if (!options.hmr)
94
+ return;
95
+ const runtime = getRuntime();
96
+ const generation = runtime.react?.mountGeneration ?? 0;
97
+ runtime.hmrHandlers ??= {};
98
+ runtime.hmrHandlers[options.hmr.importPath] = (newUrl) => handlePageHmr(options, newUrl, generation, readPageData, setPageState, (opts) => opts.pageDataReader.getPageDataFromDocument());
99
+ }
100
+ /**
101
+ * Coalesces concurrent page starts into one promise.
102
+ *
103
+ * @remarks
104
+ * Rerun scripts and DOM-ready callbacks can arrive together. Sharing the
105
+ * pending promise prevents two calls to `hydrateRoot` for document.body.
106
+ */
107
+ async function mount(options) {
108
+ const runtime = getRuntime();
109
+ const reactRuntime = runtime.react;
110
+ if (reactRuntime.mountPromise)
111
+ return reactRuntime.mountPromise;
112
+ const generation = reactRuntime.mountGeneration ?? 0;
113
+ const pendingMount = mountPage(options, generation);
114
+ reactRuntime.mountPromise = pendingMount;
115
+ pendingMount.then(() => {
116
+ if (reactRuntime.mountPromise === pendingMount)
117
+ delete reactRuntime.mountPromise;
118
+ }, () => {
119
+ if (reactRuntime.mountPromise === pendingMount)
120
+ delete reactRuntime.mountPromise;
121
+ });
122
+ return pendingMount;
123
+ }
124
+ /** Performs one page start after the caller has reserved the current generation. */
125
+ async function mountPage(options, generation) {
126
+ const runtime = getRuntime();
127
+ const pageData = readPageData(options);
128
+ setPageState(options, pageData);
129
+ if (runtime.react?.pageRoot) {
130
+ if (!options.hasRouter) {
131
+ runtime.react.pageRoot.render(options.createTree(options.Page, pageData.props));
132
+ }
133
+ return;
134
+ }
135
+ await options.preload?.(pageData.props);
136
+ if (!isCurrentMountGeneration(generation))
137
+ return;
138
+ if (runtime.react?.pageRoot)
139
+ return;
140
+ window.__ECO_DEV_HYDRATION_STARTED__ = performance.now();
141
+ const root = options.runtime.hydrateRoot(document.body, options.createTree(options.Page, pageData.props), {
142
+ onRecoverableError: (error) => console.warn('[ecopages] Hydration error:', error),
143
+ });
144
+ runtime.react.pageRoot = root;
145
+ recordHydrationTiming();
146
+ }
147
+ /**
148
+ * Registers and starts the Page lifecycle when its persistent script is present.
149
+ *
150
+ * @remarks
151
+ * Restores lifecycle registration, router ownership, and HMR generation binding
152
+ * whenever the page is activated or rerun after navigation.
153
+ *
154
+ * @param options - Generated entry configuration for the current Page.
155
+ */
156
+ export function startPageHydration(options) {
157
+ if (!document.querySelector(`script[data-eco-script-id="${options.scriptId}"]`))
158
+ return;
159
+ const runtime = getRuntime();
160
+ runtime.react.pageRoot ??= null;
161
+ const initialPageData = readPageData(options);
162
+ setPageState(options, initialPageData);
163
+ const activatePage = () => {
164
+ runtime.react.cleanupPageRoot = () => cleanupPageRoot(runtime.react?.pageRoot ?? null);
165
+ registerRouterOwnership(options);
166
+ registerHmr(options);
167
+ return mount(options);
168
+ };
169
+ runtime.rerunScripts ??= {};
170
+ runtime.rerunScripts[options.scriptId] = activatePage;
171
+ if (document.readyState === 'loading') {
172
+ document.addEventListener('DOMContentLoaded', activatePage, { once: true });
173
+ }
174
+ else {
175
+ void activatePage();
176
+ }
177
+ }
@@ -0,0 +1,20 @@
1
+ /** Complete inputs that affect a Page hydration script's generated source. */
2
+ export type CompiledPageHydrationOptions = {
3
+ importPath: string;
4
+ pageModuleUrlExpression: string;
5
+ scriptId: string;
6
+ reactImportPath: string;
7
+ reactDomClientImportPath: string;
8
+ routerImportPath?: string;
9
+ layoutComposeImportPath: string;
10
+ pageLayoutNormalizationImportPath: string;
11
+ routerComponents?: {
12
+ router: string;
13
+ pageContent: string;
14
+ };
15
+ routerPropsExpression?: string;
16
+ hmrEnabled: boolean;
17
+ isMdx: boolean;
18
+ hasPagePreload: boolean;
19
+ minify: boolean;
20
+ };
@@ -0,0 +1,127 @@
1
+ /**
2
+ * Hydration asset creation service for React integration.
3
+ *
4
+ * Builds the asset definitions required for client-side React rendering — both at
5
+ * the page level and the component island level.
6
+ *
7
+ * @module
8
+ */
9
+ import type { EcoComponentConfig } from '@ecopages/core';
10
+ import type { PageClientBuildEntry } from '@ecopages/core/integration';
11
+ import { type AssetDefinition, type ProcessedAsset } from '@ecopages/core/integration';
12
+ import type { AssetProcessingIntegration, AssetProcessingService } from '@ecopages/core/integration';
13
+ import type { BundleService } from '../bundling/bundle.js';
14
+ import type { HmrPageMetadataCache } from '../hmr/page-metadata-cache.js';
15
+ import type { ReactRouterAdapter } from '../contracts/router-adapter.js';
16
+ /**
17
+ * Configuration for the HydrationAssetService.
18
+ */
19
+ export interface HydrationAssetServiceConfig {
20
+ srcDir: string;
21
+ routerAdapter?: ReactRouterAdapter;
22
+ assetProcessingService: AssetProcessingService;
23
+ assetProcessingIntegration?: AssetProcessingIntegration;
24
+ bundleService: BundleService;
25
+ hmrPageMetadataCache?: HmrPageMetadataCache;
26
+ }
27
+ type PageDependencyOptions = {
28
+ pagePath: string;
29
+ componentName: string;
30
+ importPath: string;
31
+ pageModuleUrlExpression: string;
32
+ bundleOptions: Record<string, unknown>;
33
+ hmrEnabled: boolean;
34
+ useBrowserRuntimeImports: boolean;
35
+ isMdx: boolean;
36
+ hasPagePreload?: boolean;
37
+ };
38
+ /**
39
+ * Derives the stable component key used by asset grouping and host selectors.
40
+ *
41
+ * @remarks
42
+ * The key identifies the component entry. Individual SSR instances receive a
43
+ * separate component ID, so repeated uses share browser assets without sharing
44
+ * a React root.
45
+ *
46
+ * @param componentFile - Absolute source path of the React component.
47
+ * @param config - Optional component identity used to distinguish entries.
48
+ * @returns Stable key used in selectors and asset names.
49
+ */
50
+ export declare function getIslandComponentKey(componentFile: string, config?: EcoComponentConfig): string;
51
+ /**
52
+ * Manages the creation of client-side hydration assets for React pages and component islands.
53
+ */
54
+ export declare class HydrationAssetService {
55
+ private readonly config;
56
+ private readonly islandScriptCompiler;
57
+ private readonly pageScriptCompiler;
58
+ private static readonly ROUTER_PAGE_GROUPED_BUNDLE_ID;
59
+ constructor(config: HydrationAssetServiceConfig);
60
+ private getIslandBundleName;
61
+ private getIslandHydrationName;
62
+ private getRouterPageGroupedEntryName;
63
+ /**
64
+ * Resolves the browser import path used for a React-owned page or island module.
65
+ *
66
+ * @remarks
67
+ * When HMR is enabled, registers the source file as an HMR entrypoint and returns
68
+ * that URL. Otherwise returns the static resolved-assets path for the generated
69
+ * asset name.
70
+ */
71
+ resolveAssetImportPath(pagePath: string, assetName: string): Promise<string>;
72
+ /**
73
+ * Creates the page-owned route entry asset for hydration and client navigation.
74
+ *
75
+ * @remarks
76
+ * The entry is compiled asynchronously from the editable browser lifecycle.
77
+ * Production router pages may be grouped into the Page Browser Graph, while
78
+ * HMR entries remain separate ESM scripts with browser-resolvable imports.
79
+ */
80
+ createPageDependencies(options: PageDependencyOptions): Promise<AssetDefinition[]>;
81
+ /**
82
+ * Builds island and lazy-entry browser assets in one grouped multi-entry build.
83
+ *
84
+ * @remarks
85
+ * Production reads island module URLs from processed grouped-build outputs.
86
+ * HMR keeps per-file transform URLs and does not start a disk bundle.
87
+ */
88
+ buildPageClientRenderAssets(input: {
89
+ islands: Array<{
90
+ file: string;
91
+ config?: EcoComponentConfig;
92
+ }>;
93
+ lazyEntries?: AssetDefinition[];
94
+ }): Promise<{
95
+ assetsByFile: Map<string, ProcessedAsset[]>;
96
+ processedAssets: ProcessedAsset[];
97
+ }>;
98
+ /** Collects React island hydration entries for the production app browser build. */
99
+ collectAppBrowserClientBuildEntries(islands: Array<{
100
+ file: string;
101
+ config?: EcoComponentConfig;
102
+ }>): Promise<PageClientBuildEntry[]>;
103
+ private uniqueIslands;
104
+ private buildHmrPageClientRenderAssets;
105
+ private buildGroupedPageClientRenderAssets;
106
+ private createGroupedIslandEntries;
107
+ private indexSrcUrlsByEntryName;
108
+ private createGroupedHydrationScripts;
109
+ private collectIslandAssetsByFile;
110
+ private buildHmrIslandRenderAssets;
111
+ private createIslandHydrationScript;
112
+ /**
113
+ * Creates the page browser graph dependency declarations for a React page.
114
+ *
115
+ * @remarks
116
+ * Chooses shared vendor import URLs when HMR is on, when running a non-production
117
+ * hosted runtime with HMR off, or when a router adapter is configured (router
118
+ * pages always externalize to shared runtimes). Production non-router pages
119
+ * may inline React into the page bundle instead.
120
+ *
121
+ * @param pagePath - Absolute file path of the page
122
+ * @param isMdx - Whether the page is an MDX file
123
+ * @param declaredModules - Explicitly declared browser module specifiers
124
+ */
125
+ createPageBrowserGraphDependencies(pagePath: string, isMdx: boolean, declaredModules: string[]): Promise<AssetDefinition[]>;
126
+ }
127
+ export {};