@umijs/plugins 4.0.87 → 4.0.89

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 CHANGED
@@ -193,5 +193,3 @@ export type AccessInstance = ReturnType<typeof accessFactory>;
193
193
  (0, import_path.join)(api.paths.absSrcPath, "access.js")
194
194
  ]);
195
195
  };
196
- // Annotate the CommonJS export names for ESM import in node:
197
- 0 && (module.exports = {});
package/dist/analytics.js CHANGED
@@ -116,5 +116,3 @@ var analytics_default = (api) => {
116
116
  return scripts.filter(Boolean);
117
117
  });
118
118
  };
119
- // Annotate the CommonJS export names for ESM import in node:
120
- 0 && (module.exports = {});
package/dist/antd.js CHANGED
@@ -158,6 +158,9 @@ var antd_default = (api) => {
158
158
  );
159
159
  }
160
160
  }
161
+ if (antd.dark || antd.compact) {
162
+ antd.configProvider ?? (antd.configProvider = {});
163
+ }
161
164
  return memo;
162
165
  });
163
166
  api.chainWebpack((memo) => {
@@ -189,6 +192,10 @@ var antd_default = (api) => {
189
192
  }
190
193
  return [];
191
194
  });
195
+ const lodashPkg = (0, import_path.dirname)(require.resolve("lodash/package.json"));
196
+ const lodashPath = {
197
+ merge: (0, import_plugin_utils.winPath)((0, import_path.join)(lodashPkg, "merge"))
198
+ };
192
199
  api.onGenerateFiles(() => {
193
200
  var _a;
194
201
  const withConfigProvider = !!api.config.antd.configProvider;
@@ -218,44 +225,38 @@ var antd_default = (api) => {
218
225
  };
219
226
  }
220
227
  }
228
+ const configProvider = withConfigProvider && JSON.stringify(api.config.antd.configProvider);
229
+ const appConfig = appComponentAvailable && JSON.stringify(api.config.antd.appConfig);
230
+ const enableV5ThemeAlgorithm = isV5 && (userInputCompact || userInputDark) ? { compact: userInputCompact, dark: userInputDark } : false;
231
+ const hasConfigProvider = configProvider || enableV5ThemeAlgorithm;
232
+ const antdConfigSetter = isV5 && hasConfigProvider;
221
233
  api.writeTmpFile({
222
234
  path: `runtime.tsx`,
223
235
  context: {
224
- configProvider: withConfigProvider && JSON.stringify(api.config.antd.configProvider),
225
- appConfig: appComponentAvailable && JSON.stringify(api.config.antd.appConfig),
236
+ configProvider,
237
+ appConfig,
226
238
  styleProvider: styleProviderConfig,
227
239
  // 是否启用了 v5 的 theme algorithm
228
- enableV5ThemeAlgorithm: isV5 && (userInputCompact || userInputDark) ? { compact: userInputCompact, dark: userInputDark } : false
240
+ enableV5ThemeAlgorithm,
241
+ antdConfigSetter,
242
+ lodashPath,
243
+ /**
244
+ * 是否重构了全局静态配置。 重构后需要在运行时将全局静态配置传入到 ConfigProvider 中。
245
+ * 实际上 4.13.0 重构后有一个 bug,真正的 warn 出现在 4.13.1,并且 4.13.1 修复了这个 bug。
246
+ * Resolve issue: https://github.com/umijs/umi/issues/10231
247
+ * `InternalStatic` 指 `Modal.config` 等静态方法,详见:https://github.com/ant-design/ant-design/pull/29285
248
+ */
249
+ disableInternalStatic: import_plugin_utils.semver.gt(antdVersion, "4.13.0")
229
250
  },
230
251
  tplPath: (0, import_plugin_utils.winPath)((0, import_path.join)(ANTD_TEMPLATES_DIR, "runtime.ts.tpl"))
231
252
  });
