@modern-js/plugin-router-v7 2.68.0 → 2.68.2
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/index.js +18 -7
- package/dist/cjs/runtime/rsc.js +22 -0
- package/dist/esm/cli/index.js +19 -8
- package/dist/esm/runtime/rsc.js +1 -0
- package/dist/esm-node/cli/index.js +19 -8
- package/dist/esm-node/runtime/rsc.js +1 -0
- package/dist/types/runtime/rsc.d.ts +1 -0
- package/package.json +10 -10
package/dist/cjs/cli/index.js
CHANGED
|
@@ -32,7 +32,7 @@ __export(cli_exports, {
|
|
|
32
32
|
routerPlugin: () => routerPlugin
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(cli_exports);
|
|
35
|
-
var import_path = require("path");
|
|
35
|
+
var import_path = __toESM(require("path"));
|
|
36
36
|
var import_utils = require("@modern-js/utils");
|
|
37
37
|
const routerPlugin = () => ({
|
|
38
38
|
name: "@modern-js/plugin-router-v7",
|
|
@@ -43,6 +43,7 @@ const routerPlugin = () => ({
|
|
|
43
43
|
api.config(() => {
|
|
44
44
|
var _config_source;
|
|
45
45
|
const config = api.getNormalizedConfig();
|
|
46
|
+
const appContext = api.getAppContext();
|
|
46
47
|
const alias = config === null || config === void 0 ? void 0 : (_config_source = config.source) === null || _config_source === void 0 ? void 0 : _config_source.alias;
|
|
47
48
|
if (typeof alias !== "undefined") {
|
|
48
49
|
Object.keys(alias).forEach((key) => {
|
|
@@ -51,16 +52,26 @@ const routerPlugin = () => ({
|
|
|
51
52
|
}
|
|
52
53
|
});
|
|
53
54
|
}
|
|
55
|
+
const hasReactRouterDep = (0, import_utils.isDepExists)(appContext.appDirectory, "react-router");
|
|
54
56
|
const cjs = `${import_path.sep}cjs${import_path.sep}`;
|
|
55
57
|
const esm = `${import_path.sep}esm${import_path.sep}`;
|
|
56
|
-
const runtimeAlias = require.resolve("../runtime").replace(cjs, esm);
|
|
58
|
+
const runtimeAlias = hasReactRouterDep ? import_path.default.join(appContext.appDirectory, "node_modules", "react-router") : require.resolve("../runtime").replace(cjs, esm);
|
|
59
|
+
const finalAlias = {
|
|
60
|
+
"react-router-dom$": runtimeAlias,
|
|
61
|
+
"@remix-run/router": runtimeAlias,
|
|
62
|
+
"react-router-dom/server$": runtimeAlias,
|
|
63
|
+
[`@${appContext.metaName}/runtime/router/rsc`]: require.resolve("../runtime/rsc").replace(cjs, esm)
|
|
64
|
+
};
|
|
65
|
+
if (hasReactRouterDep) {
|
|
66
|
+
finalAlias["react-router/rsc$"] = require.resolve("react-router/rsc", {
|
|
67
|
+
paths: [
|
|
68
|
+
appContext.appDirectory
|
|
69
|
+
]
|
|
70
|
+
});
|
|
71
|
+
}
|
|
57
72
|
return {
|
|
58
73
|
resolve: {
|
|
59
|
-
alias:
|
|
60
|
-
"react-router-dom$": runtimeAlias,
|
|
61
|
-
"@remix-run/router": runtimeAlias,
|
|
62
|
-
"react-router-dom/server": runtimeAlias
|
|
63
|
-
}
|
|
74
|
+
alias: finalAlias
|
|
64
75
|
},
|
|
65
76
|
source: {
|
|
66
77
|
globalVars: {
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
+
var rsc_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(rsc_exports);
|
|
18
|
+
__reExport(rsc_exports, require("react-router/rsc"), module.exports);
|
|
19
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
20
|
+
0 && (module.exports = {
|
|
21
|
+
...require("react-router/rsc")
|
|
22
|
+
});
|
package/dist/esm/cli/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { _ as _define_property } from "@swc/helpers/_/_define_property";
|
|
2
|
+
import path, { sep } from "path";
|
|
3
|
+
import { isDepExists, logger } from "@modern-js/utils";
|
|
3
4
|
var routerPlugin = function() {
|
|
4
5
|
return {
|
|
5
6
|
name: "@modern-js/plugin-router-v7",
|
|
@@ -10,6 +11,7 @@ var routerPlugin = function() {
|
|
|
10
11
|
api.config(function() {
|
|
11
12
|
var _config_source;
|
|
12
13
|
var config = api.getNormalizedConfig();
|
|
14
|
+
var appContext = api.getAppContext();
|
|
13
15
|
var alias = config === null || config === void 0 ? void 0 : (_config_source = config.source) === null || _config_source === void 0 ? void 0 : _config_source.alias;
|
|
14
16
|
if (typeof alias !== "undefined") {
|
|
15
17
|
Object.keys(alias).forEach(function(key) {
|
|
@@ -18,16 +20,25 @@ var routerPlugin = function() {
|
|
|
18
20
|
}
|
|
19
21
|
});
|
|
20
22
|
}
|
|
23
|
+
var hasReactRouterDep = isDepExists(appContext.appDirectory, "react-router");
|
|
21
24
|
var cjs = "".concat(sep, "cjs").concat(sep);
|
|
22
25
|
var esm = "".concat(sep, "esm").concat(sep);
|
|
23
|
-
var runtimeAlias = require.resolve("../runtime").replace(cjs, esm);
|
|
26
|
+
var runtimeAlias = hasReactRouterDep ? path.join(appContext.appDirectory, "node_modules", "react-router") : require.resolve("../runtime").replace(cjs, esm);
|
|
27
|
+
var finalAlias = _define_property({
|
|
28
|
+
"react-router-dom$": runtimeAlias,
|
|
29
|
+
"@remix-run/router": runtimeAlias,
|
|
30
|
+
"react-router-dom/server$": runtimeAlias
|
|
31
|
+
}, "@".concat(appContext.metaName, "/runtime/router/rsc"), require.resolve("../runtime/rsc").replace(cjs, esm));
|
|
32
|
+
if (hasReactRouterDep) {
|
|
33
|
+
finalAlias["react-router/rsc$"] = require.resolve("react-router/rsc", {
|
|
34
|
+
paths: [
|
|
35
|
+
appContext.appDirectory
|
|
36
|
+
]
|
|
37
|
+
});
|
|
38
|
+
}
|
|
24
39
|
return {
|
|
25
40
|
resolve: {
|
|
26
|
-
alias:
|
|
27
|
-
"react-router-dom$": runtimeAlias,
|
|
28
|
-
"@remix-run/router": runtimeAlias,
|
|
29
|
-
"react-router-dom/server": runtimeAlias
|
|
30
|
-
}
|
|
41
|
+
alias: finalAlias
|
|
31
42
|
},
|
|
32
43
|
source: {
|
|
33
44
|
globalVars: {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "react-router/rsc";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { sep } from "path";
|
|
2
|
-
import { logger } from "@modern-js/utils";
|
|
1
|
+
import path, { sep } from "path";
|
|
2
|
+
import { isDepExists, logger } from "@modern-js/utils";
|
|
3
3
|
const routerPlugin = () => ({
|
|
4
4
|
name: "@modern-js/plugin-router-v7",
|
|
5
5
|
required: [
|
|
@@ -9,6 +9,7 @@ const routerPlugin = () => ({
|
|
|
9
9
|
api.config(() => {
|
|
10
10
|
var _config_source;
|
|
11
11
|
const config = api.getNormalizedConfig();
|
|
12
|
+
const appContext = api.getAppContext();
|
|
12
13
|
const alias = config === null || config === void 0 ? void 0 : (_config_source = config.source) === null || _config_source === void 0 ? void 0 : _config_source.alias;
|
|
13
14
|
if (typeof alias !== "undefined") {
|
|
14
15
|
Object.keys(alias).forEach((key) => {
|
|
@@ -17,16 +18,26 @@ const routerPlugin = () => ({
|
|
|
17
18
|
}
|
|
18
19
|
});
|
|
19
20
|
}
|
|
21
|
+
const hasReactRouterDep = isDepExists(appContext.appDirectory, "react-router");
|
|
20
22
|
const cjs = `${sep}cjs${sep}`;
|
|
21
23
|
const esm = `${sep}esm${sep}`;
|
|
22
|
-
const runtimeAlias = require.resolve("../runtime").replace(cjs, esm);
|
|
24
|
+
const runtimeAlias = hasReactRouterDep ? path.join(appContext.appDirectory, "node_modules", "react-router") : require.resolve("../runtime").replace(cjs, esm);
|
|
25
|
+
const finalAlias = {
|
|
26
|
+
"react-router-dom$": runtimeAlias,
|
|
27
|
+
"@remix-run/router": runtimeAlias,
|
|
28
|
+
"react-router-dom/server$": runtimeAlias,
|
|
29
|
+
[`@${appContext.metaName}/runtime/router/rsc`]: require.resolve("../runtime/rsc").replace(cjs, esm)
|
|
30
|
+
};
|
|
31
|
+
if (hasReactRouterDep) {
|
|
32
|
+
finalAlias["react-router/rsc$"] = require.resolve("react-router/rsc", {
|
|
33
|
+
paths: [
|
|
34
|
+
appContext.appDirectory
|
|
35
|
+
]
|
|
36
|
+
});
|
|
37
|
+
}
|
|
23
38
|
return {
|
|
24
39
|
resolve: {
|
|
25
|
-
alias:
|
|
26
|
-
"react-router-dom$": runtimeAlias,
|
|
27
|
-
"@remix-run/router": runtimeAlias,
|
|
28
|
-
"react-router-dom/server": runtimeAlias
|
|
29
|
-
}
|
|
40
|
+
alias: finalAlias
|
|
30
41
|
},
|
|
31
42
|
source: {
|
|
32
43
|
globalVars: {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "react-router/rsc";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from 'react-router/rsc';
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "2.68.
|
|
18
|
+
"version": "2.68.2",
|
|
19
19
|
"jsnext:source": "./src/index.ts",
|
|
20
20
|
"types": "./dist/types/cli/index.d.ts",
|
|
21
21
|
"main": "./dist/cjs/cli/index.js",
|
|
@@ -52,14 +52,14 @@
|
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@swc/helpers": "^0.5.17",
|
|
55
|
-
"react-router": "
|
|
56
|
-
"@modern-js/runtime-utils": "2.68.
|
|
57
|
-
"@modern-js/utils": "2.68.
|
|
55
|
+
"react-router": "7.6.0",
|
|
56
|
+
"@modern-js/runtime-utils": "2.68.2",
|
|
57
|
+
"@modern-js/utils": "2.68.2"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
60
|
"react": ">=17",
|
|
61
61
|
"react-dom": ">=17",
|
|
62
|
-
"@modern-js/runtime": "^2.68.
|
|
62
|
+
"@modern-js/runtime": "^2.68.2"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@testing-library/react": "^13.4.0",
|
|
@@ -70,11 +70,11 @@
|
|
|
70
70
|
"react-dom": "^18.3.1",
|
|
71
71
|
"ts-jest": "^29.1.0",
|
|
72
72
|
"typescript": "^5",
|
|
73
|
-
"@modern-js/app-tools": "2.68.
|
|
74
|
-
"@modern-js/core": "2.68.
|
|
75
|
-
"@modern-js/runtime": "2.68.
|
|
76
|
-
"@scripts/
|
|
77
|
-
"@scripts/
|
|
73
|
+
"@modern-js/app-tools": "2.68.2",
|
|
74
|
+
"@modern-js/core": "2.68.2",
|
|
75
|
+
"@modern-js/runtime": "2.68.2",
|
|
76
|
+
"@scripts/build": "2.66.0",
|
|
77
|
+
"@scripts/jest-config": "2.66.0"
|
|
78
78
|
},
|
|
79
79
|
"sideEffects": false,
|
|
80
80
|
"publishConfig": {
|