@umijs/bundler-webpack 4.0.0-beta.7 → 4.0.0-canary.202200505.1

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 (197) hide show
  1. package/client/client/client.js +65 -37
  2. package/client/constants.js +9 -0
  3. package/compiled/autoprefixer/browserslist/index.d.ts +13 -7
  4. package/compiled/autoprefixer/index.js +3 -3
  5. package/compiled/autoprefixer/postcss/lib/at-rule.d.ts +1 -1
  6. package/compiled/autoprefixer/postcss/lib/comment.d.ts +1 -1
  7. package/compiled/autoprefixer/postcss/lib/container.d.ts +2 -2
  8. package/compiled/autoprefixer/postcss/lib/css-syntax-error.d.ts +55 -8
  9. package/compiled/autoprefixer/postcss/lib/declaration.d.ts +2 -2
  10. package/compiled/autoprefixer/postcss/lib/input.d.ts +26 -6
  11. package/compiled/autoprefixer/postcss/lib/lazy-result.d.ts +11 -10
  12. package/compiled/autoprefixer/postcss/lib/no-work-result.d.ts +37 -0
  13. package/compiled/autoprefixer/postcss/lib/node.d.ts +38 -4
  14. package/compiled/autoprefixer/postcss/lib/postcss.d.ts +31 -30
  15. package/compiled/autoprefixer/postcss/lib/processor.d.ts +5 -4
  16. package/compiled/autoprefixer/postcss/lib/result.d.ts +3 -2
  17. package/compiled/autoprefixer/postcss/lib/rule.d.ts +1 -1
  18. package/compiled/autoprefixer/postcss/lib/warning.d.ts +37 -3
  19. package/compiled/autoprefixer/source-map-js/source-map.d.ts +99 -82
  20. package/compiled/babel-loader/index.js +2 -2
  21. package/compiled/copy-webpack-plugin/939.index.js +1171 -0
  22. package/compiled/copy-webpack-plugin/index.js +16 -10
  23. package/compiled/copy-webpack-plugin/package.json +1 -1
  24. package/compiled/css-minimizer-webpack-plugin/index.js +8 -2
  25. package/compiled/css-minimizer-webpack-plugin/minify.js +25 -11
  26. package/compiled/css-minimizer-webpack-plugin/package.json +1 -1
  27. package/compiled/css-minimizer-webpack-plugin/utils.js +225 -28
  28. package/compiled/cssnano/index.js +12 -11
  29. package/compiled/cssnano/package.json +1 -1
  30. package/compiled/express.d.ts +2 -0
  31. package/compiled/fork-ts-checker-webpack-plugin/LICENSE +21 -0
  32. package/compiled/fork-ts-checker-webpack-plugin/fsevents.node +0 -0
  33. package/compiled/fork-ts-checker-webpack-plugin/index.js +42 -0
  34. package/compiled/fork-ts-checker-webpack-plugin/package.json +1 -0
  35. package/compiled/http-proxy-middleware/dist/types.d.ts +5 -5
  36. package/compiled/http-proxy-middleware/http-proxy/index.d.ts +1 -1
  37. package/compiled/http-proxy-middleware/index.js +10 -10
  38. package/compiled/mini-css-extract-plugin/hmr/hotModuleReplacement.js +60 -8
  39. package/compiled/mini-css-extract-plugin/hmr/normalize-url.js +13 -1
  40. package/compiled/mini-css-extract-plugin/index.js +7970 -7445
  41. package/compiled/mini-css-extract-plugin/loader.js +179 -54
  42. package/compiled/mini-css-extract-plugin/package.json +1 -1
  43. package/compiled/mini-css-extract-plugin/utils.js +85 -24
  44. package/compiled/postcss-loader/index.js +1 -1
  45. package/compiled/react-refresh/LICENSE +21 -0
  46. package/compiled/react-refresh/index.js +9 -7
  47. package/compiled/react-refresh/package.json +1 -0
  48. package/compiled/sass-loader/index.js +1 -1
  49. package/compiled/schema-utils/ajv/dist/ajv.d.ts +16 -0
  50. package/compiled/schema-utils/ajv/dist/compile/codegen/code.d.ts +39 -0
  51. package/compiled/schema-utils/ajv/dist/compile/codegen/index.d.ts +79 -0
  52. package/compiled/schema-utils/ajv/dist/compile/codegen/scope.d.ts +79 -0
  53. package/compiled/schema-utils/ajv/dist/compile/errors.d.ts +13 -0
  54. package/compiled/schema-utils/ajv/dist/compile/index.d.ts +80 -0
  55. package/compiled/schema-utils/ajv/dist/compile/ref_error.d.ts +5 -0
  56. package/compiled/schema-utils/ajv/dist/compile/resolve.d.ts +12 -0
  57. package/compiled/schema-utils/ajv/dist/compile/rules.d.ts +28 -0
  58. package/compiled/schema-utils/ajv/dist/compile/util.d.ts +40 -0
  59. package/compiled/schema-utils/ajv/dist/compile/validate/index.d.ts +42 -0
  60. package/compiled/schema-utils/ajv/dist/compile/validate/subschema.d.ts +47 -0
  61. package/compiled/schema-utils/ajv/dist/core.d.ts +171 -0
  62. package/compiled/schema-utils/ajv/dist/runtime/validation_error.d.ts +7 -0
  63. package/compiled/schema-utils/ajv/dist/types/index.d.ts +177 -0
  64. package/compiled/schema-utils/ajv/dist/types/json-schema.d.ts +124 -0
  65. package/compiled/schema-utils/ajv/dist/types/jtd-schema.d.ts +168 -0
  66. package/compiled/schema-utils/declarations/validate.d.ts +4 -4
  67. package/compiled/schema-utils/index.js +8 -2
  68. package/compiled/schema-utils/uri-js/dist/es5/uri.all.d.ts +59 -0
  69. package/compiled/style-loader/index.js +1 -1
  70. package/compiled/terser/index.js +1 -1
  71. package/compiled/terser-webpack-plugin/index.js +393 -517
  72. package/compiled/terser-webpack-plugin/jest-worker/build/types.d.ts +1 -0
  73. package/compiled/terser-webpack-plugin/minify.js +10 -3
  74. package/compiled/terser-webpack-plugin/package.json +1 -1
  75. package/compiled/terser-webpack-plugin/types/index.d.ts +183 -149
  76. package/compiled/terser-webpack-plugin/types/minify.d.ts +17 -0
  77. package/compiled/terser-webpack-plugin/types/utils.d.ts +10 -15
  78. package/compiled/terser-webpack-plugin/utils.js +118 -25
  79. package/compiled/webpack/BasicEffectRulePlugin.js +1 -0
  80. package/compiled/webpack/BasicMatcherRulePlugin.js +1 -0
  81. package/compiled/webpack/HotModuleReplacement.runtime.js +29 -14
  82. package/compiled/webpack/JavascriptHotModuleReplacement.runtime.js +4 -3
  83. package/compiled/webpack/ObjectMatcherRulePlugin.js +1 -0
  84. package/compiled/webpack/RuleSetCompiler.js +1 -0
  85. package/compiled/webpack/UseEffectRulePlugin.js +1 -0
  86. package/compiled/webpack/deepImports.json +6 -1
  87. package/compiled/webpack/index.js +13409 -5746
  88. package/compiled/webpack/types.d.ts +606 -171
  89. package/compiled/webpack-dev-middleware/index.js +11 -5
  90. package/compiled/webpack-dev-middleware/package.json +1 -1
  91. package/compiled/{tapable → webpack-manifest-plugin}/LICENSE +2 -2
  92. package/compiled/webpack-manifest-plugin/index.js +1 -0
  93. package/compiled/webpack-manifest-plugin/package.json +1 -0
  94. package/compiled/webpack-sources/index.js +1 -1
  95. package/compiled/ws/index.d.ts +1 -2
  96. package/compiled/ws/index.js +1 -1
  97. package/dist/build.d.ts +6 -3
  98. package/dist/build.js +48 -56
  99. package/dist/cli.js +10 -22
  100. package/dist/client/client.js +57 -51
  101. package/dist/config/_sampleFeature.js +6 -17
  102. package/dist/config/assetRules.js +44 -51
  103. package/dist/config/bundleAnalyzerPlugin.js +12 -23
  104. package/dist/config/compressPlugin.js +70 -64
  105. package/dist/config/config.d.ts +9 -2
  106. package/dist/config/config.js +184 -144
  107. package/dist/config/copyPlugin.js +29 -40
  108. package/dist/config/cssRules.js +93 -83
  109. package/dist/config/definePlugin.js +11 -19
  110. package/dist/config/detectDeadCode.d.ts +12 -0
  111. package/dist/config/detectDeadCode.js +120 -0
  112. package/dist/config/detectDeadCodePlugin.d.ts +9 -0
  113. package/dist/config/detectDeadCodePlugin.js +70 -0
  114. package/dist/config/fastRefreshPlugin.js +11 -22
  115. package/dist/config/forkTSCheckerPlugin.d.ts +11 -0
  116. package/dist/config/forkTSCheckerPlugin.js +23 -0
  117. package/dist/config/harmonyLinkingErrorPlugin.d.ts +6 -0
  118. package/dist/config/harmonyLinkingErrorPlugin.js +31 -0
  119. package/dist/config/ignorePlugin.js +10 -21
  120. package/dist/config/javaScriptRules.d.ts +2 -0
  121. package/dist/config/javaScriptRules.js +153 -131
  122. package/dist/config/manifestPlugin.d.ts +11 -0
  123. package/dist/config/manifestPlugin.js +17 -0
  124. package/dist/config/miniCSSExtractPlugin.d.ts +1 -0
  125. package/dist/config/miniCSSExtractPlugin.js +12 -24
  126. package/dist/config/nodePolyfill.js +14 -20
  127. package/dist/config/nodePrefixPlugin.d.ts +11 -0
  128. package/dist/config/nodePrefixPlugin.js +14 -0
  129. package/dist/config/progressPlugin.js +7 -18
  130. package/dist/config/purgecssWebpackPlugin.js +15 -26
  131. package/dist/config/speedMeasureWebpackPlugin.js +12 -23
  132. package/dist/config/svgRules.d.ts +1 -0
  133. package/dist/config/svgRules.js +45 -48
  134. package/dist/constants.d.ts +4 -0
  135. package/dist/constants.js +10 -1
  136. package/dist/dev.d.ts +8 -2
  137. package/dist/dev.js +117 -66
  138. package/dist/index.d.ts +4 -1
  139. package/dist/index.js +5 -1
  140. package/dist/loader/svgr.d.ts +4 -0
  141. package/dist/loader/svgr.js +58 -0
  142. package/dist/loader/swc.d.ts +4 -0
  143. package/dist/loader/swc.js +74 -0
  144. package/dist/plugins/ESBuildCSSMinifyPlugin.js +23 -36
  145. package/dist/plugins/ParcelCSSMinifyPlugin.d.ts +10 -0
  146. package/dist/plugins/ParcelCSSMinifyPlugin.js +73 -0
  147. package/dist/plugins/ProgressPlugin.js +2 -2
  148. package/dist/plugins/RuntimePublicPathPlugin.d.ts +4 -0
  149. package/dist/plugins/RuntimePublicPathPlugin.js +20 -0
  150. package/dist/requireHook.js +1 -1
  151. package/dist/schema.js +23 -11
  152. package/dist/server/server.d.ts +2 -1
  153. package/dist/server/server.js +165 -130
  154. package/dist/server/ws.d.ts +6 -3
  155. package/dist/server/ws.js +1 -1
  156. package/dist/swcPlugins/autoCSSModules.d.ts +7 -2
  157. package/dist/swcPlugins/autoCSSModules.js +16 -17
  158. package/dist/swcPlugins/changeImportFromString.d.ts +2 -0
  159. package/dist/swcPlugins/changeImportFromString.js +10 -0
  160. package/dist/swcPlugins/lockCoreJS.d.ts +6 -0
  161. package/dist/swcPlugins/lockCoreJS.js +24 -0
  162. package/dist/types.d.ts +19 -0
  163. package/dist/types.js +1 -0
  164. package/dist/utils/depMatch.js +1 -1
  165. package/dist/utils/getEsBuildTarget.d.ts +5 -0
  166. package/dist/utils/getEsBuildTarget.js +12 -0
  167. package/package.json +68 -67
  168. package/compiled/@svgr/webpack/.svgo.yml +0 -75
  169. package/compiled/@svgr/webpack/LICENSE +0 -7
  170. package/compiled/@svgr/webpack/index.js +0 -343
  171. package/compiled/@svgr/webpack/package.json +0 -1
  172. package/compiled/css-loader/LICENSE +0 -20
  173. package/compiled/css-loader/api.js +0 -102
  174. package/compiled/css-loader/getUrl.js +0 -29
  175. package/compiled/css-loader/index.js +0 -2
  176. package/compiled/css-loader/noSourceMaps.js +0 -5
  177. package/compiled/css-loader/package.json +0 -1
  178. package/compiled/css-loader/sourceMaps.js +0 -22
  179. package/compiled/express/LICENSE +0 -24
  180. package/compiled/express/body-parser/index.d.ts +0 -104
  181. package/compiled/express/connect/index.d.ts +0 -93
  182. package/compiled/express/express-serve-static-core/index.d.ts +0 -1252
  183. package/compiled/express/index.d.ts +0 -133
  184. package/compiled/express/index.js +0 -338
  185. package/compiled/express/mime/index.d.ts +0 -35
  186. package/compiled/express/package.json +0 -1
  187. package/compiled/express/qs/index.d.ts +0 -62
  188. package/compiled/express/range-parser/index.d.ts +0 -35
  189. package/compiled/express/serve-static/index.d.ts +0 -108
  190. package/compiled/less/index.js +0 -31
  191. package/compiled/less/package.json +0 -1
  192. package/compiled/swc-loader/LICENSE +0 -25
  193. package/compiled/swc-loader/index.js +0 -1
  194. package/compiled/swc-loader/package.json +0 -1
  195. package/compiled/tapable/index.js +0 -1
  196. package/compiled/tapable/package.json +0 -1
  197. package/compiled/tapable/tapable.d.ts +0 -116
