@umijs/bundler-webpack 4.0.41 → 4.0.43

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 (94) hide show
  1. package/client/utils/formatWebpackMessages.js +27 -8
  2. package/compiled/autoprefixer/browserslist/index.d.ts +21 -1
  3. package/compiled/autoprefixer/index.js +2 -2
  4. package/compiled/autoprefixer/package.json +1 -1
  5. package/compiled/autoprefixer/postcss/lib/processor.d.ts +1 -1
  6. package/compiled/babel-loader/index.js +8 -2
  7. package/compiled/babel-loader/package.json +1 -1
  8. package/compiled/less-loader/index.js +1 -1
  9. package/compiled/less-loader/package.json +1 -1
  10. package/compiled/mini-css-extract-plugin/hmr/hotModuleReplacement.js +22 -60
  11. package/compiled/mini-css-extract-plugin/hmr/normalize-url.js +2 -10
  12. package/compiled/mini-css-extract-plugin/index.js +492 -696
  13. package/compiled/mini-css-extract-plugin/loader.js +54 -120
  14. package/compiled/mini-css-extract-plugin/package.json +1 -1
  15. package/compiled/mini-css-extract-plugin/utils.js +27 -44
  16. package/compiled/postcss-loader/index.js +1 -1
  17. package/compiled/postcss-loader/package.json +1 -1
  18. package/compiled/sass-loader/index.js +1 -1
  19. package/compiled/sass-loader/package.json +1 -1
  20. package/compiled/sass-loader/sass.default.dart.js +4 -0
  21. package/compiled/terser/@jridgewell/gen-mapping/dist/types/gen-mapping.d.ts +90 -0
  22. package/compiled/terser/@jridgewell/gen-mapping/dist/types/sourcemap-segment.d.ts +12 -0
  23. package/compiled/terser/@jridgewell/gen-mapping/dist/types/types.d.ts +35 -0
  24. package/compiled/terser/@jridgewell/source-map/dist/types/source-map.d.ts +25 -0
  25. package/compiled/terser/@jridgewell/trace-mapping/dist/types/sourcemap-segment.d.ts +16 -0
  26. package/compiled/terser/@jridgewell/trace-mapping/dist/types/trace-mapping.d.ts +74 -0
  27. package/compiled/terser/@jridgewell/trace-mapping/dist/types/types.d.ts +92 -0
  28. package/compiled/terser/index.js +1 -1
  29. package/compiled/terser/package.json +1 -1
  30. package/compiled/terser/tools/terser.d.ts +6 -3
  31. package/compiled/terser-webpack-plugin/@jridgewell/trace-mapping/dist/types/sourcemap-segment.d.ts +16 -0
  32. package/compiled/terser-webpack-plugin/@jridgewell/trace-mapping/dist/types/trace-mapping.d.ts +74 -0
  33. package/compiled/terser-webpack-plugin/@jridgewell/trace-mapping/dist/types/types.d.ts +92 -0
  34. package/compiled/terser-webpack-plugin/index.js +1211 -3390
  35. package/compiled/terser-webpack-plugin/package.json +1 -1
  36. package/compiled/terser-webpack-plugin/types/index.d.ts +10 -10
  37. package/compiled/terser-webpack-plugin/types/utils.d.ts +10 -9
  38. package/compiled/terser-webpack-plugin/utils.js +36 -10
  39. package/compiled/webpack/package.json +1 -1
  40. package/compiled/webpack/types.d.ts +137 -126
  41. package/compiled/webpack-5-chain/index.js +1 -1
  42. package/compiled/webpack-5-chain/package.json +1 -1
  43. package/compiled/webpack-5-chain/types/index.d.ts +76 -20
  44. package/compiled/webpack-bundle-analyzer/index.js +7 -6
  45. package/compiled/webpack-bundle-analyzer/package.json +1 -1
  46. package/compiled/webpack-bundle-analyzer/public/viewer.js +2 -2
  47. package/compiled/webpack-bundle-analyzer/public/viewer.js.map +1 -1
  48. package/compiled/webpack-dev-middleware/index.js +5 -5
  49. package/compiled/webpack-dev-middleware/package.json +1 -1
  50. package/compiled/webpackbar/LICENSE +20 -0
  51. package/compiled/webpackbar/dist/index.d.ts +121 -0
  52. package/compiled/webpackbar/index.js +7 -0
  53. package/compiled/webpackbar/package.json +1 -0
  54. package/compiled/ws/LICENSE +13 -12
  55. package/compiled/ws/index.d.ts +73 -33
  56. package/compiled/ws/index.js +1 -1
  57. package/compiled/ws/package.json +1 -1
  58. package/dist/build.js +8 -2
  59. package/dist/cli.js +4 -1
  60. package/dist/config/compressPlugin.js +4 -1
  61. package/dist/config/config.js +41 -11
  62. package/dist/config/cssRules.js +17 -5
  63. package/dist/config/detectDeadCode.js +38 -8
  64. package/dist/config/detectDeadCodePlugin.js +8 -2
  65. package/dist/config/fastRefreshPlugin.js +4 -1
  66. package/dist/config/forkTSCheckerPlugin.js +4 -1
  67. package/dist/config/harmonyLinkingErrorPlugin.js +14 -11
  68. package/dist/config/javaScriptRules.js +21 -9
  69. package/dist/config/miniCSSExtractPlugin.js +4 -1
  70. package/dist/config/progressPlugin.js +16 -7
  71. package/dist/config/speedMeasureWebpackPlugin.js +7 -2
  72. package/dist/config/ssrPlugin.js +20 -6
  73. package/dist/config/svgRules.js +4 -1
  74. package/dist/dev.js +29 -13
  75. package/dist/loader/svgr.js +16 -11
  76. package/dist/loader/swc.d.ts +2 -2
  77. package/dist/loader/swc.js +66 -10
  78. package/dist/parcelCSS.js +4 -1
  79. package/dist/plugins/ProgressPlugin.js +6 -2
  80. package/dist/plugins/RuntimePublicPathPlugin.js +9 -6
  81. package/dist/plugins/_SamplePlugin.d.ts +1 -1
  82. package/dist/plugins/_SamplePlugin.js +1 -1
  83. package/dist/requireHook.js +4 -1
  84. package/dist/schema.js +62 -23
  85. package/dist/server/server.d.ts +1 -4
  86. package/dist/server/server.js +37 -23
  87. package/dist/server/ws.js +8 -3
  88. package/dist/swcPlugins/autoCSSModules.d.ts +5 -1
  89. package/dist/swcPlugins/autoCSSModules.js +4 -1
  90. package/dist/swcPlugins/lockCoreJS.js +8 -2
  91. package/dist/types.d.ts +15 -3
  92. package/dist/utils/formatWebpackMessages.js +31 -9
  93. package/dist/utils/getEsBuildTarget.js +7 -1
  94. package/package.json +30 -26
