@modern-js/runtime 3.11.0 → 3.11.1
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 +5 -1
- package/dist/cjs/cli/ssr/mode.js +2 -2
- package/dist/cjs/core/compat/hooks.js +4 -4
- package/dist/cjs/core/constants.js +2 -3
- package/dist/cjs/core/server/shared.js +2 -2
- package/dist/cjs/core/server/tracer.js +3 -3
- package/dist/cjs/exports/config-routes.js +2 -2
- package/dist/cjs/router/cli/code/makeLegalIdentifier.js +2 -2
- package/dist/cjs/router/runtime/plugin.js +4 -2
- package/dist/esm/cli/ssr/loadable-bundler-plugin.mjs +5 -1
- package/dist/esm/router/runtime/plugin.mjs +4 -2
- package/dist/esm-node/cli/ssr/loadable-bundler-plugin.mjs +5 -1
- package/dist/esm-node/router/runtime/plugin.mjs +4 -2
- package/dist/types/router/runtime/types.d.ts +9 -0
- package/package.json +12 -12
- package/rstest.config.mts +8 -2
|
@@ -43,7 +43,11 @@ const external_path_namespaceObject = require("path");
|
|
|
43
43
|
var external_path_default = /*#__PURE__*/ __webpack_require__.n(external_path_namespaceObject);
|
|
44
44
|
const utils_namespaceObject = require("@modern-js/utils");
|
|
45
45
|
const DEFAULT_CHUNK_LOADING_GLOBAL = '__LOADABLE_LOADED_CHUNKS__';
|
|
46
|
-
const normalizeChunkId = (id)=>
|
|
46
|
+
const normalizeChunkId = (id)=>{
|
|
47
|
+
if ('string' != typeof id || !/^\d+$/.test(id)) return id;
|
|
48
|
+
const num = Number(id);
|
|
49
|
+
return String(num) === id ? num : id;
|
|
50
|
+
};
|
|
47
51
|
const normalizeChunkGroup = (group)=>({
|
|
48
52
|
...group,
|
|
49
53
|
chunks: (group.chunks || []).map(normalizeChunkId)
|
package/dist/cjs/cli/ssr/mode.js
CHANGED
|
@@ -40,8 +40,8 @@ function resolveSSRMode(params) {
|
|
|
40
40
|
}
|
|
41
41
|
return false;
|
|
42
42
|
}
|
|
43
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
44
|
-
resolveSSRMode:
|
|
43
|
+
__webpack_require__.d(__webpack_exports__, {}, {
|
|
44
|
+
resolveSSRMode: resolveSSRMode
|
|
45
45
|
});
|
|
46
46
|
exports.resolveSSRMode = __webpack_exports__.resolveSSRMode;
|
|
47
47
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
@@ -61,10 +61,10 @@ function getHookRunners(runtimeContext) {
|
|
|
61
61
|
config: ()=>hooks.config.call()
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
65
|
-
getHookRunners:
|
|
66
|
-
handleSetupResult:
|
|
67
|
-
transformHookRunner:
|
|
64
|
+
__webpack_require__.d(__webpack_exports__, {}, {
|
|
65
|
+
getHookRunners: getHookRunners,
|
|
66
|
+
handleSetupResult: handleSetupResult,
|
|
67
|
+
transformHookRunner: transformHookRunner
|
|
68
68
|
});
|
|
69
69
|
exports.getHookRunners = __webpack_exports__.getHookRunners;
|
|
70
70
|
exports.handleSetupResult = __webpack_exports__.handleSetupResult;
|
|
@@ -34,10 +34,9 @@ var RenderLevel = /*#__PURE__*/ function(RenderLevel) {
|
|
|
34
34
|
}({});
|
|
35
35
|
const SSR_DATA_JSON_ID = '__MODERN_SSR_DATA__';
|
|
36
36
|
const ROUTER_DATA_JSON_ID = '__MODERN_ROUTER_DATA__';
|
|
37
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
38
|
-
RenderLevel: ()=>RenderLevel
|
|
39
|
-
}, {
|
|
37
|
+
__webpack_require__.d(__webpack_exports__, {}, {
|
|
40
38
|
ROUTER_DATA_JSON_ID: ROUTER_DATA_JSON_ID,
|
|
39
|
+
RenderLevel: RenderLevel,
|
|
41
40
|
SSR_DATA_JSON_ID: SSR_DATA_JSON_ID
|
|
42
41
|
});
|
|
43
42
|
exports.ROUTER_DATA_JSON_ID = __webpack_exports__.ROUTER_DATA_JSON_ID;
|
|
@@ -30,8 +30,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
30
30
|
function buildHtml(template, callbacks) {
|
|
31
31
|
return callbacks.reduce((promise, buildHtmlCb)=>promise.then((template)=>buildHtmlCb(template)), Promise.resolve(template));
|
|
32
32
|
}
|
|
33
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
34
|
-
buildHtml:
|
|
33
|
+
__webpack_require__.d(__webpack_exports__, {}, {
|
|
34
|
+
buildHtml: buildHtml
|
|
35
35
|
});
|
|
36
36
|
exports.buildHtml = __webpack_exports__.buildHtml;
|
|
37
37
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
@@ -41,9 +41,9 @@ var SSRErrors = /*#__PURE__*/ function(SSRErrors) {
|
|
|
41
41
|
SSRErrors["LOADER_ERROR"] = "App error occurs during data loader";
|
|
42
42
|
return SSRErrors;
|
|
43
43
|
}({});
|
|
44
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
45
|
-
SSRErrors:
|
|
46
|
-
SSRTimings:
|
|
44
|
+
__webpack_require__.d(__webpack_exports__, {}, {
|
|
45
|
+
SSRErrors: SSRErrors,
|
|
46
|
+
SSRTimings: SSRTimings
|
|
47
47
|
});
|
|
48
48
|
exports.SSRErrors = __webpack_exports__.SSRErrors;
|
|
49
49
|
exports.SSRTimings = __webpack_exports__.SSRTimings;
|
|
@@ -30,8 +30,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
30
30
|
function defineRoutes(routesCallback) {
|
|
31
31
|
return routesCallback;
|
|
32
32
|
}
|
|
33
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
34
|
-
defineRoutes:
|
|
33
|
+
__webpack_require__.d(__webpack_exports__, {}, {
|
|
34
|
+
defineRoutes: defineRoutes
|
|
35
35
|
});
|
|
36
36
|
exports.defineRoutes = __webpack_exports__.defineRoutes;
|
|
37
37
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
@@ -35,8 +35,8 @@ function makeLegalIdentifier(str) {
|
|
|
35
35
|
if (/\d/.test(identifier[0]) || forbidList.has(identifier)) return `_${identifier}`;
|
|
36
36
|
return identifier || '_';
|
|
37
37
|
}
|
|
38
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
39
|
-
makeLegalIdentifier:
|
|
38
|
+
__webpack_require__.d(__webpack_exports__, {}, {
|
|
39
|
+
makeLegalIdentifier: makeLegalIdentifier
|
|
40
40
|
});
|
|
41
41
|
exports.makeLegalIdentifier = __webpack_exports__.makeLegalIdentifier;
|
|
42
42
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
@@ -88,7 +88,8 @@ const routerPlugin = (userConfig = {})=>({
|
|
|
88
88
|
});
|
|
89
89
|
api.wrapRoot((App)=>{
|
|
90
90
|
const mergedConfig = (0, merge_namespaceObject.merge)(api.getRuntimeConfig().router || {}, userConfig);
|
|
91
|
-
const { serverBase = [], supportHtml5History = true, basename = '', routesConfig, createRoutes } = mergedConfig;
|
|
91
|
+
const { serverBase = [], supportHtml5History = true, basename = '', routesConfig, createRoutes, future } = mergedConfig;
|
|
92
|
+
const useTransitions = mergedConfig.useTransitions ?? future?.v7_startTransition;
|
|
92
93
|
finalRouteConfig = {
|
|
93
94
|
routes: (0, index_js_namespaceObject.getGlobalRoutes)(),
|
|
94
95
|
globalApp: (0, index_js_namespaceObject.getGlobalLayoutApp)(),
|
|
@@ -122,7 +123,8 @@ const routerPlugin = (userConfig = {})=>({
|
|
|
122
123
|
const RouterContent = ()=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
123
124
|
children: [
|
|
124
125
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(router_namespaceObject.RouterProvider, {
|
|
125
|
-
router: router
|
|
126
|
+
router: router,
|
|
127
|
+
useTransitions: useTransitions
|
|
126
128
|
}),
|
|
127
129
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(EmptyComponent, {}),
|
|
128
130
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(EmptyComponent, {})
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import path_0 from "path";
|
|
2
2
|
import { fs } from "@modern-js/utils";
|
|
3
3
|
const DEFAULT_CHUNK_LOADING_GLOBAL = '__LOADABLE_LOADED_CHUNKS__';
|
|
4
|
-
const normalizeChunkId = (id)=>
|
|
4
|
+
const normalizeChunkId = (id)=>{
|
|
5
|
+
if ('string' != typeof id || !/^\d+$/.test(id)) return id;
|
|
6
|
+
const num = Number(id);
|
|
7
|
+
return String(num) === id ? num : id;
|
|
8
|
+
};
|
|
5
9
|
const normalizeChunkGroup = (group)=>({
|
|
6
10
|
...group,
|
|
7
11
|
chunks: (group.chunks || []).map(normalizeChunkId)
|
|
@@ -53,7 +53,8 @@ const routerPlugin = (userConfig = {})=>({
|
|
|
53
53
|
});
|
|
54
54
|
api.wrapRoot((App)=>{
|
|
55
55
|
const mergedConfig = merge(api.getRuntimeConfig().router || {}, userConfig);
|
|
56
|
-
const { serverBase = [], supportHtml5History = true, basename = '', routesConfig, createRoutes } = mergedConfig;
|
|
56
|
+
const { serverBase = [], supportHtml5History = true, basename = '', routesConfig, createRoutes, future } = mergedConfig;
|
|
57
|
+
const useTransitions = mergedConfig.useTransitions ?? future?.v7_startTransition;
|
|
57
58
|
finalRouteConfig = {
|
|
58
59
|
routes: getGlobalRoutes(),
|
|
59
60
|
globalApp: getGlobalLayoutApp(),
|
|
@@ -87,7 +88,8 @@ const routerPlugin = (userConfig = {})=>({
|
|
|
87
88
|
const RouterContent = ()=>/*#__PURE__*/ jsxs(Fragment, {
|
|
88
89
|
children: [
|
|
89
90
|
/*#__PURE__*/ jsx(RouterProvider, {
|
|
90
|
-
router: router
|
|
91
|
+
router: router,
|
|
92
|
+
useTransitions: useTransitions
|
|
91
93
|
}),
|
|
92
94
|
/*#__PURE__*/ jsx(EmptyComponent, {}),
|
|
93
95
|
/*#__PURE__*/ jsx(EmptyComponent, {})
|
|
@@ -2,7 +2,11 @@ import "node:module";
|
|
|
2
2
|
import path_0 from "path";
|
|
3
3
|
import { fs } from "@modern-js/utils";
|
|
4
4
|
const DEFAULT_CHUNK_LOADING_GLOBAL = '__LOADABLE_LOADED_CHUNKS__';
|
|
5
|
-
const normalizeChunkId = (id)=>
|
|
5
|
+
const normalizeChunkId = (id)=>{
|
|
6
|
+
if ('string' != typeof id || !/^\d+$/.test(id)) return id;
|
|
7
|
+
const num = Number(id);
|
|
8
|
+
return String(num) === id ? num : id;
|
|
9
|
+
};
|
|
6
10
|
const normalizeChunkGroup = (group)=>({
|
|
7
11
|
...group,
|
|
8
12
|
chunks: (group.chunks || []).map(normalizeChunkId)
|
|
@@ -54,7 +54,8 @@ const routerPlugin = (userConfig = {})=>({
|
|
|
54
54
|
});
|
|
55
55
|
api.wrapRoot((App)=>{
|
|
56
56
|
const mergedConfig = merge(api.getRuntimeConfig().router || {}, userConfig);
|
|
57
|
-
const { serverBase = [], supportHtml5History = true, basename = '', routesConfig, createRoutes } = mergedConfig;
|
|
57
|
+
const { serverBase = [], supportHtml5History = true, basename = '', routesConfig, createRoutes, future } = mergedConfig;
|
|
58
|
+
const useTransitions = mergedConfig.useTransitions ?? future?.v7_startTransition;
|
|
58
59
|
finalRouteConfig = {
|
|
59
60
|
routes: getGlobalRoutes(),
|
|
60
61
|
globalApp: getGlobalLayoutApp(),
|
|
@@ -88,7 +89,8 @@ const routerPlugin = (userConfig = {})=>({
|
|
|
88
89
|
const RouterContent = ()=>/*#__PURE__*/ jsxs(Fragment, {
|
|
89
90
|
children: [
|
|
90
91
|
/*#__PURE__*/ jsx(RouterProvider, {
|
|
91
|
-
router: router
|
|
92
|
+
router: router,
|
|
93
|
+
useTransitions: useTransitions
|
|
92
94
|
}),
|
|
93
95
|
/*#__PURE__*/ jsx(EmptyComponent, {}),
|
|
94
96
|
/*#__PURE__*/ jsx(EmptyComponent, {})
|
|
@@ -27,6 +27,15 @@ export type RouterConfig = {
|
|
|
27
27
|
supportHtml5History?: boolean;
|
|
28
28
|
basename?: string;
|
|
29
29
|
createRoutes?: () => RouteObject[];
|
|
30
|
+
/**
|
|
31
|
+
* Whether to wrap router state updates in `React.startTransition`.
|
|
32
|
+
* Passed to `<RouterProvider useTransitions>`. Defaults to React Router's behavior (enabled).
|
|
33
|
+
* Set to `false` to render route updates synchronously.
|
|
34
|
+
*/
|
|
35
|
+
useTransitions?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* @deprecated Use `useTransitions` instead.
|
|
38
|
+
*/
|
|
30
39
|
future?: Partial<{
|
|
31
40
|
v7_startTransition: boolean;
|
|
32
41
|
}>;
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "3.11.
|
|
18
|
+
"version": "3.11.1",
|
|
19
19
|
"engines": {
|
|
20
20
|
"node": ">=20"
|
|
21
21
|
},
|
|
@@ -203,7 +203,7 @@
|
|
|
203
203
|
"dependencies": {
|
|
204
204
|
"@loadable/component": "5.16.7",
|
|
205
205
|
"@loadable/server": "5.16.7",
|
|
206
|
-
"@swc/core": "1.16.
|
|
206
|
+
"@swc/core": "1.16.21",
|
|
207
207
|
"@swc/helpers": "^0.5.17",
|
|
208
208
|
"@swc/plugin-loadable-components": "^12.0.0",
|
|
209
209
|
"@types/loadable__component": "^5.13.10",
|
|
@@ -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/plugin": "3.11.
|
|
219
|
-
"@modern-js/plugin-data-loader": "3.11.
|
|
220
|
-
"@modern-js/render": "3.11.
|
|
221
|
-
"@modern-js/
|
|
222
|
-
"@modern-js/
|
|
223
|
-
"@modern-js/utils": "3.11.
|
|
218
|
+
"@modern-js/plugin": "3.11.1",
|
|
219
|
+
"@modern-js/plugin-data-loader": "3.11.1",
|
|
220
|
+
"@modern-js/render": "3.11.1",
|
|
221
|
+
"@modern-js/runtime-utils": "3.11.1",
|
|
222
|
+
"@modern-js/types": "3.11.1",
|
|
223
|
+
"@modern-js/utils": "3.11.1"
|
|
224
224
|
},
|
|
225
225
|
"peerDependencies": {
|
|
226
226
|
"react": ">=18.3.1",
|
|
@@ -228,7 +228,7 @@
|
|
|
228
228
|
},
|
|
229
229
|
"devDependencies": {
|
|
230
230
|
"@remix-run/web-fetch": "^4.1.3",
|
|
231
|
-
"@rsbuild/core": "2.
|
|
231
|
+
"@rsbuild/core": "2.3.1",
|
|
232
232
|
"@testing-library/dom": "^10.4.2",
|
|
233
233
|
"@testing-library/react": "^16.3.3",
|
|
234
234
|
"@types/cookie": "0.6.0",
|
|
@@ -239,9 +239,9 @@
|
|
|
239
239
|
"react-dom": "^19.3.1",
|
|
240
240
|
"ts-node": "^10.9.2",
|
|
241
241
|
"typescript": "^5",
|
|
242
|
-
"@modern-js/app-tools": "3.11.
|
|
243
|
-
"@
|
|
244
|
-
"@
|
|
242
|
+
"@modern-js/app-tools": "3.11.1",
|
|
243
|
+
"@modern-js/rslib": "3.11.1",
|
|
244
|
+
"@scripts/rstest-config": "2.66.5"
|
|
245
245
|
},
|
|
246
246
|
"sideEffects": false,
|
|
247
247
|
"publishConfig": {
|
package/rstest.config.mts
CHANGED
|
@@ -22,7 +22,10 @@ export default {
|
|
|
22
22
|
withTestPreset({
|
|
23
23
|
name: 'plugin-runtime-node',
|
|
24
24
|
testEnvironment: 'node',
|
|
25
|
-
exclude: [
|
|
25
|
+
exclude: [
|
|
26
|
+
'tests/router/prefetch.test.tsx',
|
|
27
|
+
'tests/router/useTransitions.test.tsx',
|
|
28
|
+
],
|
|
26
29
|
extends: commonConfig,
|
|
27
30
|
plugins: [
|
|
28
31
|
{
|
|
@@ -46,7 +49,10 @@ export default {
|
|
|
46
49
|
withTestPreset({
|
|
47
50
|
name: 'plugin-runtime-client',
|
|
48
51
|
testEnvironment: 'happy-dom',
|
|
49
|
-
include: [
|
|
52
|
+
include: [
|
|
53
|
+
'tests/router/prefetch.test.tsx',
|
|
54
|
+
'tests/router/useTransitions.test.tsx',
|
|
55
|
+
],
|
|
50
56
|
extends: commonConfig,
|
|
51
57
|
plugins: [
|
|
52
58
|
{
|