@ecopages/react 0.2.0-beta.30 → 0.2.0-beta.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/README.md +5 -1
  2. package/package.json +4 -4
  3. package/src/app/client-only.js +13 -17
  4. package/src/app/dynamic.js +7 -10
  5. package/src/app/dynamic.test.browser.js +27 -29
  6. package/src/bundling/bootstrap-package-paths.js +5 -6
  7. package/src/bundling/bundle.js +115 -114
  8. package/src/bundling/discover-layout-runtime-modules.js +166 -155
  9. package/src/bundling/runtime-alias-map.d.ts +4 -1
  10. package/src/bundling/runtime-alias-map.js +107 -95
  11. package/src/bundling/runtime-bundle.js +250 -274
  12. package/src/bundling/runtime-interop-plugin.js +31 -35
  13. package/src/bundling/runtime-mode.js +10 -5
  14. package/src/bundling/runtime-modules.js +46 -35
  15. package/src/client-graph/ast-transform.js +415 -305
  16. package/src/client-graph/boundary-cache.js +146 -104
  17. package/src/client-graph/boundary-plugin.js +122 -104
  18. package/src/client-graph/component-config-traversal.js +70 -49
  19. package/src/client-graph/declared-modules.js +63 -41
  20. package/src/client-graph/reachability-analyzer.js +506 -313
  21. package/src/client-graph/specifier-classification.js +209 -141
  22. package/src/contracts/router-adapter.js +6 -0
  23. package/src/dev-transform/react-dev-transform-contributor.d.ts +17 -0
  24. package/src/dev-transform/react-dev-transform-contributor.js +22 -0
  25. package/src/hmr/hmr-scripts.js +22 -9
  26. package/src/hmr/hmr-strategy.d.ts +12 -181
  27. package/src/hmr/hmr-strategy.js +321 -650
  28. package/src/hmr/page-metadata-cache.js +43 -40
  29. package/src/hmr/react-hmr-dev-transform-plugins.d.ts +23 -0
  30. package/src/hmr/react-hmr-dev-transform-plugins.js +20 -0
  31. package/src/hydration/assert-no-bare-ecopages-imports.js +6 -6
  32. package/src/hydration/bootstrap-imports.js +30 -20
  33. package/src/hydration/hydration-asset.js +216 -213
  34. package/src/hydration/hydration-scripts.d.ts +4 -0
  35. package/src/hydration/hydration-scripts.js +199 -66
  36. package/src/hydration/hydration-scripts.test.browser.js +163 -168
  37. package/src/hydration/page-data-manifest.js +89 -45
  38. package/src/hydration/page-data-reader.js +45 -32
  39. package/src/hydration/page-payload.js +101 -99
  40. package/src/hydration/serialize-page-data-script.js +27 -28
  41. package/src/mdx/mdx-config-dependency.js +108 -112
  42. package/src/mdx/mdx-loader-plugin.js +7 -10
  43. package/src/page/page-module.js +72 -66
  44. package/src/plugin/react.constants.js +1 -4
  45. package/src/plugin/react.plugin.d.ts +1 -0
  46. package/src/plugin/react.plugin.js +227 -216
  47. package/src/plugin/react.types.js +1 -0
  48. package/src/render/component-ownership.js +42 -18
  49. package/src/render/component-ssr.js +168 -190
  50. package/src/render/eco-embed.js +8 -10
  51. package/src/render/errors.js +21 -16
  52. package/src/render/html-boundary.js +55 -51
  53. package/src/render/layout-compose.js +122 -94
  54. package/src/render/react-renderer.js +433 -468
  55. package/src/render/react-runtime.js +25 -20
  56. package/src/render/unified-layout-composition.js +74 -85
  57. package/src/runtime/use-sync-external-store-with-selector.js +52 -54
@@ -1,38 +1,49 @@
1
- function resolveReactPluginRuntimeModuleSlug(specifier) {
2
- return specifier.replace(/^@/, "").replace(/\//g, "-");
1
+ /**
2
+ * Normalizes `reactPlugin({ runtimeModules })` entries for vendor bundling.
3
+ *
4
+ * @module
5
+ */
6
+ /**
7
+ * Builds a stable vendor filename stem from a package specifier.
8
+ */
9
+ export function resolveReactPluginRuntimeModuleSlug(specifier) {
10
+ return specifier.replace(/^@/, '').replace(/\//g, '-');
3
11
  }
4
- function resolveReactPluginRuntimeModules(modules) {
5
- return (modules ?? []).map((entry) => {
6
- if (typeof entry === "string") {
7
- return {
8
- specifier: entry,
9
- outputName: resolveReactPluginRuntimeModuleSlug(entry),
10
- externals: []
11
- };
12
- }
13
- return {
14
- specifier: entry.specifier,
15
- outputName: entry.outputName ?? resolveReactPluginRuntimeModuleSlug(entry.specifier),
16
- externals: entry.externals ?? []
17
- };
18
- });
19
- }
20
- function mergeReactPluginRuntimeModules(manualModules, autoSpecifiers) {
21
- const merged = /* @__PURE__ */ new Map();
22
- for (const specifier of autoSpecifiers) {
23
- merged.set(specifier, {
24
- specifier,
25
- outputName: resolveReactPluginRuntimeModuleSlug(specifier),
26
- externals: []
12
+ /**
13
+ * Resolves user-facing runtime module declarations into vendor bundle config.
14
+ */
15
+ export function resolveReactPluginRuntimeModules(modules) {
16
+ return (modules ?? []).map((entry) => {
17
+ if (typeof entry === 'string') {
18
+ return {
19
+ specifier: entry,
20
+ outputName: resolveReactPluginRuntimeModuleSlug(entry),
21
+ externals: [],
22
+ };
23
+ }
24
+ return {
25
+ specifier: entry.specifier,
26
+ outputName: entry.outputName ?? resolveReactPluginRuntimeModuleSlug(entry.specifier),
27
+ externals: entry.externals ?? [],
28
+ };
27
29
  });
28
- }
29
- for (const entry of manualModules) {
30
- merged.set(entry.specifier, entry);
31
- }
32
- return [...merged.values()];
33
30
  }
34
- export {
35
- mergeReactPluginRuntimeModules,
36
- resolveReactPluginRuntimeModuleSlug,
37
- resolveReactPluginRuntimeModules
38
- };
31
+ /**
32
+ * Merges auto-discovered layout npm imports with explicit `runtimeModules` entries.
33
+ *
34
+ * @remarks Manual entries win when both sources declare the same specifier.
35
+ */
36
+ export function mergeReactPluginRuntimeModules(manualModules, autoSpecifiers) {
37
+ const merged = new Map();
38
+ for (const specifier of autoSpecifiers) {
39
+ merged.set(specifier, {
40
+ specifier,
41
+ outputName: resolveReactPluginRuntimeModuleSlug(specifier),
42
+ externals: [],
43
+ });
44
+ }
45
+ for (const entry of manualModules) {
46
+ merged.set(entry.specifier, entry);
47
+ }
48
+ return [...merged.values()];
49
+ }