@vue/compiler-sfc 3.4.0-alpha.2 → 3.4.0-alpha.4
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 +3119 -2982
- package/dist/compiler-sfc.d.ts +4 -3
- package/dist/compiler-sfc.esm-browser.js +568 -173
- package/package.json +10 -10
|
@@ -7,8 +7,8 @@ const EMPTY_OBJ = Object.freeze({}) ;
|
|
|
7
7
|
const NOOP = () => {
|
|
8
8
|
};
|
|
9
9
|
const NO = () => false;
|
|
10
|
-
const
|
|
11
|
-
|
|
10
|
+
const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
|
|
11
|
+
(key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
|
|
12
12
|
const extend = Object.assign;
|
|
13
13
|
const hasOwnProperty$3 = Object.prototype.hasOwnProperty;
|
|
14
14
|
const hasOwn = (val, key) => hasOwnProperty$3.call(val, key);
|
|
@@ -79,7 +79,7 @@ const slotFlagsText = {
|
|
|
79
79
|
[3]: "FORWARDED"
|
|
80
80
|
};
|
|
81
81
|
|
|
82
|
-
const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console";
|
|
82
|
+
const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error";
|
|
83
83
|
const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED);
|
|
84
84
|
|
|
85
85
|
const range = 2;
|
|
@@ -374,6 +374,90 @@ function registerRuntimeHelpers(helpers) {
|
|
|
374
374
|
});
|
|
375
375
|
}
|
|
376
376
|
|
|
377
|
+
const Namespaces = {
|
|
378
|
+
"HTML": 0,
|
|
379
|
+
"0": "HTML",
|
|
380
|
+
"SVG": 1,
|
|
381
|
+
"1": "SVG",
|
|
382
|
+
"MATH_ML": 2,
|
|
383
|
+
"2": "MATH_ML"
|
|
384
|
+
};
|
|
385
|
+
const NodeTypes = {
|
|
386
|
+
"ROOT": 0,
|
|
387
|
+
"0": "ROOT",
|
|
388
|
+
"ELEMENT": 1,
|
|
389
|
+
"1": "ELEMENT",
|
|
390
|
+
"TEXT": 2,
|
|
391
|
+
"2": "TEXT",
|
|
392
|
+
"COMMENT": 3,
|
|
393
|
+
"3": "COMMENT",
|
|
394
|
+
"SIMPLE_EXPRESSION": 4,
|
|
395
|
+
"4": "SIMPLE_EXPRESSION",
|
|
396
|
+
"INTERPOLATION": 5,
|
|
397
|
+
"5": "INTERPOLATION",
|
|
398
|
+
"ATTRIBUTE": 6,
|
|
399
|
+
"6": "ATTRIBUTE",
|
|
400
|
+
"DIRECTIVE": 7,
|
|
401
|
+
"7": "DIRECTIVE",
|
|
402
|
+
"COMPOUND_EXPRESSION": 8,
|
|
403
|
+
"8": "COMPOUND_EXPRESSION",
|
|
404
|
+
"IF": 9,
|
|
405
|
+
"9": "IF",
|
|
406
|
+
"IF_BRANCH": 10,
|
|
407
|
+
"10": "IF_BRANCH",
|
|
408
|
+
"FOR": 11,
|
|
409
|
+
"11": "FOR",
|
|
410
|
+
"TEXT_CALL": 12,
|
|
411
|
+
"12": "TEXT_CALL",
|
|
412
|
+
"VNODE_CALL": 13,
|
|
413
|
+
"13": "VNODE_CALL",
|
|
414
|
+
"JS_CALL_EXPRESSION": 14,
|
|
415
|
+
"14": "JS_CALL_EXPRESSION",
|
|
416
|
+
"JS_OBJECT_EXPRESSION": 15,
|
|
417
|
+
"15": "JS_OBJECT_EXPRESSION",
|
|
418
|
+
"JS_PROPERTY": 16,
|
|
419
|
+
"16": "JS_PROPERTY",
|
|
420
|
+
"JS_ARRAY_EXPRESSION": 17,
|
|
421
|
+
"17": "JS_ARRAY_EXPRESSION",
|
|
422
|
+
"JS_FUNCTION_EXPRESSION": 18,
|
|
423
|
+
"18": "JS_FUNCTION_EXPRESSION",
|
|
424
|
+
"JS_CONDITIONAL_EXPRESSION": 19,
|
|
425
|
+
"19": "JS_CONDITIONAL_EXPRESSION",
|
|
426
|
+
"JS_CACHE_EXPRESSION": 20,
|
|
427
|
+
"20": "JS_CACHE_EXPRESSION",
|
|
428
|
+
"JS_BLOCK_STATEMENT": 21,
|
|
429
|
+
"21": "JS_BLOCK_STATEMENT",
|
|
430
|
+
"JS_TEMPLATE_LITERAL": 22,
|
|
431
|
+
"22": "JS_TEMPLATE_LITERAL",
|
|
432
|
+
"JS_IF_STATEMENT": 23,
|
|
433
|
+
"23": "JS_IF_STATEMENT",
|
|
434
|
+
"JS_ASSIGNMENT_EXPRESSION": 24,
|
|
435
|
+
"24": "JS_ASSIGNMENT_EXPRESSION",
|
|
436
|
+
"JS_SEQUENCE_EXPRESSION": 25,
|
|
437
|
+
"25": "JS_SEQUENCE_EXPRESSION",
|
|
438
|
+
"JS_RETURN_STATEMENT": 26,
|
|
439
|
+
"26": "JS_RETURN_STATEMENT"
|
|
440
|
+
};
|
|
441
|
+
const ElementTypes = {
|
|
442
|
+
"ELEMENT": 0,
|
|
443
|
+
"0": "ELEMENT",
|
|
444
|
+
"COMPONENT": 1,
|
|
445
|
+
"1": "COMPONENT",
|
|
446
|
+
"SLOT": 2,
|
|
447
|
+
"2": "SLOT",
|
|
448
|
+
"TEMPLATE": 3,
|
|
449
|
+
"3": "TEMPLATE"
|
|
450
|
+
};
|
|
451
|
+
const ConstantTypes = {
|
|
452
|
+
"NOT_CONSTANT": 0,
|
|
453
|
+
"0": "NOT_CONSTANT",
|
|
454
|
+
"CAN_SKIP_PATCH": 1,
|
|
455
|
+
"1": "CAN_SKIP_PATCH",
|
|
456
|
+
"CAN_HOIST": 2,
|
|
457
|
+
"2": "CAN_HOIST",
|
|
458
|
+
"CAN_STRINGIFY": 3,
|
|
459
|
+
"3": "CAN_STRINGIFY"
|
|
460
|
+
};
|
|
377
461
|
const locStub = {
|
|
378
462
|
start: { line: 1, column: 1, offset: 0 },
|
|
379
463
|
end: { line: 1, column: 1, offset: 0 },
|
|
@@ -1166,7 +1250,9 @@ let Tokenizer$1 = class Tokenizer {
|
|
|
1166
1250
|
this.inRCDATA = false;
|
|
1167
1251
|
/** For disabling RCDATA tags handling */
|
|
1168
1252
|
this.inXML = false;
|
|
1169
|
-
/**
|
|
1253
|
+
/** For disabling interpolation parsing in v-pre */
|
|
1254
|
+
this.inVPre = false;
|
|
1255
|
+
/** Record newline positions for fast line / column calculation */
|
|
1170
1256
|
this.newlines = [];
|
|
1171
1257
|
this.mode = 0;
|
|
1172
1258
|
this.delimiterOpen = defaultDelimitersOpen;
|
|
@@ -1191,6 +1277,7 @@ let Tokenizer$1 = class Tokenizer {
|
|
|
1191
1277
|
this.sectionStart = 0;
|
|
1192
1278
|
this.index = 0;
|
|
1193
1279
|
this.baseState = 1;
|
|
1280
|
+
this.inRCDATA = false;
|
|
1194
1281
|
this.currentSequence = void 0;
|
|
1195
1282
|
this.newlines.length = 0;
|
|
1196
1283
|
this.delimiterOpen = defaultDelimitersOpen;
|
|
@@ -1231,7 +1318,7 @@ let Tokenizer$1 = class Tokenizer {
|
|
|
1231
1318
|
this.sectionStart = this.index;
|
|
1232
1319
|
} else if (c === 38) {
|
|
1233
1320
|
this.startEntity();
|
|
1234
|
-
} else if (c === this.delimiterOpen[0]) {
|
|
1321
|
+
} else if (!this.inVPre && c === this.delimiterOpen[0]) {
|
|
1235
1322
|
this.state = 2;
|
|
1236
1323
|
this.delimiterIndex = 0;
|
|
1237
1324
|
this.stateInterpolationOpen(c);
|
|
@@ -1967,6 +2054,16 @@ let Tokenizer$1 = class Tokenizer {
|
|
|
1967
2054
|
}
|
|
1968
2055
|
};
|
|
1969
2056
|
|
|
2057
|
+
const CompilerDeprecationTypes = {
|
|
2058
|
+
"COMPILER_IS_ON_ELEMENT": "COMPILER_IS_ON_ELEMENT",
|
|
2059
|
+
"COMPILER_V_BIND_SYNC": "COMPILER_V_BIND_SYNC",
|
|
2060
|
+
"COMPILER_V_BIND_OBJECT_ORDER": "COMPILER_V_BIND_OBJECT_ORDER",
|
|
2061
|
+
"COMPILER_V_ON_NATIVE": "COMPILER_V_ON_NATIVE",
|
|
2062
|
+
"COMPILER_V_IF_V_FOR_PRECEDENCE": "COMPILER_V_IF_V_FOR_PRECEDENCE",
|
|
2063
|
+
"COMPILER_NATIVE_TEMPLATE": "COMPILER_NATIVE_TEMPLATE",
|
|
2064
|
+
"COMPILER_INLINE_TEMPLATE": "COMPILER_INLINE_TEMPLATE",
|
|
2065
|
+
"COMPILER_FILTERS": "COMPILER_FILTER"
|
|
2066
|
+
};
|
|
1970
2067
|
const deprecationData = {
|
|
1971
2068
|
["COMPILER_IS_ON_ELEMENT"]: {
|
|
1972
2069
|
message: `Platform-native elements with "is" prop will no longer be treated as components in Vue 3 unless the "is" value is explicitly prefixed with "vue:".`,
|
|
@@ -2048,6 +2145,114 @@ function createCompilerError(code, loc, messages, additionalMessage) {
|
|
|
2048
2145
|
error.loc = loc;
|
|
2049
2146
|
return error;
|
|
2050
2147
|
}
|
|
2148
|
+
const ErrorCodes = {
|
|
2149
|
+
"ABRUPT_CLOSING_OF_EMPTY_COMMENT": 0,
|
|
2150
|
+
"0": "ABRUPT_CLOSING_OF_EMPTY_COMMENT",
|
|
2151
|
+
"CDATA_IN_HTML_CONTENT": 1,
|
|
2152
|
+
"1": "CDATA_IN_HTML_CONTENT",
|
|
2153
|
+
"DUPLICATE_ATTRIBUTE": 2,
|
|
2154
|
+
"2": "DUPLICATE_ATTRIBUTE",
|
|
2155
|
+
"END_TAG_WITH_ATTRIBUTES": 3,
|
|
2156
|
+
"3": "END_TAG_WITH_ATTRIBUTES",
|
|
2157
|
+
"END_TAG_WITH_TRAILING_SOLIDUS": 4,
|
|
2158
|
+
"4": "END_TAG_WITH_TRAILING_SOLIDUS",
|
|
2159
|
+
"EOF_BEFORE_TAG_NAME": 5,
|
|
2160
|
+
"5": "EOF_BEFORE_TAG_NAME",
|
|
2161
|
+
"EOF_IN_CDATA": 6,
|
|
2162
|
+
"6": "EOF_IN_CDATA",
|
|
2163
|
+
"EOF_IN_COMMENT": 7,
|
|
2164
|
+
"7": "EOF_IN_COMMENT",
|
|
2165
|
+
"EOF_IN_SCRIPT_HTML_COMMENT_LIKE_TEXT": 8,
|
|
2166
|
+
"8": "EOF_IN_SCRIPT_HTML_COMMENT_LIKE_TEXT",
|
|
2167
|
+
"EOF_IN_TAG": 9,
|
|
2168
|
+
"9": "EOF_IN_TAG",
|
|
2169
|
+
"INCORRECTLY_CLOSED_COMMENT": 10,
|
|
2170
|
+
"10": "INCORRECTLY_CLOSED_COMMENT",
|
|
2171
|
+
"INCORRECTLY_OPENED_COMMENT": 11,
|
|
2172
|
+
"11": "INCORRECTLY_OPENED_COMMENT",
|
|
2173
|
+
"INVALID_FIRST_CHARACTER_OF_TAG_NAME": 12,
|
|
2174
|
+
"12": "INVALID_FIRST_CHARACTER_OF_TAG_NAME",
|
|
2175
|
+
"MISSING_ATTRIBUTE_VALUE": 13,
|
|
2176
|
+
"13": "MISSING_ATTRIBUTE_VALUE",
|
|
2177
|
+
"MISSING_END_TAG_NAME": 14,
|
|
2178
|
+
"14": "MISSING_END_TAG_NAME",
|
|
2179
|
+
"MISSING_WHITESPACE_BETWEEN_ATTRIBUTES": 15,
|
|
2180
|
+
"15": "MISSING_WHITESPACE_BETWEEN_ATTRIBUTES",
|
|
2181
|
+
"NESTED_COMMENT": 16,
|
|
2182
|
+
"16": "NESTED_COMMENT",
|
|
2183
|
+
"UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME": 17,
|
|
2184
|
+
"17": "UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME",
|
|
2185
|
+
"UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE": 18,
|
|
2186
|
+
"18": "UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE",
|
|
2187
|
+
"UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME": 19,
|
|
2188
|
+
"19": "UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME",
|
|
2189
|
+
"UNEXPECTED_NULL_CHARACTER": 20,
|
|
2190
|
+
"20": "UNEXPECTED_NULL_CHARACTER",
|
|
2191
|
+
"UNEXPECTED_QUESTION_MARK_INSTEAD_OF_TAG_NAME": 21,
|
|
2192
|
+
"21": "UNEXPECTED_QUESTION_MARK_INSTEAD_OF_TAG_NAME",
|
|
2193
|
+
"UNEXPECTED_SOLIDUS_IN_TAG": 22,
|
|
2194
|
+
"22": "UNEXPECTED_SOLIDUS_IN_TAG",
|
|
2195
|
+
"X_INVALID_END_TAG": 23,
|
|
2196
|
+
"23": "X_INVALID_END_TAG",
|
|
2197
|
+
"X_MISSING_END_TAG": 24,
|
|
2198
|
+
"24": "X_MISSING_END_TAG",
|
|
2199
|
+
"X_MISSING_INTERPOLATION_END": 25,
|
|
2200
|
+
"25": "X_MISSING_INTERPOLATION_END",
|
|
2201
|
+
"X_MISSING_DIRECTIVE_NAME": 26,
|
|
2202
|
+
"26": "X_MISSING_DIRECTIVE_NAME",
|
|
2203
|
+
"X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END": 27,
|
|
2204
|
+
"27": "X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END",
|
|
2205
|
+
"X_V_IF_NO_EXPRESSION": 28,
|
|
2206
|
+
"28": "X_V_IF_NO_EXPRESSION",
|
|
2207
|
+
"X_V_IF_SAME_KEY": 29,
|
|
2208
|
+
"29": "X_V_IF_SAME_KEY",
|
|
2209
|
+
"X_V_ELSE_NO_ADJACENT_IF": 30,
|
|
2210
|
+
"30": "X_V_ELSE_NO_ADJACENT_IF",
|
|
2211
|
+
"X_V_FOR_NO_EXPRESSION": 31,
|
|
2212
|
+
"31": "X_V_FOR_NO_EXPRESSION",
|
|
2213
|
+
"X_V_FOR_MALFORMED_EXPRESSION": 32,
|
|
2214
|
+
"32": "X_V_FOR_MALFORMED_EXPRESSION",
|
|
2215
|
+
"X_V_FOR_TEMPLATE_KEY_PLACEMENT": 33,
|
|
2216
|
+
"33": "X_V_FOR_TEMPLATE_KEY_PLACEMENT",
|
|
2217
|
+
"X_V_BIND_NO_EXPRESSION": 34,
|
|
2218
|
+
"34": "X_V_BIND_NO_EXPRESSION",
|
|
2219
|
+
"X_V_ON_NO_EXPRESSION": 35,
|
|
2220
|
+
"35": "X_V_ON_NO_EXPRESSION",
|
|
2221
|
+
"X_V_SLOT_UNEXPECTED_DIRECTIVE_ON_SLOT_OUTLET": 36,
|
|
2222
|
+
"36": "X_V_SLOT_UNEXPECTED_DIRECTIVE_ON_SLOT_OUTLET",
|
|
2223
|
+
"X_V_SLOT_MIXED_SLOT_USAGE": 37,
|
|
2224
|
+
"37": "X_V_SLOT_MIXED_SLOT_USAGE",
|
|
2225
|
+
"X_V_SLOT_DUPLICATE_SLOT_NAMES": 38,
|
|
2226
|
+
"38": "X_V_SLOT_DUPLICATE_SLOT_NAMES",
|
|
2227
|
+
"X_V_SLOT_EXTRANEOUS_DEFAULT_SLOT_CHILDREN": 39,
|
|
2228
|
+
"39": "X_V_SLOT_EXTRANEOUS_DEFAULT_SLOT_CHILDREN",
|
|
2229
|
+
"X_V_SLOT_MISPLACED": 40,
|
|
2230
|
+
"40": "X_V_SLOT_MISPLACED",
|
|
2231
|
+
"X_V_MODEL_NO_EXPRESSION": 41,
|
|
2232
|
+
"41": "X_V_MODEL_NO_EXPRESSION",
|
|
2233
|
+
"X_V_MODEL_MALFORMED_EXPRESSION": 42,
|
|
2234
|
+
"42": "X_V_MODEL_MALFORMED_EXPRESSION",
|
|
2235
|
+
"X_V_MODEL_ON_SCOPE_VARIABLE": 43,
|
|
2236
|
+
"43": "X_V_MODEL_ON_SCOPE_VARIABLE",
|
|
2237
|
+
"X_V_MODEL_ON_PROPS": 44,
|
|
2238
|
+
"44": "X_V_MODEL_ON_PROPS",
|
|
2239
|
+
"X_INVALID_EXPRESSION": 45,
|
|
2240
|
+
"45": "X_INVALID_EXPRESSION",
|
|
2241
|
+
"X_KEEP_ALIVE_INVALID_CHILDREN": 46,
|
|
2242
|
+
"46": "X_KEEP_ALIVE_INVALID_CHILDREN",
|
|
2243
|
+
"X_VNODE_HOOKS": 47,
|
|
2244
|
+
"47": "X_VNODE_HOOKS",
|
|
2245
|
+
"X_PREFIX_ID_NOT_SUPPORTED": 48,
|
|
2246
|
+
"48": "X_PREFIX_ID_NOT_SUPPORTED",
|
|
2247
|
+
"X_MODULE_MODE_NOT_SUPPORTED": 49,
|
|
2248
|
+
"49": "X_MODULE_MODE_NOT_SUPPORTED",
|
|
2249
|
+
"X_CACHE_HANDLER_NOT_SUPPORTED": 50,
|
|
2250
|
+
"50": "X_CACHE_HANDLER_NOT_SUPPORTED",
|
|
2251
|
+
"X_SCOPE_ID_NOT_SUPPORTED": 51,
|
|
2252
|
+
"51": "X_SCOPE_ID_NOT_SUPPORTED",
|
|
2253
|
+
"__EXTEND_POINT__": 52,
|
|
2254
|
+
"52": "__EXTEND_POINT__"
|
|
2255
|
+
};
|
|
2051
2256
|
const errorMessages = {
|
|
2052
2257
|
// parse errors
|
|
2053
2258
|
[0]: "Illegal comment.",
|
|
@@ -2100,16 +2305,14 @@ const errorMessages = {
|
|
|
2100
2305
|
Use a v-bind binding combined with a v-on listener that emits update:x event instead.`,
|
|
2101
2306
|
[45]: `Error parsing JavaScript expression: `,
|
|
2102
2307
|
[46]: `<KeepAlive> expects exactly one child component.`,
|
|
2308
|
+
[47]: `@vnode-* hooks in templates are deprecated. Use the vue: prefix instead. For example, @vnode-mounted should be changed to @vue:mounted. @vnode-* hooks support will be removed in 3.4.`,
|
|
2103
2309
|
// generic errors
|
|
2104
|
-
[
|
|
2105
|
-
[
|
|
2106
|
-
[
|
|
2107
|
-
[
|
|
2108
|
-
// deprecations
|
|
2109
|
-
[51]: `@vnode-* hooks in templates are deprecated. Use the vue: prefix instead. For example, @vnode-mounted should be changed to @vue:mounted. @vnode-* hooks support will be removed in 3.4.`,
|
|
2110
|
-
[52]: `v-is="component-name" has been deprecated. Use is="vue:component-name" instead. v-is support will be removed in 3.4.`,
|
|
2310
|
+
[48]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
|
|
2311
|
+
[49]: `ES module mode is not supported in this build of compiler.`,
|
|
2312
|
+
[50]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
|
|
2313
|
+
[51]: `"scopeId" option is only supported in module mode.`,
|
|
2111
2314
|
// just to fulfill types
|
|
2112
|
-
[
|
|
2315
|
+
[52]: ``
|
|
2113
2316
|
};
|
|
2114
2317
|
|
|
2115
2318
|
function getDefaultExportFromCjs (x) {
|
|
@@ -16918,7 +17121,8 @@ const defaultParserOptions = {
|
|
|
16918
17121
|
isCustomElement: NO,
|
|
16919
17122
|
onError: defaultOnError,
|
|
16920
17123
|
onWarn: defaultOnWarn,
|
|
16921
|
-
comments: true
|
|
17124
|
+
comments: true,
|
|
17125
|
+
prefixIdentifiers: false
|
|
16922
17126
|
};
|
|
16923
17127
|
let currentOptions = defaultParserOptions;
|
|
16924
17128
|
let currentRoot = null;
|
|
@@ -16960,7 +17164,7 @@ const tokenizer$2 = new Tokenizer$1(stack, {
|
|
|
16960
17164
|
}
|
|
16961
17165
|
addNode({
|
|
16962
17166
|
type: 5,
|
|
16963
|
-
content:
|
|
17167
|
+
content: createExp(exp, false, getLoc(innerStart, innerEnd)),
|
|
16964
17168
|
loc: getLoc(start, end)
|
|
16965
17169
|
});
|
|
16966
17170
|
},
|
|
@@ -17053,7 +17257,7 @@ const tokenizer$2 = new Tokenizer$1(stack, {
|
|
|
17053
17257
|
loc: getLoc(start)
|
|
17054
17258
|
};
|
|
17055
17259
|
if (name === "pre") {
|
|
17056
|
-
inVPre = true;
|
|
17260
|
+
inVPre = tokenizer$2.inVPre = true;
|
|
17057
17261
|
currentVPreBoundary = currentOpenTag;
|
|
17058
17262
|
const props = currentOpenTag.props;
|
|
17059
17263
|
for (let i = 0; i < props.length; i++) {
|
|
@@ -17065,13 +17269,15 @@ const tokenizer$2 = new Tokenizer$1(stack, {
|
|
|
17065
17269
|
}
|
|
17066
17270
|
},
|
|
17067
17271
|
ondirarg(start, end) {
|
|
17272
|
+
if (start === end)
|
|
17273
|
+
return;
|
|
17068
17274
|
const arg = getSlice(start, end);
|
|
17069
17275
|
if (inVPre) {
|
|
17070
17276
|
currentProp.name += arg;
|
|
17071
17277
|
setLocEnd(currentProp.nameLoc, end);
|
|
17072
17278
|
} else {
|
|
17073
17279
|
const isStatic = arg[0] !== `[`;
|
|
17074
|
-
currentProp.arg =
|
|
17280
|
+
currentProp.arg = createExp(
|
|
17075
17281
|
isStatic ? arg : arg.slice(1, -1),
|
|
17076
17282
|
isStatic,
|
|
17077
17283
|
getLoc(start, end),
|
|
@@ -17138,10 +17344,22 @@ const tokenizer$2 = new Tokenizer$1(stack, {
|
|
|
17138
17344
|
tokenizer$2.enterRCDATA(toCharCodes(`</template`), 0);
|
|
17139
17345
|
}
|
|
17140
17346
|
} else {
|
|
17141
|
-
|
|
17347
|
+
let expParseMode = 0 /* Normal */;
|
|
17348
|
+
{
|
|
17349
|
+
if (currentProp.name === "for") {
|
|
17350
|
+
expParseMode = 3 /* Skip */;
|
|
17351
|
+
} else if (currentProp.name === "slot") {
|
|
17352
|
+
expParseMode = 1 /* Params */;
|
|
17353
|
+
} else if (currentProp.name === "on" && currentAttrValue.includes(";")) {
|
|
17354
|
+
expParseMode = 2 /* Statements */;
|
|
17355
|
+
}
|
|
17356
|
+
}
|
|
17357
|
+
currentProp.exp = createExp(
|
|
17142
17358
|
currentAttrValue,
|
|
17143
17359
|
false,
|
|
17144
|
-
getLoc(currentAttrStartIndex, currentAttrEndIndex)
|
|
17360
|
+
getLoc(currentAttrStartIndex, currentAttrEndIndex),
|
|
17361
|
+
0,
|
|
17362
|
+
expParseMode
|
|
17145
17363
|
);
|
|
17146
17364
|
if (currentProp.name === "for") {
|
|
17147
17365
|
currentProp.forParseResult = parseForExpression(currentProp.exp);
|
|
@@ -17234,10 +17452,16 @@ function parseForExpression(input) {
|
|
|
17234
17452
|
if (!inMatch)
|
|
17235
17453
|
return;
|
|
17236
17454
|
const [, LHS, RHS] = inMatch;
|
|
17237
|
-
const createAliasExpression = (content, offset) => {
|
|
17455
|
+
const createAliasExpression = (content, offset, asParam = false) => {
|
|
17238
17456
|
const start = loc.start.offset + offset;
|
|
17239
17457
|
const end = start + content.length;
|
|
17240
|
-
return
|
|
17458
|
+
return createExp(
|
|
17459
|
+
content,
|
|
17460
|
+
false,
|
|
17461
|
+
getLoc(start, end),
|
|
17462
|
+
0,
|
|
17463
|
+
asParam ? 1 /* Params */ : 0 /* Normal */
|
|
17464
|
+
);
|
|
17241
17465
|
};
|
|
17242
17466
|
const result = {
|
|
17243
17467
|
source: createAliasExpression(RHS.trim(), exp.indexOf(RHS, LHS.length)),
|
|
@@ -17255,7 +17479,7 @@ function parseForExpression(input) {
|
|
|
17255
17479
|
let keyOffset;
|
|
17256
17480
|
if (keyContent) {
|
|
17257
17481
|
keyOffset = exp.indexOf(keyContent, trimmedOffset + valueContent.length);
|
|
17258
|
-
result.key = createAliasExpression(keyContent, keyOffset);
|
|
17482
|
+
result.key = createAliasExpression(keyContent, keyOffset, true);
|
|
17259
17483
|
}
|
|
17260
17484
|
if (iteratorMatch[2]) {
|
|
17261
17485
|
const indexContent = iteratorMatch[2].trim();
|
|
@@ -17265,13 +17489,14 @@ function parseForExpression(input) {
|
|
|
17265
17489
|
exp.indexOf(
|
|
17266
17490
|
indexContent,
|
|
17267
17491
|
result.key ? keyOffset + keyContent.length : trimmedOffset + valueContent.length
|
|
17268
|
-
)
|
|
17492
|
+
),
|
|
17493
|
+
true
|
|
17269
17494
|
);
|
|
17270
17495
|
}
|
|
17271
17496
|
}
|
|
17272
17497
|
}
|
|
17273
17498
|
if (valueContent) {
|
|
17274
|
-
result.value = createAliasExpression(valueContent, trimmedOffset);
|
|
17499
|
+
result.value = createAliasExpression(valueContent, trimmedOffset, true);
|
|
17275
17500
|
}
|
|
17276
17501
|
return result;
|
|
17277
17502
|
}
|
|
@@ -17342,7 +17567,7 @@ function onCloseTag(el, end, isImplied = false) {
|
|
|
17342
17567
|
inPre--;
|
|
17343
17568
|
}
|
|
17344
17569
|
if (currentVPreBoundary === el) {
|
|
17345
|
-
inVPre = false;
|
|
17570
|
+
inVPre = tokenizer$2.inVPre = false;
|
|
17346
17571
|
currentVPreBoundary = null;
|
|
17347
17572
|
}
|
|
17348
17573
|
if (tokenizer$2.inXML && (stack[0] ? stack[0].ns : currentOptions.ns) === 0) {
|
|
@@ -17506,8 +17731,36 @@ function dirToAttr(dir) {
|
|
|
17506
17731
|
}
|
|
17507
17732
|
return attr;
|
|
17508
17733
|
}
|
|
17509
|
-
function
|
|
17510
|
-
|
|
17734
|
+
function createExp(content, isStatic = false, loc, constType = 0, parseMode = 0 /* Normal */) {
|
|
17735
|
+
const exp = createSimpleExpression(content, isStatic, loc, constType);
|
|
17736
|
+
if (!isStatic && currentOptions.prefixIdentifiers && parseMode !== 3 /* Skip */ && content.trim()) {
|
|
17737
|
+
if (isSimpleIdentifier(content)) {
|
|
17738
|
+
exp.ast = null;
|
|
17739
|
+
return exp;
|
|
17740
|
+
}
|
|
17741
|
+
try {
|
|
17742
|
+
const plugins = currentOptions.expressionPlugins;
|
|
17743
|
+
const options = {
|
|
17744
|
+
plugins: plugins ? [...plugins, "typescript"] : ["typescript"]
|
|
17745
|
+
};
|
|
17746
|
+
if (parseMode === 2 /* Statements */) {
|
|
17747
|
+
exp.ast = parse_1$1(` ${content} `, options).program;
|
|
17748
|
+
} else if (parseMode === 1 /* Params */) {
|
|
17749
|
+
exp.ast = parseExpression_1(`(${content})=>{}`, options);
|
|
17750
|
+
} else {
|
|
17751
|
+
exp.ast = parseExpression_1(`(${content})`, options);
|
|
17752
|
+
}
|
|
17753
|
+
} catch (e) {
|
|
17754
|
+
exp.ast = false;
|
|
17755
|
+
emitError(45, loc.start.offset, e.message);
|
|
17756
|
+
}
|
|
17757
|
+
}
|
|
17758
|
+
return exp;
|
|
17759
|
+
}
|
|
17760
|
+
function emitError(code, index, message) {
|
|
17761
|
+
currentOptions.onError(
|
|
17762
|
+
createCompilerError(code, getLoc(index, index), void 0, message)
|
|
17763
|
+
);
|
|
17511
17764
|
}
|
|
17512
17765
|
function reset() {
|
|
17513
17766
|
tokenizer$2.reset();
|
|
@@ -17538,6 +17791,7 @@ function baseParse(input, options) {
|
|
|
17538
17791
|
}
|
|
17539
17792
|
}
|
|
17540
17793
|
tokenizer$2.mode = currentOptions.parseMode === "html" ? 1 : currentOptions.parseMode === "sfc" ? 2 : 0;
|
|
17794
|
+
tokenizer$2.inXML = currentOptions.ns === 1 || currentOptions.ns === 2;
|
|
17541
17795
|
const delimiters = options == null ? void 0 : options.delimiters;
|
|
17542
17796
|
if (delimiters) {
|
|
17543
17797
|
tokenizer$2.delimiterOpen = toCharCodes(delimiters[0]);
|
|
@@ -22403,7 +22657,7 @@ function walk$1(ast, { enter, leave }) {
|
|
|
22403
22657
|
}
|
|
22404
22658
|
|
|
22405
22659
|
function walkIdentifiers(root, onIdentifier, includeAll = false, parentStack = [], knownIds = /* @__PURE__ */ Object.create(null)) {
|
|
22406
|
-
const rootExp = root.type === "Program"
|
|
22660
|
+
const rootExp = root.type === "Program" ? root.body[0].type === "ExpressionStatement" && root.body[0].expression : root;
|
|
22407
22661
|
walk$1(root, {
|
|
22408
22662
|
enter(node, parent) {
|
|
22409
22663
|
parent && parentStack.push(parent);
|
|
@@ -22476,7 +22730,7 @@ function isInDestructureAssignment(parent, parentStack) {
|
|
|
22476
22730
|
}
|
|
22477
22731
|
function walkFunctionParams(node, onIdent) {
|
|
22478
22732
|
for (const p of node.params) {
|
|
22479
|
-
for (const id of extractIdentifiers(p)) {
|
|
22733
|
+
for (const id of extractIdentifiers$1(p)) {
|
|
22480
22734
|
onIdent(id);
|
|
22481
22735
|
}
|
|
22482
22736
|
}
|
|
@@ -22487,7 +22741,7 @@ function walkBlockDeclarations(block, onIdent) {
|
|
|
22487
22741
|
if (stmt.declare)
|
|
22488
22742
|
continue;
|
|
22489
22743
|
for (const decl of stmt.declarations) {
|
|
22490
|
-
for (const id of extractIdentifiers(decl.id)) {
|
|
22744
|
+
for (const id of extractIdentifiers$1(decl.id)) {
|
|
22491
22745
|
onIdent(id);
|
|
22492
22746
|
}
|
|
22493
22747
|
}
|
|
@@ -22499,7 +22753,7 @@ function walkBlockDeclarations(block, onIdent) {
|
|
|
22499
22753
|
const variable = stmt.type === "ForStatement" ? stmt.init : stmt.left;
|
|
22500
22754
|
if (variable && variable.type === "VariableDeclaration") {
|
|
22501
22755
|
for (const decl of variable.declarations) {
|
|
22502
|
-
for (const id of extractIdentifiers(decl.id)) {
|
|
22756
|
+
for (const id of extractIdentifiers$1(decl.id)) {
|
|
22503
22757
|
onIdent(id);
|
|
22504
22758
|
}
|
|
22505
22759
|
}
|
|
@@ -22507,7 +22761,7 @@ function walkBlockDeclarations(block, onIdent) {
|
|
|
22507
22761
|
}
|
|
22508
22762
|
}
|
|
22509
22763
|
}
|
|
22510
|
-
function extractIdentifiers(param, nodes = []) {
|
|
22764
|
+
function extractIdentifiers$1(param, nodes = []) {
|
|
22511
22765
|
switch (param.type) {
|
|
22512
22766
|
case "Identifier":
|
|
22513
22767
|
nodes.push(param);
|
|
@@ -22522,23 +22776,23 @@ function extractIdentifiers(param, nodes = []) {
|
|
|
22522
22776
|
case "ObjectPattern":
|
|
22523
22777
|
for (const prop of param.properties) {
|
|
22524
22778
|
if (prop.type === "RestElement") {
|
|
22525
|
-
extractIdentifiers(prop.argument, nodes);
|
|
22779
|
+
extractIdentifiers$1(prop.argument, nodes);
|
|
22526
22780
|
} else {
|
|
22527
|
-
extractIdentifiers(prop.value, nodes);
|
|
22781
|
+
extractIdentifiers$1(prop.value, nodes);
|
|
22528
22782
|
}
|
|
22529
22783
|
}
|
|
22530
22784
|
break;
|
|
22531
22785
|
case "ArrayPattern":
|
|
22532
22786
|
param.elements.forEach((element) => {
|
|
22533
22787
|
if (element)
|
|
22534
|
-
extractIdentifiers(element, nodes);
|
|
22788
|
+
extractIdentifiers$1(element, nodes);
|
|
22535
22789
|
});
|
|
22536
22790
|
break;
|
|
22537
22791
|
case "RestElement":
|
|
22538
|
-
extractIdentifiers(param.argument, nodes);
|
|
22792
|
+
extractIdentifiers$1(param.argument, nodes);
|
|
22539
22793
|
break;
|
|
22540
22794
|
case "AssignmentPattern":
|
|
22541
|
-
extractIdentifiers(param.left, nodes);
|
|
22795
|
+
extractIdentifiers$1(param.left, nodes);
|
|
22542
22796
|
break;
|
|
22543
22797
|
}
|
|
22544
22798
|
return nodes;
|
|
@@ -22752,7 +23006,11 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
|
|
|
22752
23006
|
};
|
|
22753
23007
|
const rawExp = node.content;
|
|
22754
23008
|
const bailConstant = constantBailRE.test(rawExp);
|
|
22755
|
-
|
|
23009
|
+
let ast = node.ast;
|
|
23010
|
+
if (ast === false) {
|
|
23011
|
+
return node;
|
|
23012
|
+
}
|
|
23013
|
+
if (ast === null || !ast && isSimpleIdentifier(rawExp)) {
|
|
22756
23014
|
const isScopeVarReference = context.identifiers[rawExp];
|
|
22757
23015
|
const isAllowedGlobal = isGloballyAllowed(rawExp);
|
|
22758
23016
|
const isLiteral = isLiteralWhitelisted(rawExp);
|
|
@@ -22770,22 +23028,23 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
|
|
|
22770
23028
|
}
|
|
22771
23029
|
return node;
|
|
22772
23030
|
}
|
|
22773
|
-
|
|
22774
|
-
|
|
22775
|
-
|
|
22776
|
-
|
|
22777
|
-
|
|
22778
|
-
|
|
22779
|
-
|
|
22780
|
-
|
|
22781
|
-
|
|
22782
|
-
|
|
22783
|
-
|
|
22784
|
-
|
|
22785
|
-
|
|
22786
|
-
|
|
22787
|
-
|
|
22788
|
-
|
|
23031
|
+
if (!ast) {
|
|
23032
|
+
const source = asRawStatements ? ` ${rawExp} ` : `(${rawExp})${asParams ? `=>{}` : ``}`;
|
|
23033
|
+
try {
|
|
23034
|
+
ast = parse_1$1(source, {
|
|
23035
|
+
plugins: context.expressionPlugins
|
|
23036
|
+
}).program;
|
|
23037
|
+
} catch (e) {
|
|
23038
|
+
context.onError(
|
|
23039
|
+
createCompilerError(
|
|
23040
|
+
45,
|
|
23041
|
+
node.loc,
|
|
23042
|
+
void 0,
|
|
23043
|
+
e.message
|
|
23044
|
+
)
|
|
23045
|
+
);
|
|
23046
|
+
return node;
|
|
23047
|
+
}
|
|
22789
23048
|
}
|
|
22790
23049
|
const ids = [];
|
|
22791
23050
|
const parentStack = [];
|
|
@@ -22825,15 +23084,15 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
|
|
|
22825
23084
|
if (leadingText.length || id.prefix) {
|
|
22826
23085
|
children.push(leadingText + (id.prefix || ``));
|
|
22827
23086
|
}
|
|
22828
|
-
const
|
|
23087
|
+
const source = rawExp.slice(start, end);
|
|
22829
23088
|
children.push(
|
|
22830
23089
|
createSimpleExpression(
|
|
22831
23090
|
id.name,
|
|
22832
23091
|
false,
|
|
22833
23092
|
{
|
|
22834
|
-
start: advancePositionWithClone(node.loc.start,
|
|
22835
|
-
end: advancePositionWithClone(node.loc.start,
|
|
22836
|
-
source
|
|
23093
|
+
start: advancePositionWithClone(node.loc.start, source, start),
|
|
23094
|
+
end: advancePositionWithClone(node.loc.start, source, end),
|
|
23095
|
+
source
|
|
22837
23096
|
},
|
|
22838
23097
|
id.isConstant ? 3 : 0
|
|
22839
23098
|
)
|
|
@@ -22845,6 +23104,7 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
|
|
|
22845
23104
|
let ret;
|
|
22846
23105
|
if (children.length) {
|
|
22847
23106
|
ret = createCompoundExpression(children, node.loc);
|
|
23107
|
+
ret.ast = ast;
|
|
22848
23108
|
} else {
|
|
22849
23109
|
ret = node;
|
|
22850
23110
|
ret.constType = bailConstant ? 0 : 3;
|
|
@@ -23798,6 +24058,10 @@ function resolveSetupReference(name, context) {
|
|
|
23798
24058
|
`${context.helperString(UNREF)}(${fromMaybeRef})`
|
|
23799
24059
|
) : `$setup[${JSON.stringify(fromMaybeRef)}]`;
|
|
23800
24060
|
}
|
|
24061
|
+
const fromProps = checkType("props");
|
|
24062
|
+
if (fromProps) {
|
|
24063
|
+
return `${context.helperString(UNREF)}(${context.inline ? "__props" : "$props"}[${JSON.stringify(fromProps)}])`;
|
|
24064
|
+
}
|
|
23801
24065
|
}
|
|
23802
24066
|
function buildProps(node, context, props = node.props, isComponent, isDynamicComponent, ssr = false) {
|
|
23803
24067
|
const { tag, loc: elementLoc, children } = node;
|
|
@@ -23838,6 +24102,9 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
23838
24102
|
if (isEventHandler && isReservedProp(name)) {
|
|
23839
24103
|
hasVnodeHook = true;
|
|
23840
24104
|
}
|
|
24105
|
+
if (isEventHandler && value.type === 14) {
|
|
24106
|
+
value = value.arguments[0];
|
|
24107
|
+
}
|
|
23841
24108
|
if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) {
|
|
23842
24109
|
return;
|
|
23843
24110
|
}
|
|
@@ -24269,9 +24536,7 @@ const transformOn$1 = (dir, node, context, augmentor) => {
|
|
|
24269
24536
|
if (arg.isStatic) {
|
|
24270
24537
|
let rawName = arg.content;
|
|
24271
24538
|
if (rawName.startsWith("vnode")) {
|
|
24272
|
-
context.
|
|
24273
|
-
createCompilerError(51, arg.loc)
|
|
24274
|
-
);
|
|
24539
|
+
context.onError(createCompilerError(47, arg.loc));
|
|
24275
24540
|
}
|
|
24276
24541
|
if (rawName.startsWith("vue:")) {
|
|
24277
24542
|
rawName = `vnode-${rawName.slice(4)}`;
|
|
@@ -24658,10 +24923,10 @@ function baseCompile(source, options = {}) {
|
|
|
24658
24923
|
const isModuleMode = options.mode === "module";
|
|
24659
24924
|
const prefixIdentifiers = options.prefixIdentifiers === true || isModuleMode;
|
|
24660
24925
|
if (!prefixIdentifiers && options.cacheHandlers) {
|
|
24661
|
-
onError(createCompilerError(
|
|
24926
|
+
onError(createCompilerError(50));
|
|
24662
24927
|
}
|
|
24663
24928
|
if (options.scopeId && !isModuleMode) {
|
|
24664
|
-
onError(createCompilerError(
|
|
24929
|
+
onError(createCompilerError(51));
|
|
24665
24930
|
}
|
|
24666
24931
|
const ast = isString$2(source) ? baseParse(source, options) : source;
|
|
24667
24932
|
const [nodeTransforms, directiveTransforms] = getBaseTransformPreset(prefixIdentifiers);
|
|
@@ -24696,6 +24961,19 @@ function baseCompile(source, options = {}) {
|
|
|
24696
24961
|
);
|
|
24697
24962
|
}
|
|
24698
24963
|
|
|
24964
|
+
const BindingTypes = {
|
|
24965
|
+
"DATA": "data",
|
|
24966
|
+
"PROPS": "props",
|
|
24967
|
+
"PROPS_ALIASED": "props-aliased",
|
|
24968
|
+
"SETUP_LET": "setup-let",
|
|
24969
|
+
"SETUP_CONST": "setup-const",
|
|
24970
|
+
"SETUP_REACTIVE_CONST": "setup-reactive-const",
|
|
24971
|
+
"SETUP_MAYBE_REF": "setup-maybe-ref",
|
|
24972
|
+
"SETUP_REF": "setup-ref",
|
|
24973
|
+
"OPTIONS": "options",
|
|
24974
|
+
"LITERAL_CONST": "literal-const"
|
|
24975
|
+
};
|
|
24976
|
+
|
|
24699
24977
|
const noopDirectiveTransform = () => ({ props: [] });
|
|
24700
24978
|
|
|
24701
24979
|
const V_MODEL_RADIO = Symbol(`vModelRadio` );
|
|
@@ -24800,6 +25078,32 @@ function createDOMCompilerError(code, loc) {
|
|
|
24800
25078
|
DOMErrorMessages
|
|
24801
25079
|
);
|
|
24802
25080
|
}
|
|
25081
|
+
const DOMErrorCodes = {
|
|
25082
|
+
"X_V_HTML_NO_EXPRESSION": 53,
|
|
25083
|
+
"53": "X_V_HTML_NO_EXPRESSION",
|
|
25084
|
+
"X_V_HTML_WITH_CHILDREN": 54,
|
|
25085
|
+
"54": "X_V_HTML_WITH_CHILDREN",
|
|
25086
|
+
"X_V_TEXT_NO_EXPRESSION": 55,
|
|
25087
|
+
"55": "X_V_TEXT_NO_EXPRESSION",
|
|
25088
|
+
"X_V_TEXT_WITH_CHILDREN": 56,
|
|
25089
|
+
"56": "X_V_TEXT_WITH_CHILDREN",
|
|
25090
|
+
"X_V_MODEL_ON_INVALID_ELEMENT": 57,
|
|
25091
|
+
"57": "X_V_MODEL_ON_INVALID_ELEMENT",
|
|
25092
|
+
"X_V_MODEL_ARG_ON_ELEMENT": 58,
|
|
25093
|
+
"58": "X_V_MODEL_ARG_ON_ELEMENT",
|
|
25094
|
+
"X_V_MODEL_ON_FILE_INPUT_ELEMENT": 59,
|
|
25095
|
+
"59": "X_V_MODEL_ON_FILE_INPUT_ELEMENT",
|
|
25096
|
+
"X_V_MODEL_UNNECESSARY_VALUE": 60,
|
|
25097
|
+
"60": "X_V_MODEL_UNNECESSARY_VALUE",
|
|
25098
|
+
"X_V_SHOW_NO_EXPRESSION": 61,
|
|
25099
|
+
"61": "X_V_SHOW_NO_EXPRESSION",
|
|
25100
|
+
"X_TRANSITION_INVALID_CHILDREN": 62,
|
|
25101
|
+
"62": "X_TRANSITION_INVALID_CHILDREN",
|
|
25102
|
+
"X_IGNORED_SIDE_EFFECT_TAG": 63,
|
|
25103
|
+
"63": "X_IGNORED_SIDE_EFFECT_TAG",
|
|
25104
|
+
"__EXTEND_POINT__": 64,
|
|
25105
|
+
"64": "__EXTEND_POINT__"
|
|
25106
|
+
};
|
|
24803
25107
|
const DOMErrorMessages = {
|
|
24804
25108
|
[53]: `v-html is missing expression.`,
|
|
24805
25109
|
[54]: `v-html will override element children.`,
|
|
@@ -25362,6 +25666,7 @@ function parse$8(template, options = {}) {
|
|
|
25362
25666
|
var CompilerDOM = /*#__PURE__*/Object.freeze({
|
|
25363
25667
|
__proto__: null,
|
|
25364
25668
|
BASE_TRANSITION: BASE_TRANSITION,
|
|
25669
|
+
BindingTypes: BindingTypes,
|
|
25365
25670
|
CAMELIZE: CAMELIZE,
|
|
25366
25671
|
CAPITALIZE: CAPITALIZE,
|
|
25367
25672
|
CREATE_BLOCK: CREATE_BLOCK,
|
|
@@ -25372,9 +25677,14 @@ var CompilerDOM = /*#__PURE__*/Object.freeze({
|
|
|
25372
25677
|
CREATE_STATIC: CREATE_STATIC,
|
|
25373
25678
|
CREATE_TEXT: CREATE_TEXT,
|
|
25374
25679
|
CREATE_VNODE: CREATE_VNODE,
|
|
25680
|
+
CompilerDeprecationTypes: CompilerDeprecationTypes,
|
|
25681
|
+
ConstantTypes: ConstantTypes,
|
|
25375
25682
|
DOMDirectiveTransforms: DOMDirectiveTransforms,
|
|
25683
|
+
DOMErrorCodes: DOMErrorCodes,
|
|
25376
25684
|
DOMErrorMessages: DOMErrorMessages,
|
|
25377
25685
|
DOMNodeTransforms: DOMNodeTransforms,
|
|
25686
|
+
ElementTypes: ElementTypes,
|
|
25687
|
+
ErrorCodes: ErrorCodes,
|
|
25378
25688
|
FRAGMENT: FRAGMENT,
|
|
25379
25689
|
GUARD_REACTIVE_PROPS: GUARD_REACTIVE_PROPS,
|
|
25380
25690
|
IS_MEMO_SAME: IS_MEMO_SAME,
|
|
@@ -25384,6 +25694,8 @@ var CompilerDOM = /*#__PURE__*/Object.freeze({
|
|
|
25384
25694
|
NORMALIZE_CLASS: NORMALIZE_CLASS,
|
|
25385
25695
|
NORMALIZE_PROPS: NORMALIZE_PROPS,
|
|
25386
25696
|
NORMALIZE_STYLE: NORMALIZE_STYLE,
|
|
25697
|
+
Namespaces: Namespaces,
|
|
25698
|
+
NodeTypes: NodeTypes,
|
|
25387
25699
|
OPEN_BLOCK: OPEN_BLOCK,
|
|
25388
25700
|
POP_SCOPE_ID: POP_SCOPE_ID,
|
|
25389
25701
|
PUSH_SCOPE_ID: PUSH_SCOPE_ID,
|
|
@@ -25449,7 +25761,7 @@ var CompilerDOM = /*#__PURE__*/Object.freeze({
|
|
|
25449
25761
|
createTransformContext: createTransformContext,
|
|
25450
25762
|
createVNodeCall: createVNodeCall,
|
|
25451
25763
|
errorMessages: errorMessages,
|
|
25452
|
-
extractIdentifiers: extractIdentifiers,
|
|
25764
|
+
extractIdentifiers: extractIdentifiers$1,
|
|
25453
25765
|
findDir: findDir,
|
|
25454
25766
|
findProp: findProp,
|
|
25455
25767
|
forAliasRE: forAliasRE,
|
|
@@ -25808,8 +26120,11 @@ function getEscapedPropName(key) {
|
|
|
25808
26120
|
return propNameEscapeSymbolsRE.test(key) ? JSON.stringify(key) : key;
|
|
25809
26121
|
}
|
|
25810
26122
|
const cssVarNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g;
|
|
25811
|
-
function getEscapedCssVarName(key) {
|
|
25812
|
-
return key.replace(
|
|
26123
|
+
function getEscapedCssVarName(key, doubleEscape) {
|
|
26124
|
+
return key.replace(
|
|
26125
|
+
cssVarNameEscapeSymbolsRE,
|
|
26126
|
+
(s) => doubleEscape ? `\\\\${s}` : `\\${s}`
|
|
26127
|
+
);
|
|
25813
26128
|
}
|
|
25814
26129
|
|
|
25815
26130
|
function pad$1 (hash, len) {
|
|
@@ -25886,15 +26201,15 @@ const CSS_VARS_HELPER = `useCssVars`;
|
|
|
25886
26201
|
function genCssVarsFromList(vars, id, isProd, isSSR = false) {
|
|
25887
26202
|
return `{
|
|
25888
26203
|
${vars.map(
|
|
25889
|
-
(key) => `"${isSSR ? `--` : ``}${genVarName(id, key, isProd)}": (${key})`
|
|
26204
|
+
(key) => `"${isSSR ? `--` : ``}${genVarName(id, key, isProd, isSSR)}": (${key})`
|
|
25890
26205
|
).join(",\n ")}
|
|
25891
26206
|
}`;
|
|
25892
26207
|
}
|
|
25893
|
-
function genVarName(id, raw, isProd) {
|
|
26208
|
+
function genVarName(id, raw, isProd, isSSR = false) {
|
|
25894
26209
|
if (isProd) {
|
|
25895
26210
|
return hash(id + raw);
|
|
25896
26211
|
} else {
|
|
25897
|
-
return `${id}-${getEscapedCssVarName(raw)}`;
|
|
26212
|
+
return `${id}-${getEscapedCssVarName(raw, isSSR)}`;
|
|
25898
26213
|
}
|
|
25899
26214
|
}
|
|
25900
26215
|
function normalizeExpression(exp) {
|
|
@@ -26248,11 +26563,7 @@ function createCache(max = 500) {
|
|
|
26248
26563
|
}
|
|
26249
26564
|
|
|
26250
26565
|
function isImportUsed(local, sfc) {
|
|
26251
|
-
return
|
|
26252
|
-
// #4274 escape $ since it's a special char in regex
|
|
26253
|
-
// (and is the only regex special char that is valid in identifiers)
|
|
26254
|
-
`[^\\w$_]${local.replace(/\$/g, "\\$")}[^\\w$_]`
|
|
26255
|
-
).test(resolveTemplateUsageCheckString(sfc));
|
|
26566
|
+
return resolveTemplateUsageCheckString(sfc).has(local);
|
|
26256
26567
|
}
|
|
26257
26568
|
const templateUsageCheckCache = createCache();
|
|
26258
26569
|
function resolveTemplateUsageCheckString(sfc) {
|
|
@@ -26261,80 +26572,51 @@ function resolveTemplateUsageCheckString(sfc) {
|
|
|
26261
26572
|
if (cached) {
|
|
26262
26573
|
return cached;
|
|
26263
26574
|
}
|
|
26264
|
-
|
|
26575
|
+
const ids = /* @__PURE__ */ new Set();
|
|
26265
26576
|
ast.children.forEach(walk);
|
|
26266
26577
|
function walk(node) {
|
|
26267
26578
|
var _a;
|
|
26268
26579
|
switch (node.type) {
|
|
26269
26580
|
case 1:
|
|
26270
26581
|
if (!parserOptions.isNativeTag(node.tag) && !parserOptions.isBuiltInComponent(node.tag)) {
|
|
26271
|
-
|
|
26582
|
+
ids.add(camelize(node.tag));
|
|
26583
|
+
ids.add(capitalize$1(camelize(node.tag)));
|
|
26272
26584
|
}
|
|
26273
26585
|
for (let i = 0; i < node.props.length; i++) {
|
|
26274
26586
|
const prop = node.props[i];
|
|
26275
26587
|
if (prop.type === 7) {
|
|
26276
26588
|
if (!isBuiltInDirective(prop.name)) {
|
|
26277
|
-
|
|
26589
|
+
ids.add(`v${capitalize$1(camelize(prop.name))}`);
|
|
26278
26590
|
}
|
|
26279
26591
|
if (prop.arg && !prop.arg.isStatic) {
|
|
26280
|
-
|
|
26281
|
-
prop.arg.content
|
|
26282
|
-
)}`;
|
|
26592
|
+
extractIdentifiers(ids, prop.arg);
|
|
26283
26593
|
}
|
|
26284
|
-
if (prop.
|
|
26285
|
-
|
|
26286
|
-
|
|
26287
|
-
|
|
26288
|
-
)}`;
|
|
26594
|
+
if (prop.name === "for") {
|
|
26595
|
+
extractIdentifiers(ids, prop.forParseResult.source);
|
|
26596
|
+
} else if (prop.exp) {
|
|
26597
|
+
extractIdentifiers(ids, prop.exp);
|
|
26289
26598
|
}
|
|
26290
26599
|
}
|
|
26291
26600
|
if (prop.type === 6 && prop.name === "ref" && ((_a = prop.value) == null ? void 0 : _a.content)) {
|
|
26292
|
-
|
|
26601
|
+
ids.add(prop.value.content);
|
|
26293
26602
|
}
|
|
26294
26603
|
}
|
|
26295
26604
|
node.children.forEach(walk);
|
|
26296
26605
|
break;
|
|
26297
26606
|
case 5:
|
|
26298
|
-
|
|
26607
|
+
extractIdentifiers(ids, node.content);
|
|
26299
26608
|
break;
|
|
26300
26609
|
}
|
|
26301
26610
|
}
|
|
26302
|
-
|
|
26303
|
-
|
|
26304
|
-
return code;
|
|
26611
|
+
templateUsageCheckCache.set(content, ids);
|
|
26612
|
+
return ids;
|
|
26305
26613
|
}
|
|
26306
|
-
function
|
|
26307
|
-
if (
|
|
26308
|
-
|
|
26309
|
-
|
|
26310
|
-
|
|
26311
|
-
exp = `()=>{return ${exp}}`;
|
|
26312
|
-
} else if (dir === "for") {
|
|
26313
|
-
const inMatch = exp.match(forAliasRE);
|
|
26314
|
-
if (inMatch) {
|
|
26315
|
-
let [, LHS, RHS] = inMatch;
|
|
26316
|
-
LHS = LHS.trim().replace(/^\(|\)$/g, "");
|
|
26317
|
-
return processExp(`(${LHS})=>{}`) + processExp(RHS);
|
|
26318
|
-
}
|
|
26319
|
-
}
|
|
26320
|
-
let ret = "";
|
|
26321
|
-
const ast = parseExpression_1(exp, { plugins: ["typescript"] });
|
|
26322
|
-
walkIdentifiers(ast, (node) => {
|
|
26323
|
-
ret += `,` + node.name;
|
|
26324
|
-
});
|
|
26325
|
-
return ret;
|
|
26614
|
+
function extractIdentifiers(ids, node) {
|
|
26615
|
+
if (node.ast) {
|
|
26616
|
+
walkIdentifiers(node.ast, (n) => ids.add(n.name));
|
|
26617
|
+
} else if (node.ast === null) {
|
|
26618
|
+
ids.add(node.content);
|
|
26326
26619
|
}
|
|
26327
|
-
return stripStrings(exp);
|
|
26328
|
-
}
|
|
26329
|
-
function stripStrings(exp) {
|
|
26330
|
-
return exp.replace(/'[^']*'|"[^"]*"/g, "").replace(/`[^`]+`/g, stripTemplateString);
|
|
26331
|
-
}
|
|
26332
|
-
function stripTemplateString(str) {
|
|
26333
|
-
const interpMatch = str.match(/\${[^}]+}/g);
|
|
26334
|
-
if (interpMatch) {
|
|
26335
|
-
return interpMatch.map((m) => m.slice(2, -1)).join(",");
|
|
26336
|
-
}
|
|
26337
|
-
return "";
|
|
26338
26620
|
}
|
|
26339
26621
|
|
|
26340
26622
|
const DEFAULT_FILENAME = "anonymous.vue";
|
|
@@ -26345,7 +26627,8 @@ function parse$7(source, {
|
|
|
26345
26627
|
sourceRoot = "",
|
|
26346
26628
|
pad = false,
|
|
26347
26629
|
ignoreEmpty = true,
|
|
26348
|
-
compiler = CompilerDOM
|
|
26630
|
+
compiler = CompilerDOM,
|
|
26631
|
+
parseExpressions = true
|
|
26349
26632
|
} = {}) {
|
|
26350
26633
|
const sourceKey = source + sourceMap + filename + sourceRoot + pad + compiler.parse;
|
|
26351
26634
|
const cache = parseCache$1.get(sourceKey);
|
|
@@ -26367,6 +26650,7 @@ function parse$7(source, {
|
|
|
26367
26650
|
const errors = [];
|
|
26368
26651
|
const ast = compiler.parse(source, {
|
|
26369
26652
|
parseMode: "sfc",
|
|
26653
|
+
prefixIdentifiers: parseExpressions,
|
|
26370
26654
|
onError: (e) => {
|
|
26371
26655
|
errors.push(e);
|
|
26372
26656
|
}
|
|
@@ -26456,22 +26740,29 @@ function parse$7(source, {
|
|
|
26456
26740
|
descriptor.script = null;
|
|
26457
26741
|
}
|
|
26458
26742
|
}
|
|
26743
|
+
let templateColumnOffset = 0;
|
|
26744
|
+
if (descriptor.template && (descriptor.template.lang === "pug" || descriptor.template.lang === "jade")) {
|
|
26745
|
+
[descriptor.template.content, templateColumnOffset] = dedent(
|
|
26746
|
+
descriptor.template.content
|
|
26747
|
+
);
|
|
26748
|
+
}
|
|
26459
26749
|
if (sourceMap) {
|
|
26460
|
-
const genMap = (block) => {
|
|
26750
|
+
const genMap = (block, columnOffset = 0) => {
|
|
26461
26751
|
if (block && !block.src) {
|
|
26462
26752
|
block.map = generateSourceMap(
|
|
26463
26753
|
filename,
|
|
26464
26754
|
source,
|
|
26465
26755
|
block.content,
|
|
26466
26756
|
sourceRoot,
|
|
26467
|
-
!pad || block.type === "template" ? block.loc.start.line - 1 : 0
|
|
26757
|
+
!pad || block.type === "template" ? block.loc.start.line - 1 : 0,
|
|
26758
|
+
columnOffset
|
|
26468
26759
|
);
|
|
26469
26760
|
}
|
|
26470
26761
|
};
|
|
26471
|
-
genMap(descriptor.template);
|
|
26762
|
+
genMap(descriptor.template, templateColumnOffset);
|
|
26472
26763
|
genMap(descriptor.script);
|
|
26473
|
-
descriptor.styles.forEach(genMap);
|
|
26474
|
-
descriptor.customBlocks.forEach(genMap);
|
|
26764
|
+
descriptor.styles.forEach((s) => genMap(s));
|
|
26765
|
+
descriptor.customBlocks.forEach((s) => genMap(s));
|
|
26475
26766
|
}
|
|
26476
26767
|
descriptor.cssVars = parseCssVars(descriptor);
|
|
26477
26768
|
const slottedRE = /(?:::v-|:)slotted\(/;
|
|
@@ -26529,7 +26820,7 @@ function createBlock(node, source, pad) {
|
|
|
26529
26820
|
const splitRE = /\r?\n/g;
|
|
26530
26821
|
const emptyRE = /^(?:\/\/)?\s*$/;
|
|
26531
26822
|
const replaceRE = /./g;
|
|
26532
|
-
function generateSourceMap(filename, source, generated, sourceRoot, lineOffset) {
|
|
26823
|
+
function generateSourceMap(filename, source, generated, sourceRoot, lineOffset, columnOffset) {
|
|
26533
26824
|
const map = new SourceMapGenerator$6({
|
|
26534
26825
|
file: filename.replace(/\\/g, "/"),
|
|
26535
26826
|
sourceRoot: sourceRoot.replace(/\\/g, "/")
|
|
@@ -26544,7 +26835,7 @@ function generateSourceMap(filename, source, generated, sourceRoot, lineOffset)
|
|
|
26544
26835
|
if (!/\s/.test(line[i])) {
|
|
26545
26836
|
map._mappings.add({
|
|
26546
26837
|
originalLine,
|
|
26547
|
-
originalColumn: i,
|
|
26838
|
+
originalColumn: i + columnOffset,
|
|
26548
26839
|
generatedLine,
|
|
26549
26840
|
generatedColumn: i,
|
|
26550
26841
|
source: filename,
|
|
@@ -26595,6 +26886,26 @@ function hmrShouldReload(prevImports, next) {
|
|
|
26595
26886
|
}
|
|
26596
26887
|
return false;
|
|
26597
26888
|
}
|
|
26889
|
+
function dedent(s) {
|
|
26890
|
+
const lines = s.split("\n");
|
|
26891
|
+
const minIndent = lines.reduce(function(minIndent2, line) {
|
|
26892
|
+
var _a, _b;
|
|
26893
|
+
if (line.trim() === "") {
|
|
26894
|
+
return minIndent2;
|
|
26895
|
+
}
|
|
26896
|
+
const indent = ((_b = (_a = line.match(/^\s*/)) == null ? void 0 : _a[0]) == null ? void 0 : _b.length) || 0;
|
|
26897
|
+
return Math.min(indent, minIndent2);
|
|
26898
|
+
}, Infinity);
|
|
26899
|
+
if (minIndent === 0) {
|
|
26900
|
+
return [s, minIndent];
|
|
26901
|
+
}
|
|
26902
|
+
return [
|
|
26903
|
+
lines.map(function(line) {
|
|
26904
|
+
return line.slice(minIndent);
|
|
26905
|
+
}).join("\n"),
|
|
26906
|
+
minIndent
|
|
26907
|
+
];
|
|
26908
|
+
}
|
|
26598
26909
|
|
|
26599
26910
|
/*! https://mths.be/punycode v1.4.1 by @mathias */
|
|
26600
26911
|
|
|
@@ -32142,7 +32453,7 @@ var _polyfillNode_fs$1 = /*#__PURE__*/Object.freeze({
|
|
|
32142
32453
|
|
|
32143
32454
|
var require$$0$2 = /*@__PURE__*/getAugmentedNamespace(_polyfillNode_fs$1);
|
|
32144
32455
|
|
|
32145
|
-
var require$$
|
|
32456
|
+
var require$$1 = /*@__PURE__*/getAugmentedNamespace(_polyfillNode_path);
|
|
32146
32457
|
|
|
32147
32458
|
var require$$0$1 = /*@__PURE__*/getAugmentedNamespace(_polyfillNode_util$1);
|
|
32148
32459
|
|
|
@@ -33712,7 +34023,7 @@ var nonSecure = { nanoid: nanoid$1, customAlphabet };
|
|
|
33712
34023
|
|
|
33713
34024
|
let { SourceMapConsumer: SourceMapConsumer$4, SourceMapGenerator: SourceMapGenerator$5 } = sourceMap$2;
|
|
33714
34025
|
let { existsSync, readFileSync } = require$$0$2;
|
|
33715
|
-
let { dirname: dirname$1, join } = require$$
|
|
34026
|
+
let { dirname: dirname$1, join } = require$$1;
|
|
33716
34027
|
|
|
33717
34028
|
function fromBase64(str) {
|
|
33718
34029
|
if (Buffer$1) {
|
|
@@ -33853,7 +34164,7 @@ PreviousMap$2.default = PreviousMap$2;
|
|
|
33853
34164
|
|
|
33854
34165
|
let { SourceMapConsumer: SourceMapConsumer$3, SourceMapGenerator: SourceMapGenerator$4 } = sourceMap$2;
|
|
33855
34166
|
let { fileURLToPath, pathToFileURL: pathToFileURL$1 } = require$$2;
|
|
33856
|
-
let { isAbsolute, resolve: resolve$1 } = require$$
|
|
34167
|
+
let { isAbsolute, resolve: resolve$1 } = require$$1;
|
|
33857
34168
|
let { nanoid } = nonSecure;
|
|
33858
34169
|
|
|
33859
34170
|
let terminalHighlight = terminalHighlight_1;
|
|
@@ -34099,7 +34410,7 @@ if (terminalHighlight && terminalHighlight.registerInput) {
|
|
|
34099
34410
|
}
|
|
34100
34411
|
|
|
34101
34412
|
let { SourceMapConsumer: SourceMapConsumer$2, SourceMapGenerator: SourceMapGenerator$3 } = sourceMap$2;
|
|
34102
|
-
let { dirname, relative, resolve, sep } = require$$
|
|
34413
|
+
let { dirname, relative, resolve, sep } = require$$1;
|
|
34103
34414
|
let { pathToFileURL } = require$$2;
|
|
34104
34415
|
|
|
34105
34416
|
let Input$3 = input;
|
|
@@ -36534,7 +36845,7 @@ let Root$2 = root$2;
|
|
|
36534
36845
|
|
|
36535
36846
|
let Processor$1 = class Processor {
|
|
36536
36847
|
constructor(plugins = []) {
|
|
36537
|
-
this.version = '8.4.
|
|
36848
|
+
this.version = '8.4.32';
|
|
36538
36849
|
this.plugins = this.normalize(plugins);
|
|
36539
36850
|
}
|
|
36540
36851
|
|
|
@@ -40326,14 +40637,19 @@ function rewriteSelector(id, selector, selectorRoot, slotted = false) {
|
|
|
40326
40637
|
return false;
|
|
40327
40638
|
}
|
|
40328
40639
|
}
|
|
40329
|
-
if (n.type !== "pseudo" && n.type !== "combinator") {
|
|
40640
|
+
if (n.type !== "pseudo" && n.type !== "combinator" || n.type === "pseudo" && (n.value === ":is" || n.value === ":where")) {
|
|
40330
40641
|
node = n;
|
|
40331
40642
|
}
|
|
40332
|
-
|
|
40333
|
-
|
|
40643
|
+
});
|
|
40644
|
+
if (node) {
|
|
40645
|
+
const { type, value } = node;
|
|
40646
|
+
if (type === "pseudo" && (value === ":is" || value === ":where")) {
|
|
40647
|
+
node.nodes.forEach(
|
|
40648
|
+
(value2) => rewriteSelector(id, value2, selectorRoot, slotted)
|
|
40649
|
+
);
|
|
40334
40650
|
shouldInject = false;
|
|
40335
40651
|
}
|
|
40336
|
-
}
|
|
40652
|
+
}
|
|
40337
40653
|
if (node) {
|
|
40338
40654
|
node.spaces.after = "";
|
|
40339
40655
|
} else {
|
|
@@ -45493,33 +45809,39 @@ class TypeScope {
|
|
|
45493
45809
|
this.exportedDeclares = /* @__PURE__ */ Object.create(null);
|
|
45494
45810
|
}
|
|
45495
45811
|
}
|
|
45496
|
-
function resolveTypeElements(ctx, node, scope) {
|
|
45812
|
+
function resolveTypeElements(ctx, node, scope, typeParameters) {
|
|
45497
45813
|
if (node._resolvedElements) {
|
|
45498
45814
|
return node._resolvedElements;
|
|
45499
45815
|
}
|
|
45500
45816
|
return node._resolvedElements = innerResolveTypeElements(
|
|
45501
45817
|
ctx,
|
|
45502
45818
|
node,
|
|
45503
|
-
node._ownerScope || scope || ctxToScope(ctx)
|
|
45819
|
+
node._ownerScope || scope || ctxToScope(ctx),
|
|
45820
|
+
typeParameters
|
|
45504
45821
|
);
|
|
45505
45822
|
}
|
|
45506
|
-
function innerResolveTypeElements(ctx, node, scope) {
|
|
45823
|
+
function innerResolveTypeElements(ctx, node, scope, typeParameters) {
|
|
45507
45824
|
var _a, _b;
|
|
45508
45825
|
switch (node.type) {
|
|
45509
45826
|
case "TSTypeLiteral":
|
|
45510
|
-
return typeElementsToMap(ctx, node.members, scope);
|
|
45827
|
+
return typeElementsToMap(ctx, node.members, scope, typeParameters);
|
|
45511
45828
|
case "TSInterfaceDeclaration":
|
|
45512
|
-
return resolveInterfaceMembers(ctx, node, scope);
|
|
45829
|
+
return resolveInterfaceMembers(ctx, node, scope, typeParameters);
|
|
45513
45830
|
case "TSTypeAliasDeclaration":
|
|
45514
45831
|
case "TSParenthesizedType":
|
|
45515
|
-
return resolveTypeElements(
|
|
45832
|
+
return resolveTypeElements(
|
|
45833
|
+
ctx,
|
|
45834
|
+
node.typeAnnotation,
|
|
45835
|
+
scope,
|
|
45836
|
+
typeParameters
|
|
45837
|
+
);
|
|
45516
45838
|
case "TSFunctionType": {
|
|
45517
45839
|
return { props: {}, calls: [node] };
|
|
45518
45840
|
}
|
|
45519
45841
|
case "TSUnionType":
|
|
45520
45842
|
case "TSIntersectionType":
|
|
45521
45843
|
return mergeElements(
|
|
45522
|
-
node.types.map((t) => resolveTypeElements(ctx, t, scope)),
|
|
45844
|
+
node.types.map((t) => resolveTypeElements(ctx, t, scope, typeParameters)),
|
|
45523
45845
|
node.type
|
|
45524
45846
|
);
|
|
45525
45847
|
case "TSMappedType":
|
|
@@ -45536,20 +45858,53 @@ function innerResolveTypeElements(ctx, node, scope) {
|
|
|
45536
45858
|
const typeName = getReferenceName(node);
|
|
45537
45859
|
if ((typeName === "ExtractPropTypes" || typeName === "ExtractPublicPropTypes") && node.typeParameters && ((_a = scope.imports[typeName]) == null ? void 0 : _a.source) === "vue") {
|
|
45538
45860
|
return resolveExtractPropTypes(
|
|
45539
|
-
resolveTypeElements(
|
|
45861
|
+
resolveTypeElements(
|
|
45862
|
+
ctx,
|
|
45863
|
+
node.typeParameters.params[0],
|
|
45864
|
+
scope,
|
|
45865
|
+
typeParameters
|
|
45866
|
+
),
|
|
45540
45867
|
scope
|
|
45541
45868
|
);
|
|
45542
45869
|
}
|
|
45543
45870
|
const resolved = resolveTypeReference(ctx, node, scope);
|
|
45544
45871
|
if (resolved) {
|
|
45545
|
-
|
|
45872
|
+
const typeParams = /* @__PURE__ */ Object.create(null);
|
|
45873
|
+
if ((resolved.type === "TSTypeAliasDeclaration" || resolved.type === "TSInterfaceDeclaration") && resolved.typeParameters && node.typeParameters) {
|
|
45874
|
+
resolved.typeParameters.params.forEach((p, i) => {
|
|
45875
|
+
let param = typeParameters && typeParameters[p.name];
|
|
45876
|
+
if (!param)
|
|
45877
|
+
param = node.typeParameters.params[i];
|
|
45878
|
+
typeParams[p.name] = param;
|
|
45879
|
+
});
|
|
45880
|
+
}
|
|
45881
|
+
return resolveTypeElements(
|
|
45882
|
+
ctx,
|
|
45883
|
+
resolved,
|
|
45884
|
+
resolved._ownerScope,
|
|
45885
|
+
typeParams
|
|
45886
|
+
);
|
|
45546
45887
|
} else {
|
|
45547
45888
|
if (typeof typeName === "string") {
|
|
45889
|
+
if (typeParameters && typeParameters[typeName]) {
|
|
45890
|
+
return resolveTypeElements(
|
|
45891
|
+
ctx,
|
|
45892
|
+
typeParameters[typeName],
|
|
45893
|
+
scope,
|
|
45894
|
+
typeParameters
|
|
45895
|
+
);
|
|
45896
|
+
}
|
|
45548
45897
|
if (
|
|
45549
45898
|
// @ts-ignore
|
|
45550
45899
|
SupportedBuiltinsSet.has(typeName)
|
|
45551
45900
|
) {
|
|
45552
|
-
return resolveBuiltin(
|
|
45901
|
+
return resolveBuiltin(
|
|
45902
|
+
ctx,
|
|
45903
|
+
node,
|
|
45904
|
+
typeName,
|
|
45905
|
+
scope,
|
|
45906
|
+
typeParameters
|
|
45907
|
+
);
|
|
45553
45908
|
} else if (typeName === "ReturnType" && node.typeParameters) {
|
|
45554
45909
|
const ret = resolveReturnType(
|
|
45555
45910
|
ctx,
|
|
@@ -45598,10 +45953,14 @@ function innerResolveTypeElements(ctx, node, scope) {
|
|
|
45598
45953
|
}
|
|
45599
45954
|
return ctx.error(`Unresolvable type: ${node.type}`, node, scope);
|
|
45600
45955
|
}
|
|
45601
|
-
function typeElementsToMap(ctx, elements, scope = ctxToScope(ctx)) {
|
|
45956
|
+
function typeElementsToMap(ctx, elements, scope = ctxToScope(ctx), typeParameters) {
|
|
45602
45957
|
const res = { props: {} };
|
|
45603
45958
|
for (const e of elements) {
|
|
45604
45959
|
if (e.type === "TSPropertySignature" || e.type === "TSMethodSignature") {
|
|
45960
|
+
if (typeParameters) {
|
|
45961
|
+
scope = createChildScope(scope);
|
|
45962
|
+
Object.assign(scope.types, typeParameters);
|
|
45963
|
+
}
|
|
45605
45964
|
e._ownerScope = scope;
|
|
45606
45965
|
const name = getId(e.key);
|
|
45607
45966
|
if (name && !e.computed) {
|
|
@@ -45664,8 +46023,13 @@ function createProperty(key, typeAnnotation, scope, optional) {
|
|
|
45664
46023
|
_ownerScope: scope
|
|
45665
46024
|
};
|
|
45666
46025
|
}
|
|
45667
|
-
function resolveInterfaceMembers(ctx, node, scope) {
|
|
45668
|
-
const base = typeElementsToMap(
|
|
46026
|
+
function resolveInterfaceMembers(ctx, node, scope, typeParameters) {
|
|
46027
|
+
const base = typeElementsToMap(
|
|
46028
|
+
ctx,
|
|
46029
|
+
node.body.body,
|
|
46030
|
+
node._ownerScope,
|
|
46031
|
+
typeParameters
|
|
46032
|
+
);
|
|
45669
46033
|
if (node.extends) {
|
|
45670
46034
|
for (const ext of node.extends) {
|
|
45671
46035
|
if (ext.leadingComments && ext.leadingComments.some((c) => c.value.includes("@vue-ignore"))) {
|
|
@@ -45839,8 +46203,13 @@ const SupportedBuiltinsSet = /* @__PURE__ */ new Set([
|
|
|
45839
46203
|
"Pick",
|
|
45840
46204
|
"Omit"
|
|
45841
46205
|
]);
|
|
45842
|
-
function resolveBuiltin(ctx, node, name, scope) {
|
|
45843
|
-
const t = resolveTypeElements(
|
|
46206
|
+
function resolveBuiltin(ctx, node, name, scope, typeParameters) {
|
|
46207
|
+
const t = resolveTypeElements(
|
|
46208
|
+
ctx,
|
|
46209
|
+
node.typeParameters.params[0],
|
|
46210
|
+
scope,
|
|
46211
|
+
typeParameters
|
|
46212
|
+
);
|
|
45844
46213
|
switch (name) {
|
|
45845
46214
|
case "Partial": {
|
|
45846
46215
|
const res2 = { props: {}, calls: t.calls };
|
|
@@ -45968,7 +46337,21 @@ function resolveGlobalScope(ctx) {
|
|
|
45968
46337
|
let ts;
|
|
45969
46338
|
let loadTS;
|
|
45970
46339
|
function registerTS(_loadTS) {
|
|
45971
|
-
loadTS =
|
|
46340
|
+
loadTS = () => {
|
|
46341
|
+
try {
|
|
46342
|
+
return _loadTS();
|
|
46343
|
+
} catch (err) {
|
|
46344
|
+
if (typeof err.message === "string" && err.message.includes("Cannot find module")) {
|
|
46345
|
+
throw new Error(
|
|
46346
|
+
'Failed to load TypeScript, which is required for resolving imported types. Please make sure "typescript" is installed as a project dependency.'
|
|
46347
|
+
);
|
|
46348
|
+
} else {
|
|
46349
|
+
throw new Error(
|
|
46350
|
+
"Failed to load TypeScript for resolving imported types."
|
|
46351
|
+
);
|
|
46352
|
+
}
|
|
46353
|
+
}
|
|
46354
|
+
};
|
|
45972
46355
|
}
|
|
45973
46356
|
function resolveFS(ctx) {
|
|
45974
46357
|
if (ctx.fs) {
|
|
@@ -46002,7 +46385,12 @@ function resolveTypeFromImport(ctx, node, name, scope) {
|
|
|
46002
46385
|
return resolveTypeReference(ctx, node, sourceScope, imported, true);
|
|
46003
46386
|
}
|
|
46004
46387
|
function importSourceToScope(ctx, node, scope, source) {
|
|
46005
|
-
|
|
46388
|
+
let fs;
|
|
46389
|
+
try {
|
|
46390
|
+
fs = resolveFS(ctx);
|
|
46391
|
+
} catch (err) {
|
|
46392
|
+
return ctx.error(err.message, node, scope);
|
|
46393
|
+
}
|
|
46006
46394
|
if (!fs) {
|
|
46007
46395
|
return ctx.error(
|
|
46008
46396
|
`No fs option provided to \`compileScript\` in non-Node environment. File system access is required for resolving imported types.`,
|
|
@@ -46127,14 +46515,7 @@ function moduleDeclToScope(ctx, node, parentScope) {
|
|
|
46127
46515
|
if (node._resolvedChildScope) {
|
|
46128
46516
|
return node._resolvedChildScope;
|
|
46129
46517
|
}
|
|
46130
|
-
const scope =
|
|
46131
|
-
parentScope.filename,
|
|
46132
|
-
parentScope.source,
|
|
46133
|
-
parentScope.offset,
|
|
46134
|
-
Object.create(parentScope.imports),
|
|
46135
|
-
Object.create(parentScope.types),
|
|
46136
|
-
Object.create(parentScope.declares)
|
|
46137
|
-
);
|
|
46518
|
+
const scope = createChildScope(parentScope);
|
|
46138
46519
|
if (node.body.type === "TSModuleDeclaration") {
|
|
46139
46520
|
const decl = node.body;
|
|
46140
46521
|
decl._ownerScope = scope;
|
|
@@ -46145,6 +46526,16 @@ function moduleDeclToScope(ctx, node, parentScope) {
|
|
|
46145
46526
|
}
|
|
46146
46527
|
return node._resolvedChildScope = scope;
|
|
46147
46528
|
}
|
|
46529
|
+
function createChildScope(parentScope) {
|
|
46530
|
+
return new TypeScope(
|
|
46531
|
+
parentScope.filename,
|
|
46532
|
+
parentScope.source,
|
|
46533
|
+
parentScope.offset,
|
|
46534
|
+
Object.create(parentScope.imports),
|
|
46535
|
+
Object.create(parentScope.types),
|
|
46536
|
+
Object.create(parentScope.declares)
|
|
46537
|
+
);
|
|
46538
|
+
}
|
|
46148
46539
|
const importExportRE = /^Import|^Export/;
|
|
46149
46540
|
function recordTypes(ctx, body, scope, asGlobal = false) {
|
|
46150
46541
|
const { types, declares, exportedTypes, exportedDeclares, imports } = scope;
|
|
@@ -46266,7 +46657,7 @@ function recordType(node, types, declares, overwriteId) {
|
|
|
46266
46657
|
types[overwriteId || getId(node.id)] = node;
|
|
46267
46658
|
break;
|
|
46268
46659
|
case "TSTypeAliasDeclaration":
|
|
46269
|
-
types[node.id.name] = node.typeAnnotation;
|
|
46660
|
+
types[node.id.name] = node.typeParameters ? node : node.typeAnnotation;
|
|
46270
46661
|
break;
|
|
46271
46662
|
case "TSDeclareFunction":
|
|
46272
46663
|
if (node.id)
|
|
@@ -46806,7 +47197,7 @@ function genRuntimeProps(ctx) {
|
|
|
46806
47197
|
);
|
|
46807
47198
|
}
|
|
46808
47199
|
if (defaults.length) {
|
|
46809
|
-
propsDecls =
|
|
47200
|
+
propsDecls = `/*#__PURE__*/${ctx.helper(
|
|
46810
47201
|
`mergeDefaults`
|
|
46811
47202
|
)}(${propsDecls}, {
|
|
46812
47203
|
${defaults.join(",\n ")}
|
|
@@ -46818,7 +47209,9 @@ function genRuntimeProps(ctx) {
|
|
|
46818
47209
|
}
|
|
46819
47210
|
const modelsDecls = genModelProps(ctx);
|
|
46820
47211
|
if (propsDecls && modelsDecls) {
|
|
46821
|
-
return
|
|
47212
|
+
return `/*#__PURE__*/${ctx.helper(
|
|
47213
|
+
"mergeModels"
|
|
47214
|
+
)}(${propsDecls}, ${modelsDecls})`;
|
|
46822
47215
|
} else {
|
|
46823
47216
|
return modelsDecls || propsDecls;
|
|
46824
47217
|
}
|
|
@@ -46840,9 +47233,9 @@ function extractRuntimeProps(ctx) {
|
|
|
46840
47233
|
${propStrings.join(",\n ")}
|
|
46841
47234
|
}`;
|
|
46842
47235
|
if (ctx.propsRuntimeDefaults && !hasStaticDefaults) {
|
|
46843
|
-
propsDecls =
|
|
46844
|
-
|
|
46845
|
-
)})`;
|
|
47236
|
+
propsDecls = `/*#__PURE__*/${ctx.helper(
|
|
47237
|
+
"mergeDefaults"
|
|
47238
|
+
)}(${propsDecls}, ${ctx.getString(ctx.propsRuntimeDefaults)})`;
|
|
46846
47239
|
}
|
|
46847
47240
|
return propsDecls;
|
|
46848
47241
|
}
|
|
@@ -47060,7 +47453,7 @@ function transformDestructuredProps(ctx, vueImportAliases) {
|
|
|
47060
47453
|
}
|
|
47061
47454
|
for (const decl of stmt.declarations) {
|
|
47062
47455
|
const isDefineProps = isRoot && decl.init && isCallOf(unwrapTSNode(decl.init), "defineProps");
|
|
47063
|
-
for (const id of extractIdentifiers(decl.id)) {
|
|
47456
|
+
for (const id of extractIdentifiers$1(decl.id)) {
|
|
47064
47457
|
if (isDefineProps) {
|
|
47065
47458
|
excludedIds.add(id);
|
|
47066
47459
|
} else {
|
|
@@ -47179,7 +47572,9 @@ function genRuntimeEmits(ctx) {
|
|
|
47179
47572
|
}
|
|
47180
47573
|
if (ctx.hasDefineModelCall) {
|
|
47181
47574
|
let modelEmitsDecl = `[${Object.keys(ctx.modelDecls).map((n) => JSON.stringify(`update:${n}`)).join(", ")}]`;
|
|
47182
|
-
emitsDecl = emitsDecl ?
|
|
47575
|
+
emitsDecl = emitsDecl ? `/*#__PURE__*/${ctx.helper(
|
|
47576
|
+
"mergeModels"
|
|
47577
|
+
)}(${emitsDecl}, ${modelEmitsDecl})` : modelEmitsDecl;
|
|
47183
47578
|
}
|
|
47184
47579
|
return emitsDecl;
|
|
47185
47580
|
}
|
|
@@ -48131,9 +48526,9 @@ function isStaticNode(node) {
|
|
|
48131
48526
|
return false;
|
|
48132
48527
|
}
|
|
48133
48528
|
|
|
48134
|
-
const version = "3.4.0-alpha.
|
|
48529
|
+
const version = "3.4.0-alpha.4";
|
|
48135
48530
|
const parseCache = parseCache$1;
|
|
48136
48531
|
const walk = walk$1;
|
|
48137
48532
|
const shouldTransformRef = () => false;
|
|
48138
48533
|
|
|
48139
|
-
export { MagicString, parse_1$1 as babelParse, compileScript, compileStyle, compileStyleAsync, compileTemplate, extractIdentifiers, extractRuntimeEmits, extractRuntimeProps, generateCodeFrame, inferRuntimeType, invalidateTypeCache, isInDestructureAssignment, isStaticProperty, parse$7 as parse, parseCache, registerTS, resolveTypeElements, rewriteDefault, rewriteDefaultAST, shouldTransformRef, version, walk, walkIdentifiers };
|
|
48534
|
+
export { MagicString, parse_1$1 as babelParse, compileScript, compileStyle, compileStyleAsync, compileTemplate, extractIdentifiers$1 as extractIdentifiers, extractRuntimeEmits, extractRuntimeProps, generateCodeFrame, inferRuntimeType, invalidateTypeCache, isInDestructureAssignment, isStaticProperty, parse$7 as parse, parseCache, registerTS, resolveTypeElements, rewriteDefault, rewriteDefaultAST, shouldTransformRef, version, walk, walkIdentifiers };
|