@modern-js/plugin-router-v5 2.66.0 → 2.67.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/dist/cjs/cli/index.js +15 -19
- package/dist/cjs/runtime/plugin.js +2 -1
- package/dist/esm/cli/index.js +21 -25
- package/dist/esm/runtime/plugin.js +2 -2
- package/dist/esm-node/cli/index.js +16 -20
- package/dist/esm-node/runtime/plugin.js +2 -1
- package/package.json +10 -10
package/dist/cjs/cli/index.js
CHANGED
@@ -32,23 +32,21 @@ const routerPlugin = () => ({
|
|
32
32
|
setup: (api) => {
|
33
33
|
let routerExportsUtils;
|
34
34
|
api._internalRuntimePlugins(({ entrypoint, plugins }) => {
|
35
|
+
var _getEntryOptions;
|
35
36
|
const userConfig = api.getNormalizedConfig();
|
36
37
|
const { serverRoutes, metaName, packageName } = api.getAppContext();
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
}
|
50
|
-
});
|
51
|
-
}
|
38
|
+
const routerConfig = (_getEntryOptions = (0, import_utils.getEntryOptions)(entrypoint.entryName, entrypoint.isMainEntry, userConfig.runtime, userConfig.runtimeByEntries, packageName)) === null || _getEntryOptions === void 0 ? void 0 : _getEntryOptions.router;
|
39
|
+
const serverBase = serverRoutes.filter((route) => route.entryName === entrypoint.entryName).map((route) => route.urlPath).sort((a, b) => a.length - b.length > 0 ? -1 : 1);
|
40
|
+
plugins.push({
|
41
|
+
name: "router",
|
42
|
+
path: `@${metaName}/plugin-router-v5/runtime`,
|
43
|
+
config: typeof routerConfig === "boolean" ? {
|
44
|
+
serverBase
|
45
|
+
} : {
|
46
|
+
...routerConfig,
|
47
|
+
serverBase
|
48
|
+
}
|
49
|
+
});
|
52
50
|
return {
|
53
51
|
entrypoint,
|
54
52
|
plugins
|
@@ -69,10 +67,8 @@ const routerPlugin = () => ({
|
|
69
67
|
const userConfig = api.getNormalizedConfig();
|
70
68
|
const { internalDirectory, metaName } = api.getAppContext();
|
71
69
|
const pluginsExportsUtils = (0, import_utils.createRuntimeExportsUtils)(internalDirectory, "plugins");
|
72
|
-
|
73
|
-
|
74
|
-
routerExportsUtils === null || routerExportsUtils === void 0 ? void 0 : routerExportsUtils.addExport(`export * from '@${metaName}/plugin-router-v5/runtime'`);
|
75
|
-
}
|
70
|
+
pluginsExportsUtils.addExport(`export { default as router } from '@${metaName}/plugin-router-v5/runtime'`);
|
71
|
+
routerExportsUtils === null || routerExportsUtils === void 0 ? void 0 : routerExportsUtils.addExport(`export * from '@${metaName}/plugin-router-v5/runtime'`);
|
76
72
|
});
|
77
73
|
}
|
78
74
|
});
|
@@ -99,7 +99,8 @@ const routerPlugin = (userConfig = {}) => {
|
|
99
99
|
location: location1,
|
100
100
|
context: routerContext,
|
101
101
|
children: createRoutes ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(App, {
|
102
|
-
Component: createRoutes()
|
102
|
+
Component: createRoutes(),
|
103
|
+
...props
|
103
104
|
}) : App && !(finalRouteConfig === null || finalRouteConfig === void 0 ? void 0 : finalRouteConfig.routes) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(App, {
|
104
105
|
...props
|
105
106
|
}) : (0, import_utils.renderRoutes)(finalRouteConfig, props)
|
package/dist/esm/cli/index.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { _ as _define_property } from "@swc/helpers/_/_define_property";
|
2
2
|
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
3
3
|
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
4
|
-
import { createRuntimeExportsUtils, getEntryOptions
|
4
|
+
import { createRuntimeExportsUtils, getEntryOptions } from "@modern-js/utils";
|
5
5
|
import "./types";
|
6
6
|
var routerPlugin = function() {
|
7
7
|
return {
|
@@ -13,28 +13,26 @@ var routerPlugin = function() {
|
|
13
13
|
var routerExportsUtils;
|
14
14
|
api._internalRuntimePlugins(function(param) {
|
15
15
|
var entrypoint = param.entrypoint, plugins = param.plugins;
|
16
|
+
var _getEntryOptions;
|
16
17
|
var userConfig = api.getNormalizedConfig();
|
17
18
|
var _api_getAppContext = api.getAppContext(), serverRoutes = _api_getAppContext.serverRoutes, metaName = _api_getAppContext.metaName, packageName = _api_getAppContext.packageName;
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
})
|
36
|
-
});
|
37
|
-
}
|
19
|
+
var routerConfig = (_getEntryOptions = getEntryOptions(entrypoint.entryName, entrypoint.isMainEntry, userConfig.runtime, userConfig.runtimeByEntries, packageName)) === null || _getEntryOptions === void 0 ? void 0 : _getEntryOptions.router;
|
20
|
+
var serverBase = serverRoutes.filter(function(route) {
|
21
|
+
return route.entryName === entrypoint.entryName;
|
22
|
+
}).map(function(route) {
|
23
|
+
return route.urlPath;
|
24
|
+
}).sort(function(a, b) {
|
25
|
+
return a.length - b.length > 0 ? -1 : 1;
|
26
|
+
});
|
27
|
+
plugins.push({
|
28
|
+
name: "router",
|
29
|
+
path: "@".concat(metaName, "/plugin-router-v5/runtime"),
|
30
|
+
config: typeof routerConfig === "boolean" ? {
|
31
|
+
serverBase
|
32
|
+
} : _object_spread_props(_object_spread({}, routerConfig), {
|
33
|
+
serverBase
|
34
|
+
})
|
35
|
+
});
|
38
36
|
return {
|
39
37
|
entrypoint,
|
40
38
|
plugins
|
@@ -53,10 +51,8 @@ var routerPlugin = function() {
|
|
53
51
|
var userConfig = api.getNormalizedConfig();
|
54
52
|
var _api_getAppContext = api.getAppContext(), internalDirectory = _api_getAppContext.internalDirectory, metaName = _api_getAppContext.metaName;
|
55
53
|
var pluginsExportsUtils = createRuntimeExportsUtils(internalDirectory, "plugins");
|
56
|
-
|
57
|
-
|
58
|
-
routerExportsUtils === null || routerExportsUtils === void 0 ? void 0 : routerExportsUtils.addExport("export * from '@".concat(metaName, "/plugin-router-v5/runtime'"));
|
59
|
-
}
|
54
|
+
pluginsExportsUtils.addExport("export { default as router } from '@".concat(metaName, "/plugin-router-v5/runtime'"));
|
55
|
+
routerExportsUtils === null || routerExportsUtils === void 0 ? void 0 : routerExportsUtils.addExport("export * from '@".concat(metaName, "/plugin-router-v5/runtime'"));
|
60
56
|
});
|
61
57
|
}
|
62
58
|
};
|
@@ -78,9 +78,9 @@ var routerPlugin = function() {
|
|
78
78
|
basename: basename === "/" ? "" : basename,
|
79
79
|
location: location1,
|
80
80
|
context: routerContext,
|
81
|
-
children: createRoutes ? /* @__PURE__ */ _jsx(App, {
|
81
|
+
children: createRoutes ? /* @__PURE__ */ _jsx(App, _object_spread({
|
82
82
|
Component: createRoutes()
|
83
|
-
}) : App && !(finalRouteConfig === null || finalRouteConfig === void 0 ? void 0 : finalRouteConfig.routes) ? /* @__PURE__ */ _jsx(App, _object_spread({}, props)) : renderRoutes(finalRouteConfig, props)
|
83
|
+
}, props)) : App && !(finalRouteConfig === null || finalRouteConfig === void 0 ? void 0 : finalRouteConfig.routes) ? /* @__PURE__ */ _jsx(App, _object_spread({}, props)) : renderRoutes(finalRouteConfig, props)
|
84
84
|
});
|
85
85
|
};
|
86
86
|
};
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { createRuntimeExportsUtils, getEntryOptions
|
1
|
+
import { createRuntimeExportsUtils, getEntryOptions } from "@modern-js/utils";
|
2
2
|
import "./types";
|
3
3
|
const routerPlugin = () => ({
|
4
4
|
name: "@modern-js/plugin-router-v5",
|
@@ -8,23 +8,21 @@ const routerPlugin = () => ({
|
|
8
8
|
setup: (api) => {
|
9
9
|
let routerExportsUtils;
|
10
10
|
api._internalRuntimePlugins(({ entrypoint, plugins }) => {
|
11
|
+
var _getEntryOptions;
|
11
12
|
const userConfig = api.getNormalizedConfig();
|
12
13
|
const { serverRoutes, metaName, packageName } = api.getAppContext();
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
}
|
26
|
-
});
|
27
|
-
}
|
14
|
+
const routerConfig = (_getEntryOptions = getEntryOptions(entrypoint.entryName, entrypoint.isMainEntry, userConfig.runtime, userConfig.runtimeByEntries, packageName)) === null || _getEntryOptions === void 0 ? void 0 : _getEntryOptions.router;
|
15
|
+
const serverBase = serverRoutes.filter((route) => route.entryName === entrypoint.entryName).map((route) => route.urlPath).sort((a, b) => a.length - b.length > 0 ? -1 : 1);
|
16
|
+
plugins.push({
|
17
|
+
name: "router",
|
18
|
+
path: `@${metaName}/plugin-router-v5/runtime`,
|
19
|
+
config: typeof routerConfig === "boolean" ? {
|
20
|
+
serverBase
|
21
|
+
} : {
|
22
|
+
...routerConfig,
|
23
|
+
serverBase
|
24
|
+
}
|
25
|
+
});
|
28
26
|
return {
|
29
27
|
entrypoint,
|
30
28
|
plugins
|
@@ -45,10 +43,8 @@ const routerPlugin = () => ({
|
|
45
43
|
const userConfig = api.getNormalizedConfig();
|
46
44
|
const { internalDirectory, metaName } = api.getAppContext();
|
47
45
|
const pluginsExportsUtils = createRuntimeExportsUtils(internalDirectory, "plugins");
|
48
|
-
|
49
|
-
|
50
|
-
routerExportsUtils === null || routerExportsUtils === void 0 ? void 0 : routerExportsUtils.addExport(`export * from '@${metaName}/plugin-router-v5/runtime'`);
|
51
|
-
}
|
46
|
+
pluginsExportsUtils.addExport(`export { default as router } from '@${metaName}/plugin-router-v5/runtime'`);
|
47
|
+
routerExportsUtils === null || routerExportsUtils === void 0 ? void 0 : routerExportsUtils.addExport(`export * from '@${metaName}/plugin-router-v5/runtime'`);
|
52
48
|
});
|
53
49
|
}
|
54
50
|
});
|
@@ -76,7 +76,8 @@ const routerPlugin = (userConfig = {}) => {
|
|
76
76
|
location: location1,
|
77
77
|
context: routerContext,
|
78
78
|
children: createRoutes ? /* @__PURE__ */ _jsx(App, {
|
79
|
-
Component: createRoutes()
|
79
|
+
Component: createRoutes(),
|
80
|
+
...props
|
80
81
|
}) : App && !(finalRouteConfig === null || finalRouteConfig === void 0 ? void 0 : finalRouteConfig.routes) ? /* @__PURE__ */ _jsx(App, {
|
81
82
|
...props
|
82
83
|
}) : renderRoutes(finalRouteConfig, props)
|
package/package.json
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
"modern",
|
16
16
|
"modern.js"
|
17
17
|
],
|
18
|
-
"version": "2.
|
18
|
+
"version": "2.67.0",
|
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,16 +59,16 @@
|
|
59
59
|
"@types/react-router-dom": "^5.1.8",
|
60
60
|
"history": "^4.7.9",
|
61
61
|
"react-router-dom": "^5.3.4",
|
62
|
-
"@modern-js/plugin": "2.
|
63
|
-
"@modern-js/plugin-v2": "2.
|
64
|
-
"@modern-js/runtime-utils": "2.
|
65
|
-
"@modern-js/types": "2.
|
66
|
-
"@modern-js/utils": "2.
|
62
|
+
"@modern-js/plugin": "2.67.0",
|
63
|
+
"@modern-js/plugin-v2": "2.67.0",
|
64
|
+
"@modern-js/runtime-utils": "2.67.0",
|
65
|
+
"@modern-js/types": "2.67.0",
|
66
|
+
"@modern-js/utils": "2.67.0"
|
67
67
|
},
|
68
68
|
"peerDependencies": {
|
69
69
|
"react": ">=17",
|
70
70
|
"react-dom": ">=17",
|
71
|
-
"@modern-js/runtime": "^2.
|
71
|
+
"@modern-js/runtime": "^2.67.0"
|
72
72
|
},
|
73
73
|
"devDependencies": {
|
74
74
|
"@testing-library/react": "^13.4.0",
|
@@ -80,9 +80,9 @@
|
|
80
80
|
"react-dom": "^18.3.1",
|
81
81
|
"ts-jest": "^29.1.0",
|
82
82
|
"typescript": "^5",
|
83
|
-
"@modern-js/app-tools": "2.
|
84
|
-
"@modern-js/core": "2.
|
85
|
-
"@modern-js/runtime": "2.
|
83
|
+
"@modern-js/app-tools": "2.67.0",
|
84
|
+
"@modern-js/core": "2.67.0",
|
85
|
+
"@modern-js/runtime": "2.67.0",
|
86
86
|
"@scripts/build": "2.66.0",
|
87
87
|
"@scripts/jest-config": "2.66.0"
|
88
88
|
},
|