@ecopages/react 0.2.0-alpha.2 → 0.2.0-alpha.21

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 (66) hide show
  1. package/CHANGELOG.md +19 -39
  2. package/README.md +160 -18
  3. package/package.json +6 -6
  4. package/src/react-hmr-strategy.d.ts +26 -21
  5. package/src/react-hmr-strategy.js +91 -110
  6. package/src/react-renderer.d.ts +165 -41
  7. package/src/react-renderer.js +451 -158
  8. package/src/react.constants.d.ts +1 -0
  9. package/src/react.constants.js +4 -0
  10. package/src/react.plugin.d.ts +37 -108
  11. package/src/react.plugin.js +125 -54
  12. package/src/react.types.d.ts +88 -0
  13. package/src/react.types.js +0 -0
  14. package/src/router-adapter.d.ts +2 -2
  15. package/src/services/react-bundle.service.d.ts +4 -25
  16. package/src/services/react-bundle.service.js +39 -91
  17. package/src/services/react-hmr-page-metadata-cache.d.ts +9 -0
  18. package/src/services/react-hmr-page-metadata-cache.js +18 -2
  19. package/src/services/react-hydration-asset.service.d.ts +7 -6
  20. package/src/services/react-hydration-asset.service.js +29 -17
  21. package/src/services/react-mdx-config-dependency.service.d.ts +36 -0
  22. package/src/services/react-mdx-config-dependency.service.js +122 -0
  23. package/src/services/react-page-module.service.d.ts +8 -2
  24. package/src/services/react-page-module.service.js +44 -37
  25. package/src/services/react-page-payload.service.d.ts +46 -0
  26. package/src/services/react-page-payload.service.js +67 -0
  27. package/src/services/react-runtime-bundle.service.d.ts +14 -12
  28. package/src/services/react-runtime-bundle.service.js +103 -180
  29. package/src/utils/client-graph-boundary-plugin.js +149 -11
  30. package/src/utils/component-config-traversal.d.ts +36 -0
  31. package/src/utils/component-config-traversal.js +54 -0
  32. package/src/utils/declared-modules.d.ts +1 -1
  33. package/src/utils/declared-modules.js +7 -16
  34. package/src/utils/dynamic.test.browser.d.ts +1 -0
  35. package/src/utils/dynamic.test.browser.js +33 -0
  36. package/src/utils/hydration-scripts.d.ts +19 -4
  37. package/src/utils/hydration-scripts.js +102 -39
  38. package/src/utils/hydration-scripts.test.browser.d.ts +1 -0
  39. package/src/utils/hydration-scripts.test.browser.js +126 -0
  40. package/src/utils/reachability-analyzer.d.ts +12 -1
  41. package/src/utils/reachability-analyzer.js +101 -5
  42. package/src/utils/react-dom-runtime-interop-plugin.d.ts +5 -0
  43. package/src/utils/react-dom-runtime-interop-plugin.js +29 -0
  44. package/src/utils/react-mdx-loader-plugin.js +13 -5
  45. package/src/utils/react-runtime-specifier-map.d.ts +6 -0
  46. package/src/utils/react-runtime-specifier-map.js +37 -0
  47. package/src/utils/use-sync-external-store-shim-plugin.d.ts +5 -0
  48. package/src/utils/use-sync-external-store-shim-plugin.js +41 -0
  49. package/src/react-hmr-strategy.ts +0 -444
  50. package/src/react-renderer.ts +0 -403
  51. package/src/react.plugin.ts +0 -241
  52. package/src/router-adapter.ts +0 -95
  53. package/src/services/react-bundle.service.ts +0 -212
  54. package/src/services/react-hmr-page-metadata-cache.ts +0 -24
  55. package/src/services/react-hydration-asset.service.ts +0 -260
  56. package/src/services/react-page-module.service.ts +0 -214
  57. package/src/services/react-runtime-bundle.service.ts +0 -271
  58. package/src/utils/client-graph-boundary-plugin.ts +0 -590
  59. package/src/utils/client-only.ts +0 -27
  60. package/src/utils/declared-modules.ts +0 -99
  61. package/src/utils/dynamic.ts +0 -27
  62. package/src/utils/hmr-scripts.ts +0 -47
  63. package/src/utils/html-boundary.ts +0 -66
  64. package/src/utils/hydration-scripts.ts +0 -338
  65. package/src/utils/reachability-analyzer.ts +0 -440
  66. package/src/utils/react-mdx-loader-plugin.ts +0 -40
