@vue/compiler-sfc 3.4.26 → 3.4.28
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 +268 -183
- package/dist/compiler-sfc.d.ts +1 -1
- package/dist/compiler-sfc.esm-browser.js +644 -572
- package/package.json +10 -10
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-sfc v3.4.
|
|
2
|
+
* @vue/compiler-sfc v3.4.28
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -91,6 +91,9 @@ const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED);
|
|
|
91
91
|
|
|
92
92
|
const range = 2;
|
|
93
93
|
function generateCodeFrame(source, start = 0, end = source.length) {
|
|
94
|
+
start = Math.max(0, Math.min(start, source.length));
|
|
95
|
+
end = Math.max(0, Math.min(end, source.length));
|
|
96
|
+
if (start > end) return "";
|
|
94
97
|
let lines = source.split(/(\r?\n)/);
|
|
95
98
|
const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
|
|
96
99
|
lines = lines.filter((_, idx) => idx % 2 === 0);
|
|
@@ -100,8 +103,7 @@ function generateCodeFrame(source, start = 0, end = source.length) {
|
|
|
100
103
|
count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0);
|
|
101
104
|
if (count >= start) {
|
|
102
105
|
for (let j = i - range; j <= i + range || end > count; j++) {
|
|
103
|
-
if (j < 0 || j >= lines.length)
|
|
104
|
-
continue;
|
|
106
|
+
if (j < 0 || j >= lines.length) continue;
|
|
105
107
|
const line = j + 1;
|
|
106
108
|
res.push(
|
|
107
109
|
`${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`
|
|
@@ -166,8 +168,8 @@ function stringifyStyle(styles) {
|
|
|
166
168
|
}
|
|
167
169
|
for (const key in styles) {
|
|
168
170
|
const value = styles[key];
|
|
169
|
-
const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
|
|
170
171
|
if (isString$2(value) || typeof value === "number") {
|
|
172
|
+
const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
|
|
171
173
|
ret += `${normalizedKey}:${value};`;
|
|
172
174
|
}
|
|
173
175
|
}
|
|
@@ -2146,8 +2148,7 @@ function warnDeprecation(key, context, loc, ...args) {
|
|
|
2146
2148
|
Details: ${link}` : ``}`;
|
|
2147
2149
|
const err = new SyntaxError(msg);
|
|
2148
2150
|
err.code = key;
|
|
2149
|
-
if (loc)
|
|
2150
|
-
err.loc = loc;
|
|
2151
|
+
if (loc) err.loc = loc;
|
|
2151
2152
|
context.onWarn(err);
|
|
2152
2153
|
}
|
|
2153
2154
|
|
|
@@ -2447,10 +2448,7 @@ const NodeDescriptions = {
|
|
|
2447
2448
|
VariableDeclarator: "variable declaration",
|
|
2448
2449
|
YieldExpression: "yield expression"
|
|
2449
2450
|
};
|
|
2450
|
-
const toNodeDescription =
|
|
2451
|
-
type,
|
|
2452
|
-
prefix
|
|
2453
|
-
}) => type === "UpdateExpression" ? NodeDescriptions.UpdateExpression[String(prefix)] : NodeDescriptions[type];
|
|
2451
|
+
const toNodeDescription = node => node.type === "UpdateExpression" ? NodeDescriptions.UpdateExpression[`${node.prefix}`] : NodeDescriptions[node.type];
|
|
2454
2452
|
var StandardErrors = {
|
|
2455
2453
|
AccessorIsGenerator: ({
|
|
2456
2454
|
kind
|
|
@@ -2661,6 +2659,7 @@ var StandardErrors = {
|
|
|
2661
2659
|
UnterminatedRegExp: "Unterminated regular expression.",
|
|
2662
2660
|
UnterminatedString: "Unterminated string constant.",
|
|
2663
2661
|
UnterminatedTemplate: "Unterminated template.",
|
|
2662
|
+
UsingDeclarationExport: "Using declaration cannot be exported.",
|
|
2664
2663
|
UsingDeclarationHasBindingPattern: "Using declaration cannot have destructuring patterns.",
|
|
2665
2664
|
VarRedeclaration: ({
|
|
2666
2665
|
identifierName
|
|
@@ -2950,6 +2949,10 @@ var estree = superClass => class ESTreeParserMixin extends superClass {
|
|
|
2950
2949
|
}
|
|
2951
2950
|
return this.finishNode(node, "MethodDefinition");
|
|
2952
2951
|
}
|
|
2952
|
+
nameIsConstructor(key) {
|
|
2953
|
+
if (key.type === "Literal") return key.value === "constructor";
|
|
2954
|
+
return super.nameIsConstructor(key);
|
|
2955
|
+
}
|
|
2953
2956
|
parseClassProperty(...args) {
|
|
2954
2957
|
const propertyNode = super.parseClassProperty(...args);
|
|
2955
2958
|
{
|
|
@@ -3014,9 +3017,9 @@ var estree = superClass => class ESTreeParserMixin extends superClass {
|
|
|
3014
3017
|
}
|
|
3015
3018
|
}
|
|
3016
3019
|
toAssignableObjectExpressionProp(prop, isLast, isLHS) {
|
|
3017
|
-
if (prop.kind === "get" || prop.kind === "set") {
|
|
3020
|
+
if (prop.type === "Property" && (prop.kind === "get" || prop.kind === "set")) {
|
|
3018
3021
|
this.raise(Errors.PatternHasAccessor, prop.key);
|
|
3019
|
-
} else if (prop.method) {
|
|
3022
|
+
} else if (prop.type === "Property" && prop.method) {
|
|
3020
3023
|
this.raise(Errors.PatternHasMethod, prop.key);
|
|
3021
3024
|
} else {
|
|
3022
3025
|
super.toAssignableObjectExpressionProp(prop, isLast, isLHS);
|
|
@@ -3028,9 +3031,9 @@ var estree = superClass => class ESTreeParserMixin extends superClass {
|
|
|
3028
3031
|
node.type = "ImportExpression";
|
|
3029
3032
|
node.source = node.arguments[0];
|
|
3030
3033
|
if (this.hasPlugin("importAttributes") || this.hasPlugin("importAssertions")) {
|
|
3031
|
-
var
|
|
3032
|
-
node.options = (
|
|
3033
|
-
node.attributes = (
|
|
3034
|
+
var _ref, _ref2;
|
|
3035
|
+
node.options = (_ref = node.arguments[1]) != null ? _ref : null;
|
|
3036
|
+
node.attributes = (_ref2 = node.arguments[1]) != null ? _ref2 : null;
|
|
3034
3037
|
}
|
|
3035
3038
|
delete node.arguments;
|
|
3036
3039
|
delete node.callee;
|
|
@@ -3102,7 +3105,7 @@ var estree = superClass => class ESTreeParserMixin extends superClass {
|
|
|
3102
3105
|
return node.type === "Property" && node.kind === "init" && !node.method;
|
|
3103
3106
|
}
|
|
3104
3107
|
isObjectMethod(node) {
|
|
3105
|
-
return node.method || node.kind === "get" || node.kind === "set";
|
|
3108
|
+
return node.type === "Property" && (node.method || node.kind === "get" || node.kind === "set");
|
|
3106
3109
|
}
|
|
3107
3110
|
finishNodeAt(node, type, endLoc) {
|
|
3108
3111
|
return toESTreeLocation(super.finishNodeAt(node, type, endLoc));
|
|
@@ -4005,7 +4008,9 @@ class CommentsParser extends BaseParser {
|
|
|
4005
4008
|
const {
|
|
4006
4009
|
commentsLen
|
|
4007
4010
|
} = this.state;
|
|
4008
|
-
if (this.comments.length
|
|
4011
|
+
if (this.comments.length !== commentsLen) {
|
|
4012
|
+
this.comments.length = commentsLen;
|
|
4013
|
+
}
|
|
4009
4014
|
this.comments.push(comment);
|
|
4010
4015
|
this.state.commentsLen++;
|
|
4011
4016
|
}
|
|
@@ -4227,12 +4232,8 @@ class State {
|
|
|
4227
4232
|
get strict() {
|
|
4228
4233
|
return (this.flags & 1) > 0;
|
|
4229
4234
|
}
|
|
4230
|
-
set strict(
|
|
4231
|
-
if (
|
|
4232
|
-
this.flags |= 1;
|
|
4233
|
-
} else {
|
|
4234
|
-
this.flags &= ~1;
|
|
4235
|
-
}
|
|
4235
|
+
set strict(v) {
|
|
4236
|
+
if (v) this.flags |= 1;else this.flags &= -2;
|
|
4236
4237
|
}
|
|
4237
4238
|
init({
|
|
4238
4239
|
strictMode,
|
|
@@ -4248,112 +4249,68 @@ class State {
|
|
|
4248
4249
|
get maybeInArrowParameters() {
|
|
4249
4250
|
return (this.flags & 2) > 0;
|
|
4250
4251
|
}
|
|
4251
|
-
set maybeInArrowParameters(
|
|
4252
|
-
if (
|
|
4253
|
-
this.flags |= 2;
|
|
4254
|
-
} else {
|
|
4255
|
-
this.flags &= ~2;
|
|
4256
|
-
}
|
|
4252
|
+
set maybeInArrowParameters(v) {
|
|
4253
|
+
if (v) this.flags |= 2;else this.flags &= -3;
|
|
4257
4254
|
}
|
|
4258
4255
|
get inType() {
|
|
4259
4256
|
return (this.flags & 4) > 0;
|
|
4260
4257
|
}
|
|
4261
|
-
set inType(
|
|
4262
|
-
if (
|
|
4263
|
-
this.flags |= 4;
|
|
4264
|
-
} else {
|
|
4265
|
-
this.flags &= ~4;
|
|
4266
|
-
}
|
|
4258
|
+
set inType(v) {
|
|
4259
|
+
if (v) this.flags |= 4;else this.flags &= -5;
|
|
4267
4260
|
}
|
|
4268
4261
|
get noAnonFunctionType() {
|
|
4269
4262
|
return (this.flags & 8) > 0;
|
|
4270
4263
|
}
|
|
4271
|
-
set noAnonFunctionType(
|
|
4272
|
-
if (
|
|
4273
|
-
this.flags |= 8;
|
|
4274
|
-
} else {
|
|
4275
|
-
this.flags &= ~8;
|
|
4276
|
-
}
|
|
4264
|
+
set noAnonFunctionType(v) {
|
|
4265
|
+
if (v) this.flags |= 8;else this.flags &= -9;
|
|
4277
4266
|
}
|
|
4278
4267
|
get hasFlowComment() {
|
|
4279
4268
|
return (this.flags & 16) > 0;
|
|
4280
4269
|
}
|
|
4281
|
-
set hasFlowComment(
|
|
4282
|
-
if (
|
|
4283
|
-
this.flags |= 16;
|
|
4284
|
-
} else {
|
|
4285
|
-
this.flags &= ~16;
|
|
4286
|
-
}
|
|
4270
|
+
set hasFlowComment(v) {
|
|
4271
|
+
if (v) this.flags |= 16;else this.flags &= -17;
|
|
4287
4272
|
}
|
|
4288
4273
|
get isAmbientContext() {
|
|
4289
4274
|
return (this.flags & 32) > 0;
|
|
4290
4275
|
}
|
|
4291
|
-
set isAmbientContext(
|
|
4292
|
-
if (
|
|
4293
|
-
this.flags |= 32;
|
|
4294
|
-
} else {
|
|
4295
|
-
this.flags &= ~32;
|
|
4296
|
-
}
|
|
4276
|
+
set isAmbientContext(v) {
|
|
4277
|
+
if (v) this.flags |= 32;else this.flags &= -33;
|
|
4297
4278
|
}
|
|
4298
4279
|
get inAbstractClass() {
|
|
4299
4280
|
return (this.flags & 64) > 0;
|
|
4300
4281
|
}
|
|
4301
|
-
set inAbstractClass(
|
|
4302
|
-
if (
|
|
4303
|
-
this.flags |= 64;
|
|
4304
|
-
} else {
|
|
4305
|
-
this.flags &= ~64;
|
|
4306
|
-
}
|
|
4282
|
+
set inAbstractClass(v) {
|
|
4283
|
+
if (v) this.flags |= 64;else this.flags &= -65;
|
|
4307
4284
|
}
|
|
4308
4285
|
get inDisallowConditionalTypesContext() {
|
|
4309
4286
|
return (this.flags & 128) > 0;
|
|
4310
4287
|
}
|
|
4311
|
-
set inDisallowConditionalTypesContext(
|
|
4312
|
-
if (
|
|
4313
|
-
this.flags |= 128;
|
|
4314
|
-
} else {
|
|
4315
|
-
this.flags &= ~128;
|
|
4316
|
-
}
|
|
4288
|
+
set inDisallowConditionalTypesContext(v) {
|
|
4289
|
+
if (v) this.flags |= 128;else this.flags &= -129;
|
|
4317
4290
|
}
|
|
4318
4291
|
get soloAwait() {
|
|
4319
4292
|
return (this.flags & 256) > 0;
|
|
4320
4293
|
}
|
|
4321
|
-
set soloAwait(
|
|
4322
|
-
if (
|
|
4323
|
-
this.flags |= 256;
|
|
4324
|
-
} else {
|
|
4325
|
-
this.flags &= ~256;
|
|
4326
|
-
}
|
|
4294
|
+
set soloAwait(v) {
|
|
4295
|
+
if (v) this.flags |= 256;else this.flags &= -257;
|
|
4327
4296
|
}
|
|
4328
4297
|
get inFSharpPipelineDirectBody() {
|
|
4329
4298
|
return (this.flags & 512) > 0;
|
|
4330
4299
|
}
|
|
4331
|
-
set inFSharpPipelineDirectBody(
|
|
4332
|
-
if (
|
|
4333
|
-
this.flags |= 512;
|
|
4334
|
-
} else {
|
|
4335
|
-
this.flags &= ~512;
|
|
4336
|
-
}
|
|
4300
|
+
set inFSharpPipelineDirectBody(v) {
|
|
4301
|
+
if (v) this.flags |= 512;else this.flags &= -513;
|
|
4337
4302
|
}
|
|
4338
4303
|
get canStartJSXElement() {
|
|
4339
4304
|
return (this.flags & 1024) > 0;
|
|
4340
4305
|
}
|
|
4341
|
-
set canStartJSXElement(
|
|
4342
|
-
if (
|
|
4343
|
-
this.flags |= 1024;
|
|
4344
|
-
} else {
|
|
4345
|
-
this.flags &= ~1024;
|
|
4346
|
-
}
|
|
4306
|
+
set canStartJSXElement(v) {
|
|
4307
|
+
if (v) this.flags |= 1024;else this.flags &= -1025;
|
|
4347
4308
|
}
|
|
4348
4309
|
get containsEsc() {
|
|
4349
4310
|
return (this.flags & 2048) > 0;
|
|
4350
4311
|
}
|
|
4351
|
-
set containsEsc(
|
|
4352
|
-
if (
|
|
4353
|
-
this.flags |= 2048;
|
|
4354
|
-
} else {
|
|
4355
|
-
this.flags &= ~2048;
|
|
4356
|
-
}
|
|
4312
|
+
set containsEsc(v) {
|
|
4313
|
+
if (v) this.flags |= 2048;else this.flags &= -2049;
|
|
4357
4314
|
}
|
|
4358
4315
|
curPosition() {
|
|
4359
4316
|
return new Position(this.curLine, this.pos - this.lineStart, this.pos);
|
|
@@ -7179,50 +7136,56 @@ var flow = superClass => class FlowParserMixin extends superClass {
|
|
|
7179
7136
|
this.state.noAnonFunctionType = oldNoAnonFunctionType;
|
|
7180
7137
|
return type;
|
|
7181
7138
|
case 47:
|
|
7182
|
-
|
|
7183
|
-
|
|
7184
|
-
|
|
7185
|
-
|
|
7186
|
-
|
|
7187
|
-
|
|
7188
|
-
|
|
7189
|
-
|
|
7190
|
-
|
|
7191
|
-
|
|
7139
|
+
{
|
|
7140
|
+
const node = this.startNode();
|
|
7141
|
+
node.typeParameters = this.flowParseTypeParameterDeclaration();
|
|
7142
|
+
this.expect(10);
|
|
7143
|
+
tmp = this.flowParseFunctionTypeParams();
|
|
7144
|
+
node.params = tmp.params;
|
|
7145
|
+
node.rest = tmp.rest;
|
|
7146
|
+
node.this = tmp._this;
|
|
7147
|
+
this.expect(11);
|
|
7148
|
+
this.expect(19);
|
|
7149
|
+
node.returnType = this.flowParseType();
|
|
7150
|
+
return this.finishNode(node, "FunctionTypeAnnotation");
|
|
7151
|
+
}
|
|
7192
7152
|
case 10:
|
|
7193
|
-
|
|
7194
|
-
|
|
7195
|
-
|
|
7196
|
-
|
|
7197
|
-
|
|
7198
|
-
|
|
7199
|
-
|
|
7153
|
+
{
|
|
7154
|
+
const node = this.startNode();
|
|
7155
|
+
this.next();
|
|
7156
|
+
if (!this.match(11) && !this.match(21)) {
|
|
7157
|
+
if (tokenIsIdentifier(this.state.type) || this.match(78)) {
|
|
7158
|
+
const token = this.lookahead().type;
|
|
7159
|
+
isGroupedType = token !== 17 && token !== 14;
|
|
7160
|
+
} else {
|
|
7161
|
+
isGroupedType = true;
|
|
7162
|
+
}
|
|
7200
7163
|
}
|
|
7201
|
-
|
|
7202
|
-
|
|
7203
|
-
|
|
7204
|
-
|
|
7205
|
-
|
|
7206
|
-
|
|
7207
|
-
|
|
7208
|
-
|
|
7164
|
+
if (isGroupedType) {
|
|
7165
|
+
this.state.noAnonFunctionType = false;
|
|
7166
|
+
type = this.flowParseType();
|
|
7167
|
+
this.state.noAnonFunctionType = oldNoAnonFunctionType;
|
|
7168
|
+
if (this.state.noAnonFunctionType || !(this.match(12) || this.match(11) && this.lookahead().type === 19)) {
|
|
7169
|
+
this.expect(11);
|
|
7170
|
+
return type;
|
|
7171
|
+
} else {
|
|
7172
|
+
this.eat(12);
|
|
7173
|
+
}
|
|
7174
|
+
}
|
|
7175
|
+
if (type) {
|
|
7176
|
+
tmp = this.flowParseFunctionTypeParams([this.reinterpretTypeAsFunctionTypeParam(type)]);
|
|
7209
7177
|
} else {
|
|
7210
|
-
this.
|
|
7178
|
+
tmp = this.flowParseFunctionTypeParams();
|
|
7211
7179
|
}
|
|
7180
|
+
node.params = tmp.params;
|
|
7181
|
+
node.rest = tmp.rest;
|
|
7182
|
+
node.this = tmp._this;
|
|
7183
|
+
this.expect(11);
|
|
7184
|
+
this.expect(19);
|
|
7185
|
+
node.returnType = this.flowParseType();
|
|
7186
|
+
node.typeParameters = null;
|
|
7187
|
+
return this.finishNode(node, "FunctionTypeAnnotation");
|
|
7212
7188
|
}
|
|
7213
|
-
if (type) {
|
|
7214
|
-
tmp = this.flowParseFunctionTypeParams([this.reinterpretTypeAsFunctionTypeParam(type)]);
|
|
7215
|
-
} else {
|
|
7216
|
-
tmp = this.flowParseFunctionTypeParams();
|
|
7217
|
-
}
|
|
7218
|
-
node.params = tmp.params;
|
|
7219
|
-
node.rest = tmp.rest;
|
|
7220
|
-
node.this = tmp._this;
|
|
7221
|
-
this.expect(11);
|
|
7222
|
-
this.expect(19);
|
|
7223
|
-
node.returnType = this.flowParseType();
|
|
7224
|
-
node.typeParameters = null;
|
|
7225
|
-
return this.finishNode(node, "FunctionTypeAnnotation");
|
|
7226
7189
|
case 133:
|
|
7227
7190
|
return this.parseLiteral(this.state.value, "StringLiteralTypeAnnotation");
|
|
7228
7191
|
case 85:
|
|
@@ -7538,7 +7501,7 @@ var flow = superClass => class FlowParserMixin extends superClass {
|
|
|
7538
7501
|
const arrows = [];
|
|
7539
7502
|
while (stack.length !== 0) {
|
|
7540
7503
|
const node = stack.pop();
|
|
7541
|
-
if (node.type === "ArrowFunctionExpression") {
|
|
7504
|
+
if (node.type === "ArrowFunctionExpression" && node.body.type !== "BlockStatement") {
|
|
7542
7505
|
if (node.typeParameters || !node.returnType) {
|
|
7543
7506
|
this.finishArrowValidation(node);
|
|
7544
7507
|
} else {
|
|
@@ -7575,18 +7538,18 @@ var flow = superClass => class FlowParserMixin extends superClass {
|
|
|
7575
7538
|
return result;
|
|
7576
7539
|
}
|
|
7577
7540
|
parseParenItem(node, startLoc) {
|
|
7578
|
-
|
|
7541
|
+
const newNode = super.parseParenItem(node, startLoc);
|
|
7579
7542
|
if (this.eat(17)) {
|
|
7580
|
-
|
|
7543
|
+
newNode.optional = true;
|
|
7581
7544
|
this.resetEndLocation(node);
|
|
7582
7545
|
}
|
|
7583
7546
|
if (this.match(14)) {
|
|
7584
7547
|
const typeCastNode = this.startNodeAt(startLoc);
|
|
7585
|
-
typeCastNode.expression =
|
|
7548
|
+
typeCastNode.expression = newNode;
|
|
7586
7549
|
typeCastNode.typeAnnotation = this.flowParseTypeAnnotation();
|
|
7587
7550
|
return this.finishNode(typeCastNode, "TypeCastExpression");
|
|
7588
7551
|
}
|
|
7589
|
-
return
|
|
7552
|
+
return newNode;
|
|
7590
7553
|
}
|
|
7591
7554
|
assertModuleNodeAllowed(node) {
|
|
7592
7555
|
if (node.type === "ImportDeclaration" && (node.importKind === "type" || node.importKind === "typeof") || node.type === "ExportNamedDeclaration" && node.exportKind === "type" || node.type === "ExportAllDeclaration" && node.exportKind === "type") {
|
|
@@ -8959,7 +8922,7 @@ var jsx = superClass => class JSXParserMixin extends superClass {
|
|
|
8959
8922
|
} else {
|
|
8960
8923
|
let count = 0;
|
|
8961
8924
|
let semi = false;
|
|
8962
|
-
while (count++ < 10 && this.state.pos < this.length && !(semi = this.codePointAtPos(this.state.pos)
|
|
8925
|
+
while (count++ < 10 && this.state.pos < this.length && !(semi = this.codePointAtPos(this.state.pos) === 59)) {
|
|
8963
8926
|
++this.state.pos;
|
|
8964
8927
|
}
|
|
8965
8928
|
if (semi) {
|
|
@@ -9121,7 +9084,7 @@ var jsx = superClass => class JSXParserMixin extends superClass {
|
|
|
9121
9084
|
children.push(this.jsxParseElementAt(startLoc));
|
|
9122
9085
|
break;
|
|
9123
9086
|
case 141:
|
|
9124
|
-
children.push(this.
|
|
9087
|
+
children.push(this.parseLiteral(this.state.value, "JSXText"));
|
|
9125
9088
|
break;
|
|
9126
9089
|
case 5:
|
|
9127
9090
|
{
|
|
@@ -9178,9 +9141,7 @@ var jsx = superClass => class JSXParserMixin extends superClass {
|
|
|
9178
9141
|
context[context.length - 1] = newContext;
|
|
9179
9142
|
}
|
|
9180
9143
|
parseExprAtom(refExpressionErrors) {
|
|
9181
|
-
if (this.match(
|
|
9182
|
-
return this.parseLiteral(this.state.value, "JSXText");
|
|
9183
|
-
} else if (this.match(142)) {
|
|
9144
|
+
if (this.match(142)) {
|
|
9184
9145
|
return this.jsxParseElement();
|
|
9185
9146
|
} else if (this.match(47) && this.input.charCodeAt(this.state.pos) !== 33) {
|
|
9186
9147
|
this.replaceToken(142);
|
|
@@ -9261,14 +9222,14 @@ class TypeScriptScopeHandler extends ScopeHandler {
|
|
|
9261
9222
|
return new TypeScriptScope(flags);
|
|
9262
9223
|
}
|
|
9263
9224
|
enter(flags) {
|
|
9264
|
-
if (flags
|
|
9225
|
+
if (flags === 256) {
|
|
9265
9226
|
this.importsStack.push(new Set());
|
|
9266
9227
|
}
|
|
9267
9228
|
super.enter(flags);
|
|
9268
9229
|
}
|
|
9269
9230
|
exit() {
|
|
9270
9231
|
const flags = super.exit();
|
|
9271
|
-
if (flags
|
|
9232
|
+
if (flags === 256) {
|
|
9272
9233
|
this.importsStack.pop();
|
|
9273
9234
|
}
|
|
9274
9235
|
return flags;
|
|
@@ -9577,14 +9538,15 @@ class LValParser extends NodeUtils {
|
|
|
9577
9538
|
return this.finishNode(prop, "RestElement");
|
|
9578
9539
|
}
|
|
9579
9540
|
parseBindingProperty() {
|
|
9580
|
-
const prop = this.startNode();
|
|
9581
9541
|
const {
|
|
9582
9542
|
type,
|
|
9583
9543
|
startLoc
|
|
9584
9544
|
} = this.state;
|
|
9585
9545
|
if (type === 21) {
|
|
9586
|
-
return this.parseBindingRestProperty(
|
|
9587
|
-
}
|
|
9546
|
+
return this.parseBindingRestProperty(this.startNode());
|
|
9547
|
+
}
|
|
9548
|
+
const prop = this.startNode();
|
|
9549
|
+
if (type === 138) {
|
|
9588
9550
|
this.expectPlugin("destructuringPrivate", startLoc);
|
|
9589
9551
|
this.classScope.usePrivateName(this.state.value, startLoc);
|
|
9590
9552
|
prop.key = this.parsePrivateName();
|
|
@@ -11434,13 +11396,14 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
|
|
11434
11396
|
parseExport(node, decorators) {
|
|
11435
11397
|
if (this.match(83)) {
|
|
11436
11398
|
this.next();
|
|
11399
|
+
const nodeImportEquals = node;
|
|
11437
11400
|
let maybeDefaultIdentifier = null;
|
|
11438
11401
|
if (this.isContextual(130) && this.isPotentialImportPhase(false)) {
|
|
11439
|
-
maybeDefaultIdentifier = this.parseMaybeImportPhase(
|
|
11402
|
+
maybeDefaultIdentifier = this.parseMaybeImportPhase(nodeImportEquals, false);
|
|
11440
11403
|
} else {
|
|
11441
|
-
|
|
11404
|
+
nodeImportEquals.importKind = "value";
|
|
11442
11405
|
}
|
|
11443
|
-
return this.tsParseImportEqualsDeclaration(
|
|
11406
|
+
return this.tsParseImportEqualsDeclaration(nodeImportEquals, maybeDefaultIdentifier, true);
|
|
11444
11407
|
} else if (this.eat(29)) {
|
|
11445
11408
|
const assign = node;
|
|
11446
11409
|
assign.expression = super.parseExpression();
|
|
@@ -11612,9 +11575,9 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
|
|
11612
11575
|
return result.node;
|
|
11613
11576
|
}
|
|
11614
11577
|
parseParenItem(node, startLoc) {
|
|
11615
|
-
|
|
11578
|
+
const newNode = super.parseParenItem(node, startLoc);
|
|
11616
11579
|
if (this.eat(17)) {
|
|
11617
|
-
|
|
11580
|
+
newNode.optional = true;
|
|
11618
11581
|
this.resetEndLocation(node);
|
|
11619
11582
|
}
|
|
11620
11583
|
if (this.match(14)) {
|
|
@@ -11723,7 +11686,9 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
|
|
11723
11686
|
}
|
|
11724
11687
|
declareClassPrivateMethodInScope(node, kind) {
|
|
11725
11688
|
if (node.type === "TSDeclareMethod") return;
|
|
11726
|
-
if (node.type === "MethodDefinition" && !node.value
|
|
11689
|
+
if (node.type === "MethodDefinition" && !hasOwnProperty.call(node.value, "body")) {
|
|
11690
|
+
return;
|
|
11691
|
+
}
|
|
11727
11692
|
super.declareClassPrivateMethodInScope(node, kind);
|
|
11728
11693
|
}
|
|
11729
11694
|
parseClassSuper(node) {
|
|
@@ -11922,6 +11887,7 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
|
|
11922
11887
|
TSTypeCastExpression: true,
|
|
11923
11888
|
TSParameterProperty: "parameter",
|
|
11924
11889
|
TSNonNullExpression: "expression",
|
|
11890
|
+
TSInstantiationExpression: "expression",
|
|
11925
11891
|
TSAsExpression: (binding !== 64 || !isUnparenthesizedInAssign) && ["expression", true],
|
|
11926
11892
|
TSSatisfiesExpression: (binding !== 64 || !isUnparenthesizedInAssign) && ["expression", true],
|
|
11927
11893
|
TSTypeAssertion: (binding !== 64 || !isUnparenthesizedInAssign) && ["expression", true]
|
|
@@ -12275,9 +12241,12 @@ var placeholders = superClass => class PlaceholdersParserMixin extends superClas
|
|
|
12275
12241
|
}
|
|
12276
12242
|
}
|
|
12277
12243
|
finishPlaceholder(node, expectedNode) {
|
|
12278
|
-
|
|
12279
|
-
|
|
12280
|
-
|
|
12244
|
+
let placeholder = node;
|
|
12245
|
+
if (!placeholder.expectedNode || !placeholder.type) {
|
|
12246
|
+
placeholder = this.finishNode(placeholder, "Placeholder");
|
|
12247
|
+
}
|
|
12248
|
+
placeholder.expectedNode = expectedNode;
|
|
12249
|
+
return placeholder;
|
|
12281
12250
|
}
|
|
12282
12251
|
getTokenFromCode(code) {
|
|
12283
12252
|
if (code === 37 && this.input.charCodeAt(this.state.pos + 1) === 37) {
|
|
@@ -12337,8 +12306,9 @@ var placeholders = superClass => class PlaceholdersParserMixin extends superClas
|
|
|
12337
12306
|
return this.finishNode(stmt, "LabeledStatement");
|
|
12338
12307
|
}
|
|
12339
12308
|
this.semicolon();
|
|
12340
|
-
|
|
12341
|
-
|
|
12309
|
+
const stmtPlaceholder = node;
|
|
12310
|
+
stmtPlaceholder.name = expr.name;
|
|
12311
|
+
return this.finishPlaceholder(stmtPlaceholder, "Statement");
|
|
12342
12312
|
}
|
|
12343
12313
|
parseBlock(allowDirectives, createNewLexicalScope, afterBlockParse) {
|
|
12344
12314
|
return this.parsePlaceholder("BlockStatement") || super.parseBlock(allowDirectives, createNewLexicalScope, afterBlockParse);
|
|
@@ -12371,17 +12341,18 @@ var placeholders = superClass => class PlaceholdersParserMixin extends superClas
|
|
|
12371
12341
|
parseExport(node, decorators) {
|
|
12372
12342
|
const placeholder = this.parsePlaceholder("Identifier");
|
|
12373
12343
|
if (!placeholder) return super.parseExport(node, decorators);
|
|
12344
|
+
const node2 = node;
|
|
12374
12345
|
if (!this.isContextual(98) && !this.match(12)) {
|
|
12375
|
-
|
|
12376
|
-
|
|
12377
|
-
|
|
12378
|
-
return this.finishNode(
|
|
12346
|
+
node2.specifiers = [];
|
|
12347
|
+
node2.source = null;
|
|
12348
|
+
node2.declaration = this.finishPlaceholder(placeholder, "Declaration");
|
|
12349
|
+
return this.finishNode(node2, "ExportNamedDeclaration");
|
|
12379
12350
|
}
|
|
12380
12351
|
this.expectPlugin("exportDefaultFrom");
|
|
12381
12352
|
const specifier = this.startNode();
|
|
12382
12353
|
specifier.exported = placeholder;
|
|
12383
|
-
|
|
12384
|
-
return super.parseExport(
|
|
12354
|
+
node2.specifiers = [this.finishNode(specifier, "ExportDefaultSpecifier")];
|
|
12355
|
+
return super.parseExport(node2, decorators);
|
|
12385
12356
|
}
|
|
12386
12357
|
isExportDefaultSpecifier() {
|
|
12387
12358
|
if (this.match(65)) {
|
|
@@ -12498,7 +12469,6 @@ function getPluginOption(plugins, name, option) {
|
|
|
12498
12469
|
}
|
|
12499
12470
|
const PIPELINE_PROPOSALS = ["minimal", "fsharp", "hack", "smart"];
|
|
12500
12471
|
const TOPIC_TOKENS = ["^^", "@@", "^", "%", "#"];
|
|
12501
|
-
const RECORD_AND_TUPLE_SYNTAX_TYPES = ["hash", "bar"];
|
|
12502
12472
|
function validatePlugins(plugins) {
|
|
12503
12473
|
if (hasPlugin(plugins, "decorators")) {
|
|
12504
12474
|
if (hasPlugin(plugins, "decorators-legacy")) {
|
|
@@ -12525,9 +12495,10 @@ function validatePlugins(plugins) {
|
|
|
12525
12495
|
const proposalList = PIPELINE_PROPOSALS.map(p => `"${p}"`).join(", ");
|
|
12526
12496
|
throw new Error(`"pipelineOperator" requires "proposal" option whose value must be one of: ${proposalList}.`);
|
|
12527
12497
|
}
|
|
12528
|
-
const
|
|
12498
|
+
const recordAndTupleConfigItem = ["recordAndTuple", {
|
|
12529
12499
|
syntaxType: "hash"
|
|
12530
|
-
}]
|
|
12500
|
+
}];
|
|
12501
|
+
const tupleSyntaxIsHash = hasPlugin(plugins, recordAndTupleConfigItem);
|
|
12531
12502
|
if (proposal === "hack") {
|
|
12532
12503
|
if (hasPlugin(plugins, "placeholders")) {
|
|
12533
12504
|
throw new Error("Cannot combine placeholders plugin and Hack-style pipes.");
|
|
@@ -12541,10 +12512,10 @@ function validatePlugins(plugins) {
|
|
|
12541
12512
|
throw new Error(`"pipelineOperator" in "proposal": "hack" mode also requires a "topicToken" option whose value must be one of: ${tokenList}.`);
|
|
12542
12513
|
}
|
|
12543
12514
|
if (topicToken === "#" && tupleSyntaxIsHash) {
|
|
12544
|
-
throw new Error(
|
|
12515
|
+
throw new Error(`Plugin conflict between \`["pipelineOperator", { proposal: "hack", topicToken: "#" }]\` and \`${JSON.stringify(recordAndTupleConfigItem)}\`.`);
|
|
12545
12516
|
}
|
|
12546
12517
|
} else if (proposal === "smart" && tupleSyntaxIsHash) {
|
|
12547
|
-
throw new Error(
|
|
12518
|
+
throw new Error(`Plugin conflict between \`["pipelineOperator", { proposal: "smart" }]\` and \`${JSON.stringify(recordAndTupleConfigItem)}\`.`);
|
|
12548
12519
|
}
|
|
12549
12520
|
}
|
|
12550
12521
|
if (hasPlugin(plugins, "moduleAttributes")) {
|
|
@@ -12561,8 +12532,16 @@ function validatePlugins(plugins) {
|
|
|
12561
12532
|
if (hasPlugin(plugins, "importAssertions") && hasPlugin(plugins, "importAttributes")) {
|
|
12562
12533
|
throw new Error("Cannot combine importAssertions and importAttributes plugins.");
|
|
12563
12534
|
}
|
|
12564
|
-
if (hasPlugin(plugins, "recordAndTuple")
|
|
12565
|
-
|
|
12535
|
+
if (hasPlugin(plugins, "recordAndTuple")) {
|
|
12536
|
+
const syntaxType = getPluginOption(plugins, "recordAndTuple", "syntaxType");
|
|
12537
|
+
if (syntaxType != null) {
|
|
12538
|
+
{
|
|
12539
|
+
const RECORD_AND_TUPLE_SYNTAX_TYPES = ["hash", "bar"];
|
|
12540
|
+
if (!RECORD_AND_TUPLE_SYNTAX_TYPES.includes(syntaxType)) {
|
|
12541
|
+
throw new Error("The 'syntaxType' option of the 'recordAndTuple' plugin must be one of: " + RECORD_AND_TUPLE_SYNTAX_TYPES.map(p => `'${p}'`).join(", "));
|
|
12542
|
+
}
|
|
12543
|
+
}
|
|
12544
|
+
}
|
|
12566
12545
|
}
|
|
12567
12546
|
if (hasPlugin(plugins, "asyncDoExpressions") && !hasPlugin(plugins, "doExpressions")) {
|
|
12568
12547
|
const error = new Error("'asyncDoExpressions' requires 'doExpressions', please add 'doExpressions' to parser plugins.");
|
|
@@ -13681,14 +13660,16 @@ class ExpressionParser extends LValParser {
|
|
|
13681
13660
|
}
|
|
13682
13661
|
parseTemplate(isTagged) {
|
|
13683
13662
|
const node = this.startNode();
|
|
13684
|
-
node.expressions = [];
|
|
13685
13663
|
let curElt = this.parseTemplateElement(isTagged);
|
|
13686
|
-
|
|
13664
|
+
const quasis = [curElt];
|
|
13665
|
+
const substitutions = [];
|
|
13687
13666
|
while (!curElt.tail) {
|
|
13688
|
-
|
|
13667
|
+
substitutions.push(this.parseTemplateSubstitution());
|
|
13689
13668
|
this.readTemplateContinuation();
|
|
13690
|
-
|
|
13669
|
+
quasis.push(curElt = this.parseTemplateElement(isTagged));
|
|
13691
13670
|
}
|
|
13671
|
+
node.expressions = substitutions;
|
|
13672
|
+
node.quasis = quasis;
|
|
13692
13673
|
return this.finishNode(node, "TemplateLiteral");
|
|
13693
13674
|
}
|
|
13694
13675
|
parseTemplateSubstitution() {
|
|
@@ -13725,8 +13706,10 @@ class ExpressionParser extends LValParser {
|
|
|
13725
13706
|
if (isRecord && !this.isObjectProperty(prop) && prop.type !== "SpreadElement") {
|
|
13726
13707
|
this.raise(Errors.InvalidRecordProperty, prop);
|
|
13727
13708
|
}
|
|
13728
|
-
|
|
13729
|
-
|
|
13709
|
+
{
|
|
13710
|
+
if (prop.shorthand) {
|
|
13711
|
+
this.addExtra(prop, "shorthand", true);
|
|
13712
|
+
}
|
|
13730
13713
|
}
|
|
13731
13714
|
node.properties.push(prop);
|
|
13732
13715
|
}
|
|
@@ -13776,8 +13759,11 @@ class ExpressionParser extends LValParser {
|
|
|
13776
13759
|
let isGenerator = this.eat(55);
|
|
13777
13760
|
this.parsePropertyNamePrefixOperator(prop);
|
|
13778
13761
|
const containsEsc = this.state.containsEsc;
|
|
13779
|
-
|
|
13762
|
+
this.parsePropertyName(prop, refExpressionErrors);
|
|
13780
13763
|
if (!isGenerator && !containsEsc && this.maybeAsyncOrAccessorProp(prop)) {
|
|
13764
|
+
const {
|
|
13765
|
+
key
|
|
13766
|
+
} = prop;
|
|
13781
13767
|
const keyName = key.name;
|
|
13782
13768
|
if (keyName === "async" && !this.hasPrecedingLineBreak()) {
|
|
13783
13769
|
isAsync = true;
|
|
@@ -13912,7 +13898,6 @@ class ExpressionParser extends LValParser {
|
|
|
13912
13898
|
prop.computed = false;
|
|
13913
13899
|
}
|
|
13914
13900
|
}
|
|
13915
|
-
return prop.key;
|
|
13916
13901
|
}
|
|
13917
13902
|
initFunction(node, isAsync) {
|
|
13918
13903
|
node.id = null;
|
|
@@ -15322,8 +15307,11 @@ class StatementParser extends ExpressionParser {
|
|
|
15322
15307
|
isClassMethod() {
|
|
15323
15308
|
return this.match(10);
|
|
15324
15309
|
}
|
|
15310
|
+
nameIsConstructor(key) {
|
|
15311
|
+
return key.type === "Identifier" && key.name === "constructor" || key.type === "StringLiteral" && key.value === "constructor";
|
|
15312
|
+
}
|
|
15325
15313
|
isNonstaticConstructor(method) {
|
|
15326
|
-
return !method.computed && !method.static && (method.key
|
|
15314
|
+
return !method.computed && !method.static && this.nameIsConstructor(method.key);
|
|
15327
15315
|
}
|
|
15328
15316
|
parseClassBody(hadSuperClass, oldStrict) {
|
|
15329
15317
|
this.classScope.enter();
|
|
@@ -15425,9 +15413,10 @@ class StatementParser extends ExpressionParser {
|
|
|
15425
15413
|
this.pushClassMethod(classBody, publicMethod, true, false, false, false);
|
|
15426
15414
|
return;
|
|
15427
15415
|
}
|
|
15428
|
-
const isContextual =
|
|
15429
|
-
const isPrivate = this.match(138);
|
|
15416
|
+
const isContextual = !this.state.containsEsc && tokenIsIdentifier(this.state.type);
|
|
15430
15417
|
const key = this.parseClassElementName(member);
|
|
15418
|
+
const maybeContextualKw = isContextual ? key.name : null;
|
|
15419
|
+
const isPrivate = this.isPrivateName(key);
|
|
15431
15420
|
const maybeQuestionTokenStartLoc = this.state.startLoc;
|
|
15432
15421
|
this.parsePostMemberNameModifiers(publicMember);
|
|
15433
15422
|
if (this.isClassMethod()) {
|
|
@@ -15456,7 +15445,7 @@ class StatementParser extends ExpressionParser {
|
|
|
15456
15445
|
} else {
|
|
15457
15446
|
this.pushClassProperty(classBody, publicProp);
|
|
15458
15447
|
}
|
|
15459
|
-
} else if (
|
|
15448
|
+
} else if (maybeContextualKw === "async" && !this.isLineTerminator()) {
|
|
15460
15449
|
this.resetPreviousNodeTrailingComments(key);
|
|
15461
15450
|
const isGenerator = this.eat(55);
|
|
15462
15451
|
if (publicMember.optional) {
|
|
@@ -15474,9 +15463,9 @@ class StatementParser extends ExpressionParser {
|
|
|
15474
15463
|
}
|
|
15475
15464
|
this.pushClassMethod(classBody, publicMethod, isGenerator, true, false, false);
|
|
15476
15465
|
}
|
|
15477
|
-
} else if (
|
|
15466
|
+
} else if ((maybeContextualKw === "get" || maybeContextualKw === "set") && !(this.match(55) && this.isLineTerminator())) {
|
|
15478
15467
|
this.resetPreviousNodeTrailingComments(key);
|
|
15479
|
-
method.kind =
|
|
15468
|
+
method.kind = maybeContextualKw;
|
|
15480
15469
|
const isPrivate = this.match(138);
|
|
15481
15470
|
this.parseClassElementName(publicMethod);
|
|
15482
15471
|
if (isPrivate) {
|
|
@@ -15488,7 +15477,7 @@ class StatementParser extends ExpressionParser {
|
|
|
15488
15477
|
this.pushClassMethod(classBody, publicMethod, false, false, false, false);
|
|
15489
15478
|
}
|
|
15490
15479
|
this.checkGetterSetterParams(publicMethod);
|
|
15491
|
-
} else if (
|
|
15480
|
+
} else if (maybeContextualKw === "accessor" && !this.isLineTerminator()) {
|
|
15492
15481
|
this.expectPlugin("decoratorAutoAccessors");
|
|
15493
15482
|
this.resetPreviousNodeTrailingComments(key);
|
|
15494
15483
|
const isPrivate = this.match(138);
|
|
@@ -15520,7 +15509,8 @@ class StatementParser extends ExpressionParser {
|
|
|
15520
15509
|
member.key = key;
|
|
15521
15510
|
return key;
|
|
15522
15511
|
}
|
|
15523
|
-
|
|
15512
|
+
this.parsePropertyName(member);
|
|
15513
|
+
return member.key;
|
|
15524
15514
|
}
|
|
15525
15515
|
parseClassStaticBlock(classBody, member) {
|
|
15526
15516
|
var _member$decorators;
|
|
@@ -15539,7 +15529,7 @@ class StatementParser extends ExpressionParser {
|
|
|
15539
15529
|
}
|
|
15540
15530
|
}
|
|
15541
15531
|
pushClassProperty(classBody, prop) {
|
|
15542
|
-
if (!prop.computed && (prop.key
|
|
15532
|
+
if (!prop.computed && this.nameIsConstructor(prop.key)) {
|
|
15543
15533
|
this.raise(Errors.ConstructorClassField, prop.key);
|
|
15544
15534
|
}
|
|
15545
15535
|
classBody.body.push(this.parseClassProperty(prop));
|
|
@@ -15550,11 +15540,8 @@ class StatementParser extends ExpressionParser {
|
|
|
15550
15540
|
this.classScope.declarePrivateName(this.getPrivateNameSV(node.key), 0, node.key.loc.start);
|
|
15551
15541
|
}
|
|
15552
15542
|
pushClassAccessorProperty(classBody, prop, isPrivate) {
|
|
15553
|
-
if (!isPrivate && !prop.computed) {
|
|
15554
|
-
|
|
15555
|
-
if (key.name === "constructor" || key.value === "constructor") {
|
|
15556
|
-
this.raise(Errors.ConstructorClassField, key);
|
|
15557
|
-
}
|
|
15543
|
+
if (!isPrivate && !prop.computed && this.nameIsConstructor(prop.key)) {
|
|
15544
|
+
this.raise(Errors.ConstructorClassField, prop.key);
|
|
15558
15545
|
}
|
|
15559
15546
|
const node = this.parseClassAccessorProperty(prop);
|
|
15560
15547
|
classBody.body.push(node);
|
|
@@ -15690,7 +15677,8 @@ class StatementParser extends ExpressionParser {
|
|
|
15690
15677
|
}
|
|
15691
15678
|
maybeParseExportNamespaceSpecifier(node) {
|
|
15692
15679
|
if (this.isContextual(93)) {
|
|
15693
|
-
|
|
15680
|
+
var _ref, _ref$specifiers;
|
|
15681
|
+
(_ref$specifiers = (_ref = node).specifiers) != null ? _ref$specifiers : _ref.specifiers = [];
|
|
15694
15682
|
const specifier = this.startNodeAt(this.state.lastTokStartLoc);
|
|
15695
15683
|
this.next();
|
|
15696
15684
|
specifier.exported = this.parseModuleExportName();
|
|
@@ -15701,13 +15689,14 @@ class StatementParser extends ExpressionParser {
|
|
|
15701
15689
|
}
|
|
15702
15690
|
maybeParseExportNamedSpecifiers(node) {
|
|
15703
15691
|
if (this.match(5)) {
|
|
15704
|
-
|
|
15705
|
-
|
|
15706
|
-
|
|
15707
|
-
|
|
15708
|
-
|
|
15692
|
+
const node2 = node;
|
|
15693
|
+
if (!node2.specifiers) node2.specifiers = [];
|
|
15694
|
+
const isTypeExport = node2.exportKind === "type";
|
|
15695
|
+
node2.specifiers.push(...this.parseExportSpecifiers(isTypeExport));
|
|
15696
|
+
node2.source = null;
|
|
15697
|
+
node2.declaration = null;
|
|
15709
15698
|
if (this.hasPlugin("importAssertions")) {
|
|
15710
|
-
|
|
15699
|
+
node2.assertions = [];
|
|
15711
15700
|
}
|
|
15712
15701
|
return true;
|
|
15713
15702
|
}
|
|
@@ -15818,6 +15807,14 @@ class StatementParser extends ExpressionParser {
|
|
|
15818
15807
|
return true;
|
|
15819
15808
|
}
|
|
15820
15809
|
}
|
|
15810
|
+
if (this.isContextual(107)) {
|
|
15811
|
+
this.raise(Errors.UsingDeclarationExport, this.state.startLoc);
|
|
15812
|
+
return true;
|
|
15813
|
+
}
|
|
15814
|
+
if (this.isContextual(96) && this.startsAwaitUsing()) {
|
|
15815
|
+
this.raise(Errors.UsingDeclarationExport, this.state.startLoc);
|
|
15816
|
+
return true;
|
|
15817
|
+
}
|
|
15821
15818
|
return type === 74 || type === 75 || type === 68 || type === 80 || this.isLet() || this.isAsyncFunction();
|
|
15822
15819
|
}
|
|
15823
15820
|
checkExport(node, checkNames, isDefault, isFrom) {
|
|
@@ -15855,12 +15852,15 @@ class StatementParser extends ExpressionParser {
|
|
|
15855
15852
|
}
|
|
15856
15853
|
}
|
|
15857
15854
|
} else if (node.declaration) {
|
|
15858
|
-
|
|
15859
|
-
|
|
15855
|
+
const decl = node.declaration;
|
|
15856
|
+
if (decl.type === "FunctionDeclaration" || decl.type === "ClassDeclaration") {
|
|
15857
|
+
const {
|
|
15858
|
+
id
|
|
15859
|
+
} = decl;
|
|
15860
15860
|
if (!id) throw new Error("Assertion failure");
|
|
15861
15861
|
this.checkDuplicateExports(node, id.name);
|
|
15862
|
-
} else if (
|
|
15863
|
-
for (const declaration of
|
|
15862
|
+
} else if (decl.type === "VariableDeclaration") {
|
|
15863
|
+
for (const declaration of decl.declarations) {
|
|
15864
15864
|
this.checkDeclaration(declaration.id);
|
|
15865
15865
|
}
|
|
15866
15866
|
}
|
|
@@ -16570,7 +16570,8 @@ function walkIdentifiers(root, onIdentifier, includeAll = false, parentStack = [
|
|
|
16570
16570
|
if (includeAll || isRefed && !isLocal) {
|
|
16571
16571
|
onIdentifier(node, parent, parentStack, isRefed, isLocal);
|
|
16572
16572
|
}
|
|
16573
|
-
} else if (node.type === "ObjectProperty" &&
|
|
16573
|
+
} else if (node.type === "ObjectProperty" && // eslint-disable-next-line no-restricted-syntax
|
|
16574
|
+
(parent == null ? void 0 : parent.type) === "ObjectPattern") {
|
|
16574
16575
|
node.inPattern = true;
|
|
16575
16576
|
} else if (isFunctionType(node)) {
|
|
16576
16577
|
if (node.scopeIds) {
|
|
@@ -16661,16 +16662,14 @@ function walkFunctionParams(node, onIdent) {
|
|
|
16661
16662
|
function walkBlockDeclarations(block, onIdent) {
|
|
16662
16663
|
for (const stmt of block.body) {
|
|
16663
16664
|
if (stmt.type === "VariableDeclaration") {
|
|
16664
|
-
if (stmt.declare)
|
|
16665
|
-
continue;
|
|
16665
|
+
if (stmt.declare) continue;
|
|
16666
16666
|
for (const decl of stmt.declarations) {
|
|
16667
16667
|
for (const id of extractIdentifiers$1(decl.id)) {
|
|
16668
16668
|
onIdent(id);
|
|
16669
16669
|
}
|
|
16670
16670
|
}
|
|
16671
16671
|
} else if (stmt.type === "FunctionDeclaration" || stmt.type === "ClassDeclaration") {
|
|
16672
|
-
if (stmt.declare || !stmt.id)
|
|
16673
|
-
continue;
|
|
16672
|
+
if (stmt.declare || !stmt.id) continue;
|
|
16674
16673
|
onIdent(stmt.id);
|
|
16675
16674
|
} else if (stmt.type === "ForOfStatement" || stmt.type === "ForInStatement" || stmt.type === "ForStatement") {
|
|
16676
16675
|
const variable = stmt.type === "ForStatement" ? stmt.init : stmt.left;
|
|
@@ -16707,8 +16706,7 @@ function extractIdentifiers$1(param, nodes = []) {
|
|
|
16707
16706
|
break;
|
|
16708
16707
|
case "ArrayPattern":
|
|
16709
16708
|
param.elements.forEach((element) => {
|
|
16710
|
-
if (element)
|
|
16711
|
-
extractIdentifiers$1(element, nodes);
|
|
16709
|
+
if (element) extractIdentifiers$1(element, nodes);
|
|
16712
16710
|
});
|
|
16713
16711
|
break;
|
|
16714
16712
|
case "RestElement":
|
|
@@ -16861,7 +16859,7 @@ function isCoreComponent(tag) {
|
|
|
16861
16859
|
return BASE_TRANSITION;
|
|
16862
16860
|
}
|
|
16863
16861
|
}
|
|
16864
|
-
const nonIdentifierRE = /^\d|[^\$\w]/;
|
|
16862
|
+
const nonIdentifierRE = /^\d|[^\$\w\xA0-\uFFFF]/;
|
|
16865
16863
|
const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
|
|
16866
16864
|
const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
|
|
16867
16865
|
const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
|
|
@@ -16982,8 +16980,7 @@ function findProp(node, name, dynamicOnly = false, allowEmpty = false) {
|
|
|
16982
16980
|
for (let i = 0; i < node.props.length; i++) {
|
|
16983
16981
|
const p = node.props[i];
|
|
16984
16982
|
if (p.type === 6) {
|
|
16985
|
-
if (dynamicOnly)
|
|
16986
|
-
continue;
|
|
16983
|
+
if (dynamicOnly) continue;
|
|
16987
16984
|
if (p.name === name && (p.value || allowEmpty)) {
|
|
16988
16985
|
return p;
|
|
16989
16986
|
}
|
|
@@ -17147,7 +17144,7 @@ function getMemoedVNodeCall(node) {
|
|
|
17147
17144
|
return node;
|
|
17148
17145
|
}
|
|
17149
17146
|
}
|
|
17150
|
-
const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
|
|
17147
|
+
const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+(\S[\s\S]*)/;
|
|
17151
17148
|
|
|
17152
17149
|
const defaultParserOptions = {
|
|
17153
17150
|
parseMode: "base",
|
|
@@ -17300,8 +17297,7 @@ const tokenizer$2 = new Tokenizer$1(stack, {
|
|
|
17300
17297
|
}
|
|
17301
17298
|
},
|
|
17302
17299
|
ondirarg(start, end) {
|
|
17303
|
-
if (start === end)
|
|
17304
|
-
return;
|
|
17300
|
+
if (start === end) return;
|
|
17305
17301
|
const arg = getSlice(start, end);
|
|
17306
17302
|
if (inVPre) {
|
|
17307
17303
|
currentProp.name += arg;
|
|
@@ -17333,14 +17329,12 @@ const tokenizer$2 = new Tokenizer$1(stack, {
|
|
|
17333
17329
|
},
|
|
17334
17330
|
onattribdata(start, end) {
|
|
17335
17331
|
currentAttrValue += getSlice(start, end);
|
|
17336
|
-
if (currentAttrStartIndex < 0)
|
|
17337
|
-
currentAttrStartIndex = start;
|
|
17332
|
+
if (currentAttrStartIndex < 0) currentAttrStartIndex = start;
|
|
17338
17333
|
currentAttrEndIndex = end;
|
|
17339
17334
|
},
|
|
17340
17335
|
onattribentity(char, start, end) {
|
|
17341
17336
|
currentAttrValue += char;
|
|
17342
|
-
if (currentAttrStartIndex < 0)
|
|
17343
|
-
currentAttrStartIndex = start;
|
|
17337
|
+
if (currentAttrStartIndex < 0) currentAttrStartIndex = start;
|
|
17344
17338
|
currentAttrEndIndex = end;
|
|
17345
17339
|
},
|
|
17346
17340
|
onattribnameend(end) {
|
|
@@ -17480,8 +17474,7 @@ function parseForExpression(input) {
|
|
|
17480
17474
|
const loc = input.loc;
|
|
17481
17475
|
const exp = input.content;
|
|
17482
17476
|
const inMatch = exp.match(forAliasRE);
|
|
17483
|
-
if (!inMatch)
|
|
17484
|
-
return;
|
|
17477
|
+
if (!inMatch) return;
|
|
17485
17478
|
const [, LHS, RHS] = inMatch;
|
|
17486
17479
|
const createAliasExpression = (content, offset, asParam = false) => {
|
|
17487
17480
|
const start = loc.start.offset + offset;
|
|
@@ -17610,14 +17603,12 @@ function onCloseTag(el, end, isImplied = false) {
|
|
|
17610
17603
|
}
|
|
17611
17604
|
function lookAhead(index, c) {
|
|
17612
17605
|
let i = index;
|
|
17613
|
-
while (currentInput.charCodeAt(i) !== c && i < currentInput.length - 1)
|
|
17614
|
-
i++;
|
|
17606
|
+
while (currentInput.charCodeAt(i) !== c && i < currentInput.length - 1) i++;
|
|
17615
17607
|
return i;
|
|
17616
17608
|
}
|
|
17617
17609
|
function backTrack(index, c) {
|
|
17618
17610
|
let i = index;
|
|
17619
|
-
while (currentInput.charCodeAt(i) !== c && i >= 0)
|
|
17620
|
-
i--;
|
|
17611
|
+
while (currentInput.charCodeAt(i) !== c && i >= 0) i--;
|
|
17621
17612
|
return i;
|
|
17622
17613
|
}
|
|
17623
17614
|
const specialTemplateDir = /* @__PURE__ */ new Set(["if", "else", "else-if", "for", "slot"]);
|
|
@@ -17929,7 +17920,7 @@ function getConstantType(node, context) {
|
|
|
17929
17920
|
if (codegenNode.type !== 13) {
|
|
17930
17921
|
return 0;
|
|
17931
17922
|
}
|
|
17932
|
-
if (codegenNode.isBlock && node.tag !== "svg" && node.tag !== "foreignObject") {
|
|
17923
|
+
if (codegenNode.isBlock && node.tag !== "svg" && node.tag !== "foreignObject" && node.tag !== "math") {
|
|
17933
17924
|
return 0;
|
|
17934
17925
|
}
|
|
17935
17926
|
const flag = getPatchFlag(codegenNode);
|
|
@@ -18227,8 +18218,7 @@ function createTransformContext(root, {
|
|
|
18227
18218
|
}
|
|
18228
18219
|
},
|
|
18229
18220
|
hoist(exp) {
|
|
18230
|
-
if (isString$2(exp))
|
|
18231
|
-
exp = createSimpleExpression(exp);
|
|
18221
|
+
if (isString$2(exp)) exp = createSimpleExpression(exp);
|
|
18232
18222
|
context.hoists.push(exp);
|
|
18233
18223
|
const identifier = createSimpleExpression(
|
|
18234
18224
|
`_hoisted_${context.hoists.length}`,
|
|
@@ -18315,8 +18305,7 @@ function traverseChildren(parent, context) {
|
|
|
18315
18305
|
};
|
|
18316
18306
|
for (; i < parent.children.length; i++) {
|
|
18317
18307
|
const child = parent.children[i];
|
|
18318
|
-
if (isString$2(child))
|
|
18319
|
-
continue;
|
|
18308
|
+
if (isString$2(child)) continue;
|
|
18320
18309
|
context.grandParent = context.parent;
|
|
18321
18310
|
context.parent = parent;
|
|
18322
18311
|
context.childIndex = i;
|
|
@@ -18387,8 +18376,7 @@ function createStructuralDirectiveTransform(name, fn) {
|
|
|
18387
18376
|
props.splice(i, 1);
|
|
18388
18377
|
i--;
|
|
18389
18378
|
const onExit = fn(node, prop, context);
|
|
18390
|
-
if (onExit)
|
|
18391
|
-
exitFns.push(onExit);
|
|
18379
|
+
if (onExit) exitFns.push(onExit);
|
|
18392
18380
|
}
|
|
18393
18381
|
}
|
|
18394
18382
|
return exitFns;
|
|
@@ -21827,8 +21815,7 @@ function createCodegenContext(ast, {
|
|
|
21827
21815
|
}
|
|
21828
21816
|
function addMapping(loc, name = null) {
|
|
21829
21817
|
const { _names, _mappings } = context.map;
|
|
21830
|
-
if (name !== null && !_names.has(name))
|
|
21831
|
-
_names.add(name);
|
|
21818
|
+
if (name !== null && !_names.has(name)) _names.add(name);
|
|
21832
21819
|
_mappings.add({
|
|
21833
21820
|
originalLine: loc.line,
|
|
21834
21821
|
originalColumn: loc.column - 1,
|
|
@@ -21848,8 +21835,7 @@ function createCodegenContext(ast, {
|
|
|
21848
21835
|
}
|
|
21849
21836
|
function generate(ast, options = {}) {
|
|
21850
21837
|
const context = createCodegenContext(ast, options);
|
|
21851
|
-
if (options.onContextCreated)
|
|
21852
|
-
options.onContextCreated(context);
|
|
21838
|
+
if (options.onContextCreated) options.onContextCreated(context);
|
|
21853
21839
|
const {
|
|
21854
21840
|
mode,
|
|
21855
21841
|
push,
|
|
@@ -22064,8 +22050,9 @@ function genHoists(hoists, context) {
|
|
|
22064
22050
|
const genScopeId = scopeId != null && mode !== "function";
|
|
22065
22051
|
newline();
|
|
22066
22052
|
if (genScopeId) {
|
|
22053
|
+
const param = context.isTS ? "(n: any)" : "n";
|
|
22067
22054
|
push(
|
|
22068
|
-
`const _withScopeId =
|
|
22055
|
+
`const _withScopeId = ${param} => (${helper(
|
|
22069
22056
|
PUSH_SCOPE_ID
|
|
22070
22057
|
)}("${scopeId}"),n=n(),${helper(POP_SCOPE_ID)}(),n)`
|
|
22071
22058
|
);
|
|
@@ -22229,8 +22216,7 @@ function genExpression(node, context) {
|
|
|
22229
22216
|
}
|
|
22230
22217
|
function genInterpolation(node, context) {
|
|
22231
22218
|
const { push, helper, pure } = context;
|
|
22232
|
-
if (pure)
|
|
22233
|
-
push(PURE_ANNOTATION);
|
|
22219
|
+
if (pure) push(PURE_ANNOTATION);
|
|
22234
22220
|
push(`${helper(TO_DISPLAY_STRING)}(`);
|
|
22235
22221
|
genNode(node.content, context);
|
|
22236
22222
|
push(`)`);
|
|
@@ -22310,8 +22296,7 @@ function genVNodeCall(node, context) {
|
|
|
22310
22296
|
function genNullableArgs(args) {
|
|
22311
22297
|
let i = args.length;
|
|
22312
22298
|
while (i--) {
|
|
22313
|
-
if (args[i] != null)
|
|
22314
|
-
break;
|
|
22299
|
+
if (args[i] != null) break;
|
|
22315
22300
|
}
|
|
22316
22301
|
return args.slice(0, i + 1).map((arg) => arg || `null`);
|
|
22317
22302
|
}
|
|
@@ -22454,11 +22439,9 @@ function genTemplateLiteral(node, context) {
|
|
|
22454
22439
|
push(e.replace(/(`|\$|\\)/g, "\\$1"), -3 /* Unknown */);
|
|
22455
22440
|
} else {
|
|
22456
22441
|
push("${");
|
|
22457
|
-
if (multilines)
|
|
22458
|
-
indent();
|
|
22442
|
+
if (multilines) indent();
|
|
22459
22443
|
genNode(e, context);
|
|
22460
|
-
if (multilines)
|
|
22461
|
-
deindent();
|
|
22444
|
+
if (multilines) deindent();
|
|
22462
22445
|
push("}");
|
|
22463
22446
|
}
|
|
22464
22447
|
}
|
|
@@ -22829,8 +22812,7 @@ function processIf(node, dir, context, processCodegen) {
|
|
|
22829
22812
|
sibling.branches.push(branch);
|
|
22830
22813
|
const onExit = processCodegen && processCodegen(sibling, branch, false);
|
|
22831
22814
|
traverseNode(branch, context);
|
|
22832
|
-
if (onExit)
|
|
22833
|
-
onExit();
|
|
22815
|
+
if (onExit) onExit();
|
|
22834
22816
|
context.currentNode = null;
|
|
22835
22817
|
} else {
|
|
22836
22818
|
context.onError(
|
|
@@ -22952,6 +22934,90 @@ function getParentCondition(node) {
|
|
|
22952
22934
|
}
|
|
22953
22935
|
}
|
|
22954
22936
|
|
|
22937
|
+
const transformBind = (dir, _node, context) => {
|
|
22938
|
+
const { modifiers, loc } = dir;
|
|
22939
|
+
const arg = dir.arg;
|
|
22940
|
+
let { exp } = dir;
|
|
22941
|
+
if (exp && exp.type === 4 && !exp.content.trim()) {
|
|
22942
|
+
{
|
|
22943
|
+
context.onError(
|
|
22944
|
+
createCompilerError(34, loc)
|
|
22945
|
+
);
|
|
22946
|
+
return {
|
|
22947
|
+
props: [
|
|
22948
|
+
createObjectProperty(arg, createSimpleExpression("", true, loc))
|
|
22949
|
+
]
|
|
22950
|
+
};
|
|
22951
|
+
}
|
|
22952
|
+
}
|
|
22953
|
+
if (!exp) {
|
|
22954
|
+
if (arg.type !== 4 || !arg.isStatic) {
|
|
22955
|
+
context.onError(
|
|
22956
|
+
createCompilerError(
|
|
22957
|
+
52,
|
|
22958
|
+
arg.loc
|
|
22959
|
+
)
|
|
22960
|
+
);
|
|
22961
|
+
return {
|
|
22962
|
+
props: [
|
|
22963
|
+
createObjectProperty(arg, createSimpleExpression("", true, loc))
|
|
22964
|
+
]
|
|
22965
|
+
};
|
|
22966
|
+
}
|
|
22967
|
+
transformBindShorthand(dir, context);
|
|
22968
|
+
exp = dir.exp;
|
|
22969
|
+
}
|
|
22970
|
+
if (arg.type !== 4) {
|
|
22971
|
+
arg.children.unshift(`(`);
|
|
22972
|
+
arg.children.push(`) || ""`);
|
|
22973
|
+
} else if (!arg.isStatic) {
|
|
22974
|
+
arg.content = `${arg.content} || ""`;
|
|
22975
|
+
}
|
|
22976
|
+
if (modifiers.includes("camel")) {
|
|
22977
|
+
if (arg.type === 4) {
|
|
22978
|
+
if (arg.isStatic) {
|
|
22979
|
+
arg.content = camelize(arg.content);
|
|
22980
|
+
} else {
|
|
22981
|
+
arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
|
|
22982
|
+
}
|
|
22983
|
+
} else {
|
|
22984
|
+
arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
|
|
22985
|
+
arg.children.push(`)`);
|
|
22986
|
+
}
|
|
22987
|
+
}
|
|
22988
|
+
if (!context.inSSR) {
|
|
22989
|
+
if (modifiers.includes("prop")) {
|
|
22990
|
+
injectPrefix(arg, ".");
|
|
22991
|
+
}
|
|
22992
|
+
if (modifiers.includes("attr")) {
|
|
22993
|
+
injectPrefix(arg, "^");
|
|
22994
|
+
}
|
|
22995
|
+
}
|
|
22996
|
+
return {
|
|
22997
|
+
props: [createObjectProperty(arg, exp)]
|
|
22998
|
+
};
|
|
22999
|
+
};
|
|
23000
|
+
const transformBindShorthand = (dir, context) => {
|
|
23001
|
+
const arg = dir.arg;
|
|
23002
|
+
const propName = camelize(arg.content);
|
|
23003
|
+
dir.exp = createSimpleExpression(propName, false, arg.loc);
|
|
23004
|
+
{
|
|
23005
|
+
dir.exp = processExpression(dir.exp, context);
|
|
23006
|
+
}
|
|
23007
|
+
};
|
|
23008
|
+
const injectPrefix = (arg, prefix) => {
|
|
23009
|
+
if (arg.type === 4) {
|
|
23010
|
+
if (arg.isStatic) {
|
|
23011
|
+
arg.content = prefix + arg.content;
|
|
23012
|
+
} else {
|
|
23013
|
+
arg.content = `\`${prefix}\${${arg.content}}\``;
|
|
23014
|
+
}
|
|
23015
|
+
} else {
|
|
23016
|
+
arg.children.unshift(`'${prefix}' + (`);
|
|
23017
|
+
arg.children.push(`)`);
|
|
23018
|
+
}
|
|
23019
|
+
};
|
|
23020
|
+
|
|
22955
23021
|
const transformFor = createStructuralDirectiveTransform(
|
|
22956
23022
|
"for",
|
|
22957
23023
|
(node, dir, context) => {
|
|
@@ -22962,9 +23028,12 @@ const transformFor = createStructuralDirectiveTransform(
|
|
|
22962
23028
|
]);
|
|
22963
23029
|
const isTemplate = isTemplateNode(node);
|
|
22964
23030
|
const memo = findDir(node, "memo");
|
|
22965
|
-
const keyProp = findProp(node, `key
|
|
22966
|
-
|
|
22967
|
-
|
|
23031
|
+
const keyProp = findProp(node, `key`, false, true);
|
|
23032
|
+
if (keyProp && keyProp.type === 7 && !keyProp.exp) {
|
|
23033
|
+
transformBindShorthand(keyProp, context);
|
|
23034
|
+
}
|
|
23035
|
+
const keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
|
|
23036
|
+
const keyProperty = keyProp && keyExp ? createObjectProperty(`key`, keyExp) : null;
|
|
22968
23037
|
if (isTemplate) {
|
|
22969
23038
|
if (memo) {
|
|
22970
23039
|
memo.exp = processExpression(
|
|
@@ -23137,13 +23206,11 @@ function processFor(node, dir, context, processCodegen) {
|
|
|
23137
23206
|
key && removeIdentifiers(key);
|
|
23138
23207
|
index && removeIdentifiers(index);
|
|
23139
23208
|
}
|
|
23140
|
-
if (onExit)
|
|
23141
|
-
onExit();
|
|
23209
|
+
if (onExit) onExit();
|
|
23142
23210
|
};
|
|
23143
23211
|
}
|
|
23144
23212
|
function finalizeForParseResult(result, context) {
|
|
23145
|
-
if (result.finalized)
|
|
23146
|
-
return;
|
|
23213
|
+
if (result.finalized) return;
|
|
23147
23214
|
if (context.prefixIdentifiers) {
|
|
23148
23215
|
result.source = processExpression(
|
|
23149
23216
|
result.source,
|
|
@@ -23179,8 +23246,7 @@ function createForLoopParams({ value, key, index }, memoArgs = []) {
|
|
|
23179
23246
|
function createParamsList(args) {
|
|
23180
23247
|
let i = args.length;
|
|
23181
23248
|
while (i--) {
|
|
23182
|
-
if (args[i])
|
|
23183
|
-
break;
|
|
23249
|
+
if (args[i]) break;
|
|
23184
23250
|
}
|
|
23185
23251
|
return args.slice(0, i + 1).map((arg, i2) => arg || createSimpleExpression(`_`.repeat(i2 + 1), false));
|
|
23186
23252
|
}
|
|
@@ -23448,13 +23514,11 @@ function hasForwardedSlots(children) {
|
|
|
23448
23514
|
}
|
|
23449
23515
|
break;
|
|
23450
23516
|
case 9:
|
|
23451
|
-
if (hasForwardedSlots(child.branches))
|
|
23452
|
-
return true;
|
|
23517
|
+
if (hasForwardedSlots(child.branches)) return true;
|
|
23453
23518
|
break;
|
|
23454
23519
|
case 10:
|
|
23455
23520
|
case 11:
|
|
23456
|
-
if (hasForwardedSlots(child.children))
|
|
23457
|
-
return true;
|
|
23521
|
+
if (hasForwardedSlots(child.children)) return true;
|
|
23458
23522
|
break;
|
|
23459
23523
|
}
|
|
23460
23524
|
}
|
|
@@ -23490,7 +23554,7 @@ const transformElement = (node, context) => {
|
|
|
23490
23554
|
// updates inside get proper isSVG flag at runtime. (#639, #643)
|
|
23491
23555
|
// This is technically web-specific, but splitting the logic out of core
|
|
23492
23556
|
// leads to too much unnecessary complexity.
|
|
23493
|
-
(tag === "svg" || tag === "foreignObject")
|
|
23557
|
+
(tag === "svg" || tag === "foreignObject" || tag === "math")
|
|
23494
23558
|
);
|
|
23495
23559
|
if (props.length > 0) {
|
|
23496
23560
|
const propsBuildResult = buildProps(
|
|
@@ -23613,8 +23677,7 @@ function resolveComponentType(node, context, ssr = false) {
|
|
|
23613
23677
|
}
|
|
23614
23678
|
const builtIn = isCoreComponent(tag) || context.isBuiltInComponent(tag);
|
|
23615
23679
|
if (builtIn) {
|
|
23616
|
-
if (!ssr)
|
|
23617
|
-
context.helper(builtIn);
|
|
23680
|
+
if (!ssr) context.helper(builtIn);
|
|
23618
23681
|
return builtIn;
|
|
23619
23682
|
}
|
|
23620
23683
|
{
|
|
@@ -23698,8 +23761,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
23698
23761
|
);
|
|
23699
23762
|
properties = [];
|
|
23700
23763
|
}
|
|
23701
|
-
if (arg)
|
|
23702
|
-
mergeArgs.push(arg);
|
|
23764
|
+
if (arg) mergeArgs.push(arg);
|
|
23703
23765
|
};
|
|
23704
23766
|
const pushRefVForMarker = () => {
|
|
23705
23767
|
if (context.scopes.vFor > 0) {
|
|
@@ -24015,8 +24077,7 @@ function buildDirectiveArgs(dir, context) {
|
|
|
24015
24077
|
}
|
|
24016
24078
|
}
|
|
24017
24079
|
const { loc } = dir;
|
|
24018
|
-
if (dir.exp)
|
|
24019
|
-
dirArgs.push(dir.exp);
|
|
24080
|
+
if (dir.exp) dirArgs.push(dir.exp);
|
|
24020
24081
|
if (dir.arg) {
|
|
24021
24082
|
if (!dir.exp) {
|
|
24022
24083
|
dirArgs.push(`void 0`);
|
|
@@ -24046,8 +24107,7 @@ function stringifyDynamicPropNames(props) {
|
|
|
24046
24107
|
let propsNamesString = `[`;
|
|
24047
24108
|
for (let i = 0, l = props.length; i < l; i++) {
|
|
24048
24109
|
propsNamesString += JSON.stringify(props[i]);
|
|
24049
|
-
if (i < l - 1)
|
|
24050
|
-
propsNamesString += ", ";
|
|
24110
|
+
if (i < l - 1) propsNamesString += ", ";
|
|
24051
24111
|
}
|
|
24052
24112
|
return propsNamesString + `]`;
|
|
24053
24113
|
}
|
|
@@ -24144,7 +24204,7 @@ function processSlotOutlet(node, context) {
|
|
|
24144
24204
|
};
|
|
24145
24205
|
}
|
|
24146
24206
|
|
|
24147
|
-
const fnExpRE = /^\s*(
|
|
24207
|
+
const fnExpRE = /^\s*(async\s*)?(\([^)]*?\)|[\w$_]+)\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
|
|
24148
24208
|
const transformOn$1 = (dir, node, context, augmentor) => {
|
|
24149
24209
|
const { loc, modifiers, arg } = dir;
|
|
24150
24210
|
if (!dir.exp && !modifiers.length) {
|
|
@@ -24247,85 +24307,6 @@ const transformOn$1 = (dir, node, context, augmentor) => {
|
|
|
24247
24307
|
return ret;
|
|
24248
24308
|
};
|
|
24249
24309
|
|
|
24250
|
-
const transformBind = (dir, _node, context) => {
|
|
24251
|
-
const { modifiers, loc } = dir;
|
|
24252
|
-
const arg = dir.arg;
|
|
24253
|
-
let { exp } = dir;
|
|
24254
|
-
if (exp && exp.type === 4 && !exp.content.trim()) {
|
|
24255
|
-
{
|
|
24256
|
-
context.onError(
|
|
24257
|
-
createCompilerError(34, loc)
|
|
24258
|
-
);
|
|
24259
|
-
return {
|
|
24260
|
-
props: [
|
|
24261
|
-
createObjectProperty(arg, createSimpleExpression("", true, loc))
|
|
24262
|
-
]
|
|
24263
|
-
};
|
|
24264
|
-
}
|
|
24265
|
-
}
|
|
24266
|
-
if (!exp) {
|
|
24267
|
-
if (arg.type !== 4 || !arg.isStatic) {
|
|
24268
|
-
context.onError(
|
|
24269
|
-
createCompilerError(
|
|
24270
|
-
52,
|
|
24271
|
-
arg.loc
|
|
24272
|
-
)
|
|
24273
|
-
);
|
|
24274
|
-
return {
|
|
24275
|
-
props: [
|
|
24276
|
-
createObjectProperty(arg, createSimpleExpression("", true, loc))
|
|
24277
|
-
]
|
|
24278
|
-
};
|
|
24279
|
-
}
|
|
24280
|
-
const propName = camelize(arg.content);
|
|
24281
|
-
exp = dir.exp = createSimpleExpression(propName, false, arg.loc);
|
|
24282
|
-
{
|
|
24283
|
-
exp = dir.exp = processExpression(exp, context);
|
|
24284
|
-
}
|
|
24285
|
-
}
|
|
24286
|
-
if (arg.type !== 4) {
|
|
24287
|
-
arg.children.unshift(`(`);
|
|
24288
|
-
arg.children.push(`) || ""`);
|
|
24289
|
-
} else if (!arg.isStatic) {
|
|
24290
|
-
arg.content = `${arg.content} || ""`;
|
|
24291
|
-
}
|
|
24292
|
-
if (modifiers.includes("camel")) {
|
|
24293
|
-
if (arg.type === 4) {
|
|
24294
|
-
if (arg.isStatic) {
|
|
24295
|
-
arg.content = camelize(arg.content);
|
|
24296
|
-
} else {
|
|
24297
|
-
arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
|
|
24298
|
-
}
|
|
24299
|
-
} else {
|
|
24300
|
-
arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
|
|
24301
|
-
arg.children.push(`)`);
|
|
24302
|
-
}
|
|
24303
|
-
}
|
|
24304
|
-
if (!context.inSSR) {
|
|
24305
|
-
if (modifiers.includes("prop")) {
|
|
24306
|
-
injectPrefix(arg, ".");
|
|
24307
|
-
}
|
|
24308
|
-
if (modifiers.includes("attr")) {
|
|
24309
|
-
injectPrefix(arg, "^");
|
|
24310
|
-
}
|
|
24311
|
-
}
|
|
24312
|
-
return {
|
|
24313
|
-
props: [createObjectProperty(arg, exp)]
|
|
24314
|
-
};
|
|
24315
|
-
};
|
|
24316
|
-
const injectPrefix = (arg, prefix) => {
|
|
24317
|
-
if (arg.type === 4) {
|
|
24318
|
-
if (arg.isStatic) {
|
|
24319
|
-
arg.content = prefix + arg.content;
|
|
24320
|
-
} else {
|
|
24321
|
-
arg.content = `\`${prefix}\${${arg.content}}\``;
|
|
24322
|
-
}
|
|
24323
|
-
} else {
|
|
24324
|
-
arg.children.unshift(`'${prefix}' + (`);
|
|
24325
|
-
arg.children.push(`)`);
|
|
24326
|
-
}
|
|
24327
|
-
};
|
|
24328
|
-
|
|
24329
24310
|
const transformText = (node, context) => {
|
|
24330
24311
|
if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) {
|
|
24331
24312
|
return () => {
|
|
@@ -24944,8 +24925,7 @@ const transformClick = (key, event) => {
|
|
|
24944
24925
|
const transformOn = (dir, node, context) => {
|
|
24945
24926
|
return transformOn$1(dir, node, context, (baseResult) => {
|
|
24946
24927
|
const { modifiers } = dir;
|
|
24947
|
-
if (!modifiers.length)
|
|
24948
|
-
return baseResult;
|
|
24928
|
+
if (!modifiers.length) return baseResult;
|
|
24949
24929
|
let { key, value: handlerExp } = baseResult.props[0];
|
|
24950
24930
|
const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(key, modifiers, context, dir.loc);
|
|
24951
24931
|
if (nonKeyModifiers.includes("right")) {
|
|
@@ -25114,6 +25094,7 @@ function analyzeNode(node) {
|
|
|
25114
25094
|
return false;
|
|
25115
25095
|
};
|
|
25116
25096
|
function walk(node2) {
|
|
25097
|
+
const isOptionTag = node2.tag === "option" && node2.ns === 0;
|
|
25117
25098
|
for (let i = 0; i < node2.props.length; i++) {
|
|
25118
25099
|
const p = node2.props[i];
|
|
25119
25100
|
if (p.type === 6 && !isStringifiableAttr(p.name, node2.ns)) {
|
|
@@ -25126,6 +25107,9 @@ function analyzeNode(node) {
|
|
|
25126
25107
|
if (p.exp && (p.exp.type === 8 || p.exp.constType < 3)) {
|
|
25127
25108
|
return bail();
|
|
25128
25109
|
}
|
|
25110
|
+
if (isOptionTag && isStaticArgOf(p.arg, "value") && p.exp && p.exp.ast && p.exp.ast.type !== "StringLiteral") {
|
|
25111
|
+
return bail();
|
|
25112
|
+
}
|
|
25129
25113
|
}
|
|
25130
25114
|
}
|
|
25131
25115
|
for (let i = 0; i < node2.children.length; i++) {
|
|
@@ -25712,8 +25696,7 @@ function resolveObjectKey(node, computed) {
|
|
|
25712
25696
|
case "NumericLiteral":
|
|
25713
25697
|
return String(node.value);
|
|
25714
25698
|
case "Identifier":
|
|
25715
|
-
if (!computed)
|
|
25716
|
-
return node.name;
|
|
25699
|
+
if (!computed) return node.name;
|
|
25717
25700
|
}
|
|
25718
25701
|
return void 0;
|
|
25719
25702
|
}
|
|
@@ -25732,8 +25715,7 @@ function toRuntimeTypeString(types) {
|
|
|
25732
25715
|
function getImportedName(specifier) {
|
|
25733
25716
|
if (specifier.type === "ImportSpecifier")
|
|
25734
25717
|
return specifier.imported.type === "Identifier" ? specifier.imported.name : specifier.imported.value;
|
|
25735
|
-
else if (specifier.type === "ImportNamespaceSpecifier")
|
|
25736
|
-
return "*";
|
|
25718
|
+
else if (specifier.type === "ImportNamespaceSpecifier") return "*";
|
|
25737
25719
|
return "default";
|
|
25738
25720
|
}
|
|
25739
25721
|
function getId(node) {
|
|
@@ -26100,8 +26082,8 @@ Item.prototype.run = function () {
|
|
|
26100
26082
|
var title = 'browser';
|
|
26101
26083
|
var platform = 'browser';
|
|
26102
26084
|
var browser = true;
|
|
26103
|
-
var env = {};
|
|
26104
|
-
var argv = [];
|
|
26085
|
+
var env$1 = {};
|
|
26086
|
+
var argv$1 = [];
|
|
26105
26087
|
var version$1 = ''; // empty string to avoid regexp issues
|
|
26106
26088
|
var versions = {};
|
|
26107
26089
|
var release = {};
|
|
@@ -26164,8 +26146,8 @@ var browser$1 = {
|
|
|
26164
26146
|
nextTick: nextTick,
|
|
26165
26147
|
title: title,
|
|
26166
26148
|
browser: browser,
|
|
26167
|
-
env: env,
|
|
26168
|
-
argv: argv,
|
|
26149
|
+
env: env$1,
|
|
26150
|
+
argv: argv$1,
|
|
26169
26151
|
version: version$1,
|
|
26170
26152
|
versions: versions,
|
|
26171
26153
|
on: on,
|
|
@@ -26209,8 +26191,7 @@ function resolveTemplateUsedIdentifiers(sfc) {
|
|
|
26209
26191
|
switch (node.type) {
|
|
26210
26192
|
case 1:
|
|
26211
26193
|
let tag = node.tag;
|
|
26212
|
-
if (tag.includes("."))
|
|
26213
|
-
tag = tag.split(".")[0].trim();
|
|
26194
|
+
if (tag.includes(".")) tag = tag.split(".")[0].trim();
|
|
26214
26195
|
if (!parserOptions.isNativeTag(tag) && !parserOptions.isBuiltInComponent(tag)) {
|
|
26215
26196
|
ids.add(camelize(tag));
|
|
26216
26197
|
ids.add(capitalize$1(camelize(tag)));
|
|
@@ -30627,11 +30608,9 @@ const transformSrcset = (node, context, options = defaultAssetUrlOptions) => {
|
|
|
30627
30608
|
if (srcsetTags.includes(node.tag) && node.props.length) {
|
|
30628
30609
|
node.props.forEach((attr, index) => {
|
|
30629
30610
|
if (attr.name === "srcset" && attr.type === 6) {
|
|
30630
|
-
if (!attr.value)
|
|
30631
|
-
return;
|
|
30611
|
+
if (!attr.value) return;
|
|
30632
30612
|
const value = attr.value.content;
|
|
30633
|
-
if (!value)
|
|
30634
|
-
return;
|
|
30613
|
+
if (!value) return;
|
|
30635
30614
|
const imageCandidates = value.split(",").map((s) => {
|
|
30636
30615
|
const [url, descriptor] = s.replace(escapedSpaceCharacters, " ").trim().split(" ", 2);
|
|
30637
30616
|
return { url, descriptor };
|
|
@@ -31985,8 +31964,7 @@ const ssrInjectFallthroughAttrs = (node, context) => {
|
|
|
31985
31964
|
let hasEncounteredIf = false;
|
|
31986
31965
|
for (const c of filterChild(parent)) {
|
|
31987
31966
|
if (c.type === 9 || c.type === 1 && findDir(c, "if")) {
|
|
31988
|
-
if (hasEncounteredIf)
|
|
31989
|
-
return;
|
|
31967
|
+
if (hasEncounteredIf) return;
|
|
31990
31968
|
hasEncounteredIf = true;
|
|
31991
31969
|
} else if (
|
|
31992
31970
|
// node before v-if
|
|
@@ -32128,6 +32106,10 @@ var CompilerSSR = /*#__PURE__*/Object.freeze({
|
|
|
32128
32106
|
compile: compile
|
|
32129
32107
|
});
|
|
32130
32108
|
|
|
32109
|
+
function commonjsRequire(path) {
|
|
32110
|
+
throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
|
|
32111
|
+
}
|
|
32112
|
+
|
|
32131
32113
|
var _polyfillNode_fs = {};
|
|
32132
32114
|
|
|
32133
32115
|
var _polyfillNode_fs$1 = /*#__PURE__*/Object.freeze({
|
|
@@ -32182,13 +32164,11 @@ function preprocess$1({ source, filename, preprocessOptions }, preprocessor) {
|
|
|
32182
32164
|
source,
|
|
32183
32165
|
__spreadValues$6({ filename }, preprocessOptions),
|
|
32184
32166
|
(_err, _res) => {
|
|
32185
|
-
if (_err)
|
|
32186
|
-
err = _err;
|
|
32167
|
+
if (_err) err = _err;
|
|
32187
32168
|
res = _res;
|
|
32188
32169
|
}
|
|
32189
32170
|
);
|
|
32190
|
-
if (err)
|
|
32191
|
-
throw err;
|
|
32171
|
+
if (err) throw err;
|
|
32192
32172
|
return res;
|
|
32193
32173
|
}
|
|
32194
32174
|
function compileTemplate(options) {
|
|
@@ -32258,11 +32238,11 @@ function doCompileTemplate({
|
|
|
32258
32238
|
}
|
|
32259
32239
|
if (ssr && !ssrCssVars) {
|
|
32260
32240
|
warnOnce$3(
|
|
32261
|
-
`compileTemplate is called with \`ssr: true\` but no corresponding \`cssVars\` option
|
|
32241
|
+
`compileTemplate is called with \`ssr: true\` but no corresponding \`cssVars\` option.`
|
|
32262
32242
|
);
|
|
32263
32243
|
}
|
|
32264
32244
|
if (!id) {
|
|
32265
|
-
warnOnce$3(`compileTemplate now requires the \`id\` option
|
|
32245
|
+
warnOnce$3(`compileTemplate now requires the \`id\` option.`);
|
|
32266
32246
|
id = "";
|
|
32267
32247
|
}
|
|
32268
32248
|
const shortId = id.replace(/^data-v-/, "");
|
|
@@ -32323,10 +32303,8 @@ ${generateCodeFrame(
|
|
|
32323
32303
|
return { code, ast, preamble, source, errors, tips, map };
|
|
32324
32304
|
}
|
|
32325
32305
|
function mapLines(oldMap, newMap) {
|
|
32326
|
-
if (!oldMap)
|
|
32327
|
-
|
|
32328
|
-
if (!newMap)
|
|
32329
|
-
return oldMap;
|
|
32306
|
+
if (!oldMap) return newMap;
|
|
32307
|
+
if (!newMap) return oldMap;
|
|
32330
32308
|
const oldMapConsumer = new SourceMapConsumer$5(oldMap);
|
|
32331
32309
|
const newMapConsumer = new SourceMapConsumer$5(newMap);
|
|
32332
32310
|
const mergedMapGenerator = new SourceMapGenerator$6();
|
|
@@ -32418,15 +32396,15 @@ var _polyfillNode_tty$1 = /*#__PURE__*/Object.freeze({
|
|
|
32418
32396
|
|
|
32419
32397
|
var require$$0 = /*@__PURE__*/getAugmentedNamespace(_polyfillNode_tty$1);
|
|
32420
32398
|
|
|
32421
|
-
let
|
|
32422
|
-
|
|
32399
|
+
let argv = browser$1.argv || [],
|
|
32400
|
+
env = ({});
|
|
32423
32401
|
let isColorSupported =
|
|
32424
|
-
!("NO_COLOR" in
|
|
32425
|
-
("FORCE_COLOR" in
|
|
32426
|
-
|
|
32402
|
+
!("NO_COLOR" in env || argv.includes("--no-color")) &&
|
|
32403
|
+
("FORCE_COLOR" in env ||
|
|
32404
|
+
argv.includes("--color") ||
|
|
32427
32405
|
"" === "win32" ||
|
|
32428
|
-
(
|
|
32429
|
-
"CI" in
|
|
32406
|
+
(commonjsRequire != null && require$$0.isatty(1) && env.TERM !== "dumb") ||
|
|
32407
|
+
"CI" in env);
|
|
32430
32408
|
|
|
32431
32409
|
let formatter =
|
|
32432
32410
|
(open, close, replace = open) =>
|
|
@@ -32439,40 +32417,47 @@ let formatter =
|
|
|
32439
32417
|
};
|
|
32440
32418
|
|
|
32441
32419
|
let replaceClose = (string, close, replace, index) => {
|
|
32442
|
-
let
|
|
32443
|
-
let
|
|
32444
|
-
|
|
32445
|
-
|
|
32446
|
-
|
|
32447
|
-
|
|
32448
|
-
|
|
32449
|
-
|
|
32450
|
-
|
|
32451
|
-
|
|
32452
|
-
|
|
32453
|
-
|
|
32454
|
-
|
|
32455
|
-
|
|
32456
|
-
|
|
32457
|
-
|
|
32458
|
-
|
|
32459
|
-
|
|
32460
|
-
|
|
32461
|
-
|
|
32462
|
-
|
|
32463
|
-
|
|
32464
|
-
|
|
32465
|
-
|
|
32466
|
-
|
|
32467
|
-
|
|
32468
|
-
|
|
32469
|
-
|
|
32470
|
-
|
|
32471
|
-
|
|
32472
|
-
|
|
32473
|
-
|
|
32474
|
-
|
|
32475
|
-
|
|
32420
|
+
let result = "";
|
|
32421
|
+
let cursor = 0;
|
|
32422
|
+
do {
|
|
32423
|
+
result += string.substring(cursor, index) + replace;
|
|
32424
|
+
cursor = index + close.length;
|
|
32425
|
+
index = string.indexOf(close, cursor);
|
|
32426
|
+
} while (~index)
|
|
32427
|
+
return result + string.substring(cursor)
|
|
32428
|
+
};
|
|
32429
|
+
|
|
32430
|
+
let createColors = (enabled = isColorSupported) => {
|
|
32431
|
+
let init = enabled ? formatter : () => String;
|
|
32432
|
+
return {
|
|
32433
|
+
isColorSupported: enabled,
|
|
32434
|
+
reset: init("\x1b[0m", "\x1b[0m"),
|
|
32435
|
+
bold: init("\x1b[1m", "\x1b[22m", "\x1b[22m\x1b[1m"),
|
|
32436
|
+
dim: init("\x1b[2m", "\x1b[22m", "\x1b[22m\x1b[2m"),
|
|
32437
|
+
italic: init("\x1b[3m", "\x1b[23m"),
|
|
32438
|
+
underline: init("\x1b[4m", "\x1b[24m"),
|
|
32439
|
+
inverse: init("\x1b[7m", "\x1b[27m"),
|
|
32440
|
+
hidden: init("\x1b[8m", "\x1b[28m"),
|
|
32441
|
+
strikethrough: init("\x1b[9m", "\x1b[29m"),
|
|
32442
|
+
black: init("\x1b[30m", "\x1b[39m"),
|
|
32443
|
+
red: init("\x1b[31m", "\x1b[39m"),
|
|
32444
|
+
green: init("\x1b[32m", "\x1b[39m"),
|
|
32445
|
+
yellow: init("\x1b[33m", "\x1b[39m"),
|
|
32446
|
+
blue: init("\x1b[34m", "\x1b[39m"),
|
|
32447
|
+
magenta: init("\x1b[35m", "\x1b[39m"),
|
|
32448
|
+
cyan: init("\x1b[36m", "\x1b[39m"),
|
|
32449
|
+
white: init("\x1b[37m", "\x1b[39m"),
|
|
32450
|
+
gray: init("\x1b[90m", "\x1b[39m"),
|
|
32451
|
+
bgBlack: init("\x1b[40m", "\x1b[49m"),
|
|
32452
|
+
bgRed: init("\x1b[41m", "\x1b[49m"),
|
|
32453
|
+
bgGreen: init("\x1b[42m", "\x1b[49m"),
|
|
32454
|
+
bgYellow: init("\x1b[43m", "\x1b[49m"),
|
|
32455
|
+
bgBlue: init("\x1b[44m", "\x1b[49m"),
|
|
32456
|
+
bgMagenta: init("\x1b[45m", "\x1b[49m"),
|
|
32457
|
+
bgCyan: init("\x1b[46m", "\x1b[49m"),
|
|
32458
|
+
bgWhite: init("\x1b[47m", "\x1b[49m"),
|
|
32459
|
+
}
|
|
32460
|
+
};
|
|
32476
32461
|
|
|
32477
32462
|
picocolors.exports = createColors();
|
|
32478
32463
|
picocolors.exports.createColors = createColors;
|
|
@@ -36791,10 +36776,8 @@ const trimPlugin = () => {
|
|
|
36791
36776
|
Once(root) {
|
|
36792
36777
|
root.walk(({ type, raws }) => {
|
|
36793
36778
|
if (type === "rule" || type === "atrule") {
|
|
36794
|
-
if (raws.before)
|
|
36795
|
-
|
|
36796
|
-
if ("after" in raws && raws.after)
|
|
36797
|
-
raws.after = "\n";
|
|
36779
|
+
if (raws.before) raws.before = "\n";
|
|
36780
|
+
if ("after" in raws && raws.after) raws.after = "\n";
|
|
36798
36781
|
}
|
|
36799
36782
|
});
|
|
36800
36783
|
}
|
|
@@ -37220,7 +37203,7 @@ types.UNIVERSAL = UNIVERSAL;
|
|
|
37220
37203
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
37221
37204
|
function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike ) { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
37222
37205
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
37223
|
-
function _arrayLikeToArray(arr, len) { len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
37206
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
37224
37207
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
37225
37208
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
37226
37209
|
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
|
@@ -38977,7 +38960,8 @@ tokenTypes.combinator = combinator$1;
|
|
|
38977
38960
|
line: 1,
|
|
38978
38961
|
column: 1
|
|
38979
38962
|
}
|
|
38980
|
-
}
|
|
38963
|
+
},
|
|
38964
|
+
sourceIndex: 0
|
|
38981
38965
|
});
|
|
38982
38966
|
this.root.append(selector);
|
|
38983
38967
|
this.current = selector;
|
|
@@ -39436,7 +39420,8 @@ tokenTypes.combinator = combinator$1;
|
|
|
39436
39420
|
var selector = new _selector["default"]({
|
|
39437
39421
|
source: {
|
|
39438
39422
|
start: tokenStart(this.tokens[this.position + 1])
|
|
39439
|
-
}
|
|
39423
|
+
},
|
|
39424
|
+
sourceIndex: this.tokens[this.position + 1][_tokenize.FIELDS.START_POS]
|
|
39440
39425
|
});
|
|
39441
39426
|
this.current.parent.append(selector);
|
|
39442
39427
|
this.current = selector;
|
|
@@ -39505,8 +39490,9 @@ tokenTypes.combinator = combinator$1;
|
|
|
39505
39490
|
if (last && last.type === types$1.PSEUDO) {
|
|
39506
39491
|
var selector = new _selector["default"]({
|
|
39507
39492
|
source: {
|
|
39508
|
-
start: tokenStart(this.tokens[this.position
|
|
39509
|
-
}
|
|
39493
|
+
start: tokenStart(this.tokens[this.position])
|
|
39494
|
+
},
|
|
39495
|
+
sourceIndex: this.tokens[this.position][_tokenize.FIELDS.START_POS]
|
|
39510
39496
|
});
|
|
39511
39497
|
var cache = this.current;
|
|
39512
39498
|
last.append(selector);
|
|
@@ -40354,8 +40340,7 @@ function rewriteSelector(id, selector, selectorRoot, slotted = false) {
|
|
|
40354
40340
|
return false;
|
|
40355
40341
|
}
|
|
40356
40342
|
}
|
|
40357
|
-
if (node)
|
|
40358
|
-
return;
|
|
40343
|
+
if (node) return;
|
|
40359
40344
|
}
|
|
40360
40345
|
if (n.type !== "pseudo" && n.type !== "combinator" || n.type === "pseudo" && (n.value === ":is" || n.value === ":where") && !node) {
|
|
40361
40346
|
node = n;
|
|
@@ -43685,8 +43670,7 @@ const less = (source, map, options, load = require) => {
|
|
|
43685
43670
|
result = output;
|
|
43686
43671
|
}
|
|
43687
43672
|
);
|
|
43688
|
-
if (error)
|
|
43689
|
-
return { code: "", errors: [error], dependencies: [] };
|
|
43673
|
+
if (error) return { code: "", errors: [error], dependencies: [] };
|
|
43690
43674
|
const dependencies = result.imports;
|
|
43691
43675
|
if (map) {
|
|
43692
43676
|
return {
|
|
@@ -43706,8 +43690,7 @@ const styl = (source, map, options, load = require) => {
|
|
|
43706
43690
|
const nodeStylus = load("stylus");
|
|
43707
43691
|
try {
|
|
43708
43692
|
const ref = nodeStylus(source, options);
|
|
43709
|
-
if (map)
|
|
43710
|
-
ref.set("sourcemap", { inline: false, comment: false });
|
|
43693
|
+
if (map) ref.set("sourcemap", { inline: false, comment: false });
|
|
43711
43694
|
const result = ref.render();
|
|
43712
43695
|
const dependencies = ref.deps();
|
|
43713
43696
|
if (map) {
|
|
@@ -43724,8 +43707,7 @@ const styl = (source, map, options, load = require) => {
|
|
|
43724
43707
|
}
|
|
43725
43708
|
};
|
|
43726
43709
|
function getSource(source, filename, additionalData) {
|
|
43727
|
-
if (!additionalData)
|
|
43728
|
-
return source;
|
|
43710
|
+
if (!additionalData) return source;
|
|
43729
43711
|
if (isFunction$1(additionalData)) {
|
|
43730
43712
|
return additionalData(source, filename);
|
|
43731
43713
|
}
|
|
@@ -43925,11 +43907,9 @@ function analyzeBindingsFromOptions(node) {
|
|
|
43925
43907
|
function getObjectExpressionKeys(node) {
|
|
43926
43908
|
const keys = [];
|
|
43927
43909
|
for (const prop of node.properties) {
|
|
43928
|
-
if (prop.type === "SpreadElement")
|
|
43929
|
-
continue;
|
|
43910
|
+
if (prop.type === "SpreadElement") continue;
|
|
43930
43911
|
const key = resolveObjectKey(prop.key, prop.computed);
|
|
43931
|
-
if (key)
|
|
43932
|
-
keys.push(String(key));
|
|
43912
|
+
if (key) keys.push(String(key));
|
|
43933
43913
|
}
|
|
43934
43914
|
return keys;
|
|
43935
43915
|
}
|
|
@@ -45620,7 +45600,7 @@ function innerResolveTypeElements(ctx, node, scope, typeParameters) {
|
|
|
45620
45600
|
node.type
|
|
45621
45601
|
);
|
|
45622
45602
|
case "TSMappedType":
|
|
45623
|
-
return resolveMappedType(ctx, node, scope);
|
|
45603
|
+
return resolveMappedType(ctx, node, scope, typeParameters);
|
|
45624
45604
|
case "TSIndexedAccessType": {
|
|
45625
45605
|
const types = resolveIndexType(ctx, node, scope);
|
|
45626
45606
|
return mergeElements(
|
|
@@ -45649,8 +45629,7 @@ function innerResolveTypeElements(ctx, node, scope, typeParameters) {
|
|
|
45649
45629
|
typeParams = /* @__PURE__ */ Object.create(null);
|
|
45650
45630
|
resolved.typeParameters.params.forEach((p, i) => {
|
|
45651
45631
|
let param = typeParameters && typeParameters[p.name];
|
|
45652
|
-
if (!param)
|
|
45653
|
-
param = node.typeParameters.params[i];
|
|
45632
|
+
if (!param) param = node.typeParameters.params[i];
|
|
45654
45633
|
typeParams[p.name] = param;
|
|
45655
45634
|
});
|
|
45656
45635
|
}
|
|
@@ -45760,8 +45739,7 @@ function typeElementsToMap(ctx, elements, scope = ctxToScope(ctx), typeParameter
|
|
|
45760
45739
|
return res;
|
|
45761
45740
|
}
|
|
45762
45741
|
function mergeElements(maps, type) {
|
|
45763
|
-
if (maps.length === 1)
|
|
45764
|
-
return maps[0];
|
|
45742
|
+
if (maps.length === 1) return maps[0];
|
|
45765
45743
|
const res = { props: {} };
|
|
45766
45744
|
const { props: baseProps } = res;
|
|
45767
45745
|
for (const { props, calls } of maps) {
|
|
@@ -45838,9 +45816,17 @@ Note: both in 3.2 or with the ignore, the properties in the base type are treate
|
|
|
45838
45816
|
}
|
|
45839
45817
|
return base;
|
|
45840
45818
|
}
|
|
45841
|
-
function resolveMappedType(ctx, node, scope) {
|
|
45819
|
+
function resolveMappedType(ctx, node, scope, typeParameters) {
|
|
45842
45820
|
const res = { props: {} };
|
|
45843
|
-
|
|
45821
|
+
let keys;
|
|
45822
|
+
if (node.nameType) {
|
|
45823
|
+
const { name, constraint } = node.typeParameter;
|
|
45824
|
+
scope = createChildScope(scope);
|
|
45825
|
+
Object.assign(scope.types, __spreadProps$1(__spreadValues$2({}, typeParameters), { [name]: constraint }));
|
|
45826
|
+
keys = resolveStringType(ctx, node.nameType, scope);
|
|
45827
|
+
} else {
|
|
45828
|
+
keys = resolveStringType(ctx, node.typeParameter.constraint, scope);
|
|
45829
|
+
}
|
|
45844
45830
|
for (const key of keys) {
|
|
45845
45831
|
res.props[key] = createProperty(
|
|
45846
45832
|
{
|
|
@@ -46184,7 +46170,7 @@ function importSourceToScope(ctx, node, scope, source) {
|
|
|
46184
46170
|
const osSpecificJoinFn = joinPaths;
|
|
46185
46171
|
const filename = osSpecificJoinFn(dirname$2(scope.filename), source);
|
|
46186
46172
|
resolved = resolveExt(filename, fs);
|
|
46187
|
-
} else if (source
|
|
46173
|
+
} else if (source[0] === ".") {
|
|
46188
46174
|
const filename = joinPaths(dirname$2(scope.filename), source);
|
|
46189
46175
|
resolved = resolveExt(filename, fs);
|
|
46190
46176
|
} else {
|
|
@@ -46214,8 +46200,7 @@ function importSourceToScope(ctx, node, scope, source) {
|
|
|
46214
46200
|
function resolveExt(filename, fs) {
|
|
46215
46201
|
filename = filename.replace(/\.js$/, "");
|
|
46216
46202
|
const tryResolve = (filename2) => {
|
|
46217
|
-
if (fs.fileExists(filename2))
|
|
46218
|
-
return filename2;
|
|
46203
|
+
if (fs.fileExists(filename2)) return filename2;
|
|
46219
46204
|
};
|
|
46220
46205
|
return tryResolve(filename) || tryResolve(filename + `.ts`) || tryResolve(filename + `.tsx`) || tryResolve(filename + `.d.ts`) || tryResolve(joinPaths(filename, `index.ts`)) || tryResolve(joinPaths(filename, `index.tsx`)) || tryResolve(joinPaths(filename, `index.d.ts`));
|
|
46221
46206
|
}
|
|
@@ -46227,8 +46212,7 @@ function invalidateTypeCache(filename) {
|
|
|
46227
46212
|
fileToScopeCache.delete(filename);
|
|
46228
46213
|
tsConfigCache.delete(filename);
|
|
46229
46214
|
const affectedConfig = tsConfigRefMap.get(filename);
|
|
46230
|
-
if (affectedConfig)
|
|
46231
|
-
tsConfigCache.delete(affectedConfig);
|
|
46215
|
+
if (affectedConfig) tsConfigCache.delete(affectedConfig);
|
|
46232
46216
|
}
|
|
46233
46217
|
function fileToScope(ctx, filename, asGlobal = false) {
|
|
46234
46218
|
const cached = fileToScopeCache.get(filename);
|
|
@@ -46391,8 +46375,7 @@ function recordTypes(ctx, body, scope, asGlobal = false) {
|
|
|
46391
46375
|
for (const key of Object.keys(types)) {
|
|
46392
46376
|
const node = types[key];
|
|
46393
46377
|
node._ownerScope = scope;
|
|
46394
|
-
if (node._ns)
|
|
46395
|
-
node._ns._ownerScope = scope;
|
|
46378
|
+
if (node._ns) node._ns._ownerScope = scope;
|
|
46396
46379
|
}
|
|
46397
46380
|
for (const key of Object.keys(declares)) {
|
|
46398
46381
|
declares[key]._ownerScope = scope;
|
|
@@ -46433,15 +46416,13 @@ function recordType(node, types, declares, overwriteId) {
|
|
|
46433
46416
|
break;
|
|
46434
46417
|
}
|
|
46435
46418
|
case "ClassDeclaration":
|
|
46436
|
-
if (overwriteId || node.id)
|
|
46437
|
-
types[overwriteId || getId(node.id)] = node;
|
|
46419
|
+
if (overwriteId || node.id) types[overwriteId || getId(node.id)] = node;
|
|
46438
46420
|
break;
|
|
46439
46421
|
case "TSTypeAliasDeclaration":
|
|
46440
46422
|
types[node.id.name] = node.typeParameters ? node : node.typeAnnotation;
|
|
46441
46423
|
break;
|
|
46442
46424
|
case "TSDeclareFunction":
|
|
46443
|
-
if (node.id)
|
|
46444
|
-
declares[node.id.name] = node;
|
|
46425
|
+
if (node.id) declares[node.id.name] = node;
|
|
46445
46426
|
break;
|
|
46446
46427
|
case "VariableDeclaration": {
|
|
46447
46428
|
if (node.declare) {
|
|
@@ -46505,7 +46486,7 @@ function recordImport(node, imports) {
|
|
|
46505
46486
|
};
|
|
46506
46487
|
}
|
|
46507
46488
|
}
|
|
46508
|
-
function inferRuntimeType(ctx, node, scope = node._ownerScope || ctxToScope(ctx)) {
|
|
46489
|
+
function inferRuntimeType(ctx, node, scope = node._ownerScope || ctxToScope(ctx), isKeyOf = false) {
|
|
46509
46490
|
try {
|
|
46510
46491
|
switch (node.type) {
|
|
46511
46492
|
case "TSStringKeyword":
|
|
@@ -46523,13 +46504,30 @@ function inferRuntimeType(ctx, node, scope = node._ownerScope || ctxToScope(ctx)
|
|
|
46523
46504
|
const types = /* @__PURE__ */ new Set();
|
|
46524
46505
|
const members = node.type === "TSTypeLiteral" ? node.members : node.body.body;
|
|
46525
46506
|
for (const m of members) {
|
|
46526
|
-
if (
|
|
46507
|
+
if (isKeyOf) {
|
|
46508
|
+
if (m.type === "TSPropertySignature" && m.key.type === "NumericLiteral") {
|
|
46509
|
+
types.add("Number");
|
|
46510
|
+
} else if (m.type === "TSIndexSignature") {
|
|
46511
|
+
const annotation = m.parameters[0].typeAnnotation;
|
|
46512
|
+
if (annotation && annotation.type !== "Noop") {
|
|
46513
|
+
const type = inferRuntimeType(
|
|
46514
|
+
ctx,
|
|
46515
|
+
annotation.typeAnnotation,
|
|
46516
|
+
scope
|
|
46517
|
+
)[0];
|
|
46518
|
+
if (type === UNKNOWN_TYPE) return [UNKNOWN_TYPE];
|
|
46519
|
+
types.add(type);
|
|
46520
|
+
}
|
|
46521
|
+
} else {
|
|
46522
|
+
types.add("String");
|
|
46523
|
+
}
|
|
46524
|
+
} else if (m.type === "TSCallSignatureDeclaration" || m.type === "TSConstructSignatureDeclaration") {
|
|
46527
46525
|
types.add("Function");
|
|
46528
46526
|
} else {
|
|
46529
46527
|
types.add("Object");
|
|
46530
46528
|
}
|
|
46531
46529
|
}
|
|
46532
|
-
return types.size ? Array.from(types) : ["Object"];
|
|
46530
|
+
return types.size ? Array.from(types) : [isKeyOf ? UNKNOWN_TYPE : "Object"];
|
|
46533
46531
|
}
|
|
46534
46532
|
case "TSPropertySignature":
|
|
46535
46533
|
if (node.typeAnnotation) {
|
|
@@ -46561,70 +46559,121 @@ function inferRuntimeType(ctx, node, scope = node._ownerScope || ctxToScope(ctx)
|
|
|
46561
46559
|
case "TSTypeReference": {
|
|
46562
46560
|
const resolved = resolveTypeReference(ctx, node, scope);
|
|
46563
46561
|
if (resolved) {
|
|
46564
|
-
return inferRuntimeType(ctx, resolved, resolved._ownerScope);
|
|
46562
|
+
return inferRuntimeType(ctx, resolved, resolved._ownerScope, isKeyOf);
|
|
46565
46563
|
}
|
|
46566
46564
|
if (node.typeName.type === "Identifier") {
|
|
46567
|
-
|
|
46568
|
-
|
|
46569
|
-
|
|
46570
|
-
|
|
46571
|
-
|
|
46572
|
-
|
|
46573
|
-
|
|
46574
|
-
|
|
46575
|
-
|
|
46576
|
-
|
|
46577
|
-
|
|
46578
|
-
|
|
46579
|
-
|
|
46580
|
-
|
|
46581
|
-
|
|
46582
|
-
|
|
46583
|
-
|
|
46584
|
-
|
|
46585
|
-
|
|
46586
|
-
|
|
46587
|
-
|
|
46588
|
-
|
|
46589
|
-
|
|
46590
|
-
|
|
46591
|
-
|
|
46592
|
-
|
|
46593
|
-
|
|
46594
|
-
|
|
46595
|
-
|
|
46596
|
-
|
|
46597
|
-
|
|
46598
|
-
|
|
46599
|
-
|
|
46600
|
-
|
|
46601
|
-
|
|
46602
|
-
|
|
46603
|
-
|
|
46604
|
-
|
|
46605
|
-
|
|
46606
|
-
|
|
46607
|
-
|
|
46608
|
-
|
|
46609
|
-
|
|
46610
|
-
|
|
46611
|
-
|
|
46612
|
-
|
|
46613
|
-
|
|
46614
|
-
|
|
46615
|
-
|
|
46616
|
-
|
|
46617
|
-
|
|
46618
|
-
|
|
46619
|
-
|
|
46620
|
-
|
|
46621
|
-
|
|
46622
|
-
|
|
46623
|
-
|
|
46624
|
-
|
|
46625
|
-
|
|
46626
|
-
|
|
46627
|
-
|
|
46565
|
+
if (isKeyOf) {
|
|
46566
|
+
switch (node.typeName.name) {
|
|
46567
|
+
case "String":
|
|
46568
|
+
case "Array":
|
|
46569
|
+
case "ArrayLike":
|
|
46570
|
+
case "Parameters":
|
|
46571
|
+
case "ConstructorParameters":
|
|
46572
|
+
case "ReadonlyArray":
|
|
46573
|
+
return ["String", "Number"];
|
|
46574
|
+
case "Record":
|
|
46575
|
+
case "Partial":
|
|
46576
|
+
case "Required":
|
|
46577
|
+
case "Readonly":
|
|
46578
|
+
if (node.typeParameters && node.typeParameters.params[0]) {
|
|
46579
|
+
return inferRuntimeType(
|
|
46580
|
+
ctx,
|
|
46581
|
+
node.typeParameters.params[0],
|
|
46582
|
+
scope,
|
|
46583
|
+
true
|
|
46584
|
+
);
|
|
46585
|
+
}
|
|
46586
|
+
break;
|
|
46587
|
+
case "Pick":
|
|
46588
|
+
case "Extract":
|
|
46589
|
+
if (node.typeParameters && node.typeParameters.params[1]) {
|
|
46590
|
+
return inferRuntimeType(
|
|
46591
|
+
ctx,
|
|
46592
|
+
node.typeParameters.params[1],
|
|
46593
|
+
scope
|
|
46594
|
+
);
|
|
46595
|
+
}
|
|
46596
|
+
break;
|
|
46597
|
+
case "Function":
|
|
46598
|
+
case "Object":
|
|
46599
|
+
case "Set":
|
|
46600
|
+
case "Map":
|
|
46601
|
+
case "WeakSet":
|
|
46602
|
+
case "WeakMap":
|
|
46603
|
+
case "Date":
|
|
46604
|
+
case "Promise":
|
|
46605
|
+
case "Error":
|
|
46606
|
+
case "Uppercase":
|
|
46607
|
+
case "Lowercase":
|
|
46608
|
+
case "Capitalize":
|
|
46609
|
+
case "Uncapitalize":
|
|
46610
|
+
case "ReadonlyMap":
|
|
46611
|
+
case "ReadonlySet":
|
|
46612
|
+
return ["String"];
|
|
46613
|
+
}
|
|
46614
|
+
} else {
|
|
46615
|
+
switch (node.typeName.name) {
|
|
46616
|
+
case "Array":
|
|
46617
|
+
case "Function":
|
|
46618
|
+
case "Object":
|
|
46619
|
+
case "Set":
|
|
46620
|
+
case "Map":
|
|
46621
|
+
case "WeakSet":
|
|
46622
|
+
case "WeakMap":
|
|
46623
|
+
case "Date":
|
|
46624
|
+
case "Promise":
|
|
46625
|
+
case "Error":
|
|
46626
|
+
return [node.typeName.name];
|
|
46627
|
+
case "Partial":
|
|
46628
|
+
case "Required":
|
|
46629
|
+
case "Readonly":
|
|
46630
|
+
case "Record":
|
|
46631
|
+
case "Pick":
|
|
46632
|
+
case "Omit":
|
|
46633
|
+
case "InstanceType":
|
|
46634
|
+
return ["Object"];
|
|
46635
|
+
case "Uppercase":
|
|
46636
|
+
case "Lowercase":
|
|
46637
|
+
case "Capitalize":
|
|
46638
|
+
case "Uncapitalize":
|
|
46639
|
+
return ["String"];
|
|
46640
|
+
case "Parameters":
|
|
46641
|
+
case "ConstructorParameters":
|
|
46642
|
+
case "ReadonlyArray":
|
|
46643
|
+
return ["Array"];
|
|
46644
|
+
case "ReadonlyMap":
|
|
46645
|
+
return ["Map"];
|
|
46646
|
+
case "ReadonlySet":
|
|
46647
|
+
return ["Set"];
|
|
46648
|
+
case "NonNullable":
|
|
46649
|
+
if (node.typeParameters && node.typeParameters.params[0]) {
|
|
46650
|
+
return inferRuntimeType(
|
|
46651
|
+
ctx,
|
|
46652
|
+
node.typeParameters.params[0],
|
|
46653
|
+
scope
|
|
46654
|
+
).filter((t) => t !== "null");
|
|
46655
|
+
}
|
|
46656
|
+
break;
|
|
46657
|
+
case "Extract":
|
|
46658
|
+
if (node.typeParameters && node.typeParameters.params[1]) {
|
|
46659
|
+
return inferRuntimeType(
|
|
46660
|
+
ctx,
|
|
46661
|
+
node.typeParameters.params[1],
|
|
46662
|
+
scope
|
|
46663
|
+
);
|
|
46664
|
+
}
|
|
46665
|
+
break;
|
|
46666
|
+
case "Exclude":
|
|
46667
|
+
case "OmitThisParameter":
|
|
46668
|
+
if (node.typeParameters && node.typeParameters.params[0]) {
|
|
46669
|
+
return inferRuntimeType(
|
|
46670
|
+
ctx,
|
|
46671
|
+
node.typeParameters.params[0],
|
|
46672
|
+
scope
|
|
46673
|
+
);
|
|
46674
|
+
}
|
|
46675
|
+
break;
|
|
46676
|
+
}
|
|
46628
46677
|
}
|
|
46629
46678
|
}
|
|
46630
46679
|
break;
|
|
@@ -46632,9 +46681,9 @@ function inferRuntimeType(ctx, node, scope = node._ownerScope || ctxToScope(ctx)
|
|
|
46632
46681
|
case "TSParenthesizedType":
|
|
46633
46682
|
return inferRuntimeType(ctx, node.typeAnnotation, scope);
|
|
46634
46683
|
case "TSUnionType":
|
|
46635
|
-
return flattenTypes(ctx, node.types, scope);
|
|
46684
|
+
return flattenTypes(ctx, node.types, scope, isKeyOf);
|
|
46636
46685
|
case "TSIntersectionType": {
|
|
46637
|
-
return flattenTypes(ctx, node.types, scope).filter(
|
|
46686
|
+
return flattenTypes(ctx, node.types, scope, isKeyOf).filter(
|
|
46638
46687
|
(t) => t !== UNKNOWN_TYPE
|
|
46639
46688
|
);
|
|
46640
46689
|
}
|
|
@@ -46666,27 +46715,38 @@ function inferRuntimeType(ctx, node, scope = node._ownerScope || ctxToScope(ctx)
|
|
|
46666
46715
|
if (id.type === "Identifier") {
|
|
46667
46716
|
const matched = scope.declares[id.name];
|
|
46668
46717
|
if (matched) {
|
|
46669
|
-
return inferRuntimeType(ctx, matched, matched._ownerScope);
|
|
46718
|
+
return inferRuntimeType(ctx, matched, matched._ownerScope, isKeyOf);
|
|
46670
46719
|
}
|
|
46671
46720
|
}
|
|
46672
46721
|
break;
|
|
46673
46722
|
}
|
|
46674
46723
|
case "TSTypeOperator": {
|
|
46675
|
-
return inferRuntimeType(
|
|
46724
|
+
return inferRuntimeType(
|
|
46725
|
+
ctx,
|
|
46726
|
+
node.typeAnnotation,
|
|
46727
|
+
scope,
|
|
46728
|
+
node.operator === "keyof"
|
|
46729
|
+
);
|
|
46730
|
+
}
|
|
46731
|
+
case "TSAnyKeyword": {
|
|
46732
|
+
if (isKeyOf) {
|
|
46733
|
+
return ["String", "Number", "Symbol"];
|
|
46734
|
+
}
|
|
46735
|
+
break;
|
|
46676
46736
|
}
|
|
46677
46737
|
}
|
|
46678
46738
|
} catch (e) {
|
|
46679
46739
|
}
|
|
46680
46740
|
return [UNKNOWN_TYPE];
|
|
46681
46741
|
}
|
|
46682
|
-
function flattenTypes(ctx, types, scope) {
|
|
46742
|
+
function flattenTypes(ctx, types, scope, isKeyOf = false) {
|
|
46683
46743
|
if (types.length === 1) {
|
|
46684
|
-
return inferRuntimeType(ctx, types[0], scope);
|
|
46744
|
+
return inferRuntimeType(ctx, types[0], scope, isKeyOf);
|
|
46685
46745
|
}
|
|
46686
46746
|
return [
|
|
46687
46747
|
...new Set(
|
|
46688
46748
|
[].concat(
|
|
46689
|
-
...types.map((t) => inferRuntimeType(ctx, t, scope))
|
|
46749
|
+
...types.map((t) => inferRuntimeType(ctx, t, scope, isKeyOf))
|
|
46690
46750
|
)
|
|
46691
46751
|
)
|
|
46692
46752
|
];
|
|
@@ -46742,8 +46802,7 @@ function reverseInferType(key, node, scope, optional = true, checkObjectSyntax =
|
|
|
46742
46802
|
if ((node.type === "TSTypeReference" || node.type === "TSImportType") && node.typeParameters) {
|
|
46743
46803
|
for (const t of node.typeParameters.params) {
|
|
46744
46804
|
const inferred = reverseInferType(key, t, scope, optional);
|
|
46745
|
-
if (inferred)
|
|
46746
|
-
return inferred;
|
|
46805
|
+
if (inferred) return inferred;
|
|
46747
46806
|
}
|
|
46748
46807
|
}
|
|
46749
46808
|
return createProperty(key, { type: `TSNullKeyword` }, scope, optional);
|
|
@@ -46783,8 +46842,7 @@ function resolveReturnType(ctx, arg, scope) {
|
|
|
46783
46842
|
if (arg.type === "TSTypeReference" || arg.type === "TSTypeQuery" || arg.type === "TSImportType") {
|
|
46784
46843
|
resolved = resolveTypeReference(ctx, arg, scope);
|
|
46785
46844
|
}
|
|
46786
|
-
if (!resolved)
|
|
46787
|
-
return;
|
|
46845
|
+
if (!resolved) return;
|
|
46788
46846
|
if (resolved.type === "TSFunctionType") {
|
|
46789
46847
|
return (_a = resolved.typeAnnotation) == null ? void 0 : _a.typeAnnotation;
|
|
46790
46848
|
}
|
|
@@ -46795,8 +46853,7 @@ function resolveReturnType(ctx, arg, scope) {
|
|
|
46795
46853
|
function resolveUnionType(ctx, node, scope) {
|
|
46796
46854
|
if (node.type === "TSTypeReference") {
|
|
46797
46855
|
const resolved = resolveTypeReference(ctx, node, scope);
|
|
46798
|
-
if (resolved)
|
|
46799
|
-
node = resolved;
|
|
46856
|
+
if (resolved) node = resolved;
|
|
46800
46857
|
}
|
|
46801
46858
|
let types;
|
|
46802
46859
|
if (node.type === "TSUnionType") {
|
|
@@ -46873,8 +46930,7 @@ function processDefineModel(ctx, node, declId) {
|
|
|
46873
46930
|
return true;
|
|
46874
46931
|
}
|
|
46875
46932
|
function genModelProps(ctx) {
|
|
46876
|
-
if (!ctx.hasDefineModelCall)
|
|
46877
|
-
return;
|
|
46933
|
+
if (!ctx.hasDefineModelCall) return;
|
|
46878
46934
|
const isProd = !!ctx.options.isProd;
|
|
46879
46935
|
let modelPropsDecl = "";
|
|
46880
46936
|
for (const [name, { type, options: runtimeOptions }] of Object.entries(
|
|
@@ -47076,8 +47132,7 @@ function genRuntimePropFromType(ctx, { key, required, type, skipCheck }, hasStat
|
|
|
47076
47132
|
} else if (hasStaticDefaults) {
|
|
47077
47133
|
const prop = ctx.propsRuntimeDefaults.properties.find(
|
|
47078
47134
|
(node) => {
|
|
47079
|
-
if (node.type === "SpreadElement")
|
|
47080
|
-
return false;
|
|
47135
|
+
if (node.type === "SpreadElement") return false;
|
|
47081
47136
|
return resolveObjectKey(node.key, node.computed) === key;
|
|
47082
47137
|
}
|
|
47083
47138
|
);
|
|
@@ -47249,8 +47304,7 @@ function transformDestructuredProps(ctx, vueImportAliases) {
|
|
|
47249
47304
|
if (stmt.type === "VariableDeclaration") {
|
|
47250
47305
|
walkVariableDeclaration(stmt, isRoot);
|
|
47251
47306
|
} else if (stmt.type === "FunctionDeclaration" || stmt.type === "ClassDeclaration") {
|
|
47252
|
-
if (stmt.declare || !stmt.id)
|
|
47253
|
-
continue;
|
|
47307
|
+
if (stmt.declare || !stmt.id) continue;
|
|
47254
47308
|
registerLocalBinding(stmt.id);
|
|
47255
47309
|
} else if ((stmt.type === "ForOfStatement" || stmt.type === "ForInStatement") && stmt.left.type === "VariableDeclaration") {
|
|
47256
47310
|
walkVariableDeclaration(stmt.left);
|
|
@@ -47476,8 +47530,7 @@ function processDefineOptions(ctx, node) {
|
|
|
47476
47530
|
if (node.typeParameters) {
|
|
47477
47531
|
ctx.error(`${DEFINE_OPTIONS}() cannot accept type arguments`, node);
|
|
47478
47532
|
}
|
|
47479
|
-
if (!node.arguments[0])
|
|
47480
|
-
return true;
|
|
47533
|
+
if (!node.arguments[0]) return true;
|
|
47481
47534
|
ctx.hasDefineOptionsCall = true;
|
|
47482
47535
|
ctx.optionsRuntimeDecl = unwrapTSNode(node.arguments[0]);
|
|
47483
47536
|
let propsOption = void 0;
|
|
@@ -47487,14 +47540,20 @@ function processDefineOptions(ctx, node) {
|
|
|
47487
47540
|
if (ctx.optionsRuntimeDecl.type === "ObjectExpression") {
|
|
47488
47541
|
for (const prop of ctx.optionsRuntimeDecl.properties) {
|
|
47489
47542
|
if ((prop.type === "ObjectProperty" || prop.type === "ObjectMethod") && prop.key.type === "Identifier") {
|
|
47490
|
-
|
|
47491
|
-
|
|
47492
|
-
|
|
47493
|
-
|
|
47494
|
-
|
|
47495
|
-
|
|
47496
|
-
|
|
47497
|
-
|
|
47543
|
+
switch (prop.key.name) {
|
|
47544
|
+
case "props":
|
|
47545
|
+
propsOption = prop;
|
|
47546
|
+
break;
|
|
47547
|
+
case "emits":
|
|
47548
|
+
emitsOption = prop;
|
|
47549
|
+
break;
|
|
47550
|
+
case "expose":
|
|
47551
|
+
exposeOption = prop;
|
|
47552
|
+
break;
|
|
47553
|
+
case "slots":
|
|
47554
|
+
slotsOption = prop;
|
|
47555
|
+
break;
|
|
47556
|
+
}
|
|
47498
47557
|
}
|
|
47499
47558
|
}
|
|
47500
47559
|
}
|
|
@@ -47570,6 +47629,15 @@ var __spreadValues$1 = (a, b) => {
|
|
|
47570
47629
|
return a;
|
|
47571
47630
|
};
|
|
47572
47631
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
47632
|
+
const MACROS = [
|
|
47633
|
+
DEFINE_PROPS,
|
|
47634
|
+
DEFINE_EMITS,
|
|
47635
|
+
DEFINE_EXPOSE,
|
|
47636
|
+
DEFINE_OPTIONS,
|
|
47637
|
+
DEFINE_SLOTS,
|
|
47638
|
+
DEFINE_MODEL,
|
|
47639
|
+
WITH_DEFAULTS
|
|
47640
|
+
];
|
|
47573
47641
|
function compileScript(sfc, options) {
|
|
47574
47642
|
var _a, _b, _c;
|
|
47575
47643
|
if (!options.id) {
|
|
@@ -47637,8 +47705,7 @@ Upgrade your vite or vue-loader version for compatibility with the latest experi
|
|
|
47637
47705
|
};
|
|
47638
47706
|
}
|
|
47639
47707
|
function checkInvalidScopeReference(node, method) {
|
|
47640
|
-
if (!node)
|
|
47641
|
-
return;
|
|
47708
|
+
if (!node) return;
|
|
47642
47709
|
walkIdentifiers(node, (id) => {
|
|
47643
47710
|
const binding = setupBindings[id.name];
|
|
47644
47711
|
if (binding && binding !== "literal-const") {
|
|
@@ -47688,10 +47755,17 @@ Upgrade your vite or vue-loader version for compatibility with the latest experi
|
|
|
47688
47755
|
const imported = getImportedName(specifier);
|
|
47689
47756
|
const source2 = node.source.value;
|
|
47690
47757
|
const existing = ctx.userImports[local];
|
|
47691
|
-
if (source2 === "vue" && (imported
|
|
47692
|
-
|
|
47693
|
-
|
|
47694
|
-
|
|
47758
|
+
if (source2 === "vue" && MACROS.includes(imported)) {
|
|
47759
|
+
if (local === imported) {
|
|
47760
|
+
warnOnce$3(
|
|
47761
|
+
`\`${imported}\` is a compiler macro and no longer needs to be imported.`
|
|
47762
|
+
);
|
|
47763
|
+
} else {
|
|
47764
|
+
ctx.error(
|
|
47765
|
+
`\`${imported}\` is a compiler macro and cannot be aliased to a different name.`,
|
|
47766
|
+
specifier
|
|
47767
|
+
);
|
|
47768
|
+
}
|
|
47695
47769
|
removeSpecifier(i);
|
|
47696
47770
|
} else if (existing) {
|
|
47697
47771
|
if (existing.source === source2 && existing.imported === imported) {
|
|
@@ -47721,8 +47795,7 @@ Upgrade your vite or vue-loader version for compatibility with the latest experi
|
|
|
47721
47795
|
const vueImportAliases = {};
|
|
47722
47796
|
for (const key in ctx.userImports) {
|
|
47723
47797
|
const { source: source2, imported, local } = ctx.userImports[key];
|
|
47724
|
-
if (source2 === "vue")
|
|
47725
|
-
vueImportAliases[imported] = local;
|
|
47798
|
+
if (source2 === "vue") vueImportAliases[imported] = local;
|
|
47726
47799
|
}
|
|
47727
47800
|
if (script && scriptAst) {
|
|
47728
47801
|
for (const node of scriptAst.body) {
|
|
@@ -47836,6 +47909,9 @@ const ${normalScriptDefaultVar} = ${defaultSpecifier.local.name}
|
|
|
47836
47909
|
);
|
|
47837
47910
|
}
|
|
47838
47911
|
const isDefineProps = processDefineProps(ctx, init, decl.id);
|
|
47912
|
+
if (ctx.propsDestructureRestId) {
|
|
47913
|
+
setupBindings[ctx.propsDestructureRestId] = "setup-reactive-const";
|
|
47914
|
+
}
|
|
47839
47915
|
const isDefineEmits = !isDefineProps && processDefineEmits(ctx, init, decl.id);
|
|
47840
47916
|
!isDefineEmits && (processDefineSlots(ctx, init, decl.id) || processDefineModel(ctx, init, decl.id));
|
|
47841
47917
|
if (isDefineProps && !ctx.propsDestructureRestId && ctx.propsDestructureDecl) {
|
|
@@ -47902,8 +47978,7 @@ const ${normalScriptDefaultVar} = ${defaultSpecifier.local.name}
|
|
|
47902
47978
|
}
|
|
47903
47979
|
},
|
|
47904
47980
|
exit(node2) {
|
|
47905
|
-
if (node2.type === "BlockStatement")
|
|
47906
|
-
scope.pop();
|
|
47981
|
+
if (node2.type === "BlockStatement") scope.pop();
|
|
47907
47982
|
}
|
|
47908
47983
|
});
|
|
47909
47984
|
}
|
|
@@ -47954,8 +48029,7 @@ const ${normalScriptDefaultVar} = ${defaultSpecifier.local.name}
|
|
|
47954
48029
|
for (const [key, { isType, imported, source: source2 }] of Object.entries(
|
|
47955
48030
|
ctx.userImports
|
|
47956
48031
|
)) {
|
|
47957
|
-
if (isType)
|
|
47958
|
-
continue;
|
|
48032
|
+
if (isType) continue;
|
|
47959
48033
|
ctx.bindingMetadata[key] = imported === "*" || imported === "default" && source2.endsWith(".vue") || source2 === "vue" ? "setup-const" : "setup-maybe-ref";
|
|
47960
48034
|
}
|
|
47961
48035
|
for (const key in scriptBindings) {
|
|
@@ -48122,12 +48196,10 @@ return ${returned}
|
|
|
48122
48196
|
__ssrInlineRender: true,`;
|
|
48123
48197
|
}
|
|
48124
48198
|
const propsDecl = genRuntimeProps(ctx);
|
|
48125
|
-
if (propsDecl)
|
|
48126
|
-
runtimeOptions += `
|
|
48199
|
+
if (propsDecl) runtimeOptions += `
|
|
48127
48200
|
props: ${propsDecl},`;
|
|
48128
48201
|
const emitsDecl = genRuntimeEmits(ctx);
|
|
48129
|
-
if (emitsDecl)
|
|
48130
|
-
runtimeOptions += `
|
|
48202
|
+
if (emitsDecl) runtimeOptions += `
|
|
48131
48203
|
emits: ${emitsDecl},`;
|
|
48132
48204
|
let definedOptions = "";
|
|
48133
48205
|
if (ctx.optionsRuntimeDecl) {
|
|
@@ -48204,10 +48276,10 @@ function walkDeclaration(from, node, bindings, userImportAliases, hoistStatic) {
|
|
|
48204
48276
|
);
|
|
48205
48277
|
for (const { id, init: _init } of node.declarations) {
|
|
48206
48278
|
const init = _init && unwrapTSNode(_init);
|
|
48207
|
-
const
|
|
48279
|
+
const isConstMacroCall = isConst && isCallOf(
|
|
48208
48280
|
init,
|
|
48209
|
-
(c) => c === DEFINE_PROPS || c === DEFINE_EMITS || c === WITH_DEFAULTS
|
|
48210
|
-
)
|
|
48281
|
+
(c) => c === DEFINE_PROPS || c === DEFINE_EMITS || c === WITH_DEFAULTS || c === DEFINE_SLOTS
|
|
48282
|
+
);
|
|
48211
48283
|
if (id.type === "Identifier") {
|
|
48212
48284
|
let bindingType;
|
|
48213
48285
|
const userReactiveBinding = userImportAliases["reactive"];
|
|
@@ -48218,7 +48290,7 @@ function walkDeclaration(from, node, bindings, userImportAliases, hoistStatic) {
|
|
|
48218
48290
|
} else if (
|
|
48219
48291
|
// if a declaration is a const literal, we can mark it so that
|
|
48220
48292
|
// the generated render fn code doesn't need to unref() it
|
|
48221
|
-
|
|
48293
|
+
isConstMacroCall || isConst && canNeverBeRef(init, userReactiveBinding)
|
|
48222
48294
|
) {
|
|
48223
48295
|
bindingType = isCallOf(init, DEFINE_PROPS) ? "setup-reactive-const" : "setup-const";
|
|
48224
48296
|
} else if (isConst) {
|
|
@@ -48239,9 +48311,9 @@ function walkDeclaration(from, node, bindings, userImportAliases, hoistStatic) {
|
|
|
48239
48311
|
continue;
|
|
48240
48312
|
}
|
|
48241
48313
|
if (id.type === "ObjectPattern") {
|
|
48242
|
-
walkObjectPattern(id, bindings, isConst,
|
|
48314
|
+
walkObjectPattern(id, bindings, isConst, isConstMacroCall);
|
|
48243
48315
|
} else if (id.type === "ArrayPattern") {
|
|
48244
|
-
walkArrayPattern(id, bindings, isConst,
|
|
48316
|
+
walkArrayPattern(id, bindings, isConst, isConstMacroCall);
|
|
48245
48317
|
}
|
|
48246
48318
|
}
|
|
48247
48319
|
}
|
|
@@ -48364,7 +48436,7 @@ var __spreadValues = (a, b) => {
|
|
|
48364
48436
|
}
|
|
48365
48437
|
return a;
|
|
48366
48438
|
};
|
|
48367
|
-
const version = "3.4.
|
|
48439
|
+
const version = "3.4.28";
|
|
48368
48440
|
const parseCache = parseCache$1;
|
|
48369
48441
|
const errorMessages = __spreadValues(__spreadValues({}, errorMessages$1), DOMErrorMessages);
|
|
48370
48442
|
const walk = walk$2;
|