@umijs/plugins 4.0.0-canary.20220718.2 → 4.0.0-canary.20220729.1

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.
Files changed (72) hide show
  1. package/dist/access.d.ts +0 -1
  2. package/dist/access.js +69 -53
  3. package/dist/analytics.d.ts +0 -1
  4. package/dist/analytics.js +62 -41
  5. package/dist/antd.d.ts +0 -1
  6. package/dist/antd.js +139 -123
  7. package/dist/dva.d.ts +0 -1
  8. package/dist/dva.js +133 -142
  9. package/dist/icons.d.ts +0 -1
  10. package/dist/icons.js +28 -4
  11. package/dist/initial-state.d.ts +0 -1
  12. package/dist/initial-state.js +71 -54
  13. package/dist/layout.d.ts +0 -1
  14. package/dist/layout.js +205 -214
  15. package/dist/locale.d.ts +0 -1
  16. package/dist/locale.js +214 -192
  17. package/dist/mf.d.ts +2 -0
  18. package/dist/mf.js +197 -0
  19. package/dist/model.d.ts +0 -1
  20. package/dist/model.js +79 -78
  21. package/dist/moment2dayjs.d.ts +0 -1
  22. package/dist/moment2dayjs.js +102 -81
  23. package/dist/qiankun/constants.d.ts +0 -1
  24. package/dist/qiankun/constants.js +41 -8
  25. package/dist/qiankun/master.d.ts +0 -1
  26. package/dist/qiankun/master.js +147 -121
  27. package/dist/qiankun/slave.d.ts +0 -1
  28. package/dist/qiankun/slave.js +160 -150
  29. package/dist/qiankun.d.ts +0 -1
  30. package/dist/qiankun.js +46 -19
  31. package/dist/request.d.ts +0 -1
  32. package/dist/request.js +79 -55
  33. package/dist/tailwindcss.d.ts +0 -1
  34. package/dist/tailwindcss.js +70 -49
  35. package/dist/unocss.d.ts +0 -1
  36. package/dist/unocss.js +57 -37
  37. package/dist/utils/astUtils.d.ts +0 -1
  38. package/dist/utils/astUtils.js +38 -34
  39. package/dist/utils/localeUtils.d.ts +0 -1
  40. package/dist/utils/localeUtils.js +125 -120
  41. package/dist/utils/modelUtils.d.ts +0 -1
  42. package/dist/utils/modelUtils.js +216 -237
  43. package/dist/utils/resolveProjectDep.d.ts +0 -1
  44. package/dist/utils/resolveProjectDep.js +36 -13
  45. package/dist/utils/withTmpPath.d.ts +0 -1
  46. package/dist/utils/withTmpPath.js +31 -9
  47. package/libs/locale/localeExports.tpl +7 -3
  48. package/libs/qiankun/master/MicroApp.tsx +8 -2
  49. package/libs/qiankun/slave/lifecycles.ts +15 -7
  50. package/package.json +6 -6
  51. package/dist/access.d.ts.map +0 -1
  52. package/dist/analytics.d.ts.map +0 -1
  53. package/dist/antd.d.ts.map +0 -1
  54. package/dist/dva.d.ts.map +0 -1
  55. package/dist/icons.d.ts.map +0 -1
  56. package/dist/initial-state.d.ts.map +0 -1
  57. package/dist/layout.d.ts.map +0 -1
  58. package/dist/locale.d.ts.map +0 -1
  59. package/dist/model.d.ts.map +0 -1
  60. package/dist/moment2dayjs.d.ts.map +0 -1
  61. package/dist/qiankun/constants.d.ts.map +0 -1
  62. package/dist/qiankun/master.d.ts.map +0 -1
  63. package/dist/qiankun/slave.d.ts.map +0 -1
  64. package/dist/qiankun.d.ts.map +0 -1
  65. package/dist/request.d.ts.map +0 -1
  66. package/dist/tailwindcss.d.ts.map +0 -1
  67. package/dist/unocss.d.ts.map +0 -1
  68. package/dist/utils/astUtils.d.ts.map +0 -1
  69. package/dist/utils/localeUtils.d.ts.map +0 -1
  70. package/dist/utils/modelUtils.d.ts.map +0 -1
  71. package/dist/utils/resolveProjectDep.d.ts.map +0 -1
  72. package/dist/utils/withTmpPath.d.ts.map +0 -1
