@vue/compiler-sfc 3.5.16 → 3.5.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/compiler-sfc.cjs.js +283 -303
- package/dist/compiler-sfc.esm-browser.js +465 -274
- package/package.json +10 -10
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-sfc v3.5.
|
|
2
|
+
* @vue/compiler-sfc v3.5.18
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -87,7 +87,7 @@ const PatchFlagNames = {
|
|
|
87
87
|
[512]: `NEED_PATCH`,
|
|
88
88
|
[1024]: `DYNAMIC_SLOTS`,
|
|
89
89
|
[2048]: `DEV_ROOT_FRAGMENT`,
|
|
90
|
-
[-1]: `
|
|
90
|
+
[-1]: `CACHED`,
|
|
91
91
|
[-2]: `BAIL`
|
|
92
92
|
};
|
|
93
93
|
|
|
@@ -1921,7 +1921,7 @@ class Tokenizer {
|
|
|
1921
1921
|
this.buffer = input;
|
|
1922
1922
|
while (this.index < this.buffer.length) {
|
|
1923
1923
|
const c = this.buffer.charCodeAt(this.index);
|
|
1924
|
-
if (c === 10) {
|
|
1924
|
+
if (c === 10 && this.state !== 33) {
|
|
1925
1925
|
this.newlines.push(this.index);
|
|
1926
1926
|
}
|
|
1927
1927
|
switch (this.state) {
|
|
@@ -2406,7 +2406,11 @@ function getAugmentedNamespace(n) {
|
|
|
2406
2406
|
var f = n.default;
|
|
2407
2407
|
if (typeof f == "function") {
|
|
2408
2408
|
var a = function a () {
|
|
2409
|
-
|
|
2409
|
+
var isInstance = false;
|
|
2410
|
+
try {
|
|
2411
|
+
isInstance = this instanceof a;
|
|
2412
|
+
} catch {}
|
|
2413
|
+
if (isInstance) {
|
|
2410
2414
|
return Reflect.construct(f, arguments, this.constructor);
|
|
2411
2415
|
}
|
|
2412
2416
|
return f.apply(this, arguments);
|
|
@@ -2550,9 +2554,6 @@ function requireLib () {
|
|
|
2550
2554
|
}) => `\`${exportName}\` has already been exported. Exported identifiers must be unique.`,
|
|
2551
2555
|
DuplicateProto: "Redefinition of __proto__ property.",
|
|
2552
2556
|
DuplicateRegExpFlags: "Duplicate regular expression flag.",
|
|
2553
|
-
DynamicImportPhaseRequiresImportExpressions: ({
|
|
2554
|
-
phase
|
|
2555
|
-
}) => `'import.${phase}(...)' can only be parsed when using the 'createImportExpressions' option.`,
|
|
2556
2557
|
ElementAfterRest: "Rest element must be last element.",
|
|
2557
2558
|
EscapedCharNotAnIdentifier: "Invalid Unicode escape.",
|
|
2558
2559
|
ExportBindingIsString: ({
|
|
@@ -2585,6 +2586,7 @@ function requireLib () {
|
|
|
2585
2586
|
IncompatibleRegExpUVFlags: "The 'u' and 'v' regular expression flags cannot be enabled at the same time.",
|
|
2586
2587
|
InvalidBigIntLiteral: "Invalid BigIntLiteral.",
|
|
2587
2588
|
InvalidCodePoint: "Code point out of bounds.",
|
|
2589
|
+
InvalidCoverDiscardElement: "'void' must be followed by an expression when not used in a binding position.",
|
|
2588
2590
|
InvalidCoverInitializedName: "Invalid shorthand property initializer.",
|
|
2589
2591
|
InvalidDecimal: "Invalid decimal.",
|
|
2590
2592
|
InvalidDigit: ({
|
|
@@ -2701,7 +2703,8 @@ function requireLib () {
|
|
|
2701
2703
|
unexpected
|
|
2702
2704
|
}) => `Unexpected token${unexpected ? ` '${unexpected}'.` : ""}${expected ? `, expected "${expected}"` : ""}`,
|
|
2703
2705
|
UnexpectedTokenUnaryExponentiation: "Illegal expression. Wrap left hand side or entire exponentiation in parentheses.",
|
|
2704
|
-
UnexpectedUsingDeclaration: "Using declaration cannot appear in the top level when source type is `script
|
|
2706
|
+
UnexpectedUsingDeclaration: "Using declaration cannot appear in the top level when source type is `script` or in the bare case statement.",
|
|
2707
|
+
UnexpectedVoidPattern: "Unexpected void binding.",
|
|
2705
2708
|
UnsupportedBind: "Binding should be performed on object property.",
|
|
2706
2709
|
UnsupportedDecoratorExport: "A decorated export must export a class declaration.",
|
|
2707
2710
|
UnsupportedDefaultExport: "Only expressions, functions or classes are allowed as the `default` export.",
|
|
@@ -2722,6 +2725,8 @@ function requireLib () {
|
|
|
2722
2725
|
VarRedeclaration: ({
|
|
2723
2726
|
identifierName
|
|
2724
2727
|
}) => `Identifier '${identifierName}' has already been declared.`,
|
|
2728
|
+
VoidPatternCatchClauseParam: "A void binding can not be the catch clause parameter. Use `try { ... } catch { ... }` if you want to discard the caught error.",
|
|
2729
|
+
VoidPatternInitializer: "A void binding may not have an initializer.",
|
|
2725
2730
|
YieldBindingIdentifier: "Can not use 'yield' as identifier inside a generator.",
|
|
2726
2731
|
YieldInParameter: "Yield expression is not allowed in formal parameters.",
|
|
2727
2732
|
YieldNotInGeneratorFunction: "'yield' is only allowed within generator functions.",
|
|
@@ -2740,6 +2745,12 @@ function requireLib () {
|
|
|
2740
2745
|
StrictOctalLiteral: "Legacy octal literals are not allowed in strict mode.",
|
|
2741
2746
|
StrictWith: "'with' in strict mode."
|
|
2742
2747
|
};
|
|
2748
|
+
var ParseExpressionErrors = {
|
|
2749
|
+
ParseExpressionEmptyInput: "Unexpected parseExpression() input: The input is empty or contains only comments.",
|
|
2750
|
+
ParseExpressionExpectsEOF: ({
|
|
2751
|
+
unexpected
|
|
2752
|
+
}) => `Unexpected parseExpression() input: The input should contain exactly one expression, but the first expression is followed by the unexpected character \`${String.fromCodePoint(unexpected)}\`.`
|
|
2753
|
+
};
|
|
2743
2754
|
const UnparenthesizedPipeBodyDescriptions = new Set(["ArrowFunctionExpression", "AssignmentExpression", "ConditionalExpression", "YieldExpression"]);
|
|
2744
2755
|
var PipelineOperatorErrors = Object.assign({
|
|
2745
2756
|
PipeBodyIsTighter: "Unexpected yield after pipeline body; any yield expression acting as Hack-style pipe body must be parenthesized due to its loose operator precedence.",
|
|
@@ -2854,7 +2865,7 @@ function requireLib () {
|
|
|
2854
2865
|
}
|
|
2855
2866
|
return ParseErrorConstructors;
|
|
2856
2867
|
}
|
|
2857
|
-
const Errors = Object.assign({}, ParseErrorEnum(ModuleErrors), ParseErrorEnum(StandardErrors), ParseErrorEnum(StrictModeErrors), ParseErrorEnum`pipelineOperator`(PipelineOperatorErrors));
|
|
2868
|
+
const Errors = Object.assign({}, ParseErrorEnum(ModuleErrors), ParseErrorEnum(StandardErrors), ParseErrorEnum(StrictModeErrors), ParseErrorEnum(ParseExpressionErrors), ParseErrorEnum`pipelineOperator`(PipelineOperatorErrors));
|
|
2858
2869
|
function createDefaultOptions() {
|
|
2859
2870
|
return {
|
|
2860
2871
|
sourceType: "script",
|
|
@@ -2902,6 +2913,17 @@ function requireLib () {
|
|
|
2902
2913
|
throw new Error("With a `startLine > 1` you must also specify `startIndex` and `startColumn`.");
|
|
2903
2914
|
}
|
|
2904
2915
|
}
|
|
2916
|
+
if (options.sourceType === "commonjs") {
|
|
2917
|
+
if (opts.allowAwaitOutsideFunction != null) {
|
|
2918
|
+
throw new Error("The `allowAwaitOutsideFunction` option cannot be used with `sourceType: 'commonjs'`.");
|
|
2919
|
+
}
|
|
2920
|
+
if (opts.allowReturnOutsideFunction != null) {
|
|
2921
|
+
throw new Error("`sourceType: 'commonjs'` implies `allowReturnOutsideFunction: true`, please remove the `allowReturnOutsideFunction` option or use `sourceType: 'script'`.");
|
|
2922
|
+
}
|
|
2923
|
+
if (opts.allowNewTargetOutsideFunction != null) {
|
|
2924
|
+
throw new Error("`sourceType: 'commonjs'` implies `allowNewTargetOutsideFunction: true`, please remove the `allowNewTargetOutsideFunction` option or use `sourceType: 'script'`.");
|
|
2925
|
+
}
|
|
2926
|
+
}
|
|
2905
2927
|
return options;
|
|
2906
2928
|
}
|
|
2907
2929
|
const {
|
|
@@ -3769,7 +3791,7 @@ function requireLib () {
|
|
|
3769
3791
|
startsExpr
|
|
3770
3792
|
}),
|
|
3771
3793
|
placeholder: createToken("%%", {
|
|
3772
|
-
startsExpr
|
|
3794
|
+
startsExpr
|
|
3773
3795
|
}),
|
|
3774
3796
|
string: createToken("string", {
|
|
3775
3797
|
startsExpr
|
|
@@ -3792,10 +3814,10 @@ function requireLib () {
|
|
|
3792
3814
|
eof: createToken("eof"),
|
|
3793
3815
|
jsxName: createToken("jsxName"),
|
|
3794
3816
|
jsxText: createToken("jsxText", {
|
|
3795
|
-
beforeExpr
|
|
3817
|
+
beforeExpr
|
|
3796
3818
|
}),
|
|
3797
3819
|
jsxTagStart: createToken("jsxTagStart", {
|
|
3798
|
-
startsExpr
|
|
3820
|
+
startsExpr
|
|
3799
3821
|
}),
|
|
3800
3822
|
jsxTagEnd: createToken("jsxTagEnd")
|
|
3801
3823
|
};
|
|
@@ -3975,6 +3997,9 @@ function requireLib () {
|
|
|
3975
3997
|
get allowDirectSuper() {
|
|
3976
3998
|
return (this.currentThisScopeFlags() & 32) > 0;
|
|
3977
3999
|
}
|
|
4000
|
+
get allowNewTarget() {
|
|
4001
|
+
return (this.currentThisScopeFlags() & 512) > 0;
|
|
4002
|
+
}
|
|
3978
4003
|
get inClass() {
|
|
3979
4004
|
return (this.currentThisScopeFlags() & 64) > 0;
|
|
3980
4005
|
}
|
|
@@ -3990,7 +4015,7 @@ function requireLib () {
|
|
|
3990
4015
|
if (flags & 128) {
|
|
3991
4016
|
return true;
|
|
3992
4017
|
}
|
|
3993
|
-
if (flags & (
|
|
4018
|
+
if (flags & (1667 | 64)) {
|
|
3994
4019
|
return false;
|
|
3995
4020
|
}
|
|
3996
4021
|
}
|
|
@@ -3998,6 +4023,9 @@ function requireLib () {
|
|
|
3998
4023
|
get inNonArrowFunction() {
|
|
3999
4024
|
return (this.currentThisScopeFlags() & 2) > 0;
|
|
4000
4025
|
}
|
|
4026
|
+
get inBareCaseStatement() {
|
|
4027
|
+
return (this.currentScope().flags & 256) > 0;
|
|
4028
|
+
}
|
|
4001
4029
|
get treatFunctionsAsVar() {
|
|
4002
4030
|
return this.treatFunctionsAsVarInScope(this.currentScope());
|
|
4003
4031
|
}
|
|
@@ -4037,7 +4065,7 @@ function requireLib () {
|
|
|
4037
4065
|
this.checkRedeclarationInScope(scope, name, bindingType, loc);
|
|
4038
4066
|
scope.names.set(name, (scope.names.get(name) || 0) | 1);
|
|
4039
4067
|
this.maybeExportDefined(scope, name);
|
|
4040
|
-
if (scope.flags &
|
|
4068
|
+
if (scope.flags & 1667) break;
|
|
4041
4069
|
}
|
|
4042
4070
|
}
|
|
4043
4071
|
if (this.parser.inModule && scope.flags & 1) {
|
|
@@ -4084,7 +4112,7 @@ function requireLib () {
|
|
|
4084
4112
|
const {
|
|
4085
4113
|
flags
|
|
4086
4114
|
} = this.scopeStack[i];
|
|
4087
|
-
if (flags &
|
|
4115
|
+
if (flags & 1667) {
|
|
4088
4116
|
return flags;
|
|
4089
4117
|
}
|
|
4090
4118
|
}
|
|
@@ -4094,7 +4122,7 @@ function requireLib () {
|
|
|
4094
4122
|
const {
|
|
4095
4123
|
flags
|
|
4096
4124
|
} = this.scopeStack[i];
|
|
4097
|
-
if (flags & (
|
|
4125
|
+
if (flags & (1667 | 64) && !(flags & 4)) {
|
|
4098
4126
|
return flags;
|
|
4099
4127
|
}
|
|
4100
4128
|
}
|
|
@@ -5492,7 +5520,7 @@ function requireLib () {
|
|
|
5492
5520
|
finishArrowValidation(node) {
|
|
5493
5521
|
var _node$extra;
|
|
5494
5522
|
this.toAssignableList(node.params, (_node$extra = node.extra) == null ? void 0 : _node$extra.trailingCommaLoc, false);
|
|
5495
|
-
this.scope.enter(
|
|
5523
|
+
this.scope.enter(514 | 4);
|
|
5496
5524
|
super.checkParams(node, false, true);
|
|
5497
5525
|
this.scope.exit();
|
|
5498
5526
|
}
|
|
@@ -6035,7 +6063,7 @@ function requireLib () {
|
|
|
6035
6063
|
this.next();
|
|
6036
6064
|
const node = this.startNodeAt(startLoc);
|
|
6037
6065
|
node.callee = base;
|
|
6038
|
-
node.arguments = super.parseCallExpressionArguments(
|
|
6066
|
+
node.arguments = super.parseCallExpressionArguments();
|
|
6039
6067
|
base = this.finishNode(node, "CallExpression");
|
|
6040
6068
|
} else if (base.type === "Identifier" && base.name === "async" && this.match(47)) {
|
|
6041
6069
|
const state = this.state.clone();
|
|
@@ -6067,7 +6095,7 @@ function requireLib () {
|
|
|
6067
6095
|
node.callee = base;
|
|
6068
6096
|
node.typeArguments = this.flowParseTypeParameterInstantiationInExpression();
|
|
6069
6097
|
this.expect(10);
|
|
6070
|
-
node.arguments = this.parseCallExpressionArguments(
|
|
6098
|
+
node.arguments = this.parseCallExpressionArguments();
|
|
6071
6099
|
node.optional = true;
|
|
6072
6100
|
return this.finishCallExpression(node, true);
|
|
6073
6101
|
} else if (!noCalls && this.shouldParseTypes() && (this.match(47) || this.match(51))) {
|
|
@@ -6076,7 +6104,7 @@ function requireLib () {
|
|
|
6076
6104
|
const result = this.tryParse(() => {
|
|
6077
6105
|
node.typeArguments = this.flowParseTypeParameterInstantiationCallOrNew();
|
|
6078
6106
|
this.expect(10);
|
|
6079
|
-
node.arguments = super.parseCallExpressionArguments(
|
|
6107
|
+
node.arguments = super.parseCallExpressionArguments();
|
|
6080
6108
|
if (subscriptState.optionalChainMember) {
|
|
6081
6109
|
node.optional = false;
|
|
6082
6110
|
}
|
|
@@ -7276,14 +7304,14 @@ function requireLib () {
|
|
|
7276
7304
|
return new TypeScriptScope(flags);
|
|
7277
7305
|
}
|
|
7278
7306
|
enter(flags) {
|
|
7279
|
-
if (flags ===
|
|
7307
|
+
if (flags === 1024) {
|
|
7280
7308
|
this.importsStack.push(new Set());
|
|
7281
7309
|
}
|
|
7282
7310
|
super.enter(flags);
|
|
7283
7311
|
}
|
|
7284
7312
|
exit() {
|
|
7285
7313
|
const flags = super.exit();
|
|
7286
|
-
if (flags ===
|
|
7314
|
+
if (flags === 1024) {
|
|
7287
7315
|
this.importsStack.pop();
|
|
7288
7316
|
}
|
|
7289
7317
|
return flags;
|
|
@@ -7512,6 +7540,7 @@ function requireLib () {
|
|
|
7512
7540
|
}
|
|
7513
7541
|
}
|
|
7514
7542
|
finalizeComment(commentWS) {
|
|
7543
|
+
var _node$options;
|
|
7515
7544
|
const {
|
|
7516
7545
|
comments
|
|
7517
7546
|
} = commentWS;
|
|
@@ -7538,6 +7567,9 @@ function requireLib () {
|
|
|
7538
7567
|
case "OptionalCallExpression":
|
|
7539
7568
|
adjustInnerComments(node, node.arguments, commentWS);
|
|
7540
7569
|
break;
|
|
7570
|
+
case "ImportExpression":
|
|
7571
|
+
adjustInnerComments(node, [node.source, (_node$options = node.options) != null ? _node$options : null], commentWS);
|
|
7572
|
+
break;
|
|
7541
7573
|
case "FunctionDeclaration":
|
|
7542
7574
|
case "FunctionExpression":
|
|
7543
7575
|
case "ArrowFunctionExpression":
|
|
@@ -7595,20 +7627,6 @@ function requireLib () {
|
|
|
7595
7627
|
commentWS.leadingNode = null;
|
|
7596
7628
|
}
|
|
7597
7629
|
}
|
|
7598
|
-
resetPreviousIdentifierLeadingComments(node) {
|
|
7599
|
-
const {
|
|
7600
|
-
commentStack
|
|
7601
|
-
} = this.state;
|
|
7602
|
-
const {
|
|
7603
|
-
length
|
|
7604
|
-
} = commentStack;
|
|
7605
|
-
if (length === 0) return;
|
|
7606
|
-
if (commentStack[length - 1].trailingNode === node) {
|
|
7607
|
-
commentStack[length - 1].trailingNode = null;
|
|
7608
|
-
} else if (length >= 2 && commentStack[length - 2].trailingNode === node) {
|
|
7609
|
-
commentStack[length - 2].trailingNode = null;
|
|
7610
|
-
}
|
|
7611
|
-
}
|
|
7612
7630
|
takeSurroundingComments(node, start, end) {
|
|
7613
7631
|
const {
|
|
7614
7632
|
commentStack
|
|
@@ -9301,9 +9319,8 @@ function requireLib () {
|
|
|
9301
9319
|
return this.state.type === token && !this.state.containsEsc;
|
|
9302
9320
|
}
|
|
9303
9321
|
isUnparsedContextual(nameStart, name) {
|
|
9304
|
-
|
|
9305
|
-
|
|
9306
|
-
const nextCh = this.input.charCodeAt(nameEnd);
|
|
9322
|
+
if (this.input.startsWith(name, nameStart)) {
|
|
9323
|
+
const nextCh = this.input.charCodeAt(nameStart + name.length);
|
|
9307
9324
|
return !(isIdentifierChar(nextCh) || (nextCh & 0xfc00) === 0xd800);
|
|
9308
9325
|
}
|
|
9309
9326
|
return false;
|
|
@@ -9406,9 +9423,10 @@ function requireLib () {
|
|
|
9406
9423
|
shorthandAssignLoc,
|
|
9407
9424
|
doubleProtoLoc,
|
|
9408
9425
|
privateKeyLoc,
|
|
9409
|
-
optionalParametersLoc
|
|
9426
|
+
optionalParametersLoc,
|
|
9427
|
+
voidPatternLoc
|
|
9410
9428
|
} = refExpressionErrors;
|
|
9411
|
-
const hasErrors = !!shorthandAssignLoc || !!doubleProtoLoc || !!optionalParametersLoc || !!privateKeyLoc;
|
|
9429
|
+
const hasErrors = !!shorthandAssignLoc || !!doubleProtoLoc || !!optionalParametersLoc || !!privateKeyLoc || !!voidPatternLoc;
|
|
9412
9430
|
if (!andThrow) {
|
|
9413
9431
|
return hasErrors;
|
|
9414
9432
|
}
|
|
@@ -9424,6 +9442,9 @@ function requireLib () {
|
|
|
9424
9442
|
if (optionalParametersLoc != null) {
|
|
9425
9443
|
this.unexpected(optionalParametersLoc);
|
|
9426
9444
|
}
|
|
9445
|
+
if (voidPatternLoc != null) {
|
|
9446
|
+
this.raise(Errors.InvalidCoverDiscardElement, voidPatternLoc);
|
|
9447
|
+
}
|
|
9427
9448
|
}
|
|
9428
9449
|
isLiteralPropertyName() {
|
|
9429
9450
|
return tokenIsLiteralPropertyName(this.state.type);
|
|
@@ -9471,14 +9492,22 @@ function requireLib () {
|
|
|
9471
9492
|
}
|
|
9472
9493
|
enterInitialScopes() {
|
|
9473
9494
|
let paramFlags = 0;
|
|
9474
|
-
if (this.inModule) {
|
|
9495
|
+
if (this.inModule || this.optionFlags & 1) {
|
|
9475
9496
|
paramFlags |= 2;
|
|
9476
9497
|
}
|
|
9477
9498
|
if (this.optionFlags & 32) {
|
|
9478
9499
|
paramFlags |= 1;
|
|
9479
9500
|
}
|
|
9480
|
-
this.
|
|
9501
|
+
const isCommonJS = !this.inModule && this.options.sourceType === "commonjs";
|
|
9502
|
+
if (isCommonJS || this.optionFlags & 2) {
|
|
9503
|
+
paramFlags |= 4;
|
|
9504
|
+
}
|
|
9481
9505
|
this.prodParam.enter(paramFlags);
|
|
9506
|
+
let scopeFlags = isCommonJS ? 514 : 1;
|
|
9507
|
+
if (this.optionFlags & 4) {
|
|
9508
|
+
scopeFlags |= 512;
|
|
9509
|
+
}
|
|
9510
|
+
this.scope.enter(scopeFlags);
|
|
9482
9511
|
}
|
|
9483
9512
|
checkDestructuringPrivate(refExpressionErrors) {
|
|
9484
9513
|
const {
|
|
@@ -9495,6 +9524,7 @@ function requireLib () {
|
|
|
9495
9524
|
this.doubleProtoLoc = null;
|
|
9496
9525
|
this.privateKeyLoc = null;
|
|
9497
9526
|
this.optionalParametersLoc = null;
|
|
9527
|
+
this.voidPatternLoc = null;
|
|
9498
9528
|
}
|
|
9499
9529
|
}
|
|
9500
9530
|
class Node {
|
|
@@ -9626,6 +9656,7 @@ function requireLib () {
|
|
|
9626
9656
|
case "ArrayPattern":
|
|
9627
9657
|
case "AssignmentPattern":
|
|
9628
9658
|
case "RestElement":
|
|
9659
|
+
case "VoidPattern":
|
|
9629
9660
|
break;
|
|
9630
9661
|
case "ObjectExpression":
|
|
9631
9662
|
this.castNodeTo(node, "ObjectPattern");
|
|
@@ -9665,6 +9696,9 @@ function requireLib () {
|
|
|
9665
9696
|
}
|
|
9666
9697
|
this.castNodeTo(node, "AssignmentPattern");
|
|
9667
9698
|
delete node.operator;
|
|
9699
|
+
if (node.left.type === "VoidPattern") {
|
|
9700
|
+
this.raise(Errors.VoidPatternInitializer, node.left);
|
|
9701
|
+
}
|
|
9668
9702
|
this.toAssignable(node.left, isLHS);
|
|
9669
9703
|
break;
|
|
9670
9704
|
case "ParenthesizedExpression":
|
|
@@ -9720,6 +9754,7 @@ function requireLib () {
|
|
|
9720
9754
|
case "ArrayPattern":
|
|
9721
9755
|
case "AssignmentPattern":
|
|
9722
9756
|
case "RestElement":
|
|
9757
|
+
case "VoidPattern":
|
|
9723
9758
|
return true;
|
|
9724
9759
|
case "ObjectExpression":
|
|
9725
9760
|
{
|
|
@@ -9765,7 +9800,11 @@ function requireLib () {
|
|
|
9765
9800
|
parseRestBinding() {
|
|
9766
9801
|
const node = this.startNode();
|
|
9767
9802
|
this.next();
|
|
9768
|
-
|
|
9803
|
+
const argument = this.parseBindingAtom();
|
|
9804
|
+
if (argument.type === "VoidPattern") {
|
|
9805
|
+
this.raise(Errors.UnexpectedVoidPattern, argument);
|
|
9806
|
+
}
|
|
9807
|
+
node.argument = argument;
|
|
9769
9808
|
return this.finishNode(node, "RestElement");
|
|
9770
9809
|
}
|
|
9771
9810
|
parseBindingAtom() {
|
|
@@ -9779,6 +9818,8 @@ function requireLib () {
|
|
|
9779
9818
|
}
|
|
9780
9819
|
case 5:
|
|
9781
9820
|
return this.parseObjectLike(8, true);
|
|
9821
|
+
case 88:
|
|
9822
|
+
return this.parseVoidPattern(null);
|
|
9782
9823
|
}
|
|
9783
9824
|
return this.parseIdentifier();
|
|
9784
9825
|
}
|
|
@@ -9823,7 +9864,12 @@ function requireLib () {
|
|
|
9823
9864
|
}
|
|
9824
9865
|
parseBindingRestProperty(prop) {
|
|
9825
9866
|
this.next();
|
|
9826
|
-
|
|
9867
|
+
if (this.hasPlugin("discardBinding") && this.match(88)) {
|
|
9868
|
+
prop.argument = this.parseVoidPattern(null);
|
|
9869
|
+
this.raise(Errors.UnexpectedVoidPattern, prop.argument);
|
|
9870
|
+
} else {
|
|
9871
|
+
prop.argument = this.parseIdentifier();
|
|
9872
|
+
}
|
|
9827
9873
|
this.checkCommaAfterRest(125);
|
|
9828
9874
|
return this.finishNode(prop, "RestElement");
|
|
9829
9875
|
}
|
|
@@ -9866,6 +9912,9 @@ function requireLib () {
|
|
|
9866
9912
|
left = left != null ? left : this.parseBindingAtom();
|
|
9867
9913
|
if (!this.eat(29)) return left;
|
|
9868
9914
|
const node = this.startNodeAt(startLoc);
|
|
9915
|
+
if (left.type === "VoidPattern") {
|
|
9916
|
+
this.raise(Errors.VoidPatternInitializer, left);
|
|
9917
|
+
}
|
|
9869
9918
|
node.left = left;
|
|
9870
9919
|
node.right = this.parseMaybeAssignAllowIn();
|
|
9871
9920
|
return this.finishNode(node, "AssignmentPattern");
|
|
@@ -9884,6 +9933,8 @@ function requireLib () {
|
|
|
9884
9933
|
return "elements";
|
|
9885
9934
|
case "ObjectPattern":
|
|
9886
9935
|
return "properties";
|
|
9936
|
+
case "VoidPattern":
|
|
9937
|
+
return true;
|
|
9887
9938
|
}
|
|
9888
9939
|
return false;
|
|
9889
9940
|
}
|
|
@@ -9922,6 +9973,8 @@ function requireLib () {
|
|
|
9922
9973
|
}
|
|
9923
9974
|
}
|
|
9924
9975
|
return;
|
|
9976
|
+
} else if (type === "VoidPattern" && ancestor.type === "CatchClause") {
|
|
9977
|
+
this.raise(Errors.VoidPatternCatchClauseParam, expression);
|
|
9925
9978
|
}
|
|
9926
9979
|
const validity = this.isValidLVal(type, !(hasParenthesizedAncestor || (_expression$extra = expression.extra) != null && _expression$extra.parenthesized) && ancestor.type === "AssignmentExpression", binding);
|
|
9927
9980
|
if (validity === true) return;
|
|
@@ -10030,7 +10083,7 @@ function requireLib () {
|
|
|
10030
10083
|
DeclareFunctionHasImplementation: "An implementation cannot be declared in ambient contexts.",
|
|
10031
10084
|
DuplicateAccessibilityModifier: ({
|
|
10032
10085
|
modifier
|
|
10033
|
-
}) => `Accessibility modifier already seen.`,
|
|
10086
|
+
}) => `Accessibility modifier already seen: '${modifier}'.`,
|
|
10034
10087
|
DuplicateModifier: ({
|
|
10035
10088
|
modifier
|
|
10036
10089
|
}) => `Duplicate modifier: '${modifier}'.`,
|
|
@@ -10056,6 +10109,7 @@ function requireLib () {
|
|
|
10056
10109
|
InvalidHeritageClauseType: ({
|
|
10057
10110
|
token
|
|
10058
10111
|
}) => `'${token}' list can only include identifiers or qualified-names with optional type arguments.`,
|
|
10112
|
+
InvalidModifierOnAwaitUsingDeclaration: modifier => `'${modifier}' modifier cannot appear on an await using declaration.`,
|
|
10059
10113
|
InvalidModifierOnTypeMember: ({
|
|
10060
10114
|
modifier
|
|
10061
10115
|
}) => `'${modifier}' modifier cannot appear on a type member.`,
|
|
@@ -10065,6 +10119,7 @@ function requireLib () {
|
|
|
10065
10119
|
InvalidModifierOnTypeParameterPositions: ({
|
|
10066
10120
|
modifier
|
|
10067
10121
|
}) => `'${modifier}' modifier can only appear on a type parameter of a class, interface or type alias.`,
|
|
10122
|
+
InvalidModifierOnUsingDeclaration: modifier => `'${modifier}' modifier cannot appear on a using declaration.`,
|
|
10068
10123
|
InvalidModifiersOrder: ({
|
|
10069
10124
|
orderedModifiers
|
|
10070
10125
|
}) => `'${orderedModifiers[0]}' modifier must precede '${orderedModifiers[1]}' modifier.`,
|
|
@@ -10072,7 +10127,7 @@ function requireLib () {
|
|
|
10072
10127
|
InvalidTupleMemberLabel: "Tuple members must be labeled with a simple identifier.",
|
|
10073
10128
|
MissingInterfaceName: "'interface' declarations must be followed by an identifier.",
|
|
10074
10129
|
NonAbstractClassHasAbstractMethod: "Abstract methods can only appear within an abstract class.",
|
|
10075
|
-
|
|
10130
|
+
NonClassMethodPropertyHasAbstractModifier: "'abstract' modifier can only appear on a class, method, or property declaration.",
|
|
10076
10131
|
OptionalTypeBeforeRequired: "A required element cannot follow an optional element.",
|
|
10077
10132
|
OverrideNotInSubClass: "This member cannot have an 'override' modifier because its containing class does not extend another class.",
|
|
10078
10133
|
PatternIsOptional: "A binding pattern parameter cannot be optional in an implementation signature.",
|
|
@@ -10103,7 +10158,8 @@ function requireLib () {
|
|
|
10103
10158
|
UnsupportedParameterPropertyKind: "A parameter property may not be declared using a binding pattern.",
|
|
10104
10159
|
UnsupportedSignatureParameterKind: ({
|
|
10105
10160
|
type
|
|
10106
|
-
}) => `Name in a signature must be an Identifier, ObjectPattern or ArrayPattern, instead got ${type}
|
|
10161
|
+
}) => `Name in a signature must be an Identifier, ObjectPattern or ArrayPattern, instead got ${type}.`,
|
|
10162
|
+
UsingDeclarationInAmbientContext: kind => `'${kind}' declarations are not allowed in ambient contexts.`
|
|
10107
10163
|
});
|
|
10108
10164
|
function keywordTypeFromName(value) {
|
|
10109
10165
|
switch (value) {
|
|
@@ -10179,12 +10235,15 @@ function requireLib () {
|
|
|
10179
10235
|
}
|
|
10180
10236
|
return this.tsNextTokenOnSameLineAndCanFollowModifier();
|
|
10181
10237
|
}
|
|
10182
|
-
tsParseModifier(allowedModifiers, stopOnStartOfClassStaticBlock) {
|
|
10238
|
+
tsParseModifier(allowedModifiers, stopOnStartOfClassStaticBlock, hasSeenStaticModifier) {
|
|
10183
10239
|
if (!tokenIsIdentifier(this.state.type) && this.state.type !== 58 && this.state.type !== 75) {
|
|
10184
10240
|
return undefined;
|
|
10185
10241
|
}
|
|
10186
10242
|
const modifier = this.state.value;
|
|
10187
10243
|
if (allowedModifiers.includes(modifier)) {
|
|
10244
|
+
if (hasSeenStaticModifier && this.match(106)) {
|
|
10245
|
+
return undefined;
|
|
10246
|
+
}
|
|
10188
10247
|
if (stopOnStartOfClassStaticBlock && this.tsIsStartOfStaticBlocks()) {
|
|
10189
10248
|
return undefined;
|
|
10190
10249
|
}
|
|
@@ -10218,7 +10277,7 @@ function requireLib () {
|
|
|
10218
10277
|
const {
|
|
10219
10278
|
startLoc
|
|
10220
10279
|
} = this.state;
|
|
10221
|
-
const modifier = this.tsParseModifier(allowedModifiers.concat(disallowedModifiers != null ? disallowedModifiers : []), stopOnStartOfClassStaticBlock);
|
|
10280
|
+
const modifier = this.tsParseModifier(allowedModifiers.concat(disallowedModifiers != null ? disallowedModifiers : []), stopOnStartOfClassStaticBlock, modified.static);
|
|
10222
10281
|
if (!modifier) break;
|
|
10223
10282
|
if (tsIsAccessModifier(modifier)) {
|
|
10224
10283
|
if (modified.accessibility) {
|
|
@@ -11115,7 +11174,7 @@ function requireLib () {
|
|
|
11115
11174
|
return this.finishNode(node, "TSConditionalType");
|
|
11116
11175
|
}
|
|
11117
11176
|
isAbstractConstructorSignature() {
|
|
11118
|
-
return this.isContextual(124) && this.
|
|
11177
|
+
return this.isContextual(124) && this.isLookaheadContextual("new");
|
|
11119
11178
|
}
|
|
11120
11179
|
tsParseNonConditionalType() {
|
|
11121
11180
|
if (this.tsIsStartOfFunctionType()) {
|
|
@@ -11186,7 +11245,7 @@ function requireLib () {
|
|
|
11186
11245
|
node.typeAnnotation = this.tsInType(() => {
|
|
11187
11246
|
node.typeParameters = this.tsTryParseTypeParameters(this.tsParseInOutModifiers);
|
|
11188
11247
|
this.expect(29);
|
|
11189
|
-
if (this.isContextual(114) && this.
|
|
11248
|
+
if (this.isContextual(114) && this.lookaheadCharCode() !== 46) {
|
|
11190
11249
|
const node = this.startNode();
|
|
11191
11250
|
this.next();
|
|
11192
11251
|
return this.finishNode(node, "TSIntrinsicKeyword");
|
|
@@ -11299,7 +11358,7 @@ function requireLib () {
|
|
|
11299
11358
|
this.tsParseModuleOrNamespaceDeclaration(inner, true);
|
|
11300
11359
|
node.body = inner;
|
|
11301
11360
|
} else {
|
|
11302
|
-
this.scope.enter(
|
|
11361
|
+
this.scope.enter(1024);
|
|
11303
11362
|
this.prodParam.enter(0);
|
|
11304
11363
|
node.body = this.tsParseModuleBlock();
|
|
11305
11364
|
this.prodParam.exit();
|
|
@@ -11321,7 +11380,7 @@ function requireLib () {
|
|
|
11321
11380
|
this.unexpected();
|
|
11322
11381
|
}
|
|
11323
11382
|
if (this.match(5)) {
|
|
11324
|
-
this.scope.enter(
|
|
11383
|
+
this.scope.enter(1024);
|
|
11325
11384
|
this.prodParam.enter(0);
|
|
11326
11385
|
node.body = this.tsParseModuleBlock();
|
|
11327
11386
|
this.prodParam.exit();
|
|
@@ -11384,51 +11443,65 @@ function requireLib () {
|
|
|
11384
11443
|
}
|
|
11385
11444
|
this.state = state;
|
|
11386
11445
|
}
|
|
11387
|
-
tsTryParseDeclare(
|
|
11446
|
+
tsTryParseDeclare(node) {
|
|
11388
11447
|
if (this.isLineTerminator()) {
|
|
11389
11448
|
return;
|
|
11390
11449
|
}
|
|
11391
|
-
|
|
11392
|
-
let kind;
|
|
11393
|
-
if (this.isContextual(100)) {
|
|
11394
|
-
startType = 74;
|
|
11395
|
-
kind = "let";
|
|
11396
|
-
}
|
|
11450
|
+
const startType = this.state.type;
|
|
11397
11451
|
return this.tsInAmbientContext(() => {
|
|
11398
11452
|
switch (startType) {
|
|
11399
11453
|
case 68:
|
|
11400
|
-
|
|
11401
|
-
return super.parseFunctionStatement(
|
|
11454
|
+
node.declare = true;
|
|
11455
|
+
return super.parseFunctionStatement(node, false, false);
|
|
11402
11456
|
case 80:
|
|
11403
|
-
|
|
11404
|
-
return this.parseClass(
|
|
11457
|
+
node.declare = true;
|
|
11458
|
+
return this.parseClass(node, true, false);
|
|
11405
11459
|
case 126:
|
|
11406
|
-
return this.tsParseEnumDeclaration(
|
|
11460
|
+
return this.tsParseEnumDeclaration(node, {
|
|
11407
11461
|
declare: true
|
|
11408
11462
|
});
|
|
11409
11463
|
case 112:
|
|
11410
|
-
return this.tsParseAmbientExternalModuleDeclaration(
|
|
11464
|
+
return this.tsParseAmbientExternalModuleDeclaration(node);
|
|
11465
|
+
case 100:
|
|
11466
|
+
if (this.state.containsEsc) {
|
|
11467
|
+
return;
|
|
11468
|
+
}
|
|
11411
11469
|
case 75:
|
|
11412
11470
|
case 74:
|
|
11413
11471
|
if (!this.match(75) || !this.isLookaheadContextual("enum")) {
|
|
11414
|
-
|
|
11415
|
-
return this.parseVarStatement(
|
|
11472
|
+
node.declare = true;
|
|
11473
|
+
return this.parseVarStatement(node, this.state.value, true);
|
|
11416
11474
|
}
|
|
11417
11475
|
this.expect(75);
|
|
11418
|
-
return this.tsParseEnumDeclaration(
|
|
11476
|
+
return this.tsParseEnumDeclaration(node, {
|
|
11419
11477
|
const: true,
|
|
11420
11478
|
declare: true
|
|
11421
11479
|
});
|
|
11480
|
+
case 107:
|
|
11481
|
+
if (this.isUsing()) {
|
|
11482
|
+
this.raise(TSErrors.InvalidModifierOnUsingDeclaration, this.state.startLoc, "declare");
|
|
11483
|
+
node.declare = true;
|
|
11484
|
+
return this.parseVarStatement(node, "using", true);
|
|
11485
|
+
}
|
|
11486
|
+
break;
|
|
11487
|
+
case 96:
|
|
11488
|
+
if (this.isAwaitUsing()) {
|
|
11489
|
+
this.raise(TSErrors.InvalidModifierOnAwaitUsingDeclaration, this.state.startLoc, "declare");
|
|
11490
|
+
node.declare = true;
|
|
11491
|
+
this.next();
|
|
11492
|
+
return this.parseVarStatement(node, "await using", true);
|
|
11493
|
+
}
|
|
11494
|
+
break;
|
|
11422
11495
|
case 129:
|
|
11423
11496
|
{
|
|
11424
|
-
const result = this.tsParseInterfaceDeclaration(
|
|
11497
|
+
const result = this.tsParseInterfaceDeclaration(node, {
|
|
11425
11498
|
declare: true
|
|
11426
11499
|
});
|
|
11427
11500
|
if (result) return result;
|
|
11428
11501
|
}
|
|
11429
11502
|
default:
|
|
11430
11503
|
if (tokenIsIdentifier(startType)) {
|
|
11431
|
-
return this.tsParseDeclaration(
|
|
11504
|
+
return this.tsParseDeclaration(node, this.state.value, true, null);
|
|
11432
11505
|
}
|
|
11433
11506
|
}
|
|
11434
11507
|
});
|
|
@@ -11448,7 +11521,7 @@ function requireLib () {
|
|
|
11448
11521
|
}
|
|
11449
11522
|
case "global":
|
|
11450
11523
|
if (this.match(5)) {
|
|
11451
|
-
this.scope.enter(
|
|
11524
|
+
this.scope.enter(1024);
|
|
11452
11525
|
this.prodParam.enter(0);
|
|
11453
11526
|
const mod = node;
|
|
11454
11527
|
mod.kind = "global";
|
|
@@ -11679,7 +11752,7 @@ function requireLib () {
|
|
|
11679
11752
|
if (!noCalls && this.eat(10)) {
|
|
11680
11753
|
const node = this.startNodeAt(startLoc);
|
|
11681
11754
|
node.callee = base;
|
|
11682
|
-
node.arguments = this.parseCallExpressionArguments(
|
|
11755
|
+
node.arguments = this.parseCallExpressionArguments();
|
|
11683
11756
|
this.tsCheckForInvalidTypeCasts(node.arguments);
|
|
11684
11757
|
{
|
|
11685
11758
|
node.typeParameters = typeArguments;
|
|
@@ -11836,7 +11909,7 @@ function requireLib () {
|
|
|
11836
11909
|
}
|
|
11837
11910
|
}
|
|
11838
11911
|
isAbstractClass() {
|
|
11839
|
-
return this.isContextual(124) && this.
|
|
11912
|
+
return this.isContextual(124) && this.isLookaheadContextual("class");
|
|
11840
11913
|
}
|
|
11841
11914
|
parseExportDefaultExpression() {
|
|
11842
11915
|
if (this.isAbstractClass()) {
|
|
@@ -11857,12 +11930,16 @@ function requireLib () {
|
|
|
11857
11930
|
} = this.state;
|
|
11858
11931
|
const declaration = super.parseVarStatement(node, kind, allowMissingInitializer || isAmbientContext);
|
|
11859
11932
|
if (!isAmbientContext) return declaration;
|
|
11933
|
+
if (!node.declare && (kind === "using" || kind === "await using")) {
|
|
11934
|
+
this.raiseOverwrite(TSErrors.UsingDeclarationInAmbientContext, node, kind);
|
|
11935
|
+
return declaration;
|
|
11936
|
+
}
|
|
11860
11937
|
for (const {
|
|
11861
11938
|
id,
|
|
11862
11939
|
init
|
|
11863
11940
|
} of declaration.declarations) {
|
|
11864
11941
|
if (!init) continue;
|
|
11865
|
-
if (kind
|
|
11942
|
+
if (kind === "var" || kind === "let" || !!id.typeAnnotation) {
|
|
11866
11943
|
this.raise(TSErrors.InitializerNotAllowedInAmbientContext, init);
|
|
11867
11944
|
} else if (!isValidAmbientConstInitializer(init, this.hasPlugin("estree"))) {
|
|
11868
11945
|
this.raise(TSErrors.ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference, init);
|
|
@@ -12468,7 +12545,7 @@ function requireLib () {
|
|
|
12468
12545
|
} else if (this.isContextual(129)) {
|
|
12469
12546
|
if (!this.hasFollowingLineBreak()) {
|
|
12470
12547
|
node.abstract = true;
|
|
12471
|
-
this.raise(TSErrors.
|
|
12548
|
+
this.raise(TSErrors.NonClassMethodPropertyHasAbstractModifier, node);
|
|
12472
12549
|
return this.tsParseInterfaceDeclaration(node);
|
|
12473
12550
|
}
|
|
12474
12551
|
} else {
|
|
@@ -12827,8 +12904,8 @@ function requireLib () {
|
|
|
12827
12904
|
if (super.chStartsBindingIdentifier(ch, pos)) {
|
|
12828
12905
|
return true;
|
|
12829
12906
|
}
|
|
12830
|
-
const
|
|
12831
|
-
if (
|
|
12907
|
+
const next = this.nextTokenStart();
|
|
12908
|
+
if (this.input.charCodeAt(next) === 37 && this.input.charCodeAt(next + 1) === 37) {
|
|
12832
12909
|
return true;
|
|
12833
12910
|
}
|
|
12834
12911
|
return false;
|
|
@@ -13068,6 +13145,9 @@ function requireLib () {
|
|
|
13068
13145
|
if (pluginsMap.has("optionalChainingAssign") && pluginsMap.get("optionalChainingAssign").version !== "2023-07") {
|
|
13069
13146
|
throw new Error("The 'optionalChainingAssign' plugin requires a 'version' option," + " representing the last proposal update. Currently, the" + " only supported value is '2023-07'.");
|
|
13070
13147
|
}
|
|
13148
|
+
if (pluginsMap.has("discardBinding") && pluginsMap.get("discardBinding").syntaxType !== "void") {
|
|
13149
|
+
throw new Error("The 'discardBinding' plugin requires a 'syntaxType' option. Currently the only supported value is 'void'.");
|
|
13150
|
+
}
|
|
13071
13151
|
}
|
|
13072
13152
|
const mixinPlugins = {
|
|
13073
13153
|
estree,
|
|
@@ -13109,9 +13189,14 @@ function requireLib () {
|
|
|
13109
13189
|
getExpression() {
|
|
13110
13190
|
this.enterInitialScopes();
|
|
13111
13191
|
this.nextToken();
|
|
13192
|
+
if (this.match(140)) {
|
|
13193
|
+
throw this.raise(Errors.ParseExpressionEmptyInput, this.state.startLoc);
|
|
13194
|
+
}
|
|
13112
13195
|
const expr = this.parseExpression();
|
|
13113
13196
|
if (!this.match(140)) {
|
|
13114
|
-
this.
|
|
13197
|
+
throw this.raise(Errors.ParseExpressionExpectsEOF, this.state.startLoc, {
|
|
13198
|
+
unexpected: this.input.codePointAt(this.state.start)
|
|
13199
|
+
});
|
|
13115
13200
|
}
|
|
13116
13201
|
this.finalizeRemainingComments();
|
|
13117
13202
|
expr.comments = this.comments;
|
|
@@ -13198,6 +13283,9 @@ function requireLib () {
|
|
|
13198
13283
|
this.checkDestructuringPrivate(refExpressionErrors);
|
|
13199
13284
|
refExpressionErrors.privateKeyLoc = null;
|
|
13200
13285
|
}
|
|
13286
|
+
if (refExpressionErrors.voidPatternLoc != null && refExpressionErrors.voidPatternLoc.index >= startIndex) {
|
|
13287
|
+
refExpressionErrors.voidPatternLoc = null;
|
|
13288
|
+
}
|
|
13201
13289
|
} else {
|
|
13202
13290
|
node.left = left;
|
|
13203
13291
|
}
|
|
@@ -13526,9 +13614,9 @@ function requireLib () {
|
|
|
13526
13614
|
node.optional = optional;
|
|
13527
13615
|
}
|
|
13528
13616
|
if (optional) {
|
|
13529
|
-
node.arguments = this.parseCallExpressionArguments(
|
|
13617
|
+
node.arguments = this.parseCallExpressionArguments();
|
|
13530
13618
|
} else {
|
|
13531
|
-
node.arguments = this.parseCallExpressionArguments(
|
|
13619
|
+
node.arguments = this.parseCallExpressionArguments(base.type !== "Super", node, refExpressionErrors);
|
|
13532
13620
|
}
|
|
13533
13621
|
let finishedNode = this.finishCallExpression(node, optionalChainMember);
|
|
13534
13622
|
if (maybeAsyncArrow && this.shouldParseAsyncArrow() && !optional) {
|
|
@@ -13576,17 +13664,17 @@ function requireLib () {
|
|
|
13576
13664
|
}
|
|
13577
13665
|
return this.finishNode(node, optional ? "OptionalCallExpression" : "CallExpression");
|
|
13578
13666
|
}
|
|
13579
|
-
parseCallExpressionArguments(
|
|
13667
|
+
parseCallExpressionArguments(allowPlaceholder, nodeForExtra, refExpressionErrors) {
|
|
13580
13668
|
const elts = [];
|
|
13581
13669
|
let first = true;
|
|
13582
13670
|
const oldInFSharpPipelineDirectBody = this.state.inFSharpPipelineDirectBody;
|
|
13583
13671
|
this.state.inFSharpPipelineDirectBody = false;
|
|
13584
|
-
while (!this.eat(
|
|
13672
|
+
while (!this.eat(11)) {
|
|
13585
13673
|
if (first) {
|
|
13586
13674
|
first = false;
|
|
13587
13675
|
} else {
|
|
13588
13676
|
this.expect(12);
|
|
13589
|
-
if (this.match(
|
|
13677
|
+
if (this.match(11)) {
|
|
13590
13678
|
if (nodeForExtra) {
|
|
13591
13679
|
this.addTrailingCommaExtraToNode(nodeForExtra);
|
|
13592
13680
|
}
|
|
@@ -13594,7 +13682,7 @@ function requireLib () {
|
|
|
13594
13682
|
break;
|
|
13595
13683
|
}
|
|
13596
13684
|
}
|
|
13597
|
-
elts.push(this.parseExprListItem(false, refExpressionErrors, allowPlaceholder));
|
|
13685
|
+
elts.push(this.parseExprListItem(11, false, refExpressionErrors, allowPlaceholder));
|
|
13598
13686
|
}
|
|
13599
13687
|
this.state.inFSharpPipelineDirectBody = oldInFSharpPipelineDirectBody;
|
|
13600
13688
|
return elts;
|
|
@@ -13632,7 +13720,7 @@ function requireLib () {
|
|
|
13632
13720
|
node = this.startNode();
|
|
13633
13721
|
this.next();
|
|
13634
13722
|
if (this.match(16)) {
|
|
13635
|
-
return this.
|
|
13723
|
+
return this.parseImportMetaPropertyOrPhaseCall(node);
|
|
13636
13724
|
}
|
|
13637
13725
|
if (this.match(10)) {
|
|
13638
13726
|
if (this.optionFlags & 512) {
|
|
@@ -13925,27 +14013,24 @@ function requireLib () {
|
|
|
13925
14013
|
}
|
|
13926
14014
|
return this.finishNode(node, "MetaProperty");
|
|
13927
14015
|
}
|
|
13928
|
-
|
|
13929
|
-
const id = this.createIdentifier(this.startNodeAtNode(node), "import");
|
|
14016
|
+
parseImportMetaPropertyOrPhaseCall(node) {
|
|
13930
14017
|
this.next();
|
|
13931
|
-
if (this.isContextual(
|
|
13932
|
-
if (!this.inModule) {
|
|
13933
|
-
this.raise(Errors.ImportMetaOutsideModule, id);
|
|
13934
|
-
}
|
|
13935
|
-
this.sawUnambiguousESM = true;
|
|
13936
|
-
} else if (this.isContextual(105) || this.isContextual(97)) {
|
|
14018
|
+
if (this.isContextual(105) || this.isContextual(97)) {
|
|
13937
14019
|
const isSource = this.isContextual(105);
|
|
13938
14020
|
this.expectPlugin(isSource ? "sourcePhaseImports" : "deferredImportEvaluation");
|
|
13939
|
-
if (!(this.optionFlags & 512)) {
|
|
13940
|
-
throw this.raise(Errors.DynamicImportPhaseRequiresImportExpressions, this.state.startLoc, {
|
|
13941
|
-
phase: this.state.value
|
|
13942
|
-
});
|
|
13943
|
-
}
|
|
13944
14021
|
this.next();
|
|
13945
14022
|
node.phase = isSource ? "source" : "defer";
|
|
13946
14023
|
return this.parseImportCall(node);
|
|
14024
|
+
} else {
|
|
14025
|
+
const id = this.createIdentifierAt(this.startNodeAtNode(node), "import", this.state.lastTokStartLoc);
|
|
14026
|
+
if (this.isContextual(101)) {
|
|
14027
|
+
if (!this.inModule) {
|
|
14028
|
+
this.raise(Errors.ImportMetaOutsideModule, id);
|
|
14029
|
+
}
|
|
14030
|
+
this.sawUnambiguousESM = true;
|
|
14031
|
+
}
|
|
14032
|
+
return this.parseMetaProperty(node, id, "meta");
|
|
13947
14033
|
}
|
|
13948
|
-
return this.parseMetaProperty(node, id, "meta");
|
|
13949
14034
|
}
|
|
13950
14035
|
parseLiteralAtNode(value, type, node) {
|
|
13951
14036
|
this.addExtra(node, "rawValue", value);
|
|
@@ -13965,7 +14050,9 @@ function requireLib () {
|
|
|
13965
14050
|
return this.parseLiteral(value, "NumericLiteral");
|
|
13966
14051
|
}
|
|
13967
14052
|
parseBigIntLiteral(value) {
|
|
13968
|
-
|
|
14053
|
+
{
|
|
14054
|
+
return this.parseLiteral(value, "BigIntLiteral");
|
|
14055
|
+
}
|
|
13969
14056
|
}
|
|
13970
14057
|
parseDecimalLiteral(value) {
|
|
13971
14058
|
return this.parseLiteral(value, "DecimalLiteral");
|
|
@@ -14022,7 +14109,7 @@ function requireLib () {
|
|
|
14022
14109
|
break;
|
|
14023
14110
|
}
|
|
14024
14111
|
} else {
|
|
14025
|
-
exprList.push(this.
|
|
14112
|
+
exprList.push(this.parseMaybeAssignAllowInOrVoidPattern(11, refExpressionErrors, this.parseParenItem));
|
|
14026
14113
|
}
|
|
14027
14114
|
}
|
|
14028
14115
|
const innerEndLoc = this.state.lastTokEndLoc;
|
|
@@ -14084,7 +14171,7 @@ function requireLib () {
|
|
|
14084
14171
|
const meta = this.createIdentifier(this.startNodeAtNode(node), "new");
|
|
14085
14172
|
this.next();
|
|
14086
14173
|
const metaProp = this.parseMetaProperty(node, meta, "target");
|
|
14087
|
-
if (!this.scope.
|
|
14174
|
+
if (!this.scope.allowNewTarget) {
|
|
14088
14175
|
this.raise(Errors.UnexpectedNewTarget, metaProp);
|
|
14089
14176
|
}
|
|
14090
14177
|
return metaProp;
|
|
@@ -14299,7 +14386,7 @@ function requireLib () {
|
|
|
14299
14386
|
parseObjectProperty(prop, startLoc, isPattern, refExpressionErrors) {
|
|
14300
14387
|
prop.shorthand = false;
|
|
14301
14388
|
if (this.eat(14)) {
|
|
14302
|
-
prop.value = isPattern ? this.parseMaybeDefault(this.state.startLoc) : this.
|
|
14389
|
+
prop.value = isPattern ? this.parseMaybeDefault(this.state.startLoc) : this.parseMaybeAssignAllowInOrVoidPattern(8, refExpressionErrors);
|
|
14303
14390
|
return this.finishObjectProperty(prop);
|
|
14304
14391
|
}
|
|
14305
14392
|
if (!prop.computed && prop.key.type === "Identifier") {
|
|
@@ -14390,7 +14477,7 @@ function requireLib () {
|
|
|
14390
14477
|
parseMethod(node, isGenerator, isAsync, isConstructor, allowDirectSuper, type, inClassScope = false) {
|
|
14391
14478
|
this.initFunction(node, isAsync);
|
|
14392
14479
|
node.generator = isGenerator;
|
|
14393
|
-
this.scope.enter(
|
|
14480
|
+
this.scope.enter(514 | 16 | (inClassScope ? 576 : 0) | (allowDirectSuper ? 32 : 0));
|
|
14394
14481
|
this.prodParam.enter(functionFlags(isAsync, node.generator));
|
|
14395
14482
|
this.parseFunctionParams(node, isConstructor);
|
|
14396
14483
|
const finishedNode = this.parseFunctionBodyAndFinish(node, type, true);
|
|
@@ -14411,7 +14498,7 @@ function requireLib () {
|
|
|
14411
14498
|
return this.finishNode(node, isTuple ? "TupleExpression" : "ArrayExpression");
|
|
14412
14499
|
}
|
|
14413
14500
|
parseArrowExpression(node, params, isAsync, trailingCommaLoc) {
|
|
14414
|
-
this.scope.enter(
|
|
14501
|
+
this.scope.enter(514 | 4);
|
|
14415
14502
|
let flags = functionFlags(isAsync, false);
|
|
14416
14503
|
if (!this.match(5) && this.prodParam.hasIn) {
|
|
14417
14504
|
flags |= 8;
|
|
@@ -14499,11 +14586,11 @@ function requireLib () {
|
|
|
14499
14586
|
break;
|
|
14500
14587
|
}
|
|
14501
14588
|
}
|
|
14502
|
-
elts.push(this.parseExprListItem(allowEmpty, refExpressionErrors));
|
|
14589
|
+
elts.push(this.parseExprListItem(close, allowEmpty, refExpressionErrors));
|
|
14503
14590
|
}
|
|
14504
14591
|
return elts;
|
|
14505
14592
|
}
|
|
14506
|
-
parseExprListItem(allowEmpty, refExpressionErrors, allowPlaceholder) {
|
|
14593
|
+
parseExprListItem(close, allowEmpty, refExpressionErrors, allowPlaceholder) {
|
|
14507
14594
|
let elt;
|
|
14508
14595
|
if (this.match(12)) {
|
|
14509
14596
|
if (!allowEmpty) {
|
|
@@ -14524,7 +14611,7 @@ function requireLib () {
|
|
|
14524
14611
|
this.next();
|
|
14525
14612
|
elt = this.finishNode(node, "ArgumentPlaceholder");
|
|
14526
14613
|
} else {
|
|
14527
|
-
elt = this.
|
|
14614
|
+
elt = this.parseMaybeAssignAllowInOrVoidPattern(close, refExpressionErrors, this.parseParenItem);
|
|
14528
14615
|
}
|
|
14529
14616
|
return elt;
|
|
14530
14617
|
}
|
|
@@ -14538,6 +14625,11 @@ function requireLib () {
|
|
|
14538
14625
|
node.loc.identifierName = name;
|
|
14539
14626
|
return this.finishNode(node, "Identifier");
|
|
14540
14627
|
}
|
|
14628
|
+
createIdentifierAt(node, name, endLoc) {
|
|
14629
|
+
node.name = name;
|
|
14630
|
+
node.loc.identifierName = name;
|
|
14631
|
+
return this.finishNodeAt(node, "Identifier", endLoc);
|
|
14632
|
+
}
|
|
14541
14633
|
parseIdentifierName(liberal) {
|
|
14542
14634
|
let name;
|
|
14543
14635
|
const {
|
|
@@ -14602,7 +14694,7 @@ function requireLib () {
|
|
|
14602
14694
|
}
|
|
14603
14695
|
}
|
|
14604
14696
|
recordAwaitIfAllowed() {
|
|
14605
|
-
const isAwaitAllowed = this.prodParam.hasAwait
|
|
14697
|
+
const isAwaitAllowed = this.prodParam.hasAwait;
|
|
14606
14698
|
if (isAwaitAllowed && !this.scope.inFunction) {
|
|
14607
14699
|
this.state.hasTopLevelAwait = true;
|
|
14608
14700
|
}
|
|
@@ -14665,12 +14757,17 @@ function requireLib () {
|
|
|
14665
14757
|
if (this.eat(12)) {
|
|
14666
14758
|
if (!this.match(11)) {
|
|
14667
14759
|
node.options = this.parseMaybeAssignAllowIn();
|
|
14668
|
-
if (this.eat(12)
|
|
14669
|
-
|
|
14670
|
-
|
|
14671
|
-
|
|
14672
|
-
|
|
14760
|
+
if (this.eat(12)) {
|
|
14761
|
+
this.addTrailingCommaExtraToNode(node.options);
|
|
14762
|
+
if (!this.match(11)) {
|
|
14763
|
+
do {
|
|
14764
|
+
this.parseMaybeAssignAllowIn();
|
|
14765
|
+
} while (this.eat(12) && !this.match(11));
|
|
14766
|
+
this.raise(Errors.ImportCallArity, node);
|
|
14767
|
+
}
|
|
14673
14768
|
}
|
|
14769
|
+
} else {
|
|
14770
|
+
this.addTrailingCommaExtraToNode(node.source);
|
|
14674
14771
|
}
|
|
14675
14772
|
}
|
|
14676
14773
|
this.expect(11);
|
|
@@ -14816,6 +14913,24 @@ function requireLib () {
|
|
|
14816
14913
|
}
|
|
14817
14914
|
return this.finishNode(node, "ModuleExpression");
|
|
14818
14915
|
}
|
|
14916
|
+
parseVoidPattern(refExpressionErrors) {
|
|
14917
|
+
this.expectPlugin("discardBinding");
|
|
14918
|
+
const node = this.startNode();
|
|
14919
|
+
if (refExpressionErrors != null) {
|
|
14920
|
+
refExpressionErrors.voidPatternLoc = this.state.startLoc;
|
|
14921
|
+
}
|
|
14922
|
+
this.next();
|
|
14923
|
+
return this.finishNode(node, "VoidPattern");
|
|
14924
|
+
}
|
|
14925
|
+
parseMaybeAssignAllowInOrVoidPattern(close, refExpressionErrors, afterLeftParse) {
|
|
14926
|
+
if (refExpressionErrors != null && this.match(88)) {
|
|
14927
|
+
const nextCode = this.lookaheadCharCode();
|
|
14928
|
+
if (nextCode === 44 || nextCode === (close === 3 ? 93 : close === 8 ? 125 : 41) || nextCode === 61) {
|
|
14929
|
+
return this.parseMaybeDefault(this.state.startLoc, this.parseVoidPattern(refExpressionErrors));
|
|
14930
|
+
}
|
|
14931
|
+
}
|
|
14932
|
+
return this.parseMaybeAssignAllowIn(refExpressionErrors, afterLeftParse);
|
|
14933
|
+
}
|
|
14819
14934
|
parsePropertyNamePrefixOperator(prop) {}
|
|
14820
14935
|
}
|
|
14821
14936
|
const loopLabel = {
|
|
@@ -14935,14 +15050,14 @@ function requireLib () {
|
|
|
14935
15050
|
}
|
|
14936
15051
|
class StatementParser extends ExpressionParser {
|
|
14937
15052
|
parseTopLevel(file, program) {
|
|
14938
|
-
file.program = this.parseProgram(program);
|
|
15053
|
+
file.program = this.parseProgram(program, 140, this.options.sourceType === "module" ? "module" : "script");
|
|
14939
15054
|
file.comments = this.comments;
|
|
14940
15055
|
if (this.optionFlags & 256) {
|
|
14941
15056
|
file.tokens = babel7CompatTokens(this.tokens, this.input, this.startIndex);
|
|
14942
15057
|
}
|
|
14943
15058
|
return this.finishNode(file, "File");
|
|
14944
15059
|
}
|
|
14945
|
-
parseProgram(program, end
|
|
15060
|
+
parseProgram(program, end, sourceType) {
|
|
14946
15061
|
program.sourceType = sourceType;
|
|
14947
15062
|
program.interpreter = this.parseInterpreterDirective();
|
|
14948
15063
|
this.parseBlockBody(program, true, true, end);
|
|
@@ -14992,6 +15107,45 @@ function requireLib () {
|
|
|
14992
15107
|
}
|
|
14993
15108
|
return this.hasFollowingBindingAtom();
|
|
14994
15109
|
}
|
|
15110
|
+
isUsing() {
|
|
15111
|
+
if (!this.isContextual(107)) {
|
|
15112
|
+
return false;
|
|
15113
|
+
}
|
|
15114
|
+
const next = this.nextTokenInLineStart();
|
|
15115
|
+
const nextCh = this.codePointAtPos(next);
|
|
15116
|
+
return this.chStartsBindingIdentifier(nextCh, next);
|
|
15117
|
+
}
|
|
15118
|
+
isForUsing() {
|
|
15119
|
+
if (!this.isContextual(107)) {
|
|
15120
|
+
return false;
|
|
15121
|
+
}
|
|
15122
|
+
const next = this.nextTokenInLineStart();
|
|
15123
|
+
const nextCh = this.codePointAtPos(next);
|
|
15124
|
+
if (this.isUnparsedContextual(next, "of")) {
|
|
15125
|
+
const nextCharAfterOf = this.lookaheadCharCodeSince(next + 2);
|
|
15126
|
+
if (nextCharAfterOf !== 61 && nextCharAfterOf !== 58 && nextCharAfterOf !== 59) {
|
|
15127
|
+
return false;
|
|
15128
|
+
}
|
|
15129
|
+
}
|
|
15130
|
+
if (this.chStartsBindingIdentifier(nextCh, next) || this.isUnparsedContextual(next, "void")) {
|
|
15131
|
+
return true;
|
|
15132
|
+
}
|
|
15133
|
+
return false;
|
|
15134
|
+
}
|
|
15135
|
+
isAwaitUsing() {
|
|
15136
|
+
if (!this.isContextual(96)) {
|
|
15137
|
+
return false;
|
|
15138
|
+
}
|
|
15139
|
+
let next = this.nextTokenInLineStart();
|
|
15140
|
+
if (this.isUnparsedContextual(next, "using")) {
|
|
15141
|
+
next = this.nextTokenInLineStartSince(next + 5);
|
|
15142
|
+
const nextCh = this.codePointAtPos(next);
|
|
15143
|
+
if (this.chStartsBindingIdentifier(nextCh, next)) {
|
|
15144
|
+
return true;
|
|
15145
|
+
}
|
|
15146
|
+
}
|
|
15147
|
+
return false;
|
|
15148
|
+
}
|
|
14995
15149
|
chStartsBindingIdentifier(ch, pos) {
|
|
14996
15150
|
if (isIdentifierStart(ch)) {
|
|
14997
15151
|
keywordRelationalOperator.lastIndex = pos;
|
|
@@ -15021,35 +15175,8 @@ function requireLib () {
|
|
|
15021
15175
|
const nextCh = this.codePointAtPos(next);
|
|
15022
15176
|
return nextCh === 123 || this.chStartsBindingIdentifier(nextCh, next);
|
|
15023
15177
|
}
|
|
15024
|
-
|
|
15025
|
-
|
|
15026
|
-
type,
|
|
15027
|
-
containsEsc,
|
|
15028
|
-
end
|
|
15029
|
-
} = this.lookahead();
|
|
15030
|
-
if (type === 102 && !containsEsc) {
|
|
15031
|
-
const nextCharAfterOf = this.lookaheadCharCodeSince(end);
|
|
15032
|
-
if (nextCharAfterOf !== 61 && nextCharAfterOf !== 58 && nextCharAfterOf !== 59) {
|
|
15033
|
-
return false;
|
|
15034
|
-
}
|
|
15035
|
-
}
|
|
15036
|
-
if (tokenIsIdentifier(type) && !this.hasFollowingLineBreak()) {
|
|
15037
|
-
this.expectPlugin("explicitResourceManagement");
|
|
15038
|
-
return true;
|
|
15039
|
-
}
|
|
15040
|
-
return false;
|
|
15041
|
-
}
|
|
15042
|
-
startsAwaitUsing() {
|
|
15043
|
-
let next = this.nextTokenInLineStart();
|
|
15044
|
-
if (this.isUnparsedContextual(next, "using")) {
|
|
15045
|
-
next = this.nextTokenInLineStartSince(next + 5);
|
|
15046
|
-
const nextCh = this.codePointAtPos(next);
|
|
15047
|
-
if (this.chStartsBindingIdentifier(nextCh, next)) {
|
|
15048
|
-
this.expectPlugin("explicitResourceManagement");
|
|
15049
|
-
return true;
|
|
15050
|
-
}
|
|
15051
|
-
}
|
|
15052
|
-
return false;
|
|
15178
|
+
allowsUsing() {
|
|
15179
|
+
return (this.scope.inModule || !this.scope.inTopLevel) && !this.scope.inBareCaseStatement;
|
|
15053
15180
|
}
|
|
15054
15181
|
parseModuleItem() {
|
|
15055
15182
|
return this.parseStatementLike(1 | 2 | 4 | 8);
|
|
@@ -15114,11 +15241,13 @@ function requireLib () {
|
|
|
15114
15241
|
case 73:
|
|
15115
15242
|
return this.parseTryStatement(node);
|
|
15116
15243
|
case 96:
|
|
15117
|
-
if (
|
|
15118
|
-
if (!this.
|
|
15119
|
-
this.raise(Errors.
|
|
15244
|
+
if (this.isAwaitUsing()) {
|
|
15245
|
+
if (!this.allowsUsing()) {
|
|
15246
|
+
this.raise(Errors.UnexpectedUsingDeclaration, node);
|
|
15120
15247
|
} else if (!allowDeclaration) {
|
|
15121
15248
|
this.raise(Errors.UnexpectedLexicalDeclaration, node);
|
|
15249
|
+
} else if (!this.recordAwaitIfAllowed()) {
|
|
15250
|
+
this.raise(Errors.AwaitUsingNotInAsyncContext, node);
|
|
15122
15251
|
}
|
|
15123
15252
|
this.next();
|
|
15124
15253
|
return this.parseVarStatement(node, "await using");
|
|
@@ -15128,8 +15257,7 @@ function requireLib () {
|
|
|
15128
15257
|
if (this.state.containsEsc || !this.hasInLineFollowingBindingIdentifierOrBrace()) {
|
|
15129
15258
|
break;
|
|
15130
15259
|
}
|
|
15131
|
-
this.
|
|
15132
|
-
if (!this.scope.inModule && this.scope.inTopLevel) {
|
|
15260
|
+
if (!this.allowsUsing()) {
|
|
15133
15261
|
this.raise(Errors.UnexpectedUsingDeclaration, this.state.startLoc);
|
|
15134
15262
|
} else if (!allowDeclaration) {
|
|
15135
15263
|
this.raise(Errors.UnexpectedLexicalDeclaration, this.state.startLoc);
|
|
@@ -15297,7 +15425,7 @@ function requireLib () {
|
|
|
15297
15425
|
if (this.eat(10)) {
|
|
15298
15426
|
const node = this.startNodeAt(startLoc);
|
|
15299
15427
|
node.callee = expr;
|
|
15300
|
-
node.arguments = this.parseCallExpressionArguments(
|
|
15428
|
+
node.arguments = this.parseCallExpressionArguments();
|
|
15301
15429
|
this.toReferencedList(node.arguments);
|
|
15302
15430
|
return this.finishNode(node, "CallExpression");
|
|
15303
15431
|
}
|
|
@@ -15371,8 +15499,8 @@ function requireLib () {
|
|
|
15371
15499
|
}
|
|
15372
15500
|
const startsWithLet = this.isContextual(100);
|
|
15373
15501
|
{
|
|
15374
|
-
const startsWithAwaitUsing = this.
|
|
15375
|
-
const starsWithUsingDeclaration = startsWithAwaitUsing || this.
|
|
15502
|
+
const startsWithAwaitUsing = this.isAwaitUsing();
|
|
15503
|
+
const starsWithUsingDeclaration = startsWithAwaitUsing || this.isForUsing();
|
|
15376
15504
|
const isLetOrUsing = startsWithLet && this.hasFollowingBindingAtom() || starsWithUsingDeclaration;
|
|
15377
15505
|
if (this.match(74) || this.match(75) || isLetOrUsing) {
|
|
15378
15506
|
const initNode = this.startNode();
|
|
@@ -15442,7 +15570,7 @@ function requireLib () {
|
|
|
15442
15570
|
return this.finishNode(node, "IfStatement");
|
|
15443
15571
|
}
|
|
15444
15572
|
parseReturnStatement(node) {
|
|
15445
|
-
if (!this.prodParam.hasReturn
|
|
15573
|
+
if (!this.prodParam.hasReturn) {
|
|
15446
15574
|
this.raise(Errors.IllegalReturn, this.state.startLoc);
|
|
15447
15575
|
}
|
|
15448
15576
|
this.next();
|
|
@@ -15460,7 +15588,7 @@ function requireLib () {
|
|
|
15460
15588
|
const cases = node.cases = [];
|
|
15461
15589
|
this.expect(5);
|
|
15462
15590
|
this.state.labels.push(switchLabel);
|
|
15463
|
-
this.scope.enter(
|
|
15591
|
+
this.scope.enter(256);
|
|
15464
15592
|
let cur;
|
|
15465
15593
|
for (let sawDefault; !this.match(8);) {
|
|
15466
15594
|
if (this.match(61) || this.match(65)) {
|
|
@@ -15714,6 +15842,10 @@ function requireLib () {
|
|
|
15714
15842
|
if (id.type === "ArrayPattern" || id.type === "ObjectPattern") {
|
|
15715
15843
|
this.raise(Errors.UsingDeclarationHasBindingPattern, id.loc.start);
|
|
15716
15844
|
}
|
|
15845
|
+
} else {
|
|
15846
|
+
if (id.type === "VoidPattern") {
|
|
15847
|
+
this.raise(Errors.UnexpectedVoidPattern, id.loc.start);
|
|
15848
|
+
}
|
|
15717
15849
|
}
|
|
15718
15850
|
this.checkLVal(id, {
|
|
15719
15851
|
type: "VariableDeclarator"
|
|
@@ -15741,7 +15873,7 @@ function requireLib () {
|
|
|
15741
15873
|
}
|
|
15742
15874
|
const oldMaybeInArrowParameters = this.state.maybeInArrowParameters;
|
|
15743
15875
|
this.state.maybeInArrowParameters = false;
|
|
15744
|
-
this.scope.enter(
|
|
15876
|
+
this.scope.enter(514);
|
|
15745
15877
|
this.prodParam.enter(functionFlags(isAsync, node.generator));
|
|
15746
15878
|
if (!isDeclaration) {
|
|
15747
15879
|
node.id = this.parseFunctionId();
|
|
@@ -15882,6 +16014,7 @@ function requireLib () {
|
|
|
15882
16014
|
method.kind = "method";
|
|
15883
16015
|
const isPrivateName = this.match(139);
|
|
15884
16016
|
this.parseClassElementName(method);
|
|
16017
|
+
this.parsePostMemberNameModifiers(method);
|
|
15885
16018
|
if (isPrivateName) {
|
|
15886
16019
|
this.pushClassPrivateMethod(classBody, privateMethod, true, false);
|
|
15887
16020
|
return;
|
|
@@ -15993,7 +16126,7 @@ function requireLib () {
|
|
|
15993
16126
|
}
|
|
15994
16127
|
parseClassStaticBlock(classBody, member) {
|
|
15995
16128
|
var _member$decorators;
|
|
15996
|
-
this.scope.enter(
|
|
16129
|
+
this.scope.enter(576 | 128 | 16);
|
|
15997
16130
|
const oldLabels = this.state.labels;
|
|
15998
16131
|
this.state.labels = [];
|
|
15999
16132
|
this.prodParam.enter(0);
|
|
@@ -16057,7 +16190,7 @@ function requireLib () {
|
|
|
16057
16190
|
return this.finishNode(node, "ClassAccessorProperty");
|
|
16058
16191
|
}
|
|
16059
16192
|
parseInitializer(node) {
|
|
16060
|
-
this.scope.enter(
|
|
16193
|
+
this.scope.enter(576 | 16);
|
|
16061
16194
|
this.expressionScope.enter(newExpressionScope());
|
|
16062
16195
|
this.prodParam.enter(0);
|
|
16063
16196
|
node.value = this.eat(29) ? this.parseMaybeAssignAllowIn() : null;
|
|
@@ -16224,7 +16357,7 @@ function requireLib () {
|
|
|
16224
16357
|
}
|
|
16225
16358
|
return this.parseClass(this.maybeTakeDecorators(this.parseDecorators(false), this.startNode()), true, true);
|
|
16226
16359
|
}
|
|
16227
|
-
if (this.match(75) || this.match(74) || this.isLet()) {
|
|
16360
|
+
if (this.match(75) || this.match(74) || this.isLet() || this.isUsing() || this.isAwaitUsing()) {
|
|
16228
16361
|
throw this.raise(Errors.UnsupportedDefaultExport, this.state.startLoc);
|
|
16229
16362
|
}
|
|
16230
16363
|
const res = this.parseMaybeAssignAllowIn();
|
|
@@ -16247,10 +16380,9 @@ function requireLib () {
|
|
|
16247
16380
|
return false;
|
|
16248
16381
|
}
|
|
16249
16382
|
if ((type === 130 || type === 129) && !this.state.containsEsc) {
|
|
16250
|
-
const
|
|
16251
|
-
|
|
16252
|
-
|
|
16253
|
-
if (tokenIsIdentifier(nextType) && nextType !== 98 || nextType === 5) {
|
|
16383
|
+
const next = this.nextTokenStart();
|
|
16384
|
+
const nextChar = this.input.charCodeAt(next);
|
|
16385
|
+
if (nextChar === 123 || this.chStartsBindingIdentifier(nextChar, next) && !this.input.startsWith("from", next)) {
|
|
16254
16386
|
this.expectOnePlugin(["flow", "typescript"]);
|
|
16255
16387
|
return false;
|
|
16256
16388
|
}
|
|
@@ -16293,11 +16425,11 @@ function requireLib () {
|
|
|
16293
16425
|
return true;
|
|
16294
16426
|
}
|
|
16295
16427
|
}
|
|
16296
|
-
if (this.
|
|
16428
|
+
if (this.isUsing()) {
|
|
16297
16429
|
this.raise(Errors.UsingDeclarationExport, this.state.startLoc);
|
|
16298
16430
|
return true;
|
|
16299
16431
|
}
|
|
16300
|
-
if (this.
|
|
16432
|
+
if (this.isAwaitUsing()) {
|
|
16301
16433
|
this.raise(Errors.UsingDeclarationExport, this.state.startLoc);
|
|
16302
16434
|
return true;
|
|
16303
16435
|
}
|
|
@@ -16514,18 +16646,18 @@ function requireLib () {
|
|
|
16514
16646
|
this.applyImportPhase(node, isExport, null);
|
|
16515
16647
|
return null;
|
|
16516
16648
|
}
|
|
16517
|
-
const phaseIdentifier = this.
|
|
16649
|
+
const phaseIdentifier = this.startNode();
|
|
16650
|
+
const phaseIdentifierName = this.parseIdentifierName(true);
|
|
16518
16651
|
const {
|
|
16519
16652
|
type
|
|
16520
16653
|
} = this.state;
|
|
16521
16654
|
const isImportPhase = tokenIsKeywordOrIdentifier(type) ? type !== 98 || this.lookaheadCharCode() === 102 : type !== 12;
|
|
16522
16655
|
if (isImportPhase) {
|
|
16523
|
-
this.
|
|
16524
|
-
this.applyImportPhase(node, isExport, phaseIdentifier.name, phaseIdentifier.loc.start);
|
|
16656
|
+
this.applyImportPhase(node, isExport, phaseIdentifierName, phaseIdentifier.loc.start);
|
|
16525
16657
|
return null;
|
|
16526
16658
|
} else {
|
|
16527
16659
|
this.applyImportPhase(node, isExport, null);
|
|
16528
|
-
return phaseIdentifier;
|
|
16660
|
+
return this.createIdentifier(phaseIdentifier, phaseIdentifierName);
|
|
16529
16661
|
}
|
|
16530
16662
|
}
|
|
16531
16663
|
isPrecedingIdImportPhase(phase) {
|
|
@@ -17162,14 +17294,15 @@ function isReferencedIdentifier(id, parent, parentStack) {
|
|
|
17162
17294
|
if (id.name === "arguments") {
|
|
17163
17295
|
return false;
|
|
17164
17296
|
}
|
|
17165
|
-
if (isReferenced(id, parent)) {
|
|
17297
|
+
if (isReferenced(id, parent, parentStack[parentStack.length - 2])) {
|
|
17166
17298
|
return true;
|
|
17167
17299
|
}
|
|
17168
17300
|
switch (parent.type) {
|
|
17169
17301
|
case "AssignmentExpression":
|
|
17170
17302
|
case "AssignmentPattern":
|
|
17171
17303
|
return true;
|
|
17172
|
-
case "
|
|
17304
|
+
case "ObjectProperty":
|
|
17305
|
+
return parent.key !== id && isInDestructureAssignment(parent, parentStack);
|
|
17173
17306
|
case "ArrayPattern":
|
|
17174
17307
|
return isInDestructureAssignment(parent, parentStack);
|
|
17175
17308
|
}
|
|
@@ -17338,7 +17471,7 @@ function isReferenced(node, parent, grandparent) {
|
|
|
17338
17471
|
if (parent.key === node) {
|
|
17339
17472
|
return !!parent.computed;
|
|
17340
17473
|
}
|
|
17341
|
-
return
|
|
17474
|
+
return !grandparent || grandparent.type !== "ObjectPattern";
|
|
17342
17475
|
// no: class { NODE = value; }
|
|
17343
17476
|
// yes: class { [NODE] = value; }
|
|
17344
17477
|
// yes: class { key = NODE; }
|
|
@@ -17388,6 +17521,9 @@ function isReferenced(node, parent, grandparent) {
|
|
|
17388
17521
|
// yes: export { NODE as foo };
|
|
17389
17522
|
// no: export { NODE as foo } from "foo";
|
|
17390
17523
|
case "ExportSpecifier":
|
|
17524
|
+
if (grandparent == null ? void 0 : grandparent.source) {
|
|
17525
|
+
return false;
|
|
17526
|
+
}
|
|
17391
17527
|
return parent.local === node;
|
|
17392
17528
|
// no: import NODE from "foo";
|
|
17393
17529
|
// no: import * as NODE from "foo";
|
|
@@ -17468,7 +17604,7 @@ function isCoreComponent(tag) {
|
|
|
17468
17604
|
return BASE_TRANSITION;
|
|
17469
17605
|
}
|
|
17470
17606
|
}
|
|
17471
|
-
const nonIdentifierRE =
|
|
17607
|
+
const nonIdentifierRE = /^$|^\d|[^\$\w\xA0-\uFFFF]/;
|
|
17472
17608
|
const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
|
|
17473
17609
|
const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
|
|
17474
17610
|
const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
|
|
@@ -17633,6 +17769,9 @@ function hasDynamicKeyVBind(node) {
|
|
|
17633
17769
|
function isText$1(node) {
|
|
17634
17770
|
return node.type === 5 || node.type === 2;
|
|
17635
17771
|
}
|
|
17772
|
+
function isVPre(p) {
|
|
17773
|
+
return p.type === 7 && p.name === "pre";
|
|
17774
|
+
}
|
|
17636
17775
|
function isVSlot(p) {
|
|
17637
17776
|
return p.type === 7 && p.name === "slot";
|
|
17638
17777
|
}
|
|
@@ -17931,7 +18070,7 @@ const tokenizer = new Tokenizer(stack, {
|
|
|
17931
18070
|
ondirarg(start, end) {
|
|
17932
18071
|
if (start === end) return;
|
|
17933
18072
|
const arg = getSlice(start, end);
|
|
17934
|
-
if (inVPre) {
|
|
18073
|
+
if (inVPre && !isVPre(currentProp)) {
|
|
17935
18074
|
currentProp.name += arg;
|
|
17936
18075
|
setLocEnd(currentProp.nameLoc, end);
|
|
17937
18076
|
} else {
|
|
@@ -17946,7 +18085,7 @@ const tokenizer = new Tokenizer(stack, {
|
|
|
17946
18085
|
},
|
|
17947
18086
|
ondirmodifier(start, end) {
|
|
17948
18087
|
const mod = getSlice(start, end);
|
|
17949
|
-
if (inVPre) {
|
|
18088
|
+
if (inVPre && !isVPre(currentProp)) {
|
|
17950
18089
|
currentProp.name += "." + mod;
|
|
17951
18090
|
setLocEnd(currentProp.nameLoc, end);
|
|
17952
18091
|
} else if (currentProp.name === "slot") {
|
|
@@ -18286,7 +18425,7 @@ function isUpperCase(c) {
|
|
|
18286
18425
|
return c > 64 && c < 91;
|
|
18287
18426
|
}
|
|
18288
18427
|
const windowsNewlineRE = /\r\n/g;
|
|
18289
|
-
function condenseWhitespace(nodes
|
|
18428
|
+
function condenseWhitespace(nodes) {
|
|
18290
18429
|
const shouldCondense = currentOptions.whitespace !== "preserve";
|
|
18291
18430
|
let removedWhitespace = false;
|
|
18292
18431
|
for (let i = 0; i < nodes.length; i++) {
|
|
@@ -18472,12 +18611,12 @@ function cacheStatic(root, context) {
|
|
|
18472
18611
|
context,
|
|
18473
18612
|
// Root node is unfortunately non-hoistable due to potential parent
|
|
18474
18613
|
// fallthrough attributes.
|
|
18475
|
-
|
|
18614
|
+
!!getSingleElementRoot(root)
|
|
18476
18615
|
);
|
|
18477
18616
|
}
|
|
18478
|
-
function
|
|
18479
|
-
const
|
|
18480
|
-
return children.length === 1 &&
|
|
18617
|
+
function getSingleElementRoot(root) {
|
|
18618
|
+
const children = root.children.filter((x) => x.type !== 3);
|
|
18619
|
+
return children.length === 1 && children[0].type === 1 && !isSlotOutlet(children[0]) ? children[0] : null;
|
|
18481
18620
|
}
|
|
18482
18621
|
function walk$1(node, parent, context, doNotHoistNode = false, inFor = false) {
|
|
18483
18622
|
const { children } = node;
|
|
@@ -18510,6 +18649,11 @@ function walk$1(node, parent, context, doNotHoistNode = false, inFor = false) {
|
|
|
18510
18649
|
} else if (child.type === 12) {
|
|
18511
18650
|
const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
|
|
18512
18651
|
if (constantType >= 2) {
|
|
18652
|
+
if (child.codegenNode.type === 14 && child.codegenNode.arguments.length > 0) {
|
|
18653
|
+
child.codegenNode.arguments.push(
|
|
18654
|
+
-1 + (` /* ${PatchFlagNames[-1]} */` )
|
|
18655
|
+
);
|
|
18656
|
+
}
|
|
18513
18657
|
toCache.push(child);
|
|
18514
18658
|
continue;
|
|
18515
18659
|
}
|
|
@@ -18965,15 +19109,15 @@ function createRootCodegen(root, context) {
|
|
|
18965
19109
|
const { helper } = context;
|
|
18966
19110
|
const { children } = root;
|
|
18967
19111
|
if (children.length === 1) {
|
|
18968
|
-
const
|
|
18969
|
-
if (
|
|
18970
|
-
const codegenNode =
|
|
19112
|
+
const singleElementRootChild = getSingleElementRoot(root);
|
|
19113
|
+
if (singleElementRootChild && singleElementRootChild.codegenNode) {
|
|
19114
|
+
const codegenNode = singleElementRootChild.codegenNode;
|
|
18971
19115
|
if (codegenNode.type === 13) {
|
|
18972
19116
|
convertToBlock(codegenNode, context);
|
|
18973
19117
|
}
|
|
18974
19118
|
root.codegenNode = codegenNode;
|
|
18975
19119
|
} else {
|
|
18976
|
-
root.codegenNode =
|
|
19120
|
+
root.codegenNode = children[0];
|
|
18977
19121
|
}
|
|
18978
19122
|
} else if (children.length > 1) {
|
|
18979
19123
|
let patchFlag = 64;
|
|
@@ -23756,7 +23900,7 @@ const transformBind = (dir, _node, context) => {
|
|
|
23756
23900
|
arg.children.unshift(`(`);
|
|
23757
23901
|
arg.children.push(`) || ""`);
|
|
23758
23902
|
} else if (!arg.isStatic) {
|
|
23759
|
-
arg.content = `${arg.content} || ""`;
|
|
23903
|
+
arg.content = arg.content ? `${arg.content} || ""` : `""`;
|
|
23760
23904
|
}
|
|
23761
23905
|
if (modifiers.some((mod) => mod.content === "camel")) {
|
|
23762
23906
|
if (arg.type === 4) {
|
|
@@ -24169,7 +24313,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
|
|
|
24169
24313
|
let prev;
|
|
24170
24314
|
while (j--) {
|
|
24171
24315
|
prev = children[j];
|
|
24172
|
-
if (prev.type !== 3) {
|
|
24316
|
+
if (prev.type !== 3 && isNonWhitespaceContent(prev)) {
|
|
24173
24317
|
break;
|
|
24174
24318
|
}
|
|
24175
24319
|
}
|
|
@@ -26397,6 +26541,7 @@ var CompilerDOM = /*#__PURE__*/Object.freeze({
|
|
|
26397
26541
|
isStaticPropertyKey: isStaticPropertyKey,
|
|
26398
26542
|
isTemplateNode: isTemplateNode,
|
|
26399
26543
|
isText: isText$1,
|
|
26544
|
+
isVPre: isVPre,
|
|
26400
26545
|
isVSlot: isVSlot,
|
|
26401
26546
|
locStub: locStub,
|
|
26402
26547
|
noopDirectiveTransform: noopDirectiveTransform,
|
|
@@ -26511,7 +26656,14 @@ const CSS_VARS_HELPER = `useCssVars`;
|
|
|
26511
26656
|
function genCssVarsFromList(vars, id, isProd, isSSR = false) {
|
|
26512
26657
|
return `{
|
|
26513
26658
|
${vars.map(
|
|
26514
|
-
(key) =>
|
|
26659
|
+
(key) => (
|
|
26660
|
+
// The `:` prefix here is used in `ssrRenderStyle` to distinguish whether
|
|
26661
|
+
// a custom property comes from `ssrCssVars`. If it does, we need to reset
|
|
26662
|
+
// its value to `initial` on the component instance to avoid unintentionally
|
|
26663
|
+
// inheriting the same property value from a different instance of the same
|
|
26664
|
+
// component in the outer scope.
|
|
26665
|
+
`"${isSSR ? `:--` : ``}${genVarName(id, key, isProd, isSSR)}": (${key})`
|
|
26666
|
+
)
|
|
26515
26667
|
).join(",\n ")}
|
|
26516
26668
|
}`;
|
|
26517
26669
|
}
|
|
@@ -31562,7 +31714,7 @@ const transformSrcset = (node, context, options = defaultAssetUrlOptions) => {
|
|
|
31562
31714
|
}
|
|
31563
31715
|
}
|
|
31564
31716
|
const shouldProcessUrl = (url) => {
|
|
31565
|
-
return !isExternalUrl(url) && !isDataUrl(url) && (options.includeAbsolute || isRelativeUrl(url));
|
|
31717
|
+
return url && !isExternalUrl(url) && !isDataUrl(url) && (options.includeAbsolute || isRelativeUrl(url));
|
|
31566
31718
|
};
|
|
31567
31719
|
if (!imageCandidates.some(({ url }) => shouldProcessUrl(url))) {
|
|
31568
31720
|
return;
|
|
@@ -32740,6 +32892,17 @@ const ssrTransformModel = (dir, node, context) => {
|
|
|
32740
32892
|
);
|
|
32741
32893
|
}
|
|
32742
32894
|
}
|
|
32895
|
+
const processSelectChildren = (children) => {
|
|
32896
|
+
children.forEach((child) => {
|
|
32897
|
+
if (child.type === 1) {
|
|
32898
|
+
processOption(child);
|
|
32899
|
+
} else if (child.type === 11) {
|
|
32900
|
+
processSelectChildren(child.children);
|
|
32901
|
+
} else if (child.type === 9) {
|
|
32902
|
+
child.branches.forEach((b) => processSelectChildren(b.children));
|
|
32903
|
+
}
|
|
32904
|
+
});
|
|
32905
|
+
};
|
|
32743
32906
|
function processOption(plainNode) {
|
|
32744
32907
|
if (plainNode.tag === "option") {
|
|
32745
32908
|
if (plainNode.props.findIndex((p) => p.name === "selected") === -1) {
|
|
@@ -32766,9 +32929,7 @@ const ssrTransformModel = (dir, node, context) => {
|
|
|
32766
32929
|
);
|
|
32767
32930
|
}
|
|
32768
32931
|
} else if (plainNode.tag === "optgroup") {
|
|
32769
|
-
plainNode.children
|
|
32770
|
-
(option) => processOption(option)
|
|
32771
|
-
);
|
|
32932
|
+
processSelectChildren(plainNode.children);
|
|
32772
32933
|
}
|
|
32773
32934
|
}
|
|
32774
32935
|
if (node.tagType === 0) {
|
|
@@ -32853,18 +33014,7 @@ const ssrTransformModel = (dir, node, context) => {
|
|
|
32853
33014
|
checkDuplicatedValue();
|
|
32854
33015
|
node.children = [createInterpolation(model, model.loc)];
|
|
32855
33016
|
} else if (node.tag === "select") {
|
|
32856
|
-
|
|
32857
|
-
children.forEach((child) => {
|
|
32858
|
-
if (child.type === 1) {
|
|
32859
|
-
processOption(child);
|
|
32860
|
-
} else if (child.type === 11) {
|
|
32861
|
-
processChildren(child.children);
|
|
32862
|
-
} else if (child.type === 9) {
|
|
32863
|
-
child.branches.forEach((b) => processChildren(b.children));
|
|
32864
|
-
}
|
|
32865
|
-
});
|
|
32866
|
-
};
|
|
32867
|
-
processChildren(node.children);
|
|
33017
|
+
processSelectChildren(node.children);
|
|
32868
33018
|
} else {
|
|
32869
33019
|
context.onError(
|
|
32870
33020
|
createDOMCompilerError(
|
|
@@ -34340,11 +34490,8 @@ function requireNode$2 () {
|
|
|
34340
34490
|
|
|
34341
34491
|
function sourceOffset(inputCSS, position) {
|
|
34342
34492
|
// Not all custom syntaxes support `offset` in `source.start` and `source.end`
|
|
34343
|
-
if (
|
|
34344
|
-
position
|
|
34345
|
-
typeof position.offset !== 'undefined'
|
|
34346
|
-
) {
|
|
34347
|
-
return position.offset;
|
|
34493
|
+
if (position && typeof position.offset !== 'undefined') {
|
|
34494
|
+
return position.offset
|
|
34348
34495
|
}
|
|
34349
34496
|
|
|
34350
34497
|
let column = 1;
|
|
@@ -34514,14 +34661,15 @@ function requireNode$2 () {
|
|
|
34514
34661
|
return this.parent.nodes[index + 1]
|
|
34515
34662
|
}
|
|
34516
34663
|
|
|
34517
|
-
positionBy(opts) {
|
|
34664
|
+
positionBy(opts = {}) {
|
|
34518
34665
|
let pos = this.source.start;
|
|
34519
34666
|
if (opts.index) {
|
|
34520
34667
|
pos = this.positionInside(opts.index);
|
|
34521
34668
|
} else if (opts.word) {
|
|
34522
|
-
let inputString =
|
|
34523
|
-
|
|
34524
|
-
|
|
34669
|
+
let inputString =
|
|
34670
|
+
'document' in this.source.input
|
|
34671
|
+
? this.source.input.document
|
|
34672
|
+
: this.source.input.css;
|
|
34525
34673
|
let stringRepresentation = inputString.slice(
|
|
34526
34674
|
sourceOffset(inputString, this.source.start),
|
|
34527
34675
|
sourceOffset(inputString, this.source.end)
|
|
@@ -34535,9 +34683,10 @@ function requireNode$2 () {
|
|
|
34535
34683
|
positionInside(index) {
|
|
34536
34684
|
let column = this.source.start.column;
|
|
34537
34685
|
let line = this.source.start.line;
|
|
34538
|
-
let inputString =
|
|
34539
|
-
|
|
34540
|
-
|
|
34686
|
+
let inputString =
|
|
34687
|
+
'document' in this.source.input
|
|
34688
|
+
? this.source.input.document
|
|
34689
|
+
: this.source.input.css;
|
|
34541
34690
|
let offset = sourceOffset(inputString, this.source.start);
|
|
34542
34691
|
let end = offset + index;
|
|
34543
34692
|
|
|
@@ -34550,7 +34699,7 @@ function requireNode$2 () {
|
|
|
34550
34699
|
}
|
|
34551
34700
|
}
|
|
34552
34701
|
|
|
34553
|
-
return { column, line }
|
|
34702
|
+
return { column, line, offset: end }
|
|
34554
34703
|
}
|
|
34555
34704
|
|
|
34556
34705
|
prev() {
|
|
@@ -34559,25 +34708,36 @@ function requireNode$2 () {
|
|
|
34559
34708
|
return this.parent.nodes[index - 1]
|
|
34560
34709
|
}
|
|
34561
34710
|
|
|
34562
|
-
rangeBy(opts) {
|
|
34711
|
+
rangeBy(opts = {}) {
|
|
34712
|
+
let inputString =
|
|
34713
|
+
'document' in this.source.input
|
|
34714
|
+
? this.source.input.document
|
|
34715
|
+
: this.source.input.css;
|
|
34563
34716
|
let start = {
|
|
34564
34717
|
column: this.source.start.column,
|
|
34565
|
-
line: this.source.start.line
|
|
34718
|
+
line: this.source.start.line,
|
|
34719
|
+
offset: sourceOffset(inputString, this.source.start)
|
|
34566
34720
|
};
|
|
34567
34721
|
let end = this.source.end
|
|
34568
34722
|
? {
|
|
34569
34723
|
column: this.source.end.column + 1,
|
|
34570
|
-
line: this.source.end.line
|
|
34724
|
+
line: this.source.end.line,
|
|
34725
|
+
offset:
|
|
34726
|
+
typeof this.source.end.offset === 'number'
|
|
34727
|
+
? // `source.end.offset` is exclusive, so we don't need to add 1
|
|
34728
|
+
this.source.end.offset
|
|
34729
|
+
: // Since line/column in this.source.end is inclusive,
|
|
34730
|
+
// the `sourceOffset(... , this.source.end)` returns an inclusive offset.
|
|
34731
|
+
// So, we add 1 to convert it to exclusive.
|
|
34732
|
+
sourceOffset(inputString, this.source.end) + 1
|
|
34571
34733
|
}
|
|
34572
34734
|
: {
|
|
34573
34735
|
column: start.column + 1,
|
|
34574
|
-
line: start.line
|
|
34736
|
+
line: start.line,
|
|
34737
|
+
offset: start.offset + 1
|
|
34575
34738
|
};
|
|
34576
34739
|
|
|
34577
34740
|
if (opts.word) {
|
|
34578
|
-
let inputString = ('document' in this.source.input)
|
|
34579
|
-
? this.source.input.document
|
|
34580
|
-
: this.source.input.css;
|
|
34581
34741
|
let stringRepresentation = inputString.slice(
|
|
34582
34742
|
sourceOffset(inputString, this.source.start),
|
|
34583
34743
|
sourceOffset(inputString, this.source.end)
|
|
@@ -34585,15 +34745,14 @@ function requireNode$2 () {
|
|
|
34585
34745
|
let index = stringRepresentation.indexOf(opts.word);
|
|
34586
34746
|
if (index !== -1) {
|
|
34587
34747
|
start = this.positionInside(index);
|
|
34588
|
-
end = this.positionInside(
|
|
34589
|
-
index + opts.word.length,
|
|
34590
|
-
);
|
|
34748
|
+
end = this.positionInside(index + opts.word.length);
|
|
34591
34749
|
}
|
|
34592
34750
|
} else {
|
|
34593
34751
|
if (opts.start) {
|
|
34594
34752
|
start = {
|
|
34595
34753
|
column: opts.start.column,
|
|
34596
|
-
line: opts.start.line
|
|
34754
|
+
line: opts.start.line,
|
|
34755
|
+
offset: sourceOffset(inputString, opts.start)
|
|
34597
34756
|
};
|
|
34598
34757
|
} else if (opts.index) {
|
|
34599
34758
|
start = this.positionInside(opts.index);
|
|
@@ -34602,7 +34761,8 @@ function requireNode$2 () {
|
|
|
34602
34761
|
if (opts.end) {
|
|
34603
34762
|
end = {
|
|
34604
34763
|
column: opts.end.column,
|
|
34605
|
-
line: opts.end.line
|
|
34764
|
+
line: opts.end.line,
|
|
34765
|
+
offset: sourceOffset(inputString, opts.end)
|
|
34606
34766
|
};
|
|
34607
34767
|
} else if (typeof opts.endIndex === 'number') {
|
|
34608
34768
|
end = this.positionInside(opts.endIndex);
|
|
@@ -34615,7 +34775,11 @@ function requireNode$2 () {
|
|
|
34615
34775
|
end.line < start.line ||
|
|
34616
34776
|
(end.line === start.line && end.column <= start.column)
|
|
34617
34777
|
) {
|
|
34618
|
-
end = {
|
|
34778
|
+
end = {
|
|
34779
|
+
column: start.column + 1,
|
|
34780
|
+
line: start.line,
|
|
34781
|
+
offset: start.offset + 1
|
|
34782
|
+
};
|
|
34619
34783
|
}
|
|
34620
34784
|
|
|
34621
34785
|
return { end, start }
|
|
@@ -34690,6 +34854,7 @@ function requireNode$2 () {
|
|
|
34690
34854
|
} else if (typeof value === 'object' && value.toJSON) {
|
|
34691
34855
|
fixed[name] = value.toJSON(null, inputs);
|
|
34692
34856
|
} else if (name === 'source') {
|
|
34857
|
+
if (value == null) continue
|
|
34693
34858
|
let inputId = inputs.get(value.input);
|
|
34694
34859
|
if (inputId == null) {
|
|
34695
34860
|
inputId = inputsNextIndex;
|
|
@@ -34729,7 +34894,7 @@ function requireNode$2 () {
|
|
|
34729
34894
|
return result
|
|
34730
34895
|
}
|
|
34731
34896
|
|
|
34732
|
-
warn(result, text, opts) {
|
|
34897
|
+
warn(result, text, opts = {}) {
|
|
34733
34898
|
let data = { node: this };
|
|
34734
34899
|
for (let i in opts) data[i] = opts[i];
|
|
34735
34900
|
return result.warn(text, data)
|
|
@@ -35536,11 +35701,26 @@ function requireInput () {
|
|
|
35536
35701
|
let PreviousMap = /*@__PURE__*/ requirePreviousMap();
|
|
35537
35702
|
let terminalHighlight = /*@__PURE__*/ requireTerminalHighlight();
|
|
35538
35703
|
|
|
35539
|
-
let
|
|
35704
|
+
let lineToIndexCache = Symbol('lineToIndexCache');
|
|
35540
35705
|
|
|
35541
35706
|
let sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator);
|
|
35542
35707
|
let pathAvailable = Boolean(resolve && isAbsolute);
|
|
35543
35708
|
|
|
35709
|
+
function getLineToIndex(input) {
|
|
35710
|
+
if (input[lineToIndexCache]) return input[lineToIndexCache]
|
|
35711
|
+
let lines = input.css.split('\n');
|
|
35712
|
+
let lineToIndex = new Array(lines.length);
|
|
35713
|
+
let prevIndex = 0;
|
|
35714
|
+
|
|
35715
|
+
for (let i = 0, l = lines.length; i < l; i++) {
|
|
35716
|
+
lineToIndex[i] = prevIndex;
|
|
35717
|
+
prevIndex += lines[i].length + 1;
|
|
35718
|
+
}
|
|
35719
|
+
|
|
35720
|
+
input[lineToIndexCache] = lineToIndex;
|
|
35721
|
+
return lineToIndex
|
|
35722
|
+
}
|
|
35723
|
+
|
|
35544
35724
|
class Input {
|
|
35545
35725
|
get from() {
|
|
35546
35726
|
return this.file || this.id
|
|
@@ -35595,31 +35775,38 @@ function requireInput () {
|
|
|
35595
35775
|
}
|
|
35596
35776
|
|
|
35597
35777
|
error(message, line, column, opts = {}) {
|
|
35598
|
-
let endColumn, endLine, result;
|
|
35778
|
+
let endColumn, endLine, endOffset, offset, result;
|
|
35599
35779
|
|
|
35600
35780
|
if (line && typeof line === 'object') {
|
|
35601
35781
|
let start = line;
|
|
35602
35782
|
let end = column;
|
|
35603
35783
|
if (typeof start.offset === 'number') {
|
|
35604
|
-
|
|
35784
|
+
offset = start.offset;
|
|
35785
|
+
let pos = this.fromOffset(offset);
|
|
35605
35786
|
line = pos.line;
|
|
35606
35787
|
column = pos.col;
|
|
35607
35788
|
} else {
|
|
35608
35789
|
line = start.line;
|
|
35609
35790
|
column = start.column;
|
|
35791
|
+
offset = this.fromLineAndColumn(line, column);
|
|
35610
35792
|
}
|
|
35611
35793
|
if (typeof end.offset === 'number') {
|
|
35612
|
-
|
|
35794
|
+
endOffset = end.offset;
|
|
35795
|
+
let pos = this.fromOffset(endOffset);
|
|
35613
35796
|
endLine = pos.line;
|
|
35614
35797
|
endColumn = pos.col;
|
|
35615
35798
|
} else {
|
|
35616
35799
|
endLine = end.line;
|
|
35617
35800
|
endColumn = end.column;
|
|
35801
|
+
endOffset = this.fromLineAndColumn(end.line, end.column);
|
|
35618
35802
|
}
|
|
35619
35803
|
} else if (!column) {
|
|
35620
|
-
|
|
35804
|
+
offset = line;
|
|
35805
|
+
let pos = this.fromOffset(offset);
|
|
35621
35806
|
line = pos.line;
|
|
35622
35807
|
column = pos.col;
|
|
35808
|
+
} else {
|
|
35809
|
+
offset = this.fromLineAndColumn(line, column);
|
|
35623
35810
|
}
|
|
35624
35811
|
|
|
35625
35812
|
let origin = this.origin(line, column, endLine, endColumn);
|
|
@@ -35647,7 +35834,7 @@ function requireInput () {
|
|
|
35647
35834
|
);
|
|
35648
35835
|
}
|
|
35649
35836
|
|
|
35650
|
-
result.input = { column, endColumn, endLine, line, source: this.css };
|
|
35837
|
+
result.input = { column, endColumn, endLine, endOffset, line, offset, source: this.css };
|
|
35651
35838
|
if (this.file) {
|
|
35652
35839
|
if (pathToFileURL) {
|
|
35653
35840
|
result.input.url = pathToFileURL(this.file).toString();
|
|
@@ -35658,23 +35845,15 @@ function requireInput () {
|
|
|
35658
35845
|
return result
|
|
35659
35846
|
}
|
|
35660
35847
|
|
|
35661
|
-
|
|
35662
|
-
let
|
|
35663
|
-
|
|
35664
|
-
|
|
35665
|
-
|
|
35666
|
-
let prevIndex = 0;
|
|
35667
|
-
|
|
35668
|
-
for (let i = 0, l = lines.length; i < l; i++) {
|
|
35669
|
-
lineToIndex[i] = prevIndex;
|
|
35670
|
-
prevIndex += lines[i].length + 1;
|
|
35671
|
-
}
|
|
35848
|
+
fromLineAndColumn(line, column) {
|
|
35849
|
+
let lineToIndex = getLineToIndex(this);
|
|
35850
|
+
let index = lineToIndex[line - 1];
|
|
35851
|
+
return index + column - 1
|
|
35852
|
+
}
|
|
35672
35853
|
|
|
35673
|
-
|
|
35674
|
-
|
|
35675
|
-
|
|
35676
|
-
}
|
|
35677
|
-
lastLine = lineToIndex[lineToIndex.length - 1];
|
|
35854
|
+
fromOffset(offset) {
|
|
35855
|
+
let lineToIndex = getLineToIndex(this);
|
|
35856
|
+
let lastLine = lineToIndex[lineToIndex.length - 1];
|
|
35678
35857
|
|
|
35679
35858
|
let min = 0;
|
|
35680
35859
|
if (offset >= lastLine) {
|
|
@@ -37120,7 +37299,7 @@ function requireResult () {
|
|
|
37120
37299
|
this.messages = [];
|
|
37121
37300
|
this.root = root;
|
|
37122
37301
|
this.opts = opts;
|
|
37123
|
-
this.css =
|
|
37302
|
+
this.css = '';
|
|
37124
37303
|
this.map = undefined;
|
|
37125
37304
|
}
|
|
37126
37305
|
|
|
@@ -37891,7 +38070,7 @@ function requireProcessor$1 () {
|
|
|
37891
38070
|
|
|
37892
38071
|
class Processor {
|
|
37893
38072
|
constructor(plugins = []) {
|
|
37894
|
-
this.version = '8.5.
|
|
38073
|
+
this.version = '8.5.6';
|
|
37895
38074
|
this.plugins = this.normalize(plugins);
|
|
37896
38075
|
}
|
|
37897
38076
|
|
|
@@ -41731,6 +41910,7 @@ var selectorParser = /*@__PURE__*/getDefaultExportFromCjs(distExports);
|
|
|
41731
41910
|
|
|
41732
41911
|
const animationNameRE = /^(-\w+-)?animation-name$/;
|
|
41733
41912
|
const animationRE = /^(-\w+-)?animation$/;
|
|
41913
|
+
const keyframesRE = /^(?:-\w+-)?keyframes$/;
|
|
41734
41914
|
const scopedPlugin = (id = "") => {
|
|
41735
41915
|
const keyframes = /* @__PURE__ */ Object.create(null);
|
|
41736
41916
|
const shortId = id.replace(/^data-v-/, "");
|
|
@@ -41740,7 +41920,7 @@ const scopedPlugin = (id = "") => {
|
|
|
41740
41920
|
processRule(id, rule);
|
|
41741
41921
|
},
|
|
41742
41922
|
AtRule(node) {
|
|
41743
|
-
if (
|
|
41923
|
+
if (keyframesRE.test(node.name) && !node.params.endsWith(`-${shortId}`)) {
|
|
41744
41924
|
keyframes[node.params] = node.params = node.params + "-" + shortId;
|
|
41745
41925
|
}
|
|
41746
41926
|
},
|
|
@@ -41769,7 +41949,7 @@ const scopedPlugin = (id = "") => {
|
|
|
41769
41949
|
};
|
|
41770
41950
|
const processedRules = /* @__PURE__ */ new WeakSet();
|
|
41771
41951
|
function processRule(id, rule) {
|
|
41772
|
-
if (processedRules.has(rule) || rule.parent && rule.parent.type === "atrule" &&
|
|
41952
|
+
if (processedRules.has(rule) || rule.parent && rule.parent.type === "atrule" && keyframesRE.test(rule.parent.name)) {
|
|
41773
41953
|
return;
|
|
41774
41954
|
}
|
|
41775
41955
|
processedRules.add(rule);
|
|
@@ -47639,25 +47819,39 @@ function resolveArrayElementType(ctx, node, scope) {
|
|
|
47639
47819
|
scope
|
|
47640
47820
|
);
|
|
47641
47821
|
}
|
|
47642
|
-
function resolveStringType(ctx, node, scope) {
|
|
47822
|
+
function resolveStringType(ctx, node, scope, typeParameters) {
|
|
47643
47823
|
switch (node.type) {
|
|
47644
47824
|
case "StringLiteral":
|
|
47645
47825
|
return [node.value];
|
|
47646
47826
|
case "TSLiteralType":
|
|
47647
|
-
return resolveStringType(ctx, node.literal, scope);
|
|
47827
|
+
return resolveStringType(ctx, node.literal, scope, typeParameters);
|
|
47648
47828
|
case "TSUnionType":
|
|
47649
|
-
return node.types.map((t) => resolveStringType(ctx, t, scope)).flat();
|
|
47829
|
+
return node.types.map((t) => resolveStringType(ctx, t, scope, typeParameters)).flat();
|
|
47650
47830
|
case "TemplateLiteral": {
|
|
47651
47831
|
return resolveTemplateKeys(ctx, node, scope);
|
|
47652
47832
|
}
|
|
47653
47833
|
case "TSTypeReference": {
|
|
47654
47834
|
const resolved = resolveTypeReference(ctx, node, scope);
|
|
47655
47835
|
if (resolved) {
|
|
47656
|
-
return resolveStringType(ctx, resolved, scope);
|
|
47836
|
+
return resolveStringType(ctx, resolved, scope, typeParameters);
|
|
47657
47837
|
}
|
|
47658
47838
|
if (node.typeName.type === "Identifier") {
|
|
47659
|
-
const
|
|
47660
|
-
|
|
47839
|
+
const name = node.typeName.name;
|
|
47840
|
+
if (typeParameters && typeParameters[name]) {
|
|
47841
|
+
return resolveStringType(
|
|
47842
|
+
ctx,
|
|
47843
|
+
typeParameters[name],
|
|
47844
|
+
scope,
|
|
47845
|
+
typeParameters
|
|
47846
|
+
);
|
|
47847
|
+
}
|
|
47848
|
+
const getParam = (index = 0) => resolveStringType(
|
|
47849
|
+
ctx,
|
|
47850
|
+
node.typeParameters.params[index],
|
|
47851
|
+
scope,
|
|
47852
|
+
typeParameters
|
|
47853
|
+
);
|
|
47854
|
+
switch (name) {
|
|
47661
47855
|
case "Extract":
|
|
47662
47856
|
return getParam(1);
|
|
47663
47857
|
case "Exclude": {
|
|
@@ -47743,7 +47937,8 @@ function resolveBuiltin(ctx, node, name, scope, typeParameters) {
|
|
|
47743
47937
|
const picked = resolveStringType(
|
|
47744
47938
|
ctx,
|
|
47745
47939
|
node.typeParameters.params[1],
|
|
47746
|
-
scope
|
|
47940
|
+
scope,
|
|
47941
|
+
typeParameters
|
|
47747
47942
|
);
|
|
47748
47943
|
const res2 = { props: {}, calls: t.calls };
|
|
47749
47944
|
for (const key of picked) {
|
|
@@ -47755,7 +47950,8 @@ function resolveBuiltin(ctx, node, name, scope, typeParameters) {
|
|
|
47755
47950
|
const omitted = resolveStringType(
|
|
47756
47951
|
ctx,
|
|
47757
47952
|
node.typeParameters.params[1],
|
|
47758
|
-
scope
|
|
47953
|
+
scope,
|
|
47954
|
+
typeParameters
|
|
47759
47955
|
);
|
|
47760
47956
|
const res = { props: {}, calls: t.calls };
|
|
47761
47957
|
for (const key in t.props) {
|
|
@@ -48318,13 +48514,8 @@ function inferRuntimeType(ctx, node, scope = node._ownerScope || ctxToScope(ctx)
|
|
|
48318
48514
|
case "TSTypeReference": {
|
|
48319
48515
|
const resolved = resolveTypeReference(ctx, node, scope);
|
|
48320
48516
|
if (resolved) {
|
|
48321
|
-
if (resolved.type === "TSTypeAliasDeclaration") {
|
|
48322
|
-
return
|
|
48323
|
-
ctx,
|
|
48324
|
-
resolved.typeAnnotation,
|
|
48325
|
-
resolved._ownerScope,
|
|
48326
|
-
isKeyOf
|
|
48327
|
-
);
|
|
48517
|
+
if (resolved.type === "TSTypeAliasDeclaration" && resolved.typeAnnotation.type === "TSFunctionType") {
|
|
48518
|
+
return ["Function"];
|
|
48328
48519
|
}
|
|
48329
48520
|
return inferRuntimeType(ctx, resolved, resolved._ownerScope, isKeyOf);
|
|
48330
48521
|
}
|
|
@@ -50256,7 +50447,7 @@ var __spreadValues = (a, b) => {
|
|
|
50256
50447
|
}
|
|
50257
50448
|
return a;
|
|
50258
50449
|
};
|
|
50259
|
-
const version = "3.5.
|
|
50450
|
+
const version = "3.5.18";
|
|
50260
50451
|
const parseCache = parseCache$1;
|
|
50261
50452
|
const errorMessages = __spreadValues(__spreadValues({}, errorMessages$1), DOMErrorMessages);
|
|
50262
50453
|
const walk = walk$2;
|