@umijs/core 4.3.6 → 4.3.8
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/index.js
CHANGED
package/dist/route/route.js
CHANGED
|
@@ -19,3 +19,9 @@ module.exports = __toCommonJS(route_exports);
|
|
|
19
19
|
__reExport(route_exports, require("./routesConfig"), module.exports);
|
|
20
20
|
__reExport(route_exports, require("./routesConvention"), module.exports);
|
|
21
21
|
__reExport(route_exports, require("./routeUtils"), module.exports);
|
|
22
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
23
|
+
0 && (module.exports = {
|
|
24
|
+
...require("./routesConfig"),
|
|
25
|
+
...require("./routesConvention"),
|
|
26
|
+
...require("./routeUtils")
|
|
27
|
+
});
|
|
@@ -42,10 +42,18 @@ function getConventionRoutes(opts) {
|
|
|
42
42
|
}
|
|
43
43
|
});
|
|
44
44
|
const routeIds = Object.keys(files).sort(import_utils2.byLongestFirst);
|
|
45
|
+
const parentToChildrenMap = /* @__PURE__ */ new Map();
|
|
46
|
+
routeIds.forEach((id) => {
|
|
47
|
+
const prefix = `${id}/`;
|
|
48
|
+
routeIds.filter((childId) => childId.startsWith(prefix) && childId !== id).forEach((childId) => {
|
|
49
|
+
if (!parentToChildrenMap.has(id)) {
|
|
50
|
+
parentToChildrenMap.set(id, []);
|
|
51
|
+
}
|
|
52
|
+
parentToChildrenMap.get(id).push(childId);
|
|
53
|
+
});
|
|
54
|
+
});
|
|
45
55
|
function defineNestedRoutes(defineRoute, parentId) {
|
|
46
|
-
const childRouteIds =
|
|
47
|
-
(id) => (0, import_utils2.findParentRouteId)(routeIds, id) === parentId
|
|
48
|
-
);
|
|
56
|
+
const childRouteIds = parentId ? parentToChildrenMap.get(parentId) || [] : routeIds;
|
|
49
57
|
for (let routeId of childRouteIds) {
|
|
50
58
|
let routePath = createRoutePath(
|
|
51
59
|
parentId ? routeId.slice(parentId.length + 1) : routeId
|
package/dist/route/utils.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export declare function createRouteId(file: string): string;
|
|
2
2
|
export declare function stripFileExtension(file: string): string;
|
|
3
3
|
export declare function byLongestFirst(a: string, b: string): number;
|
|
4
|
-
export declare function findParentRouteId(routeIds: string[], childRouteId: string): string | undefined;
|
|
5
4
|
export declare function isRouteModuleFile(opts: {
|
|
6
5
|
file: string;
|
|
7
6
|
exclude?: RegExp[];
|
package/dist/route/utils.js
CHANGED
|
@@ -21,7 +21,6 @@ var utils_exports = {};
|
|
|
21
21
|
__export(utils_exports, {
|
|
22
22
|
byLongestFirst: () => byLongestFirst,
|
|
23
23
|
createRouteId: () => createRouteId,
|
|
24
|
-
findParentRouteId: () => findParentRouteId,
|
|
25
24
|
isRouteModuleFile: () => isRouteModuleFile,
|
|
26
25
|
stripFileExtension: () => stripFileExtension
|
|
27
26
|
});
|
|
@@ -37,9 +36,6 @@ function stripFileExtension(file) {
|
|
|
37
36
|
function byLongestFirst(a, b) {
|
|
38
37
|
return b.length - a.length;
|
|
39
38
|
}
|
|
40
|
-
function findParentRouteId(routeIds, childRouteId) {
|
|
41
|
-
return routeIds.find((id) => childRouteId.startsWith(`${id}/`));
|
|
42
|
-
}
|
|
43
39
|
var routeModuleExts = [".js", ".jsx", ".ts", ".tsx", ".md", ".mdx", ".vue"];
|
|
44
40
|
function isRouteModuleFile(opts) {
|
|
45
41
|
for (const excludeRegExp of opts.exclude || []) {
|
|
@@ -53,7 +49,6 @@ function isRouteModuleFile(opts) {
|
|
|
53
49
|
0 && (module.exports = {
|
|
54
50
|
byLongestFirst,
|
|
55
51
|
createRouteId,
|
|
56
|
-
findParentRouteId,
|
|
57
52
|
isRouteModuleFile,
|
|
58
53
|
stripFileExtension
|
|
59
54
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/core",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.8",
|
|
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": {
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"compiled"
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@umijs/bundler-utils": "4.3.
|
|
19
|
-
"@umijs/utils": "4.3.
|
|
18
|
+
"@umijs/bundler-utils": "4.3.8",
|
|
19
|
+
"@umijs/utils": "4.3.8"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"dotenv": "16.0.0",
|