@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.
@@ -1,10 +1,6 @@
1
1
  function makeMap(str, expectsLowerCase) {
2
- const map = /* @__PURE__ */ Object.create(null);
3
- const list = str.split(",");
4
- for (let i = 0; i < list.length; i++) {
5
- map[list[i]] = true;
6
- }
7
- return expectsLowerCase ? (val) => !!map[val.toLowerCase()] : (val) => !!map[val];
2
+ const set = new Set(str.split(","));
3
+ return expectsLowerCase ? (val) => set.has(val.toLowerCase()) : (val) => set.has(val);
8
4
  }
9
5
 
10
6
  const EMPTY_OBJ = Object.freeze({}) ;
@@ -104,7 +100,7 @@ const PatchFlagNames = {
104
100
  [4]: `STYLE`,
105
101
  [8]: `PROPS`,
106
102
  [16]: `FULL_PROPS`,
107
- [32]: `HYDRATE_EVENTS`,
103
+ [32]: `NEED_HYDRATION`,
108
104
  [64]: `STABLE_FRAGMENT`,
109
105
  [128]: `KEYED_FRAGMENT`,
110
106
  [256]: `UNKEYED_FRAGMENT`,
@@ -1026,7 +1022,7 @@ function createReadonlyMethod(type) {
1026
1022
  toRaw(this)
1027
1023
  );
1028
1024
  }
1029
- return type === "delete" ? false : this;
1025
+ return type === "delete" ? false : type === "clear" ? void 0 : this;
1030
1026
  };
1031
1027
  }
