rollup 2.73.0 → 2.74.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.
- package/CHANGELOG.md +21 -0
- package/dist/bin/rollup +2 -2
- package/dist/es/rollup.browser.js +3 -3
- package/dist/es/rollup.js +2 -2
- package/dist/es/shared/rollup.js +1902 -1714
- package/dist/es/shared/watch.js +5 -5
- package/dist/loadConfigFile.js +3 -3
- package/dist/rollup.browser.js +3 -3
- package/dist/rollup.browser.js.map +1 -1
- package/dist/rollup.js +2 -2
- package/dist/shared/index.js +4 -4
- package/dist/shared/loadConfigFile.js +4 -5
- package/dist/shared/mergeOptions.js +2 -2
- package/dist/shared/rollup.js +1902 -1714
- package/dist/shared/watch-cli.js +2 -2
- package/dist/shared/watch.js +2 -2
- package/package.json +1 -1
package/dist/shared/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v2.
|
|
4
|
-
|
|
3
|
+
Rollup.js v2.74.0
|
|
4
|
+
Thu, 19 May 2022 05:01:43 GMT - commit fc99e96e09d26798f1c0aabdd7429307cc908c8e
|
|
5
5
|
|
|
6
6
|
https://github.com/rollup/rollup
|
|
7
7
|
|
|
@@ -27,7 +27,7 @@ function _interopNamespaceDefault(e) {
|
|
|
27
27
|
return n;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
var version$1 = "2.
|
|
30
|
+
var version$1 = "2.74.0";
|
|
31
31
|
|
|
32
32
|
function ensureArray$1(items) {
|
|
33
33
|
if (Array.isArray(items)) {
|
|
@@ -1865,7 +1865,7 @@ class MagicString {
|
|
|
1865
1865
|
const hasOwnProp = Object.prototype.hasOwnProperty;
|
|
1866
1866
|
|
|
1867
1867
|
class Bundle$1 {
|
|
1868
|
-
constructor(options
|
|
1868
|
+
constructor(options) {
|
|
1869
1869
|
this.intro = options.intro || '';
|
|
1870
1870
|
this.separator = options.separator !== undefined ? options.separator : '\n';
|
|
1871
1871
|
this.sources = [];
|
|
@@ -2222,6 +2222,7 @@ class DiscriminatedPathTracker {
|
|
|
2222
2222
|
}
|
|
2223
2223
|
|
|
2224
2224
|
const UnknownValue = Symbol('Unknown Value');
|
|
2225
|
+
const UnknownTruthyValue = Symbol('Unknown Truthy Value');
|
|
2225
2226
|
class ExpressionEntity {
|
|
2226
2227
|
constructor() {
|
|
2227
2228
|
this.included = false;
|
|
@@ -2250,14 +2251,17 @@ class ExpressionEntity {
|
|
|
2250
2251
|
hasEffectsWhenCalledAtPath(_path, _callOptions, _context) {
|
|
2251
2252
|
return true;
|
|
2252
2253
|
}
|
|
2253
|
-
include(_context, _includeChildrenRecursively) {
|
|
2254
|
+
include(_context, _includeChildrenRecursively, _options) {
|
|
2254
2255
|
this.included = true;
|
|
2255
2256
|
}
|
|
2256
|
-
|
|
2257
|
+
includeArgumentsWhenCalledAtPath(_path, context, args) {
|
|
2257
2258
|
for (const arg of args) {
|
|
2258
2259
|
arg.include(context, false);
|
|
2259
2260
|
}
|
|
2260
2261
|
}
|
|
2262
|
+
shouldBeIncluded(_context) {
|
|
2263
|
+
return true;
|
|
2264
|
+
}
|
|
2261
2265
|
}
|
|
2262
2266
|
const UNKNOWN_EXPRESSION = new (class UnknownExpression extends ExpressionEntity {
|
|
2263
2267
|
})();
|
|
@@ -4796,9 +4800,9 @@ const stringReplace = {
|
|
|
4796
4800
|
hasEffectsWhenCalled(callOptions, context) {
|
|
4797
4801
|
const arg1 = callOptions.args[1];
|
|
4798
4802
|
return (callOptions.args.length < 2 ||
|
|
4799
|
-
(arg1.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, {
|
|
4803
|
+
(typeof arg1.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, {
|
|
4800
4804
|
deoptimizeCache() { }
|
|
4801
|
-
}) ===
|
|
4805
|
+
}) === 'symbol' &&
|
|
4802
4806
|
arg1.hasEffectsWhenCalledAtPath(EMPTY_PATH, {
|
|
4803
4807
|
args: NO_ARGS,
|
|
4804
4808
|
thisParam: null,
|
|
@@ -5353,8 +5357,7 @@ class NodeBase extends ExpressionEntity {
|
|
|
5353
5357
|
continue;
|
|
5354
5358
|
if (Array.isArray(value)) {
|
|
5355
5359
|
for (const child of value) {
|
|
5356
|
-
|
|
5357
|
-
child.bind();
|
|
5360
|
+
child === null || child === void 0 ? void 0 : child.bind();
|
|
5358
5361
|
}
|
|
5359
5362
|
}
|
|
5360
5363
|
else {
|
|
@@ -5377,7 +5380,7 @@ class NodeBase extends ExpressionEntity {
|
|
|
5377
5380
|
continue;
|
|
5378
5381
|
if (Array.isArray(value)) {
|
|
5379
5382
|
for (const child of value) {
|
|
5380
|
-
if (child
|
|
5383
|
+
if (child === null || child === void 0 ? void 0 : child.hasEffects(context))
|
|
5381
5384
|
return true;
|
|
5382
5385
|
}
|
|
5383
5386
|
}
|
|
@@ -5386,7 +5389,7 @@ class NodeBase extends ExpressionEntity {
|
|
|
5386
5389
|
}
|
|
5387
5390
|
return false;
|
|
5388
5391
|
}
|
|
5389
|
-
include(context, includeChildrenRecursively) {
|
|
5392
|
+
include(context, includeChildrenRecursively, _options) {
|
|
5390
5393
|
if (this.deoptimized === false)
|
|
5391
5394
|
this.applyDeoptimizations();
|
|
5392
5395
|
this.included = true;
|
|
@@ -5396,8 +5399,7 @@ class NodeBase extends ExpressionEntity {
|
|
|
5396
5399
|
continue;
|
|
5397
5400
|
if (Array.isArray(value)) {
|
|
5398
5401
|
for (const child of value) {
|
|
5399
|
-
|
|
5400
|
-
child.include(context, includeChildrenRecursively);
|
|
5402
|
+
child === null || child === void 0 ? void 0 : child.include(context, includeChildrenRecursively);
|
|
5401
5403
|
}
|
|
5402
5404
|
}
|
|
5403
5405
|
else {
|
|
@@ -5405,9 +5407,6 @@ class NodeBase extends ExpressionEntity {
|
|
|
5405
5407
|
}
|
|
5406
5408
|
}
|
|
5407
5409
|
}
|
|
5408
|
-
includeAsSingleStatement(context, includeChildrenRecursively) {
|
|
5409
|
-
this.include(context, includeChildrenRecursively);
|
|
5410
|
-
}
|
|
5411
5410
|
/**
|
|
5412
5411
|
* Override to perform special initialisation steps after the scope is initialised
|
|
5413
5412
|
*/
|
|
@@ -5454,8 +5453,7 @@ class NodeBase extends ExpressionEntity {
|
|
|
5454
5453
|
continue;
|
|
5455
5454
|
if (Array.isArray(value)) {
|
|
5456
5455
|
for (const child of value) {
|
|
5457
|
-
|
|
5458
|
-
child.render(code, options);
|
|
5456
|
+
child === null || child === void 0 ? void 0 : child.render(code, options);
|
|
5459
5457
|
}
|
|
5460
5458
|
}
|
|
5461
5459
|
else {
|
|
@@ -5466,7 +5464,28 @@ class NodeBase extends ExpressionEntity {
|
|
|
5466
5464
|
shouldBeIncluded(context) {
|
|
5467
5465
|
return this.included || (!context.brokenFlow && this.hasEffects(createHasEffectsContext()));
|
|
5468
5466
|
}
|
|
5469
|
-
|
|
5467
|
+
/**
|
|
5468
|
+
* Just deoptimize everything by default so that when e.g. we do not track
|
|
5469
|
+
* something properly, it is deoptimized.
|
|
5470
|
+
* @protected
|
|
5471
|
+
*/
|
|
5472
|
+
applyDeoptimizations() {
|
|
5473
|
+
this.deoptimized = true;
|
|
5474
|
+
for (const key of this.keys) {
|
|
5475
|
+
const value = this[key];
|
|
5476
|
+
if (value === null)
|
|
5477
|
+
continue;
|
|
5478
|
+
if (Array.isArray(value)) {
|
|
5479
|
+
for (const child of value) {
|
|
5480
|
+
child === null || child === void 0 ? void 0 : child.deoptimizePath(UNKNOWN_PATH);
|
|
5481
|
+
}
|
|
5482
|
+
}
|
|
5483
|
+
else {
|
|
5484
|
+
value.deoptimizePath(UNKNOWN_PATH);
|
|
5485
|
+
}
|
|
5486
|
+
}
|
|
5487
|
+
this.context.requestTreeshakingPass();
|
|
5488
|
+
}
|
|
5470
5489
|
}
|
|
5471
5490
|
|
|
5472
5491
|
class SpreadElement extends NodeBase {
|
|
@@ -5548,7 +5567,7 @@ class Method extends ExpressionEntity {
|
|
|
5548
5567
|
}
|
|
5549
5568
|
return false;
|
|
5550
5569
|
}
|
|
5551
|
-
|
|
5570
|
+
includeArgumentsWhenCalledAtPath(_path, context, args) {
|
|
5552
5571
|
for (const arg of args) {
|
|
5553
5572
|
arg.include(context, false);
|
|
5554
5573
|
}
|
|
@@ -5752,7 +5771,7 @@ class ObjectEntity extends ExpressionEntity {
|
|
|
5752
5771
|
}
|
|
5753
5772
|
getLiteralValueAtPath(path, recursionTracker, origin) {
|
|
5754
5773
|
if (path.length === 0) {
|
|
5755
|
-
return
|
|
5774
|
+
return UnknownTruthyValue;
|
|
5756
5775
|
}
|
|
5757
5776
|
const key = path[0];
|
|
5758
5777
|
const expressionAtPath = this.getMemberExpressionAndTrackDeopt(key, origin);
|
|
@@ -5888,6 +5907,16 @@ class ObjectEntity extends ExpressionEntity {
|
|
|
5888
5907
|
}
|
|
5889
5908
|
return true;
|
|
5890
5909
|
}
|
|
5910
|
+
includeArgumentsWhenCalledAtPath(path, context, args) {
|
|
5911
|
+
const key = path[0];
|
|
5912
|
+
const expressionAtPath = this.getMemberExpression(key);
|
|
5913
|
+
if (expressionAtPath) {
|
|
5914
|
+
return expressionAtPath.includeArgumentsWhenCalledAtPath(path.slice(1), context, args);
|
|
5915
|
+
}
|
|
5916
|
+
if (this.prototypeExpression) {
|
|
5917
|
+
return this.prototypeExpression.includeArgumentsWhenCalledAtPath(path, context, args);
|
|
5918
|
+
}
|
|
5919
|
+
}
|
|
5891
5920
|
buildPropertyMaps(properties) {
|
|
5892
5921
|
const { allProperties, propertiesAndGettersByKey, propertiesAndSettersByKey, settersByKey, gettersByKey, unknownIntegerProps, unmatchablePropertiesAndGetters, unmatchableGetters, unmatchableSetters } = this;
|
|
5893
5922
|
const unmatchablePropertiesAndSetters = [];
|
|
@@ -6157,6 +6186,7 @@ const ARRAY_PROTOTYPE = new ObjectEntity({
|
|
|
6157
6186
|
class ArrayExpression extends NodeBase {
|
|
6158
6187
|
constructor() {
|
|
6159
6188
|
super(...arguments);
|
|
6189
|
+
this.deoptimized = false;
|
|
6160
6190
|
this.objectEntity = null;
|
|
6161
6191
|
}
|
|
6162
6192
|
deoptimizePath(path) {
|
|
@@ -6180,6 +6210,23 @@ class ArrayExpression extends NodeBase {
|
|
|
6180
6210
|
hasEffectsWhenCalledAtPath(path, callOptions, context) {
|
|
6181
6211
|
return this.getObjectEntity().hasEffectsWhenCalledAtPath(path, callOptions, context);
|
|
6182
6212
|
}
|
|
6213
|
+
includeArgumentsWhenCalledAtPath(path, context, args) {
|
|
6214
|
+
this.getObjectEntity().includeArgumentsWhenCalledAtPath(path, context, args);
|
|
6215
|
+
}
|
|
6216
|
+
applyDeoptimizations() {
|
|
6217
|
+
this.deoptimized = true;
|
|
6218
|
+
let hasSpread = false;
|
|
6219
|
+
for (let index = 0; index < this.elements.length; index++) {
|
|
6220
|
+
const element = this.elements[index];
|
|
6221
|
+
if (hasSpread || element instanceof SpreadElement) {
|
|
6222
|
+
if (element) {
|
|
6223
|
+
hasSpread = true;
|
|
6224
|
+
element.deoptimizePath(UNKNOWN_PATH);
|
|
6225
|
+
}
|
|
6226
|
+
}
|
|
6227
|
+
}
|
|
6228
|
+
this.context.requestTreeshakingPass();
|
|
6229
|
+
}
|
|
6183
6230
|
getObjectEntity() {
|
|
6184
6231
|
if (this.objectEntity !== null) {
|
|
6185
6232
|
return this.objectEntity;
|
|
@@ -6190,7 +6237,7 @@ class ArrayExpression extends NodeBase {
|
|
|
6190
6237
|
let hasSpread = false;
|
|
6191
6238
|
for (let index = 0; index < this.elements.length; index++) {
|
|
6192
6239
|
const element = this.elements[index];
|
|
6193
|
-
if (element instanceof SpreadElement
|
|
6240
|
+
if (hasSpread || element instanceof SpreadElement) {
|
|
6194
6241
|
if (element) {
|
|
6195
6242
|
hasSpread = true;
|
|
6196
6243
|
properties.unshift({ key: UnknownInteger, kind: 'init', property: element });
|
|
@@ -6210,9 +6257,7 @@ class ArrayExpression extends NodeBase {
|
|
|
6210
6257
|
class ArrayPattern extends NodeBase {
|
|
6211
6258
|
addExportedVariables(variables, exportNamesByVariable) {
|
|
6212
6259
|
for (const element of this.elements) {
|
|
6213
|
-
|
|
6214
|
-
element.addExportedVariables(variables, exportNamesByVariable);
|
|
6215
|
-
}
|
|
6260
|
+
element === null || element === void 0 ? void 0 : element.addExportedVariables(variables, exportNamesByVariable);
|
|
6216
6261
|
}
|
|
6217
6262
|
}
|
|
6218
6263
|
declare(kind) {
|
|
@@ -6224,29 +6269,23 @@ class ArrayPattern extends NodeBase {
|
|
|
6224
6269
|
}
|
|
6225
6270
|
return variables;
|
|
6226
6271
|
}
|
|
6227
|
-
|
|
6228
|
-
|
|
6229
|
-
|
|
6230
|
-
|
|
6231
|
-
element.deoptimizePath(path);
|
|
6232
|
-
}
|
|
6233
|
-
}
|
|
6272
|
+
// Patterns can only be deoptimized at the empty path at the moment
|
|
6273
|
+
deoptimizePath() {
|
|
6274
|
+
for (const element of this.elements) {
|
|
6275
|
+
element === null || element === void 0 ? void 0 : element.deoptimizePath(EMPTY_PATH);
|
|
6234
6276
|
}
|
|
6235
6277
|
}
|
|
6236
|
-
|
|
6237
|
-
|
|
6238
|
-
return true;
|
|
6278
|
+
// Patterns are only checked at the emtpy path at the moment
|
|
6279
|
+
hasEffectsWhenAssignedAtPath(_path, context) {
|
|
6239
6280
|
for (const element of this.elements) {
|
|
6240
|
-
if (element
|
|
6281
|
+
if (element === null || element === void 0 ? void 0 : element.hasEffectsWhenAssignedAtPath(EMPTY_PATH, context))
|
|
6241
6282
|
return true;
|
|
6242
6283
|
}
|
|
6243
6284
|
return false;
|
|
6244
6285
|
}
|
|
6245
6286
|
markDeclarationReached() {
|
|
6246
6287
|
for (const element of this.elements) {
|
|
6247
|
-
|
|
6248
|
-
element.markDeclarationReached();
|
|
6249
|
-
}
|
|
6288
|
+
element === null || element === void 0 ? void 0 : element.markDeclarationReached();
|
|
6250
6289
|
}
|
|
6251
6290
|
}
|
|
6252
6291
|
}
|
|
@@ -6366,7 +6405,7 @@ class LocalVariable extends Variable {
|
|
|
6366
6405
|
}
|
|
6367
6406
|
}
|
|
6368
6407
|
}
|
|
6369
|
-
|
|
6408
|
+
includeArgumentsWhenCalledAtPath(path, context, args) {
|
|
6370
6409
|
if (this.isReassigned || (this.init && context.includedCallArguments.has(this.init))) {
|
|
6371
6410
|
for (const arg of args) {
|
|
6372
6411
|
arg.include(context, false);
|
|
@@ -6374,7 +6413,7 @@ class LocalVariable extends Variable {
|
|
|
6374
6413
|
}
|
|
6375
6414
|
else if (this.init) {
|
|
6376
6415
|
context.includedCallArguments.add(this.init);
|
|
6377
|
-
this.init.
|
|
6416
|
+
this.init.includeArgumentsWhenCalledAtPath(path, context, args);
|
|
6378
6417
|
context.includedCallArguments.delete(this.init);
|
|
6379
6418
|
}
|
|
6380
6419
|
}
|
|
@@ -6622,1579 +6661,1649 @@ class ReturnValueScope extends ParameterScope {
|
|
|
6622
6661
|
}
|
|
6623
6662
|
}
|
|
6624
6663
|
|
|
6625
|
-
|
|
6626
|
-
|
|
6627
|
-
|
|
6628
|
-
|
|
6629
|
-
|
|
6630
|
-
|
|
6631
|
-
|
|
6632
|
-
|
|
6633
|
-
|
|
6634
|
-
|
|
6635
|
-
|
|
6636
|
-
|
|
6637
|
-
|
|
6638
|
-
|
|
6639
|
-
|
|
6640
|
-
|
|
6641
|
-
|
|
6642
|
-
|
|
6643
|
-
|
|
6644
|
-
|
|
6645
|
-
|
|
6646
|
-
|
|
6647
|
-
|
|
6648
|
-
|
|
6649
|
-
|
|
6650
|
-
|
|
6651
|
-
|
|
6652
|
-
|
|
6653
|
-
|
|
6654
|
-
|
|
6655
|
-
|
|
6656
|
-
|
|
6657
|
-
|
|
6658
|
-
|
|
6659
|
-
|
|
6660
|
-
|
|
6661
|
-
|
|
6662
|
-
|
|
6663
|
-
|
|
6664
|
-
|
|
6665
|
-
// disregard the `foo` in `foo: while (...) { ... break foo; ... continue foo;}`
|
|
6666
|
-
case 'LabeledStatement':
|
|
6667
|
-
case 'BreakStatement':
|
|
6668
|
-
case 'ContinueStatement': return false;
|
|
6669
|
-
default: return true;
|
|
6670
|
-
}
|
|
6671
|
-
}
|
|
6672
|
-
|
|
6673
|
-
return false;
|
|
6664
|
+
class AssignmentPattern extends NodeBase {
|
|
6665
|
+
constructor() {
|
|
6666
|
+
super(...arguments);
|
|
6667
|
+
this.deoptimized = false;
|
|
6668
|
+
}
|
|
6669
|
+
addExportedVariables(variables, exportNamesByVariable) {
|
|
6670
|
+
this.left.addExportedVariables(variables, exportNamesByVariable);
|
|
6671
|
+
}
|
|
6672
|
+
declare(kind, init) {
|
|
6673
|
+
return this.left.declare(kind, init);
|
|
6674
|
+
}
|
|
6675
|
+
deoptimizePath(path) {
|
|
6676
|
+
path.length === 0 && this.left.deoptimizePath(path);
|
|
6677
|
+
}
|
|
6678
|
+
hasEffectsWhenAssignedAtPath(path, context) {
|
|
6679
|
+
return path.length > 0 || this.left.hasEffectsWhenAssignedAtPath(EMPTY_PATH, context);
|
|
6680
|
+
}
|
|
6681
|
+
include(context, includeChildrenRecursively) {
|
|
6682
|
+
this.included = true;
|
|
6683
|
+
this.left.include(context, includeChildrenRecursively);
|
|
6684
|
+
this.right.include(context, includeChildrenRecursively);
|
|
6685
|
+
}
|
|
6686
|
+
markDeclarationReached() {
|
|
6687
|
+
this.left.markDeclarationReached();
|
|
6688
|
+
}
|
|
6689
|
+
render(code, options, { isShorthandProperty } = BLANK) {
|
|
6690
|
+
this.left.render(code, options, { isShorthandProperty });
|
|
6691
|
+
if (this.right.included) {
|
|
6692
|
+
this.right.render(code, options);
|
|
6693
|
+
}
|
|
6694
|
+
else {
|
|
6695
|
+
code.remove(this.left.end, this.end);
|
|
6696
|
+
}
|
|
6697
|
+
}
|
|
6698
|
+
applyDeoptimizations() {
|
|
6699
|
+
this.deoptimized = true;
|
|
6700
|
+
this.left.deoptimizePath(EMPTY_PATH);
|
|
6701
|
+
this.right.deoptimizePath(UNKNOWN_PATH);
|
|
6702
|
+
this.context.requestTreeshakingPass();
|
|
6703
|
+
}
|
|
6674
6704
|
}
|
|
6675
6705
|
|
|
6676
|
-
|
|
6677
|
-
|
|
6678
|
-
|
|
6679
|
-
|
|
6680
|
-
|
|
6706
|
+
function treeshakeNode(node, code, start, end) {
|
|
6707
|
+
code.remove(start, end);
|
|
6708
|
+
if (node.annotations) {
|
|
6709
|
+
for (const annotation of node.annotations) {
|
|
6710
|
+
if (annotation.start < start) {
|
|
6711
|
+
code.remove(annotation.start, annotation.end);
|
|
6712
|
+
}
|
|
6713
|
+
else {
|
|
6714
|
+
return;
|
|
6715
|
+
}
|
|
6716
|
+
}
|
|
6681
6717
|
}
|
|
6682
|
-
}
|
|
6683
|
-
|
|
6684
|
-
|
|
6685
|
-
|
|
6718
|
+
}
|
|
6719
|
+
function removeAnnotations(node, code) {
|
|
6720
|
+
if (!node.annotations && node.parent.type === ExpressionStatement$1) {
|
|
6721
|
+
node = node.parent;
|
|
6686
6722
|
}
|
|
6687
|
-
|
|
6688
|
-
|
|
6689
|
-
|
|
6690
|
-
const O = {
|
|
6691
|
-
__proto__: null,
|
|
6692
|
-
[ValueProperties]: IMPURE
|
|
6693
|
-
};
|
|
6694
|
-
/* PURE FUNCTION */
|
|
6695
|
-
const PF = {
|
|
6696
|
-
__proto__: null,
|
|
6697
|
-
[ValueProperties]: PURE
|
|
6698
|
-
};
|
|
6699
|
-
/* FUNCTION THAT MUTATES FIRST ARG WITHOUT TRIGGERING ACCESSORS */
|
|
6700
|
-
const MUTATES_ARG_WITHOUT_ACCESSOR = {
|
|
6701
|
-
__proto__: null,
|
|
6702
|
-
[ValueProperties]: {
|
|
6703
|
-
hasEffectsWhenCalled(callOptions, context) {
|
|
6704
|
-
return (!callOptions.args.length ||
|
|
6705
|
-
callOptions.args[0].hasEffectsWhenAssignedAtPath(UNKNOWN_NON_ACCESSOR_PATH, context));
|
|
6723
|
+
if (node.annotations) {
|
|
6724
|
+
for (const annotation of node.annotations) {
|
|
6725
|
+
code.remove(annotation.start, annotation.end);
|
|
6706
6726
|
}
|
|
6707
6727
|
}
|
|
6708
|
-
};
|
|
6709
|
-
/* CONSTRUCTOR */
|
|
6710
|
-
const C = {
|
|
6711
|
-
__proto__: null,
|
|
6712
|
-
[ValueProperties]: IMPURE,
|
|
6713
|
-
prototype: O
|
|
6714
|
-
};
|
|
6715
|
-
/* PURE CONSTRUCTOR */
|
|
6716
|
-
const PC = {
|
|
6717
|
-
__proto__: null,
|
|
6718
|
-
[ValueProperties]: PURE,
|
|
6719
|
-
prototype: O
|
|
6720
|
-
};
|
|
6721
|
-
const ARRAY_TYPE = {
|
|
6722
|
-
__proto__: null,
|
|
6723
|
-
[ValueProperties]: PURE,
|
|
6724
|
-
from: PF,
|
|
6725
|
-
of: PF,
|
|
6726
|
-
prototype: O
|
|
6727
|
-
};
|
|
6728
|
-
const INTL_MEMBER = {
|
|
6729
|
-
__proto__: null,
|
|
6730
|
-
[ValueProperties]: PURE,
|
|
6731
|
-
supportedLocalesOf: PC
|
|
6732
|
-
};
|
|
6733
|
-
const knownGlobals = {
|
|
6734
|
-
// Placeholders for global objects to avoid shape mutations
|
|
6735
|
-
global: O,
|
|
6736
|
-
globalThis: O,
|
|
6737
|
-
self: O,
|
|
6738
|
-
window: O,
|
|
6739
|
-
// Common globals
|
|
6740
|
-
__proto__: null,
|
|
6741
|
-
[ValueProperties]: IMPURE,
|
|
6742
|
-
Array: {
|
|
6743
|
-
__proto__: null,
|
|
6744
|
-
[ValueProperties]: IMPURE,
|
|
6745
|
-
from: O,
|
|
6746
|
-
isArray: PF,
|
|
6747
|
-
of: PF,
|
|
6748
|
-
prototype: O
|
|
6749
|
-
},
|
|
6750
|
-
ArrayBuffer: {
|
|
6751
|
-
__proto__: null,
|
|
6752
|
-
[ValueProperties]: PURE,
|
|
6753
|
-
isView: PF,
|
|
6754
|
-
prototype: O
|
|
6755
|
-
},
|
|
6756
|
-
Atomics: O,
|
|
6757
|
-
BigInt: C,
|
|
6758
|
-
BigInt64Array: C,
|
|
6759
|
-
BigUint64Array: C,
|
|
6760
|
-
Boolean: PC,
|
|
6761
|
-
constructor: C,
|
|
6762
|
-
DataView: PC,
|
|
6763
|
-
Date: {
|
|
6764
|
-
__proto__: null,
|
|
6765
|
-
[ValueProperties]: PURE,
|
|
6766
|
-
now: PF,
|
|
6767
|
-
parse: PF,
|
|
6768
|
-
prototype: O,
|
|
6769
|
-
UTC: PF
|
|
6770
|
-
},
|
|
6771
|
-
decodeURI: PF,
|
|
6772
|
-
decodeURIComponent: PF,
|
|
6773
|
-
encodeURI: PF,
|
|
6774
|
-
encodeURIComponent: PF,
|
|
6775
|
-
Error: PC,
|
|
6776
|
-
escape: PF,
|
|
6777
|
-
eval: O,
|
|
6778
|
-
EvalError: PC,
|
|
6779
|
-
Float32Array: ARRAY_TYPE,
|
|
6780
|
-
Float64Array: ARRAY_TYPE,
|
|
6781
|
-
Function: C,
|
|
6782
|
-
hasOwnProperty: O,
|
|
6783
|
-
Infinity: O,
|
|
6784
|
-
Int16Array: ARRAY_TYPE,
|
|
6785
|
-
Int32Array: ARRAY_TYPE,
|
|
6786
|
-
Int8Array: ARRAY_TYPE,
|
|
6787
|
-
isFinite: PF,
|
|
6788
|
-
isNaN: PF,
|
|
6789
|
-
isPrototypeOf: O,
|
|
6790
|
-
JSON: O,
|
|
6791
|
-
Map: PC,
|
|
6792
|
-
Math: {
|
|
6793
|
-
__proto__: null,
|
|
6794
|
-
[ValueProperties]: IMPURE,
|
|
6795
|
-
abs: PF,
|
|
6796
|
-
acos: PF,
|
|
6797
|
-
acosh: PF,
|
|
6798
|
-
asin: PF,
|
|
6799
|
-
asinh: PF,
|
|
6800
|
-
atan: PF,
|
|
6801
|
-
atan2: PF,
|
|
6802
|
-
atanh: PF,
|
|
6803
|
-
cbrt: PF,
|
|
6804
|
-
ceil: PF,
|
|
6805
|
-
clz32: PF,
|
|
6806
|
-
cos: PF,
|
|
6807
|
-
cosh: PF,
|
|
6808
|
-
exp: PF,
|
|
6809
|
-
expm1: PF,
|
|
6810
|
-
floor: PF,
|
|
6811
|
-
fround: PF,
|
|
6812
|
-
hypot: PF,
|
|
6813
|
-
imul: PF,
|
|
6814
|
-
log: PF,
|
|
6815
|
-
log10: PF,
|
|
6816
|
-
log1p: PF,
|
|
6817
|
-
log2: PF,
|
|
6818
|
-
max: PF,
|
|
6819
|
-
min: PF,
|
|
6820
|
-
pow: PF,
|
|
6821
|
-
random: PF,
|
|
6822
|
-
round: PF,
|
|
6823
|
-
sign: PF,
|
|
6824
|
-
sin: PF,
|
|
6825
|
-
sinh: PF,
|
|
6826
|
-
sqrt: PF,
|
|
6827
|
-
tan: PF,
|
|
6828
|
-
tanh: PF,
|
|
6829
|
-
trunc: PF
|
|
6830
|
-
},
|
|
6831
|
-
NaN: O,
|
|
6832
|
-
Number: {
|
|
6833
|
-
__proto__: null,
|
|
6834
|
-
[ValueProperties]: PURE,
|
|
6835
|
-
isFinite: PF,
|
|
6836
|
-
isInteger: PF,
|
|
6837
|
-
isNaN: PF,
|
|
6838
|
-
isSafeInteger: PF,
|
|
6839
|
-
parseFloat: PF,
|
|
6840
|
-
parseInt: PF,
|
|
6841
|
-
prototype: O
|
|
6842
|
-
},
|
|
6843
|
-
Object: {
|
|
6844
|
-
__proto__: null,
|
|
6845
|
-
[ValueProperties]: PURE,
|
|
6846
|
-
create: PF,
|
|
6847
|
-
// Technically those can throw in certain situations, but we ignore this as
|
|
6848
|
-
// code that relies on this will hopefully wrap this in a try-catch, which
|
|
6849
|
-
// deoptimizes everything anyway
|
|
6850
|
-
defineProperty: MUTATES_ARG_WITHOUT_ACCESSOR,
|
|
6851
|
-
defineProperties: MUTATES_ARG_WITHOUT_ACCESSOR,
|
|
6852
|
-
getOwnPropertyDescriptor: PF,
|
|
6853
|
-
getOwnPropertyNames: PF,
|
|
6854
|
-
getOwnPropertySymbols: PF,
|
|
6855
|
-
getPrototypeOf: PF,
|
|
6856
|
-
hasOwn: PF,
|
|
6857
|
-
is: PF,
|
|
6858
|
-
isExtensible: PF,
|
|
6859
|
-
isFrozen: PF,
|
|
6860
|
-
isSealed: PF,
|
|
6861
|
-
keys: PF,
|
|
6862
|
-
fromEntries: PF,
|
|
6863
|
-
entries: PF,
|
|
6864
|
-
prototype: O
|
|
6865
|
-
},
|
|
6866
|
-
parseFloat: PF,
|
|
6867
|
-
parseInt: PF,
|
|
6868
|
-
Promise: {
|
|
6869
|
-
__proto__: null,
|
|
6870
|
-
[ValueProperties]: IMPURE,
|
|
6871
|
-
all: O,
|
|
6872
|
-
prototype: O,
|
|
6873
|
-
race: O,
|
|
6874
|
-
reject: O,
|
|
6875
|
-
resolve: O
|
|
6876
|
-
},
|
|
6877
|
-
propertyIsEnumerable: O,
|
|
6878
|
-
Proxy: O,
|
|
6879
|
-
RangeError: PC,
|
|
6880
|
-
ReferenceError: PC,
|
|
6881
|
-
Reflect: O,
|
|
6882
|
-
RegExp: PC,
|
|
6883
|
-
Set: PC,
|
|
6884
|
-
SharedArrayBuffer: C,
|
|
6885
|
-
String: {
|
|
6886
|
-
__proto__: null,
|
|
6887
|
-
[ValueProperties]: PURE,
|
|
6888
|
-
fromCharCode: PF,
|
|
6889
|
-
fromCodePoint: PF,
|
|
6890
|
-
prototype: O,
|
|
6891
|
-
raw: PF
|
|
6892
|
-
},
|
|
6893
|
-
Symbol: {
|
|
6894
|
-
__proto__: null,
|
|
6895
|
-
[ValueProperties]: PURE,
|
|
6896
|
-
for: PF,
|
|
6897
|
-
keyFor: PF,
|
|
6898
|
-
prototype: O
|
|
6899
|
-
},
|
|
6900
|
-
SyntaxError: PC,
|
|
6901
|
-
toLocaleString: O,
|
|
6902
|
-
toString: O,
|
|
6903
|
-
TypeError: PC,
|
|
6904
|
-
Uint16Array: ARRAY_TYPE,
|
|
6905
|
-
Uint32Array: ARRAY_TYPE,
|
|
6906
|
-
Uint8Array: ARRAY_TYPE,
|
|
6907
|
-
Uint8ClampedArray: ARRAY_TYPE,
|
|
6908
|
-
// Technically, this is a global, but it needs special handling
|
|
6909
|
-
// undefined: ?,
|
|
6910
|
-
unescape: PF,
|
|
6911
|
-
URIError: PC,
|
|
6912
|
-
valueOf: O,
|
|
6913
|
-
WeakMap: PC,
|
|
6914
|
-
WeakSet: PC,
|
|
6915
|
-
// Additional globals shared by Node and Browser that are not strictly part of the language
|
|
6916
|
-
clearInterval: C,
|
|
6917
|
-
clearTimeout: C,
|
|
6918
|
-
console: O,
|
|
6919
|
-
Intl: {
|
|
6920
|
-
__proto__: null,
|
|
6921
|
-
[ValueProperties]: IMPURE,
|
|
6922
|
-
Collator: INTL_MEMBER,
|
|
6923
|
-
DateTimeFormat: INTL_MEMBER,
|
|
6924
|
-
ListFormat: INTL_MEMBER,
|
|
6925
|
-
NumberFormat: INTL_MEMBER,
|
|
6926
|
-
PluralRules: INTL_MEMBER,
|
|
6927
|
-
RelativeTimeFormat: INTL_MEMBER
|
|
6928
|
-
},
|
|
6929
|
-
setInterval: C,
|
|
6930
|
-
setTimeout: C,
|
|
6931
|
-
TextDecoder: C,
|
|
6932
|
-
TextEncoder: C,
|
|
6933
|
-
URL: C,
|
|
6934
|
-
URLSearchParams: C,
|
|
6935
|
-
// Browser specific globals
|
|
6936
|
-
AbortController: C,
|
|
6937
|
-
AbortSignal: C,
|
|
6938
|
-
addEventListener: O,
|
|
6939
|
-
alert: O,
|
|
6940
|
-
AnalyserNode: C,
|
|
6941
|
-
Animation: C,
|
|
6942
|
-
AnimationEvent: C,
|
|
6943
|
-
applicationCache: O,
|
|
6944
|
-
ApplicationCache: C,
|
|
6945
|
-
ApplicationCacheErrorEvent: C,
|
|
6946
|
-
atob: O,
|
|
6947
|
-
Attr: C,
|
|
6948
|
-
Audio: C,
|
|
6949
|
-
AudioBuffer: C,
|
|
6950
|
-
AudioBufferSourceNode: C,
|
|
6951
|
-
AudioContext: C,
|
|
6952
|
-
AudioDestinationNode: C,
|
|
6953
|
-
AudioListener: C,
|
|
6954
|
-
AudioNode: C,
|
|
6955
|
-
AudioParam: C,
|
|
6956
|
-
AudioProcessingEvent: C,
|
|
6957
|
-
AudioScheduledSourceNode: C,
|
|
6958
|
-
AudioWorkletNode: C,
|
|
6959
|
-
BarProp: C,
|
|
6960
|
-
BaseAudioContext: C,
|
|
6961
|
-
BatteryManager: C,
|
|
6962
|
-
BeforeUnloadEvent: C,
|
|
6963
|
-
BiquadFilterNode: C,
|
|
6964
|
-
Blob: C,
|
|
6965
|
-
BlobEvent: C,
|
|
6966
|
-
blur: O,
|
|
6967
|
-
BroadcastChannel: C,
|
|
6968
|
-
btoa: O,
|
|
6969
|
-
ByteLengthQueuingStrategy: C,
|
|
6970
|
-
Cache: C,
|
|
6971
|
-
caches: O,
|
|
6972
|
-
CacheStorage: C,
|
|
6973
|
-
cancelAnimationFrame: O,
|
|
6974
|
-
cancelIdleCallback: O,
|
|
6975
|
-
CanvasCaptureMediaStreamTrack: C,
|
|
6976
|
-
CanvasGradient: C,
|
|
6977
|
-
CanvasPattern: C,
|
|
6978
|
-
CanvasRenderingContext2D: C,
|
|
6979
|
-
ChannelMergerNode: C,
|
|
6980
|
-
ChannelSplitterNode: C,
|
|
6981
|
-
CharacterData: C,
|
|
6982
|
-
clientInformation: O,
|
|
6983
|
-
ClipboardEvent: C,
|
|
6984
|
-
close: O,
|
|
6985
|
-
closed: O,
|
|
6986
|
-
CloseEvent: C,
|
|
6987
|
-
Comment: C,
|
|
6988
|
-
CompositionEvent: C,
|
|
6989
|
-
confirm: O,
|
|
6990
|
-
ConstantSourceNode: C,
|
|
6991
|
-
ConvolverNode: C,
|
|
6992
|
-
CountQueuingStrategy: C,
|
|
6993
|
-
createImageBitmap: O,
|
|
6994
|
-
Credential: C,
|
|
6995
|
-
CredentialsContainer: C,
|
|
6996
|
-
crypto: O,
|
|
6997
|
-
Crypto: C,
|
|
6998
|
-
CryptoKey: C,
|
|
6999
|
-
CSS: C,
|
|
7000
|
-
CSSConditionRule: C,
|
|
7001
|
-
CSSFontFaceRule: C,
|
|
7002
|
-
CSSGroupingRule: C,
|
|
7003
|
-
CSSImportRule: C,
|
|
7004
|
-
CSSKeyframeRule: C,
|
|
7005
|
-
CSSKeyframesRule: C,
|
|
7006
|
-
CSSMediaRule: C,
|
|
7007
|
-
CSSNamespaceRule: C,
|
|
7008
|
-
CSSPageRule: C,
|
|
7009
|
-
CSSRule: C,
|
|
7010
|
-
CSSRuleList: C,
|
|
7011
|
-
CSSStyleDeclaration: C,
|
|
7012
|
-
CSSStyleRule: C,
|
|
7013
|
-
CSSStyleSheet: C,
|
|
7014
|
-
CSSSupportsRule: C,
|
|
7015
|
-
CustomElementRegistry: C,
|
|
7016
|
-
customElements: O,
|
|
7017
|
-
CustomEvent: C,
|
|
7018
|
-
DataTransfer: C,
|
|
7019
|
-
DataTransferItem: C,
|
|
7020
|
-
DataTransferItemList: C,
|
|
7021
|
-
defaultstatus: O,
|
|
7022
|
-
defaultStatus: O,
|
|
7023
|
-
DelayNode: C,
|
|
7024
|
-
DeviceMotionEvent: C,
|
|
7025
|
-
DeviceOrientationEvent: C,
|
|
7026
|
-
devicePixelRatio: O,
|
|
7027
|
-
dispatchEvent: O,
|
|
7028
|
-
document: O,
|
|
7029
|
-
Document: C,
|
|
7030
|
-
DocumentFragment: C,
|
|
7031
|
-
DocumentType: C,
|
|
7032
|
-
DOMError: C,
|
|
7033
|
-
DOMException: C,
|
|
7034
|
-
DOMImplementation: C,
|
|
7035
|
-
DOMMatrix: C,
|
|
7036
|
-
DOMMatrixReadOnly: C,
|
|
7037
|
-
DOMParser: C,
|
|
7038
|
-
DOMPoint: C,
|
|
7039
|
-
DOMPointReadOnly: C,
|
|
7040
|
-
DOMQuad: C,
|
|
7041
|
-
DOMRect: C,
|
|
7042
|
-
DOMRectReadOnly: C,
|
|
7043
|
-
DOMStringList: C,
|
|
7044
|
-
DOMStringMap: C,
|
|
7045
|
-
DOMTokenList: C,
|
|
7046
|
-
DragEvent: C,
|
|
7047
|
-
DynamicsCompressorNode: C,
|
|
7048
|
-
Element: C,
|
|
7049
|
-
ErrorEvent: C,
|
|
7050
|
-
Event: C,
|
|
7051
|
-
EventSource: C,
|
|
7052
|
-
EventTarget: C,
|
|
7053
|
-
external: O,
|
|
7054
|
-
fetch: O,
|
|
7055
|
-
File: C,
|
|
7056
|
-
FileList: C,
|
|
7057
|
-
FileReader: C,
|
|
7058
|
-
find: O,
|
|
7059
|
-
focus: O,
|
|
7060
|
-
FocusEvent: C,
|
|
7061
|
-
FontFace: C,
|
|
7062
|
-
FontFaceSetLoadEvent: C,
|
|
7063
|
-
FormData: C,
|
|
7064
|
-
frames: O,
|
|
7065
|
-
GainNode: C,
|
|
7066
|
-
Gamepad: C,
|
|
7067
|
-
GamepadButton: C,
|
|
7068
|
-
GamepadEvent: C,
|
|
7069
|
-
getComputedStyle: O,
|
|
7070
|
-
getSelection: O,
|
|
7071
|
-
HashChangeEvent: C,
|
|
7072
|
-
Headers: C,
|
|
7073
|
-
history: O,
|
|
7074
|
-
History: C,
|
|
7075
|
-
HTMLAllCollection: C,
|
|
7076
|
-
HTMLAnchorElement: C,
|
|
7077
|
-
HTMLAreaElement: C,
|
|
7078
|
-
HTMLAudioElement: C,
|
|
7079
|
-
HTMLBaseElement: C,
|
|
7080
|
-
HTMLBodyElement: C,
|
|
7081
|
-
HTMLBRElement: C,
|
|
7082
|
-
HTMLButtonElement: C,
|
|
7083
|
-
HTMLCanvasElement: C,
|
|
7084
|
-
HTMLCollection: C,
|
|
7085
|
-
HTMLContentElement: C,
|
|
7086
|
-
HTMLDataElement: C,
|
|
7087
|
-
HTMLDataListElement: C,
|
|
7088
|
-
HTMLDetailsElement: C,
|
|
7089
|
-
HTMLDialogElement: C,
|
|
7090
|
-
HTMLDirectoryElement: C,
|
|
7091
|
-
HTMLDivElement: C,
|
|
7092
|
-
HTMLDListElement: C,
|
|
7093
|
-
HTMLDocument: C,
|
|
7094
|
-
HTMLElement: C,
|
|
7095
|
-
HTMLEmbedElement: C,
|
|
7096
|
-
HTMLFieldSetElement: C,
|
|
7097
|
-
HTMLFontElement: C,
|
|
7098
|
-
HTMLFormControlsCollection: C,
|
|
7099
|
-
HTMLFormElement: C,
|
|
7100
|
-
HTMLFrameElement: C,
|
|
7101
|
-
HTMLFrameSetElement: C,
|
|
7102
|
-
HTMLHeadElement: C,
|
|
7103
|
-
HTMLHeadingElement: C,
|
|
7104
|
-
HTMLHRElement: C,
|
|
7105
|
-
HTMLHtmlElement: C,
|
|
7106
|
-
HTMLIFrameElement: C,
|
|
7107
|
-
HTMLImageElement: C,
|
|
7108
|
-
HTMLInputElement: C,
|
|
7109
|
-
HTMLLabelElement: C,
|
|
7110
|
-
HTMLLegendElement: C,
|
|
7111
|
-
HTMLLIElement: C,
|
|
7112
|
-
HTMLLinkElement: C,
|
|
7113
|
-
HTMLMapElement: C,
|
|
7114
|
-
HTMLMarqueeElement: C,
|
|
7115
|
-
HTMLMediaElement: C,
|
|
7116
|
-
HTMLMenuElement: C,
|
|
7117
|
-
HTMLMetaElement: C,
|
|
7118
|
-
HTMLMeterElement: C,
|
|
7119
|
-
HTMLModElement: C,
|
|
7120
|
-
HTMLObjectElement: C,
|
|
7121
|
-
HTMLOListElement: C,
|
|
7122
|
-
HTMLOptGroupElement: C,
|
|
7123
|
-
HTMLOptionElement: C,
|
|
7124
|
-
HTMLOptionsCollection: C,
|
|
7125
|
-
HTMLOutputElement: C,
|
|
7126
|
-
HTMLParagraphElement: C,
|
|
7127
|
-
HTMLParamElement: C,
|
|
7128
|
-
HTMLPictureElement: C,
|
|
7129
|
-
HTMLPreElement: C,
|
|
7130
|
-
HTMLProgressElement: C,
|
|
7131
|
-
HTMLQuoteElement: C,
|
|
7132
|
-
HTMLScriptElement: C,
|
|
7133
|
-
HTMLSelectElement: C,
|
|
7134
|
-
HTMLShadowElement: C,
|
|
7135
|
-
HTMLSlotElement: C,
|
|
7136
|
-
HTMLSourceElement: C,
|
|
7137
|
-
HTMLSpanElement: C,
|
|
7138
|
-
HTMLStyleElement: C,
|
|
7139
|
-
HTMLTableCaptionElement: C,
|
|
7140
|
-
HTMLTableCellElement: C,
|
|
7141
|
-
HTMLTableColElement: C,
|
|
7142
|
-
HTMLTableElement: C,
|
|
7143
|
-
HTMLTableRowElement: C,
|
|
7144
|
-
HTMLTableSectionElement: C,
|
|
7145
|
-
HTMLTemplateElement: C,
|
|
7146
|
-
HTMLTextAreaElement: C,
|
|
7147
|
-
HTMLTimeElement: C,
|
|
7148
|
-
HTMLTitleElement: C,
|
|
7149
|
-
HTMLTrackElement: C,
|
|
7150
|
-
HTMLUListElement: C,
|
|
7151
|
-
HTMLUnknownElement: C,
|
|
7152
|
-
HTMLVideoElement: C,
|
|
7153
|
-
IDBCursor: C,
|
|
7154
|
-
IDBCursorWithValue: C,
|
|
7155
|
-
IDBDatabase: C,
|
|
7156
|
-
IDBFactory: C,
|
|
7157
|
-
IDBIndex: C,
|
|
7158
|
-
IDBKeyRange: C,
|
|
7159
|
-
IDBObjectStore: C,
|
|
7160
|
-
IDBOpenDBRequest: C,
|
|
7161
|
-
IDBRequest: C,
|
|
7162
|
-
IDBTransaction: C,
|
|
7163
|
-
IDBVersionChangeEvent: C,
|
|
7164
|
-
IdleDeadline: C,
|
|
7165
|
-
IIRFilterNode: C,
|
|
7166
|
-
Image: C,
|
|
7167
|
-
ImageBitmap: C,
|
|
7168
|
-
ImageBitmapRenderingContext: C,
|
|
7169
|
-
ImageCapture: C,
|
|
7170
|
-
ImageData: C,
|
|
7171
|
-
indexedDB: O,
|
|
7172
|
-
innerHeight: O,
|
|
7173
|
-
innerWidth: O,
|
|
7174
|
-
InputEvent: C,
|
|
7175
|
-
IntersectionObserver: C,
|
|
7176
|
-
IntersectionObserverEntry: C,
|
|
7177
|
-
isSecureContext: O,
|
|
7178
|
-
KeyboardEvent: C,
|
|
7179
|
-
KeyframeEffect: C,
|
|
7180
|
-
length: O,
|
|
7181
|
-
localStorage: O,
|
|
7182
|
-
location: O,
|
|
7183
|
-
Location: C,
|
|
7184
|
-
locationbar: O,
|
|
7185
|
-
matchMedia: O,
|
|
7186
|
-
MediaDeviceInfo: C,
|
|
7187
|
-
MediaDevices: C,
|
|
7188
|
-
MediaElementAudioSourceNode: C,
|
|
7189
|
-
MediaEncryptedEvent: C,
|
|
7190
|
-
MediaError: C,
|
|
7191
|
-
MediaKeyMessageEvent: C,
|
|
7192
|
-
MediaKeySession: C,
|
|
7193
|
-
MediaKeyStatusMap: C,
|
|
7194
|
-
MediaKeySystemAccess: C,
|
|
7195
|
-
MediaList: C,
|
|
7196
|
-
MediaQueryList: C,
|
|
7197
|
-
MediaQueryListEvent: C,
|
|
7198
|
-
MediaRecorder: C,
|
|
7199
|
-
MediaSettingsRange: C,
|
|
7200
|
-
MediaSource: C,
|
|
7201
|
-
MediaStream: C,
|
|
7202
|
-
MediaStreamAudioDestinationNode: C,
|
|
7203
|
-
MediaStreamAudioSourceNode: C,
|
|
7204
|
-
MediaStreamEvent: C,
|
|
7205
|
-
MediaStreamTrack: C,
|
|
7206
|
-
MediaStreamTrackEvent: C,
|
|
7207
|
-
menubar: O,
|
|
7208
|
-
MessageChannel: C,
|
|
7209
|
-
MessageEvent: C,
|
|
7210
|
-
MessagePort: C,
|
|
7211
|
-
MIDIAccess: C,
|
|
7212
|
-
MIDIConnectionEvent: C,
|
|
7213
|
-
MIDIInput: C,
|
|
7214
|
-
MIDIInputMap: C,
|
|
7215
|
-
MIDIMessageEvent: C,
|
|
7216
|
-
MIDIOutput: C,
|
|
7217
|
-
MIDIOutputMap: C,
|
|
7218
|
-
MIDIPort: C,
|
|
7219
|
-
MimeType: C,
|
|
7220
|
-
MimeTypeArray: C,
|
|
7221
|
-
MouseEvent: C,
|
|
7222
|
-
moveBy: O,
|
|
7223
|
-
moveTo: O,
|
|
7224
|
-
MutationEvent: C,
|
|
7225
|
-
MutationObserver: C,
|
|
7226
|
-
MutationRecord: C,
|
|
7227
|
-
name: O,
|
|
7228
|
-
NamedNodeMap: C,
|
|
7229
|
-
NavigationPreloadManager: C,
|
|
7230
|
-
navigator: O,
|
|
7231
|
-
Navigator: C,
|
|
7232
|
-
NetworkInformation: C,
|
|
7233
|
-
Node: C,
|
|
7234
|
-
NodeFilter: O,
|
|
7235
|
-
NodeIterator: C,
|
|
7236
|
-
NodeList: C,
|
|
7237
|
-
Notification: C,
|
|
7238
|
-
OfflineAudioCompletionEvent: C,
|
|
7239
|
-
OfflineAudioContext: C,
|
|
7240
|
-
offscreenBuffering: O,
|
|
7241
|
-
OffscreenCanvas: C,
|
|
7242
|
-
open: O,
|
|
7243
|
-
openDatabase: O,
|
|
7244
|
-
Option: C,
|
|
7245
|
-
origin: O,
|
|
7246
|
-
OscillatorNode: C,
|
|
7247
|
-
outerHeight: O,
|
|
7248
|
-
outerWidth: O,
|
|
7249
|
-
PageTransitionEvent: C,
|
|
7250
|
-
pageXOffset: O,
|
|
7251
|
-
pageYOffset: O,
|
|
7252
|
-
PannerNode: C,
|
|
7253
|
-
parent: O,
|
|
7254
|
-
Path2D: C,
|
|
7255
|
-
PaymentAddress: C,
|
|
7256
|
-
PaymentRequest: C,
|
|
7257
|
-
PaymentRequestUpdateEvent: C,
|
|
7258
|
-
PaymentResponse: C,
|
|
7259
|
-
performance: O,
|
|
7260
|
-
Performance: C,
|
|
7261
|
-
PerformanceEntry: C,
|
|
7262
|
-
PerformanceLongTaskTiming: C,
|
|
7263
|
-
PerformanceMark: C,
|
|
7264
|
-
PerformanceMeasure: C,
|
|
7265
|
-
PerformanceNavigation: C,
|
|
7266
|
-
PerformanceNavigationTiming: C,
|
|
7267
|
-
PerformanceObserver: C,
|
|
7268
|
-
PerformanceObserverEntryList: C,
|
|
7269
|
-
PerformancePaintTiming: C,
|
|
7270
|
-
PerformanceResourceTiming: C,
|
|
7271
|
-
PerformanceTiming: C,
|
|
7272
|
-
PeriodicWave: C,
|
|
7273
|
-
Permissions: C,
|
|
7274
|
-
PermissionStatus: C,
|
|
7275
|
-
personalbar: O,
|
|
7276
|
-
PhotoCapabilities: C,
|
|
7277
|
-
Plugin: C,
|
|
7278
|
-
PluginArray: C,
|
|
7279
|
-
PointerEvent: C,
|
|
7280
|
-
PopStateEvent: C,
|
|
7281
|
-
postMessage: O,
|
|
7282
|
-
Presentation: C,
|
|
7283
|
-
PresentationAvailability: C,
|
|
7284
|
-
PresentationConnection: C,
|
|
7285
|
-
PresentationConnectionAvailableEvent: C,
|
|
7286
|
-
PresentationConnectionCloseEvent: C,
|
|
7287
|
-
PresentationConnectionList: C,
|
|
7288
|
-
PresentationReceiver: C,
|
|
7289
|
-
PresentationRequest: C,
|
|
7290
|
-
print: O,
|
|
7291
|
-
ProcessingInstruction: C,
|
|
7292
|
-
ProgressEvent: C,
|
|
7293
|
-
PromiseRejectionEvent: C,
|
|
7294
|
-
prompt: O,
|
|
7295
|
-
PushManager: C,
|
|
7296
|
-
PushSubscription: C,
|
|
7297
|
-
PushSubscriptionOptions: C,
|
|
7298
|
-
queueMicrotask: O,
|
|
7299
|
-
RadioNodeList: C,
|
|
7300
|
-
Range: C,
|
|
7301
|
-
ReadableStream: C,
|
|
7302
|
-
RemotePlayback: C,
|
|
7303
|
-
removeEventListener: O,
|
|
7304
|
-
Request: C,
|
|
7305
|
-
requestAnimationFrame: O,
|
|
7306
|
-
requestIdleCallback: O,
|
|
7307
|
-
resizeBy: O,
|
|
7308
|
-
ResizeObserver: C,
|
|
7309
|
-
ResizeObserverEntry: C,
|
|
7310
|
-
resizeTo: O,
|
|
7311
|
-
Response: C,
|
|
7312
|
-
RTCCertificate: C,
|
|
7313
|
-
RTCDataChannel: C,
|
|
7314
|
-
RTCDataChannelEvent: C,
|
|
7315
|
-
RTCDtlsTransport: C,
|
|
7316
|
-
RTCIceCandidate: C,
|
|
7317
|
-
RTCIceTransport: C,
|
|
7318
|
-
RTCPeerConnection: C,
|
|
7319
|
-
RTCPeerConnectionIceEvent: C,
|
|
7320
|
-
RTCRtpReceiver: C,
|
|
7321
|
-
RTCRtpSender: C,
|
|
7322
|
-
RTCSctpTransport: C,
|
|
7323
|
-
RTCSessionDescription: C,
|
|
7324
|
-
RTCStatsReport: C,
|
|
7325
|
-
RTCTrackEvent: C,
|
|
7326
|
-
screen: O,
|
|
7327
|
-
Screen: C,
|
|
7328
|
-
screenLeft: O,
|
|
7329
|
-
ScreenOrientation: C,
|
|
7330
|
-
screenTop: O,
|
|
7331
|
-
screenX: O,
|
|
7332
|
-
screenY: O,
|
|
7333
|
-
ScriptProcessorNode: C,
|
|
7334
|
-
scroll: O,
|
|
7335
|
-
scrollbars: O,
|
|
7336
|
-
scrollBy: O,
|
|
7337
|
-
scrollTo: O,
|
|
7338
|
-
scrollX: O,
|
|
7339
|
-
scrollY: O,
|
|
7340
|
-
SecurityPolicyViolationEvent: C,
|
|
7341
|
-
Selection: C,
|
|
7342
|
-
ServiceWorker: C,
|
|
7343
|
-
ServiceWorkerContainer: C,
|
|
7344
|
-
ServiceWorkerRegistration: C,
|
|
7345
|
-
sessionStorage: O,
|
|
7346
|
-
ShadowRoot: C,
|
|
7347
|
-
SharedWorker: C,
|
|
7348
|
-
SourceBuffer: C,
|
|
7349
|
-
SourceBufferList: C,
|
|
7350
|
-
speechSynthesis: O,
|
|
7351
|
-
SpeechSynthesisEvent: C,
|
|
7352
|
-
SpeechSynthesisUtterance: C,
|
|
7353
|
-
StaticRange: C,
|
|
7354
|
-
status: O,
|
|
7355
|
-
statusbar: O,
|
|
7356
|
-
StereoPannerNode: C,
|
|
7357
|
-
stop: O,
|
|
7358
|
-
Storage: C,
|
|
7359
|
-
StorageEvent: C,
|
|
7360
|
-
StorageManager: C,
|
|
7361
|
-
styleMedia: O,
|
|
7362
|
-
StyleSheet: C,
|
|
7363
|
-
StyleSheetList: C,
|
|
7364
|
-
SubtleCrypto: C,
|
|
7365
|
-
SVGAElement: C,
|
|
7366
|
-
SVGAngle: C,
|
|
7367
|
-
SVGAnimatedAngle: C,
|
|
7368
|
-
SVGAnimatedBoolean: C,
|
|
7369
|
-
SVGAnimatedEnumeration: C,
|
|
7370
|
-
SVGAnimatedInteger: C,
|
|
7371
|
-
SVGAnimatedLength: C,
|
|
7372
|
-
SVGAnimatedLengthList: C,
|
|
7373
|
-
SVGAnimatedNumber: C,
|
|
7374
|
-
SVGAnimatedNumberList: C,
|
|
7375
|
-
SVGAnimatedPreserveAspectRatio: C,
|
|
7376
|
-
SVGAnimatedRect: C,
|
|
7377
|
-
SVGAnimatedString: C,
|
|
7378
|
-
SVGAnimatedTransformList: C,
|
|
7379
|
-
SVGAnimateElement: C,
|
|
7380
|
-
SVGAnimateMotionElement: C,
|
|
7381
|
-
SVGAnimateTransformElement: C,
|
|
7382
|
-
SVGAnimationElement: C,
|
|
7383
|
-
SVGCircleElement: C,
|
|
7384
|
-
SVGClipPathElement: C,
|
|
7385
|
-
SVGComponentTransferFunctionElement: C,
|
|
7386
|
-
SVGDefsElement: C,
|
|
7387
|
-
SVGDescElement: C,
|
|
7388
|
-
SVGDiscardElement: C,
|
|
7389
|
-
SVGElement: C,
|
|
7390
|
-
SVGEllipseElement: C,
|
|
7391
|
-
SVGFEBlendElement: C,
|
|
7392
|
-
SVGFEColorMatrixElement: C,
|
|
7393
|
-
SVGFEComponentTransferElement: C,
|
|
7394
|
-
SVGFECompositeElement: C,
|
|
7395
|
-
SVGFEConvolveMatrixElement: C,
|
|
7396
|
-
SVGFEDiffuseLightingElement: C,
|
|
7397
|
-
SVGFEDisplacementMapElement: C,
|
|
7398
|
-
SVGFEDistantLightElement: C,
|
|
7399
|
-
SVGFEDropShadowElement: C,
|
|
7400
|
-
SVGFEFloodElement: C,
|
|
7401
|
-
SVGFEFuncAElement: C,
|
|
7402
|
-
SVGFEFuncBElement: C,
|
|
7403
|
-
SVGFEFuncGElement: C,
|
|
7404
|
-
SVGFEFuncRElement: C,
|
|
7405
|
-
SVGFEGaussianBlurElement: C,
|
|
7406
|
-
SVGFEImageElement: C,
|
|
7407
|
-
SVGFEMergeElement: C,
|
|
7408
|
-
SVGFEMergeNodeElement: C,
|
|
7409
|
-
SVGFEMorphologyElement: C,
|
|
7410
|
-
SVGFEOffsetElement: C,
|
|
7411
|
-
SVGFEPointLightElement: C,
|
|
7412
|
-
SVGFESpecularLightingElement: C,
|
|
7413
|
-
SVGFESpotLightElement: C,
|
|
7414
|
-
SVGFETileElement: C,
|
|
7415
|
-
SVGFETurbulenceElement: C,
|
|
7416
|
-
SVGFilterElement: C,
|
|
7417
|
-
SVGForeignObjectElement: C,
|
|
7418
|
-
SVGGElement: C,
|
|
7419
|
-
SVGGeometryElement: C,
|
|
7420
|
-
SVGGradientElement: C,
|
|
7421
|
-
SVGGraphicsElement: C,
|
|
7422
|
-
SVGImageElement: C,
|
|
7423
|
-
SVGLength: C,
|
|
7424
|
-
SVGLengthList: C,
|
|
7425
|
-
SVGLinearGradientElement: C,
|
|
7426
|
-
SVGLineElement: C,
|
|
7427
|
-
SVGMarkerElement: C,
|
|
7428
|
-
SVGMaskElement: C,
|
|
7429
|
-
SVGMatrix: C,
|
|
7430
|
-
SVGMetadataElement: C,
|
|
7431
|
-
SVGMPathElement: C,
|
|
7432
|
-
SVGNumber: C,
|
|
7433
|
-
SVGNumberList: C,
|
|
7434
|
-
SVGPathElement: C,
|
|
7435
|
-
SVGPatternElement: C,
|
|
7436
|
-
SVGPoint: C,
|
|
7437
|
-
SVGPointList: C,
|
|
7438
|
-
SVGPolygonElement: C,
|
|
7439
|
-
SVGPolylineElement: C,
|
|
7440
|
-
SVGPreserveAspectRatio: C,
|
|
7441
|
-
SVGRadialGradientElement: C,
|
|
7442
|
-
SVGRect: C,
|
|
7443
|
-
SVGRectElement: C,
|
|
7444
|
-
SVGScriptElement: C,
|
|
7445
|
-
SVGSetElement: C,
|
|
7446
|
-
SVGStopElement: C,
|
|
7447
|
-
SVGStringList: C,
|
|
7448
|
-
SVGStyleElement: C,
|
|
7449
|
-
SVGSVGElement: C,
|
|
7450
|
-
SVGSwitchElement: C,
|
|
7451
|
-
SVGSymbolElement: C,
|
|
7452
|
-
SVGTextContentElement: C,
|
|
7453
|
-
SVGTextElement: C,
|
|
7454
|
-
SVGTextPathElement: C,
|
|
7455
|
-
SVGTextPositioningElement: C,
|
|
7456
|
-
SVGTitleElement: C,
|
|
7457
|
-
SVGTransform: C,
|
|
7458
|
-
SVGTransformList: C,
|
|
7459
|
-
SVGTSpanElement: C,
|
|
7460
|
-
SVGUnitTypes: C,
|
|
7461
|
-
SVGUseElement: C,
|
|
7462
|
-
SVGViewElement: C,
|
|
7463
|
-
TaskAttributionTiming: C,
|
|
7464
|
-
Text: C,
|
|
7465
|
-
TextEvent: C,
|
|
7466
|
-
TextMetrics: C,
|
|
7467
|
-
TextTrack: C,
|
|
7468
|
-
TextTrackCue: C,
|
|
7469
|
-
TextTrackCueList: C,
|
|
7470
|
-
TextTrackList: C,
|
|
7471
|
-
TimeRanges: C,
|
|
7472
|
-
toolbar: O,
|
|
7473
|
-
top: O,
|
|
7474
|
-
Touch: C,
|
|
7475
|
-
TouchEvent: C,
|
|
7476
|
-
TouchList: C,
|
|
7477
|
-
TrackEvent: C,
|
|
7478
|
-
TransitionEvent: C,
|
|
7479
|
-
TreeWalker: C,
|
|
7480
|
-
UIEvent: C,
|
|
7481
|
-
ValidityState: C,
|
|
7482
|
-
visualViewport: O,
|
|
7483
|
-
VisualViewport: C,
|
|
7484
|
-
VTTCue: C,
|
|
7485
|
-
WaveShaperNode: C,
|
|
7486
|
-
WebAssembly: O,
|
|
7487
|
-
WebGL2RenderingContext: C,
|
|
7488
|
-
WebGLActiveInfo: C,
|
|
7489
|
-
WebGLBuffer: C,
|
|
7490
|
-
WebGLContextEvent: C,
|
|
7491
|
-
WebGLFramebuffer: C,
|
|
7492
|
-
WebGLProgram: C,
|
|
7493
|
-
WebGLQuery: C,
|
|
7494
|
-
WebGLRenderbuffer: C,
|
|
7495
|
-
WebGLRenderingContext: C,
|
|
7496
|
-
WebGLSampler: C,
|
|
7497
|
-
WebGLShader: C,
|
|
7498
|
-
WebGLShaderPrecisionFormat: C,
|
|
7499
|
-
WebGLSync: C,
|
|
7500
|
-
WebGLTexture: C,
|
|
7501
|
-
WebGLTransformFeedback: C,
|
|
7502
|
-
WebGLUniformLocation: C,
|
|
7503
|
-
WebGLVertexArrayObject: C,
|
|
7504
|
-
WebSocket: C,
|
|
7505
|
-
WheelEvent: C,
|
|
7506
|
-
Window: C,
|
|
7507
|
-
Worker: C,
|
|
7508
|
-
WritableStream: C,
|
|
7509
|
-
XMLDocument: C,
|
|
7510
|
-
XMLHttpRequest: C,
|
|
7511
|
-
XMLHttpRequestEventTarget: C,
|
|
7512
|
-
XMLHttpRequestUpload: C,
|
|
7513
|
-
XMLSerializer: C,
|
|
7514
|
-
XPathEvaluator: C,
|
|
7515
|
-
XPathExpression: C,
|
|
7516
|
-
XPathResult: C,
|
|
7517
|
-
XSLTProcessor: C
|
|
7518
|
-
};
|
|
7519
|
-
for (const global of ['window', 'global', 'self', 'globalThis']) {
|
|
7520
|
-
knownGlobals[global] = knownGlobals;
|
|
7521
6728
|
}
|
|
7522
|
-
|
|
7523
|
-
|
|
7524
|
-
|
|
7525
|
-
|
|
7526
|
-
|
|
6729
|
+
|
|
6730
|
+
const NO_SEMICOLON = { isNoStatement: true };
|
|
6731
|
+
// This assumes there are only white-space and comments between start and the string we are looking for
|
|
6732
|
+
function findFirstOccurrenceOutsideComment(code, searchString, start = 0) {
|
|
6733
|
+
let searchPos, charCodeAfterSlash;
|
|
6734
|
+
searchPos = code.indexOf(searchString, start);
|
|
6735
|
+
while (true) {
|
|
6736
|
+
start = code.indexOf('/', start);
|
|
6737
|
+
if (start === -1 || start >= searchPos)
|
|
6738
|
+
return searchPos;
|
|
6739
|
+
charCodeAfterSlash = code.charCodeAt(++start);
|
|
6740
|
+
++start;
|
|
6741
|
+
// With our assumption, '/' always starts a comment. Determine comment type:
|
|
6742
|
+
start =
|
|
6743
|
+
charCodeAfterSlash === 47 /*"/"*/
|
|
6744
|
+
? code.indexOf('\n', start) + 1
|
|
6745
|
+
: code.indexOf('*/', start) + 2;
|
|
6746
|
+
if (start > searchPos) {
|
|
6747
|
+
searchPos = code.indexOf(searchString, start);
|
|
6748
|
+
}
|
|
6749
|
+
}
|
|
6750
|
+
}
|
|
6751
|
+
const NON_WHITESPACE = /\S/g;
|
|
6752
|
+
function findNonWhiteSpace(code, index) {
|
|
6753
|
+
NON_WHITESPACE.lastIndex = index;
|
|
6754
|
+
const result = NON_WHITESPACE.exec(code);
|
|
6755
|
+
return result.index;
|
|
6756
|
+
}
|
|
6757
|
+
// This assumes "code" only contains white-space and comments
|
|
6758
|
+
// Returns position of line-comment if applicable
|
|
6759
|
+
function findFirstLineBreakOutsideComment(code) {
|
|
6760
|
+
let lineBreakPos, charCodeAfterSlash, start = 0;
|
|
6761
|
+
lineBreakPos = code.indexOf('\n', start);
|
|
6762
|
+
while (true) {
|
|
6763
|
+
start = code.indexOf('/', start);
|
|
6764
|
+
if (start === -1 || start > lineBreakPos)
|
|
6765
|
+
return [lineBreakPos, lineBreakPos + 1];
|
|
6766
|
+
// With our assumption, '/' always starts a comment. Determine comment type:
|
|
6767
|
+
charCodeAfterSlash = code.charCodeAt(start + 1);
|
|
6768
|
+
if (charCodeAfterSlash === 47 /*"/"*/)
|
|
6769
|
+
return [start, lineBreakPos + 1];
|
|
6770
|
+
start = code.indexOf('*/', start + 3) + 2;
|
|
6771
|
+
if (start > lineBreakPos) {
|
|
6772
|
+
lineBreakPos = code.indexOf('\n', start);
|
|
6773
|
+
}
|
|
6774
|
+
}
|
|
6775
|
+
}
|
|
6776
|
+
function renderStatementList(statements, code, start, end, options) {
|
|
6777
|
+
let currentNode, currentNodeStart, currentNodeNeedsBoundaries, nextNodeStart;
|
|
6778
|
+
let nextNode = statements[0];
|
|
6779
|
+
let nextNodeNeedsBoundaries = !nextNode.included || nextNode.needsBoundaries;
|
|
6780
|
+
if (nextNodeNeedsBoundaries) {
|
|
6781
|
+
nextNodeStart =
|
|
6782
|
+
start + findFirstLineBreakOutsideComment(code.original.slice(start, nextNode.start))[1];
|
|
6783
|
+
}
|
|
6784
|
+
for (let nextIndex = 1; nextIndex <= statements.length; nextIndex++) {
|
|
6785
|
+
currentNode = nextNode;
|
|
6786
|
+
currentNodeStart = nextNodeStart;
|
|
6787
|
+
currentNodeNeedsBoundaries = nextNodeNeedsBoundaries;
|
|
6788
|
+
nextNode = statements[nextIndex];
|
|
6789
|
+
nextNodeNeedsBoundaries =
|
|
6790
|
+
nextNode === undefined ? false : !nextNode.included || nextNode.needsBoundaries;
|
|
6791
|
+
if (currentNodeNeedsBoundaries || nextNodeNeedsBoundaries) {
|
|
6792
|
+
nextNodeStart =
|
|
6793
|
+
currentNode.end +
|
|
6794
|
+
findFirstLineBreakOutsideComment(code.original.slice(currentNode.end, nextNode === undefined ? end : nextNode.start))[1];
|
|
6795
|
+
if (currentNode.included) {
|
|
6796
|
+
currentNodeNeedsBoundaries
|
|
6797
|
+
? currentNode.render(code, options, {
|
|
6798
|
+
end: nextNodeStart,
|
|
6799
|
+
start: currentNodeStart
|
|
6800
|
+
})
|
|
6801
|
+
: currentNode.render(code, options);
|
|
6802
|
+
}
|
|
6803
|
+
else {
|
|
6804
|
+
treeshakeNode(currentNode, code, currentNodeStart, nextNodeStart);
|
|
6805
|
+
}
|
|
6806
|
+
}
|
|
6807
|
+
else {
|
|
6808
|
+
currentNode.render(code, options);
|
|
6809
|
+
}
|
|
6810
|
+
}
|
|
6811
|
+
}
|
|
6812
|
+
// This assumes that the first character is not part of the first node
|
|
6813
|
+
function getCommaSeparatedNodesWithBoundaries(nodes, code, start, end) {
|
|
6814
|
+
const splitUpNodes = [];
|
|
6815
|
+
let node, nextNode, nextNodeStart, contentEnd, char;
|
|
6816
|
+
let separator = start - 1;
|
|
6817
|
+
for (let nextIndex = 0; nextIndex < nodes.length; nextIndex++) {
|
|
6818
|
+
nextNode = nodes[nextIndex];
|
|
6819
|
+
if (node !== undefined) {
|
|
6820
|
+
separator =
|
|
6821
|
+
node.end +
|
|
6822
|
+
findFirstOccurrenceOutsideComment(code.original.slice(node.end, nextNode.start), ',');
|
|
6823
|
+
}
|
|
6824
|
+
nextNodeStart = contentEnd =
|
|
6825
|
+
separator +
|
|
6826
|
+
1 +
|
|
6827
|
+
findFirstLineBreakOutsideComment(code.original.slice(separator + 1, nextNode.start))[1];
|
|
6828
|
+
while (((char = code.original.charCodeAt(nextNodeStart)),
|
|
6829
|
+
char === 32 /*" "*/ || char === 9 /*"\t"*/ || char === 10 /*"\n"*/ || char === 13) /*"\r"*/)
|
|
6830
|
+
nextNodeStart++;
|
|
6831
|
+
if (node !== undefined) {
|
|
6832
|
+
splitUpNodes.push({
|
|
6833
|
+
contentEnd,
|
|
6834
|
+
end: nextNodeStart,
|
|
6835
|
+
node,
|
|
6836
|
+
separator,
|
|
6837
|
+
start
|
|
6838
|
+
});
|
|
6839
|
+
}
|
|
6840
|
+
node = nextNode;
|
|
6841
|
+
start = nextNodeStart;
|
|
6842
|
+
}
|
|
6843
|
+
splitUpNodes.push({
|
|
6844
|
+
contentEnd: end,
|
|
6845
|
+
end,
|
|
6846
|
+
node: node,
|
|
6847
|
+
separator: null,
|
|
6848
|
+
start
|
|
6849
|
+
});
|
|
6850
|
+
return splitUpNodes;
|
|
6851
|
+
}
|
|
6852
|
+
// This assumes there are only white-space and comments between start and end
|
|
6853
|
+
function removeLineBreaks(code, start, end) {
|
|
6854
|
+
while (true) {
|
|
6855
|
+
const [removeStart, removeEnd] = findFirstLineBreakOutsideComment(code.original.slice(start, end));
|
|
6856
|
+
if (removeStart === -1) {
|
|
6857
|
+
break;
|
|
6858
|
+
}
|
|
6859
|
+
code.remove(start + removeStart, (start += removeEnd));
|
|
6860
|
+
}
|
|
6861
|
+
}
|
|
6862
|
+
|
|
6863
|
+
class BlockScope extends ChildScope {
|
|
6864
|
+
addDeclaration(identifier, context, init, isHoisted) {
|
|
6865
|
+
if (isHoisted) {
|
|
6866
|
+
const variable = this.parent.addDeclaration(identifier, context, init, isHoisted);
|
|
6867
|
+
// Necessary to make sure the init is deoptimized for conditional declarations.
|
|
6868
|
+
// We cannot call deoptimizePath here.
|
|
6869
|
+
variable.markInitializersForDeoptimization();
|
|
6870
|
+
return variable;
|
|
6871
|
+
}
|
|
6872
|
+
else {
|
|
6873
|
+
return super.addDeclaration(identifier, context, init, false);
|
|
6874
|
+
}
|
|
6875
|
+
}
|
|
6876
|
+
}
|
|
6877
|
+
|
|
6878
|
+
class ExpressionStatement extends NodeBase {
|
|
6879
|
+
initialise() {
|
|
6880
|
+
if (this.directive &&
|
|
6881
|
+
this.directive !== 'use strict' &&
|
|
6882
|
+
this.parent.type === Program$1) {
|
|
6883
|
+
this.context.warn(
|
|
6884
|
+
// This is necessary, because either way (deleting or not) can lead to errors.
|
|
6885
|
+
{
|
|
6886
|
+
code: 'MODULE_LEVEL_DIRECTIVE',
|
|
6887
|
+
message: `Module level directives cause errors when bundled, '${this.directive}' was ignored.`
|
|
6888
|
+
}, this.start);
|
|
6889
|
+
}
|
|
6890
|
+
}
|
|
6891
|
+
render(code, options) {
|
|
6892
|
+
super.render(code, options);
|
|
6893
|
+
if (this.included)
|
|
6894
|
+
this.insertSemicolon(code);
|
|
6895
|
+
}
|
|
6896
|
+
shouldBeIncluded(context) {
|
|
6897
|
+
if (this.directive && this.directive !== 'use strict')
|
|
6898
|
+
return this.parent.type !== Program$1;
|
|
6899
|
+
return super.shouldBeIncluded(context);
|
|
6900
|
+
}
|
|
6901
|
+
}
|
|
6902
|
+
|
|
6903
|
+
class BlockStatement extends NodeBase {
|
|
6904
|
+
constructor() {
|
|
6905
|
+
super(...arguments);
|
|
6906
|
+
this.directlyIncluded = false;
|
|
6907
|
+
}
|
|
6908
|
+
addImplicitReturnExpressionToScope() {
|
|
6909
|
+
const lastStatement = this.body[this.body.length - 1];
|
|
6910
|
+
if (!lastStatement || lastStatement.type !== ReturnStatement$1) {
|
|
6911
|
+
this.scope.addReturnExpression(UNKNOWN_EXPRESSION);
|
|
6912
|
+
}
|
|
6913
|
+
}
|
|
6914
|
+
createScope(parentScope) {
|
|
6915
|
+
this.scope = this.parent.preventChildBlockScope
|
|
6916
|
+
? parentScope
|
|
6917
|
+
: new BlockScope(parentScope);
|
|
6918
|
+
}
|
|
6919
|
+
hasEffects(context) {
|
|
6920
|
+
if (this.deoptimizeBody)
|
|
6921
|
+
return true;
|
|
6922
|
+
for (const node of this.body) {
|
|
6923
|
+
if (context.brokenFlow)
|
|
6924
|
+
break;
|
|
6925
|
+
if (node.hasEffects(context))
|
|
6926
|
+
return true;
|
|
6927
|
+
}
|
|
6928
|
+
return false;
|
|
6929
|
+
}
|
|
6930
|
+
include(context, includeChildrenRecursively) {
|
|
6931
|
+
if (!(this.deoptimizeBody && this.directlyIncluded)) {
|
|
6932
|
+
this.included = true;
|
|
6933
|
+
this.directlyIncluded = true;
|
|
6934
|
+
if (this.deoptimizeBody)
|
|
6935
|
+
includeChildrenRecursively = true;
|
|
6936
|
+
for (const node of this.body) {
|
|
6937
|
+
if (includeChildrenRecursively || node.shouldBeIncluded(context))
|
|
6938
|
+
node.include(context, includeChildrenRecursively);
|
|
6939
|
+
}
|
|
6940
|
+
}
|
|
6941
|
+
}
|
|
6942
|
+
initialise() {
|
|
6943
|
+
const firstBodyStatement = this.body[0];
|
|
6944
|
+
this.deoptimizeBody =
|
|
6945
|
+
firstBodyStatement instanceof ExpressionStatement &&
|
|
6946
|
+
firstBodyStatement.directive === 'use asm';
|
|
6947
|
+
}
|
|
6948
|
+
render(code, options) {
|
|
6949
|
+
if (this.body.length) {
|
|
6950
|
+
renderStatementList(this.body, code, this.start + 1, this.end - 1, options);
|
|
7527
6951
|
}
|
|
7528
|
-
|
|
7529
|
-
|
|
7530
|
-
return null;
|
|
6952
|
+
else {
|
|
6953
|
+
super.render(code, options);
|
|
7531
6954
|
}
|
|
7532
6955
|
}
|
|
7533
|
-
return currentGlobal[ValueProperties];
|
|
7534
6956
|
}
|
|
7535
6957
|
|
|
7536
|
-
class
|
|
6958
|
+
class RestElement extends NodeBase {
|
|
7537
6959
|
constructor() {
|
|
7538
6960
|
super(...arguments);
|
|
7539
|
-
|
|
7540
|
-
|
|
7541
|
-
this.isReassigned = true;
|
|
6961
|
+
this.deoptimized = false;
|
|
6962
|
+
this.declarationInit = null;
|
|
7542
6963
|
}
|
|
7543
|
-
|
|
7544
|
-
|
|
7545
|
-
// Technically, "undefined" is a global variable of sorts
|
|
7546
|
-
return this.name !== 'undefined' && getGlobalAtPath([this.name]) === null;
|
|
7547
|
-
}
|
|
7548
|
-
return getGlobalAtPath([this.name, ...path].slice(0, -1)) === null;
|
|
6964
|
+
addExportedVariables(variables, exportNamesByVariable) {
|
|
6965
|
+
this.argument.addExportedVariables(variables, exportNamesByVariable);
|
|
7549
6966
|
}
|
|
7550
|
-
|
|
7551
|
-
|
|
7552
|
-
return
|
|
6967
|
+
declare(kind, init) {
|
|
6968
|
+
this.declarationInit = init;
|
|
6969
|
+
return this.argument.declare(kind, UNKNOWN_EXPRESSION);
|
|
6970
|
+
}
|
|
6971
|
+
deoptimizePath(path) {
|
|
6972
|
+
path.length === 0 && this.argument.deoptimizePath(EMPTY_PATH);
|
|
6973
|
+
}
|
|
6974
|
+
hasEffectsWhenAssignedAtPath(path, context) {
|
|
6975
|
+
return path.length > 0 || this.argument.hasEffectsWhenAssignedAtPath(EMPTY_PATH, context);
|
|
6976
|
+
}
|
|
6977
|
+
markDeclarationReached() {
|
|
6978
|
+
this.argument.markDeclarationReached();
|
|
6979
|
+
}
|
|
6980
|
+
applyDeoptimizations() {
|
|
6981
|
+
this.deoptimized = true;
|
|
6982
|
+
if (this.declarationInit !== null) {
|
|
6983
|
+
this.declarationInit.deoptimizePath([UnknownKey, UnknownKey]);
|
|
6984
|
+
this.context.requestTreeshakingPass();
|
|
6985
|
+
}
|
|
7553
6986
|
}
|
|
7554
6987
|
}
|
|
7555
6988
|
|
|
7556
|
-
|
|
7557
|
-
__proto__: null,
|
|
7558
|
-
class: true,
|
|
7559
|
-
const: true,
|
|
7560
|
-
let: true,
|
|
7561
|
-
var: true
|
|
7562
|
-
};
|
|
7563
|
-
class Identifier extends NodeBase {
|
|
6989
|
+
class FunctionBase extends NodeBase {
|
|
7564
6990
|
constructor() {
|
|
7565
6991
|
super(...arguments);
|
|
7566
|
-
|
|
7567
|
-
this.
|
|
7568
|
-
this.
|
|
7569
|
-
|
|
7570
|
-
addExportedVariables(variables, exportNamesByVariable) {
|
|
7571
|
-
if (this.variable !== null && exportNamesByVariable.has(this.variable)) {
|
|
7572
|
-
variables.push(this.variable);
|
|
7573
|
-
}
|
|
7574
|
-
}
|
|
7575
|
-
bind() {
|
|
7576
|
-
if (this.variable === null && is_reference(this, this.parent)) {
|
|
7577
|
-
this.variable = this.scope.findVariable(this.name);
|
|
7578
|
-
this.variable.addReference(this);
|
|
7579
|
-
}
|
|
6992
|
+
// By default, parameters are included via includeArgumentsWhenCalledAtPath
|
|
6993
|
+
this.alwaysIncludeParameters = false;
|
|
6994
|
+
this.objectEntity = null;
|
|
6995
|
+
this.deoptimizedReturn = false;
|
|
7580
6996
|
}
|
|
7581
|
-
|
|
7582
|
-
|
|
7583
|
-
const { treeshake } = this.context.options;
|
|
7584
|
-
switch (kind) {
|
|
7585
|
-
case 'var':
|
|
7586
|
-
variable = this.scope.addDeclaration(this, this.context, init, true);
|
|
7587
|
-
if (treeshake && treeshake.correctVarValueBeforeDeclaration) {
|
|
7588
|
-
// Necessary to make sure the init is deoptimized. We cannot call deoptimizePath here.
|
|
7589
|
-
variable.markInitializersForDeoptimization();
|
|
7590
|
-
}
|
|
7591
|
-
break;
|
|
7592
|
-
case 'function':
|
|
7593
|
-
// in strict mode, functions are only hoisted within a scope but not across block scopes
|
|
7594
|
-
variable = this.scope.addDeclaration(this, this.context, init, false);
|
|
7595
|
-
break;
|
|
7596
|
-
case 'let':
|
|
7597
|
-
case 'const':
|
|
7598
|
-
case 'class':
|
|
7599
|
-
variable = this.scope.addDeclaration(this, this.context, init, false);
|
|
7600
|
-
break;
|
|
7601
|
-
case 'parameter':
|
|
7602
|
-
variable = this.scope.addParameterDeclaration(this);
|
|
7603
|
-
break;
|
|
7604
|
-
/* istanbul ignore next */
|
|
7605
|
-
default:
|
|
7606
|
-
/* istanbul ignore next */
|
|
7607
|
-
throw new Error(`Internal Error: Unexpected identifier kind ${kind}.`);
|
|
7608
|
-
}
|
|
7609
|
-
variable.kind = kind;
|
|
7610
|
-
return [(this.variable = variable)];
|
|
6997
|
+
deoptimizeCache() {
|
|
6998
|
+
this.alwaysIncludeParameters = true;
|
|
7611
6999
|
}
|
|
7612
7000
|
deoptimizePath(path) {
|
|
7613
|
-
|
|
7614
|
-
|
|
7001
|
+
this.getObjectEntity().deoptimizePath(path);
|
|
7002
|
+
if (path.length === 1 && path[0] === UnknownKey) {
|
|
7003
|
+
// A reassignment of UNKNOWN_PATH is considered equivalent to having lost track
|
|
7004
|
+
// which means the return expression needs to be reassigned
|
|
7005
|
+
this.alwaysIncludeParameters = true;
|
|
7006
|
+
this.scope.getReturnExpression().deoptimizePath(UNKNOWN_PATH);
|
|
7615
7007
|
}
|
|
7616
|
-
this.variable.deoptimizePath(path);
|
|
7617
7008
|
}
|
|
7618
7009
|
deoptimizeThisOnEventAtPath(event, path, thisParameter, recursionTracker) {
|
|
7619
|
-
|
|
7010
|
+
if (path.length > 0) {
|
|
7011
|
+
this.getObjectEntity().deoptimizeThisOnEventAtPath(event, path, thisParameter, recursionTracker);
|
|
7012
|
+
}
|
|
7620
7013
|
}
|
|
7621
7014
|
getLiteralValueAtPath(path, recursionTracker, origin) {
|
|
7622
|
-
return this.
|
|
7015
|
+
return this.getObjectEntity().getLiteralValueAtPath(path, recursionTracker, origin);
|
|
7623
7016
|
}
|
|
7624
7017
|
getReturnExpressionWhenCalledAtPath(path, callOptions, recursionTracker, origin) {
|
|
7625
|
-
|
|
7626
|
-
|
|
7627
|
-
hasEffects() {
|
|
7628
|
-
if (!this.deoptimized)
|
|
7629
|
-
this.applyDeoptimizations();
|
|
7630
|
-
if (this.isPossibleTDZ() && this.variable.kind !== 'var') {
|
|
7631
|
-
return true;
|
|
7018
|
+
if (path.length > 0) {
|
|
7019
|
+
return this.getObjectEntity().getReturnExpressionWhenCalledAtPath(path, callOptions, recursionTracker, origin);
|
|
7632
7020
|
}
|
|
7633
|
-
|
|
7634
|
-
this.
|
|
7635
|
-
|
|
7021
|
+
if (this.async) {
|
|
7022
|
+
if (!this.deoptimizedReturn) {
|
|
7023
|
+
this.deoptimizedReturn = true;
|
|
7024
|
+
this.scope.getReturnExpression().deoptimizePath(UNKNOWN_PATH);
|
|
7025
|
+
this.context.requestTreeshakingPass();
|
|
7026
|
+
}
|
|
7027
|
+
return UNKNOWN_EXPRESSION;
|
|
7028
|
+
}
|
|
7029
|
+
return this.scope.getReturnExpression();
|
|
7636
7030
|
}
|
|
7637
7031
|
hasEffectsWhenAccessedAtPath(path, context) {
|
|
7638
|
-
return
|
|
7639
|
-
this.getVariableRespectingTDZ().hasEffectsWhenAccessedAtPath(path, context));
|
|
7032
|
+
return this.getObjectEntity().hasEffectsWhenAccessedAtPath(path, context);
|
|
7640
7033
|
}
|
|
7641
7034
|
hasEffectsWhenAssignedAtPath(path, context) {
|
|
7642
|
-
return
|
|
7643
|
-
(path.length > 0
|
|
7644
|
-
? this.getVariableRespectingTDZ()
|
|
7645
|
-
: this.variable).hasEffectsWhenAssignedAtPath(path, context));
|
|
7035
|
+
return this.getObjectEntity().hasEffectsWhenAssignedAtPath(path, context);
|
|
7646
7036
|
}
|
|
7647
7037
|
hasEffectsWhenCalledAtPath(path, callOptions, context) {
|
|
7648
|
-
|
|
7649
|
-
this.
|
|
7650
|
-
}
|
|
7651
|
-
include() {
|
|
7652
|
-
if (!this.deoptimized)
|
|
7653
|
-
this.applyDeoptimizations();
|
|
7654
|
-
if (!this.included) {
|
|
7655
|
-
this.included = true;
|
|
7656
|
-
if (this.variable !== null) {
|
|
7657
|
-
this.context.includeVariableInModule(this.variable);
|
|
7658
|
-
}
|
|
7659
|
-
}
|
|
7660
|
-
}
|
|
7661
|
-
includeCallArguments(context, args) {
|
|
7662
|
-
this.getVariableRespectingTDZ().includeCallArguments(context, args);
|
|
7663
|
-
}
|
|
7664
|
-
isPossibleTDZ() {
|
|
7665
|
-
// return cached value to avoid issues with the next tree-shaking pass
|
|
7666
|
-
if (this.isTDZAccess !== null)
|
|
7667
|
-
return this.isTDZAccess;
|
|
7668
|
-
if (!(this.variable instanceof LocalVariable) ||
|
|
7669
|
-
!this.variable.kind ||
|
|
7670
|
-
!(this.variable.kind in tdzVariableKinds)) {
|
|
7671
|
-
return (this.isTDZAccess = false);
|
|
7672
|
-
}
|
|
7673
|
-
let decl_id;
|
|
7674
|
-
if (this.variable.declarations &&
|
|
7675
|
-
this.variable.declarations.length === 1 &&
|
|
7676
|
-
(decl_id = this.variable.declarations[0]) &&
|
|
7677
|
-
this.start < decl_id.start &&
|
|
7678
|
-
closestParentFunctionOrProgram(this) === closestParentFunctionOrProgram(decl_id)) {
|
|
7679
|
-
// a variable accessed before its declaration
|
|
7680
|
-
// in the same function or at top level of module
|
|
7681
|
-
return (this.isTDZAccess = true);
|
|
7682
|
-
}
|
|
7683
|
-
if (!this.variable.initReached) {
|
|
7684
|
-
// Either a const/let TDZ violation or
|
|
7685
|
-
// var use before declaration was encountered.
|
|
7686
|
-
return (this.isTDZAccess = true);
|
|
7038
|
+
if (path.length > 0) {
|
|
7039
|
+
return this.getObjectEntity().hasEffectsWhenCalledAtPath(path, callOptions, context);
|
|
7687
7040
|
}
|
|
7688
|
-
|
|
7689
|
-
|
|
7690
|
-
|
|
7691
|
-
|
|
7692
|
-
|
|
7693
|
-
|
|
7694
|
-
|
|
7695
|
-
|
|
7696
|
-
|
|
7697
|
-
code.overwrite(this.start, this.end, name, {
|
|
7698
|
-
contentOnly: true,
|
|
7699
|
-
storeName: true
|
|
7700
|
-
});
|
|
7701
|
-
if (isShorthandProperty) {
|
|
7702
|
-
code.prependRight(this.start, `${this.name}: `);
|
|
7703
|
-
}
|
|
7704
|
-
}
|
|
7705
|
-
// In strict mode, any variable named "eval" must be the actual "eval" function
|
|
7706
|
-
if (name === 'eval' &&
|
|
7707
|
-
renderedParentType === CallExpression$1 &&
|
|
7708
|
-
isCalleeOfRenderedParent) {
|
|
7709
|
-
code.appendRight(this.start, '0, ');
|
|
7041
|
+
if (this.async) {
|
|
7042
|
+
const { propertyReadSideEffects } = this.context.options
|
|
7043
|
+
.treeshake;
|
|
7044
|
+
const returnExpression = this.scope.getReturnExpression();
|
|
7045
|
+
if (returnExpression.hasEffectsWhenCalledAtPath(['then'], { args: NO_ARGS, thisParam: null, withNew: false }, context) ||
|
|
7046
|
+
(propertyReadSideEffects &&
|
|
7047
|
+
(propertyReadSideEffects === 'always' ||
|
|
7048
|
+
returnExpression.hasEffectsWhenAccessedAtPath(['then'], context)))) {
|
|
7049
|
+
return true;
|
|
7710
7050
|
}
|
|
7711
7051
|
}
|
|
7712
|
-
|
|
7713
|
-
|
|
7714
|
-
|
|
7715
|
-
if (this.variable !== null && this.variable instanceof LocalVariable) {
|
|
7716
|
-
this.variable.consolidateInitializers();
|
|
7717
|
-
this.context.requestTreeshakingPass();
|
|
7052
|
+
for (const param of this.params) {
|
|
7053
|
+
if (param.hasEffects(context))
|
|
7054
|
+
return true;
|
|
7718
7055
|
}
|
|
7056
|
+
return false;
|
|
7719
7057
|
}
|
|
7720
|
-
|
|
7721
|
-
|
|
7722
|
-
|
|
7723
|
-
|
|
7724
|
-
|
|
7725
|
-
|
|
7726
|
-
|
|
7727
|
-
|
|
7728
|
-
|
|
7058
|
+
include(context, includeChildrenRecursively) {
|
|
7059
|
+
this.included = true;
|
|
7060
|
+
const { brokenFlow } = context;
|
|
7061
|
+
context.brokenFlow = BROKEN_FLOW_NONE;
|
|
7062
|
+
this.body.include(context, includeChildrenRecursively);
|
|
7063
|
+
context.brokenFlow = brokenFlow;
|
|
7064
|
+
if (includeChildrenRecursively || this.alwaysIncludeParameters) {
|
|
7065
|
+
for (const param of this.params) {
|
|
7066
|
+
param.include(context, includeChildrenRecursively);
|
|
7067
|
+
}
|
|
7729
7068
|
}
|
|
7730
|
-
return this.variable;
|
|
7731
7069
|
}
|
|
7732
|
-
|
|
7733
|
-
|
|
7734
|
-
|
|
7735
|
-
|
|
7736
|
-
|
|
7737
|
-
|
|
7738
|
-
|
|
7739
|
-
|
|
7740
|
-
|
|
7741
|
-
|
|
7742
|
-
|
|
7743
|
-
|
|
7744
|
-
|
|
7745
|
-
|
|
7746
|
-
|
|
7747
|
-
|
|
7748
|
-
|
|
7749
|
-
|
|
7070
|
+
includeArgumentsWhenCalledAtPath(path, context, args) {
|
|
7071
|
+
var _a;
|
|
7072
|
+
if (path.length === 0) {
|
|
7073
|
+
for (let position = 0; position < this.params.length; position++) {
|
|
7074
|
+
const parameter = this.params[position];
|
|
7075
|
+
if (parameter instanceof AssignmentPattern) {
|
|
7076
|
+
if (parameter.left.shouldBeIncluded(context)) {
|
|
7077
|
+
parameter.left.include(context, false);
|
|
7078
|
+
}
|
|
7079
|
+
const argumentValue = (_a = args[position]) === null || _a === void 0 ? void 0 : _a.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, this);
|
|
7080
|
+
// If argumentValue === UnknownTruthyValue, then we do not need to
|
|
7081
|
+
// include the default
|
|
7082
|
+
if ((argumentValue === undefined || argumentValue === UnknownValue) &&
|
|
7083
|
+
(this.parameterVariables[position].some(variable => variable.included) ||
|
|
7084
|
+
parameter.right.shouldBeIncluded(context))) {
|
|
7085
|
+
parameter.right.include(context, false);
|
|
7086
|
+
}
|
|
7087
|
+
}
|
|
7088
|
+
else if (parameter.shouldBeIncluded(context)) {
|
|
7089
|
+
parameter.include(context, false);
|
|
7090
|
+
}
|
|
7750
7091
|
}
|
|
7092
|
+
this.scope.includeCallArguments(context, args);
|
|
7093
|
+
}
|
|
7094
|
+
else {
|
|
7095
|
+
this.getObjectEntity().includeArgumentsWhenCalledAtPath(path, context, args);
|
|
7751
7096
|
}
|
|
7752
7097
|
}
|
|
7753
|
-
|
|
7754
|
-
|
|
7755
|
-
|
|
7756
|
-
|
|
7098
|
+
initialise() {
|
|
7099
|
+
this.parameterVariables = this.params.map(param => param.declare('parameter', UNKNOWN_EXPRESSION));
|
|
7100
|
+
this.scope.addParameterVariables(this.parameterVariables, this.params[this.params.length - 1] instanceof RestElement);
|
|
7101
|
+
if (this.body instanceof BlockStatement) {
|
|
7102
|
+
this.body.addImplicitReturnExpressionToScope();
|
|
7103
|
+
}
|
|
7104
|
+
else {
|
|
7105
|
+
this.scope.addReturnExpression(this.body);
|
|
7106
|
+
}
|
|
7757
7107
|
}
|
|
7758
|
-
|
|
7759
|
-
|
|
7760
|
-
|
|
7108
|
+
parseNode(esTreeNode) {
|
|
7109
|
+
if (esTreeNode.body.type === BlockStatement$1) {
|
|
7110
|
+
this.body = new BlockStatement(esTreeNode.body, this, this.scope.hoistedBodyVarScope);
|
|
7761
7111
|
}
|
|
7112
|
+
super.parseNode(esTreeNode);
|
|
7762
7113
|
}
|
|
7763
7114
|
}
|
|
7115
|
+
FunctionBase.prototype.preventChildBlockScope = true;
|
|
7764
7116
|
|
|
7765
|
-
|
|
7766
|
-
|
|
7767
|
-
|
|
7768
|
-
|
|
7769
|
-
searchPos = code.indexOf(searchString, start);
|
|
7770
|
-
while (true) {
|
|
7771
|
-
start = code.indexOf('/', start);
|
|
7772
|
-
if (start === -1 || start >= searchPos)
|
|
7773
|
-
return searchPos;
|
|
7774
|
-
charCodeAfterSlash = code.charCodeAt(++start);
|
|
7775
|
-
++start;
|
|
7776
|
-
// With our assumption, '/' always starts a comment. Determine comment type:
|
|
7777
|
-
start =
|
|
7778
|
-
charCodeAfterSlash === 47 /*"/"*/
|
|
7779
|
-
? code.indexOf('\n', start) + 1
|
|
7780
|
-
: code.indexOf('*/', start) + 2;
|
|
7781
|
-
if (start > searchPos) {
|
|
7782
|
-
searchPos = code.indexOf(searchString, start);
|
|
7783
|
-
}
|
|
7117
|
+
class ArrowFunctionExpression extends FunctionBase {
|
|
7118
|
+
constructor() {
|
|
7119
|
+
super(...arguments);
|
|
7120
|
+
this.objectEntity = null;
|
|
7784
7121
|
}
|
|
7785
|
-
|
|
7786
|
-
|
|
7787
|
-
|
|
7788
|
-
|
|
7789
|
-
|
|
7790
|
-
|
|
7791
|
-
|
|
7792
|
-
|
|
7793
|
-
|
|
7794
|
-
|
|
7795
|
-
|
|
7796
|
-
|
|
7797
|
-
|
|
7798
|
-
|
|
7799
|
-
|
|
7800
|
-
|
|
7801
|
-
|
|
7802
|
-
|
|
7803
|
-
|
|
7804
|
-
|
|
7805
|
-
|
|
7806
|
-
|
|
7807
|
-
|
|
7122
|
+
createScope(parentScope) {
|
|
7123
|
+
this.scope = new ReturnValueScope(parentScope, this.context);
|
|
7124
|
+
}
|
|
7125
|
+
hasEffects() {
|
|
7126
|
+
return false;
|
|
7127
|
+
}
|
|
7128
|
+
hasEffectsWhenCalledAtPath(path, callOptions, context) {
|
|
7129
|
+
if (super.hasEffectsWhenCalledAtPath(path, callOptions, context))
|
|
7130
|
+
return true;
|
|
7131
|
+
const { ignore, brokenFlow } = context;
|
|
7132
|
+
context.ignore = {
|
|
7133
|
+
breaks: false,
|
|
7134
|
+
continues: false,
|
|
7135
|
+
labels: new Set(),
|
|
7136
|
+
returnYield: true
|
|
7137
|
+
};
|
|
7138
|
+
if (this.body.hasEffects(context))
|
|
7139
|
+
return true;
|
|
7140
|
+
context.ignore = ignore;
|
|
7141
|
+
context.brokenFlow = brokenFlow;
|
|
7142
|
+
return false;
|
|
7143
|
+
}
|
|
7144
|
+
getObjectEntity() {
|
|
7145
|
+
if (this.objectEntity !== null) {
|
|
7146
|
+
return this.objectEntity;
|
|
7808
7147
|
}
|
|
7148
|
+
return (this.objectEntity = new ObjectEntity([], OBJECT_PROTOTYPE));
|
|
7809
7149
|
}
|
|
7810
7150
|
}
|
|
7811
|
-
|
|
7812
|
-
|
|
7813
|
-
|
|
7814
|
-
|
|
7815
|
-
|
|
7816
|
-
|
|
7817
|
-
start + findFirstLineBreakOutsideComment(code.original.slice(start, nextNode.start))[1];
|
|
7151
|
+
|
|
7152
|
+
function getSystemExportStatement(exportedVariables, { exportNamesByVariable, snippets: { _, getObject, getPropertyAccess } }, modifier = '') {
|
|
7153
|
+
if (exportedVariables.length === 1 &&
|
|
7154
|
+
exportNamesByVariable.get(exportedVariables[0]).length === 1) {
|
|
7155
|
+
const variable = exportedVariables[0];
|
|
7156
|
+
return `exports('${exportNamesByVariable.get(variable)}',${_}${variable.getName(getPropertyAccess)}${modifier})`;
|
|
7818
7157
|
}
|
|
7819
|
-
|
|
7820
|
-
|
|
7821
|
-
|
|
7822
|
-
|
|
7823
|
-
|
|
7824
|
-
nextNodeNeedsBoundaries =
|
|
7825
|
-
nextNode === undefined ? false : !nextNode.included || nextNode.needsBoundaries;
|
|
7826
|
-
if (currentNodeNeedsBoundaries || nextNodeNeedsBoundaries) {
|
|
7827
|
-
nextNodeStart =
|
|
7828
|
-
currentNode.end +
|
|
7829
|
-
findFirstLineBreakOutsideComment(code.original.slice(currentNode.end, nextNode === undefined ? end : nextNode.start))[1];
|
|
7830
|
-
if (currentNode.included) {
|
|
7831
|
-
currentNodeNeedsBoundaries
|
|
7832
|
-
? currentNode.render(code, options, {
|
|
7833
|
-
end: nextNodeStart,
|
|
7834
|
-
start: currentNodeStart
|
|
7835
|
-
})
|
|
7836
|
-
: currentNode.render(code, options);
|
|
7837
|
-
}
|
|
7838
|
-
else {
|
|
7839
|
-
treeshakeNode(currentNode, code, currentNodeStart, nextNodeStart);
|
|
7158
|
+
else {
|
|
7159
|
+
const fields = [];
|
|
7160
|
+
for (const variable of exportedVariables) {
|
|
7161
|
+
for (const exportName of exportNamesByVariable.get(variable)) {
|
|
7162
|
+
fields.push([exportName, variable.getName(getPropertyAccess) + modifier]);
|
|
7840
7163
|
}
|
|
7841
7164
|
}
|
|
7842
|
-
|
|
7843
|
-
currentNode.render(code, options);
|
|
7844
|
-
}
|
|
7165
|
+
return `exports(${getObject(fields, { lineBreakIndent: null })})`;
|
|
7845
7166
|
}
|
|
7846
7167
|
}
|
|
7847
|
-
|
|
7848
|
-
|
|
7849
|
-
|
|
7850
|
-
|
|
7851
|
-
|
|
7852
|
-
|
|
7853
|
-
|
|
7854
|
-
|
|
7855
|
-
|
|
7856
|
-
|
|
7857
|
-
|
|
7858
|
-
|
|
7859
|
-
|
|
7860
|
-
|
|
7861
|
-
|
|
7862
|
-
findFirstLineBreakOutsideComment(code.original.slice(separator + 1, nextNode.start))[1];
|
|
7863
|
-
while (((char = code.original.charCodeAt(nextNodeStart)),
|
|
7864
|
-
char === 32 /*" "*/ || char === 9 /*"\t"*/ || char === 10 /*"\n"*/ || char === 13) /*"\r"*/)
|
|
7865
|
-
nextNodeStart++;
|
|
7866
|
-
if (node !== undefined) {
|
|
7867
|
-
splitUpNodes.push({
|
|
7868
|
-
contentEnd,
|
|
7869
|
-
end: nextNodeStart,
|
|
7870
|
-
node,
|
|
7871
|
-
separator,
|
|
7872
|
-
start
|
|
7873
|
-
});
|
|
7874
|
-
}
|
|
7875
|
-
node = nextNode;
|
|
7876
|
-
start = nextNodeStart;
|
|
7168
|
+
function renderSystemExportExpression(exportedVariable, expressionStart, expressionEnd, code, { exportNamesByVariable, snippets: { _ } }) {
|
|
7169
|
+
code.prependRight(expressionStart, `exports('${exportNamesByVariable.get(exportedVariable)}',${_}`);
|
|
7170
|
+
code.appendLeft(expressionEnd, ')');
|
|
7171
|
+
}
|
|
7172
|
+
function renderSystemExportFunction(exportedVariables, expressionStart, expressionEnd, needsParens, code, options) {
|
|
7173
|
+
const { _, getDirectReturnIifeLeft } = options.snippets;
|
|
7174
|
+
code.prependRight(expressionStart, getDirectReturnIifeLeft(['v'], `${getSystemExportStatement(exportedVariables, options)},${_}v`, { needsArrowReturnParens: true, needsWrappedFunction: needsParens }));
|
|
7175
|
+
code.appendLeft(expressionEnd, ')');
|
|
7176
|
+
}
|
|
7177
|
+
function renderSystemExportSequenceAfterExpression(exportedVariable, expressionStart, expressionEnd, needsParens, code, options) {
|
|
7178
|
+
const { _, getPropertyAccess } = options.snippets;
|
|
7179
|
+
code.appendLeft(expressionEnd, `,${_}${getSystemExportStatement([exportedVariable], options)},${_}${exportedVariable.getName(getPropertyAccess)}`);
|
|
7180
|
+
if (needsParens) {
|
|
7181
|
+
code.prependRight(expressionStart, '(');
|
|
7182
|
+
code.appendLeft(expressionEnd, ')');
|
|
7877
7183
|
}
|
|
7878
|
-
splitUpNodes.push({
|
|
7879
|
-
contentEnd: end,
|
|
7880
|
-
end,
|
|
7881
|
-
node: node,
|
|
7882
|
-
separator: null,
|
|
7883
|
-
start
|
|
7884
|
-
});
|
|
7885
|
-
return splitUpNodes;
|
|
7886
7184
|
}
|
|
7887
|
-
|
|
7888
|
-
|
|
7889
|
-
|
|
7890
|
-
|
|
7891
|
-
|
|
7892
|
-
|
|
7185
|
+
function renderSystemExportSequenceBeforeExpression(exportedVariable, expressionStart, expressionEnd, needsParens, code, options, modifier) {
|
|
7186
|
+
const { _ } = options.snippets;
|
|
7187
|
+
code.prependRight(expressionStart, `${getSystemExportStatement([exportedVariable], options, modifier)},${_}`);
|
|
7188
|
+
if (needsParens) {
|
|
7189
|
+
code.prependRight(expressionStart, '(');
|
|
7190
|
+
code.appendLeft(expressionEnd, ')');
|
|
7191
|
+
}
|
|
7192
|
+
}
|
|
7193
|
+
|
|
7194
|
+
//@ts-check
|
|
7195
|
+
/** @typedef { import('estree').Node} Node */
|
|
7196
|
+
/** @typedef {Node | {
|
|
7197
|
+
* type: 'PropertyDefinition';
|
|
7198
|
+
* computed: boolean;
|
|
7199
|
+
* value: Node
|
|
7200
|
+
* }} NodeWithPropertyDefinition */
|
|
7201
|
+
|
|
7202
|
+
/**
|
|
7203
|
+
*
|
|
7204
|
+
* @param {NodeWithPropertyDefinition} node
|
|
7205
|
+
* @param {NodeWithPropertyDefinition} parent
|
|
7206
|
+
* @returns boolean
|
|
7207
|
+
*/
|
|
7208
|
+
function is_reference (node, parent) {
|
|
7209
|
+
if (node.type === 'MemberExpression') {
|
|
7210
|
+
return !node.computed && is_reference(node.object, node);
|
|
7211
|
+
}
|
|
7212
|
+
|
|
7213
|
+
if (node.type === 'Identifier') {
|
|
7214
|
+
if (!parent) return true;
|
|
7215
|
+
|
|
7216
|
+
switch (parent.type) {
|
|
7217
|
+
// disregard `bar` in `foo.bar`
|
|
7218
|
+
case 'MemberExpression': return parent.computed || node === parent.object;
|
|
7219
|
+
|
|
7220
|
+
// disregard the `foo` in `class {foo(){}}` but keep it in `class {[foo](){}}`
|
|
7221
|
+
case 'MethodDefinition': return parent.computed;
|
|
7222
|
+
|
|
7223
|
+
// disregard the `foo` in `class {foo=bar}` but keep it in `class {[foo]=bar}` and `class {bar=foo}`
|
|
7224
|
+
case 'PropertyDefinition': return parent.computed || node === parent.value;
|
|
7225
|
+
|
|
7226
|
+
// disregard the `bar` in `{ bar: foo }`, but keep it in `{ [bar]: foo }`
|
|
7227
|
+
case 'Property': return parent.computed || node === parent.value;
|
|
7228
|
+
|
|
7229
|
+
// disregard the `bar` in `export { foo as bar }` or
|
|
7230
|
+
// the foo in `import { foo as bar }`
|
|
7231
|
+
case 'ExportSpecifier':
|
|
7232
|
+
case 'ImportSpecifier': return node === parent.local;
|
|
7233
|
+
|
|
7234
|
+
// disregard the `foo` in `foo: while (...) { ... break foo; ... continue foo;}`
|
|
7235
|
+
case 'LabeledStatement':
|
|
7236
|
+
case 'BreakStatement':
|
|
7237
|
+
case 'ContinueStatement': return false;
|
|
7238
|
+
default: return true;
|
|
7239
|
+
}
|
|
7240
|
+
}
|
|
7241
|
+
|
|
7242
|
+
return false;
|
|
7243
|
+
}
|
|
7244
|
+
|
|
7245
|
+
/* eslint sort-keys: "off" */
|
|
7246
|
+
const ValueProperties = Symbol('Value Properties');
|
|
7247
|
+
const PURE = {
|
|
7248
|
+
hasEffectsWhenCalled() {
|
|
7249
|
+
return false;
|
|
7250
|
+
}
|
|
7251
|
+
};
|
|
7252
|
+
const IMPURE = {
|
|
7253
|
+
hasEffectsWhenCalled() {
|
|
7254
|
+
return true;
|
|
7255
|
+
}
|
|
7256
|
+
};
|
|
7257
|
+
// We use shortened variables to reduce file size here
|
|
7258
|
+
/* OBJECT */
|
|
7259
|
+
const O = {
|
|
7260
|
+
__proto__: null,
|
|
7261
|
+
[ValueProperties]: IMPURE
|
|
7262
|
+
};
|
|
7263
|
+
/* PURE FUNCTION */
|
|
7264
|
+
const PF = {
|
|
7265
|
+
__proto__: null,
|
|
7266
|
+
[ValueProperties]: PURE
|
|
7267
|
+
};
|
|
7268
|
+
/* FUNCTION THAT MUTATES FIRST ARG WITHOUT TRIGGERING ACCESSORS */
|
|
7269
|
+
const MUTATES_ARG_WITHOUT_ACCESSOR = {
|
|
7270
|
+
__proto__: null,
|
|
7271
|
+
[ValueProperties]: {
|
|
7272
|
+
hasEffectsWhenCalled(callOptions, context) {
|
|
7273
|
+
return (!callOptions.args.length ||
|
|
7274
|
+
callOptions.args[0].hasEffectsWhenAssignedAtPath(UNKNOWN_NON_ACCESSOR_PATH, context));
|
|
7893
7275
|
}
|
|
7894
|
-
code.remove(start + removeStart, (start += removeEnd));
|
|
7895
7276
|
}
|
|
7277
|
+
};
|
|
7278
|
+
/* CONSTRUCTOR */
|
|
7279
|
+
const C = {
|
|
7280
|
+
__proto__: null,
|
|
7281
|
+
[ValueProperties]: IMPURE,
|
|
7282
|
+
prototype: O
|
|
7283
|
+
};
|
|
7284
|
+
/* PURE CONSTRUCTOR */
|
|
7285
|
+
const PC = {
|
|
7286
|
+
__proto__: null,
|
|
7287
|
+
[ValueProperties]: PURE,
|
|
7288
|
+
prototype: O
|
|
7289
|
+
};
|
|
7290
|
+
const ARRAY_TYPE = {
|
|
7291
|
+
__proto__: null,
|
|
7292
|
+
[ValueProperties]: PURE,
|
|
7293
|
+
from: PF,
|
|
7294
|
+
of: PF,
|
|
7295
|
+
prototype: O
|
|
7296
|
+
};
|
|
7297
|
+
const INTL_MEMBER = {
|
|
7298
|
+
__proto__: null,
|
|
7299
|
+
[ValueProperties]: PURE,
|
|
7300
|
+
supportedLocalesOf: PC
|
|
7301
|
+
};
|
|
7302
|
+
const knownGlobals = {
|
|
7303
|
+
// Placeholders for global objects to avoid shape mutations
|
|
7304
|
+
global: O,
|
|
7305
|
+
globalThis: O,
|
|
7306
|
+
self: O,
|
|
7307
|
+
window: O,
|
|
7308
|
+
// Common globals
|
|
7309
|
+
__proto__: null,
|
|
7310
|
+
[ValueProperties]: IMPURE,
|
|
7311
|
+
Array: {
|
|
7312
|
+
__proto__: null,
|
|
7313
|
+
[ValueProperties]: IMPURE,
|
|
7314
|
+
from: O,
|
|
7315
|
+
isArray: PF,
|
|
7316
|
+
of: PF,
|
|
7317
|
+
prototype: O
|
|
7318
|
+
},
|
|
7319
|
+
ArrayBuffer: {
|
|
7320
|
+
__proto__: null,
|
|
7321
|
+
[ValueProperties]: PURE,
|
|
7322
|
+
isView: PF,
|
|
7323
|
+
prototype: O
|
|
7324
|
+
},
|
|
7325
|
+
Atomics: O,
|
|
7326
|
+
BigInt: C,
|
|
7327
|
+
BigInt64Array: C,
|
|
7328
|
+
BigUint64Array: C,
|
|
7329
|
+
Boolean: PC,
|
|
7330
|
+
constructor: C,
|
|
7331
|
+
DataView: PC,
|
|
7332
|
+
Date: {
|
|
7333
|
+
__proto__: null,
|
|
7334
|
+
[ValueProperties]: PURE,
|
|
7335
|
+
now: PF,
|
|
7336
|
+
parse: PF,
|
|
7337
|
+
prototype: O,
|
|
7338
|
+
UTC: PF
|
|
7339
|
+
},
|
|
7340
|
+
decodeURI: PF,
|
|
7341
|
+
decodeURIComponent: PF,
|
|
7342
|
+
encodeURI: PF,
|
|
7343
|
+
encodeURIComponent: PF,
|
|
7344
|
+
Error: PC,
|
|
7345
|
+
escape: PF,
|
|
7346
|
+
eval: O,
|
|
7347
|
+
EvalError: PC,
|
|
7348
|
+
Float32Array: ARRAY_TYPE,
|
|
7349
|
+
Float64Array: ARRAY_TYPE,
|
|
7350
|
+
Function: C,
|
|
7351
|
+
hasOwnProperty: O,
|
|
7352
|
+
Infinity: O,
|
|
7353
|
+
Int16Array: ARRAY_TYPE,
|
|
7354
|
+
Int32Array: ARRAY_TYPE,
|
|
7355
|
+
Int8Array: ARRAY_TYPE,
|
|
7356
|
+
isFinite: PF,
|
|
7357
|
+
isNaN: PF,
|
|
7358
|
+
isPrototypeOf: O,
|
|
7359
|
+
JSON: O,
|
|
7360
|
+
Map: PC,
|
|
7361
|
+
Math: {
|
|
7362
|
+
__proto__: null,
|
|
7363
|
+
[ValueProperties]: IMPURE,
|
|
7364
|
+
abs: PF,
|
|
7365
|
+
acos: PF,
|
|
7366
|
+
acosh: PF,
|
|
7367
|
+
asin: PF,
|
|
7368
|
+
asinh: PF,
|
|
7369
|
+
atan: PF,
|
|
7370
|
+
atan2: PF,
|
|
7371
|
+
atanh: PF,
|
|
7372
|
+
cbrt: PF,
|
|
7373
|
+
ceil: PF,
|
|
7374
|
+
clz32: PF,
|
|
7375
|
+
cos: PF,
|
|
7376
|
+
cosh: PF,
|
|
7377
|
+
exp: PF,
|
|
7378
|
+
expm1: PF,
|
|
7379
|
+
floor: PF,
|
|
7380
|
+
fround: PF,
|
|
7381
|
+
hypot: PF,
|
|
7382
|
+
imul: PF,
|
|
7383
|
+
log: PF,
|
|
7384
|
+
log10: PF,
|
|
7385
|
+
log1p: PF,
|
|
7386
|
+
log2: PF,
|
|
7387
|
+
max: PF,
|
|
7388
|
+
min: PF,
|
|
7389
|
+
pow: PF,
|
|
7390
|
+
random: PF,
|
|
7391
|
+
round: PF,
|
|
7392
|
+
sign: PF,
|
|
7393
|
+
sin: PF,
|
|
7394
|
+
sinh: PF,
|
|
7395
|
+
sqrt: PF,
|
|
7396
|
+
tan: PF,
|
|
7397
|
+
tanh: PF,
|
|
7398
|
+
trunc: PF
|
|
7399
|
+
},
|
|
7400
|
+
NaN: O,
|
|
7401
|
+
Number: {
|
|
7402
|
+
__proto__: null,
|
|
7403
|
+
[ValueProperties]: PURE,
|
|
7404
|
+
isFinite: PF,
|
|
7405
|
+
isInteger: PF,
|
|
7406
|
+
isNaN: PF,
|
|
7407
|
+
isSafeInteger: PF,
|
|
7408
|
+
parseFloat: PF,
|
|
7409
|
+
parseInt: PF,
|
|
7410
|
+
prototype: O
|
|
7411
|
+
},
|
|
7412
|
+
Object: {
|
|
7413
|
+
__proto__: null,
|
|
7414
|
+
[ValueProperties]: PURE,
|
|
7415
|
+
create: PF,
|
|
7416
|
+
// Technically those can throw in certain situations, but we ignore this as
|
|
7417
|
+
// code that relies on this will hopefully wrap this in a try-catch, which
|
|
7418
|
+
// deoptimizes everything anyway
|
|
7419
|
+
defineProperty: MUTATES_ARG_WITHOUT_ACCESSOR,
|
|
7420
|
+
defineProperties: MUTATES_ARG_WITHOUT_ACCESSOR,
|
|
7421
|
+
getOwnPropertyDescriptor: PF,
|
|
7422
|
+
getOwnPropertyNames: PF,
|
|
7423
|
+
getOwnPropertySymbols: PF,
|
|
7424
|
+
getPrototypeOf: PF,
|
|
7425
|
+
hasOwn: PF,
|
|
7426
|
+
is: PF,
|
|
7427
|
+
isExtensible: PF,
|
|
7428
|
+
isFrozen: PF,
|
|
7429
|
+
isSealed: PF,
|
|
7430
|
+
keys: PF,
|
|
7431
|
+
fromEntries: PF,
|
|
7432
|
+
entries: PF,
|
|
7433
|
+
prototype: O
|
|
7434
|
+
},
|
|
7435
|
+
parseFloat: PF,
|
|
7436
|
+
parseInt: PF,
|
|
7437
|
+
Promise: {
|
|
7438
|
+
__proto__: null,
|
|
7439
|
+
[ValueProperties]: IMPURE,
|
|
7440
|
+
all: O,
|
|
7441
|
+
prototype: O,
|
|
7442
|
+
race: O,
|
|
7443
|
+
reject: O,
|
|
7444
|
+
resolve: O
|
|
7445
|
+
},
|
|
7446
|
+
propertyIsEnumerable: O,
|
|
7447
|
+
Proxy: O,
|
|
7448
|
+
RangeError: PC,
|
|
7449
|
+
ReferenceError: PC,
|
|
7450
|
+
Reflect: O,
|
|
7451
|
+
RegExp: PC,
|
|
7452
|
+
Set: PC,
|
|
7453
|
+
SharedArrayBuffer: C,
|
|
7454
|
+
String: {
|
|
7455
|
+
__proto__: null,
|
|
7456
|
+
[ValueProperties]: PURE,
|
|
7457
|
+
fromCharCode: PF,
|
|
7458
|
+
fromCodePoint: PF,
|
|
7459
|
+
prototype: O,
|
|
7460
|
+
raw: PF
|
|
7461
|
+
},
|
|
7462
|
+
Symbol: {
|
|
7463
|
+
__proto__: null,
|
|
7464
|
+
[ValueProperties]: PURE,
|
|
7465
|
+
for: PF,
|
|
7466
|
+
keyFor: PF,
|
|
7467
|
+
prototype: O
|
|
7468
|
+
},
|
|
7469
|
+
SyntaxError: PC,
|
|
7470
|
+
toLocaleString: O,
|
|
7471
|
+
toString: O,
|
|
7472
|
+
TypeError: PC,
|
|
7473
|
+
Uint16Array: ARRAY_TYPE,
|
|
7474
|
+
Uint32Array: ARRAY_TYPE,
|
|
7475
|
+
Uint8Array: ARRAY_TYPE,
|
|
7476
|
+
Uint8ClampedArray: ARRAY_TYPE,
|
|
7477
|
+
// Technically, this is a global, but it needs special handling
|
|
7478
|
+
// undefined: ?,
|
|
7479
|
+
unescape: PF,
|
|
7480
|
+
URIError: PC,
|
|
7481
|
+
valueOf: O,
|
|
7482
|
+
WeakMap: PC,
|
|
7483
|
+
WeakSet: PC,
|
|
7484
|
+
// Additional globals shared by Node and Browser that are not strictly part of the language
|
|
7485
|
+
clearInterval: C,
|
|
7486
|
+
clearTimeout: C,
|
|
7487
|
+
console: O,
|
|
7488
|
+
Intl: {
|
|
7489
|
+
__proto__: null,
|
|
7490
|
+
[ValueProperties]: IMPURE,
|
|
7491
|
+
Collator: INTL_MEMBER,
|
|
7492
|
+
DateTimeFormat: INTL_MEMBER,
|
|
7493
|
+
ListFormat: INTL_MEMBER,
|
|
7494
|
+
NumberFormat: INTL_MEMBER,
|
|
7495
|
+
PluralRules: INTL_MEMBER,
|
|
7496
|
+
RelativeTimeFormat: INTL_MEMBER
|
|
7497
|
+
},
|
|
7498
|
+
setInterval: C,
|
|
7499
|
+
setTimeout: C,
|
|
7500
|
+
TextDecoder: C,
|
|
7501
|
+
TextEncoder: C,
|
|
7502
|
+
URL: C,
|
|
7503
|
+
URLSearchParams: C,
|
|
7504
|
+
// Browser specific globals
|
|
7505
|
+
AbortController: C,
|
|
7506
|
+
AbortSignal: C,
|
|
7507
|
+
addEventListener: O,
|
|
7508
|
+
alert: O,
|
|
7509
|
+
AnalyserNode: C,
|
|
7510
|
+
Animation: C,
|
|
7511
|
+
AnimationEvent: C,
|
|
7512
|
+
applicationCache: O,
|
|
7513
|
+
ApplicationCache: C,
|
|
7514
|
+
ApplicationCacheErrorEvent: C,
|
|
7515
|
+
atob: O,
|
|
7516
|
+
Attr: C,
|
|
7517
|
+
Audio: C,
|
|
7518
|
+
AudioBuffer: C,
|
|
7519
|
+
AudioBufferSourceNode: C,
|
|
7520
|
+
AudioContext: C,
|
|
7521
|
+
AudioDestinationNode: C,
|
|
7522
|
+
AudioListener: C,
|
|
7523
|
+
AudioNode: C,
|
|
7524
|
+
AudioParam: C,
|
|
7525
|
+
AudioProcessingEvent: C,
|
|
7526
|
+
AudioScheduledSourceNode: C,
|
|
7527
|
+
AudioWorkletNode: C,
|
|
7528
|
+
BarProp: C,
|
|
7529
|
+
BaseAudioContext: C,
|
|
7530
|
+
BatteryManager: C,
|
|
7531
|
+
BeforeUnloadEvent: C,
|
|
7532
|
+
BiquadFilterNode: C,
|
|
7533
|
+
Blob: C,
|
|
7534
|
+
BlobEvent: C,
|
|
7535
|
+
blur: O,
|
|
7536
|
+
BroadcastChannel: C,
|
|
7537
|
+
btoa: O,
|
|
7538
|
+
ByteLengthQueuingStrategy: C,
|
|
7539
|
+
Cache: C,
|
|
7540
|
+
caches: O,
|
|
7541
|
+
CacheStorage: C,
|
|
7542
|
+
cancelAnimationFrame: O,
|
|
7543
|
+
cancelIdleCallback: O,
|
|
7544
|
+
CanvasCaptureMediaStreamTrack: C,
|
|
7545
|
+
CanvasGradient: C,
|
|
7546
|
+
CanvasPattern: C,
|
|
7547
|
+
CanvasRenderingContext2D: C,
|
|
7548
|
+
ChannelMergerNode: C,
|
|
7549
|
+
ChannelSplitterNode: C,
|
|
7550
|
+
CharacterData: C,
|
|
7551
|
+
clientInformation: O,
|
|
7552
|
+
ClipboardEvent: C,
|
|
7553
|
+
close: O,
|
|
7554
|
+
closed: O,
|
|
7555
|
+
CloseEvent: C,
|
|
7556
|
+
Comment: C,
|
|
7557
|
+
CompositionEvent: C,
|
|
7558
|
+
confirm: O,
|
|
7559
|
+
ConstantSourceNode: C,
|
|
7560
|
+
ConvolverNode: C,
|
|
7561
|
+
CountQueuingStrategy: C,
|
|
7562
|
+
createImageBitmap: O,
|
|
7563
|
+
Credential: C,
|
|
7564
|
+
CredentialsContainer: C,
|
|
7565
|
+
crypto: O,
|
|
7566
|
+
Crypto: C,
|
|
7567
|
+
CryptoKey: C,
|
|
7568
|
+
CSS: C,
|
|
7569
|
+
CSSConditionRule: C,
|
|
7570
|
+
CSSFontFaceRule: C,
|
|
7571
|
+
CSSGroupingRule: C,
|
|
7572
|
+
CSSImportRule: C,
|
|
7573
|
+
CSSKeyframeRule: C,
|
|
7574
|
+
CSSKeyframesRule: C,
|
|
7575
|
+
CSSMediaRule: C,
|
|
7576
|
+
CSSNamespaceRule: C,
|
|
7577
|
+
CSSPageRule: C,
|
|
7578
|
+
CSSRule: C,
|
|
7579
|
+
CSSRuleList: C,
|
|
7580
|
+
CSSStyleDeclaration: C,
|
|
7581
|
+
CSSStyleRule: C,
|
|
7582
|
+
CSSStyleSheet: C,
|
|
7583
|
+
CSSSupportsRule: C,
|
|
7584
|
+
CustomElementRegistry: C,
|
|
7585
|
+
customElements: O,
|
|
7586
|
+
CustomEvent: C,
|
|
7587
|
+
DataTransfer: C,
|
|
7588
|
+
DataTransferItem: C,
|
|
7589
|
+
DataTransferItemList: C,
|
|
7590
|
+
defaultstatus: O,
|
|
7591
|
+
defaultStatus: O,
|
|
7592
|
+
DelayNode: C,
|
|
7593
|
+
DeviceMotionEvent: C,
|
|
7594
|
+
DeviceOrientationEvent: C,
|
|
7595
|
+
devicePixelRatio: O,
|
|
7596
|
+
dispatchEvent: O,
|
|
7597
|
+
document: O,
|
|
7598
|
+
Document: C,
|
|
7599
|
+
DocumentFragment: C,
|
|
7600
|
+
DocumentType: C,
|
|
7601
|
+
DOMError: C,
|
|
7602
|
+
DOMException: C,
|
|
7603
|
+
DOMImplementation: C,
|
|
7604
|
+
DOMMatrix: C,
|
|
7605
|
+
DOMMatrixReadOnly: C,
|
|
7606
|
+
DOMParser: C,
|
|
7607
|
+
DOMPoint: C,
|
|
7608
|
+
DOMPointReadOnly: C,
|
|
7609
|
+
DOMQuad: C,
|
|
7610
|
+
DOMRect: C,
|
|
7611
|
+
DOMRectReadOnly: C,
|
|
7612
|
+
DOMStringList: C,
|
|
7613
|
+
DOMStringMap: C,
|
|
7614
|
+
DOMTokenList: C,
|
|
7615
|
+
DragEvent: C,
|
|
7616
|
+
DynamicsCompressorNode: C,
|
|
7617
|
+
Element: C,
|
|
7618
|
+
ErrorEvent: C,
|
|
7619
|
+
Event: C,
|
|
7620
|
+
EventSource: C,
|
|
7621
|
+
EventTarget: C,
|
|
7622
|
+
external: O,
|
|
7623
|
+
fetch: O,
|
|
7624
|
+
File: C,
|
|
7625
|
+
FileList: C,
|
|
7626
|
+
FileReader: C,
|
|
7627
|
+
find: O,
|
|
7628
|
+
focus: O,
|
|
7629
|
+
FocusEvent: C,
|
|
7630
|
+
FontFace: C,
|
|
7631
|
+
FontFaceSetLoadEvent: C,
|
|
7632
|
+
FormData: C,
|
|
7633
|
+
frames: O,
|
|
7634
|
+
GainNode: C,
|
|
7635
|
+
Gamepad: C,
|
|
7636
|
+
GamepadButton: C,
|
|
7637
|
+
GamepadEvent: C,
|
|
7638
|
+
getComputedStyle: O,
|
|
7639
|
+
getSelection: O,
|
|
7640
|
+
HashChangeEvent: C,
|
|
7641
|
+
Headers: C,
|
|
7642
|
+
history: O,
|
|
7643
|
+
History: C,
|
|
7644
|
+
HTMLAllCollection: C,
|
|
7645
|
+
HTMLAnchorElement: C,
|
|
7646
|
+
HTMLAreaElement: C,
|
|
7647
|
+
HTMLAudioElement: C,
|
|
7648
|
+
HTMLBaseElement: C,
|
|
7649
|
+
HTMLBodyElement: C,
|
|
7650
|
+
HTMLBRElement: C,
|
|
7651
|
+
HTMLButtonElement: C,
|
|
7652
|
+
HTMLCanvasElement: C,
|
|
7653
|
+
HTMLCollection: C,
|
|
7654
|
+
HTMLContentElement: C,
|
|
7655
|
+
HTMLDataElement: C,
|
|
7656
|
+
HTMLDataListElement: C,
|
|
7657
|
+
HTMLDetailsElement: C,
|
|
7658
|
+
HTMLDialogElement: C,
|
|
7659
|
+
HTMLDirectoryElement: C,
|
|
7660
|
+
HTMLDivElement: C,
|
|
7661
|
+
HTMLDListElement: C,
|
|
7662
|
+
HTMLDocument: C,
|
|
7663
|
+
HTMLElement: C,
|
|
7664
|
+
HTMLEmbedElement: C,
|
|
7665
|
+
HTMLFieldSetElement: C,
|
|
7666
|
+
HTMLFontElement: C,
|
|
7667
|
+
HTMLFormControlsCollection: C,
|
|
7668
|
+
HTMLFormElement: C,
|
|
7669
|
+
HTMLFrameElement: C,
|
|
7670
|
+
HTMLFrameSetElement: C,
|
|
7671
|
+
HTMLHeadElement: C,
|
|
7672
|
+
HTMLHeadingElement: C,
|
|
7673
|
+
HTMLHRElement: C,
|
|
7674
|
+
HTMLHtmlElement: C,
|
|
7675
|
+
HTMLIFrameElement: C,
|
|
7676
|
+
HTMLImageElement: C,
|
|
7677
|
+
HTMLInputElement: C,
|
|
7678
|
+
HTMLLabelElement: C,
|
|
7679
|
+
HTMLLegendElement: C,
|
|
7680
|
+
HTMLLIElement: C,
|
|
7681
|
+
HTMLLinkElement: C,
|
|
7682
|
+
HTMLMapElement: C,
|
|
7683
|
+
HTMLMarqueeElement: C,
|
|
7684
|
+
HTMLMediaElement: C,
|
|
7685
|
+
HTMLMenuElement: C,
|
|
7686
|
+
HTMLMetaElement: C,
|
|
7687
|
+
HTMLMeterElement: C,
|
|
7688
|
+
HTMLModElement: C,
|
|
7689
|
+
HTMLObjectElement: C,
|
|
7690
|
+
HTMLOListElement: C,
|
|
7691
|
+
HTMLOptGroupElement: C,
|
|
7692
|
+
HTMLOptionElement: C,
|
|
7693
|
+
HTMLOptionsCollection: C,
|
|
7694
|
+
HTMLOutputElement: C,
|
|
7695
|
+
HTMLParagraphElement: C,
|
|
7696
|
+
HTMLParamElement: C,
|
|
7697
|
+
HTMLPictureElement: C,
|
|
7698
|
+
HTMLPreElement: C,
|
|
7699
|
+
HTMLProgressElement: C,
|
|
7700
|
+
HTMLQuoteElement: C,
|
|
7701
|
+
HTMLScriptElement: C,
|
|
7702
|
+
HTMLSelectElement: C,
|
|
7703
|
+
HTMLShadowElement: C,
|
|
7704
|
+
HTMLSlotElement: C,
|
|
7705
|
+
HTMLSourceElement: C,
|
|
7706
|
+
HTMLSpanElement: C,
|
|
7707
|
+
HTMLStyleElement: C,
|
|
7708
|
+
HTMLTableCaptionElement: C,
|
|
7709
|
+
HTMLTableCellElement: C,
|
|
7710
|
+
HTMLTableColElement: C,
|
|
7711
|
+
HTMLTableElement: C,
|
|
7712
|
+
HTMLTableRowElement: C,
|
|
7713
|
+
HTMLTableSectionElement: C,
|
|
7714
|
+
HTMLTemplateElement: C,
|
|
7715
|
+
HTMLTextAreaElement: C,
|
|
7716
|
+
HTMLTimeElement: C,
|
|
7717
|
+
HTMLTitleElement: C,
|
|
7718
|
+
HTMLTrackElement: C,
|
|
7719
|
+
HTMLUListElement: C,
|
|
7720
|
+
HTMLUnknownElement: C,
|
|
7721
|
+
HTMLVideoElement: C,
|
|
7722
|
+
IDBCursor: C,
|
|
7723
|
+
IDBCursorWithValue: C,
|
|
7724
|
+
IDBDatabase: C,
|
|
7725
|
+
IDBFactory: C,
|
|
7726
|
+
IDBIndex: C,
|
|
7727
|
+
IDBKeyRange: C,
|
|
7728
|
+
IDBObjectStore: C,
|
|
7729
|
+
IDBOpenDBRequest: C,
|
|
7730
|
+
IDBRequest: C,
|
|
7731
|
+
IDBTransaction: C,
|
|
7732
|
+
IDBVersionChangeEvent: C,
|
|
7733
|
+
IdleDeadline: C,
|
|
7734
|
+
IIRFilterNode: C,
|
|
7735
|
+
Image: C,
|
|
7736
|
+
ImageBitmap: C,
|
|
7737
|
+
ImageBitmapRenderingContext: C,
|
|
7738
|
+
ImageCapture: C,
|
|
7739
|
+
ImageData: C,
|
|
7740
|
+
indexedDB: O,
|
|
7741
|
+
innerHeight: O,
|
|
7742
|
+
innerWidth: O,
|
|
7743
|
+
InputEvent: C,
|
|
7744
|
+
IntersectionObserver: C,
|
|
7745
|
+
IntersectionObserverEntry: C,
|
|
7746
|
+
isSecureContext: O,
|
|
7747
|
+
KeyboardEvent: C,
|
|
7748
|
+
KeyframeEffect: C,
|
|
7749
|
+
length: O,
|
|
7750
|
+
localStorage: O,
|
|
7751
|
+
location: O,
|
|
7752
|
+
Location: C,
|
|
7753
|
+
locationbar: O,
|
|
7754
|
+
matchMedia: O,
|
|
7755
|
+
MediaDeviceInfo: C,
|
|
7756
|
+
MediaDevices: C,
|
|
7757
|
+
MediaElementAudioSourceNode: C,
|
|
7758
|
+
MediaEncryptedEvent: C,
|
|
7759
|
+
MediaError: C,
|
|
7760
|
+
MediaKeyMessageEvent: C,
|
|
7761
|
+
MediaKeySession: C,
|
|
7762
|
+
MediaKeyStatusMap: C,
|
|
7763
|
+
MediaKeySystemAccess: C,
|
|
7764
|
+
MediaList: C,
|
|
7765
|
+
MediaQueryList: C,
|
|
7766
|
+
MediaQueryListEvent: C,
|
|
7767
|
+
MediaRecorder: C,
|
|
7768
|
+
MediaSettingsRange: C,
|
|
7769
|
+
MediaSource: C,
|
|
7770
|
+
MediaStream: C,
|
|
7771
|
+
MediaStreamAudioDestinationNode: C,
|
|
7772
|
+
MediaStreamAudioSourceNode: C,
|
|
7773
|
+
MediaStreamEvent: C,
|
|
7774
|
+
MediaStreamTrack: C,
|
|
7775
|
+
MediaStreamTrackEvent: C,
|
|
7776
|
+
menubar: O,
|
|
7777
|
+
MessageChannel: C,
|
|
7778
|
+
MessageEvent: C,
|
|
7779
|
+
MessagePort: C,
|
|
7780
|
+
MIDIAccess: C,
|
|
7781
|
+
MIDIConnectionEvent: C,
|
|
7782
|
+
MIDIInput: C,
|
|
7783
|
+
MIDIInputMap: C,
|
|
7784
|
+
MIDIMessageEvent: C,
|
|
7785
|
+
MIDIOutput: C,
|
|
7786
|
+
MIDIOutputMap: C,
|
|
7787
|
+
MIDIPort: C,
|
|
7788
|
+
MimeType: C,
|
|
7789
|
+
MimeTypeArray: C,
|
|
7790
|
+
MouseEvent: C,
|
|
7791
|
+
moveBy: O,
|
|
7792
|
+
moveTo: O,
|
|
7793
|
+
MutationEvent: C,
|
|
7794
|
+
MutationObserver: C,
|
|
7795
|
+
MutationRecord: C,
|
|
7796
|
+
name: O,
|
|
7797
|
+
NamedNodeMap: C,
|
|
7798
|
+
NavigationPreloadManager: C,
|
|
7799
|
+
navigator: O,
|
|
7800
|
+
Navigator: C,
|
|
7801
|
+
NetworkInformation: C,
|
|
7802
|
+
Node: C,
|
|
7803
|
+
NodeFilter: O,
|
|
7804
|
+
NodeIterator: C,
|
|
7805
|
+
NodeList: C,
|
|
7806
|
+
Notification: C,
|
|
7807
|
+
OfflineAudioCompletionEvent: C,
|
|
7808
|
+
OfflineAudioContext: C,
|
|
7809
|
+
offscreenBuffering: O,
|
|
7810
|
+
OffscreenCanvas: C,
|
|
7811
|
+
open: O,
|
|
7812
|
+
openDatabase: O,
|
|
7813
|
+
Option: C,
|
|
7814
|
+
origin: O,
|
|
7815
|
+
OscillatorNode: C,
|
|
7816
|
+
outerHeight: O,
|
|
7817
|
+
outerWidth: O,
|
|
7818
|
+
PageTransitionEvent: C,
|
|
7819
|
+
pageXOffset: O,
|
|
7820
|
+
pageYOffset: O,
|
|
7821
|
+
PannerNode: C,
|
|
7822
|
+
parent: O,
|
|
7823
|
+
Path2D: C,
|
|
7824
|
+
PaymentAddress: C,
|
|
7825
|
+
PaymentRequest: C,
|
|
7826
|
+
PaymentRequestUpdateEvent: C,
|
|
7827
|
+
PaymentResponse: C,
|
|
7828
|
+
performance: O,
|
|
7829
|
+
Performance: C,
|
|
7830
|
+
PerformanceEntry: C,
|
|
7831
|
+
PerformanceLongTaskTiming: C,
|
|
7832
|
+
PerformanceMark: C,
|
|
7833
|
+
PerformanceMeasure: C,
|
|
7834
|
+
PerformanceNavigation: C,
|
|
7835
|
+
PerformanceNavigationTiming: C,
|
|
7836
|
+
PerformanceObserver: C,
|
|
7837
|
+
PerformanceObserverEntryList: C,
|
|
7838
|
+
PerformancePaintTiming: C,
|
|
7839
|
+
PerformanceResourceTiming: C,
|
|
7840
|
+
PerformanceTiming: C,
|
|
7841
|
+
PeriodicWave: C,
|
|
7842
|
+
Permissions: C,
|
|
7843
|
+
PermissionStatus: C,
|
|
7844
|
+
personalbar: O,
|
|
7845
|
+
PhotoCapabilities: C,
|
|
7846
|
+
Plugin: C,
|
|
7847
|
+
PluginArray: C,
|
|
7848
|
+
PointerEvent: C,
|
|
7849
|
+
PopStateEvent: C,
|
|
7850
|
+
postMessage: O,
|
|
7851
|
+
Presentation: C,
|
|
7852
|
+
PresentationAvailability: C,
|
|
7853
|
+
PresentationConnection: C,
|
|
7854
|
+
PresentationConnectionAvailableEvent: C,
|
|
7855
|
+
PresentationConnectionCloseEvent: C,
|
|
7856
|
+
PresentationConnectionList: C,
|
|
7857
|
+
PresentationReceiver: C,
|
|
7858
|
+
PresentationRequest: C,
|
|
7859
|
+
print: O,
|
|
7860
|
+
ProcessingInstruction: C,
|
|
7861
|
+
ProgressEvent: C,
|
|
7862
|
+
PromiseRejectionEvent: C,
|
|
7863
|
+
prompt: O,
|
|
7864
|
+
PushManager: C,
|
|
7865
|
+
PushSubscription: C,
|
|
7866
|
+
PushSubscriptionOptions: C,
|
|
7867
|
+
queueMicrotask: O,
|
|
7868
|
+
RadioNodeList: C,
|
|
7869
|
+
Range: C,
|
|
7870
|
+
ReadableStream: C,
|
|
7871
|
+
RemotePlayback: C,
|
|
7872
|
+
removeEventListener: O,
|
|
7873
|
+
Request: C,
|
|
7874
|
+
requestAnimationFrame: O,
|
|
7875
|
+
requestIdleCallback: O,
|
|
7876
|
+
resizeBy: O,
|
|
7877
|
+
ResizeObserver: C,
|
|
7878
|
+
ResizeObserverEntry: C,
|
|
7879
|
+
resizeTo: O,
|
|
7880
|
+
Response: C,
|
|
7881
|
+
RTCCertificate: C,
|
|
7882
|
+
RTCDataChannel: C,
|
|
7883
|
+
RTCDataChannelEvent: C,
|
|
7884
|
+
RTCDtlsTransport: C,
|
|
7885
|
+
RTCIceCandidate: C,
|
|
7886
|
+
RTCIceTransport: C,
|
|
7887
|
+
RTCPeerConnection: C,
|
|
7888
|
+
RTCPeerConnectionIceEvent: C,
|
|
7889
|
+
RTCRtpReceiver: C,
|
|
7890
|
+
RTCRtpSender: C,
|
|
7891
|
+
RTCSctpTransport: C,
|
|
7892
|
+
RTCSessionDescription: C,
|
|
7893
|
+
RTCStatsReport: C,
|
|
7894
|
+
RTCTrackEvent: C,
|
|
7895
|
+
screen: O,
|
|
7896
|
+
Screen: C,
|
|
7897
|
+
screenLeft: O,
|
|
7898
|
+
ScreenOrientation: C,
|
|
7899
|
+
screenTop: O,
|
|
7900
|
+
screenX: O,
|
|
7901
|
+
screenY: O,
|
|
7902
|
+
ScriptProcessorNode: C,
|
|
7903
|
+
scroll: O,
|
|
7904
|
+
scrollbars: O,
|
|
7905
|
+
scrollBy: O,
|
|
7906
|
+
scrollTo: O,
|
|
7907
|
+
scrollX: O,
|
|
7908
|
+
scrollY: O,
|
|
7909
|
+
SecurityPolicyViolationEvent: C,
|
|
7910
|
+
Selection: C,
|
|
7911
|
+
ServiceWorker: C,
|
|
7912
|
+
ServiceWorkerContainer: C,
|
|
7913
|
+
ServiceWorkerRegistration: C,
|
|
7914
|
+
sessionStorage: O,
|
|
7915
|
+
ShadowRoot: C,
|
|
7916
|
+
SharedWorker: C,
|
|
7917
|
+
SourceBuffer: C,
|
|
7918
|
+
SourceBufferList: C,
|
|
7919
|
+
speechSynthesis: O,
|
|
7920
|
+
SpeechSynthesisEvent: C,
|
|
7921
|
+
SpeechSynthesisUtterance: C,
|
|
7922
|
+
StaticRange: C,
|
|
7923
|
+
status: O,
|
|
7924
|
+
statusbar: O,
|
|
7925
|
+
StereoPannerNode: C,
|
|
7926
|
+
stop: O,
|
|
7927
|
+
Storage: C,
|
|
7928
|
+
StorageEvent: C,
|
|
7929
|
+
StorageManager: C,
|
|
7930
|
+
styleMedia: O,
|
|
7931
|
+
StyleSheet: C,
|
|
7932
|
+
StyleSheetList: C,
|
|
7933
|
+
SubtleCrypto: C,
|
|
7934
|
+
SVGAElement: C,
|
|
7935
|
+
SVGAngle: C,
|
|
7936
|
+
SVGAnimatedAngle: C,
|
|
7937
|
+
SVGAnimatedBoolean: C,
|
|
7938
|
+
SVGAnimatedEnumeration: C,
|
|
7939
|
+
SVGAnimatedInteger: C,
|
|
7940
|
+
SVGAnimatedLength: C,
|
|
7941
|
+
SVGAnimatedLengthList: C,
|
|
7942
|
+
SVGAnimatedNumber: C,
|
|
7943
|
+
SVGAnimatedNumberList: C,
|
|
7944
|
+
SVGAnimatedPreserveAspectRatio: C,
|
|
7945
|
+
SVGAnimatedRect: C,
|
|
7946
|
+
SVGAnimatedString: C,
|
|
7947
|
+
SVGAnimatedTransformList: C,
|
|
7948
|
+
SVGAnimateElement: C,
|
|
7949
|
+
SVGAnimateMotionElement: C,
|
|
7950
|
+
SVGAnimateTransformElement: C,
|
|
7951
|
+
SVGAnimationElement: C,
|
|
7952
|
+
SVGCircleElement: C,
|
|
7953
|
+
SVGClipPathElement: C,
|
|
7954
|
+
SVGComponentTransferFunctionElement: C,
|
|
7955
|
+
SVGDefsElement: C,
|
|
7956
|
+
SVGDescElement: C,
|
|
7957
|
+
SVGDiscardElement: C,
|
|
7958
|
+
SVGElement: C,
|
|
7959
|
+
SVGEllipseElement: C,
|
|
7960
|
+
SVGFEBlendElement: C,
|
|
7961
|
+
SVGFEColorMatrixElement: C,
|
|
7962
|
+
SVGFEComponentTransferElement: C,
|
|
7963
|
+
SVGFECompositeElement: C,
|
|
7964
|
+
SVGFEConvolveMatrixElement: C,
|
|
7965
|
+
SVGFEDiffuseLightingElement: C,
|
|
7966
|
+
SVGFEDisplacementMapElement: C,
|
|
7967
|
+
SVGFEDistantLightElement: C,
|
|
7968
|
+
SVGFEDropShadowElement: C,
|
|
7969
|
+
SVGFEFloodElement: C,
|
|
7970
|
+
SVGFEFuncAElement: C,
|
|
7971
|
+
SVGFEFuncBElement: C,
|
|
7972
|
+
SVGFEFuncGElement: C,
|
|
7973
|
+
SVGFEFuncRElement: C,
|
|
7974
|
+
SVGFEGaussianBlurElement: C,
|
|
7975
|
+
SVGFEImageElement: C,
|
|
7976
|
+
SVGFEMergeElement: C,
|
|
7977
|
+
SVGFEMergeNodeElement: C,
|
|
7978
|
+
SVGFEMorphologyElement: C,
|
|
7979
|
+
SVGFEOffsetElement: C,
|
|
7980
|
+
SVGFEPointLightElement: C,
|
|
7981
|
+
SVGFESpecularLightingElement: C,
|
|
7982
|
+
SVGFESpotLightElement: C,
|
|
7983
|
+
SVGFETileElement: C,
|
|
7984
|
+
SVGFETurbulenceElement: C,
|
|
7985
|
+
SVGFilterElement: C,
|
|
7986
|
+
SVGForeignObjectElement: C,
|
|
7987
|
+
SVGGElement: C,
|
|
7988
|
+
SVGGeometryElement: C,
|
|
7989
|
+
SVGGradientElement: C,
|
|
7990
|
+
SVGGraphicsElement: C,
|
|
7991
|
+
SVGImageElement: C,
|
|
7992
|
+
SVGLength: C,
|
|
7993
|
+
SVGLengthList: C,
|
|
7994
|
+
SVGLinearGradientElement: C,
|
|
7995
|
+
SVGLineElement: C,
|
|
7996
|
+
SVGMarkerElement: C,
|
|
7997
|
+
SVGMaskElement: C,
|
|
7998
|
+
SVGMatrix: C,
|
|
7999
|
+
SVGMetadataElement: C,
|
|
8000
|
+
SVGMPathElement: C,
|
|
8001
|
+
SVGNumber: C,
|
|
8002
|
+
SVGNumberList: C,
|
|
8003
|
+
SVGPathElement: C,
|
|
8004
|
+
SVGPatternElement: C,
|
|
8005
|
+
SVGPoint: C,
|
|
8006
|
+
SVGPointList: C,
|
|
8007
|
+
SVGPolygonElement: C,
|
|
8008
|
+
SVGPolylineElement: C,
|
|
8009
|
+
SVGPreserveAspectRatio: C,
|
|
8010
|
+
SVGRadialGradientElement: C,
|
|
8011
|
+
SVGRect: C,
|
|
8012
|
+
SVGRectElement: C,
|
|
8013
|
+
SVGScriptElement: C,
|
|
8014
|
+
SVGSetElement: C,
|
|
8015
|
+
SVGStopElement: C,
|
|
8016
|
+
SVGStringList: C,
|
|
8017
|
+
SVGStyleElement: C,
|
|
8018
|
+
SVGSVGElement: C,
|
|
8019
|
+
SVGSwitchElement: C,
|
|
8020
|
+
SVGSymbolElement: C,
|
|
8021
|
+
SVGTextContentElement: C,
|
|
8022
|
+
SVGTextElement: C,
|
|
8023
|
+
SVGTextPathElement: C,
|
|
8024
|
+
SVGTextPositioningElement: C,
|
|
8025
|
+
SVGTitleElement: C,
|
|
8026
|
+
SVGTransform: C,
|
|
8027
|
+
SVGTransformList: C,
|
|
8028
|
+
SVGTSpanElement: C,
|
|
8029
|
+
SVGUnitTypes: C,
|
|
8030
|
+
SVGUseElement: C,
|
|
8031
|
+
SVGViewElement: C,
|
|
8032
|
+
TaskAttributionTiming: C,
|
|
8033
|
+
Text: C,
|
|
8034
|
+
TextEvent: C,
|
|
8035
|
+
TextMetrics: C,
|
|
8036
|
+
TextTrack: C,
|
|
8037
|
+
TextTrackCue: C,
|
|
8038
|
+
TextTrackCueList: C,
|
|
8039
|
+
TextTrackList: C,
|
|
8040
|
+
TimeRanges: C,
|
|
8041
|
+
toolbar: O,
|
|
8042
|
+
top: O,
|
|
8043
|
+
Touch: C,
|
|
8044
|
+
TouchEvent: C,
|
|
8045
|
+
TouchList: C,
|
|
8046
|
+
TrackEvent: C,
|
|
8047
|
+
TransitionEvent: C,
|
|
8048
|
+
TreeWalker: C,
|
|
8049
|
+
UIEvent: C,
|
|
8050
|
+
ValidityState: C,
|
|
8051
|
+
visualViewport: O,
|
|
8052
|
+
VisualViewport: C,
|
|
8053
|
+
VTTCue: C,
|
|
8054
|
+
WaveShaperNode: C,
|
|
8055
|
+
WebAssembly: O,
|
|
8056
|
+
WebGL2RenderingContext: C,
|
|
8057
|
+
WebGLActiveInfo: C,
|
|
8058
|
+
WebGLBuffer: C,
|
|
8059
|
+
WebGLContextEvent: C,
|
|
8060
|
+
WebGLFramebuffer: C,
|
|
8061
|
+
WebGLProgram: C,
|
|
8062
|
+
WebGLQuery: C,
|
|
8063
|
+
WebGLRenderbuffer: C,
|
|
8064
|
+
WebGLRenderingContext: C,
|
|
8065
|
+
WebGLSampler: C,
|
|
8066
|
+
WebGLShader: C,
|
|
8067
|
+
WebGLShaderPrecisionFormat: C,
|
|
8068
|
+
WebGLSync: C,
|
|
8069
|
+
WebGLTexture: C,
|
|
8070
|
+
WebGLTransformFeedback: C,
|
|
8071
|
+
WebGLUniformLocation: C,
|
|
8072
|
+
WebGLVertexArrayObject: C,
|
|
8073
|
+
WebSocket: C,
|
|
8074
|
+
WheelEvent: C,
|
|
8075
|
+
Window: C,
|
|
8076
|
+
Worker: C,
|
|
8077
|
+
WritableStream: C,
|
|
8078
|
+
XMLDocument: C,
|
|
8079
|
+
XMLHttpRequest: C,
|
|
8080
|
+
XMLHttpRequestEventTarget: C,
|
|
8081
|
+
XMLHttpRequestUpload: C,
|
|
8082
|
+
XMLSerializer: C,
|
|
8083
|
+
XPathEvaluator: C,
|
|
8084
|
+
XPathExpression: C,
|
|
8085
|
+
XPathResult: C,
|
|
8086
|
+
XSLTProcessor: C
|
|
8087
|
+
};
|
|
8088
|
+
for (const global of ['window', 'global', 'self', 'globalThis']) {
|
|
8089
|
+
knownGlobals[global] = knownGlobals;
|
|
7896
8090
|
}
|
|
7897
|
-
|
|
7898
|
-
|
|
7899
|
-
|
|
7900
|
-
if (
|
|
7901
|
-
|
|
7902
|
-
// Necessary to make sure the init is deoptimized for conditional declarations.
|
|
7903
|
-
// We cannot call deoptimizePath here.
|
|
7904
|
-
variable.markInitializersForDeoptimization();
|
|
7905
|
-
return variable;
|
|
7906
|
-
}
|
|
7907
|
-
else {
|
|
7908
|
-
return super.addDeclaration(identifier, context, init, false);
|
|
8091
|
+
function getGlobalAtPath(path) {
|
|
8092
|
+
let currentGlobal = knownGlobals;
|
|
8093
|
+
for (const pathSegment of path) {
|
|
8094
|
+
if (typeof pathSegment !== 'string') {
|
|
8095
|
+
return null;
|
|
7909
8096
|
}
|
|
7910
|
-
|
|
7911
|
-
|
|
7912
|
-
|
|
7913
|
-
class ExpressionStatement extends NodeBase {
|
|
7914
|
-
initialise() {
|
|
7915
|
-
if (this.directive &&
|
|
7916
|
-
this.directive !== 'use strict' &&
|
|
7917
|
-
this.parent.type === Program$1) {
|
|
7918
|
-
this.context.warn(
|
|
7919
|
-
// This is necessary, because either way (deleting or not) can lead to errors.
|
|
7920
|
-
{
|
|
7921
|
-
code: 'MODULE_LEVEL_DIRECTIVE',
|
|
7922
|
-
message: `Module level directives cause errors when bundled, '${this.directive}' was ignored.`
|
|
7923
|
-
}, this.start);
|
|
8097
|
+
currentGlobal = currentGlobal[pathSegment];
|
|
8098
|
+
if (!currentGlobal) {
|
|
8099
|
+
return null;
|
|
7924
8100
|
}
|
|
7925
8101
|
}
|
|
7926
|
-
|
|
7927
|
-
super.render(code, options);
|
|
7928
|
-
if (this.included)
|
|
7929
|
-
this.insertSemicolon(code);
|
|
7930
|
-
}
|
|
7931
|
-
shouldBeIncluded(context) {
|
|
7932
|
-
if (this.directive && this.directive !== 'use strict')
|
|
7933
|
-
return this.parent.type !== Program$1;
|
|
7934
|
-
return super.shouldBeIncluded(context);
|
|
7935
|
-
}
|
|
8102
|
+
return currentGlobal[ValueProperties];
|
|
7936
8103
|
}
|
|
7937
8104
|
|
|
7938
|
-
class
|
|
8105
|
+
class GlobalVariable extends Variable {
|
|
7939
8106
|
constructor() {
|
|
7940
8107
|
super(...arguments);
|
|
7941
|
-
|
|
7942
|
-
|
|
7943
|
-
|
|
7944
|
-
const lastStatement = this.body[this.body.length - 1];
|
|
7945
|
-
if (!lastStatement || lastStatement.type !== ReturnStatement$1) {
|
|
7946
|
-
this.scope.addReturnExpression(UNKNOWN_EXPRESSION);
|
|
7947
|
-
}
|
|
7948
|
-
}
|
|
7949
|
-
createScope(parentScope) {
|
|
7950
|
-
this.scope = this.parent.preventChildBlockScope
|
|
7951
|
-
? parentScope
|
|
7952
|
-
: new BlockScope(parentScope);
|
|
8108
|
+
// Ensure we use live-bindings for globals as we do not know if they have
|
|
8109
|
+
// been reassigned
|
|
8110
|
+
this.isReassigned = true;
|
|
7953
8111
|
}
|
|
7954
|
-
|
|
7955
|
-
|
|
7956
|
-
return true;
|
|
7957
|
-
for (const node of this.body) {
|
|
7958
|
-
if (context.brokenFlow)
|
|
7959
|
-
break;
|
|
7960
|
-
if (node.hasEffects(context))
|
|
7961
|
-
return true;
|
|
7962
|
-
}
|
|
7963
|
-
return false;
|
|
8112
|
+
getLiteralValueAtPath(path, _recursionTracker, _origin) {
|
|
8113
|
+
return getGlobalAtPath([this.name, ...path]) ? UnknownTruthyValue : UnknownValue;
|
|
7964
8114
|
}
|
|
7965
|
-
|
|
7966
|
-
if (
|
|
7967
|
-
|
|
7968
|
-
this.
|
|
7969
|
-
if (this.deoptimizeBody)
|
|
7970
|
-
includeChildrenRecursively = true;
|
|
7971
|
-
for (const node of this.body) {
|
|
7972
|
-
if (includeChildrenRecursively || node.shouldBeIncluded(context))
|
|
7973
|
-
node.include(context, includeChildrenRecursively);
|
|
7974
|
-
}
|
|
8115
|
+
hasEffectsWhenAccessedAtPath(path) {
|
|
8116
|
+
if (path.length === 0) {
|
|
8117
|
+
// Technically, "undefined" is a global variable of sorts
|
|
8118
|
+
return this.name !== 'undefined' && !getGlobalAtPath([this.name]);
|
|
7975
8119
|
}
|
|
8120
|
+
return !getGlobalAtPath([this.name, ...path].slice(0, -1));
|
|
7976
8121
|
}
|
|
7977
|
-
|
|
7978
|
-
const
|
|
7979
|
-
|
|
7980
|
-
firstBodyStatement instanceof ExpressionStatement &&
|
|
7981
|
-
firstBodyStatement.directive === 'use asm';
|
|
7982
|
-
}
|
|
7983
|
-
render(code, options) {
|
|
7984
|
-
if (this.body.length) {
|
|
7985
|
-
renderStatementList(this.body, code, this.start + 1, this.end - 1, options);
|
|
7986
|
-
}
|
|
7987
|
-
else {
|
|
7988
|
-
super.render(code, options);
|
|
7989
|
-
}
|
|
8122
|
+
hasEffectsWhenCalledAtPath(path, callOptions, context) {
|
|
8123
|
+
const globalAtPath = getGlobalAtPath([this.name, ...path]);
|
|
8124
|
+
return !globalAtPath || globalAtPath.hasEffectsWhenCalled(callOptions, context);
|
|
7990
8125
|
}
|
|
7991
8126
|
}
|
|
7992
8127
|
|
|
7993
|
-
|
|
8128
|
+
const tdzVariableKinds = {
|
|
8129
|
+
__proto__: null,
|
|
8130
|
+
class: true,
|
|
8131
|
+
const: true,
|
|
8132
|
+
let: true,
|
|
8133
|
+
var: true
|
|
8134
|
+
};
|
|
8135
|
+
class Identifier extends NodeBase {
|
|
7994
8136
|
constructor() {
|
|
7995
8137
|
super(...arguments);
|
|
8138
|
+
this.variable = null;
|
|
7996
8139
|
this.deoptimized = false;
|
|
7997
|
-
this.
|
|
8140
|
+
this.isTDZAccess = null;
|
|
7998
8141
|
}
|
|
7999
8142
|
addExportedVariables(variables, exportNamesByVariable) {
|
|
8000
|
-
this.
|
|
8001
|
-
|
|
8002
|
-
|
|
8003
|
-
this.declarationInit = init;
|
|
8004
|
-
return this.argument.declare(kind, UNKNOWN_EXPRESSION);
|
|
8005
|
-
}
|
|
8006
|
-
deoptimizePath(path) {
|
|
8007
|
-
path.length === 0 && this.argument.deoptimizePath(EMPTY_PATH);
|
|
8008
|
-
}
|
|
8009
|
-
hasEffectsWhenAssignedAtPath(path, context) {
|
|
8010
|
-
return path.length > 0 || this.argument.hasEffectsWhenAssignedAtPath(EMPTY_PATH, context);
|
|
8011
|
-
}
|
|
8012
|
-
markDeclarationReached() {
|
|
8013
|
-
this.argument.markDeclarationReached();
|
|
8143
|
+
if (exportNamesByVariable.has(this.variable)) {
|
|
8144
|
+
variables.push(this.variable);
|
|
8145
|
+
}
|
|
8014
8146
|
}
|
|
8015
|
-
|
|
8016
|
-
this.
|
|
8017
|
-
|
|
8018
|
-
this.
|
|
8019
|
-
this.context.requestTreeshakingPass();
|
|
8147
|
+
bind() {
|
|
8148
|
+
if (!this.variable && is_reference(this, this.parent)) {
|
|
8149
|
+
this.variable = this.scope.findVariable(this.name);
|
|
8150
|
+
this.variable.addReference(this);
|
|
8020
8151
|
}
|
|
8021
8152
|
}
|
|
8022
|
-
|
|
8023
|
-
|
|
8024
|
-
|
|
8025
|
-
|
|
8026
|
-
|
|
8027
|
-
|
|
8028
|
-
|
|
8153
|
+
declare(kind, init) {
|
|
8154
|
+
let variable;
|
|
8155
|
+
const { treeshake } = this.context.options;
|
|
8156
|
+
switch (kind) {
|
|
8157
|
+
case 'var':
|
|
8158
|
+
variable = this.scope.addDeclaration(this, this.context, init, true);
|
|
8159
|
+
if (treeshake && treeshake.correctVarValueBeforeDeclaration) {
|
|
8160
|
+
// Necessary to make sure the init is deoptimized. We cannot call deoptimizePath here.
|
|
8161
|
+
variable.markInitializersForDeoptimization();
|
|
8162
|
+
}
|
|
8163
|
+
break;
|
|
8164
|
+
case 'function':
|
|
8165
|
+
// in strict mode, functions are only hoisted within a scope but not across block scopes
|
|
8166
|
+
variable = this.scope.addDeclaration(this, this.context, init, false);
|
|
8167
|
+
break;
|
|
8168
|
+
case 'let':
|
|
8169
|
+
case 'const':
|
|
8170
|
+
case 'class':
|
|
8171
|
+
variable = this.scope.addDeclaration(this, this.context, init, false);
|
|
8172
|
+
break;
|
|
8173
|
+
case 'parameter':
|
|
8174
|
+
variable = this.scope.addParameterDeclaration(this);
|
|
8175
|
+
break;
|
|
8176
|
+
/* istanbul ignore next */
|
|
8177
|
+
default:
|
|
8178
|
+
/* istanbul ignore next */
|
|
8179
|
+
throw new Error(`Internal Error: Unexpected identifier kind ${kind}.`);
|
|
8180
|
+
}
|
|
8181
|
+
variable.kind = kind;
|
|
8182
|
+
return [(this.variable = variable)];
|
|
8029
8183
|
}
|
|
8030
8184
|
deoptimizePath(path) {
|
|
8031
|
-
this.
|
|
8032
|
-
|
|
8033
|
-
// A reassignment of UNKNOWN_PATH is considered equivalent to having lost track
|
|
8034
|
-
// which means the return expression needs to be reassigned
|
|
8035
|
-
this.scope.getReturnExpression().deoptimizePath(UNKNOWN_PATH);
|
|
8185
|
+
if (path.length === 0 && !this.scope.contains(this.name)) {
|
|
8186
|
+
this.disallowImportReassignment();
|
|
8036
8187
|
}
|
|
8188
|
+
this.variable.deoptimizePath(path);
|
|
8037
8189
|
}
|
|
8038
8190
|
deoptimizeThisOnEventAtPath(event, path, thisParameter, recursionTracker) {
|
|
8039
|
-
|
|
8040
|
-
this.getObjectEntity().deoptimizeThisOnEventAtPath(event, path, thisParameter, recursionTracker);
|
|
8041
|
-
}
|
|
8191
|
+
this.variable.deoptimizeThisOnEventAtPath(event, path, thisParameter, recursionTracker);
|
|
8042
8192
|
}
|
|
8043
8193
|
getLiteralValueAtPath(path, recursionTracker, origin) {
|
|
8044
|
-
return this.
|
|
8194
|
+
return this.getVariableRespectingTDZ().getLiteralValueAtPath(path, recursionTracker, origin);
|
|
8045
8195
|
}
|
|
8046
8196
|
getReturnExpressionWhenCalledAtPath(path, callOptions, recursionTracker, origin) {
|
|
8047
|
-
|
|
8048
|
-
|
|
8049
|
-
|
|
8050
|
-
if (this.
|
|
8051
|
-
|
|
8052
|
-
|
|
8053
|
-
|
|
8054
|
-
this.context.requestTreeshakingPass();
|
|
8055
|
-
}
|
|
8056
|
-
return UNKNOWN_EXPRESSION;
|
|
8197
|
+
return this.getVariableRespectingTDZ().getReturnExpressionWhenCalledAtPath(path, callOptions, recursionTracker, origin);
|
|
8198
|
+
}
|
|
8199
|
+
hasEffects() {
|
|
8200
|
+
if (!this.deoptimized)
|
|
8201
|
+
this.applyDeoptimizations();
|
|
8202
|
+
if (this.isPossibleTDZ() && this.variable.kind !== 'var') {
|
|
8203
|
+
return true;
|
|
8057
8204
|
}
|
|
8058
|
-
return this.
|
|
8205
|
+
return (this.context.options.treeshake.unknownGlobalSideEffects &&
|
|
8206
|
+
this.variable instanceof GlobalVariable &&
|
|
8207
|
+
this.variable.hasEffectsWhenAccessedAtPath(EMPTY_PATH));
|
|
8059
8208
|
}
|
|
8060
8209
|
hasEffectsWhenAccessedAtPath(path, context) {
|
|
8061
|
-
|
|
8210
|
+
var _a;
|
|
8211
|
+
return (_a = this.getVariableRespectingTDZ()) === null || _a === void 0 ? void 0 : _a.hasEffectsWhenAccessedAtPath(path, context);
|
|
8062
8212
|
}
|
|
8063
8213
|
hasEffectsWhenAssignedAtPath(path, context) {
|
|
8064
|
-
return this.
|
|
8214
|
+
return (path.length > 0 ? this.getVariableRespectingTDZ() : this.variable).hasEffectsWhenAssignedAtPath(path, context);
|
|
8065
8215
|
}
|
|
8066
8216
|
hasEffectsWhenCalledAtPath(path, callOptions, context) {
|
|
8067
|
-
|
|
8068
|
-
|
|
8069
|
-
|
|
8070
|
-
if (this.
|
|
8071
|
-
|
|
8072
|
-
|
|
8073
|
-
|
|
8074
|
-
if (
|
|
8075
|
-
(
|
|
8076
|
-
(propertyReadSideEffects === 'always' ||
|
|
8077
|
-
returnExpression.hasEffectsWhenAccessedAtPath(['then'], context)))) {
|
|
8078
|
-
return true;
|
|
8217
|
+
return this.getVariableRespectingTDZ().hasEffectsWhenCalledAtPath(path, callOptions, context);
|
|
8218
|
+
}
|
|
8219
|
+
include() {
|
|
8220
|
+
if (!this.deoptimized)
|
|
8221
|
+
this.applyDeoptimizations();
|
|
8222
|
+
if (!this.included) {
|
|
8223
|
+
this.included = true;
|
|
8224
|
+
if (this.variable !== null) {
|
|
8225
|
+
this.context.includeVariableInModule(this.variable);
|
|
8079
8226
|
}
|
|
8080
8227
|
}
|
|
8081
|
-
for (const param of this.params) {
|
|
8082
|
-
if (param.hasEffects(context))
|
|
8083
|
-
return true;
|
|
8084
|
-
}
|
|
8085
|
-
return false;
|
|
8086
|
-
}
|
|
8087
|
-
include(context, includeChildrenRecursively) {
|
|
8088
|
-
this.included = true;
|
|
8089
|
-
const { brokenFlow } = context;
|
|
8090
|
-
context.brokenFlow = BROKEN_FLOW_NONE;
|
|
8091
|
-
this.body.include(context, includeChildrenRecursively);
|
|
8092
|
-
context.brokenFlow = brokenFlow;
|
|
8093
8228
|
}
|
|
8094
|
-
|
|
8095
|
-
this.
|
|
8229
|
+
includeArgumentsWhenCalledAtPath(path, context, args) {
|
|
8230
|
+
this.variable.includeArgumentsWhenCalledAtPath(path, context, args);
|
|
8096
8231
|
}
|
|
8097
|
-
|
|
8098
|
-
|
|
8099
|
-
if (this.
|
|
8100
|
-
this.
|
|
8232
|
+
isPossibleTDZ() {
|
|
8233
|
+
// return cached value to avoid issues with the next tree-shaking pass
|
|
8234
|
+
if (this.isTDZAccess !== null)
|
|
8235
|
+
return this.isTDZAccess;
|
|
8236
|
+
if (!(this.variable instanceof LocalVariable) ||
|
|
8237
|
+
!this.variable.kind ||
|
|
8238
|
+
!(this.variable.kind in tdzVariableKinds)) {
|
|
8239
|
+
return (this.isTDZAccess = false);
|
|
8101
8240
|
}
|
|
8102
|
-
|
|
8103
|
-
|
|
8241
|
+
let decl_id;
|
|
8242
|
+
if (this.variable.declarations &&
|
|
8243
|
+
this.variable.declarations.length === 1 &&
|
|
8244
|
+
(decl_id = this.variable.declarations[0]) &&
|
|
8245
|
+
this.start < decl_id.start &&
|
|
8246
|
+
closestParentFunctionOrProgram(this) === closestParentFunctionOrProgram(decl_id)) {
|
|
8247
|
+
// a variable accessed before its declaration
|
|
8248
|
+
// in the same function or at top level of module
|
|
8249
|
+
return (this.isTDZAccess = true);
|
|
8104
8250
|
}
|
|
8105
|
-
|
|
8106
|
-
|
|
8107
|
-
|
|
8108
|
-
this.
|
|
8251
|
+
if (!this.variable.initReached) {
|
|
8252
|
+
// Either a const/let TDZ violation or
|
|
8253
|
+
// var use before declaration was encountered.
|
|
8254
|
+
return (this.isTDZAccess = true);
|
|
8109
8255
|
}
|
|
8110
|
-
|
|
8111
|
-
}
|
|
8112
|
-
}
|
|
8113
|
-
FunctionBase.prototype.preventChildBlockScope = true;
|
|
8114
|
-
|
|
8115
|
-
class ArrowFunctionExpression extends FunctionBase {
|
|
8116
|
-
constructor() {
|
|
8117
|
-
super(...arguments);
|
|
8118
|
-
this.objectEntity = null;
|
|
8119
|
-
}
|
|
8120
|
-
createScope(parentScope) {
|
|
8121
|
-
this.scope = new ReturnValueScope(parentScope, this.context);
|
|
8122
|
-
}
|
|
8123
|
-
hasEffects() {
|
|
8124
|
-
return false;
|
|
8256
|
+
return (this.isTDZAccess = false);
|
|
8125
8257
|
}
|
|
8126
|
-
|
|
8127
|
-
|
|
8128
|
-
return true;
|
|
8129
|
-
const { ignore, brokenFlow } = context;
|
|
8130
|
-
context.ignore = {
|
|
8131
|
-
breaks: false,
|
|
8132
|
-
continues: false,
|
|
8133
|
-
labels: new Set(),
|
|
8134
|
-
returnYield: true
|
|
8135
|
-
};
|
|
8136
|
-
if (this.body.hasEffects(context))
|
|
8137
|
-
return true;
|
|
8138
|
-
context.ignore = ignore;
|
|
8139
|
-
context.brokenFlow = brokenFlow;
|
|
8140
|
-
return false;
|
|
8258
|
+
markDeclarationReached() {
|
|
8259
|
+
this.variable.initReached = true;
|
|
8141
8260
|
}
|
|
8142
|
-
|
|
8143
|
-
|
|
8144
|
-
|
|
8145
|
-
if (
|
|
8146
|
-
|
|
8261
|
+
render(code, { snippets: { getPropertyAccess } }, { renderedParentType, isCalleeOfRenderedParent, isShorthandProperty } = BLANK) {
|
|
8262
|
+
if (this.variable) {
|
|
8263
|
+
const name = this.variable.getName(getPropertyAccess);
|
|
8264
|
+
if (name !== this.name) {
|
|
8265
|
+
code.overwrite(this.start, this.end, name, {
|
|
8266
|
+
contentOnly: true,
|
|
8267
|
+
storeName: true
|
|
8268
|
+
});
|
|
8269
|
+
if (isShorthandProperty) {
|
|
8270
|
+
code.prependRight(this.start, `${this.name}: `);
|
|
8271
|
+
}
|
|
8272
|
+
}
|
|
8273
|
+
// In strict mode, any variable named "eval" must be the actual "eval" function
|
|
8274
|
+
if (name === 'eval' &&
|
|
8275
|
+
renderedParentType === CallExpression$1 &&
|
|
8276
|
+
isCalleeOfRenderedParent) {
|
|
8277
|
+
code.appendRight(this.start, '0, ');
|
|
8147
8278
|
}
|
|
8148
8279
|
}
|
|
8149
8280
|
}
|
|
8150
|
-
|
|
8151
|
-
|
|
8152
|
-
|
|
8281
|
+
applyDeoptimizations() {
|
|
8282
|
+
this.deoptimized = true;
|
|
8283
|
+
if (this.variable instanceof LocalVariable) {
|
|
8284
|
+
this.variable.consolidateInitializers();
|
|
8285
|
+
this.context.requestTreeshakingPass();
|
|
8153
8286
|
}
|
|
8154
|
-
return (this.objectEntity = new ObjectEntity([], OBJECT_PROTOTYPE));
|
|
8155
8287
|
}
|
|
8156
|
-
|
|
8157
|
-
|
|
8158
|
-
|
|
8159
|
-
|
|
8160
|
-
|
|
8161
|
-
const variable = exportedVariables[0];
|
|
8162
|
-
return `exports('${exportNamesByVariable.get(variable)}',${_}${variable.getName(getPropertyAccess)}${modifier})`;
|
|
8288
|
+
disallowImportReassignment() {
|
|
8289
|
+
return this.context.error({
|
|
8290
|
+
code: 'ILLEGAL_REASSIGNMENT',
|
|
8291
|
+
message: `Illegal reassignment to import '${this.name}'`
|
|
8292
|
+
}, this.start);
|
|
8163
8293
|
}
|
|
8164
|
-
|
|
8165
|
-
|
|
8166
|
-
|
|
8167
|
-
for (const exportName of exportNamesByVariable.get(variable)) {
|
|
8168
|
-
fields.push([exportName, variable.getName(getPropertyAccess) + modifier]);
|
|
8169
|
-
}
|
|
8294
|
+
getVariableRespectingTDZ() {
|
|
8295
|
+
if (this.isPossibleTDZ()) {
|
|
8296
|
+
return UNKNOWN_EXPRESSION;
|
|
8170
8297
|
}
|
|
8171
|
-
return
|
|
8172
|
-
}
|
|
8173
|
-
}
|
|
8174
|
-
function renderSystemExportExpression(exportedVariable, expressionStart, expressionEnd, code, { exportNamesByVariable, snippets: { _ } }) {
|
|
8175
|
-
code.prependRight(expressionStart, `exports('${exportNamesByVariable.get(exportedVariable)}',${_}`);
|
|
8176
|
-
code.appendLeft(expressionEnd, ')');
|
|
8177
|
-
}
|
|
8178
|
-
function renderSystemExportFunction(exportedVariables, expressionStart, expressionEnd, needsParens, code, options) {
|
|
8179
|
-
const { _, getDirectReturnIifeLeft } = options.snippets;
|
|
8180
|
-
code.prependRight(expressionStart, getDirectReturnIifeLeft(['v'], `${getSystemExportStatement(exportedVariables, options)},${_}v`, { needsArrowReturnParens: true, needsWrappedFunction: needsParens }));
|
|
8181
|
-
code.appendLeft(expressionEnd, ')');
|
|
8182
|
-
}
|
|
8183
|
-
function renderSystemExportSequenceAfterExpression(exportedVariable, expressionStart, expressionEnd, needsParens, code, options) {
|
|
8184
|
-
const { _, getPropertyAccess } = options.snippets;
|
|
8185
|
-
code.appendLeft(expressionEnd, `,${_}${getSystemExportStatement([exportedVariable], options)},${_}${exportedVariable.getName(getPropertyAccess)}`);
|
|
8186
|
-
if (needsParens) {
|
|
8187
|
-
code.prependRight(expressionStart, '(');
|
|
8188
|
-
code.appendLeft(expressionEnd, ')');
|
|
8298
|
+
return this.variable;
|
|
8189
8299
|
}
|
|
8190
8300
|
}
|
|
8191
|
-
function
|
|
8192
|
-
|
|
8193
|
-
|
|
8194
|
-
if (needsParens) {
|
|
8195
|
-
code.prependRight(expressionStart, '(');
|
|
8196
|
-
code.appendLeft(expressionEnd, ')');
|
|
8301
|
+
function closestParentFunctionOrProgram(node) {
|
|
8302
|
+
while (node && !/^Program|Function/.test(node.type)) {
|
|
8303
|
+
node = node.parent;
|
|
8197
8304
|
}
|
|
8305
|
+
// one of: ArrowFunctionExpression, FunctionDeclaration, FunctionExpression or Program
|
|
8306
|
+
return node;
|
|
8198
8307
|
}
|
|
8199
8308
|
|
|
8200
8309
|
class ObjectPattern extends NodeBase {
|
|
@@ -8296,56 +8405,24 @@ class AssignmentExpression extends NodeBase {
|
|
|
8296
8405
|
renderSystemExportSequenceAfterExpression(variable, this.start, this.end, this.parent.type !== ExpressionStatement$1, code, options);
|
|
8297
8406
|
}
|
|
8298
8407
|
return;
|
|
8299
|
-
}
|
|
8300
|
-
}
|
|
8301
|
-
else {
|
|
8302
|
-
const systemPatternExports = [];
|
|
8303
|
-
this.left.addExportedVariables(systemPatternExports, options.exportNamesByVariable);
|
|
8304
|
-
if (systemPatternExports.length > 0) {
|
|
8305
|
-
renderSystemExportFunction(systemPatternExports, this.start, this.end, renderedSurroundingElement === ExpressionStatement$1, code, options);
|
|
8306
|
-
return;
|
|
8307
|
-
}
|
|
8308
|
-
}
|
|
8309
|
-
}
|
|
8310
|
-
if (this.left.included &&
|
|
8311
|
-
this.left instanceof ObjectPattern &&
|
|
8312
|
-
(renderedSurroundingElement === ExpressionStatement$1 ||
|
|
8313
|
-
renderedSurroundingElement === ArrowFunctionExpression$1)) {
|
|
8314
|
-
code.appendRight(this.start, '(');
|
|
8315
|
-
code.prependLeft(this.end, ')');
|
|
8316
|
-
}
|
|
8317
|
-
}
|
|
8318
|
-
applyDeoptimizations() {
|
|
8319
|
-
this.deoptimized = true;
|
|
8320
|
-
this.left.deoptimizePath(EMPTY_PATH);
|
|
8321
|
-
this.right.deoptimizePath(UNKNOWN_PATH);
|
|
8322
|
-
this.context.requestTreeshakingPass();
|
|
8323
|
-
}
|
|
8324
|
-
}
|
|
8325
|
-
|
|
8326
|
-
class AssignmentPattern extends NodeBase {
|
|
8327
|
-
constructor() {
|
|
8328
|
-
super(...arguments);
|
|
8329
|
-
this.deoptimized = false;
|
|
8330
|
-
}
|
|
8331
|
-
addExportedVariables(variables, exportNamesByVariable) {
|
|
8332
|
-
this.left.addExportedVariables(variables, exportNamesByVariable);
|
|
8333
|
-
}
|
|
8334
|
-
declare(kind, init) {
|
|
8335
|
-
return this.left.declare(kind, init);
|
|
8336
|
-
}
|
|
8337
|
-
deoptimizePath(path) {
|
|
8338
|
-
path.length === 0 && this.left.deoptimizePath(path);
|
|
8339
|
-
}
|
|
8340
|
-
hasEffectsWhenAssignedAtPath(path, context) {
|
|
8341
|
-
return path.length > 0 || this.left.hasEffectsWhenAssignedAtPath(EMPTY_PATH, context);
|
|
8342
|
-
}
|
|
8343
|
-
markDeclarationReached() {
|
|
8344
|
-
this.left.markDeclarationReached();
|
|
8345
|
-
}
|
|
8346
|
-
render(code, options, { isShorthandProperty } = BLANK) {
|
|
8347
|
-
this.left.render(code, options, { isShorthandProperty });
|
|
8348
|
-
this.right.render(code, options);
|
|
8408
|
+
}
|
|
8409
|
+
}
|
|
8410
|
+
else {
|
|
8411
|
+
const systemPatternExports = [];
|
|
8412
|
+
this.left.addExportedVariables(systemPatternExports, options.exportNamesByVariable);
|
|
8413
|
+
if (systemPatternExports.length > 0) {
|
|
8414
|
+
renderSystemExportFunction(systemPatternExports, this.start, this.end, renderedSurroundingElement === ExpressionStatement$1, code, options);
|
|
8415
|
+
return;
|
|
8416
|
+
}
|
|
8417
|
+
}
|
|
8418
|
+
}
|
|
8419
|
+
if (this.left.included &&
|
|
8420
|
+
this.left instanceof ObjectPattern &&
|
|
8421
|
+
(renderedSurroundingElement === ExpressionStatement$1 ||
|
|
8422
|
+
renderedSurroundingElement === ArrowFunctionExpression$1)) {
|
|
8423
|
+
code.appendRight(this.start, '(');
|
|
8424
|
+
code.prependLeft(this.end, ')');
|
|
8425
|
+
}
|
|
8349
8426
|
}
|
|
8350
8427
|
applyDeoptimizations() {
|
|
8351
8428
|
this.deoptimized = true;
|
|
@@ -8462,7 +8539,8 @@ class FunctionNode extends FunctionBase {
|
|
|
8462
8539
|
}
|
|
8463
8540
|
}
|
|
8464
8541
|
hasEffects() {
|
|
8465
|
-
|
|
8542
|
+
var _a;
|
|
8543
|
+
return (_a = this.id) === null || _a === void 0 ? void 0 : _a.hasEffects();
|
|
8466
8544
|
}
|
|
8467
8545
|
hasEffectsWhenCalledAtPath(path, callOptions, context) {
|
|
8468
8546
|
if (super.hasEffectsWhenCalledAtPath(path, callOptions, context))
|
|
@@ -8491,15 +8569,13 @@ class FunctionNode extends FunctionBase {
|
|
|
8491
8569
|
return false;
|
|
8492
8570
|
}
|
|
8493
8571
|
include(context, includeChildrenRecursively) {
|
|
8494
|
-
|
|
8495
|
-
|
|
8496
|
-
|
|
8497
|
-
|
|
8498
|
-
for (const param of this.params) {
|
|
8499
|
-
if (!(param instanceof Identifier) || hasArguments) {
|
|
8500
|
-
param.include(context, includeChildrenRecursively);
|
|
8501
|
-
}
|
|
8572
|
+
var _a;
|
|
8573
|
+
// This ensures that super.include will also include all parameters
|
|
8574
|
+
if (this.scope.argumentsVariable.included) {
|
|
8575
|
+
this.alwaysIncludeParameters = true;
|
|
8502
8576
|
}
|
|
8577
|
+
(_a = this.id) === null || _a === void 0 ? void 0 : _a.include();
|
|
8578
|
+
super.include(context, includeChildrenRecursively);
|
|
8503
8579
|
}
|
|
8504
8580
|
initialise() {
|
|
8505
8581
|
var _a;
|
|
@@ -8546,11 +8622,6 @@ class AwaitExpression extends NodeBase {
|
|
|
8546
8622
|
}
|
|
8547
8623
|
this.argument.include(context, includeChildrenRecursively);
|
|
8548
8624
|
}
|
|
8549
|
-
applyDeoptimizations() {
|
|
8550
|
-
this.deoptimized = true;
|
|
8551
|
-
this.argument.deoptimizePath(UNKNOWN_PATH);
|
|
8552
|
-
this.context.requestTreeshakingPass();
|
|
8553
|
-
}
|
|
8554
8625
|
}
|
|
8555
8626
|
|
|
8556
8627
|
const binaryOperators = {
|
|
@@ -8584,10 +8655,10 @@ class BinaryExpression extends NodeBase {
|
|
|
8584
8655
|
if (path.length > 0)
|
|
8585
8656
|
return UnknownValue;
|
|
8586
8657
|
const leftValue = this.left.getLiteralValueAtPath(EMPTY_PATH, recursionTracker, origin);
|
|
8587
|
-
if (leftValue ===
|
|
8658
|
+
if (typeof leftValue === 'symbol')
|
|
8588
8659
|
return UnknownValue;
|
|
8589
8660
|
const rightValue = this.right.getLiteralValueAtPath(EMPTY_PATH, recursionTracker, origin);
|
|
8590
|
-
if (rightValue ===
|
|
8661
|
+
if (typeof rightValue === 'symbol')
|
|
8591
8662
|
return UnknownValue;
|
|
8592
8663
|
const operatorFn = binaryOperators[this.operator];
|
|
8593
8664
|
if (!operatorFn)
|
|
@@ -8878,12 +8949,15 @@ class MemberExpression extends NodeBase {
|
|
|
8878
8949
|
this.object.include(context, includeChildrenRecursively);
|
|
8879
8950
|
this.property.include(context, includeChildrenRecursively);
|
|
8880
8951
|
}
|
|
8881
|
-
|
|
8952
|
+
includeArgumentsWhenCalledAtPath(path, context, args) {
|
|
8882
8953
|
if (this.variable) {
|
|
8883
|
-
this.variable.
|
|
8954
|
+
this.variable.includeArgumentsWhenCalledAtPath(path, context, args);
|
|
8884
8955
|
}
|
|
8885
|
-
else {
|
|
8886
|
-
super.
|
|
8956
|
+
else if (this.replacement) {
|
|
8957
|
+
super.includeArgumentsWhenCalledAtPath(path, context, args);
|
|
8958
|
+
}
|
|
8959
|
+
else if (path.length < MAX_PATH_DEPTH) {
|
|
8960
|
+
this.object.includeArgumentsWhenCalledAtPath([this.getPropertyKey(), ...path], context, args);
|
|
8887
8961
|
}
|
|
8888
8962
|
}
|
|
8889
8963
|
initialise() {
|
|
@@ -8945,7 +9019,7 @@ class MemberExpression extends NodeBase {
|
|
|
8945
9019
|
if (this.propertyKey === null) {
|
|
8946
9020
|
this.propertyKey = UnknownKey;
|
|
8947
9021
|
const value = this.property.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, this);
|
|
8948
|
-
return (this.propertyKey = value ===
|
|
9022
|
+
return (this.propertyKey = typeof value === 'symbol' ? UnknownKey : String(value));
|
|
8949
9023
|
}
|
|
8950
9024
|
return this.propertyKey;
|
|
8951
9025
|
}
|
|
@@ -8972,39 +9046,13 @@ class MemberExpression extends NodeBase {
|
|
|
8972
9046
|
}
|
|
8973
9047
|
}
|
|
8974
9048
|
|
|
8975
|
-
class
|
|
9049
|
+
class CallExpressionBase extends NodeBase {
|
|
8976
9050
|
constructor() {
|
|
8977
9051
|
super(...arguments);
|
|
8978
9052
|
this.deoptimized = false;
|
|
9053
|
+
this.returnExpression = null;
|
|
8979
9054
|
this.deoptimizableDependentExpressions = [];
|
|
8980
9055
|
this.expressionsToBeDeoptimized = new Set();
|
|
8981
|
-
this.returnExpression = null;
|
|
8982
|
-
}
|
|
8983
|
-
bind() {
|
|
8984
|
-
super.bind();
|
|
8985
|
-
if (this.callee instanceof Identifier) {
|
|
8986
|
-
const variable = this.scope.findVariable(this.callee.name);
|
|
8987
|
-
if (variable.isNamespace) {
|
|
8988
|
-
this.context.warn({
|
|
8989
|
-
code: 'CANNOT_CALL_NAMESPACE',
|
|
8990
|
-
message: `Cannot call a namespace ('${this.callee.name}')`
|
|
8991
|
-
}, this.start);
|
|
8992
|
-
}
|
|
8993
|
-
if (this.callee.name === 'eval') {
|
|
8994
|
-
this.context.warn({
|
|
8995
|
-
code: 'EVAL',
|
|
8996
|
-
message: `Use of eval is strongly discouraged, as it poses security risks and may cause issues with minification`,
|
|
8997
|
-
url: 'https://rollupjs.org/guide/en/#avoiding-eval'
|
|
8998
|
-
}, this.start);
|
|
8999
|
-
}
|
|
9000
|
-
}
|
|
9001
|
-
this.callOptions = {
|
|
9002
|
-
args: this.arguments,
|
|
9003
|
-
thisParam: this.callee instanceof MemberExpression && !this.callee.variable
|
|
9004
|
-
? this.callee.object
|
|
9005
|
-
: null,
|
|
9006
|
-
withNew: false
|
|
9007
|
-
};
|
|
9008
9056
|
}
|
|
9009
9057
|
deoptimizeCache() {
|
|
9010
9058
|
if (this.returnExpression !== UNKNOWN_EXPRESSION) {
|
|
@@ -9059,6 +9107,47 @@ class CallExpression extends NodeBase {
|
|
|
9059
9107
|
return returnExpression.getReturnExpressionWhenCalledAtPath(path, callOptions, recursionTracker, origin);
|
|
9060
9108
|
}, UNKNOWN_EXPRESSION);
|
|
9061
9109
|
}
|
|
9110
|
+
hasEffectsWhenAccessedAtPath(path, context) {
|
|
9111
|
+
return (!context.accessed.trackEntityAtPathAndGetIfTracked(path, this) &&
|
|
9112
|
+
this.getReturnExpression().hasEffectsWhenAccessedAtPath(path, context));
|
|
9113
|
+
}
|
|
9114
|
+
hasEffectsWhenAssignedAtPath(path, context) {
|
|
9115
|
+
return (!context.assigned.trackEntityAtPathAndGetIfTracked(path, this) &&
|
|
9116
|
+
this.getReturnExpression().hasEffectsWhenAssignedAtPath(path, context));
|
|
9117
|
+
}
|
|
9118
|
+
hasEffectsWhenCalledAtPath(path, callOptions, context) {
|
|
9119
|
+
return (!(callOptions.withNew ? context.instantiated : context.called).trackEntityAtPathAndGetIfTracked(path, callOptions, this) &&
|
|
9120
|
+
this.getReturnExpression().hasEffectsWhenCalledAtPath(path, callOptions, context));
|
|
9121
|
+
}
|
|
9122
|
+
}
|
|
9123
|
+
|
|
9124
|
+
class CallExpression extends CallExpressionBase {
|
|
9125
|
+
bind() {
|
|
9126
|
+
super.bind();
|
|
9127
|
+
if (this.callee instanceof Identifier) {
|
|
9128
|
+
const variable = this.scope.findVariable(this.callee.name);
|
|
9129
|
+
if (variable.isNamespace) {
|
|
9130
|
+
this.context.warn({
|
|
9131
|
+
code: 'CANNOT_CALL_NAMESPACE',
|
|
9132
|
+
message: `Cannot call a namespace ('${this.callee.name}')`
|
|
9133
|
+
}, this.start);
|
|
9134
|
+
}
|
|
9135
|
+
if (this.callee.name === 'eval') {
|
|
9136
|
+
this.context.warn({
|
|
9137
|
+
code: 'EVAL',
|
|
9138
|
+
message: `Use of eval is strongly discouraged, as it poses security risks and may cause issues with minification`,
|
|
9139
|
+
url: 'https://rollupjs.org/guide/en/#avoiding-eval'
|
|
9140
|
+
}, this.start);
|
|
9141
|
+
}
|
|
9142
|
+
}
|
|
9143
|
+
this.callOptions = {
|
|
9144
|
+
args: this.arguments,
|
|
9145
|
+
thisParam: this.callee instanceof MemberExpression && !this.callee.variable
|
|
9146
|
+
? this.callee.object
|
|
9147
|
+
: null,
|
|
9148
|
+
withNew: false
|
|
9149
|
+
};
|
|
9150
|
+
}
|
|
9062
9151
|
hasEffects(context) {
|
|
9063
9152
|
try {
|
|
9064
9153
|
for (const argument of this.arguments) {
|
|
@@ -9076,18 +9165,6 @@ class CallExpression extends NodeBase {
|
|
|
9076
9165
|
this.applyDeoptimizations();
|
|
9077
9166
|
}
|
|
9078
9167
|
}
|
|
9079
|
-
hasEffectsWhenAccessedAtPath(path, context) {
|
|
9080
|
-
return (!context.accessed.trackEntityAtPathAndGetIfTracked(path, this) &&
|
|
9081
|
-
this.getReturnExpression().hasEffectsWhenAccessedAtPath(path, context));
|
|
9082
|
-
}
|
|
9083
|
-
hasEffectsWhenAssignedAtPath(path, context) {
|
|
9084
|
-
return (!context.assigned.trackEntityAtPathAndGetIfTracked(path, this) &&
|
|
9085
|
-
this.getReturnExpression().hasEffectsWhenAssignedAtPath(path, context));
|
|
9086
|
-
}
|
|
9087
|
-
hasEffectsWhenCalledAtPath(path, callOptions, context) {
|
|
9088
|
-
return (!(callOptions.withNew ? context.instantiated : context.called).trackEntityAtPathAndGetIfTracked(path, callOptions, this) &&
|
|
9089
|
-
this.getReturnExpression().hasEffectsWhenCalledAtPath(path, callOptions, context));
|
|
9090
|
-
}
|
|
9091
9168
|
include(context, includeChildrenRecursively) {
|
|
9092
9169
|
if (!this.deoptimized)
|
|
9093
9170
|
this.applyDeoptimizations();
|
|
@@ -9103,7 +9180,7 @@ class CallExpression extends NodeBase {
|
|
|
9103
9180
|
this.included = true;
|
|
9104
9181
|
this.callee.include(context, false);
|
|
9105
9182
|
}
|
|
9106
|
-
this.callee.
|
|
9183
|
+
this.callee.includeArgumentsWhenCalledAtPath(EMPTY_PATH, context, this.arguments);
|
|
9107
9184
|
const returnExpression = this.getReturnExpression();
|
|
9108
9185
|
if (!returnExpression.included) {
|
|
9109
9186
|
returnExpression.include(context, false);
|
|
@@ -9274,6 +9351,9 @@ class MethodBase extends NodeBase {
|
|
|
9274
9351
|
hasEffectsWhenCalledAtPath(path, callOptions, context) {
|
|
9275
9352
|
return this.getAccessedValue().hasEffectsWhenCalledAtPath(path, callOptions, context);
|
|
9276
9353
|
}
|
|
9354
|
+
includeArgumentsWhenCalledAtPath(path, context, args) {
|
|
9355
|
+
this.getAccessedValue().includeArgumentsWhenCalledAtPath(path, context, args);
|
|
9356
|
+
}
|
|
9277
9357
|
getAccessedValue() {
|
|
9278
9358
|
if (this.accessedValue === null) {
|
|
9279
9359
|
if (this.kind === 'get') {
|
|
@@ -9310,8 +9390,6 @@ class ObjectMember extends ExpressionEntity {
|
|
|
9310
9390
|
return this.object.getReturnExpressionWhenCalledAtPath([this.key, ...path], callOptions, recursionTracker, origin);
|
|
9311
9391
|
}
|
|
9312
9392
|
hasEffectsWhenAccessedAtPath(path, context) {
|
|
9313
|
-
if (path.length === 0)
|
|
9314
|
-
return false;
|
|
9315
9393
|
return this.object.hasEffectsWhenAccessedAtPath([this.key, ...path], context);
|
|
9316
9394
|
}
|
|
9317
9395
|
hasEffectsWhenAssignedAtPath(path, context) {
|
|
@@ -9325,6 +9403,7 @@ class ObjectMember extends ExpressionEntity {
|
|
|
9325
9403
|
class ClassNode extends NodeBase {
|
|
9326
9404
|
constructor() {
|
|
9327
9405
|
super(...arguments);
|
|
9406
|
+
this.deoptimized = false;
|
|
9328
9407
|
this.objectEntity = null;
|
|
9329
9408
|
}
|
|
9330
9409
|
createScope(parentScope) {
|
|
@@ -9334,7 +9413,14 @@ class ClassNode extends NodeBase {
|
|
|
9334
9413
|
this.getObjectEntity().deoptimizeAllProperties();
|
|
9335
9414
|
}
|
|
9336
9415
|
deoptimizePath(path) {
|
|
9416
|
+
var _a, _b;
|
|
9337
9417
|
this.getObjectEntity().deoptimizePath(path);
|
|
9418
|
+
if (path.length === 1 && path[0] === UnknownKey) {
|
|
9419
|
+
// A reassignment of UNKNOWN_PATH is considered equivalent to having lost track
|
|
9420
|
+
// which means the constructor needs to be reassigned
|
|
9421
|
+
(_a = this.classConstructor) === null || _a === void 0 ? void 0 : _a.deoptimizePath(UNKNOWN_PATH);
|
|
9422
|
+
(_b = this.superClass) === null || _b === void 0 ? void 0 : _b.deoptimizePath(UNKNOWN_PATH);
|
|
9423
|
+
}
|
|
9338
9424
|
}
|
|
9339
9425
|
deoptimizeThisOnEventAtPath(event, path, thisParameter, recursionTracker) {
|
|
9340
9426
|
this.getObjectEntity().deoptimizeThisOnEventAtPath(event, path, thisParameter, recursionTracker);
|
|
@@ -9347,6 +9433,8 @@ class ClassNode extends NodeBase {
|
|
|
9347
9433
|
}
|
|
9348
9434
|
hasEffects(context) {
|
|
9349
9435
|
var _a, _b;
|
|
9436
|
+
if (!this.deoptimized)
|
|
9437
|
+
this.applyDeoptimizations();
|
|
9350
9438
|
const initEffect = ((_a = this.superClass) === null || _a === void 0 ? void 0 : _a.hasEffects(context)) || this.body.hasEffects(context);
|
|
9351
9439
|
(_b = this.id) === null || _b === void 0 ? void 0 : _b.markDeclarationReached();
|
|
9352
9440
|
return initEffect || super.hasEffects(context);
|
|
@@ -9358,12 +9446,13 @@ class ClassNode extends NodeBase {
|
|
|
9358
9446
|
return this.getObjectEntity().hasEffectsWhenAssignedAtPath(path, context);
|
|
9359
9447
|
}
|
|
9360
9448
|
hasEffectsWhenCalledAtPath(path, callOptions, context) {
|
|
9449
|
+
var _a;
|
|
9361
9450
|
if (path.length === 0) {
|
|
9362
9451
|
return (!callOptions.withNew ||
|
|
9363
9452
|
(this.classConstructor !== null
|
|
9364
9453
|
? this.classConstructor.hasEffectsWhenCalledAtPath(EMPTY_PATH, callOptions, context)
|
|
9365
|
-
: this.superClass
|
|
9366
|
-
|
|
9454
|
+
: (_a = this.superClass) === null || _a === void 0 ? void 0 : _a.hasEffectsWhenCalledAtPath(path, callOptions, context)) ||
|
|
9455
|
+
false);
|
|
9367
9456
|
}
|
|
9368
9457
|
else {
|
|
9369
9458
|
return this.getObjectEntity().hasEffectsWhenCalledAtPath(path, callOptions, context);
|
|
@@ -9371,6 +9460,8 @@ class ClassNode extends NodeBase {
|
|
|
9371
9460
|
}
|
|
9372
9461
|
include(context, includeChildrenRecursively) {
|
|
9373
9462
|
var _a;
|
|
9463
|
+
if (!this.deoptimized)
|
|
9464
|
+
this.applyDeoptimizations();
|
|
9374
9465
|
this.included = true;
|
|
9375
9466
|
(_a = this.superClass) === null || _a === void 0 ? void 0 : _a.include(context, includeChildrenRecursively);
|
|
9376
9467
|
this.body.include(context, includeChildrenRecursively);
|
|
@@ -9379,6 +9470,20 @@ class ClassNode extends NodeBase {
|
|
|
9379
9470
|
this.id.include();
|
|
9380
9471
|
}
|
|
9381
9472
|
}
|
|
9473
|
+
includeArgumentsWhenCalledAtPath(path, context, args) {
|
|
9474
|
+
var _a;
|
|
9475
|
+
if (path.length === 0) {
|
|
9476
|
+
if (this.classConstructor) {
|
|
9477
|
+
this.classConstructor.includeArgumentsWhenCalledAtPath(path, context, args);
|
|
9478
|
+
}
|
|
9479
|
+
else {
|
|
9480
|
+
(_a = this.superClass) === null || _a === void 0 ? void 0 : _a.includeArgumentsWhenCalledAtPath(path, context, args);
|
|
9481
|
+
}
|
|
9482
|
+
}
|
|
9483
|
+
else {
|
|
9484
|
+
this.getObjectEntity().includeArgumentsWhenCalledAtPath(path, context, args);
|
|
9485
|
+
}
|
|
9486
|
+
}
|
|
9382
9487
|
initialise() {
|
|
9383
9488
|
var _a;
|
|
9384
9489
|
(_a = this.id) === null || _a === void 0 ? void 0 : _a.declare('class', this);
|
|
@@ -9390,6 +9495,18 @@ class ClassNode extends NodeBase {
|
|
|
9390
9495
|
}
|
|
9391
9496
|
this.classConstructor = null;
|
|
9392
9497
|
}
|
|
9498
|
+
applyDeoptimizations() {
|
|
9499
|
+
this.deoptimized = true;
|
|
9500
|
+
for (const definition of this.body.body) {
|
|
9501
|
+
if (!(definition.static ||
|
|
9502
|
+
(definition instanceof MethodDefinition && definition.kind === 'constructor'))) {
|
|
9503
|
+
// Calls to methods are not tracked, ensure that parameter defaults are
|
|
9504
|
+
// included and the return value is deoptimized
|
|
9505
|
+
definition.deoptimizePath(UNKNOWN_PATH);
|
|
9506
|
+
}
|
|
9507
|
+
}
|
|
9508
|
+
this.context.requestTreeshakingPass();
|
|
9509
|
+
}
|
|
9393
9510
|
getObjectEntity() {
|
|
9394
9511
|
if (this.objectEntity !== null) {
|
|
9395
9512
|
return this.objectEntity;
|
|
@@ -9406,7 +9523,7 @@ class ClassNode extends NodeBase {
|
|
|
9406
9523
|
let key;
|
|
9407
9524
|
if (definition.computed) {
|
|
9408
9525
|
const keyValue = definition.key.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, this);
|
|
9409
|
-
if (keyValue ===
|
|
9526
|
+
if (typeof keyValue === 'symbol') {
|
|
9410
9527
|
properties.push({ key: UnknownKey, kind, property: definition });
|
|
9411
9528
|
continue;
|
|
9412
9529
|
}
|
|
@@ -9602,14 +9719,14 @@ class ConditionalExpression extends NodeBase {
|
|
|
9602
9719
|
usedBranch.include(context, includeChildrenRecursively);
|
|
9603
9720
|
}
|
|
9604
9721
|
}
|
|
9605
|
-
|
|
9722
|
+
includeArgumentsWhenCalledAtPath(path, context, args) {
|
|
9606
9723
|
const usedBranch = this.getUsedBranch();
|
|
9607
9724
|
if (usedBranch === null) {
|
|
9608
|
-
this.consequent.
|
|
9609
|
-
this.alternate.
|
|
9725
|
+
this.consequent.includeArgumentsWhenCalledAtPath(path, context, args);
|
|
9726
|
+
this.alternate.includeArgumentsWhenCalledAtPath(path, context, args);
|
|
9610
9727
|
}
|
|
9611
9728
|
else {
|
|
9612
|
-
usedBranch.
|
|
9729
|
+
usedBranch.includeArgumentsWhenCalledAtPath(path, context, args);
|
|
9613
9730
|
}
|
|
9614
9731
|
}
|
|
9615
9732
|
render(code, options, { isCalleeOfRenderedParent, preventASI, renderedParentType, renderedSurroundingElement } = BLANK) {
|
|
@@ -9646,7 +9763,7 @@ class ConditionalExpression extends NodeBase {
|
|
|
9646
9763
|
}
|
|
9647
9764
|
this.isBranchResolutionAnalysed = true;
|
|
9648
9765
|
const testValue = this.test.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, this);
|
|
9649
|
-
return testValue ===
|
|
9766
|
+
return typeof testValue === 'symbol'
|
|
9650
9767
|
? null
|
|
9651
9768
|
: (this.usedBranch = testValue ? this.consequent : this.alternate);
|
|
9652
9769
|
}
|
|
@@ -9695,7 +9812,7 @@ class DoWhileStatement extends NodeBase {
|
|
|
9695
9812
|
this.included = true;
|
|
9696
9813
|
this.test.include(context, includeChildrenRecursively);
|
|
9697
9814
|
const { brokenFlow } = context;
|
|
9698
|
-
this.body.
|
|
9815
|
+
this.body.include(context, includeChildrenRecursively, { asSingleStatement: true });
|
|
9699
9816
|
context.brokenFlow = brokenFlow;
|
|
9700
9817
|
}
|
|
9701
9818
|
}
|
|
@@ -9823,12 +9940,13 @@ ExportDefaultDeclaration.prototype.needsBoundaries = true;
|
|
|
9823
9940
|
|
|
9824
9941
|
class ExportNamedDeclaration extends NodeBase {
|
|
9825
9942
|
bind() {
|
|
9943
|
+
var _a;
|
|
9826
9944
|
// Do not bind specifiers
|
|
9827
|
-
|
|
9828
|
-
this.declaration.bind();
|
|
9945
|
+
(_a = this.declaration) === null || _a === void 0 ? void 0 : _a.bind();
|
|
9829
9946
|
}
|
|
9830
9947
|
hasEffects(context) {
|
|
9831
|
-
|
|
9948
|
+
var _a;
|
|
9949
|
+
return (_a = this.declaration) === null || _a === void 0 ? void 0 : _a.hasEffects(context);
|
|
9832
9950
|
}
|
|
9833
9951
|
initialise() {
|
|
9834
9952
|
this.context.addExport(this);
|
|
@@ -9882,7 +10000,7 @@ class ForInStatement extends NodeBase {
|
|
|
9882
10000
|
this.left.include(context, includeChildrenRecursively || true);
|
|
9883
10001
|
this.right.include(context, includeChildrenRecursively);
|
|
9884
10002
|
const { brokenFlow } = context;
|
|
9885
|
-
this.body.
|
|
10003
|
+
this.body.include(context, includeChildrenRecursively, { asSingleStatement: true });
|
|
9886
10004
|
context.brokenFlow = brokenFlow;
|
|
9887
10005
|
}
|
|
9888
10006
|
render(code, options) {
|
|
@@ -9922,7 +10040,7 @@ class ForOfStatement extends NodeBase {
|
|
|
9922
10040
|
this.left.include(context, includeChildrenRecursively || true);
|
|
9923
10041
|
this.right.include(context, includeChildrenRecursively);
|
|
9924
10042
|
const { brokenFlow } = context;
|
|
9925
|
-
this.body.
|
|
10043
|
+
this.body.include(context, includeChildrenRecursively, { asSingleStatement: true });
|
|
9926
10044
|
context.brokenFlow = brokenFlow;
|
|
9927
10045
|
}
|
|
9928
10046
|
render(code, options) {
|
|
@@ -9946,9 +10064,10 @@ class ForStatement extends NodeBase {
|
|
|
9946
10064
|
this.scope = new BlockScope(parentScope);
|
|
9947
10065
|
}
|
|
9948
10066
|
hasEffects(context) {
|
|
9949
|
-
|
|
9950
|
-
|
|
9951
|
-
(this.
|
|
10067
|
+
var _a, _b, _c;
|
|
10068
|
+
if (((_a = this.init) === null || _a === void 0 ? void 0 : _a.hasEffects(context)) ||
|
|
10069
|
+
((_b = this.test) === null || _b === void 0 ? void 0 : _b.hasEffects(context)) ||
|
|
10070
|
+
((_c = this.update) === null || _c === void 0 ? void 0 : _c.hasEffects(context)))
|
|
9952
10071
|
return true;
|
|
9953
10072
|
const { brokenFlow, ignore: { breaks, continues } } = context;
|
|
9954
10073
|
context.ignore.breaks = true;
|
|
@@ -9961,24 +10080,20 @@ class ForStatement extends NodeBase {
|
|
|
9961
10080
|
return false;
|
|
9962
10081
|
}
|
|
9963
10082
|
include(context, includeChildrenRecursively) {
|
|
10083
|
+
var _a, _b, _c;
|
|
9964
10084
|
this.included = true;
|
|
9965
|
-
|
|
9966
|
-
|
|
9967
|
-
if (this.test)
|
|
9968
|
-
this.test.include(context, includeChildrenRecursively);
|
|
10085
|
+
(_a = this.init) === null || _a === void 0 ? void 0 : _a.include(context, includeChildrenRecursively, { asSingleStatement: true });
|
|
10086
|
+
(_b = this.test) === null || _b === void 0 ? void 0 : _b.include(context, includeChildrenRecursively);
|
|
9969
10087
|
const { brokenFlow } = context;
|
|
9970
|
-
|
|
9971
|
-
|
|
9972
|
-
this.body.includeAsSingleStatement(context, includeChildrenRecursively);
|
|
10088
|
+
(_c = this.update) === null || _c === void 0 ? void 0 : _c.include(context, includeChildrenRecursively);
|
|
10089
|
+
this.body.include(context, includeChildrenRecursively, { asSingleStatement: true });
|
|
9973
10090
|
context.brokenFlow = brokenFlow;
|
|
9974
10091
|
}
|
|
9975
10092
|
render(code, options) {
|
|
9976
|
-
|
|
9977
|
-
|
|
9978
|
-
|
|
9979
|
-
|
|
9980
|
-
if (this.update)
|
|
9981
|
-
this.update.render(code, options, NO_SEMICOLON);
|
|
10093
|
+
var _a, _b, _c;
|
|
10094
|
+
(_a = this.init) === null || _a === void 0 ? void 0 : _a.render(code, options, NO_SEMICOLON);
|
|
10095
|
+
(_b = this.test) === null || _b === void 0 ? void 0 : _b.render(code, options, NO_SEMICOLON);
|
|
10096
|
+
(_c = this.update) === null || _c === void 0 ? void 0 : _c.render(code, options, NO_SEMICOLON);
|
|
9982
10097
|
this.body.render(code, options);
|
|
9983
10098
|
}
|
|
9984
10099
|
}
|
|
@@ -10014,11 +10129,12 @@ class IfStatement extends NodeBase {
|
|
|
10014
10129
|
this.testValue = UnknownValue;
|
|
10015
10130
|
}
|
|
10016
10131
|
hasEffects(context) {
|
|
10132
|
+
var _a;
|
|
10017
10133
|
if (this.test.hasEffects(context)) {
|
|
10018
10134
|
return true;
|
|
10019
10135
|
}
|
|
10020
10136
|
const testValue = this.getTestValue();
|
|
10021
|
-
if (testValue ===
|
|
10137
|
+
if (typeof testValue === 'symbol') {
|
|
10022
10138
|
const { brokenFlow } = context;
|
|
10023
10139
|
if (this.consequent.hasEffects(context))
|
|
10024
10140
|
return true;
|
|
@@ -10032,9 +10148,7 @@ class IfStatement extends NodeBase {
|
|
|
10032
10148
|
context.brokenFlow < consequentBrokenFlow ? context.brokenFlow : consequentBrokenFlow;
|
|
10033
10149
|
return false;
|
|
10034
10150
|
}
|
|
10035
|
-
return testValue
|
|
10036
|
-
? this.consequent.hasEffects(context)
|
|
10037
|
-
: this.alternate !== null && this.alternate.hasEffects(context);
|
|
10151
|
+
return testValue ? this.consequent.hasEffects(context) : (_a = this.alternate) === null || _a === void 0 ? void 0 : _a.hasEffects(context);
|
|
10038
10152
|
}
|
|
10039
10153
|
include(context, includeChildrenRecursively) {
|
|
10040
10154
|
this.included = true;
|
|
@@ -10043,7 +10157,7 @@ class IfStatement extends NodeBase {
|
|
|
10043
10157
|
}
|
|
10044
10158
|
else {
|
|
10045
10159
|
const testValue = this.getTestValue();
|
|
10046
|
-
if (testValue ===
|
|
10160
|
+
if (typeof testValue === 'symbol') {
|
|
10047
10161
|
this.includeUnknownTest(context);
|
|
10048
10162
|
}
|
|
10049
10163
|
else {
|
|
@@ -10073,7 +10187,7 @@ class IfStatement extends NodeBase {
|
|
|
10073
10187
|
else {
|
|
10074
10188
|
code.remove(this.start, this.consequent.start);
|
|
10075
10189
|
}
|
|
10076
|
-
if (this.consequent.included && (noTreeshake || testValue ===
|
|
10190
|
+
if (this.consequent.included && (noTreeshake || typeof testValue === 'symbol' || testValue)) {
|
|
10077
10191
|
this.consequent.render(code, options);
|
|
10078
10192
|
}
|
|
10079
10193
|
else {
|
|
@@ -10081,7 +10195,7 @@ class IfStatement extends NodeBase {
|
|
|
10081
10195
|
hoistedDeclarations.push(...this.consequentScope.hoistedDeclarations);
|
|
10082
10196
|
}
|
|
10083
10197
|
if (this.alternate) {
|
|
10084
|
-
if (this.alternate.included && (noTreeshake || testValue ===
|
|
10198
|
+
if (this.alternate.included && (noTreeshake || typeof testValue === 'symbol' || !testValue)) {
|
|
10085
10199
|
if (includesIfElse) {
|
|
10086
10200
|
if (code.original.charCodeAt(this.alternate.start - 1) === 101) {
|
|
10087
10201
|
code.prependLeft(this.alternate.start, ' ');
|
|
@@ -10111,34 +10225,35 @@ class IfStatement extends NodeBase {
|
|
|
10111
10225
|
return this.testValue;
|
|
10112
10226
|
}
|
|
10113
10227
|
includeKnownTest(context, testValue) {
|
|
10228
|
+
var _a;
|
|
10114
10229
|
if (this.test.shouldBeIncluded(context)) {
|
|
10115
10230
|
this.test.include(context, false);
|
|
10116
10231
|
}
|
|
10117
10232
|
if (testValue && this.consequent.shouldBeIncluded(context)) {
|
|
10118
|
-
this.consequent.
|
|
10233
|
+
this.consequent.include(context, false, { asSingleStatement: true });
|
|
10119
10234
|
}
|
|
10120
|
-
if (this.alternate
|
|
10121
|
-
this.alternate.
|
|
10235
|
+
if (!testValue && ((_a = this.alternate) === null || _a === void 0 ? void 0 : _a.shouldBeIncluded(context))) {
|
|
10236
|
+
this.alternate.include(context, false, { asSingleStatement: true });
|
|
10122
10237
|
}
|
|
10123
10238
|
}
|
|
10124
10239
|
includeRecursively(includeChildrenRecursively, context) {
|
|
10240
|
+
var _a;
|
|
10125
10241
|
this.test.include(context, includeChildrenRecursively);
|
|
10126
10242
|
this.consequent.include(context, includeChildrenRecursively);
|
|
10127
|
-
|
|
10128
|
-
this.alternate.include(context, includeChildrenRecursively);
|
|
10129
|
-
}
|
|
10243
|
+
(_a = this.alternate) === null || _a === void 0 ? void 0 : _a.include(context, includeChildrenRecursively);
|
|
10130
10244
|
}
|
|
10131
10245
|
includeUnknownTest(context) {
|
|
10246
|
+
var _a;
|
|
10132
10247
|
this.test.include(context, false);
|
|
10133
10248
|
const { brokenFlow } = context;
|
|
10134
10249
|
let consequentBrokenFlow = BROKEN_FLOW_NONE;
|
|
10135
10250
|
if (this.consequent.shouldBeIncluded(context)) {
|
|
10136
|
-
this.consequent.
|
|
10251
|
+
this.consequent.include(context, false, { asSingleStatement: true });
|
|
10137
10252
|
consequentBrokenFlow = context.brokenFlow;
|
|
10138
10253
|
context.brokenFlow = brokenFlow;
|
|
10139
10254
|
}
|
|
10140
|
-
if (this.alternate
|
|
10141
|
-
this.alternate.
|
|
10255
|
+
if ((_a = this.alternate) === null || _a === void 0 ? void 0 : _a.shouldBeIncluded(context)) {
|
|
10256
|
+
this.alternate.include(context, false, { asSingleStatement: true });
|
|
10142
10257
|
context.brokenFlow =
|
|
10143
10258
|
context.brokenFlow < consequentBrokenFlow ? context.brokenFlow : consequentBrokenFlow;
|
|
10144
10259
|
}
|
|
@@ -10725,7 +10840,7 @@ class LogicalExpression extends NodeBase {
|
|
|
10725
10840
|
if (!this.isBranchResolutionAnalysed) {
|
|
10726
10841
|
this.isBranchResolutionAnalysed = true;
|
|
10727
10842
|
const leftValue = this.left.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, this);
|
|
10728
|
-
if (leftValue ===
|
|
10843
|
+
if (typeof leftValue === 'symbol') {
|
|
10729
10844
|
return null;
|
|
10730
10845
|
}
|
|
10731
10846
|
else {
|
|
@@ -10911,21 +11026,32 @@ class NewExpression extends NodeBase {
|
|
|
10911
11026
|
this.deoptimized = false;
|
|
10912
11027
|
}
|
|
10913
11028
|
hasEffects(context) {
|
|
10914
|
-
|
|
10915
|
-
this.
|
|
10916
|
-
|
|
10917
|
-
|
|
10918
|
-
|
|
11029
|
+
try {
|
|
11030
|
+
for (const argument of this.arguments) {
|
|
11031
|
+
if (argument.hasEffects(context))
|
|
11032
|
+
return true;
|
|
11033
|
+
}
|
|
11034
|
+
if (this.context.options.treeshake.annotations &&
|
|
11035
|
+
this.annotations)
|
|
11036
|
+
return false;
|
|
11037
|
+
return (this.callee.hasEffects(context) ||
|
|
11038
|
+
this.callee.hasEffectsWhenCalledAtPath(EMPTY_PATH, this.callOptions, context));
|
|
11039
|
+
}
|
|
11040
|
+
finally {
|
|
11041
|
+
if (!this.deoptimized)
|
|
11042
|
+
this.applyDeoptimizations();
|
|
10919
11043
|
}
|
|
10920
|
-
if (this.context.options.treeshake.annotations &&
|
|
10921
|
-
this.annotations)
|
|
10922
|
-
return false;
|
|
10923
|
-
return (this.callee.hasEffects(context) ||
|
|
10924
|
-
this.callee.hasEffectsWhenCalledAtPath(EMPTY_PATH, this.callOptions, context));
|
|
10925
11044
|
}
|
|
10926
11045
|
hasEffectsWhenAccessedAtPath(path) {
|
|
10927
11046
|
return path.length > 0;
|
|
10928
11047
|
}
|
|
11048
|
+
include(context, includeChildrenRecursively) {
|
|
11049
|
+
if (!this.deoptimized)
|
|
11050
|
+
this.applyDeoptimizations();
|
|
11051
|
+
this.included = true;
|
|
11052
|
+
this.callee.include(context, includeChildrenRecursively);
|
|
11053
|
+
this.callee.includeArgumentsWhenCalledAtPath(EMPTY_PATH, context, this.arguments);
|
|
11054
|
+
}
|
|
10929
11055
|
initialise() {
|
|
10930
11056
|
this.callOptions = {
|
|
10931
11057
|
args: this.arguments,
|
|
@@ -10972,6 +11098,9 @@ class ObjectExpression extends NodeBase {
|
|
|
10972
11098
|
hasEffectsWhenCalledAtPath(path, callOptions, context) {
|
|
10973
11099
|
return this.getObjectEntity().hasEffectsWhenCalledAtPath(path, callOptions, context);
|
|
10974
11100
|
}
|
|
11101
|
+
includeArgumentsWhenCalledAtPath(path, context, args) {
|
|
11102
|
+
this.getObjectEntity().includeArgumentsWhenCalledAtPath(path, context, args);
|
|
11103
|
+
}
|
|
10975
11104
|
render(code, options, { renderedSurroundingElement } = BLANK) {
|
|
10976
11105
|
super.render(code, options);
|
|
10977
11106
|
if (renderedSurroundingElement === ExpressionStatement$1 ||
|
|
@@ -10994,7 +11123,7 @@ class ObjectExpression extends NodeBase {
|
|
|
10994
11123
|
let key;
|
|
10995
11124
|
if (property.computed) {
|
|
10996
11125
|
const keyValue = property.key.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, this);
|
|
10997
|
-
if (keyValue ===
|
|
11126
|
+
if (typeof keyValue === 'symbol') {
|
|
10998
11127
|
properties.push({ key: UnknownKey, kind: property.kind, property });
|
|
10999
11128
|
continue;
|
|
11000
11129
|
}
|
|
@@ -11115,8 +11244,8 @@ class PropertyDefinition extends NodeBase {
|
|
|
11115
11244
|
: UNKNOWN_EXPRESSION;
|
|
11116
11245
|
}
|
|
11117
11246
|
hasEffects(context) {
|
|
11118
|
-
|
|
11119
|
-
|
|
11247
|
+
var _a;
|
|
11248
|
+
return this.key.hasEffects(context) || (this.static && ((_a = this.value) === null || _a === void 0 ? void 0 : _a.hasEffects(context)));
|
|
11120
11249
|
}
|
|
11121
11250
|
hasEffectsWhenAccessedAtPath(path, context) {
|
|
11122
11251
|
return !this.value || this.value.hasEffectsWhenAccessedAtPath(path, context);
|
|
@@ -11127,21 +11256,24 @@ class PropertyDefinition extends NodeBase {
|
|
|
11127
11256
|
hasEffectsWhenCalledAtPath(path, callOptions, context) {
|
|
11128
11257
|
return !this.value || this.value.hasEffectsWhenCalledAtPath(path, callOptions, context);
|
|
11129
11258
|
}
|
|
11259
|
+
includeArgumentsWhenCalledAtPath(path, context, args) {
|
|
11260
|
+
var _a;
|
|
11261
|
+
(_a = this.value) === null || _a === void 0 ? void 0 : _a.includeArgumentsWhenCalledAtPath(path, context, args);
|
|
11262
|
+
}
|
|
11130
11263
|
}
|
|
11131
11264
|
|
|
11132
11265
|
class ReturnStatement extends NodeBase {
|
|
11133
11266
|
hasEffects(context) {
|
|
11134
|
-
|
|
11135
|
-
|
|
11267
|
+
var _a;
|
|
11268
|
+
if (!context.ignore.returnYield || ((_a = this.argument) === null || _a === void 0 ? void 0 : _a.hasEffects(context)))
|
|
11136
11269
|
return true;
|
|
11137
11270
|
context.brokenFlow = BROKEN_FLOW_ERROR_RETURN_LABEL;
|
|
11138
11271
|
return false;
|
|
11139
11272
|
}
|
|
11140
11273
|
include(context, includeChildrenRecursively) {
|
|
11274
|
+
var _a;
|
|
11141
11275
|
this.included = true;
|
|
11142
|
-
|
|
11143
|
-
this.argument.include(context, includeChildrenRecursively);
|
|
11144
|
-
}
|
|
11276
|
+
(_a = this.argument) === null || _a === void 0 ? void 0 : _a.include(context, includeChildrenRecursively);
|
|
11145
11277
|
context.brokenFlow = BROKEN_FLOW_ERROR_RETURN_LABEL;
|
|
11146
11278
|
}
|
|
11147
11279
|
initialise() {
|
|
@@ -11261,6 +11393,9 @@ class Super extends NodeBase {
|
|
|
11261
11393
|
deoptimizePath(path) {
|
|
11262
11394
|
this.variable.deoptimizePath(path);
|
|
11263
11395
|
}
|
|
11396
|
+
deoptimizeThisOnEventAtPath(event, path, thisParameter, recursionTracker) {
|
|
11397
|
+
this.variable.deoptimizeThisOnEventAtPath(event, path, thisParameter, recursionTracker);
|
|
11398
|
+
}
|
|
11264
11399
|
include() {
|
|
11265
11400
|
if (!this.included) {
|
|
11266
11401
|
this.included = true;
|
|
@@ -11271,7 +11406,8 @@ class Super extends NodeBase {
|
|
|
11271
11406
|
|
|
11272
11407
|
class SwitchCase extends NodeBase {
|
|
11273
11408
|
hasEffects(context) {
|
|
11274
|
-
|
|
11409
|
+
var _a;
|
|
11410
|
+
if ((_a = this.test) === null || _a === void 0 ? void 0 : _a.hasEffects(context))
|
|
11275
11411
|
return true;
|
|
11276
11412
|
for (const node of this.consequent) {
|
|
11277
11413
|
if (context.brokenFlow)
|
|
@@ -11282,9 +11418,9 @@ class SwitchCase extends NodeBase {
|
|
|
11282
11418
|
return false;
|
|
11283
11419
|
}
|
|
11284
11420
|
include(context, includeChildrenRecursively) {
|
|
11421
|
+
var _a;
|
|
11285
11422
|
this.included = true;
|
|
11286
|
-
|
|
11287
|
-
this.test.include(context, includeChildrenRecursively);
|
|
11423
|
+
(_a = this.test) === null || _a === void 0 ? void 0 : _a.include(context, includeChildrenRecursively);
|
|
11288
11424
|
for (const node of this.consequent) {
|
|
11289
11425
|
if (includeChildrenRecursively || node.shouldBeIncluded(context))
|
|
11290
11426
|
node.include(context, includeChildrenRecursively);
|
|
@@ -11377,7 +11513,7 @@ class SwitchStatement extends NodeBase {
|
|
|
11377
11513
|
}
|
|
11378
11514
|
}
|
|
11379
11515
|
|
|
11380
|
-
class TaggedTemplateExpression extends
|
|
11516
|
+
class TaggedTemplateExpression extends CallExpressionBase {
|
|
11381
11517
|
bind() {
|
|
11382
11518
|
super.bind();
|
|
11383
11519
|
if (this.tag.type === Identifier$1) {
|
|
@@ -11392,13 +11528,35 @@ class TaggedTemplateExpression extends NodeBase {
|
|
|
11392
11528
|
}
|
|
11393
11529
|
}
|
|
11394
11530
|
hasEffects(context) {
|
|
11395
|
-
|
|
11396
|
-
|
|
11531
|
+
try {
|
|
11532
|
+
for (const argument of this.quasi.expressions) {
|
|
11533
|
+
if (argument.hasEffects(context))
|
|
11534
|
+
return true;
|
|
11535
|
+
}
|
|
11536
|
+
return (this.tag.hasEffects(context) ||
|
|
11537
|
+
this.tag.hasEffectsWhenCalledAtPath(EMPTY_PATH, this.callOptions, context));
|
|
11538
|
+
}
|
|
11539
|
+
finally {
|
|
11540
|
+
if (!this.deoptimized)
|
|
11541
|
+
this.applyDeoptimizations();
|
|
11542
|
+
}
|
|
11543
|
+
}
|
|
11544
|
+
include(context, includeChildrenRecursively) {
|
|
11545
|
+
if (!this.deoptimized)
|
|
11546
|
+
this.applyDeoptimizations();
|
|
11547
|
+
this.included = true;
|
|
11548
|
+
this.tag.include(context, includeChildrenRecursively);
|
|
11549
|
+
this.quasi.include(context, includeChildrenRecursively);
|
|
11550
|
+
this.tag.includeArgumentsWhenCalledAtPath(EMPTY_PATH, context, this.callOptions.args);
|
|
11551
|
+
const returnExpression = this.getReturnExpression();
|
|
11552
|
+
if (!returnExpression.included) {
|
|
11553
|
+
returnExpression.include(context, false);
|
|
11554
|
+
}
|
|
11397
11555
|
}
|
|
11398
11556
|
initialise() {
|
|
11399
11557
|
this.callOptions = {
|
|
11400
|
-
args:
|
|
11401
|
-
thisParam: null,
|
|
11558
|
+
args: [UNKNOWN_EXPRESSION, ...this.quasi.expressions],
|
|
11559
|
+
thisParam: this.tag instanceof MemberExpression && !this.tag.variable ? this.tag.object : null,
|
|
11402
11560
|
withNew: false
|
|
11403
11561
|
};
|
|
11404
11562
|
}
|
|
@@ -11406,6 +11564,25 @@ class TaggedTemplateExpression extends NodeBase {
|
|
|
11406
11564
|
this.tag.render(code, options, { isCalleeOfRenderedParent: true });
|
|
11407
11565
|
this.quasi.render(code, options);
|
|
11408
11566
|
}
|
|
11567
|
+
applyDeoptimizations() {
|
|
11568
|
+
this.deoptimized = true;
|
|
11569
|
+
const { thisParam } = this.callOptions;
|
|
11570
|
+
if (thisParam) {
|
|
11571
|
+
this.tag.deoptimizeThisOnEventAtPath(EVENT_CALLED, EMPTY_PATH, thisParam, SHARED_RECURSION_TRACKER);
|
|
11572
|
+
}
|
|
11573
|
+
for (const argument of this.quasi.expressions) {
|
|
11574
|
+
// This will make sure all properties of parameters behave as "unknown"
|
|
11575
|
+
argument.deoptimizePath(UNKNOWN_PATH);
|
|
11576
|
+
}
|
|
11577
|
+
this.context.requestTreeshakingPass();
|
|
11578
|
+
}
|
|
11579
|
+
getReturnExpression(recursionTracker = SHARED_RECURSION_TRACKER) {
|
|
11580
|
+
if (this.returnExpression === null) {
|
|
11581
|
+
this.returnExpression = UNKNOWN_EXPRESSION;
|
|
11582
|
+
return (this.returnExpression = this.tag.getReturnExpressionWhenCalledAtPath(EMPTY_PATH, this.callOptions, recursionTracker, this));
|
|
11583
|
+
}
|
|
11584
|
+
return this.returnExpression;
|
|
11585
|
+
}
|
|
11409
11586
|
}
|
|
11410
11587
|
|
|
11411
11588
|
class TemplateElement extends NodeBase {
|
|
@@ -11617,13 +11794,15 @@ class TryStatement extends NodeBase {
|
|
|
11617
11794
|
this.includedLabelsAfterBlock = null;
|
|
11618
11795
|
}
|
|
11619
11796
|
hasEffects(context) {
|
|
11797
|
+
var _a;
|
|
11620
11798
|
return ((this.context.options.treeshake.tryCatchDeoptimization
|
|
11621
11799
|
? this.block.body.length > 0
|
|
11622
11800
|
: this.block.hasEffects(context)) ||
|
|
11623
|
-
(this.finalizer
|
|
11801
|
+
((_a = this.finalizer) === null || _a === void 0 ? void 0 : _a.hasEffects(context)) ||
|
|
11802
|
+
false);
|
|
11624
11803
|
}
|
|
11625
11804
|
include(context, includeChildrenRecursively) {
|
|
11626
|
-
var _a;
|
|
11805
|
+
var _a, _b;
|
|
11627
11806
|
const tryCatchDeoptimization = (_a = this.context.options.treeshake) === null || _a === void 0 ? void 0 : _a.tryCatchDeoptimization;
|
|
11628
11807
|
const { brokenFlow } = context;
|
|
11629
11808
|
if (!this.directlyIncluded || !tryCatchDeoptimization) {
|
|
@@ -11644,9 +11823,7 @@ class TryStatement extends NodeBase {
|
|
|
11644
11823
|
this.handler.include(context, includeChildrenRecursively);
|
|
11645
11824
|
context.brokenFlow = brokenFlow;
|
|
11646
11825
|
}
|
|
11647
|
-
|
|
11648
|
-
this.finalizer.include(context, includeChildrenRecursively);
|
|
11649
|
-
}
|
|
11826
|
+
(_b = this.finalizer) === null || _b === void 0 ? void 0 : _b.include(context, includeChildrenRecursively);
|
|
11650
11827
|
}
|
|
11651
11828
|
}
|
|
11652
11829
|
|
|
@@ -11668,7 +11845,7 @@ class UnaryExpression extends NodeBase {
|
|
|
11668
11845
|
if (path.length > 0)
|
|
11669
11846
|
return UnknownValue;
|
|
11670
11847
|
const argumentValue = this.argument.getLiteralValueAtPath(EMPTY_PATH, recursionTracker, origin);
|
|
11671
|
-
if (argumentValue ===
|
|
11848
|
+
if (typeof argumentValue === 'symbol')
|
|
11672
11849
|
return UnknownValue;
|
|
11673
11850
|
return unaryOperators[this.operator](argumentValue);
|
|
11674
11851
|
}
|
|
@@ -11782,18 +11959,12 @@ class VariableDeclaration extends NodeBase {
|
|
|
11782
11959
|
hasEffectsWhenAssignedAtPath() {
|
|
11783
11960
|
return false;
|
|
11784
11961
|
}
|
|
11785
|
-
include(context, includeChildrenRecursively) {
|
|
11962
|
+
include(context, includeChildrenRecursively, { asSingleStatement } = BLANK) {
|
|
11786
11963
|
this.included = true;
|
|
11787
11964
|
for (const declarator of this.declarations) {
|
|
11788
11965
|
if (includeChildrenRecursively || declarator.shouldBeIncluded(context))
|
|
11789
11966
|
declarator.include(context, includeChildrenRecursively);
|
|
11790
|
-
|
|
11791
|
-
}
|
|
11792
|
-
includeAsSingleStatement(context, includeChildrenRecursively) {
|
|
11793
|
-
this.included = true;
|
|
11794
|
-
for (const declarator of this.declarations) {
|
|
11795
|
-
if (includeChildrenRecursively || declarator.shouldBeIncluded(context)) {
|
|
11796
|
-
declarator.include(context, includeChildrenRecursively);
|
|
11967
|
+
if (asSingleStatement) {
|
|
11797
11968
|
declarator.id.include(context, includeChildrenRecursively);
|
|
11798
11969
|
}
|
|
11799
11970
|
}
|
|
@@ -11941,15 +12112,15 @@ class VariableDeclarator extends NodeBase {
|
|
|
11941
12112
|
this.id.deoptimizePath(path);
|
|
11942
12113
|
}
|
|
11943
12114
|
hasEffects(context) {
|
|
11944
|
-
|
|
12115
|
+
var _a;
|
|
12116
|
+
const initEffect = (_a = this.init) === null || _a === void 0 ? void 0 : _a.hasEffects(context);
|
|
11945
12117
|
this.id.markDeclarationReached();
|
|
11946
12118
|
return initEffect || this.id.hasEffects(context);
|
|
11947
12119
|
}
|
|
11948
12120
|
include(context, includeChildrenRecursively) {
|
|
12121
|
+
var _a;
|
|
11949
12122
|
this.included = true;
|
|
11950
|
-
|
|
11951
|
-
this.init.include(context, includeChildrenRecursively);
|
|
11952
|
-
}
|
|
12123
|
+
(_a = this.init) === null || _a === void 0 ? void 0 : _a.include(context, includeChildrenRecursively);
|
|
11953
12124
|
this.id.markDeclarationReached();
|
|
11954
12125
|
if (includeChildrenRecursively || this.id.shouldBeIncluded(context)) {
|
|
11955
12126
|
this.id.include(context, includeChildrenRecursively);
|
|
@@ -11993,7 +12164,7 @@ class WhileStatement extends NodeBase {
|
|
|
11993
12164
|
this.included = true;
|
|
11994
12165
|
this.test.include(context, includeChildrenRecursively);
|
|
11995
12166
|
const { brokenFlow } = context;
|
|
11996
|
-
this.body.
|
|
12167
|
+
this.body.include(context, includeChildrenRecursively, { asSingleStatement: true });
|
|
11997
12168
|
context.brokenFlow = brokenFlow;
|
|
11998
12169
|
}
|
|
11999
12170
|
}
|
|
@@ -12004,9 +12175,10 @@ class YieldExpression extends NodeBase {
|
|
|
12004
12175
|
this.deoptimized = false;
|
|
12005
12176
|
}
|
|
12006
12177
|
hasEffects(context) {
|
|
12178
|
+
var _a;
|
|
12007
12179
|
if (!this.deoptimized)
|
|
12008
12180
|
this.applyDeoptimizations();
|
|
12009
|
-
return
|
|
12181
|
+
return !context.ignore.returnYield || ((_a = this.argument) === null || _a === void 0 ? void 0 : _a.hasEffects(context));
|
|
12010
12182
|
}
|
|
12011
12183
|
render(code, options) {
|
|
12012
12184
|
if (this.argument) {
|
|
@@ -12016,14 +12188,6 @@ class YieldExpression extends NodeBase {
|
|
|
12016
12188
|
}
|
|
12017
12189
|
}
|
|
12018
12190
|
}
|
|
12019
|
-
applyDeoptimizations() {
|
|
12020
|
-
this.deoptimized = true;
|
|
12021
|
-
const { argument } = this;
|
|
12022
|
-
if (argument) {
|
|
12023
|
-
argument.deoptimizePath(UNKNOWN_PATH);
|
|
12024
|
-
this.context.requestTreeshakingPass();
|
|
12025
|
-
}
|
|
12026
|
-
}
|
|
12027
12191
|
}
|
|
12028
12192
|
|
|
12029
12193
|
const nodeConstructors = {
|
|
@@ -12452,8 +12616,8 @@ class Module {
|
|
|
12452
12616
|
this.importMetas = [];
|
|
12453
12617
|
this.importedFromNotTreeshaken = false;
|
|
12454
12618
|
this.importers = [];
|
|
12455
|
-
this.imports = new Set();
|
|
12456
12619
|
this.includedDynamicImporters = [];
|
|
12620
|
+
this.includedImports = new Set();
|
|
12457
12621
|
this.isExecuted = false;
|
|
12458
12622
|
this.isUserDefinedEntryPoint = false;
|
|
12459
12623
|
this.needsExportShim = false;
|
|
@@ -12582,7 +12746,7 @@ class Module {
|
|
|
12582
12746
|
this.relevantDependencies = new Set();
|
|
12583
12747
|
const necessaryDependencies = new Set();
|
|
12584
12748
|
const alwaysCheckedDependencies = new Set();
|
|
12585
|
-
const dependencyVariables = new Set(this.
|
|
12749
|
+
const dependencyVariables = new Set(this.includedImports);
|
|
12586
12750
|
if (this.info.isEntry ||
|
|
12587
12751
|
this.includedDynamicImporters.length > 0 ||
|
|
12588
12752
|
this.namespace.included ||
|
|
@@ -13160,13 +13324,13 @@ class Module {
|
|
|
13160
13324
|
if (module instanceof ExternalModule) {
|
|
13161
13325
|
const [externalVariable] = module.getVariableForExportName('*');
|
|
13162
13326
|
externalVariable.include();
|
|
13163
|
-
this.
|
|
13327
|
+
this.includedImports.add(externalVariable);
|
|
13164
13328
|
externalNamespaces.add(externalVariable);
|
|
13165
13329
|
}
|
|
13166
13330
|
else if (module.info.syntheticNamedExports) {
|
|
13167
13331
|
const syntheticNamespace = module.getSyntheticNamespace();
|
|
13168
13332
|
syntheticNamespace.include();
|
|
13169
|
-
this.
|
|
13333
|
+
this.includedImports.add(syntheticNamespace);
|
|
13170
13334
|
syntheticNamespaces.add(syntheticNamespace);
|
|
13171
13335
|
}
|
|
13172
13336
|
}
|
|
@@ -13203,7 +13367,7 @@ class Module {
|
|
|
13203
13367
|
this.includeVariable(variable);
|
|
13204
13368
|
const variableModule = variable.module;
|
|
13205
13369
|
if (variableModule && variableModule !== this) {
|
|
13206
|
-
this.
|
|
13370
|
+
this.includedImports.add(variable);
|
|
13207
13371
|
}
|
|
13208
13372
|
}
|
|
13209
13373
|
shimMissingExport(name) {
|
|
@@ -14535,6 +14699,7 @@ class Chunk {
|
|
|
14535
14699
|
this.implicitEntryModules = [];
|
|
14536
14700
|
this.implicitlyLoadedBefore = new Set();
|
|
14537
14701
|
this.imports = new Set();
|
|
14702
|
+
this.includedReexportsByModule = new Map();
|
|
14538
14703
|
this.indentString = undefined;
|
|
14539
14704
|
// This may only be updated in the constructor
|
|
14540
14705
|
this.isEmpty = true;
|
|
@@ -14706,6 +14871,9 @@ class Chunk {
|
|
|
14706
14871
|
this.exports.add(module.namespace);
|
|
14707
14872
|
}
|
|
14708
14873
|
}
|
|
14874
|
+
if (!this.outputOptions.preserveModules) {
|
|
14875
|
+
this.addNecessaryImportsForFacades();
|
|
14876
|
+
}
|
|
14709
14877
|
return facades;
|
|
14710
14878
|
}
|
|
14711
14879
|
generateId(addons, options, existingNames, includeHash) {
|
|
@@ -15048,6 +15216,15 @@ class Chunk {
|
|
|
15048
15216
|
}
|
|
15049
15217
|
}
|
|
15050
15218
|
}
|
|
15219
|
+
addNecessaryImportsForFacades() {
|
|
15220
|
+
for (const [module, variables] of this.includedReexportsByModule) {
|
|
15221
|
+
if (this.includedNamespaces.has(module)) {
|
|
15222
|
+
for (const variable of variables) {
|
|
15223
|
+
this.imports.add(variable);
|
|
15224
|
+
}
|
|
15225
|
+
}
|
|
15226
|
+
}
|
|
15227
|
+
}
|
|
15051
15228
|
assignFacadeName({ fileName, name }, facadedModule) {
|
|
15052
15229
|
if (fileName) {
|
|
15053
15230
|
this.fileName = fileName;
|
|
@@ -15095,6 +15272,7 @@ class Chunk {
|
|
|
15095
15272
|
return hash.digest('hex').substr(0, 8);
|
|
15096
15273
|
}
|
|
15097
15274
|
ensureReexportsAreAvailableForModule(module) {
|
|
15275
|
+
const includedReexports = [];
|
|
15098
15276
|
const map = module.getExportNamesByVariable();
|
|
15099
15277
|
for (const exportedVariable of map.keys()) {
|
|
15100
15278
|
const isSynthetic = exportedVariable instanceof SyntheticNamedExportVariable;
|
|
@@ -15108,6 +15286,7 @@ class Chunk {
|
|
|
15108
15286
|
const chunk = this.chunkByModule.get(exportingModule);
|
|
15109
15287
|
if (chunk && chunk !== this) {
|
|
15110
15288
|
chunk.exports.add(importedVariable);
|
|
15289
|
+
includedReexports.push(importedVariable);
|
|
15111
15290
|
if (isSynthetic) {
|
|
15112
15291
|
this.imports.add(importedVariable);
|
|
15113
15292
|
}
|
|
@@ -15115,6 +15294,9 @@ class Chunk {
|
|
|
15115
15294
|
}
|
|
15116
15295
|
}
|
|
15117
15296
|
}
|
|
15297
|
+
if (includedReexports.length) {
|
|
15298
|
+
this.includedReexportsByModule.set(module, includedReexports);
|
|
15299
|
+
}
|
|
15118
15300
|
}
|
|
15119
15301
|
finaliseDynamicImports(options, snippets) {
|
|
15120
15302
|
const stripKnownJsExtensions = options.format === 'amd';
|
|
@@ -15470,7 +15652,7 @@ class Chunk {
|
|
|
15470
15652
|
deconflictChunk(this.orderedModules, this.getDependenciesToBeDeconflicted(format !== 'es' && format !== 'system', format === 'amd' || format === 'umd' || format === 'iife', interop), this.imports, usedNames, format, interop, this.outputOptions.preserveModules, this.outputOptions.externalLiveBindings, this.chunkByModule, syntheticExports, this.exportNamesByVariable, this.accessedGlobalsByScope, this.includedNamespaces);
|
|
15471
15653
|
}
|
|
15472
15654
|
setUpChunkImportsAndExportsForModule(module) {
|
|
15473
|
-
const moduleImports = new Set(module.
|
|
15655
|
+
const moduleImports = new Set(module.includedImports);
|
|
15474
15656
|
// when we are not preserving modules, we need to make all namespace variables available for
|
|
15475
15657
|
// rendering the namespace object
|
|
15476
15658
|
if (!this.outputOptions.preserveModules) {
|
|
@@ -23137,6 +23319,12 @@ function formatAction([pluginName, hookName, args]) {
|
|
|
23137
23319
|
}
|
|
23138
23320
|
return action;
|
|
23139
23321
|
}
|
|
23322
|
+
// We do not directly listen on process to avoid max listeners warnings for
|
|
23323
|
+
// complicated build processes
|
|
23324
|
+
const beforeExitEvent = 'beforeExit';
|
|
23325
|
+
const beforeExitEmitter = new require$$0$2.EventEmitter();
|
|
23326
|
+
beforeExitEmitter.setMaxListeners(0);
|
|
23327
|
+
process$1.on(beforeExitEvent, () => beforeExitEmitter.emit(beforeExitEvent));
|
|
23140
23328
|
async function catchUnfinishedHookActions(pluginDriver, callback) {
|
|
23141
23329
|
let handleEmptyEventLoop;
|
|
23142
23330
|
const emptyEventLoopPromise = new Promise((_, reject) => {
|
|
@@ -23145,10 +23333,10 @@ async function catchUnfinishedHookActions(pluginDriver, callback) {
|
|
|
23145
23333
|
reject(new Error(`Unexpected early exit. This happens when Promises returned by plugins cannot resolve. Unfinished hook action(s) on exit:\n` +
|
|
23146
23334
|
[...unfulfilledActions].map(formatAction).join('\n')));
|
|
23147
23335
|
};
|
|
23148
|
-
|
|
23336
|
+
beforeExitEmitter.once(beforeExitEvent, handleEmptyEventLoop);
|
|
23149
23337
|
});
|
|
23150
23338
|
const result = await Promise.race([callback(), emptyEventLoopPromise]);
|
|
23151
|
-
|
|
23339
|
+
beforeExitEmitter.off(beforeExitEvent, handleEmptyEventLoop);
|
|
23152
23340
|
return result;
|
|
23153
23341
|
}
|
|
23154
23342
|
|