@@ -1,13 +1,5 @@
1
1
  "use strict";
2
2
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.terserMinify = terserMinify;
7
- exports.uglifyJsMinify = uglifyJsMinify;
8
- exports.swcMinify = swcMinify;
9
- exports.esbuildMinify = esbuildMinify;
10
-
11
3
  /** @typedef {import("source-map").RawSourceMap} RawSourceMap */
12
4
 
13
5
  /** @typedef {import("terser").FormatOptions} TerserFormatOptions */
@@ -28,14 +20,68 @@ exports.esbuildMinify = esbuildMinify;
28
20
 
29
21
  /** @typedef {import("./index.js").PredefinedOptions} PredefinedOptions */
30
22
 
23
+ /** @typedef {import("./index.js").CustomOptions} CustomOptions */
24
+
25
+ /**
26
+ * @typedef {Array<string>} ExtractedComments
27
+ */
28
+ const notSettled = Symbol(`not-settled`);
31
29
  /**
32
- * @typedef {{ [key: string]: any }} CustomOptions
30
+ * @template T
31
+ * @typedef {() => Promise<T>} Task
33
32
  */
34
33
 
35
34
  /**
36
- * @typedef {Array<string>} ExtractedComments
35
+ * Run tasks with limited concurency.
36
+ * @template T
37
+ * @param {number} limit - Limit of tasks that run at once.
38
+ * @param {Task<T>[]} tasks - List of tasks to run.
39
+ * @returns {Promise<T[]>} A promise that fulfills to an array of the results
37
40
  */
