@vue/compiler-dom 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.
@@ -10,8 +10,8 @@ var VueCompilerDOM = (function (exports) {
10
10
  const NOOP = () => {
11
11
  };
12
12
  const NO = () => false;
13
- const onRE = /^on[^a-z]/;
14
- const isOn = (key) => onRE.test(key);
13
+ const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
14
+ (key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
15
15
  const extend = Object.assign;
16
16
  const isArray = Array.isArray;
17
17
  const isString = (val) => typeof val === "string";
@@ -122,9 +122,11 @@ var VueCompilerDOM = (function (exports) {
122
122
 
123
123
  const HTML_TAGS = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot";
124
124
  const SVG_TAGS = "svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view";
125
+ const MATH_TAGS = "math,maction,annotation,annotation-xml,menclose,merror,mfenced,mfrac,mi,mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,semantics,mspace,msqrt,mstyle,msub,msup,msubsup,mtable,mtd,mtext,mtr,munder,munderover";
125
126
  const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr";
126
127
  const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS);
127
128
  const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);
129
+ const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS);
128
130
  const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
129
131
 
130
132
  const FRAGMENT = Symbol(`Fragment` );
@@ -215,6 +217,90 @@ var VueCompilerDOM = (function (exports) {
215
217
  });
216
218
  }
217
219
 
220
+ const Namespaces = {
221
+ "HTML": 0,
222
+ "0": "HTML",
223
+ "SVG": 1,
224
+ "1": "SVG",
225
+ "MATH_ML": 2,
226
+ "2": "MATH_ML"
227
+ };
228
+ const NodeTypes = {
229
+ "ROOT": 0,
230
+ "0": "ROOT",
231
+ "ELEMENT": 1,
232
+ "1": "ELEMENT",
233
+ "TEXT": 2,
234
+ "2": "TEXT",
235
+ "COMMENT": 3,
236
+ "3": "COMMENT",
237
+ "SIMPLE_EXPRESSION": 4,
238
+ "4": "SIMPLE_EXPRESSION",
239
+ "INTERPOLATION": 5,
240
+ "5": "INTERPOLATION",
241
+ "ATTRIBUTE": 6,
242
+ "6": "ATTRIBUTE",
243
+ "DIRECTIVE": 7,
244
+ "7": "DIRECTIVE",
245
+ "COMPOUND_EXPRESSION": 8,
246
+ "8": "COMPOUND_EXPRESSION",
247
+ "IF": 9,
248
+ "9": "IF",
249
+ "IF_BRANCH": 10,
250
+ "10": "IF_BRANCH",
251
+ "FOR": 11,
252
+ "11": "FOR",
253
+ "TEXT_CALL": 12,
254
+ "12": "TEXT_CALL",
255
+ "VNODE_CALL": 13,
256
+ "13": "VNODE_CALL",
257
+ "JS_CALL_EXPRESSION": 14,
258
+ "14": "JS_CALL_EXPRESSION",
259
+ "JS_OBJECT_EXPRESSION": 15,
260
+ "15": "JS_OBJECT_EXPRESSION",
261
+ "JS_PROPERTY": 16,
262
+ "16": "JS_PROPERTY",
263
+ "JS_ARRAY_EXPRESSION": 17,
264
+ "17": "JS_ARRAY_EXPRESSION",
265
+ "JS_FUNCTION_EXPRESSION": 18,
266
+ "18": "JS_FUNCTION_EXPRESSION",
267
+ "JS_CONDITIONAL_EXPRESSION": 19,
268
+ "19": "JS_CONDITIONAL_EXPRESSION",
269
+ "JS_CACHE_EXPRESSION": 20,
270
+ "20": "JS_CACHE_EXPRESSION",
271
+ "JS_BLOCK_STATEMENT": 21,
272
+ "21": "JS_BLOCK_STATEMENT",
273
+ "JS_TEMPLATE_LITERAL": 22,
274
+ "22": "JS_TEMPLATE_LITERAL",
275
+ "JS_IF_STATEMENT": 23,
276
+ "23": "JS_IF_STATEMENT",
277
+ "JS_ASSIGNMENT_EXPRESSION": 24,
278
+ "24": "JS_ASSIGNMENT_EXPRESSION",
279
+ "JS_SEQUENCE_EXPRESSION": 25,
280
+ "25": "JS_SEQUENCE_EXPRESSION",
281
+ "JS_RETURN_STATEMENT": 26,
282
+ "26": "JS_RETURN_STATEMENT"
283
+ };
284
+ const ElementTypes = {
285
+ "ELEMENT": 0,
286
+ "0": "ELEMENT",
287
+ "COMPONENT": 1,
288
+ "1": "COMPONENT",
289
+ "SLOT": 2,
290
+ "2": "SLOT",
291
+ "TEMPLATE": 3,
292
+ "3": "TEMPLATE"
293
+ };
294
+ const ConstantTypes = {
295
+ "NOT_CONSTANT": 0,
296
+ "0": "NOT_CONSTANT",
297
+ "CAN_SKIP_PATCH": 1,
298
+ "1": "CAN_SKIP_PATCH",
299
+ "CAN_HOIST": 2,
300
+ "2": "CAN_HOIST",
301
+ "CAN_STRINGIFY": 3,
302
+ "3": "CAN_STRINGIFY"
303
+ };
218
304
  const locStub = {
219
305
  start: { line: 1, column: 1, offset: 0 },
220
306
  end: { line: 1, column: 1, offset: 0 },
@@ -469,7 +555,9 @@ var VueCompilerDOM = (function (exports) {
469
555
  this.inRCDATA = false;
470
556
  /** For disabling RCDATA tags handling */
471
557
  this.inXML = false;
472
- /** Reocrd newline positions for fast line / column calculation */
558
+ /** For disabling interpolation parsing in v-pre */
559
+ this.inVPre = false;
560
+ /** Record newline positions for fast line / column calculation */
473
561
  this.newlines = [];
474
562
  this.mode = 0;
475
563
  this.delimiterOpen = defaultDelimitersOpen;
@@ -488,6 +576,7 @@ var VueCompilerDOM = (function (exports) {
488
576
  this.sectionStart = 0;
489
577
  this.index = 0;
490
578
  this.baseState = 1;
579
+ this.inRCDATA = false;
491
580
  this.currentSequence = void 0;
492
581
  this.newlines.length = 0;
493
582
  this.delimiterOpen = defaultDelimitersOpen;
@@ -526,7 +615,7 @@ var VueCompilerDOM = (function (exports) {
526
615
  }
527
616
  this.state = 5;
528
617
  this.sectionStart = this.index;
529
- } else if (c === this.delimiterOpen[0]) {
618
+ } else if (!this.inVPre && c === this.delimiterOpen[0]) {
530
619
  this.state = 2;
531
620
  this.delimiterIndex = 0;
532
621
  this.stateInterpolationOpen(c);
@@ -1208,6 +1297,16 @@ var VueCompilerDOM = (function (exports) {
1208
1297
  }
1209
1298
  }
1210
1299
 
1300
+ const CompilerDeprecationTypes = {
1301
+ "COMPILER_IS_ON_ELEMENT": "COMPILER_IS_ON_ELEMENT",
1302
+ "COMPILER_V_BIND_SYNC": "COMPILER_V_BIND_SYNC",
1303
+ "COMPILER_V_BIND_OBJECT_ORDER": "COMPILER_V_BIND_OBJECT_ORDER",
1304
+ "COMPILER_V_ON_NATIVE": "COMPILER_V_ON_NATIVE",
1305
+ "COMPILER_V_IF_V_FOR_PRECEDENCE": "COMPILER_V_IF_V_FOR_PRECEDENCE",
1306
+ "COMPILER_NATIVE_TEMPLATE": "COMPILER_NATIVE_TEMPLATE",
1307
+ "COMPILER_INLINE_TEMPLATE": "COMPILER_INLINE_TEMPLATE",
1308
+ "COMPILER_FILTERS": "COMPILER_FILTER"
1309
+ };
1211
1310
  const deprecationData = {
1212
1311
  ["COMPILER_IS_ON_ELEMENT"]: {
1213
1312
  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:".`,
@@ -1289,6 +1388,114 @@ var VueCompilerDOM = (function (exports) {
1289
1388
  error.loc = loc;
1290
1389
  return error;
1291
1390
  }
1391
+ const ErrorCodes = {
1392
+ "ABRUPT_CLOSING_OF_EMPTY_COMMENT": 0,
1393
+ "0": "ABRUPT_CLOSING_OF_EMPTY_COMMENT",
1394
+ "CDATA_IN_HTML_CONTENT": 1,
1395
+ "1": "CDATA_IN_HTML_CONTENT",
1396
+ "DUPLICATE_ATTRIBUTE": 2,
1397
+ "2": "DUPLICATE_ATTRIBUTE",
1398
+ "END_TAG_WITH_ATTRIBUTES": 3,
1399
+ "3": "END_TAG_WITH_ATTRIBUTES",
1400
+ "END_TAG_WITH_TRAILING_SOLIDUS": 4,
1401
+ "4": "END_TAG_WITH_TRAILING_SOLIDUS",
1402
+ "EOF_BEFORE_TAG_NAME": 5,
1403
+ "5": "EOF_BEFORE_TAG_NAME",
1404
+ "EOF_IN_CDATA": 6,
1405
+ "6": "EOF_IN_CDATA",
1406
+ "EOF_IN_COMMENT": 7,
1407
+ "7": "EOF_IN_COMMENT",
1408
+ "EOF_IN_SCRIPT_HTML_COMMENT_LIKE_TEXT": 8,
1409
+ "8": "EOF_IN_SCRIPT_HTML_COMMENT_LIKE_TEXT",
1410
+ "EOF_IN_TAG": 9,
1411
+ "9": "EOF_IN_TAG",
1412
+ "INCORRECTLY_CLOSED_COMMENT": 10,
1413
+ "10": "INCORRECTLY_CLOSED_COMMENT",
1414
+ "INCORRECTLY_OPENED_COMMENT": 11,
1415
+ "11": "INCORRECTLY_OPENED_COMMENT",
1416
+ "INVALID_FIRST_CHARACTER_OF_TAG_NAME": 12,
1417
+ "12": "INVALID_FIRST_CHARACTER_OF_TAG_NAME",
1418
+ "MISSING_ATTRIBUTE_VALUE": 13,
1419
+ "13": "MISSING_ATTRIBUTE_VALUE",
1420
+ "MISSING_END_TAG_NAME": 14,
1421
+ "14": "MISSING_END_TAG_NAME",
1422
+ "MISSING_WHITESPACE_BETWEEN_ATTRIBUTES": 15,
1423
+ "15": "MISSING_WHITESPACE_BETWEEN_ATTRIBUTES",
1424
+ "NESTED_COMMENT": 16,
1425
+ "16": "NESTED_COMMENT",
1426
+ "UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME": 17,
1427
+ "17": "UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME",
1428
+ "UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE": 18,
1429
+ "18": "UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE",
1430
+ "UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME": 19,
1431
+ "19": "UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME",
1432
+ "UNEXPECTED_NULL_CHARACTER": 20,
1433
+ "20": "UNEXPECTED_NULL_CHARACTER",
1434
+ "UNEXPECTED_QUESTION_MARK_INSTEAD_OF_TAG_NAME": 21,
1435
+ "21": "UNEXPECTED_QUESTION_MARK_INSTEAD_OF_TAG_NAME",
1436
+ "UNEXPECTED_SOLIDUS_IN_TAG": 22,
1437
+ "22": "UNEXPECTED_SOLIDUS_IN_TAG",
1438
+ "X_INVALID_END_TAG": 23,
1439
+ "23": "X_INVALID_END_TAG",
1440
+ "X_MISSING_END_TAG": 24,
1441
+ "24": "X_MISSING_END_TAG",
1442
+ "X_MISSING_INTERPOLATION_END": 25,
1443
+ "25": "X_MISSING_INTERPOLATION_END",
1444
+ "X_MISSING_DIRECTIVE_NAME": 26,
1445
+ "26": "X_MISSING_DIRECTIVE_NAME",
1446
+ "X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END": 27,
1447
+ "27": "X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END",
1448
+ "X_V_IF_NO_EXPRESSION": 28,
1449
+ "28": "X_V_IF_NO_EXPRESSION",
1450
+ "X_V_IF_SAME_KEY": 29,
1451
+ "29": "X_V_IF_SAME_KEY",
1452
+ "X_V_ELSE_NO_ADJACENT_IF": 30,
1453
+ "30": "X_V_ELSE_NO_ADJACENT_IF",
1454
+ "X_V_FOR_NO_EXPRESSION": 31,
1455
+ "31": "X_V_FOR_NO_EXPRESSION",
1456
+ "X_V_FOR_MALFORMED_EXPRESSION": 32,
1457
+ "32": "X_V_FOR_MALFORMED_EXPRESSION",
1458
+ "X_V_FOR_TEMPLATE_KEY_PLACEMENT": 33,
1459
+ "33": "X_V_FOR_TEMPLATE_KEY_PLACEMENT",
1460
+ "X_V_BIND_NO_EXPRESSION": 34,
1461
+ "34": "X_V_BIND_NO_EXPRESSION",
1462
+ "X_V_ON_NO_EXPRESSION": 35,
1463
+ "35": "X_V_ON_NO_EXPRESSION",
1464
+ "X_V_SLOT_UNEXPECTED_DIRECTIVE_ON_SLOT_OUTLET": 36,
1465
+ "36": "X_V_SLOT_UNEXPECTED_DIRECTIVE_ON_SLOT_OUTLET",
1466
+ "X_V_SLOT_MIXED_SLOT_USAGE": 37,
1467
+ "37": "X_V_SLOT_MIXED_SLOT_USAGE",
1468
+ "X_V_SLOT_DUPLICATE_SLOT_NAMES": 38,
1469
+ "38": "X_V_SLOT_DUPLICATE_SLOT_NAMES",
1470
+ "X_V_SLOT_EXTRANEOUS_DEFAULT_SLOT_CHILDREN": 39,
1471
+ "39": "X_V_SLOT_EXTRANEOUS_DEFAULT_SLOT_CHILDREN",
1472
+ "X_V_SLOT_MISPLACED": 40,
1473
+ "40": "X_V_SLOT_MISPLACED",
1474
+ "X_V_MODEL_NO_EXPRESSION": 41,
1475
+ "41": "X_V_MODEL_NO_EXPRESSION",
1476
+ "X_V_MODEL_MALFORMED_EXPRESSION": 42,
1477
+ "42": "X_V_MODEL_MALFORMED_EXPRESSION",
1478
+ "X_V_MODEL_ON_SCOPE_VARIABLE": 43,
1479
+ "43": "X_V_MODEL_ON_SCOPE_VARIABLE",
1480
+ "X_V_MODEL_ON_PROPS": 44,
1481
+ "44": "X_V_MODEL_ON_PROPS",
1482
+ "X_INVALID_EXPRESSION": 45,
1483
+ "45": "X_INVALID_EXPRESSION",
1484
+ "X_KEEP_ALIVE_INVALID_CHILDREN": 46,
1485
+ "46": "X_KEEP_ALIVE_INVALID_CHILDREN",
1486
+ "X_PREFIX_ID_NOT_SUPPORTED": 47,
1487
+ "47": "X_PREFIX_ID_NOT_SUPPORTED",
1488
+ "X_MODULE_MODE_NOT_SUPPORTED": 48,
1489
+ "48": "X_MODULE_MODE_NOT_SUPPORTED",
1490
+ "X_CACHE_HANDLER_NOT_SUPPORTED": 49,
1491
+ "49": "X_CACHE_HANDLER_NOT_SUPPORTED",
1492
+ "X_SCOPE_ID_NOT_SUPPORTED": 50,
1493
+ "50": "X_SCOPE_ID_NOT_SUPPORTED",
1494
+ "X_VNODE_HOOKS": 51,
1495
+ "51": "X_VNODE_HOOKS",
1496
+ "__EXTEND_POINT__": 52,
1497
+ "52": "__EXTEND_POINT__"
1498
+ };
1292
1499
  const errorMessages = {
1293
1500
  // parse errors
1294
1501
  [0]: "Illegal comment.",
@@ -1341,18 +1548,134 @@ var VueCompilerDOM = (function (exports) {
1341
1548
  Use a v-bind binding combined with a v-on listener that emits update:x event instead.`,
1342
1549
  [45]: `Error parsing JavaScript expression: `,
1343
1550
  [46]: `<KeepAlive> expects exactly one child component.`,
1551
+ [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.`,
1344
1552
  // generic errors
1345
1553
  [47]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
1346
1554
  [48]: `ES module mode is not supported in this build of compiler.`,
1347
1555
  [49]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
1348
1556
  [50]: `"scopeId" option is only supported in module mode.`,
1349
- // deprecations
1350
- [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.`,
1351
- [52]: `v-is="component-name" has been deprecated. Use is="vue:component-name" instead. v-is support will be removed in 3.4.`,
1352
1557
  // just to fulfill types
1353
- [53]: ``
1558
+ [52]: ``
1354
1559
  };
1355
1560
 
1561
+ function walkIdentifiers(root, onIdentifier, includeAll = false, parentStack = [], knownIds = /* @__PURE__ */ Object.create(null)) {
1562
+ {
1563
+ return;
1564
+ }
1565
+ }
1566
+ function isReferencedIdentifier(id, parent, parentStack) {
1567
+ {
1568
+ return false;
1569
+ }
1570
+ }
1571
+ function isInDestructureAssignment(parent, parentStack) {
1572
+ if (parent && (parent.type === "ObjectProperty" || parent.type === "ArrayPattern")) {
1573
+ let i = parentStack.length;
1574
+ while (i--) {
1575
+ const p = parentStack[i];
1576
+ if (p.type === "AssignmentExpression") {
1577
+ return true;
1578
+ } else if (p.type !== "ObjectProperty" && !p.type.endsWith("Pattern")) {
1579
+ break;
1580
+ }
1581
+ }
1582
+ }
1583
+ return false;
1584
+ }
1585
+ function walkFunctionParams(node, onIdent) {
1586
+ for (const p of node.params) {
1587
+ for (const id of extractIdentifiers(p)) {
1588
+ onIdent(id);
1589
+ }
1590
+ }
1591
+ }
1592
+ function walkBlockDeclarations(block, onIdent) {
1593
+ for (const stmt of block.body) {
1594
+ if (stmt.type === "VariableDeclaration") {
1595
+ if (stmt.declare)
1596
+ continue;
1597
+ for (const decl of stmt.declarations) {
1598
+ for (const id of extractIdentifiers(decl.id)) {
1599
+ onIdent(id);
1600
+ }
1601
+ }
1602
+ } else if (stmt.type === "FunctionDeclaration" || stmt.type === "ClassDeclaration") {
1603
+ if (stmt.declare || !stmt.id)
1604
+ continue;
1605
+ onIdent(stmt.id);
1606
+ } else if (stmt.type === "ForOfStatement" || stmt.type === "ForInStatement" || stmt.type === "ForStatement") {
1607
+ const variable = stmt.type === "ForStatement" ? stmt.init : stmt.left;
1608
+ if (variable && variable.type === "VariableDeclaration") {
1609
+ for (const decl of variable.declarations) {
1610
+ for (const id of extractIdentifiers(decl.id)) {
1611
+ onIdent(id);
1612
+ }
1613
+ }
1614
+ }
1615
+ }
1616
+ }
1617
+ }
1618
+ function extractIdentifiers(param, nodes = []) {
1619
+ switch (param.type) {
1620
+ case "Identifier":
1621
+ nodes.push(param);
1622
+ break;
1623
+ case "MemberExpression":
1624
+ let object = param;
1625
+ while (object.type === "MemberExpression") {
1626
+ object = object.object;
1627
+ }
1628
+ nodes.push(object);
1629
+ break;
1630
+ case "ObjectPattern":
1631
+ for (const prop of param.properties) {
1632
+ if (prop.type === "RestElement") {
1633
+ extractIdentifiers(prop.argument, nodes);
1634
+ } else {
1635
+ extractIdentifiers(prop.value, nodes);
1636
+ }
1637
+ }
1638
+ break;
1639
+ case "ArrayPattern":
1640
+ param.elements.forEach((element) => {
1641
+ if (element)
1642
+ extractIdentifiers(element, nodes);
1643
+ });
1644
+ break;
1645
+ case "RestElement":
1646
+ extractIdentifiers(param.argument, nodes);
1647
+ break;
1648
+ case "AssignmentPattern":
1649
+ extractIdentifiers(param.left, nodes);
1650
+ break;
1651
+ }
1652
+ return nodes;
1653
+ }
1654
+ const isFunctionType = (node) => {
1655
+ return /Function(?:Expression|Declaration)$|Method$/.test(node.type);
1656
+ };
1657
+ const isStaticProperty = (node) => node && (node.type === "ObjectProperty" || node.type === "ObjectMethod") && !node.computed;
1658
+ const isStaticPropertyKey = (node, parent) => isStaticProperty(parent) && parent.key === node;
1659
+ const TS_NODE_TYPES = [
1660
+ "TSAsExpression",
1661
+ // foo as number
1662
+ "TSTypeAssertion",
1663
+ // (<number>foo)
1664
+ "TSNonNullExpression",
1665
+ // foo!
1666
+ "TSInstantiationExpression",
1667
+ // foo<string>
1668
+ "TSSatisfiesExpression"
1669
+ // foo satisfies T
1670
+ ];
1671
+ function unwrapTSNode(node) {
1672
+ if (TS_NODE_TYPES.includes(node.type)) {
1673
+ return unwrapTSNode(node.expression);
1674
+ } else {
1675
+ return node;
1676
+ }
1677
+ }
1678
+
1356
1679
  const isStaticExp = (p) => p.type === 4 && p.isStatic;
1357
1680
  function isCoreComponent(tag) {
1358
1681
  switch (tag) {
@@ -1658,7 +1981,8 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
1658
1981
  isCustomElement: NO,
1659
1982
  onError: defaultOnError,
1660
1983
  onWarn: defaultOnWarn,
1661
- comments: true
1984
+ comments: true,
1985
+ prefixIdentifiers: false
1662
1986
  };
1663
1987
  let currentOptions = defaultParserOptions;
1664
1988
  let currentRoot = null;
@@ -1700,7 +2024,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
1700
2024
  }
1701
2025
  addNode({
1702
2026
  type: 5,
1703
- content: createSimpleExpression(exp, false, getLoc(innerStart, innerEnd)),
2027
+ content: createExp(exp, false, getLoc(innerStart, innerEnd)),
1704
2028
  loc: getLoc(start, end)
1705
2029
  });
1706
2030
  },
@@ -1793,7 +2117,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
1793
2117
  loc: getLoc(start)
1794
2118
  };
1795
2119
  if (name === "pre") {
1796
- inVPre = true;
2120
+ inVPre = tokenizer.inVPre = true;
1797
2121
  currentVPreBoundary = currentOpenTag;
1798
2122
  const props = currentOpenTag.props;
1799
2123
  for (let i = 0; i < props.length; i++) {
@@ -1813,7 +2137,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
1813
2137
  setLocEnd(currentProp.nameLoc, end);
1814
2138
  } else {
1815
2139
  const isStatic = arg[0] !== `[`;
1816
- currentProp.arg = createSimpleExpression(
2140
+ currentProp.arg = createExp(
1817
2141
  isStatic ? arg : arg.slice(1, -1),
1818
2142
  isStatic,
1819
2143
  getLoc(start, end),
@@ -1886,10 +2210,13 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
1886
2210
  tokenizer.enterRCDATA(toCharCodes(`</template`), 0);
1887
2211
  }
1888
2212
  } else {
1889
- currentProp.exp = createSimpleExpression(
2213
+ let expParseMode = 0 /* Normal */;
2214
+ currentProp.exp = createExp(
1890
2215
  currentAttrValue,
1891
2216
  false,
1892
- getLoc(currentAttrStartIndex, currentAttrEndIndex)
2217
+ getLoc(currentAttrStartIndex, currentAttrEndIndex),
2218
+ 0,
2219
+ expParseMode
1893
2220
  );
1894
2221
  if (currentProp.name === "for") {
1895
2222
  currentProp.forParseResult = parseForExpression(currentProp.exp);
@@ -1992,10 +2319,16 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
1992
2319
  if (!inMatch)
1993
2320
  return;
1994
2321
  const [, LHS, RHS] = inMatch;
1995
- const createAliasExpression = (content, offset) => {
2322
+ const createAliasExpression = (content, offset, asParam = false) => {
1996
2323
  const start = loc.start.offset + offset;
1997
2324
  const end = start + content.length;
1998
- return createSimpleExpression(content, false, getLoc(start, end));
2325
+ return createExp(
2326
+ content,
2327
+ false,
2328
+ getLoc(start, end),
2329
+ 0,
2330
+ asParam ? 1 /* Params */ : 0 /* Normal */
2331
+ );
1999
2332
  };
2000
2333
  const result = {
2001
2334
  source: createAliasExpression(RHS.trim(), exp.indexOf(RHS, LHS.length)),
@@ -2013,7 +2346,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
2013
2346
  let keyOffset;
2014
2347
  if (keyContent) {
2015
2348
  keyOffset = exp.indexOf(keyContent, trimmedOffset + valueContent.length);
2016
- result.key = createAliasExpression(keyContent, keyOffset);
2349
+ result.key = createAliasExpression(keyContent, keyOffset, true);
2017
2350
  }
2018
2351
  if (iteratorMatch[2]) {
2019
2352
  const indexContent = iteratorMatch[2].trim();
@@ -2023,13 +2356,14 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
2023
2356
  exp.indexOf(
2024
2357
  indexContent,
2025
2358
  result.key ? keyOffset + keyContent.length : trimmedOffset + valueContent.length
2026
- )
2359
+ ),
2360
+ true
2027
2361
  );
2028
2362
  }
2029
2363
  }
2030
2364
  }
2031
2365
  if (valueContent) {
2032
- result.value = createAliasExpression(valueContent, trimmedOffset);
2366
+ result.value = createAliasExpression(valueContent, trimmedOffset, true);
2033
2367
  }
2034
2368
  return result;
2035
2369
  }
@@ -2107,7 +2441,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
2107
2441
  inPre--;
2108
2442
  }
2109
2443
  if (currentVPreBoundary === el) {
2110
- inVPre = false;
2444
+ inVPre = tokenizer.inVPre = false;
2111
2445
  currentVPreBoundary = null;
2112
2446
  }
2113
2447
  if (tokenizer.inXML && (stack[0] ? stack[0].ns : currentOptions.ns) === 0) {
@@ -2342,8 +2676,14 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
2342
2676
  }
2343
2677
  return attr;
2344
2678
  }
2345
- function emitError(code, index) {
2346
- currentOptions.onError(createCompilerError(code, getLoc(index, index)));
2679
+ function createExp(content, isStatic = false, loc, constType = 0, parseMode = 0 /* Normal */) {
2680
+ const exp = createSimpleExpression(content, isStatic, loc, constType);
2681
+ return exp;
2682
+ }
2683
+ function emitError(code, index, message) {
2684
+ currentOptions.onError(
2685
+ createCompilerError(code, getLoc(index, index), void 0, message)
2686
+ );
2347
2687
  }
2348
2688
  function reset() {
2349
2689
  tokenizer.reset();
@@ -2374,6 +2714,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
2374
2714
  }
2375
2715
  }
2376
2716
  tokenizer.mode = currentOptions.parseMode === "html" ? 1 : currentOptions.parseMode === "sfc" ? 2 : 0;
2717
+ tokenizer.inXML = currentOptions.ns === 1 || currentOptions.ns === 2;
2377
2718
  const delimiters = options == null ? void 0 : options.delimiters;
2378
2719
  if (delimiters) {
2379
2720
  tokenizer.delimiterOpen = toCharCodes(delimiters[0]);
@@ -2658,6 +2999,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
2658
2999
  const nameMatch = filename.replace(/\?.*$/, "").match(/([^/\\]+)\.\w+$/);
2659
3000
  const context = {
2660
3001
  // options
3002
+ filename,
2661
3003
  selfName: nameMatch && capitalize(camelize(nameMatch[1])),
2662
3004
  prefixIdentifiers,
2663
3005
  hoistStatic: hoistStatic2,
@@ -3490,117 +3832,6 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
3490
3832
  push(`)`);
3491
3833
  }
3492
3834
 
3493
- function walkIdentifiers(root, onIdentifier, includeAll = false, parentStack = [], knownIds = /* @__PURE__ */ Object.create(null)) {
3494
- {
3495
- return;
3496
- }
3497
- }
3498
- function isReferencedIdentifier(id, parent, parentStack) {
3499
- {
3500
- return false;
3501
- }
3502
- }
3503
- function isInDestructureAssignment(parent, parentStack) {
3504
- if (parent && (parent.type === "ObjectProperty" || parent.type === "ArrayPattern")) {
3505
- let i = parentStack.length;
3506
- while (i--) {
3507
- const p = parentStack[i];
3508
- if (p.type === "AssignmentExpression") {
3509
- return true;
3510
- } else if (p.type !== "ObjectProperty" && !p.type.endsWith("Pattern")) {
3511
- break;
3512
- }
3513
- }
3514
- }
3515
- return false;
3516
- }
3517
- function walkFunctionParams(node, onIdent) {
3518
- for (const p of node.params) {
3519
- for (const id of extractIdentifiers(p)) {
3520
- onIdent(id);
3521
- }
3522
- }
3523
- }
3524
- function walkBlockDeclarations(block, onIdent) {
3525
- for (const stmt of block.body) {
3526
- if (stmt.type === "VariableDeclaration") {
3527
- if (stmt.declare)
3528
- continue;
3529
- for (const decl of stmt.declarations) {
3530
- for (const id of extractIdentifiers(decl.id)) {
3531
- onIdent(id);
3532
- }
3533
- }
3534
- } else if (stmt.type === "FunctionDeclaration" || stmt.type === "ClassDeclaration") {
3535
- if (stmt.declare || !stmt.id)
3536
- continue;
3537
- onIdent(stmt.id);
3538
- } else if (stmt.type === "ForOfStatement" || stmt.type === "ForInStatement" || stmt.type === "ForStatement") {
3539
- const variable = stmt.type === "ForStatement" ? stmt.init : stmt.left;
3540
- if (variable && variable.type === "VariableDeclaration") {
3541
- for (const decl of variable.declarations) {
3542
- for (const id of extractIdentifiers(decl.id)) {
3543
- onIdent(id);
3544
- }
3545
- }
3546
- }
3547
- }
3548
- }
3549
- }
3550
- function extractIdentifiers(param, nodes = []) {
3551
- switch (param.type) {
3552
- case "Identifier":
3553
- nodes.push(param);
3554
- break;
3555
- case "MemberExpression":
3556
- let object = param;
3557
- while (object.type === "MemberExpression") {
3558
- object = object.object;
3559
- }
3560
- nodes.push(object);
3561
- break;
3562
- case "ObjectPattern":
3563
- for (const prop of param.properties) {
3564
- if (prop.type === "RestElement") {
3565
- extractIdentifiers(prop.argument, nodes);
3566
- } else {
3567
- extractIdentifiers(prop.value, nodes);
3568
- }
3569
- }
3570
- break;
3571
- case "ArrayPattern":
3572
- param.elements.forEach((element) => {
3573
- if (element)
3574
- extractIdentifiers(element, nodes);
3575
- });
3576
- break;
3577
- case "RestElement":
3578
- extractIdentifiers(param.argument, nodes);
3579
- break;
3580
- case "AssignmentPattern":
3581
- extractIdentifiers(param.left, nodes);
3582
- break;
3583
- }
3584
- return nodes;
3585
- }
3586
- const isFunctionType = (node) => {
3587
- return /Function(?:Expression|Declaration)$|Method$/.test(node.type);
3588
- };
3589
- const isStaticProperty = (node) => node && (node.type === "ObjectProperty" || node.type === "ObjectMethod") && !node.computed;
3590
- const isStaticPropertyKey = (node, parent) => isStaticProperty(parent) && parent.key === node;
3591
- const TS_NODE_TYPES = [
3592
- "TSAsExpression",
3593
- // foo as number
3594
- "TSTypeAssertion",
3595
- // (<number>foo)
3596
- "TSNonNullExpression",
3597
- // foo!
3598
- "TSInstantiationExpression",
3599
- // foo<string>
3600
- "TSSatisfiesExpression"
3601
- // foo satisfies T
3602
- ];
3603
-
3604
3835
  const prohibitedKeywordRE = new RegExp(
3605
3836
  "\\b" + "arguments,await,break,case,catch,class,const,continue,debugger,default,delete,do,else,export,extends,finally,for,function,if,import,let,new,return,super,switch,throw,try,var,void,while,with,yield".split(",").join("\\b|\\b") + "\\b"
3606
3837
  );
@@ -4559,6 +4790,9 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
4559
4790
  if (isEventHandler && isReservedProp(name)) {
4560
4791
  hasVnodeHook = true;
4561
4792
  }
4793
+ if (isEventHandler && value.type === 14) {
4794
+ value = value.arguments[0];
4795
+ }
4562
4796
  if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) {
4563
4797
  return;
4564
4798
  }
@@ -5011,9 +5245,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
5011
5245
  if (arg.isStatic) {
5012
5246
  let rawName = arg.content;
5013
5247
  if (rawName.startsWith("vnode")) {
5014
- context.onWarn(
5015
- createCompilerError(51, arg.loc)
5016
- );
5248
+ context.onError(createCompilerError(51, arg.loc));
5017
5249
  }
5018
5250
  if (rawName.startsWith("vue:")) {
5019
5251
  rawName = `vnode-${rawName.slice(4)}`;
@@ -5506,12 +5738,14 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
5506
5738
  if (options.scopeId && !isModuleMode) {
5507
5739
  onError(createCompilerError(50));
5508
5740
  }
5509
- const ast = isString(source) ? baseParse(source, options) : source;
5741
+ const resolvedOptions = extend({}, options, {
5742
+ prefixIdentifiers
5743
+ });
5744
+ const ast = isString(source) ? baseParse(source, resolvedOptions) : source;
5510
5745
  const [nodeTransforms, directiveTransforms] = getBaseTransformPreset();
5511
5746
  transform(
5512
5747
  ast,
5513
- extend({}, options, {
5514
- prefixIdentifiers,
5748
+ extend({}, resolvedOptions, {
5515
5749
  nodeTransforms: [
5516
5750
  ...nodeTransforms,
5517
5751
  ...options.nodeTransforms || []
@@ -5525,14 +5759,22 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
5525
5759
  )
5526
5760
  })
5527
5761
  );
5528
- return generate(
5529
- ast,
5530
- extend({}, options, {
5531
- prefixIdentifiers
5532
- })
5533
- );
5762
+ return generate(ast, resolvedOptions);
5534
5763
  }
5535
5764
 
5765
+ const BindingTypes = {
5766
+ "DATA": "data",
5767
+ "PROPS": "props",
5768
+ "PROPS_ALIASED": "props-aliased",
5769
+ "SETUP_LET": "setup-let",
5770
+ "SETUP_CONST": "setup-const",
5771
+ "SETUP_REACTIVE_CONST": "setup-reactive-const",
5772
+ "SETUP_MAYBE_REF": "setup-maybe-ref",
5773
+ "SETUP_REF": "setup-ref",
5774
+ "OPTIONS": "options",
5775
+ "LITERAL_CONST": "literal-const"
5776
+ };
5777
+
5536
5778
  const noopDirectiveTransform = () => ({ props: [] });
5537
5779
 
5538
5780
  const V_MODEL_RADIO = Symbol(`vModelRadio` );
@@ -5575,7 +5817,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
5575
5817
  const parserOptions = {
5576
5818
  parseMode: "html",
5577
5819
  isVoidTag,
5578
- isNativeTag: (tag) => isHTMLTag(tag) || isSVGTag(tag),
5820
+ isNativeTag: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag),
5579
5821
  isPreTag: (tag) => tag === "pre",
5580
5822
  decodeEntities: decodeHtmlBrowser ,
5581
5823
  isBuiltInComponent: (tag) => {
@@ -5651,6 +5893,32 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
5651
5893
  DOMErrorMessages
5652
5894
  );
5653
5895
  }
5896
+ const DOMErrorCodes = {
5897
+ "X_V_HTML_NO_EXPRESSION": 53,
5898
+ "53": "X_V_HTML_NO_EXPRESSION",
5899
+ "X_V_HTML_WITH_CHILDREN": 54,
5900
+ "54": "X_V_HTML_WITH_CHILDREN",
5901
+ "X_V_TEXT_NO_EXPRESSION": 55,
5902
+ "55": "X_V_TEXT_NO_EXPRESSION",
5903
+ "X_V_TEXT_WITH_CHILDREN": 56,
5904
+ "56": "X_V_TEXT_WITH_CHILDREN",
5905
+ "X_V_MODEL_ON_INVALID_ELEMENT": 57,
5906
+ "57": "X_V_MODEL_ON_INVALID_ELEMENT",
5907
+ "X_V_MODEL_ARG_ON_ELEMENT": 58,
5908
+ "58": "X_V_MODEL_ARG_ON_ELEMENT",
5909
+ "X_V_MODEL_ON_FILE_INPUT_ELEMENT": 59,
5910
+ "59": "X_V_MODEL_ON_FILE_INPUT_ELEMENT",
5911
+ "X_V_MODEL_UNNECESSARY_VALUE": 60,
5912
+ "60": "X_V_MODEL_UNNECESSARY_VALUE",
5913
+ "X_V_SHOW_NO_EXPRESSION": 61,
5914
+ "61": "X_V_SHOW_NO_EXPRESSION",
5915
+ "X_TRANSITION_INVALID_CHILDREN": 62,
5916
+ "62": "X_TRANSITION_INVALID_CHILDREN",
5917
+ "X_IGNORED_SIDE_EFFECT_TAG": 63,
5918
+ "63": "X_IGNORED_SIDE_EFFECT_TAG",
5919
+ "__EXTEND_POINT__": 64,
5920
+ "64": "__EXTEND_POINT__"
5921
+ };
5654
5922
  const DOMErrorMessages = {
5655
5923
  [53]: `v-html is missing expression.`,
5656
5924
  [54]: `v-html will override element children.`,
@@ -6006,6 +6274,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
6006
6274
  }
6007
6275
 
6008
6276
  exports.BASE_TRANSITION = BASE_TRANSITION;
6277
+ exports.BindingTypes = BindingTypes;
6009
6278
  exports.CAMELIZE = CAMELIZE;
6010
6279
  exports.CAPITALIZE = CAPITALIZE;
6011
6280
  exports.CREATE_BLOCK = CREATE_BLOCK;
@@ -6016,9 +6285,14 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
6016
6285
  exports.CREATE_STATIC = CREATE_STATIC;
6017
6286
  exports.CREATE_TEXT = CREATE_TEXT;
6018
6287
  exports.CREATE_VNODE = CREATE_VNODE;
6288
+ exports.CompilerDeprecationTypes = CompilerDeprecationTypes;
6289
+ exports.ConstantTypes = ConstantTypes;
6019
6290
  exports.DOMDirectiveTransforms = DOMDirectiveTransforms;
6291
+ exports.DOMErrorCodes = DOMErrorCodes;
6020
6292
  exports.DOMErrorMessages = DOMErrorMessages;
6021
6293
  exports.DOMNodeTransforms = DOMNodeTransforms;
6294
+ exports.ElementTypes = ElementTypes;
6295
+ exports.ErrorCodes = ErrorCodes;
6022
6296
  exports.FRAGMENT = FRAGMENT;
6023
6297
  exports.GUARD_REACTIVE_PROPS = GUARD_REACTIVE_PROPS;
6024
6298
  exports.IS_MEMO_SAME = IS_MEMO_SAME;
@@ -6028,6 +6302,8 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
6028
6302
  exports.NORMALIZE_CLASS = NORMALIZE_CLASS;
6029
6303
  exports.NORMALIZE_PROPS = NORMALIZE_PROPS;
6030
6304
  exports.NORMALIZE_STYLE = NORMALIZE_STYLE;
6305
+ exports.Namespaces = Namespaces;
6306
+ exports.NodeTypes = NodeTypes;
6031
6307
  exports.OPEN_BLOCK = OPEN_BLOCK;
6032
6308
  exports.POP_SCOPE_ID = POP_SCOPE_ID;
6033
6309
  exports.PUSH_SCOPE_ID = PUSH_SCOPE_ID;
@@ -6146,6 +6422,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
6146
6422
  exports.transformOn = transformOn$1;
6147
6423
  exports.transformStyle = transformStyle;
6148
6424
  exports.traverseNode = traverseNode;
6425
+ exports.unwrapTSNode = unwrapTSNode;
6149
6426
  exports.walkBlockDeclarations = walkBlockDeclarations;
6150
6427
  exports.walkFunctionParams = walkFunctionParams;
6151
6428
  exports.walkIdentifiers = walkIdentifiers;