@umijs/bundler-webpack 4.0.19 → 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 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 });
@@ -68,9 +51,10 @@ async function build(opts) {
68
51
  extraBabelIncludes: opts.config.extraBabelIncludes,
69
52
  chainWebpack: opts.chainWebpack,
70
53
  modifyWebpackConfig: opts.modifyWebpackConfig,
71
- cache: opts.cache ? __spreadProps(__spreadValues({}, opts.cache), {
54
+ cache: opts.cache ? {
55
+ ...opts.cache,
72
56
  cacheDirectory: (0, import_path.join)(cacheDirectoryPath, "bundler-webpack")
73
- }) : void 0,
57
+ } : void 0,
74
58
  pkg: opts.pkg
75
59
  });
76
60
  let isFirstCompile = true;
@@ -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 });
@@ -83,7 +69,10 @@ async function addCompressPlugin(opts) {
83
69
  } else if (jsMinifier !== import_types.JSMinifier.none) {
84
70
  throw new Error(`Unsupported jsMinifier ${userConfig.jsMinifier}.`);
85
71
  }
86
- terserOptions = __spreadValues(__spreadValues({}, terserOptions), userConfig.jsMinifierOptions);
72
+ terserOptions = {
73
+ ...terserOptions,
74
+ ...userConfig.jsMinifierOptions
75
+ };
87
76
  if (jsMinifier !== import_types.JSMinifier.none) {
88
77
  config.optimization.minimizer(`js-${jsMinifier}`).use(import_terser_webpack_plugin.default, [
89
78
  {
@@ -107,7 +96,10 @@ async function addCompressPlugin(opts) {
107
96
  } else if (cssMinifier !== import_types.CSSMinifier.none) {
108
97
  throw new Error(`Unsupported cssMinifier ${userConfig.cssMinifier}.`);
109
98
  }
110
- minimizerOptions = __spreadValues(__spreadValues({}, minimizerOptions), userConfig.cssMinifierOptions);
99
+ minimizerOptions = {
100
+ ...minimizerOptions,
101
+ ...userConfig.cssMinifierOptions
102
+ };
111
103
  config.optimization.minimizer(`css-${cssMinifier}`).use(import_css_minimizer_webpack_plugin.default, [
112
104
  {
113
105
  minify: cssMinify,
@@ -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 });
@@ -174,11 +160,12 @@ async function getConfig(opts) {
174
160
  managedPaths: [nodeModulesPath, ...localLinkedNodeModules]
175
161
  });
176
162
  }
177
- config.infrastructureLogging(__spreadValues({
178
- level: "error"
179
- }, process.env.WEBPACK_FS_CACHE_DEBUG ? {
180
- debug: /webpack\.cache/
181
- } : {}));
163
+ config.infrastructureLogging({
164
+ level: "error",
165
+ ...process.env.WEBPACK_FS_CACHE_DEBUG ? {
166
+ debug: /webpack\.cache/
167
+ } : {}
168
+ });
182
169
  }
183
170
  if (opts.analyze) {
184
171
  await (0, import_bundleAnalyzerPlugin.addBundleAnalyzerPlugin)(applyOpts);
@@ -1,21 +1,7 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
17
- return a;
18
- };
19
5
  var __export = (target, all) => {
20
6
  for (var name in all)
21
7
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -57,9 +43,10 @@ function resolveDefine(opts) {
57
43
  define[key] = JSON.stringify(opts.define[key]);
58
44
  }
59
45
  }
60
- return __spreadValues({
61
- "process.env": env
62
- }, define);
46
+ return {
47
+ "process.env": env,
48
+ ...define
49
+ };
63
50
  }
64
51
  async function addDefinePlugin(opts) {
65
52
  const { config, userConfig } = opts;
@@ -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,13 +44,17 @@ var DetectDeadCodePlugin = class {
61
44
  if (!options) {
62
45
  return;
63
46
  }
64
- this.options = __spreadValues(__spreadValues({}, this.options), options);
47
+ this.options = {
48
+ ...this.options,
49
+ ...options
50
+ };
65
51
  }
66
52
  apply(compiler) {
67
53
  if (!this.options.context) {
68
- this.options = __spreadProps(__spreadValues({}, this.options), {
54
+ this.options = {
55
+ ...this.options,
69
56
  context: compiler.context
70
- });
57
+ };
71
58
  }
72
59
  compiler.hooks.afterEmit.tapAsync("DetectDeadCodePlugin", this.handleAfterEmit);
73
60
  }
@@ -56,7 +56,10 @@ async function addJavaScriptRules(opts) {
56
56
  if (p.startsWith("./")) {
57
57
  return require.resolve(p, { paths: [cwd] });
58
58
  }
59
- return (0, import_path.dirname)(import_utils.resolve.sync(`${p}/package.json`, { basedir: cwd }));
59
+ return (0, import_path.dirname)(import_utils.resolve.sync(`${p}/package.json`, {
60
+ basedir: cwd,
61
+ preserveSymlinks: false
62
+ }));
60
63
  } catch (e) {
61
64
  if (e.code === "MODULE_NOT_FOUND") {
62
65
  throw new Error("Cannot resolve extraBabelIncludes: " + p);
@@ -1,21 +1,7 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
17
- return a;
18
- };
19
5
  var __export = (target, all) => {
20
6
  for (var name in all)
21
7
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -41,9 +27,10 @@ async function addManifestPlugin(opts) {
41
27
  const { config, userConfig } = opts;
42
28
  if (userConfig.manifest) {
43
29
  config.plugin("manifest-plugin").use(import_webpack_manifest_plugin.WebpackManifestPlugin, [
44
- __spreadValues({
45
- fileName: "asset-manifest.json"
46
- }, userConfig.manifest)
30
+ {
31
+ fileName: "asset-manifest.json",
32
+ ...userConfig.manifest
33
+ }
47
34
  ]);
48
35
  }
49
36
  }
@@ -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 });
@@ -49,17 +32,18 @@ async function addNodePolyfill(opts) {
49
32
  process: nodeLibs["process"]
50
33
  }
51
34
  ]);
