@vue/compiler-core 3.4.0-alpha.3 → 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.
@@ -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
- /** Reocrd newline positions for fast line / column calculation */
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:".`,
@@ -1232,6 +1329,114 @@ function createCompilerError(code, loc, messages, additionalMessage) {
1232
1329
  error.loc = loc;
1233
1330
  return error;
1234
1331
  }
1332
+ const ErrorCodes = {
1333
+ "ABRUPT_CLOSING_OF_EMPTY_COMMENT": 0,
1334
+ "0": "ABRUPT_CLOSING_OF_EMPTY_COMMENT",
1335
+ "CDATA_IN_HTML_CONTENT": 1,
1336
+ "1": "CDATA_IN_HTML_CONTENT",
1337
+ "DUPLICATE_ATTRIBUTE": 2,
1338
+ "2": "DUPLICATE_ATTRIBUTE",
1339
+ "END_TAG_WITH_ATTRIBUTES": 3,
1340
+ "3": "END_TAG_WITH_ATTRIBUTES",
1341
+ "END_TAG_WITH_TRAILING_SOLIDUS": 4,
1342
+ "4": "END_TAG_WITH_TRAILING_SOLIDUS",
1343
+ "EOF_BEFORE_TAG_NAME": 5,
1344
+ "5": "EOF_BEFORE_TAG_NAME",
1345
+ "EOF_IN_CDATA": 6,
1346
+ "6": "EOF_IN_CDATA",
1347
+ "EOF_IN_COMMENT": 7,
1348
+ "7": "EOF_IN_COMMENT",
1349
+ "EOF_IN_SCRIPT_HTML_COMMENT_LIKE_TEXT": 8,
1350
+ "8": "EOF_IN_SCRIPT_HTML_COMMENT_LIKE_TEXT",
1351
+ "EOF_IN_TAG": 9,
1352
+ "9": "EOF_IN_TAG",
1353
+ "INCORRECTLY_CLOSED_COMMENT": 10,
1354
+ "10": "INCORRECTLY_CLOSED_COMMENT",
1355
+ "INCORRECTLY_OPENED_COMMENT": 11,
1356
+ "11": "INCORRECTLY_OPENED_COMMENT",
1357
+ "INVALID_FIRST_CHARACTER_OF_TAG_NAME": 12,
1358
+ "12": "INVALID_FIRST_CHARACTER_OF_TAG_NAME",
1359
+ "MISSING_ATTRIBUTE_VALUE": 13,
1360
+ "13": "MISSING_ATTRIBUTE_VALUE",
1361
+ "MISSING_END_TAG_NAME": 14,
1362
+ "14": "MISSING_END_TAG_NAME",
1363
+ "MISSING_WHITESPACE_BETWEEN_ATTRIBUTES": 15,
1364
+ "15": "MISSING_WHITESPACE_BETWEEN_ATTRIBUTES",
1365
+ "NESTED_COMMENT": 16,
1366
+ "16": "NESTED_COMMENT",
1367
+ "UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME": 17,
1368
+ "17": "UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME",
1369
+ "UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE": 18,
1370
+ "18": "UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE",
1371
+ "UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME": 19,
1372
+ "19": "UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME",
1373
+ "UNEXPECTED_NULL_CHARACTER": 20,
1374
+ "20": "UNEXPECTED_NULL_CHARACTER",
1375
+ "UNEXPECTED_QUESTION_MARK_INSTEAD_OF_TAG_NAME": 21,
1376
+ "21": "UNEXPECTED_QUESTION_MARK_INSTEAD_OF_TAG_NAME",
1377
+ "UNEXPECTED_SOLIDUS_IN_TAG": 22,
1378
+ "22": "UNEXPECTED_SOLIDUS_IN_TAG",
1379
+ "X_INVALID_END_TAG": 23,
1380
+ "23": "X_INVALID_END_TAG",
1381
+ "X_MISSING_END_TAG": 24,
1382
+ "24": "X_MISSING_END_TAG",
1383
+ "X_MISSING_INTERPOLATION_END": 25,
1384
+ "25": "X_MISSING_INTERPOLATION_END",
1385
+ "X_MISSING_DIRECTIVE_NAME": 26,
1386
+ "26": "X_MISSING_DIRECTIVE_NAME",
1387
+ "X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END": 27,
1388
+ "27": "X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END",
1389
+ "X_V_IF_NO_EXPRESSION": 28,
1390
+ "28": "X_V_IF_NO_EXPRESSION",
1391
+ "X_V_IF_SAME_KEY": 29,
1392
+ "29": "X_V_IF_SAME_KEY",
1393
+ "X_V_ELSE_NO_ADJACENT_IF": 30,
1394
+ "30": "X_V_ELSE_NO_ADJACENT_IF",
1395
+ "X_V_FOR_NO_EXPRESSION": 31,
1396
+ "31": "X_V_FOR_NO_EXPRESSION",
1397
+ "X_V_FOR_MALFORMED_EXPRESSION": 32,
1398
+ "32": "X_V_FOR_MALFORMED_EXPRESSION",
1399
+ "X_V_FOR_TEMPLATE_KEY_PLACEMENT": 33,
1400
+ "33": "X_V_FOR_TEMPLATE_KEY_PLACEMENT",
1401
+ "X_V_BIND_NO_EXPRESSION": 34,
1402
+ "34": "X_V_BIND_NO_EXPRESSION",
1403
+ "X_V_ON_NO_EXPRESSION": 35,
1404
+ "35": "X_V_ON_NO_EXPRESSION",
1405
+ "X_V_SLOT_UNEXPECTED_DIRECTIVE_ON_SLOT_OUTLET": 36,
1406
+ "36": "X_V_SLOT_UNEXPECTED_DIRECTIVE_ON_SLOT_OUTLET",
1407
+ "X_V_SLOT_MIXED_SLOT_USAGE": 37,
1408
+ "37": "X_V_SLOT_MIXED_SLOT_USAGE",
1409
+ "X_V_SLOT_DUPLICATE_SLOT_NAMES": 38,
1410
+ "38": "X_V_SLOT_DUPLICATE_SLOT_NAMES",
1411
+ "X_V_SLOT_EXTRANEOUS_DEFAULT_SLOT_CHILDREN": 39,
1412
+ "39": "X_V_SLOT_EXTRANEOUS_DEFAULT_SLOT_CHILDREN",
1413
+ "X_V_SLOT_MISPLACED": 40,
1414
+ "40": "X_V_SLOT_MISPLACED",
1415
+ "X_V_MODEL_NO_EXPRESSION": 41,
1416
+ "41": "X_V_MODEL_NO_EXPRESSION",
1417
+ "X_V_MODEL_MALFORMED_EXPRESSION": 42,
1418
+ "42": "X_V_MODEL_MALFORMED_EXPRESSION",
1419
+ "X_V_MODEL_ON_SCOPE_VARIABLE": 43,
1420
+ "43": "X_V_MODEL_ON_SCOPE_VARIABLE",
1421
+ "X_V_MODEL_ON_PROPS": 44,
1422
+ "44": "X_V_MODEL_ON_PROPS",
1423
+ "X_INVALID_EXPRESSION": 45,
1424
+ "45": "X_INVALID_EXPRESSION",
1425
+ "X_KEEP_ALIVE_INVALID_CHILDREN": 46,
1426
+ "46": "X_KEEP_ALIVE_INVALID_CHILDREN",
1427
+ "X_VNODE_HOOKS": 47,
1428
+ "47": "X_VNODE_HOOKS",
1429
+ "X_PREFIX_ID_NOT_SUPPORTED": 48,
1430
+ "48": "X_PREFIX_ID_NOT_SUPPORTED",
1431
+ "X_MODULE_MODE_NOT_SUPPORTED": 49,
1432
+ "49": "X_MODULE_MODE_NOT_SUPPORTED",
1433
+ "X_CACHE_HANDLER_NOT_SUPPORTED": 50,
1434
+ "50": "X_CACHE_HANDLER_NOT_SUPPORTED",
1435
+ "X_SCOPE_ID_NOT_SUPPORTED": 51,
1436
+ "51": "X_SCOPE_ID_NOT_SUPPORTED",
1437
+ "__EXTEND_POINT__": 52,
1438
+ "52": "__EXTEND_POINT__"
1439
+ };
1235
1440
  const errorMessages = {
1236
1441
  // parse errors
1237
1442
  [0]: "Illegal comment.",
@@ -1284,16 +1489,14 @@ const errorMessages = {
1284
1489
  Use a v-bind binding combined with a v-on listener that emits update:x event instead.`,
1285
1490
  [45]: `Error parsing JavaScript expression: `,
1286
1491
  [46]: `<KeepAlive> expects exactly one child component.`,
1492
+ [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.`,
1287
1493
  // generic errors
1288
- [47]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
1289
- [48]: `ES module mode is not supported in this build of compiler.`,
1290
- [49]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
1291
- [50]: `"scopeId" option is only supported in module mode.`,
1292
- // deprecations
1293
- [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.`,
1294
- [52]: `v-is="component-name" has been deprecated. Use is="vue:component-name" instead. v-is support will be removed in 3.4.`,
1494
+ [48]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
1495
+ [49]: `ES module mode is not supported in this build of compiler.`,
1496
+ [50]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
1497
+ [51]: `"scopeId" option is only supported in module mode.`,
1295
1498
  // just to fulfill types
1296
- [53]: ``
1499
+ [52]: ``
1297
1500
  };
1298
1501
 
1299
1502
  const isStaticExp = (p) => p.type === 4 && p.isStatic;
@@ -1613,7 +1816,8 @@ const defaultParserOptions = {
1613
1816
  isCustomElement: shared.NO,
1614
1817
  onError: defaultOnError,
1615
1818
  onWarn: defaultOnWarn,
1616
- comments: true
1819
+ comments: true,
1820
+ prefixIdentifiers: false
1617
1821
  };
1618
1822
  let currentOptions = defaultParserOptions;
1619
1823
  let currentRoot = null;
@@ -1655,7 +1859,7 @@ const tokenizer = new Tokenizer(stack, {
1655
1859
  }
1656
1860
  addNode({
1657
1861
  type: 5,
1658
- content: createSimpleExpression(exp, false, getLoc(innerStart, innerEnd)),
1862
+ content: createExp(exp, false, getLoc(innerStart, innerEnd)),
1659
1863
  loc: getLoc(start, end)
1660
1864
  });
1661
1865
  },
@@ -1748,7 +1952,7 @@ const tokenizer = new Tokenizer(stack, {
1748
1952
  loc: getLoc(start)
1749
1953
  };
1750
1954
  if (name === "pre") {
1751
- inVPre = true;
1955
+ inVPre = tokenizer.inVPre = true;
1752
1956
  currentVPreBoundary = currentOpenTag;
1753
1957
  const props = currentOpenTag.props;
1754
1958
  for (let i = 0; i < props.length; i++) {
@@ -1768,7 +1972,7 @@ const tokenizer = new Tokenizer(stack, {
1768
1972
  setLocEnd(currentProp.nameLoc, end);
1769
1973
  } else {
1770
1974
  const isStatic = arg[0] !== `[`;
1771
- currentProp.arg = createSimpleExpression(
1975
+ currentProp.arg = createExp(
1772
1976
  isStatic ? arg : arg.slice(1, -1),
1773
1977
  isStatic,
1774
1978
  getLoc(start, end),
@@ -1835,10 +2039,22 @@ const tokenizer = new Tokenizer(stack, {
1835
2039
  tokenizer.enterRCDATA(toCharCodes(`</template`), 0);
1836
2040
  }
1837
2041
  } else {
1838
- currentProp.exp = createSimpleExpression(
2042
+ let expParseMode = 0 /* Normal */;
2043
+ {
2044
+ if (currentProp.name === "for") {
2045
+ expParseMode = 3 /* Skip */;
2046
+ } else if (currentProp.name === "slot") {
2047
+ expParseMode = 1 /* Params */;
2048
+ } else if (currentProp.name === "on" && currentAttrValue.includes(";")) {
2049
+ expParseMode = 2 /* Statements */;
2050
+ }
2051
+ }
2052
+ currentProp.exp = createExp(
1839
2053
  currentAttrValue,
1840
2054
  false,
1841
- getLoc(currentAttrStartIndex, currentAttrEndIndex)
2055
+ getLoc(currentAttrStartIndex, currentAttrEndIndex),
2056
+ 0,
2057
+ expParseMode
1842
2058
  );
1843
2059
  if (currentProp.name === "for") {
1844
2060
  currentProp.forParseResult = parseForExpression(currentProp.exp);
@@ -1941,10 +2157,16 @@ function parseForExpression(input) {
1941
2157
  if (!inMatch)
1942
2158
  return;
1943
2159
  const [, LHS, RHS] = inMatch;
1944
- const createAliasExpression = (content, offset) => {
2160
+ const createAliasExpression = (content, offset, asParam = false) => {
1945
2161
  const start = loc.start.offset + offset;
1946
2162
  const end = start + content.length;
1947
- return createSimpleExpression(content, false, getLoc(start, end));
2163
+ return createExp(
2164
+ content,
2165
+ false,
2166
+ getLoc(start, end),
2167
+ 0,
2168
+ asParam ? 1 /* Params */ : 0 /* Normal */
2169
+ );
1948
2170
  };
1949
2171
  const result = {
1950
2172
  source: createAliasExpression(RHS.trim(), exp.indexOf(RHS, LHS.length)),
@@ -1962,7 +2184,7 @@ function parseForExpression(input) {
1962
2184
  let keyOffset;
1963
2185
  if (keyContent) {
1964
2186
  keyOffset = exp.indexOf(keyContent, trimmedOffset + valueContent.length);
1965
- result.key = createAliasExpression(keyContent, keyOffset);
2187
+ result.key = createAliasExpression(keyContent, keyOffset, true);
1966
2188
  }
1967
2189
  if (iteratorMatch[2]) {
1968
2190
  const indexContent = iteratorMatch[2].trim();
@@ -1972,13 +2194,14 @@ function parseForExpression(input) {
1972
2194
  exp.indexOf(
1973
2195
  indexContent,
1974
2196
  result.key ? keyOffset + keyContent.length : trimmedOffset + valueContent.length
1975
- )
2197
+ ),
2198
+ true
1976
2199
  );
1977
2200
  }
1978
2201
  }
1979
2202
  }
1980
2203
  if (valueContent) {
1981
- result.value = createAliasExpression(valueContent, trimmedOffset);
2204
+ result.value = createAliasExpression(valueContent, trimmedOffset, true);
1982
2205
  }
1983
2206
  return result;
1984
2207
  }
@@ -2049,7 +2272,7 @@ function onCloseTag(el, end, isImplied = false) {
2049
2272
  inPre--;
2050
2273
  }
2051
2274
  if (currentVPreBoundary === el) {
2052
- inVPre = false;
2275
+ inVPre = tokenizer.inVPre = false;
2053
2276
  currentVPreBoundary = null;
2054
2277
  }
2055
2278
  if (tokenizer.inXML && (stack[0] ? stack[0].ns : currentOptions.ns) === 0) {
@@ -2284,8 +2507,36 @@ function dirToAttr(dir) {
2284
2507
  }
2285
2508
  return attr;
2286
2509
  }
2287
- function emitError(code, index) {
2288
- currentOptions.onError(createCompilerError(code, getLoc(index, index)));
2510
+ function createExp(content, isStatic = false, loc, constType = 0, parseMode = 0 /* Normal */) {
2511
+ const exp = createSimpleExpression(content, isStatic, loc, constType);
2512
+ if (!isStatic && currentOptions.prefixIdentifiers && parseMode !== 3 /* Skip */ && content.trim()) {
2513
+ if (isSimpleIdentifier(content)) {
2514
+ exp.ast = null;
2515
+ return exp;
2516
+ }
2517
+ try {
2518
+ const plugins = currentOptions.expressionPlugins;
2519
+ const options = {
2520
+ plugins: plugins ? [...plugins, "typescript"] : ["typescript"]
2521
+ };
2522
+ if (parseMode === 2 /* Statements */) {
2523
+ exp.ast = parser.parse(` ${content} `, options).program;
2524
+ } else if (parseMode === 1 /* Params */) {
2525
+ exp.ast = parser.parseExpression(`(${content})=>{}`, options);
2526
+ } else {
2527
+ exp.ast = parser.parseExpression(`(${content})`, options);
2528
+ }
2529
+ } catch (e) {
2530
+ exp.ast = false;
2531
+ emitError(45, loc.start.offset, e.message);
2532
+ }
2533
+ }
2534
+ return exp;
2535
+ }
2536
+ function emitError(code, index, message) {
2537
+ currentOptions.onError(
2538
+ createCompilerError(code, getLoc(index, index), void 0, message)
2539
+ );
2289
2540
  }
2290
2541
  function reset() {
2291
2542
  tokenizer.reset();
@@ -2316,6 +2567,7 @@ function baseParse(input, options) {
2316
2567
  }
2317
2568
  }
2318
2569
  tokenizer.mode = currentOptions.parseMode === "html" ? 1 : currentOptions.parseMode === "sfc" ? 2 : 0;
2570
+ tokenizer.inXML = currentOptions.ns === 1 || currentOptions.ns === 2;
2319
2571
  const delimiters = options == null ? void 0 : options.delimiters;
2320
2572
  if (delimiters) {
2321
2573
  tokenizer.delimiterOpen = toCharCodes(delimiters[0]);
@@ -3674,7 +3926,7 @@ function genReturnStatement({ returns }, context) {
3674
3926
  }
3675
3927
 
3676
3928
  function walkIdentifiers(root, onIdentifier, includeAll = false, parentStack = [], knownIds = /* @__PURE__ */ Object.create(null)) {
3677
- const rootExp = root.type === "Program" && root.body[0].type === "ExpressionStatement" && root.body[0].expression;
3929
+ const rootExp = root.type === "Program" ? root.body[0].type === "ExpressionStatement" && root.body[0].expression : root;
3678
3930
  estreeWalker.walk(root, {
3679
3931
  enter(node, parent) {
3680
3932
  parent && parentStack.push(parent);
@@ -4023,7 +4275,11 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
4023
4275
  };
4024
4276
  const rawExp = node.content;
4025
4277
  const bailConstant = constantBailRE.test(rawExp);
4026
- if (isSimpleIdentifier(rawExp)) {
4278
+ let ast = node.ast;
4279
+ if (ast === false) {
4280
+ return node;
4281
+ }
4282
+ if (ast === null || !ast && isSimpleIdentifier(rawExp)) {
4027
4283
  const isScopeVarReference = context.identifiers[rawExp];
4028
4284
  const isAllowedGlobal = shared.isGloballyAllowed(rawExp);
4029
4285
  const isLiteral = isLiteralWhitelisted(rawExp);
@@ -4041,22 +4297,23 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
4041
4297
  }
4042
4298
  return node;
4043
4299
  }
4044
- let ast;
4045
- const source = asRawStatements ? ` ${rawExp} ` : `(${rawExp})${asParams ? `=>{}` : ``}`;
4046
- try {
4047
- ast = parser.parse(source, {
4048
- plugins: context.expressionPlugins
4049
- }).program;
4050
- } catch (e) {
4051
- context.onError(
4052
- createCompilerError(
4053
- 45,
4054
- node.loc,
4055
- void 0,
4056
- e.message
4057
- )
4058
- );
4059
- return node;
4300
+ if (!ast) {
4301
+ const source = asRawStatements ? ` ${rawExp} ` : `(${rawExp})${asParams ? `=>{}` : ``}`;
4302
+ try {
4303
+ ast = parser.parse(source, {
4304
+ plugins: context.expressionPlugins
4305
+ }).program;
4306
+ } catch (e) {
4307
+ context.onError(
4308
+ createCompilerError(
4309
+ 45,
4310
+ node.loc,
4311
+ void 0,
4312
+ e.message
4313
+ )
4314
+ );
4315
+ return node;
4316
+ }
4060
4317
  }
4061
4318
  const ids = [];
4062
4319
  const parentStack = [];
@@ -4099,15 +4356,15 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
4099
4356
  if (leadingText.length || id.prefix) {
4100
4357
  children.push(leadingText + (id.prefix || ``));
4101
4358
  }
4102
- const source2 = rawExp.slice(start, end);
4359
+ const source = rawExp.slice(start, end);
4103
4360
  children.push(
4104
4361
  createSimpleExpression(
4105
4362
  id.name,
4106
4363
  false,
4107
4364
  {
4108
- start: advancePositionWithClone(node.loc.start, source2, start),
4109
- end: advancePositionWithClone(node.loc.start, source2, end),
4110
- source: source2
4365
+ start: advancePositionWithClone(node.loc.start, source, start),
4366
+ end: advancePositionWithClone(node.loc.start, source, end),
4367
+ source
4111
4368
  },
4112
4369
  id.isConstant ? 3 : 0
4113
4370
  )
@@ -4119,6 +4376,7 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
4119
4376
  let ret;
4120
4377
  if (children.length) {
4121
4378
  ret = createCompoundExpression(children, node.loc);
4379
+ ret.ast = ast;
4122
4380
  } else {
4123
4381
  ret = node;
4124
4382
  ret.constType = bailConstant ? 0 : 3;
@@ -5078,6 +5336,10 @@ function resolveSetupReference(name, context) {
5078
5336
  `${context.helperString(UNREF)}(${fromMaybeRef})`
5079
5337
  ) : `$setup[${JSON.stringify(fromMaybeRef)}]`;
5080
5338
  }
5339
+ const fromProps = checkType("props");
5340
+ if (fromProps) {
5341
+ return `${context.helperString(UNREF)}(${context.inline ? "__props" : "$props"}[${JSON.stringify(fromProps)}])`;
5342
+ }
5081
5343
  }
5082
5344
  function buildProps(node, context, props = node.props, isComponent, isDynamicComponent, ssr = false) {
5083
5345
  const { tag, loc: elementLoc, children } = node;
@@ -5118,6 +5380,9 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
5118
5380
  if (isEventHandler && shared.isReservedProp(name)) {
5119
5381
  hasVnodeHook = true;
5120
5382
  }
5383
+ if (isEventHandler && value.type === 14) {
5384
+ value = value.arguments[0];
5385
+ }
5121
5386
  if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) {
5122
5387
  return;
5123
5388
  }
@@ -5585,9 +5850,7 @@ const transformOn = (dir, node, context, augmentor) => {
5585
5850
  if (arg.isStatic) {
5586
5851
  let rawName = arg.content;
5587
5852
  if (rawName.startsWith("vnode")) {
5588
- context.onWarn(
5589
- createCompilerError(51, arg.loc)
5590
- );
5853
+ context.onError(createCompilerError(47, arg.loc));
5591
5854
  }
5592
5855
  if (rawName.startsWith("vue:")) {
5593
5856
  rawName = `vnode-${rawName.slice(4)}`;
@@ -6121,10 +6384,10 @@ function baseCompile(source, options = {}) {
6121
6384
  const isModuleMode = options.mode === "module";
6122
6385
  const prefixIdentifiers = options.prefixIdentifiers === true || isModuleMode;
6123
6386
  if (!prefixIdentifiers && options.cacheHandlers) {
6124
- onError(createCompilerError(49));
6387
+ onError(createCompilerError(50));
6125
6388
  }
6126
6389
  if (options.scopeId && !isModuleMode) {
6127
- onError(createCompilerError(50));
6390
+ onError(createCompilerError(51));
6128
6391
  }
6129
6392
  const ast = shared.isString(source) ? baseParse(source, options) : source;
6130
6393
  const [nodeTransforms, directiveTransforms] = getBaseTransformPreset(prefixIdentifiers);
@@ -6159,10 +6422,24 @@ function baseCompile(source, options = {}) {
6159
6422
  );
6160
6423
  }
6161
6424
 
6425
+ const BindingTypes = {
6426
+ "DATA": "data",
6427
+ "PROPS": "props",
6428
+ "PROPS_ALIASED": "props-aliased",
6429
+ "SETUP_LET": "setup-let",
6430
+ "SETUP_CONST": "setup-const",
6431
+ "SETUP_REACTIVE_CONST": "setup-reactive-const",
6432
+ "SETUP_MAYBE_REF": "setup-maybe-ref",
6433
+ "SETUP_REF": "setup-ref",
6434
+ "OPTIONS": "options",
6435
+ "LITERAL_CONST": "literal-const"
6436
+ };
6437
+
6162
6438
  const noopDirectiveTransform = () => ({ props: [] });
6163
6439
 
6164
6440
  exports.generateCodeFrame = shared.generateCodeFrame;
6165
6441
  exports.BASE_TRANSITION = BASE_TRANSITION;
6442
+ exports.BindingTypes = BindingTypes;
6166
6443
  exports.CAMELIZE = CAMELIZE;
6167
6444
  exports.CAPITALIZE = CAPITALIZE;
6168
6445
  exports.CREATE_BLOCK = CREATE_BLOCK;
@@ -6173,6 +6450,10 @@ exports.CREATE_SLOTS = CREATE_SLOTS;
6173
6450
  exports.CREATE_STATIC = CREATE_STATIC;
6174
6451
  exports.CREATE_TEXT = CREATE_TEXT;
6175
6452
  exports.CREATE_VNODE = CREATE_VNODE;
6453
+ exports.CompilerDeprecationTypes = CompilerDeprecationTypes;
6454
+ exports.ConstantTypes = ConstantTypes;
6455
+ exports.ElementTypes = ElementTypes;
6456
+ exports.ErrorCodes = ErrorCodes;
6176
6457
  exports.FRAGMENT = FRAGMENT;
6177
6458
  exports.GUARD_REACTIVE_PROPS = GUARD_REACTIVE_PROPS;
6178
6459
  exports.IS_MEMO_SAME = IS_MEMO_SAME;
@@ -6182,6 +6463,8 @@ exports.MERGE_PROPS = MERGE_PROPS;
6182
6463
  exports.NORMALIZE_CLASS = NORMALIZE_CLASS;
6183
6464
  exports.NORMALIZE_PROPS = NORMALIZE_PROPS;
6184
6465
  exports.NORMALIZE_STYLE = NORMALIZE_STYLE;
6466
+ exports.Namespaces = Namespaces;
6467
+ exports.NodeTypes = NodeTypes;
6185
6468
  exports.OPEN_BLOCK = OPEN_BLOCK;
6186
6469
  exports.POP_SCOPE_ID = POP_SCOPE_ID;
6187
6470
  exports.PUSH_SCOPE_ID = PUSH_SCOPE_ID;