@umijs/bundler-webpack 4.0.42 → 4.0.44

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.
Files changed (84) hide show
  1. package/client/utils/formatWebpackMessages.js +27 -8
  2. package/compiled/babel-loader/index.js +8 -2
  3. package/compiled/babel-loader/package.json +1 -1
  4. package/compiled/less-loader/index.js +1 -1
  5. package/compiled/less-loader/package.json +1 -1
  6. package/compiled/mini-css-extract-plugin/hmr/hotModuleReplacement.js +22 -60
  7. package/compiled/mini-css-extract-plugin/hmr/normalize-url.js +2 -10
  8. package/compiled/mini-css-extract-plugin/index.js +492 -696
  9. package/compiled/mini-css-extract-plugin/loader.js +54 -120
  10. package/compiled/mini-css-extract-plugin/package.json +1 -1
  11. package/compiled/mini-css-extract-plugin/utils.js +27 -44
  12. package/compiled/postcss-loader/index.js +1 -1
  13. package/compiled/postcss-loader/package.json +1 -1
  14. package/compiled/sass-loader/index.js +1 -1
  15. package/compiled/sass-loader/package.json +1 -1
  16. package/compiled/sass-loader/sass.default.dart.js +4 -0
  17. package/compiled/terser/@jridgewell/gen-mapping/dist/types/gen-mapping.d.ts +90 -0
  18. package/compiled/terser/@jridgewell/gen-mapping/dist/types/sourcemap-segment.d.ts +12 -0
  19. package/compiled/terser/@jridgewell/gen-mapping/dist/types/types.d.ts +35 -0
  20. package/compiled/terser/@jridgewell/source-map/dist/types/source-map.d.ts +25 -0
  21. package/compiled/terser/@jridgewell/trace-mapping/dist/types/sourcemap-segment.d.ts +16 -0
  22. package/compiled/terser/@jridgewell/trace-mapping/dist/types/trace-mapping.d.ts +74 -0
  23. package/compiled/terser/@jridgewell/trace-mapping/dist/types/types.d.ts +92 -0
  24. package/compiled/terser/index.js +1 -1
  25. package/compiled/terser/package.json +1 -1
  26. package/compiled/terser/tools/terser.d.ts +6 -3
  27. package/compiled/terser-webpack-plugin/@jridgewell/trace-mapping/dist/types/sourcemap-segment.d.ts +16 -0
  28. package/compiled/terser-webpack-plugin/@jridgewell/trace-mapping/dist/types/trace-mapping.d.ts +74 -0
  29. package/compiled/terser-webpack-plugin/@jridgewell/trace-mapping/dist/types/types.d.ts +92 -0
  30. package/compiled/terser-webpack-plugin/index.js +1211 -3390
  31. package/compiled/terser-webpack-plugin/package.json +1 -1
  32. package/compiled/terser-webpack-plugin/types/index.d.ts +10 -10
  33. package/compiled/terser-webpack-plugin/types/utils.d.ts +10 -9
  34. package/compiled/terser-webpack-plugin/utils.js +36 -10
  35. package/compiled/webpack/package.json +1 -1
  36. package/compiled/webpack/types.d.ts +137 -126
  37. package/compiled/webpack-5-chain/index.js +1 -1
  38. package/compiled/webpack-5-chain/package.json +1 -1
  39. package/compiled/webpack-5-chain/types/index.d.ts +76 -20
  40. package/compiled/webpack-bundle-analyzer/index.js +7 -6
  41. package/compiled/webpack-bundle-analyzer/package.json +1 -1
  42. package/compiled/webpack-bundle-analyzer/public/viewer.js +2 -2
  43. package/compiled/webpack-bundle-analyzer/public/viewer.js.map +1 -1
  44. package/compiled/webpack-dev-middleware/index.js +5 -5
  45. package/compiled/webpack-dev-middleware/package.json +1 -1
  46. package/compiled/ws/LICENSE +13 -12
  47. package/compiled/ws/index.d.ts +73 -33
  48. package/compiled/ws/index.js +1 -1
  49. package/compiled/ws/package.json +1 -1
  50. package/dist/build.js +8 -2
  51. package/dist/cli.js +4 -1
  52. package/dist/config/compressPlugin.js +4 -1
  53. package/dist/config/config.js +41 -11
  54. package/dist/config/cssRules.js +17 -5
  55. package/dist/config/detectDeadCode.js +38 -8
  56. package/dist/config/detectDeadCodePlugin.js +8 -2
  57. package/dist/config/fastRefreshPlugin.js +4 -1
  58. package/dist/config/forkTSCheckerPlugin.js +4 -1
  59. package/dist/config/harmonyLinkingErrorPlugin.js +14 -11
  60. package/dist/config/javaScriptRules.js +10 -5
  61. package/dist/config/miniCSSExtractPlugin.js +4 -1
  62. package/dist/config/progressPlugin.js +9 -2
  63. package/dist/config/speedMeasureWebpackPlugin.js +7 -2
  64. package/dist/config/ssrPlugin.js +20 -6
  65. package/dist/config/svgRules.js +4 -1
  66. package/dist/dev.js +29 -10
  67. package/dist/loader/svgr.js +16 -11
  68. package/dist/loader/swc.js +26 -8
  69. package/dist/parcelCSS.js +4 -1
  70. package/dist/plugins/ProgressPlugin.js +6 -2
  71. package/dist/plugins/RuntimePublicPathPlugin.js +9 -6
  72. package/dist/plugins/_SamplePlugin.d.ts +1 -1
  73. package/dist/plugins/_SamplePlugin.js +1 -1
  74. package/dist/requireHook.js +4 -1
  75. package/dist/schema.js +58 -23
  76. package/dist/server/server.d.ts +1 -4
  77. package/dist/server/server.js +37 -23
  78. package/dist/server/ws.js +8 -3
  79. package/dist/swcPlugins/autoCSSModules.js +4 -1
  80. package/dist/swcPlugins/lockCoreJS.js +8 -2
  81. package/dist/types.d.ts +2 -1
  82. package/dist/utils/formatWebpackMessages.js +31 -9
  83. package/dist/utils/getEsBuildTarget.js +7 -1
  84. package/package.json +25 -24
