webpack 5.99.0 → 5.99.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.
@@ -1952,10 +1952,19 @@ class JavascriptParser extends Parser {
1952
1952
  * @param {(Statement | ModuleDeclaration)[]} statements statements
1953
1953
  */
1954
1954
  walkStatements(statements) {
1955
+ let onlyFunctionDeclaration = false;
1956
+
1955
1957
  for (let index = 0, len = statements.length; index < len; index++) {
1956
1958
  const statement = statements[index];
1959
+
1960
+ if (onlyFunctionDeclaration && statement.type !== "FunctionDeclaration")
1961
+ continue;
1962
+
1957
1963
  this.walkStatement(statement);
1958
- if (this.scope.terminated) break;
1964
+
1965
+ if (this.scope.terminated) {
1966
+ onlyFunctionDeclaration = true;
1967
+ }
1959
1968
  }
1960
1969
  }
1961
1970
 
@@ -2302,13 +2311,24 @@ class JavascriptParser extends Parser {
2302
2311
  this.walkStatement(statement.block);
2303
2312
  this.scope.inTry = false;
2304
2313
  }
2305
- if (this.scope.terminated === "throw") {
2306
- this.scope.terminated = undefined;
2307
- } else if (this.scope.terminated === "return") {
2308
- return;
2309
- }
2314
+
2315
+ const tryTerminated = this.scope.terminated;
2316
+ this.scope.terminated = undefined;
2317
+
2310
2318
  if (statement.handler) this.walkCatchClause(statement.handler);
2319
+
2320
+ const handlerTerminated = this.scope.terminated;
2321
+ this.scope.terminated = undefined;
2322
+
2311
2323
  if (statement.finalizer) this.walkStatement(statement.finalizer);
2324
+
2325
+ if (
2326
+ !this.scope.terminated &&
2327
+ tryTerminated &&
2328
+ (statement.handler ? handlerTerminated : true)
2329
+ ) {
2330
+ this.scope.terminated = tryTerminated;
2331
+ }
2312
2332
  }
2313
2333
 
2314
2334
  /**
@@ -3001,7 +3021,7 @@ class JavascriptParser extends Parser {
3001
3021
  this.blockPreWalkStatement(catchClause.body);
3002
3022
  this.prevStatement = prev;
3003
3023
  this.walkStatement(catchClause.body);
3004
- });
3024
+ }, true);
3005
3025
  }
3006
3026
 
3007
3027
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webpack",
3
- "version": "5.99.0",
3
+ "version": "5.99.2",
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",