@putout/babel 4.1.0 → 4.1.1
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/bundle/index.js +271 -493
- package/package.json +1 -1
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) {
|
|
@@ -8832,8 +8782,6 @@ function isMemberExpressionLike(node) {
|
|
|
8832
8782
|
}
|
|
8833
8783
|
|
|
8834
8784
|
function matchesPattern(member, match, allowPartial) {
|
|
8835
|
-
var _a;
|
|
8836
|
-
|
|
8837
8785
|
if (!isMemberExpressionLike(member))
|
|
8838
8786
|
return false;
|
|
8839
8787
|
|
|
@@ -8841,7 +8789,7 @@ function matchesPattern(member, match, allowPartial) {
|
|
|
8841
8789
|
const nodes2 = [];
|
|
8842
8790
|
let node;
|
|
8843
8791
|
|
|
8844
|
-
for (node = member; isMemberExpressionLike(node); node =
|
|
8792
|
+
for (node = member; isMemberExpressionLike(node); node = node.object ?? node.meta) {
|
|
8845
8793
|
nodes2.push(node.property);
|
|
8846
8794
|
}
|
|
8847
8795
|
|
|
@@ -8903,7 +8851,7 @@ function isType(nodeType, targetType) {
|
|
|
8903
8851
|
|
|
8904
8852
|
const aliases = FLIPPED_ALIAS_KEYS[targetType];
|
|
8905
8853
|
|
|
8906
|
-
if (aliases
|
|
8854
|
+
if (aliases?.includes(nodeType))
|
|
8907
8855
|
return true;
|
|
8908
8856
|
|
|
8909
8857
|
return false;
|
|
@@ -8915,7 +8863,7 @@ function isPlaceholderType(placeholderType, targetType) {
|
|
|
8915
8863
|
|
|
8916
8864
|
const aliases = PLACEHOLDERS_ALIAS[placeholderType];
|
|
8917
8865
|
|
|
8918
|
-
if (aliases
|
|
8866
|
+
if (aliases?.includes(targetType))
|
|
8919
8867
|
return true;
|
|
8920
8868
|
|
|
8921
8869
|
return false;
|
|
@@ -9156,7 +9104,7 @@ function assertNodeType(...types2) {
|
|
|
9156
9104
|
set: expandedTypes,
|
|
9157
9105
|
});
|
|
9158
9106
|
function validate4(node, key, val) {
|
|
9159
|
-
const valType = val
|
|
9107
|
+
const valType = val?.type;
|
|
9160
9108
|
|
|
9161
9109
|
if (valType != null) {
|
|
9162
9110
|
if (expandedTypes.has(valType)) {
|
|
@@ -9193,7 +9141,7 @@ function assertNodeOrValueType(...types2) {
|
|
|
9193
9141
|
}
|
|
9194
9142
|
}
|
|
9195
9143
|
|
|
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
|
|
9144
|
+
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
9145
|
}
|
|
9198
9146
|
|
|
9199
9147
|
validate4.oneOfNodeOrValueTypes = types2;
|
|
@@ -9271,7 +9219,7 @@ function assertOptionalChainStart() {
|
|
|
9271
9219
|
break;
|
|
9272
9220
|
}
|
|
9273
9221
|
|
|
9274
|
-
throw new TypeError(`Non-optional ${node.type} must chain from an optional OptionalMemberExpression or OptionalCallExpression. Found chain from ${current
|
|
9222
|
+
throw new TypeError(`Non-optional ${node.type} must chain from an optional OptionalMemberExpression or OptionalCallExpression. Found chain from ${current?.type}`);
|
|
9275
9223
|
}
|
|
9276
9224
|
|
|
9277
9225
|
return validate4;
|
|
@@ -9312,14 +9260,13 @@ var store = {};
|
|
|
9312
9260
|
|
|
9313
9261
|
function defineAliasedType(...aliases) {
|
|
9314
9262
|
return (type, opts = {}) => {
|
|
9315
|
-
var _a;
|
|
9316
9263
|
let defined = opts.aliases;
|
|
9317
9264
|
|
|
9318
9265
|
if (!defined) {
|
|
9319
9266
|
if (opts.inherits)
|
|
9320
|
-
defined =
|
|
9267
|
+
defined = store[opts.inherits].aliases?.slice();
|
|
9321
9268
|
|
|
9322
|
-
defined
|
|
9269
|
+
defined ?? (defined = []);
|
|
9323
9270
|
opts.aliases = defined;
|
|
9324
9271
|
}
|
|
9325
9272
|
|
|
@@ -12378,7 +12325,7 @@ var PLACEHOLDERS_ALIAS = {
|
|
|
12378
12325
|
for (const type of PLACEHOLDERS) {
|
|
12379
12326
|
const alias2 = ALIAS_KEYS[type];
|
|
12380
12327
|
|
|
12381
|
-
if (alias2
|
|
12328
|
+
if (alias2?.length)
|
|
12382
12329
|
PLACEHOLDERS_ALIAS[type] = alias2;
|
|
12383
12330
|
}
|
|
12384
12331
|
|
|
@@ -13210,9 +13157,7 @@ function validate$1(node, key, val) {
|
|
|
13210
13157
|
}
|
|
13211
13158
|
|
|
13212
13159
|
function validateInternal(field, node, key, val, maybeNode) {
|
|
13213
|
-
|
|
13214
|
-
|
|
13215
|
-
if (!(field == null ? void 0 : field.validate))
|
|
13160
|
+
if (!field?.validate)
|
|
13216
13161
|
return;
|
|
13217
13162
|
|
|
13218
13163
|
if (field.optional && val == null)
|
|
@@ -13226,12 +13171,12 @@ function validateInternal(field, node, key, val, maybeNode) {
|
|
|
13226
13171
|
if (type == null)
|
|
13227
13172
|
return;
|
|
13228
13173
|
|
|
13229
|
-
|
|
13174
|
+
NODE_PARENT_VALIDATIONS[type]?.(node, key, val);
|
|
13230
13175
|
}
|
|
13231
13176
|
}
|
|
13232
13177
|
|
|
13233
13178
|
function validateField(node, key, val, field) {
|
|
13234
|
-
if (!
|
|
13179
|
+
if (!field?.validate)
|
|
13235
13180
|
return;
|
|
13236
13181
|
|
|
13237
13182
|
if (field.optional && val == null)
|
|
@@ -13241,13 +13186,12 @@ function validateField(node, key, val, field) {
|
|
|
13241
13186
|
}
|
|
13242
13187
|
|
|
13243
13188
|
function validateChild(node, key, val) {
|
|
13244
|
-
|
|
13245
|
-
const type = val == null ? void 0 : val.type;
|
|
13189
|
+
const type = val?.type;
|
|
13246
13190
|
|
|
13247
13191
|
if (type == null)
|
|
13248
13192
|
return;
|
|
13249
13193
|
|
|
13250
|
-
|
|
13194
|
+
NODE_PARENT_VALIDATIONS[type]?.(node, key, val);
|
|
13251
13195
|
}
|
|
13252
13196
|
|
|
13253
13197
|
var _validate = /* @__PURE__ */Object.freeze({
|
|
@@ -16933,10 +16877,8 @@ function isNode(node) {
|
|
|
16933
16877
|
}
|
|
16934
16878
|
|
|
16935
16879
|
function assertNode(node) {
|
|
16936
|
-
var _a;
|
|
16937
|
-
|
|
16938
16880
|
if (!isNode(node)) {
|
|
16939
|
-
const type =
|
|
16881
|
+
const type = node?.type ?? JSON.stringify(node);
|
|
16940
16882
|
throw new TypeError(`Not a valid node of type "${type}"`);
|
|
16941
16883
|
}
|
|
16942
16884
|
}
|
|
@@ -19402,7 +19344,7 @@ function isNodesEquivalent(a, b2) {
|
|
|
19402
19344
|
continue;
|
|
19403
19345
|
}
|
|
19404
19346
|
|
|
19405
|
-
if (typeof val_a === 'object' && !
|
|
19347
|
+
if (typeof val_a === 'object' && !visitorKeys?.includes(field)) {
|
|
19406
19348
|
for (const key of Object.keys(val_a)) {
|
|
19407
19349
|
if (val_a[key] !== val_b[key]) {
|
|
19408
19350
|
return false;
|
|
@@ -19501,7 +19443,7 @@ function isReferenced(node, parent, grandparent) {
|
|
|
19501
19443
|
return false;
|
|
19502
19444
|
|
|
19503
19445
|
case 'ExportSpecifier':
|
|
19504
|
-
if (grandparent
|
|
19446
|
+
if (grandparent?.source) {
|
|
19505
19447
|
return false;
|
|
19506
19448
|
}
|
|
19507
19449
|
|
|
@@ -19918,12 +19860,11 @@ function toParseErrorConstructor({toMessage, code: code2, reasonCode, syntaxPlug
|
|
|
19918
19860
|
}
|
|
19919
19861
|
|
|
19920
19862
|
defineHidden(error, 'clone', function clone2(overrides = {}) {
|
|
19921
|
-
var _a;
|
|
19922
19863
|
const {
|
|
19923
19864
|
line,
|
|
19924
19865
|
column,
|
|
19925
19866
|
index: index2,
|
|
19926
|
-
} =
|
|
19867
|
+
} = overrides.loc ?? loc;
|
|
19927
19868
|
|
|
19928
19869
|
return constructor(new Position(line, column, index2), Object.assign({}, details, overrides.details));
|
|
19929
19870
|
});
|
|
@@ -20099,7 +20040,7 @@ var estree = (superClass) => class ESTreeParserMixin extends superClass {
|
|
|
20099
20040
|
|
|
20100
20041
|
try {
|
|
20101
20042
|
bigInt = BigInt(value);
|
|
20102
|
-
} catch
|
|
20043
|
+
} catch {
|
|
20103
20044
|
bigInt = null;
|
|
20104
20045
|
}
|
|
20105
20046
|
|
|
@@ -20201,11 +20142,10 @@ var estree = (superClass) => class ESTreeParserMixin extends superClass {
|
|
|
20201
20142
|
}
|
|
20202
20143
|
|
|
20203
20144
|
isValidDirective(stmt) {
|
|
20204
|
-
var _a;
|
|
20205
20145
|
return stmt.type === 'ExpressionStatement'
|
|
20206
20146
|
&& stmt.expression.type === 'Literal'
|
|
20207
20147
|
&& typeof stmt.expression.value === 'string'
|
|
20208
|
-
&& !
|
|
20148
|
+
&& !stmt.expression.extra?.parenthesized;
|
|
20209
20149
|
}
|
|
20210
20150
|
|
|
20211
20151
|
parseBlockBody(node, allowDirectives, topLevel, end, afterBlockParse) {
|
|
@@ -20391,14 +20331,13 @@ var estree = (superClass) => class ESTreeParserMixin extends superClass {
|
|
|
20391
20331
|
}
|
|
20392
20332
|
|
|
20393
20333
|
finishCallExpression(unfinished, optional) {
|
|
20394
|
-
var _a, _b;
|
|
20395
20334
|
const node = super.finishCallExpression(unfinished, optional);
|
|
20396
20335
|
|
|
20397
20336
|
if (node.callee.type === 'Import') {
|
|
20398
20337
|
this.castNodeTo(node, 'ImportExpression');
|
|
20399
20338
|
node.source = node.arguments[0];
|
|
20400
|
-
node.options =
|
|
20401
|
-
node.attributes =
|
|
20339
|
+
node.options = node.arguments[1] ?? null;
|
|
20340
|
+
node.attributes = node.arguments[1] ?? null;
|
|
20402
20341
|
delete node.arguments;
|
|
20403
20342
|
delete node.callee;
|
|
20404
20343
|
} else if (node.type === 'OptionalCallExpression') {
|
|
@@ -20419,7 +20358,6 @@ var estree = (superClass) => class ESTreeParserMixin extends superClass {
|
|
|
20419
20358
|
}
|
|
20420
20359
|
|
|
20421
20360
|
parseExport(unfinished, decorators) {
|
|
20422
|
-
var _a;
|
|
20423
20361
|
const exportStartLoc = this.state.lastTokStartLoc;
|
|
20424
20362
|
const node = super.parseExport(unfinished, decorators);
|
|
20425
20363
|
|
|
@@ -20438,7 +20376,7 @@ var estree = (superClass) => class ESTreeParserMixin extends superClass {
|
|
|
20438
20376
|
case 'ExportDefaultDeclaration': {
|
|
20439
20377
|
const {declaration} = node;
|
|
20440
20378
|
|
|
20441
|
-
if (
|
|
20379
|
+
if (declaration?.type === 'ClassDeclaration' && declaration.decorators?.length > 0 && declaration.start === node.start) {
|
|
20442
20380
|
this.resetStartLocation(node, exportStartLoc);
|
|
20443
20381
|
}
|
|
20444
20382
|
}
|
|
@@ -20612,26 +20550,24 @@ var tokenStartsExprs = [];
|
|
|
20612
20550
|
var tokenPrefixes = [];
|
|
20613
20551
|
|
|
20614
20552
|
function createToken(name, options = {}) {
|
|
20615
|
-
var _a, _b, _c, _d;
|
|
20616
20553
|
++tokenTypeCounter;
|
|
20617
20554
|
tokenLabels.push(name);
|
|
20618
|
-
tokenBinops.push(
|
|
20619
|
-
tokenBeforeExprs.push(
|
|
20620
|
-
tokenStartsExprs.push(
|
|
20621
|
-
tokenPrefixes.push(
|
|
20555
|
+
tokenBinops.push(options.binop ?? -1);
|
|
20556
|
+
tokenBeforeExprs.push(options.beforeExpr ?? false);
|
|
20557
|
+
tokenStartsExprs.push(options.startsExpr ?? false);
|
|
20558
|
+
tokenPrefixes.push(options.prefix ?? false);
|
|
20622
20559
|
tokenTypes.push(new ExportedTokenType(name, options));
|
|
20623
20560
|
return tokenTypeCounter;
|
|
20624
20561
|
}
|
|
20625
20562
|
|
|
20626
20563
|
function createKeywordLike(name, options = {}) {
|
|
20627
|
-
var _a, _b, _c, _d;
|
|
20628
20564
|
++tokenTypeCounter;
|
|
20629
20565
|
keywords$1.set(name, tokenTypeCounter);
|
|
20630
20566
|
tokenLabels.push(name);
|
|
20631
|
-
tokenBinops.push(
|
|
20632
|
-
tokenBeforeExprs.push(
|
|
20633
|
-
tokenStartsExprs.push(
|
|
20634
|
-
tokenPrefixes.push(
|
|
20567
|
+
tokenBinops.push(options.binop ?? -1);
|
|
20568
|
+
tokenBeforeExprs.push(options.beforeExpr ?? false);
|
|
20569
|
+
tokenStartsExprs.push(options.startsExpr ?? false);
|
|
20570
|
+
tokenPrefixes.push(options.prefix ?? false);
|
|
20635
20571
|
tokenTypes.push(new ExportedTokenType('name', options));
|
|
20636
20572
|
return tokenTypeCounter;
|
|
20637
20573
|
}
|
|
@@ -23343,7 +23279,7 @@ var flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
23343
23279
|
}
|
|
23344
23280
|
}
|
|
23345
23281
|
|
|
23346
|
-
const propOrInexact = this.flowParseObjectTypeProperty(node, isStatic2, protoStartLoc, variance2, kind, allowSpread, allowInexact
|
|
23282
|
+
const propOrInexact = this.flowParseObjectTypeProperty(node, isStatic2, protoStartLoc, variance2, kind, allowSpread, allowInexact ?? !exact);
|
|
23347
23283
|
|
|
23348
23284
|
if (propOrInexact === null) {
|
|
23349
23285
|
inexact = true;
|
|
@@ -23477,7 +23413,7 @@ var flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
23477
23413
|
}
|
|
23478
23414
|
|
|
23479
23415
|
flowParseQualifiedTypeIdentifier(startLoc, id) {
|
|
23480
|
-
startLoc
|
|
23416
|
+
startLoc ?? (startLoc = this.state.startLoc);
|
|
23481
23417
|
let node = id || this.flowParseRestrictedIdentifier(true);
|
|
23482
23418
|
|
|
23483
23419
|
while (this.eat(16)) {
|
|
@@ -24150,8 +24086,7 @@ var flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
24150
24086
|
}
|
|
24151
24087
|
|
|
24152
24088
|
finishArrowValidation(node) {
|
|
24153
|
-
|
|
24154
|
-
this.toAssignableList(node.params, (_a = node.extra) == null ? void 0 : _a.trailingCommaLoc, false);
|
|
24089
|
+
this.toAssignableList(node.params, node.extra?.trailingCommaLoc, false);
|
|
24155
24090
|
this.scope.enter(514 | 4);
|
|
24156
24091
|
super.checkParams(node, false, true);
|
|
24157
24092
|
this.scope.exit();
|
|
@@ -24349,7 +24284,7 @@ var flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
24349
24284
|
for (let i = 0; i < exprList.length; i++) {
|
|
24350
24285
|
const expr = exprList[i];
|
|
24351
24286
|
|
|
24352
|
-
if (
|
|
24287
|
+
if (expr?.type === 'TypeCastExpression') {
|
|
24353
24288
|
exprList[i] = this.typeCastToParameter(expr);
|
|
24354
24289
|
}
|
|
24355
24290
|
}
|
|
@@ -24358,12 +24293,10 @@ var flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
24358
24293
|
}
|
|
24359
24294
|
|
|
24360
24295
|
toReferencedList(exprList, isParenthesizedExpr) {
|
|
24361
|
-
var _a;
|
|
24362
|
-
|
|
24363
24296
|
for (let i = 0; i < exprList.length; i++) {
|
|
24364
24297
|
const expr = exprList[i];
|
|
24365
24298
|
|
|
24366
|
-
if (expr && expr.type === 'TypeCastExpression' && !
|
|
24299
|
+
if (expr && expr.type === 'TypeCastExpression' && !expr.extra?.parenthesized && (exprList.length > 1 || !isParenthesizedExpr)) {
|
|
24367
24300
|
this.raise(FlowErrors.TypeCastInPattern, expr.typeAnnotation);
|
|
24368
24301
|
}
|
|
24369
24302
|
}
|
|
@@ -24741,12 +24674,10 @@ var flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
24741
24674
|
}
|
|
24742
24675
|
}
|
|
24743
24676
|
|
|
24744
|
-
if (
|
|
24677
|
+
if (jsx2?.error || this.match(47)) {
|
|
24745
24678
|
state = state || this.state.clone();
|
|
24746
24679
|
let typeParameters;
|
|
24747
24680
|
const arrow = this.tryParse((abort) => {
|
|
24748
|
-
var _a;
|
|
24749
|
-
|
|
24750
24681
|
typeParameters = this.flowParseTypeParameterDeclaration();
|
|
24751
24682
|
const arrowExpression2 = this.forwardNoArrowParamsConversionAt(typeParameters, () => {
|
|
24752
24683
|
const result = super.parseMaybeAssign(refExpressionErrors, afterLeftParse);
|
|
@@ -24754,7 +24685,7 @@ var flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
24754
24685
|
return result;
|
|
24755
24686
|
});
|
|
24756
24687
|
|
|
24757
|
-
if (
|
|
24688
|
+
if (arrowExpression2.extra?.parenthesized)
|
|
24758
24689
|
abort();
|
|
24759
24690
|
|
|
24760
24691
|
const expr = this.maybeUnwrapTypeCastExpression(arrowExpression2);
|
|
@@ -24781,7 +24712,7 @@ var flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
24781
24712
|
arrowExpression = arrow.node;
|
|
24782
24713
|
}
|
|
24783
24714
|
|
|
24784
|
-
if (jsx2
|
|
24715
|
+
if (jsx2?.node) {
|
|
24785
24716
|
this.state = jsx2.failState;
|
|
24786
24717
|
return jsx2.node;
|
|
24787
24718
|
}
|
|
@@ -24791,7 +24722,7 @@ var flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
24791
24722
|
return arrowExpression;
|
|
24792
24723
|
}
|
|
24793
24724
|
|
|
24794
|
-
if (jsx2
|
|
24725
|
+
if (jsx2?.thrown)
|
|
24795
24726
|
throw jsx2.error;
|
|
24796
24727
|
|
|
24797
24728
|
if (arrow.thrown)
|
|
@@ -26065,15 +25996,13 @@ var jsx = (superClass) => class JSXParserMixin extends superClass {
|
|
|
26065
25996
|
}
|
|
26066
25997
|
|
|
26067
25998
|
jsxParseExpressionContainer(node, previousContext) {
|
|
26068
|
-
var _a;
|
|
26069
|
-
|
|
26070
25999
|
if (this.match(8)) {
|
|
26071
26000
|
node.expression = this.jsxParseEmptyExpression();
|
|
26072
26001
|
} else {
|
|
26073
26002
|
const expression2 = this.parseExpression();
|
|
26074
26003
|
|
|
26075
26004
|
{
|
|
26076
|
-
if (expression2.type === 'SequenceExpression' && !
|
|
26005
|
+
if (expression2.type === 'SequenceExpression' && !expression2.extra?.parenthesized) {
|
|
26077
26006
|
this.raise(JsxErrors.UnexpectedSequenceExpression, expression2.expressions[1]);
|
|
26078
26007
|
}
|
|
26079
26008
|
}
|
|
@@ -26524,7 +26453,7 @@ var BaseParser = class {
|
|
|
26524
26453
|
const actualOptions = this.plugins.get(pluginName);
|
|
26525
26454
|
|
|
26526
26455
|
for (const key of Object.keys(pluginOptions)) {
|
|
26527
|
-
if (
|
|
26456
|
+
if (actualOptions?.[key] !== pluginOptions[key]) {
|
|
26528
26457
|
return false;
|
|
26529
26458
|
}
|
|
26530
26459
|
}
|
|
@@ -26534,8 +26463,7 @@ var BaseParser = class {
|
|
|
26534
26463
|
}
|
|
26535
26464
|
|
|
26536
26465
|
getPluginOption(plugin, name) {
|
|
26537
|
-
|
|
26538
|
-
return (_a = this.plugins.get(plugin)) == null ? void 0 : _a[name];
|
|
26466
|
+
return this.plugins.get(plugin)?.[name];
|
|
26539
26467
|
}
|
|
26540
26468
|
};
|
|
26541
26469
|
|
|
@@ -26630,7 +26558,6 @@ var CommentsParser = class extends BaseParser {
|
|
|
26630
26558
|
}
|
|
26631
26559
|
|
|
26632
26560
|
finalizeComment(commentWS) {
|
|
26633
|
-
var _a;
|
|
26634
26561
|
const {comments} = commentWS;
|
|
26635
26562
|
|
|
26636
26563
|
if (commentWS.leadingNode !== null || commentWS.trailingNode !== null) {
|
|
@@ -26658,7 +26585,7 @@ var CommentsParser = class extends BaseParser {
|
|
|
26658
26585
|
break;
|
|
26659
26586
|
|
|
26660
26587
|
case 'ImportExpression':
|
|
26661
|
-
adjustInnerComments(node, [node.source,
|
|
26588
|
+
adjustInnerComments(node, [node.source, node.options ?? null], commentWS);
|
|
26662
26589
|
break;
|
|
26663
26590
|
|
|
26664
26591
|
case 'FunctionDeclaration':
|
|
@@ -27636,7 +27563,7 @@ var Tokenizer = class extends CommentsParser {
|
|
|
27636
27563
|
|
|
27637
27564
|
if (comment !== void 0) {
|
|
27638
27565
|
this.addComment(comment);
|
|
27639
|
-
comments
|
|
27566
|
+
comments?.push(comment);
|
|
27640
27567
|
}
|
|
27641
27568
|
|
|
27642
27569
|
break;
|
|
@@ -27647,7 +27574,7 @@ var Tokenizer = class extends CommentsParser {
|
|
|
27647
27574
|
|
|
27648
27575
|
if (comment !== void 0) {
|
|
27649
27576
|
this.addComment(comment);
|
|
27650
|
-
comments
|
|
27577
|
+
comments?.push(comment);
|
|
27651
27578
|
}
|
|
27652
27579
|
|
|
27653
27580
|
break;
|
|
@@ -27670,7 +27597,7 @@ var Tokenizer = class extends CommentsParser {
|
|
|
27670
27597
|
|
|
27671
27598
|
if (comment !== void 0) {
|
|
27672
27599
|
this.addComment(comment);
|
|
27673
|
-
comments
|
|
27600
|
+
comments?.push(comment);
|
|
27674
27601
|
}
|
|
27675
27602
|
} else {
|
|
27676
27603
|
break loop;
|
|
@@ -27683,7 +27610,7 @@ var Tokenizer = class extends CommentsParser {
|
|
|
27683
27610
|
|
|
27684
27611
|
if (comment !== void 0) {
|
|
27685
27612
|
this.addComment(comment);
|
|
27686
|
-
comments
|
|
27613
|
+
comments?.push(comment);
|
|
27687
27614
|
}
|
|
27688
27615
|
} else {
|
|
27689
27616
|
break loop;
|
|
@@ -27694,7 +27621,7 @@ var Tokenizer = class extends CommentsParser {
|
|
|
27694
27621
|
|
|
27695
27622
|
}
|
|
27696
27623
|
}
|
|
27697
|
-
if (
|
|
27624
|
+
if (comments?.length > 0) {
|
|
27698
27625
|
const end = this.state.pos;
|
|
27699
27626
|
const commentWhitespace = {
|
|
27700
27627
|
start: this.sourceToOffsetPos(spaceStart),
|
|
@@ -29085,10 +29012,10 @@ var Node = class {
|
|
|
29085
29012
|
this.end = 0;
|
|
29086
29013
|
this.loc = new SourceLocation(loc);
|
|
29087
29014
|
|
|
29088
|
-
if (
|
|
29015
|
+
if (parser?.optionFlags & 128)
|
|
29089
29016
|
this.range = [pos, 0];
|
|
29090
29017
|
|
|
29091
|
-
if (parser
|
|
29018
|
+
if (parser?.filename)
|
|
29092
29019
|
this.loc.filename = parser.filename;
|
|
29093
29020
|
}
|
|
29094
29021
|
};
|
|
@@ -29207,10 +29134,9 @@ var unwrapParenthesizedExpression = (node) => {
|
|
|
29207
29134
|
|
|
29208
29135
|
var LValParser = class extends NodeUtils {
|
|
29209
29136
|
toAssignable(node, isLHS = false) {
|
|
29210
|
-
var _a, _b, _c;
|
|
29211
29137
|
let parenthesized = void 0;
|
|
29212
29138
|
|
|
29213
|
-
if (node.type === 'ParenthesizedExpression' ||
|
|
29139
|
+
if (node.type === 'ParenthesizedExpression' || node.extra?.parenthesized) {
|
|
29214
29140
|
parenthesized = unwrapParenthesizedExpression(node);
|
|
29215
29141
|
|
|
29216
29142
|
if (isLHS) {
|
|
@@ -29240,7 +29166,7 @@ var LValParser = class extends NodeUtils {
|
|
|
29240
29166
|
const isLast = i === last2;
|
|
29241
29167
|
this.toAssignableObjectExpressionProp(prop, isLast, isLHS);
|
|
29242
29168
|
|
|
29243
|
-
if (isLast && prop.type === 'RestElement' &&
|
|
29169
|
+
if (isLast && prop.type === 'RestElement' && node.extra?.trailingCommaLoc) {
|
|
29244
29170
|
this.raise(Errors.RestTrailingComma, node.extra.trailingCommaLoc);
|
|
29245
29171
|
}
|
|
29246
29172
|
}
|
|
@@ -29264,7 +29190,7 @@ var LValParser = class extends NodeUtils {
|
|
|
29264
29190
|
|
|
29265
29191
|
case 'ArrayExpression':
|
|
29266
29192
|
this.castNodeTo(node, 'ArrayPattern');
|
|
29267
|
-
this.toAssignableList(node.elements,
|
|
29193
|
+
this.toAssignableList(node.elements, node.extra?.trailingCommaLoc, isLHS);
|
|
29268
29194
|
break;
|
|
29269
29195
|
|
|
29270
29196
|
case 'AssignmentExpression':
|
|
@@ -29391,7 +29317,7 @@ var LValParser = class extends NodeUtils {
|
|
|
29391
29317
|
toReferencedListDeep(exprList, isParenthesizedExpr) {
|
|
29392
29318
|
this.toReferencedList(exprList, isParenthesizedExpr);
|
|
29393
29319
|
for (const expr of exprList) {
|
|
29394
|
-
if (
|
|
29320
|
+
if (expr?.type === 'ArrayExpression') {
|
|
29395
29321
|
this.toReferencedListDeep(expr.elements);
|
|
29396
29322
|
}
|
|
29397
29323
|
}
|
|
@@ -29543,8 +29469,8 @@ var LValParser = class extends NodeUtils {
|
|
|
29543
29469
|
}
|
|
29544
29470
|
|
|
29545
29471
|
parseMaybeDefault(startLoc, left) {
|
|
29546
|
-
startLoc
|
|
29547
|
-
left = left
|
|
29472
|
+
startLoc ?? (startLoc = this.state.startLoc);
|
|
29473
|
+
left = left ?? this.parseBindingAtom();
|
|
29548
29474
|
|
|
29549
29475
|
if (!this.eat(29))
|
|
29550
29476
|
return left;
|
|
@@ -29592,7 +29518,6 @@ var LValParser = class extends NodeUtils {
|
|
|
29592
29518
|
}
|
|
29593
29519
|
|
|
29594
29520
|
checkLVal(expression2, ancestor, binding = 64, checkClashes = false, strictModeChanged = false, hasParenthesizedAncestor = false) {
|
|
29595
|
-
var _a;
|
|
29596
29521
|
const type = expression2.type;
|
|
29597
29522
|
|
|
29598
29523
|
if (this.isObjectMethod(expression2))
|
|
@@ -29635,7 +29560,7 @@ var LValParser = class extends NodeUtils {
|
|
|
29635
29560
|
this.raise(Errors.VoidPatternCatchClauseParam, expression2);
|
|
29636
29561
|
}
|
|
29637
29562
|
|
|
29638
|
-
const validity = this.isValidLVal(type, !(hasParenthesizedAncestor ||
|
|
29563
|
+
const validity = this.isValidLVal(type, !(hasParenthesizedAncestor || expression2.extra?.parenthesized) && ancestor.type === 'AssignmentExpression', binding);
|
|
29639
29564
|
|
|
29640
29565
|
if (validity === true)
|
|
29641
29566
|
return;
|
|
@@ -29860,9 +29785,7 @@ function tsIsVarianceAnnotations(modifier) {
|
|
|
29860
29785
|
}
|
|
29861
29786
|
|
|
29862
29787
|
function tsIsEntityName(node) {
|
|
29863
|
-
|
|
29864
|
-
|
|
29865
|
-
if ((_a = node.extra) == null ? void 0 : _a.parenthesized) {
|
|
29788
|
+
if (node.extra?.parenthesized) {
|
|
29866
29789
|
return false;
|
|
29867
29790
|
}
|
|
29868
29791
|
|
|
@@ -30002,7 +29925,7 @@ var typescript = (superClass) => class TypeScriptParserMixin extends superClass
|
|
|
30002
29925
|
for (;;) {
|
|
30003
29926
|
const {startLoc} = this.state;
|
|
30004
29927
|
|
|
30005
|
-
const modifier = this.tsParseModifier(allowedModifiers.concat(disallowedModifiers
|
|
29928
|
+
const modifier = this.tsParseModifier(allowedModifiers.concat(disallowedModifiers ?? []), stopOnStartOfClassStaticBlock, modified.static);
|
|
30006
29929
|
|
|
30007
29930
|
if (!modifier)
|
|
30008
29931
|
break;
|
|
@@ -30044,7 +29967,7 @@ var typescript = (superClass) => class TypeScriptParserMixin extends superClass
|
|
|
30044
29967
|
modified[modifier] = true;
|
|
30045
29968
|
}
|
|
30046
29969
|
|
|
30047
|
-
if (disallowedModifiers
|
|
29970
|
+
if (disallowedModifiers?.includes(modifier)) {
|
|
30048
29971
|
this.raise(errorTemplate, startLoc, {
|
|
30049
29972
|
modifier,
|
|
30050
29973
|
});
|
|
@@ -31011,7 +30934,7 @@ var typescript = (superClass) => class TypeScriptParserMixin extends superClass
|
|
|
31011
30934
|
try {
|
|
31012
30935
|
this.parseObjectLike(8, true);
|
|
31013
30936
|
return errors.length === previousErrorCount;
|
|
31014
|
-
} catch
|
|
30937
|
+
} catch {
|
|
31015
30938
|
return false;
|
|
31016
30939
|
}
|
|
31017
30940
|
}
|
|
@@ -31025,7 +30948,7 @@ var typescript = (superClass) => class TypeScriptParserMixin extends superClass
|
|
|
31025
30948
|
try {
|
|
31026
30949
|
super.parseBindingList(3, 93, 1);
|
|
31027
30950
|
return errors.length === previousErrorCount;
|
|
31028
|
-
} catch
|
|
30951
|
+
} catch {
|
|
31029
30952
|
return false;
|
|
31030
30953
|
}
|
|
31031
30954
|
}
|
|
@@ -31865,7 +31788,7 @@ var typescript = (superClass) => class TypeScriptParserMixin extends superClass
|
|
|
31865
31788
|
|
|
31866
31789
|
tsCheckForInvalidTypeCasts(items) {
|
|
31867
31790
|
items.forEach((node) => {
|
|
31868
|
-
if (
|
|
31791
|
+
if (node?.type === 'TSTypeCastExpression') {
|
|
31869
31792
|
this.raise(TSErrors.UnexpectedTypeAnnotation, node.typeAnnotation);
|
|
31870
31793
|
}
|
|
31871
31794
|
});
|
|
@@ -31995,11 +31918,10 @@ var typescript = (superClass) => class TypeScriptParserMixin extends superClass
|
|
|
31995
31918
|
}
|
|
31996
31919
|
|
|
31997
31920
|
parseNewCallee(node) {
|
|
31998
|
-
var _a;
|
|
31999
31921
|
super.parseNewCallee(node);
|
|
32000
31922
|
const {callee} = node;
|
|
32001
31923
|
|
|
32002
|
-
if (callee.type === 'TSInstantiationExpression' && !
|
|
31924
|
+
if (callee.type === 'TSInstantiationExpression' && !callee.extra?.parenthesized) {
|
|
32003
31925
|
{
|
|
32004
31926
|
node.typeArguments = callee.typeArguments;
|
|
32005
31927
|
}
|
|
@@ -32595,7 +32517,7 @@ var typescript = (superClass) => class TypeScriptParserMixin extends superClass
|
|
|
32595
32517
|
}
|
|
32596
32518
|
}
|
|
32597
32519
|
|
|
32598
|
-
if (!
|
|
32520
|
+
if (!jsx2?.error && !this.match(47)) {
|
|
32599
32521
|
return super.parseMaybeAssign(refExpressionErrors, afterLeftParse);
|
|
32600
32522
|
}
|
|
32601
32523
|
|
|
@@ -32605,22 +32527,20 @@ var typescript = (superClass) => class TypeScriptParserMixin extends superClass
|
|
|
32605
32527
|
let typeParameters;
|
|
32606
32528
|
|
|
32607
32529
|
const arrow = this.tryParse((abort) => {
|
|
32608
|
-
var _a, _b;
|
|
32609
|
-
|
|
32610
32530
|
typeParameters = this.tsParseTypeParameters(this.tsParseConstModifier);
|
|
32611
32531
|
const expr = super.parseMaybeAssign(refExpressionErrors, afterLeftParse);
|
|
32612
32532
|
|
|
32613
|
-
if (expr.type !== 'ArrowFunctionExpression' ||
|
|
32533
|
+
if (expr.type !== 'ArrowFunctionExpression' || expr.extra?.parenthesized) {
|
|
32614
32534
|
abort();
|
|
32615
32535
|
}
|
|
32616
32536
|
|
|
32617
|
-
if (
|
|
32537
|
+
if (typeParameters?.params.length !== 0) {
|
|
32618
32538
|
this.resetStartLocationFromNode(expr, typeParameters);
|
|
32619
32539
|
}
|
|
32620
32540
|
|
|
32621
32541
|
expr.typeParameters = typeParameters;
|
|
32622
32542
|
{
|
|
32623
|
-
if (this.hasPlugin('jsx') && expr.typeParameters.params.length === 1 && !
|
|
32543
|
+
if (this.hasPlugin('jsx') && expr.typeParameters.params.length === 1 && !expr.typeParameters.extra?.trailingComma) {
|
|
32624
32544
|
const parameter = expr.typeParameters.params[0];
|
|
32625
32545
|
|
|
32626
32546
|
if (!parameter.constraint) {
|
|
@@ -32649,7 +32569,7 @@ var typescript = (superClass) => class TypeScriptParserMixin extends superClass
|
|
|
32649
32569
|
return typeCast.node;
|
|
32650
32570
|
}
|
|
32651
32571
|
|
|
32652
|
-
if (jsx2
|
|
32572
|
+
if (jsx2?.node) {
|
|
32653
32573
|
this.state = jsx2.failState;
|
|
32654
32574
|
return jsx2.node;
|
|
32655
32575
|
}
|
|
@@ -32663,18 +32583,16 @@ var typescript = (superClass) => class TypeScriptParserMixin extends superClass
|
|
|
32663
32583
|
return arrow.node;
|
|
32664
32584
|
}
|
|
32665
32585
|
|
|
32666
|
-
if (typeCast
|
|
32586
|
+
if (typeCast?.node) {
|
|
32667
32587
|
this.state = typeCast.failState;
|
|
32668
32588
|
return typeCast.node;
|
|
32669
32589
|
}
|
|
32670
32590
|
|
|
32671
|
-
throw
|
|
32591
|
+
throw jsx2?.error || arrow.error || typeCast?.error;
|
|
32672
32592
|
}
|
|
32673
32593
|
|
|
32674
32594
|
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')) {
|
|
32595
|
+
if (node.params.length === 1 && !node.params[0].constraint && !node.extra?.trailingComma && this.getPluginOption('typescript', 'disallowAmbiguousJSXLike')) {
|
|
32678
32596
|
this.raise(TSErrors.ReservedArrowTypeParam, node);
|
|
32679
32597
|
}
|
|
32680
32598
|
}
|
|
@@ -33158,57 +33076,9 @@ var typescript = (superClass) => class TypeScriptParserMixin extends superClass
|
|
|
33158
33076
|
}
|
|
33159
33077
|
|
|
33160
33078
|
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
33079
|
switch(node.type) {
|
|
33210
33080
|
case 'ExpressionStatement':
|
|
33211
|
-
|
|
33081
|
+
node.directive ?? (node.directive = void 0);
|
|
33212
33082
|
return;
|
|
33213
33083
|
|
|
33214
33084
|
case 'RestElement':
|
|
@@ -33218,17 +33088,17 @@ var typescript = (superClass) => class TypeScriptParserMixin extends superClass
|
|
|
33218
33088
|
case 'ArrayPattern':
|
|
33219
33089
|
case 'AssignmentPattern':
|
|
33220
33090
|
case 'ObjectPattern':
|
|
33221
|
-
|
|
33222
|
-
|
|
33223
|
-
|
|
33091
|
+
node.decorators ?? (node.decorators = []);
|
|
33092
|
+
node.optional ?? (node.optional = false);
|
|
33093
|
+
node.typeAnnotation ?? (node.typeAnnotation = void 0);
|
|
33224
33094
|
return;
|
|
33225
33095
|
|
|
33226
33096
|
case 'TSParameterProperty':
|
|
33227
|
-
|
|
33228
|
-
|
|
33229
|
-
|
|
33230
|
-
|
|
33231
|
-
|
|
33097
|
+
node.accessibility ?? (node.accessibility = void 0);
|
|
33098
|
+
node.decorators ?? (node.decorators = []);
|
|
33099
|
+
node.override ?? (node.override = false);
|
|
33100
|
+
node.readonly ?? (node.readonly = false);
|
|
33101
|
+
node.static ?? (node.static = false);
|
|
33232
33102
|
return;
|
|
33233
33103
|
|
|
33234
33104
|
case 'TSEmptyBodyFunctionExpression':
|
|
@@ -33239,95 +33109,95 @@ var typescript = (superClass) => class TypeScriptParserMixin extends superClass
|
|
|
33239
33109
|
case 'FunctionExpression':
|
|
33240
33110
|
case 'ClassMethod':
|
|
33241
33111
|
case 'ClassPrivateMethod':
|
|
33242
|
-
|
|
33243
|
-
|
|
33244
|
-
|
|
33112
|
+
node.declare ?? (node.declare = false);
|
|
33113
|
+
node.returnType ?? (node.returnType = void 0);
|
|
33114
|
+
node.typeParameters ?? (node.typeParameters = void 0);
|
|
33245
33115
|
return;
|
|
33246
33116
|
|
|
33247
33117
|
case 'Property':
|
|
33248
|
-
|
|
33118
|
+
node.optional ?? (node.optional = false);
|
|
33249
33119
|
return;
|
|
33250
33120
|
|
|
33251
33121
|
case 'TSMethodSignature':
|
|
33252
33122
|
case 'TSPropertySignature':
|
|
33253
|
-
|
|
33123
|
+
node.optional ?? (node.optional = false);
|
|
33254
33124
|
|
|
33255
33125
|
case 'TSIndexSignature':
|
|
33256
|
-
|
|
33257
|
-
|
|
33258
|
-
|
|
33126
|
+
node.accessibility ?? (node.accessibility = void 0);
|
|
33127
|
+
node.readonly ?? (node.readonly = false);
|
|
33128
|
+
node.static ?? (node.static = false);
|
|
33259
33129
|
return;
|
|
33260
33130
|
|
|
33261
33131
|
case 'TSAbstractPropertyDefinition':
|
|
33262
33132
|
case 'PropertyDefinition':
|
|
33263
33133
|
case 'TSAbstractAccessorProperty':
|
|
33264
33134
|
case 'AccessorProperty':
|
|
33265
|
-
|
|
33266
|
-
|
|
33267
|
-
|
|
33268
|
-
|
|
33135
|
+
node.declare ?? (node.declare = false);
|
|
33136
|
+
node.definite ?? (node.definite = false);
|
|
33137
|
+
node.readonly ?? (node.readonly = false);
|
|
33138
|
+
node.typeAnnotation ?? (node.typeAnnotation = void 0);
|
|
33269
33139
|
|
|
33270
33140
|
case 'TSAbstractMethodDefinition':
|
|
33271
33141
|
case 'MethodDefinition':
|
|
33272
|
-
|
|
33273
|
-
|
|
33274
|
-
|
|
33275
|
-
|
|
33142
|
+
node.accessibility ?? (node.accessibility = void 0);
|
|
33143
|
+
node.decorators ?? (node.decorators = []);
|
|
33144
|
+
node.override ?? (node.override = false);
|
|
33145
|
+
node.optional ?? (node.optional = false);
|
|
33276
33146
|
return;
|
|
33277
33147
|
|
|
33278
33148
|
case 'ClassExpression':
|
|
33279
|
-
|
|
33149
|
+
node.id ?? (node.id = null);
|
|
33280
33150
|
|
|
33281
33151
|
case 'ClassDeclaration':
|
|
33282
|
-
|
|
33283
|
-
|
|
33284
|
-
|
|
33285
|
-
|
|
33286
|
-
|
|
33287
|
-
|
|
33152
|
+
node.abstract ?? (node.abstract = false);
|
|
33153
|
+
node.declare ?? (node.declare = false);
|
|
33154
|
+
node.decorators ?? (node.decorators = []);
|
|
33155
|
+
node.implements ?? (node.implements = []);
|
|
33156
|
+
node.superTypeArguments ?? (node.superTypeArguments = void 0);
|
|
33157
|
+
node.typeParameters ?? (node.typeParameters = void 0);
|
|
33288
33158
|
return;
|
|
33289
33159
|
|
|
33290
33160
|
case 'TSTypeAliasDeclaration':
|
|
33291
33161
|
case 'VariableDeclaration':
|
|
33292
|
-
|
|
33162
|
+
node.declare ?? (node.declare = false);
|
|
33293
33163
|
return;
|
|
33294
33164
|
|
|
33295
33165
|
case 'VariableDeclarator':
|
|
33296
|
-
|
|
33166
|
+
node.definite ?? (node.definite = false);
|
|
33297
33167
|
return;
|
|
33298
33168
|
|
|
33299
33169
|
case 'TSEnumDeclaration':
|
|
33300
|
-
|
|
33301
|
-
|
|
33170
|
+
node.const ?? (node.const = false);
|
|
33171
|
+
node.declare ?? (node.declare = false);
|
|
33302
33172
|
return;
|
|
33303
33173
|
|
|
33304
33174
|
case 'TSEnumMember':
|
|
33305
|
-
|
|
33175
|
+
node.computed ?? (node.computed = false);
|
|
33306
33176
|
return;
|
|
33307
33177
|
|
|
33308
33178
|
case 'TSImportType':
|
|
33309
|
-
|
|
33310
|
-
|
|
33179
|
+
node.qualifier ?? (node.qualifier = null);
|
|
33180
|
+
node.options ?? (node.options = null);
|
|
33311
33181
|
{
|
|
33312
|
-
|
|
33182
|
+
node.typeArguments ?? (node.typeArguments = null);
|
|
33313
33183
|
}
|
|
33314
33184
|
|
|
33315
33185
|
return;
|
|
33316
33186
|
|
|
33317
33187
|
case 'TSInterfaceDeclaration':
|
|
33318
|
-
|
|
33319
|
-
|
|
33188
|
+
node.declare ?? (node.declare = false);
|
|
33189
|
+
node.extends ?? (node.extends = []);
|
|
33320
33190
|
return;
|
|
33321
33191
|
|
|
33322
33192
|
case 'TSModuleDeclaration':
|
|
33323
|
-
|
|
33324
|
-
|
|
33193
|
+
node.declare ?? (node.declare = false);
|
|
33194
|
+
node.global ?? (node.global = node.kind === 'global');
|
|
33325
33195
|
return;
|
|
33326
33196
|
|
|
33327
33197
|
case 'TSTypeParameter':
|
|
33328
|
-
|
|
33329
|
-
|
|
33330
|
-
|
|
33198
|
+
node.const ?? (node.const = false);
|
|
33199
|
+
node.in ?? (node.in = false);
|
|
33200
|
+
node.out ?? (node.out = false);
|
|
33331
33201
|
return;
|
|
33332
33202
|
}
|
|
33333
33203
|
}
|
|
@@ -33347,10 +33217,9 @@ function isPossiblyLiteralEnum(expression2) {
|
|
|
33347
33217
|
}
|
|
33348
33218
|
|
|
33349
33219
|
function isValidAmbientConstInitializer(expression2, estree2) {
|
|
33350
|
-
var _a;
|
|
33351
33220
|
const {type} = expression2;
|
|
33352
33221
|
|
|
33353
|
-
if (
|
|
33222
|
+
if (expression2.extra?.parenthesized) {
|
|
33354
33223
|
return false;
|
|
33355
33224
|
}
|
|
33356
33225
|
|
|
@@ -33521,9 +33390,7 @@ var placeholders = (superClass) => class PlaceholdersParserMixin extends superCl
|
|
|
33521
33390
|
}
|
|
33522
33391
|
|
|
33523
33392
|
parseExpressionStatement(node, expr) {
|
|
33524
|
-
|
|
33525
|
-
|
|
33526
|
-
if (expr.type !== 'Placeholder' || ((_a = expr.extra) == null ? void 0 : _a.parenthesized)) {
|
|
33393
|
+
if (expr.type !== 'Placeholder' || expr.extra?.parenthesized) {
|
|
33527
33394
|
return super.parseExpressionStatement(node, expr);
|
|
33528
33395
|
}
|
|
33529
33396
|
|
|
@@ -33616,9 +33483,7 @@ var placeholders = (superClass) => class PlaceholdersParserMixin extends superCl
|
|
|
33616
33483
|
}
|
|
33617
33484
|
|
|
33618
33485
|
maybeParseExportDefaultSpecifier(node, maybeDefaultIdentifier) {
|
|
33619
|
-
|
|
33620
|
-
|
|
33621
|
-
if ((_a = node.specifiers) == null ? void 0 : _a.length) {
|
|
33486
|
+
if (node.specifiers?.length) {
|
|
33622
33487
|
return true;
|
|
33623
33488
|
}
|
|
33624
33489
|
|
|
@@ -33628,7 +33493,7 @@ var placeholders = (superClass) => class PlaceholdersParserMixin extends superCl
|
|
|
33628
33493
|
checkExport(node) {
|
|
33629
33494
|
const {specifiers} = node;
|
|
33630
33495
|
|
|
33631
|
-
if (specifiers
|
|
33496
|
+
if (specifiers?.length) {
|
|
33632
33497
|
node.specifiers = specifiers.filter((node2) => node2.exported.type === 'Placeholder');
|
|
33633
33498
|
}
|
|
33634
33499
|
|
|
@@ -34152,13 +34017,12 @@ var ExpressionParser = class extends LValParser {
|
|
|
34152
34017
|
}
|
|
34153
34018
|
|
|
34154
34019
|
parseHackPipeBody() {
|
|
34155
|
-
var _a;
|
|
34156
34020
|
const {startLoc} = this.state;
|
|
34157
34021
|
|
|
34158
34022
|
const body = this.parseMaybeAssign();
|
|
34159
34023
|
const requiredParentheses = UnparenthesizedPipeBodyDescriptions.has(body.type);
|
|
34160
34024
|
|
|
34161
|
-
if (requiredParentheses && !
|
|
34025
|
+
if (requiredParentheses && !body.extra?.parenthesized) {
|
|
34162
34026
|
this.raise(Errors.PipeUnparenthesizedBody, startLoc, {
|
|
34163
34027
|
type: body.type,
|
|
34164
34028
|
});
|
|
@@ -34510,10 +34374,9 @@ var ExpressionParser = class extends LValParser {
|
|
|
34510
34374
|
}
|
|
34511
34375
|
|
|
34512
34376
|
parseAsyncArrowFromCallExpression(node, call2) {
|
|
34513
|
-
var _a;
|
|
34514
34377
|
this.resetPreviousNodeTrailingComments(call2);
|
|
34515
34378
|
this.expect(19);
|
|
34516
|
-
this.parseArrowExpression(node, call2.arguments, true,
|
|
34379
|
+
this.parseArrowExpression(node, call2.arguments, true, call2.extra?.trailingCommaLoc);
|
|
34517
34380
|
|
|
34518
34381
|
if (call2.innerComments) {
|
|
34519
34382
|
setInnerComments(node, call2.innerComments);
|
|
@@ -34932,7 +34795,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
34932
34795
|
|
|
34933
34796
|
try {
|
|
34934
34797
|
bigInt = BigInt(value);
|
|
34935
|
-
} catch
|
|
34798
|
+
} catch {
|
|
34936
34799
|
bigInt = null;
|
|
34937
34800
|
}
|
|
34938
34801
|
|
|
@@ -35338,7 +35201,6 @@ var ExpressionParser = class extends LValParser {
|
|
|
35338
35201
|
}
|
|
35339
35202
|
|
|
35340
35203
|
checkGetterSetterParams(method) {
|
|
35341
|
-
var _a;
|
|
35342
35204
|
const paramCount = this.getGetterSetterExpectedParamCount(method);
|
|
35343
35205
|
const params = this.getObjectOrClassMethodParams(method);
|
|
35344
35206
|
|
|
@@ -35346,7 +35208,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
35346
35208
|
this.raise(method.kind === 'get' ? Errors.BadGetterArity : Errors.BadSetterArity, method);
|
|
35347
35209
|
}
|
|
35348
35210
|
|
|
35349
|
-
if (method.kind === 'set' &&
|
|
35211
|
+
if (method.kind === 'set' && params[params.length - 1]?.type === 'RestElement') {
|
|
35350
35212
|
this.raise(Errors.BadSetterRestParameter, method);
|
|
35351
35213
|
}
|
|
35352
35214
|
}
|
|
@@ -36456,10 +36318,8 @@ var StatementParser = class extends ExpressionParser {
|
|
|
36456
36318
|
}
|
|
36457
36319
|
|
|
36458
36320
|
maybeTakeDecorators(maybeDecorators, classNode, exportNode) {
|
|
36459
|
-
var _a;
|
|
36460
|
-
|
|
36461
36321
|
if (maybeDecorators) {
|
|
36462
|
-
if (
|
|
36322
|
+
if (classNode.decorators?.length) {
|
|
36463
36323
|
if (typeof this.getPluginOption('decorators', 'decoratorsBeforeExport') !== 'boolean') {
|
|
36464
36324
|
this.raise(Errors.DecoratorsBeforeAfterExport, classNode.decorators[0]);
|
|
36465
36325
|
}
|
|
@@ -36992,7 +36852,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
36992
36852
|
body.push(stmt);
|
|
36993
36853
|
}
|
|
36994
36854
|
|
|
36995
|
-
afterBlockParse
|
|
36855
|
+
afterBlockParse?.call(this, hasStrictModeDirective);
|
|
36996
36856
|
|
|
36997
36857
|
if (!oldStrict) {
|
|
36998
36858
|
this.setStrict(false);
|
|
@@ -37444,7 +37304,6 @@ var StatementParser = class extends ExpressionParser {
|
|
|
37444
37304
|
}
|
|
37445
37305
|
|
|
37446
37306
|
parseClassStaticBlock(classBody2, member) {
|
|
37447
|
-
var _a;
|
|
37448
37307
|
this.scope.enter(576 | 128 | 16);
|
|
37449
37308
|
const oldLabels = this.state.labels;
|
|
37450
37309
|
|
|
@@ -37457,7 +37316,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
37457
37316
|
this.state.labels = oldLabels;
|
|
37458
37317
|
classBody2.body.push(this.finishNode(member, 'StaticBlock'));
|
|
37459
37318
|
|
|
37460
|
-
if (
|
|
37319
|
+
if (member.decorators?.length) {
|
|
37461
37320
|
this.raise(Errors.DecoratorStaticBlock, member);
|
|
37462
37321
|
}
|
|
37463
37322
|
}
|
|
@@ -37563,7 +37422,6 @@ var StatementParser = class extends ExpressionParser {
|
|
|
37563
37422
|
}
|
|
37564
37423
|
|
|
37565
37424
|
parseExport(node, decorators) {
|
|
37566
|
-
var _a;
|
|
37567
37425
|
const maybeDefaultIdentifier = this.parseMaybeImportPhase(node, true);
|
|
37568
37426
|
const hasDefault = this.maybeParseExportDefaultSpecifier(node, maybeDefaultIdentifier);
|
|
37569
37427
|
const parseAfterDefault = !hasDefault || this.eat(12);
|
|
@@ -37613,7 +37471,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
37613
37471
|
const node2 = node;
|
|
37614
37472
|
this.checkExport(node2, true, false, !!node2.source);
|
|
37615
37473
|
|
|
37616
|
-
if (
|
|
37474
|
+
if (node2.declaration?.type === 'ClassDeclaration') {
|
|
37617
37475
|
this.maybeTakeDecorators(decorators, node2.declaration, node2);
|
|
37618
37476
|
} else if (decorators) {
|
|
37619
37477
|
throw this.raise(Errors.UnsupportedDecoratorExport, node);
|
|
@@ -37649,7 +37507,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
37649
37507
|
|
|
37650
37508
|
maybeParseExportDefaultSpecifier(node, maybeDefaultIdentifier) {
|
|
37651
37509
|
if (maybeDefaultIdentifier || this.isExportDefaultSpecifier()) {
|
|
37652
|
-
this.expectPlugin('exportDefaultFrom', maybeDefaultIdentifier
|
|
37510
|
+
this.expectPlugin('exportDefaultFrom', maybeDefaultIdentifier?.loc.start);
|
|
37653
37511
|
const id = maybeDefaultIdentifier || this.parseIdentifier(true);
|
|
37654
37512
|
const specifier = this.startNodeAtNode(id);
|
|
37655
37513
|
|
|
@@ -37664,10 +37522,8 @@ var StatementParser = class extends ExpressionParser {
|
|
|
37664
37522
|
}
|
|
37665
37523
|
|
|
37666
37524
|
maybeParseExportNamespaceSpecifier(node) {
|
|
37667
|
-
var _a;
|
|
37668
|
-
|
|
37669
37525
|
if (this.isContextual(93)) {
|
|
37670
|
-
|
|
37526
|
+
node.specifiers ?? (node.specifiers = []);
|
|
37671
37527
|
const specifier = this.startNodeAt(this.state.lastTokStartLoc);
|
|
37672
37528
|
this.next();
|
|
37673
37529
|
specifier.exported = this.parseModuleExportName();
|
|
@@ -37846,8 +37702,6 @@ var StatementParser = class extends ExpressionParser {
|
|
|
37846
37702
|
}
|
|
37847
37703
|
|
|
37848
37704
|
checkExport(node, checkNames, isDefault, isFrom) {
|
|
37849
|
-
var _a, _b;
|
|
37850
|
-
|
|
37851
37705
|
if (checkNames) {
|
|
37852
37706
|
if (isDefault) {
|
|
37853
37707
|
this.checkDuplicateExports(node, 'default');
|
|
@@ -37855,11 +37709,11 @@ var StatementParser = class extends ExpressionParser {
|
|
|
37855
37709
|
if (this.hasPlugin('exportDefaultFrom')) {
|
|
37856
37710
|
const declaration = node.declaration;
|
|
37857
37711
|
|
|
37858
|
-
if (declaration.type === 'Identifier' && declaration.name === 'from' && declaration.end - declaration.start === 4 && !
|
|
37712
|
+
if (declaration.type === 'Identifier' && declaration.name === 'from' && declaration.end - declaration.start === 4 && !declaration.extra?.parenthesized) {
|
|
37859
37713
|
this.raise(Errors.ExportDefaultFromAsIdentifier, declaration);
|
|
37860
37714
|
}
|
|
37861
37715
|
}
|
|
37862
|
-
} else if (
|
|
37716
|
+
} else if (node.specifiers?.length) {
|
|
37863
37717
|
for (const specifier of node.specifiers) {
|
|
37864
37718
|
const {exported} = specifier;
|
|
37865
37719
|
|
|
@@ -38010,7 +37864,6 @@ var StatementParser = class extends ExpressionParser {
|
|
|
38010
37864
|
}
|
|
38011
37865
|
|
|
38012
37866
|
checkImportReflection(node) {
|
|
38013
|
-
var _a;
|
|
38014
37867
|
const {specifiers} = node;
|
|
38015
37868
|
|
|
38016
37869
|
const singleBindingType = specifiers.length === 1 ? specifiers[0].type : null;
|
|
@@ -38028,7 +37881,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
38028
37881
|
this.raise(Errors.ImportReflectionNotBinding, specifiers[0].loc.start);
|
|
38029
37882
|
}
|
|
38030
37883
|
|
|
38031
|
-
if (
|
|
37884
|
+
if (node.assertions?.length > 0) {
|
|
38032
37885
|
this.raise(Errors.ImportReflectionHasAssertion, specifiers[0].loc.start);
|
|
38033
37886
|
}
|
|
38034
37887
|
}
|
|
@@ -38139,8 +37992,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
38139
37992
|
}
|
|
38140
37993
|
|
|
38141
37994
|
parseImportSourceAndAttributes(node) {
|
|
38142
|
-
|
|
38143
|
-
(_a = node.specifiers) != null ? _a : node.specifiers = [];
|
|
37995
|
+
node.specifiers ?? (node.specifiers = []);
|
|
38144
37996
|
node.source = this.parseImportSource();
|
|
38145
37997
|
this.maybeParseImportAttributes(node);
|
|
38146
37998
|
this.checkImportReflection(node);
|
|
@@ -38443,7 +38295,7 @@ var Parser = class extends StatementParser {
|
|
|
38443
38295
|
};
|
|
38444
38296
|
|
|
38445
38297
|
function parse(input, options) {
|
|
38446
|
-
if (
|
|
38298
|
+
if (options?.sourceType === 'unambiguous') {
|
|
38447
38299
|
options = Object.assign({}, options);
|
|
38448
38300
|
try {
|
|
38449
38301
|
options.sourceType = 'module';
|
|
@@ -38458,7 +38310,7 @@ function parse(input, options) {
|
|
|
38458
38310
|
try {
|
|
38459
38311
|
options.sourceType = 'script';
|
|
38460
38312
|
return getParser(options, input).parse();
|
|
38461
|
-
} catch
|
|
38313
|
+
} catch {}
|
|
38462
38314
|
} else {
|
|
38463
38315
|
ast.program.sourceType = 'script';
|
|
38464
38316
|
}
|
|
@@ -38468,7 +38320,7 @@ function parse(input, options) {
|
|
|
38468
38320
|
try {
|
|
38469
38321
|
options.sourceType = 'script';
|
|
38470
38322
|
return getParser(options, input).parse();
|
|
38471
|
-
} catch
|
|
38323
|
+
} catch {}
|
|
38472
38324
|
|
|
38473
38325
|
|
|
38474
38326
|
throw moduleError;
|
|
@@ -38504,7 +38356,7 @@ function getParser(options, input) {
|
|
|
38504
38356
|
let cls = Parser;
|
|
38505
38357
|
const pluginsMap = /* @__PURE__ */new Map();
|
|
38506
38358
|
|
|
38507
|
-
if (options
|
|
38359
|
+
if (options?.plugins) {
|
|
38508
38360
|
for (const plugin of options.plugins) {
|
|
38509
38361
|
let name, opts;
|
|
38510
38362
|
|
|
@@ -39072,7 +38924,6 @@ function parseAndBuildMetadata(formatter, code2, opts) {
|
|
|
39072
38924
|
}
|
|
39073
38925
|
|
|
39074
38926
|
function placeholderVisitorHandler(node, ancestors, state) {
|
|
39075
|
-
var _a;
|
|
39076
38927
|
let name;
|
|
39077
38928
|
let hasSyntacticPlaceholders = state.syntactic.placeholders.length > 0;
|
|
39078
38929
|
|
|
@@ -39098,7 +38949,7 @@ function placeholderVisitorHandler(node, ancestors, state) {
|
|
|
39098
38949
|
throw new Error('\'.placeholderWhitelist\' and \'.placeholderPattern\' aren\'t compatible with \'.syntacticPlaceholders: true\'');
|
|
39099
38950
|
}
|
|
39100
38951
|
|
|
39101
|
-
if (!hasSyntacticPlaceholders && (state.placeholderPattern === false || !(state.placeholderPattern || PATTERN).test(name)) && !
|
|
38952
|
+
if (!hasSyntacticPlaceholders && (state.placeholderPattern === false || !(state.placeholderPattern || PATTERN).test(name)) && !state.placeholderWhitelist?.has(name)) {
|
|
39102
38953
|
return;
|
|
39103
38954
|
}
|
|
39104
38955
|
|
|
@@ -39230,10 +39081,8 @@ function populatePlaceholders(metadata, replacements) {
|
|
|
39230
39081
|
.slice()
|
|
39231
39082
|
.reverse()
|
|
39232
39083
|
.forEach((placeholder2) => {
|
|
39233
|
-
var _a;
|
|
39234
|
-
|
|
39235
39084
|
try {
|
|
39236
|
-
applyReplacement(placeholder2, ast, (
|
|
39085
|
+
applyReplacement(placeholder2, ast, (replacements && replacements[placeholder2.name]) ?? null);
|
|
39237
39086
|
} catch(e) {
|
|
39238
39087
|
e.message = `@babel/template placeholder "${placeholder2.name}": ${e.message}`;
|
|
39239
39088
|
throw e;
|
|
@@ -40566,13 +40415,11 @@ var SourceMap = class {
|
|
|
40566
40415
|
__publicField(this, '_lastSourceLine', 0);
|
|
40567
40416
|
__publicField(this, '_lastSourceColumn', 0);
|
|
40568
40417
|
__publicField(this, '_inputMap');
|
|
40569
|
-
var _a, _b;
|
|
40570
|
-
|
|
40571
40418
|
const map = this._map = new GenMapping({
|
|
40572
40419
|
sourceRoot: opts.sourceRoot,
|
|
40573
40420
|
});
|
|
40574
40421
|
|
|
40575
|
-
this._sourceFileName =
|
|
40422
|
+
this._sourceFileName = opts.sourceFileName?.replace(/\\/g, '/');
|
|
40576
40423
|
this._rawMappings = void 0;
|
|
40577
40424
|
|
|
40578
40425
|
if (opts.inputSourceMap) {
|
|
@@ -40581,7 +40428,7 @@ var SourceMap = class {
|
|
|
40581
40428
|
|
|
40582
40429
|
if (resolvedSources.length) {
|
|
40583
40430
|
for (let i = 0; i < resolvedSources.length; i++) {
|
|
40584
|
-
setSourceContent(map, resolvedSources[i],
|
|
40431
|
+
setSourceContent(map, resolvedSources[i], this._inputMap.sourcesContent?.[i]);
|
|
40585
40432
|
}
|
|
40586
40433
|
}
|
|
40587
40434
|
}
|
|
@@ -40627,7 +40474,7 @@ var SourceMap = class {
|
|
|
40627
40474
|
}
|
|
40628
40475
|
} else {
|
|
40629
40476
|
originalMapping = {
|
|
40630
|
-
source:
|
|
40477
|
+
source: filename?.replace(/\\/g, '/') || this._sourceFileName,
|
|
40631
40478
|
line,
|
|
40632
40479
|
column,
|
|
40633
40480
|
};
|
|
@@ -40637,7 +40484,7 @@ var SourceMap = class {
|
|
|
40637
40484
|
maybeAddMapping(this._map, {
|
|
40638
40485
|
name: identifierName,
|
|
40639
40486
|
generated,
|
|
40640
|
-
source: originalMapping
|
|
40487
|
+
source: originalMapping?.source,
|
|
40641
40488
|
original: originalMapping,
|
|
40642
40489
|
});
|
|
40643
40490
|
}
|
|
@@ -40721,7 +40568,7 @@ var Buffer2 = class {
|
|
|
40721
40568
|
const map = this._map;
|
|
40722
40569
|
const result = {
|
|
40723
40570
|
code: (this._buf + this._str).trimRight(),
|
|
40724
|
-
decodedMap: map
|
|
40571
|
+
decodedMap: map?.getDecoded(),
|
|
40725
40572
|
get __mergedMap() {
|
|
40726
40573
|
return this.map;
|
|
40727
40574
|
},
|
|
@@ -40738,7 +40585,7 @@ var Buffer2 = class {
|
|
|
40738
40585
|
});
|
|
40739
40586
|
},
|
|
40740
40587
|
get rawMappings() {
|
|
40741
|
-
const mappings = map
|
|
40588
|
+
const mappings = map?.getRawMappings();
|
|
40742
40589
|
|
|
40743
40590
|
result.rawMappings = mappings;
|
|
40744
40591
|
return mappings;
|
|
@@ -40888,8 +40735,7 @@ var Buffer2 = class {
|
|
|
40888
40735
|
}
|
|
40889
40736
|
|
|
40890
40737
|
_mark(line, column, identifierName, identifierNamePos, filename) {
|
|
40891
|
-
|
|
40892
|
-
(_a = this._map) == null ? void 0 : _a.mark(this._position, line, column, identifierName, identifierNamePos, filename);
|
|
40738
|
+
this._map?.mark(this._position, line, column, identifierName, identifierNamePos, filename);
|
|
40893
40739
|
}
|
|
40894
40740
|
|
|
40895
40741
|
removeTrailingNewline() {
|
|
@@ -41176,23 +41022,17 @@ nodes.ObjectMethod = function(node, parent) {
|
|
|
41176
41022
|
}
|
|
41177
41023
|
};
|
|
41178
41024
|
nodes.ObjectTypeCallProperty = function(node, parent) {
|
|
41179
|
-
|
|
41180
|
-
|
|
41181
|
-
if (parent.callProperties[0] === node && !((_a = parent.properties) == null ? void 0 : _a.length)) {
|
|
41025
|
+
if (parent.callProperties[0] === node && !parent.properties?.length) {
|
|
41182
41026
|
return 1;
|
|
41183
41027
|
}
|
|
41184
41028
|
};
|
|
41185
41029
|
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)) {
|
|
41030
|
+
if (parent.indexers[0] === node && !parent.properties?.length && !parent.callProperties?.length) {
|
|
41189
41031
|
return 1;
|
|
41190
41032
|
}
|
|
41191
41033
|
};
|
|
41192
41034
|
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)) {
|
|
41035
|
+
if (parent.internalSlots[0] === node && !parent.properties?.length && !parent.callProperties?.length && !parent.indexers?.length) {
|
|
41196
41036
|
return 1;
|
|
41197
41037
|
}
|
|
41198
41038
|
};
|
|
@@ -41552,10 +41392,9 @@ function LogicalExpression2(node, parent) {
|
|
|
41552
41392
|
}
|
|
41553
41393
|
|
|
41554
41394
|
function Identifier$1(node, parent, tokenContext, getRawIdentifier) {
|
|
41555
|
-
var _a;
|
|
41556
41395
|
const parentType = parent.type;
|
|
41557
41396
|
|
|
41558
|
-
if (
|
|
41397
|
+
if (node.extra?.parenthesized && parentType === 'AssignmentExpression' && parent.left === node) {
|
|
41559
41398
|
const rightType = parent.right.type;
|
|
41560
41399
|
|
|
41561
41400
|
if ((rightType === 'FunctionExpression' || rightType === 'ClassExpression') && parent.right.id == null) {
|
|
@@ -41659,8 +41498,7 @@ function expandAliases(obj) {
|
|
|
41659
41498
|
const fn = map.get(type);
|
|
41660
41499
|
|
|
41661
41500
|
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);
|
|
41501
|
+
return fn(node, parent, stack, getRawIdentifier) ?? func(node, parent, stack, getRawIdentifier);
|
|
41664
41502
|
} : func);
|
|
41665
41503
|
}
|
|
41666
41504
|
|
|
@@ -41691,8 +41529,6 @@ function isOrHasCallExpression(node) {
|
|
|
41691
41529
|
}
|
|
41692
41530
|
|
|
41693
41531
|
function needsWhitespace(node, parent, type) {
|
|
41694
|
-
var _a;
|
|
41695
|
-
|
|
41696
41532
|
if (!node)
|
|
41697
41533
|
return false;
|
|
41698
41534
|
|
|
@@ -41700,7 +41536,7 @@ function needsWhitespace(node, parent, type) {
|
|
|
41700
41536
|
node = node.expression;
|
|
41701
41537
|
}
|
|
41702
41538
|
|
|
41703
|
-
const flag =
|
|
41539
|
+
const flag = expandedWhitespaceNodes.get(node.type)?.(node, parent);
|
|
41704
41540
|
|
|
41705
41541
|
if (typeof flag === 'number') {
|
|
41706
41542
|
return (flag & type) !== 0;
|
|
@@ -41718,8 +41554,6 @@ function needsWhitespaceAfter(node, parent) {
|
|
|
41718
41554
|
}
|
|
41719
41555
|
|
|
41720
41556
|
function needsParens$1(node, parent, tokenContext, getRawIdentifier) {
|
|
41721
|
-
var _a;
|
|
41722
|
-
|
|
41723
41557
|
if (!parent)
|
|
41724
41558
|
return false;
|
|
41725
41559
|
|
|
@@ -41732,7 +41566,7 @@ function needsParens$1(node, parent, tokenContext, getRawIdentifier) {
|
|
|
41732
41566
|
return !isDecoratorMemberExpression(node) && !(isCallExpression$1(node) && isDecoratorMemberExpression(node.callee)) && !isParenthesizedExpression2(node);
|
|
41733
41567
|
}
|
|
41734
41568
|
|
|
41735
|
-
return
|
|
41569
|
+
return expandedParens.get(node.type)?.(node, parent, tokenContext, getRawIdentifier);
|
|
41736
41570
|
}
|
|
41737
41571
|
|
|
41738
41572
|
function isDecoratorMemberExpression(node) {
|
|
@@ -42028,7 +41862,7 @@ function* childrenIterator(node) {
|
|
|
42028
41862
|
continue;
|
|
42029
41863
|
|
|
42030
41864
|
if (Array.isArray(child)) {
|
|
42031
|
-
yield*
|
|
41865
|
+
yield* child;
|
|
42032
41866
|
} else {
|
|
42033
41867
|
yield child;
|
|
42034
41868
|
}
|
|
@@ -42479,7 +42313,7 @@ function ForXStatement(node) {
|
|
|
42479
42313
|
{
|
|
42480
42314
|
const exit = this.enterForXStatementInit(isForOf);
|
|
42481
42315
|
this.print(node.left);
|
|
42482
|
-
exit
|
|
42316
|
+
exit?.();
|
|
42483
42317
|
}
|
|
42484
42318
|
this.space();
|
|
42485
42319
|
this.word(isForOf ? 'of' : 'in');
|
|
@@ -42732,7 +42566,7 @@ function ClassBody2(node) {
|
|
|
42732
42566
|
} else {
|
|
42733
42567
|
this.newline();
|
|
42734
42568
|
const separator = classBodyEmptySemicolonsPrinter(this, node);
|
|
42735
|
-
separator
|
|
42569
|
+
separator?.(-1);
|
|
42736
42570
|
const exit = this.enterDelimited();
|
|
42737
42571
|
this.printJoin(node.body, true, true, separator, true);
|
|
42738
42572
|
exit();
|
|
@@ -42782,11 +42616,10 @@ function classBodyEmptySemicolonsPrinter(printer, node) {
|
|
|
42782
42616
|
}
|
|
42783
42617
|
|
|
42784
42618
|
function ClassProperty2(node) {
|
|
42785
|
-
var _a, _b;
|
|
42786
42619
|
this.printJoin(node.decorators);
|
|
42787
42620
|
|
|
42788
42621
|
if (!node.static && !this.format.preserveFormat) {
|
|
42789
|
-
const endLine =
|
|
42622
|
+
const endLine = node.key.loc?.end?.line;
|
|
42790
42623
|
|
|
42791
42624
|
if (endLine)
|
|
42792
42625
|
this.catchUp(endLine);
|
|
@@ -42824,9 +42657,8 @@ function ClassProperty2(node) {
|
|
|
42824
42657
|
}
|
|
42825
42658
|
|
|
42826
42659
|
function ClassAccessorProperty2(node) {
|
|
42827
|
-
var _a, _b;
|
|
42828
42660
|
this.printJoin(node.decorators);
|
|
42829
|
-
const endLine =
|
|
42661
|
+
const endLine = node.key.loc?.end?.line;
|
|
42830
42662
|
|
|
42831
42663
|
if (endLine)
|
|
42832
42664
|
this.catchUp(endLine);
|
|
@@ -42902,11 +42734,10 @@ function ClassPrivateMethod2(node) {
|
|
|
42902
42734
|
}
|
|
42903
42735
|
|
|
42904
42736
|
function _classMethodHead(node) {
|
|
42905
|
-
var _a, _b;
|
|
42906
42737
|
this.printJoin(node.decorators);
|
|
42907
42738
|
|
|
42908
42739
|
if (!this.format.preserveFormat) {
|
|
42909
|
-
const endLine =
|
|
42740
|
+
const endLine = node.key.loc?.end?.line;
|
|
42910
42741
|
|
|
42911
42742
|
if (endLine)
|
|
42912
42743
|
this.catchUp(endLine);
|
|
@@ -43084,8 +42915,6 @@ function ArrowFunctionExpression2(node, parent) {
|
|
|
43084
42915
|
}
|
|
43085
42916
|
|
|
43086
42917
|
function _shouldPrintArrowParamsParens(node) {
|
|
43087
|
-
var _a, _b;
|
|
43088
|
-
|
|
43089
42918
|
if (node.params.length !== 1)
|
|
43090
42919
|
return true;
|
|
43091
42920
|
|
|
@@ -43095,7 +42924,7 @@ function _shouldPrintArrowParamsParens(node) {
|
|
|
43095
42924
|
|
|
43096
42925
|
const firstParam = node.params[0];
|
|
43097
42926
|
|
|
43098
|
-
if (!isIdentifier$1(firstParam) || firstParam.typeAnnotation || firstParam.optional ||
|
|
42927
|
+
if (!isIdentifier$1(firstParam) || firstParam.typeAnnotation || firstParam.optional || firstParam.leadingComments?.length || firstParam.trailingComments?.length) {
|
|
43099
42928
|
return true;
|
|
43100
42929
|
}
|
|
43101
42930
|
|
|
@@ -43108,7 +42937,7 @@ function _shouldPrintArrowParamsParens(node) {
|
|
|
43108
42937
|
|
|
43109
42938
|
const arrowToken = this.tokenMap.findMatching(node, '=>');
|
|
43110
42939
|
|
|
43111
|
-
if (
|
|
42940
|
+
if (arrowToken?.loc == null)
|
|
43112
42941
|
return true;
|
|
43113
42942
|
|
|
43114
42943
|
return arrowToken.loc.start.line !== node.loc.start.line;
|
|
@@ -43121,7 +42950,6 @@ function _shouldPrintArrowParamsParens(node) {
|
|
|
43121
42950
|
}
|
|
43122
42951
|
|
|
43123
42952
|
function _getFuncIdName(idNode, parent) {
|
|
43124
|
-
var _a, _b, _c, _d;
|
|
43125
42953
|
let id = idNode;
|
|
43126
42954
|
|
|
43127
42955
|
if (!id && parent) {
|
|
@@ -43149,17 +42977,17 @@ function _getFuncIdName(idNode, parent) {
|
|
|
43149
42977
|
|
|
43150
42978
|
if (id.type === 'Identifier') {
|
|
43151
42979
|
nameInfo = {
|
|
43152
|
-
pos:
|
|
43153
|
-
name:
|
|
42980
|
+
pos: id.loc?.start,
|
|
42981
|
+
name: id.loc?.identifierName || id.name,
|
|
43154
42982
|
};
|
|
43155
42983
|
} else if (id.type === 'PrivateName') {
|
|
43156
42984
|
nameInfo = {
|
|
43157
|
-
pos:
|
|
42985
|
+
pos: id.loc?.start,
|
|
43158
42986
|
name: '#' + id.id.name,
|
|
43159
42987
|
};
|
|
43160
42988
|
} else if (id.type === 'StringLiteral') {
|
|
43161
42989
|
nameInfo = {
|
|
43162
|
-
pos:
|
|
42990
|
+
pos: id.loc?.start,
|
|
43163
42991
|
name: id.value,
|
|
43164
42992
|
};
|
|
43165
42993
|
}
|
|
@@ -43242,7 +43070,6 @@ function _printAttributes(node, hasPreviousBrace) {
|
|
|
43242
43070
|
}
|
|
43243
43071
|
|
|
43244
43072
|
function ExportAllDeclaration2(node) {
|
|
43245
|
-
var _a, _b;
|
|
43246
43073
|
this.word('export');
|
|
43247
43074
|
this.space();
|
|
43248
43075
|
|
|
@@ -43256,7 +43083,7 @@ function ExportAllDeclaration2(node) {
|
|
|
43256
43083
|
this.word('from');
|
|
43257
43084
|
this.space();
|
|
43258
43085
|
|
|
43259
|
-
if (
|
|
43086
|
+
if (node.attributes?.length || node.assertions?.length) {
|
|
43260
43087
|
this.print(node.source, true);
|
|
43261
43088
|
this.space();
|
|
43262
43089
|
this._printAttributes(node, false);
|
|
@@ -43274,7 +43101,6 @@ function maybePrintDecoratorsBeforeExport(printer, node) {
|
|
|
43274
43101
|
}
|
|
43275
43102
|
|
|
43276
43103
|
function ExportNamedDeclaration2(node) {
|
|
43277
|
-
var _a, _b;
|
|
43278
43104
|
maybePrintDecoratorsBeforeExport(this, node);
|
|
43279
43105
|
this.word('export');
|
|
43280
43106
|
this.space();
|
|
@@ -43330,7 +43156,7 @@ function ExportNamedDeclaration2(node) {
|
|
|
43330
43156
|
this.word('from');
|
|
43331
43157
|
this.space();
|
|
43332
43158
|
|
|
43333
|
-
if (
|
|
43159
|
+
if (node.attributes?.length || node.assertions?.length) {
|
|
43334
43160
|
this.print(node.source, true);
|
|
43335
43161
|
this.space();
|
|
43336
43162
|
this._printAttributes(node, hasBrace);
|
|
@@ -43359,7 +43185,6 @@ function ExportDefaultDeclaration2(node) {
|
|
|
43359
43185
|
}
|
|
43360
43186
|
|
|
43361
43187
|
function ImportDeclaration2(node) {
|
|
43362
|
-
var _a, _b;
|
|
43363
43188
|
this.word('import');
|
|
43364
43189
|
this.space();
|
|
43365
43190
|
const isTypeKind = node.importKind === 'type' || node.importKind === 'typeof';
|
|
@@ -43417,7 +43242,7 @@ function ImportDeclaration2(node) {
|
|
|
43417
43242
|
this.space();
|
|
43418
43243
|
}
|
|
43419
43244
|
|
|
43420
|
-
if (
|
|
43245
|
+
if (node.attributes?.length || node.assertions?.length) {
|
|
43421
43246
|
this.print(node.source, true);
|
|
43422
43247
|
this.space();
|
|
43423
43248
|
this._printAttributes(node, hasBrace);
|
|
@@ -43494,8 +43319,7 @@ function _getRawIdentifier(node) {
|
|
|
43494
43319
|
}
|
|
43495
43320
|
|
|
43496
43321
|
function Identifier2(node) {
|
|
43497
|
-
|
|
43498
|
-
this.sourceIdentifierName(((_a = node.loc) == null ? void 0 : _a.identifierName) || node.name);
|
|
43322
|
+
this.sourceIdentifierName(node.loc?.identifierName || node.name);
|
|
43499
43323
|
this.word(this.tokenMap ? this._getRawIdentifier(node) : node.name);
|
|
43500
43324
|
}
|
|
43501
43325
|
|
|
@@ -44020,7 +43844,7 @@ function FunctionTypeAnnotation2(node, parent) {
|
|
|
44020
43844
|
}
|
|
44021
43845
|
|
|
44022
43846
|
this.tokenChar(41);
|
|
44023
|
-
const type = parent
|
|
43847
|
+
const type = parent?.type;
|
|
44024
43848
|
|
|
44025
43849
|
if (type != null && (type === 'ObjectTypeCallProperty' || type === 'ObjectTypeInternalSlot' || type === 'DeclareFunction' || type === 'ObjectTypeProperty' && parent.method)) {
|
|
44026
43850
|
this.tokenChar(58);
|
|
@@ -44053,11 +43877,10 @@ function InterfaceExtends2(node) {
|
|
|
44053
43877
|
}
|
|
44054
43878
|
|
|
44055
43879
|
function _interfaceish(node) {
|
|
44056
|
-
var _a, _b, _c;
|
|
44057
43880
|
this.print(node.id);
|
|
44058
43881
|
this.print(node.typeParameters);
|
|
44059
43882
|
|
|
44060
|
-
if (
|
|
43883
|
+
if (node.extends?.length) {
|
|
44061
43884
|
this.space();
|
|
44062
43885
|
this.word('extends');
|
|
44063
43886
|
this.space();
|
|
@@ -44065,14 +43888,14 @@ function _interfaceish(node) {
|
|
|
44065
43888
|
}
|
|
44066
43889
|
|
|
44067
43890
|
if (node.type === 'DeclareClass') {
|
|
44068
|
-
if (
|
|
43891
|
+
if (node.mixins?.length) {
|
|
44069
43892
|
this.space();
|
|
44070
43893
|
this.word('mixins');
|
|
44071
43894
|
this.space();
|
|
44072
43895
|
this.printList(node.mixins);
|
|
44073
43896
|
}
|
|
44074
43897
|
|
|
44075
|
-
if (
|
|
43898
|
+
if (node.implements?.length) {
|
|
44076
43899
|
this.space();
|
|
44077
43900
|
this.word('implements');
|
|
44078
43901
|
this.space();
|
|
@@ -44085,8 +43908,7 @@ function _interfaceish(node) {
|
|
|
44085
43908
|
}
|
|
44086
43909
|
|
|
44087
43910
|
function _variance(node) {
|
|
44088
|
-
|
|
44089
|
-
const kind = (_a = node.variance) == null ? void 0 : _a.kind;
|
|
43911
|
+
const kind = node.variance?.kind;
|
|
44090
43912
|
|
|
44091
43913
|
if (kind != null) {
|
|
44092
43914
|
if (kind === 'plus') {
|
|
@@ -44110,10 +43932,9 @@ function andSeparator(occurrenceCount) {
|
|
|
44110
43932
|
}
|
|
44111
43933
|
|
|
44112
43934
|
function InterfaceTypeAnnotation2(node) {
|
|
44113
|
-
var _a;
|
|
44114
43935
|
this.word('interface');
|
|
44115
43936
|
|
|
44116
|
-
if (
|
|
43937
|
+
if (node.extends?.length) {
|
|
44117
43938
|
this.space();
|
|
44118
43939
|
this.word('extends');
|
|
44119
43940
|
this.space();
|
|
@@ -44439,16 +44260,15 @@ function File2(node) {
|
|
|
44439
44260
|
}
|
|
44440
44261
|
|
|
44441
44262
|
function Program2(node) {
|
|
44442
|
-
var _a, _b;
|
|
44443
44263
|
this.noIndentInnerCommentsHere();
|
|
44444
44264
|
this.printInnerComments();
|
|
44445
|
-
const directivesLen =
|
|
44265
|
+
const directivesLen = node.directives?.length;
|
|
44446
44266
|
|
|
44447
44267
|
if (directivesLen) {
|
|
44448
44268
|
const newline = node.body.length ? 2 : 1;
|
|
44449
44269
|
this.printSequence(node.directives, void 0, newline);
|
|
44450
44270
|
|
|
44451
|
-
if (!
|
|
44271
|
+
if (!node.directives[directivesLen - 1].trailingComments?.length) {
|
|
44452
44272
|
this.newline(newline);
|
|
44453
44273
|
}
|
|
44454
44274
|
}
|
|
@@ -44457,16 +44277,15 @@ function Program2(node) {
|
|
|
44457
44277
|
}
|
|
44458
44278
|
|
|
44459
44279
|
function BlockStatement2(node) {
|
|
44460
|
-
var _a, _b;
|
|
44461
44280
|
this.tokenChar(123);
|
|
44462
44281
|
const exit = this.enterDelimited();
|
|
44463
|
-
const directivesLen =
|
|
44282
|
+
const directivesLen = node.directives?.length;
|
|
44464
44283
|
|
|
44465
44284
|
if (directivesLen) {
|
|
44466
44285
|
const newline = node.body.length ? 2 : 1;
|
|
44467
44286
|
this.printSequence(node.directives, true, newline);
|
|
44468
44287
|
|
|
44469
|
-
if (!
|
|
44288
|
+
if (!node.directives[directivesLen - 1].trailingComments?.length) {
|
|
44470
44289
|
this.newline(newline);
|
|
44471
44290
|
}
|
|
44472
44291
|
}
|
|
@@ -44984,10 +44803,9 @@ function TSIntersectionType2(node) {
|
|
|
44984
44803
|
}
|
|
44985
44804
|
|
|
44986
44805
|
function tsPrintUnionOrIntersectionType(printer, node, sep) {
|
|
44987
|
-
var _a;
|
|
44988
44806
|
let hasLeadingToken = 0;
|
|
44989
44807
|
|
|
44990
|
-
if (
|
|
44808
|
+
if (printer.tokenMap?.startMatches(node, sep)) {
|
|
44991
44809
|
hasLeadingToken = 1;
|
|
44992
44810
|
printer.token(sep);
|
|
44993
44811
|
}
|
|
@@ -45130,7 +44948,7 @@ function TSInterfaceDeclaration2(node) {
|
|
|
45130
44948
|
this.print(id);
|
|
45131
44949
|
this.print(typeParameters);
|
|
45132
44950
|
|
|
45133
|
-
if (extendz
|
|
44951
|
+
if (extendz?.length) {
|
|
45134
44952
|
this.space();
|
|
45135
44953
|
this.word('extends');
|
|
45136
44954
|
this.space();
|
|
@@ -45227,10 +45045,7 @@ function TSEnumDeclaration2(node) {
|
|
|
45227
45045
|
}
|
|
45228
45046
|
|
|
45229
45047
|
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
|
-
});
|
|
45048
|
+
printBraced(this, node, () => this.printList(node.members, this.shouldPrintTrailingComma('}') ?? false, true, true));
|
|
45234
45049
|
}
|
|
45235
45050
|
|
|
45236
45051
|
function TSEnumMember2(node) {
|
|
@@ -45390,7 +45205,6 @@ function printBraced(printer, node, cb) {
|
|
|
45390
45205
|
}
|
|
45391
45206
|
|
|
45392
45207
|
function printModifiersList(printer, node, modifiers) {
|
|
45393
|
-
var _a;
|
|
45394
45208
|
const modifiersSet = /* @__PURE__ */new Set();
|
|
45395
45209
|
|
|
45396
45210
|
for (const modifier of modifiers) {
|
|
@@ -45398,7 +45212,7 @@ function printModifiersList(printer, node, modifiers) {
|
|
|
45398
45212
|
modifiersSet.add(modifier);
|
|
45399
45213
|
}
|
|
45400
45214
|
|
|
45401
|
-
|
|
45215
|
+
printer.tokenMap?.find(node, (tok) => {
|
|
45402
45216
|
if (modifiersSet.has(tok.value)) {
|
|
45403
45217
|
printer.token(tok.value);
|
|
45404
45218
|
printer.space();
|
|
@@ -45735,7 +45549,7 @@ var Printer = class {
|
|
|
45735
45549
|
this._tokens = tokens;
|
|
45736
45550
|
this._originalCode = originalCode;
|
|
45737
45551
|
this._indentRepeat = format.indent.style.length;
|
|
45738
|
-
this._inputMap = map
|
|
45552
|
+
this._inputMap = map?._inputMap;
|
|
45739
45553
|
this._buf = new Buffer2(map, format.indent.style[0]);
|
|
45740
45554
|
}
|
|
45741
45555
|
|
|
@@ -46079,14 +45893,14 @@ var Printer = class {
|
|
|
46079
45893
|
const {format} = this;
|
|
46080
45894
|
|
|
46081
45895
|
if (!format.preserveFormat) {
|
|
46082
|
-
if (format.retainLines &&
|
|
45896
|
+
if (format.retainLines && loc?.[prop]) {
|
|
46083
45897
|
this.catchUp(loc[prop].line);
|
|
46084
45898
|
}
|
|
46085
45899
|
|
|
46086
45900
|
return;
|
|
46087
45901
|
}
|
|
46088
45902
|
|
|
46089
|
-
const pos = loc
|
|
45903
|
+
const pos = loc?.[prop];
|
|
46090
45904
|
|
|
46091
45905
|
if (pos != null)
|
|
46092
45906
|
this._catchUpTo(pos);
|
|
@@ -46124,8 +45938,6 @@ var Printer = class {
|
|
|
46124
45938
|
}
|
|
46125
45939
|
|
|
46126
45940
|
print(node, noLineTerminatorAfter, trailingCommentsLineOffset) {
|
|
46127
|
-
var _a, _b, _c, _d;
|
|
46128
|
-
|
|
46129
45941
|
if (!node)
|
|
46130
45942
|
return;
|
|
46131
45943
|
|
|
@@ -46156,7 +45968,7 @@ var Printer = class {
|
|
|
46156
45968
|
|
|
46157
45969
|
this._insideAux = node.loc == null;
|
|
46158
45970
|
this._maybeAddAuxComment(this._insideAux && !oldInAux);
|
|
46159
|
-
const parenthesized =
|
|
45971
|
+
const parenthesized = node.extra?.parenthesized;
|
|
46160
45972
|
let shouldPrintParens = parenthesized
|
|
46161
45973
|
&& format.preserveFormat
|
|
46162
45974
|
|| parenthesized
|
|
@@ -46164,8 +45976,8 @@ var Printer = class {
|
|
|
46164
45976
|
&& nodeType === 'FunctionExpression'
|
|
46165
45977
|
|| needsParens(node, parent, this.tokenContext, format.preserveFormat ? this._boundGetRawIdentifier : void 0);
|
|
46166
45978
|
|
|
46167
|
-
if (!shouldPrintParens && parenthesized &&
|
|
46168
|
-
const parentType = parent
|
|
45979
|
+
if (!shouldPrintParens && parenthesized && node.leadingComments?.length && node.leadingComments[0].type === 'CommentBlock') {
|
|
45980
|
+
const parentType = parent?.type;
|
|
46169
45981
|
|
|
46170
45982
|
switch(parentType) {
|
|
46171
45983
|
case 'ExpressionStatement':
|
|
@@ -46187,7 +45999,7 @@ var Printer = class {
|
|
|
46187
45999
|
|
|
46188
46000
|
let indentParenthesized = false;
|
|
46189
46001
|
|
|
46190
|
-
if (!shouldPrintParens && this._noLineTerminator && (
|
|
46002
|
+
if (!shouldPrintParens && this._noLineTerminator && (node.leadingComments?.some(commentIsNewline) || this.format.retainLines && node.loc && node.loc.start.line > this._buf.getCurrentLine())) {
|
|
46191
46003
|
shouldPrintParens = true;
|
|
46192
46004
|
indentParenthesized = true;
|
|
46193
46005
|
}
|
|
@@ -46199,7 +46011,7 @@ var Printer = class {
|
|
|
46199
46011
|
noLineTerminatorAfter || (noLineTerminatorAfter = parent && this._noLineTerminatorAfterNode === parent && isLastChild(parent, node));
|
|
46200
46012
|
|
|
46201
46013
|
if (noLineTerminatorAfter) {
|
|
46202
|
-
if (
|
|
46014
|
+
if (node.trailingComments?.some(commentIsNewline)) {
|
|
46203
46015
|
if (isExpression2(node))
|
|
46204
46016
|
shouldPrintParens = true;
|
|
46205
46017
|
} else {
|
|
@@ -46303,19 +46115,17 @@ var Printer = class {
|
|
|
46303
46115
|
getPossibleRaw(node) {
|
|
46304
46116
|
const extra = node.extra;
|
|
46305
46117
|
|
|
46306
|
-
if (
|
|
46118
|
+
if (extra?.raw != null && extra.rawValue != null && node.value === extra.rawValue) {
|
|
46307
46119
|
return extra.raw;
|
|
46308
46120
|
}
|
|
46309
46121
|
}
|
|
46310
46122
|
|
|
46311
46123
|
printJoin(nodes2, statement2, indent, separator, printTrailingSeparator, addNewlines, iterator, trailingCommentsLineOffset) {
|
|
46312
|
-
|
|
46313
|
-
|
|
46314
|
-
if (!(nodes2 == null ? void 0 : nodes2.length))
|
|
46124
|
+
if (!nodes2?.length)
|
|
46315
46125
|
return;
|
|
46316
46126
|
|
|
46317
46127
|
if (indent == null && this.format.retainLines) {
|
|
46318
|
-
const startLine =
|
|
46128
|
+
const startLine = nodes2[0].loc?.start.line;
|
|
46319
46129
|
|
|
46320
46130
|
if (startLine != null && startLine !== this._buf.getCurrentLine()) {
|
|
46321
46131
|
indent = true;
|
|
@@ -46330,7 +46140,7 @@ var Printer = class {
|
|
|
46330
46140
|
nextNodeStartLine: 0,
|
|
46331
46141
|
};
|
|
46332
46142
|
|
|
46333
|
-
const boundSeparator = separator
|
|
46143
|
+
const boundSeparator = separator?.bind(this);
|
|
46334
46144
|
const len = nodes2.length;
|
|
46335
46145
|
|
|
46336
46146
|
for (let i = 0; i < len; i++) {
|
|
@@ -46343,7 +46153,7 @@ var Printer = class {
|
|
|
46343
46153
|
this._printNewline(i === 0, newlineOpts);
|
|
46344
46154
|
|
|
46345
46155
|
this.print(node, void 0, trailingCommentsLineOffset || 0);
|
|
46346
|
-
iterator
|
|
46156
|
+
iterator?.(node, i);
|
|
46347
46157
|
|
|
46348
46158
|
if (boundSeparator != null) {
|
|
46349
46159
|
if (i < len - 1)
|
|
@@ -46353,7 +46163,7 @@ var Printer = class {
|
|
|
46353
46163
|
}
|
|
46354
46164
|
|
|
46355
46165
|
if (statement2) {
|
|
46356
|
-
if (!
|
|
46166
|
+
if (!node.trailingComments?.length) {
|
|
46357
46167
|
this._lastCommentLine = 0;
|
|
46358
46168
|
}
|
|
46359
46169
|
|
|
@@ -46362,7 +46172,7 @@ var Printer = class {
|
|
|
46362
46172
|
} else {
|
|
46363
46173
|
const nextNode = nodes2[i + 1];
|
|
46364
46174
|
|
|
46365
|
-
newlineOpts.nextNodeStartLine =
|
|
46175
|
+
newlineOpts.nextNodeStartLine = nextNode.loc?.start.line || 0;
|
|
46366
46176
|
this._printNewline(true, newlineOpts);
|
|
46367
46177
|
}
|
|
46368
46178
|
}
|
|
@@ -46400,11 +46210,11 @@ var Printer = class {
|
|
|
46400
46210
|
trailingComments,
|
|
46401
46211
|
} = node;
|
|
46402
46212
|
|
|
46403
|
-
if (innerComments
|
|
46213
|
+
if (innerComments?.length) {
|
|
46404
46214
|
this._printComments(2, innerComments, node, parent, lineOffset);
|
|
46405
46215
|
}
|
|
46406
46216
|
|
|
46407
|
-
if (trailingComments
|
|
46217
|
+
if (trailingComments?.length) {
|
|
46408
46218
|
this._printComments(2, trailingComments, node, parent, lineOffset);
|
|
46409
46219
|
}
|
|
46410
46220
|
}
|
|
@@ -46412,17 +46222,19 @@ var Printer = class {
|
|
|
46412
46222
|
_printLeadingComments(node, parent) {
|
|
46413
46223
|
const comments = node.leadingComments;
|
|
46414
46224
|
|
|
46415
|
-
if (!
|
|
46225
|
+
if (!comments?.length)
|
|
46416
46226
|
return;
|
|
46417
46227
|
|
|
46418
46228
|
this._printComments(0, comments, node, parent);
|
|
46419
46229
|
}
|
|
46420
46230
|
|
|
46421
46231
|
_maybePrintInnerComments(nextTokenStr, nextTokenOccurrenceCount) {
|
|
46422
|
-
var _a;
|
|
46423
|
-
|
|
46424
46232
|
if (this._endsWithInnerRaw) {
|
|
46425
|
-
this.printInnerComments(
|
|
46233
|
+
this.printInnerComments(this.tokenMap?.findMatching(
|
|
46234
|
+
this._currentNode,
|
|
46235
|
+
nextTokenStr,
|
|
46236
|
+
nextTokenOccurrenceCount,
|
|
46237
|
+
));
|
|
46426
46238
|
}
|
|
46427
46239
|
|
|
46428
46240
|
this._endsWithInnerRaw = true;
|
|
@@ -46433,7 +46245,7 @@ var Printer = class {
|
|
|
46433
46245
|
const node = this._currentNode;
|
|
46434
46246
|
const comments = node.innerComments;
|
|
46435
46247
|
|
|
46436
|
-
if (!
|
|
46248
|
+
if (!comments?.length)
|
|
46437
46249
|
return;
|
|
46438
46250
|
|
|
46439
46251
|
const hasSpace = this.endsWith(32);
|
|
@@ -46458,11 +46270,11 @@ var Printer = class {
|
|
|
46458
46270
|
}
|
|
46459
46271
|
|
|
46460
46272
|
printSequence(nodes2, indent, trailingCommentsLineOffset, addNewlines) {
|
|
46461
|
-
this.printJoin(nodes2, true, indent
|
|
46273
|
+
this.printJoin(nodes2, true, indent ?? false, void 0, void 0, addNewlines, void 0, trailingCommentsLineOffset);
|
|
46462
46274
|
}
|
|
46463
46275
|
|
|
46464
46276
|
printList(items, printTrailingSeparator, statement2, indent, separator, iterator) {
|
|
46465
|
-
this.printJoin(items, statement2, indent, separator
|
|
46277
|
+
this.printJoin(items, statement2, indent, separator ?? commaSeparator, printTrailingSeparator, void 0, iterator);
|
|
46466
46278
|
}
|
|
46467
46279
|
|
|
46468
46280
|
shouldPrintTrailingComma(listEnd) {
|
|
@@ -46538,7 +46350,6 @@ var Printer = class {
|
|
|
46538
46350
|
}
|
|
46539
46351
|
|
|
46540
46352
|
_printComment(comment, skipNewLines) {
|
|
46541
|
-
var _a;
|
|
46542
46353
|
const noLineTerminator = this._noLineTerminator;
|
|
46543
46354
|
const isBlockComment = comment.type === 'CommentBlock';
|
|
46544
46355
|
const printNewLines = isBlockComment && skipNewLines !== 1 && !this._noLineTerminator;
|
|
@@ -46559,7 +46370,7 @@ var Printer = class {
|
|
|
46559
46370
|
val = `/*${comment.value}*/`;
|
|
46560
46371
|
|
|
46561
46372
|
if (this.format.indent.adjustMultilineComment) {
|
|
46562
|
-
const offset =
|
|
46373
|
+
const offset = comment.loc?.start.column;
|
|
46563
46374
|
|
|
46564
46375
|
if (offset) {
|
|
46565
46376
|
const newlineRegex = new RegExp('\\n\\s{1,' + offset + '}', 'g');
|
|
@@ -47019,13 +46830,11 @@ function isFlow2() {
|
|
|
47019
46830
|
}
|
|
47020
46831
|
|
|
47021
46832
|
function isRestProperty2() {
|
|
47022
|
-
|
|
47023
|
-
return nodeIsRestElement(this.node) && ((_a = this.parentPath) == null ? void 0 : _a.isObjectPattern());
|
|
46833
|
+
return nodeIsRestElement(this.node) && this.parentPath?.isObjectPattern();
|
|
47024
46834
|
}
|
|
47025
46835
|
|
|
47026
46836
|
function isSpreadProperty2() {
|
|
47027
|
-
|
|
47028
|
-
return nodeIsRestElement(this.node) && ((_a = this.parentPath) == null ? void 0 : _a.isObjectExpression());
|
|
46837
|
+
return nodeIsRestElement(this.node) && this.parentPath?.isObjectExpression();
|
|
47029
46838
|
}
|
|
47030
46839
|
|
|
47031
46840
|
function isForAwaitStatement() {
|
|
@@ -47067,7 +46876,7 @@ function isVirtualType(type) {
|
|
|
47067
46876
|
}
|
|
47068
46877
|
|
|
47069
46878
|
function isExplodedVisitor(visitor) {
|
|
47070
|
-
return visitor
|
|
46879
|
+
return visitor?._exploded;
|
|
47071
46880
|
}
|
|
47072
46881
|
|
|
47073
46882
|
function explode$1(visitor) {
|
|
@@ -47266,7 +47075,7 @@ function wrapWithStateOrWrapper(oldVisitor, state, wrapper) {
|
|
|
47266
47075
|
}
|
|
47267
47076
|
|
|
47268
47077
|
if (wrapper) {
|
|
47269
|
-
newFn = wrapper(state
|
|
47078
|
+
newFn = wrapper(state?.key, phase, newFn);
|
|
47270
47079
|
}
|
|
47271
47080
|
|
|
47272
47081
|
if (newFn !== fn) {
|
|
@@ -47692,14 +47501,12 @@ var {
|
|
|
47692
47501
|
} = lib_exports;
|
|
47693
47502
|
|
|
47694
47503
|
function gatherNodeParts(node, parts) {
|
|
47695
|
-
|
|
47696
|
-
|
|
47697
|
-
switch(node == null ? void 0 : node.type) {
|
|
47504
|
+
switch(node?.type) {
|
|
47698
47505
|
default:
|
|
47699
47506
|
if (isImportDeclaration2(node) || isExportDeclaration2(node)) {
|
|
47700
47507
|
if ((isExportAllDeclaration2(node) || isExportNamedDeclaration$1(node) || isImportDeclaration2(node)) && node.source) {
|
|
47701
47508
|
gatherNodeParts(node.source, parts);
|
|
47702
|
-
} else if ((isExportNamedDeclaration$1(node) || isImportDeclaration2(node)) &&
|
|
47509
|
+
} else if ((isExportNamedDeclaration$1(node) || isImportDeclaration2(node)) && node.specifiers?.length) {
|
|
47703
47510
|
for (const e of node.specifiers)
|
|
47704
47511
|
gatherNodeParts(e, parts);
|
|
47705
47512
|
} else if ((isExportDefaultDeclaration3(node) || isExportNamedDeclaration$1(node)) && node.declaration) {
|
|
@@ -47918,12 +47725,12 @@ var collectorVisitor = {
|
|
|
47918
47725
|
return;
|
|
47919
47726
|
|
|
47920
47727
|
const binding = scope2.getBinding(id.name);
|
|
47921
|
-
binding
|
|
47728
|
+
binding?.reference(path);
|
|
47922
47729
|
} else if (isVariableDeclaration$1(declar)) {
|
|
47923
47730
|
for (const decl of declar.declarations) {
|
|
47924
47731
|
for (const name of Object.keys(getBindingIdentifiers$3(decl))) {
|
|
47925
47732
|
const binding = scope2.getBinding(name);
|
|
47926
|
-
binding
|
|
47733
|
+
binding?.reference(path);
|
|
47927
47734
|
}
|
|
47928
47735
|
}
|
|
47929
47736
|
}
|
|
@@ -48006,7 +47813,7 @@ var _Scope = class _Scope {
|
|
|
48006
47813
|
|
|
48007
47814
|
const cached = scope.get(node);
|
|
48008
47815
|
|
|
48009
|
-
if (
|
|
47816
|
+
if (cached?.path === path) {
|
|
48010
47817
|
return cached;
|
|
48011
47818
|
}
|
|
48012
47819
|
|
|
@@ -48029,11 +47836,11 @@ var _Scope = class _Scope {
|
|
|
48029
47836
|
if (shouldSkip && path.isMethod())
|
|
48030
47837
|
path = path.parentPath;
|
|
48031
47838
|
|
|
48032
|
-
if (path
|
|
47839
|
+
if (path?.isScope())
|
|
48033
47840
|
parent = path;
|
|
48034
47841
|
} while (path && !parent)
|
|
48035
47842
|
|
|
48036
|
-
return parent
|
|
47843
|
+
return parent?.scope;
|
|
48037
47844
|
}
|
|
48038
47845
|
|
|
48039
47846
|
get references() {
|
|
@@ -48249,11 +48056,10 @@ var _Scope = class _Scope {
|
|
|
48249
48056
|
}
|
|
48250
48057
|
|
|
48251
48058
|
registerConstantViolation(path) {
|
|
48252
|
-
var _a;
|
|
48253
48059
|
const ids = path.getAssignmentIdentifiers();
|
|
48254
48060
|
|
|
48255
48061
|
for (const name of Object.keys(ids)) {
|
|
48256
|
-
|
|
48062
|
+
this.getBinding(name)?.reassign(path);
|
|
48257
48063
|
}
|
|
48258
48064
|
}
|
|
48259
48065
|
|
|
@@ -48337,8 +48143,6 @@ var _Scope = class _Scope {
|
|
|
48337
48143
|
}
|
|
48338
48144
|
|
|
48339
48145
|
isPure(node, constantsOnly) {
|
|
48340
|
-
var _a, _b, _c;
|
|
48341
|
-
|
|
48342
48146
|
if (isIdentifier$5(node)) {
|
|
48343
48147
|
const binding = this.getBinding(node.name);
|
|
48344
48148
|
|
|
@@ -48356,7 +48160,7 @@ var _Scope = class _Scope {
|
|
|
48356
48160
|
return false;
|
|
48357
48161
|
}
|
|
48358
48162
|
|
|
48359
|
-
if (
|
|
48163
|
+
if (node.decorators?.length > 0) {
|
|
48360
48164
|
return false;
|
|
48361
48165
|
}
|
|
48362
48166
|
|
|
@@ -48388,7 +48192,7 @@ var _Scope = class _Scope {
|
|
|
48388
48192
|
if (node.computed && !this.isPure(node.key, constantsOnly))
|
|
48389
48193
|
return false;
|
|
48390
48194
|
|
|
48391
|
-
if (
|
|
48195
|
+
if (node.decorators?.length > 0) {
|
|
48392
48196
|
return false;
|
|
48393
48197
|
}
|
|
48394
48198
|
|
|
@@ -48397,7 +48201,7 @@ var _Scope = class _Scope {
|
|
|
48397
48201
|
if (node.computed && !this.isPure(node.key, constantsOnly))
|
|
48398
48202
|
return false;
|
|
48399
48203
|
|
|
48400
|
-
if (
|
|
48204
|
+
if (node.decorators?.length > 0) {
|
|
48401
48205
|
return false;
|
|
48402
48206
|
}
|
|
48403
48207
|
|
|
@@ -48687,7 +48491,7 @@ collectorVisitor]));
|
|
|
48687
48491
|
const binding = scope2.getOwnBinding(name);
|
|
48688
48492
|
|
|
48689
48493
|
if (binding) {
|
|
48690
|
-
if (
|
|
48494
|
+
if (previousPath?.isPattern() && binding.kind !== 'param' && binding.kind !== 'local'); else {
|
|
48691
48495
|
return binding;
|
|
48692
48496
|
}
|
|
48693
48497
|
} else if (!binding && name === 'arguments' && scope2.path.isFunction() && !scope2.path.isArrowFunctionExpression()) {
|
|
@@ -48703,13 +48507,12 @@ collectorVisitor]));
|
|
|
48703
48507
|
}
|
|
48704
48508
|
|
|
48705
48509
|
getBindingIdentifier(name) {
|
|
48706
|
-
|
|
48707
|
-
return (_a = this.getBinding(name)) == null ? void 0 : _a.identifier;
|
|
48510
|
+
return this.getBinding(name)?.identifier;
|
|
48708
48511
|
}
|
|
48709
48512
|
|
|
48710
48513
|
getOwnBindingIdentifier(name) {
|
|
48711
48514
|
const binding = this.bindings[name];
|
|
48712
|
-
return binding
|
|
48515
|
+
return binding?.identifier;
|
|
48713
48516
|
}
|
|
48714
48517
|
|
|
48715
48518
|
hasOwnBinding(name) {
|
|
@@ -48756,8 +48559,7 @@ collectorVisitor]));
|
|
|
48756
48559
|
}
|
|
48757
48560
|
|
|
48758
48561
|
parentHasBinding(name, opts) {
|
|
48759
|
-
|
|
48760
|
-
return (_a = this.parent) == null ? void 0 : _a.hasBinding(name, opts);
|
|
48562
|
+
return this.parent?.hasBinding(name, opts);
|
|
48761
48563
|
}
|
|
48762
48564
|
|
|
48763
48565
|
moveBindingTo(name, scope2) {
|
|
@@ -48775,8 +48577,7 @@ collectorVisitor]));
|
|
|
48775
48577
|
}
|
|
48776
48578
|
|
|
48777
48579
|
removeBinding(name) {
|
|
48778
|
-
|
|
48779
|
-
(_a = this.getBinding(name)) == null ? void 0 : _a.scope.removeOwnBinding(name);
|
|
48580
|
+
this.getBinding(name)?.scope.removeOwnBinding(name);
|
|
48780
48581
|
{
|
|
48781
48582
|
this
|
|
48782
48583
|
.getProgramParent()
|
|
@@ -48812,7 +48613,7 @@ collectorVisitor]));
|
|
|
48812
48613
|
const init = [];
|
|
48813
48614
|
|
|
48814
48615
|
for (const decl of parent.declarations) {
|
|
48815
|
-
firstId
|
|
48616
|
+
firstId ?? (firstId = decl.id);
|
|
48816
48617
|
|
|
48817
48618
|
if (decl.init) {
|
|
48818
48619
|
init.push(assignmentExpression$3('=', decl.id, decl.init));
|
|
@@ -49557,7 +49358,7 @@ function _getTypeAnnotation() {
|
|
|
49557
49358
|
|
|
49558
49359
|
inferer = inferers[this.parentPath.type];
|
|
49559
49360
|
|
|
49560
|
-
if (inferer
|
|
49361
|
+
if (inferer?.validParent) {
|
|
49561
49362
|
return this.parentPath.getTypeAnnotation();
|
|
49562
49363
|
}
|
|
49563
49364
|
} finally {
|
|
@@ -49695,7 +49496,6 @@ var hooks = [
|
|
|
49695
49496
|
var {getBindingIdentifiers: getBindingIdentifiers$2} = lib_exports;
|
|
49696
49497
|
|
|
49697
49498
|
function remove() {
|
|
49698
|
-
var _a;
|
|
49699
49499
|
_assertUnremoved.call(this);
|
|
49700
49500
|
resync.call(this);
|
|
49701
49501
|
|
|
@@ -49704,7 +49504,7 @@ function remove() {
|
|
|
49704
49504
|
return;
|
|
49705
49505
|
}
|
|
49706
49506
|
|
|
49707
|
-
if (!
|
|
49507
|
+
if (!this.opts?.noScope) {
|
|
49708
49508
|
_removeFromScope.call(this);
|
|
49709
49509
|
}
|
|
49710
49510
|
|
|
@@ -49739,12 +49539,10 @@ function _remove() {
|
|
|
49739
49539
|
}
|
|
49740
49540
|
|
|
49741
49541
|
function _markRemoved() {
|
|
49742
|
-
var _a;
|
|
49743
|
-
|
|
49744
49542
|
this._traverseFlags |= SHOULD_SKIP | REMOVED;
|
|
49745
49543
|
|
|
49746
49544
|
if (this.parent) {
|
|
49747
|
-
|
|
49545
|
+
getCachedPaths(this)?.delete(this.node);
|
|
49748
49546
|
}
|
|
49749
49547
|
|
|
49750
49548
|
this.node = null;
|
|
@@ -49801,7 +49599,6 @@ function insertBefore(nodes_) {
|
|
|
49801
49599
|
}
|
|
49802
49600
|
|
|
49803
49601
|
function _containerInsert(from, nodes2) {
|
|
49804
|
-
var _a;
|
|
49805
49602
|
updateSiblingKeys.call(this, from, nodes2.length);
|
|
49806
49603
|
const paths = [];
|
|
49807
49604
|
this.container.splice(from, 0, ...nodes2);
|
|
@@ -49810,7 +49607,7 @@ function _containerInsert(from, nodes2) {
|
|
|
49810
49607
|
const path = this.getSibling(to);
|
|
49811
49608
|
paths.push(path);
|
|
49812
49609
|
|
|
49813
|
-
if (
|
|
49610
|
+
if (this.context?.queue) {
|
|
49814
49611
|
pushContext.call(path, this.context);
|
|
49815
49612
|
}
|
|
49816
49613
|
}
|
|
@@ -50031,12 +49828,11 @@ var {
|
|
|
50031
49828
|
} = lib_exports;
|
|
50032
49829
|
|
|
50033
49830
|
function replaceWithMultiple(nodes2) {
|
|
50034
|
-
var _a;
|
|
50035
49831
|
resync.call(this);
|
|
50036
49832
|
nodes2 = _verifyNodeList.call(this, nodes2);
|
|
50037
49833
|
inheritLeadingComments2(nodes2[0], this.node);
|
|
50038
49834
|
inheritTrailingComments2(nodes2[nodes2.length - 1], this.node);
|
|
50039
|
-
|
|
49835
|
+
getCachedPaths(this)?.delete(this.node);
|
|
50040
49836
|
this.node =
|
|
50041
49837
|
this.container[this.key] = null;
|
|
50042
49838
|
const paths = this.insertAfter(nodes2);
|
|
@@ -50142,8 +49938,6 @@ function replaceWith(replacementPath) {
|
|
|
50142
49938
|
}
|
|
50143
49939
|
|
|
50144
49940
|
function _replaceWith(node) {
|
|
50145
|
-
var _a;
|
|
50146
|
-
|
|
50147
49941
|
if (!this.container) {
|
|
50148
49942
|
throw new ReferenceError('Container is falsy');
|
|
50149
49943
|
}
|
|
@@ -50154,10 +49948,8 @@ function _replaceWith(node) {
|
|
|
50154
49948
|
validate$13(this.parent, this.key, node);
|
|
50155
49949
|
}
|
|
50156
49950
|
|
|
50157
|
-
this.debug(`Replace with ${node
|
|
50158
|
-
(
|
|
50159
|
-
.set(node, this)
|
|
50160
|
-
.delete(this.node);
|
|
49951
|
+
this.debug(`Replace with ${node?.type}`);
|
|
49952
|
+
getCachedPaths(this)?.set(node, this).delete(this.node);
|
|
50161
49953
|
this.node =
|
|
50162
49954
|
this.container[this.key] = node;
|
|
50163
49955
|
}
|
|
@@ -50179,8 +49971,8 @@ function replaceExpressionWithStatements(nodes2) {
|
|
|
50179
49971
|
}
|
|
50180
49972
|
|
|
50181
49973
|
const functionParent = this.getFunctionParent();
|
|
50182
|
-
const isParentAsync = functionParent
|
|
50183
|
-
const isParentGenerator = functionParent
|
|
49974
|
+
const isParentAsync = functionParent?.node.async;
|
|
49975
|
+
const isParentGenerator = functionParent?.node.generator;
|
|
50184
49976
|
const container = arrowFunctionExpression$1([], blockStatement$1(nodes2));
|
|
50185
49977
|
|
|
50186
49978
|
this.replaceWith(callExpression$1(container, []));
|
|
@@ -50406,8 +50198,6 @@ function evaluateCached(path, state) {
|
|
|
50406
50198
|
}
|
|
50407
50199
|
|
|
50408
50200
|
function _evaluate(path, state) {
|
|
50409
|
-
var _a;
|
|
50410
|
-
|
|
50411
50201
|
if (!state.confident)
|
|
50412
50202
|
return;
|
|
50413
50203
|
|
|
@@ -50508,7 +50298,7 @@ function _evaluate(path, state) {
|
|
|
50508
50298
|
break;
|
|
50509
50299
|
}
|
|
50510
50300
|
|
|
50511
|
-
if (
|
|
50301
|
+
if (scope2.path.parentPath?.isBlockStatement()) {
|
|
50512
50302
|
hasUnsafeBlock = true;
|
|
50513
50303
|
}
|
|
50514
50304
|
}
|
|
@@ -50674,7 +50464,7 @@ function _evaluate(path, state) {
|
|
|
50674
50464
|
if (!state.confident)
|
|
50675
50465
|
return;
|
|
50676
50466
|
|
|
50677
|
-
return left
|
|
50467
|
+
return left ?? right;
|
|
50678
50468
|
}
|
|
50679
50469
|
}
|
|
50680
50470
|
|
|
@@ -50706,7 +50496,7 @@ function _evaluate(path, state) {
|
|
|
50706
50496
|
return left % right;
|
|
50707
50497
|
|
|
50708
50498
|
case '**':
|
|
50709
|
-
return
|
|
50499
|
+
return left ** right;
|
|
50710
50500
|
|
|
50711
50501
|
case '<':
|
|
50712
50502
|
return left < right;
|
|
@@ -50952,8 +50742,6 @@ function setType(path, type) {
|
|
|
50952
50742
|
}
|
|
50953
50743
|
|
|
50954
50744
|
function arrowFunctionToExpression({allowInsertArrow = true, allowInsertArrowWithRest = allowInsertArrow, noNewArrows = true} = {}) {
|
|
50955
|
-
var _a;
|
|
50956
|
-
|
|
50957
50745
|
if (!this.isArrowFunctionExpression()) {
|
|
50958
50746
|
throw this.buildCodeFrameError('Cannot convert non-arrow function to a function expression.');
|
|
50959
50747
|
}
|
|
@@ -50961,7 +50749,7 @@ function arrowFunctionToExpression({allowInsertArrow = true, allowInsertArrowWit
|
|
|
50961
50749
|
let self = this;
|
|
50962
50750
|
|
|
50963
50751
|
if (!noNewArrows) {
|
|
50964
|
-
self =
|
|
50752
|
+
self = self.ensureFunctionName(false) ?? self;
|
|
50965
50753
|
}
|
|
50966
50754
|
|
|
50967
50755
|
const {thisBinding, fnPath: fn} = hoistFunctionEnvironment(self, noNewArrows, allowInsertArrow, allowInsertArrowWithRest);
|
|
@@ -51000,7 +50788,7 @@ function hoistFunctionEnvironment(fnPath, noNewArrows = true, allowInsertArrow =
|
|
|
51000
50788
|
let arrowParent;
|
|
51001
50789
|
let thisEnvFn = fnPath.findParent((p) => {
|
|
51002
50790
|
if (p.isArrowFunctionExpression()) {
|
|
51003
|
-
arrowParent
|
|
50791
|
+
arrowParent ?? (arrowParent = p);
|
|
51004
50792
|
return false;
|
|
51005
50793
|
}
|
|
51006
50794
|
|
|
@@ -51883,7 +51671,7 @@ function resolve2(dangerous, resolved) {
|
|
|
51883
51671
|
}
|
|
51884
51672
|
|
|
51885
51673
|
function _resolve(dangerous, resolved) {
|
|
51886
|
-
if (resolved
|
|
51674
|
+
if (resolved?.includes(this))
|
|
51887
51675
|
return;
|
|
51888
51676
|
|
|
51889
51677
|
resolved = resolved || [];
|
|
@@ -52511,7 +52299,7 @@ function shareCommentsWithSiblings() {
|
|
|
52511
52299
|
}
|
|
52512
52300
|
|
|
52513
52301
|
function removeIfExisting(list, toRemove) {
|
|
52514
|
-
if (!
|
|
52302
|
+
if (!toRemove?.length)
|
|
52515
52303
|
return list;
|
|
52516
52304
|
|
|
52517
52305
|
const set = new Set(toRemove);
|
|
@@ -52820,7 +52608,7 @@ var TraversalContext = class {
|
|
|
52820
52608
|
|
|
52821
52609
|
const keys2 = VISITOR_KEYS$2[node.type];
|
|
52822
52610
|
|
|
52823
|
-
if (!
|
|
52611
|
+
if (!keys2?.length)
|
|
52824
52612
|
return false;
|
|
52825
52613
|
|
|
52826
52614
|
for (const key of keys2) {
|
|
@@ -52996,7 +52784,6 @@ function _visitPaths(ctx, paths) {
|
|
|
52996
52784
|
}
|
|
52997
52785
|
|
|
52998
52786
|
function _visit(ctx, path) {
|
|
52999
|
-
var _a, _b, _c, _d;
|
|
53000
52787
|
const node = path.node;
|
|
53001
52788
|
|
|
53002
52789
|
if (!node) {
|
|
@@ -53004,13 +52791,13 @@ function _visit(ctx, path) {
|
|
|
53004
52791
|
}
|
|
53005
52792
|
|
|
53006
52793
|
const opts = ctx.opts;
|
|
53007
|
-
const denylist =
|
|
52794
|
+
const denylist = opts.denylist ?? opts.blacklist;
|
|
53008
52795
|
|
|
53009
|
-
if (denylist
|
|
52796
|
+
if (denylist?.includes(node.type)) {
|
|
53010
52797
|
return false;
|
|
53011
52798
|
}
|
|
53012
52799
|
|
|
53013
|
-
if (
|
|
52800
|
+
if (opts.shouldSkip?.(path)) {
|
|
53014
52801
|
return false;
|
|
53015
52802
|
}
|
|
53016
52803
|
|
|
@@ -53021,7 +52808,7 @@ function _visit(ctx, path) {
|
|
|
53021
52808
|
return path.shouldStop;
|
|
53022
52809
|
|
|
53023
52810
|
if (path.node) {
|
|
53024
|
-
if (_call.call(path,
|
|
52811
|
+
if (_call.call(path, opts[node.type]?.enter))
|
|
53025
52812
|
return path.shouldStop;
|
|
53026
52813
|
}
|
|
53027
52814
|
|
|
@@ -53033,7 +52820,7 @@ function _visit(ctx, path) {
|
|
|
53033
52820
|
}
|
|
53034
52821
|
|
|
53035
52822
|
if (path.node) {
|
|
53036
|
-
_call.call(path,
|
|
52823
|
+
_call.call(path, opts[node.type]?.exit);
|
|
53037
52824
|
}
|
|
53038
52825
|
|
|
53039
52826
|
return path.shouldStop;
|
|
@@ -53042,20 +52829,20 @@ function _visit(ctx, path) {
|
|
|
53042
52829
|
function _traverse(node, opts, scope2, state, path, skipKeys, visitSelf) {
|
|
53043
52830
|
const keys2 = VISITOR_KEYS$12[node.type];
|
|
53044
52831
|
|
|
53045
|
-
if (!
|
|
52832
|
+
if (!keys2?.length)
|
|
53046
52833
|
return false;
|
|
53047
52834
|
|
|
53048
52835
|
const ctx = new TraversalContext(scope2, opts, state, path);
|
|
53049
52836
|
|
|
53050
52837
|
if (visitSelf) {
|
|
53051
|
-
if (skipKeys
|
|
52838
|
+
if (skipKeys?.[path.parentKey])
|
|
53052
52839
|
return false;
|
|
53053
52840
|
|
|
53054
52841
|
return _visitPaths(ctx, [path]);
|
|
53055
52842
|
}
|
|
53056
52843
|
|
|
53057
52844
|
for (const key of keys2) {
|
|
53058
|
-
if (skipKeys
|
|
52845
|
+
if (skipKeys?.[key])
|
|
53059
52846
|
continue;
|
|
53060
52847
|
|
|
53061
52848
|
const prop = node[key];
|
|
@@ -53102,7 +52889,6 @@ function traverseNode(node, opts, scope2, state, path, skipKeys, visitSelf) {
|
|
|
53102
52889
|
}
|
|
53103
52890
|
|
|
53104
52891
|
function call(key) {
|
|
53105
|
-
var _a;
|
|
53106
52892
|
const opts = this.opts;
|
|
53107
52893
|
this.debug(key);
|
|
53108
52894
|
|
|
@@ -53112,7 +52898,7 @@ function call(key) {
|
|
|
53112
52898
|
}
|
|
53113
52899
|
|
|
53114
52900
|
if (this.node) {
|
|
53115
|
-
return _call.call(this,
|
|
52901
|
+
return _call.call(this, opts[this.node.type]?.[key]);
|
|
53116
52902
|
}
|
|
53117
52903
|
|
|
53118
52904
|
return false;
|
|
@@ -53152,10 +52938,8 @@ function _call(fns) {
|
|
|
53152
52938
|
}
|
|
53153
52939
|
|
|
53154
52940
|
function isDenylisted() {
|
|
53155
|
-
|
|
53156
|
-
|
|
53157
|
-
|
|
53158
|
-
return denylist == null ? void 0 : denylist.includes(this.node.type);
|
|
52941
|
+
const denylist = this.opts.denylist ?? this.opts.blacklist;
|
|
52942
|
+
return denylist?.includes(this.node.type);
|
|
53159
52943
|
}
|
|
53160
52944
|
|
|
53161
52945
|
function restoreContext(path, context) {
|
|
@@ -53167,8 +52951,6 @@ function restoreContext(path, context) {
|
|
|
53167
52951
|
}
|
|
53168
52952
|
|
|
53169
52953
|
function visit() {
|
|
53170
|
-
var _a, _b;
|
|
53171
|
-
|
|
53172
52954
|
if (!this.node) {
|
|
53173
52955
|
return false;
|
|
53174
52956
|
}
|
|
@@ -53177,7 +52959,7 @@ function visit() {
|
|
|
53177
52959
|
return false;
|
|
53178
52960
|
}
|
|
53179
52961
|
|
|
53180
|
-
if (
|
|
52962
|
+
if (this.opts.shouldSkip?.(this)) {
|
|
53181
52963
|
return false;
|
|
53182
52964
|
}
|
|
53183
52965
|
|
|
@@ -53213,9 +52995,7 @@ function stop() {
|
|
|
53213
52995
|
}
|
|
53214
52996
|
|
|
53215
52997
|
function setScope() {
|
|
53216
|
-
|
|
53217
|
-
|
|
53218
|
-
if ((_a = this.opts) == null ? void 0 : _a.noScope)
|
|
52998
|
+
if (this.opts?.noScope)
|
|
53219
52999
|
return;
|
|
53220
53000
|
|
|
53221
53001
|
let path = this.parentPath;
|
|
@@ -53227,7 +53007,7 @@ function setScope() {
|
|
|
53227
53007
|
let target;
|
|
53228
53008
|
|
|
53229
53009
|
while (path && !target) {
|
|
53230
|
-
if (
|
|
53010
|
+
if (path.opts?.noScope)
|
|
53231
53011
|
return;
|
|
53232
53012
|
|
|
53233
53013
|
target = path.scope;
|
|
@@ -53235,7 +53015,7 @@ function setScope() {
|
|
|
53235
53015
|
}
|
|
53236
53016
|
|
|
53237
53017
|
this.scope = this.getScope(target);
|
|
53238
|
-
|
|
53018
|
+
this.scope?.init();
|
|
53239
53019
|
}
|
|
53240
53020
|
|
|
53241
53021
|
function setContext(context) {
|
|
@@ -53332,11 +53112,9 @@ function setup(parentPath, container, listKey, key) {
|
|
|
53332
53112
|
}
|
|
53333
53113
|
|
|
53334
53114
|
function setKey(key) {
|
|
53335
|
-
var _a;
|
|
53336
|
-
|
|
53337
53115
|
this.key = key;
|
|
53338
53116
|
this.node = this.container[this.key];
|
|
53339
|
-
this.type =
|
|
53117
|
+
this.type = this.node?.type;
|
|
53340
53118
|
}
|
|
53341
53119
|
|
|
53342
53120
|
function requeue(pathToQueue = this) {
|
|
@@ -53429,14 +53207,14 @@ traverse3.removeProperties = function(tree, opts) {
|
|
|
53429
53207
|
return tree;
|
|
53430
53208
|
};
|
|
53431
53209
|
traverse3.hasType = function(tree, type, denylistTypes) {
|
|
53432
|
-
if (denylistTypes
|
|
53210
|
+
if (denylistTypes?.includes(tree.type))
|
|
53433
53211
|
return false;
|
|
53434
53212
|
|
|
53435
53213
|
if (tree.type === type)
|
|
53436
53214
|
return true;
|
|
53437
53215
|
|
|
53438
53216
|
return traverseFast3(tree, function(node) {
|
|
53439
|
-
if (denylistTypes
|
|
53217
|
+
if (denylistTypes?.includes(node.type)) {
|
|
53440
53218
|
return traverseFast3.skip;
|
|
53441
53219
|
}
|
|
53442
53220
|
|