package/CHANGELOG.md CHANGED
@@ -6,57 +6,37 @@ All notable changes to `@ecopages/react` are documented here.
6
6
 
7
7
  ## [UNRELEASED] — TBD
8
8
 
9
- ### Features
10
-
11
- #### Render Reachability Analysis
12
-
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
9
+ ### Bug Fixes
27
10
 
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`).
11
+ - Fixed React hydration, Fast Refresh, module loading, doctype handling, island asset reuse, and mixed-renderer boundary resolution across Bun, Vite, and Nitro flows.
12
+ - Restored direct `ReactPlugin` construction so the exported class still accepts the public plugin options shape.
13
+ - Fixed React boundary payload compatibility coverage and removed the plugin/renderer integration-name import cycle.
31
14
 
32
- #### HTML Boundary Utilities
15
+ ### Features
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
+ - Added built-in React MDX support and reachability-based hydration analysis for React page bundles.
36
18
 
37
19
  ### Refactoring
38
20
 
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`).
21
+ - Consolidated React bundling, hydration, and runtime state behind shared service boundaries and `window.__ECO_PAGES__`.
22
+ - Moved React plugin option/default resolution into the factory and replaced renderer static config with instance-owned runtime wiring.
23
+ - Extracted React page-payload and locals serialization into a dedicated service to keep the renderer focused on orchestration.
24
+ - Centralized recursive React component-config traversal so module discovery and MDX SSR-lazy asset collection no longer reimplement graph walking.
25
+ - Moved MDX config dependency resolution out of the renderer into a dedicated React service.
26
+ - Collected shared React plugin and renderer config types into a dedicated module while keeping renderer-local runtime types close to implementation.
43
27
 
44
- ### Bug Fixes
28
+ ### Tests
45
29
 
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`).
30
+ - Added Vitest browser coverage for the React `dynamic()` utility using React Testing Library.
31
+ - Added browser execution coverage for the generated React hydration bootstrap, including router ownership registration and page-root cleanup.
32
+ - Added renderer-level coverage for the boundary payload compatibility contract, including non-attachable fragment roots.
49
33
 
50
- ### Tests
34
+ ### Documentation
51
35
 
52
- - Added `html-boundary.test.ts` covering boundary wrapping utilities.
53
- - Added `hydration-scripts.test.ts` with hydration script generation coverage.
54
- - Added `reachability-analyzer.test.ts` (187 lines) covering export declaration reachability.
55
- - Updated integration tests for esbuild adapter compatibility (`31a44458`).
36
+ - Updated the README to document React-owned mixed boundaries and React MDX setup.
56
37
 
57
38
  ---
58
39
 
59
40
  ## Migration Notes
60
41
 
61
- - The React integration now requires explicit client boundary declarations. Components that should be hydrated client-side must be marked at a boundary entry point.
62
- - The internal service layer (`ReactRuntimeBundleService`, `ReactBundleService`, etc.) is not part of the public API and may change between releases.
42
+ - React MDX support is built in and no longer requires installing `@ecopages/mdx` just to enable React MDX routes.
package/README.md CHANGED
@@ -1,19 +1,19 @@
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
- bunx jsr add @ecopages/react
8
+ bun add @ecopages/react
9
9
  ```
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,17 +60,148 @@ 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
+ ## Mixed Rendering
53
64
 