38
41
 
42
+ function throttleAll(limit, tasks) {
43
+ if (!Number.isInteger(limit) || limit < 1) {
44
+ throw new TypeError(`Expected \`limit\` to be a finite number > 0, got \`${limit}\` (${typeof limit})`);
45
+ }
46
+
47
+ if (!Array.isArray(tasks) || !tasks.every(task => typeof task === `function`)) {
48
+ throw new TypeError(`Expected \`tasks\` to be a list of functions returning a promise`);
49
+ }
50
+
51
+ return new Promise((resolve, reject) => {
52
+ const result = Array(tasks.length).fill(notSettled);
53
+ const entries = tasks.entries();
54
+
55
+ const next = () => {
56
+ const {
57
+ done,
58
+ value
59
+ } = entries.next();
60
+
61
+ if (done) {
62
+ const isLast = !result.includes(notSettled);
63
+ if (isLast) resolve(
64
+ /** @type{T[]} **/
65
+ result);
66
+ return;
67
+ }
68
+
69
+ const [index, task] = value;
70
+ /**
71
+ * @param {T} x
72
+ */
73
+
74
+ const onFulfilled = x => {
75
+ result[index] = x;
76
+ next();
77
+ };
78
+
79
+ task().then(onFulfilled, reject);
80
+ };
81
+
82
+ Array(limit).fill(0).forEach(next);
83
+ });
84
+ }
39
85
  /* istanbul ignore next */