232
253
  api.writeTmpFile({
233
254
  path: "types.d.ts",
234
- content: import_plugin_utils.Mustache.render(
235
- `
236
- {{#withConfigProvider}}
237
- import type { ConfigProviderProps } from 'antd/es/config-provider';
238
- {{/withConfigProvider}}
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
- )
255
+ context: {
256
+ withConfigProvider,
257
+ withAppConfig
258
+ },
259
+ tplPath: (0, import_plugin_utils.winPath)((0, import_path.join)(ANTD_TEMPLATES_DIR, "types.d.ts.tpl"))
259
260
  });
260
261
  api.writeTmpFile({
261
262
  path: import_umi.RUNTIME_TYPE_FILE_NAME,
@@ -266,6 +267,34 @@ export type IRuntimeConfig = {
266
267
  };
267
268
  `
268
269
  });
270
+ if (antdConfigSetter) {
271
+ api.writeTmpFile({
272
+ path: "index.tsx",
273
+ content: `import React from 'react';
274
+ import { AntdConfigContext, AntdConfigContextSetter } from './context';
275
+
276
+ export function useAntdConfig() {
277
+ return React.useContext(AntdConfigContext);
278
+ }
279
+
280
+ export function useAntdConfigSetter() {
281
+ return React.useContext(AntdConfigContextSetter);
282
+ }`
283
+ });
284
+ api.writeTmpFile({
285
+ path: "context.tsx",
286
+ content: `import React from 'react';
287
+ import type { ConfigProviderProps } from 'antd/es/config-provider';
288
+
289
+ export const AntdConfigContext = React.createContext<ConfigProviderProps>(null!);
290
+ export const AntdConfigContextSetter = React.createContext<React.Dispatch<React.SetStateAction<ConfigProviderProps>>>(
291
+ () => {
292
+ console.error(\`The 'useAntdConfigSetter()' method depends on the antd 'ConfigProvider', requires one of 'antd.configProvider' / 'antd.dark' / 'antd.compact' to be enabled.\`);
293
+ }
294
+ );
295
+ `
296
+ });
297
+ }
269
298
  });
270
299
  api.addRuntimePlugin(() => {
271
300
  if (api.config.antd.styleProvider || api.config.antd.configProvider || appComponentAvailable && api.config.antd.appConfig) {
package/dist/confetti.js CHANGED
@@ -62,5 +62,3 @@ var confetti_default = (api) => {
62
62
  }
63
63
  });
64
64
  };
65
- // Annotate the CommonJS export names for ESM import in node:
66
- 0 && (module.exports = {});
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 'dva';
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 'dva';
180
+ export { connect, useDispatch, useStore, useSelector } from '${(0, import_utils.winPath)(
181
+ pkgPath
182
+ )}';
181
183
  export { getDvaApp } from './dva';
