webpack 5.70.0 → 5.71.0

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.

Potentially problematic release.


This version of webpack might be problematic. Click here for more details.

Files changed (42) hide show
  1. package/hot/poll.js +1 -1
  2. package/hot/signal.js +1 -1
  3. package/lib/Chunk.js +1 -1
  4. package/lib/ChunkGroup.js +1 -1
  5. package/lib/Compilation.js +10 -8
  6. package/lib/Compiler.js +16 -3
  7. package/lib/ConstPlugin.js +2 -2
  8. package/lib/ContextModule.js +31 -8
  9. package/lib/ContextModuleFactory.js +7 -11
  10. package/lib/DelegatedModuleFactoryPlugin.js +1 -1
  11. package/lib/Dependency.js +7 -0
  12. package/lib/ErrorHelpers.js +2 -2
  13. package/lib/ExternalModuleFactoryPlugin.js +4 -4
  14. package/lib/FileSystemInfo.js +8 -0
  15. package/lib/LoaderOptionsPlugin.js +1 -1
  16. package/lib/Module.js +2 -0
  17. package/lib/ModuleFilenameHelpers.js +3 -3
  18. package/lib/NormalModule.js +2 -2
  19. package/lib/NormalModuleFactory.js +2 -2
  20. package/lib/RuntimePlugin.js +18 -0
  21. package/lib/config/defaults.js +9 -1
  22. package/lib/dependencies/CommonJsExportsParserPlugin.js +1 -2
  23. package/lib/dependencies/ContextDependencyHelpers.js +2 -2
  24. package/lib/dependencies/ContextElementDependency.js +33 -1
  25. package/lib/dependencies/HarmonyEvaluatedImportSpecifierDependency.js +95 -0
  26. package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +127 -43
  27. package/lib/dependencies/HarmonyImportSpecifierDependency.js +22 -8
  28. package/lib/dependencies/HarmonyModulesPlugin.js +10 -0
  29. package/lib/esm/ModuleChunkLoadingPlugin.js +3 -1
  30. package/lib/hmr/HotModuleReplacement.runtime.js +29 -14
  31. package/lib/hmr/JavascriptHotModuleReplacement.runtime.js +4 -3
  32. package/lib/ids/HashedModuleIdsPlugin.js +2 -2
  33. package/lib/ids/IdHelpers.js +1 -1
  34. package/lib/javascript/BasicEvaluatedExpression.js +5 -2
  35. package/lib/javascript/JavascriptParser.js +66 -40
  36. package/lib/library/UmdLibraryPlugin.js +5 -3
  37. package/lib/runtime/BaseUriRuntimeModule.js +31 -0
  38. package/lib/stats/DefaultStatsFactoryPlugin.js +1 -1
  39. package/lib/util/internalSerializables.js +2 -0
  40. package/lib/web/JsonpChunkLoadingRuntimeModule.js +2 -1
  41. package/package.json +1 -1
  42. package/types.d.ts +21 -11
@@ -57,7 +57,7 @@ const BasicEvaluatedExpression = require("./BasicEvaluatedExpression");
57
57
  /** @typedef {import("../Parser").ParserState} ParserState */
58
58
  /** @typedef {import("../Parser").PreparsedAst} PreparsedAst */
59
59
  /** @typedef {{declaredScope: ScopeInfo, freeName: string | true, tagInfo: TagInfo | undefined}} VariableInfoInterface */
60
- /** @typedef {{ name: string | VariableInfo, rootInfo: string | VariableInfo, getMembers: () => string[] }} GetInfoResult */
60
+ /** @typedef {{ name: string | VariableInfo, rootInfo: string | VariableInfo, getMembers: () => string[], getMembersOptionals: () => boolean[] }} GetInfoResult */
61
61
 
62
62
  const EMPTY_ARRAY = [];
63
63
  const ALLOWED_MEMBER_TYPES_CALL_EXPRESSION = 0b01;
