@modern-js/plugin-router-v7 0.0.0-next-20250708024045 → 0.0.0-next-20250709162233

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.
@@ -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",
@@ -55,15 +55,23 @@ const routerPlugin = () => ({
55
55
  const hasReactRouterDep = (0, import_utils.isDepExists)(appContext.appDirectory, "react-router");
56
56
  const cjs = `${import_path.sep}cjs${import_path.sep}`;
57
57
  const esm = `${import_path.sep}esm${import_path.sep}`;
58
- const runtimeAlias = hasReactRouterDep ? "react-router" : 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
+ }
59
72
  return {
60
73
  resolve: {
61
- alias: {
62
- "react-router-dom$": runtimeAlias,
63
- "@remix-run/router": runtimeAlias,
64
- "react-router-dom/server$": runtimeAlias,
65
- [`@${appContext.metaName}/runtime/router/rsc`]: require.resolve("../runtime/rsc").replace(/\/cjs\//, "/esm/")
66
- }
74
+ alias: finalAlias
67
75
  },
68
76
  source: {
69
77
  globalVars: {
@@ -1,5 +1,5 @@
1
1
  import { _ as _define_property } from "@swc/helpers/_/_define_property";
2
- import { sep } from "path";
2
+ import path, { sep } from "path";
3
3
  import { isDepExists, logger } from "@modern-js/utils";
4
4
  var routerPlugin = function() {
5
5
  return {
@@ -23,14 +23,22 @@ var routerPlugin = function() {
23
23
  var hasReactRouterDep = isDepExists(appContext.appDirectory, "react-router");
24
24
  var cjs = "".concat(sep, "cjs").concat(sep);
25
25
  var esm = "".concat(sep, "esm").concat(sep);
26
- var runtimeAlias = hasReactRouterDep ? "react-router" : 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
+ }
27
39
  return {
28
40
  resolve: {
29
- alias: _define_property({
30
- "react-router-dom$": runtimeAlias,
31
- "@remix-run/router": runtimeAlias,
32
- "react-router-dom/server$": runtimeAlias
33
- }, "@".concat(appContext.metaName, "/runtime/router/rsc"), require.resolve("../runtime/rsc").replace(/\/cjs\//, "/esm/"))
41
+ alias: finalAlias
34
42
  },
35
43
  source: {
36
44
  globalVars: {
@@ -1,4 +1,4 @@
1
- import { sep } from "path";
1
+ import path, { sep } from "path";
2
2
  import { isDepExists, logger } from "@modern-js/utils";
3
3
  const routerPlugin = () => ({
4
4
  name: "@modern-js/plugin-router-v7",
@@ -21,15 +21,23 @@ const routerPlugin = () => ({
21
21
  const hasReactRouterDep = isDepExists(appContext.appDirectory, "react-router");
22
22
  const cjs = `${sep}cjs${sep}`;
23
23
  const esm = `${sep}esm${sep}`;
24
- const runtimeAlias = hasReactRouterDep ? "react-router" : 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
+ }
25
38
  return {
26
39
  resolve: {
27
- alias: {
28
- "react-router-dom$": runtimeAlias,
29
- "@remix-run/router": runtimeAlias,
30
- "react-router-dom/server$": runtimeAlias,
31
- [`@${appContext.metaName}/runtime/router/rsc`]: require.resolve("../runtime/rsc").replace(/\/cjs\//, "/esm/")
32
- }
40
+ alias: finalAlias
33
41
  },
34
42
  source: {
35
43
  globalVars: {
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "0.0.0-next-20250708024045",
18
+ "version": "0.0.0-next-20250709162233",
19
19
  "jsnext:source": "./src/index.ts",
20
20
  "types": "./dist/types/cli/index.d.ts",
21
21
  "main": "./dist/cjs/cli/index.js",
@@ -47,22 +47,19 @@
47
47
  ],
48
48
  "runtime": [
49
49
  "./dist/types/runtime/index.d.ts"
50
- ],
51
- "rsc": [
52
- "./dist/types/runtime/rsc.d.ts"
53
50
  ]
54
51
  }
55
52
  },
56
53
  "dependencies": {
57
54
  "@swc/helpers": "^0.5.17",
58
55
  "react-router": "7.6.0",
59
- "@modern-js/runtime-utils": "0.0.0-next-20250708024045",
60
- "@modern-js/utils": "0.0.0-next-20250708024045"
56
+ "@modern-js/runtime-utils": "0.0.0-next-20250709162233",
57
+ "@modern-js/utils": "0.0.0-next-20250709162233"
61
58
  },
62
59
  "peerDependencies": {
63
60
  "react": ">=17",
64
61
  "react-dom": ">=17",
65
- "@modern-js/runtime": "0.0.0-next-20250708024045"
62
+ "@modern-js/runtime": "0.0.0-next-20250709162233"
66
63
  },
67
64
  "devDependencies": {
68
65
  "@testing-library/react": "^13.4.0",
@@ -73,11 +70,11 @@
73
70
  "react-dom": "^18.3.1",
74
71
  "ts-jest": "^29.1.0",
75
72
  "typescript": "^5",
76
- "@modern-js/app-tools": "0.0.0-next-20250708024045",
77
- "@modern-js/core": "0.0.0-next-20250708024045",
78
- "@modern-js/runtime": "0.0.0-next-20250708024045",
79
- "@scripts/build": "0.0.0-next-20250708024045",
80
- "@scripts/jest-config": "0.0.0-next-20250708024045"
73
+ "@modern-js/app-tools": "0.0.0-next-20250709162233",
74
+ "@modern-js/core": "0.0.0-next-20250709162233",
75
+ "@scripts/build": "0.0.0-next-20250709162233",
76
+ "@modern-js/runtime": "0.0.0-next-20250709162233",
77
+ "@scripts/jest-config": "0.0.0-next-20250709162233"
81
78
  },
82
79
  "sideEffects": false,
83
80
  "publishConfig": {