@vue/compiler-dom 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.
@@ -107,6 +107,32 @@ function createDOMCompilerError(code, loc) {
107
107
  DOMErrorMessages
108
108
  );
109
109
  }
110
+ const DOMErrorCodes = {
111
+ "X_V_HTML_NO_EXPRESSION": 53,
112
+ "53": "X_V_HTML_NO_EXPRESSION",
113
+ "X_V_HTML_WITH_CHILDREN": 54,
114
+ "54": "X_V_HTML_WITH_CHILDREN",
115
+ "X_V_TEXT_NO_EXPRESSION": 55,
116
+ "55": "X_V_TEXT_NO_EXPRESSION",
117
+ "X_V_TEXT_WITH_CHILDREN": 56,
118
+ "56": "X_V_TEXT_WITH_CHILDREN",
119
+ "X_V_MODEL_ON_INVALID_ELEMENT": 57,
120
+ "57": "X_V_MODEL_ON_INVALID_ELEMENT",
121
+ "X_V_MODEL_ARG_ON_ELEMENT": 58,
122
+ "58": "X_V_MODEL_ARG_ON_ELEMENT",
123
+ "X_V_MODEL_ON_FILE_INPUT_ELEMENT": 59,
124
+ "59": "X_V_MODEL_ON_FILE_INPUT_ELEMENT",
125
+ "X_V_MODEL_UNNECESSARY_VALUE": 60,
126
+ "60": "X_V_MODEL_UNNECESSARY_VALUE",
127
+ "X_V_SHOW_NO_EXPRESSION": 61,
128
+ "61": "X_V_SHOW_NO_EXPRESSION",
129
+ "X_TRANSITION_INVALID_CHILDREN": 62,
130
+ "62": "X_TRANSITION_INVALID_CHILDREN",
131
+ "X_IGNORED_SIDE_EFFECT_TAG": 63,
132
+ "63": "X_IGNORED_SIDE_EFFECT_TAG",
133
+ "__EXTEND_POINT__": 64,
134
+ "64": "__EXTEND_POINT__"
135
+ };
110
136
  const DOMErrorMessages = {
111
137
  [53]: `v-html is missing expression.`,
112
138
  [54]: `v-html will override element children.`,
@@ -673,6 +699,7 @@ function parse(template, options = {}) {
673
699
  }
674
700
 
675
701
  exports.DOMDirectiveTransforms = DOMDirectiveTransforms;
702
+ exports.DOMErrorCodes = DOMErrorCodes;
676
703
  exports.DOMErrorMessages = DOMErrorMessages;
677
704
  exports.DOMNodeTransforms = DOMNodeTransforms;
678
705
  exports.TRANSITION = TRANSITION;
@@ -107,6 +107,32 @@ function createDOMCompilerError(code, loc) {
107
107
  DOMErrorMessages
108
108
  );
109
109
  }
