webpack 5.99.3 → 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.
- package/lib/javascript/JavascriptParser.js +51 -55
- package/package.json +1 -1
- package/types.d.ts +0 -1
@@ -2197,24 +2197,34 @@ class JavascriptParser extends Parser {
|
|
2197
2197
|
walkIfStatement(statement) {
|
2198
2198
|
const result = this.hooks.statementIf.call(statement);
|
2199
2199
|
if (result === undefined) {
|
2200
|
-
this.
|
2201
|
-
|
2202
|
-
this.walkNestedStatement(statement.consequent);
|
2203
|
-
});
|
2200
|
+
this.walkExpression(statement.test);
|
2201
|
+
this.walkNestedStatement(statement.consequent);
|
2204
2202
|
|
2205
|
-
|
2206
|
-
|
2207
|
-
|
2208
|
-
|
2209
|
-
|
2203
|
+
const consequentTerminated = this.scope.terminated;
|
2204
|
+
this.scope.terminated = undefined;
|
2205
|
+
|
2206
|
+
if (statement.alternate) {
|
2207
|
+
this.walkNestedStatement(statement.alternate);
|
2208
|
+
}
|
2209
|
+
|
2210
|
+
const alternateTerminated = this.scope.terminated;
|
2211
|
+
|
2212
|
+
this.scope.terminated =
|
2213
|
+
consequentTerminated && alternateTerminated
|
2214
|
+
? this.scope.terminated
|
2215
|
+
: undefined;
|
2210
2216
|
} else {
|
2211
|
-
this.inExecutedPath
|
2212
|
-
|
2213
|
-
|
2214
|
-
|
2215
|
-
|
2216
|
-
|
2217
|
-
})
|
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;
|
2218
2228
|
}
|
2219
2229
|
}
|
2220
2230
|
|
@@ -2234,7 +2244,9 @@ class JavascriptParser extends Parser {
|
|
2234
2244
|
const result = hook.call(statement);
|
2235
2245
|
if (result === true) return;
|
2236
2246
|
}
|
2237
|
-
this.
|
2247
|
+
this.inBlockScope(() => {
|
2248
|
+
this.walkNestedStatement(statement.body);
|
2249
|
+
});
|
2238
2250
|
}
|
2239
2251
|
|
2240
2252
|
/**
|
@@ -2248,8 +2260,10 @@ class JavascriptParser extends Parser {
|
|
2248
2260
|
* @param {WithStatement} statement with statement
|
2249
2261
|
*/
|
2250
2262
|
walkWithStatement(statement) {
|
2251
|
-
this.
|
2252
|
-
|
2263
|
+
this.inBlockScope(() => {
|
2264
|
+
this.walkExpression(statement.object);
|
2265
|
+
this.walkNestedStatement(statement.body);
|
2266
|
+
});
|
2253
2267
|
}
|
2254
2268
|
|
2255
2269
|
/**
|
@@ -2345,8 +2359,10 @@ class JavascriptParser extends Parser {
|
|
2345
2359
|
* @param {WhileStatement} statement while statement
|
2346
2360
|
*/
|
2347
2361
|
walkWhileStatement(statement) {
|
2348
|
-
this.
|
2349
|
-
|
2362
|
+
this.inBlockScope(() => {
|
2363
|
+
this.walkExpression(statement.test);
|
2364
|
+
this.walkNestedStatement(statement.body);
|
2365
|
+
});
|
2350
2366
|
}
|
2351
2367
|
|
2352
2368
|
/**
|
@@ -2360,8 +2376,10 @@ class JavascriptParser extends Parser {
|
|
2360
2376
|
* @param {DoWhileStatement} statement do while statement
|
2361
2377
|
*/
|
2362
2378
|
walkDoWhileStatement(statement) {
|
2363
|
-
this.
|
2364
|
-
|
2379
|
+
this.inBlockScope(() => {
|
2380
|
+
this.walkNestedStatement(statement.body);
|
2381
|
+
this.walkExpression(statement.test);
|
2382
|
+
});
|
2365
2383
|
}
|
2366
2384
|
|
2367
2385
|
/**
|
@@ -3479,21 +3497,16 @@ class JavascriptParser extends Parser {
|
|
3479
3497
|
walkConditionalExpression(expression) {
|
3480
3498
|
const result = this.hooks.expressionConditionalOperator.call(expression);
|
3481
3499
|
if (result === undefined) {
|
3482
|
-
this.
|
3483
|
-
|
3484
|
-
|
3485
|
-
|
3486
|
-
|
3487
|
-
|
3488
|
-
|
3489
|
-
|
3490
|
-
|
3491
|
-
|
3492
|
-
this.walkExpression(expression.consequent);
|
3493
|
-
} else if (expression.alternate) {
|
3494
|
-
this.walkExpression(expression.alternate);
|
3495
|
-
}
|
3496
|
-
});
|
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);
|
3497
3510
|
}
|
3498
3511
|
}
|
3499
3512
|
|
@@ -4077,23 +4090,6 @@ class JavascriptParser extends Parser {
|
|
4077
4090
|
this.scope = oldScope;
|
4078
4091
|
}
|
4079
4092
|
|
4080
|
-
/**
|
4081
|
-
* @param {boolean} state executed state
|
4082
|
-
* @param {() => void} fn inner function
|
4083
|
-
*/
|
4084
|
-
inExecutedPath(state, fn) {
|
4085
|
-
const oldState = this.scope.inExecutedPath;
|
4086
|
-
const oldTerminated = this.scope.terminated;
|
4087
|
-
this.scope.inExecutedPath = state;
|
4088
|
-
|
4089
|
-
fn();
|
4090
|
-
|
4091
|
-
if (!state) {
|
4092
|
-
this.scope.terminated = oldTerminated;
|
4093
|
-
}
|
4094
|
-
this.scope.inExecutedPath = oldState;
|
4095
|
-
}
|
4096
|
-
|
4097
4093
|
/**
|
4098
4094
|
* @param {boolean} hasThis true, when this is defined
|
4099
4095
|
* @param {Identifier[]} params scope params
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "webpack",
|
3
|
-
"version": "5.99.
|
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,
|