@modern-js/plugin-router-v5 0.0.0-next-20221221151319 → 2.0.0-beta.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.
@@ -23,7 +23,12 @@ import {
|
|
23
23
|
createBrowserHistory,
|
24
24
|
createHashHistory
|
25
25
|
} from "history";
|
26
|
-
import {
|
26
|
+
import {
|
27
|
+
Router,
|
28
|
+
StaticRouter,
|
29
|
+
useRouteMatch,
|
30
|
+
useLocation
|
31
|
+
} from "react-router-dom";
|
27
32
|
import hoistNonReactStatics from "hoist-non-react-statics";
|
28
33
|
import { RuntimeReactContext, isBrowser } from "@modern-js/runtime";
|
29
34
|
import { renderRoutes, getLocation, urlJoin } from "./utils";
|
@@ -40,6 +45,13 @@ const routerPlugin = ({
|
|
40
45
|
name: "@modern-js/plugin-router",
|
41
46
|
setup: () => {
|
42
47
|
return {
|
48
|
+
init({ context }, next) {
|
49
|
+
context.router = {
|
50
|
+
useRouteMatch,
|
51
|
+
useLocation
|
52
|
+
};
|
53
|
+
return next({ context });
|
54
|
+
},
|
43
55
|
hoc: ({ App }, next) => {
|
44
56
|
const getRouteApp = () => {
|
45
57
|
var _a;
|
@@ -63,6 +63,13 @@ const routerPlugin = ({
|
|
63
63
|
name: "@modern-js/plugin-router",
|
64
64
|
setup: () => {
|
65
65
|
return {
|
66
|
+
init({ context }, next) {
|
67
|
+
context.router = {
|
68
|
+
useRouteMatch: import_react_router_dom.useRouteMatch,
|
69
|
+
useLocation: import_react_router_dom.useLocation
|
70
|
+
};
|
71
|
+
return next({ context });
|
72
|
+
},
|
66
73
|
hoc: ({ App }, next) => {
|
67
74
|
const getRouteApp = () => {
|
68
75
|
var _a;
|
@@ -53,7 +53,7 @@ function _objectSpreadProps(target, source) {
|
|
53
53
|
import { jsx } from "react/jsx-runtime";
|
54
54
|
import { useContext } from "react";
|
55
55
|
import { createBrowserHistory, createHashHistory } from "history";
|
56
|
-
import { Router, StaticRouter } from "react-router-dom";
|
56
|
+
import { Router, StaticRouter, useRouteMatch, useLocation } from "react-router-dom";
|
57
57
|
import hoistNonReactStatics from "hoist-non-react-statics";
|
58
58
|
import { RuntimeReactContext, isBrowser } from "@modern-js/runtime";
|
59
59
|
import { renderRoutes, getLocation, urlJoin } from "./utils";
|
@@ -69,6 +69,16 @@ var routerPlugin = function(param) {
|
|
69
69
|
name: "@modern-js/plugin-router",
|
70
70
|
setup: function() {
|
71
71
|
return {
|
72
|
+
init: function init(param, next) {
|
73
|
+
var context = param.context;
|
74
|
+
context.router = {
|
75
|
+
useRouteMatch: useRouteMatch,
|
76
|
+
useLocation: useLocation
|
77
|
+
};
|
78
|
+
return next({
|
79
|
+
context: context
|
80
|
+
});
|
81
|
+
},
|
72
82
|
hoc: function(param, next) {
|
73
83
|
var App = param.App;
|
74
84
|
var getRouteApp = function() {
|
package/package.json
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
"modern",
|
12
12
|
"modern.js"
|
13
13
|
],
|
14
|
-
"version": "
|
14
|
+
"version": "2.0.0-beta.5",
|
15
15
|
"jsnext:source": "./src/index.ts",
|
16
16
|
"types": "./dist/types/cli/index.d.ts",
|
17
17
|
"main": "./dist/js/node/cli/index.js",
|
@@ -51,12 +51,12 @@
|
|
51
51
|
"dependencies": {
|
52
52
|
"history": "^4.7.9",
|
53
53
|
"react-router-dom": "^5.1.2",
|
54
|
+
"@modern-js/plugin": "2.0.0-beta.4",
|
55
|
+
"@modern-js/utils": "2.0.0-beta.4",
|
56
|
+
"@modern-js/types": "2.0.0-beta.4",
|
54
57
|
"hoist-non-react-statics": "^3.3.2",
|
55
58
|
"@types/history": "^4.7.9",
|
56
|
-
"@types/react-router-dom": "^5.1.8"
|
57
|
-
"@modern-js/plugin": "0.0.0-next-20221221151319",
|
58
|
-
"@modern-js/utils": "0.0.0-next-20221221151319",
|
59
|
-
"@modern-js/types": "0.0.0-next-20221221151319"
|
59
|
+
"@types/react-router-dom": "^5.1.8"
|
60
60
|
},
|
61
61
|
"peerDependencies": {
|
62
62
|
"react": ">=17",
|
@@ -68,19 +68,19 @@
|
|
68
68
|
"ts-jest": "^27.0.4",
|
69
69
|
"typescript": "^4",
|
70
70
|
"jest": "^27",
|
71
|
+
"@modern-js/runtime": "2.0.0-beta.5",
|
72
|
+
"@modern-js/core": "2.0.0-beta.4",
|
73
|
+
"@modern-js/utils": "2.0.0-beta.4",
|
71
74
|
"@babel/core": "^7.18.0",
|
72
75
|
"@babel/runtime": "^7.18.0",
|
73
76
|
"@types/jest": "^27",
|
74
77
|
"@types/node": "^14",
|
78
|
+
"@scripts/build": "2.0.0-beta.4",
|
79
|
+
"@modern-js/app-tools": "2.0.0-beta.4",
|
80
|
+
"@scripts/jest-config": "2.0.0-beta.4",
|
75
81
|
"@testing-library/react": "^13.4.0",
|
76
82
|
"@testing-library/react-hooks": "^8.0.1",
|
77
|
-
"@types/invariant": "^2.2.30"
|
78
|
-
"@modern-js/runtime": "0.0.0-next-20221221151319",
|
79
|
-
"@modern-js/core": "0.0.0-next-20221221151319",
|
80
|
-
"@modern-js/utils": "0.0.0-next-20221221151319",
|
81
|
-
"@scripts/build": "0.0.0-next-20221221151319",
|
82
|
-
"@modern-js/app-tools": "0.0.0-next-20221221151319",
|
83
|
-
"@scripts/jest-config": "0.0.0-next-20221221151319"
|
83
|
+
"@types/invariant": "^2.2.30"
|
84
84
|
},
|
85
85
|
"sideEffects": false,
|
86
86
|
"modernConfig": {},
|
package/CHANGELOG.md
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
# @modern-js/plugin-router-v5
|
2
|
-
|
3
|
-
## 0.0.0-next-20221221151319
|
4
|
-
|
5
|
-
### Major Changes
|
6
|
-
|
7
|
-
- dda38c9c3: chore: v2
|
8
|
-
|
9
|
-
### Minor Changes
|
10
|
-
|
11
|
-
- df7ee2d59: feat: runtime user config types extends
|
12
|
-
feat: runtime 用户配置类型扩展
|
13
|
-
|
14
|
-
### Patch Changes
|
15
|
-
|
16
|
-
- fe17f5105: fix: change plugin-router-legacy exports field for node environment
|
17
|
-
fix: 修改 plugin-router-legacy 的 exports 字段
|
18
|
-
- 6bda14ed7: feat: refactor router with react-router@6.4
|
19
|
-
|
20
|
-
feat: 使用 react-router@6.4 重构路由模块
|
21
|
-
|
22
|
-
- Updated dependencies [7879e8f71]
|
23
|
-
- Updated dependencies [6aca87501]
|
24
|
-
- Updated dependencies [2e6031955]
|
25
|
-
- Updated dependencies [7b7d12cf8]
|
26
|
-
- Updated dependencies [7efeed4a3]
|
27
|
-
- Updated dependencies [92f0eade3]
|
28
|
-
- Updated dependencies [edd1cfb1a]
|
29
|
-
- Updated dependencies [cc971eabf]
|
30
|
-
- Updated dependencies [5b9049f2e]
|
31
|
-
- Updated dependencies [6bda14ed7]
|
32
|
-
- Updated dependencies [92004d190]
|
33
|
-
- Updated dependencies [b8bbe036c]
|
34
|
-
- Updated dependencies [40ed5874c]
|
35
|
-
- Updated dependencies [87c1ff86b]
|
36
|
-
- Updated dependencies [d5a31df78]
|
37
|
-
- Updated dependencies [dda38c9c3]
|
38
|
-
- Updated dependencies [102d32e4b]
|
39
|
-
- Updated dependencies [8b8e1bb57]
|
40
|
-
- Updated dependencies [3bbea92b2]
|
41
|
-
- Updated dependencies [b710adb84]
|
42
|
-
- Updated dependencies [f17974937]
|
43
|
-
- Updated dependencies [ea7cf0625]
|
44
|
-
- Updated dependencies [bbe4c4ab6]
|
45
|
-
- Updated dependencies [e4558a0bc]
|
46
|
-
- Updated dependencies [abf3421a7]
|
47
|
-
- Updated dependencies [543be9558]
|
48
|
-
- Updated dependencies [14b712da8]
|
49
|
-
- @modern-js/types@0.0.0-next-20221221151319
|
50
|
-
- @modern-js/utils@0.0.0-next-20221221151319
|
51
|
-
- @modern-js/plugin@0.0.0-next-20221221151319
|