@umijs/plugins 4.0.0-rc.3 → 4.0.0-rc.6
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 +3 -3
- package/dist/dva.js +5 -1
- package/dist/layout.js +5 -1
- package/dist/model.js +5 -1
- package/dist/moment2dayjs.js +4 -4
- package/dist/qiankun/master.js +3 -2
- package/dist/qiankun/slave.js +3 -2
- package/dist/tailwindcss.js +30 -28
- package/dist/unocss.js +7 -3
- package/dist/utils/astUtils.js +5 -1
- package/dist/utils/localeUtils.js +10 -10
- package/dist/utils/modelUtils.js +8 -4
- package/dist/utils/withTmpPath.js +2 -2
- package/libs/locale/localeExports.tpl +6 -6
- package/package.json +6 -7
package/dist/antd.js
CHANGED
|
@@ -67,7 +67,7 @@ exports.default = (api) => {
|
|
|
67
67
|
});
|
|
68
68
|
// antd config provider
|
|
69
69
|
api.onGenerateFiles(() => {
|
|
70
|
-
if (!api.config.antd.
|
|
70
|
+
if (!api.config.antd.configProvider)
|
|
71
71
|
return;
|
|
72
72
|
api.writeTmpFile({
|
|
73
73
|
path: `runtime.tsx`,
|
|
@@ -90,12 +90,12 @@ export function rootContainer(container) {
|
|
|
90
90
|
return <ConfigProvider {...finalConfig}>{container}</ConfigProvider>;
|
|
91
91
|
}
|
|
92
92
|
`.trim(), {
|
|
93
|
-
config: JSON.stringify(api.config.antd.
|
|
93
|
+
config: JSON.stringify(api.config.antd.configProvider),
|
|
94
94
|
}),
|
|
95
95
|
});
|
|
96
96
|
});
|
|
97
97
|
api.addRuntimePlugin(() => {
|
|
98
|
-
return api.config.antd.
|
|
98
|
+
return api.config.antd.configProvider
|
|
99
99
|
? [(0, withTmpPath_1.withTmpPath)({ api, path: 'runtime.tsx' })]
|
|
100
100
|
: [];
|
|
101
101
|
});
|
package/dist/dva.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
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);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/dist/layout.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
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);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/dist/model.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
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);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/dist/moment2dayjs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const utils_1 = require("@umijs/utils");
|
|
4
3
|
const path_1 = require("path");
|
|
4
|
+
const plugin_utils_1 = require("umi/plugin-utils");
|
|
5
5
|
/*
|
|
6
6
|
As long as moment2dayjs is registered, moment will be replaced by dayjs.
|
|
7
7
|
The presets that can adapt to antd is registered by default.
|
|
@@ -81,11 +81,11 @@ dayjs.extend({{.}});
|
|
|
81
81
|
|
|
82
82
|
dayjs.extend(antdPlugin);
|
|
83
83
|
`;
|
|
84
|
-
const dayjsAntdPluginPath = require.resolve('antd-dayjs-webpack-plugin/src/antd-plugin');
|
|
85
|
-
const dayjsPath = (0, path_1.dirname)(require.resolve('dayjs/package.json'));
|
|
84
|
+
const dayjsAntdPluginPath = (0, plugin_utils_1.winPath)(require.resolve('antd-dayjs-webpack-plugin/src/antd-plugin'));
|
|
85
|
+
const dayjsPath = (0, plugin_utils_1.winPath)((0, path_1.dirname)(require.resolve('dayjs/package.json')));
|
|
86
86
|
api.writeTmpFile({
|
|
87
87
|
path: 'runtime.tsx',
|
|
88
|
-
content:
|
|
88
|
+
content: plugin_utils_1.Mustache.render(runtimeTpl, {
|
|
89
89
|
plugins,
|
|
90
90
|
dayjsPath,
|
|
91
91
|
dayjsAntdPluginPath,
|
package/dist/qiankun/master.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.isMasterEnable = void 0;
|
|
4
4
|
const fs_1 = require("fs");
|
|
5
5
|
const path_1 = require("path");
|
|
6
|
+
const plugin_utils_1 = require("umi/plugin-utils");
|
|
6
7
|
const withTmpPath_1 = require("../utils/withTmpPath");
|
|
7
8
|
const constants_1 = require("./constants");
|
|
8
9
|
function isMasterEnable(opts) {
|
|
@@ -105,8 +106,8 @@ export const setMasterOptions = (newOpts) => options = ({ ...options, ...newOpts
|
|
|
105
106
|
.replace('__USE_MODEL__', api.isPluginEnable('model')
|
|
106
107
|
? `import { useModel } from '@@/plugin-model'`
|
|
107
108
|
: `const useModel = null;`)
|
|
108
|
-
.replace(/from 'qiankun'/g, `from '${(0, path_1.dirname)(require.resolve('qiankun/package'))}'`)
|
|
109
|
-
.replace(/from 'lodash\//g, `from '${(0, path_1.dirname)(require.resolve('lodash/package'))}/`),
|
|
109
|
+
.replace(/from 'qiankun'/g, `from '${(0, plugin_utils_1.winPath)((0, path_1.dirname)(require.resolve('qiankun/package')))}'`)
|
|
110
|
+
.replace(/from 'lodash\//g, `from '${(0, plugin_utils_1.winPath)((0, path_1.dirname)(require.resolve('lodash/package')))}/`),
|
|
110
111
|
});
|
|
111
112
|
}
|
|
112
113
|
});
|
package/dist/qiankun/slave.js
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const assert_1 = __importDefault(require("assert"));
|
|
7
7
|
const fs_1 = require("fs");
|
|
8
8
|
const path_1 = require("path");
|
|
9
|
+
const plugin_utils_1 = require("umi/plugin-utils");
|
|
9
10
|
const withTmpPath_1 = require("../utils/withTmpPath");
|
|
10
11
|
const constants_1 = require("./constants");
|
|
11
12
|
// BREAK CHANGE: 需要手动配置 slave: {},不能留空
|
|
@@ -133,8 +134,8 @@ if (!window.__POWERED_BY_QIANKUN__) {
|
|
|
133
134
|
.replace('__USE_MODEL__', api.isPluginEnable('model')
|
|
134
135
|
? `import { useModel } from '@@/plugin/model'`
|
|
135
136
|
: `const useModel = null;`)
|
|
136
|
-
.replace(/from 'qiankun'/g, `from '${(0, path_1.dirname)(require.resolve('qiankun/package'))}'`)
|
|
137
|
-
.replace(/from 'lodash\//g, `from '${(0, path_1.dirname)(require.resolve('lodash/package'))}/`),
|
|
137
|
+
.replace(/from 'qiankun'/g, `from '${(0, plugin_utils_1.winPath)((0, path_1.dirname)(require.resolve('qiankun/package')))}'`)
|
|
138
|
+
.replace(/from 'lodash\//g, `from '${(0, plugin_utils_1.winPath)((0, path_1.dirname)(require.resolve('lodash/package')))}/`),
|
|
138
139
|
});
|
|
139
140
|
});
|
|
140
141
|
});
|
package/dist/tailwindcss.js
CHANGED
|
@@ -1,38 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
const
|
|
23
|
-
const
|
|
3
|
+
const plugin_utils_1 = require("umi/plugin-utils");
|
|
4
|
+
const path_1 = require("path");
|
|
24
5
|
exports.default = (api) => {
|
|
25
|
-
api.describe({
|
|
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';
|
|
26
17
|
api.onStart(() => {
|
|
27
|
-
const inputPath =
|
|
28
|
-
const generatedPath =
|
|
29
|
-
const binPath =
|
|
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');
|
|
30
21
|
/** 透过子进程建立 tailwindcss 服务,将生成的 css 写入 generatedPath */
|
|
31
|
-
|
|
22
|
+
tailwind = (0, plugin_utils_1.crossSpawn)(`${binPath}`, [
|
|
23
|
+
'-i',
|
|
24
|
+
inputPath,
|
|
25
|
+
'-o',
|
|
26
|
+
generatedPath,
|
|
27
|
+
api.env === 'development' ? '--watch' : '',
|
|
28
|
+
], {
|
|
29
|
+
stdio: 'inherit',
|
|
30
|
+
});
|
|
32
31
|
tailwind.on('error', (m) => {
|
|
33
32
|
api.logger.error('tailwindcss service encounter an error: ' + m);
|
|
34
33
|
});
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
});
|
|
35
|
+
/** 将生成的 css 文件加入到 import 中 */
|
|
36
|
+
api.addEntryImports(() => {
|
|
37
|
+
const generatedPath = (0, plugin_utils_1.winPath)((0, path_1.join)(api.paths.absTmpPath, outputPath));
|
|
38
|
+
return [{ source: generatedPath }];
|
|
37
39
|
});
|
|
38
40
|
};
|
package/dist/unocss.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
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);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -22,10 +26,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
22
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
27
|
};
|
|
24
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
const utils_1 = require("@umijs/utils");
|
|
26
29
|
const child_process_1 = require("child_process");
|
|
27
30
|
const fs = __importStar(require("fs"));
|
|
28
31
|
const path_1 = __importDefault(require("path"));
|
|
32
|
+
const plugin_utils_1 = require("umi/plugin-utils");
|
|
29
33
|
exports.default = (api) => {
|
|
30
34
|
api.describe({
|
|
31
35
|
key: 'unocss',
|
|
@@ -42,7 +46,7 @@ exports.default = (api) => {
|
|
|
42
46
|
/** 由于 @unocss/cli 对设置文件进行了检查,因此加入需要 unocss.config.ts 设置的提示
|
|
43
47
|
* https://github.com/antfu/unocss/blob/main/packages/cli/src/index.ts#L93 */
|
|
44
48
|
if (!fs.existsSync(path_1.default.resolve(api.paths.cwd, 'unocss.config.ts')))
|
|
45
|
-
|
|
49
|
+
plugin_utils_1.logger.warn('请在项目目录中添加 unocss.config.ts 文件,并配置需要的 unocss presets,否则插件将没有效果!');
|
|
46
50
|
const generatedPath = path_1.default.resolve(api.paths.absTmpPath, 'uno.css');
|
|
47
51
|
const binPath = path_1.default.resolve(api.cwd, 'node_modules/.bin/unocss');
|
|
48
52
|
const watchDirs = api.config.unocss.watch;
|
package/dist/utils/astUtils.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
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);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -10,9 +10,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.isNeedPolyfill = exports.exactLocalePaths = exports.getLocaleList = exports.getAntdLocale = exports.getMomentLocale = void 0;
|
|
13
|
-
const utils_1 = require("@umijs/utils");
|
|
14
13
|
const fs_1 = require("fs");
|
|
15
14
|
const path_1 = require("path");
|
|
15
|
+
const plugin_utils_1 = require("umi/plugin-utils");
|
|
16
16
|
/**
|
|
17
17
|
* 获取 moment 包的 locale 名称
|
|
18
18
|
* @param lang 语言
|
|
@@ -58,16 +58,16 @@ const modulesHasLocale = (localePath) => {
|
|
|
58
58
|
const getLocaleList = (opts) => __awaiter(void 0, void 0, void 0, function* () {
|
|
59
59
|
const { localeFolder, separator = '-', absSrcPath = '', absPagesPath = '', addAntdLocales, resolveKey = 'moment', } = opts;
|
|
60
60
|
const localeFileMath = new RegExp(`^([a-z]{2})${separator}?([A-Z]{2})?\.(js|json|ts)$`);
|
|
61
|
-
const localeFiles =
|
|
61
|
+
const localeFiles = plugin_utils_1.glob
|
|
62
62
|
.sync('*.{ts,js,json}', {
|
|
63
|
-
cwd: (0,
|
|
63
|
+
cwd: (0, plugin_utils_1.winPath)((0, path_1.join)(absSrcPath, localeFolder)),
|
|
64
64
|
})
|
|
65
|
-
.map((name) => (0,
|
|
66
|
-
.concat(
|
|
65
|
+
.map((name) => (0, plugin_utils_1.winPath)((0, path_1.join)(absSrcPath, localeFolder, name)))
|
|
66
|
+
.concat(plugin_utils_1.glob
|
|
67
67
|
.sync(`**/${localeFolder}/*.{ts,js,json}`, {
|
|
68
68
|
cwd: absPagesPath,
|
|
69
69
|
})
|
|
70
|
-
.map((name) => (0,
|
|
70
|
+
.map((name) => (0, plugin_utils_1.winPath)((0, path_1.join)(absPagesPath, name))))
|
|
71
71
|
.filter((p) => localeFileMath.test((0, path_1.basename)(p)) && (0, fs_1.existsSync)(p))
|
|
72
72
|
.map((fullName) => {
|
|
73
73
|
var _a, _b;
|
|
@@ -79,11 +79,11 @@ const getLocaleList = (opts) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
79
79
|
path: fullName,
|
|
80
80
|
};
|
|
81
81
|
});
|
|
82
|
-
const groups =
|
|
82
|
+
const groups = plugin_utils_1.lodash.groupBy(localeFiles, 'name');
|
|
83
83
|
const promises = Object.keys(groups).map((name) => __awaiter(void 0, void 0, void 0, function* () {
|
|
84
84
|
const [lang, country = ''] = name.split(separator);
|
|
85
85
|
const { momentLocale } = (0, exports.getMomentLocale)(lang, country, resolveKey);
|
|
86
|
-
const antdLocale =
|
|
86
|
+
const antdLocale = plugin_utils_1.lodash
|
|
87
87
|
.uniq(yield addAntdLocales({ lang, country }))
|
|
88
88
|
.filter((localePath) => modulesHasLocale(localePath));
|
|
89
89
|
return {
|
|
@@ -94,7 +94,7 @@ const getLocaleList = (opts) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
94
94
|
locale: name.split(separator).join('-'),
|
|
95
95
|
country,
|
|
96
96
|
antdLocale,
|
|
97
|
-
paths: groups[name].map((item) => (0,
|
|
97
|
+
paths: groups[name].map((item) => (0, plugin_utils_1.winPath)(item.path)),
|
|
98
98
|
momentLocale,
|
|
99
99
|
};
|
|
100
100
|
}));
|
|
@@ -102,7 +102,7 @@ const getLocaleList = (opts) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
102
102
|
});
|
|
103
103
|
exports.getLocaleList = getLocaleList;
|
|
104
104
|
const exactLocalePaths = (data) => {
|
|
105
|
-
return
|
|
105
|
+
return plugin_utils_1.lodash.flatten(data.map((item) => item.paths));
|
|
106
106
|
};
|
|
107
107
|
exports.exactLocalePaths = exactLocalePaths;
|
|
108
108
|
function isNeedPolyfill(targets = {}) {
|
package/dist/utils/modelUtils.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
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);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -26,9 +30,9 @@ exports.ModelUtils = exports.Model = void 0;
|
|
|
26
30
|
const parser = __importStar(require("@umijs/bundler-utils/compiled/babel/parser"));
|
|
27
31
|
const traverse_1 = __importDefault(require("@umijs/bundler-utils/compiled/babel/traverse"));
|
|
28
32
|
const esbuild_1 = require("@umijs/bundler-utils/compiled/esbuild");
|
|
29
|
-
const utils_1 = require("@umijs/utils");
|
|
30
33
|
const fs_1 = require("fs");
|
|
31
34
|
const path_1 = require("path");
|
|
35
|
+
const plugin_utils_1 = require("umi/plugin-utils");
|
|
32
36
|
const astUtils_1 = require("./astUtils");
|
|
33
37
|
class Model {
|
|
34
38
|
constructor(file, id) {
|
|
@@ -76,12 +80,12 @@ class ModelUtils {
|
|
|
76
80
|
});
|
|
77
81
|
}
|
|
78
82
|
getModels(opts) {
|
|
79
|
-
return
|
|
83
|
+
return plugin_utils_1.glob
|
|
80
84
|
.sync(opts.pattern || '**/*.{ts,js}', {
|
|
81
85
|
cwd: opts.base,
|
|
82
86
|
absolute: true,
|
|
83
87
|
})
|
|
84
|
-
.map(
|
|
88
|
+
.map(plugin_utils_1.winPath)
|
|
85
89
|
.filter((file) => {
|
|
86
90
|
if (/\.d.ts$/.test(file))
|
|
87
91
|
return false;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.withTmpPath = void 0;
|
|
4
|
-
const utils_1 = require("@umijs/utils");
|
|
5
4
|
const path_1 = require("path");
|
|
5
|
+
const plugin_utils_1 = require("umi/plugin-utils");
|
|
6
6
|
function withTmpPath(opts) {
|
|
7
|
-
return (0,
|
|
7
|
+
return (0, plugin_utils_1.winPath)((0, path_1.join)(opts.api.paths.absTmpPath, opts.api.plugin.key && !opts.noPluginDir
|
|
8
8
|
? `plugin-${opts.api.plugin.key}`
|
|
9
9
|
: '', opts.path));
|
|
10
10
|
}
|
|
@@ -163,9 +163,9 @@ export const getLocale = () => {
|
|
|
163
163
|
// please clear localStorage if you change the baseSeparator config
|
|
164
164
|
// because changing will break the app
|
|
165
165
|
const lang =
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
166
|
+
navigator.cookieEnabled && typeof localStorage !== 'undefined' && useLocalStorage
|
|
167
|
+
? window.localStorage.getItem('umi_locale')
|
|
168
|
+
: '';
|
|
169
169
|
// support baseNavigator, default true
|
|
170
170
|
let browserLang;
|
|
171
171
|
{{#BaseNavigator}}
|
|
@@ -207,9 +207,9 @@ export const setLocale = (lang: string, realReload: boolean = true) => {
|
|
|
207
207
|
|
|
208
208
|
const updater = () => {
|
|
209
209
|
if (getLocale() !== lang) {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
210
|
+
if (navigator.cookieEnabled && typeof window.localStorage !== 'undefined' && useLocalStorage) {
|
|
211
|
+
window.localStorage.setItem('umi_locale', lang || '');
|
|
212
|
+
}
|
|
213
213
|
setIntl(lang);
|
|
214
214
|
if (realReload) {
|
|
215
215
|
window.location.reload();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/plugins",
|
|
3
|
-
"version": "4.0.0-rc.
|
|
3
|
+
"version": "4.0.0-rc.6",
|
|
4
4
|
"description": "@umijs/plugins",
|
|
5
5
|
"homepage": "https://github.com/umijs/umi-next/tree/master/packages/plugins#readme",
|
|
6
6
|
"bugs": "https://github.com/umijs/umi-next/issues",
|
|
@@ -23,13 +23,12 @@
|
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@ahooksjs/use-request": "^2.0.0",
|
|
25
25
|
"@ant-design/icons": "^4.7.0",
|
|
26
|
-
"@ant-design/pro-layout": "^
|
|
27
|
-
"@umijs/bundler-utils": "4.0.0-rc.
|
|
28
|
-
"antd": "^4.18.8",
|
|
26
|
+
"@ant-design/pro-layout": "^7.0.1-beta.3",
|
|
27
|
+
"@umijs/bundler-utils": "4.0.0-rc.6",
|
|
29
28
|
"antd-dayjs-webpack-plugin": "^1.0.6",
|
|
30
|
-
"axios": "^0.26.
|
|
29
|
+
"axios": "^0.26.1",
|
|
31
30
|
"babel-plugin-import": "^1.13.3",
|
|
32
|
-
"dayjs": "^1.10.
|
|
31
|
+
"dayjs": "^1.10.8",
|
|
33
32
|
"dva-core": "^2.0.4",
|
|
34
33
|
"event-emitter": "~0.3.5",
|
|
35
34
|
"fast-deep-equal": "3.1.3",
|
|
@@ -42,7 +41,7 @@
|
|
|
42
41
|
"warning": "^4.0.3"
|
|
43
42
|
},
|
|
44
43
|
"devDependencies": {
|
|
45
|
-
"umi": "4.0.0-rc.
|
|
44
|
+
"umi": "4.0.0-rc.6"
|
|
46
45
|
},
|
|
47
46
|
"publishConfig": {
|
|
48
47
|
"access": "public"
|