54
- ## Component-Level Islands
65
+ The React integration can participate in mixed-renderer apps in three ways:
66
+
67
+ - React can own the page or view directly.
68
+ - React can render nested component boundaries inside pages owned by another integration.
69
+ - React can render through non-React page, layout, or document shells when those shell components return strings.
70
+
71
+ When a non-React render pass enters a React-owned boundary, Ecopages hands that boundary back to the React renderer. When React renders through a non-React shell, that shell must serialize to HTML so React can insert the result into the final response without escaping it.
72
+
73
+ Important:
74
+
75
+ - Components that may render foreign children must declare those children in `config.dependencies.components`.
76
+ - Ecopages validates mixed-renderer ownership from declared dependencies during render preparation. It does not infer every foreign boundary from rendered HTML alone.
77
+ - React still keeps its own child transport and hydration rules for React-owned subtrees.
78
+
79
+ ## Server and Client Graph Contract
80
+
81
+ The React integration supports Node.js modules and server-only code **only on the server execution graph**.
82
+
83
+ - Server rendering can safely import `node:*` modules, database clients, filesystem utilities, etc.
84
+ - Client-hydrated React code must resolve to browser-safe modules only.
85
+ - If a server-only import crosses the boundary and becomes reachable by client code, **the client build will intentionally fail**.
86
+
87
+ Keep server helpers close, but separate them physically or logically so they do not leak into the client bundle.
88
+
89
+ ## Client Graph Boundary Architecture
90
+
91
+ 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.
92
+
93
+ ### Goal
94
+
95
+ The React integration has two jobs that must hold at the same time:
96
+
97
+ - Produce a browser-safe bundle for hydrated pages and islands.
98
+ - Preserve enough page code for hydration to reconstruct the same React tree the server rendered.
99
+
100
+ 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.
101
+
102
+ ### Mental Model
103
+
104
+ Think about each React page as two related graphs:
105
+
106
+ 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.
107
+ 2. **Client graph**: the smallest browser-safe subset needed to hydrate the rendered output in the browser.
108
+
109
+ 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.
110
+
111
+ ### What Stays and What Goes
112
+
113
+ The client bundle keeps:
114
+
115
+ - The page component render path.
116
+ - Client-safe component dependencies reachable from render.
117
+ - Layout wiring needed for hydration.
118
+ - Router runtime state needed by [@ecopages/react-router](../react-router/README.md) when SPA mode is enabled.
119
+
120
+ The client bundle removes or excludes:
121
+
122
+ - Server-only imports that are not reachable from the hydrated render path.
123
+ - Server-only `eco.page(...)` options such as `cache`, `middleware`, `metadata`, `staticProps`, and `staticPaths`.
124
+ - Request-time configuration that has no meaning in the browser.
125
+
126
+ Important:
127
+
128
+ - `render` must stay in the client bundle, because hydration needs it to reconstruct the page tree.
129
+ - `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.
130
+
131
+ ### AST Pipeline Order
132
+
133
+ 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:
134
+
135
+ 1. Parse the module and build a reachability view of the client render graph.
136
+ 2. Remove imports that are not allowed or not reachable from the client graph.
137
+ 3. Reparse the transformed source.
138
+ 4. Strip server-only `eco.page(...)` object properties from the reparsed AST.
139
+ 5. Return the rewritten source to the bundle step.
140
+
141
+ 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.
142
+
143
+ ### Why `eco.page(...)` Options Are Stripped
144
+
145
+ Import pruning alone is not enough.
146
+
147
+ Consider a page like this:
148
+
149
+ ```tsx
150
+ import { authMiddleware } from './auth.server';
151
+
152
+ export default eco.page({
153
+ cache: 'dynamic',
154
+ middleware: [authMiddleware],
155
+ requires: ['session'] as const,
156
+ render: () => <div>Dashboard</div>,
157
+ });
158
+ ```
159
+
160
+ 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.
161
+
162
+ The fix is to strip server-only `eco.page(...)` options after import pruning, while keeping `render` intact.
163
+
164
+ ### Hydration Contract for `locals`
165
+
166
+ The browser must not receive arbitrary request-scoped data.
167
+
168
+ 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.
169
+
170
+ Example:
171
+
172
+ ```tsx
173
+ export default eco.page({
174
+ requires: ['session'] as const,
175
+ render: ({ locals }) => <Dashboard user={locals?.session?.user} />,
176
+ });
177
+ ```
178
+
179
+ In this case, the hydration payload may include `locals.session`, but it will exclude unrelated request-only keys.
180
+
181
+ Important:
182
+
183
+ - This filtering is currently top-level only.
184
+ - If `locals.session` itself contains sensitive nested fields, those fields will still be serialized.
185
+ - Middleware should therefore expose a client-safe shape for any key declared in `requires`.
186
+
187
+ ### Layout Hydration Invariant
188
+
189
+ Hydration must rebuild the same tree the server rendered.
190
+
191
+ That applies to both:
192
+
193
+ - non-router hydration scripts in [packages/integrations/react/src/utils/hydration-scripts.ts](packages/integrations/react/src/utils/hydration-scripts.ts)
194
+ - router-backed hydration in [packages/react-router/src/router.ts](packages/react-router/src/router.ts)
195
+
196
+ 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.
55
197
 
56
- Current behavior:
198
+ ### Tests That Guard This Contract
57
199
 
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.
200
+ The main regression coverage lives in:
62
201
 
63
- This design preserves global CSS/layout selectors while keeping runtime ownership isolated per island instance.
202
+ - [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.
203
+ - [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.
204
+ - [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.
205
+ - [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.
64
206
 
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.
207
+ 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.2",
3
+ "version": "0.2.0-alpha.21",
4
4
  "description": "React integration for Ecopages",
5
5
  "keywords": [
6
6
  "ecopages",
@@ -53,19 +53,19 @@
53
53
  "directory": "packages/integrations/react"
54
54
  },
55
55
  "peerDependencies": {
56
- "@ecopages/core": "0.2.0-alpha.2",
56
+ "@ecopages/core": "0.2.0-alpha.21",
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.2",
64
- "@ecopages/logger": "latest",
63
+ "@ecopages/file-system": "0.2.0-alpha.21",
64
+ "@ecopages/logger": "^0.2.3",
65
65
  "@mdx-js/esbuild": "^3.0.1",
66
66
  "@mdx-js/mdx": "^3.1.0",
67
- "oxc-parser": "^0.114.0",
68
- "oxc-transform": "^0.114.0",
67
+ "oxc-parser": "^0.124.0",
68
+ "oxc-transform": "^0.124.0",
69
69
  "source-map": "^0.7.6",
70
70
  "vfile": "^6.0.3"
71
71
  },
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * @module
8
8
  */
9
- import { HmrStrategy, HmrStrategyType, type HmrAction } from '@ecopages/core/hmr/hmr-strategy';
9
+ import { HmrStrategy, type HmrAction } from '@ecopages/core/hmr/hmr-strategy';
10
10
  import type { DefaultHmrContext } from '@ecopages/core';
11
11
  import type { CompileOptions } from '@mdx-js/mdx';
12
12
  import type { ReactHmrPageMetadataCache } from './services/react-hmr-page-metadata-cache.js';
@@ -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,14 +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
- readonly type = HmrStrategyType.INTEGRATION;
52
+ readonly type: 100;
54
53
  private mdxCompilerOptions?;
55
- private readonly knownEntrypoints;
54
+ private readonly ownedTemplateExtensions;
55
+ private readonly allTemplateExtensions;
56
56
  private importNodePageModule;
57
- private createUseSyncExternalStoreShimPlugin;
58
57
  /**
59
58
  * Creates a new React HMR strategy instance.
60
59
  *
@@ -68,7 +67,10 @@ export declare class ReactHmrStrategy extends HmrStrategy {
68
67
  * @param explicitGraphEnabled - Enables explicit graph mode for React HMR bundling.
69
68
  * In explicit mode, HMR builds omit AST server-only stripping plugins in React paths.
70
69
  */
71
- 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);
72
74
  /**
73
75
  * Returns build plugins for React HMR bundling.
74
76
  *
@@ -77,6 +79,17 @@ export declare class ReactHmrStrategy extends HmrStrategy {
77
79
  */
78
80
  private getBuildPlugins;
79
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;
92
+ private ownsWatchedEntrypoint;
80
93
  /**
81
94
  * Determines if the file is a React/MDX entrypoint that's registered for HMR.
82
95
  *
@@ -116,13 +129,14 @@ export declare class ReactHmrStrategy extends HmrStrategy {
116
129
  * @returns True if bundling was successful
117
130
  */
118
131
  private bundleReactEntrypoint;
132
+ private resolveTempOutputPath;
119
133
  /**
120
134
  * Encodes dynamic route segments (brackets) in file paths.
121
135
  * Converts `[slug]` to `_slug_` to avoid filesystem issues.
122
136
  */
123
137
  private encodeDynamicSegments;
124
138
  /**
125
- * Processes bundled output by replacing specifiers and injecting HMR handler.
139
+ * Processes bundled output and injects the React HMR handler.
126
140
  * Writes to temp file first, then renames atomically to avoid conflicts.
127
141
  *
128
142
  * @param tempPath - Path to the temporary bundled file
@@ -131,13 +145,4 @@ export declare class ReactHmrStrategy extends HmrStrategy {
131
145
  * @returns True if processing was successful
132
146
  */
133
147
  private processOutput;
134
- /**
135
- * Replaces bare specifiers with runtime URLs.
136
- *
137
- * Handles both static imports and dynamic imports.
138
- *
139
- * @param code - The bundled code to transform
140
- * @returns The transformed code with runtime URLs
141
- */
142
- private replaceBareSpecifiers;
143
148
  }