@ecopages/react 0.2.0-alpha.5 → 0.2.0-alpha.7

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 (41) hide show
  1. package/CHANGELOG.md +22 -41
  2. package/README.md +135 -29
  3. package/package.json +3 -3
  4. package/src/react-hmr-strategy.d.ts +22 -30
  5. package/src/react-hmr-strategy.js +57 -120
  6. package/src/react-hmr-strategy.ts +76 -145
  7. package/src/react-renderer.d.ts +130 -11
  8. package/src/react-renderer.js +368 -64
  9. package/src/react-renderer.ts +490 -90
  10. package/src/react.plugin.d.ts +17 -5
  11. package/src/react.plugin.js +44 -13
  12. package/src/react.plugin.ts +49 -14
  13. package/src/router-adapter.d.ts +2 -2
  14. package/src/router-adapter.ts +2 -2
  15. package/src/services/react-bundle.service.d.ts +2 -30
  16. package/src/services/react-bundle.service.js +19 -94
  17. package/src/services/react-bundle.service.ts +20 -129
  18. package/src/services/react-hydration-asset.service.js +3 -3
  19. package/src/services/react-hydration-asset.service.ts +7 -4
  20. package/src/services/react-page-module.service.d.ts +3 -0
  21. package/src/services/react-page-module.service.js +20 -16
  22. package/src/services/react-page-module.service.ts +27 -17
  23. package/src/services/react-runtime-bundle.service.d.ts +12 -12
  24. package/src/services/react-runtime-bundle.service.js +98 -180
  25. package/src/services/react-runtime-bundle.service.ts +112 -211
  26. package/src/utils/client-graph-boundary-plugin.js +78 -1
  27. package/src/utils/client-graph-boundary-plugin.ts +122 -1
  28. package/src/utils/hydration-scripts.d.ts +18 -1
  29. package/src/utils/hydration-scripts.js +83 -32
  30. package/src/utils/hydration-scripts.ts +159 -38
  31. package/src/utils/react-dom-runtime-interop-plugin.d.ts +5 -0
  32. package/src/utils/react-dom-runtime-interop-plugin.js +29 -0
  33. package/src/utils/react-dom-runtime-interop-plugin.ts +33 -0
  34. package/src/utils/react-mdx-loader-plugin.js +13 -5
  35. package/src/utils/react-mdx-loader-plugin.ts +28 -5
  36. package/src/utils/react-runtime-specifier-map.d.ts +6 -0
  37. package/src/utils/react-runtime-specifier-map.js +37 -0
  38. package/src/utils/react-runtime-specifier-map.ts +45 -0
  39. package/src/utils/use-sync-external-store-shim-plugin.d.ts +5 -0
  40. package/src/utils/use-sync-external-store-shim-plugin.js +41 -0
  41. package/src/utils/use-sync-external-store-shim-plugin.ts +45 -0
package/CHANGELOG.md CHANGED
@@ -8,60 +8,41 @@ All notable changes to `@ecopages/react` are documented here.
8
8
 
9
9
  ### Features
10
10
 
11
- #### Render Reachability Analysis
11
+ - Added Phase 1 client render graph analysis to track client-reachable exports and enforce explicit React hydration boundaries.
12
+ - Split React browser and runtime work into focused services for runtime bundles, hydration assets, page modules, and browser bundling.
13
+ - Inlined the React MDX loader so React apps can enable MDX without installing `@ecopages/mdx` separately.
12
14
 
