rollup 3.20.3-0 → 3.20.4
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/dist/bin/rollup +2 -2
- package/dist/es/rollup.js +2 -2
- package/dist/es/shared/node-entry.js +84 -94
- package/dist/es/shared/watch.js +2 -2
- package/dist/loadConfigFile.js +2 -2
- package/dist/rollup.js +2 -2
- package/dist/shared/fsevents-importer.js +2 -2
- package/dist/shared/index.js +2 -2
- package/dist/shared/loadConfigFile.js +2 -2
- package/dist/shared/rollup.js +84 -94
- package/dist/shared/watch-cli.js +2 -2
- package/dist/shared/watch-proxy.js +2 -2
- package/dist/shared/watch.js +2 -2
- package/package.json +1 -1
package/dist/bin/rollup
CHANGED
package/dist/es/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v3.20.
|
|
4
|
-
|
|
3
|
+
Rollup.js v3.20.4
|
|
4
|
+
Mon, 17 Apr 2023 05:03:36 GMT - commit baa03115f72163a0fc921074822a077444d49402
|
|
5
5
|
|
|
6
6
|
https://github.com/rollup/rollup
|
|
7
7
|
|
|
@@ -16,7 +16,7 @@ import { lstat, realpath, readdir, readFile, mkdir, writeFile } from 'node:fs/pr
|
|
|
16
16
|
import { EventEmitter } from 'node:events';
|
|
17
17
|
import * as tty from 'tty';
|
|
18
18
|
|
|
19
|
-
var version$1 = "3.20.
|
|
19
|
+
var version$1 = "3.20.4";
|
|
20
20
|
|
|
21
21
|
const comma = ','.charCodeAt(0);
|
|
22
22
|
const semicolon = ';'.charCodeAt(0);
|
|
@@ -5039,12 +5039,11 @@ const builtins = 'arguments Infinity NaN undefined null true false eval uneval i
|
|
|
5039
5039
|
const forbiddenIdentifiers = new Set(`${reservedWords$1} ${builtins}`.split(' '));
|
|
5040
5040
|
forbiddenIdentifiers.add('');
|
|
5041
5041
|
|
|
5042
|
-
const BROKEN_FLOW_NONE = 0;
|
|
5043
|
-
const BROKEN_FLOW_BREAK_CONTINUE = 1;
|
|
5044
|
-
const BROKEN_FLOW_ERROR_RETURN_LABEL = 2;
|
|
5045
5042
|
function createInclusionContext() {
|
|
5046
5043
|
return {
|
|
5047
|
-
brokenFlow:
|
|
5044
|
+
brokenFlow: false,
|
|
5045
|
+
hasBreak: false,
|
|
5046
|
+
hasContinue: false,
|
|
5048
5047
|
includedCallArguments: new Set(),
|
|
5049
5048
|
includedLabels: new Set()
|
|
5050
5049
|
};
|
|
@@ -5053,8 +5052,10 @@ function createHasEffectsContext() {
|
|
|
5053
5052
|
return {
|
|
5054
5053
|
accessed: new PathTracker(),
|
|
5055
5054
|
assigned: new PathTracker(),
|
|
5056
|
-
brokenFlow:
|
|
5055
|
+
brokenFlow: false,
|
|
5057
5056
|
called: new DiscriminatedPathTracker(),
|
|
5057
|
+
hasBreak: false,
|
|
5058
|
+
hasContinue: false,
|
|
5058
5059
|
ignore: {
|
|
5059
5060
|
breaks: false,
|
|
5060
5061
|
continues: false,
|
|
@@ -8672,7 +8673,7 @@ class FunctionBase extends NodeBase {
|
|
|
8672
8673
|
this.applyDeoptimizations();
|
|
8673
8674
|
this.included = true;
|
|
8674
8675
|
const { brokenFlow } = context;
|
|
8675
|
-
context.brokenFlow =
|
|
8676
|
+
context.brokenFlow = false;
|
|
8676
8677
|
this.body.include(context, includeChildrenRecursively);
|
|
8677
8678
|
context.brokenFlow = brokenFlow;
|
|
8678
8679
|
}
|
|
@@ -9150,13 +9151,13 @@ class BreakStatement extends NodeBase {
|
|
|
9150
9151
|
if (!context.ignore.labels.has(this.label.name))
|
|
9151
9152
|
return true;
|
|
9152
9153
|
context.includedLabels.add(this.label.name);
|
|
9153
|
-
context.brokenFlow = BROKEN_FLOW_ERROR_RETURN_LABEL;
|
|
9154
9154
|
}
|
|
9155
9155
|
else {
|
|
9156
9156
|
if (!context.ignore.breaks)
|
|
9157
9157
|
return true;
|
|
9158
|
-
context.
|
|
9158
|
+
context.hasBreak = true;
|
|
9159
9159
|
}
|
|
9160
|
+
context.brokenFlow = true;
|
|
9160
9161
|
return false;
|
|
9161
9162
|
}
|
|
9162
9163
|
include(context) {
|
|
@@ -9165,7 +9166,10 @@ class BreakStatement extends NodeBase {
|
|
|
9165
9166
|
this.label.include();
|
|
9166
9167
|
context.includedLabels.add(this.label.name);
|
|
9167
9168
|
}
|
|
9168
|
-
|
|
9169
|
+
else {
|
|
9170
|
+
context.hasBreak = true;
|
|
9171
|
+
}
|
|
9172
|
+
context.brokenFlow = true;
|
|
9169
9173
|
}
|
|
9170
9174
|
}
|
|
9171
9175
|
|
|
@@ -10238,13 +10242,13 @@ class ContinueStatement extends NodeBase {
|
|
|
10238
10242
|
if (!context.ignore.labels.has(this.label.name))
|
|
10239
10243
|
return true;
|
|
10240
10244
|
context.includedLabels.add(this.label.name);
|
|
10241
|
-
context.brokenFlow = BROKEN_FLOW_ERROR_RETURN_LABEL;
|
|
10242
10245
|
}
|
|
10243
10246
|
else {
|
|
10244
10247
|
if (!context.ignore.continues)
|
|
10245
10248
|
return true;
|
|
10246
|
-
context.
|
|
10249
|
+
context.hasContinue = true;
|
|
10247
10250
|
}
|
|
10251
|
+
context.brokenFlow = true;
|
|
10248
10252
|
return false;
|
|
10249
10253
|
}
|
|
10250
10254
|
include(context) {
|
|
@@ -10253,31 +10257,49 @@ class ContinueStatement extends NodeBase {
|
|
|
10253
10257
|
this.label.include();
|
|
10254
10258
|
context.includedLabels.add(this.label.name);
|
|
10255
10259
|
}
|
|
10256
|
-
|
|
10260
|
+
else {
|
|
10261
|
+
context.hasContinue = true;
|
|
10262
|
+
}
|
|
10263
|
+
context.brokenFlow = true;
|
|
10257
10264
|
}
|
|
10258
10265
|
}
|
|
10259
10266
|
|
|
10267
|
+
function hasLoopBodyEffects(context, body) {
|
|
10268
|
+
const { brokenFlow, hasBreak, hasContinue, ignore } = context;
|
|
10269
|
+
const { breaks, continues } = ignore;
|
|
10270
|
+
ignore.breaks = true;
|
|
10271
|
+
ignore.continues = true;
|
|
10272
|
+
context.hasBreak = false;
|
|
10273
|
+
context.hasContinue = false;
|
|
10274
|
+
if (body.hasEffects(context))
|
|
10275
|
+
return true;
|
|
10276
|
+
ignore.breaks = breaks;
|
|
10277
|
+
ignore.continues = continues;
|
|
10278
|
+
context.hasBreak = hasBreak;
|
|
10279
|
+
context.hasContinue = hasContinue;
|
|
10280
|
+
context.brokenFlow = brokenFlow;
|
|
10281
|
+
return false;
|
|
10282
|
+
}
|
|
10283
|
+
function includeLoopBody(context, body, includeChildrenRecursively) {
|
|
10284
|
+
const { brokenFlow, hasBreak, hasContinue } = context;
|
|
10285
|
+
context.hasBreak = false;
|
|
10286
|
+
context.hasContinue = false;
|
|
10287
|
+
body.include(context, includeChildrenRecursively, { asSingleStatement: true });
|
|
10288
|
+
context.hasBreak = hasBreak;
|
|
10289
|
+
context.hasContinue = hasContinue;
|
|
10290
|
+
context.brokenFlow = brokenFlow;
|
|
10291
|
+
}
|
|
10292
|
+
|
|
10260
10293
|
class DoWhileStatement extends NodeBase {
|
|
10261
10294
|
hasEffects(context) {
|
|
10262
10295
|
if (this.test.hasEffects(context))
|
|
10263
10296
|
return true;
|
|
10264
|
-
|
|
10265
|
-
const { breaks, continues } = ignore;
|
|
10266
|
-
ignore.breaks = true;
|
|
10267
|
-
ignore.continues = true;
|
|
10268
|
-
if (this.body.hasEffects(context))
|
|
10269
|
-
return true;
|
|
10270
|
-
ignore.breaks = breaks;
|
|
10271
|
-
ignore.continues = continues;
|
|
10272
|
-
context.brokenFlow = brokenFlow;
|
|
10273
|
-
return false;
|
|
10297
|
+
return hasLoopBodyEffects(context, this.body);
|
|
10274
10298
|
}
|
|
10275
10299
|
include(context, includeChildrenRecursively) {
|
|
10276
10300
|
this.included = true;
|
|
10277
10301
|
this.test.include(context, includeChildrenRecursively);
|
|
10278
|
-
|
|
10279
|
-
this.body.include(context, includeChildrenRecursively, { asSingleStatement: true });
|
|
10280
|
-
context.brokenFlow = brokenFlow;
|
|
10302
|
+
includeLoopBody(context, this.body, includeChildrenRecursively);
|
|
10281
10303
|
}
|
|
10282
10304
|
}
|
|
10283
10305
|
|
|
@@ -10443,16 +10465,7 @@ class ForInStatement extends NodeBase {
|
|
|
10443
10465
|
this.applyDeoptimizations();
|
|
10444
10466
|
if (left.hasEffectsAsAssignmentTarget(context, false) || right.hasEffects(context))
|
|
10445
10467
|
return true;
|
|
10446
|
-
|
|
10447
|
-
const { breaks, continues } = ignore;
|
|
10448
|
-
ignore.breaks = true;
|
|
10449
|
-
ignore.continues = true;
|
|
10450
|
-
if (body.hasEffects(context))
|
|
10451
|
-
return true;
|
|
10452
|
-
ignore.breaks = breaks;
|
|
10453
|
-
ignore.continues = continues;
|
|
10454
|
-
context.brokenFlow = brokenFlow;
|
|
10455
|
-
return false;
|
|
10468
|
+
return hasLoopBodyEffects(context, body);
|
|
10456
10469
|
}
|
|
10457
10470
|
include(context, includeChildrenRecursively) {
|
|
10458
10471
|
const { body, deoptimized, left, right } = this;
|
|
@@ -10461,9 +10474,7 @@ class ForInStatement extends NodeBase {
|
|
|
10461
10474
|
this.included = true;
|
|
10462
10475
|
left.includeAsAssignmentTarget(context, includeChildrenRecursively || true, false);
|
|
10463
10476
|
right.include(context, includeChildrenRecursively);
|
|
10464
|
-
|
|
10465
|
-
body.include(context, includeChildrenRecursively, { asSingleStatement: true });
|
|
10466
|
-
context.brokenFlow = brokenFlow;
|
|
10477
|
+
includeLoopBody(context, body, includeChildrenRecursively);
|
|
10467
10478
|
}
|
|
10468
10479
|
initialise() {
|
|
10469
10480
|
this.left.setAssignedValue(UNKNOWN_EXPRESSION);
|
|
@@ -10501,9 +10512,7 @@ class ForOfStatement extends NodeBase {
|
|
|
10501
10512
|
this.included = true;
|
|
10502
10513
|
left.includeAsAssignmentTarget(context, includeChildrenRecursively || true, false);
|
|
10503
10514
|
right.include(context, includeChildrenRecursively);
|
|
10504
|
-
|
|
10505
|
-
body.include(context, includeChildrenRecursively, { asSingleStatement: true });
|
|
10506
|
-
context.brokenFlow = brokenFlow;
|
|
10515
|
+
includeLoopBody(context, body, includeChildrenRecursively);
|
|
10507
10516
|
}
|
|
10508
10517
|
initialise() {
|
|
10509
10518
|
this.left.setAssignedValue(UNKNOWN_EXPRESSION);
|
|
@@ -10531,27 +10540,17 @@ class ForStatement extends NodeBase {
|
|
|
10531
10540
|
hasEffects(context) {
|
|
10532
10541
|
if (this.init?.hasEffects(context) ||
|
|
10533
10542
|
this.test?.hasEffects(context) ||
|
|
10534
|
-
this.update?.hasEffects(context))
|
|
10535
|
-
return true;
|
|
10536
|
-
const { brokenFlow, ignore } = context;
|
|
10537
|
-
const { breaks, continues } = ignore;
|
|
10538
|
-
ignore.breaks = true;
|
|
10539
|
-
ignore.continues = true;
|
|
10540
|
-
if (this.body.hasEffects(context))
|
|
10543
|
+
this.update?.hasEffects(context)) {
|
|
10541
10544
|
return true;
|
|
10542
|
-
|
|
10543
|
-
|
|
10544
|
-
context.brokenFlow = brokenFlow;
|
|
10545
|
-
return false;
|
|
10545
|
+
}
|
|
10546
|
+
return hasLoopBodyEffects(context, this.body);
|
|
10546
10547
|
}
|
|
10547
10548
|
include(context, includeChildrenRecursively) {
|
|
10548
10549
|
this.included = true;
|
|
10549
10550
|
this.init?.include(context, includeChildrenRecursively, { asSingleStatement: true });
|
|
10550
10551
|
this.test?.include(context, includeChildrenRecursively);
|
|
10551
|
-
const { brokenFlow } = context;
|
|
10552
10552
|
this.update?.include(context, includeChildrenRecursively);
|
|
10553
|
-
this.body
|
|
10554
|
-
context.brokenFlow = brokenFlow;
|
|
10553
|
+
includeLoopBody(context, this.body, includeChildrenRecursively);
|
|
10555
10554
|
}
|
|
10556
10555
|
render(code, options) {
|
|
10557
10556
|
this.init?.render(code, options, NO_SEMICOLON);
|
|
@@ -10607,9 +10606,8 @@ class IfStatement extends NodeBase {
|
|
|
10607
10606
|
return false;
|
|
10608
10607
|
if (this.alternate.hasEffects(context))
|
|
10609
10608
|
return true;
|
|
10610
|
-
|
|
10611
|
-
|
|
10612
|
-
context.brokenFlow < consequentBrokenFlow ? context.brokenFlow : consequentBrokenFlow;
|
|
10609
|
+
// eslint-disable-next-line unicorn/consistent-destructuring
|
|
10610
|
+
context.brokenFlow = context.brokenFlow && consequentBrokenFlow;
|
|
10613
10611
|
return false;
|
|
10614
10612
|
}
|
|
10615
10613
|
return testValue ? this.consequent.hasEffects(context) : !!this.alternate?.hasEffects(context);
|
|
@@ -10708,7 +10706,7 @@ class IfStatement extends NodeBase {
|
|
|
10708
10706
|
includeUnknownTest(context) {
|
|
10709
10707
|
this.test.include(context, false);
|
|
10710
10708
|
const { brokenFlow } = context;
|
|
10711
|
-
let consequentBrokenFlow =
|
|
10709
|
+
let consequentBrokenFlow = false;
|
|
10712
10710
|
if (this.consequent.shouldBeIncluded(context)) {
|
|
10713
10711
|
this.consequent.include(context, false, { asSingleStatement: true });
|
|
10714
10712
|
// eslint-disable-next-line unicorn/consistent-destructuring
|
|
@@ -10717,9 +10715,8 @@ class IfStatement extends NodeBase {
|
|
|
10717
10715
|
}
|
|
10718
10716
|
if (this.alternate?.shouldBeIncluded(context)) {
|
|
10719
10717
|
this.alternate.include(context, false, { asSingleStatement: true });
|
|
10720
|
-
|
|
10721
|
-
|
|
10722
|
-
context.brokenFlow < consequentBrokenFlow ? context.brokenFlow : consequentBrokenFlow;
|
|
10718
|
+
// eslint-disable-next-line unicorn/consistent-destructuring
|
|
10719
|
+
context.brokenFlow = context.brokenFlow && consequentBrokenFlow;
|
|
10723
10720
|
}
|
|
10724
10721
|
}
|
|
10725
10722
|
renderHoistedDeclarations(hoistedDeclarations, code, getPropertyAccess) {
|
|
@@ -11770,13 +11767,13 @@ class ReturnStatement extends NodeBase {
|
|
|
11770
11767
|
hasEffects(context) {
|
|
11771
11768
|
if (!context.ignore.returnYield || this.argument?.hasEffects(context))
|
|
11772
11769
|
return true;
|
|
11773
|
-
context.brokenFlow =
|
|
11770
|
+
context.brokenFlow = true;
|
|
11774
11771
|
return false;
|
|
11775
11772
|
}
|
|
11776
11773
|
include(context, includeChildrenRecursively) {
|
|
11777
11774
|
this.included = true;
|
|
11778
11775
|
this.argument?.include(context, includeChildrenRecursively);
|
|
11779
|
-
context.brokenFlow =
|
|
11776
|
+
context.brokenFlow = true;
|
|
11780
11777
|
}
|
|
11781
11778
|
initialise() {
|
|
11782
11779
|
this.scope.addReturnExpression(this.argument || UNKNOWN_EXPRESSION);
|
|
@@ -11943,28 +11940,32 @@ class SwitchStatement extends NodeBase {
|
|
|
11943
11940
|
hasEffects(context) {
|
|
11944
11941
|
if (this.discriminant.hasEffects(context))
|
|
11945
11942
|
return true;
|
|
11946
|
-
const { brokenFlow, ignore } = context;
|
|
11943
|
+
const { brokenFlow, hasBreak, ignore } = context;
|
|
11947
11944
|
const { breaks } = ignore;
|
|
11948
|
-
let minBrokenFlow = Infinity;
|
|
11949
11945
|
ignore.breaks = true;
|
|
11946
|
+
context.hasBreak = false;
|
|
11947
|
+
let onlyHasBrokenFlow = true;
|
|
11950
11948
|
for (const switchCase of this.cases) {
|
|
11951
11949
|
if (switchCase.hasEffects(context))
|
|
11952
11950
|
return true;
|
|
11953
11951
|
// eslint-disable-next-line unicorn/consistent-destructuring
|
|
11954
|
-
|
|
11952
|
+
onlyHasBrokenFlow && (onlyHasBrokenFlow = context.brokenFlow && !context.hasBreak);
|
|
11953
|
+
context.hasBreak = false;
|
|
11955
11954
|
context.brokenFlow = brokenFlow;
|
|
11956
11955
|
}
|
|
11957
|
-
if (this.defaultCase !== null
|
|
11958
|
-
context.brokenFlow =
|
|
11956
|
+
if (this.defaultCase !== null) {
|
|
11957
|
+
context.brokenFlow = onlyHasBrokenFlow;
|
|
11959
11958
|
}
|
|
11960
11959
|
ignore.breaks = breaks;
|
|
11960
|
+
context.hasBreak = hasBreak;
|
|
11961
11961
|
return false;
|
|
11962
11962
|
}
|
|
11963
11963
|
include(context, includeChildrenRecursively) {
|
|
11964
11964
|
this.included = true;
|
|
11965
11965
|
this.discriminant.include(context, includeChildrenRecursively);
|
|
11966
|
-
const { brokenFlow } = context;
|
|
11967
|
-
|
|
11966
|
+
const { brokenFlow, hasBreak } = context;
|
|
11967
|
+
context.hasBreak = false;
|
|
11968
|
+
let onlyHasBrokenFlow = true;
|
|
11968
11969
|
let isCaseIncluded = includeChildrenRecursively ||
|
|
11969
11970
|
(this.defaultCase !== null && this.defaultCase < this.cases.length - 1);
|
|
11970
11971
|
for (let caseIndex = this.cases.length - 1; caseIndex >= 0; caseIndex--) {
|
|
@@ -11980,18 +11981,18 @@ class SwitchStatement extends NodeBase {
|
|
|
11980
11981
|
if (isCaseIncluded) {
|
|
11981
11982
|
switchCase.include(context, includeChildrenRecursively);
|
|
11982
11983
|
// eslint-disable-next-line unicorn/consistent-destructuring
|
|
11983
|
-
|
|
11984
|
+
onlyHasBrokenFlow && (onlyHasBrokenFlow = context.brokenFlow && !context.hasBreak);
|
|
11985
|
+
context.hasBreak = false;
|
|
11984
11986
|
context.brokenFlow = brokenFlow;
|
|
11985
11987
|
}
|
|
11986
11988
|
else {
|
|
11987
|
-
|
|
11989
|
+
onlyHasBrokenFlow = brokenFlow;
|
|
11988
11990
|
}
|
|
11989
11991
|
}
|
|
11990
|
-
if (isCaseIncluded &&
|
|
11991
|
-
|
|
11992
|
-
!(minBrokenFlow === BROKEN_FLOW_BREAK_CONTINUE)) {
|
|
11993
|
-
context.brokenFlow = minBrokenFlow;
|
|
11992
|
+
if (isCaseIncluded && this.defaultCase !== null) {
|
|
11993
|
+
context.brokenFlow = onlyHasBrokenFlow;
|
|
11994
11994
|
}
|
|
11995
|
+
context.hasBreak = hasBreak;
|
|
11995
11996
|
}
|
|
11996
11997
|
initialise() {
|
|
11997
11998
|
for (let caseIndex = 0; caseIndex < this.cases.length; caseIndex++) {
|
|
@@ -12284,7 +12285,7 @@ class ThrowStatement extends NodeBase {
|
|
|
12284
12285
|
include(context, includeChildrenRecursively) {
|
|
12285
12286
|
this.included = true;
|
|
12286
12287
|
this.argument.include(context, includeChildrenRecursively);
|
|
12287
|
-
context.brokenFlow =
|
|
12288
|
+
context.brokenFlow = true;
|
|
12288
12289
|
}
|
|
12289
12290
|
render(code, options) {
|
|
12290
12291
|
this.argument.render(code, options, { preventASI: true });
|
|
@@ -12678,23 +12679,12 @@ class WhileStatement extends NodeBase {
|
|
|
12678
12679
|
hasEffects(context) {
|
|
12679
12680
|
if (this.test.hasEffects(context))
|
|
12680
12681
|
return true;
|
|
12681
|
-
|
|
12682
|
-
const { breaks, continues } = ignore;
|
|
12683
|
-
ignore.breaks = true;
|
|
12684
|
-
ignore.continues = true;
|
|
12685
|
-
if (this.body.hasEffects(context))
|
|
12686
|
-
return true;
|
|
12687
|
-
ignore.breaks = breaks;
|
|
12688
|
-
ignore.continues = continues;
|
|
12689
|
-
context.brokenFlow = brokenFlow;
|
|
12690
|
-
return false;
|
|
12682
|
+
return hasLoopBodyEffects(context, this.body);
|
|
12691
12683
|
}
|
|
12692
12684
|
include(context, includeChildrenRecursively) {
|
|
12693
12685
|
this.included = true;
|
|
12694
12686
|
this.test.include(context, includeChildrenRecursively);
|
|
12695
|
-
|
|
12696
|
-
this.body.include(context, includeChildrenRecursively, { asSingleStatement: true });
|
|
12697
|
-
context.brokenFlow = brokenFlow;
|
|
12687
|
+
includeLoopBody(context, this.body, includeChildrenRecursively);
|
|
12698
12688
|
}
|
|
12699
12689
|
}
|
|
12700
12690
|
|
package/dist/es/shared/watch.js
CHANGED
package/dist/loadConfigFile.js
CHANGED
package/dist/rollup.js
CHANGED
package/dist/shared/index.js
CHANGED
package/dist/shared/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v3.20.
|
|
4
|
-
|
|
3
|
+
Rollup.js v3.20.4
|
|
4
|
+
Mon, 17 Apr 2023 05:03:36 GMT - commit baa03115f72163a0fc921074822a077444d49402
|
|
5
5
|
|
|
6
6
|
https://github.com/rollup/rollup
|
|
7
7
|
|
|
@@ -31,7 +31,7 @@ function _interopNamespaceDefault(e) {
|
|
|
31
31
|
|
|
32
32
|
const tty__namespace = /*#__PURE__*/_interopNamespaceDefault(tty);
|
|
33
33
|
|
|
34
|
-
var version$1 = "3.20.
|
|
34
|
+
var version$1 = "3.20.4";
|
|
35
35
|
|
|
36
36
|
function ensureArray$1(items) {
|
|
37
37
|
if (Array.isArray(items)) {
|
|
@@ -5537,12 +5537,11 @@ const builtins = 'arguments Infinity NaN undefined null true false eval uneval i
|
|
|
5537
5537
|
const forbiddenIdentifiers = new Set(`${reservedWords$1} ${builtins}`.split(' '));
|
|
5538
5538
|
forbiddenIdentifiers.add('');
|
|
5539
5539
|
|
|
5540
|
-
const BROKEN_FLOW_NONE = 0;
|
|
5541
|
-
const BROKEN_FLOW_BREAK_CONTINUE = 1;
|
|
5542
|
-
const BROKEN_FLOW_ERROR_RETURN_LABEL = 2;
|
|
5543
5540
|
function createInclusionContext() {
|
|
5544
5541
|
return {
|
|
5545
|
-
brokenFlow:
|
|
5542
|
+
brokenFlow: false,
|
|
5543
|
+
hasBreak: false,
|
|
5544
|
+
hasContinue: false,
|
|
5546
5545
|
includedCallArguments: new Set(),
|
|
5547
5546
|
includedLabels: new Set()
|
|
5548
5547
|
};
|
|
@@ -5551,8 +5550,10 @@ function createHasEffectsContext() {
|
|
|
5551
5550
|
return {
|
|
5552
5551
|
accessed: new PathTracker(),
|
|
5553
5552
|
assigned: new PathTracker(),
|
|
5554
|
-
brokenFlow:
|
|
5553
|
+
brokenFlow: false,
|
|
5555
5554
|
called: new DiscriminatedPathTracker(),
|
|
5555
|
+
hasBreak: false,
|
|
5556
|
+
hasContinue: false,
|
|
5556
5557
|
ignore: {
|
|
5557
5558
|
breaks: false,
|
|
5558
5559
|
continues: false,
|
|
@@ -9170,7 +9171,7 @@ class FunctionBase extends NodeBase {
|
|
|
9170
9171
|
this.applyDeoptimizations();
|
|
9171
9172
|
this.included = true;
|
|
9172
9173
|
const { brokenFlow } = context;
|
|
9173
|
-
context.brokenFlow =
|
|
9174
|
+
context.brokenFlow = false;
|
|
9174
9175
|
this.body.include(context, includeChildrenRecursively);
|
|
9175
9176
|
context.brokenFlow = brokenFlow;
|
|
9176
9177
|
}
|
|
@@ -9648,13 +9649,13 @@ class BreakStatement extends NodeBase {
|
|
|
9648
9649
|
if (!context.ignore.labels.has(this.label.name))
|
|
9649
9650
|
return true;
|
|
9650
9651
|
context.includedLabels.add(this.label.name);
|
|
9651
|
-
context.brokenFlow = BROKEN_FLOW_ERROR_RETURN_LABEL;
|
|
9652
9652
|
}
|
|
9653
9653
|
else {
|
|
9654
9654
|
if (!context.ignore.breaks)
|
|
9655
9655
|
return true;
|
|
9656
|
-
context.
|
|
9656
|
+
context.hasBreak = true;
|
|
9657
9657
|
}
|
|
9658
|
+
context.brokenFlow = true;
|
|
9658
9659
|
return false;
|
|
9659
9660
|
}
|
|
9660
9661
|
include(context) {
|
|
@@ -9663,7 +9664,10 @@ class BreakStatement extends NodeBase {
|
|
|
9663
9664
|
this.label.include();
|
|
9664
9665
|
context.includedLabels.add(this.label.name);
|
|
9665
9666
|
}
|
|
9666
|
-
|
|
9667
|
+
else {
|
|
9668
|
+
context.hasBreak = true;
|
|
9669
|
+
}
|
|
9670
|
+
context.brokenFlow = true;
|
|
9667
9671
|
}
|
|
9668
9672
|
}
|
|
9669
9673
|
|
|
@@ -10736,13 +10740,13 @@ class ContinueStatement extends NodeBase {
|
|
|
10736
10740
|
if (!context.ignore.labels.has(this.label.name))
|
|
10737
10741
|
return true;
|
|
10738
10742
|
context.includedLabels.add(this.label.name);
|
|
10739
|
-
context.brokenFlow = BROKEN_FLOW_ERROR_RETURN_LABEL;
|
|
10740
10743
|
}
|
|
10741
10744
|
else {
|
|
10742
10745
|
if (!context.ignore.continues)
|
|
10743
10746
|
return true;
|
|
10744
|
-
context.
|
|
10747
|
+
context.hasContinue = true;
|
|
10745
10748
|
}
|
|
10749
|
+
context.brokenFlow = true;
|
|
10746
10750
|
return false;
|
|
10747
10751
|
}
|
|
10748
10752
|
include(context) {
|
|
@@ -10751,31 +10755,49 @@ class ContinueStatement extends NodeBase {
|
|
|
10751
10755
|
this.label.include();
|
|
10752
10756
|
context.includedLabels.add(this.label.name);
|
|
10753
10757
|
}
|
|
10754
|
-
|
|
10758
|
+
else {
|
|
10759
|
+
context.hasContinue = true;
|
|
10760
|
+
}
|
|
10761
|
+
context.brokenFlow = true;
|
|
10755
10762
|
}
|
|
10756
10763
|
}
|
|
10757
10764
|
|
|
10765
|
+
function hasLoopBodyEffects(context, body) {
|
|
10766
|
+
const { brokenFlow, hasBreak, hasContinue, ignore } = context;
|
|
10767
|
+
const { breaks, continues } = ignore;
|
|
10768
|
+
ignore.breaks = true;
|
|
10769
|
+
ignore.continues = true;
|
|
10770
|
+
context.hasBreak = false;
|
|
10771
|
+
context.hasContinue = false;
|
|
10772
|
+
if (body.hasEffects(context))
|
|
10773
|
+
return true;
|
|
10774
|
+
ignore.breaks = breaks;
|
|
10775
|
+
ignore.continues = continues;
|
|
10776
|
+
context.hasBreak = hasBreak;
|
|
10777
|
+
context.hasContinue = hasContinue;
|
|
10778
|
+
context.brokenFlow = brokenFlow;
|
|
10779
|
+
return false;
|
|
10780
|
+
}
|
|
10781
|
+
function includeLoopBody(context, body, includeChildrenRecursively) {
|
|
10782
|
+
const { brokenFlow, hasBreak, hasContinue } = context;
|
|
10783
|
+
context.hasBreak = false;
|
|
10784
|
+
context.hasContinue = false;
|
|
10785
|
+
body.include(context, includeChildrenRecursively, { asSingleStatement: true });
|
|
10786
|
+
context.hasBreak = hasBreak;
|
|
10787
|
+
context.hasContinue = hasContinue;
|
|
10788
|
+
context.brokenFlow = brokenFlow;
|
|
10789
|
+
}
|
|
10790
|
+
|
|
10758
10791
|
class DoWhileStatement extends NodeBase {
|
|
10759
10792
|
hasEffects(context) {
|
|
10760
10793
|
if (this.test.hasEffects(context))
|
|
10761
10794
|
return true;
|
|
10762
|
-
|
|
10763
|
-
const { breaks, continues } = ignore;
|
|
10764
|
-
ignore.breaks = true;
|
|
10765
|
-
ignore.continues = true;
|
|
10766
|
-
if (this.body.hasEffects(context))
|
|
10767
|
-
return true;
|
|
10768
|
-
ignore.breaks = breaks;
|
|
10769
|
-
ignore.continues = continues;
|
|
10770
|
-
context.brokenFlow = brokenFlow;
|
|
10771
|
-
return false;
|
|
10795
|
+
return hasLoopBodyEffects(context, this.body);
|
|
10772
10796
|
}
|
|
10773
10797
|
include(context, includeChildrenRecursively) {
|
|
10774
10798
|
this.included = true;
|
|
10775
10799
|
this.test.include(context, includeChildrenRecursively);
|
|
10776
|
-
|
|
10777
|
-
this.body.include(context, includeChildrenRecursively, { asSingleStatement: true });
|
|
10778
|
-
context.brokenFlow = brokenFlow;
|
|
10800
|
+
includeLoopBody(context, this.body, includeChildrenRecursively);
|
|
10779
10801
|
}
|
|
10780
10802
|
}
|
|
10781
10803
|
|
|
@@ -10941,16 +10963,7 @@ class ForInStatement extends NodeBase {
|
|
|
10941
10963
|
this.applyDeoptimizations();
|
|
10942
10964
|
if (left.hasEffectsAsAssignmentTarget(context, false) || right.hasEffects(context))
|
|
10943
10965
|
return true;
|
|
10944
|
-
|
|
10945
|
-
const { breaks, continues } = ignore;
|
|
10946
|
-
ignore.breaks = true;
|
|
10947
|
-
ignore.continues = true;
|
|
10948
|
-
if (body.hasEffects(context))
|
|
10949
|
-
return true;
|
|
10950
|
-
ignore.breaks = breaks;
|
|
10951
|
-
ignore.continues = continues;
|
|
10952
|
-
context.brokenFlow = brokenFlow;
|
|
10953
|
-
return false;
|
|
10966
|
+
return hasLoopBodyEffects(context, body);
|
|
10954
10967
|
}
|
|
10955
10968
|
include(context, includeChildrenRecursively) {
|
|
10956
10969
|
const { body, deoptimized, left, right } = this;
|
|
@@ -10959,9 +10972,7 @@ class ForInStatement extends NodeBase {
|
|
|
10959
10972
|
this.included = true;
|
|
10960
10973
|
left.includeAsAssignmentTarget(context, includeChildrenRecursively || true, false);
|
|
10961
10974
|
right.include(context, includeChildrenRecursively);
|
|
10962
|
-
|
|
10963
|
-
body.include(context, includeChildrenRecursively, { asSingleStatement: true });
|
|
10964
|
-
context.brokenFlow = brokenFlow;
|
|
10975
|
+
includeLoopBody(context, body, includeChildrenRecursively);
|
|
10965
10976
|
}
|
|
10966
10977
|
initialise() {
|
|
10967
10978
|
this.left.setAssignedValue(UNKNOWN_EXPRESSION);
|
|
@@ -10999,9 +11010,7 @@ class ForOfStatement extends NodeBase {
|
|
|
10999
11010
|
this.included = true;
|
|
11000
11011
|
left.includeAsAssignmentTarget(context, includeChildrenRecursively || true, false);
|
|
11001
11012
|
right.include(context, includeChildrenRecursively);
|
|
11002
|
-
|
|
11003
|
-
body.include(context, includeChildrenRecursively, { asSingleStatement: true });
|
|
11004
|
-
context.brokenFlow = brokenFlow;
|
|
11013
|
+
includeLoopBody(context, body, includeChildrenRecursively);
|
|
11005
11014
|
}
|
|
11006
11015
|
initialise() {
|
|
11007
11016
|
this.left.setAssignedValue(UNKNOWN_EXPRESSION);
|
|
@@ -11029,27 +11038,17 @@ class ForStatement extends NodeBase {
|
|
|
11029
11038
|
hasEffects(context) {
|
|
11030
11039
|
if (this.init?.hasEffects(context) ||
|
|
11031
11040
|
this.test?.hasEffects(context) ||
|
|
11032
|
-
this.update?.hasEffects(context))
|
|
11033
|
-
return true;
|
|
11034
|
-
const { brokenFlow, ignore } = context;
|
|
11035
|
-
const { breaks, continues } = ignore;
|
|
11036
|
-
ignore.breaks = true;
|
|
11037
|
-
ignore.continues = true;
|
|
11038
|
-
if (this.body.hasEffects(context))
|
|
11041
|
+
this.update?.hasEffects(context)) {
|
|
11039
11042
|
return true;
|
|
11040
|
-
|
|
11041
|
-
|
|
11042
|
-
context.brokenFlow = brokenFlow;
|
|
11043
|
-
return false;
|
|
11043
|
+
}
|
|
11044
|
+
return hasLoopBodyEffects(context, this.body);
|
|
11044
11045
|
}
|
|
11045
11046
|
include(context, includeChildrenRecursively) {
|
|
11046
11047
|
this.included = true;
|
|
11047
11048
|
this.init?.include(context, includeChildrenRecursively, { asSingleStatement: true });
|
|
11048
11049
|
this.test?.include(context, includeChildrenRecursively);
|
|
11049
|
-
const { brokenFlow } = context;
|
|
11050
11050
|
this.update?.include(context, includeChildrenRecursively);
|
|
11051
|
-
this.body
|
|
11052
|
-
context.brokenFlow = brokenFlow;
|
|
11051
|
+
includeLoopBody(context, this.body, includeChildrenRecursively);
|
|
11053
11052
|
}
|
|
11054
11053
|
render(code, options) {
|
|
11055
11054
|
this.init?.render(code, options, NO_SEMICOLON);
|
|
@@ -11105,9 +11104,8 @@ class IfStatement extends NodeBase {
|
|
|
11105
11104
|
return false;
|
|
11106
11105
|
if (this.alternate.hasEffects(context))
|
|
11107
11106
|
return true;
|
|
11108
|
-
|
|
11109
|
-
|
|
11110
|
-
context.brokenFlow < consequentBrokenFlow ? context.brokenFlow : consequentBrokenFlow;
|
|
11107
|
+
// eslint-disable-next-line unicorn/consistent-destructuring
|
|
11108
|
+
context.brokenFlow = context.brokenFlow && consequentBrokenFlow;
|
|
11111
11109
|
return false;
|
|
11112
11110
|
}
|
|
11113
11111
|
return testValue ? this.consequent.hasEffects(context) : !!this.alternate?.hasEffects(context);
|
|
@@ -11206,7 +11204,7 @@ class IfStatement extends NodeBase {
|
|
|
11206
11204
|
includeUnknownTest(context) {
|
|
11207
11205
|
this.test.include(context, false);
|
|
11208
11206
|
const { brokenFlow } = context;
|
|
11209
|
-
let consequentBrokenFlow =
|
|
11207
|
+
let consequentBrokenFlow = false;
|
|
11210
11208
|
if (this.consequent.shouldBeIncluded(context)) {
|
|
11211
11209
|
this.consequent.include(context, false, { asSingleStatement: true });
|
|
11212
11210
|
// eslint-disable-next-line unicorn/consistent-destructuring
|
|
@@ -11215,9 +11213,8 @@ class IfStatement extends NodeBase {
|
|
|
11215
11213
|
}
|
|
11216
11214
|
if (this.alternate?.shouldBeIncluded(context)) {
|
|
11217
11215
|
this.alternate.include(context, false, { asSingleStatement: true });
|
|
11218
|
-
|
|
11219
|
-
|
|
11220
|
-
context.brokenFlow < consequentBrokenFlow ? context.brokenFlow : consequentBrokenFlow;
|
|
11216
|
+
// eslint-disable-next-line unicorn/consistent-destructuring
|
|
11217
|
+
context.brokenFlow = context.brokenFlow && consequentBrokenFlow;
|
|
11221
11218
|
}
|
|
11222
11219
|
}
|
|
11223
11220
|
renderHoistedDeclarations(hoistedDeclarations, code, getPropertyAccess) {
|
|
@@ -12268,13 +12265,13 @@ class ReturnStatement extends NodeBase {
|
|
|
12268
12265
|
hasEffects(context) {
|
|
12269
12266
|
if (!context.ignore.returnYield || this.argument?.hasEffects(context))
|
|
12270
12267
|
return true;
|
|
12271
|
-
context.brokenFlow =
|
|
12268
|
+
context.brokenFlow = true;
|
|
12272
12269
|
return false;
|
|
12273
12270
|
}
|
|
12274
12271
|
include(context, includeChildrenRecursively) {
|
|
12275
12272
|
this.included = true;
|
|
12276
12273
|
this.argument?.include(context, includeChildrenRecursively);
|
|
12277
|
-
context.brokenFlow =
|
|
12274
|
+
context.brokenFlow = true;
|
|
12278
12275
|
}
|
|
12279
12276
|
initialise() {
|
|
12280
12277
|
this.scope.addReturnExpression(this.argument || UNKNOWN_EXPRESSION);
|
|
@@ -12441,28 +12438,32 @@ class SwitchStatement extends NodeBase {
|
|
|
12441
12438
|
hasEffects(context) {
|
|
12442
12439
|
if (this.discriminant.hasEffects(context))
|
|
12443
12440
|
return true;
|
|
12444
|
-
const { brokenFlow, ignore } = context;
|
|
12441
|
+
const { brokenFlow, hasBreak, ignore } = context;
|
|
12445
12442
|
const { breaks } = ignore;
|
|
12446
|
-
let minBrokenFlow = Infinity;
|
|
12447
12443
|
ignore.breaks = true;
|
|
12444
|
+
context.hasBreak = false;
|
|
12445
|
+
let onlyHasBrokenFlow = true;
|
|
12448
12446
|
for (const switchCase of this.cases) {
|
|
12449
12447
|
if (switchCase.hasEffects(context))
|
|
12450
12448
|
return true;
|
|
12451
12449
|
// eslint-disable-next-line unicorn/consistent-destructuring
|
|
12452
|
-
|
|
12450
|
+
onlyHasBrokenFlow && (onlyHasBrokenFlow = context.brokenFlow && !context.hasBreak);
|
|
12451
|
+
context.hasBreak = false;
|
|
12453
12452
|
context.brokenFlow = brokenFlow;
|
|
12454
12453
|
}
|
|
12455
|
-
if (this.defaultCase !== null
|
|
12456
|
-
context.brokenFlow =
|
|
12454
|
+
if (this.defaultCase !== null) {
|
|
12455
|
+
context.brokenFlow = onlyHasBrokenFlow;
|
|
12457
12456
|
}
|
|
12458
12457
|
ignore.breaks = breaks;
|
|
12458
|
+
context.hasBreak = hasBreak;
|
|
12459
12459
|
return false;
|
|
12460
12460
|
}
|
|
12461
12461
|
include(context, includeChildrenRecursively) {
|
|
12462
12462
|
this.included = true;
|
|
12463
12463
|
this.discriminant.include(context, includeChildrenRecursively);
|
|
12464
|
-
const { brokenFlow } = context;
|
|
12465
|
-
|
|
12464
|
+
const { brokenFlow, hasBreak } = context;
|
|
12465
|
+
context.hasBreak = false;
|
|
12466
|
+
let onlyHasBrokenFlow = true;
|
|
12466
12467
|
let isCaseIncluded = includeChildrenRecursively ||
|
|
12467
12468
|
(this.defaultCase !== null && this.defaultCase < this.cases.length - 1);
|
|
12468
12469
|
for (let caseIndex = this.cases.length - 1; caseIndex >= 0; caseIndex--) {
|
|
@@ -12478,18 +12479,18 @@ class SwitchStatement extends NodeBase {
|
|
|
12478
12479
|
if (isCaseIncluded) {
|
|
12479
12480
|
switchCase.include(context, includeChildrenRecursively);
|
|
12480
12481
|
// eslint-disable-next-line unicorn/consistent-destructuring
|
|
12481
|
-
|
|
12482
|
+
onlyHasBrokenFlow && (onlyHasBrokenFlow = context.brokenFlow && !context.hasBreak);
|
|
12483
|
+
context.hasBreak = false;
|
|
12482
12484
|
context.brokenFlow = brokenFlow;
|
|
12483
12485
|
}
|
|
12484
12486
|
else {
|
|
12485
|
-
|
|
12487
|
+
onlyHasBrokenFlow = brokenFlow;
|
|
12486
12488
|
}
|
|
12487
12489
|
}
|
|
12488
|
-
if (isCaseIncluded &&
|
|
12489
|
-
|
|
12490
|
-
!(minBrokenFlow === BROKEN_FLOW_BREAK_CONTINUE)) {
|
|
12491
|
-
context.brokenFlow = minBrokenFlow;
|
|
12490
|
+
if (isCaseIncluded && this.defaultCase !== null) {
|
|
12491
|
+
context.brokenFlow = onlyHasBrokenFlow;
|
|
12492
12492
|
}
|
|
12493
|
+
context.hasBreak = hasBreak;
|
|
12493
12494
|
}
|
|
12494
12495
|
initialise() {
|
|
12495
12496
|
for (let caseIndex = 0; caseIndex < this.cases.length; caseIndex++) {
|
|
@@ -12782,7 +12783,7 @@ class ThrowStatement extends NodeBase {
|
|
|
12782
12783
|
include(context, includeChildrenRecursively) {
|
|
12783
12784
|
this.included = true;
|
|
12784
12785
|
this.argument.include(context, includeChildrenRecursively);
|
|
12785
|
-
context.brokenFlow =
|
|
12786
|
+
context.brokenFlow = true;
|
|
12786
12787
|
}
|
|
12787
12788
|
render(code, options) {
|
|
12788
12789
|
this.argument.render(code, options, { preventASI: true });
|
|
@@ -13176,23 +13177,12 @@ class WhileStatement extends NodeBase {
|
|
|
13176
13177
|
hasEffects(context) {
|
|
13177
13178
|
if (this.test.hasEffects(context))
|
|
13178
13179
|
return true;
|
|
13179
|
-
|
|
13180
|
-
const { breaks, continues } = ignore;
|
|
13181
|
-
ignore.breaks = true;
|
|
13182
|
-
ignore.continues = true;
|
|
13183
|
-
if (this.body.hasEffects(context))
|
|
13184
|
-
return true;
|
|
13185
|
-
ignore.breaks = breaks;
|
|
13186
|
-
ignore.continues = continues;
|
|
13187
|
-
context.brokenFlow = brokenFlow;
|
|
13188
|
-
return false;
|
|
13180
|
+
return hasLoopBodyEffects(context, this.body);
|
|
13189
13181
|
}
|
|
13190
13182
|
include(context, includeChildrenRecursively) {
|
|
13191
13183
|
this.included = true;
|
|
13192
13184
|
this.test.include(context, includeChildrenRecursively);
|
|
13193
|
-
|
|
13194
|
-
this.body.include(context, includeChildrenRecursively, { asSingleStatement: true });
|
|
13195
|
-
context.brokenFlow = brokenFlow;
|
|
13185
|
+
includeLoopBody(context, this.body, includeChildrenRecursively);
|
|
13196
13186
|
}
|
|
13197
13187
|
}
|
|
13198
13188
|
|
package/dist/shared/watch-cli.js
CHANGED
package/dist/shared/watch.js
CHANGED