@@ -50,11 +50,15 @@ var UmiProgressPlugin = class extends import_webpack.ProgressPlugin {
50
50
  hasWarnings;
51
51
  if (hasErrors) {
52
52
  errors.forEach((error) => {
53
- import_utils.logger.error(`${error.moduleName}${error.loc ? `:${error.loc}` : ""}`);
53
+ import_utils.logger.error(
54
+ `${error.moduleName}${error.loc ? `:${error.loc}` : ""}`
55
+ );
54
56
  console.log(error.message);
55
57
  });
56
58
  } else {
57
- import_utils.logger.event(`${prefix} Compiled in ${stats.endTime - stats.startTime} ms (${stats.compilation.modules.size} modules)`);
59
+ import_utils.logger.event(
60
+ `${prefix} Compiled in ${stats.endTime - stats.startTime} ms (${stats.compilation.modules.size} modules)`
61
+ );
58
62
  }
59
63
  });
60
64
  }
@@ -26,13 +26,16 @@ var PLUGIN_NAME = "RuntimePublicPath";
26
26
  var RuntimePublicPathPlugin = class {
27
27
  apply(compiler) {
28
28
  compiler.hooks.make.tap(PLUGIN_NAME, (compilation) => {
29
- compilation.hooks.runtimeModule.tap(PLUGIN_NAME, (module2) => {
30
- if (module2.constructor.name === "PublicPathRuntimeModule") {
31
- if (module2.getGeneratedCode().includes("webpack:///mini-css-extract-plugin"))
32
- return;
33
- module2._cachedGeneratedCode = `__webpack_require__.p = (typeof globalThis !== 'undefined' ? globalThis : window).publicPath || '/';`;
29
+ compilation.hooks.runtimeModule.tap(
30
+ PLUGIN_NAME,
31
+ (module2) => {
32
+ if (module2.constructor.name === "PublicPathRuntimeModule") {
33
+ if (module2.getGeneratedCode().includes("webpack:///mini-css-extract-plugin"))
34
+ return;
35
+ module2._cachedGeneratedCode = `__webpack_require__.p = (typeof globalThis !== 'undefined' ? globalThis : window).publicPath || '/';`;
36
+ }
34
37
  }
35
- });
38
+ );
36
39
  });
37
40
  }
38
41
  };
@@ -1,4 +1,4 @@
1
- import { Compiler } from '@umijs/bundler-webpack/compiled/webpack';
1
+ import type { Compiler } from '@umijs/bundler-webpack/compiled/webpack';
2
2
  interface IOpts {
3
3
  }
4
4
  declare class _SamplePlugin {
@@ -29,7 +29,7 @@ var _SamplePlugin = class {
29
29
  }
30
30
  apply(compiler) {
31
31
  compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
32
- compilation.hooks.chunkHash.tap(PLUGIN_NAME, (_) => {
32
+ compilation.hooks.chunkHash.tap(PLUGIN_NAME, () => {
33
33
  });
34
34
  });
35
35
  }
@@ -12,7 +12,10 @@ var __copyProps = (to, from, except, desc) => {
12
12
  }
13
13
  return to;
14
14
  };
15
- var __toESM = (mod2, isNodeMode, target) => (target = mod2 != null ? __create(__getProtoOf(mod2)) : {}, __copyProps(isNodeMode || !mod2 || !mod2.__esModule ? __defProp(target, "default", { value: mod2, enumerable: true }) : target, mod2));
15
+ var __toESM = (mod2, isNodeMode, target) => (target = mod2 != null ? __create(__getProtoOf(mod2)) : {}, __copyProps(
16
+ isNodeMode || !mod2 || !mod2.__esModule ? __defProp(target, "default", { value: mod2, enumerable: true }) : target,
17
+ mod2
18
+ ));
16
19
 
17
20
  // src/requireHook.ts
18
21
  var import_deepImports = __toESM(require("@umijs/bundler-webpack/compiled/webpack/deepImports.json"));
package/dist/schema.js CHANGED
@@ -50,7 +50,9 @@ var options = [
50
50
  "nosources-cheap-source-map",
51
51
  "nosources-cheap-module-source-map"
52
52
  ];
53
- var DEVTOOL_REGEX = new RegExp(`^(#@|@|#)?(${options.join("$|")})`);
53
+ var DEVTOOL_REGEX = new RegExp(
54
+ `^(#@|@|#)?(${options.join("$|")})`
55
+ );
54
56
  function getSchemas() {
55
57
  return {
56
58
  alias: (Joi) => Joi.object(),
@@ -59,21 +61,38 @@ function getSchemas() {
59
61
  babelLoaderCustomize: (Joi) => Joi.string(),
60
62
  cacheDirectoryPath: (Joi) => Joi.string(),
61
63
  chainWebpack: (Joi) => Joi.function(),
62
- copy: (Joi) => Joi.array().items(Joi.alternatives().try(Joi.object({
63
- from: Joi.string(),
64
- to: Joi.string()
65
- }), Joi.string())),
64
+ copy: (Joi) => Joi.array().items(
65
+ Joi.alternatives().try(
66
+ Joi.object({
67
+ from: Joi.string(),
68
+ to: Joi.string()
69
+ }),
70
+ Joi.string()
71
+ )
72
+ ),
66
73
  cssLoader: (Joi) => Joi.object(),
67
74
  cssLoaderModules: (Joi) => Joi.object(),
68
- cssMinifier: (Joi) => Joi.string().valid(import_types.CSSMinifier.cssnano, import_types.CSSMinifier.esbuild, import_types.CSSMinifier.parcelCSS, import_types.CSSMinifier.none),
75
+ cssMinifier: (Joi) => Joi.string().valid(
76
+ import_types.CSSMinifier.cssnano,
77
+ import_types.CSSMinifier.esbuild,
78
+ import_types.CSSMinifier.parcelCSS,
79
+ import_types.CSSMinifier.none
80
+ ),
69
81
  cssMinifierOptions: (Joi) => Joi.object(),
70
82
  deadCode: (Joi) => Joi.object(),
71
83
  define: (Joi) => Joi.object(),
72
- depTranspiler: (Joi) => Joi.string().valid(import_types.Transpiler.babel, import_types.Transpiler.esbuild, import_types.Transpiler.swc, import_types.Transpiler.none),
84
+ depTranspiler: (Joi) => Joi.string().valid(
85
+ import_types.Transpiler.babel,
86
+ import_types.Transpiler.esbuild,
87
+ import_types.Transpiler.swc,
88
+ import_types.Transpiler.none
89
+ ),
73
90
  devtool: (Joi) => Joi.alternatives().try(Joi.string().regex(DEVTOOL_REGEX), Joi.boolean()),
74
91
  esm: (Joi) => Joi.object(),
75
92
  externals: (Joi) => Joi.alternatives().try(Joi.object(), Joi.string(), Joi.func()),
76
- extraBabelIncludes: (Joi) => Joi.array().items(Joi.alternatives().try(Joi.string(), Joi.object().instance(RegExp))),
93
+ extraBabelIncludes: (Joi) => Joi.array().items(
94
+ Joi.alternatives().try(Joi.string(), Joi.object().instance(RegExp))
95
+ ),
77
96
  extraBabelPlugins: (Joi) => Joi.array().items(Joi.alternatives().try(Joi.string(), Joi.array())),
78
97
  extraBabelPresets: (Joi) => Joi.array().items(Joi.alternatives().try(Joi.string(), Joi.array())),
79
98
  extraPostCSSPlugins: (Joi) => Joi.array(),
@@ -83,7 +102,13 @@ function getSchemas() {
83
102
  https: (Joi) => Joi.object(),
84
103
  ignoreMomentLocale: (Joi) => Joi.boolean(),
85
104
  inlineLimit: (Joi) => Joi.number(),
86
- jsMinifier: (Joi) => Joi.string().valid(import_types.JSMinifier.esbuild, import_types.JSMinifier.swc, import_types.JSMinifier.terser, import_types.JSMinifier.uglifyJs, import_types.JSMinifier.none),
105
+ jsMinifier: (Joi) => Joi.string().valid(
106
+ import_types.JSMinifier.esbuild,
107
+ import_types.JSMinifier.swc,
108
+ import_types.JSMinifier.terser,
109
+ import_types.JSMinifier.uglifyJs,
110
+ import_types.JSMinifier.none
111
+ ),
87
112
  jsMinifierOptions: (Joi) => Joi.object(),
88
113
  lessLoader: (Joi) => Joi.object(),
89
114
  manifest: (Joi) => Joi.object(),
@@ -91,19 +116,24 @@ function getSchemas() {
91
116
  loader: Joi.string(),
92
117
  loaderOptions: Joi.object()
93
118
  }),
94
- mfsu: (Joi) => Joi.alternatives(Joi.object({
95
- cacheDirectory: Joi.string(),
96
- chainWebpack: Joi.function(),
97
- esbuild: Joi.boolean(),
98
- exclude: Joi.array().items(Joi.alternatives().try(Joi.string(), Joi.object().regex())),
99
- include: Joi.array().items(Joi.string()),
100
- mfName: Joi.string(),
101
- remoteAliases: Joi.array().items(Joi.string()),
102
- remoteName: Joi.string(),
103
- runtimePublicPath: Joi.boolean(),
104
- shared: Joi.object(),
105
- strategy: Joi.string().valid("eager", "normal").default("normal")
106
- }), Joi.boolean()),
119
+ mfsu: (Joi) => Joi.alternatives(
120
+ Joi.object({
121
+ cacheDirectory: Joi.string(),
122
+ chainWebpack: Joi.function(),
123
+ esbuild: Joi.boolean(),
124
+ exclude: Joi.array().items(
125
+ Joi.alternatives().try(Joi.string(), Joi.object().regex())
126
+ ),
127
+ include: Joi.array().items(Joi.string()),
128
+ mfName: Joi.string(),
129
+ remoteAliases: Joi.array().items(Joi.string()),
130
+ remoteName: Joi.string(),
131
+ runtimePublicPath: Joi.boolean(),
132
+ shared: Joi.object(),
133
+ strategy: Joi.string().valid("eager", "normal").default("normal")
134
+ }),
135
+ Joi.boolean()
136
+ ),
107
137
  outputPath: (Joi) => Joi.string(),
108
138
  postcssLoader: (Joi) => Joi.object(),
109
139
  proxy: (Joi) => Joi.alternatives().try(Joi.object(), Joi.array()),
@@ -111,7 +141,12 @@ function getSchemas() {
111
141
  purgeCSS: (Joi) => Joi.object(),
112
142
  runtimePublicPath: (Joi) => Joi.object(),
113
143
  sassLoader: (Joi) => Joi.object(),
114
- srcTranspiler: (Joi) => Joi.string().valid(import_types.Transpiler.babel, import_types.Transpiler.esbuild, import_types.Transpiler.swc, import_types.Transpiler.none),
144
+ srcTranspiler: (Joi) => Joi.string().valid(
145
+ import_types.Transpiler.babel,
146
+ import_types.Transpiler.esbuild,
147
+ import_types.Transpiler.swc,
148
+ import_types.Transpiler.none
149
+ ),
115
150
  srcTranspilerOptions: (Joi) => Joi.object({
116
151
  esbuild: Joi.object(),
117
152
  swc: Joi.object()
@@ -1,7 +1,4 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
1
  import { Configuration } from '@umijs/bundler-webpack/compiled/webpack';
4
- import http from 'http';
5
2
  import { IConfig } from '../types';
6
3
  interface IOpts {
7
4
  cwd: string;
@@ -16,5 +13,5 @@ interface IOpts {
16
13
  onProgress?: Function;
17
14
  onBeforeMiddleware?: Function;
18
15
  }
19
- export declare function createServer(opts: IOpts): Promise<http.Server | import("https").Server | null>;
16
+ export declare function createServer(opts: IOpts): Promise<any>;
20
17
  export {};
@@ -16,7 +16,10 @@ var __copyProps = (to, from, except, desc) => {
16
16
  }
17
17
  return to;
18
18
  };
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));
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
+ mod
22
+ ));
20
23
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
24
 
22
25
  // src/server/server.ts
@@ -40,18 +43,23 @@ async function createServer(opts) {
40
43
  const { proxy } = userConfig;
41
44
  const app = (0, import_express.default)();
42
45
  let ws;
43
- app.use((0, import_cors.default)({
44
- origin: true,
45
- methods: ["GET", "HEAD", "PUT", "POST", "PATCH", "DELETE", "OPTIONS"],
46
- credentials: true
47
- }));
46
+ app.use(
47
+ (0, import_cors.default)({
48
+ origin: true,
49
+ methods: ["GET", "HEAD", "PUT", "POST", "PATCH", "DELETE", "OPTIONS"],
50
+ credentials: true
51
+ })
52
+ );
48
53
  app.use(require("@umijs/bundler-webpack/compiled/compression")());
49
54
  app.use((req, res, next) => {
50
55
  const file = req.path;
51
56
  const filePath = (0, import_path.join)(opts.cwd, file);
52
57
  const ext = (0, import_path.extname)(filePath);
53
58
  if (ext === ".js" && (0, import_fs.existsSync)(filePath)) {
54
- import_utils.logger.info("[dev]", `${file} is responded with ${filePath}, remove it to use original file`);
59
+ import_utils.logger.info(
60
+ "[dev]",
61
+ `${file} is responded with ${filePath}, remove it to use original file`
62
+ );
55
63
  res.sendFile(filePath);
56
64
  } else {
57
65
  next();
@@ -71,12 +79,14 @@ async function createServer(opts) {
71
79
  details: []
72
80
  };
73
81
  progresses.push(progress);
74
- config.plugins.push(new import_webpack.default.ProgressPlugin((percent, msg, ...details) => {
75
- progress.percent = percent;
76
- progress.status = msg;
77
- progress.details = details;
78
- opts.onProgress({ progresses });
79
- }));
82
+ config.plugins.push(
83
+ new import_webpack.default.ProgressPlugin((percent, msg, ...details) => {
84
+ progress.percent = percent;
85
+ progress.status = msg;
86
+ progress.details = details;
87
+ opts.onProgress({ progresses });
88
+ })
89
+ );
80
90
  });
81
91
  }
82
92
  const compiler = (0, import_webpack.default)(configs);
@@ -144,9 +154,11 @@ async function createServer(opts) {
144
154
  (opts.afterMiddlewares || []).forEach((m) => {
145
155
  app.use(m.toString().includes(`{ compiler }`) ? m({ compiler }) : m);
146
156
  });
147
- app.use(require("@umijs/bundler-webpack/compiled/connect-history-api-fallback")({
148
- index: "/"
149
- }));
157
+ app.use(
158
+ require("@umijs/bundler-webpack/compiled/connect-history-api-fallback")({
159
+ index: "/"
160
+ })
161
+ );
150
162
  app.use("/__umi_ping", (_, res) => {
151
163
  res.end("pong");
152
164
  });
@@ -163,13 +175,15 @@ async function createServer(opts) {
163
175
  if (userConfig.https) {
164
176
  const httpsOpts = userConfig.https;
165
177
  if (!httpsOpts.hosts) {
166
- httpsOpts.hosts = import_utils.lodash.uniq([
167
- ...httpsOpts.hosts || [],
168
- "127.0.0.1",
169
- "localhost",
170
- opts.ip,
171
- opts.host !== "0.0.0.0" && opts.host
172
- ].filter(Boolean));
178
+ httpsOpts.hosts = import_utils.lodash.uniq(
179
+ [
180
+ ...httpsOpts.hosts || [],
181
+ "127.0.0.1",
182
+ "localhost",
183
+ opts.ip,
184
+ opts.host !== "0.0.0.0" && opts.host
185
+ ].filter(Boolean)
186
+ );
173
187
  }
174
188
  server = await (0, import_bundler_utils.createHttpsServer)(app, httpsOpts);
175
189
  } else {
package/dist/server/ws.js CHANGED
@@ -16,7 +16,10 @@ var __copyProps = (to, from, except, desc) => {
16
16
  }
17
17
  return to;
18
18
  };
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));
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
+ mod
22
+ ));
20
23
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
24
 
22
25
  // src/server/ws.ts
@@ -43,8 +46,10 @@ function createWebSocketServer(server) {
43
46
  });
44
47
  wss.on("error", (e) => {
45
48
  if (e.code !== "EADDRINUSE") {
46
- console.error(import_utils.chalk.red(`WebSocket server error:
47
- ${e.stack || e.message}`));
49
+ console.error(
50
+ import_utils.chalk.red(`WebSocket server error:
51
+ ${e.stack || e.message}`)
52
+ );
48
53
  }
49
54
  });
50
55
  return {
@@ -16,7 +16,10 @@ var __copyProps = (to, from, except, desc) => {
16
16
  }
17
17
  return to;
18
18
  };
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));
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
+ mod
22
+ ));
20
23
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
24
 
