@modern-js/plugin-router-v5 2.18.0 → 2.18.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/CHANGELOG.md
CHANGED
@@ -12,7 +12,7 @@ const _history = require("history");
|
|
12
12
|
const _reactrouterdom = require("react-router-dom");
|
13
13
|
const _hoistnonreactstatics = /* @__PURE__ */ _interop_require_default(require("hoist-non-react-statics"));
|
14
14
|
const _runtime = require("@modern-js/runtime");
|
15
|
-
const
|
15
|
+
const _runtimebrowser = require("@modern-js/utils/runtime-browser");
|
16
16
|
const _utils = require("./utils");
|
17
17
|
function _interop_require_default(obj) {
|
18
18
|
return obj && obj.__esModule ? obj : {
|
@@ -63,7 +63,7 @@ const routerPlugin = ({ serverBase = [], history: customHistory, supportHtml5His
|
|
63
63
|
const isBrow = (0, _runtime.isBrowser)();
|
64
64
|
const select = (pathname) => serverBase.find((baseUrl) => pathname.search(baseUrl) === 0) || "/";
|
65
65
|
if (isBrow) {
|
66
|
-
window._SERVER_DATA = (0,
|
66
|
+
window._SERVER_DATA = (0, _runtimebrowser.parsedJSONFromElement)("__MODERN_SERVER_DATA__");
|
67
67
|
}
|
68
68
|
return {
|
69
69
|
name: "@modern-js/plugin-router",
|
@@ -56,7 +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
|
+
import { parsedJSONFromElement } from "@modern-js/utils/runtime-browser";
|
60
60
|
import { renderRoutes, getLocation, urlJoin } from "./utils";
|
61
61
|
export var routerPlugin = function(param) {
|
62
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;
|
@@ -4,7 +4,7 @@ import { createBrowserHistory, createHashHistory } from "history";
|
|
4
4
|
import { Router, StaticRouter, useRouteMatch, useLocation } from "react-router-dom";
|
5
5
|
import hoistNonReactStatics from "hoist-non-react-statics";
|
6
6
|
import { RuntimeReactContext, isBrowser } from "@modern-js/runtime";
|
7
|
-
import { parsedJSONFromElement } from "@modern-js/utils/runtime";
|
7
|
+
import { parsedJSONFromElement } from "@modern-js/utils/runtime-browser";
|
8
8
|
import { renderRoutes, getLocation, urlJoin } from "./utils";
|
9
9
|
export const routerPlugin = ({ serverBase = [], history: customHistory, supportHtml5History = true, routesConfig, createRoutes, historyOptions = {} }) => {
|
10
10
|
const isBrow = isBrowser();
|
package/package.json
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
"modern",
|
16
16
|
"modern.js"
|
17
17
|
],
|
18
|
-
"version": "2.18.
|
18
|
+
"version": "2.18.1",
|
19
19
|
"jsnext:source": "./src/index.ts",
|
20
20
|
"types": "./dist/types/cli/index.d.ts",
|
21
21
|
"main": "./dist/cjs/cli/index.js",
|
@@ -59,8 +59,8 @@
|
|
59
59
|
"history": "^4.7.9",
|
60
60
|
"hoist-non-react-statics": "^3.3.2",
|
61
61
|
"react-router-dom": "^5.3.4",
|
62
|
-
"@modern-js/types": "2.18.
|
63
|
-
"@modern-js/utils": "2.18.
|
62
|
+
"@modern-js/types": "2.18.1",
|
63
|
+
"@modern-js/utils": "2.18.1"
|
64
64
|
},
|
65
65
|
"peerDependencies": {
|
66
66
|
"react": ">=17",
|
@@ -78,12 +78,12 @@
|
|
78
78
|
"react-dom": "^18",
|
79
79
|
"ts-jest": "^29.0.4",
|
80
80
|
"typescript": "^4",
|
81
|
-
"@modern-js/app-tools": "2.18.
|
82
|
-
"@modern-js/core": "2.18.
|
83
|
-
"@modern-js/runtime": "2.18.
|
84
|
-
"@modern-js/utils": "2.18.
|
85
|
-
"@scripts/build": "2.18.
|
86
|
-
"@scripts/jest-config": "2.18.
|
81
|
+
"@modern-js/app-tools": "2.18.1",
|
82
|
+
"@modern-js/core": "2.18.1",
|
83
|
+
"@modern-js/runtime": "2.18.1",
|
84
|
+
"@modern-js/utils": "2.18.1",
|
85
|
+
"@scripts/build": "2.18.1",
|
86
|
+
"@scripts/jest-config": "2.18.1"
|
87
87
|
},
|
88
88
|
"sideEffects": false,
|
89
89
|
"modernConfig": {},
|