40
86
 
41
87
  /**
@@ -45,6 +91,8 @@ exports.esbuildMinify = esbuildMinify;
45
91
  * @param {ExtractCommentsOptions | undefined} extractComments
46
92
  * @return {Promise<MinimizedResult>}
47
93
  */
94
+
95
+
48
96
  async function terserMinify(input, sourceMap, minimizerOptions, extractComments) {
49
97
  /**
50
98
  * @param {any} value
@@ -117,21 +165,33 @@ async function terserMinify(input, sourceMap, minimizerOptions, extractComments)
117
165
  }
118
166
 
119
167
  if (condition[key] === "some") {
120
- condition[key] = (astNode, comment) => (comment.type === "comment2" || comment.type === "comment1") && /@preserve|@lic|@cc_on|^\**!/i.test(comment.value);
168
+ condition[key] =
169
+ /** @type {ExtractCommentsFunction} */
170
+ (astNode, comment) => (comment.type === "comment2" || comment.type === "comment1") && /@preserve|@lic|@cc_on|^\**!/i.test(comment.value);
121
171
 
122
172
  break;
123
173
  }
124
174
 
125
- regexStr = condition[key];
175
+ regexStr =
176
+ /** @type {string} */
177
+ condition[key];
126
178
 
127
- condition[key] = (astNode, comment) => new RegExp(regexStr).test(comment.value);
179
+ condition[key] =
180
+ /** @type {ExtractCommentsFunction} */
181
+ (astNode, comment) => new RegExp(
182
+ /** @type {string} */
183
+ regexStr).test(comment.value);
128
184
 
