@umijs/plugins 4.0.0-canary.20230210.1 → 4.0.0-canary.20230216.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.
package/dist/antd.js CHANGED
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
17
17
  return to;
18
18
  };
19
19
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
20
24
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
25
  mod
22
26
  ));
@@ -52,9 +56,12 @@ var antd_default = (api) => {
52
56
  return Joi.alternatives().try(
53
57
  Joi.object({
54
58
  configProvider: Joi.object(),
59
+ // themes
55
60
  dark: Joi.boolean(),
56
61
  compact: Joi.boolean(),
62
+ // babel-plugin-import
57
63
  import: Joi.boolean(),
64
+ // less or css, default less
58
65
  style: Joi.string().allow("less", "css"),
59
66
  theme: Joi.object()
60
67
  }),
@@ -99,10 +106,10 @@ var antd_default = (api) => {
99
106
  ...theme,
100
107
  ...memo.theme
101
108
  };
102
- if ((_a = memo.antd) == null ? void 0 : _a.style) {
103
- const errorMessage = `Can't set antd.style while using antd5 (${antdVersion})`;
109
+ if ((_a = memo.antd) == null ? void 0 : _a.import) {
110
+ const errorMessage = `Can't set antd.import while using antd5 (${antdVersion})`;
104
111
  api.logger.fatal(
105
- "please remove config antd.style, then start server again"
112
+ "please change config antd.import to false, then start server again"
106
113
  );
107
114
  throw Error(errorMessage);
108
115
  }
package/dist/layout.js CHANGED
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
17
17
  return to;
18
18
  };
19
19
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
20
24
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
25
  mod
22
26
  ));
@@ -28,13 +32,27 @@ __export(layout_exports, {
28
32
  default: () => layout_default
29
33
  });
30
34
  module.exports = __toCommonJS(layout_exports);
31
- var allIcons = __toESM(require("@ant-design/icons"));
32
35
  var import_fs = require("fs");
33
36
  var import_path = require("path");
34
37
  var import_umi = require("umi");
35
38
  var import_plugin_utils = require("umi/plugin-utils");
36
39
  var import_resolveProjectDep = require("./utils/resolveProjectDep");
37
40
  var import_withTmpPath = require("./utils/withTmpPath");
41
+ var antIconsPath = (0, import_plugin_utils.winPath)(
42
+ (0, import_path.dirname)(require.resolve("@ant-design/icons/package"))
43
+ );
44
+ var getAllIcons = () => {
45
+ const iconTypePath = (0, import_path.join)(antIconsPath, "./lib/icons/index.d.ts");
46
+ const iconTypeContent = (0, import_fs.readFileSync)(iconTypePath, "utf-8");
47
+ return [...iconTypeContent.matchAll(/default as (\w+)/g)].reduce(
48
+ (memo, cur) => {
49
+ memo[cur[1]] = true;
50
+ return memo;
51
+ },
52
+ {}
53
+ );
54
+ };
55
+ var allIcons = getAllIcons();
38
56
  var layout_default = (api) => {
39
57
  let antdVersion = "4.0.0";
40
58
  try {
@@ -342,9 +360,6 @@ export interface IRuntimeConfig {
342
360
  return memo;
343
361
  }, {});
344
362
  const icons = Object.keys(iconsMap);
345
- const antIconsPath = (0, import_plugin_utils.winPath)(
346
- (0, import_path.dirname)(require.resolve("@ant-design/icons/package"))
347
- );
348
363
  api.writeTmpFile({
349
364
  path: "icons.tsx",
350
365
  content: `
@@ -403,7 +418,6 @@ export function getRightRenderContent (opts: {
403
418
  );
404
419
  }
405
420
 
406
-
407
421
 
408
422
  const avatar = (
409
423
  <span className="umi-plugin-layout-action">
@@ -446,12 +460,11 @@ export function getRightRenderContent (opts: {
446
460
  },
447
461
  ],
448
462
  };
449
-
450
463
  // antd@5 和 4.24 之后推荐使用 menu,性能更好
451
464
  const dropdownProps =
452
465
  version.startsWith("5.") || version.startsWith("4.24.")
453
466
  ? { menu: langMenu }
454
- : { overlay: <Menu {...langMenu} /> };
467
+ : { overlay: <Menu {...langMenu} /> };
455
468
 
456
469
  return (
457
470
  <div className="umi-plugin-layout-right anticon">
@@ -479,7 +492,8 @@ export function getRightRenderContent (opts: {
479
492
  api.writeTmpFile({
480
493
  path: "Layout.less",
481
494
  content: `
482
- ${antdVersion.startsWith("5") ? "" : "@import '~antd/es/style/themes/default.less';"}
495
+ ${// antd@5里面没有这个样式了
496
+ antdVersion.startsWith("5") ? "" : "@import '~antd/es/style/themes/default.less';"}
483
497
  @media screen and (max-width: 480px) {
484
498
  // 在小屏幕的时候可以有更好的体验
485
499
  .umi-plugin-layout-container {
package/dist/request.js CHANGED
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
17
17
  return to;
18
18
  };
19
19
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
20
24
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
25
  mod
22
26
  ));
@@ -345,7 +349,9 @@ export type {
345
349
  AxiosResponse,
346
350
  AxiosError,
347
351
  RequestError,
348
- ResponseInterceptor } from './request';
352
+ ResponseInterceptor,
353
+ RequestOptions,
354
+ Request } from './request';
349
355
  `
350
356
  });
351
357
  api.writeTmpFile({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/plugins",
3
- "version": "4.0.0-canary.20230210.1",
3
+ "version": "4.0.0-canary.20230216.1",
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",
@@ -29,7 +29,7 @@
29
29
  "@ant-design/pro-components": "^2.0.1",
30
30
  "@tanstack/react-query": "^4.22.0",
31
31
  "@tanstack/react-query-devtools": "^4.22.0",
32
- "@umijs/bundler-utils": "4.0.0-canary.20230210.1",
32
+ "@umijs/bundler-utils": "4.0.0-canary.20230216.1",
33
33
  "@umijs/valtio": "^1.0.3",
34
34
  "antd-dayjs-webpack-plugin": "^1.0.6",
35
35
  "axios": "^0.27.2",
@@ -53,7 +53,7 @@
53
53
  },
54
54
  "devDependencies": {
55
55
  "antd": "^4.24.1",
56
- "umi": "4.0.0-canary.20230210.1"
56
+ "umi": "4.0.0-canary.20230216.1"
57
57
  },
58
58
  "publishConfig": {
59
59
  "access": "public"