13
- - **Client render graph (Phase 1)** — Introduces a static reachability analysis step that builds an explicit graph of which components are rendered client-side (`cdfbd69e`).
14
- - **OXC-powered reachability analyzer** — `reachability-analyzer.ts` uses OXC to parse and walk component ASTs, building a `ClientRenderGraph` that maps exported components to their client-side reach (`5412df6b`).
15
- - **Explicit client graph boundaries** — Components must now declare explicit boundaries; the analyser enforces these to prevent over-hydration (`2912d6bd`).
16
- - **Declared modules utility** — `declared-modules.ts` tracks which modules are declared as client boundaries.
17
-
18
- #### Service Architecture Refactor
19
-
20
- - **`ReactRuntimeBundleService`** — Manages runtime assets and specifier mapping for the React integration (`cfd3cb05`).
21
- - **`ReactHydrationAssetService`** — Creates and manages hydration assets for client-side rendering (`cfd3cb05`).
22
- - **`ReactBundleService`** — Handles esbuild bundle configuration for React components (`cfd3cb05`).
23
- - **`ReactPageModuleService`** — Loads and compiles MDX/TSX page modules, including config resolution (`cfd3cb05`).
24
- - The integration no longer builds a monolithic renderer — each concern is handled by a focused service.
25
-
26
- #### HMR Improvements
27
-
28
- - **HMR page metadata caching** — Page metadata is now cached between HMR refreshes, preventing unnecessary re-fetches during Fast Refresh (`a663788c`).
29
- - **Stale temp module race fix** — HMR no longer incorrectly reads a stale temporary module during rapid refresh cycles (`b2cf8466`).
30
- - **Client graph HMR stability** — HMR reloads now correctly respect client graph boundaries to avoid partial hydration mismatches (`2912d6bd`).
31
-
32
- #### HTML Boundary Utilities
15
+ ### Bug Fixes
33
16
 
34
- - **`html-boundary.ts`** New utility that wraps rendered output in explicit boundary markers for the cross-integration boundary rendering policy (`ec1e4d66`).
35
- - **`hydration-scripts.ts`** Expanded with new helpers for generating and injecting hydration entry scripts.
17
+ - Fixed React island bootstrapping to replace SSR nodes with a block-level `eco-island` container and per-element `data-eco-props` payloads, preventing duplicate DOM and prop collisions.
18
+ - Fixed router-backed React pages to emit the canonical `__ECO_PAGE_DATA__` payload and explicit document owner markers so mixed React and non-React navigation and hydration stay aligned.
19
+ - Fixed React page hydration and handoff cleanup to use `document.body`, shared navigation coordination, preserved request locals, and stable root reuse across route handoffs.
20
+ - Fixed React MDX extension handling so `.md` stays opt-in and shared builds no longer let standalone MDX configuration hijack React `.mdx` routes.
21
+ - Fixed client graph boundary wiring so client-reachable server-only re-exports fail fast and page-entry bundles strip unreachable server-only `eco.page()` options.
22
+ - Moved React MDX page-module transpilation into the internal work directory so static exports no longer leak `.server-modules-react-mdx` into `distDir`.
23
+ - Fixed development React runtime vendor asset naming so concurrent preview/export builds no longer overwrite dev-only JSX runtime helpers such as `jsxDEV`.
24
+ - Fixed React MDX declared component dependencies to eagerly emit SSR-marked lazy custom-element scripts so mixed React and Lit pages keep declared custom elements interactive.
25
+ - Fixed mixed-integration HMR matching so React strategy now uses configured route-template extension ownership (including explicit overrides such as `.react.tsx`) instead of generic `.tsx` matching for all page/layout templates.
26
+ - Fixed React MDX layout metadata fallback so inferred `__eco.file` anchors to the owning layout/component directory instead of a dependency file path, preventing double-nested relative script resolution.
36
27
 
37
28
  ### Refactoring
38
29
 
39
- - Aligned React renderer to full orchestration mode removed legacy rendering path (`fc07bdb0`).
40
- - Ambient module declarations cleaned up (`5f46ecc5`).
41
- - Client graph boundaries and runtime dependency wiring corrected (`4b6cd32e`).
42
- - Updated test suite for esbuild adapter and Node.js runtime compatibility (`31a44458`).
43
-
44
- ### Bug Fixes
45
-
46
- - Inlined the React MDX loader so React apps no longer need to install `@ecopages/mdx` when enabling React MDX support (`unreleased`).
47
- - Fixed stale temp module race during Fast Refresh cycles (`b2cf8466`).
48
- - Fixed client graph boundary wiring for runtime dependencies (`4b6cd32e`).
49
- - Fixed shared React barrel handling so client-reachable server-only re-exports now fail the build instead of being silently pruned (`unreleased`).
30
+ - Moved runtime specifier registration onto the shared integration lifecycle and reused core browser runtime asset and entry helpers instead of React-owned temp entry assembly.
31
+ - Centralized React runtime specifier policy and consolidated browser runtime state under `window.__ECO_PAGES__`.
50
32
 