129
185
  break;
130
186
 
131
187
  default:
132
- regex = condition[key];
188
+ regex =
189
+ /** @type {RegExp} */
190
+ condition[key];
133
191
 
134
- condition[key] = (astNode, comment) =>
192
+ condition[key] =
193
+ /** @type {ExtractCommentsFunction} */
194
+ (astNode, comment) =>
135
195
  /** @type {RegExp} */
136
196
  regex.test(comment.value);
137
197
 
@@ -227,10 +287,14 @@ async function terserMinify(input, sourceMap, minimizerOptions, extractComments)
227
287
  [filename]: code
228
288
  }, terserOptions);
229
289
  return {
230
- code: result.code,
290
+ code:
291
+ /** @type {string} **/
292
+ result.code,
231
293
  // @ts-ignore
232
294
  // eslint-disable-next-line no-undefined
233
- map: result.map ? result.map : undefined,
295
+ map: result.map ?
296
+ /** @type {RawSourceMap} **/
297
+ result.map : undefined,
234
298
  extractedComments
235
299
  };
236
300
  }
@@ -324,21 +388,33 @@ async function uglifyJsMinify(input, sourceMap, minimizerOptions, extractComment
324
388
  }
325
389
 
326
390
  if (condition[key] === "some") {
327
- condition[key] = (astNode, comment) => (comment.type === "comment2" || comment.type === "comment1") && /@preserve|@lic|@cc_on|^\**!/i.test(comment.value);
391
+ condition[key] =
392
+ /** @type {ExtractCommentsFunction} */
393
+ (astNode, comment) => (comment.type === "comment2" || comment.type === "comment1") && /@preserve|@lic|@cc_on|^\**!/i.test(comment.value);
328
394
 
329
395
  break;
330
396
  }
331
397
 
332
- regexStr = condition[key];
398
+ regexStr =
399
+ /** @type {string} */
400
+ condition[key];
333
401
 
