@umijs/core 4.0.4 → 4.0.7
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/config/config.js
CHANGED
|
@@ -119,7 +119,15 @@ class Config {
|
|
|
119
119
|
implementor: esbuild_1.default,
|
|
120
120
|
});
|
|
121
121
|
utils_1.register.clearFiles();
|
|
122
|
-
|
|
122
|
+
try {
|
|
123
|
+
config = utils_1.lodash.merge(config, require(configFile).default);
|
|
124
|
+
}
|
|
125
|
+
catch (e) {
|
|
126
|
+
// @ts-ignore
|
|
127
|
+
throw new Error(`Parse config file failed: [${configFile}]`, {
|
|
128
|
+
cause: e,
|
|
129
|
+
});
|
|
130
|
+
}
|
|
123
131
|
for (const file of utils_1.register.getFiles()) {
|
|
124
132
|
delete require.cache[file];
|
|
125
133
|
}
|
|
@@ -58,7 +58,7 @@ function transformRoute(opts) {
|
|
|
58
58
|
let path = opts.route.path;
|
|
59
59
|
wrappers.forEach((wrapper) => {
|
|
60
60
|
const { id } = transformRoute({
|
|
61
|
-
route: { path, component: wrapper },
|
|
61
|
+
route: { path, component: wrapper, isWrapper: true },
|
|
62
62
|
parentId,
|
|
63
63
|
memo: opts.memo,
|
|
64
64
|
onResolveComponent: opts.onResolveComponent,
|
|
@@ -68,6 +68,8 @@ function transformRoute(opts) {
|
|
|
68
68
|
});
|
|
69
69
|
opts.memo.ret[id].parentId = parentId;
|
|
70
70
|
opts.memo.ret[id].path = path;
|
|
71
|
+
// wrapper 处理后 真实 path 为空, 存储原 path 为 originPath 方便 layout 渲染
|
|
72
|
+
opts.memo.ret[id].originPath = opts.route.path;
|
|
71
73
|
}
|
|
72
74
|
if (opts.route.routes) {
|
|
73
75
|
transformRoutes({
|
|
@@ -64,9 +64,14 @@ function createRoutePath(routeId) {
|
|
|
64
64
|
.replace(/\$/g, ':')
|
|
65
65
|
// routes/not.nested -> routes/not/nested
|
|
66
66
|
.replace(/\./g, '/');
|
|
67
|
-
// /index/index ->
|
|
67
|
+
// /index/index -> ''
|
|
68
68
|
path = /\b\/?index\/index$/.test(path) ? path.replace(/\/?index$/, '') : path;
|
|
69
|
-
|
|
69
|
+
// /(?<!:)\/?\bindex$/
|
|
70
|
+
// e/index true
|
|
71
|
+
// index true
|
|
72
|
+
// e/:index false
|
|
73
|
+
// e/index -> e index -> '' e/:index -> e/:index
|
|
74
|
+
path = /\b\/?(?<!:)index$/.test(path) ? path.replace(/\/?index$/, '') : path;
|
|
70
75
|
path = /\b\/?README$/.test(path) ? path.replace(/\/?README$/, '') : path;
|
|
71
76
|
return path;
|
|
72
77
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/core",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.7",
|
|
4
4
|
"homepage": "https://github.com/umijs/umi/tree/master/packages/core#readme",
|
|
5
5
|
"bugs": "https://github.com/umijs/umi/issues",
|
|
6
6
|
"repository": {
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"test": "umi-scripts jest-turbo"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@umijs/bundler-utils": "4.0.
|
|
25
|
-
"@umijs/utils": "4.0.
|
|
24
|
+
"@umijs/bundler-utils": "4.0.7",
|
|
25
|
+
"@umijs/utils": "4.0.7"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"dotenv": "16.0.0",
|