1032
1028
  function createInstrumentations() {
@@ -1282,9 +1278,10 @@ class ComputedRefImpl {
1282
1278
  this.dep = void 0;
1283
1279
  this.__v_isRef = true;
1284
1280
  this["__v_isReadonly"] = false;
1285
- this.effect = new ReactiveEffect(getter, () => {
1286
- triggerRefValue(this, 1);
1287
- });
1281
+ this.effect = new ReactiveEffect(
1282
+ () => getter(this._value),
1283
+ () => triggerRefValue(this, 1)
1284
+ );
1288
1285
  this.effect.computed = this;
1289
1286
  this.effect.active = this._cacheable = !isSSR;
1290
1287
  this["__v_isReadonly"] = isReadonly;
@@ -1501,16 +1498,16 @@ function propertyToRef(source, key, defaultValue) {
1501
1498
  return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
1502
1499
  }
1503
1500
 
1504
- const stack = [];
1501
+ const stack$1 = [];
1505
1502
  function pushWarningContext(vnode) {
1506
- stack.push(vnode);
1503
+ stack$1.push(vnode);
1507
1504
  }
1508
1505
  function popWarningContext() {
1509
- stack.pop();
1506
+ stack$1.pop();
1510
1507
  }
1511
1508
  function warn(msg, ...args) {
1512
1509
  pauseTracking();
1513
- const instance = stack.length ? stack[stack.length - 1].component : null;
1510
+ const instance = stack$1.length ? stack$1[stack$1.length - 1].component : null;
1514
1511
  const appWarnHandler = instance && instance.appContext.config.warnHandler;
1515
1512
  const trace = getComponentTrace();
1516
1513
  if (appWarnHandler) {
@@ -1539,7 +1536,7 @@ function warn(msg, ...args) {
1539
1536
  resetTracking();
1540
1537
  }
1541
1538
  function getComponentTrace() {
1542
- let currentVNode = stack[stack.length - 1];
1539
+ let currentVNode = stack$1[stack$1.length - 1];
1543
1540
  if (!currentVNode) {
1544
1541
  return [];
1545
1542
  }
@@ -2768,9 +2765,19 @@ function renderComponentRoot(instance) {
2768
2765
  try {
2769
2766
  if (vnode.shapeFlag & 4) {
2770
2767
  const proxyToUse = withProxy || proxy;
2768
+ const thisProxy = setupState.__isScriptSetup ? new Proxy(proxyToUse, {
2769
+ get(target, key, receiver) {
2770
+ warn(
2771
+ `Property '${String(
2772
+ key
2773
+ )}' was accessed via 'this'. Avoid using 'this' in templates.`
2774
+ );
2775
+ return Reflect.get(target, key, receiver);
2776
+ }
2777
+ }) : proxyToUse;
2771
2778
  result = normalizeVNode(
2772
2779
  render.call(
2773
- proxyToUse,
2780
+ thisProxy,
2774
2781
  proxyToUse,
2775
2782
  renderCache,
2776
2783
  props,
@@ -3021,6 +3028,65 @@ function updateHOCHostEl({ vnode, parent }, el) {
3021
3028
  }
3022
3029
  }
3023
3030
 
3031
+ const COMPONENTS = "components";
3032
+ const DIRECTIVES = "directives";
3033
+ const FILTERS = "filters";
3034
+ function resolveComponent(name, maybeSelfReference) {
3035
+ return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
3036
+ }
3037
+ const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
3038
+ function resolveDynamicComponent(component) {
3039
+ if (isString(component)) {
3040
+ return resolveAsset(COMPONENTS, component, false) || component;
3041
+ } else {
3042
+ return component || NULL_DYNAMIC_COMPONENT;
3043
+ }
3044
+ }
3045
+ function resolveDirective(name) {
3046
+ return resolveAsset(DIRECTIVES, name);
3047
+ }
3048
+ function resolveFilter$1(name) {
3049
+ return resolveAsset(FILTERS, name);
3050
+ }
3051
+ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
3052
+ const instance = currentRenderingInstance || currentInstance;
3053
+ if (instance) {
3054
+ const Component = instance.type;
3055
+ if (type === COMPONENTS) {
3056
+ const selfName = getComponentName(
3057
+ Component,
3058
+ false
3059
+ /* do not include inferred name to avoid breaking existing code */
3060
+ );
3061
+ if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
3062
+ return Component;
3063
+ }
3064
+ }
3065
+ const res = (
3066
+ // local registration
3067
+ // check instance[type] first which is resolved for options API
3068
+ resolve(instance[type] || Component[type], name) || // global registration
3069
+ resolve(instance.appContext[type], name)
3070
+ );
3071
+ if (!res && maybeSelfReference) {
3072
+ return Component;
3073
+ }
3074
+ if (warnMissing && !res) {
3075
+ const extra = type === COMPONENTS ? `
3076
+ If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
3077
+ warn(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
3078
+ }
3079
+ return res;
3080
+ } else {
3081
+ warn(
3082
+ `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
3083
+ );
3084
+ }
3085
+ }
3086
+ function resolve(registry, name) {
3087
+ return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
3088
+ }
3089
+
3024
3090
  const isSuspense = (type) => type.__isSuspense;
3025
3091
  const SuspenseImpl = {
3026
3092
  name: "Suspense",
@@ -3555,7 +3621,7 @@ function normalizeSuspenseSlot(s) {
3555
3621
  }
3556
3622
  if (isArray(s)) {
3557
3623
  const singleChild = filterSingleRoot(s);
3558
- if (!singleChild) {
3624
+ if (!singleChild && s.filter((child) => child !== NULL_DYNAMIC_COMPONENT).length > 0) {
3559
3625
  warn(`<Suspense> slots expect a single root node.`);
3560
3626
  }
3561
3627
  s = singleChild;
@@ -3753,6 +3819,7 @@ function doWatch(source, cb, { immediate, deep, flush, once, onTrack, onTrigger
3753
3819
  let onCleanup = (fn) => {
3754
3820
  cleanup = effect.onStop = () => {
3755
3821
  callWithErrorHandling(fn, instance, 4);
3822
+ cleanup = effect.onStop = void 0;
3756
3823
  };
3757
3824
  };
3758
3825
  let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
@@ -4230,7 +4297,11 @@ function emptyPlaceholder(vnode) {
4230
4297
  }
4231
4298
  }
4232
4299
  function getKeepAliveChild(vnode) {
4233
- return isKeepAlive(vnode) ? vnode.children ? vnode.children[0] : void 0 : vnode;
4300
+ return isKeepAlive(vnode) ? (
4301
+ // #7121 ensure get the child component subtree in case
4302
+ // it's been replaced during HMR
4303
+ vnode.component ? vnode.component.subTree : vnode.children ? vnode.children[0] : void 0
4304
+ ) : vnode;
4234
4305
  }
4235
4306
  function setTransitionHooks(vnode, hooks) {
4236
4307
  if (vnode.shapeFlag & 6 && vnode.component) {
@@ -4746,65 +4817,6 @@ function getCompatListeners(instance) {
4746
4817
  return listeners;
4747
4818
  }
4748
4819
 
4749
- const COMPONENTS = "components";
4750
- const DIRECTIVES = "directives";
4751
- const FILTERS = "filters";
4752
- function resolveComponent(name, maybeSelfReference) {
4753
- return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
4754
- }
4755
- const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
4756
- function resolveDynamicComponent(component) {
4757
- if (isString(component)) {
4758
- return resolveAsset(COMPONENTS, component, false) || component;
4759
- } else {
4760
- return component || NULL_DYNAMIC_COMPONENT;
4761
- }
4762
- }
4763
- function resolveDirective(name) {
4764
- return resolveAsset(DIRECTIVES, name);
4765
- }
4766
- function resolveFilter$1(name) {
4767
- return resolveAsset(FILTERS, name);
4768
- }
4769
- function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
4770
- const instance = currentRenderingInstance || currentInstance;
4771
- if (instance) {
4772
- const Component = instance.type;
4773
- if (type === COMPONENTS) {
4774
- const selfName = getComponentName(
4775
- Component,
4776
- false
4777
- /* do not include inferred name to avoid breaking existing code */
4778
- );
4779
- if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
4780
- return Component;
4781
- }
4782
- }
4783
- const res = (
4784
- // local registration
4785
- // check instance[type] first which is resolved for options API
4786
- resolve(instance[type] || Component[type], name) || // global registration
4787
- resolve(instance.appContext[type], name)
4788
- );
4789
- if (!res && maybeSelfReference) {
4790
- return Component;
4791
- }
4792
- if (warnMissing && !res) {
4793
- const extra = type === COMPONENTS ? `
4794
- If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
4795
- warn(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
4796
- }
4797
- return res;
4798
- } else {
4799
- warn(
4800
- `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
4801
- );
4802
- }
4803
- }
4804
- function resolve(registry, name) {
4805
- return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
4806
- }
4807
-
4808
4820
  function convertLegacyRenderFn(instance) {
4809
4821
  const Component2 = instance.type;
4810
4822
  const render = Component2.render;
@@ -6310,7 +6322,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6310
6322
  return vm;
6311
6323
  }
6312
6324
  }
6313
- Vue.version = `2.6.14-compat:${"3.4.0-alpha.1"}`;
6325
+ Vue.version = `2.6.14-compat:${"3.4.0-alpha.3"}`;
6314
6326
  Vue.config = singletonApp.config;
6315
6327
  Vue.use = (p, ...options) => {
6316
6328
  if (p && isFunction(p.install)) {
@@ -7338,6 +7350,9 @@ function assertType(value, type) {
7338
7350
  };
7339
7351
  }
7340
7352
  function getInvalidTypeMessage(name, value, expectedTypes) {
7353
+ if (expectedTypes.length === 0) {
7354
+ return `Prop type [] for prop "${name}" won't match anything. Did you mean to use type Array instead?`;
7355
+ }
7341
7356
  let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
7342
7357
  const expectedType = expectedTypes[0];
7343
7358
  const receivedType = toRawType(value);
@@ -7609,6 +7624,20 @@ function createHydrationFunctions(rendererInternals) {
7609
7624
  const { type, ref, shapeFlag, patchFlag } = vnode;
7610
7625
  let domType = node.nodeType;
7611
7626
  vnode.el = node;
7627
+ {
7628
+ if (!("__vnode" in node)) {
7629
+ Object.defineProperty(node, "__vnode", {
7630
+ value: vnode,
7631
+ enumerable: false
7632
+ });
7633
+ }
7634
+ if (!("__vueParentComponent" in node)) {
7635
+ Object.defineProperty(node, "__vueParentComponent", {
7636
+ value: parentComponent,
7637
+ enumerable: false
7638
+ });
7639
+ }
7640
+ }
7612
7641
  if (patchFlag === -2) {
7613
7642
  optimized = false;
7614
7643
  vnode.dynamicChildren = null;
@@ -7639,15 +7668,15 @@ function createHydrationFunctions(rendererInternals) {
7639
7668
  }
7640
7669
  break;
7641
7670
  case Comment:
7642
- if (domType !== 8 /* COMMENT */ || isFragmentStart) {
7643
- if (node.tagName.toLowerCase() === "template") {
7644
- const content = vnode.el.content.firstChild;
7645
- replaceNode(content, node, parentComponent);
7646
- vnode.el = node = content;
7647
- nextNode = nextSibling(node);
7648
- } else {
7649
- nextNode = onMismatch();
7650
- }
7671
+ if (isTemplateNode(node)) {
7672
+ nextNode = nextSibling(node);
7673
+ replaceNode(
7674
+ vnode.el = node.content.firstChild,
7675
+ node,
7676
+ parentComponent
7677
+ );
7678
+ } else if (domType !== 8 /* COMMENT */ || isFragmentStart) {
7679
+ nextNode = onMismatch();
7651
7680
  } else {
7652
7681
  nextNode = nextSibling(node);
7653
7682
  }
@@ -7770,15 +7799,16 @@ function createHydrationFunctions(rendererInternals) {
7770
7799
  const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
7771
7800
  optimized = optimized || !!vnode.dynamicChildren;
7772
7801
  const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
7773
- const forcePatchValue = type === "input" && dirs || type === "option";
7802
+ const forcePatch = type === "input" || type === "option";
7774
7803
  {
7775
7804
  if (dirs) {
7776
7805
  invokeDirectiveHook(vnode, null, parentComponent, "created");
7777
7806
  }
7778
7807
  if (props) {
7779
- if (forcePatchValue || !optimized || patchFlag & (16 | 32)) {
7808
+ if (forcePatch || !optimized || patchFlag & (16 | 32)) {
7780
7809
  for (const key in props) {
7781
- if (forcePatchValue && key.endsWith("value") || isOn(key) && !isReservedProp(key)) {
7810
+ if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
7811
+ key[0] === ".") {
7782
7812
  patchProp(
7783
7813
  el,
7784
7814
  key,
@@ -7991,8 +8021,7 @@ function createHydrationFunctions(rendererInternals) {
7991
8021
  let parent = parentComponent;
7992
8022
  while (parent) {
7993
8023
  if (parent.vnode.el === oldNode) {
7994
- parent.vnode.el = newNode;
7995
- parent.subTree.el = newNode;
8024
+ parent.vnode.el = parent.subTree.el = newNode;
7996
8025
  }
7997
8026
  parent = parent.parent;
7998
8027
  }
@@ -9576,6 +9605,7 @@ const resolveTarget = (props, select) => {
9576
9605
  }
9577
9606
  };
9578
9607
  const TeleportImpl = {
9608
+ name: "Teleport",
9579
9609
  __isTeleport: true,
9580
9610
  process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals) {
9581
9611
  const {
@@ -10055,7 +10085,7 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
10055
10085
  if (shapeFlag & 4 && isProxy(type)) {
10056
10086
  type = toRaw(type);
10057
10087
  warn(
10058
- `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\`.`,
10088
+ `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\`.`,
10059
10089
  `
10060
10090
  Component that was made reactive: `,
10061
10091
  type
@@ -10891,7 +10921,7 @@ function isMemoSame(cached, memo) {
10891
10921
  return true;
10892
10922
  }
10893
10923
 
10894
- const version = "3.4.0-alpha.1";
10924
+ const version = "3.4.0-alpha.3";
10895
10925
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10896
10926
  const ssrUtils = null;
10897
10927
  const resolveFilter = resolveFilter$1 ;
@@ -12133,21 +12163,20 @@ const vModelText = {
12133
12163
  el[assignKey] = getModelAssigner(vnode);
12134
12164
  if (el.composing)
12135
12165
  return;
12166
+ const elValue = number || el.type === "number" ? looseToNumber(el.value) : el.value;
12167
+ const newValue = value == null ? "" : value;
12168
+ if (elValue === newValue) {
12169
+ return;
12170
+ }
12136
12171
  if (document.activeElement === el && el.type !== "range") {
12137
12172
  if (lazy) {
12138
12173
  return;
12139
12174
  }
12140
- if (trim && el.value.trim() === value) {
12141
- return;
12142
- }
12143
- if ((number || el.type === "number") && looseToNumber(el.value) === value) {
12175
+ if (trim && el.value.trim() === newValue) {
12144
12176
  return;
12145
12177
  }
12146
12178
  }
12147
- const newValue = value == null ? "" : value;
12148
- if (el.value !== newValue) {
12149
- el.value = newValue;
12150
- }
12179
+ el.value = newValue;
12151
12180
  }
12152
12181
  };
12153
12182
  const vModelCheckbox = {
@@ -12712,83 +12741,6 @@ function createCompatVue() {
12712
12741
  return Vue;
12713
12742
  }
12714
12743
 
12715
- function defaultOnError(error) {
12716
- throw error;
12717
- }
12718
- function defaultOnWarn(msg) {
12719
- console.warn(`[Vue warn] ${msg.message}`);
12720
- }
12721
- function createCompilerError(code, loc, messages, additionalMessage) {
12722
- const msg = (messages || errorMessages)[code] + (additionalMessage || ``) ;
12723
- const error = new SyntaxError(String(msg));
12724
- error.code = code;
12725
- error.loc = loc;
12726
- return error;
12727
- }
12728
- const errorMessages = {
12729
- // parse errors
12730
- [0]: "Illegal comment.",
12731
- [1]: "CDATA section is allowed only in XML context.",
12732
- [2]: "Duplicate attribute.",
12733
- [3]: "End tag cannot have attributes.",
12734
- [4]: "Illegal '/' in tags.",
12735
- [5]: "Unexpected EOF in tag.",
12736
- [6]: "Unexpected EOF in CDATA section.",
12737
- [7]: "Unexpected EOF in comment.",
12738
- [8]: "Unexpected EOF in script.",
12739
- [9]: "Unexpected EOF in tag.",
12740
- [10]: "Incorrectly closed comment.",
12741
- [11]: "Incorrectly opened comment.",
12742
- [12]: "Illegal tag name. Use '&lt;' to print '<'.",
12743
- [13]: "Attribute value was expected.",
12744
- [14]: "End tag name was expected.",
12745
- [15]: "Whitespace was expected.",
12746
- [16]: "Unexpected '<!--' in comment.",
12747
- [17]: `Attribute name cannot contain U+0022 ("), U+0027 ('), and U+003C (<).`,
12748
- [18]: "Unquoted attribute value cannot contain U+0022 (\"), U+0027 ('), U+003C (<), U+003D (=), and U+0060 (`).",
12749
- [19]: "Attribute name cannot start with '='.",
12750
- [21]: "'<?' is allowed only in XML context.",
12751
- [20]: `Unexpected null character.`,
12752
- [22]: "Illegal '/' in tags.",
12753
- // Vue-specific parse errors
12754
- [23]: "Invalid end tag.",
12755
- [24]: "Element is missing end tag.",
12756
- [25]: "Interpolation end sign was not found.",
12757
- [27]: "End bracket for dynamic directive argument was not found. Note that dynamic directive argument cannot contain spaces.",
12758
- [26]: "Legal directive name was expected.",
12759
- // transform errors
12760
- [28]: `v-if/v-else-if is missing expression.`,
12761
- [29]: `v-if/else branches must use unique keys.`,
12762
- [30]: `v-else/v-else-if has no adjacent v-if or v-else-if.`,
12763
- [31]: `v-for is missing expression.`,
12764
- [32]: `v-for has invalid expression.`,
12765
- [33]: `<template v-for> key should be placed on the <template> tag.`,
12766
- [34]: `v-bind is missing expression.`,
12767
- [35]: `v-on is missing expression.`,
12768
- [36]: `Unexpected custom directive on <slot> outlet.`,
12769
- [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.`,
12770
- [38]: `Duplicate slot names found. `,
12771
- [39]: `Extraneous children found when component already has explicitly named default slot. These children will be ignored.`,
12772
- [40]: `v-slot can only be used on components or <template> tags.`,
12773
- [41]: `v-model is missing expression.`,
12774
- [42]: `v-model value must be a valid JavaScript member expression.`,
12775
- [43]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`,
12776
- [44]: `v-model cannot be used on a prop, because local prop bindings are not writable.
12777
- Use a v-bind binding combined with a v-on listener that emits update:x event instead.`,
12778
- [45]: `Error parsing JavaScript expression: `,
12779
- [46]: `<KeepAlive> expects exactly one child component.`,
12780
- // generic errors
12781
- [47]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
12782
- [48]: `ES module mode is not supported in this build of compiler.`,
12783
- [49]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
12784
- [50]: `"scopeId" option is only supported in module mode.`,
12785
- // deprecations
12786
- [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.`,
12787
- [52]: `v-is="component-name" has been deprecated. Use is="vue:component-name" instead. v-is support will be removed in 3.4.`,
12788
- // just to fulfill types
12789
- [53]: ``
12790
- };
12791
-
12792
12744
  const FRAGMENT = Symbol(`Fragment` );
12793
12745
  const TELEPORT = Symbol(`Teleport` );
12794
12746
  const SUSPENSE = Symbol(`Suspense` );
@@ -12878,13 +12830,14 @@ function registerRuntimeHelpers(helpers) {
12878
12830
  }
12879
12831
 
12880
12832
  const locStub = {
12881
- source: "",
12882
12833
  start: { line: 1, column: 1, offset: 0 },
12883
- end: { line: 1, column: 1, offset: 0 }
12834
+ end: { line: 1, column: 1, offset: 0 },
12835
+ source: ""
12884
12836
  };
12885
- function createRoot(children, loc = locStub) {
12837
+ function createRoot(children, source = "") {
12886
12838
  return {
12887
12839
  type: 0,
12840
+ source,
12888
12841
  children,
12889
12842
  helpers: /* @__PURE__ */ new Set(),
12890
12843
  components: [],
@@ -12894,7 +12847,7 @@ function createRoot(children, loc = locStub) {
12894
12847
  cached: 0,
12895
12848
  temps: 0,
12896
12849
  codegenNode: void 0,
12897
- loc
12850
+ loc: locStub
12898
12851
  };
12899
12852
  }
12900
12853
  function createVNodeCall(context, tag, props, children, patchFlag, dynamicProps, directives, isBlock = false, disableTracking = false, isComponent = false, loc = locStub) {
@@ -13020,39 +12973,992 @@ function convertToBlock(node, { helper, removeHelper, inSSR }) {
13020
12973
  }
13021
12974
  }
13022
12975
 
13023
- const isStaticExp = (p) => p.type === 4 && p.isStatic;
13024
- const isBuiltInType = (tag, expected) => tag === expected || tag === hyphenate(expected);
13025
- function isCoreComponent(tag) {
13026
- if (isBuiltInType(tag, "Teleport")) {
13027
- return TELEPORT;
13028
- } else if (isBuiltInType(tag, "Suspense")) {
13029
- return SUSPENSE;
13030
- } else if (isBuiltInType(tag, "KeepAlive")) {
13031
- return KEEP_ALIVE;
13032
- } else if (isBuiltInType(tag, "BaseTransition")) {
13033
- return BASE_TRANSITION;
12976
+ const defaultDelimitersOpen = new Uint8Array([123, 123]);
12977
+ const defaultDelimitersClose = new Uint8Array([125, 125]);
12978
+ function isTagStartChar(c) {
12979
+ return c >= 97 && c <= 122 || c >= 65 && c <= 90;
12980
+ }
12981
+ function isWhitespace(c) {
12982
+ return c === 32 || c === 10 || c === 9 || c === 12 || c === 13;
12983
+ }
12984
+ function isEndOfTagSection(c) {
12985
+ return c === 47 || c === 62 || isWhitespace(c);
12986
+ }
12987
+ function toCharCodes(str) {
12988
+ const ret = new Uint8Array(str.length);
12989
+ for (let i = 0; i < str.length; i++) {
12990
+ ret[i] = str.charCodeAt(i);
13034
12991
  }
12992
+ return ret;
13035
12993
  }
13036
- const nonIdentifierRE = /^\d|[^\$\w]/;
13037
- const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
13038
- const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
13039
- const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
13040
- const whitespaceRE = /\s+[.[]\s*|\s*[.[]\s+/g;
13041
- const isMemberExpressionBrowser = (path) => {
13042
- path = path.trim().replace(whitespaceRE, (s) => s.trim());
13043
- let state = 0 /* inMemberExp */;
13044
- let stateStack = [];
13045
- let currentOpenBracketCount = 0;
13046
- let currentOpenParensCount = 0;
13047
- let currentStringType = null;
13048
- for (let i = 0; i < path.length; i++) {
13049
- const char = path.charAt(i);
13050
- switch (state) {
13051
- case 0 /* inMemberExp */:
13052
- if (char === "[") {
13053
- stateStack.push(state);
13054
- state = 1 /* inBrackets */;
13055
- currentOpenBracketCount++;
12994
+ const Sequences = {
12995
+ Cdata: new Uint8Array([67, 68, 65, 84, 65, 91]),
12996
+ // CDATA[
12997
+ CdataEnd: new Uint8Array([93, 93, 62]),
12998
+ // ]]>
12999
+ CommentEnd: new Uint8Array([45, 45, 62]),
13000
+ // `-->`
13001
+ ScriptEnd: new Uint8Array([60, 47, 115, 99, 114, 105, 112, 116]),
13002
+ // `<\/script`
13003
+ StyleEnd: new Uint8Array([60, 47, 115, 116, 121, 108, 101]),
13004
+ // `</style`
13005
+ TitleEnd: new Uint8Array([60, 47, 116, 105, 116, 108, 101]),
13006
+ // `</title`
13007
+ TextareaEnd: new Uint8Array([
13008
+ 60,
13009
+ 47,
13010
+ 116,
13011
+ 101,
13012
+ 120,
13013
+ 116,
13014
+ 97,
13015
+ 114,
13016
+ 101,
13017
+ 97
13018
+ ])
13019
+ // `</textarea
13020
+ };
13021
+ class Tokenizer {
13022
+ constructor(stack, cbs) {
13023
+ this.stack = stack;
13024
+ this.cbs = cbs;
13025
+ /** The current state the tokenizer is in. */
13026
+ this.state = 1;
13027
+ /** The read buffer. */
13028
+ this.buffer = "";
13029
+ /** The beginning of the section that is currently being read. */
13030
+ this.sectionStart = 0;
13031
+ /** The index within the buffer that we are currently looking at. */
13032
+ this.index = 0;
13033
+ /** The start of the last entity. */
13034
+ this.entityStart = 0;
13035
+ /** Some behavior, eg. when decoding entities, is done while we are in another state. This keeps track of the other state type. */
13036
+ this.baseState = 1;
13037
+ /** For special parsing behavior inside of script and style tags. */
13038
+ this.inRCDATA = false;
13039
+ /** For disabling RCDATA tags handling */
13040
+ this.inXML = false;
13041
+ /** Reocrd newline positions for fast line / column calculation */
13042
+ this.newlines = [];
13043
+ this.mode = 0;
13044
+ this.delimiterOpen = defaultDelimitersOpen;
13045
+ this.delimiterClose = defaultDelimitersClose;
13046
+ this.delimiterIndex = -1;
13047
+ this.currentSequence = void 0;
13048
+ this.sequenceIndex = 0;
13049
+ }
13050
+ get inSFCRoot() {
13051
+ return this.mode === 2 && this.stack.length === 0;
13052
+ }
13053
+ reset() {
13054
+ this.state = 1;
13055
+ this.mode = 0;
13056
+ this.buffer = "";
13057
+ this.sectionStart = 0;
13058
+ this.index = 0;
13059
+ this.baseState = 1;
13060
+ this.currentSequence = void 0;
13061
+ this.newlines.length = 0;
13062
+ this.delimiterOpen = defaultDelimitersOpen;
13063
+ this.delimiterClose = defaultDelimitersClose;
13064
+ }
13065
+ /**
13066
+ * Generate Position object with line / column information using recorded
13067
+ * newline positions. We know the index is always going to be an already
13068
+ * processed index, so all the newlines up to this index should have been
13069
+ * recorded.
13070
+ */
13071
+ getPos(index) {
13072
+ let line = 1;
13073
+ let column = index + 1;
13074
+ for (let i = this.newlines.length - 1; i >= 0; i--) {
13075
+ const newlineIndex = this.newlines[i];
13076
+ if (index > newlineIndex) {
13077
+ line = i + 2;
13078
+ column = index - newlineIndex;
13079
+ break;
13080
+ }
13081
+ }
13082
+ return {
13083
+ column,
13084
+ line,
13085
+ offset: index
13086
+ };
13087
+ }
13088
+ peek() {
13089
+ return this.buffer.charCodeAt(this.index + 1);
13090
+ }
13091
+ stateText(c) {
13092
+ if (c === 60) {
13093
+ if (this.index > this.sectionStart) {
13094
+ this.cbs.ontext(this.sectionStart, this.index);
13095
+ }
13096
+ this.state = 5;
13097
+ this.sectionStart = this.index;
13098
+ } else if (c === this.delimiterOpen[0]) {
13099
+ this.state = 2;
13100
+ this.delimiterIndex = 0;
13101
+ this.stateInterpolationOpen(c);
13102
+ }
13103
+ }
13104
+ stateInterpolationOpen(c) {
13105
+ if (c === this.delimiterOpen[this.delimiterIndex]) {
13106
+ if (this.delimiterIndex === this.delimiterOpen.length - 1) {
13107
+ const start = this.index + 1 - this.delimiterOpen.length;
13108
+ if (start > this.sectionStart) {
13109
+ this.cbs.ontext(this.sectionStart, start);
13110
+ }
13111
+ this.state = 3;
13112
+ this.sectionStart = start;
13113
+ } else {
13114
+ this.delimiterIndex++;
13115
+ }
13116
+ } else if (this.inRCDATA) {
13117
+ this.state = 32;
13118
+ this.stateInRCDATA(c);
13119
+ } else {
13120
+ this.state = 1;
13121
+ this.stateText(c);
13122
+ }
13123
+ }
13124
+ stateInterpolation(c) {
13125
+ if (c === this.delimiterClose[0]) {
13126
+ this.state = 4;
13127
+ this.delimiterIndex = 0;
13128
+ this.stateInterpolationClose(c);
13129
+ }
13130
+ }
13131
+ stateInterpolationClose(c) {
13132
+ if (c === this.delimiterClose[this.delimiterIndex]) {
13133
+ if (this.delimiterIndex === this.delimiterClose.length - 1) {
13134
+ this.cbs.oninterpolation(this.sectionStart, this.index + 1);
13135
+ if (this.inRCDATA) {
13136
+ this.state = 32;
13137
+ } else {
13138
+ this.state = 1;
13139
+ }
13140
+ this.sectionStart = this.index + 1;
13141
+ } else {
13142
+ this.delimiterIndex++;
13143
+ }
13144
+ } else {
13145
+ this.state = 3;
13146
+ this.stateInterpolation(c);
13147
+ }
13148
+ }
13149
+ stateSpecialStartSequence(c) {
13150
+ const isEnd = this.sequenceIndex === this.currentSequence.length;
13151
+ const isMatch = isEnd ? (
13152
+ // If we are at the end of the sequence, make sure the tag name has ended
13153
+ isEndOfTagSection(c)
13154
+ ) : (
13155
+ // Otherwise, do a case-insensitive comparison
13156
+ (c | 32) === this.currentSequence[this.sequenceIndex]
13157
+ );
13158
+ if (!isMatch) {
13159
+ this.inRCDATA = false;
13160
+ } else if (!isEnd) {
13161
+ this.sequenceIndex++;
13162
+ return;
13163
+ }
13164
+ this.sequenceIndex = 0;
13165
+ this.state = 6;
13166
+ this.stateInTagName(c);
13167
+ }
13168
+ /** Look for an end tag. For <title> and <textarea>, also decode entities. */
13169
+ stateInRCDATA(c) {
13170
+ if (this.sequenceIndex === this.currentSequence.length) {
13171
+ if (c === 62 || isWhitespace(c)) {
13172
+ const endOfText = this.index - this.currentSequence.length;
13173
+ if (this.sectionStart < endOfText) {
13174
+ const actualIndex = this.index;
13175
+ this.index = endOfText;
13176
+ this.cbs.ontext(this.sectionStart, endOfText);
13177
+ this.index = actualIndex;
13178
+ }
13179
+ this.sectionStart = endOfText + 2;
13180
+ this.stateInClosingTagName(c);
13181
+ this.inRCDATA = false;
13182
+ return;
13183
+ }
13184
+ this.sequenceIndex = 0;
13185
+ }
13186
+ if ((c | 32) === this.currentSequence[this.sequenceIndex]) {
13187
+ this.sequenceIndex += 1;
13188
+ } else if (this.sequenceIndex === 0) {
13189
+ if (this.currentSequence === Sequences.TitleEnd || this.currentSequence === Sequences.TextareaEnd && !this.inSFCRoot) {
13190
+ if (c === this.delimiterOpen[0]) {
13191
+ this.state = 2;
13192
+ this.delimiterIndex = 0;
13193
+ this.stateInterpolationOpen(c);
13194
+ }
13195
+ } else if (this.fastForwardTo(60)) {
13196
+ this.sequenceIndex = 1;
13197
+ }
13198
+ } else {
13199
+ this.sequenceIndex = Number(c === 60);
13200
+ }
13201
+ }
13202
+ stateCDATASequence(c) {
13203
+ if (c === Sequences.Cdata[this.sequenceIndex]) {
13204
+ if (++this.sequenceIndex === Sequences.Cdata.length) {
13205
+ this.state = 28;
13206
+ this.currentSequence = Sequences.CdataEnd;
13207
+ this.sequenceIndex = 0;
13208
+ this.sectionStart = this.index + 1;
13209
+ }
13210
+ } else {
13211
+ this.sequenceIndex = 0;
13212
+ this.state = 23;
13213
+ this.stateInDeclaration(c);
13214
+ }
13215
+ }
13216
+ /**
13217
+ * When we wait for one specific character, we can speed things up
13218
+ * by skipping through the buffer until we find it.
13219
+ *
13220
+ * @returns Whether the character was found.
13221
+ */
13222
+ fastForwardTo(c) {
13223
+ while (++this.index < this.buffer.length) {
13224
+ const cc = this.buffer.charCodeAt(this.index);
13225
+ if (cc === 10) {
13226
+ this.newlines.push(this.index);
13227
+ }
13228
+ if (cc === c) {
13229
+ return true;
13230
+ }
13231
+ }
13232
+ this.index = this.buffer.length - 1;
13233
+ return false;
13234
+ }
13235
+ /**
13236
+ * Comments and CDATA end with `-->` and `]]>`.
13237
+ *
13238
+ * Their common qualities are:
13239
+ * - Their end sequences have a distinct character they start with.
13240
+ * - That character is then repeated, so we have to check multiple repeats.
13241
+ * - All characters but the start character of the sequence can be skipped.
13242
+ */
13243
+ stateInCommentLike(c) {
13244
+ if (c === this.currentSequence[this.sequenceIndex]) {
13245
+ if (++this.sequenceIndex === this.currentSequence.length) {
13246
+ if (this.currentSequence === Sequences.CdataEnd) {
13247
+ this.cbs.oncdata(this.sectionStart, this.index - 2);
13248
+ } else {
13249
+ this.cbs.oncomment(this.sectionStart, this.index - 2);
13250
+ }
13251
+ this.sequenceIndex = 0;
13252
+ this.sectionStart = this.index + 1;
13253
+ this.state = 1;
13254
+ }
13255
+ } else if (this.sequenceIndex === 0) {
13256
+ if (this.fastForwardTo(this.currentSequence[0])) {
13257
+ this.sequenceIndex = 1;
13258
+ }
13259
+ } else if (c !== this.currentSequence[this.sequenceIndex - 1]) {
13260
+ this.sequenceIndex = 0;
13261
+ }
13262
+ }
13263
+ startSpecial(sequence, offset) {
13264
+ this.enterRCDATA(sequence, offset);
13265
+ this.state = 31;
13266
+ }
13267
+ enterRCDATA(sequence, offset) {
13268
+ this.inRCDATA = true;
13269
+ this.currentSequence = sequence;
13270
+ this.sequenceIndex = offset;
13271
+ }
13272
+ stateBeforeTagName(c) {
13273
+ if (c === 33) {
13274
+ this.state = 22;
13275
+ this.sectionStart = this.index + 1;
13276
+ } else if (c === 63) {
13277
+ this.state = 24;
13278
+ this.sectionStart = this.index + 1;
13279
+ } else if (isTagStartChar(c)) {
13280
+ this.sectionStart = this.index;
13281
+ if (this.mode === 0) {
13282
+ this.state = 6;
13283
+ } else if (this.inSFCRoot) {
13284
+ this.state = 34;
13285
+ } else if (!this.inXML) {
13286
+ const lower = c | 32;
13287
+ if (lower === 116) {
13288
+ this.state = 30;
13289
+ } else {
13290
+ this.state = lower === 115 ? 29 : 6;
13291
+ }
13292
+ } else {
13293
+ this.state = 6;
13294
+ }
13295
+ } else if (c === 47) {
13296
+ this.state = 8;
13297
+ } else {
13298
+ this.state = 1;
13299
+ this.stateText(c);
13300
+ }
13301
+ }
13302
+ stateInTagName(c) {
13303
+ if (isEndOfTagSection(c)) {
13304
+ this.handleTagName(c);
13305
+ }
13306
+ }
13307
+ stateInSFCRootTagName(c) {
13308
+ if (isEndOfTagSection(c)) {
13309
+ const tag = this.buffer.slice(this.sectionStart, this.index);
13310
+ if (tag !== "template") {
13311
+ this.enterRCDATA(toCharCodes(`</` + tag), 0);
13312
+ }
13313
+ this.handleTagName(c);
13314
+ }
13315
+ }
13316
+ handleTagName(c) {
13317
+ this.cbs.onopentagname(this.sectionStart, this.index);
13318
+ this.sectionStart = -1;
13319
+ this.state = 11;
13320
+ this.stateBeforeAttrName(c);
13321
+ }
13322
+ stateBeforeClosingTagName(c) {
13323
+ if (isWhitespace(c)) ; else if (c === 62) {
13324
+ {
13325
+ this.cbs.onerr(14, this.index);
13326
+ }
13327
+ this.state = 1;
13328
+ this.sectionStart = this.index + 1;
13329
+ } else {
13330
+ this.state = isTagStartChar(c) ? 9 : 27;
13331
+ this.sectionStart = this.index;
13332
+ }
13333
+ }
13334
+ stateInClosingTagName(c) {
13335
+ if (c === 62 || isWhitespace(c)) {
13336
+ this.cbs.onclosetag(this.sectionStart, this.index);
13337
+ this.sectionStart = -1;
13338
+ this.state = 10;
13339
+ this.stateAfterClosingTagName(c);
13340
+ }
13341
+ }
13342
+ stateAfterClosingTagName(c) {
13343
+ if (c === 62) {
13344
+ this.state = 1;
13345
+ this.sectionStart = this.index + 1;
13346
+ }
13347
+ }
13348
+ stateBeforeAttrName(c) {
13349
+ if (c === 62) {
13350
+ this.cbs.onopentagend(this.index);
13351
+ if (this.inRCDATA) {
13352
+ this.state = 32;
13353
+ } else {
13354
+ this.state = 1;
13355
+ }
13356
+ this.sectionStart = this.index + 1;
13357
+ } else if (c === 47) {
13358
+ this.state = 7;
13359
+ if (this.peek() !== 62) {
13360
+ this.cbs.onerr(22, this.index);
13361
+ }
13362
+ } else if (c === 60 && this.peek() === 47) {
13363
+ this.cbs.onopentagend(this.index);
13364
+ this.state = 5;
13365
+ this.sectionStart = this.index;
13366
+ } else if (!isWhitespace(c)) {
13367
+ if (c === 61) {
13368
+ this.cbs.onerr(
13369
+ 19,
13370
+ this.index
13371
+ );
13372
+ }
13373
+ this.handleAttrStart(c);
13374
+ }
13375
+ }
13376
+ handleAttrStart(c) {
13377
+ if (c === 118 && this.peek() === 45) {
13378
+ this.state = 13;
13379
+ this.sectionStart = this.index;
13380
+ } else if (c === 46 || c === 58 || c === 64 || c === 35) {
13381
+ this.cbs.ondirname(this.index, this.index + 1);
13382
+ this.state = 14;
13383
+ this.sectionStart = this.index + 1;
13384
+ } else {
13385
+ this.state = 12;
13386
+ this.sectionStart = this.index;
13387
+ }
13388
+ }
13389
+ stateInSelfClosingTag(c) {
13390
+ if (c === 62) {
13391
+ this.cbs.onselfclosingtag(this.index);
13392
+ this.state = 1;
13393
+ this.sectionStart = this.index + 1;
13394
+ this.inRCDATA = false;
13395
+ } else if (!isWhitespace(c)) {
13396
+ this.state = 11;
13397
+ this.stateBeforeAttrName(c);
13398
+ }
13399
+ }
13400
+ stateInAttrName(c) {
13401
+ if (c === 61 || isEndOfTagSection(c)) {
13402
+ this.cbs.onattribname(this.sectionStart, this.index);
13403
+ this.handleAttrNameEnd(c);
13404
+ } else if (c === 34 || c === 39 || c === 60) {
13405
+ this.cbs.onerr(
13406
+ 17,
13407
+ this.index
13408
+ );
13409
+ }
13410
+ }
13411
+ stateInDirName(c) {
13412
+ if (c === 61 || isEndOfTagSection(c)) {
13413
+ this.cbs.ondirname(this.sectionStart, this.index);
13414
+ this.handleAttrNameEnd(c);
13415
+ } else if (c === 58) {
13416
+ this.cbs.ondirname(this.sectionStart, this.index);
13417
+ this.state = 14;
13418
+ this.sectionStart = this.index + 1;
13419
+ } else if (c === 46) {
13420
+ this.cbs.ondirname(this.sectionStart, this.index);
13421
+ this.state = 16;
13422
+ this.sectionStart = this.index + 1;
13423
+ }
13424
+ }
13425
+ stateInDirArg(c) {
13426
+ if (c === 61 || isEndOfTagSection(c)) {
13427
+ this.cbs.ondirarg(this.sectionStart, this.index);
13428
+ this.handleAttrNameEnd(c);
13429
+ } else if (c === 91) {
13430
+ this.state = 15;
13431
+ } else if (c === 46) {
13432
+ this.cbs.ondirarg(this.sectionStart, this.index);
13433
+ this.state = 16;
13434
+ this.sectionStart = this.index + 1;
13435
+ }
13436
+ }
13437
+ stateInDynamicDirArg(c) {
13438
+ if (c === 93) {
13439
+ this.state = 14;
13440
+ } else if (c === 61 || isEndOfTagSection(c)) {
13441
+ this.cbs.ondirarg(this.sectionStart, this.index + 1);
13442
+ this.handleAttrNameEnd(c);
13443
+ {
13444
+ this.cbs.onerr(
13445
+ 27,
13446
+ this.index
13447
+ );
13448
+ }
13449
+ }
13450
+ }
13451
+ stateInDirModifier(c) {
13452
+ if (c === 61 || isEndOfTagSection(c)) {
13453
+ this.cbs.ondirmodifier(this.sectionStart, this.index);
13454
+ this.handleAttrNameEnd(c);
13455
+ } else if (c === 46) {
13456
+ this.cbs.ondirmodifier(this.sectionStart, this.index);
13457
+ this.sectionStart = this.index + 1;
13458
+ }
13459
+ }
13460
+ handleAttrNameEnd(c) {
13461
+ this.sectionStart = this.index;
13462
+ this.state = 17;
13463
+ this.cbs.onattribnameend(this.index);
13464
+ this.stateAfterAttrName(c);
13465
+ }
13466
+ stateAfterAttrName(c) {
13467
+ if (c === 61) {
13468
+ this.state = 18;
13469
+ } else if (c === 47 || c === 62) {
13470
+ this.cbs.onattribend(0, this.sectionStart);
13471
+ this.sectionStart = -1;
13472
+ this.state = 11;
13473
+ this.stateBeforeAttrName(c);
13474
+ } else if (!isWhitespace(c)) {
13475
+ this.cbs.onattribend(0, this.sectionStart);
13476
+ this.handleAttrStart(c);
13477
+ }
13478
+ }
13479
+ stateBeforeAttrValue(c) {
13480
+ if (c === 34) {
13481
+ this.state = 19;
13482
+ this.sectionStart = this.index + 1;
13483
+ } else if (c === 39) {
13484
+ this.state = 20;
13485
+ this.sectionStart = this.index + 1;
13486
+ } else if (!isWhitespace(c)) {
13487
+ this.sectionStart = this.index;
13488
+ this.state = 21;
13489
+ this.stateInAttrValueNoQuotes(c);
13490
+ }
13491
+ }
13492
+ handleInAttrValue(c, quote) {
13493
+ if (c === quote || this.fastForwardTo(quote)) {
13494
+ this.cbs.onattribdata(this.sectionStart, this.index);
13495
+ this.sectionStart = -1;
13496
+ this.cbs.onattribend(
13497
+ quote === 34 ? 3 : 2,
13498
+ this.index + 1
13499
+ );
13500
+ this.state = 11;
13501
+ }
13502
+ }
13503
+ stateInAttrValueDoubleQuotes(c) {
13504
+ this.handleInAttrValue(c, 34);
13505
+ }
13506
+ stateInAttrValueSingleQuotes(c) {
13507
+ this.handleInAttrValue(c, 39);
13508
+ }
13509
+ stateInAttrValueNoQuotes(c) {
13510
+ if (isWhitespace(c) || c === 62) {
13511
+ this.cbs.onattribdata(this.sectionStart, this.index);
13512
+ this.sectionStart = -1;
13513
+ this.cbs.onattribend(1, this.index);
13514
+ this.state = 11;
13515
+ this.stateBeforeAttrName(c);
13516
+ } else if (c === 34 || c === 39 || c === 60 || c === 61 || c === 96) {
13517
+ this.cbs.onerr(
13518
+ 18,
13519
+ this.index
13520
+ );
13521
+ } else ;
13522
+ }
13523
+ stateBeforeDeclaration(c) {
13524
+ if (c === 91) {
13525
+ this.state = 26;
13526
+ this.sequenceIndex = 0;
13527
+ } else {
13528
+ this.state = c === 45 ? 25 : 23;
13529
+ }
13530
+ }
13531
+ stateInDeclaration(c) {
13532
+ if (c === 62 || this.fastForwardTo(62)) {
13533
+ this.state = 1;
13534
+ this.sectionStart = this.index + 1;
13535
+ }
13536
+ }
13537
+ stateInProcessingInstruction(c) {
13538
+ if (c === 62 || this.fastForwardTo(62)) {
13539
+ this.cbs.onprocessinginstruction(this.sectionStart, this.index);
13540
+ this.state = 1;
13541
+ this.sectionStart = this.index + 1;
13542
+ }
13543
+ }
13544
+ stateBeforeComment(c) {
13545
+ if (c === 45) {
13546
+ this.state = 28;
13547
+ this.currentSequence = Sequences.CommentEnd;
13548
+ this.sequenceIndex = 2;
13549
+ this.sectionStart = this.index + 1;
13550
+ } else {
13551
+ this.state = 23;
13552
+ }
13553
+ }
13554
+ stateInSpecialComment(c) {
13555
+ if (c === 62 || this.fastForwardTo(62)) {
13556
+ this.cbs.oncomment(this.sectionStart, this.index);
13557
+ this.state = 1;
13558
+ this.sectionStart = this.index + 1;
13559
+ }
13560
+ }
13561
+ stateBeforeSpecialS(c) {
13562
+ const lower = c | 32;
13563
+ if (lower === Sequences.ScriptEnd[3]) {
13564
+ this.startSpecial(Sequences.ScriptEnd, 4);
13565
+ } else if (lower === Sequences.StyleEnd[3]) {
13566
+ this.startSpecial(Sequences.StyleEnd, 4);
13567
+ } else {
13568
+ this.state = 6;
13569
+ this.stateInTagName(c);
13570
+ }
13571
+ }
13572
+ stateBeforeSpecialT(c) {
13573
+ const lower = c | 32;
13574
+ if (lower === Sequences.TitleEnd[3]) {
13575
+ this.startSpecial(Sequences.TitleEnd, 4);
13576
+ } else if (lower === Sequences.TextareaEnd[3]) {
13577
+ this.startSpecial(Sequences.TextareaEnd, 4);
13578
+ } else {
13579
+ this.state = 6;
13580
+ this.stateInTagName(c);
13581
+ }
13582
+ }
13583
+ startEntity() {
13584
+ }
13585
+ stateInEntity() {
13586
+ }
13587
+ /**
13588
+ * Iterates through the buffer, calling the function corresponding to the current state.
13589
+ *
13590
+ * States that are more likely to be hit are higher up, as a performance improvement.
13591
+ */
13592
+ parse(input) {
13593
+ this.buffer = input;
13594
+ while (this.index < this.buffer.length) {
13595
+ const c = this.buffer.charCodeAt(this.index);
13596
+ if (c === 10) {
13597
+ this.newlines.push(this.index);
13598
+ }
13599
+ switch (this.state) {
13600
+ case 1: {
13601
+ this.stateText(c);
13602
+ break;
13603
+ }
13604
+ case 2: {
13605
+ this.stateInterpolationOpen(c);
13606
+ break;
13607
+ }
13608
+ case 3: {
13609
+ this.stateInterpolation(c);
13610
+ break;
13611
+ }
13612
+ case 4: {
13613
+ this.stateInterpolationClose(c);
13614
+ break;
13615
+ }
13616
+ case 31: {
13617
+ this.stateSpecialStartSequence(c);
13618
+ break;
13619
+ }
13620
+ case 32: {
13621
+ this.stateInRCDATA(c);
13622
+ break;
13623
+ }
13624
+ case 26: {
13625
+ this.stateCDATASequence(c);
13626
+ break;
13627
+ }
13628
+ case 19: {
13629
+ this.stateInAttrValueDoubleQuotes(c);
13630
+ break;
13631
+ }
13632
+ case 12: {
13633
+ this.stateInAttrName(c);
13634
+ break;
13635
+ }
13636
+ case 13: {
13637
+ this.stateInDirName(c);
13638
+ break;
13639
+ }
13640
+ case 14: {
13641
+ this.stateInDirArg(c);
13642
+ break;
13643
+ }
13644
+ case 15: {
13645
+ this.stateInDynamicDirArg(c);
13646
+ break;
13647
+ }
13648
+ case 16: {
13649
+ this.stateInDirModifier(c);
13650
+ break;
13651
+ }
13652
+ case 28: {
13653
+ this.stateInCommentLike(c);
13654
+ break;
13655
+ }
13656
+ case 27: {
13657
+ this.stateInSpecialComment(c);
13658
+ break;
13659
+ }
13660
+ case 11: {
13661
+ this.stateBeforeAttrName(c);
13662
+ break;
13663
+ }
13664
+ case 6: {
13665
+ this.stateInTagName(c);
13666
+ break;
13667
+ }
13668
+ case 34: {
13669
+ this.stateInSFCRootTagName(c);
13670
+ break;
13671
+ }
13672
+ case 9: {
13673
+ this.stateInClosingTagName(c);
13674
+ break;
13675
+ }
13676
+ case 5: {
13677
+ this.stateBeforeTagName(c);
13678
+ break;
13679
+ }
13680
+ case 17: {
13681
+ this.stateAfterAttrName(c);
13682
+ break;
13683
+ }
13684
+ case 20: {
13685
+ this.stateInAttrValueSingleQuotes(c);
13686
+ break;
13687
+ }
13688
+ case 18: {
13689
+ this.stateBeforeAttrValue(c);
13690
+ break;
13691
+ }
13692
+ case 8: {
13693
+ this.stateBeforeClosingTagName(c);
13694
+ break;
13695
+ }
13696
+ case 10: {
13697
+ this.stateAfterClosingTagName(c);
13698
+ break;
13699
+ }
13700
+ case 29: {
13701
+ this.stateBeforeSpecialS(c);
13702
+ break;
13703
+ }
13704
+ case 30: {
13705
+ this.stateBeforeSpecialT(c);
13706
+ break;
13707
+ }
13708
+ case 21: {
13709
+ this.stateInAttrValueNoQuotes(c);
13710
+ break;
13711
+ }
13712
+ case 7: {
13713
+ this.stateInSelfClosingTag(c);
13714
+ break;
13715
+ }
13716
+ case 23: {
13717
+ this.stateInDeclaration(c);
13718
+ break;
13719
+ }
13720
+ case 22: {
13721
+ this.stateBeforeDeclaration(c);
13722
+ break;
13723
+ }
13724
+ case 25: {
13725
+ this.stateBeforeComment(c);
13726
+ break;
13727
+ }
13728
+ case 24: {
13729
+ this.stateInProcessingInstruction(c);
13730
+ break;
13731
+ }
13732
+ case 33: {
13733
+ this.stateInEntity();
13734
+ break;
13735
+ }
13736
+ }
13737
+ this.index++;
13738
+ }
13739
+ this.cleanup();
13740
+ this.finish();
13741
+ }
13742
+ /**
13743
+ * Remove data that has already been consumed from the buffer.
13744
+ */
13745
+ cleanup() {
13746
+ if (this.sectionStart !== this.index) {
13747
+ if (this.state === 1 || this.state === 32 && this.sequenceIndex === 0) {
13748
+ this.cbs.ontext(this.sectionStart, this.index);
13749
+ this.sectionStart = this.index;
13750
+ } else if (this.state === 19 || this.state === 20 || this.state === 21) {
13751
+ this.cbs.onattribdata(this.sectionStart, this.index);
13752
+ this.sectionStart = this.index;
13753
+ }
13754
+ }
13755
+ }
13756
+ finish() {
13757
+ this.handleTrailingData();
13758
+ this.cbs.onend();
13759
+ }
13760
+ /** Handle any trailing data. */
13761
+ handleTrailingData() {
13762
+ const endIndex = this.buffer.length;
13763
+ if (this.sectionStart >= endIndex) {
13764
+ return;
13765
+ }
13766
+ if (this.state === 28) {
13767
+ if (this.currentSequence === Sequences.CdataEnd) {
13768
+ this.cbs.oncdata(this.sectionStart, endIndex);
13769
+ } else {
13770
+ this.cbs.oncomment(this.sectionStart, endIndex);
13771
+ }
13772
+ } 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 {
13773
+ this.cbs.ontext(this.sectionStart, endIndex);
13774
+ }
13775
+ }
13776
+ emitCodePoint(cp, consumed) {
13777
+ }
13778
+ }
13779
+
13780
+ const deprecationData = {
13781
+ ["COMPILER_IS_ON_ELEMENT"]: {
13782
+ 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:".`,
13783
+ link: `https://v3-migration.vuejs.org/breaking-changes/custom-elements-interop.html`
13784
+ },
13785
+ ["COMPILER_V_BIND_SYNC"]: {
13786
+ 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}\`.`,
13787
+ link: `https://v3-migration.vuejs.org/breaking-changes/v-model.html`
13788
+ },
13789
+ ["COMPILER_V_BIND_OBJECT_ORDER"]: {
13790
+ 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.`,
13791
+ link: `https://v3-migration.vuejs.org/breaking-changes/v-bind.html`
13792
+ },
13793
+ ["COMPILER_V_ON_NATIVE"]: {
13794
+ message: `.native modifier for v-on has been removed as is no longer necessary.`,
13795
+ link: `https://v3-migration.vuejs.org/breaking-changes/v-on-native-modifier-removed.html`
13796
+ },
13797
+ ["COMPILER_V_IF_V_FOR_PRECEDENCE"]: {
13798
+ 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.`,
13799
+ link: `https://v3-migration.vuejs.org/breaking-changes/v-if-v-for.html`
13800
+ },
13801
+ ["COMPILER_NATIVE_TEMPLATE"]: {
13802
+ message: `<template> with no special directives will render as a native template element instead of its inner content in Vue 3.`
13803
+ },
13804
+ ["COMPILER_INLINE_TEMPLATE"]: {
13805
+ message: `"inline-template" has been removed in Vue 3.`,
13806
+ link: `https://v3-migration.vuejs.org/breaking-changes/inline-template-attribute.html`
13807
+ },
13808
+ ["COMPILER_FILTER"]: {
13809
+ 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.`,
13810
+ link: `https://v3-migration.vuejs.org/breaking-changes/filters.html`
13811
+ }
13812
+ };
13813
+ function getCompatValue(key, { compatConfig }) {
13814
+ const value = compatConfig && compatConfig[key];
13815
+ if (key === "MODE") {
13816
+ return value || 3;
13817
+ } else {
13818
+ return value;
13819
+ }
13820
+ }
13821
+ function isCompatEnabled(key, context) {
13822
+ const mode = getCompatValue("MODE", context);
13823
+ const value = getCompatValue(key, context);
13824
+ return mode === 3 ? value === true : value !== false;
13825
+ }
13826
+ function checkCompatEnabled(key, context, loc, ...args) {
13827
+ const enabled = isCompatEnabled(key, context);
13828
+ if (enabled) {
13829
+ warnDeprecation(key, context, loc, ...args);
13830
+ }
13831
+ return enabled;
13832
+ }
13833
+ function warnDeprecation(key, context, loc, ...args) {
13834
+ const val = getCompatValue(key, context);
13835
+ if (val === "suppress-warning") {
13836
+ return;
13837
+ }
13838
+ const { message, link } = deprecationData[key];
13839
+ const msg = `(deprecation ${key}) ${typeof message === "function" ? message(...args) : message}${link ? `
13840
+ Details: ${link}` : ``}`;
13841
+ const err = new SyntaxError(msg);
13842
+ err.code = key;
13843
+ if (loc)
13844
+ err.loc = loc;
13845
+ context.onWarn(err);
13846
+ }
13847
+
13848
+ function defaultOnError(error) {
13849
+ throw error;
13850
+ }
13851
+ function defaultOnWarn(msg) {
13852
+ console.warn(`[Vue warn] ${msg.message}`);
13853
+ }
13854
+ function createCompilerError(code, loc, messages, additionalMessage) {
13855
+ const msg = (messages || errorMessages)[code] + (additionalMessage || ``) ;
13856
+ const error = new SyntaxError(String(msg));
13857
+ error.code = code;
13858
+ error.loc = loc;
13859
+ return error;
13860
+ }
13861
+ const errorMessages = {
13862
+ // parse errors
13863
+ [0]: "Illegal comment.",
13864
+ [1]: "CDATA section is allowed only in XML context.",
13865
+ [2]: "Duplicate attribute.",
13866
+ [3]: "End tag cannot have attributes.",
13867
+ [4]: "Illegal '/' in tags.",
13868
+ [5]: "Unexpected EOF in tag.",
13869
+ [6]: "Unexpected EOF in CDATA section.",
13870
+ [7]: "Unexpected EOF in comment.",
13871
+ [8]: "Unexpected EOF in script.",
13872
+ [9]: "Unexpected EOF in tag.",
13873
+ [10]: "Incorrectly closed comment.",
13874
+ [11]: "Incorrectly opened comment.",
13875
+ [12]: "Illegal tag name. Use '&lt;' to print '<'.",
13876
+ [13]: "Attribute value was expected.",
13877
+ [14]: "End tag name was expected.",
13878
+ [15]: "Whitespace was expected.",
13879
+ [16]: "Unexpected '<!--' in comment.",
13880
+ [17]: `Attribute name cannot contain U+0022 ("), U+0027 ('), and U+003C (<).`,
13881
+ [18]: "Unquoted attribute value cannot contain U+0022 (\"), U+0027 ('), U+003C (<), U+003D (=), and U+0060 (`).",
13882
+ [19]: "Attribute name cannot start with '='.",
13883
+ [21]: "'<?' is allowed only in XML context.",
13884
+ [20]: `Unexpected null character.`,
13885
+ [22]: "Illegal '/' in tags.",
13886
+ // Vue-specific parse errors
13887
+ [23]: "Invalid end tag.",
13888
+ [24]: "Element is missing end tag.",
13889
+ [25]: "Interpolation end sign was not found.",
13890
+ [27]: "End bracket for dynamic directive argument was not found. Note that dynamic directive argument cannot contain spaces.",
13891
+ [26]: "Legal directive name was expected.",
13892
+ // transform errors
13893
+ [28]: `v-if/v-else-if is missing expression.`,
13894
+ [29]: `v-if/else branches must use unique keys.`,
13895
+ [30]: `v-else/v-else-if has no adjacent v-if or v-else-if.`,
13896
+ [31]: `v-for is missing expression.`,
13897
+ [32]: `v-for has invalid expression.`,
13898
+ [33]: `<template v-for> key should be placed on the <template> tag.`,
13899
+ [34]: `v-bind is missing expression.`,
13900
+ [35]: `v-on is missing expression.`,
13901
+ [36]: `Unexpected custom directive on <slot> outlet.`,
13902
+ [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.`,
13903
+ [38]: `Duplicate slot names found. `,
13904
+ [39]: `Extraneous children found when component already has explicitly named default slot. These children will be ignored.`,
13905
+ [40]: `v-slot can only be used on components or <template> tags.`,
13906
+ [41]: `v-model is missing expression.`,
13907
+ [42]: `v-model value must be a valid JavaScript member expression.`,
13908
+ [43]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`,
13909
+ [44]: `v-model cannot be used on a prop, because local prop bindings are not writable.
13910
+ Use a v-bind binding combined with a v-on listener that emits update:x event instead.`,
13911
+ [45]: `Error parsing JavaScript expression: `,
13912
+ [46]: `<KeepAlive> expects exactly one child component.`,
13913
+ // generic errors
13914
+ [47]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
13915
+ [48]: `ES module mode is not supported in this build of compiler.`,
13916
+ [49]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
13917
+ [50]: `"scopeId" option is only supported in module mode.`,
13918
+ // deprecations
13919
+ [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.`,
13920
+ [52]: `v-is="component-name" has been deprecated. Use is="vue:component-name" instead. v-is support will be removed in 3.4.`,
13921
+ // just to fulfill types
13922
+ [53]: ``
13923
+ };
13924
+
13925
+ const isStaticExp = (p) => p.type === 4 && p.isStatic;
13926
+ function isCoreComponent(tag) {
13927
+ switch (tag) {
13928
+ case "Teleport":
13929
+ case "teleport":
13930
+ return TELEPORT;
13931
+ case "Suspense":
13932
+ case "suspense":
13933
+ return SUSPENSE;
13934
+ case "KeepAlive":
13935
+ case "keep-alive":
13936
+ return KEEP_ALIVE;
13937
+ case "BaseTransition":
13938
+ case "base-transition":
13939
+ return BASE_TRANSITION;
13940
+ }
13941
+ }
13942
+ const nonIdentifierRE = /^\d|[^\$\w]/;
13943
+ const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
13944
+ const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
13945
+ const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
13946
+ const whitespaceRE = /\s+[.[]\s*|\s*[.[]\s+/g;
13947
+ const isMemberExpressionBrowser = (path) => {
13948
+ path = path.trim().replace(whitespaceRE, (s) => s.trim());
13949
+ let state = 0 /* inMemberExp */;
13950
+ let stateStack = [];
13951
+ let currentOpenBracketCount = 0;
13952
+ let currentOpenParensCount = 0;
13953
+ let currentStringType = null;
13954
+ for (let i = 0; i < path.length; i++) {
13955
+ const char = path.charAt(i);
13956
+ switch (state) {
13957
+ case 0 /* inMemberExp */:
13958
+ if (char === "[") {
13959
+ stateStack.push(state);
13960
+ state = 1 /* inBrackets */;
13961
+ currentOpenBracketCount++;
13056
13962
  } else if (char === "(") {
13057
13963
  stateStack.push(state);
13058
13964
  state = 2 /* inParens */;
@@ -13101,43 +14007,6 @@ const isMemberExpressionBrowser = (path) => {
13101
14007
  return !currentOpenBracketCount && !currentOpenParensCount;
13102
14008
  };
13103
14009
  const isMemberExpression = isMemberExpressionBrowser ;
13104
- function getInnerRange(loc, offset, length) {
13105
- const source = loc.source.slice(offset, offset + length);
13106
- const newLoc = {
13107
- source,
13108
- start: advancePositionWithClone(loc.start, loc.source, offset),
13109
- end: loc.end
13110
- };
13111
- if (length != null) {
13112
- newLoc.end = advancePositionWithClone(
13113
- loc.start,
13114
- loc.source,
13115
- offset + length
13116
- );
13117
- }
13118
- return newLoc;
13119
- }
13120
- function advancePositionWithClone(pos, source, numberOfCharacters = source.length) {
13121
- return advancePositionWithMutation(
13122
- extend({}, pos),
13123
- source,
13124
- numberOfCharacters
13125
- );
13126
- }
13127
- function advancePositionWithMutation(pos, source, numberOfCharacters = source.length) {
13128
- let linesCount = 0;
13129
- let lastNewLinePos = -1;
13130
- for (let i = 0; i < numberOfCharacters; i++) {
13131
- if (source.charCodeAt(i) === 10) {
13132
- linesCount++;
13133
- lastNewLinePos = i;
13134
- }
13135
- }
13136
- pos.offset += numberOfCharacters;
13137
- pos.line += linesCount;
13138
- pos.column = lastNewLinePos === -1 ? pos.column + numberOfCharacters : numberOfCharacters - lastNewLinePos;
13139
- return pos;
13140
- }
13141
14010
  function assert(condition, msg) {
13142
14011
  if (!condition) {
13143
14012
  throw new Error(msg || `unexpected compiler condition`);
@@ -13244,508 +14113,599 @@ function injectProp(node, prop, context) {
13244
14113
  if (parentCall && parentCall.callee === GUARD_REACTIVE_PROPS) {
13245
14114
  parentCall = callPath[callPath.length - 2];
13246
14115
  }
13247
- }
13248
- if (node.type === 13) {
13249
- if (parentCall) {
13250
- parentCall.arguments[0] = propsWithInjection;
13251
- } else {
13252
- node.props = propsWithInjection;
13253
- }
13254
- } else {
13255
- if (parentCall) {
13256
- parentCall.arguments[0] = propsWithInjection;
13257
- } else {
13258
- node.arguments[2] = propsWithInjection;
13259
- }
13260
- }
13261
- }
13262
- function hasProp(prop, props) {
13263
- let result = false;
13264
- if (prop.key.type === 4) {
13265
- const propKeyName = prop.key.content;
13266
- result = props.properties.some(
13267
- (p) => p.key.type === 4 && p.key.content === propKeyName
13268
- );
13269
- }
13270
- return result;
13271
- }
13272
- function toValidAssetId(name, type) {
13273
- return `_${type}_${name.replace(/[^\w]/g, (searchValue, replaceValue) => {
13274
- return searchValue === "-" ? "_" : name.charCodeAt(replaceValue).toString();
13275
- })}`;
13276
- }
13277
- function getMemoedVNodeCall(node) {
13278
- if (node.type === 14 && node.callee === WITH_MEMO) {
13279
- return node.arguments[1].returns;
13280
- } else {
13281
- return node;
13282
- }
13283
- }
13284
-
13285
- const deprecationData = {
13286
- ["COMPILER_IS_ON_ELEMENT"]: {
13287
- 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:".`,
13288
- link: `https://v3-migration.vuejs.org/breaking-changes/custom-elements-interop.html`
13289
- },
13290
- ["COMPILER_V_BIND_SYNC"]: {
13291
- 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}\`.`,
13292
- link: `https://v3-migration.vuejs.org/breaking-changes/v-model.html`
13293
- },
13294
- ["COMPILER_V_BIND_PROP"]: {
13295
- 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.`
13296
- },
13297
- ["COMPILER_V_BIND_OBJECT_ORDER"]: {
13298
- 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.`,
13299
- link: `https://v3-migration.vuejs.org/breaking-changes/v-bind.html`
13300
- },
13301
- ["COMPILER_V_ON_NATIVE"]: {
13302
- message: `.native modifier for v-on has been removed as is no longer necessary.`,
13303
- link: `https://v3-migration.vuejs.org/breaking-changes/v-on-native-modifier-removed.html`
13304
- },
13305
- ["COMPILER_V_IF_V_FOR_PRECEDENCE"]: {
13306
- 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.`,
13307
- link: `https://v3-migration.vuejs.org/breaking-changes/v-if-v-for.html`
13308
- },
13309
- ["COMPILER_NATIVE_TEMPLATE"]: {
13310
- message: `<template> with no special directives will render as a native template element instead of its inner content in Vue 3.`
13311
- },
13312
- ["COMPILER_INLINE_TEMPLATE"]: {
13313
- message: `"inline-template" has been removed in Vue 3.`,
13314
- link: `https://v3-migration.vuejs.org/breaking-changes/inline-template-attribute.html`
13315
- },
13316
- ["COMPILER_FILTER"]: {
13317
- 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.`,
13318
- link: `https://v3-migration.vuejs.org/breaking-changes/filters.html`
13319
- }
13320
- };
13321
- function getCompatValue(key, context) {
13322
- const config = context.options ? context.options.compatConfig : context.compatConfig;
13323
- const value = config && config[key];
13324
- if (key === "MODE") {
13325
- return value || 3;
14116
+ }
14117
+ if (node.type === 13) {
14118
+ if (parentCall) {
14119
+ parentCall.arguments[0] = propsWithInjection;
14120
+ } else {
14121
+ node.props = propsWithInjection;
14122
+ }
13326
14123
  } else {
13327
- return value;
14124
+ if (parentCall) {
14125
+ parentCall.arguments[0] = propsWithInjection;
14126
+ } else {
14127
+ node.arguments[2] = propsWithInjection;
14128
+ }
13328
14129
  }
13329
14130
  }
13330
- function isCompatEnabled(key, context) {
13331
- const mode = getCompatValue("MODE", context);
13332
- const value = getCompatValue(key, context);
13333
- return mode === 3 ? value === true : value !== false;
13334
- }
13335
- function checkCompatEnabled(key, context, loc, ...args) {
13336
- const enabled = isCompatEnabled(key, context);
13337
- if (enabled) {
13338
- warnDeprecation(key, context, loc, ...args);
14131
+ function hasProp(prop, props) {
14132
+ let result = false;
14133
+ if (prop.key.type === 4) {
14134
+ const propKeyName = prop.key.content;
14135
+ result = props.properties.some(
14136
+ (p) => p.key.type === 4 && p.key.content === propKeyName
14137
+ );
13339
14138
  }
13340
- return enabled;
14139
+ return result;
13341
14140
  }
13342
- function warnDeprecation(key, context, loc, ...args) {
13343
- const val = getCompatValue(key, context);
13344
- if (val === "suppress-warning") {
13345
- return;
14141
+ function toValidAssetId(name, type) {
14142
+ return `_${type}_${name.replace(/[^\w]/g, (searchValue, replaceValue) => {
14143
+ return searchValue === "-" ? "_" : name.charCodeAt(replaceValue).toString();
14144
+ })}`;
14145
+ }
14146
+ function getMemoedVNodeCall(node) {
14147
+ if (node.type === 14 && node.callee === WITH_MEMO) {
14148
+ return node.arguments[1].returns;
14149
+ } else {
14150
+ return node;
13346
14151
  }
13347
- const { message, link } = deprecationData[key];
13348
- const msg = `(deprecation ${key}) ${typeof message === "function" ? message(...args) : message}${link ? `
13349
- Details: ${link}` : ``}`;
13350
- const err = new SyntaxError(msg);
13351
- err.code = key;
13352
- if (loc)
13353
- err.loc = loc;
13354
- context.onWarn(err);
13355
14152
  }
14153
+ const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
13356
14154
 
13357
- const decodeRE = /&(gt|lt|amp|apos|quot);/g;
13358
- const decodeMap = {
13359
- gt: ">",
13360
- lt: "<",
13361
- amp: "&",
13362
- apos: "'",
13363
- quot: '"'
13364
- };
13365
14155
  const defaultParserOptions = {
14156
+ parseMode: "base",
14157
+ ns: 0,
13366
14158
  delimiters: [`{{`, `}}`],
13367
14159
  getNamespace: () => 0,
13368
- getTextMode: () => 0,
13369
14160
  isVoidTag: NO,
13370
14161
  isPreTag: NO,
13371
14162
  isCustomElement: NO,
13372
- decodeEntities: (rawText) => rawText.replace(decodeRE, (_, p1) => decodeMap[p1]),
13373
14163
  onError: defaultOnError,
13374
14164
  onWarn: defaultOnWarn,
13375
14165
  comments: true
13376
14166
  };
13377
- function baseParse(content, options = {}) {
13378
- const context = createParserContext(content, options);
13379
- const start = getCursor(context);
13380
- return createRoot(
13381
- parseChildren(context, 0, []),
13382
- getSelection(context, start)
13383
- );
13384
- }
13385
- function createParserContext(content, rawOptions) {
13386
- const options = extend({}, defaultParserOptions);
13387
- let key;
13388
- for (key in rawOptions) {
13389
- options[key] = rawOptions[key] === void 0 ? defaultParserOptions[key] : rawOptions[key];
13390
- }
13391
- return {
13392
- options,
13393
- column: 1,
13394
- line: 1,
13395
- offset: 0,
13396
- originalSource: content,
13397
- source: content,
13398
- inPre: false,
13399
- inVPre: false,
13400
- onWarn: options.onWarn
13401
- };
13402
- }
13403
- function parseChildren(context, mode, ancestors) {
13404
- const parent = last(ancestors);
13405
- const ns = parent ? parent.ns : 0;
13406
- const nodes = [];
13407
- while (!isEnd(context, mode, ancestors)) {
13408
- const s = context.source;
13409
- let node = void 0;
13410
- if (mode === 0 || mode === 1) {
13411
- if (!context.inVPre && startsWith(s, context.options.delimiters[0])) {
13412
- node = parseInterpolation(context, mode);
13413
- } else if (mode === 0 && s[0] === "<") {
13414
- if (s.length === 1) {
13415
- emitError(context, 5, 1);
13416
- } else if (s[1] === "!") {
13417
- if (startsWith(s, "<!--")) {
13418
- node = parseComment(context);
13419
- } else if (startsWith(s, "<!DOCTYPE")) {
13420
- node = parseBogusComment(context);
13421
- } else if (startsWith(s, "<![CDATA[")) {
13422
- if (ns !== 0) {
13423
- node = parseCDATA(context, ancestors);
13424
- } else {
13425
- emitError(context, 1);
13426
- node = parseBogusComment(context);
13427
- }
13428
- } else {
13429
- emitError(context, 11);
13430
- node = parseBogusComment(context);
14167
+ let currentOptions = defaultParserOptions;
14168
+ let currentRoot = null;
14169
+ let currentInput = "";
14170
+ let currentOpenTag = null;
14171
+ let currentProp = null;
14172
+ let currentAttrValue = "";
14173
+ let currentAttrStartIndex = -1;
14174
+ let currentAttrEndIndex = -1;
14175
+ let inPre = 0;
14176
+ let inVPre = false;
14177
+ let currentVPreBoundary = null;
14178
+ const stack = [];
14179
+ const tokenizer = new Tokenizer(stack, {
14180
+ onerr: emitError,
14181
+ ontext(start, end) {
14182
+ onText(getSlice(start, end), start, end);
14183
+ },
14184
+ ontextentity(char, start, end) {
14185
+ onText(char, start, end);
14186
+ },
14187
+ oninterpolation(start, end) {
14188
+ if (inVPre) {
14189
+ return onText(getSlice(start, end), start, end);
14190
+ }
14191
+ let innerStart = start + tokenizer.delimiterOpen.length;
14192
+ let innerEnd = end - tokenizer.delimiterClose.length;
14193
+ while (isWhitespace(currentInput.charCodeAt(innerStart))) {
14194
+ innerStart++;
14195
+ }
14196
+ while (isWhitespace(currentInput.charCodeAt(innerEnd - 1))) {
14197
+ innerEnd--;
14198
+ }
14199
+ let exp = getSlice(innerStart, innerEnd);
14200
+ if (exp.includes("&")) {
14201
+ {
14202
+ exp = currentOptions.decodeEntities(exp, false);
14203
+ }
14204
+ }
14205
+ addNode({
14206
+ type: 5,
14207
+ content: createSimpleExpression(exp, false, getLoc(innerStart, innerEnd)),
14208
+ loc: getLoc(start, end)
14209
+ });
14210
+ },
14211
+ onopentagname(start, end) {
14212
+ const name = getSlice(start, end);
14213
+ currentOpenTag = {
14214
+ type: 1,
14215
+ tag: name,
14216
+ ns: currentOptions.getNamespace(name, stack[0], currentOptions.ns),
14217
+ tagType: 0,
14218
+ // will be refined on tag close
14219
+ props: [],
14220
+ children: [],
14221
+ loc: getLoc(start - 1, end),
14222
+ codegenNode: void 0
14223
+ };
14224
+ if (tokenizer.inSFCRoot) {
14225
+ currentOpenTag.innerLoc = getLoc(
14226
+ end + fastForward(end) + 1,
14227
+ end
14228
+ );
14229
+ }
14230
+ },
14231
+ onopentagend(end) {
14232
+ endOpenTag(end);
14233
+ },
14234
+ onclosetag(start, end) {
14235
+ const name = getSlice(start, end);
14236
+ if (!currentOptions.isVoidTag(name)) {
14237
+ let found = false;
14238
+ for (let i = 0; i < stack.length; i++) {
14239
+ const e = stack[i];
14240
+ if (e.tag.toLowerCase() === name.toLowerCase()) {
14241
+ found = true;
14242
+ if (i > 0) {
14243
+ emitError(24, stack[0].loc.start.offset);
13431
14244
  }
13432
- } else if (s[1] === "/") {
13433
- if (s.length === 2) {
13434
- emitError(context, 5, 2);
13435
- } else if (s[2] === ">") {
13436
- emitError(context, 14, 2);
13437
- advanceBy(context, 3);
13438
- continue;
13439
- } else if (/[a-z]/i.test(s[2])) {
13440
- emitError(context, 23);
13441
- parseTag(context, 1 /* End */, parent);
13442
- continue;
13443
- } else {
13444
- emitError(
13445
- context,
13446
- 12,
13447
- 2
13448
- );
13449
- node = parseBogusComment(context);
14245
+ for (let j = 0; j <= i; j++) {
14246
+ const el = stack.shift();
14247
+ onCloseTag(el, end, j < i);
13450
14248
  }
13451
- } else if (/[a-z]/i.test(s[1])) {
13452
- node = parseElement(context, ancestors);
13453
- if (isCompatEnabled(
13454
- "COMPILER_NATIVE_TEMPLATE",
13455
- context
13456
- ) && node && node.tag === "template" && !node.props.some(
13457
- (p) => p.type === 7 && isSpecialTemplateDirective(p.name)
13458
- )) {
13459
- warnDeprecation(
13460
- "COMPILER_NATIVE_TEMPLATE",
13461
- context,
13462
- node.loc
13463
- );
13464
- node = node.children;
14249
+ break;
14250
+ }
14251
+ }
14252
+ if (!found) {
14253
+ emitError(23, backTrack(start, 60));
14254
+ }
14255
+ }
14256
+ },
14257
+ onselfclosingtag(end) {
14258
+ var _a;
14259
+ const name = currentOpenTag.tag;
14260
+ currentOpenTag.isSelfClosing = true;
14261
+ endOpenTag(end);
14262
+ if (((_a = stack[0]) == null ? void 0 : _a.tag) === name) {
14263
+ onCloseTag(stack.shift(), end);
14264
+ }
14265
+ },
14266
+ onattribname(start, end) {
14267
+ currentProp = {
14268
+ type: 6,
14269
+ name: getSlice(start, end),
14270
+ nameLoc: getLoc(start, end),
14271
+ value: void 0,
14272
+ loc: getLoc(start)
14273
+ };
14274
+ },
14275
+ ondirname(start, end) {
14276
+ const raw = getSlice(start, end);
14277
+ const name = raw === "." || raw === ":" ? "bind" : raw === "@" ? "on" : raw === "#" ? "slot" : raw.slice(2);
14278
+ if (!inVPre && name === "") {
14279
+ emitError(26, start);
14280
+ }
14281
+ if (inVPre || name === "") {
14282
+ currentProp = {
14283
+ type: 6,
14284
+ name: raw,
14285
+ nameLoc: getLoc(start, end),
14286
+ value: void 0,
14287
+ loc: getLoc(start)
14288
+ };
14289
+ } else {
14290
+ currentProp = {
14291
+ type: 7,
14292
+ name,
14293
+ rawName: raw,
14294
+ exp: void 0,
14295
+ arg: void 0,
14296
+ modifiers: raw === "." ? ["prop"] : [],
14297
+ loc: getLoc(start)
14298
+ };
14299
+ if (name === "pre") {
14300
+ inVPre = true;
14301
+ currentVPreBoundary = currentOpenTag;
14302
+ const props = currentOpenTag.props;
14303
+ for (let i = 0; i < props.length; i++) {
14304
+ if (props[i].type === 7) {
14305
+ props[i] = dirToAttr(props[i]);
13465
14306
  }
13466
- } else if (s[1] === "?") {
13467
- emitError(
13468
- context,
13469
- 21,
13470
- 1
13471
- );
13472
- node = parseBogusComment(context);
13473
- } else {
13474
- emitError(context, 12, 1);
13475
14307
  }
13476
14308
  }
13477
14309
  }
13478
- if (!node) {
13479
- node = parseText(context, mode);
14310
+ },
14311
+ ondirarg(start, end) {
14312
+ if (start === end)
14313
+ return;
14314
+ const arg = getSlice(start, end);
14315
+ if (inVPre) {
14316
+ currentProp.name += arg;
14317
+ setLocEnd(currentProp.nameLoc, end);
14318
+ } else {
14319
+ const isStatic = arg[0] !== `[`;
14320
+ currentProp.arg = createSimpleExpression(
14321
+ isStatic ? arg : arg.slice(1, -1),
14322
+ isStatic,
14323
+ getLoc(start, end),
14324
+ isStatic ? 3 : 0
14325
+ );
13480
14326
  }
13481
- if (isArray(node)) {
13482
- for (let i = 0; i < node.length; i++) {
13483
- pushNode(nodes, node[i]);
14327
+ },
14328
+ ondirmodifier(start, end) {
14329
+ const mod = getSlice(start, end);
14330
+ if (inVPre) {
14331
+ currentProp.name += "." + mod;
14332
+ setLocEnd(currentProp.nameLoc, end);
14333
+ } else if (currentProp.name === "slot") {
14334
+ const arg = currentProp.arg;
14335
+ if (arg) {
14336
+ arg.content += "." + mod;
14337
+ setLocEnd(arg.loc, end);
13484
14338
  }
13485
14339
  } else {
13486
- pushNode(nodes, node);
14340
+ currentProp.modifiers.push(mod);
13487
14341
  }
13488
- }
13489
- let removedWhitespace = false;
13490
- if (mode !== 2 && mode !== 1) {
13491
- const shouldCondense = context.options.whitespace !== "preserve";
13492
- for (let i = 0; i < nodes.length; i++) {
13493
- const node = nodes[i];
13494
- if (node.type === 2) {
13495
- if (!context.inPre) {
13496
- if (!/[^\t\r\n\f ]/.test(node.content)) {
13497
- const prev = nodes[i - 1];
13498
- const next = nodes[i + 1];
13499
- 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))) {
13500
- removedWhitespace = true;
13501
- nodes[i] = null;
13502
- } else {
13503
- node.content = " ";
13504
- }
13505
- } else if (shouldCondense) {
13506
- node.content = node.content.replace(/[\t\r\n\f ]+/g, " ");
14342
+ },
14343
+ onattribdata(start, end) {
14344
+ currentAttrValue += getSlice(start, end);
14345
+ if (currentAttrStartIndex < 0)
14346
+ currentAttrStartIndex = start;
14347
+ currentAttrEndIndex = end;
14348
+ },
14349
+ onattribentity(char, start, end) {
14350
+ currentAttrValue += char;
14351
+ if (currentAttrStartIndex < 0)
14352
+ currentAttrStartIndex = start;
14353
+ currentAttrEndIndex = end;
14354
+ },
14355
+ onattribnameend(end) {
14356
+ const start = currentProp.loc.start.offset;
14357
+ const name = getSlice(start, end);
14358
+ if (currentProp.type === 7) {
14359
+ currentProp.rawName = name;
14360
+ }
14361
+ if (currentOpenTag.props.some(
14362
+ (p) => (p.type === 7 ? p.rawName : p.name) === name
14363
+ )) {
14364
+ emitError(2, start);
14365
+ }
14366
+ },
14367
+ onattribend(quote, end) {
14368
+ if (currentOpenTag && currentProp) {
14369
+ setLocEnd(currentProp.loc, end);
14370
+ if (quote !== 0) {
14371
+ if (currentAttrValue.includes("&")) {
14372
+ currentAttrValue = currentOptions.decodeEntities(
14373
+ currentAttrValue,
14374
+ true
14375
+ );
14376
+ }
14377
+ if (currentProp.type === 6) {
14378
+ if (currentProp.name === "class") {
14379
+ currentAttrValue = condense(currentAttrValue).trim();
14380
+ }
14381
+ if (quote === 1 && !currentAttrValue) {
14382
+ emitError(13, end);
14383
+ }
14384
+ currentProp.value = {
14385
+ type: 2,
14386
+ content: currentAttrValue,
14387
+ loc: quote === 1 ? getLoc(currentAttrStartIndex, currentAttrEndIndex) : getLoc(currentAttrStartIndex - 1, currentAttrEndIndex + 1)
14388
+ };
14389
+ if (tokenizer.inSFCRoot && currentOpenTag.tag === "template" && currentProp.name === "lang" && currentAttrValue && currentAttrValue !== "html") {
14390
+ tokenizer.enterRCDATA(toCharCodes(`</template`), 0);
13507
14391
  }
13508
14392
  } else {
13509
- node.content = node.content.replace(/\r\n/g, "\n");
14393
+ currentProp.exp = createSimpleExpression(
14394
+ currentAttrValue,
14395
+ false,
14396
+ getLoc(currentAttrStartIndex, currentAttrEndIndex)
14397
+ );
14398
+ if (currentProp.name === "for") {
14399
+ currentProp.forParseResult = parseForExpression(currentProp.exp);
14400
+ }
14401
+ let syncIndex = -1;
14402
+ if (currentProp.name === "bind" && (syncIndex = currentProp.modifiers.indexOf("sync")) > -1 && checkCompatEnabled(
14403
+ "COMPILER_V_BIND_SYNC",
14404
+ currentOptions,
14405
+ currentProp.loc,
14406
+ currentProp.rawName
14407
+ )) {
14408
+ currentProp.name = "model";
14409
+ currentProp.modifiers.splice(syncIndex, 1);
14410
+ }
13510
14411
  }
13511
- } else if (node.type === 3 && !context.options.comments) {
13512
- removedWhitespace = true;
13513
- nodes[i] = null;
13514
14412
  }
14413
+ if (currentProp.type !== 7 || currentProp.name !== "pre") {
14414
+ currentOpenTag.props.push(currentProp);
14415
+ }
14416
+ }
14417
+ currentAttrValue = "";
14418
+ currentAttrStartIndex = currentAttrEndIndex = -1;
14419
+ },
14420
+ oncomment(start, end) {
14421
+ if (currentOptions.comments) {
14422
+ addNode({
14423
+ type: 3,
14424
+ content: getSlice(start, end),
14425
+ loc: getLoc(start - 4, end + 3)
14426
+ });
13515
14427
  }
13516
- if (context.inPre && parent && context.options.isPreTag(parent.tag)) {
13517
- const first = nodes[0];
13518
- if (first && first.type === 2) {
13519
- first.content = first.content.replace(/^\r?\n/, "");
14428
+ },
14429
+ onend() {
14430
+ const end = currentInput.length;
14431
+ if (tokenizer.state !== 1) {
14432
+ switch (tokenizer.state) {
14433
+ case 5:
14434
+ case 8:
14435
+ emitError(5, end);
14436
+ break;
14437
+ case 3:
14438
+ case 4:
14439
+ emitError(
14440
+ 25,
14441
+ tokenizer.sectionStart
14442
+ );
14443
+ break;
14444
+ case 28:
14445
+ if (tokenizer.currentSequence === Sequences.CdataEnd) {
14446
+ emitError(6, end);
14447
+ } else {
14448
+ emitError(7, end);
14449
+ }
14450
+ break;
14451
+ case 6:
14452
+ case 7:
14453
+ case 9:
14454
+ case 11:
14455
+ case 12:
14456
+ case 13:
14457
+ case 14:
14458
+ case 15:
14459
+ case 16:
14460
+ case 17:
14461
+ case 18:
14462
+ case 19:
14463
+ case 20:
14464
+ case 21:
14465
+ emitError(9, end);
14466
+ break;
13520
14467
  }
13521
14468
  }
13522
- }
13523
- return removedWhitespace ? nodes.filter(Boolean) : nodes;
13524
- }
13525
- function pushNode(nodes, node) {
13526
- if (node.type === 2) {
13527
- const prev = last(nodes);
13528
- if (prev && prev.type === 2 && prev.loc.end.offset === node.loc.start.offset) {
13529
- prev.content += node.content;
13530
- prev.loc.end = node.loc.end;
13531
- prev.loc.source += node.loc.source;
13532
- return;
14469
+ for (let index = 0; index < stack.length; index++) {
14470
+ onCloseTag(stack[index], end - 1);
14471
+ emitError(24, stack[index].loc.start.offset);
13533
14472
  }
13534
- }
13535
- nodes.push(node);
13536
- }
13537
- function parseCDATA(context, ancestors) {
13538
- advanceBy(context, 9);
13539
- const nodes = parseChildren(context, 3, ancestors);
13540
- if (context.source.length === 0) {
13541
- emitError(context, 6);
13542
- } else {
13543
- advanceBy(context, 3);
13544
- }
13545
- return nodes;
13546
- }
13547
- function parseComment(context) {
13548
- const start = getCursor(context);
13549
- let content;
13550
- const match = /--(\!)?>/.exec(context.source);
13551
- if (!match) {
13552
- content = context.source.slice(4);
13553
- advanceBy(context, context.source.length);
13554
- emitError(context, 7);
13555
- } else {
13556
- if (match.index <= 3) {
13557
- emitError(context, 0);
14473
+ },
14474
+ oncdata(start, end) {
14475
+ if (stack[0].ns !== 0) {
14476
+ onText(getSlice(start, end), start, end);
14477
+ } else {
14478
+ emitError(1, start - 9);
14479
+ }
14480
+ },
14481
+ onprocessinginstruction(start) {
14482
+ if ((stack[0] ? stack[0].ns : currentOptions.ns) === 0) {
14483
+ emitError(
14484
+ 21,
14485
+ start - 1
14486
+ );
13558
14487
  }
13559
- if (match[1]) {
13560
- emitError(context, 10);
14488
+ }
14489
+ });
14490
+ const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
14491
+ const stripParensRE = /^\(|\)$/g;
14492
+ function parseForExpression(input) {
14493
+ const loc = input.loc;
14494
+ const exp = input.content;
14495
+ const inMatch = exp.match(forAliasRE);
14496
+ if (!inMatch)
14497
+ return;
14498
+ const [, LHS, RHS] = inMatch;
14499
+ const createAliasExpression = (content, offset) => {
14500
+ const start = loc.start.offset + offset;
14501
+ const end = start + content.length;
14502
+ return createSimpleExpression(content, false, getLoc(start, end));
14503
+ };
14504
+ const result = {
14505
+ source: createAliasExpression(RHS.trim(), exp.indexOf(RHS, LHS.length)),
14506
+ value: void 0,
14507
+ key: void 0,
14508
+ index: void 0,
14509
+ finalized: false
14510
+ };
14511
+ let valueContent = LHS.trim().replace(stripParensRE, "").trim();
14512
+ const trimmedOffset = LHS.indexOf(valueContent);
14513
+ const iteratorMatch = valueContent.match(forIteratorRE);
14514
+ if (iteratorMatch) {
14515
+ valueContent = valueContent.replace(forIteratorRE, "").trim();
14516
+ const keyContent = iteratorMatch[1].trim();
14517
+ let keyOffset;
14518
+ if (keyContent) {
14519
+ keyOffset = exp.indexOf(keyContent, trimmedOffset + valueContent.length);
14520
+ result.key = createAliasExpression(keyContent, keyOffset);
13561
14521
  }
13562
- content = context.source.slice(4, match.index);
13563
- const s = context.source.slice(0, match.index);
13564
- let prevIndex = 1, nestedIndex = 0;
13565
- while ((nestedIndex = s.indexOf("<!--", prevIndex)) !== -1) {
13566
- advanceBy(context, nestedIndex - prevIndex + 1);
13567
- if (nestedIndex + 4 < s.length) {
13568
- emitError(context, 16);
14522
+ if (iteratorMatch[2]) {
14523
+ const indexContent = iteratorMatch[2].trim();
14524
+ if (indexContent) {
14525
+ result.index = createAliasExpression(
14526
+ indexContent,
14527
+ exp.indexOf(
14528
+ indexContent,
14529
+ result.key ? keyOffset + keyContent.length : trimmedOffset + valueContent.length
14530
+ )
14531
+ );
13569
14532
  }
13570
- prevIndex = nestedIndex + 1;
13571
14533
  }
13572
- advanceBy(context, match.index + match[0].length - prevIndex + 1);
13573
14534
  }
13574
- return {
13575
- type: 3,
13576
- content,
13577
- loc: getSelection(context, start)
13578
- };
14535
+ if (valueContent) {
14536
+ result.value = createAliasExpression(valueContent, trimmedOffset);
14537
+ }
14538
+ return result;
14539
+ }
14540
+ function getSlice(start, end) {
14541
+ return currentInput.slice(start, end);
13579
14542
  }
13580
- function parseBogusComment(context) {
13581
- const start = getCursor(context);
13582
- const contentStart = context.source[1] === "?" ? 1 : 2;
13583
- let content;
13584
- const closeIndex = context.source.indexOf(">");
13585
- if (closeIndex === -1) {
13586
- content = context.source.slice(contentStart);
13587
- advanceBy(context, context.source.length);
14543
+ function endOpenTag(end) {
14544
+ addNode(currentOpenTag);
14545
+ const { tag, ns } = currentOpenTag;
14546
+ if (ns === 0 && currentOptions.isPreTag(tag)) {
14547
+ inPre++;
14548
+ }
14549
+ if (currentOptions.isVoidTag(tag)) {
14550
+ onCloseTag(currentOpenTag, end);
13588
14551
  } else {
13589
- content = context.source.slice(contentStart, closeIndex);
13590
- advanceBy(context, closeIndex + 1);
14552
+ stack.unshift(currentOpenTag);
14553
+ if (ns === 1 || ns === 2) {
14554
+ tokenizer.inXML = true;
14555
+ }
13591
14556
  }
13592
- return {
13593
- type: 3,
13594
- content,
13595
- loc: getSelection(context, start)
13596
- };
14557
+ currentOpenTag = null;
13597
14558
  }
13598
- function parseElement(context, ancestors) {
13599
- const wasInPre = context.inPre;
13600
- const wasInVPre = context.inVPre;
13601
- const parent = last(ancestors);
13602
- const element = parseTag(context, 0 /* Start */, parent);
13603
- const isPreBoundary = context.inPre && !wasInPre;
13604
- const isVPreBoundary = context.inVPre && !wasInVPre;
13605
- if (element.isSelfClosing || context.options.isVoidTag(element.tag)) {
13606
- if (isPreBoundary) {
13607
- context.inPre = false;
13608
- }
13609
- if (isVPreBoundary) {
13610
- context.inVPre = false;
13611
- }
13612
- return element;
13613
- }
13614
- ancestors.push(element);
13615
- const mode = context.options.getTextMode(element, parent);
13616
- const children = parseChildren(context, mode, ancestors);
13617
- ancestors.pop();
14559
+ function onText(content, start, end) {
14560
+ var _a;
13618
14561
  {
13619
- const inlineTemplateProp = element.props.find(
13620
- (p) => p.type === 6 && p.name === "inline-template"
13621
- );
13622
- if (inlineTemplateProp && checkCompatEnabled(
13623
- "COMPILER_INLINE_TEMPLATE",
13624
- context,
13625
- inlineTemplateProp.loc
13626
- )) {
13627
- const loc = getSelection(context, element.loc.end);
13628
- inlineTemplateProp.value = {
13629
- type: 2,
13630
- content: loc.source,
13631
- loc
13632
- };
14562
+ const tag = (_a = stack[0]) == null ? void 0 : _a.tag;
14563
+ if (tag !== "script" && tag !== "style" && content.includes("&")) {
14564
+ content = currentOptions.decodeEntities(content, false);
13633
14565
  }
13634
14566
  }
13635
- element.children = children;
13636
- if (startsWithEndTagOpen(context.source, element.tag)) {
13637
- parseTag(context, 1 /* End */, parent);
14567
+ const parent = stack[0] || currentRoot;
14568
+ const lastNode = parent.children[parent.children.length - 1];
14569
+ if ((lastNode == null ? void 0 : lastNode.type) === 2) {
14570
+ lastNode.content += content;
14571
+ setLocEnd(lastNode.loc, end);
13638
14572
  } else {
13639
- emitError(context, 24, 0, element.loc.start);
13640
- if (context.source.length === 0 && element.tag.toLowerCase() === "script") {
13641
- const first = children[0];
13642
- if (first && startsWith(first.loc.source, "<!--")) {
13643
- emitError(context, 8);
13644
- }
14573
+ parent.children.push({
14574
+ type: 2,
14575
+ content,
14576
+ loc: getLoc(start, end)
14577
+ });
14578
+ }
14579
+ }
14580
+ function onCloseTag(el, end, isImplied = false) {
14581
+ if (isImplied) {
14582
+ setLocEnd(el.loc, backTrack(end, 60));
14583
+ } else {
14584
+ setLocEnd(el.loc, end + fastForward(end) + 1);
14585
+ }
14586
+ if (tokenizer.inSFCRoot) {
14587
+ if (el.children.length) {
14588
+ el.innerLoc.end = extend({}, el.children[el.children.length - 1].loc.end);
14589
+ } else {
14590
+ el.innerLoc.end = extend({}, el.innerLoc.start);
14591
+ }
14592
+ el.innerLoc.source = getSlice(
14593
+ el.innerLoc.start.offset,
14594
+ el.innerLoc.end.offset
14595
+ );
14596
+ }
14597
+ const { tag, ns } = el;
14598
+ if (!inVPre) {
14599
+ if (tag === "slot") {
14600
+ el.tagType = 2;
14601
+ } else if (isFragmentTemplate(el)) {
14602
+ el.tagType = 3;
14603
+ } else if (isComponent(el)) {
14604
+ el.tagType = 1;
13645
14605
  }
13646
14606
  }
13647
- element.loc = getSelection(context, element.loc.start);
13648
- if (isPreBoundary) {
13649
- context.inPre = false;
14607
+ if (!tokenizer.inRCDATA) {
14608
+ el.children = condenseWhitespace(el.children, el.tag);
13650
14609
  }
13651
- if (isVPreBoundary) {
13652
- context.inVPre = false;
14610
+ if (ns === 0 && currentOptions.isPreTag(tag)) {
14611
+ inPre--;
13653
14612
  }
13654
- return element;
13655
- }
13656
- const isSpecialTemplateDirective = /* @__PURE__ */ makeMap(
13657
- `if,else,else-if,for,slot`
13658
- );
13659
- function parseTag(context, type, parent) {
13660
- const start = getCursor(context);
13661
- const match = /^<\/?([a-z][^\t\r\n\f />]*)/i.exec(context.source);
13662
- const tag = match[1];
13663
- const ns = context.options.getNamespace(tag, parent);
13664
- advanceBy(context, match[0].length);
13665
- advanceSpaces(context);
13666
- const cursor = getCursor(context);
13667
- const currentSource = context.source;
13668
- if (context.options.isPreTag(tag)) {
13669
- context.inPre = true;
13670
- }
13671
- let props = parseAttributes(context, type);
13672
- if (type === 0 /* Start */ && !context.inVPre && props.some((p) => p.type === 7 && p.name === "pre")) {
13673
- context.inVPre = true;
13674
- extend(context, cursor);
13675
- context.source = currentSource;
13676
- props = parseAttributes(context, type).filter((p) => p.name !== "v-pre");
13677
- }
13678
- let isSelfClosing = false;
13679
- if (context.source.length === 0) {
13680
- emitError(context, 9);
13681
- } else {
13682
- isSelfClosing = startsWith(context.source, "/>");
13683
- if (type === 1 /* End */ && isSelfClosing) {
13684
- emitError(context, 4);
14613
+ if (currentVPreBoundary === el) {
14614
+ inVPre = false;
14615
+ currentVPreBoundary = null;
14616
+ }
14617
+ if (tokenizer.inXML && (stack[0] ? stack[0].ns : currentOptions.ns) === 0) {
14618
+ tokenizer.inXML = false;
14619
+ }
14620
+ {
14621
+ const props = el.props;
14622
+ if (isCompatEnabled(
14623
+ "COMPILER_V_IF_V_FOR_PRECEDENCE",
14624
+ currentOptions
14625
+ )) {
14626
+ let hasIf = false;
14627
+ let hasFor = false;
14628
+ for (let i = 0; i < props.length; i++) {
14629
+ const p = props[i];
14630
+ if (p.type === 7) {
14631
+ if (p.name === "if") {
14632
+ hasIf = true;
14633
+ } else if (p.name === "for") {
14634
+ hasFor = true;
14635
+ }
14636
+ }
14637
+ if (hasIf && hasFor) {
14638
+ warnDeprecation(
14639
+ "COMPILER_V_IF_V_FOR_PRECEDENCE",
14640
+ currentOptions,
14641
+ el.loc
14642
+ );
14643
+ break;
14644
+ }
14645
+ }
14646
+ }
14647
+ if (isCompatEnabled(
14648
+ "COMPILER_NATIVE_TEMPLATE",
14649
+ currentOptions
14650
+ ) && el.tag === "template" && !isFragmentTemplate(el)) {
14651
+ warnDeprecation(
14652
+ "COMPILER_NATIVE_TEMPLATE",
14653
+ currentOptions,
14654
+ el.loc
14655
+ );
14656
+ const parent = stack[0] || currentRoot;
14657
+ const index = parent.children.indexOf(el);
14658
+ parent.children.splice(index, 1, ...el.children);
14659
+ }
14660
+ const inlineTemplateProp = props.find(
14661
+ (p) => p.type === 6 && p.name === "inline-template"
14662
+ );
14663
+ if (inlineTemplateProp && checkCompatEnabled(
14664
+ "COMPILER_INLINE_TEMPLATE",
14665
+ currentOptions,
14666
+ inlineTemplateProp.loc
14667
+ ) && el.children.length) {
14668
+ inlineTemplateProp.value = {
14669
+ type: 2,
14670
+ content: getSlice(
14671
+ el.children[0].loc.start.offset,
14672
+ el.children[el.children.length - 1].loc.end.offset
14673
+ ),
14674
+ loc: inlineTemplateProp.loc
14675
+ };
13685
14676
  }
13686
- advanceBy(context, isSelfClosing ? 2 : 1);
13687
14677
  }
13688
- if (type === 1 /* End */) {
13689
- return;
14678
+ }
14679
+ function fastForward(start, c) {
14680
+ let offset = 0;
14681
+ while (currentInput.charCodeAt(start + offset) !== 62 && start + offset < currentInput.length) {
14682
+ offset++;
13690
14683
  }
13691
- if (isCompatEnabled(
13692
- "COMPILER_V_IF_V_FOR_PRECEDENCE",
13693
- context
13694
- )) {
13695
- let hasIf = false;
13696
- let hasFor = false;
14684
+ return offset;
14685
+ }
14686
+ function backTrack(index, c) {
14687
+ let i = index;
14688
+ while (currentInput.charCodeAt(i) !== c && i >= 0)
14689
+ i--;
14690
+ return i;
14691
+ }
14692
+ const specialTemplateDir = /* @__PURE__ */ new Set(["if", "else", "else-if", "for", "slot"]);
14693
+ function isFragmentTemplate({ tag, props }) {
14694
+ if (tag === "template") {
13697
14695
  for (let i = 0; i < props.length; i++) {
13698
- const p = props[i];
13699
- if (p.type === 7) {
13700
- if (p.name === "if") {
13701
- hasIf = true;
13702
- } else if (p.name === "for") {
13703
- hasFor = true;
13704
- }
13705
- }
13706
- if (hasIf && hasFor) {
13707
- warnDeprecation(
13708
- "COMPILER_V_IF_V_FOR_PRECEDENCE",
13709
- context,
13710
- getSelection(context, start)
13711
- );
13712
- break;
13713
- }
13714
- }
13715
- }
13716
- let tagType = 0;
13717
- if (!context.inVPre) {
13718
- if (tag === "slot") {
13719
- tagType = 2;
13720
- } else if (tag === "template") {
13721
- if (props.some(
13722
- (p) => p.type === 7 && isSpecialTemplateDirective(p.name)
13723
- )) {
13724
- tagType = 3;
14696
+ if (props[i].type === 7 && specialTemplateDir.has(props[i].name)) {
14697
+ return true;
13725
14698
  }
13726
- } else if (isComponent(tag, props, context)) {
13727
- tagType = 1;
13728
14699
  }
13729
14700
  }
13730
- return {
13731
- type: 1,
13732
- ns,
13733
- tag,
13734
- tagType,
13735
- props,
13736
- isSelfClosing,
13737
- children: [],
13738
- loc: getSelection(context, start),
13739
- codegenNode: void 0
13740
- // to be created during transform phase
13741
- };
14701
+ return false;
13742
14702
  }
13743
- function isComponent(tag, props, context) {
13744
- const options = context.options;
13745
- if (options.isCustomElement(tag)) {
14703
+ function isComponent({ tag, props }) {
14704
+ var _a;
14705
+ if (currentOptions.isCustomElement(tag)) {
13746
14706
  return false;
13747
14707
  }
13748
- if (tag === "component" || /^[A-Z]/.test(tag) || isCoreComponent(tag) || options.isBuiltInComponent && options.isBuiltInComponent(tag) || options.isNativeTag && !options.isNativeTag(tag)) {
14708
+ if (tag === "component" || isUpperCase(tag.charCodeAt(0)) || isCoreComponent(tag) || ((_a = currentOptions.isBuiltInComponent) == null ? void 0 : _a.call(currentOptions, tag)) || currentOptions.isNativeTag && !currentOptions.isNativeTag(tag)) {
13749
14709
  return true;
13750
14710
  }
13751
14711
  for (let i = 0; i < props.length; i++) {
@@ -13756,374 +14716,179 @@ function isComponent(tag, props, context) {
13756
14716
  return true;
13757
14717
  } else if (checkCompatEnabled(
13758
14718
  "COMPILER_IS_ON_ELEMENT",
13759
- context,
14719
+ currentOptions,
13760
14720
  p.loc
13761
14721
  )) {
13762
14722
  return true;
13763
14723
  }
13764
14724
  }
13765
- } else {
13766
- if (p.name === "is") {
13767
- return true;
13768
- } else if (
13769
- // :is on plain element - only treat as component in compat mode
13770
- p.name === "bind" && isStaticArgOf(p.arg, "is") && true && checkCompatEnabled(
13771
- "COMPILER_IS_ON_ELEMENT",
13772
- context,
13773
- p.loc
13774
- )
13775
- ) {
13776
- return true;
13777
- }
14725
+ } else if (// :is on plain element - only treat as component in compat mode
14726
+ p.name === "bind" && isStaticArgOf(p.arg, "is") && checkCompatEnabled(
14727
+ "COMPILER_IS_ON_ELEMENT",
14728
+ currentOptions,
14729
+ p.loc
14730
+ )) {
14731
+ return true;
13778
14732
  }
13779
14733
  }
14734
+ return false;
13780
14735
  }
13781
- function parseAttributes(context, type) {
13782
- const props = [];
13783
- const attributeNames = /* @__PURE__ */ new Set();
13784
- while (context.source.length > 0 && !startsWith(context.source, ">") && !startsWith(context.source, "/>")) {
13785
- if (startsWith(context.source, "/")) {
13786
- emitError(context, 22);
13787
- advanceBy(context, 1);
13788
- advanceSpaces(context);
13789
- continue;
13790
- }
13791
- if (type === 1 /* End */) {
13792
- emitError(context, 3);
13793
- }
13794
- const attr = parseAttribute(context, attributeNames);
13795
- if (attr.type === 6 && attr.value && attr.name === "class") {
13796
- attr.value.content = attr.value.content.replace(/\s+/g, " ").trim();
13797
- }
13798
- if (type === 0 /* Start */) {
13799
- props.push(attr);
13800
- }
13801
- if (/^[^\t\r\n\f />]/.test(context.source)) {
13802
- emitError(context, 15);
13803
- }
13804
- advanceSpaces(context);
13805
- }
13806
- return props;
14736
+ function isUpperCase(c) {
14737
+ return c > 64 && c < 91;
13807
14738
  }
13808
- function parseAttribute(context, nameSet) {
13809
- var _a;
13810
- const start = getCursor(context);
13811
- const match = /^[^\t\r\n\f />][^\t\r\n\f />=]*/.exec(context.source);
13812
- const name = match[0];
13813
- if (nameSet.has(name)) {
13814
- emitError(context, 2);
13815
- }
13816
- nameSet.add(name);
13817
- if (name[0] === "=") {
13818
- emitError(context, 19);
13819
- }
13820
- {
13821
- const pattern = /["'<]/g;
13822
- let m;
13823
- while (m = pattern.exec(name)) {
13824
- emitError(
13825
- context,
13826
- 17,
13827
- m.index
13828
- );
13829
- }
13830
- }
13831
- advanceBy(context, name.length);
13832
- let value = void 0;
13833
- if (/^[\t\r\n\f ]*=/.test(context.source)) {
13834
- advanceSpaces(context);
13835
- advanceBy(context, 1);
13836
- advanceSpaces(context);
13837
- value = parseAttributeValue(context);
13838
- if (!value) {
13839
- emitError(context, 13);
13840
- }
13841
- }
13842
- const loc = getSelection(context, start);
13843
- if (!context.inVPre && /^(v-[A-Za-z0-9-]|:|\.|@|#)/.test(name)) {
13844
- const match2 = /(?:^v-([a-z0-9-]+))?(?:(?::|^\.|^@|^#)(\[[^\]]+\]|[^\.]+))?(.+)?$/i.exec(
13845
- name
13846
- );
13847
- let isPropShorthand = startsWith(name, ".");
13848
- let dirName = match2[1] || (isPropShorthand || startsWith(name, ":") ? "bind" : startsWith(name, "@") ? "on" : "slot");
13849
- let arg;
13850
- if (match2[2]) {
13851
- const isSlot = dirName === "slot";
13852
- const startOffset = name.lastIndexOf(
13853
- match2[2],
13854
- name.length - (((_a = match2[3]) == null ? void 0 : _a.length) || 0)
13855
- );
13856
- const loc2 = getSelection(
13857
- context,
13858
- getNewPosition(context, start, startOffset),
13859
- getNewPosition(
13860
- context,
13861
- start,
13862
- startOffset + match2[2].length + (isSlot && match2[3] || "").length
13863
- )
13864
- );
13865
- let content = match2[2];
13866
- let isStatic = true;
13867
- if (content.startsWith("[")) {
13868
- isStatic = false;
13869
- if (!content.endsWith("]")) {
13870
- emitError(
13871
- context,
13872
- 27
13873
- );
13874
- content = content.slice(1);
13875
- } else {
13876
- content = content.slice(1, content.length - 1);
14739
+ const windowsNewlineRE = /\r\n/g;
14740
+ function condenseWhitespace(nodes, tag) {
14741
+ var _a, _b;
14742
+ const shouldCondense = currentOptions.whitespace !== "preserve";
14743
+ let removedWhitespace = false;
14744
+ for (let i = 0; i < nodes.length; i++) {
14745
+ const node = nodes[i];
14746
+ if (node.type === 2) {
14747
+ if (!inPre) {
14748
+ if (isAllWhitespace(node.content)) {
14749
+ const prev = (_a = nodes[i - 1]) == null ? void 0 : _a.type;
14750
+ const next = (_b = nodes[i + 1]) == null ? void 0 : _b.type;
14751
+ if (!prev || !next || shouldCondense && (prev === 3 && (next === 3 || next === 1) || prev === 1 && (next === 3 || next === 1 && hasNewlineChar(node.content)))) {
14752
+ removedWhitespace = true;
14753
+ nodes[i] = null;
14754
+ } else {
14755
+ node.content = " ";
14756
+ }
14757
+ } else if (shouldCondense) {
14758
+ node.content = condense(node.content);
13877
14759
  }
13878
- } else if (isSlot) {
13879
- content += match2[3] || "";
13880
- }
13881
- arg = {
13882
- type: 4,
13883
- content,
13884
- isStatic,
13885
- constType: isStatic ? 3 : 0,
13886
- loc: loc2
13887
- };
13888
- }
13889
- if (value && value.isQuoted) {
13890
- const valueLoc = value.loc;
13891
- valueLoc.start.offset++;
13892
- valueLoc.start.column++;
13893
- valueLoc.end = advancePositionWithClone(valueLoc.start, value.content);
13894
- valueLoc.source = valueLoc.source.slice(1, -1);
13895
- }
13896
- const modifiers = match2[3] ? match2[3].slice(1).split(".") : [];
13897
- if (isPropShorthand)
13898
- modifiers.push("prop");
13899
- if (dirName === "bind" && arg) {
13900
- if (modifiers.includes("sync") && checkCompatEnabled(
13901
- "COMPILER_V_BIND_SYNC",
13902
- context,
13903
- loc,
13904
- arg.loc.source
13905
- )) {
13906
- dirName = "model";
13907
- modifiers.splice(modifiers.indexOf("sync"), 1);
13908
- }
13909
- if (modifiers.includes("prop")) {
13910
- checkCompatEnabled(
13911
- "COMPILER_V_BIND_PROP",
13912
- context,
13913
- loc
13914
- );
14760
+ } else {
14761
+ node.content = node.content.replace(windowsNewlineRE, "\n");
13915
14762
  }
13916
14763
  }
13917
- return {
13918
- type: 7,
13919
- name: dirName,
13920
- exp: value && {
13921
- type: 4,
13922
- content: value.content,
13923
- isStatic: false,
13924
- // Treat as non-constant by default. This can be potentially set to
13925
- // other values by `transformExpression` to make it eligible for hoisting.
13926
- constType: 0,
13927
- loc: value.loc
13928
- },
13929
- arg,
13930
- modifiers,
13931
- loc
13932
- };
13933
14764
  }
13934
- if (!context.inVPre && startsWith(name, "v-")) {
13935
- emitError(context, 26);
14765
+ if (inPre && tag && currentOptions.isPreTag(tag)) {
14766
+ const first = nodes[0];
14767
+ if (first && first.type === 2) {
14768
+ first.content = first.content.replace(/^\r?\n/, "");
14769
+ }
13936
14770
  }
13937
- return {
13938
- type: 6,
13939
- name,
13940
- value: value && {
13941
- type: 2,
13942
- content: value.content,
13943
- loc: value.loc
13944
- },
13945
- loc
13946
- };
14771
+ return removedWhitespace ? nodes.filter(Boolean) : nodes;
13947
14772
  }
13948
- function parseAttributeValue(context) {
13949
- const start = getCursor(context);
13950
- let content;
13951
- const quote = context.source[0];
13952
- const isQuoted = quote === `"` || quote === `'`;
13953
- if (isQuoted) {
13954
- advanceBy(context, 1);
13955
- const endIndex = context.source.indexOf(quote);
13956
- if (endIndex === -1) {
13957
- content = parseTextData(
13958
- context,
13959
- context.source.length,
13960
- 4
13961
- );
13962
- } else {
13963
- content = parseTextData(context, endIndex, 4);
13964
- advanceBy(context, 1);
13965
- }
13966
- } else {
13967
- const match = /^[^\t\r\n\f >]+/.exec(context.source);
13968
- if (!match) {
13969
- return void 0;
13970
- }
13971
- const unexpectedChars = /["'<=`]/g;
13972
- let m;
13973
- while (m = unexpectedChars.exec(match[0])) {
13974
- emitError(
13975
- context,
13976
- 18,
13977
- m.index
13978
- );
14773
+ function isAllWhitespace(str) {
14774
+ for (let i = 0; i < str.length; i++) {
14775
+ if (!isWhitespace(str.charCodeAt(i))) {
14776
+ return false;
13979
14777
  }
13980
- content = parseTextData(context, match[0].length, 4);
13981
- }
13982
- return { content, isQuoted, loc: getSelection(context, start) };
13983
- }
13984
- function parseInterpolation(context, mode) {
13985
- const [open, close] = context.options.delimiters;
13986
- const closeIndex = context.source.indexOf(close, open.length);
13987
- if (closeIndex === -1) {
13988
- emitError(context, 25);
13989
- return void 0;
13990
- }
13991
- const start = getCursor(context);
13992
- advanceBy(context, open.length);
13993
- const innerStart = getCursor(context);
13994
- const innerEnd = getCursor(context);
13995
- const rawContentLength = closeIndex - open.length;
13996
- const rawContent = context.source.slice(0, rawContentLength);
13997
- const preTrimContent = parseTextData(context, rawContentLength, mode);
13998
- const content = preTrimContent.trim();
13999
- const startOffset = preTrimContent.indexOf(content);
14000
- if (startOffset > 0) {
14001
- advancePositionWithMutation(innerStart, rawContent, startOffset);
14002
- }
14003
- const endOffset = rawContentLength - (preTrimContent.length - content.length - startOffset);
14004
- advancePositionWithMutation(innerEnd, rawContent, endOffset);
14005
- advanceBy(context, close.length);
14006
- return {
14007
- type: 5,
14008
- content: {
14009
- type: 4,
14010
- isStatic: false,
14011
- // Set `isConstant` to false by default and will decide in transformExpression
14012
- constType: 0,
14013
- content,
14014
- loc: getSelection(context, innerStart, innerEnd)
14015
- },
14016
- loc: getSelection(context, start)
14017
- };
14778
+ }
14779
+ return true;
14018
14780
  }
14019
- function parseText(context, mode) {
14020
- const endTokens = mode === 3 ? ["]]>"] : ["<", context.options.delimiters[0]];
14021
- let endIndex = context.source.length;
14022
- for (let i = 0; i < endTokens.length; i++) {
14023
- const index = context.source.indexOf(endTokens[i], 1);
14024
- if (index !== -1 && endIndex > index) {
14025
- endIndex = index;
14781
+ function hasNewlineChar(str) {
14782
+ for (let i = 0; i < str.length; i++) {
14783
+ const c = str.charCodeAt(i);
14784
+ if (c === 10 || c === 13) {
14785
+ return true;
14026
14786
  }
14027
14787
  }
14028
- const start = getCursor(context);
14029
- const content = parseTextData(context, endIndex, mode);
14030
- return {
14031
- type: 2,
14032
- content,
14033
- loc: getSelection(context, start)
14034
- };
14788
+ return false;
14035
14789
  }
14036
- function parseTextData(context, length, mode) {
14037
- const rawText = context.source.slice(0, length);
14038
- advanceBy(context, length);
14039
- if (mode === 2 || mode === 3 || !rawText.includes("&")) {
14040
- return rawText;
14041
- } else {
14042
- return context.options.decodeEntities(
14043
- rawText,
14044
- mode === 4
14045
- );
14790
+ function condense(str) {
14791
+ let ret = "";
14792
+ let prevCharIsWhitespace = false;
14793
+ for (let i = 0; i < str.length; i++) {
14794
+ if (isWhitespace(str.charCodeAt(i))) {
14795
+ if (!prevCharIsWhitespace) {
14796
+ ret += " ";
14797
+ prevCharIsWhitespace = true;
14798
+ }
14799
+ } else {
14800
+ ret += str[i];
14801
+ prevCharIsWhitespace = false;
14802
+ }
14046
14803
  }
14804
+ return ret;
14047
14805
  }
14048
- function getCursor(context) {
14049
- const { column, line, offset } = context;
14050
- return { column, line, offset };
14806
+ function addNode(node) {
14807
+ (stack[0] || currentRoot).children.push(node);
14051
14808
  }
14052
- function getSelection(context, start, end) {
14053
- end = end || getCursor(context);
14809
+ function getLoc(start, end) {
14054
14810
  return {
14055
- start,
14056
- end,
14057
- source: context.originalSource.slice(start.offset, end.offset)
14811
+ start: tokenizer.getPos(start),
14812
+ // @ts-expect-error allow late attachment
14813
+ end: end == null ? end : tokenizer.getPos(end),
14814
+ // @ts-expect-error allow late attachment
14815
+ source: end == null ? end : getSlice(start, end)
14058
14816
  };
14059
14817
  }
14060
- function last(xs) {
14061
- return xs[xs.length - 1];
14062
- }
14063
- function startsWith(source, searchString) {
14064
- return source.startsWith(searchString);
14818
+ function setLocEnd(loc, end) {
14819
+ loc.end = tokenizer.getPos(end);
14820
+ loc.source = getSlice(loc.start.offset, end);
14065
14821
  }
14066
- function advanceBy(context, numberOfCharacters) {
14067
- const { source } = context;
14068
- advancePositionWithMutation(context, source, numberOfCharacters);
14069
- context.source = source.slice(numberOfCharacters);
14070
- }
14071
- function advanceSpaces(context) {
14072
- const match = /^[\t\r\n\f ]+/.exec(context.source);
14073
- if (match) {
14074
- advanceBy(context, match[0].length);
14822
+ function dirToAttr(dir) {
14823
+ const attr = {
14824
+ type: 6,
14825
+ name: dir.rawName,
14826
+ nameLoc: getLoc(
14827
+ dir.loc.start.offset,
14828
+ dir.loc.start.offset + dir.rawName.length
14829
+ ),
14830
+ value: void 0,
14831
+ loc: dir.loc
14832
+ };
14833
+ if (dir.exp) {
14834
+ const loc = dir.exp.loc;
14835
+ if (loc.end.offset < dir.loc.end.offset) {
14836
+ loc.start.offset--;
14837
+ loc.start.column--;
14838
+ loc.end.offset++;
14839
+ loc.end.column++;
14840
+ }
14841
+ attr.value = {
14842
+ type: 2,
14843
+ content: dir.exp.content,
14844
+ loc
14845
+ };
14075
14846
  }
14847
+ return attr;
14076
14848
  }
14077
- function getNewPosition(context, start, numberOfCharacters) {
14078
- return advancePositionWithClone(
14079
- start,
14080
- context.originalSource.slice(start.offset, numberOfCharacters),
14081
- numberOfCharacters
14082
- );
14849
+ function emitError(code, index) {
14850
+ currentOptions.onError(createCompilerError(code, getLoc(index, index)));
14083
14851
  }
14084
- function emitError(context, code, offset, loc = getCursor(context)) {
14085
- if (offset) {
14086
- loc.offset += offset;
14087
- loc.column += offset;
14088
- }
14089
- context.options.onError(
14090
- createCompilerError(code, {
14091
- start: loc,
14092
- end: loc,
14093
- source: ""
14094
- })
14095
- );
14852
+ function reset() {
14853
+ tokenizer.reset();
14854
+ currentOpenTag = null;
14855
+ currentProp = null;
14856
+ currentAttrValue = "";
14857
+ currentAttrStartIndex = -1;
14858
+ currentAttrEndIndex = -1;
14859
+ stack.length = 0;
14096
14860
  }
14097
- function isEnd(context, mode, ancestors) {
14098
- const s = context.source;
14099
- switch (mode) {
14100
- case 0:
14101
- if (startsWith(s, "</")) {
14102
- for (let i = ancestors.length - 1; i >= 0; --i) {
14103
- if (startsWithEndTagOpen(s, ancestors[i].tag)) {
14104
- return true;
14105
- }
14106
- }
14107
- }
14108
- break;
14109
- case 1:
14110
- case 2: {
14111
- const parent = last(ancestors);
14112
- if (parent && startsWithEndTagOpen(s, parent.tag)) {
14113
- return true;
14861
+ function baseParse(input, options) {
14862
+ reset();
14863
+ currentInput = input;
14864
+ currentOptions = extend({}, defaultParserOptions);
14865
+ if (options) {
14866
+ let key;
14867
+ for (key in options) {
14868
+ if (options[key] != null) {
14869
+ currentOptions[key] = options[key];
14114
14870
  }
14115
- break;
14116
14871
  }
14117
- case 3:
14118
- if (startsWith(s, "]]>")) {
14119
- return true;
14120
- }
14121
- break;
14122
14872
  }
14123
- return !s;
14124
- }
14125
- function startsWithEndTagOpen(source, tag) {
14126
- return startsWith(source, "</") && source.slice(2, 2 + tag.length).toLowerCase() === tag.toLowerCase() && /[\t\r\n\f />]/.test(source[2 + tag.length] || ">");
14873
+ {
14874
+ if (!currentOptions.decodeEntities) {
14875
+ throw new Error(
14876
+ `[@vue/compiler-core] decodeEntities option is required in browser builds.`
14877
+ );
14878
+ }
14879
+ }
14880
+ tokenizer.mode = currentOptions.parseMode === "html" ? 1 : currentOptions.parseMode === "sfc" ? 2 : 0;
14881
+ const delimiters = options == null ? void 0 : options.delimiters;
14882
+ if (delimiters) {
14883
+ tokenizer.delimiterOpen = toCharCodes(delimiters[0]);
14884
+ tokenizer.delimiterClose = toCharCodes(delimiters[1]);
14885
+ }
14886
+ const root = currentRoot = createRoot([], input);
14887
+ tokenizer.parse(currentInput);
14888
+ root.loc = getLoc(0, input.length);
14889
+ root.children = condenseWhitespace(root.children);
14890
+ currentRoot = null;
14891
+ return root;
14127
14892
  }
14128
14893
 
14129
14894
  function hoistStatic(root, context) {
@@ -14535,6 +15300,7 @@ function transform(root, options) {
14535
15300
  root.hoists = context.hoists;
14536
15301
  root.temps = context.temps;
14537
15302
  root.cached = context.cached;
15303
+ root.transformed = true;
14538
15304
  {
14539
15305
  root.filters = [...context.filters];
14540
15306
  }
@@ -14691,7 +15457,7 @@ function createCodegenContext(ast, {
14691
15457
  ssr,
14692
15458
  isTS,
14693
15459
  inSSR,
14694
- source: ast.loc.source,
15460
+ source: ast.source,
14695
15461
  code: ``,
14696
15462
  column: 1,
14697
15463
  line: 1,
@@ -14702,7 +15468,7 @@ function createCodegenContext(ast, {
14702
15468
  helper(key) {
14703
15469
  return `_${helperNameMap[key]}`;
14704
15470
  },
14705
- push(code, node) {
15471
+ push(code, newlineIndex = -2 /* None */, node) {
14706
15472
  context.code += code;
14707
15473
  },
14708
15474
  indent() {
@@ -14720,7 +15486,7 @@ function createCodegenContext(ast, {
14720
15486
  }
14721
15487
  };
14722
15488
  function newline(n) {
14723
- context.push("\n" + ` `.repeat(n));
15489
+ context.push("\n" + ` `.repeat(n), 0 /* Start */);
14724
15490
  }
14725
15491
  return context;
14726
15492
  }
@@ -14757,9 +15523,11 @@ function generate(ast, options = {}) {
14757
15523
  push(`with (_ctx) {`);
14758
15524
  indent();
14759
15525
  if (hasHelpers) {
14760
- push(`const { ${helpers.map(aliasHelper).join(", ")} } = _Vue`);
14761
- push(`
14762
- `);
15526
+ push(
15527
+ `const { ${helpers.map(aliasHelper).join(", ")} } = _Vue
15528
+ `,
15529
+ -1 /* End */
15530
+ );
14763
15531
  newline();
14764
15532
  }
14765
15533
  }
@@ -14788,7 +15556,7 @@ function generate(ast, options = {}) {
14788
15556
  }
14789
15557
  if (ast.components.length || ast.directives.length || ast.temps) {
14790
15558
  push(`
14791
- `);
15559
+ `, 0 /* Start */);
14792
15560
  newline();
14793
15561
  }
14794
15562
  if (!ssr) {
@@ -14809,7 +15577,6 @@ function generate(ast, options = {}) {
14809
15577
  ast,
14810
15578
  code: context.code,
14811
15579
  preamble: isSetupInlined ? preambleContext.code : ``,
14812
- // SourceMapGenerator does have toJSON() method but it's not in the types
14813
15580
  map: context.map ? context.map.toJSON() : void 0
14814
15581
  };
14815
15582
  }
@@ -14828,7 +15595,7 @@ function genFunctionPreamble(ast, context) {
14828
15595
  if (helpers.length > 0) {
14829
15596
  {
14830
15597
  push(`const _Vue = ${VueBinding}
14831
- `);
15598
+ `, -1 /* End */);
14832
15599
  if (ast.hoists.length) {
14833
15600
  const staticHelpers = [
14834
15601
  CREATE_VNODE,
@@ -14838,7 +15605,7 @@ function genFunctionPreamble(ast, context) {
14838
15605
  CREATE_STATIC
14839
15606
  ].filter((helper) => helpers.includes(helper)).map(aliasHelper).join(", ");
14840
15607
  push(`const { ${staticHelpers} } = _Vue
14841
- `);
15608
+ `, -1 /* End */);
14842
15609
  }
14843
15610
  }
14844
15611
  }
@@ -14899,7 +15666,7 @@ function genNodeList(nodes, context, multilines = false, comma = true) {
14899
15666
  for (let i = 0; i < nodes.length; i++) {
14900
15667
  const node = nodes[i];
14901
15668
  if (isString(node)) {
14902
- push(node);
15669
+ push(node, -3 /* Unknown */);
14903
15670
  } else if (isArray(node)) {
14904
15671
  genNodeListAsArray(node, context);
14905
15672
  } else {
@@ -14917,7 +15684,7 @@ function genNodeList(nodes, context, multilines = false, comma = true) {
14917
15684
  }
14918
15685
  function genNode(node, context) {
14919
15686
  if (isString(node)) {
14920
- context.push(node);
15687
+ context.push(node, -3 /* Unknown */);
14921
15688
  return;
14922
15689
  }
14923
15690
  if (isSymbol(node)) {
@@ -14997,11 +15764,15 @@ function genNode(node, context) {
14997
15764
  }
14998
15765
  }
14999
15766
  function genText(node, context) {
15000
- context.push(JSON.stringify(node.content), node);
15767
+ context.push(JSON.stringify(node.content), -3 /* Unknown */, node);
15001
15768
  }
15002
15769
  function genExpression(node, context) {
15003
15770
  const { content, isStatic } = node;
15004
- context.push(isStatic ? JSON.stringify(content) : content, node);
15771
+ context.push(
15772
+ isStatic ? JSON.stringify(content) : content,
15773
+ -3 /* Unknown */,
15774
+ node
15775
+ );
15005
15776
  }
15006
15777
  function genInterpolation(node, context) {
15007
15778
  const { push, helper, pure } = context;
@@ -15015,7 +15786,7 @@ function genCompoundExpression(node, context) {
15015
15786
  for (let i = 0; i < node.children.length; i++) {
15016
15787
  const child = node.children[i];
15017
15788
  if (isString(child)) {
15018
- context.push(child);
15789
+ context.push(child, -3 /* Unknown */);
15019
15790
  } else {
15020
15791
  genNode(child, context);
15021
15792
  }
@@ -15029,9 +15800,9 @@ function genExpressionAsPropertyKey(node, context) {
15029
15800
  push(`]`);
15030
15801
  } else if (node.isStatic) {
15031
15802
  const text = isSimpleIdentifier(node.content) ? node.content : JSON.stringify(node.content);
15032
- push(text, node);
15803
+ push(text, -2 /* None */, node);
15033
15804
  } else {
15034
- push(`[${node.content}]`, node);
15805
+ push(`[${node.content}]`, -3 /* Unknown */, node);
15035
15806
  }
15036
15807
  }
15037
15808
  function genComment(node, context) {
@@ -15039,7 +15810,11 @@ function genComment(node, context) {
15039
15810
  if (pure) {
15040
15811
  push(PURE_ANNOTATION);
15041
15812
  }
15042
- push(`${helper(CREATE_COMMENT)}(${JSON.stringify(node.content)})`, node);
15813
+ push(
15814
+ `${helper(CREATE_COMMENT)}(${JSON.stringify(node.content)})`,
15815
+ -3 /* Unknown */,
15816
+ node
15817
+ );
15043
15818
  }
15044
15819
  function genVNodeCall(node, context) {
15045
15820
  const { push, helper, pure } = context;
@@ -15064,7 +15839,7 @@ function genVNodeCall(node, context) {
15064
15839
  push(PURE_ANNOTATION);
15065
15840
  }
15066
15841
  const callHelper = isBlock ? getVNodeBlockHelper(context.inSSR, isComponent) : getVNodeHelper(context.inSSR, isComponent);
15067
- push(helper(callHelper) + `(`, node);
15842
+ push(helper(callHelper) + `(`, -2 /* None */, node);
15068
15843
  genNodeList(
15069
15844
  genNullableArgs([tag, props, children, patchFlag, dynamicProps]),
15070
15845
  context
@@ -15093,7 +15868,7 @@ function genCallExpression(node, context) {
15093
15868
  if (pure) {
15094
15869
  push(PURE_ANNOTATION);
15095
15870
  }
15096
- push(callee + `(`, node);
15871
+ push(callee + `(`, -2 /* None */, node);
15097
15872
  genNodeList(node.arguments, context);
15098
15873
  push(`)`);
15099
15874
  }
@@ -15101,7 +15876,7 @@ function genObjectExpression(node, context) {
15101
15876
  const { push, indent, deindent, newline } = context;
15102
15877
  const { properties } = node;
15103
15878
  if (!properties.length) {
15104
- push(`{}`, node);
15879
+ push(`{}`, -2 /* None */, node);
15105
15880
  return;
15106
15881
  }
15107
15882
  const multilines = properties.length > 1 || properties.some((p) => p.value.type !== 4);
@@ -15129,7 +15904,7 @@ function genFunctionExpression(node, context) {
15129
15904
  if (isSlot) {
15130
15905
  push(`_${helperNameMap[WITH_CTX]}(`);
15131
15906
  }
15132
- push(`(`, node);
15907
+ push(`(`, -2 /* None */, node);
15133
15908
  if (isArray(params)) {
15134
15909
  genNodeList(params, context);
15135
15910
  } else if (params) {
@@ -15363,7 +16138,7 @@ function processIf(node, dir, context, processCodegen) {
15363
16138
  context.removeNode();
15364
16139
  const branch = createIfBranch(node, dir);
15365
16140
  if (comments.length && // #3619 ignore comments if the v-if is direct child of <transition>
15366
- !(context.parent && context.parent.type === 1 && isBuiltInType(context.parent.tag, "transition"))) {
16141
+ !(context.parent && context.parent.type === 1 && (context.parent.tag === "transition" || context.parent.tag === "Transition"))) {
15367
16142
  branch.children = [...comments, ...branch.children];
15368
16143
  }
15369
16144
  {
@@ -15645,18 +16420,14 @@ function processFor(node, dir, context, processCodegen) {
15645
16420
  );
15646
16421
  return;
15647
16422
  }
15648
- const parseResult = parseForExpression(
15649
- // can only be simple expression because vFor transform is applied
15650
- // before expression transform.
15651
- dir.exp,
15652
- context
15653
- );
16423
+ const parseResult = dir.forParseResult;
15654
16424
  if (!parseResult) {
15655
16425
  context.onError(
15656
16426
  createCompilerError(32, dir.loc)
15657
16427
  );
15658
16428
  return;
15659
16429
  }
16430
+ finalizeForParseResult(parseResult, context);
15660
16431
  const { addIdentifiers, removeIdentifiers, scopes } = context;
15661
16432
  const { source, value, key, index } = parseResult;
15662
16433
  const forNode = {
@@ -15678,71 +16449,26 @@ function processFor(node, dir, context, processCodegen) {
15678
16449
  onExit();
15679
16450
  };
15680
16451
  }
15681
- const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
15682
- const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
15683
- const stripParensRE = /^\(|\)$/g;
15684
- function parseForExpression(input, context) {
15685
- const loc = input.loc;
15686
- const exp = input.content;
15687
- const inMatch = exp.match(forAliasRE);
15688
- if (!inMatch)
16452
+ function finalizeForParseResult(result, context) {
16453
+ if (result.finalized)
15689
16454
  return;
15690
- const [, LHS, RHS] = inMatch;
15691
- const result = {
15692
- source: createAliasExpression(
15693
- loc,
15694
- RHS.trim(),
15695
- exp.indexOf(RHS, LHS.length)
15696
- ),
15697
- value: void 0,
15698
- key: void 0,
15699
- index: void 0
15700
- };
15701
16455
  {
15702
16456
  validateBrowserExpression(result.source, context);
15703
- }
15704
- let valueContent = LHS.trim().replace(stripParensRE, "").trim();
15705
- const trimmedOffset = LHS.indexOf(valueContent);
15706
- const iteratorMatch = valueContent.match(forIteratorRE);
15707
- if (iteratorMatch) {
15708
- valueContent = valueContent.replace(forIteratorRE, "").trim();
15709
- const keyContent = iteratorMatch[1].trim();
15710
- let keyOffset;
15711
- if (keyContent) {
15712
- keyOffset = exp.indexOf(keyContent, trimmedOffset + valueContent.length);
15713
- result.key = createAliasExpression(loc, keyContent, keyOffset);
15714
- {
15715
- validateBrowserExpression(
15716
- result.key,
15717
- context,
15718
- true
15719
- );
15720
- }
16457
+ if (result.key) {
16458
+ validateBrowserExpression(
16459
+ result.key,
16460
+ context,
16461
+ true
16462
+ );
15721
16463
  }
15722
- if (iteratorMatch[2]) {
15723
- const indexContent = iteratorMatch[2].trim();
15724
- if (indexContent) {
15725
- result.index = createAliasExpression(
15726
- loc,
15727
- indexContent,
15728
- exp.indexOf(
15729
- indexContent,
15730
- result.key ? keyOffset + keyContent.length : trimmedOffset + valueContent.length
15731
- )
15732
- );
15733
- {
15734
- validateBrowserExpression(
15735
- result.index,
15736
- context,
15737
- true
15738
- );
15739
- }
15740
- }
16464
+ if (result.index) {
16465
+ validateBrowserExpression(
16466
+ result.index,
16467
+ context,
16468
+ true
16469
+ );
15741
16470
  }
15742
- }
15743
- if (valueContent) {
15744
- result.value = createAliasExpression(loc, valueContent, trimmedOffset);
15745
- {
16471
+ if (result.value) {
15746
16472
  validateBrowserExpression(
15747
16473
  result.value,
15748
16474
  context,
@@ -15750,14 +16476,7 @@ function parseForExpression(input, context) {
15750
16476
  );
15751
16477
  }
15752
16478
  }
15753
- return result;
15754
- }
15755
- function createAliasExpression(range, content, offset) {
15756
- return createSimpleExpression(
15757
- content,
15758
- false,
15759
- getInnerRange(range, offset, content.length)
15760
- );
16479
+ result.finalized = true;
15761
16480
  }
15762
16481
  function createForLoopParams({ value, key, index }, memoArgs = []) {
15763
16482
  return createParamsList([value, key, index, ...memoArgs]);
@@ -15844,12 +16563,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
15844
16563
  hasDynamicSlots = true;
15845
16564
  }
15846
16565
  const vFor = findDir(slotElement, "for");
15847
- const slotFunction = buildSlotFn(
15848
- slotProps,
15849
- vFor == null ? void 0 : vFor.exp,
15850
- slotChildren,
15851
- slotLoc
15852
- );
16566
+ const slotFunction = buildSlotFn(slotProps, vFor, slotChildren, slotLoc);
15853
16567
  let vIf;
15854
16568
  let vElse;
15855
16569
  if (vIf = findDir(slotElement, "if")) {
@@ -15898,8 +16612,9 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
15898
16612
  }
15899
16613
  } else if (vFor) {
15900
16614
  hasDynamicSlots = true;
15901
- const parseResult = vFor.parseResult || parseForExpression(vFor.exp, context);
16615
+ const parseResult = vFor.forParseResult;
15902
16616
  if (parseResult) {
16617
+ finalizeForParseResult(parseResult, context);
15903
16618
  dynamicSlots.push(
15904
16619
  createCallExpression(context.helper(RENDER_LIST), [
15905
16620
  parseResult.source,
@@ -16160,17 +16875,6 @@ function resolveComponentType(node, context, ssr = false) {
16160
16875
  tag = isProp.value.content.slice(4);
16161
16876
  }
16162
16877
  }
16163
- const isDir = !isExplicitDynamic && findDir(node, "is");
16164
- if (isDir && isDir.exp) {
16165
- {
16166
- context.onWarn(
16167
- createCompilerError(52, isDir.loc)
16168
- );
16169
- }
16170
- return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [
16171
- isDir.exp
16172
- ]);
16173
- }
16174
16878
  const builtIn = isCoreComponent(tag) || context.isBuiltInComponent(tag);
16175
16879
  if (builtIn) {
16176
16880
  if (!ssr)
@@ -16242,7 +16946,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
16242
16946
  for (let i = 0; i < props.length; i++) {
16243
16947
  const prop = props[i];
16244
16948
  if (prop.type === 6) {
16245
- const { loc, name, value } = prop;
16949
+ const { loc, name, nameLoc, value } = prop;
16246
16950
  let isStatic = true;
16247
16951
  if (name === "ref") {
16248
16952
  hasRef = true;
@@ -16263,11 +16967,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
16263
16967
  }
16264
16968
  properties.push(
16265
16969
  createObjectProperty(
16266
- createSimpleExpression(
16267
- name,
16268
- true,
16269
- getInnerRange(loc, 0, name.length)
16270
- ),
16970
+ createSimpleExpression(name, true, nameLoc),
16271
16971
  createSimpleExpression(
16272
16972
  value ? value.content : "",
16273
16973
  isStatic,
@@ -16276,7 +16976,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
16276
16976
  )
16277
16977
  );
16278
16978
  } else {
16279
- const { name, arg, exp, loc } = prop;
16979
+ const { name, arg, exp, loc, modifiers } = prop;
16280
16980
  const isVBind = name === "bind";
16281
16981
  const isVOn = name === "on";
16282
16982
  if (name === "slot") {
@@ -16369,6 +17069,9 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
16369
17069
  }
16370
17070
  continue;
16371
17071
  }
17072
+ if (isVBind && modifiers.includes("prop")) {
17073
+ patchFlag |= 32;
17074
+ }
16372
17075
  const directiveTransform = context.directiveTransforms[name];
16373
17076
  if (directiveTransform) {
16374
17077
  const { props: props2, needRuntime } = directiveTransform(prop, node, context);
@@ -16746,8 +17449,13 @@ const transformOn$1 = (dir, node, context, augmentor) => {
16746
17449
  };
16747
17450
 
16748
17451
  const transformBind = (dir, _node, context) => {
16749
- const { exp, modifiers, loc } = dir;
17452
+ const { modifiers, loc } = dir;
16750
17453
  const arg = dir.arg;
17454
+ let { exp } = dir;
17455
+ if (!exp && arg.type === 4) {
17456
+ const propName = camelize(arg.content);
17457
+ exp = dir.exp = createSimpleExpression(propName, false, arg.loc);
17458
+ }
16751
17459
  if (arg.type !== 4) {
16752
17460
  arg.children.unshift(`(`);
16753
17461
  arg.children.push(`) || ""`);
@@ -17146,7 +17854,7 @@ function getBaseTransformPreset(prefixIdentifiers) {
17146
17854
  }
17147
17855
  ];
17148
17856
  }
17149
- function baseCompile(template, options = {}) {
17857
+ function baseCompile(source, options = {}) {
17150
17858
  const onError = options.onError || defaultOnError;
17151
17859
  const isModuleMode = options.mode === "module";
17152
17860
  {
@@ -17163,7 +17871,7 @@ function baseCompile(template, options = {}) {
17163
17871
  if (options.scopeId && !isModuleMode) {
17164
17872
  onError(createCompilerError(50));
17165
17873
  }
17166
- const ast = isString(template) ? baseParse(template, options) : template;
17874
+ const ast = isString(source) ? baseParse(source, options) : source;
17167
17875
  const [nodeTransforms, directiveTransforms] = getBaseTransformPreset();
17168
17876
  transform(
17169
17877
  ast,
@@ -17229,25 +17937,22 @@ function decodeHtmlBrowser(raw, asAttr = false) {
17229
17937
  }
17230
17938
  }
17231
17939
 
17232
- const isRawTextContainer = /* @__PURE__ */ makeMap(
17233
- "style,iframe,script,noscript",
17234
- true
17235
- );
17236
17940
  const parserOptions = {
17941
+ parseMode: "html",
17237
17942
  isVoidTag,
17238
17943
  isNativeTag: (tag) => isHTMLTag(tag) || isSVGTag(tag),
17239
17944
  isPreTag: (tag) => tag === "pre",
17240
17945
  decodeEntities: decodeHtmlBrowser ,
17241
17946
  isBuiltInComponent: (tag) => {
17242
- if (isBuiltInType(tag, `Transition`)) {
17947
+ if (tag === "Transition" || tag === "transition") {
17243
17948
  return TRANSITION;
17244
- } else if (isBuiltInType(tag, `TransitionGroup`)) {
17949
+ } else if (tag === "TransitionGroup" || tag === "transition-group") {
17245
17950
  return TRANSITION_GROUP;
17246
17951
  }
17247
17952
  },
17248
17953
  // https://html.spec.whatwg.org/multipage/parsing.html#tree-construction-dispatcher
17249
- getNamespace(tag, parent) {
17250
- let ns = parent ? parent.ns : 0;
17954
+ getNamespace(tag, parent, rootNamespace) {
17955
+ let ns = parent ? parent.ns : rootNamespace;
17251
17956
  if (parent && ns === 2) {
17252
17957
  if (parent.tag === "annotation-xml") {
17253
17958
  if (tag === "svg") {
@@ -17275,18 +17980,6 @@ const parserOptions = {
17275
17980
  }
17276
17981
  }
17277
17982
  return ns;
17278
- },
17279
- // https://html.spec.whatwg.org/multipage/parsing.html#parsing-html-fragments
17280
- getTextMode({ tag, ns }) {
17281
- if (ns === 0) {
17282
- if (tag === "textarea" || tag === "title") {
17283
- return 1;
17284
- }
17285
- if (isRawTextContainer(tag)) {
17286
- return 2;
17287
- }
17288
- }
17289
- return 0;
17290
17983
  }
17291
17984
  };
17292
17985
 
@@ -17401,8 +18094,8 @@ const transformModel = (dir, node, context) => {
17401
18094
  );
17402
18095
  }
17403
18096
  function checkDuplicatedValue() {
17404
- const value = findProp(node, "value");
17405
- if (value) {
18097
+ const value = findDir(node, "bind");
18098
+ if (value && isStaticArgOf(value.arg, "value")) {
17406
18099
  context.onError(
17407
18100
  createDOMCompilerError(
17408
18101
  60,
@@ -17607,6 +18300,7 @@ const transformTransition = (node, context) => {
17607
18300
  node.props.push({
17608
18301
  type: 6,
17609
18302
  name: "persisted",
18303
+ nameLoc: node.loc,
17610
18304
  value: void 0,
17611
18305
  loc: node.loc
17612
18306
  });
@@ -17651,9 +18345,9 @@ const DOMDirectiveTransforms = {
17651
18345
  // override compiler-core
17652
18346
  show: transformShow
17653
18347
  };
17654
- function compile(template, options = {}) {
18348
+ function compile(src, options = {}) {
17655
18349
  return baseCompile(
17656
- template,
18350
+ src,
17657
18351
  extend({}, parserOptions, options, {
17658
18352
  nodeTransforms: [
17659
18353
  // ignore <script> and <tag>