110
+ const DOMErrorCodes = {
111
+ "X_V_HTML_NO_EXPRESSION": 53,
112
+ "53": "X_V_HTML_NO_EXPRESSION",
113
+ "X_V_HTML_WITH_CHILDREN": 54,
114
+ "54": "X_V_HTML_WITH_CHILDREN",
115
+ "X_V_TEXT_NO_EXPRESSION": 55,
116
+ "55": "X_V_TEXT_NO_EXPRESSION",
117
+ "X_V_TEXT_WITH_CHILDREN": 56,
118
+ "56": "X_V_TEXT_WITH_CHILDREN",
119
+ "X_V_MODEL_ON_INVALID_ELEMENT": 57,
120
+ "57": "X_V_MODEL_ON_INVALID_ELEMENT",
121
+ "X_V_MODEL_ARG_ON_ELEMENT": 58,
122
+ "58": "X_V_MODEL_ARG_ON_ELEMENT",
123
+ "X_V_MODEL_ON_FILE_INPUT_ELEMENT": 59,
124
+ "59": "X_V_MODEL_ON_FILE_INPUT_ELEMENT",
125
+ "X_V_MODEL_UNNECESSARY_VALUE": 60,
126
+ "60": "X_V_MODEL_UNNECESSARY_VALUE",
127
+ "X_V_SHOW_NO_EXPRESSION": 61,
128
+ "61": "X_V_SHOW_NO_EXPRESSION",
129
+ "X_TRANSITION_INVALID_CHILDREN": 62,
130
+ "62": "X_TRANSITION_INVALID_CHILDREN",
131
+ "X_IGNORED_SIDE_EFFECT_TAG": 63,
132
+ "63": "X_IGNORED_SIDE_EFFECT_TAG",
133
+ "__EXTEND_POINT__": 64,
134
+ "64": "__EXTEND_POINT__"
135
+ };
110
136
  const DOMErrorMessages = {
111
137
  [53]: `v-html is missing expression.`,
112
138
  [54]: `v-html will override element children.`,
@@ -603,6 +629,7 @@ function parse(template, options = {}) {
603
629
  }
604
630
 
605
631
  exports.DOMDirectiveTransforms = DOMDirectiveTransforms;
632
+ exports.DOMErrorCodes = DOMErrorCodes;
606
633
  exports.DOMErrorMessages = DOMErrorMessages;
607
634
  exports.DOMNodeTransforms = DOMNodeTransforms;
608
635
  exports.TRANSITION = TRANSITION;
@@ -20,7 +20,7 @@ interface DOMCompilerError extends CompilerError {
20
20
  code: DOMErrorCodes;
21
21
  }
22
22
  export declare function createDOMCompilerError(code: DOMErrorCodes, loc?: SourceLocation): DOMCompilerError;
23
- export declare const enum DOMErrorCodes {
23
+ export declare enum DOMErrorCodes {
24
24
  X_V_HTML_NO_EXPRESSION = 53,
25
25
  X_V_HTML_WITH_CHILDREN = 54,
26
26
  X_V_TEXT_NO_EXPRESSION = 55,
@@ -7,8 +7,8 @@ const EMPTY_OBJ = Object.freeze({}) ;
7
7
  const NOOP = () => {
8
8
  };
9
9
  const NO = () => false;
10
- const onRE = /^on[^a-z]/;
11
- const isOn = (key) => onRE.test(key);
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 isArray = Array.isArray;
14
14
  const isString = (val) => typeof val === "string";
@@ -212,6 +212,90 @@ function registerRuntimeHelpers(helpers) {
212
212
  });
213
213
  }
214
214
 
215
+ const Namespaces = {
216
+ "HTML": 0,
217
+ "0": "HTML",
218
+ "SVG": 1,
219
+ "1": "SVG",
220
+ "MATH_ML": 2,
221
+ "2": "MATH_ML"
222
+ };
223
+ const NodeTypes = {
224
+ "ROOT": 0,
225
+ "0": "ROOT",
226
+ "ELEMENT": 1,
227
+ "1": "ELEMENT",
228
+ "TEXT": 2,
229
+ "2": "TEXT",
230
+ "COMMENT": 3,
231
+ "3": "COMMENT",
232
+ "SIMPLE_EXPRESSION": 4,
233
+ "4": "SIMPLE_EXPRESSION",
234
+ "INTERPOLATION": 5,
235
+ "5": "INTERPOLATION",
236
+ "ATTRIBUTE": 6,
237
+ "6": "ATTRIBUTE",
238
+ "DIRECTIVE": 7,
239
+ "7": "DIRECTIVE",
240
+ "COMPOUND_EXPRESSION": 8,
241
+ "8": "COMPOUND_EXPRESSION",
242
+ "IF": 9,
243
+ "9": "IF",
244
+ "IF_BRANCH": 10,
245
+ "10": "IF_BRANCH",
246
+ "FOR": 11,
247
+ "11": "FOR",
248
+ "TEXT_CALL": 12,
249
+ "12": "TEXT_CALL",
250
+ "VNODE_CALL": 13,
251
+ "13": "VNODE_CALL",
252
+ "JS_CALL_EXPRESSION": 14,
253
+ "14": "JS_CALL_EXPRESSION",
254
+ "JS_OBJECT_EXPRESSION": 15,
255
+ "15": "JS_OBJECT_EXPRESSION",
256
+ "JS_PROPERTY": 16,
257
+ "16": "JS_PROPERTY",
258
+ "JS_ARRAY_EXPRESSION": 17,
259
+ "17": "JS_ARRAY_EXPRESSION",
260
+ "JS_FUNCTION_EXPRESSION": 18,
261
+ "18": "JS_FUNCTION_EXPRESSION",
262
+ "JS_CONDITIONAL_EXPRESSION": 19,
263
+ "19": "JS_CONDITIONAL_EXPRESSION",
264
+ "JS_CACHE_EXPRESSION": 20,
265
+ "20": "JS_CACHE_EXPRESSION",
266
+ "JS_BLOCK_STATEMENT": 21,
267
+ "21": "JS_BLOCK_STATEMENT",
268
+ "JS_TEMPLATE_LITERAL": 22,
269
+ "22": "JS_TEMPLATE_LITERAL",
270
+ "JS_IF_STATEMENT": 23,
271
+ "23": "JS_IF_STATEMENT",
272
+ "JS_ASSIGNMENT_EXPRESSION": 24,
273
+ "24": "JS_ASSIGNMENT_EXPRESSION",
274
+ "JS_SEQUENCE_EXPRESSION": 25,
275
+ "25": "JS_SEQUENCE_EXPRESSION",
276
+ "JS_RETURN_STATEMENT": 26,
277
+ "26": "JS_RETURN_STATEMENT"
278
+ };
279
+ const ElementTypes = {
280
+ "ELEMENT": 0,
281
+ "0": "ELEMENT",
282
+ "COMPONENT": 1,
283
+ "1": "COMPONENT",
284
+ "SLOT": 2,
285
+ "2": "SLOT",
286
+ "TEMPLATE": 3,
287
+ "3": "TEMPLATE"
288
+ };
289
+ const ConstantTypes = {
290
+ "NOT_CONSTANT": 0,
291
+ "0": "NOT_CONSTANT",
292
+ "CAN_SKIP_PATCH": 1,
293
+ "1": "CAN_SKIP_PATCH",
294
+ "CAN_HOIST": 2,
295
+ "2": "CAN_HOIST",
296
+ "CAN_STRINGIFY": 3,
297
+ "3": "CAN_STRINGIFY"
298
+ };
215
299
  const locStub = {
216
300
  start: { line: 1, column: 1, offset: 0 },
217
301
  end: { line: 1, column: 1, offset: 0 },
@@ -466,7 +550,9 @@ class Tokenizer {
466
550
  this.inRCDATA = false;
467
551
  /** For disabling RCDATA tags handling */
468
552
  this.inXML = false;
469
- /** Reocrd newline positions for fast line / column calculation */
553
+ /** For disabling interpolation parsing in v-pre */
554
+ this.inVPre = false;
555
+ /** Record newline positions for fast line / column calculation */
470
556
  this.newlines = [];
471
557
  this.mode = 0;
472
558
  this.delimiterOpen = defaultDelimitersOpen;
@@ -485,6 +571,7 @@ class Tokenizer {
485
571
  this.sectionStart = 0;
486
572
  this.index = 0;
487
573
  this.baseState = 1;
574
+ this.inRCDATA = false;
488
575
  this.currentSequence = void 0;
489
576
  this.newlines.length = 0;
490
577
  this.delimiterOpen = defaultDelimitersOpen;
@@ -523,7 +610,7 @@ class Tokenizer {
523
610
  }
524
611
  this.state = 5;
525
612
  this.sectionStart = this.index;
526
- } else if (c === this.delimiterOpen[0]) {
613
+ } else if (!this.inVPre && c === this.delimiterOpen[0]) {
527
614
  this.state = 2;
528
615
  this.delimiterIndex = 0;
529
616
  this.stateInterpolationOpen(c);
@@ -1205,6 +1292,16 @@ class Tokenizer {
1205
1292
  }
1206
1293
  }
1207
1294
 
1295
+ const CompilerDeprecationTypes = {
1296
+ "COMPILER_IS_ON_ELEMENT": "COMPILER_IS_ON_ELEMENT",
1297
+ "COMPILER_V_BIND_SYNC": "COMPILER_V_BIND_SYNC",
1298
+ "COMPILER_V_BIND_OBJECT_ORDER": "COMPILER_V_BIND_OBJECT_ORDER",
1299
+ "COMPILER_V_ON_NATIVE": "COMPILER_V_ON_NATIVE",
1300
+ "COMPILER_V_IF_V_FOR_PRECEDENCE": "COMPILER_V_IF_V_FOR_PRECEDENCE",
1301
+ "COMPILER_NATIVE_TEMPLATE": "COMPILER_NATIVE_TEMPLATE",
1302
+ "COMPILER_INLINE_TEMPLATE": "COMPILER_INLINE_TEMPLATE",
1303
+ "COMPILER_FILTERS": "COMPILER_FILTER"
1304
+ };
1208
1305
  const deprecationData = {
1209
1306
  ["COMPILER_IS_ON_ELEMENT"]: {
1210
1307
  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:".`,
@@ -1286,6 +1383,114 @@ function createCompilerError(code, loc, messages, additionalMessage) {
1286
1383
  error.loc = loc;
1287
1384
  return error;
1288
1385
  }
1386
+ const ErrorCodes = {
1387
+ "ABRUPT_CLOSING_OF_EMPTY_COMMENT": 0,
1388
+ "0": "ABRUPT_CLOSING_OF_EMPTY_COMMENT",
1389
+ "CDATA_IN_HTML_CONTENT": 1,
1390
+ "1": "CDATA_IN_HTML_CONTENT",
1391
+ "DUPLICATE_ATTRIBUTE": 2,
1392
+ "2": "DUPLICATE_ATTRIBUTE",
1393
+ "END_TAG_WITH_ATTRIBUTES": 3,
1394
+ "3": "END_TAG_WITH_ATTRIBUTES",
1395
+ "END_TAG_WITH_TRAILING_SOLIDUS": 4,
1396
+ "4": "END_TAG_WITH_TRAILING_SOLIDUS",
1397
+ "EOF_BEFORE_TAG_NAME": 5,
1398
+ "5": "EOF_BEFORE_TAG_NAME",
1399
+ "EOF_IN_CDATA": 6,
1400
+ "6": "EOF_IN_CDATA",
1401
+ "EOF_IN_COMMENT": 7,
1402
+ "7": "EOF_IN_COMMENT",
1403
+ "EOF_IN_SCRIPT_HTML_COMMENT_LIKE_TEXT": 8,
1404
+ "8": "EOF_IN_SCRIPT_HTML_COMMENT_LIKE_TEXT",
1405
+ "EOF_IN_TAG": 9,
1406
+ "9": "EOF_IN_TAG",
1407
+ "INCORRECTLY_CLOSED_COMMENT": 10,
1408
+ "10": "INCORRECTLY_CLOSED_COMMENT",
1409
+ "INCORRECTLY_OPENED_COMMENT": 11,
1410
+ "11": "INCORRECTLY_OPENED_COMMENT",
1411
+ "INVALID_FIRST_CHARACTER_OF_TAG_NAME": 12,
1412
+ "12": "INVALID_FIRST_CHARACTER_OF_TAG_NAME",
1413
+ "MISSING_ATTRIBUTE_VALUE": 13,
1414
+ "13": "MISSING_ATTRIBUTE_VALUE",
1415
+ "MISSING_END_TAG_NAME": 14,
1416
+ "14": "MISSING_END_TAG_NAME",
1417
+ "MISSING_WHITESPACE_BETWEEN_ATTRIBUTES": 15,
1418
+ "15": "MISSING_WHITESPACE_BETWEEN_ATTRIBUTES",
1419
+ "NESTED_COMMENT": 16,
1420
+ "16": "NESTED_COMMENT",
1421
+ "UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME": 17,
1422
+ "17": "UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME",
1423
+ "UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE": 18,
1424
+ "18": "UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE",
1425
+ "UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME": 19,
1426
+ "19": "UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME",
1427
+ "UNEXPECTED_NULL_CHARACTER": 20,
1428
+ "20": "UNEXPECTED_NULL_CHARACTER",
1429
+ "UNEXPECTED_QUESTION_MARK_INSTEAD_OF_TAG_NAME": 21,
1430
+ "21": "UNEXPECTED_QUESTION_MARK_INSTEAD_OF_TAG_NAME",
1431
+ "UNEXPECTED_SOLIDUS_IN_TAG": 22,
1432
+ "22": "UNEXPECTED_SOLIDUS_IN_TAG",
1433
+ "X_INVALID_END_TAG": 23,
1434
+ "23": "X_INVALID_END_TAG",
1435
+ "X_MISSING_END_TAG": 24,
1436
+ "24": "X_MISSING_END_TAG",
1437
+ "X_MISSING_INTERPOLATION_END": 25,
1438
+ "25": "X_MISSING_INTERPOLATION_END",
1439
+ "X_MISSING_DIRECTIVE_NAME": 26,
1440
+ "26": "X_MISSING_DIRECTIVE_NAME",
1441
+ "X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END": 27,
1442
+ "27": "X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END",
1443
+ "X_V_IF_NO_EXPRESSION": 28,
1444
+ "28": "X_V_IF_NO_EXPRESSION",
1445
+ "X_V_IF_SAME_KEY": 29,
1446
+ "29": "X_V_IF_SAME_KEY",
1447
+ "X_V_ELSE_NO_ADJACENT_IF": 30,
1448
+ "30": "X_V_ELSE_NO_ADJACENT_IF",
1449
+ "X_V_FOR_NO_EXPRESSION": 31,
1450
+ "31": "X_V_FOR_NO_EXPRESSION",
1451
+ "X_V_FOR_MALFORMED_EXPRESSION": 32,
1452
+ "32": "X_V_FOR_MALFORMED_EXPRESSION",
1453
+ "X_V_FOR_TEMPLATE_KEY_PLACEMENT": 33,
1454
+ "33": "X_V_FOR_TEMPLATE_KEY_PLACEMENT",
1455
+ "X_V_BIND_NO_EXPRESSION": 34,
1456
+ "34": "X_V_BIND_NO_EXPRESSION",
1457
+ "X_V_ON_NO_EXPRESSION": 35,
1458
+ "35": "X_V_ON_NO_EXPRESSION",
1459
+ "X_V_SLOT_UNEXPECTED_DIRECTIVE_ON_SLOT_OUTLET": 36,
1460
+ "36": "X_V_SLOT_UNEXPECTED_DIRECTIVE_ON_SLOT_OUTLET",
1461
+ "X_V_SLOT_MIXED_SLOT_USAGE": 37,
1462
+ "37": "X_V_SLOT_MIXED_SLOT_USAGE",
1463
+ "X_V_SLOT_DUPLICATE_SLOT_NAMES": 38,
1464
+ "38": "X_V_SLOT_DUPLICATE_SLOT_NAMES",
1465
+ "X_V_SLOT_EXTRANEOUS_DEFAULT_SLOT_CHILDREN": 39,
1466
+ "39": "X_V_SLOT_EXTRANEOUS_DEFAULT_SLOT_CHILDREN",
1467
+ "X_V_SLOT_MISPLACED": 40,
1468
+ "40": "X_V_SLOT_MISPLACED",
1469
+ "X_V_MODEL_NO_EXPRESSION": 41,
1470
+ "41": "X_V_MODEL_NO_EXPRESSION",
1471
+ "X_V_MODEL_MALFORMED_EXPRESSION": 42,
1472
+ "42": "X_V_MODEL_MALFORMED_EXPRESSION",
1473
+ "X_V_MODEL_ON_SCOPE_VARIABLE": 43,
1474
+ "43": "X_V_MODEL_ON_SCOPE_VARIABLE",
1475
+ "X_V_MODEL_ON_PROPS": 44,
1476
+ "44": "X_V_MODEL_ON_PROPS",
1477
+ "X_INVALID_EXPRESSION": 45,
1478
+ "45": "X_INVALID_EXPRESSION",
1479
+ "X_KEEP_ALIVE_INVALID_CHILDREN": 46,
1480
+ "46": "X_KEEP_ALIVE_INVALID_CHILDREN",
1481
+ "X_VNODE_HOOKS": 47,
1482
+ "47": "X_VNODE_HOOKS",
1483
+ "X_PREFIX_ID_NOT_SUPPORTED": 48,
1484
+ "48": "X_PREFIX_ID_NOT_SUPPORTED",
1485
+ "X_MODULE_MODE_NOT_SUPPORTED": 49,
1486
+ "49": "X_MODULE_MODE_NOT_SUPPORTED",
1487
+ "X_CACHE_HANDLER_NOT_SUPPORTED": 50,
1488
+ "50": "X_CACHE_HANDLER_NOT_SUPPORTED",
1489
+ "X_SCOPE_ID_NOT_SUPPORTED": 51,
1490
+ "51": "X_SCOPE_ID_NOT_SUPPORTED",
1491
+ "__EXTEND_POINT__": 52,
1492
+ "52": "__EXTEND_POINT__"
1493
+ };
1289
1494
  const errorMessages = {
1290
1495
  // parse errors
1291
1496
  [0]: "Illegal comment.",
@@ -1338,16 +1543,14 @@ const errorMessages = {
1338
1543
  Use a v-bind binding combined with a v-on listener that emits update:x event instead.`,
1339
1544
  [45]: `Error parsing JavaScript expression: `,
1340
1545
  [46]: `<KeepAlive> expects exactly one child component.`,
1546
+ [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.`,
1341
1547
  // generic errors
1342
- [47]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
1343
- [48]: `ES module mode is not supported in this build of compiler.`,
1344
- [49]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
1345
- [50]: `"scopeId" option is only supported in module mode.`,
1346
- // deprecations
1347
- [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.`,
1348
- [52]: `v-is="component-name" has been deprecated. Use is="vue:component-name" instead. v-is support will be removed in 3.4.`,
1548
+ [48]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
1549
+ [49]: `ES module mode is not supported in this build of compiler.`,
1550
+ [50]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
1551
+ [51]: `"scopeId" option is only supported in module mode.`,
1349
1552
  // just to fulfill types
1350
- [53]: ``
1553
+ [52]: ``
1351
1554
  };
1352
1555
 
1353
1556
  const isStaticExp = (p) => p.type === 4 && p.isStatic;
@@ -1655,7 +1858,8 @@ const defaultParserOptions = {
1655
1858
  isCustomElement: NO,
1656
1859
  onError: defaultOnError,
1657
1860
  onWarn: defaultOnWarn,
1658
- comments: true
1861
+ comments: true,
1862
+ prefixIdentifiers: false
1659
1863
  };
1660
1864
  let currentOptions = defaultParserOptions;
1661
1865
  let currentRoot = null;
@@ -1697,7 +1901,7 @@ const tokenizer = new Tokenizer(stack, {
1697
1901
  }
1698
1902
  addNode({
1699
1903
  type: 5,
1700
- content: createSimpleExpression(exp, false, getLoc(innerStart, innerEnd)),
1904
+ content: createExp(exp, false, getLoc(innerStart, innerEnd)),
1701
1905
  loc: getLoc(start, end)
1702
1906
  });
1703
1907
  },
@@ -1790,7 +1994,7 @@ const tokenizer = new Tokenizer(stack, {
1790
1994
  loc: getLoc(start)
1791
1995
  };
1792
1996
  if (name === "pre") {
1793
- inVPre = true;
1997
+ inVPre = tokenizer.inVPre = true;
1794
1998
  currentVPreBoundary = currentOpenTag;
1795
1999
  const props = currentOpenTag.props;
1796
2000
  for (let i = 0; i < props.length; i++) {
@@ -1802,13 +2006,15 @@ const tokenizer = new Tokenizer(stack, {
1802
2006
  }
1803
2007
  },
1804
2008
  ondirarg(start, end) {
2009
+ if (start === end)
2010
+ return;
1805
2011
  const arg = getSlice(start, end);
1806
2012
  if (inVPre) {
1807
2013
  currentProp.name += arg;
1808
2014
  setLocEnd(currentProp.nameLoc, end);
1809
2015
  } else {
1810
2016
  const isStatic = arg[0] !== `[`;
1811
- currentProp.arg = createSimpleExpression(
2017
+ currentProp.arg = createExp(
1812
2018
  isStatic ? arg : arg.slice(1, -1),
1813
2019
  isStatic,
1814
2020
  getLoc(start, end),
@@ -1881,10 +2087,13 @@ const tokenizer = new Tokenizer(stack, {
1881
2087
  tokenizer.enterRCDATA(toCharCodes(`</template`), 0);
1882
2088
  }
1883
2089
  } else {
1884
- currentProp.exp = createSimpleExpression(
2090
+ let expParseMode = 0 /* Normal */;
2091
+ currentProp.exp = createExp(
1885
2092
  currentAttrValue,
1886
2093
  false,
1887
- getLoc(currentAttrStartIndex, currentAttrEndIndex)
2094
+ getLoc(currentAttrStartIndex, currentAttrEndIndex),
2095
+ 0,
2096
+ expParseMode
1888
2097
  );
1889
2098
  if (currentProp.name === "for") {
1890
2099
  currentProp.forParseResult = parseForExpression(currentProp.exp);
@@ -1987,10 +2196,16 @@ function parseForExpression(input) {
1987
2196
  if (!inMatch)
1988
2197
  return;
1989
2198
  const [, LHS, RHS] = inMatch;
1990
- const createAliasExpression = (content, offset) => {
2199
+ const createAliasExpression = (content, offset, asParam = false) => {
1991
2200
  const start = loc.start.offset + offset;
1992
2201
  const end = start + content.length;
1993
- return createSimpleExpression(content, false, getLoc(start, end));
2202
+ return createExp(
2203
+ content,
2204
+ false,
2205
+ getLoc(start, end),
2206
+ 0,
2207
+ asParam ? 1 /* Params */ : 0 /* Normal */
2208
+ );
1994
2209
  };
1995
2210
  const result = {
1996
2211
  source: createAliasExpression(RHS.trim(), exp.indexOf(RHS, LHS.length)),
@@ -2008,7 +2223,7 @@ function parseForExpression(input) {
2008
2223
  let keyOffset;
2009
2224
  if (keyContent) {
2010
2225
  keyOffset = exp.indexOf(keyContent, trimmedOffset + valueContent.length);
2011
- result.key = createAliasExpression(keyContent, keyOffset);
2226
+ result.key = createAliasExpression(keyContent, keyOffset, true);
2012
2227
  }
2013
2228
  if (iteratorMatch[2]) {
2014
2229
  const indexContent = iteratorMatch[2].trim();
@@ -2018,13 +2233,14 @@ function parseForExpression(input) {
2018
2233
  exp.indexOf(
2019
2234
  indexContent,
2020
2235
  result.key ? keyOffset + keyContent.length : trimmedOffset + valueContent.length
2021
- )
2236
+ ),
2237
+ true
2022
2238
  );
2023
2239
  }
2024
2240
  }
2025
2241
  }
2026
2242
  if (valueContent) {
2027
- result.value = createAliasExpression(valueContent, trimmedOffset);
2243
+ result.value = createAliasExpression(valueContent, trimmedOffset, true);
2028
2244
  }
2029
2245
  return result;
2030
2246
  }
@@ -2102,7 +2318,7 @@ function onCloseTag(el, end, isImplied = false) {
2102
2318
  inPre--;
2103
2319
  }
2104
2320
  if (currentVPreBoundary === el) {
2105
- inVPre = false;
2321
+ inVPre = tokenizer.inVPre = false;
2106
2322
  currentVPreBoundary = null;
2107
2323
  }
2108
2324
  if (tokenizer.inXML && (stack[0] ? stack[0].ns : currentOptions.ns) === 0) {
@@ -2337,8 +2553,14 @@ function dirToAttr(dir) {
2337
2553
  }
2338
2554
  return attr;
2339
2555
  }
2340
- function emitError(code, index) {
2341
- currentOptions.onError(createCompilerError(code, getLoc(index, index)));
2556
+ function createExp(content, isStatic = false, loc, constType = 0, parseMode = 0 /* Normal */) {
2557
+ const exp = createSimpleExpression(content, isStatic, loc, constType);
2558
+ return exp;
2559
+ }
2560
+ function emitError(code, index, message) {
2561
+ currentOptions.onError(
2562
+ createCompilerError(code, getLoc(index, index), void 0, message)
2563
+ );
2342
2564
  }
2343
2565
  function reset() {
2344
2566
  tokenizer.reset();
@@ -2369,6 +2591,7 @@ function baseParse(input, options) {
2369
2591
  }
2370
2592
  }
2371
2593
  tokenizer.mode = currentOptions.parseMode === "html" ? 1 : currentOptions.parseMode === "sfc" ? 2 : 0;
2594
+ tokenizer.inXML = currentOptions.ns === 1 || currentOptions.ns === 2;
2372
2595
  const delimiters = options == null ? void 0 : options.delimiters;
2373
2596
  if (delimiters) {
2374
2597
  tokenizer.delimiterOpen = toCharCodes(delimiters[0]);
@@ -4554,6 +4777,9 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
4554
4777
  if (isEventHandler && isReservedProp(name)) {
4555
4778
  hasVnodeHook = true;
4556
4779
  }
4780
+ if (isEventHandler && value.type === 14) {
4781
+ value = value.arguments[0];
4782
+ }
4557
4783
  if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) {
4558
4784
  return;
4559
4785
  }
@@ -5006,9 +5232,7 @@ const transformOn$1 = (dir, node, context, augmentor) => {
5006
5232
  if (arg.isStatic) {
5007
5233
  let rawName = arg.content;
5008
5234
  if (rawName.startsWith("vnode")) {
5009
- context.onWarn(
5010
- createCompilerError(51, arg.loc)
5011
- );
5235
+ context.onError(createCompilerError(47, arg.loc));
5012
5236
  }
5013
5237
  if (rawName.startsWith("vue:")) {
5014
5238
  rawName = `vnode-${rawName.slice(4)}`;
@@ -5489,17 +5713,17 @@ function baseCompile(source, options = {}) {
5489
5713
  const isModuleMode = options.mode === "module";
5490
5714
  {
5491
5715
  if (options.prefixIdentifiers === true) {
5492
- onError(createCompilerError(47));
5493
- } else if (isModuleMode) {
5494
5716
  onError(createCompilerError(48));
5717
+ } else if (isModuleMode) {
5718
+ onError(createCompilerError(49));
5495
5719
  }
5496
5720
  }
5497
5721
  const prefixIdentifiers = false;
5498
5722
  if (options.cacheHandlers) {
5499
- onError(createCompilerError(49));
5723
+ onError(createCompilerError(50));
5500
5724
  }
5501
5725
  if (options.scopeId && !isModuleMode) {
5502
- onError(createCompilerError(50));
5726
+ onError(createCompilerError(51));
5503
5727
  }
5504
5728
  const ast = isString(source) ? baseParse(source, options) : source;
5505
5729
  const [nodeTransforms, directiveTransforms] = getBaseTransformPreset();
@@ -5528,6 +5752,19 @@ function baseCompile(source, options = {}) {
5528
5752
  );
5529
5753
  }
5530
5754
 
5755
+ const BindingTypes = {
5756
+ "DATA": "data",
5757
+ "PROPS": "props",
5758
+ "PROPS_ALIASED": "props-aliased",
5759
+ "SETUP_LET": "setup-let",
5760
+ "SETUP_CONST": "setup-const",
5761
+ "SETUP_REACTIVE_CONST": "setup-reactive-const",
5762
+ "SETUP_MAYBE_REF": "setup-maybe-ref",
5763
+ "SETUP_REF": "setup-ref",
5764
+ "OPTIONS": "options",
5765
+ "LITERAL_CONST": "literal-const"
5766
+ };
5767
+
5531
5768
  const noopDirectiveTransform = () => ({ props: [] });
5532
5769
 
5533
5770
  const V_MODEL_RADIO = Symbol(`vModelRadio` );
@@ -5646,6 +5883,32 @@ function createDOMCompilerError(code, loc) {
5646
5883
  DOMErrorMessages
5647
5884
  );
5648
5885
  }
5886
+ const DOMErrorCodes = {
5887
+ "X_V_HTML_NO_EXPRESSION": 53,
5888
+ "53": "X_V_HTML_NO_EXPRESSION",
5889
+ "X_V_HTML_WITH_CHILDREN": 54,
5890
+ "54": "X_V_HTML_WITH_CHILDREN",
5891
+ "X_V_TEXT_NO_EXPRESSION": 55,
5892
+ "55": "X_V_TEXT_NO_EXPRESSION",
5893
+ "X_V_TEXT_WITH_CHILDREN": 56,
5894
+ "56": "X_V_TEXT_WITH_CHILDREN",
5895
+ "X_V_MODEL_ON_INVALID_ELEMENT": 57,
5896
+ "57": "X_V_MODEL_ON_INVALID_ELEMENT",
5897
+ "X_V_MODEL_ARG_ON_ELEMENT": 58,
5898
+ "58": "X_V_MODEL_ARG_ON_ELEMENT",
5899
+ "X_V_MODEL_ON_FILE_INPUT_ELEMENT": 59,
5900
+ "59": "X_V_MODEL_ON_FILE_INPUT_ELEMENT",
5901
+ "X_V_MODEL_UNNECESSARY_VALUE": 60,
5902
+ "60": "X_V_MODEL_UNNECESSARY_VALUE",
5903
+ "X_V_SHOW_NO_EXPRESSION": 61,
5904
+ "61": "X_V_SHOW_NO_EXPRESSION",
5905
+ "X_TRANSITION_INVALID_CHILDREN": 62,
5906
+ "62": "X_TRANSITION_INVALID_CHILDREN",
5907
+ "X_IGNORED_SIDE_EFFECT_TAG": 63,
5908
+ "63": "X_IGNORED_SIDE_EFFECT_TAG",
5909
+ "__EXTEND_POINT__": 64,
5910
+ "64": "__EXTEND_POINT__"
5911
+ };
5649
5912
  const DOMErrorMessages = {
5650
5913
  [53]: `v-html is missing expression.`,
5651
5914
  [54]: `v-html will override element children.`,
@@ -6000,4 +6263,4 @@ function parse(template, options = {}) {
6000
6263
  return baseParse(template, extend({}, parserOptions, options));
6001
6264
  }
6002
6265
 
6003
- export { BASE_TRANSITION, CAMELIZE, CAPITALIZE, CREATE_BLOCK, CREATE_COMMENT, CREATE_ELEMENT_BLOCK, CREATE_ELEMENT_VNODE, CREATE_SLOTS, CREATE_STATIC, CREATE_TEXT, CREATE_VNODE, DOMDirectiveTransforms, DOMErrorMessages, DOMNodeTransforms, FRAGMENT, GUARD_REACTIVE_PROPS, IS_MEMO_SAME, IS_REF, KEEP_ALIVE, MERGE_PROPS, NORMALIZE_CLASS, NORMALIZE_PROPS, NORMALIZE_STYLE, OPEN_BLOCK, POP_SCOPE_ID, PUSH_SCOPE_ID, RENDER_LIST, RENDER_SLOT, RESOLVE_COMPONENT, RESOLVE_DIRECTIVE, RESOLVE_DYNAMIC_COMPONENT, RESOLVE_FILTER, SET_BLOCK_TRACKING, SUSPENSE, TELEPORT, TO_DISPLAY_STRING, TO_HANDLERS, TO_HANDLER_KEY, TRANSITION, TRANSITION_GROUP, TS_NODE_TYPES, UNREF, V_MODEL_CHECKBOX, V_MODEL_DYNAMIC, V_MODEL_RADIO, V_MODEL_SELECT, V_MODEL_TEXT, V_ON_WITH_KEYS, V_ON_WITH_MODIFIERS, V_SHOW, WITH_CTX, WITH_DIRECTIVES, WITH_MEMO, advancePositionWithClone, advancePositionWithMutation, assert, baseCompile, baseParse, buildDirectiveArgs, buildProps, buildSlots, checkCompatEnabled, compile, convertToBlock, createArrayExpression, createAssignmentExpression, createBlockStatement, createCacheExpression, createCallExpression, createCompilerError, createCompoundExpression, createConditionalExpression, createDOMCompilerError, createForLoopParams, createFunctionExpression, createIfStatement, createInterpolation, createObjectExpression, createObjectProperty, createReturnStatement, createRoot, createSequenceExpression, createSimpleExpression, createStructuralDirectiveTransform, createTemplateLiteral, createTransformContext, createVNodeCall, errorMessages, extractIdentifiers, findDir, findProp, forAliasRE, generate, generateCodeFrame, getBaseTransformPreset, getConstantType, getMemoedVNodeCall, getVNodeBlockHelper, getVNodeHelper, hasDynamicKeyVBind, hasScopeRef, helperNameMap, injectProp, isCoreComponent, isFunctionType, isInDestructureAssignment, isMemberExpression, isMemberExpressionBrowser, isMemberExpressionNode, isReferencedIdentifier, isSimpleIdentifier, isSlotOutlet, isStaticArgOf, isStaticExp, isStaticProperty, isStaticPropertyKey, isTemplateNode, isText$1 as isText, isVSlot, locStub, noopDirectiveTransform, parse, parserOptions, processExpression, processFor, processIf, processSlotOutlet, registerRuntimeHelpers, resolveComponentType, stringifyExpression, toValidAssetId, trackSlotScopes, trackVForSlotScopes, transform, transformBind, transformElement, transformExpression, transformModel$1 as transformModel, transformOn$1 as transformOn, transformStyle, traverseNode, walkBlockDeclarations, walkFunctionParams, walkIdentifiers, warnDeprecation };
6266
+ export { BASE_TRANSITION, BindingTypes, CAMELIZE, CAPITALIZE, CREATE_BLOCK, CREATE_COMMENT, CREATE_ELEMENT_BLOCK, CREATE_ELEMENT_VNODE, CREATE_SLOTS, CREATE_STATIC, CREATE_TEXT, CREATE_VNODE, CompilerDeprecationTypes, ConstantTypes, DOMDirectiveTransforms, DOMErrorCodes, DOMErrorMessages, DOMNodeTransforms, ElementTypes, ErrorCodes, FRAGMENT, GUARD_REACTIVE_PROPS, IS_MEMO_SAME, IS_REF, KEEP_ALIVE, MERGE_PROPS, NORMALIZE_CLASS, NORMALIZE_PROPS, NORMALIZE_STYLE, Namespaces, NodeTypes, OPEN_BLOCK, POP_SCOPE_ID, PUSH_SCOPE_ID, RENDER_LIST, RENDER_SLOT, RESOLVE_COMPONENT, RESOLVE_DIRECTIVE, RESOLVE_DYNAMIC_COMPONENT, RESOLVE_FILTER, SET_BLOCK_TRACKING, SUSPENSE, TELEPORT, TO_DISPLAY_STRING, TO_HANDLERS, TO_HANDLER_KEY, TRANSITION, TRANSITION_GROUP, TS_NODE_TYPES, UNREF, V_MODEL_CHECKBOX, V_MODEL_DYNAMIC, V_MODEL_RADIO, V_MODEL_SELECT, V_MODEL_TEXT, V_ON_WITH_KEYS, V_ON_WITH_MODIFIERS, V_SHOW, WITH_CTX, WITH_DIRECTIVES, WITH_MEMO, advancePositionWithClone, advancePositionWithMutation, assert, baseCompile, baseParse, buildDirectiveArgs, buildProps, buildSlots, checkCompatEnabled, compile, convertToBlock, createArrayExpression, createAssignmentExpression, createBlockStatement, createCacheExpression, createCallExpression, createCompilerError, createCompoundExpression, createConditionalExpression, createDOMCompilerError, createForLoopParams, createFunctionExpression, createIfStatement, createInterpolation, createObjectExpression, createObjectProperty, createReturnStatement, createRoot, createSequenceExpression, createSimpleExpression, createStructuralDirectiveTransform, createTemplateLiteral, createTransformContext, createVNodeCall, errorMessages, extractIdentifiers, findDir, findProp, forAliasRE, generate, generateCodeFrame, getBaseTransformPreset, getConstantType, getMemoedVNodeCall, getVNodeBlockHelper, getVNodeHelper, hasDynamicKeyVBind, hasScopeRef, helperNameMap, injectProp, isCoreComponent, isFunctionType, isInDestructureAssignment, isMemberExpression, isMemberExpressionBrowser, isMemberExpressionNode, isReferencedIdentifier, isSimpleIdentifier, isSlotOutlet, isStaticArgOf, isStaticExp, isStaticProperty, isStaticPropertyKey, isTemplateNode, isText$1 as isText, isVSlot, locStub, noopDirectiveTransform, parse, parserOptions, processExpression, processFor, processIf, processSlotOutlet, registerRuntimeHelpers, resolveComponentType, stringifyExpression, toValidAssetId, trackSlotScopes, trackVForSlotScopes, transform, transformBind, transformElement, transformExpression, transformModel$1 as transformModel, transformOn$1 as transformOn, transformStyle, traverseNode, walkBlockDeclarations, walkFunctionParams, walkIdentifiers, warnDeprecation };