334
- condition[key] = (astNode, comment) => new RegExp(regexStr).test(comment.value);
402
+ condition[key] =
403
+ /** @type {ExtractCommentsFunction} */
404
+ (astNode, comment) => new RegExp(
405
+ /** @type {string} */
406
+ regexStr).test(comment.value);
335
407
 
336
408
  break;
337
409
 
338
410
  default:
339
- regex = condition[key];
411
+ regex =
412
+ /** @type {RegExp} */
413
+ condition[key];
340
414
 
341
- condition[key] = (astNode, comment) =>
415
+ condition[key] =
416
+ /** @type {ExtractCommentsFunction} */
417
+ (astNode, comment) =>
342
418
  /** @type {RegExp} */
343
419
  regex.test(comment.value);
344
420
 
@@ -556,10 +632,10 @@ async function esbuildMinify(input, sourceMap, minimizerOptions) {
556
632
  }; // eslint-disable-next-line import/no-extraneous-dependencies, global-require
557
633
 
558
634
 
559
- const esbuild = require('@umijs/bundler-utils/compiled/esbuild'); // Copy `swc` options
635
+ const esbuild = require('@umijs/bundler-utils/compiled/esbuild'); // Copy `esbuild` options
560
636
 
561
637
 
562
- const esbuildOptions = buildEsbuildOptions(minimizerOptions); // Let `swc` generate a SourceMap
638
+ const esbuildOptions = buildEsbuildOptions(minimizerOptions); // Let `esbuild` generate a SourceMap
563
639
 
564
640
  if (sourceMap) {
565
641
  esbuildOptions.sourcemap = true;
@@ -573,7 +649,16 @@ async function esbuildMinify(input, sourceMap, minimizerOptions) {
573
649
  code: result.code,
574
650
  // eslint-disable-next-line no-undefined
575
651
  map: result.map ? JSON.parse(result.map) : undefined,
576
- warnings: result.warnings ? result.warnings.map(item => item.toString()) : []
652
+ warnings: result.warnings.length > 0 ? result.warnings.map(item => {
653
+ return {
654
+ name: "Warning",
655
+ source: item.location && item.location.file,
656
+ line: item.location && item.location.line,
657
+ column: item.location && item.location.column,
658
+ plugin: item.pluginName,
659
+ message: `${item.text}${item.detail ? `\nDetails:\n${item.detail}` : ""}${item.notes.length > 0 ? `\n\nNotes:\n${item.notes.map(note => `${note.location ? `[${note.location.file}:${note.location.line}:${note.location.column}] ` : ""}${note.text}${note.location ? `\nSuggestion: ${note.location.suggestion}` : ""}${note.location ? `\nLine text:\n${note.location.lineText}\n` : ""}`).join("\n")}` : ""}`
660
+ };
661
+ }) : []
577
662
  };
578
663
  }
579
664
  /**
@@ -591,4 +676,12 @@ esbuildMinify.getMinimizerVersion = () => {
591
676
  }
592
677
 
593
678
  return packageJson && packageJson.version;
679
+ };
680
+
681
+ module.exports = {
682
+ throttleAll,
683
+ terserMinify,
684
+ uglifyJsMinify,
685
+ swcMinify,
686
+ esbuildMinify
594
687
  };
@@ -0,0 +1 @@
1
+ module.exports = require('./').BasicEffectRulePlugin;
@@ -0,0 +1 @@
1
+ module.exports = require('./').BasicMatcherRulePlugin;
@@ -28,7 +28,8 @@ module.exports = function () {
28
28
  var currentStatus = "idle";
29
29
 
30
30
  // while downloading
31
- var blockingPromises;
31
+ var blockingPromises = 0;
32
+ var blockingPromisesWaiting = [];
32
33
 
33
34
  // The update info
34
35
  var currentUpdateApplyHandlers;
@@ -218,17 +219,28 @@ module.exports = function () {
218
219
  return Promise.all(results);
219
220
  }
220
221
 
222
+ function unblock() {
223
+ if (--blockingPromises === 0) {
224
+ setStatus("ready").then(function () {
225
+ if (blockingPromises === 0) {
226
+ var list = blockingPromisesWaiting;
227
+ blockingPromisesWaiting = [];
228
+ for (var i = 0; i < list.length; i++) {
229
+ list[i]();
230
+ }
231
+ }
232
+ });
233
+ }
234
+ }
235
+
221
236
  function trackBlockingPromise(promise) {
222
237
  switch (currentStatus) {
223
238
  case "ready":
224
239
  setStatus("prepare");
225
- blockingPromises.push(promise);
226
- waitForBlockingPromises(function () {
227
- return setStatus("ready");
228
- });
229
- return promise;
240
+ /* fallthrough */
230
241
  case "prepare":
