@umijs/plugins 4.0.86 → 4.0.88
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/access.js +0 -2
- package/dist/analytics.js +0 -2
- package/dist/antd.js +13 -26
- package/dist/confetti.js +0 -2
- package/dist/dva.js +4 -2
- package/dist/initial-state.js +0 -2
- package/dist/model.js +0 -2
- package/dist/moment2dayjs.js +0 -2
- package/dist/qiankun/slave.js +3 -1
- package/dist/qiankun.js +0 -2
- package/dist/react-query.js +0 -2
- package/dist/request.js +0 -2
- package/dist/styled-components.js +46 -11
- package/dist/unocss.js +0 -2
- package/package.json +6 -5
- package/templates/antd/runtime.ts.tpl +13 -1
- package/templates/antd/types.d.ts.tpl +17 -0
- package/templates/locale/SelectLang.tpl +1 -1
- package/templates/locale/localeExports.tpl +20 -1
package/dist/access.js
CHANGED
package/dist/analytics.js
CHANGED
package/dist/antd.js
CHANGED
|
@@ -225,37 +225,24 @@ var antd_default = (api) => {
|
|
|
225
225
|
appConfig: appComponentAvailable && JSON.stringify(api.config.antd.appConfig),
|
|
226
226
|
styleProvider: styleProviderConfig,
|
|
227
227
|
// 是否启用了 v5 的 theme algorithm
|
|
228
|
-
enableV5ThemeAlgorithm: isV5 && (userInputCompact || userInputDark) ? { compact: userInputCompact, dark: userInputDark } : false
|
|
228
|
+
enableV5ThemeAlgorithm: isV5 && (userInputCompact || userInputDark) ? { compact: userInputCompact, dark: userInputDark } : false,
|
|
229
|
+
/**
|
|
230
|
+
* 是否重构了全局静态配置。 重构后需要在运行时将全局静态配置传入到 ConfigProvider 中。
|
|
231
|
+
* 实际上 4.13.0 重构后有一个 bug,真正的 warn 出现在 4.13.1,并且 4.13.1 修复了这个 bug。
|
|
232
|
+
* Resolve issue: https://github.com/umijs/umi/issues/10231
|
|
233
|
+
* `InternalStatic` 指 `Modal.config` 等静态方法,详见:https://github.com/ant-design/ant-design/pull/29285
|
|
234
|
+
*/
|
|
235
|
+
disableInternalStatic: import_plugin_utils.semver.gt(antdVersion, "4.13.0")
|
|
229
236
|
},
|
|
230
237
|
tplPath: (0, import_plugin_utils.winPath)((0, import_path.join)(ANTD_TEMPLATES_DIR, "runtime.ts.tpl"))
|
|
231
238
|
});
|
|
232
239
|
api.writeTmpFile({
|
|
233
240
|
path: "types.d.ts",
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
{{#withAppConfig}}
|
|
240
|
-
import type { AppConfig } from 'antd/es/app/context';
|
|
241
|
-
{{/withAppConfig}}
|
|
242
|
-
|
|
243
|
-
type Prettify<T> = {
|
|
244
|
-
[K in keyof T]: T[K];
|
|
245
|
-
} & {};
|
|
246
|
-
|
|
247
|
-
type AntdConfig = Prettify<{}
|
|
248
|
-
{{#withConfigProvider}} & ConfigProviderProps{{/withConfigProvider}}
|
|
249
|
-
{{#withAppConfig}} & { appConfig: AppConfig }{{/withAppConfig}}
|
|
250
|
-
>;
|
|
251
|
-
|
|
252
|
-
export type RuntimeAntdConfig = (memo: AntdConfig) => AntdConfig;
|
|
253
|
-
`.trim(),
|
|
254
|
-
{
|
|
255
|
-
withConfigProvider,
|
|
256
|
-
withAppConfig
|
|
257
|
-
}
|
|
258
|
-
)
|
|
241
|
+
context: {
|
|
242
|
+
withConfigProvider,
|
|
243
|
+
withAppConfig
|
|
244
|
+
},
|
|
245
|
+
tplPath: (0, import_plugin_utils.winPath)((0, import_path.join)(ANTD_TEMPLATES_DIR, "types.d.ts.tpl"))
|
|
259
246
|
});
|
|
260
247
|
api.writeTmpFile({
|
|
261
248
|
path: import_umi.RUNTIME_TYPE_FILE_NAME,
|
package/dist/confetti.js
CHANGED
package/dist/dva.js
CHANGED
|
@@ -101,7 +101,7 @@ export interface IRuntimeConfig {
|
|
|
101
101
|
tpl: `
|
|
102
102
|
// It's faked dva
|
|
103
103
|
// aliased to @umijs/plugins/templates/dva
|
|
104
|
-
import { create, Provider } from '
|
|
104
|
+
import { create, Provider } from '${(0, import_utils.winPath)(pkgPath)}';
|
|
105
105
|
import createLoading from '${(0, import_utils.winPath)(require.resolve("dva-loading"))}';
|
|
106
106
|
${((_a = api.config.dva) == null ? void 0 : _a.immer) ? `
|
|
107
107
|
import dvaImmer, { enableES5, enableAllPlugins } from '${(0, import_utils.winPath)(
|
|
@@ -177,7 +177,9 @@ export function dataflowProvider(container, opts) {
|
|
|
177
177
|
api.writeTmpFile({
|
|
178
178
|
path: "index.ts",
|
|
179
179
|
content: `
|
|
180
|
-
export { connect, useDispatch, useStore, useSelector } from '
|
|
180
|
+
export { connect, useDispatch, useStore, useSelector } from '${(0, import_utils.winPath)(
|
|
181
|
+
pkgPath
|
|
182
|
+
)}';
|
|
181
183
|
export { getDvaApp } from './dva';
|
|
182
184
|
`
|
|
183
185
|
});
|
package/dist/initial-state.js
CHANGED
package/dist/model.js
CHANGED
package/dist/moment2dayjs.js
CHANGED
package/dist/qiankun/slave.js
CHANGED
|
@@ -173,7 +173,9 @@ export interface IRuntimeConfig {
|
|
|
173
173
|
});
|
|
174
174
|
api.chainWebpack((config) => {
|
|
175
175
|
(0, import_assert.default)(api.pkg.name, "You should have name in package.json.");
|
|
176
|
-
const {
|
|
176
|
+
const {
|
|
177
|
+
shouldNotAddLibraryChunkName = api.env === "production" || !Boolean(api.config.mfsu)
|
|
178
|
+
} = (api.config.qiankun || {}).slave;
|
|
177
179
|
config.output.libraryTarget("umd").library(
|
|
178
180
|
shouldNotAddLibraryChunkName ? api.pkg.name : `${api.pkg.name}-[name]`
|
|
179
181
|
);
|
package/dist/qiankun.js
CHANGED
package/dist/react-query.js
CHANGED
package/dist/request.js
CHANGED
|
@@ -47,12 +47,28 @@ var styled_components_default = (api) => {
|
|
|
47
47
|
},
|
|
48
48
|
enableBy: api.EnableBy.config
|
|
49
49
|
});
|
|
50
|
-
api.
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
50
|
+
api.modifyConfig((memo) => {
|
|
51
|
+
var _a, _b;
|
|
52
|
+
const isProd = api.env === "production";
|
|
53
|
+
const pluginConfig = {
|
|
54
|
+
// https://github.com/styled-components/babel-plugin-styled-components/blob/f8e9fb480d1645be8be797d73e49686bdf98975b/src/utils/options.js#L11
|
|
55
|
+
topLevelImportPaths: [
|
|
56
|
+
"@umijs/max",
|
|
57
|
+
"@alipay/bigfish",
|
|
58
|
+
"umi",
|
|
59
|
+
"alita",
|
|
60
|
+
"@kmi/kmi"
|
|
61
|
+
],
|
|
62
|
+
...isProd ? {
|
|
63
|
+
displayName: false
|
|
64
|
+
} : {},
|
|
65
|
+
...((_a = api.config.styledComponents) == null ? void 0 : _a.babelPlugin) || {},
|
|
66
|
+
...((_b = api.userConfig.styledComponents) == null ? void 0 : _b.babelPlugin) || {}
|
|
67
|
+
};
|
|
68
|
+
memo.extraBabelPlugins = [
|
|
69
|
+
...memo.extraBabelPlugins || [],
|
|
70
|
+
[require.resolve("babel-plugin-styled-components"), pluginConfig]
|
|
71
|
+
];
|
|
56
72
|
return memo;
|
|
57
73
|
});
|
|
58
74
|
api.addRuntimePlugin(() => {
|
|
@@ -63,7 +79,7 @@ var styled_components_default = (api) => {
|
|
|
63
79
|
});
|
|
64
80
|
const libPath = (0, import_path.dirname)(require.resolve("styled-components/package"));
|
|
65
81
|
api.onGenerateFiles(() => {
|
|
66
|
-
var _a;
|
|
82
|
+
var _a, _b, _c;
|
|
67
83
|
api.writeTmpFile({
|
|
68
84
|
path: "index.tsx",
|
|
69
85
|
content: `
|
|
@@ -76,22 +92,41 @@ export { styled, ThemeProvider, createGlobalStyle, css, keyframes, StyleSheetMan
|
|
|
76
92
|
const styledComponentsRuntimeCode = ((_a = api.appData.appJS) == null ? void 0 : _a.exports.includes(
|
|
77
93
|
"styledComponents"
|
|
78
94
|
)) ? `import { styledComponents as styledComponentsConfig } from '@/app';` : `const styledComponentsConfig = {};`;
|
|
95
|
+
const isLegacy = !import_utils.lodash.isEmpty((_b = api.config.targets) == null ? void 0 : _b.ie) || api.config.legacy;
|
|
96
|
+
const disableCSSOM = !!((_c = api.config.qiankun) == null ? void 0 : _c.slave);
|
|
97
|
+
const providerOptions = {
|
|
98
|
+
// https://styled-components.com/docs/faqs#vendor-prefixes-are-omitted-by-default
|
|
99
|
+
...isLegacy ? { enableVendorPrefixes: true } : {},
|
|
100
|
+
...disableCSSOM ? { disableCSSOMInjection: true } : {}
|
|
101
|
+
};
|
|
102
|
+
const hasProvider = !import_utils.lodash.isEmpty(providerOptions);
|
|
79
103
|
api.writeTmpFile({
|
|
80
104
|
path: "runtime.tsx",
|
|
81
105
|
content: `
|
|
106
|
+
${hasProvider ? `import { StyleSheetManager } from '${(0, import_utils.winPath)(libPath)}';` : ``}
|
|
107
|
+
|
|
82
108
|
${styledComponentsRuntimeCode}
|
|
83
109
|
export function rootContainer(container) {
|
|
84
|
-
const
|
|
85
|
-
|
|
110
|
+
const scConfig =
|
|
111
|
+
typeof styledComponentsConfig === 'function'
|
|
112
|
+
? styledComponentsConfig()
|
|
113
|
+
: styledComponentsConfig;
|
|
114
|
+
const globalStyle = scConfig.GlobalStyle ? <scConfig.GlobalStyle /> : null;
|
|
115
|
+
const inner = (
|
|
86
116
|
<>
|
|
87
117
|
{globalStyle}
|
|
88
118
|
{container}
|
|
89
119
|
</>
|
|
90
120
|
);
|
|
121
|
+
${hasProvider ? `
|
|
122
|
+
return (
|
|
123
|
+
<StyleSheetManager {...${JSON.stringify(providerOptions)}}>
|
|
124
|
+
{inner}
|
|
125
|
+
</StyleSheetManager>
|
|
126
|
+
);
|
|
127
|
+
` : "return inner;"}
|
|
91
128
|
}
|
|
92
129
|
`
|
|
93
130
|
});
|
|
94
131
|
});
|
|
95
132
|
};
|
|
96
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
97
|
-
0 && (module.exports = {});
|
package/dist/unocss.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/plugins",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.88",
|
|
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",
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"antd-dayjs-webpack-plugin": "^1.0.6",
|
|
29
29
|
"axios": "^0.27.2",
|
|
30
30
|
"babel-plugin-import": "^1.13.6",
|
|
31
|
+
"babel-plugin-styled-components": "2.1.4",
|
|
31
32
|
"dayjs": "^1.11.7",
|
|
32
33
|
"dva-core": "^2.0.4",
|
|
33
34
|
"dva-immer": "^1.0.0",
|
|
@@ -41,15 +42,15 @@
|
|
|
41
42
|
"react-intl": "3.12.1",
|
|
42
43
|
"react-redux": "^8.0.5",
|
|
43
44
|
"redux": "^4.2.1",
|
|
44
|
-
"styled-components": "6.
|
|
45
|
+
"styled-components": "6.1.0",
|
|
45
46
|
"tslib": "^2",
|
|
46
47
|
"warning": "^4.0.3",
|
|
47
|
-
"@umijs/
|
|
48
|
-
"@umijs/
|
|
48
|
+
"@umijs/bundler-utils": "4.0.88",
|
|
49
|
+
"@umijs/valtio": "1.0.4"
|
|
49
50
|
},
|
|
50
51
|
"devDependencies": {
|
|
51
52
|
"antd": "^4.24.1",
|
|
52
|
-
"umi": "4.0.
|
|
53
|
+
"umi": "4.0.88"
|
|
53
54
|
},
|
|
54
55
|
"publishConfig": {
|
|
55
56
|
"access": "public"
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import {
|
|
3
|
-
Modal,
|
|
4
3
|
ConfigProvider,
|
|
5
4
|
{{#appConfig}}
|
|
6
5
|
App,
|
|
7
6
|
{{/appConfig}}
|
|
7
|
+
{{^disableInternalStatic}}
|
|
8
|
+
Modal,
|
|
8
9
|
message,
|
|
9
10
|
notification,
|
|
11
|
+
{{/disableInternalStatic}}
|
|
10
12
|
{{#enableV5ThemeAlgorithm}}
|
|
11
13
|
theme,
|
|
12
14
|
{{/enableV5ThemeAlgorithm}}
|
|
@@ -50,6 +52,7 @@ export function rootContainer(rawContainer) {
|
|
|
50
52
|
let container = rawContainer;
|
|
51
53
|
|
|
52
54
|
{{#configProvider}}
|
|
55
|
+
{{^disableInternalStatic}}
|
|
53
56
|
if (finalConfigProvider.prefixCls) {
|
|
54
57
|
Modal.config({
|
|
55
58
|
rootPrefixCls: finalConfigProvider.prefixCls
|
|
@@ -61,6 +64,15 @@ export function rootContainer(rawContainer) {
|
|
|
61
64
|
prefixCls: `${finalConfigProvider.prefixCls}-notification`
|
|
62
65
|
});
|
|
63
66
|
}
|
|
67
|
+
{{/disableInternalStatic}}
|
|
68
|
+
|
|
69
|
+
{{#disableInternalStatic}}
|
|
70
|
+
if (finalConfigProvider.prefixCls) {
|
|
71
|
+
ConfigProvider.config({
|
|
72
|
+
prefixCls: finalConfigProvider.prefixCls,
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
{{/disableInternalStatic}}
|
|
64
76
|
|
|
65
77
|
if (finalConfigProvider.iconPrefixCls) {
|
|
66
78
|
// Icons in message need to set iconPrefixCls via ConfigProvider.config()
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{{#withConfigProvider}}
|
|
2
|
+
import type { ConfigProviderProps } from 'antd/es/config-provider';
|
|
3
|
+
{{/withConfigProvider}}
|
|
4
|
+
{{#withAppConfig}}
|
|
5
|
+
import type { AppConfig } from 'antd/es/app/context';
|
|
6
|
+
{{/withAppConfig}}
|
|
7
|
+
|
|
8
|
+
type Prettify<T> = {
|
|
9
|
+
[K in keyof T]: T[K];
|
|
10
|
+
} & {};
|
|
11
|
+
|
|
12
|
+
type AntdConfig = Prettify<{}
|
|
13
|
+
{{#withConfigProvider}} & ConfigProviderProps{{/withConfigProvider}}
|
|
14
|
+
{{#withAppConfig}} & { appConfig: AppConfig }{{/withAppConfig}}
|
|
15
|
+
>;
|
|
16
|
+
|
|
17
|
+
export type RuntimeAntdConfig = (memo: AntdConfig) => AntdConfig;
|
|
@@ -51,11 +51,30 @@ import lang_{{lang}}{{country}}{{index}} from "{{{path}}}";
|
|
|
51
51
|
{{/paths}}
|
|
52
52
|
{{/LocaleList}}
|
|
53
53
|
|
|
54
|
+
const flattenMessages=(
|
|
55
|
+
nestedMessages: Record<string, any>,
|
|
56
|
+
prefix = '',
|
|
57
|
+
) => {
|
|
58
|
+
return Object.keys(nestedMessages).reduce(
|
|
59
|
+
(messages: Record<string, any>, key) => {
|
|
60
|
+
const value = nestedMessages[key];
|
|
61
|
+
const prefixedKey = prefix ? `${prefix}.${key}` : key;
|
|
62
|
+
if (typeof value === 'string') {
|
|
63
|
+
messages[prefixedKey] = value;
|
|
64
|
+
} else {
|
|
65
|
+
Object.assign(messages, flattenMessages(value, prefixedKey));
|
|
66
|
+
}
|
|
67
|
+
return messages;
|
|
68
|
+
},
|
|
69
|
+
{},
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
54
73
|
export const localeInfo: {[key: string]: any} = {
|
|
55
74
|
{{#LocaleList}}
|
|
56
75
|
'{{name}}': {
|
|
57
76
|
messages: {
|
|
58
|
-
{{#paths}}...lang_{{lang}}{{country}}{{index}},{{/paths}}
|
|
77
|
+
{{#paths}}...flattenMessages(lang_{{lang}}{{country}}{{index}}),{{/paths}}
|
|
59
78
|
},
|
|
60
79
|
locale: '{{locale}}',
|
|
61
80
|
{{#Antd}}antd: {
|