@umijs/plugins 4.5.3 → 4.6.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 +48 -22
- package/dist/dva.js +1 -2
- package/dist/mf.js +3 -3
- package/dist/qiankun/master.js +2 -2
- package/dist/qiankun/slave.js +19 -5
- package/dist/request.js +1 -2
- package/dist/utils/modelUtils.js +62 -59
- package/package.json +3 -3
- package/templates/antd/runtime.ts.tpl +8 -8
package/dist/antd.js
CHANGED
|
@@ -53,8 +53,13 @@ var antd_default = (api) => {
|
|
|
53
53
|
antdVersion = require(`${pkgPath}/package.json`).version;
|
|
54
54
|
} catch (e) {
|
|
55
55
|
}
|
|
56
|
-
const
|
|
57
|
-
|
|
56
|
+
const isModern = import_plugin_utils.semver.satisfies(
|
|
57
|
+
antdVersion,
|
|
58
|
+
"^5.0.0 || ^6.0.0",
|
|
59
|
+
// 两者都还在维护周期中,允许使用预发布版本. eg. 6.1.0-alpha.0
|
|
60
|
+
{ includePrerelease: true }
|
|
61
|
+
);
|
|
62
|
+
const isLegacy = import_plugin_utils.semver.satisfies(antdVersion, "^4.0.0");
|
|
58
63
|
const appComponentAvailable = import_plugin_utils.semver.gte(antdVersion, "5.1.0");
|
|
59
64
|
const appConfigAvailable = import_plugin_utils.semver.gte(antdVersion, "5.3.0");
|
|
60
65
|
const day2MomentAvailable = import_plugin_utils.semver.gte(antdVersion, "5.0.0");
|
|
@@ -78,7 +83,7 @@ var antd_default = (api) => {
|
|
|
78
83
|
})
|
|
79
84
|
]);
|
|
80
85
|
};
|
|
81
|
-
const
|
|
86
|
+
const createModernSchema = () => {
|
|
82
87
|
const componentNameSchema = zod.string().refine(
|
|
83
88
|
(value) => {
|
|
84
89
|
const firstLetter = value.slice(0, 1);
|
|
@@ -103,17 +108,17 @@ var antd_default = (api) => {
|
|
|
103
108
|
configProvider
|
|
104
109
|
}).deepPartial();
|
|
105
110
|
};
|
|
106
|
-
const
|
|
111
|
+
const createLegacySchema = () => {
|
|
107
112
|
return zod.object({
|
|
108
113
|
...commonSchema,
|
|
109
114
|
configProvider: zod.record(zod.any())
|
|
110
115
|
}).deepPartial();
|
|
111
116
|
};
|
|
112
|
-
if (
|
|
113
|
-
return
|
|
117
|
+
if (isModern) {
|
|
118
|
+
return createModernSchema();
|
|
114
119
|
}
|
|
115
|
-
if (
|
|
116
|
-
return
|
|
120
|
+
if (isLegacy) {
|
|
121
|
+
return createLegacySchema();
|
|
117
122
|
}
|
|
118
123
|
return zod.object({});
|
|
119
124
|
}
|
|
@@ -128,6 +133,16 @@ var antd_default = (api) => {
|
|
|
128
133
|
throw new Error(`Can't find antd package. Please install antd first.`);
|
|
129
134
|
}
|
|
130
135
|
}
|
|
136
|
+
api.onCheck(() => {
|
|
137
|
+
if (import_plugin_utils.semver.gte(antdVersion, "6.0.0")) {
|
|
138
|
+
const reactVersion = api.appData.react.version;
|
|
139
|
+
if (import_plugin_utils.semver.lt(reactVersion, "18.0.0")) {
|
|
140
|
+
throw new Error(
|
|
141
|
+
`antd@6 requires React version >= 18.0.0, but got ${reactVersion}.`
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
});
|
|
131
146
|
api.modifyAppData((memo) => {
|
|
132
147
|
checkPkgPath();
|
|
133
148
|
const version = require(`${pkgPath}/package.json`).version;
|
|
@@ -146,21 +161,23 @@ var antd_default = (api) => {
|
|
|
146
161
|
memo.antd = antd = Object.assign(defaultConfig, antd);
|
|
147
162
|
}
|
|
148
163
|
memo.alias.antd = pkgPath;
|
|
149
|
-
if (
|
|
164
|
+
if (isModern) {
|
|
150
165
|
const theme = require("@ant-design/antd-theme-variable");
|
|
151
166
|
memo.theme = {
|
|
152
167
|
...theme,
|
|
153
168
|
...memo.theme
|
|
154
169
|
};
|
|
170
|
+
}
|
|
171
|
+
if (import_plugin_utils.semver.gte(antdVersion, "5.0.0")) {
|
|
155
172
|
if ((_a = memo.antd) == null ? void 0 : _a.import) {
|
|
156
|
-
const errorMessage = `
|
|
173
|
+
const errorMessage = `The antd.import option is not supported in antd version 5 and above (${antdVersion}).`;
|
|
157
174
|
api.logger.fatal(
|
|
158
175
|
"please change config antd.import to false, then start server again"
|
|
159
176
|
);
|
|
160
177
|
throw Error(errorMessage);
|
|
161
178
|
}
|
|
162
179
|
}
|
|
163
|
-
if (
|
|
180
|
+
if (isLegacy) {
|
|
164
181
|
if (antd.dark || antd.compact) {
|
|
165
182
|
const { getThemeVariables } = require("antd/dist/theme");
|
|
166
183
|
memo.theme = {
|
|
@@ -174,7 +191,10 @@ var antd_default = (api) => {
|
|
|
174
191
|
};
|
|
175
192
|
}
|
|
176
193
|
if (antd.theme) {
|
|
177
|
-
(0, import_assert.default)(
|
|
194
|
+
(0, import_assert.default)(
|
|
195
|
+
isModern,
|
|
196
|
+
`The 'antd.theme' option is only available for antd version 5 and above.`
|
|
197
|
+
);
|
|
178
198
|
antd.configProvider ?? (antd.configProvider = {});
|
|
179
199
|
antd.configProvider.theme = (0, import_plugin_utils.deepmerge)(
|
|
180
200
|
antd.configProvider.theme || {},
|
|
@@ -223,7 +243,7 @@ var antd_default = (api) => {
|
|
|
223
243
|
{
|
|
224
244
|
libraryName: "antd",
|
|
225
245
|
libraryDirectory: "es",
|
|
226
|
-
|
|
246
|
+
style: style === "less" || "css"
|
|
227
247
|
},
|
|
228
248
|
"antd"
|
|
229
249
|
]
|
|
@@ -244,7 +264,7 @@ var antd_default = (api) => {
|
|
|
244
264
|
const userInputDark = api.config.antd.dark;
|
|
245
265
|
const ieTarget = !!((_a = api.config.targets) == null ? void 0 : _a.ie) || !!api.config.legacy;
|
|
246
266
|
let styleProviderConfig = false;
|
|
247
|
-
if (
|
|
267
|
+
if (isModern && (ieTarget || styleProvider)) {
|
|
248
268
|
const cssinjs = (0, import_resolveProjectDep.resolveProjectDep)({
|
|
249
269
|
pkg: api.pkg,
|
|
250
270
|
cwd: api.cwd,
|
|
@@ -255,8 +275,14 @@ var antd_default = (api) => {
|
|
|
255
275
|
cssinjs: (0, import_plugin_utils.winPath)(cssinjs)
|
|
256
276
|
};
|
|
257
277
|
if (ieTarget) {
|
|
258
|
-
|
|
259
|
-
|
|
278
|
+
if (import_plugin_utils.semver.gte(antdVersion, "6.0.0")) {
|
|
279
|
+
api.logger.warn(
|
|
280
|
+
`You are using antd version ${antdVersion} which no longer supports IE, but your targets or legacy config indicates IE support. Please adjust your targets or legacy config accordingly.`
|
|
281
|
+
);
|
|
282
|
+
} else {
|
|
283
|
+
styleProviderConfig.hashPriority = "high";
|
|
284
|
+
styleProviderConfig.legacyTransformer = true;
|
|
285
|
+
}
|
|
260
286
|
}
|
|
261
287
|
styleProviderConfig = {
|
|
262
288
|
...styleProviderConfig,
|
|
@@ -266,9 +292,9 @@ var antd_default = (api) => {
|
|
|
266
292
|
}
|
|
267
293
|
const configProvider = withConfigProvider && JSON.stringify(api.config.antd.configProvider);
|
|
268
294
|
const appConfig = appComponentAvailable && JSON.stringify(api.config.antd.appConfig);
|
|
269
|
-
const
|
|
270
|
-
const hasConfigProvider = configProvider ||
|
|
271
|
-
const antdConfigSetter =
|
|
295
|
+
const enableModernThemeAlgorithm = isModern && (userInputCompact || userInputDark) ? { compact: userInputCompact, dark: userInputDark } : false;
|
|
296
|
+
const hasConfigProvider = configProvider || enableModernThemeAlgorithm;
|
|
297
|
+
const antdConfigSetter = isModern && hasConfigProvider;
|
|
272
298
|
const isModelPluginEnabled = api.isPluginEnable("model");
|
|
273
299
|
const modelPluginCompat = isModelPluginEnabled && antdConfigSetter;
|
|
274
300
|
api.writeTmpFile({
|
|
@@ -277,8 +303,8 @@ var antd_default = (api) => {
|
|
|
277
303
|
configProvider,
|
|
278
304
|
appConfig,
|
|
279
305
|
styleProvider: styleProviderConfig,
|
|
280
|
-
// 是否启用了
|
|
281
|
-
|
|
306
|
+
// 是否启用了 theme algorithm
|
|
307
|
+
enableModernThemeAlgorithm,
|
|
282
308
|
antdConfigSetter,
|
|
283
309
|
modelPluginCompat,
|
|
284
310
|
lodashPath,
|
|
@@ -347,7 +373,7 @@ export const AntdConfigContextSetter = React.createContext<React.Dispatch<React.
|
|
|
347
373
|
api.addEntryImportsAhead(() => {
|
|
348
374
|
const style = api.config.antd.style || "less";
|
|
349
375
|
const imports = [];
|
|
350
|
-
if (
|
|
376
|
+
if (isModern) {
|
|
351
377
|
imports.push({ source: "antd/dist/reset.css" });
|
|
352
378
|
} else if (!api.config.antd.import || api.appData.vite) {
|
|
353
379
|
imports.push({
|
package/dist/dva.js
CHANGED
|
@@ -266,8 +266,7 @@ export interface DvaModel<T, E = EffectsMapObject, R = ReducersMapObject<T>> {
|
|
|
266
266
|
function getModelUtil(api) {
|
|
267
267
|
return new import_modelUtils.ModelUtils(api, {
|
|
268
268
|
contentTest(content) {
|
|
269
|
-
if (api == null ? void 0 : api.config.dva.skipModelValidate)
|
|
270
|
-
return true;
|
|
269
|
+
if (api == null ? void 0 : api.config.dva.skipModelValidate) return true;
|
|
271
270
|
return content.startsWith("// @dva-model");
|
|
272
271
|
},
|
|
273
272
|
astTest({ node, content }) {
|
package/dist/mf.js
CHANGED
|
@@ -141,14 +141,14 @@ function mf(api) {
|
|
|
141
141
|
(0, import_path.join)(api.paths.absTmpPath, "umi.ts"),
|
|
142
142
|
"utf-8"
|
|
143
143
|
);
|
|
144
|
-
const [_imports,
|
|
144
|
+
const [_imports, exports2] = await (0, import_bundler_utils.parseModule)({ content, path: entry });
|
|
145
145
|
const mfEntryContent = [];
|
|
146
146
|
let hasDefaultExport = false;
|
|
147
|
-
if (
|
|
147
|
+
if (exports2.length) {
|
|
148
148
|
mfEntryContent.push(
|
|
149
149
|
`const umiExports = await import('${(0, import_plugin_utils.winPath)(entry)}')`
|
|
150
150
|
);
|
|
151
|
-
for (const exportName of
|
|
151
|
+
for (const exportName of exports2) {
|
|
152
152
|
if (exportName === "default") {
|
|
153
153
|
hasDefaultExport = true;
|
|
154
154
|
mfEntryContent.push(`export default umiExports.${exportName}`);
|
package/dist/qiankun/master.js
CHANGED
|
@@ -101,8 +101,8 @@ var master_default = (api) => {
|
|
|
101
101
|
api.register({
|
|
102
102
|
key: "addExtraModels",
|
|
103
103
|
fn() {
|
|
104
|
-
const { path, exports } = api.appData.appJS || {};
|
|
105
|
-
return path &&
|
|
104
|
+
const { path, exports: exports2 } = api.appData.appJS || {};
|
|
105
|
+
return path && exports2.includes(import_constants.MODEL_EXPORT_NAME) ? [
|
|
106
106
|
`${path}#{"namespace":"${import_constants.qiankunStateForSlaveModelNamespace}","exportName":"${import_constants.MODEL_EXPORT_NAME}"}`
|
|
107
107
|
] : [];
|
|
108
108
|
}
|
package/dist/qiankun/slave.js
CHANGED
|
@@ -172,7 +172,7 @@ export interface IRuntimeConfig {
|
|
|
172
172
|
];
|
|
173
173
|
});
|
|
174
174
|
api.chainWebpack((config, { ssr }) => {
|
|
175
|
-
if (ssr) {
|
|
175
|
+
if (ssr || api.userConfig.utoopack) {
|
|
176
176
|
return;
|
|
177
177
|
}
|
|
178
178
|
(0, import_assert.default)(api.pkg.name, "You should have name in package.json.");
|
|
@@ -202,20 +202,34 @@ export interface IRuntimeConfig {
|
|
|
202
202
|
}
|
|
203
203
|
];
|
|
204
204
|
});
|
|
205
|
-
api.addEntryCode(() =>
|
|
206
|
-
|
|
205
|
+
api.addEntryCode(() => {
|
|
206
|
+
var _a, _b;
|
|
207
|
+
const appName = ((_b = (_a = api.config.qiankun) == null ? void 0 : _a.slave) == null ? void 0 : _b.appName) || api.pkg.name;
|
|
208
|
+
return [
|
|
209
|
+
`
|
|
207
210
|
const qiankun_noop = () => new Error('qiankun lifecycle is not available for server runtime!');
|
|
208
211
|
const isServer = typeof window === 'undefined';
|
|
209
212
|
export const bootstrap = isServer ? qiankun_noop: qiankun_genBootstrap(render);
|
|
210
213
|
export const mount = isServer ? qiankun_noop : qiankun_genMount('${api.config.mountElementId}');
|
|
211
214
|
export const unmount = isServer ? qiankun_noop : qiankun_genUnmount('${api.config.mountElementId}');
|
|
212
215
|
export const update = isServer ? qiankun_noop : qiankun_genUpdate();
|
|
216
|
+
|
|
217
|
+
if (!isServer && ${Boolean(api.userConfig.utoopack)}) {
|
|
218
|
+
window['${appName}'] = {
|
|
219
|
+
bootstrap,
|
|
220
|
+
mount,
|
|
221
|
+
unmount,
|
|
222
|
+
update,
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
|
|
213
226
|
// 增加 ssr 的判断
|
|
214
227
|
if (!isServer && !window.__POWERED_BY_QIANKUN__) {
|
|
215
228
|
bootstrap().then(mount);
|
|
216
229
|
}
|
|
217
|
-
|
|
218
|
-
|
|
230
|
+
`
|
|
231
|
+
];
|
|
232
|
+
});
|
|
219
233
|
function getFileContent(file) {
|
|
220
234
|
return (0, import_fs.readFileSync)(
|
|
221
235
|
(0, import_path.join)(__dirname, "../../libs/qiankun/slave", file),
|
package/dist/request.js
CHANGED
|
@@ -326,8 +326,7 @@ export type {
|
|
|
326
326
|
);
|
|
327
327
|
const axiosPath = (0, import_plugin_utils.winPath)((0, import_path.dirname)(require.resolve("axios/package.json")));
|
|
328
328
|
let dataField = (_a = api.config.request) == null ? void 0 : _a.dataField;
|
|
329
|
-
if (dataField === void 0)
|
|
330
|
-
dataField = "data";
|
|
329
|
+
if (dataField === void 0) dataField = "data";
|
|
331
330
|
const isEmpty = dataField === "";
|
|
332
331
|
const formatResult = isEmpty ? `result => result` : `result => result?.${dataField}`;
|
|
333
332
|
const resultDataType = isEmpty ? dataField : `${dataField}?: T;`;
|
package/dist/utils/modelUtils.js
CHANGED
|
@@ -66,6 +66,11 @@ function getNamespace(absFilePath, absSrcPath) {
|
|
|
66
66
|
return [...validDirs, normalizedFile].join(".");
|
|
67
67
|
}
|
|
68
68
|
var Model = class {
|
|
69
|
+
file;
|
|
70
|
+
namespace;
|
|
71
|
+
id;
|
|
72
|
+
exportName;
|
|
73
|
+
deps;
|
|
69
74
|
constructor(file, absSrcPath, sort, id) {
|
|
70
75
|
let namespace;
|
|
71
76
|
let exportName;
|
|
@@ -106,10 +111,11 @@ var Model = class {
|
|
|
106
111
|
return [...deps];
|
|
107
112
|
}
|
|
108
113
|
};
|
|
109
|
-
var
|
|
114
|
+
var ModelUtils = class _ModelUtils {
|
|
115
|
+
api;
|
|
116
|
+
opts = {};
|
|
117
|
+
count = 1;
|
|
110
118
|
constructor(api, opts) {
|
|
111
|
-
this.opts = {};
|
|
112
|
-
this.count = 1;
|
|
113
119
|
this.api = api;
|
|
114
120
|
this.opts = opts;
|
|
115
121
|
}
|
|
@@ -156,10 +162,8 @@ var _ModelUtils = class {
|
|
|
156
162
|
cwd: opts.base,
|
|
157
163
|
absolute: true
|
|
158
164
|
}).map(import_plugin_utils.winPath).filter((file) => {
|
|
159
|
-
if (/\.d.ts$/.test(file))
|
|
160
|
-
|
|
161
|
-
if (/\.(test|e2e|spec).([jt])sx?$/.test(file))
|
|
162
|
-
return false;
|
|
165
|
+
if (/\.d.ts$/.test(file)) return false;
|
|
166
|
+
if (/\.(test|e2e|spec).([jt])sx?$/.test(file)) return false;
|
|
163
167
|
const content = (0, import_fs.readFileSync)(file, "utf-8");
|
|
164
168
|
return this.isModelValid({ content, file });
|
|
165
169
|
});
|
|
@@ -204,6 +208,57 @@ var _ModelUtils = class {
|
|
|
204
208
|
});
|
|
205
209
|
return ret;
|
|
206
210
|
}
|
|
211
|
+
// https://github.com/umijs/umi/issues/9837
|
|
212
|
+
static topologicalSort = (models) => {
|
|
213
|
+
const graph = [];
|
|
214
|
+
const namespaceToNode = {};
|
|
215
|
+
models.forEach((model, index) => {
|
|
216
|
+
const node = {
|
|
217
|
+
namespace: model.namespace,
|
|
218
|
+
deps: model.deps,
|
|
219
|
+
index,
|
|
220
|
+
in: 0,
|
|
221
|
+
childs: []
|
|
222
|
+
};
|
|
223
|
+
if (namespaceToNode[model.namespace]) {
|
|
224
|
+
throw new Error(`Duplicate namespace in models: ${model.namespace}`);
|
|
225
|
+
}
|
|
226
|
+
namespaceToNode[model.namespace] = node;
|
|
227
|
+
graph.push(node);
|
|
228
|
+
});
|
|
229
|
+
graph.forEach((node) => {
|
|
230
|
+
node.deps.forEach((dep) => {
|
|
231
|
+
const depNode = namespaceToNode[dep];
|
|
232
|
+
if (!depNode) {
|
|
233
|
+
throw new Error(`Model namespace not found: ${dep}`);
|
|
234
|
+
}
|
|
235
|
+
depNode.childs.push(node);
|
|
236
|
+
node.in++;
|
|
237
|
+
});
|
|
238
|
+
});
|
|
239
|
+
const queue = [];
|
|
240
|
+
while (true) {
|
|
241
|
+
const zeronode = graph.find((n) => {
|
|
242
|
+
return n && n.in === 0;
|
|
243
|
+
});
|
|
244
|
+
if (!zeronode) {
|
|
245
|
+
break;
|
|
246
|
+
}
|
|
247
|
+
queue.push(zeronode.namespace);
|
|
248
|
+
zeronode.childs.forEach((child) => {
|
|
249
|
+
child.in--;
|
|
250
|
+
});
|
|
251
|
+
zeronode.childs = [];
|
|
252
|
+
delete graph[zeronode.index];
|
|
253
|
+
}
|
|
254
|
+
const leftNodes = graph.filter(Boolean);
|
|
255
|
+
if (leftNodes.length > 0) {
|
|
256
|
+
throw new Error(
|
|
257
|
+
`Circle dependency detected in models: ${leftNodes.map((m) => import_plugin_utils.chalk.red(m.namespace)).join(", ")}`
|
|
258
|
+
);
|
|
259
|
+
}
|
|
260
|
+
return queue;
|
|
261
|
+
};
|
|
207
262
|
static getModelsContent(models) {
|
|
208
263
|
const imports = [];
|
|
209
264
|
const modelProps = [];
|
|
@@ -233,58 +288,6 @@ ${modelProps.join("\n")}
|
|
|
233
288
|
} as const`;
|
|
234
289
|
}
|
|
235
290
|
};
|
|
236
|
-
var ModelUtils = _ModelUtils;
|
|
237
|
-
// https://github.com/umijs/umi/issues/9837
|
|
238
|
-
ModelUtils.topologicalSort = (models) => {
|
|
239
|
-
const graph = [];
|
|
240
|
-
const namespaceToNode = {};
|
|
241
|
-
models.forEach((model, index) => {
|
|
242
|
-
const node = {
|
|
243
|
-
namespace: model.namespace,
|
|
244
|
-
deps: model.deps,
|
|
245
|
-
index,
|
|
246
|
-
in: 0,
|
|
247
|
-
childs: []
|
|
248
|
-
};
|
|
249
|
-
if (namespaceToNode[model.namespace]) {
|
|
250
|
-
throw new Error(`Duplicate namespace in models: ${model.namespace}`);
|
|
251
|
-
}
|
|
252
|
-
namespaceToNode[model.namespace] = node;
|
|
253
|
-
graph.push(node);
|
|
254
|
-
});
|
|
255
|
-
graph.forEach((node) => {
|
|
256
|
-
node.deps.forEach((dep) => {
|
|
257
|
-
const depNode = namespaceToNode[dep];
|
|
258
|
-
if (!depNode) {
|
|
259
|
-
throw new Error(`Model namespace not found: ${dep}`);
|
|
260
|
-
}
|
|
261
|
-
depNode.childs.push(node);
|
|
262
|
-
node.in++;
|
|
263
|
-
});
|
|
264
|
-
});
|
|
265
|
-
const queue = [];
|
|
266
|
-
while (true) {
|
|
267
|
-
const zeronode = graph.find((n) => {
|
|
268
|
-
return n && n.in === 0;
|
|
269
|
-
});
|
|
270
|
-
if (!zeronode) {
|
|
271
|
-
break;
|
|
272
|
-
}
|
|
273
|
-
queue.push(zeronode.namespace);
|
|
274
|
-
zeronode.childs.forEach((child) => {
|
|
275
|
-
child.in--;
|
|
276
|
-
});
|
|
277
|
-
zeronode.childs = [];
|
|
278
|
-
delete graph[zeronode.index];
|
|
279
|
-
}
|
|
280
|
-
const leftNodes = graph.filter(Boolean);
|
|
281
|
-
if (leftNodes.length > 0) {
|
|
282
|
-
throw new Error(
|
|
283
|
-
`Circle dependency detected in models: ${leftNodes.map((m) => import_plugin_utils.chalk.red(m.namespace)).join(", ")}`
|
|
284
|
-
);
|
|
285
|
-
}
|
|
286
|
-
return queue;
|
|
287
|
-
};
|
|
288
291
|
// Annotate the CommonJS export names for ESM import in node:
|
|
289
292
|
0 && (module.exports = {
|
|
290
293
|
Model,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/plugins",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.6.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",
|
|
@@ -46,11 +46,11 @@
|
|
|
46
46
|
"tslib": "^2",
|
|
47
47
|
"warning": "^4.0.3",
|
|
48
48
|
"@umijs/valtio": "1.0.4",
|
|
49
|
-
"@umijs/bundler-utils": "4.
|
|
49
|
+
"@umijs/bundler-utils": "4.6.1"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"antd": "^4.24.1",
|
|
53
|
-
"umi": "4.
|
|
53
|
+
"umi": "4.6.1"
|
|
54
54
|
},
|
|
55
55
|
"publishConfig": {
|
|
56
56
|
"access": "public"
|
|
@@ -9,9 +9,9 @@ import {
|
|
|
9
9
|
message,
|
|
10
10
|
notification,
|
|
11
11
|
{{/disableInternalStatic}}
|
|
12
|
-
{{#
|
|
12
|
+
{{#enableModernThemeAlgorithm}}
|
|
13
13
|
theme,
|
|
14
|
-
{{/
|
|
14
|
+
{{/enableModernThemeAlgorithm}}
|
|
15
15
|
} from 'antd';
|
|
16
16
|
import { ApplyPluginsType } from 'umi';
|
|
17
17
|
{{#styleProvider}}
|
|
@@ -61,24 +61,24 @@ function AntdProvider({ children }) {
|
|
|
61
61
|
appConfig: _,
|
|
62
62
|
...finalConfigProvider
|
|
63
63
|
} = getAntdConfig();
|
|
64
|
-
{{#
|
|
64
|
+
{{#enableModernThemeAlgorithm}}
|
|
65
65
|
finalConfigProvider.theme ??= {};
|
|
66
66
|
finalConfigProvider.theme.algorithm ??= [];
|
|
67
67
|
if (!Array.isArray(finalConfigProvider.theme.algorithm)) {
|
|
68
68
|
finalConfigProvider.theme.algorithm = [finalConfigProvider.theme.algorithm];
|
|
69
69
|
}
|
|
70
70
|
const algorithm = finalConfigProvider.theme.algorithm;
|
|
71
|
-
{{#
|
|
71
|
+
{{#enableModernThemeAlgorithm.compact}}
|
|
72
72
|
if (!algorithm.includes(theme.compactAlgorithm)) {
|
|
73
73
|
algorithm.push(theme.compactAlgorithm);
|
|
74
74
|
}
|
|
75
|
-
{{/
|
|
76
|
-
{{#
|
|
75
|
+
{{/enableModernThemeAlgorithm.compact}}
|
|
76
|
+
{{#enableModernThemeAlgorithm.dark}}
|
|
77
77
|
if (!algorithm.includes(theme.darkAlgorithm)) {
|
|
78
78
|
algorithm.push(theme.darkAlgorithm);
|
|
79
79
|
}
|
|
80
|
-
{{/
|
|
81
|
-
{{/
|
|
80
|
+
{{/enableModernThemeAlgorithm.dark}}
|
|
81
|
+
{{/enableModernThemeAlgorithm}}
|
|
82
82
|
return finalConfigProvider
|
|
83
83
|
});
|
|
84
84
|
const setAntdConfig: typeof _setAntdConfig = (newConfig) => {
|