webpack 5.99.4 → 5.99.5

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.
@@ -2214,13 +2214,17 @@ class JavascriptParser extends Parser {
2214
2214
  ? this.scope.terminated
2215
2215
  : undefined;
2216
2216
  } else {
2217
- this.inExecutedPath(true, () => {
2218
- if (result) {
2219
- this.walkNestedStatement(statement.consequent);
2220
- } else if (statement.alternate) {
2221
- this.walkNestedStatement(statement.alternate);
2222
- }
2223
- });
2217
+ const oldState = this.scope.inExecutedPath;
2218
+
2219
+ this.scope.inExecutedPath = true;
2220
+
2221
+ if (result) {
2222
+ this.walkNestedStatement(statement.consequent);
2223
+ } else if (statement.alternate) {
2224
+ this.walkNestedStatement(statement.alternate);
2225
+ }
2226
+
2227
+ this.scope.inExecutedPath = oldState;
2224
2228
  }
2225
2229
  }
2226
2230
 
@@ -2240,7 +2244,9 @@ class JavascriptParser extends Parser {
2240
2244
  const result = hook.call(statement);
2241
2245
  if (result === true) return;
2242
2246
  }
2243
- this.walkNestedStatement(statement.body);
2247
+ this.inBlockScope(() => {
2248
+ this.walkNestedStatement(statement.body);
2249
+ });
2244
2250
  }
2245
2251
 
2246
2252
  /**
@@ -2254,8 +2260,10 @@ class JavascriptParser extends Parser {
2254
2260
  * @param {WithStatement} statement with statement
2255
2261
  */
2256
2262
  walkWithStatement(statement) {
2257
- this.walkExpression(statement.object);
2258
- this.walkNestedStatement(statement.body);
2263
+ this.inBlockScope(() => {
2264
+ this.walkExpression(statement.object);
2265
+ this.walkNestedStatement(statement.body);
2266
+ });
2259
2267
  }
2260
2268
 
2261
2269
  /**
@@ -2351,8 +2359,10 @@ class JavascriptParser extends Parser {
2351
2359
  * @param {WhileStatement} statement while statement
2352
2360
  */
2353
2361
  walkWhileStatement(statement) {
2354
- this.walkExpression(statement.test);
2355
- this.walkNestedStatement(statement.body);
2362
+ this.inBlockScope(() => {
2363
+ this.walkExpression(statement.test);
2364
+ this.walkNestedStatement(statement.body);
2365
+ });
2356
2366
  }
2357
2367
 
2358
2368
  /**
@@ -2366,8 +2376,10 @@ class JavascriptParser extends Parser {
2366
2376
  * @param {DoWhileStatement} statement do while statement
2367
2377
  */
2368
2378
  walkDoWhileStatement(statement) {
2369
- this.walkNestedStatement(statement.body);
2370
- this.walkExpression(statement.test);
2379
+ this.inBlockScope(() => {
2380
+ this.walkNestedStatement(statement.body);
2381
+ this.walkExpression(statement.test);
2382
+ });
2371
2383
  }
2372
2384
 
2373
2385
  /**
@@ -3485,21 +3497,16 @@ class JavascriptParser extends Parser {
3485
3497
  walkConditionalExpression(expression) {
3486
3498
  const result = this.hooks.expressionConditionalOperator.call(expression);
3487
3499
  if (result === undefined) {
3488
- this.inExecutedPath(false, () => {
3489
- this.walkExpression(expression.test);
3490
- this.walkExpression(expression.consequent);
3491
- if (expression.alternate) {
3492
- this.walkExpression(expression.alternate);
3493
- }
3494
- });
3495
- } else {
3496
- this.inExecutedPath(true, () => {
3497
- if (result) {
3498
- this.walkExpression(expression.consequent);
3499
- } else if (expression.alternate) {
3500
- this.walkExpression(expression.alternate);
3501
- }
3502
- });
3500
+ this.walkExpression(expression.test);
3501
+ this.walkExpression(expression.consequent);
3502
+
3503
+ if (expression.alternate) {
3504
+ this.walkExpression(expression.alternate);
3505
+ }
3506
+ } else if (result) {
3507
+ this.walkExpression(expression.consequent);
3508
+ } else if (expression.alternate) {
3509
+ this.walkExpression(expression.alternate);
3503
3510
  }
3504
3511
  }
3505
3512
 
@@ -4083,23 +4090,6 @@ class JavascriptParser extends Parser {
4083
4090
  this.scope = oldScope;
4084
4091
  }
4085
4092
 
4086
- /**
4087
- * @param {boolean} state executed state
4088
- * @param {() => void} fn inner function
4089
- */
4090
- inExecutedPath(state, fn) {
4091
- const oldState = this.scope.inExecutedPath;
4092
- const oldTerminated = this.scope.terminated;
4093
- this.scope.inExecutedPath = state;
4094
-
4095
- fn();
4096
-
4097
- if (!state) {
4098
- this.scope.terminated = oldTerminated;
4099
- }
4100
- this.scope.inExecutedPath = oldState;
4101
- }
4102
-
4103
4093
  /**
4104
4094
  * @param {boolean} hasThis true, when this is defined
4105
4095
  * @param {Identifier[]} params scope params
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webpack",
3
- "version": "5.99.4",
3
+ "version": "5.99.5",
4
4
  "author": "Tobias Koppers @sokra",
5
5
  "description": "Packs ECMAScript/CommonJs/AMD modules for the browser. Allows you to split your codebase into multiple bundles, which can be loaded on demand. Supports loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.",
6
6
  "license": "MIT",
package/types.d.ts CHANGED
@@ -7043,7 +7043,6 @@ declare class JavascriptParser extends Parser {
7043
7043
  )[],
7044
7044
  fn: () => void
7045
7045
  ): void;
7046
- inExecutedPath(state: boolean, fn: () => void): void;
7047
7046
  inClassScope(hasThis: boolean, params: Identifier[], fn: () => void): void;
7048
7047
  inFunctionScope(
7049
7048
  hasThis: boolean,