@putout/babel 4.1.0 → 4.2.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/README.md +1 -1
- package/bundle/index.js +408 -559
- package/package.json +8 -8
package/bundle/index.js
CHANGED
|
@@ -4,13 +4,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __knownSymbol = (name, symbol) => symbol = Symbol[name] ? symbol : Symbol.for('Symbol.' + name);
|
|
8
|
-
|
|
9
|
-
var __typeError = (msg) => {
|
|
10
|
-
throw TypeError(msg);
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
var __pow = Math.pow;
|
|
14
7
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
|
|
15
8
|
enumerable: true,
|
|
16
9
|
configurable: true,
|
|
@@ -58,49 +51,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, '__esModule', {
|
|
|
58
51
|
}), mod);
|
|
59
52
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== 'symbol' ? key + '' : key, value);
|
|
60
53
|
|
|
61
|
-
var __await = function(promise, isYieldStar) {
|
|
62
|
-
this[0] = promise;
|
|
63
|
-
this[1] = isYieldStar;
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
var __yieldStar = (value) => {
|
|
67
|
-
var obj = value[__knownSymbol('asyncIterator')], isAwait = false, method, it = {};
|
|
68
|
-
|
|
69
|
-
if (obj == null) {
|
|
70
|
-
obj = value[__knownSymbol('iterator')]();
|
|
71
|
-
method = (k) => it[k] = (x) => obj[k](x);
|
|
72
|
-
} else {
|
|
73
|
-
obj = obj.call(value);
|
|
74
|
-
method = (k) => it[k] = (v) => {
|
|
75
|
-
if (isAwait) {
|
|
76
|
-
isAwait = false;
|
|
77
|
-
|
|
78
|
-
if (k === 'throw')
|
|
79
|
-
throw v;
|
|
80
|
-
|
|
81
|
-
return v;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
isAwait = true;
|
|
85
|
-
return {
|
|
86
|
-
done: false,
|
|
87
|
-
value: new __await(new Promise((resolve3) => {
|
|
88
|
-
var x = obj[k](v);
|
|
89
|
-
|
|
90
|
-
if (!(x instanceof Object))
|
|
91
|
-
__typeError('Object expected');
|
|
92
|
-
|
|
93
|
-
resolve3(x);
|
|
94
|
-
}), 1),
|
|
95
|
-
};
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
return (it[__knownSymbol('iterator')] = () => it, method('next'), 'throw' in obj ? method('throw') : it.throw = (x) => {
|
|
100
|
-
throw x;
|
|
101
|
-
}, 'return' in obj && method('return'), it);
|
|
102
|
-
};
|
|
103
|
-
|
|
104
54
|
// node_modules/picocolors/picocolors.js
|
|
105
55
|
var require_picocolors = __commonJS({
|
|
106
56
|
'node_modules/picocolors/picocolors.js'(exports2, module2) {
|
|
@@ -1533,16 +1483,14 @@ typeof window !== 'undefined'
|
|
|
1533
1483
|
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
|
1534
1484
|
typeof navigator !== 'undefined'
|
|
1535
1485
|
&& navigator.userAgent
|
|
1536
|
-
&& (m = navigator
|
|
1537
|
-
.userAgent
|
|
1486
|
+
&& (m = navigator.userAgent
|
|
1538
1487
|
.toLowerCase()
|
|
1539
1488
|
.match(/firefox\/(\d+)/))
|
|
1540
1489
|
&& parseInt(m[1], 10) >= 31
|
|
1541
1490
|
|| // Double check webkit in userAgent just in case we are in a worker
|
|
1542
1491
|
typeof navigator !== 'undefined'
|
|
1543
1492
|
&& navigator.userAgent
|
|
1544
|
-
&& navigator
|
|
1545
|
-
.userAgent
|
|
1493
|
+
&& navigator.userAgent
|
|
1546
1494
|
.toLowerCase()
|
|
1547
1495
|
.match(/applewebkit\/(\d+)/);
|
|
1548
1496
|
}
|
|
@@ -8012,7 +7960,6 @@ function isLVal(node, opts) {
|
|
|
8012
7960
|
case 'MemberExpression':
|
|
8013
7961
|
case 'ArrayPattern':
|
|
8014
7962
|
case 'ObjectPattern':
|
|
8015
|
-
case 'OptionalMemberExpression':
|
|
8016
7963
|
case 'TSAsExpression':
|
|
8017
7964
|
case 'TSSatisfiesExpression':
|
|
8018
7965
|
case 'TSTypeAssertion':
|
|
@@ -8832,8 +8779,6 @@ function isMemberExpressionLike(node) {
|
|
|
8832
8779
|
}
|
|
8833
8780
|
|
|
8834
8781
|
function matchesPattern(member, match, allowPartial) {
|
|
8835
|
-
var _a;
|
|
8836
|
-
|
|
8837
8782
|
if (!isMemberExpressionLike(member))
|
|
8838
8783
|
return false;
|
|
8839
8784
|
|
|
@@ -8841,7 +8786,7 @@ function matchesPattern(member, match, allowPartial) {
|
|
|
8841
8786
|
const nodes2 = [];
|
|
8842
8787
|
let node;
|
|
8843
8788
|
|
|
8844
|
-
for (node = member; isMemberExpressionLike(node); node =
|
|
8789
|
+
for (node = member; isMemberExpressionLike(node); node = node.object ?? node.meta) {
|
|
8845
8790
|
nodes2.push(node.property);
|
|
8846
8791
|
}
|
|
8847
8792
|
|
|
@@ -8903,7 +8848,7 @@ function isType(nodeType, targetType) {
|
|
|
8903
8848
|
|
|
8904
8849
|
const aliases = FLIPPED_ALIAS_KEYS[targetType];
|
|
8905
8850
|
|
|
8906
|
-
if (aliases
|
|
8851
|
+
if (aliases?.includes(nodeType))
|
|
8907
8852
|
return true;
|
|
8908
8853
|
|
|
8909
8854
|
return false;
|
|
@@ -8915,7 +8860,7 @@ function isPlaceholderType(placeholderType, targetType) {
|
|
|
8915
8860
|
|
|
8916
8861
|
const aliases = PLACEHOLDERS_ALIAS[placeholderType];
|
|
8917
8862
|
|
|
8918
|
-
if (aliases
|
|
8863
|
+
if (aliases?.includes(targetType))
|
|
8919
8864
|
return true;
|
|
8920
8865
|
|
|
8921
8866
|
return false;
|
|
@@ -9156,7 +9101,7 @@ function assertNodeType(...types2) {
|
|
|
9156
9101
|
set: expandedTypes,
|
|
9157
9102
|
});
|
|
9158
9103
|
function validate4(node, key, val) {
|
|
9159
|
-
const valType = val
|
|
9104
|
+
const valType = val?.type;
|
|
9160
9105
|
|
|
9161
9106
|
if (valType != null) {
|
|
9162
9107
|
if (expandedTypes.has(valType)) {
|
|
@@ -9193,7 +9138,7 @@ function assertNodeOrValueType(...types2) {
|
|
|
9193
9138
|
}
|
|
9194
9139
|
}
|
|
9195
9140
|
|
|
9196
|
-
throw new TypeError(`Property ${key} of ${node.type} expected node to be of a type ${JSON.stringify(types2)} but instead got ${JSON.stringify(val
|
|
9141
|
+
throw new TypeError(`Property ${key} of ${node.type} expected node to be of a type ${JSON.stringify(types2)} but instead got ${JSON.stringify(val?.type)}`);
|
|
9197
9142
|
}
|
|
9198
9143
|
|
|
9199
9144
|
validate4.oneOfNodeOrValueTypes = types2;
|
|
@@ -9271,7 +9216,7 @@ function assertOptionalChainStart() {
|
|
|
9271
9216
|
break;
|
|
9272
9217
|
}
|
|
9273
9218
|
|
|
9274
|
-
throw new TypeError(`Non-optional ${node.type} must chain from an optional OptionalMemberExpression or OptionalCallExpression. Found chain from ${current
|
|
9219
|
+
throw new TypeError(`Non-optional ${node.type} must chain from an optional OptionalMemberExpression or OptionalCallExpression. Found chain from ${current?.type}`);
|
|
9275
9220
|
}
|
|
9276
9221
|
|
|
9277
9222
|
return validate4;
|
|
@@ -9312,14 +9257,13 @@ var store = {};
|
|
|
9312
9257
|
|
|
9313
9258
|
function defineAliasedType(...aliases) {
|
|
9314
9259
|
return (type, opts = {}) => {
|
|
9315
|
-
var _a;
|
|
9316
9260
|
let defined = opts.aliases;
|
|
9317
9261
|
|
|
9318
9262
|
if (!defined) {
|
|
9319
9263
|
if (opts.inherits)
|
|
9320
|
-
defined =
|
|
9264
|
+
defined = store[opts.inherits].aliases?.slice();
|
|
9321
9265
|
|
|
9322
|
-
defined
|
|
9266
|
+
defined ?? (defined = []);
|
|
9323
9267
|
opts.aliases = defined;
|
|
9324
9268
|
}
|
|
9325
9269
|
|
|
@@ -9462,7 +9406,7 @@ defineType$4('ArrayExpression', {
|
|
|
9462
9406
|
defineType$4('AssignmentExpression', {
|
|
9463
9407
|
fields: {
|
|
9464
9408
|
operator: {
|
|
9465
|
-
validate: Object.assign(function() {
|
|
9409
|
+
validate: Object.assign((function() {
|
|
9466
9410
|
const identifier4 = assertOneOf(...ASSIGNMENT_OPERATORS);
|
|
9467
9411
|
const pattern = assertOneOf('=');
|
|
9468
9412
|
|
|
@@ -9470,7 +9414,7 @@ defineType$4('AssignmentExpression', {
|
|
|
9470
9414
|
const validator = is('Pattern', node.left) ? pattern : identifier4;
|
|
9471
9415
|
validator(node, key, val);
|
|
9472
9416
|
};
|
|
9473
|
-
}(), {
|
|
9417
|
+
})(), {
|
|
9474
9418
|
oneOf: ASSIGNMENT_OPERATORS,
|
|
9475
9419
|
}),
|
|
9476
9420
|
},
|
|
@@ -9500,7 +9444,7 @@ defineType$4('BinaryExpression', {
|
|
|
9500
9444
|
validate: assertOneOf(...BINARY_OPERATORS),
|
|
9501
9445
|
},
|
|
9502
9446
|
left: {
|
|
9503
|
-
validate: function() {
|
|
9447
|
+
validate: (function() {
|
|
9504
9448
|
const expression2 = assertNodeType('Expression');
|
|
9505
9449
|
const inOp = assertNodeType('Expression', 'PrivateName');
|
|
9506
9450
|
const validator = Object.assign(function(node, key, val) {
|
|
@@ -9511,7 +9455,7 @@ defineType$4('BinaryExpression', {
|
|
|
9511
9455
|
});
|
|
9512
9456
|
|
|
9513
9457
|
return validator;
|
|
9514
|
-
}(),
|
|
9458
|
+
})(),
|
|
9515
9459
|
},
|
|
9516
9460
|
right: {
|
|
9517
9461
|
validate: assertNodeType('Expression'),
|
|
@@ -9821,7 +9765,7 @@ defineType$4('FunctionDeclaration', {
|
|
|
9821
9765
|
'Pureish',
|
|
9822
9766
|
'Declaration',
|
|
9823
9767
|
],
|
|
9824
|
-
validate: function() {
|
|
9768
|
+
validate: (function() {
|
|
9825
9769
|
const identifier4 = assertNodeType('Identifier');
|
|
9826
9770
|
|
|
9827
9771
|
return function(parent, key, node) {
|
|
@@ -9829,7 +9773,7 @@ defineType$4('FunctionDeclaration', {
|
|
|
9829
9773
|
identifier4(node, 'id', node.id);
|
|
9830
9774
|
}
|
|
9831
9775
|
};
|
|
9832
|
-
}(),
|
|
9776
|
+
})(),
|
|
9833
9777
|
});
|
|
9834
9778
|
defineType$4('FunctionExpression', {
|
|
9835
9779
|
inherits: 'FunctionDeclaration',
|
|
@@ -10044,7 +9988,7 @@ defineType$4('RegExpLiteral', {
|
|
|
10044
9988
|
},
|
|
10045
9989
|
flags: {
|
|
10046
9990
|
validate: chain(assertValueType('string'), Object.assign(function(node, key, val) {
|
|
10047
|
-
const invalid = /[^
|
|
9991
|
+
const invalid = /[^dgimsuvy]/.exec(val);
|
|
10048
9992
|
|
|
10049
9993
|
if (invalid) {
|
|
10050
9994
|
throw new TypeError(`"${invalid[0]}" is not a valid RegExp flag`);
|
|
@@ -10094,7 +10038,7 @@ defineType$4('MemberExpression', {
|
|
|
10094
10038
|
validate: assertNodeType('Expression', 'Super'),
|
|
10095
10039
|
},
|
|
10096
10040
|
property: {
|
|
10097
|
-
validate: function() {
|
|
10041
|
+
validate: (function() {
|
|
10098
10042
|
const normal = assertNodeType('Identifier', 'PrivateName');
|
|
10099
10043
|
const computed = assertNodeType('Expression');
|
|
10100
10044
|
const validator = function(node, key, val) {
|
|
@@ -10108,7 +10052,7 @@ defineType$4('MemberExpression', {
|
|
|
10108
10052
|
'PrivateName',
|
|
10109
10053
|
];
|
|
10110
10054
|
return validator;
|
|
10111
|
-
}(),
|
|
10055
|
+
})(),
|
|
10112
10056
|
},
|
|
10113
10057
|
computed: {
|
|
10114
10058
|
default: false,
|
|
@@ -10181,7 +10125,7 @@ defineType$4('ObjectMethod', {
|
|
|
10181
10125
|
default: false,
|
|
10182
10126
|
},
|
|
10183
10127
|
key: {
|
|
10184
|
-
validate: function() {
|
|
10128
|
+
validate: (function() {
|
|
10185
10129
|
const normal = assertNodeType('Identifier', 'StringLiteral', 'NumericLiteral', 'BigIntLiteral');
|
|
10186
10130
|
const computed = assertNodeType('Expression');
|
|
10187
10131
|
const validator = function(node, key, val) {
|
|
@@ -10197,7 +10141,7 @@ defineType$4('ObjectMethod', {
|
|
|
10197
10141
|
'BigIntLiteral',
|
|
10198
10142
|
];
|
|
10199
10143
|
return validator;
|
|
10200
|
-
}(),
|
|
10144
|
+
})(),
|
|
10201
10145
|
},
|
|
10202
10146
|
decorators: {
|
|
10203
10147
|
validate: arrayOfType('Decorator'),
|
|
@@ -10230,7 +10174,7 @@ defineType$4('ObjectProperty', {
|
|
|
10230
10174
|
default: false,
|
|
10231
10175
|
},
|
|
10232
10176
|
key: {
|
|
10233
|
-
validate: function() {
|
|
10177
|
+
validate: (function() {
|
|
10234
10178
|
const normal = assertNodeType('Identifier', 'StringLiteral', 'NumericLiteral', 'BigIntLiteral', 'PrivateName');
|
|
10235
10179
|
const computed = assertNodeType('Expression');
|
|
10236
10180
|
const validator = Object.assign(function(node, key, val) {
|
|
@@ -10248,7 +10192,7 @@ defineType$4('ObjectProperty', {
|
|
|
10248
10192
|
});
|
|
10249
10193
|
|
|
10250
10194
|
return validator;
|
|
10251
|
-
}(),
|
|
10195
|
+
})(),
|
|
10252
10196
|
},
|
|
10253
10197
|
value: {
|
|
10254
10198
|
validate: assertNodeType('Expression', 'PatternLike'),
|
|
@@ -10285,7 +10229,7 @@ defineType$4('ObjectProperty', {
|
|
|
10285
10229
|
'Property',
|
|
10286
10230
|
'ObjectMember',
|
|
10287
10231
|
],
|
|
10288
|
-
validate: function() {
|
|
10232
|
+
validate: (function() {
|
|
10289
10233
|
const pattern = assertNodeType('Identifier', 'Pattern', 'TSAsExpression', 'TSSatisfiesExpression', 'TSNonNullExpression', 'TSTypeAssertion');
|
|
10290
10234
|
const expression2 = assertNodeType('Expression');
|
|
10291
10235
|
|
|
@@ -10293,7 +10237,7 @@ defineType$4('ObjectProperty', {
|
|
|
10293
10237
|
const validator = is('ObjectPattern', parent) ? pattern : expression2;
|
|
10294
10238
|
validator(node, 'value', node.value);
|
|
10295
10239
|
};
|
|
10296
|
-
}(),
|
|
10240
|
+
})(),
|
|
10297
10241
|
});
|
|
10298
10242
|
defineType$4('RestElement', {
|
|
10299
10243
|
visitor: ['argument', 'typeAnnotation'],
|
|
@@ -10732,7 +10676,7 @@ defineType$4('ClassDeclaration', {
|
|
|
10732
10676
|
optional: true,
|
|
10733
10677
|
},
|
|
10734
10678
|
},
|
|
10735
|
-
validate: function() {
|
|
10679
|
+
validate: (function() {
|
|
10736
10680
|
const identifier4 = assertNodeType('Identifier');
|
|
10737
10681
|
|
|
10738
10682
|
return function(parent, key, node) {
|
|
@@ -10740,7 +10684,7 @@ defineType$4('ClassDeclaration', {
|
|
|
10740
10684
|
identifier4(node, 'id', node.id);
|
|
10741
10685
|
}
|
|
10742
10686
|
};
|
|
10743
|
-
}(),
|
|
10687
|
+
})(),
|
|
10744
10688
|
});
|
|
10745
10689
|
var importAttributes = {
|
|
10746
10690
|
attributes: {
|
|
@@ -10823,7 +10767,7 @@ defineType$4('ExportNamedDeclaration', {
|
|
|
10823
10767
|
}, importAttributes, {
|
|
10824
10768
|
specifiers: {
|
|
10825
10769
|
default: [],
|
|
10826
|
-
validate: arrayOf(function() {
|
|
10770
|
+
validate: arrayOf((function() {
|
|
10827
10771
|
const sourced = assertNodeType('ExportSpecifier', 'ExportDefaultSpecifier', 'ExportNamespaceSpecifier');
|
|
10828
10772
|
const sourceless = assertNodeType('ExportSpecifier');
|
|
10829
10773
|
|
|
@@ -10837,7 +10781,7 @@ defineType$4('ExportNamedDeclaration', {
|
|
|
10837
10781
|
'ExportNamespaceSpecifier',
|
|
10838
10782
|
],
|
|
10839
10783
|
});
|
|
10840
|
-
}()),
|
|
10784
|
+
})()),
|
|
10841
10785
|
},
|
|
10842
10786
|
source: {
|
|
10843
10787
|
validate: assertNodeType('StringLiteral'),
|
|
@@ -10884,7 +10828,7 @@ defineType$4('ForOfStatement', {
|
|
|
10884
10828
|
],
|
|
10885
10829
|
fields: {
|
|
10886
10830
|
left: {
|
|
10887
|
-
validate: function() {
|
|
10831
|
+
validate: (function() {
|
|
10888
10832
|
const declaration = assertNodeType('VariableDeclaration');
|
|
10889
10833
|
const lval = assertNodeType('Identifier', 'MemberExpression', 'ArrayPattern', 'ObjectPattern', 'TSAsExpression', 'TSSatisfiesExpression', 'TSTypeAssertion', 'TSNonNullExpression');
|
|
10890
10834
|
|
|
@@ -10907,7 +10851,7 @@ defineType$4('ForOfStatement', {
|
|
|
10907
10851
|
'TSNonNullExpression',
|
|
10908
10852
|
],
|
|
10909
10853
|
});
|
|
10910
|
-
}(),
|
|
10854
|
+
})(),
|
|
10911
10855
|
},
|
|
10912
10856
|
right: {
|
|
10913
10857
|
validate: assertNodeType('Expression'),
|
|
@@ -11060,7 +11004,7 @@ var classMethodOrPropertyCommon = () => ({
|
|
|
11060
11004
|
optional: true,
|
|
11061
11005
|
},
|
|
11062
11006
|
key: {
|
|
11063
|
-
validate: chain(function() {
|
|
11007
|
+
validate: chain((function() {
|
|
11064
11008
|
const normal = assertNodeType('Identifier', 'StringLiteral', 'NumericLiteral', 'BigIntLiteral');
|
|
11065
11009
|
const computed = assertNodeType('Expression');
|
|
11066
11010
|
|
|
@@ -11068,7 +11012,7 @@ var classMethodOrPropertyCommon = () => ({
|
|
|
11068
11012
|
const validator = node.computed ? computed : normal;
|
|
11069
11013
|
validator(node, key, val);
|
|
11070
11014
|
};
|
|
11071
|
-
}(), assertNodeType('Identifier', 'StringLiteral', 'NumericLiteral', 'BigIntLiteral', 'Expression')),
|
|
11015
|
+
})(), assertNodeType('Identifier', 'StringLiteral', 'NumericLiteral', 'BigIntLiteral', 'Expression')),
|
|
11072
11016
|
},
|
|
11073
11017
|
});
|
|
11074
11018
|
|
|
@@ -11294,13 +11238,13 @@ defineType$4('OptionalMemberExpression', {
|
|
|
11294
11238
|
'optional',
|
|
11295
11239
|
],
|
|
11296
11240
|
visitor: ['object', 'property'],
|
|
11297
|
-
aliases: ['Expression'
|
|
11241
|
+
aliases: ['Expression'],
|
|
11298
11242
|
fields: {
|
|
11299
11243
|
object: {
|
|
11300
11244
|
validate: assertNodeType('Expression'),
|
|
11301
11245
|
},
|
|
11302
11246
|
property: {
|
|
11303
|
-
validate: function() {
|
|
11247
|
+
validate: (function() {
|
|
11304
11248
|
const normal = assertNodeType('Identifier');
|
|
11305
11249
|
const computed = assertNodeType('Expression');
|
|
11306
11250
|
const validator = Object.assign(function(node, key, val) {
|
|
@@ -11311,7 +11255,7 @@ defineType$4('OptionalMemberExpression', {
|
|
|
11311
11255
|
});
|
|
11312
11256
|
|
|
11313
11257
|
return validator;
|
|
11314
|
-
}(),
|
|
11258
|
+
})(),
|
|
11315
11259
|
},
|
|
11316
11260
|
computed: {
|
|
11317
11261
|
default: false,
|
|
@@ -11413,7 +11357,7 @@ defineType$4('ClassAccessorProperty', {
|
|
|
11413
11357
|
aliases: ['Property', 'Accessor'],
|
|
11414
11358
|
fields: Object.assign({}, classMethodOrPropertyCommon(), {
|
|
11415
11359
|
key: {
|
|
11416
|
-
validate: chain(function() {
|
|
11360
|
+
validate: chain((function() {
|
|
11417
11361
|
const normal = assertNodeType('Identifier', 'StringLiteral', 'NumericLiteral', 'BigIntLiteral', 'PrivateName');
|
|
11418
11362
|
const computed = assertNodeType('Expression');
|
|
11419
11363
|
|
|
@@ -11421,7 +11365,7 @@ defineType$4('ClassAccessorProperty', {
|
|
|
11421
11365
|
const validator = node.computed ? computed : normal;
|
|
11422
11366
|
validator(node, key, val);
|
|
11423
11367
|
};
|
|
11424
|
-
}(), assertNodeType('Identifier', 'StringLiteral', 'NumericLiteral', 'BigIntLiteral', 'Expression', 'PrivateName')),
|
|
11368
|
+
})(), assertNodeType('Identifier', 'StringLiteral', 'NumericLiteral', 'BigIntLiteral', 'Expression', 'PrivateName')),
|
|
11425
11369
|
},
|
|
11426
11370
|
value: {
|
|
11427
11371
|
validate: assertNodeType('Expression'),
|
|
@@ -12378,7 +12322,7 @@ var PLACEHOLDERS_ALIAS = {
|
|
|
12378
12322
|
for (const type of PLACEHOLDERS) {
|
|
12379
12323
|
const alias2 = ALIAS_KEYS[type];
|
|
12380
12324
|
|
|
12381
|
-
if (alias2
|
|
12325
|
+
if (alias2?.length)
|
|
12382
12326
|
PLACEHOLDERS_ALIAS[type] = alias2;
|
|
12383
12327
|
}
|
|
12384
12328
|
|
|
@@ -12827,6 +12771,7 @@ defineType('TSTypeOperator', {
|
|
|
12827
12771
|
fields: {
|
|
12828
12772
|
operator: {
|
|
12829
12773
|
validate: assertOneOf('keyof', 'readonly', 'unique'),
|
|
12774
|
+
default: void 0,
|
|
12830
12775
|
},
|
|
12831
12776
|
typeAnnotation: validateType('TSType'),
|
|
12832
12777
|
},
|
|
@@ -12883,7 +12828,7 @@ defineType('TSLiteralType', {
|
|
|
12883
12828
|
visitor: ['literal'],
|
|
12884
12829
|
fields: {
|
|
12885
12830
|
literal: {
|
|
12886
|
-
validate: function() {
|
|
12831
|
+
validate: (function() {
|
|
12887
12832
|
const unaryExpression3 = assertNodeType('NumericLiteral', 'BigIntLiteral');
|
|
12888
12833
|
const unaryOperator = assertOneOf('-');
|
|
12889
12834
|
const literal = assertNodeType('NumericLiteral', 'StringLiteral', 'BooleanLiteral', 'BigIntLiteral', 'TemplateLiteral');
|
|
@@ -12906,7 +12851,7 @@ defineType('TSLiteralType', {
|
|
|
12906
12851
|
'UnaryExpression',
|
|
12907
12852
|
];
|
|
12908
12853
|
return validator;
|
|
12909
|
-
}(),
|
|
12854
|
+
})(),
|
|
12910
12855
|
},
|
|
12911
12856
|
},
|
|
12912
12857
|
});
|
|
@@ -13210,9 +13155,7 @@ function validate$1(node, key, val) {
|
|
|
13210
13155
|
}
|
|
13211
13156
|
|
|
13212
13157
|
function validateInternal(field, node, key, val, maybeNode) {
|
|
13213
|
-
|
|
13214
|
-
|
|
13215
|
-
if (!(field == null ? void 0 : field.validate))
|
|
13158
|
+
if (!field?.validate)
|
|
13216
13159
|
return;
|
|
13217
13160
|
|
|
13218
13161
|
if (field.optional && val == null)
|
|
@@ -13226,12 +13169,12 @@ function validateInternal(field, node, key, val, maybeNode) {
|
|
|
13226
13169
|
if (type == null)
|
|
13227
13170
|
return;
|
|
13228
13171
|
|
|
13229
|
-
|
|
13172
|
+
NODE_PARENT_VALIDATIONS[type]?.(node, key, val);
|
|
13230
13173
|
}
|
|
13231
13174
|
}
|
|
13232
13175
|
|
|
13233
13176
|
function validateField(node, key, val, field) {
|
|
13234
|
-
if (!
|
|
13177
|
+
if (!field?.validate)
|
|
13235
13178
|
return;
|
|
13236
13179
|
|
|
13237
13180
|
if (field.optional && val == null)
|
|
@@ -13241,13 +13184,12 @@ function validateField(node, key, val, field) {
|
|
|
13241
13184
|
}
|
|
13242
13185
|
|
|
13243
13186
|
function validateChild(node, key, val) {
|
|
13244
|
-
|
|
13245
|
-
const type = val == null ? void 0 : val.type;
|
|
13187
|
+
const type = val?.type;
|
|
13246
13188
|
|
|
13247
13189
|
if (type == null)
|
|
13248
13190
|
return;
|
|
13249
13191
|
|
|
13250
|
-
|
|
13192
|
+
NODE_PARENT_VALIDATIONS[type]?.(node, key, val);
|
|
13251
13193
|
}
|
|
13252
13194
|
|
|
13253
13195
|
var _validate = /* @__PURE__ */Object.freeze({
|
|
@@ -16933,10 +16875,8 @@ function isNode(node) {
|
|
|
16933
16875
|
}
|
|
16934
16876
|
|
|
16935
16877
|
function assertNode(node) {
|
|
16936
|
-
var _a;
|
|
16937
|
-
|
|
16938
16878
|
if (!isNode(node)) {
|
|
16939
|
-
const type =
|
|
16879
|
+
const type = node?.type ?? JSON.stringify(node);
|
|
16940
16880
|
throw new TypeError(`Not a valid node of type "${type}"`);
|
|
16941
16881
|
}
|
|
16942
16882
|
}
|
|
@@ -19195,8 +19135,7 @@ function getNameFromLiteralId(id) {
|
|
|
19195
19135
|
}
|
|
19196
19136
|
|
|
19197
19137
|
if (isTemplateLiteral(id)) {
|
|
19198
|
-
return id
|
|
19199
|
-
.quasis
|
|
19138
|
+
return id.quasis
|
|
19200
19139
|
.map((quasi) => quasi.value.raw)
|
|
19201
19140
|
.join('');
|
|
19202
19141
|
}
|
|
@@ -19402,7 +19341,7 @@ function isNodesEquivalent(a, b2) {
|
|
|
19402
19341
|
continue;
|
|
19403
19342
|
}
|
|
19404
19343
|
|
|
19405
|
-
if (typeof val_a === 'object' && !
|
|
19344
|
+
if (typeof val_a === 'object' && !visitorKeys?.includes(field)) {
|
|
19406
19345
|
for (const key of Object.keys(val_a)) {
|
|
19407
19346
|
if (val_a[key] !== val_b[key]) {
|
|
19408
19347
|
return false;
|
|
@@ -19501,7 +19440,7 @@ function isReferenced(node, parent, grandparent) {
|
|
|
19501
19440
|
return false;
|
|
19502
19441
|
|
|
19503
19442
|
case 'ExportSpecifier':
|
|
19504
|
-
if (grandparent
|
|
19443
|
+
if (grandparent?.source) {
|
|
19505
19444
|
return false;
|
|
19506
19445
|
}
|
|
19507
19446
|
|
|
@@ -19918,12 +19857,11 @@ function toParseErrorConstructor({toMessage, code: code2, reasonCode, syntaxPlug
|
|
|
19918
19857
|
}
|
|
19919
19858
|
|
|
19920
19859
|
defineHidden(error, 'clone', function clone2(overrides = {}) {
|
|
19921
|
-
var _a;
|
|
19922
19860
|
const {
|
|
19923
19861
|
line,
|
|
19924
19862
|
column,
|
|
19925
19863
|
index: index2,
|
|
19926
|
-
} =
|
|
19864
|
+
} = overrides.loc ?? loc;
|
|
19927
19865
|
|
|
19928
19866
|
return constructor(new Position(line, column, index2), Object.assign({}, details, overrides.details));
|
|
19929
19867
|
});
|
|
@@ -20099,7 +20037,7 @@ var estree = (superClass) => class ESTreeParserMixin extends superClass {
|
|
|
20099
20037
|
|
|
20100
20038
|
try {
|
|
20101
20039
|
bigInt = BigInt(value);
|
|
20102
|
-
} catch
|
|
20040
|
+
} catch {
|
|
20103
20041
|
bigInt = null;
|
|
20104
20042
|
}
|
|
20105
20043
|
|
|
@@ -20201,11 +20139,10 @@ var estree = (superClass) => class ESTreeParserMixin extends superClass {
|
|
|
20201
20139
|
}
|
|
20202
20140
|
|
|
20203
20141
|
isValidDirective(stmt) {
|
|
20204
|
-
var _a;
|
|
20205
20142
|
return stmt.type === 'ExpressionStatement'
|
|
20206
20143
|
&& stmt.expression.type === 'Literal'
|
|
20207
20144
|
&& typeof stmt.expression.value === 'string'
|
|
20208
|
-
&& !
|
|
20145
|
+
&& !stmt.expression.extra?.parenthesized;
|
|
20209
20146
|
}
|
|
20210
20147
|
|
|
20211
20148
|
parseBlockBody(node, allowDirectives, topLevel, end, afterBlockParse) {
|
|
@@ -20391,14 +20328,12 @@ var estree = (superClass) => class ESTreeParserMixin extends superClass {
|
|
|
20391
20328
|
}
|
|
20392
20329
|
|
|
20393
20330
|
finishCallExpression(unfinished, optional) {
|
|
20394
|
-
var _a, _b;
|
|
20395
20331
|
const node = super.finishCallExpression(unfinished, optional);
|
|
20396
20332
|
|
|
20397
20333
|
if (node.callee.type === 'Import') {
|
|
20398
20334
|
this.castNodeTo(node, 'ImportExpression');
|
|
20399
20335
|
node.source = node.arguments[0];
|
|
20400
|
-
node.options =
|
|
20401
|
-
node.attributes = (_b = node.arguments[1]) != null ? _b : null;
|
|
20336
|
+
node.options = node.arguments[1] ?? null;
|
|
20402
20337
|
delete node.arguments;
|
|
20403
20338
|
delete node.callee;
|
|
20404
20339
|
} else if (node.type === 'OptionalCallExpression') {
|
|
@@ -20419,7 +20354,6 @@ var estree = (superClass) => class ESTreeParserMixin extends superClass {
|
|
|
20419
20354
|
}
|
|
20420
20355
|
|
|
20421
20356
|
parseExport(unfinished, decorators) {
|
|
20422
|
-
var _a;
|
|
20423
20357
|
const exportStartLoc = this.state.lastTokStartLoc;
|
|
20424
20358
|
const node = super.parseExport(unfinished, decorators);
|
|
20425
20359
|
|
|
@@ -20438,7 +20372,7 @@ var estree = (superClass) => class ESTreeParserMixin extends superClass {
|
|
|
20438
20372
|
case 'ExportDefaultDeclaration': {
|
|
20439
20373
|
const {declaration} = node;
|
|
20440
20374
|
|
|
20441
|
-
if (
|
|
20375
|
+
if (declaration?.type === 'ClassDeclaration' && declaration.decorators?.length > 0 && declaration.start === node.start) {
|
|
20442
20376
|
this.resetStartLocation(node, exportStartLoc);
|
|
20443
20377
|
}
|
|
20444
20378
|
}
|
|
@@ -20612,26 +20546,24 @@ var tokenStartsExprs = [];
|
|
|
20612
20546
|
var tokenPrefixes = [];
|
|
20613
20547
|
|
|
20614
20548
|
function createToken(name, options = {}) {
|
|
20615
|
-
var _a, _b, _c, _d;
|
|
20616
20549
|
++tokenTypeCounter;
|
|
20617
20550
|
tokenLabels.push(name);
|
|
20618
|
-
tokenBinops.push(
|
|
20619
|
-
tokenBeforeExprs.push(
|
|
20620
|
-
tokenStartsExprs.push(
|
|
20621
|
-
tokenPrefixes.push(
|
|
20551
|
+
tokenBinops.push(options.binop ?? -1);
|
|
20552
|
+
tokenBeforeExprs.push(options.beforeExpr ?? false);
|
|
20553
|
+
tokenStartsExprs.push(options.startsExpr ?? false);
|
|
20554
|
+
tokenPrefixes.push(options.prefix ?? false);
|
|
20622
20555
|
tokenTypes.push(new ExportedTokenType(name, options));
|
|
20623
20556
|
return tokenTypeCounter;
|
|
20624
20557
|
}
|
|
20625
20558
|
|
|
20626
20559
|
function createKeywordLike(name, options = {}) {
|
|
20627
|
-
var _a, _b, _c, _d;
|
|
20628
20560
|
++tokenTypeCounter;
|
|
20629
20561
|
keywords$1.set(name, tokenTypeCounter);
|
|
20630
20562
|
tokenLabels.push(name);
|
|
20631
|
-
tokenBinops.push(
|
|
20632
|
-
tokenBeforeExprs.push(
|
|
20633
|
-
tokenStartsExprs.push(
|
|
20634
|
-
tokenPrefixes.push(
|
|
20563
|
+
tokenBinops.push(options.binop ?? -1);
|
|
20564
|
+
tokenBeforeExprs.push(options.beforeExpr ?? false);
|
|
20565
|
+
tokenStartsExprs.push(options.startsExpr ?? false);
|
|
20566
|
+
tokenPrefixes.push(options.prefix ?? false);
|
|
20635
20567
|
tokenTypes.push(new ExportedTokenType('name', options));
|
|
20636
20568
|
return tokenTypeCounter;
|
|
20637
20569
|
}
|
|
@@ -22612,7 +22544,8 @@ var flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
22612
22544
|
if (this.flowPragma === void 0) {
|
|
22613
22545
|
const matches = FLOW_PRAGMA_REGEX.exec(comment.value);
|
|
22614
22546
|
|
|
22615
|
-
if (!matches);
|
|
22547
|
+
if (!matches);
|
|
22548
|
+
else if (matches[1] === 'flow') {
|
|
22616
22549
|
this.flowPragma = 'flow';
|
|
22617
22550
|
} else if (matches[1] === 'noflow') {
|
|
22618
22551
|
this.flowPragma = 'noflow';
|
|
@@ -23343,7 +23276,7 @@ var flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
23343
23276
|
}
|
|
23344
23277
|
}
|
|
23345
23278
|
|
|
23346
|
-
const propOrInexact = this.flowParseObjectTypeProperty(node, isStatic2, protoStartLoc, variance2, kind, allowSpread, allowInexact
|
|
23279
|
+
const propOrInexact = this.flowParseObjectTypeProperty(node, isStatic2, protoStartLoc, variance2, kind, allowSpread, allowInexact ?? !exact);
|
|
23347
23280
|
|
|
23348
23281
|
if (propOrInexact === null) {
|
|
23349
23282
|
inexact = true;
|
|
@@ -23477,7 +23410,7 @@ var flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
23477
23410
|
}
|
|
23478
23411
|
|
|
23479
23412
|
flowParseQualifiedTypeIdentifier(startLoc, id) {
|
|
23480
|
-
startLoc
|
|
23413
|
+
startLoc ?? (startLoc = this.state.startLoc);
|
|
23481
23414
|
let node = id || this.flowParseRestrictedIdentifier(true);
|
|
23482
23415
|
|
|
23483
23416
|
while (this.eat(16)) {
|
|
@@ -24150,8 +24083,7 @@ var flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
24150
24083
|
}
|
|
24151
24084
|
|
|
24152
24085
|
finishArrowValidation(node) {
|
|
24153
|
-
|
|
24154
|
-
this.toAssignableList(node.params, (_a = node.extra) == null ? void 0 : _a.trailingCommaLoc, false);
|
|
24086
|
+
this.toAssignableList(node.params, node.extra?.trailingCommaLoc, false);
|
|
24155
24087
|
this.scope.enter(514 | 4);
|
|
24156
24088
|
super.checkParams(node, false, true);
|
|
24157
24089
|
this.scope.exit();
|
|
@@ -24349,7 +24281,7 @@ var flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
24349
24281
|
for (let i = 0; i < exprList.length; i++) {
|
|
24350
24282
|
const expr = exprList[i];
|
|
24351
24283
|
|
|
24352
|
-
if (
|
|
24284
|
+
if (expr?.type === 'TypeCastExpression') {
|
|
24353
24285
|
exprList[i] = this.typeCastToParameter(expr);
|
|
24354
24286
|
}
|
|
24355
24287
|
}
|
|
@@ -24358,12 +24290,10 @@ var flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
24358
24290
|
}
|
|
24359
24291
|
|
|
24360
24292
|
toReferencedList(exprList, isParenthesizedExpr) {
|
|
24361
|
-
var _a;
|
|
24362
|
-
|
|
24363
24293
|
for (let i = 0; i < exprList.length; i++) {
|
|
24364
24294
|
const expr = exprList[i];
|
|
24365
24295
|
|
|
24366
|
-
if (expr && expr.type === 'TypeCastExpression' && !
|
|
24296
|
+
if (expr && expr.type === 'TypeCastExpression' && !expr.extra?.parenthesized && (exprList.length > 1 || !isParenthesizedExpr)) {
|
|
24367
24297
|
this.raise(FlowErrors.TypeCastInPattern, expr.typeAnnotation);
|
|
24368
24298
|
}
|
|
24369
24299
|
}
|
|
@@ -24741,12 +24671,10 @@ var flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
24741
24671
|
}
|
|
24742
24672
|
}
|
|
24743
24673
|
|
|
24744
|
-
if (
|
|
24674
|
+
if (jsx2?.error || this.match(47)) {
|
|
24745
24675
|
state = state || this.state.clone();
|
|
24746
24676
|
let typeParameters;
|
|
24747
24677
|
const arrow = this.tryParse((abort) => {
|
|
24748
|
-
var _a;
|
|
24749
|
-
|
|
24750
24678
|
typeParameters = this.flowParseTypeParameterDeclaration();
|
|
24751
24679
|
const arrowExpression2 = this.forwardNoArrowParamsConversionAt(typeParameters, () => {
|
|
24752
24680
|
const result = super.parseMaybeAssign(refExpressionErrors, afterLeftParse);
|
|
@@ -24754,7 +24682,7 @@ var flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
24754
24682
|
return result;
|
|
24755
24683
|
});
|
|
24756
24684
|
|
|
24757
|
-
if (
|
|
24685
|
+
if (arrowExpression2.extra?.parenthesized)
|
|
24758
24686
|
abort();
|
|
24759
24687
|
|
|
24760
24688
|
const expr = this.maybeUnwrapTypeCastExpression(arrowExpression2);
|
|
@@ -24781,7 +24709,7 @@ var flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
24781
24709
|
arrowExpression = arrow.node;
|
|
24782
24710
|
}
|
|
24783
24711
|
|
|
24784
|
-
if (jsx2
|
|
24712
|
+
if (jsx2?.node) {
|
|
24785
24713
|
this.state = jsx2.failState;
|
|
24786
24714
|
return jsx2.node;
|
|
24787
24715
|
}
|
|
@@ -24791,7 +24719,7 @@ var flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
24791
24719
|
return arrowExpression;
|
|
24792
24720
|
}
|
|
24793
24721
|
|
|
24794
|
-
if (jsx2
|
|
24722
|
+
if (jsx2?.thrown)
|
|
24795
24723
|
throw jsx2.error;
|
|
24796
24724
|
|
|
24797
24725
|
if (arrow.thrown)
|
|
@@ -26065,15 +25993,13 @@ var jsx = (superClass) => class JSXParserMixin extends superClass {
|
|
|
26065
25993
|
}
|
|
26066
25994
|
|
|
26067
25995
|
jsxParseExpressionContainer(node, previousContext) {
|
|
26068
|
-
var _a;
|
|
26069
|
-
|
|
26070
25996
|
if (this.match(8)) {
|
|
26071
25997
|
node.expression = this.jsxParseEmptyExpression();
|
|
26072
25998
|
} else {
|
|
26073
25999
|
const expression2 = this.parseExpression();
|
|
26074
26000
|
|
|
26075
26001
|
{
|
|
26076
|
-
if (expression2.type === 'SequenceExpression' && !
|
|
26002
|
+
if (expression2.type === 'SequenceExpression' && !expression2.extra?.parenthesized) {
|
|
26077
26003
|
this.raise(JsxErrors.UnexpectedSequenceExpression, expression2.expressions[1]);
|
|
26078
26004
|
}
|
|
26079
26005
|
}
|
|
@@ -26524,7 +26450,7 @@ var BaseParser = class {
|
|
|
26524
26450
|
const actualOptions = this.plugins.get(pluginName);
|
|
26525
26451
|
|
|
26526
26452
|
for (const key of Object.keys(pluginOptions)) {
|
|
26527
|
-
if (
|
|
26453
|
+
if (actualOptions?.[key] !== pluginOptions[key]) {
|
|
26528
26454
|
return false;
|
|
26529
26455
|
}
|
|
26530
26456
|
}
|
|
@@ -26534,8 +26460,7 @@ var BaseParser = class {
|
|
|
26534
26460
|
}
|
|
26535
26461
|
|
|
26536
26462
|
getPluginOption(plugin, name) {
|
|
26537
|
-
|
|
26538
|
-
return (_a = this.plugins.get(plugin)) == null ? void 0 : _a[name];
|
|
26463
|
+
return this.plugins.get(plugin)?.[name];
|
|
26539
26464
|
}
|
|
26540
26465
|
};
|
|
26541
26466
|
|
|
@@ -26630,7 +26555,6 @@ var CommentsParser = class extends BaseParser {
|
|
|
26630
26555
|
}
|
|
26631
26556
|
|
|
26632
26557
|
finalizeComment(commentWS) {
|
|
26633
|
-
var _a;
|
|
26634
26558
|
const {comments} = commentWS;
|
|
26635
26559
|
|
|
26636
26560
|
if (commentWS.leadingNode !== null || commentWS.trailingNode !== null) {
|
|
@@ -26658,7 +26582,7 @@ var CommentsParser = class extends BaseParser {
|
|
|
26658
26582
|
break;
|
|
26659
26583
|
|
|
26660
26584
|
case 'ImportExpression':
|
|
26661
|
-
adjustInnerComments(node, [node.source,
|
|
26585
|
+
adjustInnerComments(node, [node.source, node.options ?? null], commentWS);
|
|
26662
26586
|
break;
|
|
26663
26587
|
|
|
26664
26588
|
case 'FunctionDeclaration':
|
|
@@ -27636,7 +27560,7 @@ var Tokenizer = class extends CommentsParser {
|
|
|
27636
27560
|
|
|
27637
27561
|
if (comment !== void 0) {
|
|
27638
27562
|
this.addComment(comment);
|
|
27639
|
-
comments
|
|
27563
|
+
comments?.push(comment);
|
|
27640
27564
|
}
|
|
27641
27565
|
|
|
27642
27566
|
break;
|
|
@@ -27647,7 +27571,7 @@ var Tokenizer = class extends CommentsParser {
|
|
|
27647
27571
|
|
|
27648
27572
|
if (comment !== void 0) {
|
|
27649
27573
|
this.addComment(comment);
|
|
27650
|
-
comments
|
|
27574
|
+
comments?.push(comment);
|
|
27651
27575
|
}
|
|
27652
27576
|
|
|
27653
27577
|
break;
|
|
@@ -27670,7 +27594,7 @@ var Tokenizer = class extends CommentsParser {
|
|
|
27670
27594
|
|
|
27671
27595
|
if (comment !== void 0) {
|
|
27672
27596
|
this.addComment(comment);
|
|
27673
|
-
comments
|
|
27597
|
+
comments?.push(comment);
|
|
27674
27598
|
}
|
|
27675
27599
|
} else {
|
|
27676
27600
|
break loop;
|
|
@@ -27683,7 +27607,7 @@ var Tokenizer = class extends CommentsParser {
|
|
|
27683
27607
|
|
|
27684
27608
|
if (comment !== void 0) {
|
|
27685
27609
|
this.addComment(comment);
|
|
27686
|
-
comments
|
|
27610
|
+
comments?.push(comment);
|
|
27687
27611
|
}
|
|
27688
27612
|
} else {
|
|
27689
27613
|
break loop;
|
|
@@ -27694,7 +27618,7 @@ var Tokenizer = class extends CommentsParser {
|
|
|
27694
27618
|
|
|
27695
27619
|
}
|
|
27696
27620
|
}
|
|
27697
|
-
if (
|
|
27621
|
+
if (comments?.length > 0) {
|
|
27698
27622
|
const end = this.state.pos;
|
|
27699
27623
|
const commentWhitespace = {
|
|
27700
27624
|
start: this.sourceToOffsetPos(spaceStart),
|
|
@@ -29085,10 +29009,10 @@ var Node = class {
|
|
|
29085
29009
|
this.end = 0;
|
|
29086
29010
|
this.loc = new SourceLocation(loc);
|
|
29087
29011
|
|
|
29088
|
-
if (
|
|
29012
|
+
if (parser?.optionFlags & 128)
|
|
29089
29013
|
this.range = [pos, 0];
|
|
29090
29014
|
|
|
29091
|
-
if (parser
|
|
29015
|
+
if (parser?.filename)
|
|
29092
29016
|
this.loc.filename = parser.filename;
|
|
29093
29017
|
}
|
|
29094
29018
|
};
|
|
@@ -29207,10 +29131,9 @@ var unwrapParenthesizedExpression = (node) => {
|
|
|
29207
29131
|
|
|
29208
29132
|
var LValParser = class extends NodeUtils {
|
|
29209
29133
|
toAssignable(node, isLHS = false) {
|
|
29210
|
-
var _a, _b, _c;
|
|
29211
29134
|
let parenthesized = void 0;
|
|
29212
29135
|
|
|
29213
|
-
if (node.type === 'ParenthesizedExpression' ||
|
|
29136
|
+
if (node.type === 'ParenthesizedExpression' || node.extra?.parenthesized) {
|
|
29214
29137
|
parenthesized = unwrapParenthesizedExpression(node);
|
|
29215
29138
|
|
|
29216
29139
|
if (isLHS) {
|
|
@@ -29240,7 +29163,7 @@ var LValParser = class extends NodeUtils {
|
|
|
29240
29163
|
const isLast = i === last2;
|
|
29241
29164
|
this.toAssignableObjectExpressionProp(prop, isLast, isLHS);
|
|
29242
29165
|
|
|
29243
|
-
if (isLast && prop.type === 'RestElement' &&
|
|
29166
|
+
if (isLast && prop.type === 'RestElement' && node.extra?.trailingCommaLoc) {
|
|
29244
29167
|
this.raise(Errors.RestTrailingComma, node.extra.trailingCommaLoc);
|
|
29245
29168
|
}
|
|
29246
29169
|
}
|
|
@@ -29264,7 +29187,7 @@ var LValParser = class extends NodeUtils {
|
|
|
29264
29187
|
|
|
29265
29188
|
case 'ArrayExpression':
|
|
29266
29189
|
this.castNodeTo(node, 'ArrayPattern');
|
|
29267
|
-
this.toAssignableList(node.elements,
|
|
29190
|
+
this.toAssignableList(node.elements, node.extra?.trailingCommaLoc, isLHS);
|
|
29268
29191
|
break;
|
|
29269
29192
|
|
|
29270
29193
|
case 'AssignmentExpression':
|
|
@@ -29391,7 +29314,7 @@ var LValParser = class extends NodeUtils {
|
|
|
29391
29314
|
toReferencedListDeep(exprList, isParenthesizedExpr) {
|
|
29392
29315
|
this.toReferencedList(exprList, isParenthesizedExpr);
|
|
29393
29316
|
for (const expr of exprList) {
|
|
29394
|
-
if (
|
|
29317
|
+
if (expr?.type === 'ArrayExpression') {
|
|
29395
29318
|
this.toReferencedListDeep(expr.elements);
|
|
29396
29319
|
}
|
|
29397
29320
|
}
|
|
@@ -29543,8 +29466,8 @@ var LValParser = class extends NodeUtils {
|
|
|
29543
29466
|
}
|
|
29544
29467
|
|
|
29545
29468
|
parseMaybeDefault(startLoc, left) {
|
|
29546
|
-
startLoc
|
|
29547
|
-
left = left
|
|
29469
|
+
startLoc ?? (startLoc = this.state.startLoc);
|
|
29470
|
+
left = left ?? this.parseBindingAtom();
|
|
29548
29471
|
|
|
29549
29472
|
if (!this.eat(29))
|
|
29550
29473
|
return left;
|
|
@@ -29592,7 +29515,6 @@ var LValParser = class extends NodeUtils {
|
|
|
29592
29515
|
}
|
|
29593
29516
|
|
|
29594
29517
|
checkLVal(expression2, ancestor, binding = 64, checkClashes = false, strictModeChanged = false, hasParenthesizedAncestor = false) {
|
|
29595
|
-
var _a;
|
|
29596
29518
|
const type = expression2.type;
|
|
29597
29519
|
|
|
29598
29520
|
if (this.isObjectMethod(expression2))
|
|
@@ -29635,7 +29557,7 @@ var LValParser = class extends NodeUtils {
|
|
|
29635
29557
|
this.raise(Errors.VoidPatternCatchClauseParam, expression2);
|
|
29636
29558
|
}
|
|
29637
29559
|
|
|
29638
|
-
const validity = this.isValidLVal(type, !(hasParenthesizedAncestor ||
|
|
29560
|
+
const validity = this.isValidLVal(type, !(hasParenthesizedAncestor || expression2.extra?.parenthesized) && ancestor.type === 'AssignmentExpression', binding);
|
|
29639
29561
|
|
|
29640
29562
|
if (validity === true)
|
|
29641
29563
|
return;
|
|
@@ -29860,9 +29782,7 @@ function tsIsVarianceAnnotations(modifier) {
|
|
|
29860
29782
|
}
|
|
29861
29783
|
|
|
29862
29784
|
function tsIsEntityName(node) {
|
|
29863
|
-
|
|
29864
|
-
|
|
29865
|
-
if ((_a = node.extra) == null ? void 0 : _a.parenthesized) {
|
|
29785
|
+
if (node.extra?.parenthesized) {
|
|
29866
29786
|
return false;
|
|
29867
29787
|
}
|
|
29868
29788
|
|
|
@@ -30002,7 +29922,7 @@ var typescript = (superClass) => class TypeScriptParserMixin extends superClass
|
|
|
30002
29922
|
for (;;) {
|
|
30003
29923
|
const {startLoc} = this.state;
|
|
30004
29924
|
|
|
30005
|
-
const modifier = this.tsParseModifier(allowedModifiers.concat(disallowedModifiers
|
|
29925
|
+
const modifier = this.tsParseModifier(allowedModifiers.concat(disallowedModifiers ?? []), stopOnStartOfClassStaticBlock, modified.static);
|
|
30006
29926
|
|
|
30007
29927
|
if (!modifier)
|
|
30008
29928
|
break;
|
|
@@ -30044,7 +29964,7 @@ var typescript = (superClass) => class TypeScriptParserMixin extends superClass
|
|
|
30044
29964
|
modified[modifier] = true;
|
|
30045
29965
|
}
|
|
30046
29966
|
|
|
30047
|
-
if (disallowedModifiers
|
|
29967
|
+
if (disallowedModifiers?.includes(modifier)) {
|
|
30048
29968
|
this.raise(errorTemplate, startLoc, {
|
|
30049
29969
|
modifier,
|
|
30050
29970
|
});
|
|
@@ -30205,6 +30125,7 @@ var typescript = (superClass) => class TypeScriptParserMixin extends superClass
|
|
|
30205
30125
|
node.properties = [
|
|
30206
30126
|
this.finishObjectProperty(withProperty),
|
|
30207
30127
|
];
|
|
30128
|
+
this.eat(12);
|
|
30208
30129
|
this.expect(8);
|
|
30209
30130
|
return this.finishNode(node, 'ObjectExpression');
|
|
30210
30131
|
}
|
|
@@ -31011,7 +30932,7 @@ var typescript = (superClass) => class TypeScriptParserMixin extends superClass
|
|
|
31011
30932
|
try {
|
|
31012
30933
|
this.parseObjectLike(8, true);
|
|
31013
30934
|
return errors.length === previousErrorCount;
|
|
31014
|
-
} catch
|
|
30935
|
+
} catch {
|
|
31015
30936
|
return false;
|
|
31016
30937
|
}
|
|
31017
30938
|
}
|
|
@@ -31025,7 +30946,7 @@ var typescript = (superClass) => class TypeScriptParserMixin extends superClass
|
|
|
31025
30946
|
try {
|
|
31026
30947
|
super.parseBindingList(3, 93, 1);
|
|
31027
30948
|
return errors.length === previousErrorCount;
|
|
31028
|
-
} catch
|
|
30949
|
+
} catch {
|
|
31029
30950
|
return false;
|
|
31030
30951
|
}
|
|
31031
30952
|
}
|
|
@@ -31865,7 +31786,7 @@ var typescript = (superClass) => class TypeScriptParserMixin extends superClass
|
|
|
31865
31786
|
|
|
31866
31787
|
tsCheckForInvalidTypeCasts(items) {
|
|
31867
31788
|
items.forEach((node) => {
|
|
31868
|
-
if (
|
|
31789
|
+
if (node?.type === 'TSTypeCastExpression') {
|
|
31869
31790
|
this.raise(TSErrors.UnexpectedTypeAnnotation, node.typeAnnotation);
|
|
31870
31791
|
}
|
|
31871
31792
|
});
|
|
@@ -31916,6 +31837,7 @@ var typescript = (superClass) => class TypeScriptParserMixin extends superClass
|
|
|
31916
31837
|
const asyncArrowFn = this.tsTryParseGenericAsyncArrowFunction(startLoc);
|
|
31917
31838
|
|
|
31918
31839
|
if (asyncArrowFn) {
|
|
31840
|
+
state.stop = true;
|
|
31919
31841
|
return asyncArrowFn;
|
|
31920
31842
|
}
|
|
31921
31843
|
}
|
|
@@ -31995,11 +31917,10 @@ var typescript = (superClass) => class TypeScriptParserMixin extends superClass
|
|
|
31995
31917
|
}
|
|
31996
31918
|
|
|
31997
31919
|
parseNewCallee(node) {
|
|
31998
|
-
var _a;
|
|
31999
31920
|
super.parseNewCallee(node);
|
|
32000
31921
|
const {callee} = node;
|
|
32001
31922
|
|
|
32002
|
-
if (callee.type === 'TSInstantiationExpression' && !
|
|
31923
|
+
if (callee.type === 'TSInstantiationExpression' && !callee.extra?.parenthesized) {
|
|
32003
31924
|
{
|
|
32004
31925
|
node.typeArguments = callee.typeArguments;
|
|
32005
31926
|
}
|
|
@@ -32595,7 +32516,7 @@ var typescript = (superClass) => class TypeScriptParserMixin extends superClass
|
|
|
32595
32516
|
}
|
|
32596
32517
|
}
|
|
32597
32518
|
|
|
32598
|
-
if (!
|
|
32519
|
+
if (!jsx2?.error && !this.match(47)) {
|
|
32599
32520
|
return super.parseMaybeAssign(refExpressionErrors, afterLeftParse);
|
|
32600
32521
|
}
|
|
32601
32522
|
|
|
@@ -32605,22 +32526,20 @@ var typescript = (superClass) => class TypeScriptParserMixin extends superClass
|
|
|
32605
32526
|
let typeParameters;
|
|
32606
32527
|
|
|
32607
32528
|
const arrow = this.tryParse((abort) => {
|
|
32608
|
-
var _a, _b;
|
|
32609
|
-
|
|
32610
32529
|
typeParameters = this.tsParseTypeParameters(this.tsParseConstModifier);
|
|
32611
32530
|
const expr = super.parseMaybeAssign(refExpressionErrors, afterLeftParse);
|
|
32612
32531
|
|
|
32613
|
-
if (expr.type !== 'ArrowFunctionExpression' ||
|
|
32532
|
+
if (expr.type !== 'ArrowFunctionExpression' || expr.extra?.parenthesized) {
|
|
32614
32533
|
abort();
|
|
32615
32534
|
}
|
|
32616
32535
|
|
|
32617
|
-
if (
|
|
32536
|
+
if (typeParameters?.params.length !== 0) {
|
|
32618
32537
|
this.resetStartLocationFromNode(expr, typeParameters);
|
|
32619
32538
|
}
|
|
32620
32539
|
|
|
32621
32540
|
expr.typeParameters = typeParameters;
|
|
32622
32541
|
{
|
|
32623
|
-
if (this.hasPlugin('jsx') && expr.typeParameters.params.length === 1 && !
|
|
32542
|
+
if (this.hasPlugin('jsx') && expr.typeParameters.params.length === 1 && !expr.typeParameters.extra?.trailingComma) {
|
|
32624
32543
|
const parameter = expr.typeParameters.params[0];
|
|
32625
32544
|
|
|
32626
32545
|
if (!parameter.constraint) {
|
|
@@ -32649,7 +32568,7 @@ var typescript = (superClass) => class TypeScriptParserMixin extends superClass
|
|
|
32649
32568
|
return typeCast.node;
|
|
32650
32569
|
}
|
|
32651
32570
|
|
|
32652
|
-
if (jsx2
|
|
32571
|
+
if (jsx2?.node) {
|
|
32653
32572
|
this.state = jsx2.failState;
|
|
32654
32573
|
return jsx2.node;
|
|
32655
32574
|
}
|
|
@@ -32663,18 +32582,16 @@ var typescript = (superClass) => class TypeScriptParserMixin extends superClass
|
|
|
32663
32582
|
return arrow.node;
|
|
32664
32583
|
}
|
|
32665
32584
|
|
|
32666
|
-
if (typeCast
|
|
32585
|
+
if (typeCast?.node) {
|
|
32667
32586
|
this.state = typeCast.failState;
|
|
32668
32587
|
return typeCast.node;
|
|
32669
32588
|
}
|
|
32670
32589
|
|
|
32671
|
-
throw
|
|
32590
|
+
throw jsx2?.error || arrow.error || typeCast?.error;
|
|
32672
32591
|
}
|
|
32673
32592
|
|
|
32674
32593
|
reportReservedArrowTypeParam(node) {
|
|
32675
|
-
|
|
32676
|
-
|
|
32677
|
-
if (node.params.length === 1 && !node.params[0].constraint && !((_a = node.extra) == null ? void 0 : _a.trailingComma) && this.getPluginOption('typescript', 'disallowAmbiguousJSXLike')) {
|
|
32594
|
+
if (node.params.length === 1 && !node.params[0].constraint && !node.extra?.trailingComma && this.getPluginOption('typescript', 'disallowAmbiguousJSXLike')) {
|
|
32678
32595
|
this.raise(TSErrors.ReservedArrowTypeParam, node);
|
|
32679
32596
|
}
|
|
32680
32597
|
}
|
|
@@ -33158,57 +33075,9 @@ var typescript = (superClass) => class TypeScriptParserMixin extends superClass
|
|
|
33158
33075
|
}
|
|
33159
33076
|
|
|
33160
33077
|
fillOptionalPropertiesForTSESLint(node) {
|
|
33161
|
-
var _a,
|
|
33162
|
-
_b,
|
|
33163
|
-
_c,
|
|
33164
|
-
_d,
|
|
33165
|
-
_e,
|
|
33166
|
-
_f,
|
|
33167
|
-
_g,
|
|
33168
|
-
_h,
|
|
33169
|
-
_i,
|
|
33170
|
-
_j,
|
|
33171
|
-
_k,
|
|
33172
|
-
_l,
|
|
33173
|
-
_m,
|
|
33174
|
-
_n,
|
|
33175
|
-
_o,
|
|
33176
|
-
_p,
|
|
33177
|
-
_q,
|
|
33178
|
-
_r,
|
|
33179
|
-
_s,
|
|
33180
|
-
_t,
|
|
33181
|
-
_u,
|
|
33182
|
-
_v,
|
|
33183
|
-
_w,
|
|
33184
|
-
_x,
|
|
33185
|
-
_y,
|
|
33186
|
-
_z,
|
|
33187
|
-
_A,
|
|
33188
|
-
_B,
|
|
33189
|
-
_C,
|
|
33190
|
-
_D,
|
|
33191
|
-
_E,
|
|
33192
|
-
_F,
|
|
33193
|
-
_G,
|
|
33194
|
-
_H,
|
|
33195
|
-
_I,
|
|
33196
|
-
_J,
|
|
33197
|
-
_K,
|
|
33198
|
-
_L,
|
|
33199
|
-
_M,
|
|
33200
|
-
_N,
|
|
33201
|
-
_O,
|
|
33202
|
-
_P,
|
|
33203
|
-
_Q,
|
|
33204
|
-
_R,
|
|
33205
|
-
_S,
|
|
33206
|
-
_T,
|
|
33207
|
-
_U;
|
|
33208
|
-
|
|
33209
33078
|
switch(node.type) {
|
|
33210
33079
|
case 'ExpressionStatement':
|
|
33211
|
-
|
|
33080
|
+
node.directive ?? (node.directive = void 0);
|
|
33212
33081
|
return;
|
|
33213
33082
|
|
|
33214
33083
|
case 'RestElement':
|
|
@@ -33218,17 +33087,17 @@ var typescript = (superClass) => class TypeScriptParserMixin extends superClass
|
|
|
33218
33087
|
case 'ArrayPattern':
|
|
33219
33088
|
case 'AssignmentPattern':
|
|
33220
33089
|
case 'ObjectPattern':
|
|
33221
|
-
|
|
33222
|
-
|
|
33223
|
-
|
|
33090
|
+
node.decorators ?? (node.decorators = []);
|
|
33091
|
+
node.optional ?? (node.optional = false);
|
|
33092
|
+
node.typeAnnotation ?? (node.typeAnnotation = void 0);
|
|
33224
33093
|
return;
|
|
33225
33094
|
|
|
33226
33095
|
case 'TSParameterProperty':
|
|
33227
|
-
|
|
33228
|
-
|
|
33229
|
-
|
|
33230
|
-
|
|
33231
|
-
|
|
33096
|
+
node.accessibility ?? (node.accessibility = void 0);
|
|
33097
|
+
node.decorators ?? (node.decorators = []);
|
|
33098
|
+
node.override ?? (node.override = false);
|
|
33099
|
+
node.readonly ?? (node.readonly = false);
|
|
33100
|
+
node.static ?? (node.static = false);
|
|
33232
33101
|
return;
|
|
33233
33102
|
|
|
33234
33103
|
case 'TSEmptyBodyFunctionExpression':
|
|
@@ -33239,95 +33108,100 @@ var typescript = (superClass) => class TypeScriptParserMixin extends superClass
|
|
|
33239
33108
|
case 'FunctionExpression':
|
|
33240
33109
|
case 'ClassMethod':
|
|
33241
33110
|
case 'ClassPrivateMethod':
|
|
33242
|
-
|
|
33243
|
-
|
|
33244
|
-
|
|
33111
|
+
node.declare ?? (node.declare = false);
|
|
33112
|
+
node.returnType ?? (node.returnType = void 0);
|
|
33113
|
+
node.typeParameters ?? (node.typeParameters = void 0);
|
|
33245
33114
|
return;
|
|
33246
33115
|
|
|
33247
33116
|
case 'Property':
|
|
33248
|
-
|
|
33117
|
+
node.optional ?? (node.optional = false);
|
|
33249
33118
|
return;
|
|
33250
33119
|
|
|
33251
33120
|
case 'TSMethodSignature':
|
|
33252
33121
|
case 'TSPropertySignature':
|
|
33253
|
-
|
|
33122
|
+
node.optional ?? (node.optional = false);
|
|
33254
33123
|
|
|
33255
33124
|
case 'TSIndexSignature':
|
|
33256
|
-
|
|
33257
|
-
|
|
33258
|
-
|
|
33125
|
+
node.accessibility ?? (node.accessibility = void 0);
|
|
33126
|
+
node.readonly ?? (node.readonly = false);
|
|
33127
|
+
node.static ?? (node.static = false);
|
|
33259
33128
|
return;
|
|
33260
33129
|
|
|
33261
33130
|
case 'TSAbstractPropertyDefinition':
|
|
33262
33131
|
case 'PropertyDefinition':
|
|
33263
33132
|
case 'TSAbstractAccessorProperty':
|
|
33264
33133
|
case 'AccessorProperty':
|
|
33265
|
-
|
|
33266
|
-
|
|
33267
|
-
|
|
33268
|
-
|
|
33134
|
+
node.declare ?? (node.declare = false);
|
|
33135
|
+
node.definite ?? (node.definite = false);
|
|
33136
|
+
node.readonly ?? (node.readonly = false);
|
|
33137
|
+
node.typeAnnotation ?? (node.typeAnnotation = void 0);
|
|
33269
33138
|
|
|
33270
33139
|
case 'TSAbstractMethodDefinition':
|
|
33271
33140
|
case 'MethodDefinition':
|
|
33272
|
-
|
|
33273
|
-
|
|
33274
|
-
|
|
33275
|
-
|
|
33141
|
+
node.accessibility ?? (node.accessibility = void 0);
|
|
33142
|
+
node.decorators ?? (node.decorators = []);
|
|
33143
|
+
node.override ?? (node.override = false);
|
|
33144
|
+
node.optional ?? (node.optional = false);
|
|
33276
33145
|
return;
|
|
33277
33146
|
|
|
33278
33147
|
case 'ClassExpression':
|
|
33279
|
-
|
|
33148
|
+
node.id ?? (node.id = null);
|
|
33280
33149
|
|
|
33281
33150
|
case 'ClassDeclaration':
|
|
33282
|
-
|
|
33283
|
-
|
|
33284
|
-
|
|
33285
|
-
|
|
33286
|
-
|
|
33287
|
-
|
|
33151
|
+
node.abstract ?? (node.abstract = false);
|
|
33152
|
+
node.declare ?? (node.declare = false);
|
|
33153
|
+
node.decorators ?? (node.decorators = []);
|
|
33154
|
+
node.implements ?? (node.implements = []);
|
|
33155
|
+
node.superTypeArguments ?? (node.superTypeArguments = void 0);
|
|
33156
|
+
node.typeParameters ?? (node.typeParameters = void 0);
|
|
33288
33157
|
return;
|
|
33289
33158
|
|
|
33290
33159
|
case 'TSTypeAliasDeclaration':
|
|
33291
33160
|
case 'VariableDeclaration':
|
|
33292
|
-
|
|
33161
|
+
node.declare ?? (node.declare = false);
|
|
33293
33162
|
return;
|
|
33294
33163
|
|
|
33295
33164
|
case 'VariableDeclarator':
|
|
33296
|
-
|
|
33165
|
+
node.definite ?? (node.definite = false);
|
|
33297
33166
|
return;
|
|
33298
33167
|
|
|
33299
33168
|
case 'TSEnumDeclaration':
|
|
33300
|
-
|
|
33301
|
-
|
|
33169
|
+
node.const ?? (node.const = false);
|
|
33170
|
+
node.declare ?? (node.declare = false);
|
|
33302
33171
|
return;
|
|
33303
33172
|
|
|
33304
33173
|
case 'TSEnumMember':
|
|
33305
|
-
|
|
33174
|
+
node.computed ?? (node.computed = false);
|
|
33306
33175
|
return;
|
|
33307
33176
|
|
|
33308
33177
|
case 'TSImportType':
|
|
33309
|
-
|
|
33310
|
-
|
|
33178
|
+
node.qualifier ?? (node.qualifier = null);
|
|
33179
|
+
node.options ?? (node.options = null);
|
|
33311
33180
|
{
|
|
33312
|
-
|
|
33181
|
+
node.typeArguments ?? (node.typeArguments = null);
|
|
33313
33182
|
}
|
|
33314
33183
|
|
|
33315
33184
|
return;
|
|
33316
33185
|
|
|
33317
33186
|
case 'TSInterfaceDeclaration':
|
|
33318
|
-
|
|
33319
|
-
|
|
33187
|
+
node.declare ?? (node.declare = false);
|
|
33188
|
+
node.extends ?? (node.extends = []);
|
|
33189
|
+
return;
|
|
33190
|
+
|
|
33191
|
+
case 'TSMappedType':
|
|
33192
|
+
node.optional ?? (node.optional = false);
|
|
33193
|
+
node.readonly ?? (node.readonly = void 0);
|
|
33320
33194
|
return;
|
|
33321
33195
|
|
|
33322
33196
|
case 'TSModuleDeclaration':
|
|
33323
|
-
|
|
33324
|
-
|
|
33197
|
+
node.declare ?? (node.declare = false);
|
|
33198
|
+
node.global ?? (node.global = node.kind === 'global');
|
|
33325
33199
|
return;
|
|
33326
33200
|
|
|
33327
33201
|
case 'TSTypeParameter':
|
|
33328
|
-
|
|
33329
|
-
|
|
33330
|
-
|
|
33202
|
+
node.const ?? (node.const = false);
|
|
33203
|
+
node.in ?? (node.in = false);
|
|
33204
|
+
node.out ?? (node.out = false);
|
|
33331
33205
|
return;
|
|
33332
33206
|
}
|
|
33333
33207
|
}
|
|
@@ -33347,10 +33221,9 @@ function isPossiblyLiteralEnum(expression2) {
|
|
|
33347
33221
|
}
|
|
33348
33222
|
|
|
33349
33223
|
function isValidAmbientConstInitializer(expression2, estree2) {
|
|
33350
|
-
var _a;
|
|
33351
33224
|
const {type} = expression2;
|
|
33352
33225
|
|
|
33353
|
-
if (
|
|
33226
|
+
if (expression2.extra?.parenthesized) {
|
|
33354
33227
|
return false;
|
|
33355
33228
|
}
|
|
33356
33229
|
|
|
@@ -33521,9 +33394,7 @@ var placeholders = (superClass) => class PlaceholdersParserMixin extends superCl
|
|
|
33521
33394
|
}
|
|
33522
33395
|
|
|
33523
33396
|
parseExpressionStatement(node, expr) {
|
|
33524
|
-
|
|
33525
|
-
|
|
33526
|
-
if (expr.type !== 'Placeholder' || ((_a = expr.extra) == null ? void 0 : _a.parenthesized)) {
|
|
33397
|
+
if (expr.type !== 'Placeholder' || expr.extra?.parenthesized) {
|
|
33527
33398
|
return super.parseExpressionStatement(node, expr);
|
|
33528
33399
|
}
|
|
33529
33400
|
|
|
@@ -33616,9 +33487,7 @@ var placeholders = (superClass) => class PlaceholdersParserMixin extends superCl
|
|
|
33616
33487
|
}
|
|
33617
33488
|
|
|
33618
33489
|
maybeParseExportDefaultSpecifier(node, maybeDefaultIdentifier) {
|
|
33619
|
-
|
|
33620
|
-
|
|
33621
|
-
if ((_a = node.specifiers) == null ? void 0 : _a.length) {
|
|
33490
|
+
if (node.specifiers?.length) {
|
|
33622
33491
|
return true;
|
|
33623
33492
|
}
|
|
33624
33493
|
|
|
@@ -33628,7 +33497,7 @@ var placeholders = (superClass) => class PlaceholdersParserMixin extends superCl
|
|
|
33628
33497
|
checkExport(node) {
|
|
33629
33498
|
const {specifiers} = node;
|
|
33630
33499
|
|
|
33631
|
-
if (specifiers
|
|
33500
|
+
if (specifiers?.length) {
|
|
33632
33501
|
node.specifiers = specifiers.filter((node2) => node2.exported.type === 'Placeholder');
|
|
33633
33502
|
}
|
|
33634
33503
|
|
|
@@ -34152,13 +34021,12 @@ var ExpressionParser = class extends LValParser {
|
|
|
34152
34021
|
}
|
|
34153
34022
|
|
|
34154
34023
|
parseHackPipeBody() {
|
|
34155
|
-
var _a;
|
|
34156
34024
|
const {startLoc} = this.state;
|
|
34157
34025
|
|
|
34158
34026
|
const body = this.parseMaybeAssign();
|
|
34159
34027
|
const requiredParentheses = UnparenthesizedPipeBodyDescriptions.has(body.type);
|
|
34160
34028
|
|
|
34161
|
-
if (requiredParentheses && !
|
|
34029
|
+
if (requiredParentheses && !body.extra?.parenthesized) {
|
|
34162
34030
|
this.raise(Errors.PipeUnparenthesizedBody, startLoc, {
|
|
34163
34031
|
type: body.type,
|
|
34164
34032
|
});
|
|
@@ -34510,10 +34378,9 @@ var ExpressionParser = class extends LValParser {
|
|
|
34510
34378
|
}
|
|
34511
34379
|
|
|
34512
34380
|
parseAsyncArrowFromCallExpression(node, call2) {
|
|
34513
|
-
var _a;
|
|
34514
34381
|
this.resetPreviousNodeTrailingComments(call2);
|
|
34515
34382
|
this.expect(19);
|
|
34516
|
-
this.parseArrowExpression(node, call2.arguments, true,
|
|
34383
|
+
this.parseArrowExpression(node, call2.arguments, true, call2.extra?.trailingCommaLoc);
|
|
34517
34384
|
|
|
34518
34385
|
if (call2.innerComments) {
|
|
34519
34386
|
setInnerComments(node, call2.innerComments);
|
|
@@ -34932,7 +34799,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
34932
34799
|
|
|
34933
34800
|
try {
|
|
34934
34801
|
bigInt = BigInt(value);
|
|
34935
|
-
} catch
|
|
34802
|
+
} catch {
|
|
34936
34803
|
bigInt = null;
|
|
34937
34804
|
}
|
|
34938
34805
|
|
|
@@ -35338,7 +35205,6 @@ var ExpressionParser = class extends LValParser {
|
|
|
35338
35205
|
}
|
|
35339
35206
|
|
|
35340
35207
|
checkGetterSetterParams(method) {
|
|
35341
|
-
var _a;
|
|
35342
35208
|
const paramCount = this.getGetterSetterExpectedParamCount(method);
|
|
35343
35209
|
const params = this.getObjectOrClassMethodParams(method);
|
|
35344
35210
|
|
|
@@ -35346,7 +35212,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
35346
35212
|
this.raise(method.kind === 'get' ? Errors.BadGetterArity : Errors.BadSetterArity, method);
|
|
35347
35213
|
}
|
|
35348
35214
|
|
|
35349
|
-
if (method.kind === 'set' &&
|
|
35215
|
+
if (method.kind === 'set' && params[params.length - 1]?.type === 'RestElement') {
|
|
35350
35216
|
this.raise(Errors.BadSetterRestParameter, method);
|
|
35351
35217
|
}
|
|
35352
35218
|
}
|
|
@@ -36456,10 +36322,8 @@ var StatementParser = class extends ExpressionParser {
|
|
|
36456
36322
|
}
|
|
36457
36323
|
|
|
36458
36324
|
maybeTakeDecorators(maybeDecorators, classNode, exportNode) {
|
|
36459
|
-
var _a;
|
|
36460
|
-
|
|
36461
36325
|
if (maybeDecorators) {
|
|
36462
|
-
if (
|
|
36326
|
+
if (classNode.decorators?.length) {
|
|
36463
36327
|
if (typeof this.getPluginOption('decorators', 'decoratorsBeforeExport') !== 'boolean') {
|
|
36464
36328
|
this.raise(Errors.DecoratorsBeforeAfterExport, classNode.decorators[0]);
|
|
36465
36329
|
}
|
|
@@ -36992,7 +36856,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
36992
36856
|
body.push(stmt);
|
|
36993
36857
|
}
|
|
36994
36858
|
|
|
36995
|
-
afterBlockParse
|
|
36859
|
+
afterBlockParse?.call(this, hasStrictModeDirective);
|
|
36996
36860
|
|
|
36997
36861
|
if (!oldStrict) {
|
|
36998
36862
|
this.setStrict(false);
|
|
@@ -37444,7 +37308,6 @@ var StatementParser = class extends ExpressionParser {
|
|
|
37444
37308
|
}
|
|
37445
37309
|
|
|
37446
37310
|
parseClassStaticBlock(classBody2, member) {
|
|
37447
|
-
var _a;
|
|
37448
37311
|
this.scope.enter(576 | 128 | 16);
|
|
37449
37312
|
const oldLabels = this.state.labels;
|
|
37450
37313
|
|
|
@@ -37457,7 +37320,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
37457
37320
|
this.state.labels = oldLabels;
|
|
37458
37321
|
classBody2.body.push(this.finishNode(member, 'StaticBlock'));
|
|
37459
37322
|
|
|
37460
|
-
if (
|
|
37323
|
+
if (member.decorators?.length) {
|
|
37461
37324
|
this.raise(Errors.DecoratorStaticBlock, member);
|
|
37462
37325
|
}
|
|
37463
37326
|
}
|
|
@@ -37563,7 +37426,6 @@ var StatementParser = class extends ExpressionParser {
|
|
|
37563
37426
|
}
|
|
37564
37427
|
|
|
37565
37428
|
parseExport(node, decorators) {
|
|
37566
|
-
var _a;
|
|
37567
37429
|
const maybeDefaultIdentifier = this.parseMaybeImportPhase(node, true);
|
|
37568
37430
|
const hasDefault = this.maybeParseExportDefaultSpecifier(node, maybeDefaultIdentifier);
|
|
37569
37431
|
const parseAfterDefault = !hasDefault || this.eat(12);
|
|
@@ -37613,7 +37475,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
37613
37475
|
const node2 = node;
|
|
37614
37476
|
this.checkExport(node2, true, false, !!node2.source);
|
|
37615
37477
|
|
|
37616
|
-
if (
|
|
37478
|
+
if (node2.declaration?.type === 'ClassDeclaration') {
|
|
37617
37479
|
this.maybeTakeDecorators(decorators, node2.declaration, node2);
|
|
37618
37480
|
} else if (decorators) {
|
|
37619
37481
|
throw this.raise(Errors.UnsupportedDecoratorExport, node);
|
|
@@ -37649,7 +37511,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
37649
37511
|
|
|
37650
37512
|
maybeParseExportDefaultSpecifier(node, maybeDefaultIdentifier) {
|
|
37651
37513
|
if (maybeDefaultIdentifier || this.isExportDefaultSpecifier()) {
|
|
37652
|
-
this.expectPlugin('exportDefaultFrom', maybeDefaultIdentifier
|
|
37514
|
+
this.expectPlugin('exportDefaultFrom', maybeDefaultIdentifier?.loc.start);
|
|
37653
37515
|
const id = maybeDefaultIdentifier || this.parseIdentifier(true);
|
|
37654
37516
|
const specifier = this.startNodeAtNode(id);
|
|
37655
37517
|
|
|
@@ -37664,10 +37526,8 @@ var StatementParser = class extends ExpressionParser {
|
|
|
37664
37526
|
}
|
|
37665
37527
|
|
|
37666
37528
|
maybeParseExportNamespaceSpecifier(node) {
|
|
37667
|
-
var _a;
|
|
37668
|
-
|
|
37669
37529
|
if (this.isContextual(93)) {
|
|
37670
|
-
|
|
37530
|
+
node.specifiers ?? (node.specifiers = []);
|
|
37671
37531
|
const specifier = this.startNodeAt(this.state.lastTokStartLoc);
|
|
37672
37532
|
this.next();
|
|
37673
37533
|
specifier.exported = this.parseModuleExportName();
|
|
@@ -37846,8 +37706,6 @@ var StatementParser = class extends ExpressionParser {
|
|
|
37846
37706
|
}
|
|
37847
37707
|
|
|
37848
37708
|
checkExport(node, checkNames, isDefault, isFrom) {
|
|
37849
|
-
var _a, _b;
|
|
37850
|
-
|
|
37851
37709
|
if (checkNames) {
|
|
37852
37710
|
if (isDefault) {
|
|
37853
37711
|
this.checkDuplicateExports(node, 'default');
|
|
@@ -37855,11 +37713,11 @@ var StatementParser = class extends ExpressionParser {
|
|
|
37855
37713
|
if (this.hasPlugin('exportDefaultFrom')) {
|
|
37856
37714
|
const declaration = node.declaration;
|
|
37857
37715
|
|
|
37858
|
-
if (declaration.type === 'Identifier' && declaration.name === 'from' && declaration.end - declaration.start === 4 && !
|
|
37716
|
+
if (declaration.type === 'Identifier' && declaration.name === 'from' && declaration.end - declaration.start === 4 && !declaration.extra?.parenthesized) {
|
|
37859
37717
|
this.raise(Errors.ExportDefaultFromAsIdentifier, declaration);
|
|
37860
37718
|
}
|
|
37861
37719
|
}
|
|
37862
|
-
} else if (
|
|
37720
|
+
} else if (node.specifiers?.length) {
|
|
37863
37721
|
for (const specifier of node.specifiers) {
|
|
37864
37722
|
const {exported} = specifier;
|
|
37865
37723
|
|
|
@@ -38010,7 +37868,6 @@ var StatementParser = class extends ExpressionParser {
|
|
|
38010
37868
|
}
|
|
38011
37869
|
|
|
38012
37870
|
checkImportReflection(node) {
|
|
38013
|
-
var _a;
|
|
38014
37871
|
const {specifiers} = node;
|
|
38015
37872
|
|
|
38016
37873
|
const singleBindingType = specifiers.length === 1 ? specifiers[0].type : null;
|
|
@@ -38028,7 +37885,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
38028
37885
|
this.raise(Errors.ImportReflectionNotBinding, specifiers[0].loc.start);
|
|
38029
37886
|
}
|
|
38030
37887
|
|
|
38031
|
-
if (
|
|
37888
|
+
if (node.assertions?.length > 0) {
|
|
38032
37889
|
this.raise(Errors.ImportReflectionHasAssertion, specifiers[0].loc.start);
|
|
38033
37890
|
}
|
|
38034
37891
|
}
|
|
@@ -38139,8 +37996,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
38139
37996
|
}
|
|
38140
37997
|
|
|
38141
37998
|
parseImportSourceAndAttributes(node) {
|
|
38142
|
-
|
|
38143
|
-
(_a = node.specifiers) != null ? _a : node.specifiers = [];
|
|
37999
|
+
node.specifiers ?? (node.specifiers = []);
|
|
38144
38000
|
node.source = this.parseImportSource();
|
|
38145
38001
|
this.maybeParseImportAttributes(node);
|
|
38146
38002
|
this.checkImportReflection(node);
|
|
@@ -38443,7 +38299,7 @@ var Parser = class extends StatementParser {
|
|
|
38443
38299
|
};
|
|
38444
38300
|
|
|
38445
38301
|
function parse(input, options) {
|
|
38446
|
-
if (
|
|
38302
|
+
if (options?.sourceType === 'unambiguous') {
|
|
38447
38303
|
options = Object.assign({}, options);
|
|
38448
38304
|
try {
|
|
38449
38305
|
options.sourceType = 'module';
|
|
@@ -38458,7 +38314,7 @@ function parse(input, options) {
|
|
|
38458
38314
|
try {
|
|
38459
38315
|
options.sourceType = 'script';
|
|
38460
38316
|
return getParser(options, input).parse();
|
|
38461
|
-
} catch
|
|
38317
|
+
} catch {}
|
|
38462
38318
|
} else {
|
|
38463
38319
|
ast.program.sourceType = 'script';
|
|
38464
38320
|
}
|
|
@@ -38468,7 +38324,7 @@ function parse(input, options) {
|
|
|
38468
38324
|
try {
|
|
38469
38325
|
options.sourceType = 'script';
|
|
38470
38326
|
return getParser(options, input).parse();
|
|
38471
|
-
} catch
|
|
38327
|
+
} catch {}
|
|
38472
38328
|
|
|
38473
38329
|
|
|
38474
38330
|
throw moduleError;
|
|
@@ -38504,7 +38360,7 @@ function getParser(options, input) {
|
|
|
38504
38360
|
let cls = Parser;
|
|
38505
38361
|
const pluginsMap = /* @__PURE__ */new Map();
|
|
38506
38362
|
|
|
38507
|
-
if (options
|
|
38363
|
+
if (options?.plugins) {
|
|
38508
38364
|
for (const plugin of options.plugins) {
|
|
38509
38365
|
let name, opts;
|
|
38510
38366
|
|
|
@@ -39072,7 +38928,6 @@ function parseAndBuildMetadata(formatter, code2, opts) {
|
|
|
39072
38928
|
}
|
|
39073
38929
|
|
|
39074
38930
|
function placeholderVisitorHandler(node, ancestors, state) {
|
|
39075
|
-
var _a;
|
|
39076
38931
|
let name;
|
|
39077
38932
|
let hasSyntacticPlaceholders = state.syntactic.placeholders.length > 0;
|
|
39078
38933
|
|
|
@@ -39098,7 +38953,7 @@ function placeholderVisitorHandler(node, ancestors, state) {
|
|
|
39098
38953
|
throw new Error('\'.placeholderWhitelist\' and \'.placeholderPattern\' aren\'t compatible with \'.syntacticPlaceholders: true\'');
|
|
39099
38954
|
}
|
|
39100
38955
|
|
|
39101
|
-
if (!hasSyntacticPlaceholders && (state.placeholderPattern === false || !(state.placeholderPattern || PATTERN).test(name)) && !
|
|
38956
|
+
if (!hasSyntacticPlaceholders && (state.placeholderPattern === false || !(state.placeholderPattern || PATTERN).test(name)) && !state.placeholderWhitelist?.has(name)) {
|
|
39102
38957
|
return;
|
|
39103
38958
|
}
|
|
39104
38959
|
|
|
@@ -39225,15 +39080,12 @@ function populatePlaceholders(metadata, replacements) {
|
|
|
39225
39080
|
});
|
|
39226
39081
|
}
|
|
39227
39082
|
|
|
39228
|
-
metadata
|
|
39229
|
-
.placeholders
|
|
39083
|
+
metadata.placeholders
|
|
39230
39084
|
.slice()
|
|
39231
39085
|
.reverse()
|
|
39232
39086
|
.forEach((placeholder2) => {
|
|
39233
|
-
var _a;
|
|
39234
|
-
|
|
39235
39087
|
try {
|
|
39236
|
-
applyReplacement(placeholder2, ast, (
|
|
39088
|
+
applyReplacement(placeholder2, ast, (replacements && replacements[placeholder2.name]) ?? null);
|
|
39237
39089
|
} catch(e) {
|
|
39238
39090
|
e.message = `@babel/template placeholder "${placeholder2.name}": ${e.message}`;
|
|
39239
39091
|
throw e;
|
|
@@ -39500,8 +39352,7 @@ function extendedTrace(fn) {
|
|
|
39500
39352
|
throw new Error();
|
|
39501
39353
|
} catch(error) {
|
|
39502
39354
|
if (error.stack) {
|
|
39503
|
-
rootStack = error
|
|
39504
|
-
.stack
|
|
39355
|
+
rootStack = error.stack
|
|
39505
39356
|
.split('\n')
|
|
39506
39357
|
.slice(3)
|
|
39507
39358
|
.join('\n');
|
|
@@ -40566,13 +40417,11 @@ var SourceMap = class {
|
|
|
40566
40417
|
__publicField(this, '_lastSourceLine', 0);
|
|
40567
40418
|
__publicField(this, '_lastSourceColumn', 0);
|
|
40568
40419
|
__publicField(this, '_inputMap');
|
|
40569
|
-
var _a, _b;
|
|
40570
|
-
|
|
40571
40420
|
const map = this._map = new GenMapping({
|
|
40572
40421
|
sourceRoot: opts.sourceRoot,
|
|
40573
40422
|
});
|
|
40574
40423
|
|
|
40575
|
-
this._sourceFileName =
|
|
40424
|
+
this._sourceFileName = opts.sourceFileName?.replace(/\\/g, '/');
|
|
40576
40425
|
this._rawMappings = void 0;
|
|
40577
40426
|
|
|
40578
40427
|
if (opts.inputSourceMap) {
|
|
@@ -40581,7 +40430,7 @@ var SourceMap = class {
|
|
|
40581
40430
|
|
|
40582
40431
|
if (resolvedSources.length) {
|
|
40583
40432
|
for (let i = 0; i < resolvedSources.length; i++) {
|
|
40584
|
-
setSourceContent(map, resolvedSources[i],
|
|
40433
|
+
setSourceContent(map, resolvedSources[i], this._inputMap.sourcesContent?.[i]);
|
|
40585
40434
|
}
|
|
40586
40435
|
}
|
|
40587
40436
|
}
|
|
@@ -40627,7 +40476,7 @@ var SourceMap = class {
|
|
|
40627
40476
|
}
|
|
40628
40477
|
} else {
|
|
40629
40478
|
originalMapping = {
|
|
40630
|
-
source:
|
|
40479
|
+
source: filename?.replace(/\\/g, '/') || this._sourceFileName,
|
|
40631
40480
|
line,
|
|
40632
40481
|
column,
|
|
40633
40482
|
};
|
|
@@ -40637,7 +40486,7 @@ var SourceMap = class {
|
|
|
40637
40486
|
maybeAddMapping(this._map, {
|
|
40638
40487
|
name: identifierName,
|
|
40639
40488
|
generated,
|
|
40640
|
-
source: originalMapping
|
|
40489
|
+
source: originalMapping?.source,
|
|
40641
40490
|
original: originalMapping,
|
|
40642
40491
|
});
|
|
40643
40492
|
}
|
|
@@ -40721,7 +40570,7 @@ var Buffer2 = class {
|
|
|
40721
40570
|
const map = this._map;
|
|
40722
40571
|
const result = {
|
|
40723
40572
|
code: (this._buf + this._str).trimRight(),
|
|
40724
|
-
decodedMap: map
|
|
40573
|
+
decodedMap: map?.getDecoded(),
|
|
40725
40574
|
get __mergedMap() {
|
|
40726
40575
|
return this.map;
|
|
40727
40576
|
},
|
|
@@ -40738,7 +40587,7 @@ var Buffer2 = class {
|
|
|
40738
40587
|
});
|
|
40739
40588
|
},
|
|
40740
40589
|
get rawMappings() {
|
|
40741
|
-
const mappings = map
|
|
40590
|
+
const mappings = map?.getRawMappings();
|
|
40742
40591
|
|
|
40743
40592
|
result.rawMappings = mappings;
|
|
40744
40593
|
return mappings;
|
|
@@ -40888,8 +40737,7 @@ var Buffer2 = class {
|
|
|
40888
40737
|
}
|
|
40889
40738
|
|
|
40890
40739
|
_mark(line, column, identifierName, identifierNamePos, filename) {
|
|
40891
|
-
|
|
40892
|
-
(_a = this._map) == null ? void 0 : _a.mark(this._position, line, column, identifierName, identifierNamePos, filename);
|
|
40740
|
+
this._map?.mark(this._position, line, column, identifierName, identifierNamePos, filename);
|
|
40893
40741
|
}
|
|
40894
40742
|
|
|
40895
40743
|
removeTrailingNewline() {
|
|
@@ -41176,23 +41024,17 @@ nodes.ObjectMethod = function(node, parent) {
|
|
|
41176
41024
|
}
|
|
41177
41025
|
};
|
|
41178
41026
|
nodes.ObjectTypeCallProperty = function(node, parent) {
|
|
41179
|
-
|
|
41180
|
-
|
|
41181
|
-
if (parent.callProperties[0] === node && !((_a = parent.properties) == null ? void 0 : _a.length)) {
|
|
41027
|
+
if (parent.callProperties[0] === node && !parent.properties?.length) {
|
|
41182
41028
|
return 1;
|
|
41183
41029
|
}
|
|
41184
41030
|
};
|
|
41185
41031
|
nodes.ObjectTypeIndexer = function(node, parent) {
|
|
41186
|
-
|
|
41187
|
-
|
|
41188
|
-
if (parent.indexers[0] === node && !((_a = parent.properties) == null ? void 0 : _a.length) && !((_b = parent.callProperties) == null ? void 0 : _b.length)) {
|
|
41032
|
+
if (parent.indexers[0] === node && !parent.properties?.length && !parent.callProperties?.length) {
|
|
41189
41033
|
return 1;
|
|
41190
41034
|
}
|
|
41191
41035
|
};
|
|
41192
41036
|
nodes.ObjectTypeInternalSlot = function(node, parent) {
|
|
41193
|
-
|
|
41194
|
-
|
|
41195
|
-
if (parent.internalSlots[0] === node && !((_a = parent.properties) == null ? void 0 : _a.length) && !((_b = parent.callProperties) == null ? void 0 : _b.length) && !((_c = parent.indexers) == null ? void 0 : _c.length)) {
|
|
41037
|
+
if (parent.internalSlots[0] === node && !parent.properties?.length && !parent.callProperties?.length && !parent.indexers?.length) {
|
|
41196
41038
|
return 1;
|
|
41197
41039
|
}
|
|
41198
41040
|
};
|
|
@@ -41552,10 +41394,9 @@ function LogicalExpression2(node, parent) {
|
|
|
41552
41394
|
}
|
|
41553
41395
|
|
|
41554
41396
|
function Identifier$1(node, parent, tokenContext, getRawIdentifier) {
|
|
41555
|
-
var _a;
|
|
41556
41397
|
const parentType = parent.type;
|
|
41557
41398
|
|
|
41558
|
-
if (
|
|
41399
|
+
if (node.extra?.parenthesized && parentType === 'AssignmentExpression' && parent.left === node) {
|
|
41559
41400
|
const rightType = parent.right.type;
|
|
41560
41401
|
|
|
41561
41402
|
if ((rightType === 'FunctionExpression' || rightType === 'ClassExpression') && parent.right.id == null) {
|
|
@@ -41659,8 +41500,7 @@ function expandAliases(obj) {
|
|
|
41659
41500
|
const fn = map.get(type);
|
|
41660
41501
|
|
|
41661
41502
|
map.set(type, fn ? function(node, parent, stack, getRawIdentifier) {
|
|
41662
|
-
|
|
41663
|
-
return (_a = fn(node, parent, stack, getRawIdentifier)) != null ? _a : func(node, parent, stack, getRawIdentifier);
|
|
41503
|
+
return fn(node, parent, stack, getRawIdentifier) ?? func(node, parent, stack, getRawIdentifier);
|
|
41664
41504
|
} : func);
|
|
41665
41505
|
}
|
|
41666
41506
|
|
|
@@ -41691,8 +41531,6 @@ function isOrHasCallExpression(node) {
|
|
|
41691
41531
|
}
|
|
41692
41532
|
|
|
41693
41533
|
function needsWhitespace(node, parent, type) {
|
|
41694
|
-
var _a;
|
|
41695
|
-
|
|
41696
41534
|
if (!node)
|
|
41697
41535
|
return false;
|
|
41698
41536
|
|
|
@@ -41700,7 +41538,7 @@ function needsWhitespace(node, parent, type) {
|
|
|
41700
41538
|
node = node.expression;
|
|
41701
41539
|
}
|
|
41702
41540
|
|
|
41703
|
-
const flag =
|
|
41541
|
+
const flag = expandedWhitespaceNodes.get(node.type)?.(node, parent);
|
|
41704
41542
|
|
|
41705
41543
|
if (typeof flag === 'number') {
|
|
41706
41544
|
return (flag & type) !== 0;
|
|
@@ -41718,8 +41556,6 @@ function needsWhitespaceAfter(node, parent) {
|
|
|
41718
41556
|
}
|
|
41719
41557
|
|
|
41720
41558
|
function needsParens$1(node, parent, tokenContext, getRawIdentifier) {
|
|
41721
|
-
var _a;
|
|
41722
|
-
|
|
41723
41559
|
if (!parent)
|
|
41724
41560
|
return false;
|
|
41725
41561
|
|
|
@@ -41732,7 +41568,7 @@ function needsParens$1(node, parent, tokenContext, getRawIdentifier) {
|
|
|
41732
41568
|
return !isDecoratorMemberExpression(node) && !(isCallExpression$1(node) && isDecoratorMemberExpression(node.callee)) && !isParenthesizedExpression2(node);
|
|
41733
41569
|
}
|
|
41734
41570
|
|
|
41735
|
-
return
|
|
41571
|
+
return expandedParens.get(node.type)?.(node, parent, tokenContext, getRawIdentifier);
|
|
41736
41572
|
}
|
|
41737
41573
|
|
|
41738
41574
|
function isDecoratorMemberExpression(node) {
|
|
@@ -42028,7 +41864,7 @@ function* childrenIterator(node) {
|
|
|
42028
41864
|
continue;
|
|
42029
41865
|
|
|
42030
41866
|
if (Array.isArray(child)) {
|
|
42031
|
-
yield*
|
|
41867
|
+
yield* child;
|
|
42032
41868
|
} else {
|
|
42033
41869
|
yield child;
|
|
42034
41870
|
}
|
|
@@ -42139,10 +41975,6 @@ function NewExpression2(node, parent) {
|
|
|
42139
41975
|
|
|
42140
41976
|
this.print(node.typeArguments);
|
|
42141
41977
|
|
|
42142
|
-
if (node.optional) {
|
|
42143
|
-
this.token('?.');
|
|
42144
|
-
}
|
|
42145
|
-
|
|
42146
41978
|
if (node.arguments.length === 0 && this.tokenMap && !this.tokenMap.endMatches(node, ')')) {
|
|
42147
41979
|
return;
|
|
42148
41980
|
}
|
|
@@ -42479,7 +42311,7 @@ function ForXStatement(node) {
|
|
|
42479
42311
|
{
|
|
42480
42312
|
const exit = this.enterForXStatementInit(isForOf);
|
|
42481
42313
|
this.print(node.left);
|
|
42482
|
-
exit
|
|
42314
|
+
exit?.();
|
|
42483
42315
|
}
|
|
42484
42316
|
this.space();
|
|
42485
42317
|
this.word(isForOf ? 'of' : 'in');
|
|
@@ -42732,7 +42564,7 @@ function ClassBody2(node) {
|
|
|
42732
42564
|
} else {
|
|
42733
42565
|
this.newline();
|
|
42734
42566
|
const separator = classBodyEmptySemicolonsPrinter(this, node);
|
|
42735
|
-
separator
|
|
42567
|
+
separator?.(-1);
|
|
42736
42568
|
const exit = this.enterDelimited();
|
|
42737
42569
|
this.printJoin(node.body, true, true, separator, true);
|
|
42738
42570
|
exit();
|
|
@@ -42782,11 +42614,10 @@ function classBodyEmptySemicolonsPrinter(printer, node) {
|
|
|
42782
42614
|
}
|
|
42783
42615
|
|
|
42784
42616
|
function ClassProperty2(node) {
|
|
42785
|
-
var _a, _b;
|
|
42786
42617
|
this.printJoin(node.decorators);
|
|
42787
42618
|
|
|
42788
42619
|
if (!node.static && !this.format.preserveFormat) {
|
|
42789
|
-
const endLine =
|
|
42620
|
+
const endLine = node.key.loc?.end?.line;
|
|
42790
42621
|
|
|
42791
42622
|
if (endLine)
|
|
42792
42623
|
this.catchUp(endLine);
|
|
@@ -42824,9 +42655,8 @@ function ClassProperty2(node) {
|
|
|
42824
42655
|
}
|
|
42825
42656
|
|
|
42826
42657
|
function ClassAccessorProperty2(node) {
|
|
42827
|
-
var _a, _b;
|
|
42828
42658
|
this.printJoin(node.decorators);
|
|
42829
|
-
const endLine =
|
|
42659
|
+
const endLine = node.key.loc?.end?.line;
|
|
42830
42660
|
|
|
42831
42661
|
if (endLine)
|
|
42832
42662
|
this.catchUp(endLine);
|
|
@@ -42902,11 +42732,10 @@ function ClassPrivateMethod2(node) {
|
|
|
42902
42732
|
}
|
|
42903
42733
|
|
|
42904
42734
|
function _classMethodHead(node) {
|
|
42905
|
-
var _a, _b;
|
|
42906
42735
|
this.printJoin(node.decorators);
|
|
42907
42736
|
|
|
42908
42737
|
if (!this.format.preserveFormat) {
|
|
42909
|
-
const endLine =
|
|
42738
|
+
const endLine = node.key.loc?.end?.line;
|
|
42910
42739
|
|
|
42911
42740
|
if (endLine)
|
|
42912
42741
|
this.catchUp(endLine);
|
|
@@ -43084,8 +42913,6 @@ function ArrowFunctionExpression2(node, parent) {
|
|
|
43084
42913
|
}
|
|
43085
42914
|
|
|
43086
42915
|
function _shouldPrintArrowParamsParens(node) {
|
|
43087
|
-
var _a, _b;
|
|
43088
|
-
|
|
43089
42916
|
if (node.params.length !== 1)
|
|
43090
42917
|
return true;
|
|
43091
42918
|
|
|
@@ -43095,7 +42922,7 @@ function _shouldPrintArrowParamsParens(node) {
|
|
|
43095
42922
|
|
|
43096
42923
|
const firstParam = node.params[0];
|
|
43097
42924
|
|
|
43098
|
-
if (!isIdentifier$1(firstParam) || firstParam.typeAnnotation || firstParam.optional ||
|
|
42925
|
+
if (!isIdentifier$1(firstParam) || firstParam.typeAnnotation || firstParam.optional || firstParam.leadingComments?.length || firstParam.trailingComments?.length) {
|
|
43099
42926
|
return true;
|
|
43100
42927
|
}
|
|
43101
42928
|
|
|
@@ -43108,7 +42935,7 @@ function _shouldPrintArrowParamsParens(node) {
|
|
|
43108
42935
|
|
|
43109
42936
|
const arrowToken = this.tokenMap.findMatching(node, '=>');
|
|
43110
42937
|
|
|
43111
|
-
if (
|
|
42938
|
+
if (arrowToken?.loc == null)
|
|
43112
42939
|
return true;
|
|
43113
42940
|
|
|
43114
42941
|
return arrowToken.loc.start.line !== node.loc.start.line;
|
|
@@ -43121,7 +42948,6 @@ function _shouldPrintArrowParamsParens(node) {
|
|
|
43121
42948
|
}
|
|
43122
42949
|
|
|
43123
42950
|
function _getFuncIdName(idNode, parent) {
|
|
43124
|
-
var _a, _b, _c, _d;
|
|
43125
42951
|
let id = idNode;
|
|
43126
42952
|
|
|
43127
42953
|
if (!id && parent) {
|
|
@@ -43149,17 +42975,17 @@ function _getFuncIdName(idNode, parent) {
|
|
|
43149
42975
|
|
|
43150
42976
|
if (id.type === 'Identifier') {
|
|
43151
42977
|
nameInfo = {
|
|
43152
|
-
pos:
|
|
43153
|
-
name:
|
|
42978
|
+
pos: id.loc?.start,
|
|
42979
|
+
name: id.loc?.identifierName || id.name,
|
|
43154
42980
|
};
|
|
43155
42981
|
} else if (id.type === 'PrivateName') {
|
|
43156
42982
|
nameInfo = {
|
|
43157
|
-
pos:
|
|
42983
|
+
pos: id.loc?.start,
|
|
43158
42984
|
name: '#' + id.id.name,
|
|
43159
42985
|
};
|
|
43160
42986
|
} else if (id.type === 'StringLiteral') {
|
|
43161
42987
|
nameInfo = {
|
|
43162
|
-
pos:
|
|
42988
|
+
pos: id.loc?.start,
|
|
43163
42989
|
name: id.value,
|
|
43164
42990
|
};
|
|
43165
42991
|
}
|
|
@@ -43242,7 +43068,6 @@ function _printAttributes(node, hasPreviousBrace) {
|
|
|
43242
43068
|
}
|
|
43243
43069
|
|
|
43244
43070
|
function ExportAllDeclaration2(node) {
|
|
43245
|
-
var _a, _b;
|
|
43246
43071
|
this.word('export');
|
|
43247
43072
|
this.space();
|
|
43248
43073
|
|
|
@@ -43256,7 +43081,7 @@ function ExportAllDeclaration2(node) {
|
|
|
43256
43081
|
this.word('from');
|
|
43257
43082
|
this.space();
|
|
43258
43083
|
|
|
43259
|
-
if (
|
|
43084
|
+
if (node.attributes?.length || node.assertions?.length) {
|
|
43260
43085
|
this.print(node.source, true);
|
|
43261
43086
|
this.space();
|
|
43262
43087
|
this._printAttributes(node, false);
|
|
@@ -43274,7 +43099,6 @@ function maybePrintDecoratorsBeforeExport(printer, node) {
|
|
|
43274
43099
|
}
|
|
43275
43100
|
|
|
43276
43101
|
function ExportNamedDeclaration2(node) {
|
|
43277
|
-
var _a, _b;
|
|
43278
43102
|
maybePrintDecoratorsBeforeExport(this, node);
|
|
43279
43103
|
this.word('export');
|
|
43280
43104
|
this.space();
|
|
@@ -43330,7 +43154,7 @@ function ExportNamedDeclaration2(node) {
|
|
|
43330
43154
|
this.word('from');
|
|
43331
43155
|
this.space();
|
|
43332
43156
|
|
|
43333
|
-
if (
|
|
43157
|
+
if (node.attributes?.length || node.assertions?.length) {
|
|
43334
43158
|
this.print(node.source, true);
|
|
43335
43159
|
this.space();
|
|
43336
43160
|
this._printAttributes(node, hasBrace);
|
|
@@ -43359,7 +43183,6 @@ function ExportDefaultDeclaration2(node) {
|
|
|
43359
43183
|
}
|
|
43360
43184
|
|
|
43361
43185
|
function ImportDeclaration2(node) {
|
|
43362
|
-
var _a, _b;
|
|
43363
43186
|
this.word('import');
|
|
43364
43187
|
this.space();
|
|
43365
43188
|
const isTypeKind = node.importKind === 'type' || node.importKind === 'typeof';
|
|
@@ -43417,7 +43240,7 @@ function ImportDeclaration2(node) {
|
|
|
43417
43240
|
this.space();
|
|
43418
43241
|
}
|
|
43419
43242
|
|
|
43420
|
-
if (
|
|
43243
|
+
if (node.attributes?.length || node.assertions?.length) {
|
|
43421
43244
|
this.print(node.source, true);
|
|
43422
43245
|
this.space();
|
|
43423
43246
|
this._printAttributes(node, hasBrace);
|
|
@@ -43494,8 +43317,7 @@ function _getRawIdentifier(node) {
|
|
|
43494
43317
|
}
|
|
43495
43318
|
|
|
43496
43319
|
function Identifier2(node) {
|
|
43497
|
-
|
|
43498
|
-
this.sourceIdentifierName(((_a = node.loc) == null ? void 0 : _a.identifierName) || node.name);
|
|
43320
|
+
this.sourceIdentifierName(node.loc?.identifierName || node.name);
|
|
43499
43321
|
this.word(this.tokenMap ? this._getRawIdentifier(node) : node.name);
|
|
43500
43322
|
}
|
|
43501
43323
|
|
|
@@ -44020,7 +43842,7 @@ function FunctionTypeAnnotation2(node, parent) {
|
|
|
44020
43842
|
}
|
|
44021
43843
|
|
|
44022
43844
|
this.tokenChar(41);
|
|
44023
|
-
const type = parent
|
|
43845
|
+
const type = parent?.type;
|
|
44024
43846
|
|
|
44025
43847
|
if (type != null && (type === 'ObjectTypeCallProperty' || type === 'ObjectTypeInternalSlot' || type === 'DeclareFunction' || type === 'ObjectTypeProperty' && parent.method)) {
|
|
44026
43848
|
this.tokenChar(58);
|
|
@@ -44053,11 +43875,10 @@ function InterfaceExtends2(node) {
|
|
|
44053
43875
|
}
|
|
44054
43876
|
|
|
44055
43877
|
function _interfaceish(node) {
|
|
44056
|
-
var _a, _b, _c;
|
|
44057
43878
|
this.print(node.id);
|
|
44058
43879
|
this.print(node.typeParameters);
|
|
44059
43880
|
|
|
44060
|
-
if (
|
|
43881
|
+
if (node.extends?.length) {
|
|
44061
43882
|
this.space();
|
|
44062
43883
|
this.word('extends');
|
|
44063
43884
|
this.space();
|
|
@@ -44065,14 +43886,14 @@ function _interfaceish(node) {
|
|
|
44065
43886
|
}
|
|
44066
43887
|
|
|
44067
43888
|
if (node.type === 'DeclareClass') {
|
|
44068
|
-
if (
|
|
43889
|
+
if (node.mixins?.length) {
|
|
44069
43890
|
this.space();
|
|
44070
43891
|
this.word('mixins');
|
|
44071
43892
|
this.space();
|
|
44072
43893
|
this.printList(node.mixins);
|
|
44073
43894
|
}
|
|
44074
43895
|
|
|
44075
|
-
if (
|
|
43896
|
+
if (node.implements?.length) {
|
|
44076
43897
|
this.space();
|
|
44077
43898
|
this.word('implements');
|
|
44078
43899
|
this.space();
|
|
@@ -44085,8 +43906,7 @@ function _interfaceish(node) {
|
|
|
44085
43906
|
}
|
|
44086
43907
|
|
|
44087
43908
|
function _variance(node) {
|
|
44088
|
-
|
|
44089
|
-
const kind = (_a = node.variance) == null ? void 0 : _a.kind;
|
|
43909
|
+
const kind = node.variance?.kind;
|
|
44090
43910
|
|
|
44091
43911
|
if (kind != null) {
|
|
44092
43912
|
if (kind === 'plus') {
|
|
@@ -44110,10 +43930,9 @@ function andSeparator(occurrenceCount) {
|
|
|
44110
43930
|
}
|
|
44111
43931
|
|
|
44112
43932
|
function InterfaceTypeAnnotation2(node) {
|
|
44113
|
-
var _a;
|
|
44114
43933
|
this.word('interface');
|
|
44115
43934
|
|
|
44116
|
-
if (
|
|
43935
|
+
if (node.extends?.length) {
|
|
44117
43936
|
this.space();
|
|
44118
43937
|
this.word('extends');
|
|
44119
43938
|
this.space();
|
|
@@ -44439,16 +44258,15 @@ function File2(node) {
|
|
|
44439
44258
|
}
|
|
44440
44259
|
|
|
44441
44260
|
function Program2(node) {
|
|
44442
|
-
var _a, _b;
|
|
44443
44261
|
this.noIndentInnerCommentsHere();
|
|
44444
44262
|
this.printInnerComments();
|
|
44445
|
-
const directivesLen =
|
|
44263
|
+
const directivesLen = node.directives?.length;
|
|
44446
44264
|
|
|
44447
44265
|
if (directivesLen) {
|
|
44448
44266
|
const newline = node.body.length ? 2 : 1;
|
|
44449
44267
|
this.printSequence(node.directives, void 0, newline);
|
|
44450
44268
|
|
|
44451
|
-
if (!
|
|
44269
|
+
if (!node.directives[directivesLen - 1].trailingComments?.length) {
|
|
44452
44270
|
this.newline(newline);
|
|
44453
44271
|
}
|
|
44454
44272
|
}
|
|
@@ -44457,16 +44275,15 @@ function Program2(node) {
|
|
|
44457
44275
|
}
|
|
44458
44276
|
|
|
44459
44277
|
function BlockStatement2(node) {
|
|
44460
|
-
var _a, _b;
|
|
44461
44278
|
this.tokenChar(123);
|
|
44462
44279
|
const exit = this.enterDelimited();
|
|
44463
|
-
const directivesLen =
|
|
44280
|
+
const directivesLen = node.directives?.length;
|
|
44464
44281
|
|
|
44465
44282
|
if (directivesLen) {
|
|
44466
44283
|
const newline = node.body.length ? 2 : 1;
|
|
44467
44284
|
this.printSequence(node.directives, true, newline);
|
|
44468
44285
|
|
|
44469
|
-
if (!
|
|
44286
|
+
if (!node.directives[directivesLen - 1].trailingComments?.length) {
|
|
44470
44287
|
this.newline(newline);
|
|
44471
44288
|
}
|
|
44472
44289
|
}
|
|
@@ -44984,10 +44801,9 @@ function TSIntersectionType2(node) {
|
|
|
44984
44801
|
}
|
|
44985
44802
|
|
|
44986
44803
|
function tsPrintUnionOrIntersectionType(printer, node, sep) {
|
|
44987
|
-
var _a;
|
|
44988
44804
|
let hasLeadingToken = 0;
|
|
44989
44805
|
|
|
44990
|
-
if (
|
|
44806
|
+
if (printer.tokenMap?.startMatches(node, sep)) {
|
|
44991
44807
|
hasLeadingToken = 1;
|
|
44992
44808
|
printer.token(sep);
|
|
44993
44809
|
}
|
|
@@ -45130,7 +44946,7 @@ function TSInterfaceDeclaration2(node) {
|
|
|
45130
44946
|
this.print(id);
|
|
45131
44947
|
this.print(typeParameters);
|
|
45132
44948
|
|
|
45133
|
-
if (extendz
|
|
44949
|
+
if (extendz?.length) {
|
|
45134
44950
|
this.space();
|
|
45135
44951
|
this.word('extends');
|
|
45136
44952
|
this.space();
|
|
@@ -45227,10 +45043,7 @@ function TSEnumDeclaration2(node) {
|
|
|
45227
45043
|
}
|
|
45228
45044
|
|
|
45229
45045
|
function TSEnumBody2(node) {
|
|
45230
|
-
printBraced(this, node, () =>
|
|
45231
|
-
var _a;
|
|
45232
|
-
return this.printList(node.members, (_a = this.shouldPrintTrailingComma('}')) != null ? _a : false, true, true);
|
|
45233
|
-
});
|
|
45046
|
+
printBraced(this, node, () => this.printList(node.members, this.shouldPrintTrailingComma('}') ?? false, true, true));
|
|
45234
45047
|
}
|
|
45235
45048
|
|
|
45236
45049
|
function TSEnumMember2(node) {
|
|
@@ -45390,7 +45203,6 @@ function printBraced(printer, node, cb) {
|
|
|
45390
45203
|
}
|
|
45391
45204
|
|
|
45392
45205
|
function printModifiersList(printer, node, modifiers) {
|
|
45393
|
-
var _a;
|
|
45394
45206
|
const modifiersSet = /* @__PURE__ */new Set();
|
|
45395
45207
|
|
|
45396
45208
|
for (const modifier of modifiers) {
|
|
@@ -45398,7 +45210,7 @@ function printModifiersList(printer, node, modifiers) {
|
|
|
45398
45210
|
modifiersSet.add(modifier);
|
|
45399
45211
|
}
|
|
45400
45212
|
|
|
45401
|
-
|
|
45213
|
+
printer.tokenMap?.find(node, (tok) => {
|
|
45402
45214
|
if (modifiersSet.has(tok.value)) {
|
|
45403
45215
|
printer.token(tok.value);
|
|
45404
45216
|
printer.space();
|
|
@@ -45735,7 +45547,7 @@ var Printer = class {
|
|
|
45735
45547
|
this._tokens = tokens;
|
|
45736
45548
|
this._originalCode = originalCode;
|
|
45737
45549
|
this._indentRepeat = format.indent.style.length;
|
|
45738
|
-
this._inputMap = map
|
|
45550
|
+
this._inputMap = map?._inputMap;
|
|
45739
45551
|
this._buf = new Buffer2(map, format.indent.style[0]);
|
|
45740
45552
|
}
|
|
45741
45553
|
|
|
@@ -46079,14 +45891,14 @@ var Printer = class {
|
|
|
46079
45891
|
const {format} = this;
|
|
46080
45892
|
|
|
46081
45893
|
if (!format.preserveFormat) {
|
|
46082
|
-
if (format.retainLines &&
|
|
45894
|
+
if (format.retainLines && loc?.[prop]) {
|
|
46083
45895
|
this.catchUp(loc[prop].line);
|
|
46084
45896
|
}
|
|
46085
45897
|
|
|
46086
45898
|
return;
|
|
46087
45899
|
}
|
|
46088
45900
|
|
|
46089
|
-
const pos = loc
|
|
45901
|
+
const pos = loc?.[prop];
|
|
46090
45902
|
|
|
46091
45903
|
if (pos != null)
|
|
46092
45904
|
this._catchUpTo(pos);
|
|
@@ -46124,8 +45936,6 @@ var Printer = class {
|
|
|
46124
45936
|
}
|
|
46125
45937
|
|
|
46126
45938
|
print(node, noLineTerminatorAfter, trailingCommentsLineOffset) {
|
|
46127
|
-
var _a, _b, _c, _d;
|
|
46128
|
-
|
|
46129
45939
|
if (!node)
|
|
46130
45940
|
return;
|
|
46131
45941
|
|
|
@@ -46156,7 +45966,7 @@ var Printer = class {
|
|
|
46156
45966
|
|
|
46157
45967
|
this._insideAux = node.loc == null;
|
|
46158
45968
|
this._maybeAddAuxComment(this._insideAux && !oldInAux);
|
|
46159
|
-
const parenthesized =
|
|
45969
|
+
const parenthesized = node.extra?.parenthesized;
|
|
46160
45970
|
let shouldPrintParens = parenthesized
|
|
46161
45971
|
&& format.preserveFormat
|
|
46162
45972
|
|| parenthesized
|
|
@@ -46164,8 +45974,8 @@ var Printer = class {
|
|
|
46164
45974
|
&& nodeType === 'FunctionExpression'
|
|
46165
45975
|
|| needsParens(node, parent, this.tokenContext, format.preserveFormat ? this._boundGetRawIdentifier : void 0);
|
|
46166
45976
|
|
|
46167
|
-
if (!shouldPrintParens && parenthesized &&
|
|
46168
|
-
const parentType = parent
|
|
45977
|
+
if (!shouldPrintParens && parenthesized && node.leadingComments?.length && node.leadingComments[0].type === 'CommentBlock') {
|
|
45978
|
+
const parentType = parent?.type;
|
|
46169
45979
|
|
|
46170
45980
|
switch(parentType) {
|
|
46171
45981
|
case 'ExpressionStatement':
|
|
@@ -46187,7 +45997,7 @@ var Printer = class {
|
|
|
46187
45997
|
|
|
46188
45998
|
let indentParenthesized = false;
|
|
46189
45999
|
|
|
46190
|
-
if (!shouldPrintParens && this._noLineTerminator && (
|
|
46000
|
+
if (!shouldPrintParens && this._noLineTerminator && (node.leadingComments?.some(commentIsNewline) || this.format.retainLines && node.loc && node.loc.start.line > this._buf.getCurrentLine())) {
|
|
46191
46001
|
shouldPrintParens = true;
|
|
46192
46002
|
indentParenthesized = true;
|
|
46193
46003
|
}
|
|
@@ -46199,7 +46009,7 @@ var Printer = class {
|
|
|
46199
46009
|
noLineTerminatorAfter || (noLineTerminatorAfter = parent && this._noLineTerminatorAfterNode === parent && isLastChild(parent, node));
|
|
46200
46010
|
|
|
46201
46011
|
if (noLineTerminatorAfter) {
|
|
46202
|
-
if (
|
|
46012
|
+
if (node.trailingComments?.some(commentIsNewline)) {
|
|
46203
46013
|
if (isExpression2(node))
|
|
46204
46014
|
shouldPrintParens = true;
|
|
46205
46015
|
} else {
|
|
@@ -46303,19 +46113,17 @@ var Printer = class {
|
|
|
46303
46113
|
getPossibleRaw(node) {
|
|
46304
46114
|
const extra = node.extra;
|
|
46305
46115
|
|
|
46306
|
-
if (
|
|
46116
|
+
if (extra?.raw != null && extra.rawValue != null && node.value === extra.rawValue) {
|
|
46307
46117
|
return extra.raw;
|
|
46308
46118
|
}
|
|
46309
46119
|
}
|
|
46310
46120
|
|
|
46311
46121
|
printJoin(nodes2, statement2, indent, separator, printTrailingSeparator, addNewlines, iterator, trailingCommentsLineOffset) {
|
|
46312
|
-
|
|
46313
|
-
|
|
46314
|
-
if (!(nodes2 == null ? void 0 : nodes2.length))
|
|
46122
|
+
if (!nodes2?.length)
|
|
46315
46123
|
return;
|
|
46316
46124
|
|
|
46317
46125
|
if (indent == null && this.format.retainLines) {
|
|
46318
|
-
const startLine =
|
|
46126
|
+
const startLine = nodes2[0].loc?.start.line;
|
|
46319
46127
|
|
|
46320
46128
|
if (startLine != null && startLine !== this._buf.getCurrentLine()) {
|
|
46321
46129
|
indent = true;
|
|
@@ -46330,7 +46138,7 @@ var Printer = class {
|
|
|
46330
46138
|
nextNodeStartLine: 0,
|
|
46331
46139
|
};
|
|
46332
46140
|
|
|
46333
|
-
const boundSeparator = separator
|
|
46141
|
+
const boundSeparator = separator?.bind(this);
|
|
46334
46142
|
const len = nodes2.length;
|
|
46335
46143
|
|
|
46336
46144
|
for (let i = 0; i < len; i++) {
|
|
@@ -46343,7 +46151,7 @@ var Printer = class {
|
|
|
46343
46151
|
this._printNewline(i === 0, newlineOpts);
|
|
46344
46152
|
|
|
46345
46153
|
this.print(node, void 0, trailingCommentsLineOffset || 0);
|
|
46346
|
-
iterator
|
|
46154
|
+
iterator?.(node, i);
|
|
46347
46155
|
|
|
46348
46156
|
if (boundSeparator != null) {
|
|
46349
46157
|
if (i < len - 1)
|
|
@@ -46353,7 +46161,7 @@ var Printer = class {
|
|
|
46353
46161
|
}
|
|
46354
46162
|
|
|
46355
46163
|
if (statement2) {
|
|
46356
|
-
if (!
|
|
46164
|
+
if (!node.trailingComments?.length) {
|
|
46357
46165
|
this._lastCommentLine = 0;
|
|
46358
46166
|
}
|
|
46359
46167
|
|
|
@@ -46362,7 +46170,7 @@ var Printer = class {
|
|
|
46362
46170
|
} else {
|
|
46363
46171
|
const nextNode = nodes2[i + 1];
|
|
46364
46172
|
|
|
46365
|
-
newlineOpts.nextNodeStartLine =
|
|
46173
|
+
newlineOpts.nextNodeStartLine = nextNode.loc?.start.line || 0;
|
|
46366
46174
|
this._printNewline(true, newlineOpts);
|
|
46367
46175
|
}
|
|
46368
46176
|
}
|
|
@@ -46400,11 +46208,11 @@ var Printer = class {
|
|
|
46400
46208
|
trailingComments,
|
|
46401
46209
|
} = node;
|
|
46402
46210
|
|
|
46403
|
-
if (innerComments
|
|
46211
|
+
if (innerComments?.length) {
|
|
46404
46212
|
this._printComments(2, innerComments, node, parent, lineOffset);
|
|
46405
46213
|
}
|
|
46406
46214
|
|
|
46407
|
-
if (trailingComments
|
|
46215
|
+
if (trailingComments?.length) {
|
|
46408
46216
|
this._printComments(2, trailingComments, node, parent, lineOffset);
|
|
46409
46217
|
}
|
|
46410
46218
|
}
|
|
@@ -46412,17 +46220,19 @@ var Printer = class {
|
|
|
46412
46220
|
_printLeadingComments(node, parent) {
|
|
46413
46221
|
const comments = node.leadingComments;
|
|
46414
46222
|
|
|
46415
|
-
if (!
|
|
46223
|
+
if (!comments?.length)
|
|
46416
46224
|
return;
|
|
46417
46225
|
|
|
46418
46226
|
this._printComments(0, comments, node, parent);
|
|
46419
46227
|
}
|
|
46420
46228
|
|
|
46421
46229
|
_maybePrintInnerComments(nextTokenStr, nextTokenOccurrenceCount) {
|
|
46422
|
-
var _a;
|
|
46423
|
-
|
|
46424
46230
|
if (this._endsWithInnerRaw) {
|
|
46425
|
-
this.printInnerComments(
|
|
46231
|
+
this.printInnerComments(this.tokenMap?.findMatching(
|
|
46232
|
+
this._currentNode,
|
|
46233
|
+
nextTokenStr,
|
|
46234
|
+
nextTokenOccurrenceCount,
|
|
46235
|
+
));
|
|
46426
46236
|
}
|
|
46427
46237
|
|
|
46428
46238
|
this._endsWithInnerRaw = true;
|
|
@@ -46433,7 +46243,7 @@ var Printer = class {
|
|
|
46433
46243
|
const node = this._currentNode;
|
|
46434
46244
|
const comments = node.innerComments;
|
|
46435
46245
|
|
|
46436
|
-
if (!
|
|
46246
|
+
if (!comments?.length)
|
|
46437
46247
|
return;
|
|
46438
46248
|
|
|
46439
46249
|
const hasSpace = this.endsWith(32);
|
|
@@ -46458,11 +46268,11 @@ var Printer = class {
|
|
|
46458
46268
|
}
|
|
46459
46269
|
|
|
46460
46270
|
printSequence(nodes2, indent, trailingCommentsLineOffset, addNewlines) {
|
|
46461
|
-
this.printJoin(nodes2, true, indent
|
|
46271
|
+
this.printJoin(nodes2, true, indent ?? false, void 0, void 0, addNewlines, void 0, trailingCommentsLineOffset);
|
|
46462
46272
|
}
|
|
46463
46273
|
|
|
46464
46274
|
printList(items, printTrailingSeparator, statement2, indent, separator, iterator) {
|
|
46465
|
-
this.printJoin(items, statement2, indent, separator
|
|
46275
|
+
this.printJoin(items, statement2, indent, separator ?? commaSeparator, printTrailingSeparator, void 0, iterator);
|
|
46466
46276
|
}
|
|
46467
46277
|
|
|
46468
46278
|
shouldPrintTrailingComma(listEnd) {
|
|
@@ -46538,7 +46348,6 @@ var Printer = class {
|
|
|
46538
46348
|
}
|
|
46539
46349
|
|
|
46540
46350
|
_printComment(comment, skipNewLines) {
|
|
46541
|
-
var _a;
|
|
46542
46351
|
const noLineTerminator = this._noLineTerminator;
|
|
46543
46352
|
const isBlockComment = comment.type === 'CommentBlock';
|
|
46544
46353
|
const printNewLines = isBlockComment && skipNewLines !== 1 && !this._noLineTerminator;
|
|
@@ -46559,7 +46368,7 @@ var Printer = class {
|
|
|
46559
46368
|
val = `/*${comment.value}*/`;
|
|
46560
46369
|
|
|
46561
46370
|
if (this.format.indent.adjustMultilineComment) {
|
|
46562
|
-
const offset =
|
|
46371
|
+
const offset = comment.loc?.start.column;
|
|
46563
46372
|
|
|
46564
46373
|
if (offset) {
|
|
46565
46374
|
const newlineRegex = new RegExp('\\n\\s{1,' + offset + '}', 'g');
|
|
@@ -46749,7 +46558,7 @@ function normalizeOptions(code2, opts, ast) {
|
|
|
46749
46558
|
}
|
|
46750
46559
|
|
|
46751
46560
|
if (!Array.isArray(ast.tokens)) {
|
|
46752
|
-
throw new Error('`experimental_preserveFormat` requires the AST to have
|
|
46561
|
+
throw new Error('`experimental_preserveFormat` requires the AST to have attached the token of the input code. Make sure to enable the `tokens: true` parser option.');
|
|
46753
46562
|
}
|
|
46754
46563
|
}
|
|
46755
46564
|
|
|
@@ -46823,8 +46632,78 @@ function generate(ast, opts = {}, code2) {
|
|
|
46823
46632
|
|
|
46824
46633
|
// node_modules/@babel/traverse/lib/index.js
|
|
46825
46634
|
var import_debug = __toESM(require_src(), 1);
|
|
46826
|
-
|
|
46827
|
-
|
|
46635
|
+
|
|
46636
|
+
// node_modules/@babel/helper-globals/data/builtin-lower.json
|
|
46637
|
+
var builtin_lower_default = [
|
|
46638
|
+
'decodeURI',
|
|
46639
|
+
'decodeURIComponent',
|
|
46640
|
+
'encodeURI',
|
|
46641
|
+
'encodeURIComponent',
|
|
46642
|
+
'escape',
|
|
46643
|
+
'eval',
|
|
46644
|
+
'globalThis',
|
|
46645
|
+
'isFinite',
|
|
46646
|
+
'isNaN',
|
|
46647
|
+
'parseFloat',
|
|
46648
|
+
'parseInt',
|
|
46649
|
+
'undefined',
|
|
46650
|
+
'unescape',
|
|
46651
|
+
];
|
|
46652
|
+
|
|
46653
|
+
// node_modules/@babel/helper-globals/data/builtin-upper.json
|
|
46654
|
+
var builtin_upper_default = [
|
|
46655
|
+
'AggregateError',
|
|
46656
|
+
'Array',
|
|
46657
|
+
'ArrayBuffer',
|
|
46658
|
+
'Atomics',
|
|
46659
|
+
'BigInt',
|
|
46660
|
+
'BigInt64Array',
|
|
46661
|
+
'BigUint64Array',
|
|
46662
|
+
'Boolean',
|
|
46663
|
+
'DataView',
|
|
46664
|
+
'Date',
|
|
46665
|
+
'Error',
|
|
46666
|
+
'EvalError',
|
|
46667
|
+
'FinalizationRegistry',
|
|
46668
|
+
'Float16Array',
|
|
46669
|
+
'Float32Array',
|
|
46670
|
+
'Float64Array',
|
|
46671
|
+
'Function',
|
|
46672
|
+
'Infinity',
|
|
46673
|
+
'Int16Array',
|
|
46674
|
+
'Int32Array',
|
|
46675
|
+
'Int8Array',
|
|
46676
|
+
'Intl',
|
|
46677
|
+
'Iterator',
|
|
46678
|
+
'JSON',
|
|
46679
|
+
'Map',
|
|
46680
|
+
'Math',
|
|
46681
|
+
'NaN',
|
|
46682
|
+
'Number',
|
|
46683
|
+
'Object',
|
|
46684
|
+
'Promise',
|
|
46685
|
+
'Proxy',
|
|
46686
|
+
'RangeError',
|
|
46687
|
+
'ReferenceError',
|
|
46688
|
+
'Reflect',
|
|
46689
|
+
'RegExp',
|
|
46690
|
+
'Set',
|
|
46691
|
+
'SharedArrayBuffer',
|
|
46692
|
+
'String',
|
|
46693
|
+
'Symbol',
|
|
46694
|
+
'SyntaxError',
|
|
46695
|
+
'TypeError',
|
|
46696
|
+
'Uint16Array',
|
|
46697
|
+
'Uint32Array',
|
|
46698
|
+
'Uint8Array',
|
|
46699
|
+
'Uint8ClampedArray',
|
|
46700
|
+
'URIError',
|
|
46701
|
+
'WeakMap',
|
|
46702
|
+
'WeakRef',
|
|
46703
|
+
'WeakSet',
|
|
46704
|
+
];
|
|
46705
|
+
|
|
46706
|
+
// node_modules/@babel/traverse/lib/index.js
|
|
46828
46707
|
var ReferencedIdentifier = [
|
|
46829
46708
|
'Identifier',
|
|
46830
46709
|
'JSXIdentifier',
|
|
@@ -47019,13 +46898,11 @@ function isFlow2() {
|
|
|
47019
46898
|
}
|
|
47020
46899
|
|
|
47021
46900
|
function isRestProperty2() {
|
|
47022
|
-
|
|
47023
|
-
return nodeIsRestElement(this.node) && ((_a = this.parentPath) == null ? void 0 : _a.isObjectPattern());
|
|
46901
|
+
return nodeIsRestElement(this.node) && this.parentPath?.isObjectPattern();
|
|
47024
46902
|
}
|
|
47025
46903
|
|
|
47026
46904
|
function isSpreadProperty2() {
|
|
47027
|
-
|
|
47028
|
-
return nodeIsRestElement(this.node) && ((_a = this.parentPath) == null ? void 0 : _a.isObjectExpression());
|
|
46905
|
+
return nodeIsRestElement(this.node) && this.parentPath?.isObjectExpression();
|
|
47029
46906
|
}
|
|
47030
46907
|
|
|
47031
46908
|
function isForAwaitStatement() {
|
|
@@ -47067,7 +46944,7 @@ function isVirtualType(type) {
|
|
|
47067
46944
|
}
|
|
47068
46945
|
|
|
47069
46946
|
function isExplodedVisitor(visitor) {
|
|
47070
|
-
return visitor
|
|
46947
|
+
return visitor?._exploded;
|
|
47071
46948
|
}
|
|
47072
46949
|
|
|
47073
46950
|
function explode$1(visitor) {
|
|
@@ -47184,7 +47061,7 @@ function verify$1(visitor) {
|
|
|
47184
47061
|
continue;
|
|
47185
47062
|
|
|
47186
47063
|
if (!TYPES2.includes(nodeType)) {
|
|
47187
|
-
throw new Error(`You gave us a visitor for the node type ${nodeType} but it's not a valid type in @babel/traverse ${'8.0.0-beta.
|
|
47064
|
+
throw new Error(`You gave us a visitor for the node type ${nodeType} but it's not a valid type in @babel/traverse ${'8.0.0-beta.2'}`);
|
|
47188
47065
|
}
|
|
47189
47066
|
|
|
47190
47067
|
const visitors2 = visitor[nodeType];
|
|
@@ -47266,7 +47143,7 @@ function wrapWithStateOrWrapper(oldVisitor, state, wrapper) {
|
|
|
47266
47143
|
}
|
|
47267
47144
|
|
|
47268
47145
|
if (wrapper) {
|
|
47269
|
-
newFn = wrapper(state
|
|
47146
|
+
newFn = wrapper(state?.key, phase, newFn);
|
|
47270
47147
|
}
|
|
47271
47148
|
|
|
47272
47149
|
if (newFn !== fn) {
|
|
@@ -47637,9 +47514,6 @@ var cache = /* @__PURE__ */Object.freeze({
|
|
|
47637
47514
|
},
|
|
47638
47515
|
});
|
|
47639
47516
|
|
|
47640
|
-
var globalsBuiltinLower = require('@babel/helper-globals/data/builtin-lower.json');
|
|
47641
|
-
var globalsBuiltinUpper = require('@babel/helper-globals/data/builtin-upper.json');
|
|
47642
|
-
|
|
47643
47517
|
var {
|
|
47644
47518
|
assignmentExpression: assignmentExpression$3,
|
|
47645
47519
|
callExpression: callExpression$3,
|
|
@@ -47692,14 +47566,12 @@ var {
|
|
|
47692
47566
|
} = lib_exports;
|
|
47693
47567
|
|
|
47694
47568
|
function gatherNodeParts(node, parts) {
|
|
47695
|
-
|
|
47696
|
-
|
|
47697
|
-
switch(node == null ? void 0 : node.type) {
|
|
47569
|
+
switch(node?.type) {
|
|
47698
47570
|
default:
|
|
47699
47571
|
if (isImportDeclaration2(node) || isExportDeclaration2(node)) {
|
|
47700
47572
|
if ((isExportAllDeclaration2(node) || isExportNamedDeclaration$1(node) || isImportDeclaration2(node)) && node.source) {
|
|
47701
47573
|
gatherNodeParts(node.source, parts);
|
|
47702
|
-
} else if ((isExportNamedDeclaration$1(node) || isImportDeclaration2(node)) &&
|
|
47574
|
+
} else if ((isExportNamedDeclaration$1(node) || isImportDeclaration2(node)) && node.specifiers?.length) {
|
|
47703
47575
|
for (const e of node.specifiers)
|
|
47704
47576
|
gatherNodeParts(e, parts);
|
|
47705
47577
|
} else if ((isExportDefaultDeclaration3(node) || isExportNamedDeclaration$1(node)) && node.declaration) {
|
|
@@ -47918,20 +47790,19 @@ var collectorVisitor = {
|
|
|
47918
47790
|
return;
|
|
47919
47791
|
|
|
47920
47792
|
const binding = scope2.getBinding(id.name);
|
|
47921
|
-
binding
|
|
47793
|
+
binding?.reference(path);
|
|
47922
47794
|
} else if (isVariableDeclaration$1(declar)) {
|
|
47923
47795
|
for (const decl of declar.declarations) {
|
|
47924
47796
|
for (const name of Object.keys(getBindingIdentifiers$3(decl))) {
|
|
47925
47797
|
const binding = scope2.getBinding(name);
|
|
47926
|
-
binding
|
|
47798
|
+
binding?.reference(path);
|
|
47927
47799
|
}
|
|
47928
47800
|
}
|
|
47929
47801
|
}
|
|
47930
47802
|
},
|
|
47931
47803
|
},
|
|
47932
47804
|
LabeledStatement(path) {
|
|
47933
|
-
path
|
|
47934
|
-
.scope
|
|
47805
|
+
path.scope
|
|
47935
47806
|
.getBlockParent()
|
|
47936
47807
|
.registerDeclaration(path);
|
|
47937
47808
|
},
|
|
@@ -48006,7 +47877,7 @@ var _Scope = class _Scope {
|
|
|
48006
47877
|
|
|
48007
47878
|
const cached = scope.get(node);
|
|
48008
47879
|
|
|
48009
|
-
if (
|
|
47880
|
+
if (cached?.path === path) {
|
|
48010
47881
|
return cached;
|
|
48011
47882
|
}
|
|
48012
47883
|
|
|
@@ -48029,11 +47900,11 @@ var _Scope = class _Scope {
|
|
|
48029
47900
|
if (shouldSkip && path.isMethod())
|
|
48030
47901
|
path = path.parentPath;
|
|
48031
47902
|
|
|
48032
|
-
if (path
|
|
47903
|
+
if (path?.isScope())
|
|
48033
47904
|
parent = path;
|
|
48034
47905
|
} while (path && !parent)
|
|
48035
47906
|
|
|
48036
|
-
return parent
|
|
47907
|
+
return parent?.scope;
|
|
48037
47908
|
}
|
|
48038
47909
|
|
|
48039
47910
|
get references() {
|
|
@@ -48249,11 +48120,10 @@ var _Scope = class _Scope {
|
|
|
48249
48120
|
}
|
|
48250
48121
|
|
|
48251
48122
|
registerConstantViolation(path) {
|
|
48252
|
-
var _a;
|
|
48253
48123
|
const ids = path.getAssignmentIdentifiers();
|
|
48254
48124
|
|
|
48255
48125
|
for (const name of Object.keys(ids)) {
|
|
48256
|
-
|
|
48126
|
+
this.getBinding(name)?.reassign(path);
|
|
48257
48127
|
}
|
|
48258
48128
|
}
|
|
48259
48129
|
|
|
@@ -48337,8 +48207,6 @@ var _Scope = class _Scope {
|
|
|
48337
48207
|
}
|
|
48338
48208
|
|
|
48339
48209
|
isPure(node, constantsOnly) {
|
|
48340
|
-
var _a, _b, _c;
|
|
48341
|
-
|
|
48342
48210
|
if (isIdentifier$5(node)) {
|
|
48343
48211
|
const binding = this.getBinding(node.name);
|
|
48344
48212
|
|
|
@@ -48356,7 +48224,7 @@ var _Scope = class _Scope {
|
|
|
48356
48224
|
return false;
|
|
48357
48225
|
}
|
|
48358
48226
|
|
|
48359
|
-
if (
|
|
48227
|
+
if (node.decorators?.length > 0) {
|
|
48360
48228
|
return false;
|
|
48361
48229
|
}
|
|
48362
48230
|
|
|
@@ -48388,7 +48256,7 @@ var _Scope = class _Scope {
|
|
|
48388
48256
|
if (node.computed && !this.isPure(node.key, constantsOnly))
|
|
48389
48257
|
return false;
|
|
48390
48258
|
|
|
48391
|
-
if (
|
|
48259
|
+
if (node.decorators?.length > 0) {
|
|
48392
48260
|
return false;
|
|
48393
48261
|
}
|
|
48394
48262
|
|
|
@@ -48397,7 +48265,7 @@ var _Scope = class _Scope {
|
|
|
48397
48265
|
if (node.computed && !this.isPure(node.key, constantsOnly))
|
|
48398
48266
|
return false;
|
|
48399
48267
|
|
|
48400
|
-
if (
|
|
48268
|
+
if (node.decorators?.length > 0) {
|
|
48401
48269
|
return false;
|
|
48402
48270
|
}
|
|
48403
48271
|
|
|
@@ -48687,7 +48555,8 @@ collectorVisitor]));
|
|
|
48687
48555
|
const binding = scope2.getOwnBinding(name);
|
|
48688
48556
|
|
|
48689
48557
|
if (binding) {
|
|
48690
|
-
if (
|
|
48558
|
+
if (previousPath?.isPattern() && binding.kind !== 'param' && binding.kind !== 'local');
|
|
48559
|
+
else {
|
|
48691
48560
|
return binding;
|
|
48692
48561
|
}
|
|
48693
48562
|
} else if (!binding && name === 'arguments' && scope2.path.isFunction() && !scope2.path.isArrowFunctionExpression()) {
|
|
@@ -48703,13 +48572,12 @@ collectorVisitor]));
|
|
|
48703
48572
|
}
|
|
48704
48573
|
|
|
48705
48574
|
getBindingIdentifier(name) {
|
|
48706
|
-
|
|
48707
|
-
return (_a = this.getBinding(name)) == null ? void 0 : _a.identifier;
|
|
48575
|
+
return this.getBinding(name)?.identifier;
|
|
48708
48576
|
}
|
|
48709
48577
|
|
|
48710
48578
|
getOwnBindingIdentifier(name) {
|
|
48711
48579
|
const binding = this.bindings[name];
|
|
48712
|
-
return binding
|
|
48580
|
+
return binding?.identifier;
|
|
48713
48581
|
}
|
|
48714
48582
|
|
|
48715
48583
|
hasOwnBinding(name) {
|
|
@@ -48756,8 +48624,7 @@ collectorVisitor]));
|
|
|
48756
48624
|
}
|
|
48757
48625
|
|
|
48758
48626
|
parentHasBinding(name, opts) {
|
|
48759
|
-
|
|
48760
|
-
return (_a = this.parent) == null ? void 0 : _a.hasBinding(name, opts);
|
|
48627
|
+
return this.parent?.hasBinding(name, opts);
|
|
48761
48628
|
}
|
|
48762
48629
|
|
|
48763
48630
|
moveBindingTo(name, scope2) {
|
|
@@ -48775,8 +48642,7 @@ collectorVisitor]));
|
|
|
48775
48642
|
}
|
|
48776
48643
|
|
|
48777
48644
|
removeBinding(name) {
|
|
48778
|
-
|
|
48779
|
-
(_a = this.getBinding(name)) == null ? void 0 : _a.scope.removeOwnBinding(name);
|
|
48645
|
+
this.getBinding(name)?.scope.removeOwnBinding(name);
|
|
48780
48646
|
{
|
|
48781
48647
|
this
|
|
48782
48648
|
.getProgramParent()
|
|
@@ -48812,7 +48678,7 @@ collectorVisitor]));
|
|
|
48812
48678
|
const init = [];
|
|
48813
48679
|
|
|
48814
48680
|
for (const decl of parent.declarations) {
|
|
48815
|
-
firstId
|
|
48681
|
+
firstId ?? (firstId = decl.id);
|
|
48816
48682
|
|
|
48817
48683
|
if (decl.init) {
|
|
48818
48684
|
init.push(assignmentExpression$3('=', decl.id, decl.init));
|
|
@@ -48842,7 +48708,7 @@ collectorVisitor]));
|
|
|
48842
48708
|
}
|
|
48843
48709
|
};
|
|
48844
48710
|
|
|
48845
|
-
__publicField(_Scope, 'globals', [...
|
|
48711
|
+
__publicField(_Scope, 'globals', [...builtin_lower_default, ...builtin_upper_default]);
|
|
48846
48712
|
__publicField(_Scope, 'contextVariables', [
|
|
48847
48713
|
'arguments',
|
|
48848
48714
|
'undefined',
|
|
@@ -49056,6 +48922,7 @@ function infererReference(node) {
|
|
|
49056
48922
|
} else if (node.name === 'NaN' || node.name === 'Infinity') {
|
|
49057
48923
|
return numberTypeAnnotation$1();
|
|
49058
48924
|
} else if (node.name === 'arguments');
|
|
48925
|
+
|
|
49059
48926
|
}
|
|
49060
48927
|
|
|
49061
48928
|
function getTypeAnnotationBindingConstantViolations(binding, path, name) {
|
|
@@ -49437,6 +49304,7 @@ function resolveCall(callee) {
|
|
|
49437
49304
|
return callee.node.returnType;
|
|
49438
49305
|
} else
|
|
49439
49306
|
;
|
|
49307
|
+
|
|
49440
49308
|
}
|
|
49441
49309
|
}
|
|
49442
49310
|
}
|
|
@@ -49557,7 +49425,7 @@ function _getTypeAnnotation() {
|
|
|
49557
49425
|
|
|
49558
49426
|
inferer = inferers[this.parentPath.type];
|
|
49559
49427
|
|
|
49560
|
-
if (inferer
|
|
49428
|
+
if (inferer?.validParent) {
|
|
49561
49429
|
return this.parentPath.getTypeAnnotation();
|
|
49562
49430
|
}
|
|
49563
49431
|
} finally {
|
|
@@ -49695,7 +49563,6 @@ var hooks = [
|
|
|
49695
49563
|
var {getBindingIdentifiers: getBindingIdentifiers$2} = lib_exports;
|
|
49696
49564
|
|
|
49697
49565
|
function remove() {
|
|
49698
|
-
var _a;
|
|
49699
49566
|
_assertUnremoved.call(this);
|
|
49700
49567
|
resync.call(this);
|
|
49701
49568
|
|
|
@@ -49704,7 +49571,7 @@ function remove() {
|
|
|
49704
49571
|
return;
|
|
49705
49572
|
}
|
|
49706
49573
|
|
|
49707
|
-
if (!
|
|
49574
|
+
if (!this.opts?.noScope) {
|
|
49708
49575
|
_removeFromScope.call(this);
|
|
49709
49576
|
}
|
|
49710
49577
|
|
|
@@ -49739,12 +49606,10 @@ function _remove() {
|
|
|
49739
49606
|
}
|
|
49740
49607
|
|
|
49741
49608
|
function _markRemoved() {
|
|
49742
|
-
var _a;
|
|
49743
|
-
|
|
49744
49609
|
this._traverseFlags |= SHOULD_SKIP | REMOVED;
|
|
49745
49610
|
|
|
49746
49611
|
if (this.parent) {
|
|
49747
|
-
|
|
49612
|
+
getCachedPaths(this)?.delete(this.node);
|
|
49748
49613
|
}
|
|
49749
49614
|
|
|
49750
49615
|
this.node = null;
|
|
@@ -49791,8 +49656,9 @@ function insertBefore(nodes_) {
|
|
|
49791
49656
|
} else if (this.isStatementOrBlock()) {
|
|
49792
49657
|
const node = this.node;
|
|
49793
49658
|
const shouldInsertCurrentNode = node && (!this.isExpressionStatement() || node.expression != null);
|
|
49794
|
-
this.replaceWith(blockStatement$2(shouldInsertCurrentNode ? [node] : []));
|
|
49795
|
-
|
|
49659
|
+
const [blockPath] = this.replaceWith(blockStatement$2(shouldInsertCurrentNode ? [node] : []));
|
|
49660
|
+
|
|
49661
|
+
return blockPath.unshiftContainer('body', nodes2);
|
|
49796
49662
|
} else {
|
|
49797
49663
|
throw new Error('We don\'t know what to do with this node type. We were previously a Statement but we can\'t fit in here?');
|
|
49798
49664
|
}
|
|
@@ -49801,7 +49667,6 @@ function insertBefore(nodes_) {
|
|
|
49801
49667
|
}
|
|
49802
49668
|
|
|
49803
49669
|
function _containerInsert(from, nodes2) {
|
|
49804
|
-
var _a;
|
|
49805
49670
|
updateSiblingKeys.call(this, from, nodes2.length);
|
|
49806
49671
|
const paths = [];
|
|
49807
49672
|
this.container.splice(from, 0, ...nodes2);
|
|
@@ -49810,7 +49675,7 @@ function _containerInsert(from, nodes2) {
|
|
|
49810
49675
|
const path = this.getSibling(to);
|
|
49811
49676
|
paths.push(path);
|
|
49812
49677
|
|
|
49813
|
-
if (
|
|
49678
|
+
if (this.context?.queue) {
|
|
49814
49679
|
pushContext.call(path, this.context);
|
|
49815
49680
|
}
|
|
49816
49681
|
}
|
|
@@ -49911,8 +49776,9 @@ function insertAfter(nodes_) {
|
|
|
49911
49776
|
} else if (this.isStatementOrBlock()) {
|
|
49912
49777
|
const node = this.node;
|
|
49913
49778
|
const shouldInsertCurrentNode = node && (!this.isExpressionStatement() || node.expression != null);
|
|
49914
|
-
this.replaceWith(blockStatement$2(shouldInsertCurrentNode ? [node] : []));
|
|
49915
|
-
|
|
49779
|
+
const [blockPath] = this.replaceWith(blockStatement$2(shouldInsertCurrentNode ? [node] : []));
|
|
49780
|
+
|
|
49781
|
+
return blockPath.pushContainer('body', nodes2);
|
|
49916
49782
|
} else {
|
|
49917
49783
|
throw new Error('We don\'t know what to do with this node type. We were previously a Statement but we can\'t fit in here?');
|
|
49918
49784
|
}
|
|
@@ -49971,16 +49837,18 @@ function _verifyNodeList(nodes2) {
|
|
|
49971
49837
|
|
|
49972
49838
|
function unshiftContainer(listKey, nodes2) {
|
|
49973
49839
|
_assertUnremoved.call(this);
|
|
49974
|
-
|
|
49840
|
+
const verifiedNodes = _verifyNodeList.call(this, nodes2);
|
|
49841
|
+
const container = this.node[listKey];
|
|
49842
|
+
|
|
49975
49843
|
const path = NodePath_Final.get({
|
|
49976
49844
|
parentPath: this,
|
|
49977
49845
|
parent: this.node,
|
|
49978
|
-
container
|
|
49846
|
+
container,
|
|
49979
49847
|
listKey,
|
|
49980
49848
|
key: 0,
|
|
49981
49849
|
}).setContext(this.context);
|
|
49982
49850
|
|
|
49983
|
-
return _containerInsertBefore.call(path,
|
|
49851
|
+
return _containerInsertBefore.call(path, verifiedNodes);
|
|
49984
49852
|
}
|
|
49985
49853
|
|
|
49986
49854
|
function pushContainer(listKey, nodes2) {
|
|
@@ -50031,12 +49899,11 @@ var {
|
|
|
50031
49899
|
} = lib_exports;
|
|
50032
49900
|
|
|
50033
49901
|
function replaceWithMultiple(nodes2) {
|
|
50034
|
-
var _a;
|
|
50035
49902
|
resync.call(this);
|
|
50036
|
-
|
|
50037
|
-
inheritLeadingComments2(
|
|
50038
|
-
inheritTrailingComments2(
|
|
50039
|
-
|
|
49903
|
+
const verifiedNodes = _verifyNodeList.call(this, nodes2);
|
|
49904
|
+
inheritLeadingComments2(verifiedNodes[0], this.node);
|
|
49905
|
+
inheritTrailingComments2(verifiedNodes[verifiedNodes.length - 1], this.node);
|
|
49906
|
+
getCachedPaths(this)?.delete(this.node);
|
|
50040
49907
|
this.node =
|
|
50041
49908
|
this.container[this.key] = null;
|
|
50042
49909
|
const paths = this.insertAfter(nodes2);
|
|
@@ -50142,8 +50009,6 @@ function replaceWith(replacementPath) {
|
|
|
50142
50009
|
}
|
|
50143
50010
|
|
|
50144
50011
|
function _replaceWith(node) {
|
|
50145
|
-
var _a;
|
|
50146
|
-
|
|
50147
50012
|
if (!this.container) {
|
|
50148
50013
|
throw new ReferenceError('Container is falsy');
|
|
50149
50014
|
}
|
|
@@ -50154,10 +50019,8 @@ function _replaceWith(node) {
|
|
|
50154
50019
|
validate$13(this.parent, this.key, node);
|
|
50155
50020
|
}
|
|
50156
50021
|
|
|
50157
|
-
this.debug(`Replace with ${node
|
|
50158
|
-
(
|
|
50159
|
-
.set(node, this)
|
|
50160
|
-
.delete(this.node);
|
|
50022
|
+
this.debug(`Replace with ${node?.type}`);
|
|
50023
|
+
getCachedPaths(this)?.set(node, this).delete(this.node);
|
|
50161
50024
|
this.node =
|
|
50162
50025
|
this.container[this.key] = node;
|
|
50163
50026
|
}
|
|
@@ -50179,8 +50042,8 @@ function replaceExpressionWithStatements(nodes2) {
|
|
|
50179
50042
|
}
|
|
50180
50043
|
|
|
50181
50044
|
const functionParent = this.getFunctionParent();
|
|
50182
|
-
const isParentAsync = functionParent
|
|
50183
|
-
const isParentGenerator = functionParent
|
|
50045
|
+
const isParentAsync = functionParent?.node.async;
|
|
50046
|
+
const isParentGenerator = functionParent?.node.generator;
|
|
50184
50047
|
const container = arrowFunctionExpression$1([], blockStatement$1(nodes2));
|
|
50185
50048
|
|
|
50186
50049
|
this.replaceWith(callExpression$1(container, []));
|
|
@@ -50406,8 +50269,6 @@ function evaluateCached(path, state) {
|
|
|
50406
50269
|
}
|
|
50407
50270
|
|
|
50408
50271
|
function _evaluate(path, state) {
|
|
50409
|
-
var _a;
|
|
50410
|
-
|
|
50411
50272
|
if (!state.confident)
|
|
50412
50273
|
return;
|
|
50413
50274
|
|
|
@@ -50508,7 +50369,7 @@ function _evaluate(path, state) {
|
|
|
50508
50369
|
break;
|
|
50509
50370
|
}
|
|
50510
50371
|
|
|
50511
|
-
if (
|
|
50372
|
+
if (scope2.path.parentPath?.isBlockStatement()) {
|
|
50512
50373
|
hasUnsafeBlock = true;
|
|
50513
50374
|
}
|
|
50514
50375
|
}
|
|
@@ -50674,7 +50535,7 @@ function _evaluate(path, state) {
|
|
|
50674
50535
|
if (!state.confident)
|
|
50675
50536
|
return;
|
|
50676
50537
|
|
|
50677
|
-
return left
|
|
50538
|
+
return left ?? right;
|
|
50678
50539
|
}
|
|
50679
50540
|
}
|
|
50680
50541
|
|
|
@@ -50706,7 +50567,7 @@ function _evaluate(path, state) {
|
|
|
50706
50567
|
return left % right;
|
|
50707
50568
|
|
|
50708
50569
|
case '**':
|
|
50709
|
-
return
|
|
50570
|
+
return left ** right;
|
|
50710
50571
|
|
|
50711
50572
|
case '<':
|
|
50712
50573
|
return left < right;
|
|
@@ -50952,8 +50813,6 @@ function setType(path, type) {
|
|
|
50952
50813
|
}
|
|
50953
50814
|
|
|
50954
50815
|
function arrowFunctionToExpression({allowInsertArrow = true, allowInsertArrowWithRest = allowInsertArrow, noNewArrows = true} = {}) {
|
|
50955
|
-
var _a;
|
|
50956
|
-
|
|
50957
50816
|
if (!this.isArrowFunctionExpression()) {
|
|
50958
50817
|
throw this.buildCodeFrameError('Cannot convert non-arrow function to a function expression.');
|
|
50959
50818
|
}
|
|
@@ -50961,7 +50820,7 @@ function arrowFunctionToExpression({allowInsertArrow = true, allowInsertArrowWit
|
|
|
50961
50820
|
let self = this;
|
|
50962
50821
|
|
|
50963
50822
|
if (!noNewArrows) {
|
|
50964
|
-
self =
|
|
50823
|
+
self = self.ensureFunctionName(false) ?? self;
|
|
50965
50824
|
}
|
|
50966
50825
|
|
|
50967
50826
|
const {thisBinding, fnPath: fn} = hoistFunctionEnvironment(self, noNewArrows, allowInsertArrow, allowInsertArrowWithRest);
|
|
@@ -51000,7 +50859,7 @@ function hoistFunctionEnvironment(fnPath, noNewArrows = true, allowInsertArrow =
|
|
|
51000
50859
|
let arrowParent;
|
|
51001
50860
|
let thisEnvFn = fnPath.findParent((p) => {
|
|
51002
50861
|
if (p.isArrowFunctionExpression()) {
|
|
51003
|
-
arrowParent
|
|
50862
|
+
arrowParent ?? (arrowParent = p);
|
|
51004
50863
|
return false;
|
|
51005
50864
|
}
|
|
51006
50865
|
|
|
@@ -51883,7 +51742,7 @@ function resolve2(dangerous, resolved) {
|
|
|
51883
51742
|
}
|
|
51884
51743
|
|
|
51885
51744
|
function _resolve(dangerous, resolved) {
|
|
51886
|
-
if (resolved
|
|
51745
|
+
if (resolved?.includes(this))
|
|
51887
51746
|
return;
|
|
51888
51747
|
|
|
51889
51748
|
resolved = resolved || [];
|
|
@@ -52511,7 +52370,7 @@ function shareCommentsWithSiblings() {
|
|
|
52511
52370
|
}
|
|
52512
52371
|
|
|
52513
52372
|
function removeIfExisting(list, toRemove) {
|
|
52514
|
-
if (!
|
|
52373
|
+
if (!toRemove?.length)
|
|
52515
52374
|
return list;
|
|
52516
52375
|
|
|
52517
52376
|
const set = new Set(toRemove);
|
|
@@ -52820,7 +52679,7 @@ var TraversalContext = class {
|
|
|
52820
52679
|
|
|
52821
52680
|
const keys2 = VISITOR_KEYS$2[node.type];
|
|
52822
52681
|
|
|
52823
|
-
if (!
|
|
52682
|
+
if (!keys2?.length)
|
|
52824
52683
|
return false;
|
|
52825
52684
|
|
|
52826
52685
|
for (const key of keys2) {
|
|
@@ -52996,7 +52855,6 @@ function _visitPaths(ctx, paths) {
|
|
|
52996
52855
|
}
|
|
52997
52856
|
|
|
52998
52857
|
function _visit(ctx, path) {
|
|
52999
|
-
var _a, _b, _c, _d;
|
|
53000
52858
|
const node = path.node;
|
|
53001
52859
|
|
|
53002
52860
|
if (!node) {
|
|
@@ -53004,13 +52862,13 @@ function _visit(ctx, path) {
|
|
|
53004
52862
|
}
|
|
53005
52863
|
|
|
53006
52864
|
const opts = ctx.opts;
|
|
53007
|
-
const denylist =
|
|
52865
|
+
const denylist = opts.denylist ?? opts.blacklist;
|
|
53008
52866
|
|
|
53009
|
-
if (denylist
|
|
52867
|
+
if (denylist?.includes(node.type)) {
|
|
53010
52868
|
return false;
|
|
53011
52869
|
}
|
|
53012
52870
|
|
|
53013
|
-
if (
|
|
52871
|
+
if (opts.shouldSkip?.(path)) {
|
|
53014
52872
|
return false;
|
|
53015
52873
|
}
|
|
53016
52874
|
|
|
@@ -53021,7 +52879,7 @@ function _visit(ctx, path) {
|
|
|
53021
52879
|
return path.shouldStop;
|
|
53022
52880
|
|
|
53023
52881
|
if (path.node) {
|
|
53024
|
-
if (_call.call(path,
|
|
52882
|
+
if (_call.call(path, opts[node.type]?.enter))
|
|
53025
52883
|
return path.shouldStop;
|
|
53026
52884
|
}
|
|
53027
52885
|
|
|
@@ -53033,7 +52891,7 @@ function _visit(ctx, path) {
|
|
|
53033
52891
|
}
|
|
53034
52892
|
|
|
53035
52893
|
if (path.node) {
|
|
53036
|
-
_call.call(path,
|
|
52894
|
+
_call.call(path, opts[node.type]?.exit);
|
|
53037
52895
|
}
|
|
53038
52896
|
|
|
53039
52897
|
return path.shouldStop;
|
|
@@ -53042,20 +52900,20 @@ function _visit(ctx, path) {
|
|
|
53042
52900
|
function _traverse(node, opts, scope2, state, path, skipKeys, visitSelf) {
|
|
53043
52901
|
const keys2 = VISITOR_KEYS$12[node.type];
|
|
53044
52902
|
|
|
53045
|
-
if (!
|
|
52903
|
+
if (!keys2?.length)
|
|
53046
52904
|
return false;
|
|
53047
52905
|
|
|
53048
52906
|
const ctx = new TraversalContext(scope2, opts, state, path);
|
|
53049
52907
|
|
|
53050
52908
|
if (visitSelf) {
|
|
53051
|
-
if (skipKeys
|
|
52909
|
+
if (skipKeys?.[path.parentKey])
|
|
53052
52910
|
return false;
|
|
53053
52911
|
|
|
53054
52912
|
return _visitPaths(ctx, [path]);
|
|
53055
52913
|
}
|
|
53056
52914
|
|
|
53057
52915
|
for (const key of keys2) {
|
|
53058
|
-
if (skipKeys
|
|
52916
|
+
if (skipKeys?.[key])
|
|
53059
52917
|
continue;
|
|
53060
52918
|
|
|
53061
52919
|
const prop = node[key];
|
|
@@ -53102,7 +52960,6 @@ function traverseNode(node, opts, scope2, state, path, skipKeys, visitSelf) {
|
|
|
53102
52960
|
}
|
|
53103
52961
|
|
|
53104
52962
|
function call(key) {
|
|
53105
|
-
var _a;
|
|
53106
52963
|
const opts = this.opts;
|
|
53107
52964
|
this.debug(key);
|
|
53108
52965
|
|
|
@@ -53112,7 +52969,7 @@ function call(key) {
|
|
|
53112
52969
|
}
|
|
53113
52970
|
|
|
53114
52971
|
if (this.node) {
|
|
53115
|
-
return _call.call(this,
|
|
52972
|
+
return _call.call(this, opts[this.node.type]?.[key]);
|
|
53116
52973
|
}
|
|
53117
52974
|
|
|
53118
52975
|
return false;
|
|
@@ -53152,10 +53009,8 @@ function _call(fns) {
|
|
|
53152
53009
|
}
|
|
53153
53010
|
|
|
53154
53011
|
function isDenylisted() {
|
|
53155
|
-
|
|
53156
|
-
|
|
53157
|
-
|
|
53158
|
-
return denylist == null ? void 0 : denylist.includes(this.node.type);
|
|
53012
|
+
const denylist = this.opts.denylist ?? this.opts.blacklist;
|
|
53013
|
+
return denylist?.includes(this.node.type);
|
|
53159
53014
|
}
|
|
53160
53015
|
|
|
53161
53016
|
function restoreContext(path, context) {
|
|
@@ -53167,8 +53022,6 @@ function restoreContext(path, context) {
|
|
|
53167
53022
|
}
|
|
53168
53023
|
|
|
53169
53024
|
function visit() {
|
|
53170
|
-
var _a, _b;
|
|
53171
|
-
|
|
53172
53025
|
if (!this.node) {
|
|
53173
53026
|
return false;
|
|
53174
53027
|
}
|
|
@@ -53177,7 +53030,7 @@ function visit() {
|
|
|
53177
53030
|
return false;
|
|
53178
53031
|
}
|
|
53179
53032
|
|
|
53180
|
-
if (
|
|
53033
|
+
if (this.opts.shouldSkip?.(this)) {
|
|
53181
53034
|
return false;
|
|
53182
53035
|
}
|
|
53183
53036
|
|
|
@@ -53213,9 +53066,7 @@ function stop() {
|
|
|
53213
53066
|
}
|
|
53214
53067
|
|
|
53215
53068
|
function setScope() {
|
|
53216
|
-
|
|
53217
|
-
|
|
53218
|
-
if ((_a = this.opts) == null ? void 0 : _a.noScope)
|
|
53069
|
+
if (this.opts?.noScope)
|
|
53219
53070
|
return;
|
|
53220
53071
|
|
|
53221
53072
|
let path = this.parentPath;
|
|
@@ -53227,7 +53078,7 @@ function setScope() {
|
|
|
53227
53078
|
let target;
|
|
53228
53079
|
|
|
53229
53080
|
while (path && !target) {
|
|
53230
|
-
if (
|
|
53081
|
+
if (path.opts?.noScope)
|
|
53231
53082
|
return;
|
|
53232
53083
|
|
|
53233
53084
|
target = path.scope;
|
|
@@ -53235,7 +53086,7 @@ function setScope() {
|
|
|
53235
53086
|
}
|
|
53236
53087
|
|
|
53237
53088
|
this.scope = this.getScope(target);
|
|
53238
|
-
|
|
53089
|
+
this.scope?.init();
|
|
53239
53090
|
}
|
|
53240
53091
|
|
|
53241
53092
|
function setContext(context) {
|
|
@@ -53332,11 +53183,9 @@ function setup(parentPath, container, listKey, key) {
|
|
|
53332
53183
|
}
|
|
53333
53184
|
|
|
53334
53185
|
function setKey(key) {
|
|
53335
|
-
var _a;
|
|
53336
|
-
|
|
53337
53186
|
this.key = key;
|
|
53338
53187
|
this.node = this.container[this.key];
|
|
53339
|
-
this.type =
|
|
53188
|
+
this.type = this.node?.type;
|
|
53340
53189
|
}
|
|
53341
53190
|
|
|
53342
53191
|
function requeue(pathToQueue = this) {
|
|
@@ -53429,14 +53278,14 @@ traverse3.removeProperties = function(tree, opts) {
|
|
|
53429
53278
|
return tree;
|
|
53430
53279
|
};
|
|
53431
53280
|
traverse3.hasType = function(tree, type, denylistTypes) {
|
|
53432
|
-
if (denylistTypes
|
|
53281
|
+
if (denylistTypes?.includes(tree.type))
|
|
53433
53282
|
return false;
|
|
53434
53283
|
|
|
53435
53284
|
if (tree.type === type)
|
|
53436
53285
|
return true;
|
|
53437
53286
|
|
|
53438
53287
|
return traverseFast3(tree, function(node) {
|
|
53439
|
-
if (denylistTypes
|
|
53288
|
+
if (denylistTypes?.includes(node.type)) {
|
|
53440
53289
|
return traverseFast3.skip;
|
|
53441
53290
|
}
|
|
53442
53291
|
|