@umijs/plugins 4.0.6 → 4.0.9

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.
@@ -1,52 +1,73 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const path_1 = require("path");
4
- const plugin_utils_1 = require("umi/plugin-utils");
5
- exports.default = (api) => {
6
- api.describe({
7
- key: 'tailwindcss',
8
- config: {
9
- schema(Joi) {
10
- return Joi.object();
11
- },
12
- },
13
- enableBy: api.EnableBy.config,
14
- });
15
- let tailwind = null;
16
- const outputPath = 'plugin-tailwindcss/tailwind.css';
17
- api.onBeforeCompiler(() => {
18
- const inputPath = (0, path_1.join)(api.cwd, 'tailwind.css');
19
- const generatedPath = (0, path_1.join)(api.paths.absTmpPath, outputPath);
20
- const binPath = (0, path_1.join)(api.cwd, 'node_modules/.bin/tailwind');
21
- return new Promise((resolve) => {
22
- /** 透过子进程建立 tailwindcss 服务,将生成的 css 写入 generatedPath */
23
- tailwind = (0, plugin_utils_1.crossSpawn)(`${binPath}`, [
24
- '-i',
25
- inputPath,
26
- '-o',
27
- generatedPath,
28
- api.env === 'development' ? '--watch' : '',
29
- ], {
30
- stdio: 'inherit',
31
- });
32
- tailwind.on('error', (m) => {
33
- api.logger.error('tailwindcss service encounter an error: ' + m);
34
- });
35
- if (api.env === 'production') {
36
- tailwind.on('exit', () => {
37
- api.logger.info('tailwindcss service exited');
38
- resolve();
39
- });
40
- }
41
- else {
42
- api.logger.info('tailwindcss service started');
43
- resolve();
44
- }
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // tailwindcss.ts
20
+ var tailwindcss_exports = {};
21
+ __export(tailwindcss_exports, {
22
+ default: () => tailwindcss_default
23
+ });
24
+ module.exports = __toCommonJS(tailwindcss_exports);
25
+ var import_path = require("path");
26
+ var import_plugin_utils = require("umi/plugin-utils");
27
+ var tailwindcss_default = (api) => {
28
+ api.describe({
29
+ key: "tailwindcss",
30
+ config: {
31
+ schema(Joi) {
32
+ return Joi.alternatives().try(Joi.object(), Joi.boolean().invalid(true));
33
+ }
34
+ },
35
+ enableBy: api.EnableBy.config
36
+ });
37
+ let tailwind = null;
38
+ const outputPath = "plugin-tailwindcss/tailwind.css";
39
+ api.onBeforeCompiler(() => {
40
+ const inputPath = (0, import_path.join)(api.cwd, "tailwind.css");
41
+ const generatedPath = (0, import_path.join)(api.paths.absTmpPath, outputPath);
42
+ const binPath = (0, import_path.join)(api.cwd, "node_modules/.bin/tailwind");
43
+ return new Promise((resolve) => {
44
+ tailwind = (0, import_plugin_utils.crossSpawn)(`${binPath}`, [
45
+ "-i",
46
+ inputPath,
47
+ "-o",
48
+ generatedPath,
49
+ api.env === "development" ? "--watch" : ""
50
+ ], {
51
+ stdio: "inherit"
52
+ });
53
+ tailwind.on("error", (m) => {
54
+ api.logger.error("tailwindcss service encounter an error: " + m);
55
+ });
56
+ if (api.env === "production") {
57
+ tailwind.on("exit", () => {
58
+ api.logger.info("tailwindcss service exited");
59
+ resolve();
45
60
  });
61
+ } else {
62
+ api.logger.info("tailwindcss service started");
63
+ resolve();
64
+ }
46
65
  });
47
- /** 将生成的 css 文件加入到 import 中 */
48
- api.addEntryImports(() => {
49
- const generatedPath = (0, plugin_utils_1.winPath)((0, path_1.join)(api.paths.absTmpPath, outputPath));
50
- return [{ source: generatedPath }];
51
- });
66
+ });
67
+ api.addEntryImports(() => {
68
+ const generatedPath = (0, import_plugin_utils.winPath)((0, import_path.join)(api.paths.absTmpPath, outputPath));
69
+ return [{ source: generatedPath }];
70
+ });
52
71
  };
72
+ // Annotate the CommonJS export names for ESM import in node:
73
+ 0 && (module.exports = {});
package/dist/unocss.js CHANGED
@@ -1,39 +1,59 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const child_process_1 = require("child_process");
4
- const fs_1 = require("fs");
5
- const path_1 = require("path");
6
- const plugin_utils_1 = require("umi/plugin-utils");
7
- exports.default = (api) => {
8
- api.describe({
9
- key: 'unocss',
10
- config: {
11
- schema(Joi) {
12
- return Joi.object({
13
- watch: Joi.array(),
14
- });
15
- },
16
- },
17
- enableBy: api.EnableBy.config,
18
- });
19
- const outputPath = 'uno.css';
20
- api.onBeforeCompiler(() => {
21
- /** 由于 @unocss/cli 对设置文件进行了检查,因此加入需要 unocss.config.ts 设置的提示
22
- * https://github.com/antfu/unocss/blob/main/packages/cli/src/index.ts#L93 */
23
- if (!(0, fs_1.existsSync)((0, path_1.join)(api.paths.cwd, 'unocss.config.ts')))
24
- api.logger.warn('请在项目目录中添加 unocss.config.ts 文件,并配置需要的 unocss presets,否则插件将没有效果!');
25
- const generatedPath = (0, path_1.join)(api.paths.absTmpPath, outputPath);
26
- const binPath = (0, path_1.join)(api.cwd, 'node_modules/.bin/unocss');
27
- const watchDirs = api.config.unocss.watch;
28
- /** 透过子进程建立 unocss 服务,将生成的 css 写入 generatedPath */
29
- const unocss = (0, child_process_1.exec)(`${binPath} ${watchDirs.join(' ')} --out-file ${generatedPath} ${api.env === 'development' ? '--watch' : ''}`, { cwd: api.cwd });
30
- unocss.on('error', (m) => {
31
- api.logger.error('unocss service encounter an error: ' + m);
32
- });
33
- });
34
- /** 将生成的 css 文件加入到 import 中 */
35
- api.addEntryImports(() => {
36
- const generatedPath = (0, plugin_utils_1.winPath)((0, path_1.join)(api.paths.absTmpPath, outputPath));
37
- return [{ source: generatedPath }];
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // unocss.ts
20
+ var unocss_exports = {};
21
+ __export(unocss_exports, {
22
+ default: () => unocss_default
23
+ });
24
+ module.exports = __toCommonJS(unocss_exports);
25
+ var import_child_process = require("child_process");
26
+ var import_fs = require("fs");
27
+ var import_path = require("path");
28
+ var import_plugin_utils = require("umi/plugin-utils");
29
+ var unocss_default = (api) => {
30
+ api.describe({
31
+ key: "unocss",
32
+ config: {
33
+ schema(Joi) {
34
+ return Joi.alternatives().try(Joi.object({
35
+ watch: Joi.array()
36
+ }), Joi.boolean().invalid(true));
37
+ }
38
+ },
39
+ enableBy: api.EnableBy.config
40
+ });
41
+ const outputPath = "uno.css";
42
+ api.onBeforeCompiler(() => {
43
+ if (!(0, import_fs.existsSync)((0, import_path.join)(api.paths.cwd, "unocss.config.ts")))
44
+ api.logger.warn("\u8BF7\u5728\u9879\u76EE\u76EE\u5F55\u4E2D\u6DFB\u52A0 unocss.config.ts \u6587\u4EF6\uFF0C\u5E76\u914D\u7F6E\u9700\u8981\u7684 unocss presets\uFF0C\u5426\u5219\u63D2\u4EF6\u5C06\u6CA1\u6709\u6548\u679C\uFF01");
45
+ const generatedPath = (0, import_path.join)(api.paths.absTmpPath, outputPath);
46
+ const binPath = (0, import_path.join)(api.cwd, "node_modules/.bin/unocss");
47
+ const watchDirs = api.config.unocss.watch;
48
+ const unocss = (0, import_child_process.exec)(`${binPath} ${watchDirs.join(" ")} --out-file ${generatedPath} ${api.env === "development" ? "--watch" : ""}`, { cwd: api.cwd });
49
+ unocss.on("error", (m) => {
50
+ api.logger.error("unocss service encounter an error: " + m);
38
51
  });
52
+ });
53
+ api.addEntryImports(() => {
54
+ const generatedPath = (0, import_plugin_utils.winPath)((0, import_path.join)(api.paths.absTmpPath, outputPath));
55
+ return [{ source: generatedPath }];
56
+ });
39
57
  };
58
+ // Annotate the CommonJS export names for ESM import in node:
59
+ 0 && (module.exports = {});
@@ -1,38 +1,42 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
24
18
  };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.getIdentifierDeclaration = void 0;
27
- const t = __importStar(require("@umijs/bundler-utils/compiled/babel/types"));
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
+
22
+ // astUtils.ts
23
+ var astUtils_exports = {};
24
+ __export(astUtils_exports, {
25
+ getIdentifierDeclaration: () => getIdentifierDeclaration
26
+ });
27
+ module.exports = __toCommonJS(astUtils_exports);
28
+ var t = __toESM(require("@umijs/bundler-utils/compiled/babel/types"));
28
29
  function getIdentifierDeclaration(node, path) {
29
- if (t.isIdentifier(node) && path.scope.hasBinding(node.name)) {
30
- let bindingNode = path.scope.getBinding(node.name).path.node;
31
- if (t.isVariableDeclarator(bindingNode)) {
32
- bindingNode = bindingNode.init;
33
- }
34
- return bindingNode;
30
+ if (t.isIdentifier(node) && path.scope.hasBinding(node.name)) {
31
+ let bindingNode = path.scope.getBinding(node.name).path.node;
32
+ if (t.isVariableDeclarator(bindingNode)) {
33
+ bindingNode = bindingNode.init;
35
34
  }
36
- return node;
35
+ return bindingNode;
36
+ }
37
+ return node;
37
38
  }
38
- exports.getIdentifierDeclaration = getIdentifierDeclaration;
39
+ // Annotate the CommonJS export names for ESM import in node:
40
+ 0 && (module.exports = {
41
+ getIdentifierDeclaration
42
+ });
@@ -1,126 +1,131 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isNeedPolyfill = exports.exactLocalePaths = exports.getLocaleList = exports.getAntdLocale = exports.getMomentLocale = void 0;
4
- const fs_1 = require("fs");
5
- const path_1 = require("path");
6
- const plugin_utils_1 = require("umi/plugin-utils");
7
- /**
8
- * 获取 moment 包的 locale 名称
9
- * @param lang 语言
10
- * @param country 国家
11
- * @param resolveKey 用来resolve的key,moment 或者 dayjs,为了使 dayjs 可以替换 moment
12
- */
13
- const getMomentLocale = (lang, country, resolveKey) => {
14
- var _a, _b;
15
- const momentLocation = require
16
- .resolve(`${resolveKey}/locale/zh-cn`)
17
- .replace(/zh\-cn\.js$/, '');
18
- if ((0, fs_1.existsSync)((0, path_1.join)(momentLocation, `${lang}-${(_a = country === null || country === void 0 ? void 0 : country.toLocaleLowerCase) === null || _a === void 0 ? void 0 : _a.call(country)}.js`))) {
19
- const momentLocale = `${lang}-${(_b = country === null || country === void 0 ? void 0 : country.toLocaleLowerCase) === null || _b === void 0 ? void 0 : _b.call(country)}`;
20
- return {
21
- momentLocale,
22
- };
23
- }
24
- if ((0, fs_1.existsSync)((0, path_1.join)(momentLocation, `${lang}.js`))) {
25
- return {
26
- momentLocale: lang,
27
- };
28
- }
29
- return { momentLocale: '' };
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
30
8
  };
31
- exports.getMomentLocale = getMomentLocale;
32
- const getAntdLocale = (lang, country) => `${lang}_${(country || lang).toLocaleUpperCase()}`;
33
- exports.getAntdLocale = getAntdLocale;
34
- /**
35
- * 有些情况下可能项目包含的locale和antd的不匹配
36
- * 这个方法用于检测
37
- * @param localePath
38
- * @returns
39
- */
40
- const modulesHasLocale = (localePath) => {
41
- try {
42
- require.resolve(localePath);
43
- return true;
44
- }
45
- catch (error) {
46
- return false;
47
- }
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
48
16
  };
49
- const getLocaleList = async (opts) => {
50
- const { localeFolder, separator = '-', absSrcPath = '', absPagesPath = '', addAntdLocales, resolveKey = 'moment', } = opts;
51
- const localeFileMath = new RegExp(`^([a-z]{2})${separator}?([A-Z]{2})?\.(js|json|ts)$`);
52
- const localeFiles = plugin_utils_1.glob
53
- .sync('*.{ts,js,json}', {
54
- cwd: (0, plugin_utils_1.winPath)((0, path_1.join)(absSrcPath, localeFolder)),
55
- })
56
- .map((name) => (0, plugin_utils_1.winPath)((0, path_1.join)(absSrcPath, localeFolder, name)))
57
- .concat(plugin_utils_1.glob
58
- .sync(`**/${localeFolder}/*.{ts,js,json}`, {
59
- cwd: absPagesPath,
60
- })
61
- .map((name) => (0, plugin_utils_1.winPath)((0, path_1.join)(absPagesPath, name))))
62
- .filter((p) => localeFileMath.test((0, path_1.basename)(p)) && (0, fs_1.existsSync)(p))
63
- .map((fullName) => {
64
- var _a, _b;
65
- const fileName = (0, path_1.basename)(fullName);
66
- const fileInfo = (_b = (_a = localeFileMath
67
- .exec(fileName)) === null || _a === void 0 ? void 0 : _a.slice(1, 3)) === null || _b === void 0 ? void 0 : _b.filter(Boolean);
68
- return {
69
- name: (fileInfo || []).join(separator),
70
- path: fullName,
71
- };
72
- });
73
- const groups = plugin_utils_1.lodash.groupBy(localeFiles, 'name');
74
- const promises = Object.keys(groups).map(async (name) => {
75
- const [lang, country = ''] = name.split(separator);
76
- const { momentLocale } = (0, exports.getMomentLocale)(lang, country, resolveKey);
77
- const antdLocale = plugin_utils_1.lodash
78
- .uniq(await addAntdLocales({ lang, country }))
79
- .filter((localePath) => modulesHasLocale(localePath));
80
- return {
81
- lang,
82
- name,
83
- // react-intl Function.supportedLocalesOf
84
- // Uncaught RangeError: Incorrect locale information provided
85
- locale: name.split(separator).join('-'),
86
- country,
87
- antdLocale,
88
- paths: groups[name].map((item) => (0, plugin_utils_1.winPath)(item.path)),
89
- momentLocale,
90
- };
91
- });
92
- return Promise.all(promises);
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // localeUtils.ts
20
+ var localeUtils_exports = {};
21
+ __export(localeUtils_exports, {
22
+ exactLocalePaths: () => exactLocalePaths,
23
+ getAntdLocale: () => getAntdLocale,
24
+ getLocaleList: () => getLocaleList,
25
+ getMomentLocale: () => getMomentLocale,
26
+ isNeedPolyfill: () => isNeedPolyfill
27
+ });
28
+ module.exports = __toCommonJS(localeUtils_exports);
29
+ var import_fs = require("fs");
30
+ var import_path = require("path");
31
+ var import_plugin_utils = require("umi/plugin-utils");
32
+ var getMomentLocale = (lang, country, resolveKey) => {
33
+ var _a, _b;
34
+ const momentLocation = require.resolve(`${resolveKey}/locale/zh-cn`).replace(/zh\-cn\.js$/, "");
35
+ if ((0, import_fs.existsSync)((0, import_path.join)(momentLocation, `${lang}-${(_a = country == null ? void 0 : country.toLocaleLowerCase) == null ? void 0 : _a.call(country)}.js`))) {
36
+ const momentLocale = `${lang}-${(_b = country == null ? void 0 : country.toLocaleLowerCase) == null ? void 0 : _b.call(country)}`;
37
+ return {
38
+ momentLocale
39
+ };
40
+ }
41
+ if ((0, import_fs.existsSync)((0, import_path.join)(momentLocation, `${lang}.js`))) {
42
+ return {
43
+ momentLocale: lang
44
+ };
45
+ }
46
+ return { momentLocale: "" };
93
47
  };
94
- exports.getLocaleList = getLocaleList;
95
- const exactLocalePaths = (data) => {
96
- return plugin_utils_1.lodash.flatten(data.map((item) => item.paths));
48
+ var getAntdLocale = (lang, country) => `${lang}_${(country || lang).toLocaleUpperCase()}`;
49
+ var modulesHasLocale = (localePath) => {
50
+ try {
51
+ require.resolve(localePath);
52
+ return true;
53
+ } catch (error) {
54
+ return false;
55
+ }
97
56
  };
98
- exports.exactLocalePaths = exactLocalePaths;
99
- function isNeedPolyfill(targets = {}) {
100
- // data come from https://caniuse.com/#search=intl
101
- // you can find all browsers in https://github.com/browserslist/browserslist#browsers
102
- const polyfillTargets = {
103
- ie: 10,
104
- firefox: 28,
105
- chrome: 23,
106
- safari: 9.1,
107
- opera: 12.1,
108
- ios: 9.3,
109
- ios_saf: 9.3,
110
- operamini: Infinity,
111
- op_mini: Infinity,
112
- android: 4.3,
113
- blackberry: Infinity,
114
- operamobile: 12.1,
115
- op_mob: 12.1,
116
- explorermobil: 10,
117
- ie_mob: 10,
118
- ucandroid: Infinity,
57
+ var getLocaleList = async (opts) => {
58
+ const {
59
+ localeFolder,
60
+ separator = "-",
61
+ absSrcPath = "",
62
+ absPagesPath = "",
63
+ addAntdLocales,
64
+ resolveKey = "moment"
65
+ } = opts;
66
+ const localeFileMath = new RegExp(`^([a-z]{2})${separator}?([A-Z]{2})?.(js|json|ts)$`);
67
+ const localeFiles = import_plugin_utils.glob.sync("*.{ts,js,json}", {
68
+ cwd: (0, import_plugin_utils.winPath)((0, import_path.join)(absSrcPath, localeFolder))
69
+ }).map((name) => (0, import_plugin_utils.winPath)((0, import_path.join)(absSrcPath, localeFolder, name))).concat(import_plugin_utils.glob.sync(`**/${localeFolder}/*.{ts,js,json}`, {
70
+ cwd: absPagesPath
71
+ }).map((name) => (0, import_plugin_utils.winPath)((0, import_path.join)(absPagesPath, name)))).filter((p) => localeFileMath.test((0, import_path.basename)(p)) && (0, import_fs.existsSync)(p)).map((fullName) => {
72
+ var _a, _b;
73
+ const fileName = (0, import_path.basename)(fullName);
74
+ const fileInfo = (_b = (_a = localeFileMath.exec(fileName)) == null ? void 0 : _a.slice(1, 3)) == null ? void 0 : _b.filter(Boolean);
75
+ return {
76
+ name: (fileInfo || []).join(separator),
77
+ path: fullName
119
78
  };
120
- return (Object.keys(targets).find((key) => {
121
- const lowKey = key.toLocaleLowerCase();
122
- // @ts-ignore
123
- return polyfillTargets[lowKey] && polyfillTargets[lowKey] >= targets[key];
124
- }) !== undefined);
79
+ });
80
+ const groups = import_plugin_utils.lodash.groupBy(localeFiles, "name");
81
+ const promises = Object.keys(groups).map(async (name) => {
82
+ const [lang, country = ""] = name.split(separator);
83
+ const { momentLocale } = getMomentLocale(lang, country, resolveKey);
84
+ const antdLocale = import_plugin_utils.lodash.uniq(await addAntdLocales({ lang, country })).filter((localePath) => modulesHasLocale(localePath));
85
+ return {
86
+ lang,
87
+ name,
88
+ locale: name.split(separator).join("-"),
89
+ country,
90
+ antdLocale,
91
+ paths: groups[name].map((item) => (0, import_plugin_utils.winPath)(item.path)),
92
+ momentLocale
93
+ };
94
+ });
95
+ return Promise.all(promises);
96
+ };
97
+ var exactLocalePaths = (data) => {
98
+ return import_plugin_utils.lodash.flatten(data.map((item) => item.paths));
99
+ };
100
+ function isNeedPolyfill(targets = {}) {
101
+ const polyfillTargets = {
102
+ ie: 10,
103
+ firefox: 28,
104
+ chrome: 23,
105
+ safari: 9.1,
106
+ opera: 12.1,
107
+ ios: 9.3,
108
+ ios_saf: 9.3,
109
+ operamini: Infinity,
110
+ op_mini: Infinity,
111
+ android: 4.3,
112
+ blackberry: Infinity,
113
+ operamobile: 12.1,
114
+ op_mob: 12.1,
115
+ explorermobil: 10,
116
+ ie_mob: 10,
117
+ ucandroid: Infinity
118
+ };
119
+ return Object.keys(targets).find((key) => {
120
+ const lowKey = key.toLocaleLowerCase();
121
+ return polyfillTargets[lowKey] && polyfillTargets[lowKey] >= targets[key];
122
+ }) !== void 0;
125
123
  }
126
- exports.isNeedPolyfill = isNeedPolyfill;
124
+ // Annotate the CommonJS export names for ESM import in node:
125
+ 0 && (module.exports = {
126
+ exactLocalePaths,
127
+ getAntdLocale,
128
+ getLocaleList,
129
+ getMomentLocale,
130
+ isNeedPolyfill
131
+ });