51
33
  ### Documentation
52
34
 
53
- - Documented the React integration server/client graph contract for shared modules and barrel exports (`unreleased`).
35
+ - Expanded the README for client graph boundaries, shared-module rules, AST rewrite order, and hydration `locals`.
54
36
 
55
37
  ### Tests
56
38
 
57
- - Added `html-boundary.test.ts` covering boundary wrapping utilities.
58
- - Added `hydration-scripts.test.ts` with hydration script generation coverage.
59
- - Added `reachability-analyzer.test.ts` (187 lines) covering export declaration reachability.
60
- - Updated integration tests for esbuild adapter compatibility (`31a44458`).
39
+ - Added coverage for client graph reachability, hydration boundary utilities, and the router-backed component-render regression that prevents implicit island hydration.
40
+ - Added regression coverage for development React runtime vendor asset naming so dev and preview React bundles stay isolated.
61
41
 
62
42
  ---
63
43
 
64
44
  ## Migration Notes
65
45
 
66
- - The React integration now requires explicit client boundary declarations. Components that should be hydrated client-side must be marked at a boundary entry point.
67
- - The internal service layer (`ReactRuntimeBundleService`, `ReactBundleService`, etc.) is not part of the public API and may change between releases.
46
+ - The React integration now requires explicit client boundary declarations for client-rendered components.
47
+ - React MDX support is built in and no longer requires installing `@ecopages/mdx` just to enable React MDX routes.
48
+ - The internal service layer is not part of the public API and may change between releases.
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
- # Ecopages React Integration Plugin
1
+ # @ecopages/react
2
2
 
