@umijs/plugins 4.0.38 → 4.0.40
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 +33 -10
- package/dist/layout.js +2 -0
- package/package.json +3 -3
package/dist/antd.js
CHANGED
|
@@ -25,8 +25,9 @@ __export(antd_exports, {
|
|
|
25
25
|
default: () => antd_default
|
|
26
26
|
});
|
|
27
27
|
module.exports = __toCommonJS(antd_exports);
|
|
28
|
-
var import_path = require("path");
|
|
29
28
|
var import_assert = __toESM(require("assert"));
|
|
29
|
+
var import_path = require("path");
|
|
30
|
+
var import_umi = require("umi");
|
|
30
31
|
var import_plugin_utils = require("umi/plugin-utils");
|
|
31
32
|
var import_resolveProjectDep = require("./utils/resolveProjectDep");
|
|
32
33
|
var import_withTmpPath = require("./utils/withTmpPath");
|
|
@@ -59,6 +60,7 @@ var antd_default = (api) => {
|
|
|
59
60
|
return process.env.UMI_PLUGIN_ANTD_ENABLE || userConfig.antd;
|
|
60
61
|
}
|
|
61
62
|
});
|
|
63
|
+
api.addRuntimePluginKey(() => ["antd"]);
|
|
62
64
|
function checkPkgPath() {
|
|
63
65
|
if (!pkgPath) {
|
|
64
66
|
throw new Error(`Can't find antd package. Please install antd first.`);
|
|
@@ -91,9 +93,9 @@ var antd_default = (api) => {
|
|
|
91
93
|
...theme,
|
|
92
94
|
...memo.theme
|
|
93
95
|
};
|
|
94
|
-
if ((_a = memo.antd) == null ? void 0 : _a.
|
|
95
|
-
const errorMessage = `Can't set antd.
|
|
96
|
-
api.logger.fatal("please
|
|
96
|
+
if ((_a = memo.antd) == null ? void 0 : _a.style) {
|
|
97
|
+
const errorMessage = `Can't set antd.style while using antd5 (${antdVersion})`;
|
|
98
|
+
api.logger.fatal("please remove config antd.style, then start server again");
|
|
97
99
|
throw Error(errorMessage);
|
|
98
100
|
}
|
|
99
101
|
}
|
|
@@ -116,17 +118,16 @@ var antd_default = (api) => {
|
|
|
116
118
|
return memo;
|
|
117
119
|
});
|
|
118
120
|
api.addExtraBabelPlugins(() => {
|
|
119
|
-
const style = api.config.antd.style || "less";
|
|
120
|
-
if (antdVersion.startsWith("5")) {
|
|
121
|
-
return [];
|
|
122
|
-
}
|
|
121
|
+
const style = antdVersion.startsWith("5") ? false : api.config.antd.style || "less";
|
|
123
122
|
return api.config.antd.import && !api.appData.vite ? [
|
|
124
123
|
[
|
|
125
124
|
require.resolve("babel-plugin-import"),
|
|
126
125
|
{
|
|
127
126
|
libraryName: "antd",
|
|
128
127
|
libraryDirectory: "es",
|
|
129
|
-
style
|
|
128
|
+
...style ? {
|
|
129
|
+
style: style === "less" || "css"
|
|
130
|
+
} : {}
|
|
130
131
|
},
|
|
131
132
|
"antd"
|
|
132
133
|
]
|
|
@@ -140,9 +141,15 @@ var antd_default = (api) => {
|
|
|
140
141
|
content: import_plugin_utils.Mustache.render(`
|
|
141
142
|
import React from 'react';
|
|
142
143
|
import { ConfigProvider, Modal, message, notification } from 'antd';
|
|
144
|
+
import { ApplyPluginsType } from 'umi';
|
|
145
|
+
import { getPluginManager } from '../core/plugin';
|
|
143
146
|
|
|
144
147
|
export function rootContainer(container) {
|
|
145
|
-
const finalConfig = {
|
|
148
|
+
const finalConfig = getPluginManager().applyPlugins({
|
|
149
|
+
key: 'antd',
|
|
150
|
+
type: ApplyPluginsType.modify,
|
|
151
|
+
initialValue: {...{{{ config }}}},
|
|
152
|
+
});
|
|
146
153
|
if (finalConfig.prefixCls) {
|
|
147
154
|
Modal.config({
|
|
148
155
|
rootPrefixCls: finalConfig.prefixCls
|
|
@@ -166,6 +173,22 @@ export function rootContainer(container) {
|
|
|
166
173
|
config: JSON.stringify(api.config.antd.configProvider)
|
|
167
174
|
})
|
|
168
175
|
});
|
|
176
|
+
api.writeTmpFile({
|
|
177
|
+
path: "types.d.ts",
|
|
178
|
+
content: `
|
|
179
|
+
import type { ConfigProviderProps } from 'antd/es/config-provider';
|
|
180
|
+
export type RuntimeAntdConfig = (memo: ConfigProviderProps) => ConfigProviderProps;
|
|
181
|
+
`
|
|
182
|
+
});
|
|
183
|
+
api.writeTmpFile({
|
|
184
|
+
path: import_umi.RUNTIME_TYPE_FILE_NAME,
|
|
185
|
+
content: `
|
|
186
|
+
import type { RuntimeAntdConfig } from './types.d';
|
|
187
|
+
export type IRuntimeConfig = {
|
|
188
|
+
antd?: RuntimeAntdConfig
|
|
189
|
+
};
|
|
190
|
+
`
|
|
191
|
+
});
|
|
169
192
|
});
|
|
170
193
|
api.addRuntimePlugin(() => {
|
|
171
194
|
return api.config.antd.configProvider ? [(0, import_withTmpPath.withTmpPath)({ api, path: "runtime.tsx" })] : [];
|
package/dist/layout.js
CHANGED
|
@@ -256,7 +256,9 @@ const { formatMessage } = useIntl();
|
|
|
256
256
|
>
|
|
257
257
|
<Exception
|
|
258
258
|
route={matchedRoute}
|
|
259
|
+
noFound={runtimeConfig?.noFound}
|
|
259
260
|
notFound={runtimeConfig?.notFound}
|
|
261
|
+
unAccessible={runtimeConfig?.unAccessible}
|
|
260
262
|
noAccessible={runtimeConfig?.noAccessible}
|
|
261
263
|
>
|
|
262
264
|
{runtimeConfig.childrenRender
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/plugins",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.40",
|
|
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.
|
|
30
|
+
"@umijs/bundler-utils": "4.0.40",
|
|
31
31
|
"@umijs/valtio": "^1.0.2",
|
|
32
32
|
"antd-dayjs-webpack-plugin": "^1.0.6",
|
|
33
33
|
"axios": "^0.27.2",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"antd": "^4.24.1",
|
|
53
|
-
"umi": "4.0.
|
|
53
|
+
"umi": "4.0.40"
|
|
54
54
|
},
|
|
55
55
|
"publishConfig": {
|
|
56
56
|
"access": "public"
|