182
184
  `
183
185
  });
@@ -146,5 +146,3 @@ export interface IRuntimeConfig {
146
146
  });
147
147
  });
148
148
  };
149
- // Annotate the CommonJS export names for ESM import in node:
150
- 0 && (module.exports = {});
package/dist/model.js CHANGED
@@ -108,5 +108,3 @@ async function getAllModels(api) {
108
108
  extraModels: [...extraModels, ...api.config.model.extraModels || []]
109
109
  });
110
110
  }
111
- // Annotate the CommonJS export names for ESM import in node:
112
- 0 && (module.exports = {});
@@ -123,5 +123,3 @@ dayjs.extend(antdPlugin);
123
123
  });
124
124
  api.addEntryCodeAhead(() => [`import './plugin-moment2dayjs/runtime.tsx'`]);
125
125
  };
126
- // Annotate the CommonJS export names for ESM import in node:
127
- 0 && (module.exports = {});
@@ -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 { shouldNotAddLibraryChunkName = api.env === "production" || !Boolean(api.config.mfsu) } = (api.config.qiankun || {}).slave;
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
@@ -50,5 +50,3 @@ var qiankun_default = (api) => {
50
50
  require.resolve("./qiankun/slave")
51
51
  ]);
52
52
  };
53
- // Annotate the CommonJS export names for ESM import in node:
54
- 0 && (module.exports = {});
@@ -155,5 +155,3 @@ export type {
155
155
  });
156
156
  });
157
157
  };
158
- // Annotate the CommonJS export names for ESM import in node:
159
- 0 && (module.exports = {});
package/dist/request.js CHANGED
@@ -374,5 +374,3 @@ export type IRuntimeConfig = {
374
374
  });
375
375
  });
376
376
  };
377
- // Annotate the CommonJS export names for ESM import in node:
378
- 0 && (module.exports = {});
@@ -34,6 +34,7 @@ __export(styled_components_exports, {
34
34
  module.exports = __toCommonJS(styled_components_exports);
35
35
  var import_utils = require("@umijs/utils");
36
36
  var import_path = require("path");
37
+ var import_resolveProjectDep = require("./utils/resolveProjectDep");
37
38
  var import_withTmpPath = require("./utils/withTmpPath");
38
39
  var styled_components_default = (api) => {
39
40
  api.describe({
@@ -47,12 +48,31 @@ var styled_components_default = (api) => {
47
48
  },
48
49
  enableBy: api.EnableBy.config
49
50
  });
50
- api.modifyBabelPresetOpts((memo) => {
51
- if (api.env === "development") {
52
- memo.pluginStyledComponents = {
53
- ...api.config.styledComponents.babelPlugin
54
- };
51
+ api.modifyConfig((memo) => {
52
+ var _a, _b;
53
+ if (api.userConfig.mako || process.env.OKAM) {
54
+ return memo;
55
55
  }
56
+ const isProd = api.env === "production";
57
+ const pluginConfig = {
58
+ // https://github.com/styled-components/babel-plugin-styled-components/blob/f8e9fb480d1645be8be797d73e49686bdf98975b/src/utils/options.js#L11
59
+ topLevelImportPaths: [
60
+ "@umijs/max",
61
+ "@alipay/bigfish",
62
+ "umi",
63
+ "alita",
64
+ "@kmi/kmi"
65
+ ],
66
+ ...isProd ? {
67
+ displayName: false
68
+ } : {},
69
+ ...((_a = api.config.styledComponents) == null ? void 0 : _a.babelPlugin) || {},
70
+ ...((_b = api.userConfig.styledComponents) == null ? void 0 : _b.babelPlugin) || {}
71
+ };
72
+ memo.extraBabelPlugins = [
73
+ ...memo.extraBabelPlugins || [],
74
+ [require.resolve("babel-plugin-styled-components"), pluginConfig]
75
+ ];
56
76
  return memo;
57
77
  });
58
78
  api.addRuntimePlugin(() => {
@@ -61,9 +81,22 @@ var styled_components_default = (api) => {
61
81
  api.addRuntimePluginKey(() => {
62
82
  return ["styledComponents"];
63
83
  });
64
- const libPath = (0, import_path.dirname)(require.resolve("styled-components/package"));
84
+ const SC_NAME = `styled-components`;
85
+ let libPath;
86
+ try {
87
+ libPath = (0, import_resolveProjectDep.resolveProjectDep)({
88
+ pkg: api.pkg,
89
+ cwd: api.cwd,
90
+ dep: SC_NAME
91
+ }) || (0, import_path.dirname)(require.resolve(`${SC_NAME}/package.json`));
92
+ } catch (e) {
93
+ }
94
+ api.modifyConfig((memo) => {
95
+ memo.alias[SC_NAME] = libPath;
96
+ return memo;
97
+ });
65
98
  api.onGenerateFiles(() => {
66
- var _a;
99
+ var _a, _b, _c;
67
100
  api.writeTmpFile({
68
101
  path: "index.tsx",
69
102
  content: `
@@ -76,22 +109,41 @@ export { styled, ThemeProvider, createGlobalStyle, css, keyframes, StyleSheetMan
76
109
  const styledComponentsRuntimeCode = ((_a = api.appData.appJS) == null ? void 0 : _a.exports.includes(
77
110
  "styledComponents"
78
111
  )) ? `import { styledComponents as styledComponentsConfig } from '@/app';` : `const styledComponentsConfig = {};`;
112
+ const isLegacy = !import_utils.lodash.isEmpty((_b = api.config.targets) == null ? void 0 : _b.ie) || api.config.legacy;
113
+ const disableCSSOM = !!((_c = api.config.qiankun) == null ? void 0 : _c.slave);
114
+ const providerOptions = {
115
+ // https://styled-components.com/docs/faqs#vendor-prefixes-are-omitted-by-default
116
+ ...isLegacy ? { enableVendorPrefixes: true } : {},
117
+ ...disableCSSOM ? { disableCSSOMInjection: true } : {}
118
+ };
119
+ const hasProvider = !import_utils.lodash.isEmpty(providerOptions);
79
120
  api.writeTmpFile({
80
121
  path: "runtime.tsx",
81
122
  content: `
123
+ ${hasProvider ? `import { StyleSheetManager } from '${(0, import_utils.winPath)(libPath)}';` : ``}
124
+
82
125
  ${styledComponentsRuntimeCode}
83
126
  export function rootContainer(container) {
84
- const globalStyle = styledComponentsConfig.GlobalStyle ? <styledComponentsConfig.GlobalStyle /> : null;
85
- return (
127
+ const scConfig =
128
+ typeof styledComponentsConfig === 'function'
129
+ ? styledComponentsConfig()
130
+ : styledComponentsConfig;
131
+ const globalStyle = scConfig.GlobalStyle ? <scConfig.GlobalStyle /> : null;
132
+ const inner = (
86
133
  <>
87
134
  {globalStyle}
88
135
  {container}
89
136
  </>
90
137
  );
138
+ ${hasProvider ? `
139
+ return (
140
+ <StyleSheetManager {...${JSON.stringify(providerOptions)}}>
141
+ {inner}
142
+ </StyleSheetManager>
143
+ );
144
+ ` : "return inner;"}
91
145
  }
92
146
  `
93
147
  });
94
148
  });