52
- config.resolve.fallback.merge(__spreadProps(__spreadValues({}, Object.keys(nodeLibs).reduce((memo, key) => {
53
- if (nodeLibs[key]) {
54
- memo[key] = nodeLibs[key];
55
- } else {
56
- memo[key] = false;
57
- }
58
- return memo;
59
- }, {})), {
35
+ config.resolve.fallback.merge({
36
+ ...Object.keys(nodeLibs).reduce((memo, key) => {
37
+ if (nodeLibs[key]) {
38
+ memo[key] = nodeLibs[key];
39
+ } else {
40
+ memo[key] = false;
41
+ }
42
+ return memo;
43
+ }, {}),
60
44
  http: false,
61
45
  https: false
62
- }));
46
+ });
63
47
  }
64
48
  // Annotate the CommonJS export names for ESM import in node:
65
49
  0 && (module.exports = {
@@ -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 });
@@ -47,8 +30,8 @@ async function addSVGRules(opts) {
47
30
  const { svgr, svgo = {} } = userConfig;
48
31
  if (svgr) {
49
32
  const svgrRule = config.module.rule("svgr");
50
- svgrRule.test(/\.svg$/).issuer(/\.[jt]sx?$/).type("javascript/auto").use("svgr-loader").loader(require.resolve("../loader/svgr")).options(__spreadProps(__spreadValues({
51
- svgoConfig: __spreadValues({
33
+ svgrRule.test(/\.svg$/).issuer(/\.[jt]sx?$/).type("javascript/auto").use("svgr-loader").loader(require.resolve("../loader/svgr")).options({
34
+ svgoConfig: {
52
35
  plugins: [
53
36
  {
54
37
  name: "preset-default",
@@ -59,15 +42,16 @@ async function addSVGRules(opts) {
59
42
  }
60
43
  },
61
44
  "prefixIds"
62
- ]
63
- }, svgo)
64
- }, svgr), {
45
+ ],
46
+ ...svgo
47
+ },
48
+ ...svgr,
65
49
  svgo: !!svgo
66
- })).end().use("url-loader").loader(require.resolve("@umijs/bundler-webpack/compiled/url-loader")).end();
50
+ }).end().use("url-loader").loader(require.resolve("@umijs/bundler-webpack/compiled/url-loader")).end();
67
51
  }