22
25
  // src/swcPlugins/autoCSSModules.ts
@@ -16,7 +16,10 @@ var __copyProps = (to, from, except, desc) => {
16
16
  }
17
17
  return to;
18
18
  };
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));
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
+ mod
22
+ ));
20
23
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
24
 
22
25
  // src/swcPlugins/lockCoreJS.ts
@@ -37,7 +40,10 @@ var LockCoreJS = class extends import_Visitor.default {
37
40
  const { source } = expression;
38
41
  let { value, type } = source;
39
42
  if (type === "StringLiteral" && value.startsWith("core-js/")) {
40
- const newValue = value.replace(/^core-js\//, addLastSlash((0, import_utils.winPath)((0, import_path.dirname)(require.resolve("core-js/package.json")))));
43
+ const newValue = value.replace(
44
+ /^core-js\//,
45
+ addLastSlash((0, import_utils.winPath)((0, import_path.dirname)(require.resolve("core-js/package.json"))))
46
+ );
41
47
  (0, import_changeImportFromString.changeImportFromString)(expression, newValue);
42
48
  }
43
49
  return expression;
package/dist/types.d.ts CHANGED
@@ -3,6 +3,7 @@ import type { HttpsServerOptions, ProxyOptions } from '@umijs/bundler-utils';
3
3
  import webpack, { Configuration } from '../compiled/webpack';
4
4
  import Config from '../compiled/webpack-5-chain';
5
5
  import type { TransformOptions as EsbuildOptions } from '@umijs/bundler-utils/compiled/esbuild';
6
+ import type { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
6
7
  export declare enum Env {
7
8
  development = "development",
8
9
  production = "production"
@@ -119,7 +120,7 @@ export interface IConfig {
119
120
  };
120
121
  writeToDisk?: boolean;
121
122
  babelLoaderCustomize?: string;
122
- analyze?: Record<string, any>;
123
+ analyze?: BundleAnalyzerPlugin.Options;
123
124
  [key: string]: any;
124
125
  }
125
126
  export interface ISrcTranspilerOpts {
@@ -16,7 +16,10 @@ var __copyProps = (to, from, except, desc) => {
16
16
  }
17
17
  return to;
18
18
  };
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));
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
+ mod
22
+ ));
20
23
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
24
 
