@umijs/plugins 4.0.0-canary.20230424.1 → 4.0.0-canary.20230427.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 (2) hide show
  1. package/dist/antd.js +17 -4
  2. package/package.json +4 -3
package/dist/antd.js CHANGED
@@ -32,6 +32,7 @@ __export(antd_exports, {
32
32
  default: () => antd_default
33
33
  });
34
34
  module.exports = __toCommonJS(antd_exports);
35
+ var import_moment_webpack_plugin = __toESM(require("@ant-design/moment-webpack-plugin"));
35
36
  var import_assert = __toESM(require("assert"));
36
37
  var import_path = require("path");
37
38
  var import_umi = require("umi");
@@ -54,6 +55,7 @@ var antd_default = (api) => {
54
55
  }
55
56
  const appComponentAvailable = import_plugin_utils.semver.gte(antdVersion, "5.1.0");
56
57
  const appConfigAvailable = import_plugin_utils.semver.gte(antdVersion, "5.3.0");
58
+ const day2MomentAvailable = import_plugin_utils.semver.gte(antdVersion, "5.0.0");
57
59
  api.describe({
58
60
  config: {
59
61
  schema({ zod }) {
@@ -68,7 +70,9 @@ var antd_default = (api) => {
68
70
  style: zod.enum(["less", "css"]).describe("less or css, default less"),
69
71
  theme: zod.record(zod.any()),
70
72
  // Only antd@5.1.0 is supported
71
- appConfig: zod.record(zod.any()).describe("Only antd@5.1.0 is supported")
73
+ appConfig: zod.record(zod.any()).describe("Only antd@5.1.0 is supported"),
74
+ // DatePicker & Calendar use moment version
75
+ momentPicker: zod.boolean().describe("Only antd@5.x is supported")
72
76
  }).deepPartial();
73
77
  }
74
78
  },
@@ -100,9 +104,6 @@ var antd_default = (api) => {
100
104
  memo.antd = antd = Object.assign(defaultConfig, antd);
101
105
  }
102
106
  memo.alias.antd = pkgPath;
103
- if (antd.dayjs) {
104
- memo.alias.moment = (0, import_path.dirname)(require.resolve("dayjs/package.json"));
105
- }
106
107
  if (antdVersion.startsWith("5")) {
107
108
  const theme = require("@ant-design/antd-theme-variable");
108
109
  memo.theme = {
@@ -153,6 +154,18 @@ var antd_default = (api) => {
153
154
  }
154
155
  return memo;
155
156
  });
157
+ api.chainWebpack((memo) => {
158
+ if (api.config.antd.momentPicker) {
159
+ if (day2MomentAvailable) {
160
+ memo.plugin("antd-moment-webpack-plugin").use(import_moment_webpack_plugin.default);
161
+ } else {
162
+ api.logger.warn(
163
+ `MomentPicker is only available in version 5.0.0 and above, but you are using version ${antdVersion}`
164
+ );
165
+ }
166
+ }
167
+ return memo;
168
+ });
156
169
  api.addExtraBabelPlugins(() => {
157
170
  const style = antdVersion.startsWith("5") ? false : api.config.antd.style || "less";
158
171
  return api.config.antd.import && !api.appData.vite ? [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/plugins",
3
- "version": "4.0.0-canary.20230424.1",
3
+ "version": "4.0.0-canary.20230427.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",
@@ -20,6 +20,7 @@
20
20
  "@ahooksjs/use-request": "^2.0.0",
21
21
  "@ant-design/antd-theme-variable": "^1.0.0",
22
22
  "@ant-design/icons": "^4.7.0",
23
+ "@ant-design/moment-webpack-plugin": "^0.0.3",
23
24
  "@ant-design/pro-components": "^2.0.1",
24
25
  "@tanstack/react-query": "^4.24.10",
25
26
  "@tanstack/react-query-devtools": "^4.24.10",
@@ -42,12 +43,12 @@
42
43
  "styled-components": "6.0.0-beta.9",
43
44
  "tslib": "^2",
44
45
  "warning": "^4.0.3",
45
- "@umijs/bundler-utils": "4.0.0-canary.20230424.1",
46
+ "@umijs/bundler-utils": "4.0.0-canary.20230427.1",
46
47
  "@umijs/valtio": "1.0.3"
47
48
  },
48
49
  "devDependencies": {
49
50
  "antd": "^4.24.1",
50
- "umi": "4.0.0-canary.20230424.1"
51
+ "umi": "4.0.0-canary.20230427.1"
51
52
  },
52
53
  "publishConfig": {
53
54
  "access": "public"