@umijs/plugins 4.0.26 → 4.0.27

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/access.js CHANGED
@@ -131,6 +131,20 @@ export const useAccessMarkedRoutes = (routes: IRoute[]) => {
131
131
  }
132
132
  }
133
133
 
134
+ // check children access code
135
+ if (route.routes?.length) {
136
+ const isNoAccessibleChild = !route.routes.reduce((hasAccessibleChild, child) => {
137
+ process(child, accessCode, route);
138
+
139
+ return hasAccessibleChild || !child.unaccessible;
140
+ }, false);
141
+
142
+ // make sure parent route is unaccessible if all children are unaccessible
143
+ if (isNoAccessibleChild) {
144
+ route.unaccessible = true;
145
+ }
146
+ }
147
+
134
148
  return route;
135
149
  }
136
150
 
package/dist/layout.js CHANGED
@@ -123,16 +123,17 @@ const filterRoutes = (routes: IRoute[], filterFn: (route: IRoute) => boolean) =>
123
123
 
124
124
  let newRoutes = []
125
125
  for (const route of routes) {
126
+ const newRoute = {...route };
126
127
  if (filterFn(route)) {
127
- if (Array.isArray(route.routes)) {
128
- newRoutes.push(...filterRoutes(route.routes, filterFn))
128
+ if (Array.isArray(newRoute.routes)) {
129
+ newRoutes.push(...filterRoutes(newRoute.routes, filterFn))
129
130
  }
130
131
  } else {
131
- newRoutes.push(route);
132
- if (Array.isArray(route.routes)) {
133
- route.routes = filterRoutes(route.routes, filterFn);
134
- route.children = route.routes;
132
+ if (Array.isArray(newRoute.children)) {
133
+ newRoute.children = filterRoutes(newRoute.children, filterFn);
134
+ newRoute.routes = newRoute.children;
135
135
  }
136
+ newRoutes.push(newRoute);
136
137
  }
137
138
  }
138
139
 
@@ -155,6 +156,10 @@ const mapRoutes = (routes: IRoute[]) => {
155
156
  newRoute.routes = mapRoutes(route.routes);
156
157
  }
157
158
 
159
+ if (Array.isArray(route.children)) {
160
+ newRoute.children = mapRoutes(route.children);
161
+ }
162
+
158
163
  return newRoute
159
164
  })
160
165
  }
@@ -181,12 +186,14 @@ const { formatMessage } = useIntl();
181
186
  },
182
187
  });
183
188
 
184
- const matchedRoute = useMemo(() => matchRoutes(clientRoutes, location.pathname).pop()?.route, [location.pathname]);
189
+
185
190
  // \u73B0\u5728\u7684 layout \u53CA wrapper \u5B9E\u73B0\u662F\u901A\u8FC7\u7236\u8DEF\u7531\u7684\u5F62\u5F0F\u5B9E\u73B0\u7684, \u4F1A\u5BFC\u81F4\u8DEF\u7531\u6570\u636E\u591A\u4E86\u5197\u4F59\u5C42\u7EA7, proLayout \u6D88\u8D39\u65F6, \u65E0\u6CD5\u6B63\u786E\u5C55\u793A\u83DC\u5355, \u8FD9\u91CC\u5BF9\u5197\u4F59\u6570\u636E\u8FDB\u884C\u8FC7\u6EE4\u64CD\u4F5C
186
191
  const newRoutes = filterRoutes(clientRoutes.filter(route => route.id === 'ant-design-pro-layout'), (route) => {
187
192
  return (!!route.isLayout && route.id !== 'ant-design-pro-layout') || !!route.isWrapper;
188
193
  })
189
194
  const [route] = useAccessMarkedRoutes(mapRoutes(newRoutes));
195
+
196
+ const matchedRoute = useMemo(() => matchRoutes(route.children, location.pathname)?.pop?.()?.route, [location.pathname]);
190
197
 
191
198
  return (
192
199
  <ProLayout
@@ -41,6 +41,9 @@ var tailwindcss_default = (api) => {
41
41
  const generatedPath = (0, import_path.join)(api.paths.absTmpPath, outputPath);
42
42
  const binPath = getTailwindBinPath({ cwd: api.cwd });
43
43
  const configPath = (0, import_path.join)(process.env.APP_ROOT || api.cwd, "tailwind.config.js");
44
+ if (process.env.IS_UMI_BUILD_WORKER) {
45
+ return;
46
+ }
44
47
  return new Promise((resolve) => {
45
48
  tailwind = (0, import_plugin_utils.crossSpawn)(`${binPath}`, [
46
49
  "-c",
package/dist/unocss.js CHANGED
@@ -40,6 +40,8 @@ var unocss_default = (api) => {
40
40
  });
41
41
  const outputPath = "uno.css";
42
42
  api.onBeforeCompiler(() => {
43
+ if (process.env.IS_UMI_BUILD_WORKER)
44
+ return;
43
45
  if (!(0, import_fs.existsSync)((0, import_path.join)(api.paths.cwd, "unocss.config.ts")))
44
46
  api.logger.warn("\u8BF7\u5728\u9879\u76EE\u76EE\u5F55\u4E2D\u6DFB\u52A0 unocss.config.ts \u6587\u4EF6\uFF0C\u5E76\u914D\u7F6E\u9700\u8981\u7684 unocss presets\uFF0C\u5426\u5219\u63D2\u4EF6\u5C06\u6CA1\u6709\u6548\u679C\uFF01");
45
47
  const generatedPath = (0, import_path.join)(api.paths.absTmpPath, outputPath);
@@ -12,7 +12,7 @@ export function getMicroAppRouteComponent(opts: {
12
12
  const { base, masterHistoryType, appName, routeProps, routePath } = opts;
13
13
  const RouteComponent = () => {
14
14
  const match = useMatch(routePath);
15
- const url = match.pathnameBase;
15
+ const url = match ? match.pathnameBase : '';
16
16
  // 默认取静态配置的 base
17
17
  let umiConfigBase = base === '/' ? '' : base;
18
18
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/plugins",
3
- "version": "4.0.26",
3
+ "version": "4.0.27",
4
4
  "description": "@umijs/plugins",
5
5
  "homepage": "https://github.com/umijs/umi/tree/master/packages/plugins#readme",
6
6
  "bugs": "https://github.com/umijs/umi/issues",
@@ -27,7 +27,7 @@
27
27
  "@ant-design/antd-theme-variable": "^1.0.0",
28
28
  "@ant-design/icons": "^4.7.0",
29
29
  "@ant-design/pro-components": "^2.0.1",
30
- "@umijs/bundler-utils": "4.0.26",
30
+ "@umijs/bundler-utils": "4.0.27",
31
31
  "@umijs/valtio": "^1.0.0",
32
32
  "antd-dayjs-webpack-plugin": "^1.0.6",
33
33
  "axios": "^0.27.2",
@@ -38,6 +38,7 @@
38
38
  "dva-loading": "^3.0.22",
39
39
  "event-emitter": "~0.3.5",
40
40
  "fast-deep-equal": "3.1.3",
41
+ "intl": "1.2.5",
41
42
  "lodash": "^4.17.21",
42
43
  "moment": "^2.29.3",
43
44
  "qiankun": "^2.7.0",
@@ -47,7 +48,7 @@
47
48
  "warning": "^4.0.3"
48
49
  },
49
50
  "devDependencies": {
50
- "umi": "4.0.26"
51
+ "umi": "4.0.27"
51
52
  },
52
53
  "publishConfig": {
53
54
  "access": "public"