@vue/compat 3.4.0-alpha.1 → 3.4.0-alpha.3

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.
@@ -2,12 +2,8 @@ var Vue = (function () {
2
2
  'use strict';
3
3
 
4
4
  function makeMap(str, expectsLowerCase) {
5
- const map = /* @__PURE__ */ Object.create(null);
6
- const list = str.split(",");
7
- for (let i = 0; i < list.length; i++) {
8
- map[list[i]] = true;
9
- }
10
- return expectsLowerCase ? (val) => !!map[val.toLowerCase()] : (val) => !!map[val];
5
+ const set = new Set(str.split(","));
6
+ return expectsLowerCase ? (val) => set.has(val.toLowerCase()) : (val) => set.has(val);
11
7
  }
12
8
 
13
9
  const EMPTY_OBJ = Object.freeze({}) ;
@@ -107,7 +103,7 @@ var Vue = (function () {
107
103
  [4]: `STYLE`,
108
104
  [8]: `PROPS`,
109
105
  [16]: `FULL_PROPS`,
110
- [32]: `HYDRATE_EVENTS`,
106
+ [32]: `NEED_HYDRATION`,
111
107
  [64]: `STABLE_FRAGMENT`,
112
108
  [128]: `KEYED_FRAGMENT`,
113
109
  [256]: `UNKEYED_FRAGMENT`,
@@ -1029,7 +1025,7 @@ var Vue = (function () {
1029
1025
  toRaw(this)
1030
1026
  );
1031
1027
  }
1032
- return type === "delete" ? false : this;
1028
+ return type === "delete" ? false : type === "clear" ? void 0 : this;
1033
1029
  };
1034
1030
  }
1035
1031
  function createInstrumentations() {
@@ -1285,9 +1281,10 @@ var Vue = (function () {
1285
1281
  this.dep = void 0;
1286
1282
  this.__v_isRef = true;
1287
1283
  this["__v_isReadonly"] = false;
1288
- this.effect = new ReactiveEffect(getter, () => {
1289
- triggerRefValue(this, 1);
1290
- });
1284
+ this.effect = new ReactiveEffect(
1285
+ () => getter(this._value),
1286
+ () => triggerRefValue(this, 1)
1287
+ );
1291
1288
  this.effect.computed = this;
1292
1289
  this.effect.active = this._cacheable = !isSSR;
1293
1290
  this["__v_isReadonly"] = isReadonly;
@@ -1504,16 +1501,16 @@ var Vue = (function () {
1504
1501
  return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
1505
1502
  }
1506
1503
 
1507
- const stack = [];
1504
+ const stack$1 = [];
1508
1505
  function pushWarningContext(vnode) {
1509
- stack.push(vnode);
1506
+ stack$1.push(vnode);
1510
1507
  }
1511
1508
  function popWarningContext() {
1512
- stack.pop();
1509
+ stack$1.pop();
1513
1510
  }
1514
1511
  function warn(msg, ...args) {
1515
1512
  pauseTracking();
1516
- const instance = stack.length ? stack[stack.length - 1].component : null;
1513
+ const instance = stack$1.length ? stack$1[stack$1.length - 1].component : null;
1517
1514
  const appWarnHandler = instance && instance.appContext.config.warnHandler;
1518
1515
  const trace = getComponentTrace();
1519
1516
  if (appWarnHandler) {
@@ -1542,7 +1539,7 @@ var Vue = (function () {
1542
1539
  resetTracking();
1543
1540
  }
1544
1541
  function getComponentTrace() {
1545
- let currentVNode = stack[stack.length - 1];
1542
+ let currentVNode = stack$1[stack$1.length - 1];
1546
1543
  if (!currentVNode) {
1547
1544
  return [];
1548
1545
  }
@@ -2771,9 +2768,19 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
2771
2768
  try {
2772
2769
  if (vnode.shapeFlag & 4) {
2773
2770
  const proxyToUse = withProxy || proxy;
2771
+ const thisProxy = setupState.__isScriptSetup ? new Proxy(proxyToUse, {
2772
+ get(target, key, receiver) {
2773
+ warn(
2774
+ `Property '${String(
2775
+ key
2776
+ )}' was accessed via 'this'. Avoid using 'this' in templates.`
2777
+ );
2778
+ return Reflect.get(target, key, receiver);
2779
+ }
2780
+ }) : proxyToUse;
2774
2781
  result = normalizeVNode(
2775
2782
  render.call(
2776
- proxyToUse,
2783
+ thisProxy,
2777
2784
  proxyToUse,
2778
2785
  renderCache,
2779
2786
  props,
@@ -3024,6 +3031,65 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3024
3031
  }
3025
3032
  }
3026
3033
 
3034
+ const COMPONENTS = "components";
3035
+ const DIRECTIVES = "directives";
3036
+ const FILTERS = "filters";
3037
+ function resolveComponent(name, maybeSelfReference) {
3038
+ return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
3039
+ }
3040
+ const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
3041
+ function resolveDynamicComponent(component) {
3042
+ if (isString(component)) {
3043
+ return resolveAsset(COMPONENTS, component, false) || component;
3044
+ } else {
3045
+ return component || NULL_DYNAMIC_COMPONENT;
3046
+ }
3047
+ }
3048
+ function resolveDirective(name) {
3049
+ return resolveAsset(DIRECTIVES, name);
3050
+ }
3051
+ function resolveFilter$1(name) {
3052
+ return resolveAsset(FILTERS, name);
3053
+ }
3054
+ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
3055
+ const instance = currentRenderingInstance || currentInstance;
3056
+ if (instance) {
3057
+ const Component = instance.type;
3058
+ if (type === COMPONENTS) {
3059
+ const selfName = getComponentName(
3060
+ Component,
3061
+ false
3062
+ /* do not include inferred name to avoid breaking existing code */
3063
+ );
3064
+ if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
3065
+ return Component;
3066
+ }
3067
+ }
3068
+ const res = (
3069
+ // local registration
3070
+ // check instance[type] first which is resolved for options API
3071
+ resolve(instance[type] || Component[type], name) || // global registration
3072
+ resolve(instance.appContext[type], name)
3073
+ );
3074
+ if (!res && maybeSelfReference) {
3075
+ return Component;
3076
+ }
3077
+ if (warnMissing && !res) {
3078
+ const extra = type === COMPONENTS ? `
3079
+ If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
3080
+ warn(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
3081
+ }
3082
+ return res;
3083
+ } else {
3084
+ warn(
3085
+ `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
3086
+ );
3087
+ }
3088
+ }
3089
+ function resolve(registry, name) {
3090
+ return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
3091
+ }
3092
+
3027
3093
  const isSuspense = (type) => type.__isSuspense;
3028
3094
  const SuspenseImpl = {
3029
3095
  name: "Suspense",
@@ -3558,7 +3624,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3558
3624
  }
3559
3625
  if (isArray(s)) {
3560
3626
  const singleChild = filterSingleRoot(s);
3561
- if (!singleChild) {
3627
+ if (!singleChild && s.filter((child) => child !== NULL_DYNAMIC_COMPONENT).length > 0) {
3562
3628
  warn(`<Suspense> slots expect a single root node.`);
3563
3629
  }
3564
3630
  s = singleChild;
@@ -3756,6 +3822,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3756
3822
  let onCleanup = (fn) => {
3757
3823
  cleanup = effect.onStop = () => {
3758
3824
  callWithErrorHandling(fn, instance, 4);
3825
+ cleanup = effect.onStop = void 0;
3759
3826
  };
3760
3827
  };
3761
3828
  let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
@@ -4233,7 +4300,11 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4233
4300
  }
4234
4301
  }
4235
4302
  function getKeepAliveChild(vnode) {
4236
- return isKeepAlive(vnode) ? vnode.children ? vnode.children[0] : void 0 : vnode;
4303
+ return isKeepAlive(vnode) ? (
4304
+ // #7121 ensure get the child component subtree in case
4305
+ // it's been replaced during HMR
4306
+ vnode.component ? vnode.component.subTree : vnode.children ? vnode.children[0] : void 0
4307
+ ) : vnode;
4237
4308
  }
4238
4309
  function setTransitionHooks(vnode, hooks) {
4239
4310
  if (vnode.shapeFlag & 6 && vnode.component) {
@@ -4749,65 +4820,6 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4749
4820
  return listeners;
4750
4821
  }
4751
4822
 
4752
- const COMPONENTS = "components";
4753
- const DIRECTIVES = "directives";
4754
- const FILTERS = "filters";
4755
- function resolveComponent(name, maybeSelfReference) {
4756
- return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
4757
- }
4758
- const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
4759
- function resolveDynamicComponent(component) {
4760
- if (isString(component)) {
4761
- return resolveAsset(COMPONENTS, component, false) || component;
4762
- } else {
4763
- return component || NULL_DYNAMIC_COMPONENT;
4764
- }
4765
- }
4766
- function resolveDirective(name) {
4767
- return resolveAsset(DIRECTIVES, name);
4768
- }
4769
- function resolveFilter$1(name) {
4770
- return resolveAsset(FILTERS, name);
4771
- }
4772
- function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
4773
- const instance = currentRenderingInstance || currentInstance;
4774
- if (instance) {
4775
- const Component = instance.type;
4776
- if (type === COMPONENTS) {
4777
- const selfName = getComponentName(
4778
- Component,
4779
- false
4780
- /* do not include inferred name to avoid breaking existing code */
4781
- );
4782
- if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
4783
- return Component;
4784
- }
4785
- }
4786
- const res = (
4787
- // local registration
4788
- // check instance[type] first which is resolved for options API
4789
- resolve(instance[type] || Component[type], name) || // global registration
4790
- resolve(instance.appContext[type], name)
4791
- );
4792
- if (!res && maybeSelfReference) {
4793
- return Component;
4794
- }
4795
- if (warnMissing && !res) {
4796
- const extra = type === COMPONENTS ? `
4797
- If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
4798
- warn(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
4799
- }
4800
- return res;
4801
- } else {
4802
- warn(
4803
- `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
4804
- );
4805
- }
4806
- }
4807
- function resolve(registry, name) {
4808
- return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
4809
- }
4810
-
4811
4823
  function convertLegacyRenderFn(instance) {
4812
4824
  const Component2 = instance.type;
4813
4825
  const render = Component2.render;
@@ -6313,7 +6325,7 @@ If this is a native custom element, make sure to exclude it from component resol
6313
6325
  return vm;
6314
6326
  }
6315
6327
  }
6316
- Vue.version = `2.6.14-compat:${"3.4.0-alpha.1"}`;
6328
+ Vue.version = `2.6.14-compat:${"3.4.0-alpha.3"}`;
6317
6329
  Vue.config = singletonApp.config;
6318
6330
  Vue.use = (p, ...options) => {
6319
6331
  if (p && isFunction(p.install)) {
@@ -7341,6 +7353,9 @@ If you want to remount the same app, move your app creation logic into a factory
7341
7353
  };
7342
7354
  }
7343
7355
  function getInvalidTypeMessage(name, value, expectedTypes) {
7356
+ if (expectedTypes.length === 0) {
7357
+ return `Prop type [] for prop "${name}" won't match anything. Did you mean to use type Array instead?`;
7358
+ }
7344
7359
  let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
7345
7360
  const expectedType = expectedTypes[0];
7346
7361
  const receivedType = toRawType(value);
@@ -7612,6 +7627,20 @@ If you want to remount the same app, move your app creation logic into a factory
7612
7627
  const { type, ref, shapeFlag, patchFlag } = vnode;
7613
7628
  let domType = node.nodeType;
7614
7629
  vnode.el = node;
7630
+ {
7631
+ if (!("__vnode" in node)) {
7632
+ Object.defineProperty(node, "__vnode", {
7633
+ value: vnode,
7634
+ enumerable: false
7635
+ });
7636
+ }
7637
+ if (!("__vueParentComponent" in node)) {
7638
+ Object.defineProperty(node, "__vueParentComponent", {
7639
+ value: parentComponent,
7640
+ enumerable: false
7641
+ });
7642
+ }
7643
+ }
7615
7644
  if (patchFlag === -2) {
7616
7645
  optimized = false;
7617
7646
  vnode.dynamicChildren = null;
@@ -7642,15 +7671,15 @@ If you want to remount the same app, move your app creation logic into a factory
7642
7671
  }
7643
7672
  break;
7644
7673
  case Comment:
7645
- if (domType !== 8 /* COMMENT */ || isFragmentStart) {
7646
- if (node.tagName.toLowerCase() === "template") {
7647
- const content = vnode.el.content.firstChild;
7648
- replaceNode(content, node, parentComponent);
7649
- vnode.el = node = content;
7650
- nextNode = nextSibling(node);
7651
- } else {
7652
- nextNode = onMismatch();
7653
- }
7674
+ if (isTemplateNode(node)) {
7675
+ nextNode = nextSibling(node);
7676
+ replaceNode(
7677
+ vnode.el = node.content.firstChild,
7678
+ node,
7679
+ parentComponent
7680
+ );
7681
+ } else if (domType !== 8 /* COMMENT */ || isFragmentStart) {
7682
+ nextNode = onMismatch();
7654
7683
  } else {
7655
7684
  nextNode = nextSibling(node);
7656
7685
  }
@@ -7773,15 +7802,16 @@ If you want to remount the same app, move your app creation logic into a factory
7773
7802
  const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
7774
7803
  optimized = optimized || !!vnode.dynamicChildren;
7775
7804
  const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
7776
- const forcePatchValue = type === "input" && dirs || type === "option";
7805
+ const forcePatch = type === "input" || type === "option";
7777
7806
  {
7778
7807
  if (dirs) {
7779
7808
  invokeDirectiveHook(vnode, null, parentComponent, "created");
7780
7809
  }
7781
7810
  if (props) {
7782
- if (forcePatchValue || !optimized || patchFlag & (16 | 32)) {
7811
+ if (forcePatch || !optimized || patchFlag & (16 | 32)) {
7783
7812
  for (const key in props) {
7784
- if (forcePatchValue && key.endsWith("value") || isOn(key) && !isReservedProp(key)) {
7813
+ if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
7814
+ key[0] === ".") {
7785
7815
  patchProp(
7786
7816
  el,
7787
7817
  key,
@@ -7994,8 +8024,7 @@ If you want to remount the same app, move your app creation logic into a factory
7994
8024
  let parent = parentComponent;
7995
8025
  while (parent) {
7996
8026
  if (parent.vnode.el === oldNode) {
7997
- parent.vnode.el = newNode;
7998
- parent.subTree.el = newNode;
8027
+ parent.vnode.el = parent.subTree.el = newNode;
7999
8028
  }
8000
8029
  parent = parent.parent;
8001
8030
  }
@@ -9579,6 +9608,7 @@ If you want to remount the same app, move your app creation logic into a factory
9579
9608
  }
9580
9609
  };
9581
9610
  const TeleportImpl = {
9611
+ name: "Teleport",
9582
9612
  __isTeleport: true,
9583
9613
  process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals) {
9584
9614
  const {
@@ -10058,7 +10088,7 @@ If you want to remount the same app, move your app creation logic into a factory
10058
10088
  if (shapeFlag & 4 && isProxy(type)) {
10059
10089
  type = toRaw(type);
10060
10090
  warn(
10061
- `Vue received a Component which was made a reactive object. This can lead to unnecessary performance overhead, and should be avoided by marking the component with \`markRaw\` or using \`shallowRef\` instead of \`ref\`.`,
10091
+ `Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with \`markRaw\` or using \`shallowRef\` instead of \`ref\`.`,
10062
10092
  `
10063
10093
  Component that was made reactive: `,
10064
10094
  type
@@ -10888,7 +10918,7 @@ Component that was made reactive: `,
10888
10918
  return true;
10889
10919
  }
10890
10920
 
10891
- const version = "3.4.0-alpha.1";
10921
+ const version = "3.4.0-alpha.3";
10892
10922
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10893
10923
  const ssrUtils = null;
10894
10924
  const resolveFilter = resolveFilter$1 ;
@@ -12118,21 +12148,20 @@ Component that was made reactive: `,
12118
12148
  el[assignKey] = getModelAssigner(vnode);
12119
12149
  if (el.composing)
12120
12150
  return;
12151
+ const elValue = number || el.type === "number" ? looseToNumber(el.value) : el.value;
12152
+ const newValue = value == null ? "" : value;
12153
+ if (elValue === newValue) {
12154
+ return;
12155
+ }
12121
12156
  if (document.activeElement === el && el.type !== "range") {
12122
12157
  if (lazy) {
12123
12158
  return;
12124
12159
  }
12125
- if (trim && el.value.trim() === value) {
12126
- return;
12127
- }
12128
- if ((number || el.type === "number") && looseToNumber(el.value) === value) {
12160
+ if (trim && el.value.trim() === newValue) {
12129
12161
  return;
12130
12162
  }
12131
12163
  }
12132
- const newValue = value == null ? "" : value;
12133
- if (el.value !== newValue) {
12134
- el.value = newValue;
12135
- }
12164
+ el.value = newValue;
12136
12165
  }
12137
12166
  };
12138
12167
  const vModelCheckbox = {
@@ -12697,83 +12726,6 @@ Make sure to use the production build (*.prod.js) when deploying for production.
12697
12726
  return Vue;
12698
12727
  }
12699
12728
 
12700
- function defaultOnError(error) {
12701
- throw error;
12702
- }
12703
- function defaultOnWarn(msg) {
12704
- console.warn(`[Vue warn] ${msg.message}`);
12705
- }
12706
- function createCompilerError(code, loc, messages, additionalMessage) {
12707
- const msg = (messages || errorMessages)[code] + (additionalMessage || ``) ;
12708
- const error = new SyntaxError(String(msg));
12709
- error.code = code;
12710
- error.loc = loc;
12711
- return error;
12712
- }
12713
- const errorMessages = {
12714
- // parse errors
12715
- [0]: "Illegal comment.",
12716
- [1]: "CDATA section is allowed only in XML context.",
12717
- [2]: "Duplicate attribute.",
12718
- [3]: "End tag cannot have attributes.",
12719
- [4]: "Illegal '/' in tags.",
12720
- [5]: "Unexpected EOF in tag.",
12721
- [6]: "Unexpected EOF in CDATA section.",
12722
- [7]: "Unexpected EOF in comment.",
12723
- [8]: "Unexpected EOF in script.",
12724
- [9]: "Unexpected EOF in tag.",
12725
- [10]: "Incorrectly closed comment.",
12726
- [11]: "Incorrectly opened comment.",
12727
- [12]: "Illegal tag name. Use '&lt;' to print '<'.",
12728
- [13]: "Attribute value was expected.",
12729
- [14]: "End tag name was expected.",
12730
- [15]: "Whitespace was expected.",
12731
- [16]: "Unexpected '<!--' in comment.",
12732
- [17]: `Attribute name cannot contain U+0022 ("), U+0027 ('), and U+003C (<).`,
12733
- [18]: "Unquoted attribute value cannot contain U+0022 (\"), U+0027 ('), U+003C (<), U+003D (=), and U+0060 (`).",
12734
- [19]: "Attribute name cannot start with '='.",
12735
- [21]: "'<?' is allowed only in XML context.",
12736
- [20]: `Unexpected null character.`,
12737
- [22]: "Illegal '/' in tags.",
12738
- // Vue-specific parse errors
12739
- [23]: "Invalid end tag.",
12740
- [24]: "Element is missing end tag.",
12741
- [25]: "Interpolation end sign was not found.",
12742
- [27]: "End bracket for dynamic directive argument was not found. Note that dynamic directive argument cannot contain spaces.",
12743
- [26]: "Legal directive name was expected.",
12744
- // transform errors
12745
- [28]: `v-if/v-else-if is missing expression.`,
12746
- [29]: `v-if/else branches must use unique keys.`,
12747
- [30]: `v-else/v-else-if has no adjacent v-if or v-else-if.`,
12748
- [31]: `v-for is missing expression.`,
12749
- [32]: `v-for has invalid expression.`,
12750
- [33]: `<template v-for> key should be placed on the <template> tag.`,
12751
- [34]: `v-bind is missing expression.`,
12752
- [35]: `v-on is missing expression.`,
12753
- [36]: `Unexpected custom directive on <slot> outlet.`,
12754
- [37]: `Mixed v-slot usage on both the component and nested <template>. When there are multiple named slots, all slots should use <template> syntax to avoid scope ambiguity.`,
12755
- [38]: `Duplicate slot names found. `,
12756
- [39]: `Extraneous children found when component already has explicitly named default slot. These children will be ignored.`,
12757
- [40]: `v-slot can only be used on components or <template> tags.`,
12758
- [41]: `v-model is missing expression.`,
12759
- [42]: `v-model value must be a valid JavaScript member expression.`,
12760
- [43]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`,
12761
- [44]: `v-model cannot be used on a prop, because local prop bindings are not writable.
12762
- Use a v-bind binding combined with a v-on listener that emits update:x event instead.`,
12763
- [45]: `Error parsing JavaScript expression: `,
12764
- [46]: `<KeepAlive> expects exactly one child component.`,
12765
- // generic errors
12766
- [47]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
12767
- [48]: `ES module mode is not supported in this build of compiler.`,
12768
- [49]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
12769
- [50]: `"scopeId" option is only supported in module mode.`,
12770
- // deprecations
12771
- [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.`,
12772
- [52]: `v-is="component-name" has been deprecated. Use is="vue:component-name" instead. v-is support will be removed in 3.4.`,
12773
- // just to fulfill types
12774
- [53]: ``
12775
- };
12776
-
12777
12729
  const FRAGMENT = Symbol(`Fragment` );
12778
12730
  const TELEPORT = Symbol(`Teleport` );
12779
12731
  const SUSPENSE = Symbol(`Suspense` );
@@ -12863,13 +12815,14 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
12863
12815
  }
12864
12816
 
12865
12817
  const locStub = {
12866
- source: "",
12867
12818
  start: { line: 1, column: 1, offset: 0 },
12868
- end: { line: 1, column: 1, offset: 0 }
12819
+ end: { line: 1, column: 1, offset: 0 },
12820
+ source: ""
12869
12821
  };
12870
- function createRoot(children, loc = locStub) {
12822
+ function createRoot(children, source = "") {
12871
12823
  return {
12872
12824
  type: 0,
12825
+ source,
12873
12826
  children,
12874
12827
  helpers: /* @__PURE__ */ new Set(),
12875
12828
  components: [],
@@ -12879,7 +12832,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
12879
12832
  cached: 0,
12880
12833
  temps: 0,
12881
12834
  codegenNode: void 0,
12882
- loc
12835
+ loc: locStub
12883
12836
  };
12884
12837
  }
12885
12838
  function createVNodeCall(context, tag, props, children, patchFlag, dynamicProps, directives, isBlock = false, disableTracking = false, isComponent = false, loc = locStub) {
@@ -13005,39 +12958,992 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
13005
12958
  }
13006
12959
  }
13007
12960
 
13008
- const isStaticExp = (p) => p.type === 4 && p.isStatic;
13009
- const isBuiltInType = (tag, expected) => tag === expected || tag === hyphenate(expected);
13010
- function isCoreComponent(tag) {
13011
- if (isBuiltInType(tag, "Teleport")) {
13012
- return TELEPORT;
13013
- } else if (isBuiltInType(tag, "Suspense")) {
13014
- return SUSPENSE;
13015
- } else if (isBuiltInType(tag, "KeepAlive")) {
13016
- return KEEP_ALIVE;
13017
- } else if (isBuiltInType(tag, "BaseTransition")) {
13018
- return BASE_TRANSITION;
12961
+ const defaultDelimitersOpen = new Uint8Array([123, 123]);
12962
+ const defaultDelimitersClose = new Uint8Array([125, 125]);
12963
+ function isTagStartChar(c) {
12964
+ return c >= 97 && c <= 122 || c >= 65 && c <= 90;
12965
+ }
12966
+ function isWhitespace(c) {
12967
+ return c === 32 || c === 10 || c === 9 || c === 12 || c === 13;
12968
+ }
12969
+ function isEndOfTagSection(c) {
12970
+ return c === 47 || c === 62 || isWhitespace(c);
12971
+ }
12972
+ function toCharCodes(str) {
12973
+ const ret = new Uint8Array(str.length);
12974
+ for (let i = 0; i < str.length; i++) {
12975
+ ret[i] = str.charCodeAt(i);
13019
12976
  }
12977
+ return ret;
13020
12978
  }
13021
- const nonIdentifierRE = /^\d|[^\$\w]/;
13022
- const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
13023
- const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
13024
- const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
13025
- const whitespaceRE = /\s+[.[]\s*|\s*[.[]\s+/g;
13026
- const isMemberExpressionBrowser = (path) => {
13027
- path = path.trim().replace(whitespaceRE, (s) => s.trim());
13028
- let state = 0 /* inMemberExp */;
13029
- let stateStack = [];
13030
- let currentOpenBracketCount = 0;
13031
- let currentOpenParensCount = 0;
13032
- let currentStringType = null;
13033
- for (let i = 0; i < path.length; i++) {
13034
- const char = path.charAt(i);
13035
- switch (state) {
13036
- case 0 /* inMemberExp */:
13037
- if (char === "[") {
13038
- stateStack.push(state);
13039
- state = 1 /* inBrackets */;
13040
- currentOpenBracketCount++;
12979
+ const Sequences = {
12980
+ Cdata: new Uint8Array([67, 68, 65, 84, 65, 91]),
12981
+ // CDATA[
12982
+ CdataEnd: new Uint8Array([93, 93, 62]),
12983
+ // ]]>
12984
+ CommentEnd: new Uint8Array([45, 45, 62]),
12985
+ // `-->`
12986
+ ScriptEnd: new Uint8Array([60, 47, 115, 99, 114, 105, 112, 116]),
12987
+ // `<\/script`
12988
+ StyleEnd: new Uint8Array([60, 47, 115, 116, 121, 108, 101]),
12989
+ // `</style`
12990
+ TitleEnd: new Uint8Array([60, 47, 116, 105, 116, 108, 101]),
12991
+ // `</title`
12992
+ TextareaEnd: new Uint8Array([
12993
+ 60,
12994
+ 47,
12995
+ 116,
12996
+ 101,
12997
+ 120,
12998
+ 116,
12999
+ 97,
13000
+ 114,
13001
+ 101,
13002
+ 97
13003
+ ])
13004
+ // `</textarea
13005
+ };
13006
+ class Tokenizer {
13007
+ constructor(stack, cbs) {
13008
+ this.stack = stack;
13009
+ this.cbs = cbs;
13010
+ /** The current state the tokenizer is in. */
13011
+ this.state = 1;
13012
+ /** The read buffer. */
13013
+ this.buffer = "";
13014
+ /** The beginning of the section that is currently being read. */
13015
+ this.sectionStart = 0;
13016
+ /** The index within the buffer that we are currently looking at. */
13017
+ this.index = 0;
13018
+ /** The start of the last entity. */
13019
+ this.entityStart = 0;
13020
+ /** Some behavior, eg. when decoding entities, is done while we are in another state. This keeps track of the other state type. */
13021
+ this.baseState = 1;
13022
+ /** For special parsing behavior inside of script and style tags. */
13023
+ this.inRCDATA = false;
13024
+ /** For disabling RCDATA tags handling */
13025
+ this.inXML = false;
13026
+ /** Reocrd newline positions for fast line / column calculation */
13027
+ this.newlines = [];
13028
+ this.mode = 0;
13029
+ this.delimiterOpen = defaultDelimitersOpen;
13030
+ this.delimiterClose = defaultDelimitersClose;
13031
+ this.delimiterIndex = -1;
13032
+ this.currentSequence = void 0;
13033
+ this.sequenceIndex = 0;
13034
+ }
13035
+ get inSFCRoot() {
13036
+ return this.mode === 2 && this.stack.length === 0;
13037
+ }
13038
+ reset() {
13039
+ this.state = 1;
13040
+ this.mode = 0;
13041
+ this.buffer = "";
13042
+ this.sectionStart = 0;
13043
+ this.index = 0;
13044
+ this.baseState = 1;
13045
+ this.currentSequence = void 0;
13046
+ this.newlines.length = 0;
13047
+ this.delimiterOpen = defaultDelimitersOpen;
13048
+ this.delimiterClose = defaultDelimitersClose;
13049
+ }
13050
+ /**
13051
+ * Generate Position object with line / column information using recorded
13052
+ * newline positions. We know the index is always going to be an already
13053
+ * processed index, so all the newlines up to this index should have been
13054
+ * recorded.
13055
+ */
13056
+ getPos(index) {
13057
+ let line = 1;
13058
+ let column = index + 1;
13059
+ for (let i = this.newlines.length - 1; i >= 0; i--) {
13060
+ const newlineIndex = this.newlines[i];
13061
+ if (index > newlineIndex) {
13062
+ line = i + 2;
13063
+ column = index - newlineIndex;
13064
+ break;
13065
+ }
13066
+ }
13067
+ return {
13068
+ column,
13069
+ line,
13070
+ offset: index
13071
+ };
13072
+ }
13073
+ peek() {
13074
+ return this.buffer.charCodeAt(this.index + 1);
13075
+ }
13076
+ stateText(c) {
13077
+ if (c === 60) {
13078
+ if (this.index > this.sectionStart) {
13079
+ this.cbs.ontext(this.sectionStart, this.index);
13080
+ }
13081
+ this.state = 5;
13082
+ this.sectionStart = this.index;
13083
+ } else if (c === this.delimiterOpen[0]) {
13084
+ this.state = 2;
13085
+ this.delimiterIndex = 0;
13086
+ this.stateInterpolationOpen(c);
13087
+ }
13088
+ }
13089
+ stateInterpolationOpen(c) {
13090
+ if (c === this.delimiterOpen[this.delimiterIndex]) {
13091
+ if (this.delimiterIndex === this.delimiterOpen.length - 1) {
13092
+ const start = this.index + 1 - this.delimiterOpen.length;
13093
+ if (start > this.sectionStart) {
13094
+ this.cbs.ontext(this.sectionStart, start);
13095
+ }
13096
+ this.state = 3;
13097
+ this.sectionStart = start;
13098
+ } else {
13099
+ this.delimiterIndex++;
13100
+ }
13101
+ } else if (this.inRCDATA) {
13102
+ this.state = 32;
13103
+ this.stateInRCDATA(c);
13104
+ } else {
13105
+ this.state = 1;
13106
+ this.stateText(c);
13107
+ }
13108
+ }
13109
+ stateInterpolation(c) {
13110
+ if (c === this.delimiterClose[0]) {
13111
+ this.state = 4;
13112
+ this.delimiterIndex = 0;
13113
+ this.stateInterpolationClose(c);
13114
+ }
13115
+ }
13116
+ stateInterpolationClose(c) {
13117
+ if (c === this.delimiterClose[this.delimiterIndex]) {
13118
+ if (this.delimiterIndex === this.delimiterClose.length - 1) {
13119
+ this.cbs.oninterpolation(this.sectionStart, this.index + 1);
13120
+ if (this.inRCDATA) {
13121
+ this.state = 32;
13122
+ } else {
13123
+ this.state = 1;
13124
+ }
13125
+ this.sectionStart = this.index + 1;
13126
+ } else {
13127
+ this.delimiterIndex++;
13128
+ }
13129
+ } else {
13130
+ this.state = 3;
13131
+ this.stateInterpolation(c);
13132
+ }
13133
+ }
13134
+ stateSpecialStartSequence(c) {
13135
+ const isEnd = this.sequenceIndex === this.currentSequence.length;
13136
+ const isMatch = isEnd ? (
13137
+ // If we are at the end of the sequence, make sure the tag name has ended
13138
+ isEndOfTagSection(c)
13139
+ ) : (
13140
+ // Otherwise, do a case-insensitive comparison
13141
+ (c | 32) === this.currentSequence[this.sequenceIndex]
13142
+ );
13143
+ if (!isMatch) {
13144
+ this.inRCDATA = false;
13145
+ } else if (!isEnd) {
13146
+ this.sequenceIndex++;
13147
+ return;
13148
+ }
13149
+ this.sequenceIndex = 0;
13150
+ this.state = 6;
13151
+ this.stateInTagName(c);
13152
+ }
13153
+ /** Look for an end tag. For <title> and <textarea>, also decode entities. */
13154
+ stateInRCDATA(c) {
13155
+ if (this.sequenceIndex === this.currentSequence.length) {
13156
+ if (c === 62 || isWhitespace(c)) {
13157
+ const endOfText = this.index - this.currentSequence.length;
13158
+ if (this.sectionStart < endOfText) {
13159
+ const actualIndex = this.index;
13160
+ this.index = endOfText;
13161
+ this.cbs.ontext(this.sectionStart, endOfText);
13162
+ this.index = actualIndex;
13163
+ }
13164
+ this.sectionStart = endOfText + 2;
13165
+ this.stateInClosingTagName(c);
13166
+ this.inRCDATA = false;
13167
+ return;
13168
+ }
13169
+ this.sequenceIndex = 0;
13170
+ }
13171
+ if ((c | 32) === this.currentSequence[this.sequenceIndex]) {
13172
+ this.sequenceIndex += 1;
13173
+ } else if (this.sequenceIndex === 0) {
13174
+ if (this.currentSequence === Sequences.TitleEnd || this.currentSequence === Sequences.TextareaEnd && !this.inSFCRoot) {
13175
+ if (c === this.delimiterOpen[0]) {
13176
+ this.state = 2;
13177
+ this.delimiterIndex = 0;
13178
+ this.stateInterpolationOpen(c);
13179
+ }
13180
+ } else if (this.fastForwardTo(60)) {
13181
+ this.sequenceIndex = 1;
13182
+ }
13183
+ } else {
13184
+ this.sequenceIndex = Number(c === 60);
13185
+ }
13186
+ }
13187
+ stateCDATASequence(c) {
13188
+ if (c === Sequences.Cdata[this.sequenceIndex]) {
13189
+ if (++this.sequenceIndex === Sequences.Cdata.length) {
13190
+ this.state = 28;
13191
+ this.currentSequence = Sequences.CdataEnd;
13192
+ this.sequenceIndex = 0;
13193
+ this.sectionStart = this.index + 1;
13194
+ }
13195
+ } else {
13196
+ this.sequenceIndex = 0;
13197
+ this.state = 23;
13198
+ this.stateInDeclaration(c);
13199
+ }
13200
+ }
13201
+ /**
13202
+ * When we wait for one specific character, we can speed things up
13203
+ * by skipping through the buffer until we find it.
13204
+ *
13205
+ * @returns Whether the character was found.
13206
+ */
13207
+ fastForwardTo(c) {
13208
+ while (++this.index < this.buffer.length) {
13209
+ const cc = this.buffer.charCodeAt(this.index);
13210
+ if (cc === 10) {
13211
+ this.newlines.push(this.index);
13212
+ }
13213
+ if (cc === c) {
13214
+ return true;
13215
+ }
13216
+ }
13217
+ this.index = this.buffer.length - 1;
13218
+ return false;
13219
+ }
13220
+ /**
13221
+ * Comments and CDATA end with `-->` and `]]>`.
13222
+ *
13223
+ * Their common qualities are:
13224
+ * - Their end sequences have a distinct character they start with.
13225
+ * - That character is then repeated, so we have to check multiple repeats.
13226
+ * - All characters but the start character of the sequence can be skipped.
13227
+ */
13228
+ stateInCommentLike(c) {
13229
+ if (c === this.currentSequence[this.sequenceIndex]) {
13230
+ if (++this.sequenceIndex === this.currentSequence.length) {
13231
+ if (this.currentSequence === Sequences.CdataEnd) {
13232
+ this.cbs.oncdata(this.sectionStart, this.index - 2);
13233
+ } else {
13234
+ this.cbs.oncomment(this.sectionStart, this.index - 2);
13235
+ }
13236
+ this.sequenceIndex = 0;
13237
+ this.sectionStart = this.index + 1;
13238
+ this.state = 1;
13239
+ }
13240
+ } else if (this.sequenceIndex === 0) {
13241
+ if (this.fastForwardTo(this.currentSequence[0])) {
13242
+ this.sequenceIndex = 1;
13243
+ }
13244
+ } else if (c !== this.currentSequence[this.sequenceIndex - 1]) {
13245
+ this.sequenceIndex = 0;
13246
+ }
13247
+ }
13248
+ startSpecial(sequence, offset) {
13249
+ this.enterRCDATA(sequence, offset);
13250
+ this.state = 31;
13251
+ }
13252
+ enterRCDATA(sequence, offset) {
13253
+ this.inRCDATA = true;
13254
+ this.currentSequence = sequence;
13255
+ this.sequenceIndex = offset;
13256
+ }
13257
+ stateBeforeTagName(c) {
13258
+ if (c === 33) {
13259
+ this.state = 22;
13260
+ this.sectionStart = this.index + 1;
13261
+ } else if (c === 63) {
13262
+ this.state = 24;
13263
+ this.sectionStart = this.index + 1;
13264
+ } else if (isTagStartChar(c)) {
13265
+ this.sectionStart = this.index;
13266
+ if (this.mode === 0) {
13267
+ this.state = 6;
13268
+ } else if (this.inSFCRoot) {
13269
+ this.state = 34;
13270
+ } else if (!this.inXML) {
13271
+ const lower = c | 32;
13272
+ if (lower === 116) {
13273
+ this.state = 30;
13274
+ } else {
13275
+ this.state = lower === 115 ? 29 : 6;
13276
+ }
13277
+ } else {
13278
+ this.state = 6;
13279
+ }
13280
+ } else if (c === 47) {
13281
+ this.state = 8;
13282
+ } else {
13283
+ this.state = 1;
13284
+ this.stateText(c);
13285
+ }
13286
+ }
13287
+ stateInTagName(c) {
13288
+ if (isEndOfTagSection(c)) {
13289
+ this.handleTagName(c);
13290
+ }
13291
+ }
13292
+ stateInSFCRootTagName(c) {
13293
+ if (isEndOfTagSection(c)) {
13294
+ const tag = this.buffer.slice(this.sectionStart, this.index);
13295
+ if (tag !== "template") {
13296
+ this.enterRCDATA(toCharCodes(`</` + tag), 0);
13297
+ }
13298
+ this.handleTagName(c);
13299
+ }
13300
+ }
13301
+ handleTagName(c) {
13302
+ this.cbs.onopentagname(this.sectionStart, this.index);
13303
+ this.sectionStart = -1;
13304
+ this.state = 11;
13305
+ this.stateBeforeAttrName(c);
13306
+ }
13307
+ stateBeforeClosingTagName(c) {
13308
+ if (isWhitespace(c)) ; else if (c === 62) {
13309
+ {
13310
+ this.cbs.onerr(14, this.index);
13311
+ }
13312
+ this.state = 1;
13313
+ this.sectionStart = this.index + 1;
13314
+ } else {
13315
+ this.state = isTagStartChar(c) ? 9 : 27;
13316
+ this.sectionStart = this.index;
13317
+ }
13318
+ }
13319
+ stateInClosingTagName(c) {
13320
+ if (c === 62 || isWhitespace(c)) {
13321
+ this.cbs.onclosetag(this.sectionStart, this.index);
13322
+ this.sectionStart = -1;
13323
+ this.state = 10;
13324
+ this.stateAfterClosingTagName(c);
13325
+ }
13326
+ }
13327
+ stateAfterClosingTagName(c) {
13328
+ if (c === 62) {
13329
+ this.state = 1;
13330
+ this.sectionStart = this.index + 1;
13331
+ }
13332
+ }
13333
+ stateBeforeAttrName(c) {
13334
+ if (c === 62) {
13335
+ this.cbs.onopentagend(this.index);
13336
+ if (this.inRCDATA) {
13337
+ this.state = 32;
13338
+ } else {
13339
+ this.state = 1;
13340
+ }
13341
+ this.sectionStart = this.index + 1;
13342
+ } else if (c === 47) {
13343
+ this.state = 7;
13344
+ if (this.peek() !== 62) {
13345
+ this.cbs.onerr(22, this.index);
13346
+ }
13347
+ } else if (c === 60 && this.peek() === 47) {
13348
+ this.cbs.onopentagend(this.index);
13349
+ this.state = 5;
13350
+ this.sectionStart = this.index;
13351
+ } else if (!isWhitespace(c)) {
13352
+ if (c === 61) {
13353
+ this.cbs.onerr(
13354
+ 19,
13355
+ this.index
13356
+ );
13357
+ }
13358
+ this.handleAttrStart(c);
13359
+ }
13360
+ }
13361
+ handleAttrStart(c) {
13362
+ if (c === 118 && this.peek() === 45) {
13363
+ this.state = 13;
13364
+ this.sectionStart = this.index;
13365
+ } else if (c === 46 || c === 58 || c === 64 || c === 35) {
13366
+ this.cbs.ondirname(this.index, this.index + 1);
13367
+ this.state = 14;
13368
+ this.sectionStart = this.index + 1;
13369
+ } else {
13370
+ this.state = 12;
13371
+ this.sectionStart = this.index;
13372
+ }
13373
+ }
13374
+ stateInSelfClosingTag(c) {
13375
+ if (c === 62) {
13376
+ this.cbs.onselfclosingtag(this.index);
13377
+ this.state = 1;
13378
+ this.sectionStart = this.index + 1;
13379
+ this.inRCDATA = false;
13380
+ } else if (!isWhitespace(c)) {
13381
+ this.state = 11;
13382
+ this.stateBeforeAttrName(c);
13383
+ }
13384
+ }
13385
+ stateInAttrName(c) {
13386
+ if (c === 61 || isEndOfTagSection(c)) {
13387
+ this.cbs.onattribname(this.sectionStart, this.index);
13388
+ this.handleAttrNameEnd(c);
13389
+ } else if (c === 34 || c === 39 || c === 60) {
13390
+ this.cbs.onerr(
13391
+ 17,
13392
+ this.index
13393
+ );
13394
+ }
13395
+ }
13396
+ stateInDirName(c) {
13397
+ if (c === 61 || isEndOfTagSection(c)) {
13398
+ this.cbs.ondirname(this.sectionStart, this.index);
13399
+ this.handleAttrNameEnd(c);
13400
+ } else if (c === 58) {
13401
+ this.cbs.ondirname(this.sectionStart, this.index);
13402
+ this.state = 14;
13403
+ this.sectionStart = this.index + 1;
13404
+ } else if (c === 46) {
13405
+ this.cbs.ondirname(this.sectionStart, this.index);
13406
+ this.state = 16;
13407
+ this.sectionStart = this.index + 1;
13408
+ }
13409
+ }
13410
+ stateInDirArg(c) {
13411
+ if (c === 61 || isEndOfTagSection(c)) {
13412
+ this.cbs.ondirarg(this.sectionStart, this.index);
13413
+ this.handleAttrNameEnd(c);
13414
+ } else if (c === 91) {
13415
+ this.state = 15;
13416
+ } else if (c === 46) {
13417
+ this.cbs.ondirarg(this.sectionStart, this.index);
13418
+ this.state = 16;
13419
+ this.sectionStart = this.index + 1;
13420
+ }
13421
+ }
13422
+ stateInDynamicDirArg(c) {
13423
+ if (c === 93) {
13424
+ this.state = 14;
13425
+ } else if (c === 61 || isEndOfTagSection(c)) {
13426
+ this.cbs.ondirarg(this.sectionStart, this.index + 1);
13427
+ this.handleAttrNameEnd(c);
13428
+ {
13429
+ this.cbs.onerr(
13430
+ 27,
13431
+ this.index
13432
+ );
13433
+ }
13434
+ }
13435
+ }
13436
+ stateInDirModifier(c) {
13437
+ if (c === 61 || isEndOfTagSection(c)) {
13438
+ this.cbs.ondirmodifier(this.sectionStart, this.index);
13439
+ this.handleAttrNameEnd(c);
13440
+ } else if (c === 46) {
13441
+ this.cbs.ondirmodifier(this.sectionStart, this.index);
13442
+ this.sectionStart = this.index + 1;
13443
+ }
13444
+ }
13445
+ handleAttrNameEnd(c) {
13446
+ this.sectionStart = this.index;
13447
+ this.state = 17;
13448
+ this.cbs.onattribnameend(this.index);
13449
+ this.stateAfterAttrName(c);
13450
+ }
13451
+ stateAfterAttrName(c) {
13452
+ if (c === 61) {
13453
+ this.state = 18;
13454
+ } else if (c === 47 || c === 62) {
13455
+ this.cbs.onattribend(0, this.sectionStart);
13456
+ this.sectionStart = -1;
13457
+ this.state = 11;
13458
+ this.stateBeforeAttrName(c);
13459
+ } else if (!isWhitespace(c)) {
13460
+ this.cbs.onattribend(0, this.sectionStart);
13461
+ this.handleAttrStart(c);
13462
+ }
13463
+ }
13464
+ stateBeforeAttrValue(c) {
13465
+ if (c === 34) {
13466
+ this.state = 19;
13467
+ this.sectionStart = this.index + 1;
13468
+ } else if (c === 39) {
13469
+ this.state = 20;
13470
+ this.sectionStart = this.index + 1;
13471
+ } else if (!isWhitespace(c)) {
13472
+ this.sectionStart = this.index;
13473
+ this.state = 21;
13474
+ this.stateInAttrValueNoQuotes(c);
13475
+ }
13476
+ }
13477
+ handleInAttrValue(c, quote) {
13478
+ if (c === quote || this.fastForwardTo(quote)) {
13479
+ this.cbs.onattribdata(this.sectionStart, this.index);
13480
+ this.sectionStart = -1;
13481
+ this.cbs.onattribend(
13482
+ quote === 34 ? 3 : 2,
13483
+ this.index + 1
13484
+ );
13485
+ this.state = 11;
13486
+ }
13487
+ }
13488
+ stateInAttrValueDoubleQuotes(c) {
13489
+ this.handleInAttrValue(c, 34);
13490
+ }
13491
+ stateInAttrValueSingleQuotes(c) {
13492
+ this.handleInAttrValue(c, 39);
13493
+ }
13494
+ stateInAttrValueNoQuotes(c) {
13495
+ if (isWhitespace(c) || c === 62) {
13496
+ this.cbs.onattribdata(this.sectionStart, this.index);
13497
+ this.sectionStart = -1;
13498
+ this.cbs.onattribend(1, this.index);
13499
+ this.state = 11;
13500
+ this.stateBeforeAttrName(c);
13501
+ } else if (c === 34 || c === 39 || c === 60 || c === 61 || c === 96) {
13502
+ this.cbs.onerr(
13503
+ 18,
13504
+ this.index
13505
+ );
13506
+ } else ;
13507
+ }
13508
+ stateBeforeDeclaration(c) {
13509
+ if (c === 91) {
13510
+ this.state = 26;
13511
+ this.sequenceIndex = 0;
13512
+ } else {
13513
+ this.state = c === 45 ? 25 : 23;
13514
+ }
13515
+ }
13516
+ stateInDeclaration(c) {
13517
+ if (c === 62 || this.fastForwardTo(62)) {
13518
+ this.state = 1;
13519
+ this.sectionStart = this.index + 1;
13520
+ }
13521
+ }
13522
+ stateInProcessingInstruction(c) {
13523
+ if (c === 62 || this.fastForwardTo(62)) {
13524
+ this.cbs.onprocessinginstruction(this.sectionStart, this.index);
13525
+ this.state = 1;
13526
+ this.sectionStart = this.index + 1;
13527
+ }
13528
+ }
13529
+ stateBeforeComment(c) {
13530
+ if (c === 45) {
13531
+ this.state = 28;
13532
+ this.currentSequence = Sequences.CommentEnd;
13533
+ this.sequenceIndex = 2;
13534
+ this.sectionStart = this.index + 1;
13535
+ } else {
13536
+ this.state = 23;
13537
+ }
13538
+ }
13539
+ stateInSpecialComment(c) {
13540
+ if (c === 62 || this.fastForwardTo(62)) {
13541
+ this.cbs.oncomment(this.sectionStart, this.index);
13542
+ this.state = 1;
13543
+ this.sectionStart = this.index + 1;
13544
+ }
13545
+ }
13546
+ stateBeforeSpecialS(c) {
13547
+ const lower = c | 32;
13548
+ if (lower === Sequences.ScriptEnd[3]) {
13549
+ this.startSpecial(Sequences.ScriptEnd, 4);
13550
+ } else if (lower === Sequences.StyleEnd[3]) {
13551
+ this.startSpecial(Sequences.StyleEnd, 4);
13552
+ } else {
13553
+ this.state = 6;
13554
+ this.stateInTagName(c);
13555
+ }
13556
+ }
13557
+ stateBeforeSpecialT(c) {
13558
+ const lower = c | 32;
13559
+ if (lower === Sequences.TitleEnd[3]) {
13560
+ this.startSpecial(Sequences.TitleEnd, 4);
13561
+ } else if (lower === Sequences.TextareaEnd[3]) {
13562
+ this.startSpecial(Sequences.TextareaEnd, 4);
13563
+ } else {
13564
+ this.state = 6;
13565
+ this.stateInTagName(c);
13566
+ }
13567
+ }
13568
+ startEntity() {
13569
+ }
13570
+ stateInEntity() {
13571
+ }
13572
+ /**
13573
+ * Iterates through the buffer, calling the function corresponding to the current state.
13574
+ *
13575
+ * States that are more likely to be hit are higher up, as a performance improvement.
13576
+ */
13577
+ parse(input) {
13578
+ this.buffer = input;
13579
+ while (this.index < this.buffer.length) {
13580
+ const c = this.buffer.charCodeAt(this.index);
13581
+ if (c === 10) {
13582
+ this.newlines.push(this.index);
13583
+ }
13584
+ switch (this.state) {
13585
+ case 1: {
13586
+ this.stateText(c);
13587
+ break;
13588
+ }
13589
+ case 2: {
13590
+ this.stateInterpolationOpen(c);
13591
+ break;
13592
+ }
13593
+ case 3: {
13594
+ this.stateInterpolation(c);
13595
+ break;
13596
+ }
13597
+ case 4: {
13598
+ this.stateInterpolationClose(c);
13599
+ break;
13600
+ }
13601
+ case 31: {
13602
+ this.stateSpecialStartSequence(c);
13603
+ break;
13604
+ }
13605
+ case 32: {
13606
+ this.stateInRCDATA(c);
13607
+ break;
13608
+ }
13609
+ case 26: {
13610
+ this.stateCDATASequence(c);
13611
+ break;
13612
+ }
13613
+ case 19: {
13614
+ this.stateInAttrValueDoubleQuotes(c);
13615
+ break;
13616
+ }
13617
+ case 12: {
13618
+ this.stateInAttrName(c);
13619
+ break;
13620
+ }
13621
+ case 13: {
13622
+ this.stateInDirName(c);
13623
+ break;
13624
+ }
13625
+ case 14: {
13626
+ this.stateInDirArg(c);
13627
+ break;
13628
+ }
13629
+ case 15: {
13630
+ this.stateInDynamicDirArg(c);
13631
+ break;
13632
+ }
13633
+ case 16: {
13634
+ this.stateInDirModifier(c);
13635
+ break;
13636
+ }
13637
+ case 28: {
13638
+ this.stateInCommentLike(c);
13639
+ break;
13640
+ }
13641
+ case 27: {
13642
+ this.stateInSpecialComment(c);
13643
+ break;
13644
+ }
13645
+ case 11: {
13646
+ this.stateBeforeAttrName(c);
13647
+ break;
13648
+ }
13649
+ case 6: {
13650
+ this.stateInTagName(c);
13651
+ break;
13652
+ }
13653
+ case 34: {
13654
+ this.stateInSFCRootTagName(c);
13655
+ break;
13656
+ }
13657
+ case 9: {
13658
+ this.stateInClosingTagName(c);
13659
+ break;
13660
+ }
13661
+ case 5: {
13662
+ this.stateBeforeTagName(c);
13663
+ break;
13664
+ }
13665
+ case 17: {
13666
+ this.stateAfterAttrName(c);
13667
+ break;
13668
+ }
13669
+ case 20: {
13670
+ this.stateInAttrValueSingleQuotes(c);
13671
+ break;
13672
+ }
13673
+ case 18: {
13674
+ this.stateBeforeAttrValue(c);
13675
+ break;
13676
+ }
13677
+ case 8: {
13678
+ this.stateBeforeClosingTagName(c);
13679
+ break;
13680
+ }
13681
+ case 10: {
13682
+ this.stateAfterClosingTagName(c);
13683
+ break;
13684
+ }
13685
+ case 29: {
13686
+ this.stateBeforeSpecialS(c);
13687
+ break;
13688
+ }
13689
+ case 30: {
13690
+ this.stateBeforeSpecialT(c);
13691
+ break;
13692
+ }
13693
+ case 21: {
13694
+ this.stateInAttrValueNoQuotes(c);
13695
+ break;
13696
+ }
13697
+ case 7: {
13698
+ this.stateInSelfClosingTag(c);
13699
+ break;
13700
+ }
13701
+ case 23: {
13702
+ this.stateInDeclaration(c);
13703
+ break;
13704
+ }
13705
+ case 22: {
13706
+ this.stateBeforeDeclaration(c);
13707
+ break;
13708
+ }
13709
+ case 25: {
13710
+ this.stateBeforeComment(c);
13711
+ break;
13712
+ }
13713
+ case 24: {
13714
+ this.stateInProcessingInstruction(c);
13715
+ break;
13716
+ }
13717
+ case 33: {
13718
+ this.stateInEntity();
13719
+ break;
13720
+ }
13721
+ }
13722
+ this.index++;
13723
+ }
13724
+ this.cleanup();
13725
+ this.finish();
13726
+ }
13727
+ /**
13728
+ * Remove data that has already been consumed from the buffer.
13729
+ */
13730
+ cleanup() {
13731
+ if (this.sectionStart !== this.index) {
13732
+ if (this.state === 1 || this.state === 32 && this.sequenceIndex === 0) {
13733
+ this.cbs.ontext(this.sectionStart, this.index);
13734
+ this.sectionStart = this.index;
13735
+ } else if (this.state === 19 || this.state === 20 || this.state === 21) {
13736
+ this.cbs.onattribdata(this.sectionStart, this.index);
13737
+ this.sectionStart = this.index;
13738
+ }
13739
+ }
13740
+ }
13741
+ finish() {
13742
+ this.handleTrailingData();
13743
+ this.cbs.onend();
13744
+ }
13745
+ /** Handle any trailing data. */
13746
+ handleTrailingData() {
13747
+ const endIndex = this.buffer.length;
13748
+ if (this.sectionStart >= endIndex) {
13749
+ return;
13750
+ }
13751
+ if (this.state === 28) {
13752
+ if (this.currentSequence === Sequences.CdataEnd) {
13753
+ this.cbs.oncdata(this.sectionStart, endIndex);
13754
+ } else {
13755
+ this.cbs.oncomment(this.sectionStart, endIndex);
13756
+ }
13757
+ } else if (this.state === 6 || this.state === 11 || this.state === 18 || this.state === 17 || this.state === 12 || this.state === 13 || this.state === 14 || this.state === 15 || this.state === 16 || this.state === 20 || this.state === 19 || this.state === 21 || this.state === 9) ; else {
13758
+ this.cbs.ontext(this.sectionStart, endIndex);
13759
+ }
13760
+ }
13761
+ emitCodePoint(cp, consumed) {
13762
+ }
13763
+ }
13764
+
13765
+ const deprecationData = {
13766
+ ["COMPILER_IS_ON_ELEMENT"]: {
13767
+ 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:".`,
13768
+ link: `https://v3-migration.vuejs.org/breaking-changes/custom-elements-interop.html`
13769
+ },
13770
+ ["COMPILER_V_BIND_SYNC"]: {
13771
+ message: (key) => `.sync modifier for v-bind has been removed. Use v-model with argument instead. \`v-bind:${key}.sync\` should be changed to \`v-model:${key}\`.`,
13772
+ link: `https://v3-migration.vuejs.org/breaking-changes/v-model.html`
13773
+ },
13774
+ ["COMPILER_V_BIND_OBJECT_ORDER"]: {
13775
+ message: `v-bind="obj" usage is now order sensitive and behaves like JavaScript object spread: it will now overwrite an existing non-mergeable attribute that appears before v-bind in the case of conflict. To retain 2.x behavior, move v-bind to make it the first attribute. You can also suppress this warning if the usage is intended.`,
13776
+ link: `https://v3-migration.vuejs.org/breaking-changes/v-bind.html`
13777
+ },
13778
+ ["COMPILER_V_ON_NATIVE"]: {
13779
+ message: `.native modifier for v-on has been removed as is no longer necessary.`,
13780
+ link: `https://v3-migration.vuejs.org/breaking-changes/v-on-native-modifier-removed.html`
13781
+ },
13782
+ ["COMPILER_V_IF_V_FOR_PRECEDENCE"]: {
13783
+ message: `v-if / v-for precedence when used on the same element has changed in Vue 3: v-if now takes higher precedence and will no longer have access to v-for scope variables. It is best to avoid the ambiguity with <template> tags or use a computed property that filters v-for data source.`,
13784
+ link: `https://v3-migration.vuejs.org/breaking-changes/v-if-v-for.html`
13785
+ },
13786
+ ["COMPILER_NATIVE_TEMPLATE"]: {
13787
+ message: `<template> with no special directives will render as a native template element instead of its inner content in Vue 3.`
13788
+ },
13789
+ ["COMPILER_INLINE_TEMPLATE"]: {
13790
+ message: `"inline-template" has been removed in Vue 3.`,
13791
+ link: `https://v3-migration.vuejs.org/breaking-changes/inline-template-attribute.html`
13792
+ },
13793
+ ["COMPILER_FILTER"]: {
13794
+ message: `filters have been removed in Vue 3. The "|" symbol will be treated as native JavaScript bitwise OR operator. Use method calls or computed properties instead.`,
13795
+ link: `https://v3-migration.vuejs.org/breaking-changes/filters.html`
13796
+ }
13797
+ };
13798
+ function getCompatValue(key, { compatConfig }) {
13799
+ const value = compatConfig && compatConfig[key];
13800
+ if (key === "MODE") {
13801
+ return value || 3;
13802
+ } else {
13803
+ return value;
13804
+ }
13805
+ }
13806
+ function isCompatEnabled(key, context) {
13807
+ const mode = getCompatValue("MODE", context);
13808
+ const value = getCompatValue(key, context);
13809
+ return mode === 3 ? value === true : value !== false;
13810
+ }
13811
+ function checkCompatEnabled(key, context, loc, ...args) {
13812
+ const enabled = isCompatEnabled(key, context);
13813
+ if (enabled) {
13814
+ warnDeprecation(key, context, loc, ...args);
13815
+ }
13816
+ return enabled;
13817
+ }
13818
+ function warnDeprecation(key, context, loc, ...args) {
13819
+ const val = getCompatValue(key, context);
13820
+ if (val === "suppress-warning") {
13821
+ return;
13822
+ }
13823
+ const { message, link } = deprecationData[key];
13824
+ const msg = `(deprecation ${key}) ${typeof message === "function" ? message(...args) : message}${link ? `
13825
+ Details: ${link}` : ``}`;
13826
+ const err = new SyntaxError(msg);
13827
+ err.code = key;
13828
+ if (loc)
13829
+ err.loc = loc;
13830
+ context.onWarn(err);
13831
+ }
13832
+
13833
+ function defaultOnError(error) {
13834
+ throw error;
13835
+ }
13836
+ function defaultOnWarn(msg) {
13837
+ console.warn(`[Vue warn] ${msg.message}`);
13838
+ }
13839
+ function createCompilerError(code, loc, messages, additionalMessage) {
13840
+ const msg = (messages || errorMessages)[code] + (additionalMessage || ``) ;
13841
+ const error = new SyntaxError(String(msg));
13842
+ error.code = code;
13843
+ error.loc = loc;
13844
+ return error;
13845
+ }
13846
+ const errorMessages = {
13847
+ // parse errors
13848
+ [0]: "Illegal comment.",
13849
+ [1]: "CDATA section is allowed only in XML context.",
13850
+ [2]: "Duplicate attribute.",
13851
+ [3]: "End tag cannot have attributes.",
13852
+ [4]: "Illegal '/' in tags.",
13853
+ [5]: "Unexpected EOF in tag.",
13854
+ [6]: "Unexpected EOF in CDATA section.",
13855
+ [7]: "Unexpected EOF in comment.",
13856
+ [8]: "Unexpected EOF in script.",
13857
+ [9]: "Unexpected EOF in tag.",
13858
+ [10]: "Incorrectly closed comment.",
13859
+ [11]: "Incorrectly opened comment.",
13860
+ [12]: "Illegal tag name. Use '&lt;' to print '<'.",
13861
+ [13]: "Attribute value was expected.",
13862
+ [14]: "End tag name was expected.",
13863
+ [15]: "Whitespace was expected.",
13864
+ [16]: "Unexpected '<!--' in comment.",
13865
+ [17]: `Attribute name cannot contain U+0022 ("), U+0027 ('), and U+003C (<).`,
13866
+ [18]: "Unquoted attribute value cannot contain U+0022 (\"), U+0027 ('), U+003C (<), U+003D (=), and U+0060 (`).",
13867
+ [19]: "Attribute name cannot start with '='.",
13868
+ [21]: "'<?' is allowed only in XML context.",
13869
+ [20]: `Unexpected null character.`,
13870
+ [22]: "Illegal '/' in tags.",
13871
+ // Vue-specific parse errors
13872
+ [23]: "Invalid end tag.",
13873
+ [24]: "Element is missing end tag.",
13874
+ [25]: "Interpolation end sign was not found.",
13875
+ [27]: "End bracket for dynamic directive argument was not found. Note that dynamic directive argument cannot contain spaces.",
13876
+ [26]: "Legal directive name was expected.",
13877
+ // transform errors
13878
+ [28]: `v-if/v-else-if is missing expression.`,
13879
+ [29]: `v-if/else branches must use unique keys.`,
13880
+ [30]: `v-else/v-else-if has no adjacent v-if or v-else-if.`,
13881
+ [31]: `v-for is missing expression.`,
13882
+ [32]: `v-for has invalid expression.`,
13883
+ [33]: `<template v-for> key should be placed on the <template> tag.`,
13884
+ [34]: `v-bind is missing expression.`,
13885
+ [35]: `v-on is missing expression.`,
13886
+ [36]: `Unexpected custom directive on <slot> outlet.`,
13887
+ [37]: `Mixed v-slot usage on both the component and nested <template>. When there are multiple named slots, all slots should use <template> syntax to avoid scope ambiguity.`,
13888
+ [38]: `Duplicate slot names found. `,
13889
+ [39]: `Extraneous children found when component already has explicitly named default slot. These children will be ignored.`,
13890
+ [40]: `v-slot can only be used on components or <template> tags.`,
13891
+ [41]: `v-model is missing expression.`,
13892
+ [42]: `v-model value must be a valid JavaScript member expression.`,
13893
+ [43]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`,
13894
+ [44]: `v-model cannot be used on a prop, because local prop bindings are not writable.
13895
+ Use a v-bind binding combined with a v-on listener that emits update:x event instead.`,
13896
+ [45]: `Error parsing JavaScript expression: `,
13897
+ [46]: `<KeepAlive> expects exactly one child component.`,
13898
+ // generic errors
13899
+ [47]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
13900
+ [48]: `ES module mode is not supported in this build of compiler.`,
13901
+ [49]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
13902
+ [50]: `"scopeId" option is only supported in module mode.`,
13903
+ // deprecations
13904
+ [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.`,
13905
+ [52]: `v-is="component-name" has been deprecated. Use is="vue:component-name" instead. v-is support will be removed in 3.4.`,
13906
+ // just to fulfill types
13907
+ [53]: ``
13908
+ };
13909
+
13910
+ const isStaticExp = (p) => p.type === 4 && p.isStatic;
13911
+ function isCoreComponent(tag) {
13912
+ switch (tag) {
13913
+ case "Teleport":
13914
+ case "teleport":
13915
+ return TELEPORT;
13916
+ case "Suspense":
13917
+ case "suspense":
13918
+ return SUSPENSE;
13919
+ case "KeepAlive":
13920
+ case "keep-alive":
13921
+ return KEEP_ALIVE;
13922
+ case "BaseTransition":
13923
+ case "base-transition":
13924
+ return BASE_TRANSITION;
13925
+ }
13926
+ }
13927
+ const nonIdentifierRE = /^\d|[^\$\w]/;
13928
+ const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
13929
+ const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
13930
+ const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
13931
+ const whitespaceRE = /\s+[.[]\s*|\s*[.[]\s+/g;
13932
+ const isMemberExpressionBrowser = (path) => {
13933
+ path = path.trim().replace(whitespaceRE, (s) => s.trim());
13934
+ let state = 0 /* inMemberExp */;
13935
+ let stateStack = [];
13936
+ let currentOpenBracketCount = 0;
13937
+ let currentOpenParensCount = 0;
13938
+ let currentStringType = null;
13939
+ for (let i = 0; i < path.length; i++) {
13940
+ const char = path.charAt(i);
13941
+ switch (state) {
13942
+ case 0 /* inMemberExp */:
13943
+ if (char === "[") {
13944
+ stateStack.push(state);
13945
+ state = 1 /* inBrackets */;
13946
+ currentOpenBracketCount++;
13041
13947
  } else if (char === "(") {
13042
13948
  stateStack.push(state);
13043
13949
  state = 2 /* inParens */;
@@ -13086,43 +13992,6 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
13086
13992
  return !currentOpenBracketCount && !currentOpenParensCount;
13087
13993
  };
13088
13994
  const isMemberExpression = isMemberExpressionBrowser ;
13089
- function getInnerRange(loc, offset, length) {
13090
- const source = loc.source.slice(offset, offset + length);
13091
- const newLoc = {
13092
- source,
13093
- start: advancePositionWithClone(loc.start, loc.source, offset),
13094
- end: loc.end
13095
- };
13096
- if (length != null) {
13097
- newLoc.end = advancePositionWithClone(
13098
- loc.start,
13099
- loc.source,
13100
- offset + length
13101
- );
13102
- }
13103
- return newLoc;
13104
- }
13105
- function advancePositionWithClone(pos, source, numberOfCharacters = source.length) {
13106
- return advancePositionWithMutation(
13107
- extend({}, pos),
13108
- source,
13109
- numberOfCharacters
13110
- );
13111
- }
13112
- function advancePositionWithMutation(pos, source, numberOfCharacters = source.length) {
13113
- let linesCount = 0;
13114
- let lastNewLinePos = -1;
13115
- for (let i = 0; i < numberOfCharacters; i++) {
13116
- if (source.charCodeAt(i) === 10) {
13117
- linesCount++;
13118
- lastNewLinePos = i;
13119
- }
13120
- }
13121
- pos.offset += numberOfCharacters;
13122
- pos.line += linesCount;
13123
- pos.column = lastNewLinePos === -1 ? pos.column + numberOfCharacters : numberOfCharacters - lastNewLinePos;
13124
- return pos;
13125
- }
13126
13995
  function assert(condition, msg) {
13127
13996
  if (!condition) {
13128
13997
  throw new Error(msg || `unexpected compiler condition`);
@@ -13229,508 +14098,599 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
13229
14098
  if (parentCall && parentCall.callee === GUARD_REACTIVE_PROPS) {
13230
14099
  parentCall = callPath[callPath.length - 2];
13231
14100
  }
13232
- }
13233
- if (node.type === 13) {
13234
- if (parentCall) {
13235
- parentCall.arguments[0] = propsWithInjection;
13236
- } else {
13237
- node.props = propsWithInjection;
13238
- }
13239
- } else {
13240
- if (parentCall) {
13241
- parentCall.arguments[0] = propsWithInjection;
13242
- } else {
13243
- node.arguments[2] = propsWithInjection;
13244
- }
13245
- }
13246
- }
13247
- function hasProp(prop, props) {
13248
- let result = false;
13249
- if (prop.key.type === 4) {
13250
- const propKeyName = prop.key.content;
13251
- result = props.properties.some(
13252
- (p) => p.key.type === 4 && p.key.content === propKeyName
13253
- );
13254
- }
13255
- return result;
13256
- }
13257
- function toValidAssetId(name, type) {
13258
- return `_${type}_${name.replace(/[^\w]/g, (searchValue, replaceValue) => {
13259
- return searchValue === "-" ? "_" : name.charCodeAt(replaceValue).toString();
13260
- })}`;
13261
- }
13262
- function getMemoedVNodeCall(node) {
13263
- if (node.type === 14 && node.callee === WITH_MEMO) {
13264
- return node.arguments[1].returns;
13265
- } else {
13266
- return node;
13267
- }
13268
- }
13269
-
13270
- const deprecationData = {
13271
- ["COMPILER_IS_ON_ELEMENT"]: {
13272
- 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:".`,
13273
- link: `https://v3-migration.vuejs.org/breaking-changes/custom-elements-interop.html`
13274
- },
13275
- ["COMPILER_V_BIND_SYNC"]: {
13276
- message: (key) => `.sync modifier for v-bind has been removed. Use v-model with argument instead. \`v-bind:${key}.sync\` should be changed to \`v-model:${key}\`.`,
13277
- link: `https://v3-migration.vuejs.org/breaking-changes/v-model.html`
13278
- },
13279
- ["COMPILER_V_BIND_PROP"]: {
13280
- message: `.prop modifier for v-bind has been removed and no longer necessary. Vue 3 will automatically set a binding as DOM property when appropriate.`
13281
- },
13282
- ["COMPILER_V_BIND_OBJECT_ORDER"]: {
13283
- message: `v-bind="obj" usage is now order sensitive and behaves like JavaScript object spread: it will now overwrite an existing non-mergeable attribute that appears before v-bind in the case of conflict. To retain 2.x behavior, move v-bind to make it the first attribute. You can also suppress this warning if the usage is intended.`,
13284
- link: `https://v3-migration.vuejs.org/breaking-changes/v-bind.html`
13285
- },
13286
- ["COMPILER_V_ON_NATIVE"]: {
13287
- message: `.native modifier for v-on has been removed as is no longer necessary.`,
13288
- link: `https://v3-migration.vuejs.org/breaking-changes/v-on-native-modifier-removed.html`
13289
- },
13290
- ["COMPILER_V_IF_V_FOR_PRECEDENCE"]: {
13291
- message: `v-if / v-for precedence when used on the same element has changed in Vue 3: v-if now takes higher precedence and will no longer have access to v-for scope variables. It is best to avoid the ambiguity with <template> tags or use a computed property that filters v-for data source.`,
13292
- link: `https://v3-migration.vuejs.org/breaking-changes/v-if-v-for.html`
13293
- },
13294
- ["COMPILER_NATIVE_TEMPLATE"]: {
13295
- message: `<template> with no special directives will render as a native template element instead of its inner content in Vue 3.`
13296
- },
13297
- ["COMPILER_INLINE_TEMPLATE"]: {
13298
- message: `"inline-template" has been removed in Vue 3.`,
13299
- link: `https://v3-migration.vuejs.org/breaking-changes/inline-template-attribute.html`
13300
- },
13301
- ["COMPILER_FILTER"]: {
13302
- message: `filters have been removed in Vue 3. The "|" symbol will be treated as native JavaScript bitwise OR operator. Use method calls or computed properties instead.`,
13303
- link: `https://v3-migration.vuejs.org/breaking-changes/filters.html`
13304
- }
13305
- };
13306
- function getCompatValue(key, context) {
13307
- const config = context.options ? context.options.compatConfig : context.compatConfig;
13308
- const value = config && config[key];
13309
- if (key === "MODE") {
13310
- return value || 3;
14101
+ }
14102
+ if (node.type === 13) {
14103
+ if (parentCall) {
14104
+ parentCall.arguments[0] = propsWithInjection;
14105
+ } else {
14106
+ node.props = propsWithInjection;
14107
+ }
13311
14108
  } else {
13312
- return value;
14109
+ if (parentCall) {
14110
+ parentCall.arguments[0] = propsWithInjection;
14111
+ } else {
14112
+ node.arguments[2] = propsWithInjection;
14113
+ }
13313
14114
  }
13314
14115
  }
13315
- function isCompatEnabled(key, context) {
13316
- const mode = getCompatValue("MODE", context);
13317
- const value = getCompatValue(key, context);
13318
- return mode === 3 ? value === true : value !== false;
13319
- }
13320
- function checkCompatEnabled(key, context, loc, ...args) {
13321
- const enabled = isCompatEnabled(key, context);
13322
- if (enabled) {
13323
- warnDeprecation(key, context, loc, ...args);
14116
+ function hasProp(prop, props) {
14117
+ let result = false;
14118
+ if (prop.key.type === 4) {
14119
+ const propKeyName = prop.key.content;
14120
+ result = props.properties.some(
14121
+ (p) => p.key.type === 4 && p.key.content === propKeyName
14122
+ );
13324
14123
  }
13325
- return enabled;
14124
+ return result;
13326
14125
  }
13327
- function warnDeprecation(key, context, loc, ...args) {
13328
- const val = getCompatValue(key, context);
13329
- if (val === "suppress-warning") {
13330
- return;
14126
+ function toValidAssetId(name, type) {
14127
+ return `_${type}_${name.replace(/[^\w]/g, (searchValue, replaceValue) => {
14128
+ return searchValue === "-" ? "_" : name.charCodeAt(replaceValue).toString();
14129
+ })}`;
14130
+ }
14131
+ function getMemoedVNodeCall(node) {
14132
+ if (node.type === 14 && node.callee === WITH_MEMO) {
14133
+ return node.arguments[1].returns;
14134
+ } else {
14135
+ return node;
13331
14136
  }
13332
- const { message, link } = deprecationData[key];
13333
- const msg = `(deprecation ${key}) ${typeof message === "function" ? message(...args) : message}${link ? `
13334
- Details: ${link}` : ``}`;
13335
- const err = new SyntaxError(msg);
13336
- err.code = key;
13337
- if (loc)
13338
- err.loc = loc;
13339
- context.onWarn(err);
13340
14137
  }
14138
+ const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
13341
14139
 
13342
- const decodeRE = /&(gt|lt|amp|apos|quot);/g;
13343
- const decodeMap = {
13344
- gt: ">",
13345
- lt: "<",
13346
- amp: "&",
13347
- apos: "'",
13348
- quot: '"'
13349
- };
13350
14140
  const defaultParserOptions = {
14141
+ parseMode: "base",
14142
+ ns: 0,
13351
14143
  delimiters: [`{{`, `}}`],
13352
14144
  getNamespace: () => 0,
13353
- getTextMode: () => 0,
13354
14145
  isVoidTag: NO,
13355
14146
  isPreTag: NO,
13356
14147
  isCustomElement: NO,
13357
- decodeEntities: (rawText) => rawText.replace(decodeRE, (_, p1) => decodeMap[p1]),
13358
14148
  onError: defaultOnError,
13359
14149
  onWarn: defaultOnWarn,
13360
14150
  comments: true
13361
14151
  };
13362
- function baseParse(content, options = {}) {
13363
- const context = createParserContext(content, options);
13364
- const start = getCursor(context);
13365
- return createRoot(
13366
- parseChildren(context, 0, []),
13367
- getSelection(context, start)
13368
- );
13369
- }
13370
- function createParserContext(content, rawOptions) {
13371
- const options = extend({}, defaultParserOptions);
13372
- let key;
13373
- for (key in rawOptions) {
13374
- options[key] = rawOptions[key] === void 0 ? defaultParserOptions[key] : rawOptions[key];
13375
- }
13376
- return {
13377
- options,
13378
- column: 1,
13379
- line: 1,
13380
- offset: 0,
13381
- originalSource: content,
13382
- source: content,
13383
- inPre: false,
13384
- inVPre: false,
13385
- onWarn: options.onWarn
13386
- };
13387
- }
13388
- function parseChildren(context, mode, ancestors) {
13389
- const parent = last(ancestors);
13390
- const ns = parent ? parent.ns : 0;
13391
- const nodes = [];
13392
- while (!isEnd(context, mode, ancestors)) {
13393
- const s = context.source;
13394
- let node = void 0;
13395
- if (mode === 0 || mode === 1) {
13396
- if (!context.inVPre && startsWith(s, context.options.delimiters[0])) {
13397
- node = parseInterpolation(context, mode);
13398
- } else if (mode === 0 && s[0] === "<") {
13399
- if (s.length === 1) {
13400
- emitError(context, 5, 1);
13401
- } else if (s[1] === "!") {
13402
- if (startsWith(s, "<!--")) {
13403
- node = parseComment(context);
13404
- } else if (startsWith(s, "<!DOCTYPE")) {
13405
- node = parseBogusComment(context);
13406
- } else if (startsWith(s, "<![CDATA[")) {
13407
- if (ns !== 0) {
13408
- node = parseCDATA(context, ancestors);
13409
- } else {
13410
- emitError(context, 1);
13411
- node = parseBogusComment(context);
13412
- }
13413
- } else {
13414
- emitError(context, 11);
13415
- node = parseBogusComment(context);
14152
+ let currentOptions = defaultParserOptions;
14153
+ let currentRoot = null;
14154
+ let currentInput = "";
14155
+ let currentOpenTag = null;
14156
+ let currentProp = null;
14157
+ let currentAttrValue = "";
14158
+ let currentAttrStartIndex = -1;
14159
+ let currentAttrEndIndex = -1;
14160
+ let inPre = 0;
14161
+ let inVPre = false;
14162
+ let currentVPreBoundary = null;
14163
+ const stack = [];
14164
+ const tokenizer = new Tokenizer(stack, {
14165
+ onerr: emitError,
14166
+ ontext(start, end) {
14167
+ onText(getSlice(start, end), start, end);
14168
+ },
14169
+ ontextentity(char, start, end) {
14170
+ onText(char, start, end);
14171
+ },
14172
+ oninterpolation(start, end) {
14173
+ if (inVPre) {
14174
+ return onText(getSlice(start, end), start, end);
14175
+ }
14176
+ let innerStart = start + tokenizer.delimiterOpen.length;
14177
+ let innerEnd = end - tokenizer.delimiterClose.length;
14178
+ while (isWhitespace(currentInput.charCodeAt(innerStart))) {
14179
+ innerStart++;
14180
+ }
14181
+ while (isWhitespace(currentInput.charCodeAt(innerEnd - 1))) {
14182
+ innerEnd--;
14183
+ }
14184
+ let exp = getSlice(innerStart, innerEnd);
14185
+ if (exp.includes("&")) {
14186
+ {
14187
+ exp = currentOptions.decodeEntities(exp, false);
14188
+ }
14189
+ }
14190
+ addNode({
14191
+ type: 5,
14192
+ content: createSimpleExpression(exp, false, getLoc(innerStart, innerEnd)),
14193
+ loc: getLoc(start, end)
14194
+ });
14195
+ },
14196
+ onopentagname(start, end) {
14197
+ const name = getSlice(start, end);
14198
+ currentOpenTag = {
14199
+ type: 1,
14200
+ tag: name,
14201
+ ns: currentOptions.getNamespace(name, stack[0], currentOptions.ns),
14202
+ tagType: 0,
14203
+ // will be refined on tag close
14204
+ props: [],
14205
+ children: [],
14206
+ loc: getLoc(start - 1, end),
14207
+ codegenNode: void 0
14208
+ };
14209
+ if (tokenizer.inSFCRoot) {
14210
+ currentOpenTag.innerLoc = getLoc(
14211
+ end + fastForward(end) + 1,
14212
+ end
14213
+ );
14214
+ }
14215
+ },
14216
+ onopentagend(end) {
14217
+ endOpenTag(end);
14218
+ },
14219
+ onclosetag(start, end) {
14220
+ const name = getSlice(start, end);
14221
+ if (!currentOptions.isVoidTag(name)) {
14222
+ let found = false;
14223
+ for (let i = 0; i < stack.length; i++) {
14224
+ const e = stack[i];
14225
+ if (e.tag.toLowerCase() === name.toLowerCase()) {
14226
+ found = true;
14227
+ if (i > 0) {
14228
+ emitError(24, stack[0].loc.start.offset);
13416
14229
  }
13417
- } else if (s[1] === "/") {
13418
- if (s.length === 2) {
13419
- emitError(context, 5, 2);
13420
- } else if (s[2] === ">") {
13421
- emitError(context, 14, 2);
13422
- advanceBy(context, 3);
13423
- continue;
13424
- } else if (/[a-z]/i.test(s[2])) {
13425
- emitError(context, 23);
13426
- parseTag(context, 1 /* End */, parent);
13427
- continue;
13428
- } else {
13429
- emitError(
13430
- context,
13431
- 12,
13432
- 2
13433
- );
13434
- node = parseBogusComment(context);
14230
+ for (let j = 0; j <= i; j++) {
14231
+ const el = stack.shift();
14232
+ onCloseTag(el, end, j < i);
13435
14233
  }
13436
- } else if (/[a-z]/i.test(s[1])) {
13437
- node = parseElement(context, ancestors);
13438
- if (isCompatEnabled(
13439
- "COMPILER_NATIVE_TEMPLATE",
13440
- context
13441
- ) && node && node.tag === "template" && !node.props.some(
13442
- (p) => p.type === 7 && isSpecialTemplateDirective(p.name)
13443
- )) {
13444
- warnDeprecation(
13445
- "COMPILER_NATIVE_TEMPLATE",
13446
- context,
13447
- node.loc
13448
- );
13449
- node = node.children;
14234
+ break;
14235
+ }
14236
+ }
14237
+ if (!found) {
14238
+ emitError(23, backTrack(start, 60));
14239
+ }
14240
+ }
14241
+ },
14242
+ onselfclosingtag(end) {
14243
+ var _a;
14244
+ const name = currentOpenTag.tag;
14245
+ currentOpenTag.isSelfClosing = true;
14246
+ endOpenTag(end);
14247
+ if (((_a = stack[0]) == null ? void 0 : _a.tag) === name) {
14248
+ onCloseTag(stack.shift(), end);
14249
+ }
14250
+ },
14251
+ onattribname(start, end) {
14252
+ currentProp = {
14253
+ type: 6,
14254
+ name: getSlice(start, end),
14255
+ nameLoc: getLoc(start, end),
14256
+ value: void 0,
14257
+ loc: getLoc(start)
14258
+ };
14259
+ },
14260
+ ondirname(start, end) {
14261
+ const raw = getSlice(start, end);
14262
+ const name = raw === "." || raw === ":" ? "bind" : raw === "@" ? "on" : raw === "#" ? "slot" : raw.slice(2);
14263
+ if (!inVPre && name === "") {
14264
+ emitError(26, start);
14265
+ }
14266
+ if (inVPre || name === "") {
14267
+ currentProp = {
14268
+ type: 6,
14269
+ name: raw,
14270
+ nameLoc: getLoc(start, end),
14271
+ value: void 0,
14272
+ loc: getLoc(start)
14273
+ };
14274
+ } else {
14275
+ currentProp = {
14276
+ type: 7,
14277
+ name,
14278
+ rawName: raw,
14279
+ exp: void 0,
14280
+ arg: void 0,
14281
+ modifiers: raw === "." ? ["prop"] : [],
14282
+ loc: getLoc(start)
14283
+ };
14284
+ if (name === "pre") {
14285
+ inVPre = true;
14286
+ currentVPreBoundary = currentOpenTag;
14287
+ const props = currentOpenTag.props;
14288
+ for (let i = 0; i < props.length; i++) {
14289
+ if (props[i].type === 7) {
14290
+ props[i] = dirToAttr(props[i]);
13450
14291
  }
13451
- } else if (s[1] === "?") {
13452
- emitError(
13453
- context,
13454
- 21,
13455
- 1
13456
- );
13457
- node = parseBogusComment(context);
13458
- } else {
13459
- emitError(context, 12, 1);
13460
14292
  }
13461
14293
  }
13462
14294
  }
13463
- if (!node) {
13464
- node = parseText(context, mode);
14295
+ },
14296
+ ondirarg(start, end) {
14297
+ if (start === end)
14298
+ return;
14299
+ const arg = getSlice(start, end);
14300
+ if (inVPre) {
14301
+ currentProp.name += arg;
14302
+ setLocEnd(currentProp.nameLoc, end);
14303
+ } else {
14304
+ const isStatic = arg[0] !== `[`;
14305
+ currentProp.arg = createSimpleExpression(
14306
+ isStatic ? arg : arg.slice(1, -1),
14307
+ isStatic,
14308
+ getLoc(start, end),
14309
+ isStatic ? 3 : 0
14310
+ );
13465
14311
  }
13466
- if (isArray(node)) {
13467
- for (let i = 0; i < node.length; i++) {
13468
- pushNode(nodes, node[i]);
14312
+ },
14313
+ ondirmodifier(start, end) {
14314
+ const mod = getSlice(start, end);
14315
+ if (inVPre) {
14316
+ currentProp.name += "." + mod;
14317
+ setLocEnd(currentProp.nameLoc, end);
14318
+ } else if (currentProp.name === "slot") {
14319
+ const arg = currentProp.arg;
14320
+ if (arg) {
14321
+ arg.content += "." + mod;
14322
+ setLocEnd(arg.loc, end);
13469
14323
  }
13470
14324
  } else {
13471
- pushNode(nodes, node);
14325
+ currentProp.modifiers.push(mod);
13472
14326
  }
13473
- }
13474
- let removedWhitespace = false;
13475
- if (mode !== 2 && mode !== 1) {
13476
- const shouldCondense = context.options.whitespace !== "preserve";
13477
- for (let i = 0; i < nodes.length; i++) {
13478
- const node = nodes[i];
13479
- if (node.type === 2) {
13480
- if (!context.inPre) {
13481
- if (!/[^\t\r\n\f ]/.test(node.content)) {
13482
- const prev = nodes[i - 1];
13483
- const next = nodes[i + 1];
13484
- if (!prev || !next || shouldCondense && (prev.type === 3 && next.type === 3 || prev.type === 3 && next.type === 1 || prev.type === 1 && next.type === 3 || prev.type === 1 && next.type === 1 && /[\r\n]/.test(node.content))) {
13485
- removedWhitespace = true;
13486
- nodes[i] = null;
13487
- } else {
13488
- node.content = " ";
13489
- }
13490
- } else if (shouldCondense) {
13491
- node.content = node.content.replace(/[\t\r\n\f ]+/g, " ");
14327
+ },
14328
+ onattribdata(start, end) {
14329
+ currentAttrValue += getSlice(start, end);
14330
+ if (currentAttrStartIndex < 0)
14331
+ currentAttrStartIndex = start;
14332
+ currentAttrEndIndex = end;
14333
+ },
14334
+ onattribentity(char, start, end) {
14335
+ currentAttrValue += char;
14336
+ if (currentAttrStartIndex < 0)
14337
+ currentAttrStartIndex = start;
14338
+ currentAttrEndIndex = end;
14339
+ },
14340
+ onattribnameend(end) {
14341
+ const start = currentProp.loc.start.offset;
14342
+ const name = getSlice(start, end);
14343
+ if (currentProp.type === 7) {
14344
+ currentProp.rawName = name;
14345
+ }
14346
+ if (currentOpenTag.props.some(
14347
+ (p) => (p.type === 7 ? p.rawName : p.name) === name
14348
+ )) {
14349
+ emitError(2, start);
14350
+ }
14351
+ },
14352
+ onattribend(quote, end) {
14353
+ if (currentOpenTag && currentProp) {
14354
+ setLocEnd(currentProp.loc, end);
14355
+ if (quote !== 0) {
14356
+ if (currentAttrValue.includes("&")) {
14357
+ currentAttrValue = currentOptions.decodeEntities(
14358
+ currentAttrValue,
14359
+ true
14360
+ );
14361
+ }
14362
+ if (currentProp.type === 6) {
14363
+ if (currentProp.name === "class") {
14364
+ currentAttrValue = condense(currentAttrValue).trim();
14365
+ }
14366
+ if (quote === 1 && !currentAttrValue) {
14367
+ emitError(13, end);
14368
+ }
14369
+ currentProp.value = {
14370
+ type: 2,
14371
+ content: currentAttrValue,
14372
+ loc: quote === 1 ? getLoc(currentAttrStartIndex, currentAttrEndIndex) : getLoc(currentAttrStartIndex - 1, currentAttrEndIndex + 1)
14373
+ };
14374
+ if (tokenizer.inSFCRoot && currentOpenTag.tag === "template" && currentProp.name === "lang" && currentAttrValue && currentAttrValue !== "html") {
14375
+ tokenizer.enterRCDATA(toCharCodes(`</template`), 0);
13492
14376
  }
13493
14377
  } else {
13494
- node.content = node.content.replace(/\r\n/g, "\n");
14378
+ currentProp.exp = createSimpleExpression(
14379
+ currentAttrValue,
14380
+ false,
14381
+ getLoc(currentAttrStartIndex, currentAttrEndIndex)
14382
+ );
14383
+ if (currentProp.name === "for") {
14384
+ currentProp.forParseResult = parseForExpression(currentProp.exp);
14385
+ }
14386
+ let syncIndex = -1;
14387
+ if (currentProp.name === "bind" && (syncIndex = currentProp.modifiers.indexOf("sync")) > -1 && checkCompatEnabled(
14388
+ "COMPILER_V_BIND_SYNC",
14389
+ currentOptions,
14390
+ currentProp.loc,
14391
+ currentProp.rawName
14392
+ )) {
14393
+ currentProp.name = "model";
14394
+ currentProp.modifiers.splice(syncIndex, 1);
14395
+ }
13495
14396
  }
13496
- } else if (node.type === 3 && !context.options.comments) {
13497
- removedWhitespace = true;
13498
- nodes[i] = null;
13499
14397
  }
14398
+ if (currentProp.type !== 7 || currentProp.name !== "pre") {
14399
+ currentOpenTag.props.push(currentProp);
14400
+ }
14401
+ }
14402
+ currentAttrValue = "";
14403
+ currentAttrStartIndex = currentAttrEndIndex = -1;
14404
+ },
14405
+ oncomment(start, end) {
14406
+ if (currentOptions.comments) {
14407
+ addNode({
14408
+ type: 3,
14409
+ content: getSlice(start, end),
14410
+ loc: getLoc(start - 4, end + 3)
14411
+ });
13500
14412
  }
13501
- if (context.inPre && parent && context.options.isPreTag(parent.tag)) {
13502
- const first = nodes[0];
13503
- if (first && first.type === 2) {
13504
- first.content = first.content.replace(/^\r?\n/, "");
14413
+ },
14414
+ onend() {
14415
+ const end = currentInput.length;
14416
+ if (tokenizer.state !== 1) {
14417
+ switch (tokenizer.state) {
14418
+ case 5:
14419
+ case 8:
14420
+ emitError(5, end);
14421
+ break;
14422
+ case 3:
14423
+ case 4:
14424
+ emitError(
14425
+ 25,
14426
+ tokenizer.sectionStart
14427
+ );
14428
+ break;
14429
+ case 28:
14430
+ if (tokenizer.currentSequence === Sequences.CdataEnd) {
14431
+ emitError(6, end);
14432
+ } else {
14433
+ emitError(7, end);
14434
+ }
14435
+ break;
14436
+ case 6:
14437
+ case 7:
14438
+ case 9:
14439
+ case 11:
14440
+ case 12:
14441
+ case 13:
14442
+ case 14:
14443
+ case 15:
14444
+ case 16:
14445
+ case 17:
14446
+ case 18:
14447
+ case 19:
14448
+ case 20:
14449
+ case 21:
14450
+ emitError(9, end);
14451
+ break;
13505
14452
  }
13506
14453
  }
13507
- }
13508
- return removedWhitespace ? nodes.filter(Boolean) : nodes;
13509
- }
13510
- function pushNode(nodes, node) {
13511
- if (node.type === 2) {
13512
- const prev = last(nodes);
13513
- if (prev && prev.type === 2 && prev.loc.end.offset === node.loc.start.offset) {
13514
- prev.content += node.content;
13515
- prev.loc.end = node.loc.end;
13516
- prev.loc.source += node.loc.source;
13517
- return;
14454
+ for (let index = 0; index < stack.length; index++) {
14455
+ onCloseTag(stack[index], end - 1);
14456
+ emitError(24, stack[index].loc.start.offset);
13518
14457
  }
13519
- }
13520
- nodes.push(node);
13521
- }
13522
- function parseCDATA(context, ancestors) {
13523
- advanceBy(context, 9);
13524
- const nodes = parseChildren(context, 3, ancestors);
13525
- if (context.source.length === 0) {
13526
- emitError(context, 6);
13527
- } else {
13528
- advanceBy(context, 3);
13529
- }
13530
- return nodes;
13531
- }
13532
- function parseComment(context) {
13533
- const start = getCursor(context);
13534
- let content;
13535
- const match = /--(\!)?>/.exec(context.source);
13536
- if (!match) {
13537
- content = context.source.slice(4);
13538
- advanceBy(context, context.source.length);
13539
- emitError(context, 7);
13540
- } else {
13541
- if (match.index <= 3) {
13542
- emitError(context, 0);
14458
+ },
14459
+ oncdata(start, end) {
14460
+ if (stack[0].ns !== 0) {
14461
+ onText(getSlice(start, end), start, end);
14462
+ } else {
14463
+ emitError(1, start - 9);
14464
+ }
14465
+ },
14466
+ onprocessinginstruction(start) {
14467
+ if ((stack[0] ? stack[0].ns : currentOptions.ns) === 0) {
14468
+ emitError(
14469
+ 21,
14470
+ start - 1
14471
+ );
13543
14472
  }
13544
- if (match[1]) {
13545
- emitError(context, 10);
14473
+ }
14474
+ });
14475
+ const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
14476
+ const stripParensRE = /^\(|\)$/g;
14477
+ function parseForExpression(input) {
14478
+ const loc = input.loc;
14479
+ const exp = input.content;
14480
+ const inMatch = exp.match(forAliasRE);
14481
+ if (!inMatch)
14482
+ return;
14483
+ const [, LHS, RHS] = inMatch;
14484
+ const createAliasExpression = (content, offset) => {
14485
+ const start = loc.start.offset + offset;
14486
+ const end = start + content.length;
14487
+ return createSimpleExpression(content, false, getLoc(start, end));
14488
+ };
14489
+ const result = {
14490
+ source: createAliasExpression(RHS.trim(), exp.indexOf(RHS, LHS.length)),
14491
+ value: void 0,
14492
+ key: void 0,
14493
+ index: void 0,
14494
+ finalized: false
14495
+ };
14496
+ let valueContent = LHS.trim().replace(stripParensRE, "").trim();
14497
+ const trimmedOffset = LHS.indexOf(valueContent);
14498
+ const iteratorMatch = valueContent.match(forIteratorRE);
14499
+ if (iteratorMatch) {
14500
+ valueContent = valueContent.replace(forIteratorRE, "").trim();
14501
+ const keyContent = iteratorMatch[1].trim();
14502
+ let keyOffset;
14503
+ if (keyContent) {
14504
+ keyOffset = exp.indexOf(keyContent, trimmedOffset + valueContent.length);
14505
+ result.key = createAliasExpression(keyContent, keyOffset);
13546
14506
  }
13547
- content = context.source.slice(4, match.index);
13548
- const s = context.source.slice(0, match.index);
13549
- let prevIndex = 1, nestedIndex = 0;
13550
- while ((nestedIndex = s.indexOf("<!--", prevIndex)) !== -1) {
13551
- advanceBy(context, nestedIndex - prevIndex + 1);
13552
- if (nestedIndex + 4 < s.length) {
13553
- emitError(context, 16);
14507
+ if (iteratorMatch[2]) {
14508
+ const indexContent = iteratorMatch[2].trim();
14509
+ if (indexContent) {
14510
+ result.index = createAliasExpression(
14511
+ indexContent,
14512
+ exp.indexOf(
14513
+ indexContent,
14514
+ result.key ? keyOffset + keyContent.length : trimmedOffset + valueContent.length
14515
+ )
14516
+ );
13554
14517
  }
13555
- prevIndex = nestedIndex + 1;
13556
14518
  }
13557
- advanceBy(context, match.index + match[0].length - prevIndex + 1);
13558
14519
  }
13559
- return {
13560
- type: 3,
13561
- content,
13562
- loc: getSelection(context, start)
13563
- };
14520
+ if (valueContent) {
14521
+ result.value = createAliasExpression(valueContent, trimmedOffset);
14522
+ }
14523
+ return result;
14524
+ }
14525
+ function getSlice(start, end) {
14526
+ return currentInput.slice(start, end);
13564
14527
  }
13565
- function parseBogusComment(context) {
13566
- const start = getCursor(context);
13567
- const contentStart = context.source[1] === "?" ? 1 : 2;
13568
- let content;
13569
- const closeIndex = context.source.indexOf(">");
13570
- if (closeIndex === -1) {
13571
- content = context.source.slice(contentStart);
13572
- advanceBy(context, context.source.length);
14528
+ function endOpenTag(end) {
14529
+ addNode(currentOpenTag);
14530
+ const { tag, ns } = currentOpenTag;
14531
+ if (ns === 0 && currentOptions.isPreTag(tag)) {
14532
+ inPre++;
14533
+ }
14534
+ if (currentOptions.isVoidTag(tag)) {
14535
+ onCloseTag(currentOpenTag, end);
13573
14536
  } else {
13574
- content = context.source.slice(contentStart, closeIndex);
13575
- advanceBy(context, closeIndex + 1);
14537
+ stack.unshift(currentOpenTag);
14538
+ if (ns === 1 || ns === 2) {
14539
+ tokenizer.inXML = true;
14540
+ }
13576
14541
  }
13577
- return {
13578
- type: 3,
13579
- content,
13580
- loc: getSelection(context, start)
13581
- };
14542
+ currentOpenTag = null;
13582
14543
  }
13583
- function parseElement(context, ancestors) {
13584
- const wasInPre = context.inPre;
13585
- const wasInVPre = context.inVPre;
13586
- const parent = last(ancestors);
13587
- const element = parseTag(context, 0 /* Start */, parent);
13588
- const isPreBoundary = context.inPre && !wasInPre;
13589
- const isVPreBoundary = context.inVPre && !wasInVPre;
13590
- if (element.isSelfClosing || context.options.isVoidTag(element.tag)) {
13591
- if (isPreBoundary) {
13592
- context.inPre = false;
13593
- }
13594
- if (isVPreBoundary) {
13595
- context.inVPre = false;
13596
- }
13597
- return element;
13598
- }
13599
- ancestors.push(element);
13600
- const mode = context.options.getTextMode(element, parent);
13601
- const children = parseChildren(context, mode, ancestors);
13602
- ancestors.pop();
14544
+ function onText(content, start, end) {
14545
+ var _a;
13603
14546
  {
13604
- const inlineTemplateProp = element.props.find(
13605
- (p) => p.type === 6 && p.name === "inline-template"
13606
- );
13607
- if (inlineTemplateProp && checkCompatEnabled(
13608
- "COMPILER_INLINE_TEMPLATE",
13609
- context,
13610
- inlineTemplateProp.loc
13611
- )) {
13612
- const loc = getSelection(context, element.loc.end);
13613
- inlineTemplateProp.value = {
13614
- type: 2,
13615
- content: loc.source,
13616
- loc
13617
- };
14547
+ const tag = (_a = stack[0]) == null ? void 0 : _a.tag;
14548
+ if (tag !== "script" && tag !== "style" && content.includes("&")) {
14549
+ content = currentOptions.decodeEntities(content, false);
13618
14550
  }
13619
14551
  }
13620
- element.children = children;
13621
- if (startsWithEndTagOpen(context.source, element.tag)) {
13622
- parseTag(context, 1 /* End */, parent);
14552
+ const parent = stack[0] || currentRoot;
14553
+ const lastNode = parent.children[parent.children.length - 1];
14554
+ if ((lastNode == null ? void 0 : lastNode.type) === 2) {
14555
+ lastNode.content += content;
14556
+ setLocEnd(lastNode.loc, end);
13623
14557
  } else {
13624
- emitError(context, 24, 0, element.loc.start);
13625
- if (context.source.length === 0 && element.tag.toLowerCase() === "script") {
13626
- const first = children[0];
13627
- if (first && startsWith(first.loc.source, "<!--")) {
13628
- emitError(context, 8);
13629
- }
14558
+ parent.children.push({
14559
+ type: 2,
14560
+ content,
14561
+ loc: getLoc(start, end)
14562
+ });
14563
+ }
14564
+ }
14565
+ function onCloseTag(el, end, isImplied = false) {
14566
+ if (isImplied) {
14567
+ setLocEnd(el.loc, backTrack(end, 60));
14568
+ } else {
14569
+ setLocEnd(el.loc, end + fastForward(end) + 1);
14570
+ }
14571
+ if (tokenizer.inSFCRoot) {
14572
+ if (el.children.length) {
14573
+ el.innerLoc.end = extend({}, el.children[el.children.length - 1].loc.end);
14574
+ } else {
14575
+ el.innerLoc.end = extend({}, el.innerLoc.start);
14576
+ }
14577
+ el.innerLoc.source = getSlice(
14578
+ el.innerLoc.start.offset,
14579
+ el.innerLoc.end.offset
14580
+ );
14581
+ }
14582
+ const { tag, ns } = el;
14583
+ if (!inVPre) {
14584
+ if (tag === "slot") {
14585
+ el.tagType = 2;
14586
+ } else if (isFragmentTemplate(el)) {
14587
+ el.tagType = 3;
14588
+ } else if (isComponent(el)) {
14589
+ el.tagType = 1;
13630
14590
  }
13631
14591
  }
13632
- element.loc = getSelection(context, element.loc.start);
13633
- if (isPreBoundary) {
13634
- context.inPre = false;
14592
+ if (!tokenizer.inRCDATA) {
14593
+ el.children = condenseWhitespace(el.children, el.tag);
13635
14594
  }
13636
- if (isVPreBoundary) {
13637
- context.inVPre = false;
14595
+ if (ns === 0 && currentOptions.isPreTag(tag)) {
14596
+ inPre--;
13638
14597
  }
13639
- return element;
13640
- }
13641
- const isSpecialTemplateDirective = /* @__PURE__ */ makeMap(
13642
- `if,else,else-if,for,slot`
13643
- );
13644
- function parseTag(context, type, parent) {
13645
- const start = getCursor(context);
13646
- const match = /^<\/?([a-z][^\t\r\n\f />]*)/i.exec(context.source);
13647
- const tag = match[1];
13648
- const ns = context.options.getNamespace(tag, parent);
13649
- advanceBy(context, match[0].length);
13650
- advanceSpaces(context);
13651
- const cursor = getCursor(context);
13652
- const currentSource = context.source;
13653
- if (context.options.isPreTag(tag)) {
13654
- context.inPre = true;
13655
- }
13656
- let props = parseAttributes(context, type);
13657
- if (type === 0 /* Start */ && !context.inVPre && props.some((p) => p.type === 7 && p.name === "pre")) {
13658
- context.inVPre = true;
13659
- extend(context, cursor);
13660
- context.source = currentSource;
13661
- props = parseAttributes(context, type).filter((p) => p.name !== "v-pre");
13662
- }
13663
- let isSelfClosing = false;
13664
- if (context.source.length === 0) {
13665
- emitError(context, 9);
13666
- } else {
13667
- isSelfClosing = startsWith(context.source, "/>");
13668
- if (type === 1 /* End */ && isSelfClosing) {
13669
- emitError(context, 4);
14598
+ if (currentVPreBoundary === el) {
14599
+ inVPre = false;
14600
+ currentVPreBoundary = null;
14601
+ }
14602
+ if (tokenizer.inXML && (stack[0] ? stack[0].ns : currentOptions.ns) === 0) {
14603
+ tokenizer.inXML = false;
14604
+ }
14605
+ {
14606
+ const props = el.props;
14607
+ if (isCompatEnabled(
14608
+ "COMPILER_V_IF_V_FOR_PRECEDENCE",
14609
+ currentOptions
14610
+ )) {
14611
+ let hasIf = false;
14612
+ let hasFor = false;
14613
+ for (let i = 0; i < props.length; i++) {
14614
+ const p = props[i];
14615
+ if (p.type === 7) {
14616
+ if (p.name === "if") {
14617
+ hasIf = true;
14618
+ } else if (p.name === "for") {
14619
+ hasFor = true;
14620
+ }
14621
+ }
14622
+ if (hasIf && hasFor) {
14623
+ warnDeprecation(
14624
+ "COMPILER_V_IF_V_FOR_PRECEDENCE",
14625
+ currentOptions,
14626
+ el.loc
14627
+ );
14628
+ break;
14629
+ }
14630
+ }
14631
+ }
14632
+ if (isCompatEnabled(
14633
+ "COMPILER_NATIVE_TEMPLATE",
14634
+ currentOptions
14635
+ ) && el.tag === "template" && !isFragmentTemplate(el)) {
14636
+ warnDeprecation(
14637
+ "COMPILER_NATIVE_TEMPLATE",
14638
+ currentOptions,
14639
+ el.loc
14640
+ );
14641
+ const parent = stack[0] || currentRoot;
14642
+ const index = parent.children.indexOf(el);
14643
+ parent.children.splice(index, 1, ...el.children);
14644
+ }
14645
+ const inlineTemplateProp = props.find(
14646
+ (p) => p.type === 6 && p.name === "inline-template"
14647
+ );
14648
+ if (inlineTemplateProp && checkCompatEnabled(
14649
+ "COMPILER_INLINE_TEMPLATE",
14650
+ currentOptions,
14651
+ inlineTemplateProp.loc
14652
+ ) && el.children.length) {
14653
+ inlineTemplateProp.value = {
14654
+ type: 2,
14655
+ content: getSlice(
14656
+ el.children[0].loc.start.offset,
14657
+ el.children[el.children.length - 1].loc.end.offset
14658
+ ),
14659
+ loc: inlineTemplateProp.loc
14660
+ };
13670
14661
  }
13671
- advanceBy(context, isSelfClosing ? 2 : 1);
13672
14662
  }
13673
- if (type === 1 /* End */) {
13674
- return;
14663
+ }
14664
+ function fastForward(start, c) {
14665
+ let offset = 0;
14666
+ while (currentInput.charCodeAt(start + offset) !== 62 && start + offset < currentInput.length) {
14667
+ offset++;
13675
14668
  }
13676
- if (isCompatEnabled(
13677
- "COMPILER_V_IF_V_FOR_PRECEDENCE",
13678
- context
13679
- )) {
13680
- let hasIf = false;
13681
- let hasFor = false;
14669
+ return offset;
14670
+ }
14671
+ function backTrack(index, c) {
14672
+ let i = index;
14673
+ while (currentInput.charCodeAt(i) !== c && i >= 0)
14674
+ i--;
14675
+ return i;
14676
+ }
14677
+ const specialTemplateDir = /* @__PURE__ */ new Set(["if", "else", "else-if", "for", "slot"]);
14678
+ function isFragmentTemplate({ tag, props }) {
14679
+ if (tag === "template") {
13682
14680
  for (let i = 0; i < props.length; i++) {
13683
- const p = props[i];
13684
- if (p.type === 7) {
13685
- if (p.name === "if") {
13686
- hasIf = true;
13687
- } else if (p.name === "for") {
13688
- hasFor = true;
13689
- }
13690
- }
13691
- if (hasIf && hasFor) {
13692
- warnDeprecation(
13693
- "COMPILER_V_IF_V_FOR_PRECEDENCE",
13694
- context,
13695
- getSelection(context, start)
13696
- );
13697
- break;
13698
- }
13699
- }
13700
- }
13701
- let tagType = 0;
13702
- if (!context.inVPre) {
13703
- if (tag === "slot") {
13704
- tagType = 2;
13705
- } else if (tag === "template") {
13706
- if (props.some(
13707
- (p) => p.type === 7 && isSpecialTemplateDirective(p.name)
13708
- )) {
13709
- tagType = 3;
14681
+ if (props[i].type === 7 && specialTemplateDir.has(props[i].name)) {
14682
+ return true;
13710
14683
  }
13711
- } else if (isComponent(tag, props, context)) {
13712
- tagType = 1;
13713
14684
  }
13714
14685
  }
13715
- return {
13716
- type: 1,
13717
- ns,
13718
- tag,
13719
- tagType,
13720
- props,
13721
- isSelfClosing,
13722
- children: [],
13723
- loc: getSelection(context, start),
13724
- codegenNode: void 0
13725
- // to be created during transform phase
13726
- };
14686
+ return false;
13727
14687
  }
13728
- function isComponent(tag, props, context) {
13729
- const options = context.options;
13730
- if (options.isCustomElement(tag)) {
14688
+ function isComponent({ tag, props }) {
14689
+ var _a;
14690
+ if (currentOptions.isCustomElement(tag)) {
13731
14691
  return false;
13732
14692
  }
13733
- if (tag === "component" || /^[A-Z]/.test(tag) || isCoreComponent(tag) || options.isBuiltInComponent && options.isBuiltInComponent(tag) || options.isNativeTag && !options.isNativeTag(tag)) {
14693
+ if (tag === "component" || isUpperCase(tag.charCodeAt(0)) || isCoreComponent(tag) || ((_a = currentOptions.isBuiltInComponent) == null ? void 0 : _a.call(currentOptions, tag)) || currentOptions.isNativeTag && !currentOptions.isNativeTag(tag)) {
13734
14694
  return true;
13735
14695
  }
13736
14696
  for (let i = 0; i < props.length; i++) {
@@ -13741,374 +14701,179 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
13741
14701
  return true;
13742
14702
  } else if (checkCompatEnabled(
13743
14703
  "COMPILER_IS_ON_ELEMENT",
13744
- context,
14704
+ currentOptions,
13745
14705
  p.loc
13746
14706
  )) {
13747
14707
  return true;
13748
14708
  }
13749
14709
  }
13750
- } else {
13751
- if (p.name === "is") {
13752
- return true;
13753
- } else if (
13754
- // :is on plain element - only treat as component in compat mode
13755
- p.name === "bind" && isStaticArgOf(p.arg, "is") && true && checkCompatEnabled(
13756
- "COMPILER_IS_ON_ELEMENT",
13757
- context,
13758
- p.loc
13759
- )
13760
- ) {
13761
- return true;
13762
- }
14710
+ } else if (// :is on plain element - only treat as component in compat mode
14711
+ p.name === "bind" && isStaticArgOf(p.arg, "is") && checkCompatEnabled(
14712
+ "COMPILER_IS_ON_ELEMENT",
14713
+ currentOptions,
14714
+ p.loc
14715
+ )) {
14716
+ return true;
13763
14717
  }
13764
14718
  }
14719
+ return false;
13765
14720
  }
13766
- function parseAttributes(context, type) {
13767
- const props = [];
13768
- const attributeNames = /* @__PURE__ */ new Set();
13769
- while (context.source.length > 0 && !startsWith(context.source, ">") && !startsWith(context.source, "/>")) {
13770
- if (startsWith(context.source, "/")) {
13771
- emitError(context, 22);
13772
- advanceBy(context, 1);
13773
- advanceSpaces(context);
13774
- continue;
13775
- }
13776
- if (type === 1 /* End */) {
13777
- emitError(context, 3);
13778
- }
13779
- const attr = parseAttribute(context, attributeNames);
13780
- if (attr.type === 6 && attr.value && attr.name === "class") {
13781
- attr.value.content = attr.value.content.replace(/\s+/g, " ").trim();
13782
- }
13783
- if (type === 0 /* Start */) {
13784
- props.push(attr);
13785
- }
13786
- if (/^[^\t\r\n\f />]/.test(context.source)) {
13787
- emitError(context, 15);
13788
- }
13789
- advanceSpaces(context);
13790
- }
13791
- return props;
14721
+ function isUpperCase(c) {
14722
+ return c > 64 && c < 91;
13792
14723
  }
13793
- function parseAttribute(context, nameSet) {
13794
- var _a;
13795
- const start = getCursor(context);
13796
- const match = /^[^\t\r\n\f />][^\t\r\n\f />=]*/.exec(context.source);
13797
- const name = match[0];
13798
- if (nameSet.has(name)) {
13799
- emitError(context, 2);
13800
- }
13801
- nameSet.add(name);
13802
- if (name[0] === "=") {
13803
- emitError(context, 19);
13804
- }
13805
- {
13806
- const pattern = /["'<]/g;
13807
- let m;
13808
- while (m = pattern.exec(name)) {
13809
- emitError(
13810
- context,
13811
- 17,
13812
- m.index
13813
- );
13814
- }
13815
- }
13816
- advanceBy(context, name.length);
13817
- let value = void 0;
13818
- if (/^[\t\r\n\f ]*=/.test(context.source)) {
13819
- advanceSpaces(context);
13820
- advanceBy(context, 1);
13821
- advanceSpaces(context);
13822
- value = parseAttributeValue(context);
13823
- if (!value) {
13824
- emitError(context, 13);
13825
- }
13826
- }
13827
- const loc = getSelection(context, start);
13828
- if (!context.inVPre && /^(v-[A-Za-z0-9-]|:|\.|@|#)/.test(name)) {
13829
- const match2 = /(?:^v-([a-z0-9-]+))?(?:(?::|^\.|^@|^#)(\[[^\]]+\]|[^\.]+))?(.+)?$/i.exec(
13830
- name
13831
- );
13832
- let isPropShorthand = startsWith(name, ".");
13833
- let dirName = match2[1] || (isPropShorthand || startsWith(name, ":") ? "bind" : startsWith(name, "@") ? "on" : "slot");
13834
- let arg;
13835
- if (match2[2]) {
13836
- const isSlot = dirName === "slot";
13837
- const startOffset = name.lastIndexOf(
13838
- match2[2],
13839
- name.length - (((_a = match2[3]) == null ? void 0 : _a.length) || 0)
13840
- );
13841
- const loc2 = getSelection(
13842
- context,
13843
- getNewPosition(context, start, startOffset),
13844
- getNewPosition(
13845
- context,
13846
- start,
13847
- startOffset + match2[2].length + (isSlot && match2[3] || "").length
13848
- )
13849
- );
13850
- let content = match2[2];
13851
- let isStatic = true;
13852
- if (content.startsWith("[")) {
13853
- isStatic = false;
13854
- if (!content.endsWith("]")) {
13855
- emitError(
13856
- context,
13857
- 27
13858
- );
13859
- content = content.slice(1);
13860
- } else {
13861
- content = content.slice(1, content.length - 1);
14724
+ const windowsNewlineRE = /\r\n/g;
14725
+ function condenseWhitespace(nodes, tag) {
14726
+ var _a, _b;
14727
+ const shouldCondense = currentOptions.whitespace !== "preserve";
14728
+ let removedWhitespace = false;
14729
+ for (let i = 0; i < nodes.length; i++) {
14730
+ const node = nodes[i];
14731
+ if (node.type === 2) {
14732
+ if (!inPre) {
14733
+ if (isAllWhitespace(node.content)) {
14734
+ const prev = (_a = nodes[i - 1]) == null ? void 0 : _a.type;
14735
+ const next = (_b = nodes[i + 1]) == null ? void 0 : _b.type;
14736
+ if (!prev || !next || shouldCondense && (prev === 3 && (next === 3 || next === 1) || prev === 1 && (next === 3 || next === 1 && hasNewlineChar(node.content)))) {
14737
+ removedWhitespace = true;
14738
+ nodes[i] = null;
14739
+ } else {
14740
+ node.content = " ";
14741
+ }
14742
+ } else if (shouldCondense) {
14743
+ node.content = condense(node.content);
13862
14744
  }
13863
- } else if (isSlot) {
13864
- content += match2[3] || "";
13865
- }
13866
- arg = {
13867
- type: 4,
13868
- content,
13869
- isStatic,
13870
- constType: isStatic ? 3 : 0,
13871
- loc: loc2
13872
- };
13873
- }
13874
- if (value && value.isQuoted) {
13875
- const valueLoc = value.loc;
13876
- valueLoc.start.offset++;
13877
- valueLoc.start.column++;
13878
- valueLoc.end = advancePositionWithClone(valueLoc.start, value.content);
13879
- valueLoc.source = valueLoc.source.slice(1, -1);
13880
- }
13881
- const modifiers = match2[3] ? match2[3].slice(1).split(".") : [];
13882
- if (isPropShorthand)
13883
- modifiers.push("prop");
13884
- if (dirName === "bind" && arg) {
13885
- if (modifiers.includes("sync") && checkCompatEnabled(
13886
- "COMPILER_V_BIND_SYNC",
13887
- context,
13888
- loc,
13889
- arg.loc.source
13890
- )) {
13891
- dirName = "model";
13892
- modifiers.splice(modifiers.indexOf("sync"), 1);
13893
- }
13894
- if (modifiers.includes("prop")) {
13895
- checkCompatEnabled(
13896
- "COMPILER_V_BIND_PROP",
13897
- context,
13898
- loc
13899
- );
14745
+ } else {
14746
+ node.content = node.content.replace(windowsNewlineRE, "\n");
13900
14747
  }
13901
14748
  }
13902
- return {
13903
- type: 7,
13904
- name: dirName,
13905
- exp: value && {
13906
- type: 4,
13907
- content: value.content,
13908
- isStatic: false,
13909
- // Treat as non-constant by default. This can be potentially set to
13910
- // other values by `transformExpression` to make it eligible for hoisting.
13911
- constType: 0,
13912
- loc: value.loc
13913
- },
13914
- arg,
13915
- modifiers,
13916
- loc
13917
- };
13918
14749
  }
13919
- if (!context.inVPre && startsWith(name, "v-")) {
13920
- emitError(context, 26);
14750
+ if (inPre && tag && currentOptions.isPreTag(tag)) {
14751
+ const first = nodes[0];
14752
+ if (first && first.type === 2) {
14753
+ first.content = first.content.replace(/^\r?\n/, "");
14754
+ }
13921
14755
  }
13922
- return {
13923
- type: 6,
13924
- name,
13925
- value: value && {
13926
- type: 2,
13927
- content: value.content,
13928
- loc: value.loc
13929
- },
13930
- loc
13931
- };
14756
+ return removedWhitespace ? nodes.filter(Boolean) : nodes;
13932
14757
  }
13933
- function parseAttributeValue(context) {
13934
- const start = getCursor(context);
13935
- let content;
13936
- const quote = context.source[0];
13937
- const isQuoted = quote === `"` || quote === `'`;
13938
- if (isQuoted) {
13939
- advanceBy(context, 1);
13940
- const endIndex = context.source.indexOf(quote);
13941
- if (endIndex === -1) {
13942
- content = parseTextData(
13943
- context,
13944
- context.source.length,
13945
- 4
13946
- );
13947
- } else {
13948
- content = parseTextData(context, endIndex, 4);
13949
- advanceBy(context, 1);
13950
- }
13951
- } else {
13952
- const match = /^[^\t\r\n\f >]+/.exec(context.source);
13953
- if (!match) {
13954
- return void 0;
13955
- }
13956
- const unexpectedChars = /["'<=`]/g;
13957
- let m;
13958
- while (m = unexpectedChars.exec(match[0])) {
13959
- emitError(
13960
- context,
13961
- 18,
13962
- m.index
13963
- );
14758
+ function isAllWhitespace(str) {
14759
+ for (let i = 0; i < str.length; i++) {
14760
+ if (!isWhitespace(str.charCodeAt(i))) {
14761
+ return false;
13964
14762
  }
13965
- content = parseTextData(context, match[0].length, 4);
13966
- }
13967
- return { content, isQuoted, loc: getSelection(context, start) };
13968
- }
13969
- function parseInterpolation(context, mode) {
13970
- const [open, close] = context.options.delimiters;
13971
- const closeIndex = context.source.indexOf(close, open.length);
13972
- if (closeIndex === -1) {
13973
- emitError(context, 25);
13974
- return void 0;
13975
- }
13976
- const start = getCursor(context);
13977
- advanceBy(context, open.length);
13978
- const innerStart = getCursor(context);
13979
- const innerEnd = getCursor(context);
13980
- const rawContentLength = closeIndex - open.length;
13981
- const rawContent = context.source.slice(0, rawContentLength);
13982
- const preTrimContent = parseTextData(context, rawContentLength, mode);
13983
- const content = preTrimContent.trim();
13984
- const startOffset = preTrimContent.indexOf(content);
13985
- if (startOffset > 0) {
13986
- advancePositionWithMutation(innerStart, rawContent, startOffset);
13987
- }
13988
- const endOffset = rawContentLength - (preTrimContent.length - content.length - startOffset);
13989
- advancePositionWithMutation(innerEnd, rawContent, endOffset);
13990
- advanceBy(context, close.length);
13991
- return {
13992
- type: 5,
13993
- content: {
13994
- type: 4,
13995
- isStatic: false,
13996
- // Set `isConstant` to false by default and will decide in transformExpression
13997
- constType: 0,
13998
- content,
13999
- loc: getSelection(context, innerStart, innerEnd)
14000
- },
14001
- loc: getSelection(context, start)
14002
- };
14763
+ }
14764
+ return true;
14003
14765
  }
14004
- function parseText(context, mode) {
14005
- const endTokens = mode === 3 ? ["]]>"] : ["<", context.options.delimiters[0]];
14006
- let endIndex = context.source.length;
14007
- for (let i = 0; i < endTokens.length; i++) {
14008
- const index = context.source.indexOf(endTokens[i], 1);
14009
- if (index !== -1 && endIndex > index) {
14010
- endIndex = index;
14766
+ function hasNewlineChar(str) {
14767
+ for (let i = 0; i < str.length; i++) {
14768
+ const c = str.charCodeAt(i);
14769
+ if (c === 10 || c === 13) {
14770
+ return true;
14011
14771
  }
14012
14772
  }
14013
- const start = getCursor(context);
14014
- const content = parseTextData(context, endIndex, mode);
14015
- return {
14016
- type: 2,
14017
- content,
14018
- loc: getSelection(context, start)
14019
- };
14773
+ return false;
14020
14774
  }
14021
- function parseTextData(context, length, mode) {
14022
- const rawText = context.source.slice(0, length);
14023
- advanceBy(context, length);
14024
- if (mode === 2 || mode === 3 || !rawText.includes("&")) {
14025
- return rawText;
14026
- } else {
14027
- return context.options.decodeEntities(
14028
- rawText,
14029
- mode === 4
14030
- );
14775
+ function condense(str) {
14776
+ let ret = "";
14777
+ let prevCharIsWhitespace = false;
14778
+ for (let i = 0; i < str.length; i++) {
14779
+ if (isWhitespace(str.charCodeAt(i))) {
14780
+ if (!prevCharIsWhitespace) {
14781
+ ret += " ";
14782
+ prevCharIsWhitespace = true;
14783
+ }
14784
+ } else {
14785
+ ret += str[i];
14786
+ prevCharIsWhitespace = false;
14787
+ }
14031
14788
  }
14789
+ return ret;
14032
14790
  }
14033
- function getCursor(context) {
14034
- const { column, line, offset } = context;
14035
- return { column, line, offset };
14791
+ function addNode(node) {
14792
+ (stack[0] || currentRoot).children.push(node);
14036
14793
  }
14037
- function getSelection(context, start, end) {
14038
- end = end || getCursor(context);
14794
+ function getLoc(start, end) {
14039
14795
  return {
14040
- start,
14041
- end,
14042
- source: context.originalSource.slice(start.offset, end.offset)
14796
+ start: tokenizer.getPos(start),
14797
+ // @ts-expect-error allow late attachment
14798
+ end: end == null ? end : tokenizer.getPos(end),
14799
+ // @ts-expect-error allow late attachment
14800
+ source: end == null ? end : getSlice(start, end)
14043
14801
  };
14044
14802
  }
14045
- function last(xs) {
14046
- return xs[xs.length - 1];
14047
- }
14048
- function startsWith(source, searchString) {
14049
- return source.startsWith(searchString);
14803
+ function setLocEnd(loc, end) {
14804
+ loc.end = tokenizer.getPos(end);
14805
+ loc.source = getSlice(loc.start.offset, end);
14050
14806
  }
14051
- function advanceBy(context, numberOfCharacters) {
14052
- const { source } = context;
14053
- advancePositionWithMutation(context, source, numberOfCharacters);
14054
- context.source = source.slice(numberOfCharacters);
14055
- }
14056
- function advanceSpaces(context) {
14057
- const match = /^[\t\r\n\f ]+/.exec(context.source);
14058
- if (match) {
14059
- advanceBy(context, match[0].length);
14807
+ function dirToAttr(dir) {
14808
+ const attr = {
14809
+ type: 6,
14810
+ name: dir.rawName,
14811
+ nameLoc: getLoc(
14812
+ dir.loc.start.offset,
14813
+ dir.loc.start.offset + dir.rawName.length
14814
+ ),
14815
+ value: void 0,
14816
+ loc: dir.loc
14817
+ };
14818
+ if (dir.exp) {
14819
+ const loc = dir.exp.loc;
14820
+ if (loc.end.offset < dir.loc.end.offset) {
14821
+ loc.start.offset--;
14822
+ loc.start.column--;
14823
+ loc.end.offset++;
14824
+ loc.end.column++;
14825
+ }
14826
+ attr.value = {
14827
+ type: 2,
14828
+ content: dir.exp.content,
14829
+ loc
14830
+ };
14060
14831
  }
14832
+ return attr;
14061
14833
  }
14062
- function getNewPosition(context, start, numberOfCharacters) {
14063
- return advancePositionWithClone(
14064
- start,
14065
- context.originalSource.slice(start.offset, numberOfCharacters),
14066
- numberOfCharacters
14067
- );
14834
+ function emitError(code, index) {
14835
+ currentOptions.onError(createCompilerError(code, getLoc(index, index)));
14068
14836
  }
14069
- function emitError(context, code, offset, loc = getCursor(context)) {
14070
- if (offset) {
14071
- loc.offset += offset;
14072
- loc.column += offset;
14073
- }
14074
- context.options.onError(
14075
- createCompilerError(code, {
14076
- start: loc,
14077
- end: loc,
14078
- source: ""
14079
- })
14080
- );
14837
+ function reset() {
14838
+ tokenizer.reset();
14839
+ currentOpenTag = null;
14840
+ currentProp = null;
14841
+ currentAttrValue = "";
14842
+ currentAttrStartIndex = -1;
14843
+ currentAttrEndIndex = -1;
14844
+ stack.length = 0;
14081
14845
  }
14082
- function isEnd(context, mode, ancestors) {
14083
- const s = context.source;
14084
- switch (mode) {
14085
- case 0:
14086
- if (startsWith(s, "</")) {
14087
- for (let i = ancestors.length - 1; i >= 0; --i) {
14088
- if (startsWithEndTagOpen(s, ancestors[i].tag)) {
14089
- return true;
14090
- }
14091
- }
14092
- }
14093
- break;
14094
- case 1:
14095
- case 2: {
14096
- const parent = last(ancestors);
14097
- if (parent && startsWithEndTagOpen(s, parent.tag)) {
14098
- return true;
14846
+ function baseParse(input, options) {
14847
+ reset();
14848
+ currentInput = input;
14849
+ currentOptions = extend({}, defaultParserOptions);
14850
+ if (options) {
14851
+ let key;
14852
+ for (key in options) {
14853
+ if (options[key] != null) {
14854
+ currentOptions[key] = options[key];
14099
14855
  }
14100
- break;
14101
14856
  }
14102
- case 3:
14103
- if (startsWith(s, "]]>")) {
14104
- return true;
14105
- }
14106
- break;
14107
14857
  }
14108
- return !s;
14109
- }
14110
- function startsWithEndTagOpen(source, tag) {
14111
- return startsWith(source, "</") && source.slice(2, 2 + tag.length).toLowerCase() === tag.toLowerCase() && /[\t\r\n\f />]/.test(source[2 + tag.length] || ">");
14858
+ {
14859
+ if (!currentOptions.decodeEntities) {
14860
+ throw new Error(
14861
+ `[@vue/compiler-core] decodeEntities option is required in browser builds.`
14862
+ );
14863
+ }
14864
+ }
14865
+ tokenizer.mode = currentOptions.parseMode === "html" ? 1 : currentOptions.parseMode === "sfc" ? 2 : 0;
14866
+ const delimiters = options == null ? void 0 : options.delimiters;
14867
+ if (delimiters) {
14868
+ tokenizer.delimiterOpen = toCharCodes(delimiters[0]);
14869
+ tokenizer.delimiterClose = toCharCodes(delimiters[1]);
14870
+ }
14871
+ const root = currentRoot = createRoot([], input);
14872
+ tokenizer.parse(currentInput);
14873
+ root.loc = getLoc(0, input.length);
14874
+ root.children = condenseWhitespace(root.children);
14875
+ currentRoot = null;
14876
+ return root;
14112
14877
  }
14113
14878
 
14114
14879
  function hoistStatic(root, context) {
@@ -14520,6 +15285,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
14520
15285
  root.hoists = context.hoists;
14521
15286
  root.temps = context.temps;
14522
15287
  root.cached = context.cached;
15288
+ root.transformed = true;
14523
15289
  {
14524
15290
  root.filters = [...context.filters];
14525
15291
  }
@@ -14676,7 +15442,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
14676
15442
  ssr,
14677
15443
  isTS,
14678
15444
  inSSR,
14679
- source: ast.loc.source,
15445
+ source: ast.source,
14680
15446
  code: ``,
14681
15447
  column: 1,
14682
15448
  line: 1,
@@ -14687,7 +15453,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
14687
15453
  helper(key) {
14688
15454
  return `_${helperNameMap[key]}`;
14689
15455
  },
14690
- push(code, node) {
15456
+ push(code, newlineIndex = -2 /* None */, node) {
14691
15457
  context.code += code;
14692
15458
  },
14693
15459
  indent() {
@@ -14705,7 +15471,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
14705
15471
  }
14706
15472
  };
14707
15473
  function newline(n) {
14708
- context.push("\n" + ` `.repeat(n));
15474
+ context.push("\n" + ` `.repeat(n), 0 /* Start */);
14709
15475
  }
14710
15476
  return context;
14711
15477
  }
@@ -14742,9 +15508,11 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
14742
15508
  push(`with (_ctx) {`);
14743
15509
  indent();
14744
15510
  if (hasHelpers) {
14745
- push(`const { ${helpers.map(aliasHelper).join(", ")} } = _Vue`);
14746
- push(`
14747
- `);
15511
+ push(
15512
+ `const { ${helpers.map(aliasHelper).join(", ")} } = _Vue
15513
+ `,
15514
+ -1 /* End */
15515
+ );
14748
15516
  newline();
14749
15517
  }
14750
15518
  }
@@ -14773,7 +15541,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
14773
15541
  }
14774
15542
  if (ast.components.length || ast.directives.length || ast.temps) {
14775
15543
  push(`
14776
- `);
15544
+ `, 0 /* Start */);
14777
15545
  newline();
14778
15546
  }
14779
15547
  if (!ssr) {
@@ -14794,7 +15562,6 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
14794
15562
  ast,
14795
15563
  code: context.code,
14796
15564
  preamble: isSetupInlined ? preambleContext.code : ``,
14797
- // SourceMapGenerator does have toJSON() method but it's not in the types
14798
15565
  map: context.map ? context.map.toJSON() : void 0
14799
15566
  };
14800
15567
  }
@@ -14813,7 +15580,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
14813
15580
  if (helpers.length > 0) {
14814
15581
  {
14815
15582
  push(`const _Vue = ${VueBinding}
14816
- `);
15583
+ `, -1 /* End */);
14817
15584
  if (ast.hoists.length) {
14818
15585
  const staticHelpers = [
14819
15586
  CREATE_VNODE,
@@ -14823,7 +15590,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
14823
15590
  CREATE_STATIC
14824
15591
  ].filter((helper) => helpers.includes(helper)).map(aliasHelper).join(", ");
14825
15592
  push(`const { ${staticHelpers} } = _Vue
14826
- `);
15593
+ `, -1 /* End */);
14827
15594
  }
14828
15595
  }
14829
15596
  }
@@ -14884,7 +15651,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
14884
15651
  for (let i = 0; i < nodes.length; i++) {
14885
15652
  const node = nodes[i];
14886
15653
  if (isString(node)) {
14887
- push(node);
15654
+ push(node, -3 /* Unknown */);
14888
15655
  } else if (isArray(node)) {
14889
15656
  genNodeListAsArray(node, context);
14890
15657
  } else {
@@ -14902,7 +15669,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
14902
15669
  }
14903
15670
  function genNode(node, context) {
14904
15671
  if (isString(node)) {
14905
- context.push(node);
15672
+ context.push(node, -3 /* Unknown */);
14906
15673
  return;
14907
15674
  }
14908
15675
  if (isSymbol(node)) {
@@ -14982,11 +15749,15 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
14982
15749
  }
14983
15750
  }
14984
15751
  function genText(node, context) {
14985
- context.push(JSON.stringify(node.content), node);
15752
+ context.push(JSON.stringify(node.content), -3 /* Unknown */, node);
14986
15753
  }
14987
15754
  function genExpression(node, context) {
14988
15755
  const { content, isStatic } = node;
14989
- context.push(isStatic ? JSON.stringify(content) : content, node);
15756
+ context.push(
15757
+ isStatic ? JSON.stringify(content) : content,
15758
+ -3 /* Unknown */,
15759
+ node
15760
+ );
14990
15761
  }
14991
15762
  function genInterpolation(node, context) {
14992
15763
  const { push, helper, pure } = context;
@@ -15000,7 +15771,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15000
15771
  for (let i = 0; i < node.children.length; i++) {
15001
15772
  const child = node.children[i];
15002
15773
  if (isString(child)) {
15003
- context.push(child);
15774
+ context.push(child, -3 /* Unknown */);
15004
15775
  } else {
15005
15776
  genNode(child, context);
15006
15777
  }
@@ -15014,9 +15785,9 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15014
15785
  push(`]`);
15015
15786
  } else if (node.isStatic) {
15016
15787
  const text = isSimpleIdentifier(node.content) ? node.content : JSON.stringify(node.content);
15017
- push(text, node);
15788
+ push(text, -2 /* None */, node);
15018
15789
  } else {
15019
- push(`[${node.content}]`, node);
15790
+ push(`[${node.content}]`, -3 /* Unknown */, node);
15020
15791
  }
15021
15792
  }
15022
15793
  function genComment(node, context) {
@@ -15024,7 +15795,11 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15024
15795
  if (pure) {
15025
15796
  push(PURE_ANNOTATION);
15026
15797
  }
15027
- push(`${helper(CREATE_COMMENT)}(${JSON.stringify(node.content)})`, node);
15798
+ push(
15799
+ `${helper(CREATE_COMMENT)}(${JSON.stringify(node.content)})`,
15800
+ -3 /* Unknown */,
15801
+ node
15802
+ );
15028
15803
  }
15029
15804
  function genVNodeCall(node, context) {
15030
15805
  const { push, helper, pure } = context;
@@ -15049,7 +15824,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15049
15824
  push(PURE_ANNOTATION);
15050
15825
  }
15051
15826
  const callHelper = isBlock ? getVNodeBlockHelper(context.inSSR, isComponent) : getVNodeHelper(context.inSSR, isComponent);
15052
- push(helper(callHelper) + `(`, node);
15827
+ push(helper(callHelper) + `(`, -2 /* None */, node);
15053
15828
  genNodeList(
15054
15829
  genNullableArgs([tag, props, children, patchFlag, dynamicProps]),
15055
15830
  context
@@ -15078,7 +15853,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15078
15853
  if (pure) {
15079
15854
  push(PURE_ANNOTATION);
15080
15855
  }
15081
- push(callee + `(`, node);
15856
+ push(callee + `(`, -2 /* None */, node);
15082
15857
  genNodeList(node.arguments, context);
15083
15858
  push(`)`);
15084
15859
  }
@@ -15086,7 +15861,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15086
15861
  const { push, indent, deindent, newline } = context;
15087
15862
  const { properties } = node;
15088
15863
  if (!properties.length) {
15089
- push(`{}`, node);
15864
+ push(`{}`, -2 /* None */, node);
15090
15865
  return;
15091
15866
  }
15092
15867
  const multilines = properties.length > 1 || properties.some((p) => p.value.type !== 4);
@@ -15114,7 +15889,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15114
15889
  if (isSlot) {
15115
15890
  push(`_${helperNameMap[WITH_CTX]}(`);
15116
15891
  }
15117
- push(`(`, node);
15892
+ push(`(`, -2 /* None */, node);
15118
15893
  if (isArray(params)) {
15119
15894
  genNodeList(params, context);
15120
15895
  } else if (params) {
@@ -15348,7 +16123,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15348
16123
  context.removeNode();
15349
16124
  const branch = createIfBranch(node, dir);
15350
16125
  if (comments.length && // #3619 ignore comments if the v-if is direct child of <transition>
15351
- !(context.parent && context.parent.type === 1 && isBuiltInType(context.parent.tag, "transition"))) {
16126
+ !(context.parent && context.parent.type === 1 && (context.parent.tag === "transition" || context.parent.tag === "Transition"))) {
15352
16127
  branch.children = [...comments, ...branch.children];
15353
16128
  }
15354
16129
  {
@@ -15630,18 +16405,14 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15630
16405
  );
15631
16406
  return;
15632
16407
  }
15633
- const parseResult = parseForExpression(
15634
- // can only be simple expression because vFor transform is applied
15635
- // before expression transform.
15636
- dir.exp,
15637
- context
15638
- );
16408
+ const parseResult = dir.forParseResult;
15639
16409
  if (!parseResult) {
15640
16410
  context.onError(
15641
16411
  createCompilerError(32, dir.loc)
15642
16412
  );
15643
16413
  return;
15644
16414
  }
16415
+ finalizeForParseResult(parseResult, context);
15645
16416
  const { addIdentifiers, removeIdentifiers, scopes } = context;
15646
16417
  const { source, value, key, index } = parseResult;
15647
16418
  const forNode = {
@@ -15663,71 +16434,26 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15663
16434
  onExit();
15664
16435
  };
15665
16436
  }
15666
- const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
15667
- const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
15668
- const stripParensRE = /^\(|\)$/g;
15669
- function parseForExpression(input, context) {
15670
- const loc = input.loc;
15671
- const exp = input.content;
15672
- const inMatch = exp.match(forAliasRE);
15673
- if (!inMatch)
16437
+ function finalizeForParseResult(result, context) {
16438
+ if (result.finalized)
15674
16439
  return;
15675
- const [, LHS, RHS] = inMatch;
15676
- const result = {
15677
- source: createAliasExpression(
15678
- loc,
15679
- RHS.trim(),
15680
- exp.indexOf(RHS, LHS.length)
15681
- ),
15682
- value: void 0,
15683
- key: void 0,
15684
- index: void 0
15685
- };
15686
16440
  {
15687
16441
  validateBrowserExpression(result.source, context);
15688
- }
15689
- let valueContent = LHS.trim().replace(stripParensRE, "").trim();
15690
- const trimmedOffset = LHS.indexOf(valueContent);
15691
- const iteratorMatch = valueContent.match(forIteratorRE);
15692
- if (iteratorMatch) {
15693
- valueContent = valueContent.replace(forIteratorRE, "").trim();
15694
- const keyContent = iteratorMatch[1].trim();
15695
- let keyOffset;
15696
- if (keyContent) {
15697
- keyOffset = exp.indexOf(keyContent, trimmedOffset + valueContent.length);
15698
- result.key = createAliasExpression(loc, keyContent, keyOffset);
15699
- {
15700
- validateBrowserExpression(
15701
- result.key,
15702
- context,
15703
- true
15704
- );
15705
- }
16442
+ if (result.key) {
16443
+ validateBrowserExpression(
16444
+ result.key,
16445
+ context,
16446
+ true
16447
+ );
15706
16448
  }
15707
- if (iteratorMatch[2]) {
15708
- const indexContent = iteratorMatch[2].trim();
15709
- if (indexContent) {
15710
- result.index = createAliasExpression(
15711
- loc,
15712
- indexContent,
15713
- exp.indexOf(
15714
- indexContent,
15715
- result.key ? keyOffset + keyContent.length : trimmedOffset + valueContent.length
15716
- )
15717
- );
15718
- {
15719
- validateBrowserExpression(
15720
- result.index,
15721
- context,
15722
- true
15723
- );
15724
- }
15725
- }
16449
+ if (result.index) {
16450
+ validateBrowserExpression(
16451
+ result.index,
16452
+ context,
16453
+ true
16454
+ );
15726
16455
  }
15727
- }
15728
- if (valueContent) {
15729
- result.value = createAliasExpression(loc, valueContent, trimmedOffset);
15730
- {
16456
+ if (result.value) {
15731
16457
  validateBrowserExpression(
15732
16458
  result.value,
15733
16459
  context,
@@ -15735,14 +16461,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15735
16461
  );
15736
16462
  }
15737
16463
  }
15738
- return result;
15739
- }
15740
- function createAliasExpression(range, content, offset) {
15741
- return createSimpleExpression(
15742
- content,
15743
- false,
15744
- getInnerRange(range, offset, content.length)
15745
- );
16464
+ result.finalized = true;
15746
16465
  }
15747
16466
  function createForLoopParams({ value, key, index }, memoArgs = []) {
15748
16467
  return createParamsList([value, key, index, ...memoArgs]);
@@ -15829,12 +16548,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15829
16548
  hasDynamicSlots = true;
15830
16549
  }
15831
16550
  const vFor = findDir(slotElement, "for");
15832
- const slotFunction = buildSlotFn(
15833
- slotProps,
15834
- vFor == null ? void 0 : vFor.exp,
15835
- slotChildren,
15836
- slotLoc
15837
- );
16551
+ const slotFunction = buildSlotFn(slotProps, vFor, slotChildren, slotLoc);
15838
16552
  let vIf;
15839
16553
  let vElse;
15840
16554
  if (vIf = findDir(slotElement, "if")) {
@@ -15883,8 +16597,9 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15883
16597
  }
15884
16598
  } else if (vFor) {
15885
16599
  hasDynamicSlots = true;
15886
- const parseResult = vFor.parseResult || parseForExpression(vFor.exp, context);
16600
+ const parseResult = vFor.forParseResult;
15887
16601
  if (parseResult) {
16602
+ finalizeForParseResult(parseResult, context);
15888
16603
  dynamicSlots.push(
15889
16604
  createCallExpression(context.helper(RENDER_LIST), [
15890
16605
  parseResult.source,
@@ -16145,17 +16860,6 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
16145
16860
  tag = isProp.value.content.slice(4);
16146
16861
  }
16147
16862
  }
16148
- const isDir = !isExplicitDynamic && findDir(node, "is");
16149
- if (isDir && isDir.exp) {
16150
- {
16151
- context.onWarn(
16152
- createCompilerError(52, isDir.loc)
16153
- );
16154
- }
16155
- return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [
16156
- isDir.exp
16157
- ]);
16158
- }
16159
16863
  const builtIn = isCoreComponent(tag) || context.isBuiltInComponent(tag);
16160
16864
  if (builtIn) {
16161
16865
  if (!ssr)
@@ -16227,7 +16931,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
16227
16931
  for (let i = 0; i < props.length; i++) {
16228
16932
  const prop = props[i];
16229
16933
  if (prop.type === 6) {
16230
- const { loc, name, value } = prop;
16934
+ const { loc, name, nameLoc, value } = prop;
16231
16935
  let isStatic = true;
16232
16936
  if (name === "ref") {
16233
16937
  hasRef = true;
@@ -16248,11 +16952,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
16248
16952
  }
16249
16953
  properties.push(
16250
16954
  createObjectProperty(
16251
- createSimpleExpression(
16252
- name,
16253
- true,
16254
- getInnerRange(loc, 0, name.length)
16255
- ),
16955
+ createSimpleExpression(name, true, nameLoc),
16256
16956
  createSimpleExpression(
16257
16957
  value ? value.content : "",
16258
16958
  isStatic,
@@ -16261,7 +16961,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
16261
16961
  )
16262
16962
  );
16263
16963
  } else {
16264
- const { name, arg, exp, loc } = prop;
16964
+ const { name, arg, exp, loc, modifiers } = prop;
16265
16965
  const isVBind = name === "bind";
16266
16966
  const isVOn = name === "on";
16267
16967
  if (name === "slot") {
@@ -16354,6 +17054,9 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
16354
17054
  }
16355
17055
  continue;
16356
17056
  }
17057
+ if (isVBind && modifiers.includes("prop")) {
17058
+ patchFlag |= 32;
17059
+ }
16357
17060
  const directiveTransform = context.directiveTransforms[name];
16358
17061
  if (directiveTransform) {
16359
17062
  const { props: props2, needRuntime } = directiveTransform(prop, node, context);
@@ -16731,8 +17434,13 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
16731
17434
  };
16732
17435
 
16733
17436
  const transformBind = (dir, _node, context) => {
16734
- const { exp, modifiers, loc } = dir;
17437
+ const { modifiers, loc } = dir;
16735
17438
  const arg = dir.arg;
17439
+ let { exp } = dir;
17440
+ if (!exp && arg.type === 4) {
17441
+ const propName = camelize(arg.content);
17442
+ exp = dir.exp = createSimpleExpression(propName, false, arg.loc);
17443
+ }
16736
17444
  if (arg.type !== 4) {
16737
17445
  arg.children.unshift(`(`);
16738
17446
  arg.children.push(`) || ""`);
@@ -17131,7 +17839,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
17131
17839
  }
17132
17840
  ];
17133
17841
  }
17134
- function baseCompile(template, options = {}) {
17842
+ function baseCompile(source, options = {}) {
17135
17843
  const onError = options.onError || defaultOnError;
17136
17844
  const isModuleMode = options.mode === "module";
17137
17845
  {
@@ -17148,7 +17856,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
17148
17856
  if (options.scopeId && !isModuleMode) {
17149
17857
  onError(createCompilerError(50));
17150
17858
  }
17151
- const ast = isString(template) ? baseParse(template, options) : template;
17859
+ const ast = isString(source) ? baseParse(source, options) : source;
17152
17860
  const [nodeTransforms, directiveTransforms] = getBaseTransformPreset();
17153
17861
  transform(
17154
17862
  ast,
@@ -17214,25 +17922,22 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
17214
17922
  }
17215
17923
  }
17216
17924
 
17217
- const isRawTextContainer = /* @__PURE__ */ makeMap(
17218
- "style,iframe,script,noscript",
17219
- true
17220
- );
17221
17925
  const parserOptions = {
17926
+ parseMode: "html",
17222
17927
  isVoidTag,
17223
17928
  isNativeTag: (tag) => isHTMLTag(tag) || isSVGTag(tag),
17224
17929
  isPreTag: (tag) => tag === "pre",
17225
17930
  decodeEntities: decodeHtmlBrowser ,
17226
17931
  isBuiltInComponent: (tag) => {
17227
- if (isBuiltInType(tag, `Transition`)) {
17932
+ if (tag === "Transition" || tag === "transition") {
17228
17933
  return TRANSITION;
17229
- } else if (isBuiltInType(tag, `TransitionGroup`)) {
17934
+ } else if (tag === "TransitionGroup" || tag === "transition-group") {
17230
17935
  return TRANSITION_GROUP;
17231
17936
  }
17232
17937
  },
17233
17938
  // https://html.spec.whatwg.org/multipage/parsing.html#tree-construction-dispatcher
17234
- getNamespace(tag, parent) {
17235
- let ns = parent ? parent.ns : 0;
17939
+ getNamespace(tag, parent, rootNamespace) {
17940
+ let ns = parent ? parent.ns : rootNamespace;
17236
17941
  if (parent && ns === 2) {
17237
17942
  if (parent.tag === "annotation-xml") {
17238
17943
  if (tag === "svg") {
@@ -17260,18 +17965,6 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
17260
17965
  }
17261
17966
  }
17262
17967
  return ns;
17263
- },
17264
- // https://html.spec.whatwg.org/multipage/parsing.html#parsing-html-fragments
17265
- getTextMode({ tag, ns }) {
17266
- if (ns === 0) {
17267
- if (tag === "textarea" || tag === "title") {
17268
- return 1;
17269
- }
17270
- if (isRawTextContainer(tag)) {
17271
- return 2;
17272
- }
17273
- }
17274
- return 0;
17275
17968
  }
17276
17969
  };
17277
17970
 
@@ -17386,8 +18079,8 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
17386
18079
  );
17387
18080
  }
17388
18081
  function checkDuplicatedValue() {
17389
- const value = findProp(node, "value");
17390
- if (value) {
18082
+ const value = findDir(node, "bind");
18083
+ if (value && isStaticArgOf(value.arg, "value")) {
17391
18084
  context.onError(
17392
18085
  createDOMCompilerError(
17393
18086
  60,
@@ -17592,6 +18285,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
17592
18285
  node.props.push({
17593
18286
  type: 6,
17594
18287
  name: "persisted",
18288
+ nameLoc: node.loc,
17595
18289
  value: void 0,
17596
18290
  loc: node.loc
17597
18291
  });
@@ -17636,9 +18330,9 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
17636
18330
  // override compiler-core
17637
18331
  show: transformShow
17638
18332
  };
17639
- function compile(template, options = {}) {
18333
+ function compile(src, options = {}) {
17640
18334
  return baseCompile(
17641
- template,
18335
+ src,
17642
18336
  extend({}, parserOptions, options, {
17643
18337
  nodeTransforms: [
17644
18338
  // ignore <script> and <tag>