@vue/compiler-sfc 3.5.16 → 3.5.17
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 +271 -299
- package/dist/compiler-sfc.esm-browser.js +286 -198
- package/package.json +10 -10
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-sfc v3.5.
|
|
2
|
+
* @vue/compiler-sfc v3.5.17
|
|
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: ({
|
|
@@ -2701,7 +2702,7 @@ function requireLib () {
|
|
|
2701
2702
|
unexpected
|
|
2702
2703
|
}) => `Unexpected token${unexpected ? ` '${unexpected}'.` : ""}${expected ? `, expected "${expected}"` : ""}`,
|
|
2703
2704
|
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
|
|
2705
|
+
UnexpectedUsingDeclaration: "Using declaration cannot appear in the top level when source type is `script` or in the bare case statement.",
|
|
2705
2706
|
UnsupportedBind: "Binding should be performed on object property.",
|
|
2706
2707
|
UnsupportedDecoratorExport: "A decorated export must export a class declaration.",
|
|
2707
2708
|
UnsupportedDefaultExport: "Only expressions, functions or classes are allowed as the `default` export.",
|
|
@@ -2740,6 +2741,12 @@ function requireLib () {
|
|
|
2740
2741
|
StrictOctalLiteral: "Legacy octal literals are not allowed in strict mode.",
|
|
2741
2742
|
StrictWith: "'with' in strict mode."
|
|
2742
2743
|
};
|
|
2744
|
+
var ParseExpressionErrors = {
|
|
2745
|
+
ParseExpressionEmptyInput: "Unexpected parseExpression() input: The input is empty or contains only comments.",
|
|
2746
|
+
ParseExpressionExpectsEOF: ({
|
|
2747
|
+
unexpected
|
|
2748
|
+
}) => `Unexpected parseExpression() input: The input should contain exactly one expression, but the first expression is followed by the unexpected character \`${String.fromCodePoint(unexpected)}\`.`
|
|
2749
|
+
};
|
|
2743
2750
|
const UnparenthesizedPipeBodyDescriptions = new Set(["ArrowFunctionExpression", "AssignmentExpression", "ConditionalExpression", "YieldExpression"]);
|
|
2744
2751
|
var PipelineOperatorErrors = Object.assign({
|
|
2745
2752
|
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 +2861,7 @@ function requireLib () {
|
|
|
2854
2861
|
}
|
|
2855
2862
|
return ParseErrorConstructors;
|
|
2856
2863
|
}
|
|
2857
|
-
const Errors = Object.assign({}, ParseErrorEnum(ModuleErrors), ParseErrorEnum(StandardErrors), ParseErrorEnum(StrictModeErrors), ParseErrorEnum`pipelineOperator`(PipelineOperatorErrors));
|
|
2864
|
+
const Errors = Object.assign({}, ParseErrorEnum(ModuleErrors), ParseErrorEnum(StandardErrors), ParseErrorEnum(StrictModeErrors), ParseErrorEnum(ParseExpressionErrors), ParseErrorEnum`pipelineOperator`(PipelineOperatorErrors));
|
|
2858
2865
|
function createDefaultOptions() {
|
|
2859
2866
|
return {
|
|
2860
2867
|
sourceType: "script",
|
|
@@ -3990,7 +3997,7 @@ function requireLib () {
|
|
|
3990
3997
|
if (flags & 128) {
|
|
3991
3998
|
return true;
|
|
3992
3999
|
}
|
|
3993
|
-
if (flags & (
|
|
4000
|
+
if (flags & (643 | 64)) {
|
|
3994
4001
|
return false;
|
|
3995
4002
|
}
|
|
3996
4003
|
}
|
|
@@ -3998,6 +4005,9 @@ function requireLib () {
|
|
|
3998
4005
|
get inNonArrowFunction() {
|
|
3999
4006
|
return (this.currentThisScopeFlags() & 2) > 0;
|
|
4000
4007
|
}
|
|
4008
|
+
get inBareCaseStatement() {
|
|
4009
|
+
return (this.currentScope().flags & 256) > 0;
|
|
4010
|
+
}
|
|
4001
4011
|
get treatFunctionsAsVar() {
|
|
4002
4012
|
return this.treatFunctionsAsVarInScope(this.currentScope());
|
|
4003
4013
|
}
|
|
@@ -4037,7 +4047,7 @@ function requireLib () {
|
|
|
4037
4047
|
this.checkRedeclarationInScope(scope, name, bindingType, loc);
|
|
4038
4048
|
scope.names.set(name, (scope.names.get(name) || 0) | 1);
|
|
4039
4049
|
this.maybeExportDefined(scope, name);
|
|
4040
|
-
if (scope.flags &
|
|
4050
|
+
if (scope.flags & 643) break;
|
|
4041
4051
|
}
|
|
4042
4052
|
}
|
|
4043
4053
|
if (this.parser.inModule && scope.flags & 1) {
|
|
@@ -4084,7 +4094,7 @@ function requireLib () {
|
|
|
4084
4094
|
const {
|
|
4085
4095
|
flags
|
|
4086
4096
|
} = this.scopeStack[i];
|
|
4087
|
-
if (flags &
|
|
4097
|
+
if (flags & 643) {
|
|
4088
4098
|
return flags;
|
|
4089
4099
|
}
|
|
4090
4100
|
}
|
|
@@ -4094,7 +4104,7 @@ function requireLib () {
|
|
|
4094
4104
|
const {
|
|
4095
4105
|
flags
|
|
4096
4106
|
} = this.scopeStack[i];
|
|
4097
|
-
if (flags & (
|
|
4107
|
+
if (flags & (643 | 64) && !(flags & 4)) {
|
|
4098
4108
|
return flags;
|
|
4099
4109
|
}
|
|
4100
4110
|
}
|
|
@@ -7276,14 +7286,14 @@ function requireLib () {
|
|
|
7276
7286
|
return new TypeScriptScope(flags);
|
|
7277
7287
|
}
|
|
7278
7288
|
enter(flags) {
|
|
7279
|
-
if (flags ===
|
|
7289
|
+
if (flags === 512) {
|
|
7280
7290
|
this.importsStack.push(new Set());
|
|
7281
7291
|
}
|
|
7282
7292
|
super.enter(flags);
|
|
7283
7293
|
}
|
|
7284
7294
|
exit() {
|
|
7285
7295
|
const flags = super.exit();
|
|
7286
|
-
if (flags ===
|
|
7296
|
+
if (flags === 512) {
|
|
7287
7297
|
this.importsStack.pop();
|
|
7288
7298
|
}
|
|
7289
7299
|
return flags;
|
|
@@ -7512,6 +7522,7 @@ function requireLib () {
|
|
|
7512
7522
|
}
|
|
7513
7523
|
}
|
|
7514
7524
|
finalizeComment(commentWS) {
|
|
7525
|
+
var _node$options;
|
|
7515
7526
|
const {
|
|
7516
7527
|
comments
|
|
7517
7528
|
} = commentWS;
|
|
@@ -7538,6 +7549,9 @@ function requireLib () {
|
|
|
7538
7549
|
case "OptionalCallExpression":
|
|
7539
7550
|
adjustInnerComments(node, node.arguments, commentWS);
|
|
7540
7551
|
break;
|
|
7552
|
+
case "ImportExpression":
|
|
7553
|
+
adjustInnerComments(node, [node.source, (_node$options = node.options) != null ? _node$options : null], commentWS);
|
|
7554
|
+
break;
|
|
7541
7555
|
case "FunctionDeclaration":
|
|
7542
7556
|
case "FunctionExpression":
|
|
7543
7557
|
case "ArrowFunctionExpression":
|
|
@@ -7595,20 +7609,6 @@ function requireLib () {
|
|
|
7595
7609
|
commentWS.leadingNode = null;
|
|
7596
7610
|
}
|
|
7597
7611
|
}
|
|
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
7612
|
takeSurroundingComments(node, start, end) {
|
|
7613
7613
|
const {
|
|
7614
7614
|
commentStack
|
|
@@ -10030,7 +10030,7 @@ function requireLib () {
|
|
|
10030
10030
|
DeclareFunctionHasImplementation: "An implementation cannot be declared in ambient contexts.",
|
|
10031
10031
|
DuplicateAccessibilityModifier: ({
|
|
10032
10032
|
modifier
|
|
10033
|
-
}) => `Accessibility modifier already seen.`,
|
|
10033
|
+
}) => `Accessibility modifier already seen: '${modifier}'.`,
|
|
10034
10034
|
DuplicateModifier: ({
|
|
10035
10035
|
modifier
|
|
10036
10036
|
}) => `Duplicate modifier: '${modifier}'.`,
|
|
@@ -10056,6 +10056,7 @@ function requireLib () {
|
|
|
10056
10056
|
InvalidHeritageClauseType: ({
|
|
10057
10057
|
token
|
|
10058
10058
|
}) => `'${token}' list can only include identifiers or qualified-names with optional type arguments.`,
|
|
10059
|
+
InvalidModifierOnAwaitUsingDeclaration: modifier => `'${modifier}' modifier cannot appear on an await using declaration.`,
|
|
10059
10060
|
InvalidModifierOnTypeMember: ({
|
|
10060
10061
|
modifier
|
|
10061
10062
|
}) => `'${modifier}' modifier cannot appear on a type member.`,
|
|
@@ -10065,6 +10066,7 @@ function requireLib () {
|
|
|
10065
10066
|
InvalidModifierOnTypeParameterPositions: ({
|
|
10066
10067
|
modifier
|
|
10067
10068
|
}) => `'${modifier}' modifier can only appear on a type parameter of a class, interface or type alias.`,
|
|
10069
|
+
InvalidModifierOnUsingDeclaration: modifier => `'${modifier}' modifier cannot appear on a using declaration.`,
|
|
10068
10070
|
InvalidModifiersOrder: ({
|
|
10069
10071
|
orderedModifiers
|
|
10070
10072
|
}) => `'${orderedModifiers[0]}' modifier must precede '${orderedModifiers[1]}' modifier.`,
|
|
@@ -10072,7 +10074,7 @@ function requireLib () {
|
|
|
10072
10074
|
InvalidTupleMemberLabel: "Tuple members must be labeled with a simple identifier.",
|
|
10073
10075
|
MissingInterfaceName: "'interface' declarations must be followed by an identifier.",
|
|
10074
10076
|
NonAbstractClassHasAbstractMethod: "Abstract methods can only appear within an abstract class.",
|
|
10075
|
-
|
|
10077
|
+
NonClassMethodPropertyHasAbstractModifier: "'abstract' modifier can only appear on a class, method, or property declaration.",
|
|
10076
10078
|
OptionalTypeBeforeRequired: "A required element cannot follow an optional element.",
|
|
10077
10079
|
OverrideNotInSubClass: "This member cannot have an 'override' modifier because its containing class does not extend another class.",
|
|
10078
10080
|
PatternIsOptional: "A binding pattern parameter cannot be optional in an implementation signature.",
|
|
@@ -10179,12 +10181,15 @@ function requireLib () {
|
|
|
10179
10181
|
}
|
|
10180
10182
|
return this.tsNextTokenOnSameLineAndCanFollowModifier();
|
|
10181
10183
|
}
|
|
10182
|
-
tsParseModifier(allowedModifiers, stopOnStartOfClassStaticBlock) {
|
|
10184
|
+
tsParseModifier(allowedModifiers, stopOnStartOfClassStaticBlock, hasSeenStaticModifier) {
|
|
10183
10185
|
if (!tokenIsIdentifier(this.state.type) && this.state.type !== 58 && this.state.type !== 75) {
|
|
10184
10186
|
return undefined;
|
|
10185
10187
|
}
|
|
10186
10188
|
const modifier = this.state.value;
|
|
10187
10189
|
if (allowedModifiers.includes(modifier)) {
|
|
10190
|
+
if (hasSeenStaticModifier && this.match(106)) {
|
|
10191
|
+
return undefined;
|
|
10192
|
+
}
|
|
10188
10193
|
if (stopOnStartOfClassStaticBlock && this.tsIsStartOfStaticBlocks()) {
|
|
10189
10194
|
return undefined;
|
|
10190
10195
|
}
|
|
@@ -10218,7 +10223,7 @@ function requireLib () {
|
|
|
10218
10223
|
const {
|
|
10219
10224
|
startLoc
|
|
10220
10225
|
} = this.state;
|
|
10221
|
-
const modifier = this.tsParseModifier(allowedModifiers.concat(disallowedModifiers != null ? disallowedModifiers : []), stopOnStartOfClassStaticBlock);
|
|
10226
|
+
const modifier = this.tsParseModifier(allowedModifiers.concat(disallowedModifiers != null ? disallowedModifiers : []), stopOnStartOfClassStaticBlock, modified.static);
|
|
10222
10227
|
if (!modifier) break;
|
|
10223
10228
|
if (tsIsAccessModifier(modifier)) {
|
|
10224
10229
|
if (modified.accessibility) {
|
|
@@ -11299,7 +11304,7 @@ function requireLib () {
|
|
|
11299
11304
|
this.tsParseModuleOrNamespaceDeclaration(inner, true);
|
|
11300
11305
|
node.body = inner;
|
|
11301
11306
|
} else {
|
|
11302
|
-
this.scope.enter(
|
|
11307
|
+
this.scope.enter(512);
|
|
11303
11308
|
this.prodParam.enter(0);
|
|
11304
11309
|
node.body = this.tsParseModuleBlock();
|
|
11305
11310
|
this.prodParam.exit();
|
|
@@ -11321,7 +11326,7 @@ function requireLib () {
|
|
|
11321
11326
|
this.unexpected();
|
|
11322
11327
|
}
|
|
11323
11328
|
if (this.match(5)) {
|
|
11324
|
-
this.scope.enter(
|
|
11329
|
+
this.scope.enter(512);
|
|
11325
11330
|
this.prodParam.enter(0);
|
|
11326
11331
|
node.body = this.tsParseModuleBlock();
|
|
11327
11332
|
this.prodParam.exit();
|
|
@@ -11384,51 +11389,65 @@ function requireLib () {
|
|
|
11384
11389
|
}
|
|
11385
11390
|
this.state = state;
|
|
11386
11391
|
}
|
|
11387
|
-
tsTryParseDeclare(
|
|
11392
|
+
tsTryParseDeclare(node) {
|
|
11388
11393
|
if (this.isLineTerminator()) {
|
|
11389
11394
|
return;
|
|
11390
11395
|
}
|
|
11391
|
-
|
|
11392
|
-
let kind;
|
|
11393
|
-
if (this.isContextual(100)) {
|
|
11394
|
-
startType = 74;
|
|
11395
|
-
kind = "let";
|
|
11396
|
-
}
|
|
11396
|
+
const startType = this.state.type;
|
|
11397
11397
|
return this.tsInAmbientContext(() => {
|
|
11398
11398
|
switch (startType) {
|
|
11399
11399
|
case 68:
|
|
11400
|
-
|
|
11401
|
-
return super.parseFunctionStatement(
|
|
11400
|
+
node.declare = true;
|
|
11401
|
+
return super.parseFunctionStatement(node, false, false);
|
|
11402
11402
|
case 80:
|
|
11403
|
-
|
|
11404
|
-
return this.parseClass(
|
|
11403
|
+
node.declare = true;
|
|
11404
|
+
return this.parseClass(node, true, false);
|
|
11405
11405
|
case 126:
|
|
11406
|
-
return this.tsParseEnumDeclaration(
|
|
11406
|
+
return this.tsParseEnumDeclaration(node, {
|
|
11407
11407
|
declare: true
|
|
11408
11408
|
});
|
|
11409
11409
|
case 112:
|
|
11410
|
-
return this.tsParseAmbientExternalModuleDeclaration(
|
|
11410
|
+
return this.tsParseAmbientExternalModuleDeclaration(node);
|
|
11411
|
+
case 100:
|
|
11412
|
+
if (this.state.containsEsc) {
|
|
11413
|
+
return;
|
|
11414
|
+
}
|
|
11411
11415
|
case 75:
|
|
11412
11416
|
case 74:
|
|
11413
11417
|
if (!this.match(75) || !this.isLookaheadContextual("enum")) {
|
|
11414
|
-
|
|
11415
|
-
return this.parseVarStatement(
|
|
11418
|
+
node.declare = true;
|
|
11419
|
+
return this.parseVarStatement(node, this.state.value, true);
|
|
11416
11420
|
}
|
|
11417
11421
|
this.expect(75);
|
|
11418
|
-
return this.tsParseEnumDeclaration(
|
|
11422
|
+
return this.tsParseEnumDeclaration(node, {
|
|
11419
11423
|
const: true,
|
|
11420
11424
|
declare: true
|
|
11421
11425
|
});
|
|
11426
|
+
case 107:
|
|
11427
|
+
if (this.hasPlugin("explicitResourceManagement") && this.isUsing()) {
|
|
11428
|
+
this.raise(TSErrors.InvalidModifierOnUsingDeclaration, this.state.startLoc, "declare");
|
|
11429
|
+
node.declare = true;
|
|
11430
|
+
return this.parseVarStatement(node, "using", true);
|
|
11431
|
+
}
|
|
11432
|
+
break;
|
|
11433
|
+
case 96:
|
|
11434
|
+
if (this.hasPlugin("explicitResourceManagement") && this.isAwaitUsing()) {
|
|
11435
|
+
this.raise(TSErrors.InvalidModifierOnAwaitUsingDeclaration, this.state.startLoc, "declare");
|
|
11436
|
+
node.declare = true;
|
|
11437
|
+
this.next();
|
|
11438
|
+
return this.parseVarStatement(node, "await using", true);
|
|
11439
|
+
}
|
|
11440
|
+
break;
|
|
11422
11441
|
case 129:
|
|
11423
11442
|
{
|
|
11424
|
-
const result = this.tsParseInterfaceDeclaration(
|
|
11443
|
+
const result = this.tsParseInterfaceDeclaration(node, {
|
|
11425
11444
|
declare: true
|
|
11426
11445
|
});
|
|
11427
11446
|
if (result) return result;
|
|
11428
11447
|
}
|
|
11429
11448
|
default:
|
|
11430
11449
|
if (tokenIsIdentifier(startType)) {
|
|
11431
|
-
return this.tsParseDeclaration(
|
|
11450
|
+
return this.tsParseDeclaration(node, this.state.value, true, null);
|
|
11432
11451
|
}
|
|
11433
11452
|
}
|
|
11434
11453
|
});
|
|
@@ -11448,7 +11467,7 @@ function requireLib () {
|
|
|
11448
11467
|
}
|
|
11449
11468
|
case "global":
|
|
11450
11469
|
if (this.match(5)) {
|
|
11451
|
-
this.scope.enter(
|
|
11470
|
+
this.scope.enter(512);
|
|
11452
11471
|
this.prodParam.enter(0);
|
|
11453
11472
|
const mod = node;
|
|
11454
11473
|
mod.kind = "global";
|
|
@@ -11862,7 +11881,7 @@ function requireLib () {
|
|
|
11862
11881
|
init
|
|
11863
11882
|
} of declaration.declarations) {
|
|
11864
11883
|
if (!init) continue;
|
|
11865
|
-
if (kind
|
|
11884
|
+
if (kind === "var" || kind === "let" || !!id.typeAnnotation) {
|
|
11866
11885
|
this.raise(TSErrors.InitializerNotAllowedInAmbientContext, init);
|
|
11867
11886
|
} else if (!isValidAmbientConstInitializer(init, this.hasPlugin("estree"))) {
|
|
11868
11887
|
this.raise(TSErrors.ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference, init);
|
|
@@ -12468,7 +12487,7 @@ function requireLib () {
|
|
|
12468
12487
|
} else if (this.isContextual(129)) {
|
|
12469
12488
|
if (!this.hasFollowingLineBreak()) {
|
|
12470
12489
|
node.abstract = true;
|
|
12471
|
-
this.raise(TSErrors.
|
|
12490
|
+
this.raise(TSErrors.NonClassMethodPropertyHasAbstractModifier, node);
|
|
12472
12491
|
return this.tsParseInterfaceDeclaration(node);
|
|
12473
12492
|
}
|
|
12474
12493
|
} else {
|
|
@@ -13109,9 +13128,14 @@ function requireLib () {
|
|
|
13109
13128
|
getExpression() {
|
|
13110
13129
|
this.enterInitialScopes();
|
|
13111
13130
|
this.nextToken();
|
|
13131
|
+
if (this.match(140)) {
|
|
13132
|
+
throw this.raise(Errors.ParseExpressionEmptyInput, this.state.startLoc);
|
|
13133
|
+
}
|
|
13112
13134
|
const expr = this.parseExpression();
|
|
13113
13135
|
if (!this.match(140)) {
|
|
13114
|
-
this.
|
|
13136
|
+
throw this.raise(Errors.ParseExpressionExpectsEOF, this.state.startLoc, {
|
|
13137
|
+
unexpected: this.input.codePointAt(this.state.start)
|
|
13138
|
+
});
|
|
13115
13139
|
}
|
|
13116
13140
|
this.finalizeRemainingComments();
|
|
13117
13141
|
expr.comments = this.comments;
|
|
@@ -13632,7 +13656,7 @@ function requireLib () {
|
|
|
13632
13656
|
node = this.startNode();
|
|
13633
13657
|
this.next();
|
|
13634
13658
|
if (this.match(16)) {
|
|
13635
|
-
return this.
|
|
13659
|
+
return this.parseImportMetaPropertyOrPhaseCall(node);
|
|
13636
13660
|
}
|
|
13637
13661
|
if (this.match(10)) {
|
|
13638
13662
|
if (this.optionFlags & 512) {
|
|
@@ -13925,27 +13949,24 @@ function requireLib () {
|
|
|
13925
13949
|
}
|
|
13926
13950
|
return this.finishNode(node, "MetaProperty");
|
|
13927
13951
|
}
|
|
13928
|
-
|
|
13929
|
-
const id = this.createIdentifier(this.startNodeAtNode(node), "import");
|
|
13952
|
+
parseImportMetaPropertyOrPhaseCall(node) {
|
|
13930
13953
|
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)) {
|
|
13954
|
+
if (this.isContextual(105) || this.isContextual(97)) {
|
|
13937
13955
|
const isSource = this.isContextual(105);
|
|
13938
13956
|
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
13957
|
this.next();
|
|
13945
13958
|
node.phase = isSource ? "source" : "defer";
|
|
13946
13959
|
return this.parseImportCall(node);
|
|
13960
|
+
} else {
|
|
13961
|
+
const id = this.createIdentifierAt(this.startNodeAtNode(node), "import", this.state.lastTokStartLoc);
|
|
13962
|
+
if (this.isContextual(101)) {
|
|
13963
|
+
if (!this.inModule) {
|
|
13964
|
+
this.raise(Errors.ImportMetaOutsideModule, id);
|
|
13965
|
+
}
|
|
13966
|
+
this.sawUnambiguousESM = true;
|
|
13967
|
+
}
|
|
13968
|
+
return this.parseMetaProperty(node, id, "meta");
|
|
13947
13969
|
}
|
|
13948
|
-
return this.parseMetaProperty(node, id, "meta");
|
|
13949
13970
|
}
|
|
13950
13971
|
parseLiteralAtNode(value, type, node) {
|
|
13951
13972
|
this.addExtra(node, "rawValue", value);
|
|
@@ -14538,6 +14559,11 @@ function requireLib () {
|
|
|
14538
14559
|
node.loc.identifierName = name;
|
|
14539
14560
|
return this.finishNode(node, "Identifier");
|
|
14540
14561
|
}
|
|
14562
|
+
createIdentifierAt(node, name, endLoc) {
|
|
14563
|
+
node.name = name;
|
|
14564
|
+
node.loc.identifierName = name;
|
|
14565
|
+
return this.finishNodeAt(node, "Identifier", endLoc);
|
|
14566
|
+
}
|
|
14541
14567
|
parseIdentifierName(liberal) {
|
|
14542
14568
|
let name;
|
|
14543
14569
|
const {
|
|
@@ -14665,12 +14691,17 @@ function requireLib () {
|
|
|
14665
14691
|
if (this.eat(12)) {
|
|
14666
14692
|
if (!this.match(11)) {
|
|
14667
14693
|
node.options = this.parseMaybeAssignAllowIn();
|
|
14668
|
-
if (this.eat(12)
|
|
14669
|
-
|
|
14670
|
-
|
|
14671
|
-
|
|
14672
|
-
|
|
14694
|
+
if (this.eat(12)) {
|
|
14695
|
+
this.addTrailingCommaExtraToNode(node.options);
|
|
14696
|
+
if (!this.match(11)) {
|
|
14697
|
+
do {
|
|
14698
|
+
this.parseMaybeAssignAllowIn();
|
|
14699
|
+
} while (this.eat(12) && !this.match(11));
|
|
14700
|
+
this.raise(Errors.ImportCallArity, node);
|
|
14701
|
+
}
|
|
14673
14702
|
}
|
|
14703
|
+
} else {
|
|
14704
|
+
this.addTrailingCommaExtraToNode(node.source);
|
|
14674
14705
|
}
|
|
14675
14706
|
}
|
|
14676
14707
|
this.expect(11);
|
|
@@ -14992,6 +15023,29 @@ function requireLib () {
|
|
|
14992
15023
|
}
|
|
14993
15024
|
return this.hasFollowingBindingAtom();
|
|
14994
15025
|
}
|
|
15026
|
+
isUsing() {
|
|
15027
|
+
if (!this.isContextual(107)) {
|
|
15028
|
+
return false;
|
|
15029
|
+
}
|
|
15030
|
+
const next = this.nextTokenInLineStart();
|
|
15031
|
+
const nextCh = this.codePointAtPos(next);
|
|
15032
|
+
return this.chStartsBindingIdentifier(nextCh, next);
|
|
15033
|
+
}
|
|
15034
|
+
isAwaitUsing() {
|
|
15035
|
+
if (!this.isContextual(96)) {
|
|
15036
|
+
return false;
|
|
15037
|
+
}
|
|
15038
|
+
let next = this.nextTokenInLineStart();
|
|
15039
|
+
if (this.isUnparsedContextual(next, "using")) {
|
|
15040
|
+
next = this.nextTokenInLineStartSince(next + 5);
|
|
15041
|
+
const nextCh = this.codePointAtPos(next);
|
|
15042
|
+
if (this.chStartsBindingIdentifier(nextCh, next)) {
|
|
15043
|
+
this.expectPlugin("explicitResourceManagement");
|
|
15044
|
+
return true;
|
|
15045
|
+
}
|
|
15046
|
+
}
|
|
15047
|
+
return false;
|
|
15048
|
+
}
|
|
14995
15049
|
chStartsBindingIdentifier(ch, pos) {
|
|
14996
15050
|
if (isIdentifierStart(ch)) {
|
|
14997
15051
|
keywordRelationalOperator.lastIndex = pos;
|
|
@@ -15039,17 +15093,8 @@ function requireLib () {
|
|
|
15039
15093
|
}
|
|
15040
15094
|
return false;
|
|
15041
15095
|
}
|
|
15042
|
-
|
|
15043
|
-
|
|
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;
|
|
15096
|
+
allowsUsing() {
|
|
15097
|
+
return (this.scope.inModule || !this.scope.inTopLevel) && !this.scope.inBareCaseStatement;
|
|
15053
15098
|
}
|
|
15054
15099
|
parseModuleItem() {
|
|
15055
15100
|
return this.parseStatementLike(1 | 2 | 4 | 8);
|
|
@@ -15114,11 +15159,13 @@ function requireLib () {
|
|
|
15114
15159
|
case 73:
|
|
15115
15160
|
return this.parseTryStatement(node);
|
|
15116
15161
|
case 96:
|
|
15117
|
-
if (
|
|
15118
|
-
if (!this.
|
|
15119
|
-
this.raise(Errors.
|
|
15162
|
+
if (this.isAwaitUsing()) {
|
|
15163
|
+
if (!this.allowsUsing()) {
|
|
15164
|
+
this.raise(Errors.UnexpectedUsingDeclaration, node);
|
|
15120
15165
|
} else if (!allowDeclaration) {
|
|
15121
15166
|
this.raise(Errors.UnexpectedLexicalDeclaration, node);
|
|
15167
|
+
} else if (!this.recordAwaitIfAllowed()) {
|
|
15168
|
+
this.raise(Errors.AwaitUsingNotInAsyncContext, node);
|
|
15122
15169
|
}
|
|
15123
15170
|
this.next();
|
|
15124
15171
|
return this.parseVarStatement(node, "await using");
|
|
@@ -15129,7 +15176,7 @@ function requireLib () {
|
|
|
15129
15176
|
break;
|
|
15130
15177
|
}
|
|
15131
15178
|
this.expectPlugin("explicitResourceManagement");
|
|
15132
|
-
if (!this.
|
|
15179
|
+
if (!this.allowsUsing()) {
|
|
15133
15180
|
this.raise(Errors.UnexpectedUsingDeclaration, this.state.startLoc);
|
|
15134
15181
|
} else if (!allowDeclaration) {
|
|
15135
15182
|
this.raise(Errors.UnexpectedLexicalDeclaration, this.state.startLoc);
|
|
@@ -15371,7 +15418,7 @@ function requireLib () {
|
|
|
15371
15418
|
}
|
|
15372
15419
|
const startsWithLet = this.isContextual(100);
|
|
15373
15420
|
{
|
|
15374
|
-
const startsWithAwaitUsing = this.
|
|
15421
|
+
const startsWithAwaitUsing = this.isAwaitUsing();
|
|
15375
15422
|
const starsWithUsingDeclaration = startsWithAwaitUsing || this.isContextual(107) && this.allowsForUsing();
|
|
15376
15423
|
const isLetOrUsing = startsWithLet && this.hasFollowingBindingAtom() || starsWithUsingDeclaration;
|
|
15377
15424
|
if (this.match(74) || this.match(75) || isLetOrUsing) {
|
|
@@ -15460,7 +15507,7 @@ function requireLib () {
|
|
|
15460
15507
|
const cases = node.cases = [];
|
|
15461
15508
|
this.expect(5);
|
|
15462
15509
|
this.state.labels.push(switchLabel);
|
|
15463
|
-
this.scope.enter(
|
|
15510
|
+
this.scope.enter(256);
|
|
15464
15511
|
let cur;
|
|
15465
15512
|
for (let sawDefault; !this.match(8);) {
|
|
15466
15513
|
if (this.match(61) || this.match(65)) {
|
|
@@ -15882,6 +15929,7 @@ function requireLib () {
|
|
|
15882
15929
|
method.kind = "method";
|
|
15883
15930
|
const isPrivateName = this.match(139);
|
|
15884
15931
|
this.parseClassElementName(method);
|
|
15932
|
+
this.parsePostMemberNameModifiers(method);
|
|
15885
15933
|
if (isPrivateName) {
|
|
15886
15934
|
this.pushClassPrivateMethod(classBody, privateMethod, true, false);
|
|
15887
15935
|
return;
|
|
@@ -16224,7 +16272,7 @@ function requireLib () {
|
|
|
16224
16272
|
}
|
|
16225
16273
|
return this.parseClass(this.maybeTakeDecorators(this.parseDecorators(false), this.startNode()), true, true);
|
|
16226
16274
|
}
|
|
16227
|
-
if (this.match(75) || this.match(74) || this.isLet()) {
|
|
16275
|
+
if (this.match(75) || this.match(74) || this.isLet() || this.hasPlugin("explicitResourceManagement") && (this.isUsing() || this.isAwaitUsing())) {
|
|
16228
16276
|
throw this.raise(Errors.UnsupportedDefaultExport, this.state.startLoc);
|
|
16229
16277
|
}
|
|
16230
16278
|
const res = this.parseMaybeAssignAllowIn();
|
|
@@ -16293,13 +16341,15 @@ function requireLib () {
|
|
|
16293
16341
|
return true;
|
|
16294
16342
|
}
|
|
16295
16343
|
}
|
|
16296
|
-
if (this.
|
|
16297
|
-
this.
|
|
16298
|
-
|
|
16299
|
-
|
|
16300
|
-
|
|
16301
|
-
this.
|
|
16302
|
-
|
|
16344
|
+
if (this.hasPlugin("explicitResourceManagement")) {
|
|
16345
|
+
if (this.isUsing()) {
|
|
16346
|
+
this.raise(Errors.UsingDeclarationExport, this.state.startLoc);
|
|
16347
|
+
return true;
|
|
16348
|
+
}
|
|
16349
|
+
if (this.isAwaitUsing()) {
|
|
16350
|
+
this.raise(Errors.UsingDeclarationExport, this.state.startLoc);
|
|
16351
|
+
return true;
|
|
16352
|
+
}
|
|
16303
16353
|
}
|
|
16304
16354
|
return type === 74 || type === 75 || type === 68 || type === 80 || this.isLet() || this.isAsyncFunction();
|
|
16305
16355
|
}
|
|
@@ -16514,18 +16564,18 @@ function requireLib () {
|
|
|
16514
16564
|
this.applyImportPhase(node, isExport, null);
|
|
16515
16565
|
return null;
|
|
16516
16566
|
}
|
|
16517
|
-
const phaseIdentifier = this.
|
|
16567
|
+
const phaseIdentifier = this.startNode();
|
|
16568
|
+
const phaseIdentifierName = this.parseIdentifierName(true);
|
|
16518
16569
|
const {
|
|
16519
16570
|
type
|
|
16520
16571
|
} = this.state;
|
|
16521
16572
|
const isImportPhase = tokenIsKeywordOrIdentifier(type) ? type !== 98 || this.lookaheadCharCode() === 102 : type !== 12;
|
|
16522
16573
|
if (isImportPhase) {
|
|
16523
|
-
this.
|
|
16524
|
-
this.applyImportPhase(node, isExport, phaseIdentifier.name, phaseIdentifier.loc.start);
|
|
16574
|
+
this.applyImportPhase(node, isExport, phaseIdentifierName, phaseIdentifier.loc.start);
|
|
16525
16575
|
return null;
|
|
16526
16576
|
} else {
|
|
16527
16577
|
this.applyImportPhase(node, isExport, null);
|
|
16528
|
-
return phaseIdentifier;
|
|
16578
|
+
return this.createIdentifier(phaseIdentifier, phaseIdentifierName);
|
|
16529
16579
|
}
|
|
16530
16580
|
}
|
|
16531
16581
|
isPrecedingIdImportPhase(phase) {
|
|
@@ -18286,7 +18336,7 @@ function isUpperCase(c) {
|
|
|
18286
18336
|
return c > 64 && c < 91;
|
|
18287
18337
|
}
|
|
18288
18338
|
const windowsNewlineRE = /\r\n/g;
|
|
18289
|
-
function condenseWhitespace(nodes
|
|
18339
|
+
function condenseWhitespace(nodes) {
|
|
18290
18340
|
const shouldCondense = currentOptions.whitespace !== "preserve";
|
|
18291
18341
|
let removedWhitespace = false;
|
|
18292
18342
|
for (let i = 0; i < nodes.length; i++) {
|
|
@@ -18472,12 +18522,12 @@ function cacheStatic(root, context) {
|
|
|
18472
18522
|
context,
|
|
18473
18523
|
// Root node is unfortunately non-hoistable due to potential parent
|
|
18474
18524
|
// fallthrough attributes.
|
|
18475
|
-
|
|
18525
|
+
!!getSingleElementRoot(root)
|
|
18476
18526
|
);
|
|
18477
18527
|
}
|
|
18478
|
-
function
|
|
18479
|
-
const
|
|
18480
|
-
return children.length === 1 &&
|
|
18528
|
+
function getSingleElementRoot(root) {
|
|
18529
|
+
const children = root.children.filter((x) => x.type !== 3);
|
|
18530
|
+
return children.length === 1 && children[0].type === 1 && !isSlotOutlet(children[0]) ? children[0] : null;
|
|
18481
18531
|
}
|
|
18482
18532
|
function walk$1(node, parent, context, doNotHoistNode = false, inFor = false) {
|
|
18483
18533
|
const { children } = node;
|
|
@@ -18965,15 +19015,15 @@ function createRootCodegen(root, context) {
|
|
|
18965
19015
|
const { helper } = context;
|
|
18966
19016
|
const { children } = root;
|
|
18967
19017
|
if (children.length === 1) {
|
|
18968
|
-
const
|
|
18969
|
-
if (
|
|
18970
|
-
const codegenNode =
|
|
19018
|
+
const singleElementRootChild = getSingleElementRoot(root);
|
|
19019
|
+
if (singleElementRootChild && singleElementRootChild.codegenNode) {
|
|
19020
|
+
const codegenNode = singleElementRootChild.codegenNode;
|
|
18971
19021
|
if (codegenNode.type === 13) {
|
|
18972
19022
|
convertToBlock(codegenNode, context);
|
|
18973
19023
|
}
|
|
18974
19024
|
root.codegenNode = codegenNode;
|
|
18975
19025
|
} else {
|
|
18976
|
-
root.codegenNode =
|
|
19026
|
+
root.codegenNode = children[0];
|
|
18977
19027
|
}
|
|
18978
19028
|
} else if (children.length > 1) {
|
|
18979
19029
|
let patchFlag = 64;
|
|
@@ -24169,7 +24219,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
|
|
|
24169
24219
|
let prev;
|
|
24170
24220
|
while (j--) {
|
|
24171
24221
|
prev = children[j];
|
|
24172
|
-
if (prev.type !== 3) {
|
|
24222
|
+
if (prev.type !== 3 && isNonWhitespaceContent(prev)) {
|
|
24173
24223
|
break;
|
|
24174
24224
|
}
|
|
24175
24225
|
}
|
|
@@ -32740,6 +32790,17 @@ const ssrTransformModel = (dir, node, context) => {
|
|
|
32740
32790
|
);
|
|
32741
32791
|
}
|
|
32742
32792
|
}
|
|
32793
|
+
const processSelectChildren = (children) => {
|
|
32794
|
+
children.forEach((child) => {
|
|
32795
|
+
if (child.type === 1) {
|
|
32796
|
+
processOption(child);
|
|
32797
|
+
} else if (child.type === 11) {
|
|
32798
|
+
processSelectChildren(child.children);
|
|
32799
|
+
} else if (child.type === 9) {
|
|
32800
|
+
child.branches.forEach((b) => processSelectChildren(b.children));
|
|
32801
|
+
}
|
|
32802
|
+
});
|
|
32803
|
+
};
|
|
32743
32804
|
function processOption(plainNode) {
|
|
32744
32805
|
if (plainNode.tag === "option") {
|
|
32745
32806
|
if (plainNode.props.findIndex((p) => p.name === "selected") === -1) {
|
|
@@ -32766,9 +32827,7 @@ const ssrTransformModel = (dir, node, context) => {
|
|
|
32766
32827
|
);
|
|
32767
32828
|
}
|
|
32768
32829
|
} else if (plainNode.tag === "optgroup") {
|
|
32769
|
-
plainNode.children
|
|
32770
|
-
(option) => processOption(option)
|
|
32771
|
-
);
|
|
32830
|
+
processSelectChildren(plainNode.children);
|
|
32772
32831
|
}
|
|
32773
32832
|
}
|
|
32774
32833
|
if (node.tagType === 0) {
|
|
@@ -32853,18 +32912,7 @@ const ssrTransformModel = (dir, node, context) => {
|
|
|
32853
32912
|
checkDuplicatedValue();
|
|
32854
32913
|
node.children = [createInterpolation(model, model.loc)];
|
|
32855
32914
|
} 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);
|
|
32915
|
+
processSelectChildren(node.children);
|
|
32868
32916
|
} else {
|
|
32869
32917
|
context.onError(
|
|
32870
32918
|
createDOMCompilerError(
|
|
@@ -34340,11 +34388,8 @@ function requireNode$2 () {
|
|
|
34340
34388
|
|
|
34341
34389
|
function sourceOffset(inputCSS, position) {
|
|
34342
34390
|
// 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;
|
|
34391
|
+
if (position && typeof position.offset !== 'undefined') {
|
|
34392
|
+
return position.offset
|
|
34348
34393
|
}
|
|
34349
34394
|
|
|
34350
34395
|
let column = 1;
|
|
@@ -34514,14 +34559,15 @@ function requireNode$2 () {
|
|
|
34514
34559
|
return this.parent.nodes[index + 1]
|
|
34515
34560
|
}
|
|
34516
34561
|
|
|
34517
|
-
positionBy(opts) {
|
|
34562
|
+
positionBy(opts = {}) {
|
|
34518
34563
|
let pos = this.source.start;
|
|
34519
34564
|
if (opts.index) {
|
|
34520
34565
|
pos = this.positionInside(opts.index);
|
|
34521
34566
|
} else if (opts.word) {
|
|
34522
|
-
let inputString =
|
|
34523
|
-
|
|
34524
|
-
|
|
34567
|
+
let inputString =
|
|
34568
|
+
'document' in this.source.input
|
|
34569
|
+
? this.source.input.document
|
|
34570
|
+
: this.source.input.css;
|
|
34525
34571
|
let stringRepresentation = inputString.slice(
|
|
34526
34572
|
sourceOffset(inputString, this.source.start),
|
|
34527
34573
|
sourceOffset(inputString, this.source.end)
|
|
@@ -34535,9 +34581,10 @@ function requireNode$2 () {
|
|
|
34535
34581
|
positionInside(index) {
|
|
34536
34582
|
let column = this.source.start.column;
|
|
34537
34583
|
let line = this.source.start.line;
|
|
34538
|
-
let inputString =
|
|
34539
|
-
|
|
34540
|
-
|
|
34584
|
+
let inputString =
|
|
34585
|
+
'document' in this.source.input
|
|
34586
|
+
? this.source.input.document
|
|
34587
|
+
: this.source.input.css;
|
|
34541
34588
|
let offset = sourceOffset(inputString, this.source.start);
|
|
34542
34589
|
let end = offset + index;
|
|
34543
34590
|
|
|
@@ -34550,7 +34597,7 @@ function requireNode$2 () {
|
|
|
34550
34597
|
}
|
|
34551
34598
|
}
|
|
34552
34599
|
|
|
34553
|
-
return { column, line }
|
|
34600
|
+
return { column, line, offset: end }
|
|
34554
34601
|
}
|
|
34555
34602
|
|
|
34556
34603
|
prev() {
|
|
@@ -34559,25 +34606,36 @@ function requireNode$2 () {
|
|
|
34559
34606
|
return this.parent.nodes[index - 1]
|
|
34560
34607
|
}
|
|
34561
34608
|
|
|
34562
|
-
rangeBy(opts) {
|
|
34609
|
+
rangeBy(opts = {}) {
|
|
34610
|
+
let inputString =
|
|
34611
|
+
'document' in this.source.input
|
|
34612
|
+
? this.source.input.document
|
|
34613
|
+
: this.source.input.css;
|
|
34563
34614
|
let start = {
|
|
34564
34615
|
column: this.source.start.column,
|
|
34565
|
-
line: this.source.start.line
|
|
34616
|
+
line: this.source.start.line,
|
|
34617
|
+
offset: sourceOffset(inputString, this.source.start)
|
|
34566
34618
|
};
|
|
34567
34619
|
let end = this.source.end
|
|
34568
34620
|
? {
|
|
34569
34621
|
column: this.source.end.column + 1,
|
|
34570
|
-
line: this.source.end.line
|
|
34622
|
+
line: this.source.end.line,
|
|
34623
|
+
offset:
|
|
34624
|
+
typeof this.source.end.offset === 'number'
|
|
34625
|
+
? // `source.end.offset` is exclusive, so we don't need to add 1
|
|
34626
|
+
this.source.end.offset
|
|
34627
|
+
: // Since line/column in this.source.end is inclusive,
|
|
34628
|
+
// the `sourceOffset(... , this.source.end)` returns an inclusive offset.
|
|
34629
|
+
// So, we add 1 to convert it to exclusive.
|
|
34630
|
+
sourceOffset(inputString, this.source.end) + 1
|
|
34571
34631
|
}
|
|
34572
34632
|
: {
|
|
34573
34633
|
column: start.column + 1,
|
|
34574
|
-
line: start.line
|
|
34634
|
+
line: start.line,
|
|
34635
|
+
offset: start.offset + 1
|
|
34575
34636
|
};
|
|
34576
34637
|
|
|
34577
34638
|
if (opts.word) {
|
|
34578
|
-
let inputString = ('document' in this.source.input)
|
|
34579
|
-
? this.source.input.document
|
|
34580
|
-
: this.source.input.css;
|
|
34581
34639
|
let stringRepresentation = inputString.slice(
|
|
34582
34640
|
sourceOffset(inputString, this.source.start),
|
|
34583
34641
|
sourceOffset(inputString, this.source.end)
|
|
@@ -34585,15 +34643,14 @@ function requireNode$2 () {
|
|
|
34585
34643
|
let index = stringRepresentation.indexOf(opts.word);
|
|
34586
34644
|
if (index !== -1) {
|
|
34587
34645
|
start = this.positionInside(index);
|
|
34588
|
-
end = this.positionInside(
|
|
34589
|
-
index + opts.word.length,
|
|
34590
|
-
);
|
|
34646
|
+
end = this.positionInside(index + opts.word.length);
|
|
34591
34647
|
}
|
|
34592
34648
|
} else {
|
|
34593
34649
|
if (opts.start) {
|
|
34594
34650
|
start = {
|
|
34595
34651
|
column: opts.start.column,
|
|
34596
|
-
line: opts.start.line
|
|
34652
|
+
line: opts.start.line,
|
|
34653
|
+
offset: sourceOffset(inputString, opts.start)
|
|
34597
34654
|
};
|
|
34598
34655
|
} else if (opts.index) {
|
|
34599
34656
|
start = this.positionInside(opts.index);
|
|
@@ -34602,7 +34659,8 @@ function requireNode$2 () {
|
|
|
34602
34659
|
if (opts.end) {
|
|
34603
34660
|
end = {
|
|
34604
34661
|
column: opts.end.column,
|
|
34605
|
-
line: opts.end.line
|
|
34662
|
+
line: opts.end.line,
|
|
34663
|
+
offset: sourceOffset(inputString, opts.end)
|
|
34606
34664
|
};
|
|
34607
34665
|
} else if (typeof opts.endIndex === 'number') {
|
|
34608
34666
|
end = this.positionInside(opts.endIndex);
|
|
@@ -34615,7 +34673,11 @@ function requireNode$2 () {
|
|
|
34615
34673
|
end.line < start.line ||
|
|
34616
34674
|
(end.line === start.line && end.column <= start.column)
|
|
34617
34675
|
) {
|
|
34618
|
-
end = {
|
|
34676
|
+
end = {
|
|
34677
|
+
column: start.column + 1,
|
|
34678
|
+
line: start.line,
|
|
34679
|
+
offset: start.offset + 1
|
|
34680
|
+
};
|
|
34619
34681
|
}
|
|
34620
34682
|
|
|
34621
34683
|
return { end, start }
|
|
@@ -34690,6 +34752,7 @@ function requireNode$2 () {
|
|
|
34690
34752
|
} else if (typeof value === 'object' && value.toJSON) {
|
|
34691
34753
|
fixed[name] = value.toJSON(null, inputs);
|
|
34692
34754
|
} else if (name === 'source') {
|
|
34755
|
+
if (value == null) continue
|
|
34693
34756
|
let inputId = inputs.get(value.input);
|
|
34694
34757
|
if (inputId == null) {
|
|
34695
34758
|
inputId = inputsNextIndex;
|
|
@@ -34729,7 +34792,7 @@ function requireNode$2 () {
|
|
|
34729
34792
|
return result
|
|
34730
34793
|
}
|
|
34731
34794
|
|
|
34732
|
-
warn(result, text, opts) {
|
|
34795
|
+
warn(result, text, opts = {}) {
|
|
34733
34796
|
let data = { node: this };
|
|
34734
34797
|
for (let i in opts) data[i] = opts[i];
|
|
34735
34798
|
return result.warn(text, data)
|
|
@@ -35536,11 +35599,26 @@ function requireInput () {
|
|
|
35536
35599
|
let PreviousMap = /*@__PURE__*/ requirePreviousMap();
|
|
35537
35600
|
let terminalHighlight = /*@__PURE__*/ requireTerminalHighlight();
|
|
35538
35601
|
|
|
35539
|
-
let
|
|
35602
|
+
let lineToIndexCache = Symbol('lineToIndexCache');
|
|
35540
35603
|
|
|
35541
35604
|
let sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator);
|
|
35542
35605
|
let pathAvailable = Boolean(resolve && isAbsolute);
|
|
35543
35606
|
|
|
35607
|
+
function getLineToIndex(input) {
|
|
35608
|
+
if (input[lineToIndexCache]) return input[lineToIndexCache]
|
|
35609
|
+
let lines = input.css.split('\n');
|
|
35610
|
+
let lineToIndex = new Array(lines.length);
|
|
35611
|
+
let prevIndex = 0;
|
|
35612
|
+
|
|
35613
|
+
for (let i = 0, l = lines.length; i < l; i++) {
|
|
35614
|
+
lineToIndex[i] = prevIndex;
|
|
35615
|
+
prevIndex += lines[i].length + 1;
|
|
35616
|
+
}
|
|
35617
|
+
|
|
35618
|
+
input[lineToIndexCache] = lineToIndex;
|
|
35619
|
+
return lineToIndex
|
|
35620
|
+
}
|
|
35621
|
+
|
|
35544
35622
|
class Input {
|
|
35545
35623
|
get from() {
|
|
35546
35624
|
return this.file || this.id
|
|
@@ -35595,31 +35673,38 @@ function requireInput () {
|
|
|
35595
35673
|
}
|
|
35596
35674
|
|
|
35597
35675
|
error(message, line, column, opts = {}) {
|
|
35598
|
-
let endColumn, endLine, result;
|
|
35676
|
+
let endColumn, endLine, endOffset, offset, result;
|
|
35599
35677
|
|
|
35600
35678
|
if (line && typeof line === 'object') {
|
|
35601
35679
|
let start = line;
|
|
35602
35680
|
let end = column;
|
|
35603
35681
|
if (typeof start.offset === 'number') {
|
|
35604
|
-
|
|
35682
|
+
offset = start.offset;
|
|
35683
|
+
let pos = this.fromOffset(offset);
|
|
35605
35684
|
line = pos.line;
|
|
35606
35685
|
column = pos.col;
|
|
35607
35686
|
} else {
|
|
35608
35687
|
line = start.line;
|
|
35609
35688
|
column = start.column;
|
|
35689
|
+
offset = this.fromLineAndColumn(line, column);
|
|
35610
35690
|
}
|
|
35611
35691
|
if (typeof end.offset === 'number') {
|
|
35612
|
-
|
|
35692
|
+
endOffset = end.offset;
|
|
35693
|
+
let pos = this.fromOffset(endOffset);
|
|
35613
35694
|
endLine = pos.line;
|
|
35614
35695
|
endColumn = pos.col;
|
|
35615
35696
|
} else {
|
|
35616
35697
|
endLine = end.line;
|
|
35617
35698
|
endColumn = end.column;
|
|
35699
|
+
endOffset = this.fromLineAndColumn(end.line, end.column);
|
|
35618
35700
|
}
|
|
35619
35701
|
} else if (!column) {
|
|
35620
|
-
|
|
35702
|
+
offset = line;
|
|
35703
|
+
let pos = this.fromOffset(offset);
|
|
35621
35704
|
line = pos.line;
|
|
35622
35705
|
column = pos.col;
|
|
35706
|
+
} else {
|
|
35707
|
+
offset = this.fromLineAndColumn(line, column);
|
|
35623
35708
|
}
|
|
35624
35709
|
|
|
35625
35710
|
let origin = this.origin(line, column, endLine, endColumn);
|
|
@@ -35647,7 +35732,7 @@ function requireInput () {
|
|
|
35647
35732
|
);
|
|
35648
35733
|
}
|
|
35649
35734
|
|
|
35650
|
-
result.input = { column, endColumn, endLine, line, source: this.css };
|
|
35735
|
+
result.input = { column, endColumn, endLine, endOffset, line, offset, source: this.css };
|
|
35651
35736
|
if (this.file) {
|
|
35652
35737
|
if (pathToFileURL) {
|
|
35653
35738
|
result.input.url = pathToFileURL(this.file).toString();
|
|
@@ -35658,23 +35743,15 @@ function requireInput () {
|
|
|
35658
35743
|
return result
|
|
35659
35744
|
}
|
|
35660
35745
|
|
|
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
|
-
}
|
|
35746
|
+
fromLineAndColumn(line, column) {
|
|
35747
|
+
let lineToIndex = getLineToIndex(this);
|
|
35748
|
+
let index = lineToIndex[line - 1];
|
|
35749
|
+
return index + column - 1
|
|
35750
|
+
}
|
|
35672
35751
|
|
|
35673
|
-
|
|
35674
|
-
|
|
35675
|
-
|
|
35676
|
-
}
|
|
35677
|
-
lastLine = lineToIndex[lineToIndex.length - 1];
|
|
35752
|
+
fromOffset(offset) {
|
|
35753
|
+
let lineToIndex = getLineToIndex(this);
|
|
35754
|
+
let lastLine = lineToIndex[lineToIndex.length - 1];
|
|
35678
35755
|
|
|
35679
35756
|
let min = 0;
|
|
35680
35757
|
if (offset >= lastLine) {
|
|
@@ -37120,7 +37197,7 @@ function requireResult () {
|
|
|
37120
37197
|
this.messages = [];
|
|
37121
37198
|
this.root = root;
|
|
37122
37199
|
this.opts = opts;
|
|
37123
|
-
this.css =
|
|
37200
|
+
this.css = '';
|
|
37124
37201
|
this.map = undefined;
|
|
37125
37202
|
}
|
|
37126
37203
|
|
|
@@ -37891,7 +37968,7 @@ function requireProcessor$1 () {
|
|
|
37891
37968
|
|
|
37892
37969
|
class Processor {
|
|
37893
37970
|
constructor(plugins = []) {
|
|
37894
|
-
this.version = '8.5.
|
|
37971
|
+
this.version = '8.5.6';
|
|
37895
37972
|
this.plugins = this.normalize(plugins);
|
|
37896
37973
|
}
|
|
37897
37974
|
|
|
@@ -47639,25 +47716,39 @@ function resolveArrayElementType(ctx, node, scope) {
|
|
|
47639
47716
|
scope
|
|
47640
47717
|
);
|
|
47641
47718
|
}
|
|
47642
|
-
function resolveStringType(ctx, node, scope) {
|
|
47719
|
+
function resolveStringType(ctx, node, scope, typeParameters) {
|
|
47643
47720
|
switch (node.type) {
|
|
47644
47721
|
case "StringLiteral":
|
|
47645
47722
|
return [node.value];
|
|
47646
47723
|
case "TSLiteralType":
|
|
47647
|
-
return resolveStringType(ctx, node.literal, scope);
|
|
47724
|
+
return resolveStringType(ctx, node.literal, scope, typeParameters);
|
|
47648
47725
|
case "TSUnionType":
|
|
47649
|
-
return node.types.map((t) => resolveStringType(ctx, t, scope)).flat();
|
|
47726
|
+
return node.types.map((t) => resolveStringType(ctx, t, scope, typeParameters)).flat();
|
|
47650
47727
|
case "TemplateLiteral": {
|
|
47651
47728
|
return resolveTemplateKeys(ctx, node, scope);
|
|
47652
47729
|
}
|
|
47653
47730
|
case "TSTypeReference": {
|
|
47654
47731
|
const resolved = resolveTypeReference(ctx, node, scope);
|
|
47655
47732
|
if (resolved) {
|
|
47656
|
-
return resolveStringType(ctx, resolved, scope);
|
|
47733
|
+
return resolveStringType(ctx, resolved, scope, typeParameters);
|
|
47657
47734
|
}
|
|
47658
47735
|
if (node.typeName.type === "Identifier") {
|
|
47659
|
-
const
|
|
47660
|
-
|
|
47736
|
+
const name = node.typeName.name;
|
|
47737
|
+
if (typeParameters && typeParameters[name]) {
|
|
47738
|
+
return resolveStringType(
|
|
47739
|
+
ctx,
|
|
47740
|
+
typeParameters[name],
|
|
47741
|
+
scope,
|
|
47742
|
+
typeParameters
|
|
47743
|
+
);
|
|
47744
|
+
}
|
|
47745
|
+
const getParam = (index = 0) => resolveStringType(
|
|
47746
|
+
ctx,
|
|
47747
|
+
node.typeParameters.params[index],
|
|
47748
|
+
scope,
|
|
47749
|
+
typeParameters
|
|
47750
|
+
);
|
|
47751
|
+
switch (name) {
|
|
47661
47752
|
case "Extract":
|
|
47662
47753
|
return getParam(1);
|
|
47663
47754
|
case "Exclude": {
|
|
@@ -47743,7 +47834,8 @@ function resolveBuiltin(ctx, node, name, scope, typeParameters) {
|
|
|
47743
47834
|
const picked = resolveStringType(
|
|
47744
47835
|
ctx,
|
|
47745
47836
|
node.typeParameters.params[1],
|
|
47746
|
-
scope
|
|
47837
|
+
scope,
|
|
47838
|
+
typeParameters
|
|
47747
47839
|
);
|
|
47748
47840
|
const res2 = { props: {}, calls: t.calls };
|
|
47749
47841
|
for (const key of picked) {
|
|
@@ -47755,7 +47847,8 @@ function resolveBuiltin(ctx, node, name, scope, typeParameters) {
|
|
|
47755
47847
|
const omitted = resolveStringType(
|
|
47756
47848
|
ctx,
|
|
47757
47849
|
node.typeParameters.params[1],
|
|
47758
|
-
scope
|
|
47850
|
+
scope,
|
|
47851
|
+
typeParameters
|
|
47759
47852
|
);
|
|
47760
47853
|
const res = { props: {}, calls: t.calls };
|
|
47761
47854
|
for (const key in t.props) {
|
|
@@ -48318,13 +48411,8 @@ function inferRuntimeType(ctx, node, scope = node._ownerScope || ctxToScope(ctx)
|
|
|
48318
48411
|
case "TSTypeReference": {
|
|
48319
48412
|
const resolved = resolveTypeReference(ctx, node, scope);
|
|
48320
48413
|
if (resolved) {
|
|
48321
|
-
if (resolved.type === "TSTypeAliasDeclaration") {
|
|
48322
|
-
return
|
|
48323
|
-
ctx,
|
|
48324
|
-
resolved.typeAnnotation,
|
|
48325
|
-
resolved._ownerScope,
|
|
48326
|
-
isKeyOf
|
|
48327
|
-
);
|
|
48414
|
+
if (resolved.type === "TSTypeAliasDeclaration" && resolved.typeAnnotation.type === "TSFunctionType") {
|
|
48415
|
+
return ["Function"];
|
|
48328
48416
|
}
|
|
48329
48417
|
return inferRuntimeType(ctx, resolved, resolved._ownerScope, isKeyOf);
|
|
48330
48418
|
}
|
|
@@ -50256,7 +50344,7 @@ var __spreadValues = (a, b) => {
|
|
|
50256
50344
|
}
|
|
50257
50345
|
return a;
|
|
50258
50346
|
};
|
|
50259
|
-
const version = "3.5.
|
|
50347
|
+
const version = "3.5.17";
|
|
50260
50348
|
const parseCache = parseCache$1;
|
|
50261
50349
|
const errorMessages = __spreadValues(__spreadValues({}, errorMessages$1), DOMErrorMessages);
|
|
50262
50350
|
const walk = walk$2;
|