@umijs/bundler-vite 4.0.20 → 4.0.21
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/build.js +3 -19
- package/dist/config/config.js +3 -19
- package/dist/config/transformer/css.js +11 -26
- package/dist/config/transformer/react.js +4 -17
- package/dist/plugins/svgr.js +10 -24
- package/package.json +3 -3
package/dist/build.js
CHANGED
|
@@ -1,26 +1,9 @@
|
|
|
1
1
|
var __create = Object.create;
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
9
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
-
var __spreadValues = (a, b) => {
|
|
13
|
-
for (var prop in b || (b = {}))
|
|
14
|
-
if (__hasOwnProp.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
if (__getOwnPropSymbols)
|
|
17
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
-
if (__propIsEnum.call(b, prop))
|
|
19
|
-
__defNormalProp(a, prop, b[prop]);
|
|
20
|
-
}
|
|
21
|
-
return a;
|
|
22
|
-
};
|
|
23
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
7
|
var __export = (target, all) => {
|
|
25
8
|
for (var name in all)
|
|
26
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -61,9 +44,10 @@ function generateTempEntry(cwd, entry) {
|
|
|
61
44
|
return Object.keys(entry).reduce((r, name) => {
|
|
62
45
|
const entryFilePath = import_path.default.join(entryTmpDir, `${name}.html`);
|
|
63
46
|
import_fs.default.writeFileSync(entryFilePath, `<html><head></head><body><script type="module" src="${entry[name]}"><\/script></body></html>`, "utf8");
|
|
64
|
-
return
|
|
47
|
+
return {
|
|
48
|
+
...r,
|
|
65
49
|
[name]: import_path.default.relative(cwd, entryFilePath)
|
|
66
|
-
}
|
|
50
|
+
};
|
|
67
51
|
}, {});
|
|
68
52
|
}
|
|
69
53
|
}
|
package/dist/config/config.js
CHANGED
|
@@ -1,26 +1,9 @@
|
|
|
1
1
|
var __create = Object.create;
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
9
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
-
var __spreadValues = (a, b) => {
|
|
13
|
-
for (var prop in b || (b = {}))
|
|
14
|
-
if (__hasOwnProp.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
if (__getOwnPropSymbols)
|
|
17
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
-
if (__propIsEnum.call(b, prop))
|
|
19
|
-
__defNormalProp(a, prop, b[prop]);
|
|
20
|
-
}
|
|
21
|
-
return a;
|
|
22
|
-
};
|
|
23
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
7
|
var __export = (target, all) => {
|
|
25
8
|
for (var name in all)
|
|
26
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -46,7 +29,8 @@ var import_vite = require("../../compiled/vite");
|
|
|
46
29
|
var import_plugins = __toESM(require("../plugins"));
|
|
47
30
|
var import_transformer = __toESM(require("./transformer"));
|
|
48
31
|
async function getConfig(opts) {
|
|
49
|
-
const applyOpts =
|
|
32
|
+
const applyOpts = {
|
|
33
|
+
...opts.userConfig,
|
|
50
34
|
entry: opts.entry,
|
|
51
35
|
extraBabelPlugins: [
|
|
52
36
|
...opts.extraBabelPlugins || [],
|
|
@@ -56,7 +40,7 @@ async function getConfig(opts) {
|
|
|
56
40
|
...opts.extraBabelPresets || [],
|
|
57
41
|
...opts.userConfig.extraBabelPresets || []
|
|
58
42
|
]
|
|
59
|
-
}
|
|
43
|
+
};
|
|
60
44
|
const vitePluginsConfig = (0, import_plugins.default)(applyOpts);
|
|
61
45
|
const viteConfigFromUserConfig = (0, import_transformer.default)(applyOpts);
|
|
62
46
|
let viteConfig = (0, import_vite.mergeConfig)(vitePluginsConfig, viteConfigFromUserConfig);
|
|
@@ -1,24 +1,7 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
7
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
-
var __spreadValues = (a, b) => {
|
|
11
|
-
for (var prop in b || (b = {}))
|
|
12
|
-
if (__hasOwnProp.call(b, prop))
|
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
|
14
|
-
if (__getOwnPropSymbols)
|
|
15
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
-
if (__propIsEnum.call(b, prop))
|
|
17
|
-
__defNormalProp(a, prop, b[prop]);
|
|
18
|
-
}
|
|
19
|
-
return a;
|
|
20
|
-
};
|
|
21
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
22
5
|
var __export = (target, all) => {
|
|
23
6
|
for (var name in all)
|
|
24
7
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -48,24 +31,26 @@ var css_default = function css(userConfig) {
|
|
|
48
31
|
const config = {
|
|
49
32
|
css: { postcss: {}, preprocessorOptions: {} }
|
|
50
33
|
};
|
|
51
|
-
config.css.postcss =
|
|
34
|
+
config.css.postcss = {
|
|
35
|
+
...((_a = userConfig.postcssLoader) == null ? void 0 : _a.postcssOptions) || {},
|
|
52
36
|
plugins: [
|
|
53
37
|
...((_c = (_b = userConfig.postcssLoader) == null ? void 0 : _b.postcssOptions) == null ? void 0 : _c.plugins) || [],
|
|
54
38
|
require("postcss-preset-env")({
|
|
55
39
|
browsers: getBrowserlist(userConfig.targets || {}),
|
|
56
|
-
autoprefixer:
|
|
57
|
-
flexbox: "no-2009"
|
|
58
|
-
|
|
40
|
+
autoprefixer: {
|
|
41
|
+
flexbox: "no-2009",
|
|
42
|
+
...userConfig.autoprefixer || {}
|
|
43
|
+
},
|
|
59
44
|
stage: 3
|
|
60
45
|
}),
|
|
61
46
|
...userConfig.extraPostCSSPlugins || []
|
|
62
47
|
]
|
|
63
|
-
}
|
|
64
|
-
config.css.preprocessorOptions.less =
|
|
65
|
-
javascriptEnabled: true
|
|
66
|
-
|
|
48
|
+
};
|
|
49
|
+
config.css.preprocessorOptions.less = {
|
|
50
|
+
javascriptEnabled: true,
|
|
51
|
+
...((_d = userConfig.lessLoader) == null ? void 0 : _d.lessOptions) || {},
|
|
67
52
|
modifyVars: userConfig.theme || {}
|
|
68
|
-
}
|
|
53
|
+
};
|
|
69
54
|
return config;
|
|
70
55
|
};
|
|
71
56
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -2,22 +2,8 @@ var __create = Object.create;
|
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
-
var __spreadValues = (a, b) => {
|
|
11
|
-
for (var prop in b || (b = {}))
|
|
12
|
-
if (__hasOwnProp.call(b, prop))
|
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
|
14
|
-
if (__getOwnPropSymbols)
|
|
15
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
-
if (__propIsEnum.call(b, prop))
|
|
17
|
-
__defNormalProp(a, prop, b[prop]);
|
|
18
|
-
}
|
|
19
|
-
return a;
|
|
20
|
-
};
|
|
21
7
|
var __export = (target, all) => {
|
|
22
8
|
for (var name in all)
|
|
23
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -44,13 +30,14 @@ var react_default = function react(userConfig) {
|
|
|
44
30
|
var _a;
|
|
45
31
|
const config = { plugins: [] };
|
|
46
32
|
if (!userConfig.vue) {
|
|
47
|
-
(_a = config.plugins) == null ? void 0 : _a.push((0, import_plugin_react.default)(
|
|
33
|
+
(_a = config.plugins) == null ? void 0 : _a.push((0, import_plugin_react.default)({
|
|
48
34
|
include: userConfig.extraBabelIncludes,
|
|
49
35
|
babel: {
|
|
50
36
|
plugins: userConfig.extraBabelPlugins,
|
|
51
37
|
presets: userConfig.extraBabelPresets
|
|
52
|
-
}
|
|
53
|
-
|
|
38
|
+
},
|
|
39
|
+
...(userConfig == null ? void 0 : userConfig.react) || {}
|
|
40
|
+
}));
|
|
54
41
|
}
|
|
55
42
|
return config;
|
|
56
43
|
};
|
package/dist/plugins/svgr.js
CHANGED
|
@@ -1,26 +1,9 @@
|
|
|
1
1
|
var __create = Object.create;
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
9
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
-
var __spreadValues = (a, b) => {
|
|
13
|
-
for (var prop in b || (b = {}))
|
|
14
|
-
if (__hasOwnProp.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
if (__getOwnPropSymbols)
|
|
17
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
-
if (__propIsEnum.call(b, prop))
|
|
19
|
-
__defNormalProp(a, prop, b[prop]);
|
|
20
|
-
}
|
|
21
|
-
return a;
|
|
22
|
-
};
|
|
23
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
7
|
var __export = (target, all) => {
|
|
25
8
|
for (var name in all)
|
|
26
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -53,19 +36,22 @@ function svgrPlugin(svgr = {}, svgo = {}, transformOptions) {
|
|
|
53
36
|
let componentCode = code;
|
|
54
37
|
if (svgr) {
|
|
55
38
|
const svgFile = import_fs.default.readFileSync(id, "utf8");
|
|
56
|
-
const svgrCode = await (0, import_core.transform)(svgFile,
|
|
39
|
+
const svgrCode = await (0, import_core.transform)(svgFile, {
|
|
57
40
|
icon: true,
|
|
58
|
-
svgoConfig:
|
|
59
|
-
|
|
41
|
+
svgoConfig: {
|
|
42
|
+
...svgo || {}
|
|
43
|
+
},
|
|
44
|
+
...svgr,
|
|
60
45
|
svgo: !!svgo
|
|
61
|
-
}
|
|
46
|
+
}, { componentName: "ReactComponent" });
|
|
62
47
|
componentCode = svgrCode.replace("export default ReactComponent", "export { ReactComponent }") + "\n" + code;
|
|
63
48
|
}
|
|
64
|
-
const result = await (0, import_esbuild.transform)(componentCode,
|
|
49
|
+
const result = await (0, import_esbuild.transform)(componentCode, {
|
|
65
50
|
loader: "jsx",
|
|
66
51
|
sourcefile: id,
|
|
67
|
-
sourcemap: true
|
|
68
|
-
|
|
52
|
+
sourcemap: true,
|
|
53
|
+
...transformOptions
|
|
54
|
+
});
|
|
69
55
|
return {
|
|
70
56
|
code: result.code,
|
|
71
57
|
map: result.map || null
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/bundler-vite",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.21",
|
|
4
4
|
"description": "@umijs/bundler-vite",
|
|
5
5
|
"homepage": "https://github.com/umijs/umi/tree/master/packages/bundler-vite#readme",
|
|
6
6
|
"bugs": "https://github.com/umijs/umi/issues",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@svgr/core": "6.2.1",
|
|
29
|
-
"@umijs/bundler-utils": "4.0.
|
|
30
|
-
"@umijs/utils": "4.0.
|
|
29
|
+
"@umijs/bundler-utils": "4.0.21",
|
|
30
|
+
"@umijs/utils": "4.0.21",
|
|
31
31
|
"@vitejs/plugin-react": "1.2.0",
|
|
32
32
|
"postcss-preset-env": "7.5.0",
|
|
33
33
|
"rollup-plugin-visualizer": "5.6.0"
|