@umijs/core 4.0.0-rc.13 → 4.0.0-rc.14

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.
@@ -30,11 +30,11 @@ function transformRoutes(opts) {
30
30
  function transformRoute(opts) {
31
31
  (0, assert_1.default)(!opts.route.children, 'children is not allowed in route props, use routes instead.');
32
32
  const id = String(opts.memo.id++);
33
- const _a = opts.route, { routes, component } = _a, routeProps = __rest(_a, ["routes", "component"]);
33
+ const _a = opts.route, { routes, component, wrappers } = _a, routeProps = __rest(_a, ["routes", "component", "wrappers"]);
34
34
  let absPath = opts.route.path;
35
35
  if ((absPath === null || absPath === void 0 ? void 0 : absPath.charAt(0)) !== '/') {
36
36
  const parentAbsPath = opts.parentId
37
- ? opts.memo.ret[opts.parentId].absPath.replace(/\/*$/, '/') // to remove '/'s on the tail
37
+ ? opts.memo.ret[opts.parentId].absPath.replace(/\/+$/, '/') // to remove '/'s on the tail
38
38
  : '/';
39
39
  absPath = parentAbsPath + absPath;
40
40
  }
@@ -42,6 +42,21 @@ function transformRoute(opts) {
42
42
  if (absPath) {
43
43
  opts.memo.ret[id].absPath = absPath;
44
44
  }
45
+ if (wrappers === null || wrappers === void 0 ? void 0 : wrappers.length) {
46
+ let parentId = opts.parentId;
47
+ let path = opts.route.path;
48
+ wrappers.forEach((wrapper) => {
49
+ const { id } = transformRoute({
50
+ route: { path, component: wrapper },
51
+ parentId,
52
+ memo: opts.memo,
53
+ });
54
+ parentId = id;
55
+ path = '';
56
+ });
57
+ opts.memo.ret[id].parentId = parentId;
58
+ opts.memo.ret[id].path = path;
59
+ }
45
60
  if (opts.route.routes) {
46
61
  transformRoutes({
47
62
  routes: opts.route.routes,
@@ -49,4 +64,5 @@ function transformRoute(opts) {
49
64
  memo: opts.memo,
50
65
  });
51
66
  }
67
+ return { id };
52
68
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/core",
3
- "version": "4.0.0-rc.13",
3
+ "version": "4.0.0-rc.14",
4
4
  "homepage": "https://github.com/umijs/umi-next/tree/master/packages/core#readme",
5
5
  "bugs": "https://github.com/umijs/umi-next/issues",
6
6
  "repository": {
@@ -16,13 +16,13 @@
16
16
  ],
17
17
  "scripts": {
18
18
  "build": "pnpm tsc",
19
- "build:deps": "pnpm esno ../../scripts/bundleDeps.ts",
19
+ "build:deps": "umi-scripts bundleDeps",
20
20
  "dev": "pnpm build -- --watch",
21
- "test": "jest -c ../../jest.turbo.config.ts"
21
+ "test": "umi-scripts jest-turbo"
22
22
  },
23
23
  "dependencies": {
24
- "@umijs/bundler-utils": "4.0.0-rc.13",
25
- "@umijs/utils": "4.0.0-rc.13"
24
+ "@umijs/bundler-utils": "4.0.0-rc.14",
25
+ "@umijs/utils": "4.0.0-rc.14"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@hapi/joi": "17.1.1",