22
25
  // src/utils/formatWebpackMessages.ts
@@ -46,7 +49,9 @@ function formatMessage(message) {
46
49
  }
47
50
  lines = lines.filter((line) => !/Module [A-z ]+\(from/.test(line));
48
51
  lines = lines.map((line) => {
49
- const parsingError = /Line (\d+):(?:(\d+):)?\s*Parsing error: (.+)$/.exec(line);
52
+ const parsingError = /Line (\d+):(?:(\d+):)?\s*Parsing error: (.+)$/.exec(
53
+ line
54
+ );
50
55
  if (!parsingError) {
51
56
  return line;
52
57
  }
@@ -54,11 +59,23 @@ function formatMessage(message) {
54
59
  return `${friendlySyntaxErrorLabel} ${errorMessage} (${errorLine}:${errorColumn})`;
55
60
  });
56
61
  message = lines.join("\n");
57
- message = message.replace(/SyntaxError\s+\((\d+):(\d+)\)\s*(.+?)\n/g, `${friendlySyntaxErrorLabel} $3 ($1:$2)
58
- `);
59
- message = message.replace(/^.*export '(.+?)' was not found in '(.+?)'.*$/gm, `Attempted import error: '$1' is not exported from '$2'.`);
60
- message = message.replace(/^.*export 'default' \(imported as '(.+?)'\) was not found in '(.+?)'.*$/gm, `Attempted import error: '$2' does not contain a default export (imported as '$1').`);
61
- message = message.replace(/^.*export '(.+?)' \(imported as '(.+?)'\) was not found in '(.+?)'.*$/gm, `Attempted import error: '$1' is not exported from '$3' (imported as '$2').`);
62
+ message = message.replace(
63
+ /SyntaxError\s+\((\d+):(\d+)\)\s*(.+?)\n/g,
64
+ `${friendlySyntaxErrorLabel} $3 ($1:$2)
65
+ `
66
+ );
67
+ message = message.replace(
68
+ /^.*export '(.+?)' was not found in '(.+?)'.*$/gm,
69
+ `Attempted import error: '$1' is not exported from '$2'.`
70
+ );
71
+ message = message.replace(
72
+ /^.*export 'default' \(imported as '(.+?)'\) was not found in '(.+?)'.*$/gm,
73
+ `Attempted import error: '$2' does not contain a default export (imported as '$1').`
74
+ );
75
+ message = message.replace(
76
+ /^.*export '(.+?)' \(imported as '(.+?)'\) was not found in '(.+?)'.*$/gm,
77
+ `Attempted import error: '$1' is not exported from '$3' (imported as '$2').`
78
+ );
62
79
  lines = message.split("\n");
63
80
  if (lines.length > 2 && lines[1].trim() === "") {
64
81
  lines.splice(1, 1);
@@ -75,10 +92,15 @@ function formatMessage(message) {
75
92
  lines[1] += "Run `npm install sass` or `yarn add sass` inside your workspace.";
76
93
  }
77
94
  message = lines.join("\n");
78
- message = message.replace(/^\s*at\s((?!webpack:).)*:\d+:\d+[\s)]*(\n|$)/gm, "");
95
+ message = message.replace(
96
+ /^\s*at\s((?!webpack:).)*:\d+:\d+[\s)]*(\n|$)/gm,
97
+ ""
98
+ );
79
99
  message = message.replace(/^\s*at\s<anonymous>(\n|$)/gm, "");
80
100
  lines = message.split("\n");
81
- lines = lines.filter((line, index, arr) => index === 0 || line.trim() !== "" || line.trim() !== arr[index - 1].trim());
101
+ lines = lines.filter(
102
+ (line, index, arr) => index === 0 || line.trim() !== "" || line.trim() !== arr[index - 1].trim()
103
+ );
82
104
  message = lines.join("\n");
83
105
  return message.trim();
84
106
  }
