@modern-js/plugin-router-v5 2.13.4 → 2.15.0
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
CHANGED
@@ -1,5 +1,32 @@
|
|
1
1
|
# @modern-js/plugin-router-v5
|
2
2
|
|
3
|
+
## 2.15.0
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- 09a3e57: chore(runtime): remove unused @testing-library/react-hooks
|
8
|
+
|
9
|
+
chore(runtime): 移除多余的 @testing-library/react-hooks
|
10
|
+
|
11
|
+
- @modern-js/types@2.15.0
|
12
|
+
- @modern-js/utils@2.15.0
|
13
|
+
|
14
|
+
## 2.14.0
|
15
|
+
|
16
|
+
### Patch Changes
|
17
|
+
|
18
|
+
- 60a81d0: feat: add ssr.inlineScript for use inline json instead inline script when ssr
|
19
|
+
feat: 添加 ssr.inlineScript 用于在 ssr 模式下使用内联 json 而不是内联脚本
|
20
|
+
- Updated dependencies [4779152]
|
21
|
+
- Updated dependencies [9321bef]
|
22
|
+
- Updated dependencies [9b45c58]
|
23
|
+
- Updated dependencies [52d0cb1]
|
24
|
+
- Updated dependencies [60a81d0]
|
25
|
+
- Updated dependencies [dacef96]
|
26
|
+
- Updated dependencies [16399fd]
|
27
|
+
- @modern-js/utils@2.14.0
|
28
|
+
- @modern-js/types@2.14.0
|
29
|
+
|
3
30
|
## 2.13.4
|
4
31
|
|
5
32
|
### Patch Changes
|
@@ -36,6 +36,7 @@ var import_history = require("history");
|
|
36
36
|
var import_react_router_dom = require("react-router-dom");
|
37
37
|
var import_hoist_non_react_statics = __toESM(require("hoist-non-react-statics"));
|
38
38
|
var import_runtime = require("@modern-js/runtime");
|
39
|
+
var import_runtime2 = require("@modern-js/utils/runtime");
|
39
40
|
var import_utils = require("./utils");
|
40
41
|
const routerPlugin = ({
|
41
42
|
serverBase = [],
|
@@ -47,6 +48,9 @@ const routerPlugin = ({
|
|
47
48
|
}) => {
|
48
49
|
const isBrow = (0, import_runtime.isBrowser)();
|
49
50
|
const select = (pathname) => serverBase.find((baseUrl) => pathname.search(baseUrl) === 0) || "/";
|
51
|
+
if (isBrow) {
|
52
|
+
window._SERVER_DATA = (0, import_runtime2.parsedJSONFromElement)("__MODERN_SERVER_DATA__");
|
53
|
+
}
|
50
54
|
return {
|
51
55
|
name: "@modern-js/plugin-router",
|
52
56
|
setup: () => {
|
@@ -56,6 +56,7 @@ import { createBrowserHistory, createHashHistory } from "history";
|
|
56
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
|
+
import { parsedJSONFromElement } from "@modern-js/utils/runtime";
|
59
60
|
import { renderRoutes, getLocation, urlJoin } from "./utils";
|
60
61
|
var routerPlugin = function(param) {
|
61
62
|
var _param_serverBase = param.serverBase, serverBase = _param_serverBase === void 0 ? [] : _param_serverBase, customHistory = param.history, _param_supportHtml5History = param.supportHtml5History, supportHtml5History = _param_supportHtml5History === void 0 ? true : _param_supportHtml5History, routesConfig = param.routesConfig, createRoutes = param.createRoutes, _param_historyOptions = param.historyOptions, historyOptions = _param_historyOptions === void 0 ? {} : _param_historyOptions;
|
@@ -65,6 +66,9 @@ var routerPlugin = function(param) {
|
|
65
66
|
return pathname.search(baseUrl) === 0;
|
66
67
|
}) || "/";
|
67
68
|
};
|
69
|
+
if (isBrow) {
|
70
|
+
window._SERVER_DATA = parsedJSONFromElement("__MODERN_SERVER_DATA__");
|
71
|
+
}
|
68
72
|
return {
|
69
73
|
name: "@modern-js/plugin-router",
|
70
74
|
setup: function() {
|
@@ -12,6 +12,7 @@ import {
|
|
12
12
|
} from "react-router-dom";
|
13
13
|
import hoistNonReactStatics from "hoist-non-react-statics";
|
14
14
|
import { RuntimeReactContext, isBrowser } from "@modern-js/runtime";
|
15
|
+
import { parsedJSONFromElement } from "@modern-js/utils/runtime";
|
15
16
|
import { renderRoutes, getLocation, urlJoin } from "./utils";
|
16
17
|
const routerPlugin = ({
|
17
18
|
serverBase = [],
|
@@ -23,6 +24,9 @@ const routerPlugin = ({
|
|
23
24
|
}) => {
|
24
25
|
const isBrow = isBrowser();
|
25
26
|
const select = (pathname) => serverBase.find((baseUrl) => pathname.search(baseUrl) === 0) || "/";
|
27
|
+
if (isBrow) {
|
28
|
+
window._SERVER_DATA = parsedJSONFromElement("__MODERN_SERVER_DATA__");
|
29
|
+
}
|
26
30
|
return {
|
27
31
|
name: "@modern-js/plugin-router",
|
28
32
|
setup: () => {
|
package/package.json
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
"modern",
|
12
12
|
"modern.js"
|
13
13
|
],
|
14
|
-
"version": "2.
|
14
|
+
"version": "2.15.0",
|
15
15
|
"jsnext:source": "./src/index.ts",
|
16
16
|
"types": "./dist/types/cli/index.d.ts",
|
17
17
|
"main": "./dist/cjs/cli/index.js",
|
@@ -55,8 +55,8 @@
|
|
55
55
|
"history": "^4.7.9",
|
56
56
|
"hoist-non-react-statics": "^3.3.2",
|
57
57
|
"react-router-dom": "^5.3.4",
|
58
|
-
"@modern-js/types": "2.
|
59
|
-
"@modern-js/utils": "2.
|
58
|
+
"@modern-js/types": "2.15.0",
|
59
|
+
"@modern-js/utils": "2.15.0"
|
60
60
|
},
|
61
61
|
"peerDependencies": {
|
62
62
|
"react": ">=17",
|
@@ -66,7 +66,6 @@
|
|
66
66
|
"@babel/core": "^7.18.0",
|
67
67
|
"@babel/runtime": "^7.18.0",
|
68
68
|
"@testing-library/react": "^13.4.0",
|
69
|
-
"@testing-library/react-hooks": "^8.0.1",
|
70
69
|
"@types/invariant": "^2.2.30",
|
71
70
|
"@types/jest": "^29",
|
72
71
|
"@types/node": "^14",
|
@@ -75,12 +74,12 @@
|
|
75
74
|
"react-dom": "^18",
|
76
75
|
"ts-jest": "^29.0.4",
|
77
76
|
"typescript": "^4",
|
78
|
-
"@modern-js/app-tools": "2.
|
79
|
-
"@modern-js/core": "2.
|
80
|
-
"@modern-js/runtime": "2.
|
81
|
-
"@modern-js/utils": "2.
|
82
|
-
"@scripts/build": "2.
|
83
|
-
"@scripts/jest-config": "2.
|
77
|
+
"@modern-js/app-tools": "2.15.0",
|
78
|
+
"@modern-js/core": "2.15.0",
|
79
|
+
"@modern-js/runtime": "2.15.0",
|
80
|
+
"@modern-js/utils": "2.15.0",
|
81
|
+
"@scripts/build": "2.15.0",
|
82
|
+
"@scripts/jest-config": "2.15.0"
|
84
83
|
},
|
85
84
|
"sideEffects": false,
|
86
85
|
"modernConfig": {},
|