@vue/compiler-core 3.4.0-alpha.3 → 3.4.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/compiler-core.cjs.js +658 -371
- package/dist/compiler-core.cjs.prod.js +658 -369
- package/dist/compiler-core.d.ts +38 -15
- package/dist/compiler-core.esm-bundler.js +384 -144
- package/package.json +4 -4
|
@@ -5,8 +5,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var shared = require('@vue/shared');
|
|
6
6
|
var decode_js = require('entities/lib/decode.js');
|
|
7
7
|
var parser = require('@babel/parser');
|
|
8
|
-
var sourceMapJs = require('source-map-js');
|
|
9
8
|
var estreeWalker = require('estree-walker');
|
|
9
|
+
var sourceMapJs = require('source-map-js');
|
|
10
10
|
|
|
11
11
|
const FRAGMENT = Symbol(``);
|
|
12
12
|
const TELEPORT = Symbol(``);
|
|
@@ -96,6 +96,90 @@ function registerRuntimeHelpers(helpers) {
|
|
|
96
96
|
});
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
+
const Namespaces = {
|
|
100
|
+
"HTML": 0,
|
|
101
|
+
"0": "HTML",
|
|
102
|
+
"SVG": 1,
|
|
103
|
+
"1": "SVG",
|
|
104
|
+
"MATH_ML": 2,
|
|
105
|
+
"2": "MATH_ML"
|
|
106
|
+
};
|
|
107
|
+
const NodeTypes = {
|
|
108
|
+
"ROOT": 0,
|
|
109
|
+
"0": "ROOT",
|
|
110
|
+
"ELEMENT": 1,
|
|
111
|
+
"1": "ELEMENT",
|
|
112
|
+
"TEXT": 2,
|
|
113
|
+
"2": "TEXT",
|
|
114
|
+
"COMMENT": 3,
|
|
115
|
+
"3": "COMMENT",
|
|
116
|
+
"SIMPLE_EXPRESSION": 4,
|
|
117
|
+
"4": "SIMPLE_EXPRESSION",
|
|
118
|
+
"INTERPOLATION": 5,
|
|
119
|
+
"5": "INTERPOLATION",
|
|
120
|
+
"ATTRIBUTE": 6,
|
|
121
|
+
"6": "ATTRIBUTE",
|
|
122
|
+
"DIRECTIVE": 7,
|
|
123
|
+
"7": "DIRECTIVE",
|
|
124
|
+
"COMPOUND_EXPRESSION": 8,
|
|
125
|
+
"8": "COMPOUND_EXPRESSION",
|
|
126
|
+
"IF": 9,
|
|
127
|
+
"9": "IF",
|
|
128
|
+
"IF_BRANCH": 10,
|
|
129
|
+
"10": "IF_BRANCH",
|
|
130
|
+
"FOR": 11,
|
|
131
|
+
"11": "FOR",
|
|
132
|
+
"TEXT_CALL": 12,
|
|
133
|
+
"12": "TEXT_CALL",
|
|
134
|
+
"VNODE_CALL": 13,
|
|
135
|
+
"13": "VNODE_CALL",
|
|
136
|
+
"JS_CALL_EXPRESSION": 14,
|
|
137
|
+
"14": "JS_CALL_EXPRESSION",
|
|
138
|
+
"JS_OBJECT_EXPRESSION": 15,
|
|
139
|
+
"15": "JS_OBJECT_EXPRESSION",
|
|
140
|
+
"JS_PROPERTY": 16,
|
|
141
|
+
"16": "JS_PROPERTY",
|
|
142
|
+
"JS_ARRAY_EXPRESSION": 17,
|
|
143
|
+
"17": "JS_ARRAY_EXPRESSION",
|
|
144
|
+
"JS_FUNCTION_EXPRESSION": 18,
|
|
145
|
+
"18": "JS_FUNCTION_EXPRESSION",
|
|
146
|
+
"JS_CONDITIONAL_EXPRESSION": 19,
|
|
147
|
+
"19": "JS_CONDITIONAL_EXPRESSION",
|
|
148
|
+
"JS_CACHE_EXPRESSION": 20,
|
|
149
|
+
"20": "JS_CACHE_EXPRESSION",
|
|
150
|
+
"JS_BLOCK_STATEMENT": 21,
|
|
151
|
+
"21": "JS_BLOCK_STATEMENT",
|
|
152
|
+
"JS_TEMPLATE_LITERAL": 22,
|
|
153
|
+
"22": "JS_TEMPLATE_LITERAL",
|
|
154
|
+
"JS_IF_STATEMENT": 23,
|
|
155
|
+
"23": "JS_IF_STATEMENT",
|
|
156
|
+
"JS_ASSIGNMENT_EXPRESSION": 24,
|
|
157
|
+
"24": "JS_ASSIGNMENT_EXPRESSION",
|
|
158
|
+
"JS_SEQUENCE_EXPRESSION": 25,
|
|
159
|
+
"25": "JS_SEQUENCE_EXPRESSION",
|
|
160
|
+
"JS_RETURN_STATEMENT": 26,
|
|
161
|
+
"26": "JS_RETURN_STATEMENT"
|
|
162
|
+
};
|
|
163
|
+
const ElementTypes = {
|
|
164
|
+
"ELEMENT": 0,
|
|
165
|
+
"0": "ELEMENT",
|
|
166
|
+
"COMPONENT": 1,
|
|
167
|
+
"1": "COMPONENT",
|
|
168
|
+
"SLOT": 2,
|
|
169
|
+
"2": "SLOT",
|
|
170
|
+
"TEMPLATE": 3,
|
|
171
|
+
"3": "TEMPLATE"
|
|
172
|
+
};
|
|
173
|
+
const ConstantTypes = {
|
|
174
|
+
"NOT_CONSTANT": 0,
|
|
175
|
+
"0": "NOT_CONSTANT",
|
|
176
|
+
"CAN_SKIP_PATCH": 1,
|
|
177
|
+
"1": "CAN_SKIP_PATCH",
|
|
178
|
+
"CAN_HOIST": 2,
|
|
179
|
+
"2": "CAN_HOIST",
|
|
180
|
+
"CAN_STRINGIFY": 3,
|
|
181
|
+
"3": "CAN_STRINGIFY"
|
|
182
|
+
};
|
|
99
183
|
const locStub = {
|
|
100
184
|
start: { line: 1, column: 1, offset: 0 },
|
|
101
185
|
end: { line: 1, column: 1, offset: 0 },
|
|
@@ -350,7 +434,9 @@ class Tokenizer {
|
|
|
350
434
|
this.inRCDATA = false;
|
|
351
435
|
/** For disabling RCDATA tags handling */
|
|
352
436
|
this.inXML = false;
|
|
353
|
-
/**
|
|
437
|
+
/** For disabling interpolation parsing in v-pre */
|
|
438
|
+
this.inVPre = false;
|
|
439
|
+
/** Record newline positions for fast line / column calculation */
|
|
354
440
|
this.newlines = [];
|
|
355
441
|
this.mode = 0;
|
|
356
442
|
this.delimiterOpen = defaultDelimitersOpen;
|
|
@@ -375,6 +461,7 @@ class Tokenizer {
|
|
|
375
461
|
this.sectionStart = 0;
|
|
376
462
|
this.index = 0;
|
|
377
463
|
this.baseState = 1;
|
|
464
|
+
this.inRCDATA = false;
|
|
378
465
|
this.currentSequence = void 0;
|
|
379
466
|
this.newlines.length = 0;
|
|
380
467
|
this.delimiterOpen = defaultDelimitersOpen;
|
|
@@ -415,7 +502,7 @@ class Tokenizer {
|
|
|
415
502
|
this.sectionStart = this.index;
|
|
416
503
|
} else if (c === 38) {
|
|
417
504
|
this.startEntity();
|
|
418
|
-
} else if (c === this.delimiterOpen[0]) {
|
|
505
|
+
} else if (!this.inVPre && c === this.delimiterOpen[0]) {
|
|
419
506
|
this.state = 2;
|
|
420
507
|
this.delimiterIndex = 0;
|
|
421
508
|
this.stateInterpolationOpen(c);
|
|
@@ -1151,6 +1238,16 @@ class Tokenizer {
|
|
|
1151
1238
|
}
|
|
1152
1239
|
}
|
|
1153
1240
|
|
|
1241
|
+
const CompilerDeprecationTypes = {
|
|
1242
|
+
"COMPILER_IS_ON_ELEMENT": "COMPILER_IS_ON_ELEMENT",
|
|
1243
|
+
"COMPILER_V_BIND_SYNC": "COMPILER_V_BIND_SYNC",
|
|
1244
|
+
"COMPILER_V_BIND_OBJECT_ORDER": "COMPILER_V_BIND_OBJECT_ORDER",
|
|
1245
|
+
"COMPILER_V_ON_NATIVE": "COMPILER_V_ON_NATIVE",
|
|
1246
|
+
"COMPILER_V_IF_V_FOR_PRECEDENCE": "COMPILER_V_IF_V_FOR_PRECEDENCE",
|
|
1247
|
+
"COMPILER_NATIVE_TEMPLATE": "COMPILER_NATIVE_TEMPLATE",
|
|
1248
|
+
"COMPILER_INLINE_TEMPLATE": "COMPILER_INLINE_TEMPLATE",
|
|
1249
|
+
"COMPILER_FILTERS": "COMPILER_FILTER"
|
|
1250
|
+
};
|
|
1154
1251
|
const deprecationData = {
|
|
1155
1252
|
["COMPILER_IS_ON_ELEMENT"]: {
|
|
1156
1253
|
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:".`,
|
|
@@ -1228,6 +1325,114 @@ function createCompilerError(code, loc, messages, additionalMessage) {
|
|
|
1228
1325
|
error.loc = loc;
|
|
1229
1326
|
return error;
|
|
1230
1327
|
}
|
|
1328
|
+
const ErrorCodes = {
|
|
1329
|
+
"ABRUPT_CLOSING_OF_EMPTY_COMMENT": 0,
|
|
1330
|
+
"0": "ABRUPT_CLOSING_OF_EMPTY_COMMENT",
|
|
1331
|
+
"CDATA_IN_HTML_CONTENT": 1,
|
|
1332
|
+
"1": "CDATA_IN_HTML_CONTENT",
|
|
1333
|
+
"DUPLICATE_ATTRIBUTE": 2,
|
|
1334
|
+
"2": "DUPLICATE_ATTRIBUTE",
|
|
1335
|
+
"END_TAG_WITH_ATTRIBUTES": 3,
|
|
1336
|
+
"3": "END_TAG_WITH_ATTRIBUTES",
|
|
1337
|
+
"END_TAG_WITH_TRAILING_SOLIDUS": 4,
|
|
1338
|
+
"4": "END_TAG_WITH_TRAILING_SOLIDUS",
|
|
1339
|
+
"EOF_BEFORE_TAG_NAME": 5,
|
|
1340
|
+
"5": "EOF_BEFORE_TAG_NAME",
|
|
1341
|
+
"EOF_IN_CDATA": 6,
|
|
1342
|
+
"6": "EOF_IN_CDATA",
|
|
1343
|
+
"EOF_IN_COMMENT": 7,
|
|
1344
|
+
"7": "EOF_IN_COMMENT",
|
|
1345
|
+
"EOF_IN_SCRIPT_HTML_COMMENT_LIKE_TEXT": 8,
|
|
1346
|
+
"8": "EOF_IN_SCRIPT_HTML_COMMENT_LIKE_TEXT",
|
|
1347
|
+
"EOF_IN_TAG": 9,
|
|
1348
|
+
"9": "EOF_IN_TAG",
|
|
1349
|
+
"INCORRECTLY_CLOSED_COMMENT": 10,
|
|
1350
|
+
"10": "INCORRECTLY_CLOSED_COMMENT",
|
|
1351
|
+
"INCORRECTLY_OPENED_COMMENT": 11,
|
|
1352
|
+
"11": "INCORRECTLY_OPENED_COMMENT",
|
|
1353
|
+
"INVALID_FIRST_CHARACTER_OF_TAG_NAME": 12,
|
|
1354
|
+
"12": "INVALID_FIRST_CHARACTER_OF_TAG_NAME",
|
|
1355
|
+
"MISSING_ATTRIBUTE_VALUE": 13,
|
|
1356
|
+
"13": "MISSING_ATTRIBUTE_VALUE",
|
|
1357
|
+
"MISSING_END_TAG_NAME": 14,
|
|
1358
|
+
"14": "MISSING_END_TAG_NAME",
|
|
1359
|
+
"MISSING_WHITESPACE_BETWEEN_ATTRIBUTES": 15,
|
|
1360
|
+
"15": "MISSING_WHITESPACE_BETWEEN_ATTRIBUTES",
|
|
1361
|
+
"NESTED_COMMENT": 16,
|
|
1362
|
+
"16": "NESTED_COMMENT",
|
|
1363
|
+
"UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME": 17,
|
|
1364
|
+
"17": "UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME",
|
|
1365
|
+
"UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE": 18,
|
|
1366
|
+
"18": "UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE",
|
|
1367
|
+
"UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME": 19,
|
|
1368
|
+
"19": "UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME",
|
|
1369
|
+
"UNEXPECTED_NULL_CHARACTER": 20,
|
|
1370
|
+
"20": "UNEXPECTED_NULL_CHARACTER",
|
|
1371
|
+
"UNEXPECTED_QUESTION_MARK_INSTEAD_OF_TAG_NAME": 21,
|
|
1372
|
+
"21": "UNEXPECTED_QUESTION_MARK_INSTEAD_OF_TAG_NAME",
|
|
1373
|
+
"UNEXPECTED_SOLIDUS_IN_TAG": 22,
|
|
1374
|
+
"22": "UNEXPECTED_SOLIDUS_IN_TAG",
|
|
1375
|
+
"X_INVALID_END_TAG": 23,
|
|
1376
|
+
"23": "X_INVALID_END_TAG",
|
|
1377
|
+
"X_MISSING_END_TAG": 24,
|
|
1378
|
+
"24": "X_MISSING_END_TAG",
|
|
1379
|
+
"X_MISSING_INTERPOLATION_END": 25,
|
|
1380
|
+
"25": "X_MISSING_INTERPOLATION_END",
|
|
1381
|
+
"X_MISSING_DIRECTIVE_NAME": 26,
|
|
1382
|
+
"26": "X_MISSING_DIRECTIVE_NAME",
|
|
1383
|
+
"X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END": 27,
|
|
1384
|
+
"27": "X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END",
|
|
1385
|
+
"X_V_IF_NO_EXPRESSION": 28,
|
|
1386
|
+
"28": "X_V_IF_NO_EXPRESSION",
|
|
1387
|
+
"X_V_IF_SAME_KEY": 29,
|
|
1388
|
+
"29": "X_V_IF_SAME_KEY",
|
|
1389
|
+
"X_V_ELSE_NO_ADJACENT_IF": 30,
|
|
1390
|
+
"30": "X_V_ELSE_NO_ADJACENT_IF",
|
|
1391
|
+
"X_V_FOR_NO_EXPRESSION": 31,
|
|
1392
|
+
"31": "X_V_FOR_NO_EXPRESSION",
|
|
1393
|
+
"X_V_FOR_MALFORMED_EXPRESSION": 32,
|
|
1394
|
+
"32": "X_V_FOR_MALFORMED_EXPRESSION",
|
|
1395
|
+
"X_V_FOR_TEMPLATE_KEY_PLACEMENT": 33,
|
|
1396
|
+
"33": "X_V_FOR_TEMPLATE_KEY_PLACEMENT",
|
|
1397
|
+
"X_V_BIND_NO_EXPRESSION": 34,
|
|
1398
|
+
"34": "X_V_BIND_NO_EXPRESSION",
|
|
1399
|
+
"X_V_ON_NO_EXPRESSION": 35,
|
|
1400
|
+
"35": "X_V_ON_NO_EXPRESSION",
|
|
1401
|
+
"X_V_SLOT_UNEXPECTED_DIRECTIVE_ON_SLOT_OUTLET": 36,
|
|
1402
|
+
"36": "X_V_SLOT_UNEXPECTED_DIRECTIVE_ON_SLOT_OUTLET",
|
|
1403
|
+
"X_V_SLOT_MIXED_SLOT_USAGE": 37,
|
|
1404
|
+
"37": "X_V_SLOT_MIXED_SLOT_USAGE",
|
|
1405
|
+
"X_V_SLOT_DUPLICATE_SLOT_NAMES": 38,
|
|
1406
|
+
"38": "X_V_SLOT_DUPLICATE_SLOT_NAMES",
|
|
1407
|
+
"X_V_SLOT_EXTRANEOUS_DEFAULT_SLOT_CHILDREN": 39,
|
|
1408
|
+
"39": "X_V_SLOT_EXTRANEOUS_DEFAULT_SLOT_CHILDREN",
|
|
1409
|
+
"X_V_SLOT_MISPLACED": 40,
|
|
1410
|
+
"40": "X_V_SLOT_MISPLACED",
|
|
1411
|
+
"X_V_MODEL_NO_EXPRESSION": 41,
|
|
1412
|
+
"41": "X_V_MODEL_NO_EXPRESSION",
|
|
1413
|
+
"X_V_MODEL_MALFORMED_EXPRESSION": 42,
|
|
1414
|
+
"42": "X_V_MODEL_MALFORMED_EXPRESSION",
|
|
1415
|
+
"X_V_MODEL_ON_SCOPE_VARIABLE": 43,
|
|
1416
|
+
"43": "X_V_MODEL_ON_SCOPE_VARIABLE",
|
|
1417
|
+
"X_V_MODEL_ON_PROPS": 44,
|
|
1418
|
+
"44": "X_V_MODEL_ON_PROPS",
|
|
1419
|
+
"X_INVALID_EXPRESSION": 45,
|
|
1420
|
+
"45": "X_INVALID_EXPRESSION",
|
|
1421
|
+
"X_KEEP_ALIVE_INVALID_CHILDREN": 46,
|
|
1422
|
+
"46": "X_KEEP_ALIVE_INVALID_CHILDREN",
|
|
1423
|
+
"X_PREFIX_ID_NOT_SUPPORTED": 47,
|
|
1424
|
+
"47": "X_PREFIX_ID_NOT_SUPPORTED",
|
|
1425
|
+
"X_MODULE_MODE_NOT_SUPPORTED": 48,
|
|
1426
|
+
"48": "X_MODULE_MODE_NOT_SUPPORTED",
|
|
1427
|
+
"X_CACHE_HANDLER_NOT_SUPPORTED": 49,
|
|
1428
|
+
"49": "X_CACHE_HANDLER_NOT_SUPPORTED",
|
|
1429
|
+
"X_SCOPE_ID_NOT_SUPPORTED": 50,
|
|
1430
|
+
"50": "X_SCOPE_ID_NOT_SUPPORTED",
|
|
1431
|
+
"X_VNODE_HOOKS": 51,
|
|
1432
|
+
"51": "X_VNODE_HOOKS",
|
|
1433
|
+
"__EXTEND_POINT__": 52,
|
|
1434
|
+
"52": "__EXTEND_POINT__"
|
|
1435
|
+
};
|
|
1231
1436
|
const errorMessages = {
|
|
1232
1437
|
// parse errors
|
|
1233
1438
|
[0]: "Illegal comment.",
|
|
@@ -1280,18 +1485,281 @@ const errorMessages = {
|
|
|
1280
1485
|
Use a v-bind binding combined with a v-on listener that emits update:x event instead.`,
|
|
1281
1486
|
[45]: `Error parsing JavaScript expression: `,
|
|
1282
1487
|
[46]: `<KeepAlive> expects exactly one child component.`,
|
|
1488
|
+
[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.`,
|
|
1283
1489
|
// generic errors
|
|
1284
1490
|
[47]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
|
|
1285
1491
|
[48]: `ES module mode is not supported in this build of compiler.`,
|
|
1286
1492
|
[49]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
|
|
1287
1493
|
[50]: `"scopeId" option is only supported in module mode.`,
|
|
1288
|
-
// deprecations
|
|
1289
|
-
[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.`,
|
|
1290
|
-
[52]: `v-is="component-name" has been deprecated. Use is="vue:component-name" instead. v-is support will be removed in 3.4.`,
|
|
1291
1494
|
// just to fulfill types
|
|
1292
|
-
[
|
|
1495
|
+
[52]: ``
|
|
1293
1496
|
};
|
|
1294
1497
|
|
|
1498
|
+
function walkIdentifiers(root, onIdentifier, includeAll = false, parentStack = [], knownIds = /* @__PURE__ */ Object.create(null)) {
|
|
1499
|
+
const rootExp = root.type === "Program" ? root.body[0].type === "ExpressionStatement" && root.body[0].expression : root;
|
|
1500
|
+
estreeWalker.walk(root, {
|
|
1501
|
+
enter(node, parent) {
|
|
1502
|
+
parent && parentStack.push(parent);
|
|
1503
|
+
if (parent && parent.type.startsWith("TS") && !TS_NODE_TYPES.includes(parent.type)) {
|
|
1504
|
+
return this.skip();
|
|
1505
|
+
}
|
|
1506
|
+
if (node.type === "Identifier") {
|
|
1507
|
+
const isLocal = !!knownIds[node.name];
|
|
1508
|
+
const isRefed = isReferencedIdentifier(node, parent, parentStack);
|
|
1509
|
+
if (includeAll || isRefed && !isLocal) {
|
|
1510
|
+
onIdentifier(node, parent, parentStack, isRefed, isLocal);
|
|
1511
|
+
}
|
|
1512
|
+
} else if (node.type === "ObjectProperty" && parent.type === "ObjectPattern") {
|
|
1513
|
+
node.inPattern = true;
|
|
1514
|
+
} else if (isFunctionType(node)) {
|
|
1515
|
+
walkFunctionParams(node, (id) => markScopeIdentifier(node, id, knownIds));
|
|
1516
|
+
} else if (node.type === "BlockStatement") {
|
|
1517
|
+
walkBlockDeclarations(
|
|
1518
|
+
node,
|
|
1519
|
+
(id) => markScopeIdentifier(node, id, knownIds)
|
|
1520
|
+
);
|
|
1521
|
+
}
|
|
1522
|
+
},
|
|
1523
|
+
leave(node, parent) {
|
|
1524
|
+
parent && parentStack.pop();
|
|
1525
|
+
if (node !== rootExp && node.scopeIds) {
|
|
1526
|
+
for (const id of node.scopeIds) {
|
|
1527
|
+
knownIds[id]--;
|
|
1528
|
+
if (knownIds[id] === 0) {
|
|
1529
|
+
delete knownIds[id];
|
|
1530
|
+
}
|
|
1531
|
+
}
|
|
1532
|
+
}
|
|
1533
|
+
}
|
|
1534
|
+
});
|
|
1535
|
+
}
|
|
1536
|
+
function isReferencedIdentifier(id, parent, parentStack) {
|
|
1537
|
+
if (!parent) {
|
|
1538
|
+
return true;
|
|
1539
|
+
}
|
|
1540
|
+
if (id.name === "arguments") {
|
|
1541
|
+
return false;
|
|
1542
|
+
}
|
|
1543
|
+
if (isReferenced(id, parent)) {
|
|
1544
|
+
return true;
|
|
1545
|
+
}
|
|
1546
|
+
switch (parent.type) {
|
|
1547
|
+
case "AssignmentExpression":
|
|
1548
|
+
case "AssignmentPattern":
|
|
1549
|
+
return true;
|
|
1550
|
+
case "ObjectPattern":
|
|
1551
|
+
case "ArrayPattern":
|
|
1552
|
+
return isInDestructureAssignment(parent, parentStack);
|
|
1553
|
+
}
|
|
1554
|
+
return false;
|
|
1555
|
+
}
|
|
1556
|
+
function isInDestructureAssignment(parent, parentStack) {
|
|
1557
|
+
if (parent && (parent.type === "ObjectProperty" || parent.type === "ArrayPattern")) {
|
|
1558
|
+
let i = parentStack.length;
|
|
1559
|
+
while (i--) {
|
|
1560
|
+
const p = parentStack[i];
|
|
1561
|
+
if (p.type === "AssignmentExpression") {
|
|
1562
|
+
return true;
|
|
1563
|
+
} else if (p.type !== "ObjectProperty" && !p.type.endsWith("Pattern")) {
|
|
1564
|
+
break;
|
|
1565
|
+
}
|
|
1566
|
+
}
|
|
1567
|
+
}
|
|
1568
|
+
return false;
|
|
1569
|
+
}
|
|
1570
|
+
function walkFunctionParams(node, onIdent) {
|
|
1571
|
+
for (const p of node.params) {
|
|
1572
|
+
for (const id of extractIdentifiers(p)) {
|
|
1573
|
+
onIdent(id);
|
|
1574
|
+
}
|
|
1575
|
+
}
|
|
1576
|
+
}
|
|
1577
|
+
function walkBlockDeclarations(block, onIdent) {
|
|
1578
|
+
for (const stmt of block.body) {
|
|
1579
|
+
if (stmt.type === "VariableDeclaration") {
|
|
1580
|
+
if (stmt.declare)
|
|
1581
|
+
continue;
|
|
1582
|
+
for (const decl of stmt.declarations) {
|
|
1583
|
+
for (const id of extractIdentifiers(decl.id)) {
|
|
1584
|
+
onIdent(id);
|
|
1585
|
+
}
|
|
1586
|
+
}
|
|
1587
|
+
} else if (stmt.type === "FunctionDeclaration" || stmt.type === "ClassDeclaration") {
|
|
1588
|
+
if (stmt.declare || !stmt.id)
|
|
1589
|
+
continue;
|
|
1590
|
+
onIdent(stmt.id);
|
|
1591
|
+
} else if (stmt.type === "ForOfStatement" || stmt.type === "ForInStatement" || stmt.type === "ForStatement") {
|
|
1592
|
+
const variable = stmt.type === "ForStatement" ? stmt.init : stmt.left;
|
|
1593
|
+
if (variable && variable.type === "VariableDeclaration") {
|
|
1594
|
+
for (const decl of variable.declarations) {
|
|
1595
|
+
for (const id of extractIdentifiers(decl.id)) {
|
|
1596
|
+
onIdent(id);
|
|
1597
|
+
}
|
|
1598
|
+
}
|
|
1599
|
+
}
|
|
1600
|
+
}
|
|
1601
|
+
}
|
|
1602
|
+
}
|
|
1603
|
+
function extractIdentifiers(param, nodes = []) {
|
|
1604
|
+
switch (param.type) {
|
|
1605
|
+
case "Identifier":
|
|
1606
|
+
nodes.push(param);
|
|
1607
|
+
break;
|
|
1608
|
+
case "MemberExpression":
|
|
1609
|
+
let object = param;
|
|
1610
|
+
while (object.type === "MemberExpression") {
|
|
1611
|
+
object = object.object;
|
|
1612
|
+
}
|
|
1613
|
+
nodes.push(object);
|
|
1614
|
+
break;
|
|
1615
|
+
case "ObjectPattern":
|
|
1616
|
+
for (const prop of param.properties) {
|
|
1617
|
+
if (prop.type === "RestElement") {
|
|
1618
|
+
extractIdentifiers(prop.argument, nodes);
|
|
1619
|
+
} else {
|
|
1620
|
+
extractIdentifiers(prop.value, nodes);
|
|
1621
|
+
}
|
|
1622
|
+
}
|
|
1623
|
+
break;
|
|
1624
|
+
case "ArrayPattern":
|
|
1625
|
+
param.elements.forEach((element) => {
|
|
1626
|
+
if (element)
|
|
1627
|
+
extractIdentifiers(element, nodes);
|
|
1628
|
+
});
|
|
1629
|
+
break;
|
|
1630
|
+
case "RestElement":
|
|
1631
|
+
extractIdentifiers(param.argument, nodes);
|
|
1632
|
+
break;
|
|
1633
|
+
case "AssignmentPattern":
|
|
1634
|
+
extractIdentifiers(param.left, nodes);
|
|
1635
|
+
break;
|
|
1636
|
+
}
|
|
1637
|
+
return nodes;
|
|
1638
|
+
}
|
|
1639
|
+
function markScopeIdentifier(node, child, knownIds) {
|
|
1640
|
+
const { name } = child;
|
|
1641
|
+
if (node.scopeIds && node.scopeIds.has(name)) {
|
|
1642
|
+
return;
|
|
1643
|
+
}
|
|
1644
|
+
if (name in knownIds) {
|
|
1645
|
+
knownIds[name]++;
|
|
1646
|
+
} else {
|
|
1647
|
+
knownIds[name] = 1;
|
|
1648
|
+
}
|
|
1649
|
+
(node.scopeIds || (node.scopeIds = /* @__PURE__ */ new Set())).add(name);
|
|
1650
|
+
}
|
|
1651
|
+
const isFunctionType = (node) => {
|
|
1652
|
+
return /Function(?:Expression|Declaration)$|Method$/.test(node.type);
|
|
1653
|
+
};
|
|
1654
|
+
const isStaticProperty = (node) => node && (node.type === "ObjectProperty" || node.type === "ObjectMethod") && !node.computed;
|
|
1655
|
+
const isStaticPropertyKey = (node, parent) => isStaticProperty(parent) && parent.key === node;
|
|
1656
|
+
function isReferenced(node, parent, grandparent) {
|
|
1657
|
+
switch (parent.type) {
|
|
1658
|
+
case "MemberExpression":
|
|
1659
|
+
case "OptionalMemberExpression":
|
|
1660
|
+
if (parent.property === node) {
|
|
1661
|
+
return !!parent.computed;
|
|
1662
|
+
}
|
|
1663
|
+
return parent.object === node;
|
|
1664
|
+
case "JSXMemberExpression":
|
|
1665
|
+
return parent.object === node;
|
|
1666
|
+
case "VariableDeclarator":
|
|
1667
|
+
return parent.init === node;
|
|
1668
|
+
case "ArrowFunctionExpression":
|
|
1669
|
+
return parent.body === node;
|
|
1670
|
+
case "PrivateName":
|
|
1671
|
+
return false;
|
|
1672
|
+
case "ClassMethod":
|
|
1673
|
+
case "ClassPrivateMethod":
|
|
1674
|
+
case "ObjectMethod":
|
|
1675
|
+
if (parent.key === node) {
|
|
1676
|
+
return !!parent.computed;
|
|
1677
|
+
}
|
|
1678
|
+
return false;
|
|
1679
|
+
case "ObjectProperty":
|
|
1680
|
+
if (parent.key === node) {
|
|
1681
|
+
return !!parent.computed;
|
|
1682
|
+
}
|
|
1683
|
+
return !grandparent || grandparent.type !== "ObjectPattern";
|
|
1684
|
+
case "ClassProperty":
|
|
1685
|
+
if (parent.key === node) {
|
|
1686
|
+
return !!parent.computed;
|
|
1687
|
+
}
|
|
1688
|
+
return true;
|
|
1689
|
+
case "ClassPrivateProperty":
|
|
1690
|
+
return parent.key !== node;
|
|
1691
|
+
case "ClassDeclaration":
|
|
1692
|
+
case "ClassExpression":
|
|
1693
|
+
return parent.superClass === node;
|
|
1694
|
+
case "AssignmentExpression":
|
|
1695
|
+
return parent.right === node;
|
|
1696
|
+
case "AssignmentPattern":
|
|
1697
|
+
return parent.right === node;
|
|
1698
|
+
case "LabeledStatement":
|
|
1699
|
+
return false;
|
|
1700
|
+
case "CatchClause":
|
|
1701
|
+
return false;
|
|
1702
|
+
case "RestElement":
|
|
1703
|
+
return false;
|
|
1704
|
+
case "BreakStatement":
|
|
1705
|
+
case "ContinueStatement":
|
|
1706
|
+
return false;
|
|
1707
|
+
case "FunctionDeclaration":
|
|
1708
|
+
case "FunctionExpression":
|
|
1709
|
+
return false;
|
|
1710
|
+
case "ExportNamespaceSpecifier":
|
|
1711
|
+
case "ExportDefaultSpecifier":
|
|
1712
|
+
return false;
|
|
1713
|
+
case "ExportSpecifier":
|
|
1714
|
+
if (grandparent == null ? void 0 : grandparent.source) {
|
|
1715
|
+
return false;
|
|
1716
|
+
}
|
|
1717
|
+
return parent.local === node;
|
|
1718
|
+
case "ImportDefaultSpecifier":
|
|
1719
|
+
case "ImportNamespaceSpecifier":
|
|
1720
|
+
case "ImportSpecifier":
|
|
1721
|
+
return false;
|
|
1722
|
+
case "ImportAttribute":
|
|
1723
|
+
return false;
|
|
1724
|
+
case "JSXAttribute":
|
|
1725
|
+
return false;
|
|
1726
|
+
case "ObjectPattern":
|
|
1727
|
+
case "ArrayPattern":
|
|
1728
|
+
return false;
|
|
1729
|
+
case "MetaProperty":
|
|
1730
|
+
return false;
|
|
1731
|
+
case "ObjectTypeProperty":
|
|
1732
|
+
return parent.key !== node;
|
|
1733
|
+
case "TSEnumMember":
|
|
1734
|
+
return parent.id !== node;
|
|
1735
|
+
case "TSPropertySignature":
|
|
1736
|
+
if (parent.key === node) {
|
|
1737
|
+
return !!parent.computed;
|
|
1738
|
+
}
|
|
1739
|
+
return true;
|
|
1740
|
+
}
|
|
1741
|
+
return true;
|
|
1742
|
+
}
|
|
1743
|
+
const TS_NODE_TYPES = [
|
|
1744
|
+
"TSAsExpression",
|
|
1745
|
+
// foo as number
|
|
1746
|
+
"TSTypeAssertion",
|
|
1747
|
+
// (<number>foo)
|
|
1748
|
+
"TSNonNullExpression",
|
|
1749
|
+
// foo!
|
|
1750
|
+
"TSInstantiationExpression",
|
|
1751
|
+
// foo<string>
|
|
1752
|
+
"TSSatisfiesExpression"
|
|
1753
|
+
// foo satisfies T
|
|
1754
|
+
];
|
|
1755
|
+
function unwrapTSNode(node) {
|
|
1756
|
+
if (TS_NODE_TYPES.includes(node.type)) {
|
|
1757
|
+
return unwrapTSNode(node.expression);
|
|
1758
|
+
} else {
|
|
1759
|
+
return node;
|
|
1760
|
+
}
|
|
1761
|
+
}
|
|
1762
|
+
|
|
1295
1763
|
const isStaticExp = (p) => p.type === 4 && p.isStatic;
|
|
1296
1764
|
function isCoreComponent(tag) {
|
|
1297
1765
|
switch (tag) {
|
|
@@ -1381,9 +1849,7 @@ const isMemberExpressionNode = (path, context) => {
|
|
|
1381
1849
|
let ret = parser.parseExpression(path, {
|
|
1382
1850
|
plugins: context.expressionPlugins
|
|
1383
1851
|
});
|
|
1384
|
-
|
|
1385
|
-
ret = ret.expression;
|
|
1386
|
-
}
|
|
1852
|
+
ret = unwrapTSNode(ret);
|
|
1387
1853
|
return ret.type === "MemberExpression" || ret.type === "OptionalMemberExpression" || ret.type === "Identifier";
|
|
1388
1854
|
} catch (e) {
|
|
1389
1855
|
return false;
|
|
@@ -1609,7 +2075,8 @@ const defaultParserOptions = {
|
|
|
1609
2075
|
isCustomElement: shared.NO,
|
|
1610
2076
|
onError: defaultOnError,
|
|
1611
2077
|
onWarn: defaultOnWarn,
|
|
1612
|
-
comments: false
|
|
2078
|
+
comments: false,
|
|
2079
|
+
prefixIdentifiers: false
|
|
1613
2080
|
};
|
|
1614
2081
|
let currentOptions = defaultParserOptions;
|
|
1615
2082
|
let currentRoot = null;
|
|
@@ -1651,7 +2118,7 @@ const tokenizer = new Tokenizer(stack, {
|
|
|
1651
2118
|
}
|
|
1652
2119
|
addNode({
|
|
1653
2120
|
type: 5,
|
|
1654
|
-
content:
|
|
2121
|
+
content: createExp(exp, false, getLoc(innerStart, innerEnd)),
|
|
1655
2122
|
loc: getLoc(start, end)
|
|
1656
2123
|
});
|
|
1657
2124
|
},
|
|
@@ -1744,7 +2211,7 @@ const tokenizer = new Tokenizer(stack, {
|
|
|
1744
2211
|
loc: getLoc(start)
|
|
1745
2212
|
};
|
|
1746
2213
|
if (name === "pre") {
|
|
1747
|
-
inVPre = true;
|
|
2214
|
+
inVPre = tokenizer.inVPre = true;
|
|
1748
2215
|
currentVPreBoundary = currentOpenTag;
|
|
1749
2216
|
const props = currentOpenTag.props;
|
|
1750
2217
|
for (let i = 0; i < props.length; i++) {
|
|
@@ -1764,7 +2231,7 @@ const tokenizer = new Tokenizer(stack, {
|
|
|
1764
2231
|
setLocEnd(currentProp.nameLoc, end);
|
|
1765
2232
|
} else {
|
|
1766
2233
|
const isStatic = arg[0] !== `[`;
|
|
1767
|
-
currentProp.arg =
|
|
2234
|
+
currentProp.arg = createExp(
|
|
1768
2235
|
isStatic ? arg : arg.slice(1, -1),
|
|
1769
2236
|
isStatic,
|
|
1770
2237
|
getLoc(start, end),
|
|
@@ -1831,10 +2298,22 @@ const tokenizer = new Tokenizer(stack, {
|
|
|
1831
2298
|
tokenizer.enterRCDATA(toCharCodes(`</template`), 0);
|
|
1832
2299
|
}
|
|
1833
2300
|
} else {
|
|
1834
|
-
|
|
2301
|
+
let expParseMode = 0 /* Normal */;
|
|
2302
|
+
{
|
|
2303
|
+
if (currentProp.name === "for") {
|
|
2304
|
+
expParseMode = 3 /* Skip */;
|
|
2305
|
+
} else if (currentProp.name === "slot") {
|
|
2306
|
+
expParseMode = 1 /* Params */;
|
|
2307
|
+
} else if (currentProp.name === "on" && currentAttrValue.includes(";")) {
|
|
2308
|
+
expParseMode = 2 /* Statements */;
|
|
2309
|
+
}
|
|
2310
|
+
}
|
|
2311
|
+
currentProp.exp = createExp(
|
|
1835
2312
|
currentAttrValue,
|
|
1836
2313
|
false,
|
|
1837
|
-
getLoc(currentAttrStartIndex, currentAttrEndIndex)
|
|
2314
|
+
getLoc(currentAttrStartIndex, currentAttrEndIndex),
|
|
2315
|
+
0,
|
|
2316
|
+
expParseMode
|
|
1838
2317
|
);
|
|
1839
2318
|
if (currentProp.name === "for") {
|
|
1840
2319
|
currentProp.forParseResult = parseForExpression(currentProp.exp);
|
|
@@ -1937,10 +2416,16 @@ function parseForExpression(input) {
|
|
|
1937
2416
|
if (!inMatch)
|
|
1938
2417
|
return;
|
|
1939
2418
|
const [, LHS, RHS] = inMatch;
|
|
1940
|
-
const createAliasExpression = (content, offset) => {
|
|
2419
|
+
const createAliasExpression = (content, offset, asParam = false) => {
|
|
1941
2420
|
const start = loc.start.offset + offset;
|
|
1942
2421
|
const end = start + content.length;
|
|
1943
|
-
return
|
|
2422
|
+
return createExp(
|
|
2423
|
+
content,
|
|
2424
|
+
false,
|
|
2425
|
+
getLoc(start, end),
|
|
2426
|
+
0,
|
|
2427
|
+
asParam ? 1 /* Params */ : 0 /* Normal */
|
|
2428
|
+
);
|
|
1944
2429
|
};
|
|
1945
2430
|
const result = {
|
|
1946
2431
|
source: createAliasExpression(RHS.trim(), exp.indexOf(RHS, LHS.length)),
|
|
@@ -1958,7 +2443,7 @@ function parseForExpression(input) {
|
|
|
1958
2443
|
let keyOffset;
|
|
1959
2444
|
if (keyContent) {
|
|
1960
2445
|
keyOffset = exp.indexOf(keyContent, trimmedOffset + valueContent.length);
|
|
1961
|
-
result.key = createAliasExpression(keyContent, keyOffset);
|
|
2446
|
+
result.key = createAliasExpression(keyContent, keyOffset, true);
|
|
1962
2447
|
}
|
|
1963
2448
|
if (iteratorMatch[2]) {
|
|
1964
2449
|
const indexContent = iteratorMatch[2].trim();
|
|
@@ -1968,13 +2453,14 @@ function parseForExpression(input) {
|
|
|
1968
2453
|
exp.indexOf(
|
|
1969
2454
|
indexContent,
|
|
1970
2455
|
result.key ? keyOffset + keyContent.length : trimmedOffset + valueContent.length
|
|
1971
|
-
)
|
|
2456
|
+
),
|
|
2457
|
+
true
|
|
1972
2458
|
);
|
|
1973
2459
|
}
|
|
1974
2460
|
}
|
|
1975
2461
|
}
|
|
1976
2462
|
if (valueContent) {
|
|
1977
|
-
result.value = createAliasExpression(valueContent, trimmedOffset);
|
|
2463
|
+
result.value = createAliasExpression(valueContent, trimmedOffset, true);
|
|
1978
2464
|
}
|
|
1979
2465
|
return result;
|
|
1980
2466
|
}
|
|
@@ -2045,7 +2531,7 @@ function onCloseTag(el, end, isImplied = false) {
|
|
|
2045
2531
|
inPre--;
|
|
2046
2532
|
}
|
|
2047
2533
|
if (currentVPreBoundary === el) {
|
|
2048
|
-
inVPre = false;
|
|
2534
|
+
inVPre = tokenizer.inVPre = false;
|
|
2049
2535
|
currentVPreBoundary = null;
|
|
2050
2536
|
}
|
|
2051
2537
|
if (tokenizer.inXML && (stack[0] ? stack[0].ns : currentOptions.ns) === 0) {
|
|
@@ -2250,8 +2736,36 @@ function dirToAttr(dir) {
|
|
|
2250
2736
|
}
|
|
2251
2737
|
return attr;
|
|
2252
2738
|
}
|
|
2253
|
-
function
|
|
2254
|
-
|
|
2739
|
+
function createExp(content, isStatic = false, loc, constType = 0, parseMode = 0 /* Normal */) {
|
|
2740
|
+
const exp = createSimpleExpression(content, isStatic, loc, constType);
|
|
2741
|
+
if (!isStatic && currentOptions.prefixIdentifiers && parseMode !== 3 /* Skip */ && content.trim()) {
|
|
2742
|
+
if (isSimpleIdentifier(content)) {
|
|
2743
|
+
exp.ast = null;
|
|
2744
|
+
return exp;
|
|
2745
|
+
}
|
|
2746
|
+
try {
|
|
2747
|
+
const plugins = currentOptions.expressionPlugins;
|
|
2748
|
+
const options = {
|
|
2749
|
+
plugins: plugins ? [...plugins, "typescript"] : ["typescript"]
|
|
2750
|
+
};
|
|
2751
|
+
if (parseMode === 2 /* Statements */) {
|
|
2752
|
+
exp.ast = parser.parse(` ${content} `, options).program;
|
|
2753
|
+
} else if (parseMode === 1 /* Params */) {
|
|
2754
|
+
exp.ast = parser.parseExpression(`(${content})=>{}`, options);
|
|
2755
|
+
} else {
|
|
2756
|
+
exp.ast = parser.parseExpression(`(${content})`, options);
|
|
2757
|
+
}
|
|
2758
|
+
} catch (e) {
|
|
2759
|
+
exp.ast = false;
|
|
2760
|
+
emitError(45, loc.start.offset, e.message);
|
|
2761
|
+
}
|
|
2762
|
+
}
|
|
2763
|
+
return exp;
|
|
2764
|
+
}
|
|
2765
|
+
function emitError(code, index, message) {
|
|
2766
|
+
currentOptions.onError(
|
|
2767
|
+
createCompilerError(code, getLoc(index, index), void 0, message)
|
|
2768
|
+
);
|
|
2255
2769
|
}
|
|
2256
2770
|
function reset() {
|
|
2257
2771
|
tokenizer.reset();
|
|
@@ -2275,6 +2789,7 @@ function baseParse(input, options) {
|
|
|
2275
2789
|
}
|
|
2276
2790
|
}
|
|
2277
2791
|
tokenizer.mode = currentOptions.parseMode === "html" ? 1 : currentOptions.parseMode === "sfc" ? 2 : 0;
|
|
2792
|
+
tokenizer.inXML = currentOptions.ns === 1 || currentOptions.ns === 2;
|
|
2278
2793
|
const delimiters = options == null ? void 0 : options.delimiters;
|
|
2279
2794
|
if (delimiters) {
|
|
2280
2795
|
tokenizer.delimiterOpen = toCharCodes(delimiters[0]);
|
|
@@ -2559,6 +3074,7 @@ function createTransformContext(root, {
|
|
|
2559
3074
|
const nameMatch = filename.replace(/\?.*$/, "").match(/([^/\\]+)\.\w+$/);
|
|
2560
3075
|
const context = {
|
|
2561
3076
|
// options
|
|
3077
|
+
filename,
|
|
2562
3078
|
selfName: nameMatch && shared.capitalize(shared.camelize(nameMatch[1])),
|
|
2563
3079
|
prefixIdentifiers,
|
|
2564
3080
|
hoistStatic: hoistStatic2,
|
|
@@ -3532,333 +4048,75 @@ function genCacheExpression(node, context) {
|
|
|
3532
4048
|
if (node.isVNode) {
|
|
3533
4049
|
push(`,`);
|
|
3534
4050
|
newline();
|
|
3535
|
-
push(`${helper(SET_BLOCK_TRACKING)}(1),`);
|
|
3536
|
-
newline();
|
|
3537
|
-
push(`_cache[${node.index}]`);
|
|
3538
|
-
deindent();
|
|
3539
|
-
}
|
|
3540
|
-
push(`)`);
|
|
3541
|
-
}
|
|
3542
|
-
function genTemplateLiteral(node, context) {
|
|
3543
|
-
const { push, indent, deindent } = context;
|
|
3544
|
-
push("`");
|
|
3545
|
-
const l = node.elements.length;
|
|
3546
|
-
const multilines = l > 3;
|
|
3547
|
-
for (let i = 0; i < l; i++) {
|
|
3548
|
-
const e = node.elements[i];
|
|
3549
|
-
if (shared.isString(e)) {
|
|
3550
|
-
push(e.replace(/(`|\$|\\)/g, "\\$1"), -3 /* Unknown */);
|
|
3551
|
-
} else {
|
|
3552
|
-
push("${");
|
|
3553
|
-
if (multilines)
|
|
3554
|
-
indent();
|
|
3555
|
-
genNode(e, context);
|
|
3556
|
-
if (multilines)
|
|
3557
|
-
deindent();
|
|
3558
|
-
push("}");
|
|
3559
|
-
}
|
|
3560
|
-
}
|
|
3561
|
-
push("`");
|
|
3562
|
-
}
|
|
3563
|
-
function genIfStatement(node, context) {
|
|
3564
|
-
const { push, indent, deindent } = context;
|
|
3565
|
-
const { test, consequent, alternate } = node;
|
|
3566
|
-
push(`if (`);
|
|
3567
|
-
genNode(test, context);
|
|
3568
|
-
push(`) {`);
|
|
3569
|
-
indent();
|
|
3570
|
-
genNode(consequent, context);
|
|
3571
|
-
deindent();
|
|
3572
|
-
push(`}`);
|
|
3573
|
-
if (alternate) {
|
|
3574
|
-
push(` else `);
|
|
3575
|
-
if (alternate.type === 23) {
|
|
3576
|
-
genIfStatement(alternate, context);
|
|
3577
|
-
} else {
|
|
3578
|
-
push(`{`);
|
|
3579
|
-
indent();
|
|
3580
|
-
genNode(alternate, context);
|
|
3581
|
-
deindent();
|
|
3582
|
-
push(`}`);
|
|
3583
|
-
}
|
|
3584
|
-
}
|
|
3585
|
-
}
|
|
3586
|
-
function genAssignmentExpression(node, context) {
|
|
3587
|
-
genNode(node.left, context);
|
|
3588
|
-
context.push(` = `);
|
|
3589
|
-
genNode(node.right, context);
|
|
3590
|
-
}
|
|
3591
|
-
function genSequenceExpression(node, context) {
|
|
3592
|
-
context.push(`(`);
|
|
3593
|
-
genNodeList(node.expressions, context);
|
|
3594
|
-
context.push(`)`);
|
|
3595
|
-
}
|
|
3596
|
-
function genReturnStatement({ returns }, context) {
|
|
3597
|
-
context.push(`return `);
|
|
3598
|
-
if (shared.isArray(returns)) {
|
|
3599
|
-
genNodeListAsArray(returns, context);
|
|
3600
|
-
} else {
|
|
3601
|
-
genNode(returns, context);
|
|
3602
|
-
}
|
|
3603
|
-
}
|
|
3604
|
-
|
|
3605
|
-
function walkIdentifiers(root, onIdentifier, includeAll = false, parentStack = [], knownIds = /* @__PURE__ */ Object.create(null)) {
|
|
3606
|
-
const rootExp = root.type === "Program" && root.body[0].type === "ExpressionStatement" && root.body[0].expression;
|
|
3607
|
-
estreeWalker.walk(root, {
|
|
3608
|
-
enter(node, parent) {
|
|
3609
|
-
parent && parentStack.push(parent);
|
|
3610
|
-
if (parent && parent.type.startsWith("TS") && !TS_NODE_TYPES.includes(parent.type)) {
|
|
3611
|
-
return this.skip();
|
|
3612
|
-
}
|
|
3613
|
-
if (node.type === "Identifier") {
|
|
3614
|
-
const isLocal = !!knownIds[node.name];
|
|
3615
|
-
const isRefed = isReferencedIdentifier(node, parent, parentStack);
|
|
3616
|
-
if (includeAll || isRefed && !isLocal) {
|
|
3617
|
-
onIdentifier(node, parent, parentStack, isRefed, isLocal);
|
|
3618
|
-
}
|
|
3619
|
-
} else if (node.type === "ObjectProperty" && parent.type === "ObjectPattern") {
|
|
3620
|
-
node.inPattern = true;
|
|
3621
|
-
} else if (isFunctionType(node)) {
|
|
3622
|
-
walkFunctionParams(node, (id) => markScopeIdentifier(node, id, knownIds));
|
|
3623
|
-
} else if (node.type === "BlockStatement") {
|
|
3624
|
-
walkBlockDeclarations(
|
|
3625
|
-
node,
|
|
3626
|
-
(id) => markScopeIdentifier(node, id, knownIds)
|
|
3627
|
-
);
|
|
3628
|
-
}
|
|
3629
|
-
},
|
|
3630
|
-
leave(node, parent) {
|
|
3631
|
-
parent && parentStack.pop();
|
|
3632
|
-
if (node !== rootExp && node.scopeIds) {
|
|
3633
|
-
for (const id of node.scopeIds) {
|
|
3634
|
-
knownIds[id]--;
|
|
3635
|
-
if (knownIds[id] === 0) {
|
|
3636
|
-
delete knownIds[id];
|
|
3637
|
-
}
|
|
3638
|
-
}
|
|
3639
|
-
}
|
|
3640
|
-
}
|
|
3641
|
-
});
|
|
3642
|
-
}
|
|
3643
|
-
function isReferencedIdentifier(id, parent, parentStack) {
|
|
3644
|
-
if (!parent) {
|
|
3645
|
-
return true;
|
|
3646
|
-
}
|
|
3647
|
-
if (id.name === "arguments") {
|
|
3648
|
-
return false;
|
|
3649
|
-
}
|
|
3650
|
-
if (isReferenced(id, parent)) {
|
|
3651
|
-
return true;
|
|
3652
|
-
}
|
|
3653
|
-
switch (parent.type) {
|
|
3654
|
-
case "AssignmentExpression":
|
|
3655
|
-
case "AssignmentPattern":
|
|
3656
|
-
return true;
|
|
3657
|
-
case "ObjectPattern":
|
|
3658
|
-
case "ArrayPattern":
|
|
3659
|
-
return isInDestructureAssignment(parent, parentStack);
|
|
3660
|
-
}
|
|
3661
|
-
return false;
|
|
3662
|
-
}
|
|
3663
|
-
function isInDestructureAssignment(parent, parentStack) {
|
|
3664
|
-
if (parent && (parent.type === "ObjectProperty" || parent.type === "ArrayPattern")) {
|
|
3665
|
-
let i = parentStack.length;
|
|
3666
|
-
while (i--) {
|
|
3667
|
-
const p = parentStack[i];
|
|
3668
|
-
if (p.type === "AssignmentExpression") {
|
|
3669
|
-
return true;
|
|
3670
|
-
} else if (p.type !== "ObjectProperty" && !p.type.endsWith("Pattern")) {
|
|
3671
|
-
break;
|
|
3672
|
-
}
|
|
3673
|
-
}
|
|
4051
|
+
push(`${helper(SET_BLOCK_TRACKING)}(1),`);
|
|
4052
|
+
newline();
|
|
4053
|
+
push(`_cache[${node.index}]`);
|
|
4054
|
+
deindent();
|
|
3674
4055
|
}
|
|
3675
|
-
|
|
4056
|
+
push(`)`);
|
|
3676
4057
|
}
|
|
3677
|
-
function
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
|
|
4058
|
+
function genTemplateLiteral(node, context) {
|
|
4059
|
+
const { push, indent, deindent } = context;
|
|
4060
|
+
push("`");
|
|
4061
|
+
const l = node.elements.length;
|
|
4062
|
+
const multilines = l > 3;
|
|
4063
|
+
for (let i = 0; i < l; i++) {
|
|
4064
|
+
const e = node.elements[i];
|
|
4065
|
+
if (shared.isString(e)) {
|
|
4066
|
+
push(e.replace(/(`|\$|\\)/g, "\\$1"), -3 /* Unknown */);
|
|
4067
|
+
} else {
|
|
4068
|
+
push("${");
|
|
4069
|
+
if (multilines)
|
|
4070
|
+
indent();
|
|
4071
|
+
genNode(e, context);
|
|
4072
|
+
if (multilines)
|
|
4073
|
+
deindent();
|
|
4074
|
+
push("}");
|
|
3681
4075
|
}
|
|
3682
4076
|
}
|
|
4077
|
+
push("`");
|
|
3683
4078
|
}
|
|
3684
|
-
function
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
} else
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
}
|
|
3705
|
-
}
|
|
3706
|
-
}
|
|
4079
|
+
function genIfStatement(node, context) {
|
|
4080
|
+
const { push, indent, deindent } = context;
|
|
4081
|
+
const { test, consequent, alternate } = node;
|
|
4082
|
+
push(`if (`);
|
|
4083
|
+
genNode(test, context);
|
|
4084
|
+
push(`) {`);
|
|
4085
|
+
indent();
|
|
4086
|
+
genNode(consequent, context);
|
|
4087
|
+
deindent();
|
|
4088
|
+
push(`}`);
|
|
4089
|
+
if (alternate) {
|
|
4090
|
+
push(` else `);
|
|
4091
|
+
if (alternate.type === 23) {
|
|
4092
|
+
genIfStatement(alternate, context);
|
|
4093
|
+
} else {
|
|
4094
|
+
push(`{`);
|
|
4095
|
+
indent();
|
|
4096
|
+
genNode(alternate, context);
|
|
4097
|
+
deindent();
|
|
4098
|
+
push(`}`);
|
|
3707
4099
|
}
|
|
3708
4100
|
}
|
|
3709
4101
|
}
|
|
3710
|
-
function
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
break;
|
|
3715
|
-
case "MemberExpression":
|
|
3716
|
-
let object = param;
|
|
3717
|
-
while (object.type === "MemberExpression") {
|
|
3718
|
-
object = object.object;
|
|
3719
|
-
}
|
|
3720
|
-
nodes.push(object);
|
|
3721
|
-
break;
|
|
3722
|
-
case "ObjectPattern":
|
|
3723
|
-
for (const prop of param.properties) {
|
|
3724
|
-
if (prop.type === "RestElement") {
|
|
3725
|
-
extractIdentifiers(prop.argument, nodes);
|
|
3726
|
-
} else {
|
|
3727
|
-
extractIdentifiers(prop.value, nodes);
|
|
3728
|
-
}
|
|
3729
|
-
}
|
|
3730
|
-
break;
|
|
3731
|
-
case "ArrayPattern":
|
|
3732
|
-
param.elements.forEach((element) => {
|
|
3733
|
-
if (element)
|
|
3734
|
-
extractIdentifiers(element, nodes);
|
|
3735
|
-
});
|
|
3736
|
-
break;
|
|
3737
|
-
case "RestElement":
|
|
3738
|
-
extractIdentifiers(param.argument, nodes);
|
|
3739
|
-
break;
|
|
3740
|
-
case "AssignmentPattern":
|
|
3741
|
-
extractIdentifiers(param.left, nodes);
|
|
3742
|
-
break;
|
|
3743
|
-
}
|
|
3744
|
-
return nodes;
|
|
4102
|
+
function genAssignmentExpression(node, context) {
|
|
4103
|
+
genNode(node.left, context);
|
|
4104
|
+
context.push(` = `);
|
|
4105
|
+
genNode(node.right, context);
|
|
3745
4106
|
}
|
|
3746
|
-
function
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
}
|
|
3751
|
-
if (name in knownIds) {
|
|
3752
|
-
knownIds[name]++;
|
|
3753
|
-
} else {
|
|
3754
|
-
knownIds[name] = 1;
|
|
3755
|
-
}
|
|
3756
|
-
(node.scopeIds || (node.scopeIds = /* @__PURE__ */ new Set())).add(name);
|
|
4107
|
+
function genSequenceExpression(node, context) {
|
|
4108
|
+
context.push(`(`);
|
|
4109
|
+
genNodeList(node.expressions, context);
|
|
4110
|
+
context.push(`)`);
|
|
3757
4111
|
}
|
|
3758
|
-
|
|
3759
|
-
return
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
switch (parent.type) {
|
|
3765
|
-
case "MemberExpression":
|
|
3766
|
-
case "OptionalMemberExpression":
|
|
3767
|
-
if (parent.property === node) {
|
|
3768
|
-
return !!parent.computed;
|
|
3769
|
-
}
|
|
3770
|
-
return parent.object === node;
|
|
3771
|
-
case "JSXMemberExpression":
|
|
3772
|
-
return parent.object === node;
|
|
3773
|
-
case "VariableDeclarator":
|
|
3774
|
-
return parent.init === node;
|
|
3775
|
-
case "ArrowFunctionExpression":
|
|
3776
|
-
return parent.body === node;
|
|
3777
|
-
case "PrivateName":
|
|
3778
|
-
return false;
|
|
3779
|
-
case "ClassMethod":
|
|
3780
|
-
case "ClassPrivateMethod":
|
|
3781
|
-
case "ObjectMethod":
|
|
3782
|
-
if (parent.key === node) {
|
|
3783
|
-
return !!parent.computed;
|
|
3784
|
-
}
|
|
3785
|
-
return false;
|
|
3786
|
-
case "ObjectProperty":
|
|
3787
|
-
if (parent.key === node) {
|
|
3788
|
-
return !!parent.computed;
|
|
3789
|
-
}
|
|
3790
|
-
return !grandparent || grandparent.type !== "ObjectPattern";
|
|
3791
|
-
case "ClassProperty":
|
|
3792
|
-
if (parent.key === node) {
|
|
3793
|
-
return !!parent.computed;
|
|
3794
|
-
}
|
|
3795
|
-
return true;
|
|
3796
|
-
case "ClassPrivateProperty":
|
|
3797
|
-
return parent.key !== node;
|
|
3798
|
-
case "ClassDeclaration":
|
|
3799
|
-
case "ClassExpression":
|
|
3800
|
-
return parent.superClass === node;
|
|
3801
|
-
case "AssignmentExpression":
|
|
3802
|
-
return parent.right === node;
|
|
3803
|
-
case "AssignmentPattern":
|
|
3804
|
-
return parent.right === node;
|
|
3805
|
-
case "LabeledStatement":
|
|
3806
|
-
return false;
|
|
3807
|
-
case "CatchClause":
|
|
3808
|
-
return false;
|
|
3809
|
-
case "RestElement":
|
|
3810
|
-
return false;
|
|
3811
|
-
case "BreakStatement":
|
|
3812
|
-
case "ContinueStatement":
|
|
3813
|
-
return false;
|
|
3814
|
-
case "FunctionDeclaration":
|
|
3815
|
-
case "FunctionExpression":
|
|
3816
|
-
return false;
|
|
3817
|
-
case "ExportNamespaceSpecifier":
|
|
3818
|
-
case "ExportDefaultSpecifier":
|
|
3819
|
-
return false;
|
|
3820
|
-
case "ExportSpecifier":
|
|
3821
|
-
if (grandparent == null ? void 0 : grandparent.source) {
|
|
3822
|
-
return false;
|
|
3823
|
-
}
|
|
3824
|
-
return parent.local === node;
|
|
3825
|
-
case "ImportDefaultSpecifier":
|
|
3826
|
-
case "ImportNamespaceSpecifier":
|
|
3827
|
-
case "ImportSpecifier":
|
|
3828
|
-
return false;
|
|
3829
|
-
case "ImportAttribute":
|
|
3830
|
-
return false;
|
|
3831
|
-
case "JSXAttribute":
|
|
3832
|
-
return false;
|
|
3833
|
-
case "ObjectPattern":
|
|
3834
|
-
case "ArrayPattern":
|
|
3835
|
-
return false;
|
|
3836
|
-
case "MetaProperty":
|
|
3837
|
-
return false;
|
|
3838
|
-
case "ObjectTypeProperty":
|
|
3839
|
-
return parent.key !== node;
|
|
3840
|
-
case "TSEnumMember":
|
|
3841
|
-
return parent.id !== node;
|
|
3842
|
-
case "TSPropertySignature":
|
|
3843
|
-
if (parent.key === node) {
|
|
3844
|
-
return !!parent.computed;
|
|
3845
|
-
}
|
|
3846
|
-
return true;
|
|
4112
|
+
function genReturnStatement({ returns }, context) {
|
|
4113
|
+
context.push(`return `);
|
|
4114
|
+
if (shared.isArray(returns)) {
|
|
4115
|
+
genNodeListAsArray(returns, context);
|
|
4116
|
+
} else {
|
|
4117
|
+
genNode(returns, context);
|
|
3847
4118
|
}
|
|
3848
|
-
return true;
|
|
3849
4119
|
}
|
|
3850
|
-
const TS_NODE_TYPES = [
|
|
3851
|
-
"TSAsExpression",
|
|
3852
|
-
// foo as number
|
|
3853
|
-
"TSTypeAssertion",
|
|
3854
|
-
// (<number>foo)
|
|
3855
|
-
"TSNonNullExpression",
|
|
3856
|
-
// foo!
|
|
3857
|
-
"TSInstantiationExpression",
|
|
3858
|
-
// foo<string>
|
|
3859
|
-
"TSSatisfiesExpression"
|
|
3860
|
-
// foo satisfies T
|
|
3861
|
-
];
|
|
3862
4120
|
|
|
3863
4121
|
const isLiteralWhitelisted = /* @__PURE__ */ shared.makeMap("true,false,null,this");
|
|
3864
4122
|
const constantBailRE = /\w\s*\(|\.[^\d]/;
|
|
@@ -3952,7 +4210,11 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
|
|
|
3952
4210
|
};
|
|
3953
4211
|
const rawExp = node.content;
|
|
3954
4212
|
const bailConstant = constantBailRE.test(rawExp);
|
|
3955
|
-
|
|
4213
|
+
let ast = node.ast;
|
|
4214
|
+
if (ast === false) {
|
|
4215
|
+
return node;
|
|
4216
|
+
}
|
|
4217
|
+
if (ast === null || !ast && isSimpleIdentifier(rawExp)) {
|
|
3956
4218
|
const isScopeVarReference = context.identifiers[rawExp];
|
|
3957
4219
|
const isAllowedGlobal = shared.isGloballyAllowed(rawExp);
|
|
3958
4220
|
const isLiteral = isLiteralWhitelisted(rawExp);
|
|
@@ -3970,22 +4232,23 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
|
|
|
3970
4232
|
}
|
|
3971
4233
|
return node;
|
|
3972
4234
|
}
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
4235
|
+
if (!ast) {
|
|
4236
|
+
const source = asRawStatements ? ` ${rawExp} ` : `(${rawExp})${asParams ? `=>{}` : ``}`;
|
|
4237
|
+
try {
|
|
4238
|
+
ast = parser.parse(source, {
|
|
4239
|
+
plugins: context.expressionPlugins
|
|
4240
|
+
}).program;
|
|
4241
|
+
} catch (e) {
|
|
4242
|
+
context.onError(
|
|
4243
|
+
createCompilerError(
|
|
4244
|
+
45,
|
|
4245
|
+
node.loc,
|
|
4246
|
+
void 0,
|
|
4247
|
+
e.message
|
|
4248
|
+
)
|
|
4249
|
+
);
|
|
4250
|
+
return node;
|
|
4251
|
+
}
|
|
3989
4252
|
}
|
|
3990
4253
|
const ids = [];
|
|
3991
4254
|
const parentStack = [];
|
|
@@ -4028,15 +4291,15 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
|
|
|
4028
4291
|
if (leadingText.length || id.prefix) {
|
|
4029
4292
|
children.push(leadingText + (id.prefix || ``));
|
|
4030
4293
|
}
|
|
4031
|
-
const
|
|
4294
|
+
const source = rawExp.slice(start, end);
|
|
4032
4295
|
children.push(
|
|
4033
4296
|
createSimpleExpression(
|
|
4034
4297
|
id.name,
|
|
4035
4298
|
false,
|
|
4036
4299
|
{
|
|
4037
|
-
start: advancePositionWithClone(node.loc.start,
|
|
4038
|
-
end: advancePositionWithClone(node.loc.start,
|
|
4039
|
-
source
|
|
4300
|
+
start: advancePositionWithClone(node.loc.start, source, start),
|
|
4301
|
+
end: advancePositionWithClone(node.loc.start, source, end),
|
|
4302
|
+
source
|
|
4040
4303
|
},
|
|
4041
4304
|
id.isConstant ? 3 : 0
|
|
4042
4305
|
)
|
|
@@ -4048,6 +4311,7 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
|
|
|
4048
4311
|
let ret;
|
|
4049
4312
|
if (children.length) {
|
|
4050
4313
|
ret = createCompoundExpression(children, node.loc);
|
|
4314
|
+
ret.ast = ast;
|
|
4051
4315
|
} else {
|
|
4052
4316
|
ret = node;
|
|
4053
4317
|
ret.constType = bailConstant ? 0 : 3;
|
|
@@ -4983,6 +5247,10 @@ function resolveSetupReference(name, context) {
|
|
|
4983
5247
|
`${context.helperString(UNREF)}(${fromMaybeRef})`
|
|
4984
5248
|
) : `$setup[${JSON.stringify(fromMaybeRef)}]`;
|
|
4985
5249
|
}
|
|
5250
|
+
const fromProps = checkType("props");
|
|
5251
|
+
if (fromProps) {
|
|
5252
|
+
return `${context.helperString(UNREF)}(${context.inline ? "__props" : "$props"}[${JSON.stringify(fromProps)}])`;
|
|
5253
|
+
}
|
|
4986
5254
|
}
|
|
4987
5255
|
function buildProps(node, context, props = node.props, isComponent, isDynamicComponent, ssr = false) {
|
|
4988
5256
|
const { tag, loc: elementLoc, children } = node;
|
|
@@ -5023,6 +5291,9 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
5023
5291
|
if (isEventHandler && shared.isReservedProp(name)) {
|
|
5024
5292
|
hasVnodeHook = true;
|
|
5025
5293
|
}
|
|
5294
|
+
if (isEventHandler && value.type === 14) {
|
|
5295
|
+
value = value.arguments[0];
|
|
5296
|
+
}
|
|
5026
5297
|
if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) {
|
|
5027
5298
|
return;
|
|
5028
5299
|
}
|
|
@@ -6000,7 +6271,10 @@ function baseCompile(source, options = {}) {
|
|
|
6000
6271
|
if (options.scopeId && !isModuleMode) {
|
|
6001
6272
|
onError(createCompilerError(50));
|
|
6002
6273
|
}
|
|
6003
|
-
const
|
|
6274
|
+
const resolvedOptions = shared.extend({}, options, {
|
|
6275
|
+
prefixIdentifiers
|
|
6276
|
+
});
|
|
6277
|
+
const ast = shared.isString(source) ? baseParse(source, resolvedOptions) : source;
|
|
6004
6278
|
const [nodeTransforms, directiveTransforms] = getBaseTransformPreset(prefixIdentifiers);
|
|
6005
6279
|
if (options.isTS) {
|
|
6006
6280
|
const { expressionPlugins } = options;
|
|
@@ -6010,8 +6284,7 @@ function baseCompile(source, options = {}) {
|
|
|
6010
6284
|
}
|
|
6011
6285
|
transform(
|
|
6012
6286
|
ast,
|
|
6013
|
-
shared.extend({},
|
|
6014
|
-
prefixIdentifiers,
|
|
6287
|
+
shared.extend({}, resolvedOptions, {
|
|
6015
6288
|
nodeTransforms: [
|
|
6016
6289
|
...nodeTransforms,
|
|
6017
6290
|
...options.nodeTransforms || []
|
|
@@ -6025,18 +6298,27 @@ function baseCompile(source, options = {}) {
|
|
|
6025
6298
|
)
|
|
6026
6299
|
})
|
|
6027
6300
|
);
|
|
6028
|
-
return generate(
|
|
6029
|
-
ast,
|
|
6030
|
-
shared.extend({}, options, {
|
|
6031
|
-
prefixIdentifiers
|
|
6032
|
-
})
|
|
6033
|
-
);
|
|
6301
|
+
return generate(ast, resolvedOptions);
|
|
6034
6302
|
}
|
|
6035
6303
|
|
|
6304
|
+
const BindingTypes = {
|
|
6305
|
+
"DATA": "data",
|
|
6306
|
+
"PROPS": "props",
|
|
6307
|
+
"PROPS_ALIASED": "props-aliased",
|
|
6308
|
+
"SETUP_LET": "setup-let",
|
|
6309
|
+
"SETUP_CONST": "setup-const",
|
|
6310
|
+
"SETUP_REACTIVE_CONST": "setup-reactive-const",
|
|
6311
|
+
"SETUP_MAYBE_REF": "setup-maybe-ref",
|
|
6312
|
+
"SETUP_REF": "setup-ref",
|
|
6313
|
+
"OPTIONS": "options",
|
|
6314
|
+
"LITERAL_CONST": "literal-const"
|
|
6315
|
+
};
|
|
6316
|
+
|
|
6036
6317
|
const noopDirectiveTransform = () => ({ props: [] });
|
|
6037
6318
|
|
|
6038
6319
|
exports.generateCodeFrame = shared.generateCodeFrame;
|
|
6039
6320
|
exports.BASE_TRANSITION = BASE_TRANSITION;
|
|
6321
|
+
exports.BindingTypes = BindingTypes;
|
|
6040
6322
|
exports.CAMELIZE = CAMELIZE;
|
|
6041
6323
|
exports.CAPITALIZE = CAPITALIZE;
|
|
6042
6324
|
exports.CREATE_BLOCK = CREATE_BLOCK;
|
|
@@ -6047,6 +6329,10 @@ exports.CREATE_SLOTS = CREATE_SLOTS;
|
|
|
6047
6329
|
exports.CREATE_STATIC = CREATE_STATIC;
|
|
6048
6330
|
exports.CREATE_TEXT = CREATE_TEXT;
|
|
6049
6331
|
exports.CREATE_VNODE = CREATE_VNODE;
|
|
6332
|
+
exports.CompilerDeprecationTypes = CompilerDeprecationTypes;
|
|
6333
|
+
exports.ConstantTypes = ConstantTypes;
|
|
6334
|
+
exports.ElementTypes = ElementTypes;
|
|
6335
|
+
exports.ErrorCodes = ErrorCodes;
|
|
6050
6336
|
exports.FRAGMENT = FRAGMENT;
|
|
6051
6337
|
exports.GUARD_REACTIVE_PROPS = GUARD_REACTIVE_PROPS;
|
|
6052
6338
|
exports.IS_MEMO_SAME = IS_MEMO_SAME;
|
|
@@ -6056,6 +6342,8 @@ exports.MERGE_PROPS = MERGE_PROPS;
|
|
|
6056
6342
|
exports.NORMALIZE_CLASS = NORMALIZE_CLASS;
|
|
6057
6343
|
exports.NORMALIZE_PROPS = NORMALIZE_PROPS;
|
|
6058
6344
|
exports.NORMALIZE_STYLE = NORMALIZE_STYLE;
|
|
6345
|
+
exports.Namespaces = Namespaces;
|
|
6346
|
+
exports.NodeTypes = NodeTypes;
|
|
6059
6347
|
exports.OPEN_BLOCK = OPEN_BLOCK;
|
|
6060
6348
|
exports.POP_SCOPE_ID = POP_SCOPE_ID;
|
|
6061
6349
|
exports.PUSH_SCOPE_ID = PUSH_SCOPE_ID;
|
|
@@ -6158,6 +6446,7 @@ exports.transformExpression = transformExpression;
|
|
|
6158
6446
|
exports.transformModel = transformModel;
|
|
6159
6447
|
exports.transformOn = transformOn;
|
|
6160
6448
|
exports.traverseNode = traverseNode;
|
|
6449
|
+
exports.unwrapTSNode = unwrapTSNode;
|
|
6161
6450
|
exports.walkBlockDeclarations = walkBlockDeclarations;
|
|
6162
6451
|
exports.walkFunctionParams = walkFunctionParams;
|
|
6163
6452
|
exports.walkIdentifiers = walkIdentifiers;
|