@ecopages/react 0.2.0-beta.31 → 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.
- package/README.md +5 -1
- package/package.json +4 -4
- package/src/app/client-only.js +13 -17
- package/src/app/dynamic.js +7 -10
- package/src/app/dynamic.test.browser.js +27 -29
- package/src/bundling/bootstrap-package-paths.js +5 -6
- package/src/bundling/bundle.js +115 -114
- package/src/bundling/discover-layout-runtime-modules.js +166 -155
- package/src/bundling/runtime-alias-map.d.ts +4 -1
- package/src/bundling/runtime-alias-map.js +107 -95
- package/src/bundling/runtime-bundle.js +250 -274
- package/src/bundling/runtime-interop-plugin.js +31 -35
- package/src/bundling/runtime-mode.js +10 -5
- package/src/bundling/runtime-modules.js +46 -35
- package/src/client-graph/ast-transform.js +415 -305
- package/src/client-graph/boundary-cache.js +146 -104
- package/src/client-graph/boundary-plugin.js +122 -104
- package/src/client-graph/component-config-traversal.js +70 -49
- package/src/client-graph/declared-modules.js +63 -41
- package/src/client-graph/reachability-analyzer.js +506 -313
- package/src/client-graph/specifier-classification.js +209 -141
- package/src/contracts/router-adapter.js +6 -0
- package/src/dev-transform/react-dev-transform-contributor.d.ts +17 -0
- package/src/dev-transform/react-dev-transform-contributor.js +22 -0
- package/src/hmr/hmr-scripts.js +22 -9
- package/src/hmr/hmr-strategy.d.ts +12 -181
- package/src/hmr/hmr-strategy.js +321 -650
- package/src/hmr/page-metadata-cache.js +43 -40
- package/src/hmr/react-hmr-dev-transform-plugins.d.ts +23 -0
- package/src/hmr/react-hmr-dev-transform-plugins.js +20 -0
- package/src/hydration/assert-no-bare-ecopages-imports.js +6 -6
- package/src/hydration/bootstrap-imports.js +30 -20
- package/src/hydration/hydration-asset.js +216 -213
- package/src/hydration/hydration-scripts.d.ts +4 -0
- package/src/hydration/hydration-scripts.js +199 -66
- package/src/hydration/hydration-scripts.test.browser.js +163 -168
- package/src/hydration/page-data-manifest.js +89 -45
- package/src/hydration/page-data-reader.js +45 -32
- package/src/hydration/page-payload.js +101 -99
- package/src/hydration/serialize-page-data-script.js +27 -28
- package/src/mdx/mdx-config-dependency.js +108 -112
- package/src/mdx/mdx-loader-plugin.js +7 -10
- package/src/page/page-module.js +72 -66
- package/src/plugin/react.constants.js +1 -4
- package/src/plugin/react.plugin.d.ts +1 -0
- package/src/plugin/react.plugin.js +227 -216
- package/src/plugin/react.types.js +1 -0
- package/src/render/component-ownership.js +42 -18
- package/src/render/component-ssr.js +168 -190
- package/src/render/eco-embed.js +8 -10
- package/src/render/errors.js +21 -16
- package/src/render/html-boundary.js +55 -51
- package/src/render/layout-compose.js +122 -94
- package/src/render/react-renderer.js +433 -468
- package/src/render/react-runtime.js +25 -20
- package/src/render/unified-layout-composition.js +74 -85
- package/src/runtime/use-sync-external-store-with-selector.js +52 -54
|
@@ -1,38 +1,49 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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
|
+
}
|