@@ -19,7 +19,9 @@ function formatMessage(message) {
19
19
  }
20
20
  lines = lines.filter((line) => !/Module [A-z ]+\(from/.test(line));
21
21
  lines = lines.map((line) => {
22
- const parsingError = /Line (\d+):(?:(\d+):)?\s*Parsing error: (.+)$/.exec(line);
22
+ const parsingError = /Line (\d+):(?:(\d+):)?\s*Parsing error: (.+)$/.exec(
23
+ line
24
+ );
23
25
  if (!parsingError) {
24
26
  return line;
25
27
  }
@@ -27,11 +29,23 @@ function formatMessage(message) {
27
29
  return `${friendlySyntaxErrorLabel} ${errorMessage} (${errorLine}:${errorColumn})`;
28
30
  });
29
31
  message = lines.join("\n");
30
- message = message.replace(/SyntaxError\s+\((\d+):(\d+)\)\s*(.+?)\n/g, `${friendlySyntaxErrorLabel} $3 ($1:$2)
31
- `);
32
- message = message.replace(/^.*export '(.+?)' was not found in '(.+?)'.*$/gm, `Attempted import error: '$1' is not exported from '$2'.`);
33
- 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').`);
34
- message = message.replace(/^.*export '(.+?)' \(imported as '(.+?)'\) was not found in '(.+?)'.*$/gm, `Attempted import error: '$1' is not exported from '$3' (imported as '$2').`);
32
+ message = message.replace(
33
+ /SyntaxError\s+\((\d+):(\d+)\)\s*(.+?)\n/g,
34
+ `${friendlySyntaxErrorLabel} $3 ($1:$2)
35
+ `
36
+ );
37
+ message = message.replace(
38
+ /^.*export '(.+?)' was not found in '(.+?)'.*$/gm,
39
+ `Attempted import error: '$1' is not exported from '$2'.`
40
+ );
41
+ message = message.replace(
42
+ /^.*export 'default' \(imported as '(.+?)'\) was not found in '(.+?)'.*$/gm,
43
+ `Attempted import error: '$2' does not contain a default export (imported as '$1').`
44
+ );
45
+ message = message.replace(
46
+ /^.*export '(.+?)' \(imported as '(.+?)'\) was not found in '(.+?)'.*$/gm,
47
+ `Attempted import error: '$1' is not exported from '$3' (imported as '$2').`
48
+ );
35
49
  lines = message.split("\n");
36
50
  if (lines.length > 2 && lines[1].trim() === "") {
37
51
  lines.splice(1, 1);
@@ -48,10 +62,15 @@ function formatMessage(message) {
48
62
  lines[1] += "Run `npm install sass` or `yarn add sass` inside your workspace.";
49
63
  }
50
64
  message = lines.join("\n");
51
- message = message.replace(/^\s*at\s((?!webpack:).)*:\d+:\d+[\s)]*(\n|$)/gm, "");
65
+ message = message.replace(
66
+ /^\s*at\s((?!webpack:).)*:\d+:\d+[\s)]*(\n|$)/gm,
67
+ ""
68
+ );
52
69
  message = message.replace(/^\s*at\s<anonymous>(\n|$)/gm, "");
53
70
  lines = message.split("\n");
54
- lines = lines.filter((line, index, arr) => index === 0 || line.trim() !== "" || line.trim() !== arr[index - 1].trim());
71
+ lines = lines.filter(
72
+ (line, index, arr) => index === 0 || line.trim() !== "" || line.trim() !== arr[index - 1].trim()
73
+ );
55
74
  message = lines.join("\n");
56
75
  return message.trim();
57
76
  }
