@modern-js/runtime 2.0.0-beta.6 → 2.0.0-beta.7
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/CHANGELOG.md +28 -0
- package/dist/js/modern/router/runtime/index.js +0 -1
- package/dist/js/modern/router/runtime/plugin.js +10 -1
- package/dist/js/node/router/runtime/index.js +0 -1
- package/dist/js/node/router/runtime/plugin.js +7 -0
- package/dist/js/treeshaking/router/runtime/index.js +0 -1
- package/dist/js/treeshaking/router/runtime/plugin.js +11 -1
- package/dist/types/router/runtime/index.d.ts +0 -1
- package/dist/types/router/runtime/plugin.d.ts +1 -1
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# @modern-js/runtime
|
|
2
2
|
|
|
3
|
+
## 2.0.0-beta.7
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- dda38c9c3e: chore: v2
|
|
8
|
+
|
|
9
|
+
### Minor Changes
|
|
10
|
+
|
|
11
|
+
- c9e800d39a: feat: support React18 streaming SSR
|
|
12
|
+
feat: 支持 React18 流式 SSR
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- 6bda14ed71: feat: refactor router with react-router@6.4
|
|
17
|
+
|
|
18
|
+
feat: 使用 react-router@6.4 重构路由模块
|
|
19
|
+
|
|
20
|
+
- 8b8e1bb571: feat: support nested routes
|
|
21
|
+
feat: 支持嵌套路由
|
|
22
|
+
- Updated dependencies [edd1cfb1af]
|
|
23
|
+
- Updated dependencies [6bda14ed71]
|
|
24
|
+
- Updated dependencies [dda38c9c3e]
|
|
25
|
+
- Updated dependencies [8b8e1bb571]
|
|
26
|
+
- Updated dependencies [bbe4c4ab64]
|
|
27
|
+
- @modern-js/utils@2.0.0-beta.7
|
|
28
|
+
- @modern-js/types@2.0.0-beta.7
|
|
29
|
+
- @modern-js/plugin@2.0.0-beta.7
|
|
30
|
+
|
|
3
31
|
## 2.0.0-beta.6
|
|
4
32
|
|
|
5
33
|
### Major Changes
|
|
@@ -2,7 +2,6 @@ import { routerPlugin } from "./plugin";
|
|
|
2
2
|
var runtime_default = routerPlugin;
|
|
3
3
|
import { modifyRoutes } from "./plugin";
|
|
4
4
|
export * from "react-router-dom";
|
|
5
|
-
export * from "react-router-dom/server";
|
|
6
5
|
export * from "./withRouter";
|
|
7
6
|
export {
|
|
8
7
|
runtime_default as default,
|
|
@@ -22,7 +22,9 @@ import {
|
|
|
22
22
|
createBrowserRouter,
|
|
23
23
|
createHashRouter,
|
|
24
24
|
RouterProvider,
|
|
25
|
-
createRoutesFromElements
|
|
25
|
+
createRoutesFromElements,
|
|
26
|
+
useMatches,
|
|
27
|
+
useLocation
|
|
26
28
|
} from "react-router-dom";
|
|
27
29
|
import hoistNonReactStatics from "hoist-non-react-statics";
|
|
28
30
|
import { renderRoutes, urlJoin } from "./utils";
|
|
@@ -54,6 +56,13 @@ const routerPlugin = ({
|
|
|
54
56
|
name: "@modern-js/plugin-router",
|
|
55
57
|
setup: () => {
|
|
56
58
|
return {
|
|
59
|
+
init({ context }, next) {
|
|
60
|
+
context.router = {
|
|
61
|
+
useMatches,
|
|
62
|
+
useLocation
|
|
63
|
+
};
|
|
64
|
+
return next({ context });
|
|
65
|
+
},
|
|
57
66
|
hoc: ({ App }, next) => {
|
|
58
67
|
if (!finalRouteConfig && !createRoutes) {
|
|
59
68
|
return next({ App });
|
|
@@ -25,7 +25,6 @@ module.exports = __toCommonJS(runtime_exports);
|
|
|
25
25
|
var import_plugin = require("./plugin");
|
|
26
26
|
var import_plugin2 = require("./plugin");
|
|
27
27
|
__reExport(runtime_exports, require("react-router-dom"), module.exports);
|
|
28
|
-
__reExport(runtime_exports, require("react-router-dom/server"), module.exports);
|
|
29
28
|
__reExport(runtime_exports, require("./withRouter"), module.exports);
|
|
30
29
|
var runtime_default = import_plugin.routerPlugin;
|
|
31
30
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -78,6 +78,13 @@ const routerPlugin = ({
|
|
|
78
78
|
name: "@modern-js/plugin-router",
|
|
79
79
|
setup: () => {
|
|
80
80
|
return {
|
|
81
|
+
init({ context }, next) {
|
|
82
|
+
context.router = {
|
|
83
|
+
useMatches: import_react_router_dom.useMatches,
|
|
84
|
+
useLocation: import_react_router_dom.useLocation
|
|
85
|
+
};
|
|
86
|
+
return next({ context });
|
|
87
|
+
},
|
|
81
88
|
hoc: ({ App }, next) => {
|
|
82
89
|
if (!finalRouteConfig && !createRoutes) {
|
|
83
90
|
return next({ App });
|
|
@@ -2,6 +2,5 @@ import { routerPlugin } from "./plugin";
|
|
|
2
2
|
var runtime_default = routerPlugin;
|
|
3
3
|
import { modifyRoutes } from "./plugin";
|
|
4
4
|
export * from "react-router-dom";
|
|
5
|
-
export * from "react-router-dom/server";
|
|
6
5
|
export * from "./withRouter";
|
|
7
6
|
export { runtime_default as default, modifyRoutes };
|
|
@@ -51,7 +51,7 @@ function _objectSpreadProps(target, source) {
|
|
|
51
51
|
return target;
|
|
52
52
|
}
|
|
53
53
|
import { jsx } from "react/jsx-runtime";
|
|
54
|
-
import { createBrowserRouter, createHashRouter, RouterProvider, createRoutesFromElements } from "react-router-dom";
|
|
54
|
+
import { createBrowserRouter, createHashRouter, RouterProvider, createRoutesFromElements, useMatches, useLocation } from "react-router-dom";
|
|
55
55
|
import hoistNonReactStatics from "hoist-non-react-statics";
|
|
56
56
|
import { renderRoutes, urlJoin } from "./utils";
|
|
57
57
|
var finalRouteConfig = {
|
|
@@ -79,6 +79,16 @@ var routerPlugin = function(param) {
|
|
|
79
79
|
name: "@modern-js/plugin-router",
|
|
80
80
|
setup: function() {
|
|
81
81
|
return {
|
|
82
|
+
init: function init(param, next) {
|
|
83
|
+
var context = param.context;
|
|
84
|
+
context.router = {
|
|
85
|
+
useMatches: useMatches,
|
|
86
|
+
useLocation: useLocation
|
|
87
|
+
};
|
|
88
|
+
return next({
|
|
89
|
+
context: context
|
|
90
|
+
});
|
|
91
|
+
},
|
|
82
92
|
hoc: function(param, next) {
|
|
83
93
|
var App = param.App;
|
|
84
94
|
if (!finalRouteConfig && !createRoutes) {
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "2.0.0-beta.
|
|
14
|
+
"version": "2.0.0-beta.7",
|
|
15
15
|
"engines": {
|
|
16
16
|
"node": ">=14.17.6"
|
|
17
17
|
},
|
|
@@ -155,9 +155,9 @@
|
|
|
155
155
|
"redux-logger": "^3.0.6",
|
|
156
156
|
"serialize-javascript": "^6.0.0",
|
|
157
157
|
"styled-components": "^5.3.1",
|
|
158
|
-
"@modern-js/plugin": "2.0.0-beta.
|
|
159
|
-
"@modern-js/types": "2.0.0-beta.
|
|
160
|
-
"@modern-js/utils": "2.0.0-beta.
|
|
158
|
+
"@modern-js/plugin": "2.0.0-beta.7",
|
|
159
|
+
"@modern-js/types": "2.0.0-beta.7",
|
|
160
|
+
"@modern-js/utils": "2.0.0-beta.7"
|
|
161
161
|
},
|
|
162
162
|
"peerDependencies": {
|
|
163
163
|
"react": ">=17",
|
|
@@ -178,11 +178,11 @@
|
|
|
178
178
|
"react-dom": "^18",
|
|
179
179
|
"ts-jest": "^27.0.4",
|
|
180
180
|
"typescript": "^4",
|
|
181
|
-
"@modern-js/app-tools": "2.0.0-beta.
|
|
182
|
-
"@modern-js/core": "2.0.0-beta.
|
|
183
|
-
"@modern-js/server-core": "2.0.0-beta.
|
|
184
|
-
"@scripts/
|
|
185
|
-
"@scripts/
|
|
181
|
+
"@modern-js/app-tools": "2.0.0-beta.7",
|
|
182
|
+
"@modern-js/core": "2.0.0-beta.7",
|
|
183
|
+
"@modern-js/server-core": "2.0.0-beta.7",
|
|
184
|
+
"@scripts/jest-config": "2.0.0-beta.7",
|
|
185
|
+
"@scripts/build": "2.0.0-beta.7"
|
|
186
186
|
},
|
|
187
187
|
"sideEffects": false,
|
|
188
188
|
"modernConfig": {},
|