webpack 4.32.1 → 4.32.2

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.
@@ -22,6 +22,8 @@ export type EntryDynamic = () => EntryStatic | Promise<EntryStatic>;
22
22
  */
23
23
  export type EntryStatic = EntryObject | EntryItem;
24
24
  /**
25
+ * A non-empty array of non-empty strings
26
+ *
25
27
  * This interface was referenced by `WebpackOptions`'s JSON-Schema
26
28
  * via the `definition` "NonEmptyArrayOfUniqueStringValues".
27
29
  */
@@ -50,13 +50,34 @@ const getSchemaPartDescription = schemaPart => {
50
50
  return "";
51
51
  };
52
52
 
53
+ const SPECIFICITY = {
54
+ type: 1,
55
+ oneOf: 1,
56
+ anyOf: 1,
57
+ allOf: 1,
58
+ additionalProperties: 2,
59
+ enum: 1,
60
+ instanceof: 1,
61
+ required: 2,
62
+ minimum: 2,
63
+ uniqueItems: 2,
64
+ minLength: 2,
65
+ minItems: 2,
66
+ minProperties: 2,
67
+ absolutePath: 2
68
+ };
69
+
70
+ const filterMax = (array, fn) => {
71
+ const max = array.reduce((max, item) => Math.max(max, fn(item)), 0);
72
+ return array.filter(item => fn(item) === max);
73
+ };
74
+
53
75
  const filterChildren = children => {
54
- return children.filter(
55
- err =>
56
- err.keyword !== "anyOf" &&
57
- err.keyword !== "allOf" &&
58
- err.keyword !== "oneOf"
76
+ children = filterMax(children, err =>
77
+ err.dataPath ? err.dataPath.length : 0
59
78
  );
79
+ children = filterMax(children, err => SPECIFICITY[err.keyword] || 2);
80
+ return children;
60
81
  };
61
82
 
62
83
  const indent = (str, prefix, firstLine) => {
@@ -154,6 +175,10 @@ class WebpackOptionsValidationError extends WebpackError {
154
175
  return "RegExp";
155
176
  }
156
177
 
178
+ if (schema.enum) {
179
+ return schema.enum.map(item => JSON.stringify(item)).join(" | ");
180
+ }
181
+
157
182
  if (schema.$ref) {
158
183
  return formatInnerSchema(getSchemaPart(schema.$ref), true);
159
184
  }
@@ -166,9 +191,6 @@ class WebpackOptionsValidationError extends WebpackError {
166
191
  if (schema.anyOf) {
167
192
  return schema.anyOf.map(formatInnerSchema).join(" | ");
168
193
  }
169
- if (schema.enum) {
170
- return schema.enum.map(item => JSON.stringify(item)).join(" | ");
171
- }
172
194
  return JSON.stringify(schema, null, 2);
173
195
  }
174
196
 
@@ -229,11 +251,17 @@ class WebpackOptionsValidationError extends WebpackError {
229
251
  })
230
252
  );
231
253
  }
254
+ const children = filterChildren(err.children);
255
+ if (children.length === 1) {
256
+ return WebpackOptionsValidationError.formatValidationError(
257
+ children[0]
258
+ );
259
+ }
232
260
  return (
233
261
  `${dataPath} should be one of these:\n${getSchemaPartText(
234
262
  err.parentSchema
235
263
  )}\n` +
236
- `Details:\n${filterChildren(err.children)
264
+ `Details:\n${children
237
265
  .map(
238
266
  err =>
239
267
  " * " +
@@ -312,7 +340,21 @@ class WebpackOptionsValidationError extends WebpackError {
312
340
  err.keyword === "minProperties"
313
341
  ) {
314
342
  if (err.params.limit === 1) {
315
- return `${dataPath} should not be empty.${getSchemaPartDescription(
343
+ switch (err.keyword) {
344
+ case "minLength":
345
+ return `${dataPath} should be an non-empty string.${getSchemaPartDescription(
346
+ err.parentSchema
347
+ )}`;
348
+ case "minItems":
349
+ return `${dataPath} should be an non-empty array.${getSchemaPartDescription(
350
+ err.parentSchema
351
+ )}`;
352
+ case "minProperties":
353
+ return `${dataPath} should be an non-empty object.${getSchemaPartDescription(
354
+ err.parentSchema
355
+ )}`;
356
+ }
357
+ return `${dataPath} should be not empty.${getSchemaPartDescription(
316
358
  err.parentSchema
317
359
  )}`;
318
360
  } else {
@@ -521,7 +521,7 @@ class ConcatenatedModule extends Module {
521
521
  dep instanceof HarmonyExportImportedSpecifierDependency
522
522
  ) {
523
523
  const exportName = dep.name;
524
- const importName = dep.id;
524
+ const importName = dep._id;
525
525
  const importedModule = dep._module;
526
526
  if (exportName && importName) {
527
527
  if (!reexportMap.has(exportName)) {
@@ -1390,12 +1390,12 @@ class HarmonyExportImportedSpecifierDependencyConcatenatedTemplate {
1390
1390
 
1391
1391
  getExports(dep) {
1392
1392
  const importModule = dep._module;
1393
- if (dep.id) {
1393
+ if (dep._id) {
1394
1394
  // export { named } from "module"
1395
1395
  return [
1396
1396
  {
1397
1397
  name: dep.name,
1398
- id: dep.id,
1398
+ id: dep._id,
1399
1399
  module: importModule
1400
1400
  }
1401
1401
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webpack",
3
- "version": "4.32.1",
3
+ "version": "4.32.2",
4
4
  "author": "Tobias Koppers @sokra",
5
5
  "description": "Packs CommonJs/AMD modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.",
6
6
  "license": "MIT",
@@ -385,6 +385,7 @@
385
385
  }
386
386
  },
387
387
  "NonEmptyArrayOfUniqueStringValues": {
388
+ "description": "A non-empty array of non-empty strings",
388
389
  "type": "array",
389
390
  "items": {
390
391
  "description": "A non-empty string",