3
- The `@ecopages/react` package introduces first-class integration with [React](https://reactjs.org/) version 19, enabling developers to leverage React's robust ecosystem and component model within the Ecopages platform. This integration provides a seamless experience for using React components in your Ecopages projects, combining React's declarative UI library with the flexibility and simplicity of Ecopages.
3
+ First-class integration for [React 19](https://react.dev/) in Ecopages. This plugin enables React SSR and client hydration, allowing you to build component-level React islands or full React Single Page Applications (SPAs).
4
4
 
5
- ## Install
5
+ ## Installation
6
6
 
7
7
  ```bash
8
8
  bunx jsr add @ecopages/react
@@ -10,10 +10,10 @@ bunx jsr add @ecopages/react
10
10
 
11
11
  ## Usage
12
12
 
13
- To incorporate the React integration into your Ecopages project, configure your project as follows:
13
+ Configure the plugin in your `eco.config.ts`:
14
14
 
15
15
  ```ts
16
- import { ConfigBuilder } from '@ecopages/core';
16
+ import { ConfigBuilder } from '@ecopages/core/config-builder';
17
17
  import { reactPlugin } from '@ecopages/react';
18
18
 
19
19
  const config = await new ConfigBuilder()
@@ -24,16 +24,27 @@ const config = await new ConfigBuilder()
24
24
  export default config;
25
25
  ```
26
26
 
27
+ ## Component-Level Islands
28
+
29
+ By default, Ecopages React acts in island mode:
30
+
31
+ - SSR output preserves the authored DOM structure (no unnecessary wrapper elements).
32
+ - A stable `data-eco-component-id` attribute is attached to the component SSR root.
33
+ - The client bootstrap mounts the component via `createRoot()` strictly within that root boundary.
34
+
35
+ > [!TIP]
36
+ > **Full React SPA Routing:**
37
+ > If you are building full React pages and want client-side navigation (SPA), use [@ecopages/react-router](../react-router/README.md) and pass it to the react plugin: `reactPlugin({ router: ecoRouter() })`.
38
+
27
39
  ## MDX Support
28
40
 
29
- The React plugin includes optional MDX support. When enabled, you can write `.mdx` pages alongside `.tsx` pages with unified client-side routing, hydration, and HMR.
41
+ The React plugin includes built-in MDX support. When enabled, you can write `.mdx` pages alongside `.tsx` pages with unified client-side routing, hydration, and HMR.
30
42
 
31
43
  ```ts
32
- import { ConfigBuilder } from '@ecopages/core';
44
+ import { ConfigBuilder } from '@ecopages/core/config-builder';
33
45
  import { reactPlugin } from '@ecopages/react';
34
46
 
35
47
  const config = await new ConfigBuilder()
36
- .setBaseUrl(import.meta.env.ECOPAGES_BASE_URL)
37
48
  .setIntegrations([
38
49
  reactPlugin({
39
50
  mdx: {
@@ -49,37 +60,132 @@ const config = await new ConfigBuilder()
49
60
  export default config;
50
61
  ```
51
62
 
52
- This approach is recommended when using a client-side router (e.g., `@ecopages/react-router`) as it ensures consistent navigation between TSX and MDX pages.
63
+ ## Server and Client Graph Contract
53
64
 
54
- ## Component-Level Islands
65
+ The React integration supports Node.js modules and server-only code **only on the server execution graph**.
55
66
 
56
- Current behavior:
67
+ - Server rendering can safely import `node:*` modules, database clients, filesystem utilities, etc.
68
+ - Client-hydrated React code must resolve to browser-safe modules only.
69
+ - If a server-only import crosses the boundary and becomes reachable by client code, **the client build will intentionally fail**.
57
70
 
58
- - SSR output keeps the authored component DOM structure (no synthetic wrapper element).
59
- - A stable `data-eco-component-id` attribute is attached to the component SSR root when a single root element is available.
60
- - Client bootstrap resolves the component export and mounts with `createRoot()` into that root boundary.
61
- - Component assets are emitted through the shared dependency pipeline and deduplicated with other integrations.
71
+ Keep server helpers close, but separate them physically or logically so they do not leak into the client bundle.
62
72
 
63
- This design preserves global CSS/layout selectors while keeping runtime ownership isolated per island instance.
73
+ ## Client Graph Boundary Architecture
64
74
 
65
- For full React pages with client-side navigation, prefer [@ecopages/react-router](../react-router/README.md), where routing and hydration are handled by the React-specific runtime.
75
+ This section explains the internal contract used to keep the browser bundle minimal while preventing server-only code and request-only configuration from leaking into client output.
66
76
 
67
- ## Server And Client Graph Contract
77
+ ### Goal
68
78
 
69
- The React integration supports Node.js modules and server-only code, but only on the server execution graph.
79
+ The React integration has two jobs that must hold at the same time:
70
80
 
71
- - Server rendering can import and execute `node:*` modules, database clients, filesystem utilities, and `*.server.*` modules.
72
- - Client-hydrated React code must resolve to browser-safe modules only.
73
- - Shared files and barrel files are allowed when the exports that become client-reachable are browser-safe.
74
- - If a server-only import becomes client-reachable, the client build fails instead of silently replacing the import.
81
+ - Produce a browser-safe bundle for hydrated pages and islands.
82
+ - Preserve enough page code for hydration to reconstruct the same React tree the server rendered.
75
83
 
76
- In practice, this means you can keep server helpers close to your React code, but the browser bundle boundary is strict:
84
+ That means the client bundle must keep client-safe render logic, but it must drop server-only imports and server-only `eco.page(...)` options such as middleware and build-time metadata.
77
85
 
78
- ```ts
79
- export { Button } from './button';
80
- export { db } from './db.server';
86
+ ### Mental Model
87
+
88
+ Think about each React page as two related graphs:
89
+
90
+ 1. **Server graph**: everything needed to render the page on the server. This graph may include middleware, request locals, database access, filesystem access, and other server-only modules.
91
+ 2. **Client graph**: the smallest browser-safe subset needed to hydrate the rendered output in the browser.
92
+
93
+ The React integration builds the client graph conservatively. If a server-only module becomes reachable from the hydrated render path, the build should fail rather than silently shipping unsafe code.
94
+
95
+ ### What Stays and What Goes
96
+
97
+ The client bundle keeps:
98
+
99
+ - The page component render path.
100
+ - Client-safe component dependencies reachable from render.
101
+ - Layout wiring needed for hydration.
102
+ - Router runtime state needed by [@ecopages/react-router](../react-router/README.md) when SPA mode is enabled.
103
+
104
+ The client bundle removes or excludes:
105
+
106
+ - Server-only imports that are not reachable from the hydrated render path.
107
+ - Server-only `eco.page(...)` options such as `cache`, `middleware`, `metadata`, `staticProps`, and `staticPaths`.
108
+ - Request-time configuration that has no meaning in the browser.
109
+
110
+ Important:
111
+
112
+ - `render` must stay in the client bundle, because hydration needs it to reconstruct the page tree.
113
+ - `requires` does **not** stay in the browser page config. It is used on the server to decide which `locals` keys may be serialized into the hydration payload.
114
+
115
+ ### AST Pipeline Order
116
+
117
+ The browser-bound transform in [packages/integrations/react/src/utils/client-graph-boundary-plugin.ts](packages/integrations/react/src/utils/client-graph-boundary-plugin.ts) follows this order:
118
+
119
+ 1. Parse the module and build a reachability view of the client render graph.
120
+ 2. Remove imports that are not allowed or not reachable from the client graph.
121
+ 3. Reparse the transformed source.
122
+ 4. Strip server-only `eco.page(...)` object properties from the reparsed AST.
123
+ 5. Return the rewritten source to the bundle step.
124
+
125
+ The reparse step is important. Once import edits change source offsets, the original AST locations are stale. Reusing them for later edits can corrupt the output or remove the wrong code.
126
+
127
+ ### Why `eco.page(...)` Options Are Stripped
128
+
129
+ Import pruning alone is not enough.
130
+
131
+ Consider a page like this:
132
+
133
+ ```tsx
134
+ import { authMiddleware } from './auth.server';
135
+
136
+ export default eco.page({
137
+ cache: 'dynamic',
138
+ middleware: [authMiddleware],
139
+ requires: ['session'] as const,
140
+ render: () => <div>Dashboard</div>,
141
+ });
81
142
  ```
82
143
 
83
- If a client entry only reaches `Button`, the `db` re-export is removed from the browser transform. If a client entry reaches `db`, the build fails because the server-only export crossed into the client graph.
144
+ If the client transform removes the `auth.server` import but leaves `middleware: [authMiddleware]` in place, the browser bundle still contains a dangling identifier. That breaks production hydration even though the import was removed correctly.
145
+
146
+ The fix is to strip server-only `eco.page(...)` options after import pruning, while keeping `render` intact.
147
+
148
+ ### Hydration Contract for `locals`
149
+
150
+ The browser must not receive arbitrary request-scoped data.
151
+
152
+ The React renderer in [packages/integrations/react/src/react-renderer.ts](packages/integrations/react/src/react-renderer.ts) serializes only the top-level `locals` keys explicitly declared by `Page.requires`. If a page does not declare `requires`, no `locals` are serialized for hydration.
153
+
154
+ Example:
155
+
156
+ ```tsx
157
+ export default eco.page({
158
+ requires: ['session'] as const,
159
+ render: ({ locals }) => <Dashboard user={locals?.session?.user} />,
160
+ });
161
+ ```
162
+
163
+ In this case, the hydration payload may include `locals.session`, but it will exclude unrelated request-only keys.
164
+
165
+ Important:
166
+
167
+ - This filtering is currently top-level only.
168
+ - If `locals.session` itself contains sensitive nested fields, those fields will still be serialized.
169
+ - Middleware should therefore expose a client-safe shape for any key declared in `requires`.
170
+
171
+ ### Layout Hydration Invariant
172
+
173
+ Hydration must rebuild the same tree the server rendered.
174
+
175
+ That applies to both:
176
+
177
+ - non-router hydration scripts in [packages/integrations/react/src/utils/hydration-scripts.ts](packages/integrations/react/src/utils/hydration-scripts.ts)
178
+ - router-backed hydration in [packages/react-router/src/router.ts](packages/react-router/src/router.ts)
179
+
180
+ If the page render receives `locals` on the server and the layout also depends on those values, the client must pass the same serialized `locals` into the layout during hydration. Otherwise React will detect a mismatch.
181
+
182
+ ### Tests That Guard This Contract
183
+
184
+ The main regression coverage lives in:
185
+
186
+ - [packages/integrations/react/src/utils/client-graph-boundary-plugin.test.ts](packages/integrations/react/src/utils/client-graph-boundary-plugin.test.ts): verifies server-only `eco.page(...)` options are stripped from browser bundles.
187
+ - [packages/integrations/react/src/react-renderer.locals.test.ts](packages/integrations/react/src/react-renderer.locals.test.ts): verifies only declared `requires` keys are serialized into hydration payloads.
188
+ - [packages/integrations/react/src/utils/hydration-scripts.test.ts](packages/integrations/react/src/utils/hydration-scripts.test.ts): verifies non-router hydration passes serialized `locals` into layouts.
189
+ - [packages/react-router/test/hmr-reload.test.browser.ts](packages/react-router/test/hmr-reload.test.browser.ts): verifies router-backed layout hydration receives `locals` with `persistLayouts` both enabled and disabled.
84
190
 
85
- This contract keeps SSR and server functions free to use Node.js while ensuring the final browser bundle contains no client-reachable server-only code.
191
+ If you change the AST transform or hydration flow, update the corresponding tests in the same change.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ecopages/react",
3
- "version": "0.2.0-alpha.5",
3
+ "version": "0.2.0-alpha.7",
4
4
  "description": "React integration for Ecopages",
5
5
  "keywords": [
6
6
  "ecopages",
@@ -53,14 +53,14 @@
53
53
  "directory": "packages/integrations/react"
54
54
  },
55
55
  "peerDependencies": {
56
- "@ecopages/core": "0.2.0-alpha.5",
56
+ "@ecopages/core": "0.2.0-alpha.7",
57
57
  "@types/react": "^19",
58
58
  "@types/react-dom": "^19",
59
59
  "react": "^19",
60
60
  "react-dom": "^19"
61
61
  },
62
62
  "dependencies": {
63
- "@ecopages/file-system": "0.2.0-alpha.5",
63
+ "@ecopages/file-system": "0.2.0-alpha.7",
64
64
  "@ecopages/logger": "latest",
65
65
  "@mdx-js/esbuild": "^3.0.1",
66
66
  "@mdx-js/mdx": "^3.1.0",
@@ -19,9 +19,11 @@ import type { ReactHmrPageMetadataCache } from './services/react-hmr-page-metada
19
19
  * The processing steps are:
20
20
  * 1. Check if any React entrypoints are registered
21
21
  * 2. Rebuild all React entrypoints (the changed file could be a dependency)
22
- * 3. Replace bare specifiers with runtime URLs
23
- * 4. Inject HMR acceptance handler
24
- * 5. Broadcast update events for each rebuilt entrypoint
22
+ * 3. Rebuild browser output through the shared browser bundle service while
23
+ * preserving React-specific runtime aliases and graph policy
24
+ * 4. Read page config metadata through the shared server-module loading path
25
+ * 5. Inject HMR acceptance handler
26
+ * 6. Broadcast update events for each rebuilt entrypoint
25
27
  *
26
28
  * @remarks
27
29
  * This strategy has higher priority than generic JsHmrStrategy, allowing it
@@ -47,25 +49,11 @@ import type { ReactHmrPageMetadataCache } from './services/react-hmr-page-metada
47
49
  * ```
48
50
  */
49
51
  export declare class ReactHmrStrategy extends HmrStrategy {
50
- private context;
51
- private pageMetadataCache;
52
- private explicitGraphEnabled;
53
52
  readonly type = HmrStrategyType.INTEGRATION;
54
53
  private mdxCompilerOptions?;
55
- private readonly knownEntrypoints;
54
+ private readonly ownedTemplateExtensions;
55
+ private readonly allTemplateExtensions;
56
56
  private importNodePageModule;
57
- /**
58
- * Redirects `use-sync-external-store/shim` imports to React's built-in
59
- * `useSyncExternalStore`.
60
- *
61
- * Libraries like React Aria still list `use-sync-external-store` as a
62
- * dependency to support React 16/17. On React 18+ the `/shim` export is
63
- * already a pass-through, but without this plugin esbuild would bundle
64
- * the full CJS shim (including `process.env` branching) into the browser
65
- * bundle. The plugin short-circuits the resolution so only a single clean
66
- * ESM re-export is emitted.
67
- */
68
- private createUseSyncExternalStoreShimPlugin;
69
57
  /**
70
58
  * Creates a new React HMR strategy instance.
71
59
  *
@@ -79,7 +67,10 @@ export declare class ReactHmrStrategy extends HmrStrategy {
79
67
  * @param explicitGraphEnabled - Enables explicit graph mode for React HMR bundling.
80
68
  * In explicit mode, HMR builds omit AST server-only stripping plugins in React paths.
81
69
  */
82
- constructor(context: DefaultHmrContext, pageMetadataCache: ReactHmrPageMetadataCache, mdxCompilerOptions?: CompileOptions, explicitGraphEnabled?: boolean);
70
+ private context;
71
+ private pageMetadataCache;
72
+ private explicitGraphEnabled;
73
+ constructor(context: DefaultHmrContext, pageMetadataCache: ReactHmrPageMetadataCache, mdxCompilerOptions?: CompileOptions, ownedTemplateExtensions?: string[], allTemplateExtensions?: string[], explicitGraphEnabled?: boolean);
83
74
  /**
84
75
  * Returns build plugins for React HMR bundling.
85
76
  *
@@ -88,6 +79,16 @@ export declare class ReactHmrStrategy extends HmrStrategy {
88
79
  */
89
80
  private getBuildPlugins;
90
81
  private isReactEntrypoint;
82
+ /**
83
+ * Returns true when a route file uses a compound extension like `page.foo.tsx`.
84
+ *
85
+ * @remarks
86
+ * React integration owns plain `.tsx` route templates. Compound extensions in
87
+ * pages/layouts are integration-specific route templates and should not be
88
+ * claimed by React HMR strategy.
89
+ */
90
+ private isRouteTemplate;
91
+ private resolveTemplateExtension;
91
92
  /**
92
93
  * Determines if the file is a React/MDX entrypoint that's registered for HMR.
93
94
  *
@@ -133,7 +134,7 @@ export declare class ReactHmrStrategy extends HmrStrategy {
133
134
  */
134
135
  private encodeDynamicSegments;
135
136
  /**
136
- * Processes bundled output by replacing specifiers and injecting HMR handler.
137
+ * Processes bundled output and injects the React HMR handler.
137
138
  * Writes to temp file first, then renames atomically to avoid conflicts.
138
139
  *
139
140
  * @param tempPath - Path to the temporary bundled file
@@ -142,13 +143,4 @@ export declare class ReactHmrStrategy extends HmrStrategy {
142
143
  * @returns True if processing was successful
143
144
  */
144
145
  private processOutput;
145
- /**
146
- * Replaces bare specifiers with runtime URLs.
147
- *
148
- * Handles both static imports and dynamic imports.
149
- *
150
- * @param code - The bundled code to transform
151
- * @returns The transformed code with runtime URLs
152
- */
153
- private replaceBareSpecifiers;
154
146
  }