@@ -262,9 +262,9 @@ class JavascriptParser extends Parser {
262
262
  /** @type {HookMap<SyncBailHook<[ExpressionNode], boolean | void>>} */
263
263
  call: new HookMap(() => new SyncBailHook(["expression"])),
264
264
  /** Something like "a.b()" */
265
- /** @type {HookMap<SyncBailHook<[CallExpressionNode, string[]], boolean | void>>} */
265
+ /** @type {HookMap<SyncBailHook<[CallExpressionNode, string[], boolean[]], boolean | void>>} */
266
266
  callMemberChain: new HookMap(
267
- () => new SyncBailHook(["expression", "members"])
267
+ () => new SyncBailHook(["expression", "members", "membersOptionals"])
268
268
  ),
269
269
  /** Something like "a.b().c.d" */
270
270
  /** @type {HookMap<SyncBailHook<[ExpressionNode, string[], CallExpressionNode, string[]], boolean | void>>} */
@@ -292,11 +292,13 @@ class JavascriptParser extends Parser {
292
292
  optionalChaining: new SyncBailHook(["optionalChaining"]),
293
293
  /** @type {HookMap<SyncBailHook<[NewExpressionNode], boolean | void>>} */
294
294
  new: new HookMap(() => new SyncBailHook(["expression"])),
295
+ /** @type {SyncBailHook<[BinaryExpressionNode], boolean | void>} */
296
+ binaryExpression: new SyncBailHook(["binaryExpression"]),
295
297
  /** @type {HookMap<SyncBailHook<[ExpressionNode], boolean | void>>} */
296
298
  expression: new HookMap(() => new SyncBailHook(["expression"])),
297
- /** @type {HookMap<SyncBailHook<[ExpressionNode, string[]], boolean | void>>} */
299
+ /** @type {HookMap<SyncBailHook<[ExpressionNode, string[], boolean[]], boolean | void>>} */
298
300
  expressionMemberChain: new HookMap(
299
- () => new SyncBailHook(["expression", "members"])
301
+ () => new SyncBailHook(["expression", "members", "membersOptionals"])
300
302
  ),
301
303
  /** @type {HookMap<SyncBailHook<[ExpressionNode, string[]], boolean | void>>} */
302
304
  unhandledExpressionMemberChain: new HookMap(
@@ -416,7 +418,6 @@ class JavascriptParser extends Parser {
416
418
  const expr = /** @type {LogicalExpressionNode} */ (_expr);
417
419
 
418
420
  const left = this.evaluateExpression(expr.left);
419
- if (!left) return;
420
421
  let returnRight = false;
421
422
  /** @type {boolean|undefined} */
422
423
  let allowedRight;
@@ -437,7 +438,6 @@ class JavascriptParser extends Parser {
437
438
  returnRight = true;
438
439
  } else return;
439
440
  const right = this.evaluateExpression(expr.right);
440
- if (!right) return;
441
441
  if (returnRight) {
442
442
  if (left.couldHaveSideEffects()) right.setSideEffects();
443
443
  return right.setRange(expr.range);
@@ -486,10 +486,10 @@ class JavascriptParser extends Parser {
486
486
 
487
487
  const handleConstOperation = fn => {
488
488
  const left = this.evaluateExpression(expr.left);
489
- if (!left || !left.isCompileTimeValue()) return;
489
+ if (!left.isCompileTimeValue()) return;
490
490
 
491
491
  const right = this.evaluateExpression(expr.right);
492
- if (!right || !right.isCompileTimeValue()) return;
492
+ if (!right.isCompileTimeValue()) return;
493
493
 
494
494
  const result = fn(
495
495
  left.asCompileTimeValue(),
@@ -545,9 +545,7 @@ class JavascriptParser extends Parser {
545
545
 
546
546
  const handleStrictEqualityComparison = eql => {
547
547
  const left = this.evaluateExpression(expr.left);
548
- if (!left) return;
549
548
  const right = this.evaluateExpression(expr.right);
550
- if (!right) return;
551
549
  const res = new BasicEvaluatedExpression();
552
550
  res.setRange(expr.range);
553
551
 
@@ -600,9 +598,7 @@ class JavascriptParser extends Parser {
600
598
 
601
599
  const handleAbstractEqualityComparison = eql => {
602
600
  const left = this.evaluateExpression(expr.left);
603
- if (!left) return;
604
601
  const right = this.evaluateExpression(expr.right);
605
- if (!right) return;
606
602
  const res = new BasicEvaluatedExpression();
607
603
  res.setRange(expr.range);
608
604
 
@@ -635,9 +631,7 @@ class JavascriptParser extends Parser {
635
631
 
636
632
  if (expr.operator === "+") {
637
633
  const left = this.evaluateExpression(expr.left);
638
- if (!left) return;
639
634
  const right = this.evaluateExpression(expr.right);
640
- if (!right) return;
641
635
  const res = new BasicEvaluatedExpression();
642
636
  if (left.isString()) {
643
637
  if (right.isString()) {
@@ -816,7 +810,7 @@ class JavascriptParser extends Parser {
816
810
 
817
811
  const handleConstOperation = fn => {
818
812
  const argument = this.evaluateExpression(expr.argument);
819
- if (!argument || !argument.isCompileTimeValue()) return;
813
+ if (!argument.isCompileTimeValue()) return;
820
814
  const result = fn(argument.asCompileTimeValue());
821
815
  return valueAsExpression(
822
816
  result,
@@ -915,7 +909,6 @@ class JavascriptParser extends Parser {
915
909
  }
916
910
  } else if (expr.operator === "!") {
917
911
  const argument = this.evaluateExpression(expr.argument);
918
- if (!argument) return;
919
912
  const bool = argument.asBool();
920
913
  if (typeof bool !== "boolean") return;
921
914
  return new BasicEvaluatedExpression()
@@ -980,7 +973,12 @@ class JavascriptParser extends Parser {
980
973
  const info = cachedExpression === expr ? cachedInfo : getInfo(expr);
981
974
  if (info !== undefined) {
982
975
  return new BasicEvaluatedExpression()
983
- .setIdentifier(info.name, info.rootInfo, info.getMembers)
976
+ .setIdentifier(
977
+ info.name,
978
+ info.rootInfo,
979
+ info.getMembers,
980
+ info.getMembersOptionals
981
+ )
984
982
  .setRange(expr.range);
985
983
  }
986
984
  });
@@ -997,7 +995,12 @@ class JavascriptParser extends Parser {
997
995
  typeof info === "string" ||
998
996
  (info instanceof VariableInfo && typeof info.freeName === "string")
999
997
  ) {
1000
- return { name: info, rootInfo: info, getMembers: () => [] };
998
+ return {
999
+ name: info,
1000
+ rootInfo: info,
1001
+ getMembers: () => [],
1002
+ getMembersOptionals: () => []
1003
+ };
1001
1004
  }
1002
1005
  });
1003
1006
  tapEvaluateWithVariableInfo("ThisExpression", expr => {
@@ -1006,7 +1009,12 @@ class JavascriptParser extends Parser {
1006
1009
  typeof info === "string" ||
1007
1010
  (info instanceof VariableInfo && typeof info.freeName === "string")
1008
1011
  ) {
1009
- return { name: info, rootInfo: info, getMembers: () => [] };
1012
+ return {
1013
+ name: info,
1014
+ rootInfo: info,
1015
+ getMembers: () => [],
1016
+ getMembersOptionals: () => []
1017
+ };
1010
1018
  }
1011
1019
  });
1012
1020
  this.hooks.evaluate.for("MetaProperty").tap("JavascriptParser", expr => {
@@ -1039,7 +1047,6 @@ class JavascriptParser extends Parser {
1039
1047
  const param = this.evaluateExpression(
1040
1048
  /** @type {ExpressionNode} */ (expr.callee.object)
1041
1049
  );
1042
- if (!param) return;
1043
1050
  const property =
1044
1051
  expr.callee.property.type === "Literal"
1045
1052
  ? `${expr.callee.property.value}`
@@ -1306,7 +1313,6 @@ class JavascriptParser extends Parser {
1306
1313
  if (conditionValue === undefined) {
1307
1314
  const consequent = this.evaluateExpression(expr.consequent);
1308
1315
  const alternate = this.evaluateExpression(expr.alternate);
1309
- if (!consequent || !alternate) return;
1310
1316
  res = new BasicEvaluatedExpression();
1311
1317
  if (consequent.isConditional()) {
1312
1318
  res.setOptions(consequent.options);
@@ -1380,7 +1386,7 @@ class JavascriptParser extends Parser {
1380
1386
  const expression = optionalExpressionsStack.pop();
1381
1387
  const evaluated = this.evaluateExpression(expression);
1382
1388
 
1383
- if (evaluated && evaluated.asNullish()) {
1389
+ if (evaluated.asNullish()) {
1384
1390
  return evaluated.setRange(_expr.range);
1385
1391
  }
1386
1392
  }
@@ -1390,7 +1396,7 @@ class JavascriptParser extends Parser {
1390
1396
 
1391
1397
  getRenameIdentifier(expr) {
1392
1398
  const result = this.evaluateExpression(expr);
1393
- if (result && result.isIdentifier()) {
1399
+ if (result.isIdentifier()) {
1394
1400
  return result.identifier;
1395
1401
  }
1396
1402
  }
@@ -2457,7 +2463,9 @@ class JavascriptParser extends Parser {
2457
2463
  }
2458
2464
 
2459
2465
  walkBinaryExpression(expression) {
2460
- this.walkLeftRightExpression(expression);
2466
+ if (this.hooks.binaryExpression.call(expression) === undefined) {
2467
+ this.walkLeftRightExpression(expression);
2468
+ }
2461
2469
  }
2462
2470
 
2463
2471
  walkLogicalExpression(expression) {
@@ -2492,7 +2500,9 @@ class JavascriptParser extends Parser {
2492
2500
  ) {
2493
2501
  this.setVariable(
2494
2502
  expression.left.name,
2495
- this.getVariableInfo(renameIdentifier)
2503
+ typeof renameIdentifier === "string"
2504
+ ? this.getVariableInfo(renameIdentifier)
2505
+ : renameIdentifier
2496
2506
  );
2497
2507
  }
2498
2508
  return;
@@ -2627,7 +2637,9 @@ class JavascriptParser extends Parser {
2627
2637
  argOrThis
2628
2638
  )
2629
2639
  ) {
2630
- return this.getVariableInfo(renameIdentifier);
2640
+ return typeof renameIdentifier === "string"
2641
+ ? this.getVariableInfo(renameIdentifier)
2642
+ : renameIdentifier;
2631
2643
  }
2632
2644
  }
2633
2645
  }
@@ -2727,7 +2739,10 @@ class JavascriptParser extends Parser {
2727
2739
  this.hooks.callMemberChain,
2728
2740
  callee.rootInfo,
2729
2741
  expression,
2730
- callee.getMembers()
2742
+ callee.getMembers(),
2743
+ callee.getMembersOptionals
2744
+ ? callee.getMembersOptionals()
2745
+ : callee.getMembers().map(() => false)
2731
2746
  );
2732
2747
  if (result1 === true) return;
2733
2748
  const result2 = this.callHooksForInfo(
@@ -2767,11 +2782,13 @@ class JavascriptParser extends Parser {
2767
2782
  );
2768
2783
  if (result1 === true) return;
2769
2784
  const members = exprInfo.getMembers();
2785
+ const membersOptionals = exprInfo.getMembersOptionals();
2770
2786
  const result2 = this.callHooksForInfo(
2771
2787
  this.hooks.expressionMemberChain,
2772
2788
  exprInfo.rootInfo,
2773
2789
  expression,
2774
- members
2790
+ members,
2791
+ membersOptionals
2775
2792
  );
2776
2793
  if (result2 === true) return;
2777
2794
  this.walkMemberExpressionWithExpressionName(
@@ -3167,17 +3184,15 @@ class JavascriptParser extends Parser {
3167
3184
 
3168
3185
  /**
3169
3186
  * @param {ExpressionNode} expression expression node
3170
- * @returns {BasicEvaluatedExpression | undefined} evaluation result
3187
+ * @returns {BasicEvaluatedExpression} evaluation result
3171
3188
  */
3172
3189
  evaluateExpression(expression) {
3173
3190
  try {
3174
3191
  const hook = this.hooks.evaluate.get(expression.type);
3175
3192
  if (hook !== undefined) {
3176
3193
  const result = hook.call(expression);
3177
- if (result !== undefined) {
3178
- if (result) {
3179
- result.setExpression(expression);
3180
- }
3194
+ if (result !== undefined && result !== null) {
3195
+ result.setExpression(expression);
3181
3196
  return result;
3182
3197
  }
3183
3198
  }
@@ -3348,6 +3363,10 @@ class JavascriptParser extends Parser {
3348
3363
  return state;
3349
3364
  }
3350
3365
 
3366
+ /**
3367
+ * @param {string} source source code
3368
+ * @returns {BasicEvaluatedExpression} evaluation result
3369
+ */
3351
3370
  evaluate(source) {
3352
3371
  const ast = JavascriptParser._parse("(" + source + ")", {
3353
3372
  sourceType: this.sourceType,
@@ -3609,12 +3628,13 @@ class JavascriptParser extends Parser {
3609
3628
 
3610
3629
  /**
3611
3630
  * @param {MemberExpressionNode} expression a member expression
3612
- * @returns {{ members: string[], object: ExpressionNode | SuperNode }} member names (reverse order) and remaining object
3631
+ * @returns {{ members: string[], object: ExpressionNode | SuperNode, membersOptionals: boolean[] }} member names (reverse order) and remaining object
3613
3632
  */
3614
3633
  extractMemberExpressionChain(expression) {
3615
3634
  /** @type {AnyNode} */
3616
3635
  let expr = expression;
3617
3636
  const members = [];
3637
+ const membersOptionals = [];
3618
3638
  while (expr.type === "MemberExpression") {
3619
3639
  if (expr.computed) {
3620
3640
  if (expr.property.type !== "Literal") break;
@@ -3623,10 +3643,13 @@ class JavascriptParser extends Parser {
3623
3643
  if (expr.property.type !== "Identifier") break;
3624
3644
  members.push(expr.property.name);
3625
3645
  }
3646
+ membersOptionals.push(expr.optional);
3626
3647
  expr = expr.object;
3627
3648
  }
3649
+
3628
3650
  return {
3629
3651
  members,
3652
+ membersOptionals,
3630
3653
  object: expr
3631
3654
  };
3632
3655
  }
@@ -3649,8 +3672,8 @@ class JavascriptParser extends Parser {
3649
3672
  return { info, name };
3650
3673
  }
3651
3674
 
3652
- /** @typedef {{ type: "call", call: CallExpressionNode, calleeName: string, rootInfo: string | VariableInfo, getCalleeMembers: () => string[], name: string, getMembers: () => string[]}} CallExpressionInfo */
3653
- /** @typedef {{ type: "expression", rootInfo: string | VariableInfo, name: string, getMembers: () => string[]}} ExpressionExpressionInfo */
3675
+ /** @typedef {{ type: "call", call: CallExpressionNode, calleeName: string, rootInfo: string | VariableInfo, getCalleeMembers: () => string[], name: string, getMembers: () => string[], getMembersOptionals: () => boolean[]}} CallExpressionInfo */
3676
+ /** @typedef {{ type: "expression", rootInfo: string | VariableInfo, name: string, getMembers: () => string[], getMembersOptionals: () => boolean[]}} ExpressionExpressionInfo */
3654
3677
 
3655
3678
  /**
3656
3679
  * @param {MemberExpressionNode} expression a member expression
@@ -3658,7 +3681,8 @@ class JavascriptParser extends Parser {
3658
3681
  * @returns {CallExpressionInfo | ExpressionExpressionInfo | undefined} expression info
3659
3682
  */
3660
3683
  getMemberExpressionInfo(expression, allowedTypes) {
3661
- const { object, members } = this.extractMemberExpressionChain(expression);
3684
+ const { object, members, membersOptionals } =
3685
+ this.extractMemberExpressionChain(expression);
3662
3686
  switch (object.type) {
3663
3687
  case "CallExpression": {
3664
3688
  if ((allowedTypes & ALLOWED_MEMBER_TYPES_CALL_EXPRESSION) === 0)
@@ -3682,7 +3706,8 @@ class JavascriptParser extends Parser {
3682
3706
  rootInfo,
3683
3707
  getCalleeMembers: memoize(() => rootMembers.reverse()),
3684
3708
  name: objectAndMembersToName(`${calleeName}()`, members),
3685
- getMembers: memoize(() => members.reverse())
3709
+ getMembers: memoize(() => members.reverse()),
3710
+ getMembersOptionals: memoize(() => membersOptionals.reverse())
3686
3711
  };
3687
3712
  }
3688
3713
  case "Identifier":
@@ -3700,7 +3725,8 @@ class JavascriptParser extends Parser {
3700
3725
  type: "expression",
3701
3726
  name: objectAndMembersToName(resolvedRoot, members),
3702
3727
  rootInfo,
3703
- getMembers: memoize(() => members.reverse())
3728
+ getMembers: memoize(() => members.reverse()),
3729
+ getMembersOptionals: memoize(() => membersOptionals.reverse())
3704
3730
  };
3705
3731
  }
3706
3732
  }
@@ -310,9 +310,11 @@ class UmdLibraryPlugin extends AbstractLibraryPlugin {
310
310
  : " var a = factory();\n") +
311
311
  " for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n" +
312
312
  " }\n") +
313
- `})(${
314
- runtimeTemplate.outputOptions.globalObject
315
- }, function(${externalsArguments(externals)}) {\nreturn `,
313
+ `})(${runtimeTemplate.outputOptions.globalObject}, ${
314
+ runtimeTemplate.supportsArrowFunction()
315
+ ? `(${externalsArguments(externals)}) =>`
316
+ : `function(${externalsArguments(externals)})`
317
+ } {\nreturn `,
316
318
  "webpack/universalModuleDefinition"
317
319
  ),
318
320
  source,
@@ -0,0 +1,31 @@
1
+ /*
2
+ MIT License http://www.opensource.org/licenses/mit-license.php
3
+ Author Ivan Kopeykin @vankop
4
+ */
5
+
6
+ "use strict";
7
+
8
+ const RuntimeGlobals = require("../RuntimeGlobals");
9
+ const RuntimeModule = require("../RuntimeModule");
10
+
11
+ class BaseUriRuntimeModule extends RuntimeModule {
12
+ constructor() {
13
+ super("base uri", RuntimeModule.STAGE_ATTACH);
14
+ }
15
+
16
+ /**
17
+ * @returns {string} runtime code
18
+ */
19
+ generate() {
20
+ const { chunk } = this;
21
+
22
+ const options = chunk.getEntryOptions();
23
+ return `${RuntimeGlobals.baseURI} = ${
24
+ options.baseUri === undefined
25
+ ? "undefined"
26
+ : JSON.stringify(options.baseUri)
27
+ };`;
28
+ }
29
+ }
30
+
31
+ module.exports = BaseUriRuntimeModule;
@@ -2155,7 +2155,7 @@ const RESULT_GROUPERS = {
2155
2155
  // remove a prefixed "!" that can be specified to reverse sort order
2156
2156
  const normalizeFieldKey = field => {
2157
2157
  if (field[0] === "!") {
2158
- return field.substr(1);
2158
+ return field.slice(1);
2159
2159
  }
2160
2160
  return field;
2161
2161
  };
@@ -103,6 +103,8 @@ module.exports = {
103
103
  require("../dependencies/HarmonyImportSideEffectDependency"),
104
104
  "dependencies/HarmonyImportSpecifierDependency": () =>
105
105
  require("../dependencies/HarmonyImportSpecifierDependency"),
106
+ "dependencies/HarmonyEvaluatedImportSpecifierDependency": () =>
107
+ require("../dependencies/HarmonyEvaluatedImportSpecifierDependency"),
106
108
  "dependencies/ImportContextDependency": () =>
107
109
  require("../dependencies/ImportContextDependency"),
108
110
  "dependencies/ImportDependency": () =>
@@ -286,8 +286,9 @@ class JsonpChunkLoadingRuntimeModule extends RuntimeModule {
286
286
  ? Template.asString([
287
287
  "var currentUpdatedModulesList;",
288
288
  "var waitingUpdateResolves = {};",
289
- "function loadUpdateChunk(chunkId) {",
289
+ "function loadUpdateChunk(chunkId, updatedModulesList) {",
290
290
  Template.indent([
291
+ "currentUpdatedModulesList = updatedModulesList;",
291
292
  `return new Promise(${runtimeTemplate.basicFunction(
292
293
  "resolve, reject",
293
294
  [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webpack",
3
- "version": "5.70.0",
3
+ "version": "5.71.0",
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",
package/types.d.ts CHANGED
@@ -474,9 +474,10 @@ declare abstract class BasicEvaluatedExpression {
474
474
  prefix?: BasicEvaluatedExpression;
475
475
  postfix?: BasicEvaluatedExpression;
476
476
  wrappedInnerExpressions: any;
477
- identifier?: string;
477
+ identifier?: string | VariableInfoInterface;
478
478
  rootInfo: VariableInfoInterface;
479
479
  getMembers: () => string[];
480
+ getMembersOptionals: () => boolean[];
480
481
  expression: NodeEstreeIndex;
481
482
  isUnknown(): boolean;
482
483
  isNull(): boolean;
@@ -528,7 +529,8 @@ declare abstract class BasicEvaluatedExpression {
528
529
  setIdentifier(
529
530
  identifier?: any,
530
531
  rootInfo?: any,
531
- getMembers?: any
532
+ getMembers?: any,
533
+ getMembersOptionals?: any
532
534
  ): BasicEvaluatedExpression;
533
535
  setWrapped(
534
536
  prefix?: any,
@@ -681,6 +683,7 @@ declare interface CallExpressionInfo {
681
683
  getCalleeMembers: () => string[];
682
684
  name: string;
683
685
  getMembers: () => string[];
686
+ getMembersOptionals: () => boolean[];
684
687
  }
685
688
  declare interface CallbackAsyncQueue<T> {
686
689
  (err?: null | WebpackError, result?: T): any;
@@ -1239,6 +1242,11 @@ declare interface CodeGenerationContext {
1239
1242
  * code generation results of other modules (need to have a codeGenerationDependency to use that)
1240
1243
  */
1241
1244
  codeGenerationResults: CodeGenerationResults;
1245
+
1246
+ /**
1247
+ * the compilation
1248
+ */
1249
+ compilation?: Compilation;
1242
1250
  }
1243
1251
  declare interface CodeGenerationResult {
1244
1252
  /**
@@ -2454,7 +2462,7 @@ declare interface ContainerReferencePluginOptions {
2454
2462
  shareScope?: string;
2455
2463
  }
2456
2464
  declare abstract class ContextElementDependency extends ModuleDependency {
2457
- referencedExports: any;
2465
+ referencedExports?: string[][];
2458
2466
  }
2459
2467
  declare class ContextExclusionPlugin {
2460
2468
  constructor(negativeMatcher: RegExp);
@@ -2637,6 +2645,7 @@ declare class Dependency {
2637
2645
  endLine?: any,
2638
2646
  endColumn?: any
2639
2647
  ): void;
2648
+ getContext(): undefined | string;
2640
2649
  getResourceIdentifier(): null | string;
2641
2650
  couldAffectReferencingModule(): boolean | typeof TRANSITIVE;
2642
2651
 
@@ -3819,6 +3828,7 @@ declare interface ExpressionExpressionInfo {
3819
3828
  rootInfo: string | VariableInfo;
3820
3829
  name: string;
3821
3830
  getMembers: () => string[];
3831
+ getMembersOptionals: () => boolean[];
3822
3832
  }
3823
3833
  type ExternalItem =
3824
3834
  | string
@@ -5097,7 +5107,7 @@ declare class JavascriptParser extends Parser {
5097
5107
  topLevelAwait: SyncBailHook<[Expression], boolean | void>;
5098
5108
  call: HookMap<SyncBailHook<[Expression], boolean | void>>;
5099
5109
  callMemberChain: HookMap<
5100
- SyncBailHook<[CallExpression, string[]], boolean | void>
5110
+ SyncBailHook<[CallExpression, string[], boolean[]], boolean | void>
5101
5111
  >;
5102
5112
  memberChainOfCallMemberChain: HookMap<
5103
5113
  SyncBailHook<
@@ -5113,9 +5123,10 @@ declare class JavascriptParser extends Parser {
5113
5123
  >;
5114
5124
  optionalChaining: SyncBailHook<[ChainExpression], boolean | void>;
5115
5125
  new: HookMap<SyncBailHook<[NewExpression], boolean | void>>;
5126
+ binaryExpression: SyncBailHook<[BinaryExpression], boolean | void>;
5116
5127
  expression: HookMap<SyncBailHook<[Expression], boolean | void>>;
5117
5128
  expressionMemberChain: HookMap<
5118
- SyncBailHook<[Expression, string[]], boolean | void>
5129
+ SyncBailHook<[Expression, string[], boolean[]], boolean | void>
5119
5130
  >;
5120
5131
  unhandledExpressionMemberChain: HookMap<
5121
5132
  SyncBailHook<[Expression, string[]], boolean | void>
@@ -5183,7 +5194,7 @@ declare class JavascriptParser extends Parser {
5183
5194
  )[];
5184
5195
  prevStatement: any;
5185
5196
  currentTagData: any;
5186
- getRenameIdentifier(expr?: any): undefined | string;
5197
+ getRenameIdentifier(expr?: any): undefined | string | VariableInfoInterface;
5187
5198
  walkClass(classy: ClassExpression | ClassDeclaration): void;
5188
5199
  preWalkStatements(statements?: any): void;
5189
5200
  blockPreWalkStatements(statements?: any): void;
@@ -5330,12 +5341,10 @@ declare class JavascriptParser extends Parser {
5330
5341
  enterArrayPattern(pattern?: any, onIdent?: any): void;
5331
5342
  enterRestElement(pattern?: any, onIdent?: any): void;
5332
5343
  enterAssignmentPattern(pattern?: any, onIdent?: any): void;
5333
- evaluateExpression(
5334
- expression: Expression
5335
- ): undefined | BasicEvaluatedExpression;
5344
+ evaluateExpression(expression: Expression): BasicEvaluatedExpression;
5336
5345
  parseString(expression?: any): any;
5337
5346
  parseCalculatedString(expression?: any): any;
5338
- evaluate(source?: any): undefined | BasicEvaluatedExpression;
5347
+ evaluate(source: string): BasicEvaluatedExpression;
5339
5348
  isPure(
5340
5349
  expr:
5341
5350
  | undefined
@@ -5418,6 +5427,7 @@ declare class JavascriptParser extends Parser {
5418
5427
  | ImportExpression
5419
5428
  | ChainExpression
5420
5429
  | Super;
5430
+ membersOptionals: boolean[];
5421
5431
  };
5422
5432
  getFreeInfoFromVariable(varName: string): {
5423
5433
  name: string;
@@ -7481,11 +7491,11 @@ type NodeEstreeIndex =
7481
7491
  | PropertyDefinition
7482
7492
  | VariableDeclarator
7483
7493
  | Program
7484
- | Super
7485
7494
  | SwitchCase
7486
7495
  | CatchClause
7487
7496
  | Property
7488
7497
  | AssignmentProperty
7498
+ | Super
7489
7499
  | TemplateElement
7490
7500
  | SpreadElement
7491
7501
  | ObjectPattern