package/dist/layout.js CHANGED
@@ -1,120 +1,104 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
24
10
  };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- const allIcons = __importStar(require("@ant-design/icons"));
27
- const fs_1 = require("fs");
28
- const path_1 = require("path");
29
- const plugin_utils_1 = require("umi/plugin-utils");
30
- const withTmpPath_1 = require("./utils/withTmpPath");
31
- exports.default = (api) => {
32
- api.describe({
33
- key: 'layout',
34
- config: {
35
- schema(joi) {
36
- return joi.object();
37
- },
38
- onChange: api.ConfigChangeType.regenerateTmpFiles,
39
- },
40
- enableBy: api.EnableBy.config,
41
- });
42
- /**
43
- * 优先去找 '@alipay/tech-ui',保证稳定性
44
- */
45
- const depList = ['@alipay/tech-ui', '@ant-design/pro-layout'];
46
- const pkgHasDep = depList.find((dep) => {
47
- var _a, _b;
48
- const { pkg } = api;
49
- if (((_a = pkg.dependencies) === null || _a === void 0 ? void 0 : _a[dep]) || ((_b = pkg.devDependencies) === null || _b === void 0 ? void 0 : _b[dep])) {
50
- return true;
51
- }
52
- return false;
53
- });
54
- const getPkgPath = () => {
55
- // 如果 layout 和 techui 至少有一个在,找到他们的地址
56
- if (pkgHasDep &&
57
- (0, fs_1.existsSync)((0, path_1.join)(api.cwd, 'node_modules', pkgHasDep, 'package.json'))) {
58
- return (0, path_1.join)(api.cwd, 'node_modules', pkgHasDep);
59
- }
60
- const cwd = process.cwd();
61
- // support APP_ROOT
62
- if (pkgHasDep &&
63
- api.cwd !== cwd &&
64
- (0, fs_1.existsSync)((0, path_1.join)(cwd, 'node_modules', pkgHasDep, 'package.json'))) {
65
- return (0, path_1.join)(cwd, 'node_modules', pkgHasDep);
66
- }
67
- // 如果项目中没有去找插件以来的
68
- return (0, path_1.dirname)(require.resolve('@ant-design/pro-layout/package.json'));
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
+
22
+ // src/layout.ts
23
+ var layout_exports = {};
24
+ __export(layout_exports, {
25
+ default: () => layout_default
26
+ });
27
+ module.exports = __toCommonJS(layout_exports);
28
+ var allIcons = __toESM(require("@ant-design/icons"));
29
+ var import_fs = require("fs");
30
+ var import_path = require("path");
31
+ var import_plugin_utils = require("umi/plugin-utils");
32
+ var import_withTmpPath = require("./utils/withTmpPath");
33
+ var layout_default = (api) => {
34
+ api.describe({
35
+ key: "layout",
36
+ config: {
37
+ schema(Joi) {
38
+ return Joi.alternatives().try(Joi.object(), Joi.boolean().invalid(true));
39
+ },
40
+ onChange: api.ConfigChangeType.regenerateTmpFiles
41
+ },
42
+ enableBy: api.EnableBy.config
43
+ });
44
+ const depList = ["@alipay/tech-ui", "@ant-design/pro-layout"];
45
+ const pkgHasDep = depList.find((dep) => {
46
+ var _a, _b;
47
+ const { pkg } = api;
48
+ if (((_a = pkg.dependencies) == null ? void 0 : _a[dep]) || ((_b = pkg.devDependencies) == null ? void 0 : _b[dep])) {
49
+ return true;
50
+ }
51
+ return false;
52
+ });
53
+ const getPkgPath = () => {
54
+ if (pkgHasDep && (0, import_fs.existsSync)((0, import_path.join)(api.cwd, "node_modules", pkgHasDep, "package.json"))) {
55
+ return (0, import_path.join)(api.cwd, "node_modules", pkgHasDep);
56
+ }
57
+ const cwd = process.cwd();
58
+ if (pkgHasDep && api.cwd !== cwd && (0, import_fs.existsSync)((0, import_path.join)(cwd, "node_modules", pkgHasDep, "package.json"))) {
59
+ return (0, import_path.join)(cwd, "node_modules", pkgHasDep);
60
+ }
61
+ return (0, import_path.dirname)(require.resolve("@ant-design/pro-layout/package.json"));
62
+ };
63
+ const pkgPath = (0, import_plugin_utils.winPath)(getPkgPath());
64
+ api.modifyAppData((memo) => {
65
+ const version = require(`${pkgPath}/package.json`).version;
66
+ memo.pluginLayout = {
67
+ pkgPath,
68
+ version
69
69
  };
70
- const pkgPath = (0, plugin_utils_1.winPath)(getPkgPath());
71
- api.modifyAppData((memo) => {
72
- const version = require(`${pkgPath}/package.json`).version;
73
- memo.pluginLayout = {
74
- pkgPath,
75
- version,
76
- };
77
- return memo;
78
- });
79
- api.modifyConfig((memo) => {
80
- // 只在没有自行依赖 @ant-design/pro-layout 或 @alipay/tech-ui 时
81
- // 才使用插件中提供的 @ant-design/pro-layout
82
- if (!pkgHasDep) {
83
- memo.alias['@ant-design/pro-layout'] = pkgPath;
84
- }
85
- return memo;
86
- });
87
- api.onGenerateFiles(() => {
88
- const hasInitialStatePlugin = api.config.initialState;
89
- // Layout.tsx
90
- api.writeTmpFile({
91
- path: 'Layout.tsx',
92
- content: `
70
+ return memo;
71
+ });
72
+ api.modifyConfig((memo) => {
73
+ if (!pkgHasDep) {
74
+ memo.alias["@ant-design/pro-layout"] = pkgPath;
75
+ }
76
+ return memo;
77
+ });
78
+ api.onGenerateFiles(() => {
79
+ const hasInitialStatePlugin = api.config.initialState;
80
+ api.writeTmpFile({
81
+ path: "Layout.tsx",
82
+ content: `
93
83
  import { Link, useLocation, useNavigate, Outlet, useAppData, useRouteData, matchRoutes } from 'umi';
94
84
  import type { IRoute } from 'umi';
95
85
  import React, { useMemo } from 'react';
96
86
  import {
97
87
  ProLayout,
98
- } from "${pkgPath || '@ant-design/pro-layout'}";
88
+ } from "${pkgPath || "@ant-design/pro-layout"}";
99
89
  import './Layout.less';
100
90
  import Logo from './Logo';
101
91
  import Exception from './Exception';
102
92
  import { getRightRenderContent } from './rightRender';
103
- ${hasInitialStatePlugin
104
- ? `import { useModel } from '@@/plugin-model';`
105
- : 'const useModel = null;'}
106
- ${api.config.access
107
- ? `
93
+ ${hasInitialStatePlugin ? `import { useModel } from '@@/plugin-model';` : "const useModel = null;"}
94
+ ${api.config.access ? `
108
95
  import { useAccessMarkedRoutes } from '@@/plugin-access';
109
- `.trim()
110
- : 'const useAccessMarkedRoutes = (r) => r;'}
111
- ${api.config.locale
112
- ? `
96
+ `.trim() : "const useAccessMarkedRoutes = (r) => r;"}
97
+ ${api.config.locale ? `
113
98
  import { useIntl } from '@@/plugin-locale';
114
- `.trim()
115
- : ''}
99
+ `.trim() : ""}
116
100
 
117
- // 过滤出需要显示的路由, 这里的filterFn 不希望显示的层级
101
+ // \u8FC7\u6EE4\u51FA\u9700\u8981\u663E\u793A\u7684\u8DEF\u7531, \u8FD9\u91CC\u7684filterFn \u6307 \u4E0D\u5E0C\u671B\u663E\u793A\u7684\u5C42\u7EA7
118
102
  const filterRoutes = (routes: IRoute[], filterFn: (route: IRoute) => boolean) => {
119
103
  if (routes.length === 0) {
120
104
  return []
@@ -137,13 +121,13 @@ const filterRoutes = (routes: IRoute[], filterFn: (route: IRoute) => boolean) =>
137
121
  return newRoutes;
138
122
  }
139
123
 
140
- // 格式化路由 处理因 wrapper 导致的 菜单 path 不一致
124
+ // \u683C\u5F0F\u5316\u8DEF\u7531 \u5904\u7406\u56E0 wrapper \u5BFC\u81F4\u7684 \u83DC\u5355 path \u4E0D\u4E00\u81F4
141
125
  const mapRoutes = (routes: IRoute[]) => {
142
126
  if (routes.length === 0) {
143
127
  return []
144
128
  }
145
129
  return routes.map(route => {
146
- // 需要 copy 一份, 否则会污染原始数据
130
+ // \u9700\u8981 copy \u4E00\u4EFD, \u5426\u5219\u4F1A\u6C61\u67D3\u539F\u59CB\u6570\u636E
147
131
  const newRoute = {...route}
148
132
  if (route.originPath) {
149
133
  newRoute.path = route.originPath
@@ -168,11 +152,9 @@ export default (props: any) => {
168
152
  };
169
153
  const { initialState, loading, setInitialState } = initialInfo;
170
154
  const userConfig = ${JSON.stringify(api.config.layout, null, 2)};
171
- ${api.config.locale
172
- ? `
155
+ ${api.config.locale ? `
173
156
  const { formatMessage } = useIntl();
174
- `.trim()
175
- : 'const formatMessage = undefined;'}
157
+ `.trim() : "const formatMessage = undefined;"}
176
158
  const runtimeConfig = pluginManager.applyPlugins({
177
159
  key: 'layout',
178
160
  type: 'modify',
@@ -256,72 +238,82 @@ const { formatMessage } = useIntl();
256
238
  </ProLayout>
257
239
  );
258
240
  }
259
- `,
260
- });
261
- api.writeTmpFile({
262
- path: 'index.ts',
263
- content: `export type TempType = string`,
264
- });
265
- // 写入类型, RunTimeLayoutConfig 是 app.tsx 中 layout 配置的类型
266
- // 对于动态 layout 配置很有用
267
- api.writeTmpFile({
268
- path: 'types.d.ts',
269
- content: `
270
- import type { ProLayoutProps } from "${pkgPath || '@ant-design/pro-layout'}";
271
- ${hasInitialStatePlugin
272
- ? `import type InitialStateType from '@@/plugin-initialState/@@initialState';
241
+ `
242
+ });
243
+ api.writeTmpFile({
244
+ path: "index.ts",
245
+ content: `export type TempType = string`
246
+ });
247
+ api.writeTmpFile({
248
+ path: "types.d.ts",
249
+ content: `
250
+ import type { ProLayoutProps, HeaderProps } from "${pkgPath || "@ant-design/pro-layout"}";
251
+ ${hasInitialStatePlugin ? `import type InitialStateType from '@@/plugin-initialState/@@initialState';
273
252
  type InitDataType = ReturnType<typeof InitialStateType>;
274
- `
275
- : 'type InitDataType = any;'}
276
-
277
- export type RunTimeLayoutConfig = (
278
- initData: InitDataType,
279
- ) => ProLayoutProps & {
280
- childrenRender?: (dom: JSX.Element, props: ProLayoutProps) => React.ReactNode,
281
- unAccessible?: JSX.Element,
282
- noFound?: JSX.Element,
253
+ ` : "type InitDataType = any;"}
254
+ import { IConfigFromPlugins } from '@@/core/pluginConfig';
255
+
256
+ export type RunTimeLayoutConfig = (initData: InitDataType) => Omit<
257
+ ProLayoutProps,
258
+ 'rightContentRender'
259
+ > & {
260
+ childrenRender?: (dom: JSX.Element, props: ProLayoutProps) => React.ReactNode;
261
+ noAccessible?: JSX.Element;
262
+ notFound?: JSX.Element;
263
+ logout?: (initialState: InitDataType['initialState']) => Promise<void> | void;
264
+ rightContentRender?: (
265
+ headerProps: HeaderProps,
266
+ dom: JSX.Element,
267
+ props: {
268
+ userConfig: IConfigFromPlugins['layout'];
269
+ runtimeConfig: RunTimeLayoutConfig;
270
+ loading: InitDataType['loading'];
271
+ initialState: InitDataType['initialState'];
272
+ setInitialState: InitDataType['setInitialState'];
273
+ },
274
+ ) => JSX.Element;
275
+ rightRender?: (
276
+ initialState: InitDataType['initialState'],
277
+ setInitialState: InitDataType['setInitialState'],
278
+ runtimeConfig: RunTimeLayoutConfig,
279
+ ) => JSX.Element;
283
280
  };
284
- `,
285
- });
286
- const iconsMap = Object.keys(api.appData.routes).reduce((memo, id) => {
287
- const { icon } = api.appData.routes[id];
288
- if (icon) {
289
- const upperIcon = plugin_utils_1.lodash.upperFirst(plugin_utils_1.lodash.camelCase(icon));
290
- // @ts-ignore
291
- if (allIcons[upperIcon]) {
292
- memo[upperIcon] = true;
293
- }
294
- // @ts-ignore
295
- if (allIcons[`${upperIcon}Outlined`]) {
296
- memo[`${upperIcon}Outlined`] = true;
297
- }
298
- }
299
- return memo;
300
- }, {});
301
- const icons = Object.keys(iconsMap);
302
- const antIconsPath = (0, plugin_utils_1.winPath)((0, path_1.dirname)(require.resolve('@ant-design/icons/package')));
303
- api.writeTmpFile({
304
- path: 'icons.tsx',
305
- content: `
306
- ${icons
307
- .map((icon) => {
308
- return `import ${icon} from '${antIconsPath}/es/icons/${icon}';`;
309
- })
310
- .join('\n')}
311
- export default { ${icons.join(', ')} };
312
- `,
313
- });
314
- // runtime.tsx
315
- api.writeTmpFile({
316
- path: 'runtime.tsx',
317
- content: `
281
+ `
282
+ });
283
+ const iconsMap = Object.keys(api.appData.routes).reduce((memo, id) => {
284
+ const { icon } = api.appData.routes[id];
285
+ if (icon) {
286
+ const upperIcon = import_plugin_utils.lodash.upperFirst(import_plugin_utils.lodash.camelCase(icon));
287
+ if (allIcons[upperIcon]) {
288
+ memo[upperIcon] = true;
289
+ }
290
+ if (allIcons[`${upperIcon}Outlined`]) {
291
+ memo[`${upperIcon}Outlined`] = true;
292
+ }
293
+ }
294
+ return memo;
295
+ }, {});
296
+ const icons = Object.keys(iconsMap);
297
+ const antIconsPath = (0, import_plugin_utils.winPath)((0, import_path.dirname)(require.resolve("@ant-design/icons/package")));
298
+ api.writeTmpFile({
299
+ path: "icons.tsx",
300
+ content: `
301
+ ${icons.map((icon) => {
302
+ return `import ${icon} from '${antIconsPath}/es/icons/${icon}';`;
303
+ }).join("\n")}
304
+ export default { ${icons.join(", ")} };
305
+ `
306
+ });
307
+ api.writeTmpFile({
308
+ path: "runtime.tsx",
309
+ content: `
318
310
  import React from 'react';
319
311
  import icons from './icons';
320
312
 
321
313
  function formatIcon(name: string) {
322
314
  return name
323
315
  .replace(name[0], name[0].toUpperCase())
324
- .replace(/-(\w)/g, function(all, letter) {
316
+ .replace(/-(w)/g, function(all, letter) {
325
317
  return letter.toUpperCase();
326
318
  });
327
319
  }
@@ -337,9 +329,9 @@ export function patchRoutes({ routes }) {
337
329
  }
338
330
  });
339
331
  }
340
- `,
341
- });
342
- const rightRenderContent = `
332
+ `
333
+ });
334
+ const rightRenderContent = `
343
335
  import React from 'react';
344
336
  import { Avatar, Dropdown, Menu, Spin } from 'antd';
345
337
  import { LogoutOutlined } from '@ant-design/icons';
@@ -370,7 +362,7 @@ export function getRightRenderContent (opts: {
370
362
  }
371
363
  >
372
364
  <LogoutOutlined />
373
- 退出登录
365
+ \u9000\u51FA\u767B\u5F55
374
366
  </Menu.Item>
375
367
  </Menu>
376
368
  );
@@ -414,22 +406,20 @@ export function getRightRenderContent (opts: {
414
406
  );
415
407
  }
416
408
  `;
417
- const Locale = api.isPluginEnable('locale');
418
- // rightRender.tsx
419
- api.writeTmpFile({
420
- path: 'rightRender.tsx',
421
- content: plugin_utils_1.Mustache.render(rightRenderContent, {
422
- Locale,
423
- }),
424
- });
425
- // Layout.less
426
- api.writeTmpFile({
427
- path: 'Layout.less',
428
- content: `
409
+ const Locale = api.isPluginEnable("locale");
410
+ api.writeTmpFile({
411
+ path: "rightRender.tsx",
412
+ content: import_plugin_utils.Mustache.render(rightRenderContent, {
413
+ Locale
414
+ })
415
+ });
416
+ api.writeTmpFile({
417
+ path: "Layout.less",
418
+ content: `
429
419
  @import '~antd/es/style/themes/default.less';
430
420
  @pro-header-hover-bg: rgba(0, 0, 0, 0.025);
431
421
  @media screen and (max-width: @screen-xs) {
432
- // 在小屏幕的时候可以有更好的体验
422
+ // \u5728\u5C0F\u5C4F\u5E55\u7684\u65F6\u5019\u53EF\u4EE5\u6709\u66F4\u597D\u7684\u4F53\u9A8C
433
423
  .umi-plugin-layout-container {
434
424
  width: 100% !important;
435
425
  }
@@ -479,12 +469,11 @@ export function getRightRenderContent (opts: {
479
469
  .umi-plugin-layout-name {
480
470
  margin-left: 8px;
481
471
  }
482
- `,
483
- });
484
- // Logo.tsx
485
- api.writeTmpFile({
486
- path: 'Logo.tsx',
487
- content: `
472
+ `
473
+ });
474
+ api.writeTmpFile({
475
+ path: "Logo.tsx",
476
+ content: `
488
477
  import React from 'react';
489
478
 
490
479
  const LogoIcon: React.FC = () => {
@@ -576,11 +565,11 @@ const LogoIcon: React.FC = () => {
576
565
  };
577
566
 
578
567
  export default LogoIcon;
579
- `,
580
- });
581
- api.writeTmpFile({
582
- path: 'Exception.tsx',
583
- content: `
568
+ `
569
+ });
570
+ api.writeTmpFile({
571
+ path: "Exception.tsx",
572
+ content: `
584
573
  import React from 'react';
585
574
  import { history, type IRoute } from 'umi';
586
575
  import { Result, Button } from 'antd';
@@ -600,10 +589,10 @@ const Exception: React.FC<{
600
589
  <Result
601
590
  status={props.route ? '403' : '404'}
602
591
  title={props.route ? '403' : '404'}
603
- subTitle={props.route ? '抱歉,你无权访问该页面' : '抱歉,你访问的页面不存在'}
592
+ subTitle={props.route ? '\u62B1\u6B49\uFF0C\u4F60\u65E0\u6743\u8BBF\u95EE\u8BE5\u9875\u9762' : '\u62B1\u6B49\uFF0C\u4F60\u8BBF\u95EE\u7684\u9875\u9762\u4E0D\u5B58\u5728'}
604
593
  extra={
605
594
  <Button type="primary" onClick={() => history.push('/')}>
606
- 返回首页
595
+ \u8FD4\u56DE\u9996\u9875
607
596
  </Button>
608
597
  }
609
598
  />
@@ -613,22 +602,24 @@ const Exception: React.FC<{
613
602
  );
614
603
 
615
604
  export default Exception;
616
- `,
617
- });
618
- });
619
- api.addLayouts(() => {
620
- return [
621
- {
622
- id: 'ant-design-pro-layout',
623
- file: (0, withTmpPath_1.withTmpPath)({ api, path: 'Layout.tsx' }),
624
- test: (route) => {
625
- return route.layout !== false;
626
- },
627
- },
628
- ];
629
- });
630
- api.addRuntimePluginKey(() => ['layout']);
631
- api.addRuntimePlugin(() => {
632
- return [(0, withTmpPath_1.withTmpPath)({ api, path: 'runtime.tsx' })];
605
+ `
633
606
  });
607
+ });
608
+ api.addLayouts(() => {
609
+ return [
610
+ {
611
+ id: "ant-design-pro-layout",
612
+ file: (0, import_withTmpPath.withTmpPath)({ api, path: "Layout.tsx" }),
613
+ test: (route) => {
614
+ return route.layout !== false;
615
+ }
616
+ }
617
+ ];
618
+ });
619
+ api.addRuntimePluginKey(() => ["layout"]);
620
+ api.addRuntimePlugin(() => {
621
+ return [(0, import_withTmpPath.withTmpPath)({ api, path: "runtime.tsx" })];
622
+ });
634
623
  };
624
+ // Annotate the CommonJS export names for ESM import in node:
625
+ 0 && (module.exports = {});
package/dist/locale.d.ts CHANGED
@@ -2,4 +2,3 @@ import { IApi } from 'umi';
2
2
  export declare const packageNormalize: (packageName: string) => string;
3
3
  declare const _default: (api: IApi) => void;
4
4
  export default _default;
5
- //# sourceMappingURL=locale.d.ts.map