95
149
  };
96
- // Annotate the CommonJS export names for ESM import in node:
97
- 0 && (module.exports = {});
@@ -104,5 +104,3 @@ function getTailwindBinPath(opts) {
104
104
  const tailwindPath = require(pkgPath).bin["tailwind"];
105
105
  return (0, import_path.join)((0, import_path.dirname)(pkgPath), tailwindPath);
106
106
  }
107
- // Annotate the CommonJS export names for ESM import in node:
108
- 0 && (module.exports = {});
package/dist/unocss.js CHANGED
@@ -69,5 +69,3 @@ var unocss_default = (api) => {
69
69
  return [{ source: generatedPath }];
70
70
  });
71
71
  };
72
- // Annotate the CommonJS export names for ESM import in node:
73
- 0 && (module.exports = {});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/plugins",
3
- "version": "4.0.87",
3
+ "version": "4.0.89",
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.0.0-rc.0",
45
+ "styled-components": "6.1.1",
45
46
  "tslib": "^2",
46
47
  "warning": "^4.0.3",
47
- "@umijs/valtio": "1.0.4",
48
- "@umijs/bundler-utils": "4.0.87"
48
+ "@umijs/bundler-utils": "4.0.89",
49
+ "@umijs/valtio": "1.0.4"
49
50
  },
50
51
  "devDependencies": {
51
52
  "antd": "^4.24.1",
52
- "umi": "4.0.87"
53
+ "umi": "4.0.89"
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}}
@@ -21,6 +23,10 @@ import {
21
23
  } from '{{{styleProvider.cssinjs}}}';
22
24
  {{/styleProvider}}
23
25
  import { getPluginManager } from '../core/plugin';