231
- blockingPromises.push(promise);
242
+ blockingPromises++;
243
+ promise.then(unblock, unblock);
232
244
  return promise;
233
245
  default:
234
246
  return promise;
@@ -236,11 +248,11 @@ module.exports = function () {
236
248
  }
237
249
 
238
250
  function waitForBlockingPromises(fn) {
239
- if (blockingPromises.length === 0) return fn();
240
- var blocker = blockingPromises;
241
- blockingPromises = [];
242
- return Promise.all(blocker).then(function () {
243
- return waitForBlockingPromises(fn);
251
+ if (blockingPromises === 0) return fn();
252
+ return new Promise(function (resolve) {
253
+ blockingPromisesWaiting.push(function () {
254
+ resolve(fn());
255
+ });
244
256
  });
245
257
  }
246
258
 
@@ -261,7 +273,6 @@ module.exports = function () {
261
273
 
262
274
  return setStatus("prepare").then(function () {
263
275
  var updatedModules = [];
264
- blockingPromises = [];
265
276
  currentUpdateApplyHandlers = [];
266
277
 
267
278
  return Promise.all(
@@ -298,7 +309,11 @@ module.exports = function () {
298
309
  function hotApply(options) {
299
310
  if (currentStatus !== "ready") {
300
311
  return Promise.resolve().then(function () {
301
- throw new Error("apply() is only allowed in ready status");
312
+ throw new Error(
313
+ "apply() is only allowed in ready status (state: " +
314
+ currentStatus +
315
+ ")"
316
+ );
302
317
  });
303
318
  }
304
319
  return internalApply(options);
@@ -443,15 +443,16 @@ module.exports = function () {
443
443
  ) {
444
444
  promises.push($loadUpdateChunk$(chunkId, updatedModulesList));
445
445
  currentUpdateChunks[chunkId] = true;
446
+ } else {
447
+ currentUpdateChunks[chunkId] = false;
446
448
  }
447
449
  });
448
450
  if ($ensureChunkHandlers$) {
449
451
  $ensureChunkHandlers$.$key$Hmr = function (chunkId, promises) {
450
452
  if (
451
453
  currentUpdateChunks &&
452
- !$hasOwnProperty$(currentUpdateChunks, chunkId) &&
453
- $hasOwnProperty$($installedChunks$, chunkId) &&
454
- $installedChunks$[chunkId] !== undefined
454
+ $hasOwnProperty$(currentUpdateChunks, chunkId) &&
455
+ !currentUpdateChunks[chunkId]
455
456
  ) {
456
457
  promises.push($loadUpdateChunk$(chunkId));
457
458
  currentUpdateChunks[chunkId] = true;
@@ -0,0 +1 @@
1
+ module.exports = require('./').ObjectMatcherRulePlugin;
@@ -0,0 +1 @@
1
+ module.exports = require('./').RuleSetCompiler;
@@ -0,0 +1 @@
1
+ module.exports = require('./').UseEffectRulePlugin;
@@ -8,5 +8,10 @@
8
8
  "webpack/lib/RuntimeGlobals",
9
9
  "webpack/lib/RuntimeModule",
10
10
  "webpack/lib/SingleEntryPlugin",
11
- "webpack/lib/Template"
11
+ "webpack/lib/Template",
12
+ "webpack/lib/rules/BasicEffectRulePlugin",
13
+ "webpack/lib/rules/BasicMatcherRulePlugin",
14
+ "webpack/lib/rules/ObjectMatcherRulePlugin",
15
+ "webpack/lib/rules/RuleSetCompiler",
16
+ "webpack/lib/rules/UseEffectRulePlugin"
12
17
  ]