68
52
  if (svgo !== false) {
69
53
  const svgRule = config.module.rule("svg");
70
- svgRule.test(/\.svg$/).use("svgo-loader").loader(require.resolve("@umijs/bundler-webpack/compiled/svgo-loader")).options(__spreadValues({ configFile: false }, svgo)).end();
54
+ svgRule.test(/\.svg$/).use("svgo-loader").loader(require.resolve("@umijs/bundler-webpack/compiled/svgo-loader")).options({ configFile: false, ...svgo }).end();
71
55
  }
72
56
  }
73
57
  // Annotate the CommonJS export names for ESM import in node:
@@ -1,36 +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
- var __objRest = (source, exclude) => {
23
- var target = {};
24
- for (var prop in source)
25
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
26
- target[prop] = source[prop];
27
- if (source != null && __getOwnPropSymbols)
28
- for (var prop of __getOwnPropSymbols(source)) {
29
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
30
- target[prop] = source[prop];
31
- }
32
- return target;
33
- };
34
5
  var __export = (target, all) => {
35
6
  for (var name in all)
36
7
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -86,15 +57,17 @@ function getBaseOpts({ filename }) {
86
57
  function swcLoader(contents) {
87
58
  const callback = this.async();
88
59
  const loaderOpts = this.getOptions();
89
- const _a = loaderOpts, { sync = false, parseMap = false } = _a, otherOpts = __objRest(_a, ["sync", "parseMap"]);
60
+ const { sync = false, parseMap = false, ...otherOpts } = loaderOpts;
90
61
  const filename = this.resourcePath;
91
- const swcOpts = __spreadValues(__spreadProps(__spreadValues({}, getBaseOpts({
92
- filename
93
- })), {
62
+ const swcOpts = {
63
+ ...getBaseOpts({
64
+ filename
65
+ }),
94
66
  filename,
95
67
  sourceMaps: this.sourceMap,
96
- sourceFileName: filename
97
- }), otherOpts);
68
+ sourceFileName: filename,
69
+ ...otherOpts
70
+ };
98
71
  try {
99
72
  if (sync) {
100
73
  const output = (0, import_core.transformSync)(contents, swcOpts);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/bundler-webpack",
3
- "version": "4.0.19",
3
+ "version": "4.0.21",
4
4
  "description": "@umijs/bundler-webpack",
5
5
  "homepage": "https://github.com/umijs/umi/tree/master/packages/bundler-webpack#readme",
6
6
  "bugs": "https://github.com/umijs/umi/issues",
@@ -34,11 +34,11 @@
34
34
  "@svgr/plugin-jsx": "^6.2.1",
35
35
  "@svgr/plugin-svgo": "^6.2.0",
36
36
  "@types/hapi__joi": "17.1.8",
37
- "@umijs/babel-preset-umi": "4.0.19",
38
- "@umijs/bundler-utils": "4.0.19",
37
+ "@umijs/babel-preset-umi": "4.0.21",
38
+ "@umijs/bundler-utils": "4.0.21",
39
39
  "@umijs/case-sensitive-paths-webpack-plugin": "^1.0.1",
40
- "@umijs/mfsu": "4.0.19",
41
- "@umijs/utils": "4.0.19",
40
+ "@umijs/mfsu": "4.0.21",
41
+ "@umijs/utils": "4.0.21",
42
42
  "cors": "^2.8.5",
43
43
  "css-loader": "6.7.1",
44
44
  "es5-imcompatible-versions": "^0.1.73",