26
+ {{#antdConfigSetter}}
27
+ import { AntdConfigContext, AntdConfigContextSetter } from './context';
28
+ import merge from '{{{lodashPath.merge}}}'
29
+ {{/antdConfigSetter}}
24
30
 
25
31
  let cacheAntdConfig = null;
26
32
 
@@ -42,63 +48,80 @@ const getAntdConfig = () => {
42
48
  return cacheAntdConfig;
43
49
  }
44
50
 
45
- export function rootContainer(rawContainer) {
46
- const {
47
- appConfig,
48
- ...finalConfigProvider
49
- } = getAntdConfig();
50
- let container = rawContainer;
51
+ function AntdProvider({ children }) {
52
+ let container = children;
53
+
54
+ const [antdConfig, _setAntdConfig] = React.useState(() => {
55
+ const {
56
+ appConfig: _,
57
+ ...finalConfigProvider
58
+ } = getAntdConfig();
59
+ {{#enableV5ThemeAlgorithm}}
60
+ finalConfigProvider.theme ??= {};
61
+ finalConfigProvider.theme.algorithm ??= [];
62
+ if (!Array.isArray(finalConfigProvider.theme.algorithm)) {
63
+ finalConfigProvider.theme.algorithm = [finalConfigProvider.theme.algorithm];
64
+ }
65
+ const algorithm = finalConfigProvider.theme.algorithm;
66
+ {{#enableV5ThemeAlgorithm.compact}}
67
+ if (!algorithm.includes(theme.compactAlgorithm)) {
68
+ algorithm.push(theme.compactAlgorithm);
69
+ }
70
+ {{/enableV5ThemeAlgorithm.compact}}
71
+ {{#enableV5ThemeAlgorithm.dark}}
72
+ if (!algorithm.includes(theme.darkAlgorithm)) {
73
+ algorithm.push(theme.darkAlgorithm);
74
+ }
75
+ {{/enableV5ThemeAlgorithm.dark}}
76
+ {{/enableV5ThemeAlgorithm}}
77
+ return finalConfigProvider
78
+ });
79
+ const setAntdConfig: typeof _setAntdConfig = (newConfig) => {
80
+ _setAntdConfig(prev => {
81
+ return merge({}, prev, typeof newConfig === 'function' ? newConfig(prev) : newConfig)
82
+ })
83
+ }
51
84
 
52
85
  {{#configProvider}}
53
- if (finalConfigProvider.prefixCls) {
86
+ {{^disableInternalStatic}}
87
+ if (antdConfig.prefixCls) {
54
88
  Modal.config({
55
- rootPrefixCls: finalConfigProvider.prefixCls
89
+ rootPrefixCls: antdConfig.prefixCls
56
90
  });
57
91
  message.config({
58
- prefixCls: `${finalConfigProvider.prefixCls}-message`
92
+ prefixCls: `${antdConfig.prefixCls}-message`
59
93
  });
60
94
  notification.config({
61
- prefixCls: `${finalConfigProvider.prefixCls}-notification`
95
+ prefixCls: `${antdConfig.prefixCls}-notification`
62
96
  });
63
97
  }
98
+ {{/disableInternalStatic}}
64
99
 
65
- if (finalConfigProvider.iconPrefixCls) {
100
+ {{#disableInternalStatic}}
101
+ if (antdConfig.prefixCls) {
102
+ ConfigProvider.config({
103
+ prefixCls: antdConfig.prefixCls,
104
+ });
105
+ };
106
+ {{/disableInternalStatic}}
107
+
108
+ if (antdConfig.iconPrefixCls) {
66
109
  // Icons in message need to set iconPrefixCls via ConfigProvider.config()
67
110
  ConfigProvider.config({
68
- iconPrefixCls: finalConfigProvider.iconPrefixCls,
111
+ iconPrefixCls: antdConfig.iconPrefixCls,
69
112
  });
70
113
  };
71
114
 
72
- if (finalConfigProvider.theme) {
115
+ if (antdConfig.theme) {
73
116
  // Pass config theme to static method
74
117
  ConfigProvider.config({
75
- theme: finalConfigProvider.theme,
118
+ theme: antdConfig.theme,
76
119
  });
77
120
  }
78
121
 
79
- container = <ConfigProvider {...finalConfigProvider}>{container}</ConfigProvider>;
122
+ container = <ConfigProvider {...antdConfig}>{container}</ConfigProvider>;
80
123
  {{/configProvider}}
81
124
 
82
- {{#enableV5ThemeAlgorithm}}
83
- // Add token algorithm for antd5 only
84
- container = (
85
- <ConfigProvider
86
- theme={({
87
- algorithm: [
88
- {{#enableV5ThemeAlgorithm.compact}}
89
- theme.compactAlgorithm,
90
- {{/enableV5ThemeAlgorithm.compact}}
91
- {{#enableV5ThemeAlgorithm.dark}}
92
- theme.darkAlgorithm,
93
- {{/enableV5ThemeAlgorithm.dark}}
94
- ],
95
- })}
96
- >
97
- {container}
98
- </ConfigProvider>
99
- );
100
- {{/enableV5ThemeAlgorithm}}
101
-
102
125
  {{#styleProvider}}
103
126
  container = (
104
127
  <StyleProvider
@@ -114,9 +137,27 @@ export function rootContainer(rawContainer) {
114
137
  );
115
138
  {{/styleProvider}}
116
139
 
140
+ {{#antdConfigSetter}}
141
+ container = (
142
+ <AntdConfigContextSetter.Provider value={setAntdConfig}>
143
+ <AntdConfigContext.Provider value={antdConfig}>
144
+ {container}
145
+ </AntdConfigContext.Provider>
146
+ </AntdConfigContextSetter.Provider>
147
+ )
148
+ {{/antdConfigSetter}}
149
+
117
150
  return container;
118
151
  }
119
152
 
153
+ export function rootContainer(children) {
154
+ return (
155
+ <AntdProvider>
156
+ {children}
157
+ </AntdProvider>
158
+ );
159
+ }
160
+
120
161
  {{#appConfig}}
121
162
  // The App component should be under ConfigProvider
122
163
  // plugin-locale has other ConfigProvider
@@ -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;
@@ -284,7 +284,7 @@ const defaultLangUConfigMap = {
284
284
  },
285
285
  'nl-NL': {
286
286
  lang: 'nl-NL',
287
- label: 'Vlaams',
287
+ label: 'Nederlands',
288
288
  icon: '🇳🇱',
289
289
  title: 'Taal'
290
290
  },
@@ -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: {