@modern-js/runtime 3.1.4 → 3.1.5
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/dist/cjs/cli/ssr/loadable-bundler-plugin.js +12 -1
- package/dist/cjs/cli/template.js +4 -4
- package/dist/esm/cli/ssr/loadable-bundler-plugin.mjs +12 -1
- package/dist/esm/cli/template.mjs +4 -4
- package/dist/esm-node/cli/ssr/loadable-bundler-plugin.mjs +12 -1
- package/dist/esm-node/cli/template.mjs +4 -4
- package/package.json +11 -11
|
@@ -38,6 +38,11 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
38
38
|
const external_path_namespaceObject = require("path");
|
|
39
39
|
var external_path_default = /*#__PURE__*/ __webpack_require__.n(external_path_namespaceObject);
|
|
40
40
|
const utils_namespaceObject = require("@modern-js/utils");
|
|
41
|
+
const normalizeChunkId = (id)=>'string' == typeof id && /^\d+$/.test(id) ? Number(id) : id;
|
|
42
|
+
const normalizeChunkGroup = (group)=>({
|
|
43
|
+
...group,
|
|
44
|
+
chunks: (group.chunks || []).map(normalizeChunkId)
|
|
45
|
+
});
|
|
41
46
|
class LoadablePlugin {
|
|
42
47
|
apply(compiler) {
|
|
43
48
|
this.compiler = compiler;
|
|
@@ -66,13 +71,19 @@ class LoadablePlugin {
|
|
|
66
71
|
outputPath: true,
|
|
67
72
|
publicPath: true
|
|
68
73
|
});
|
|
74
|
+
const namedChunkGroups = {};
|
|
75
|
+
for (const [name, group] of Object.entries(stats.namedChunkGroups || {}))namedChunkGroups[name] = normalizeChunkGroup(group);
|
|
76
|
+
const entrypoints = {};
|
|
77
|
+
for (const [name, ep] of Object.entries(stats.entrypoints || {}))entrypoints[name] = normalizeChunkGroup(ep);
|
|
69
78
|
const output = {
|
|
70
79
|
...stats,
|
|
80
|
+
namedChunkGroups,
|
|
81
|
+
entrypoints,
|
|
71
82
|
generator: 'loadable-components',
|
|
72
83
|
chunks: [
|
|
73
84
|
...stats.chunks || []
|
|
74
85
|
].map((chunk)=>({
|
|
75
|
-
id: chunk.id,
|
|
86
|
+
id: normalizeChunkId(chunk.id),
|
|
76
87
|
files: [
|
|
77
88
|
...chunk.files || []
|
|
78
89
|
]
|
package/dist/cjs/cli/template.js
CHANGED
|
@@ -93,7 +93,7 @@ const entryForCSRWithRSC = ({ metaName, entryName, urlPath = '/', mountId = 'roo
|
|
|
93
93
|
|
|
94
94
|
setServerCallback(callServer);
|
|
95
95
|
|
|
96
|
-
const handleRedirectResponse = (res
|
|
96
|
+
const handleRedirectResponse = (res) => {
|
|
97
97
|
const { headers } = res;
|
|
98
98
|
const location = headers.get('X-Modernjs-Redirect');
|
|
99
99
|
const baseUrl = headers.get('X-Modernjs-BaseUrl');
|
|
@@ -189,7 +189,7 @@ const runtimeGlobalContextForRSCServer = ({ metaName })=>`
|
|
|
189
189
|
import { setGlobalContext } from '@${metaName}/runtime/context';
|
|
190
190
|
import AppProxy from './AppProxy';
|
|
191
191
|
|
|
192
|
-
const DefaultRoot = ({ children }
|
|
192
|
+
const DefaultRoot = ({ children }) =>
|
|
193
193
|
createElement(Fragment, null, children);
|
|
194
194
|
|
|
195
195
|
|
|
@@ -212,7 +212,7 @@ const runtimeGlobalContextForRSCClient = ({ metaName, customEntry })=>`
|
|
|
212
212
|
|
|
213
213
|
${customEntry ? 'setServerCallback(callServer);' : ''}
|
|
214
214
|
|
|
215
|
-
${customEntry ? `const handleRedirectResponse = (res
|
|
215
|
+
${customEntry ? `const handleRedirectResponse = (res) => {
|
|
216
216
|
const { headers } = res;
|
|
217
217
|
const location = headers.get('X-Modernjs-Redirect');
|
|
218
218
|
const baseUrl = headers.get('X-Modernjs-BaseUrl');
|
|
@@ -237,7 +237,7 @@ const runtimeGlobalContextForRSCClient = ({ metaName, customEntry })=>`
|
|
|
237
237
|
callServer: callServer,
|
|
238
238
|
})`};` : ''}
|
|
239
239
|
|
|
240
|
-
const DefaultRoot = ({ children }
|
|
240
|
+
const DefaultRoot = ({ children }) =>
|
|
241
241
|
createElement(Fragment, null, children);
|
|
242
242
|
|
|
243
243
|
${customEntry ? 'const RSCRoot = () => createElement(RscClientRoot, { rscPayload: data });' : ''}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import path_0 from "path";
|
|
2
2
|
import { fs } from "@modern-js/utils";
|
|
3
|
+
const normalizeChunkId = (id)=>'string' == typeof id && /^\d+$/.test(id) ? Number(id) : id;
|
|
4
|
+
const normalizeChunkGroup = (group)=>({
|
|
5
|
+
...group,
|
|
6
|
+
chunks: (group.chunks || []).map(normalizeChunkId)
|
|
7
|
+
});
|
|
3
8
|
class LoadablePlugin {
|
|
4
9
|
apply(compiler) {
|
|
5
10
|
this.compiler = compiler;
|
|
@@ -28,13 +33,19 @@ class LoadablePlugin {
|
|
|
28
33
|
outputPath: true,
|
|
29
34
|
publicPath: true
|
|
30
35
|
});
|
|
36
|
+
const namedChunkGroups = {};
|
|
37
|
+
for (const [name, group] of Object.entries(stats.namedChunkGroups || {}))namedChunkGroups[name] = normalizeChunkGroup(group);
|
|
38
|
+
const entrypoints = {};
|
|
39
|
+
for (const [name, ep] of Object.entries(stats.entrypoints || {}))entrypoints[name] = normalizeChunkGroup(ep);
|
|
31
40
|
const output = {
|
|
32
41
|
...stats,
|
|
42
|
+
namedChunkGroups,
|
|
43
|
+
entrypoints,
|
|
33
44
|
generator: 'loadable-components',
|
|
34
45
|
chunks: [
|
|
35
46
|
...stats.chunks || []
|
|
36
47
|
].map((chunk)=>({
|
|
37
|
-
id: chunk.id,
|
|
48
|
+
id: normalizeChunkId(chunk.id),
|
|
38
49
|
files: [
|
|
39
50
|
...chunk.files || []
|
|
40
51
|
]
|
|
@@ -48,7 +48,7 @@ const entryForCSRWithRSC = ({ metaName, entryName, urlPath = '/', mountId = 'roo
|
|
|
48
48
|
|
|
49
49
|
setServerCallback(callServer);
|
|
50
50
|
|
|
51
|
-
const handleRedirectResponse = (res
|
|
51
|
+
const handleRedirectResponse = (res) => {
|
|
52
52
|
const { headers } = res;
|
|
53
53
|
const location = headers.get('X-Modernjs-Redirect');
|
|
54
54
|
const baseUrl = headers.get('X-Modernjs-BaseUrl');
|
|
@@ -144,7 +144,7 @@ const runtimeGlobalContextForRSCServer = ({ metaName })=>`
|
|
|
144
144
|
import { setGlobalContext } from '@${metaName}/runtime/context';
|
|
145
145
|
import AppProxy from './AppProxy';
|
|
146
146
|
|
|
147
|
-
const DefaultRoot = ({ children }
|
|
147
|
+
const DefaultRoot = ({ children }) =>
|
|
148
148
|
createElement(Fragment, null, children);
|
|
149
149
|
|
|
150
150
|
|
|
@@ -167,7 +167,7 @@ const runtimeGlobalContextForRSCClient = ({ metaName, customEntry })=>`
|
|
|
167
167
|
|
|
168
168
|
${customEntry ? 'setServerCallback(callServer);' : ''}
|
|
169
169
|
|
|
170
|
-
${customEntry ? `const handleRedirectResponse = (res
|
|
170
|
+
${customEntry ? `const handleRedirectResponse = (res) => {
|
|
171
171
|
const { headers } = res;
|
|
172
172
|
const location = headers.get('X-Modernjs-Redirect');
|
|
173
173
|
const baseUrl = headers.get('X-Modernjs-BaseUrl');
|
|
@@ -192,7 +192,7 @@ const runtimeGlobalContextForRSCClient = ({ metaName, customEntry })=>`
|
|
|
192
192
|
callServer: callServer,
|
|
193
193
|
})`};` : ''}
|
|
194
194
|
|
|
195
|
-
const DefaultRoot = ({ children }
|
|
195
|
+
const DefaultRoot = ({ children }) =>
|
|
196
196
|
createElement(Fragment, null, children);
|
|
197
197
|
|
|
198
198
|
${customEntry ? 'const RSCRoot = () => createElement(RscClientRoot, { rscPayload: data });' : ''}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import "node:module";
|
|
2
2
|
import path_0 from "path";
|
|
3
3
|
import { fs } from "@modern-js/utils";
|
|
4
|
+
const normalizeChunkId = (id)=>'string' == typeof id && /^\d+$/.test(id) ? Number(id) : id;
|
|
5
|
+
const normalizeChunkGroup = (group)=>({
|
|
6
|
+
...group,
|
|
7
|
+
chunks: (group.chunks || []).map(normalizeChunkId)
|
|
8
|
+
});
|
|
4
9
|
class LoadablePlugin {
|
|
5
10
|
apply(compiler) {
|
|
6
11
|
this.compiler = compiler;
|
|
@@ -29,13 +34,19 @@ class LoadablePlugin {
|
|
|
29
34
|
outputPath: true,
|
|
30
35
|
publicPath: true
|
|
31
36
|
});
|
|
37
|
+
const namedChunkGroups = {};
|
|
38
|
+
for (const [name, group] of Object.entries(stats.namedChunkGroups || {}))namedChunkGroups[name] = normalizeChunkGroup(group);
|
|
39
|
+
const entrypoints = {};
|
|
40
|
+
for (const [name, ep] of Object.entries(stats.entrypoints || {}))entrypoints[name] = normalizeChunkGroup(ep);
|
|
32
41
|
const output = {
|
|
33
42
|
...stats,
|
|
43
|
+
namedChunkGroups,
|
|
44
|
+
entrypoints,
|
|
34
45
|
generator: 'loadable-components',
|
|
35
46
|
chunks: [
|
|
36
47
|
...stats.chunks || []
|
|
37
48
|
].map((chunk)=>({
|
|
38
|
-
id: chunk.id,
|
|
49
|
+
id: normalizeChunkId(chunk.id),
|
|
39
50
|
files: [
|
|
40
51
|
...chunk.files || []
|
|
41
52
|
]
|
|
@@ -49,7 +49,7 @@ const entryForCSRWithRSC = ({ metaName, entryName, urlPath = '/', mountId = 'roo
|
|
|
49
49
|
|
|
50
50
|
setServerCallback(callServer);
|
|
51
51
|
|
|
52
|
-
const handleRedirectResponse = (res
|
|
52
|
+
const handleRedirectResponse = (res) => {
|
|
53
53
|
const { headers } = res;
|
|
54
54
|
const location = headers.get('X-Modernjs-Redirect');
|
|
55
55
|
const baseUrl = headers.get('X-Modernjs-BaseUrl');
|
|
@@ -145,7 +145,7 @@ const runtimeGlobalContextForRSCServer = ({ metaName })=>`
|
|
|
145
145
|
import { setGlobalContext } from '@${metaName}/runtime/context';
|
|
146
146
|
import AppProxy from './AppProxy';
|
|
147
147
|
|
|
148
|
-
const DefaultRoot = ({ children }
|
|
148
|
+
const DefaultRoot = ({ children }) =>
|
|
149
149
|
createElement(Fragment, null, children);
|
|
150
150
|
|
|
151
151
|
|
|
@@ -168,7 +168,7 @@ const runtimeGlobalContextForRSCClient = ({ metaName, customEntry })=>`
|
|
|
168
168
|
|
|
169
169
|
${customEntry ? 'setServerCallback(callServer);' : ''}
|
|
170
170
|
|
|
171
|
-
${customEntry ? `const handleRedirectResponse = (res
|
|
171
|
+
${customEntry ? `const handleRedirectResponse = (res) => {
|
|
172
172
|
const { headers } = res;
|
|
173
173
|
const location = headers.get('X-Modernjs-Redirect');
|
|
174
174
|
const baseUrl = headers.get('X-Modernjs-BaseUrl');
|
|
@@ -193,7 +193,7 @@ const runtimeGlobalContextForRSCClient = ({ metaName, customEntry })=>`
|
|
|
193
193
|
callServer: callServer,
|
|
194
194
|
})`};` : ''}
|
|
195
195
|
|
|
196
|
-
const DefaultRoot = ({ children }
|
|
196
|
+
const DefaultRoot = ({ children }) =>
|
|
197
197
|
createElement(Fragment, null, children);
|
|
198
198
|
|
|
199
199
|
${customEntry ? 'const RSCRoot = () => createElement(RscClientRoot, { rscPayload: data });' : ''}
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "3.1.
|
|
18
|
+
"version": "3.1.5",
|
|
19
19
|
"engines": {
|
|
20
20
|
"node": ">=20"
|
|
21
21
|
},
|
|
@@ -215,12 +215,12 @@
|
|
|
215
215
|
"isbot": "3.8.0",
|
|
216
216
|
"react-helmet": "^6.1.0",
|
|
217
217
|
"react-is": "^18.3.1",
|
|
218
|
-
"@modern-js/
|
|
219
|
-
"@modern-js/plugin
|
|
220
|
-
"@modern-js/
|
|
221
|
-
"@modern-js/
|
|
222
|
-
"@modern-js/
|
|
223
|
-
"@modern-js/utils": "3.1.
|
|
218
|
+
"@modern-js/render": "3.1.5",
|
|
219
|
+
"@modern-js/plugin": "3.1.5",
|
|
220
|
+
"@modern-js/plugin-data-loader": "3.1.5",
|
|
221
|
+
"@modern-js/runtime-utils": "3.1.5",
|
|
222
|
+
"@modern-js/types": "3.1.5",
|
|
223
|
+
"@modern-js/utils": "3.1.5"
|
|
224
224
|
},
|
|
225
225
|
"peerDependencies": {
|
|
226
226
|
"react": ">=17.0.2",
|
|
@@ -228,8 +228,8 @@
|
|
|
228
228
|
},
|
|
229
229
|
"devDependencies": {
|
|
230
230
|
"@remix-run/web-fetch": "^4.1.3",
|
|
231
|
-
"@rsbuild/core": "2.0.0
|
|
232
|
-
"@rslib/core": "0.21.
|
|
231
|
+
"@rsbuild/core": "2.0.0",
|
|
232
|
+
"@rslib/core": "0.21.2",
|
|
233
233
|
"@testing-library/dom": "^10.4.1",
|
|
234
234
|
"@testing-library/react": "^16.3.2",
|
|
235
235
|
"@types/cookie": "0.6.0",
|
|
@@ -240,9 +240,9 @@
|
|
|
240
240
|
"react-dom": "^19.2.4",
|
|
241
241
|
"ts-node": "^10.9.2",
|
|
242
242
|
"typescript": "^5",
|
|
243
|
-
"@scripts/rstest-config": "2.66.0",
|
|
244
243
|
"@modern-js/rslib": "2.68.10",
|
|
245
|
-
"@
|
|
244
|
+
"@scripts/rstest-config": "2.66.0",
|
|
245
|
+
"@modern-js/app-tools": "3.1.5"
|
|
246
246
|
},
|
|
247
247
|
"sideEffects": false,
|
|
248
248
|
"publishConfig": {
|