@@ -6,6 +6,7 @@
6
6
  * ```
7
7
  *
8
8
  * @param queries Browser queries.
9
+ * @param opts Options.
9
10
  * @returns Array with browser names in Can I Use.
10
11
  */
11
12
  declare function browserslist(
@@ -14,6 +15,13 @@ declare function browserslist(
14
15
  ): string[]
15
16
 
16
17
  declare namespace browserslist {
18
+ interface Query {
19
+ compose: 'or' | 'and'
20
+ type: string
21
+ query: string
22
+ not?: true
23
+ }
24
+
17
25
  interface Options {
18
26
  /**
19
27
  * Path to processed file. It will be used to find config files.
@@ -37,7 +45,7 @@ declare namespace browserslist {
37
45
  */
38
46
  ignoreUnknownVersions?: boolean
39
47
  /**
40
- * Throw a error if env is not found.
48
+ * Throw an error if env is not found.
41
49
  */
42
50
  throwOnMissing?: boolean
43
51
  /**
@@ -144,6 +152,18 @@ declare namespace browserslist {
144
152
  */
145
153
  function coverage(browsers: readonly string[], stats?: StatsOptions): number
146
154
 
155
+ /**
156
+ * Get queries AST to analyze the config content.
157
+ *
158
+ * @param queries Browser queries.
159
+ * @param opts Options.
160
+ * @returns An array of the data of each query in the config.
161
+ */
162
+ function parse(
163
+ queries?: string | readonly string[] | null,
164
+ opts?: browserslist.Options
165
+ ): Query[]
166
+
147
167
  function clearCaches(): void
148
168
 
149
169
  function parseConfig(string: string): Config