@@ -27,7 +27,13 @@ var import_constants = require("../constants");
27
27
  var import_types = require("../types");
28
28
  function getEsBuildTarget({ targets, jsMinifier }) {
29
29
  if (targets["ie"] && jsMinifier === import_types.JSMinifier.esbuild) {
30
- import_utils.logger.error(`${import_utils.chalk.red(`jsMinifier: esbuild`)} is not supported when there is ie in the targets, you can use ${import_utils.chalk.green(`jsMinifier: 'terser'`)}`);
30
+ import_utils.logger.error(
31
+ `${import_utils.chalk.red(
32
+ `jsMinifier: esbuild`
33
+ )} is not supported when there is ie in the targets, you can use ${import_utils.chalk.green(
34
+ `jsMinifier: 'terser'`
35
+ )}`
36
+ );
31
37
  throw new Error("IE is not supported");
32
38
  }
33
39
  return Object.keys(targets).filter((key) => import_constants.DEFAULT_ESBUILD_TARGET_KEYS.includes(key)).map((key) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/bundler-webpack",
3
- "version": "4.0.42",
3
+ "version": "4.0.44",
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",
@@ -33,57 +33,58 @@
33
33
  "@svgr/core": "6.2.1",
34
34
  "@svgr/plugin-jsx": "^6.2.1",
35
35
  "@svgr/plugin-svgo": "^6.2.0",
36
- "@types/hapi__joi": "17.1.8",
37
- "@umijs/babel-preset-umi": "4.0.42",
38
- "@umijs/bundler-utils": "4.0.42",
36
+ "@types/hapi__joi": "17.1.9",
37
+ "@umijs/babel-preset-umi": "4.0.44",
38
+ "@umijs/bundler-utils": "4.0.44",
39
39
  "@umijs/case-sensitive-paths-webpack-plugin": "^1.0.1",
40
- "@umijs/mfsu": "4.0.42",
41
- "@umijs/utils": "4.0.42",
40
+ "@umijs/mfsu": "4.0.44",
41
+ "@umijs/utils": "4.0.44",
42
42
  "cors": "^2.8.5",
43
43
  "css-loader": "6.7.1",
44
44
  "es5-imcompatible-versions": "^0.1.73",
45
- "fork-ts-checker-webpack-plugin": "7.2.4",
46
- "jest-worker": "27.5.1",
45
+ "fork-ts-checker-webpack-plugin": "7.3.0",
46
+ "jest-worker": "29.3.1",
47
47
  "node-libs-browser": "2.2.1",
48
- "postcss": "^8.4.13",
48
+ "postcss": "^8.4.21",
49
49
  "postcss-preset-env": "7.5.0",
50
- "react-error-overlay": "6.0.9",
50
+ "react-error-overlay": "6.0.11",
51
51
  "react-refresh": "0.14.0"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@swc/core": "1.3.24",
55
- "@types/cors": "^2.8.12",
55
+ "@types/cors": "^2.8.13",
56
+ "@types/webpack-bundle-analyzer": "^4.6.0",
56
57
  "@types/webpack-sources": "3.2.0",
57
- "@types/ws": "8.5.3",
58
+ "@types/ws": "8.5.4",
58
59
  "autoprefixer": "10.4.13",
59
- "babel-loader": "8.2.4",
60
+ "babel-loader": "9.1.2",
60
61
  "compression": "1.7.4",
61
62
  "connect-history-api-fallback": "1.6.0",
62
63
  "copy-webpack-plugin": "10.2.4",
63
64
  "css-minimizer-webpack-plugin": "4.0.0",
64
65
  "cssnano": "5.1.7",
65
- "less-loader": "10.2.0",
66
- "mini-css-extract-plugin": "2.6.0",
66
+ "less-loader": "11.1.0",
67
+ "mini-css-extract-plugin": "2.7.2",
67
68
  "postcss-flexbugs-fixes": "5.0.2",
68
- "postcss-loader": "6.2.1",
69
+ "postcss-loader": "7.0.2",
69
70
  "purgecss-webpack-plugin": "4.1.3",
70
- "sass-loader": "12.6.0",
71
+ "sass-loader": "13.2.0",
71
72
  "schema-utils": "4.0.0",
72
73
  "speed-measure-webpack-plugin": "1.5.0",
73
74
  "style-loader": "3.3.1",
74
75
  "svgo-loader": "3.0.0",
75
76
  "swc-plugin-auto-css-modules": "1.3.0",
76
- "terser": "5.12.1",
77
- "terser-webpack-plugin": "5.3.1",
77
+ "terser": "5.16.1",
78
+ "terser-webpack-plugin": "5.3.6",
78
79
  "url-loader": "4.1.1",
79
- "webpack": "5.72.1",
80
- "webpack-5-chain": "8.0.0",
81
- "webpack-bundle-analyzer": "4.5.0",
82
- "webpack-dev-middleware": "5.3.3",
80
+ "webpack": "5.75.0",
81
+ "webpack-5-chain": "8.0.1",
82
+ "webpack-bundle-analyzer": "4.7.0",
83
+ "webpack-dev-middleware": "6.0.1",
83
84
  "webpack-manifest-plugin": "5.0.0",
84
85
  "webpack-sources": "3.2.3",
85
86
  "webpackbar": "5.0.2",
86
- "ws": "8.5.0"
87
+ "ws": "8.12.0"
87
88
  },
88
89
  "publishConfig": {
89
90
  "access": "public"