@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 = !!(process.env.NODE_ENV !== "production") ? 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,18 +1498,18 @@ 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
  if (!!!(process.env.NODE_ENV !== "production"))
1513
1510
  return;
1514
1511
  pauseTracking();
1515
- const instance = stack.length ? stack[stack.length - 1].component : null;
1512
+ const instance = stack$1.length ? stack$1[stack$1.length - 1].component : null;
1516
1513
  const appWarnHandler = instance && instance.appContext.config.warnHandler;
1517
1514
  const trace = getComponentTrace();
1518
1515
  if (appWarnHandler) {
@@ -1541,7 +1538,7 @@ function warn(msg, ...args) {
1541
1538
  resetTracking();
1542
1539
  }
1543
1540
  function getComponentTrace() {
1544
- let currentVNode = stack[stack.length - 1];
1541
+ let currentVNode = stack$1[stack$1.length - 1];
1545
1542
  if (!currentVNode) {
1546
1543
  return [];
1547
1544
  }
@@ -1680,7 +1677,7 @@ function handleError(err, instance, type, throwInDev = true) {
1680
1677
  if (instance) {
1681
1678
  let cur = instance.parent;
1682
1679
  const exposedInstance = instance.proxy;
1683
- const errorInfo = !!(process.env.NODE_ENV !== "production") ? ErrorTypeStrings$1[type] : type;
1680
+ const errorInfo = !!(process.env.NODE_ENV !== "production") ? ErrorTypeStrings$1[type] : `https://vuejs.org/errors/#runtime-${type}`;
1684
1681
  while (cur) {
1685
1682
  const errorCapturedHooks = cur.ec;
1686
1683
  if (errorCapturedHooks) {
@@ -2777,9 +2774,19 @@ function renderComponentRoot(instance) {
2777
2774
  try {
2778
2775
  if (vnode.shapeFlag & 4) {
2779
2776
  const proxyToUse = withProxy || proxy;
2777
+ const thisProxy = !!(process.env.NODE_ENV !== "production") && setupState.__isScriptSetup ? new Proxy(proxyToUse, {
2778
+ get(target, key, receiver) {
2779
+ warn(
2780
+ `Property '${String(
2781
+ key
2782
+ )}' was accessed via 'this'. Avoid using 'this' in templates.`
2783
+ );
2784
+ return Reflect.get(target, key, receiver);
2785
+ }
2786
+ }) : proxyToUse;
2780
2787
  result = normalizeVNode(
2781
2788
  render.call(
2782
- proxyToUse,
2789
+ thisProxy,
2783
2790
  proxyToUse,
2784
2791
  renderCache,
2785
2792
  props,
@@ -3030,6 +3037,65 @@ function updateHOCHostEl({ vnode, parent }, el) {
3030
3037
  }
3031
3038
  }
3032
3039
 
3040
+ const COMPONENTS = "components";
3041
+ const DIRECTIVES = "directives";
3042
+ const FILTERS = "filters";
3043
+ function resolveComponent(name, maybeSelfReference) {
3044
+ return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
3045
+ }
3046
+ const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
3047
+ function resolveDynamicComponent(component) {
3048
+ if (isString(component)) {
3049
+ return resolveAsset(COMPONENTS, component, false) || component;
3050
+ } else {
3051
+ return component || NULL_DYNAMIC_COMPONENT;
3052
+ }
3053
+ }
3054
+ function resolveDirective(name) {
3055
+ return resolveAsset(DIRECTIVES, name);
3056
+ }
3057
+ function resolveFilter$1(name) {
3058
+ return resolveAsset(FILTERS, name);
3059
+ }
3060
+ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
3061
+ const instance = currentRenderingInstance || currentInstance;
3062
+ if (instance) {
3063
+ const Component = instance.type;
3064
+ if (type === COMPONENTS) {
3065
+ const selfName = getComponentName(
3066
+ Component,
3067
+ false
3068
+ /* do not include inferred name to avoid breaking existing code */
3069
+ );
3070
+ if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
3071
+ return Component;
3072
+ }
3073
+ }
3074
+ const res = (
3075
+ // local registration
3076
+ // check instance[type] first which is resolved for options API
3077
+ resolve(instance[type] || Component[type], name) || // global registration
3078
+ resolve(instance.appContext[type], name)
3079
+ );
3080
+ if (!res && maybeSelfReference) {
3081
+ return Component;
3082
+ }
3083
+ if (!!(process.env.NODE_ENV !== "production") && warnMissing && !res) {
3084
+ const extra = type === COMPONENTS ? `
3085
+ If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
3086
+ warn(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
3087
+ }
3088
+ return res;
3089
+ } else if (!!(process.env.NODE_ENV !== "production")) {
3090
+ warn(
3091
+ `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
3092
+ );
3093
+ }
3094
+ }
3095
+ function resolve(registry, name) {
3096
+ return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
3097
+ }
3098
+
3033
3099
  const isSuspense = (type) => type.__isSuspense;
3034
3100
  const SuspenseImpl = {
3035
3101
  name: "Suspense",
@@ -3564,7 +3630,7 @@ function normalizeSuspenseSlot(s) {
3564
3630
  }
3565
3631
  if (isArray(s)) {
3566
3632
  const singleChild = filterSingleRoot(s);
3567
- if (!!(process.env.NODE_ENV !== "production") && !singleChild) {
3633
+ if (!!(process.env.NODE_ENV !== "production") && !singleChild && s.filter((child) => child !== NULL_DYNAMIC_COMPONENT).length > 0) {
3568
3634
  warn(`<Suspense> slots expect a single root node.`);
3569
3635
  }
3570
3636
  s = singleChild;
@@ -3762,6 +3828,7 @@ function doWatch(source, cb, { immediate, deep, flush, once, onTrack, onTrigger
3762
3828
  let onCleanup = (fn) => {
3763
3829
  cleanup = effect.onStop = () => {
3764
3830
  callWithErrorHandling(fn, instance, 4);
3831
+ cleanup = effect.onStop = void 0;
3765
3832
  };
3766
3833
  };
3767
3834
  let ssrCleanup;
@@ -4262,7 +4329,11 @@ function emptyPlaceholder(vnode) {
4262
4329
  }
4263
4330
  }
4264
4331
  function getKeepAliveChild(vnode) {
4265
- return isKeepAlive(vnode) ? vnode.children ? vnode.children[0] : void 0 : vnode;
4332
+ return isKeepAlive(vnode) ? (
4333
+ // #7121 ensure get the child component subtree in case
4334
+ // it's been replaced during HMR
4335
+ !!(process.env.NODE_ENV !== "production") && vnode.component ? vnode.component.subTree : vnode.children ? vnode.children[0] : void 0
4336
+ ) : vnode;
4266
4337
  }
4267
4338
  function setTransitionHooks(vnode, hooks) {
4268
4339
  if (vnode.shapeFlag & 6 && vnode.component) {
@@ -4784,65 +4855,6 @@ function getCompatListeners(instance) {
4784
4855
  return listeners;
4785
4856
  }
4786
4857
 
4787
- const COMPONENTS = "components";
4788
- const DIRECTIVES = "directives";
4789
- const FILTERS = "filters";
4790
- function resolveComponent(name, maybeSelfReference) {
4791
- return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
4792
- }
4793
- const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
4794
- function resolveDynamicComponent(component) {
4795
- if (isString(component)) {
4796
- return resolveAsset(COMPONENTS, component, false) || component;
4797
- } else {
4798
- return component || NULL_DYNAMIC_COMPONENT;
4799
- }
4800
- }
4801
- function resolveDirective(name) {
4802
- return resolveAsset(DIRECTIVES, name);
4803
- }
4804
- function resolveFilter$1(name) {
4805
- return resolveAsset(FILTERS, name);
4806
- }
4807
- function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
4808
- const instance = currentRenderingInstance || currentInstance;
4809
- if (instance) {
4810
- const Component = instance.type;
4811
- if (type === COMPONENTS) {
4812
- const selfName = getComponentName(
4813
- Component,
4814
- false
4815
- /* do not include inferred name to avoid breaking existing code */
4816
- );
4817
- if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
4818
- return Component;
4819
- }
4820
- }
4821
- const res = (
4822
- // local registration
4823
- // check instance[type] first which is resolved for options API
4824
- resolve(instance[type] || Component[type], name) || // global registration
4825
- resolve(instance.appContext[type], name)
4826
- );
4827
- if (!res && maybeSelfReference) {
4828
- return Component;
4829
- }
4830
- if (!!(process.env.NODE_ENV !== "production") && warnMissing && !res) {
4831
- const extra = type === COMPONENTS ? `
4832
- If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
4833
- warn(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
4834
- }
4835
- return res;
4836
- } else if (!!(process.env.NODE_ENV !== "production")) {
4837
- warn(
4838
- `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
4839
- );
4840
- }
4841
- }
4842
- function resolve(registry, name) {
4843
- return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
4844
- }
4845
-
4846
4858
  function convertLegacyRenderFn(instance) {
4847
4859
  const Component2 = instance.type;
4848
4860
  const render = Component2.render;
@@ -6350,7 +6362,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6350
6362
  return vm;
6351
6363
  }
6352
6364
  }
6353
- Vue.version = `2.6.14-compat:${"3.4.0-alpha.1"}`;
6365
+ Vue.version = `2.6.14-compat:${"3.4.0-alpha.3"}`;
6354
6366
  Vue.config = singletonApp.config;
6355
6367
  Vue.use = (p, ...options) => {
6356
6368
  if (p && isFunction(p.install)) {
@@ -7381,6 +7393,9 @@ function assertType(value, type) {
7381
7393
  };
7382
7394
  }
7383
7395
  function getInvalidTypeMessage(name, value, expectedTypes) {
7396
+ if (expectedTypes.length === 0) {
7397
+ return `Prop type [] for prop "${name}" won't match anything. Did you mean to use type Array instead?`;
7398
+ }
7384
7399
  let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
7385
7400
  const expectedType = expectedTypes[0];
7386
7401
  const receivedType = toRawType(value);
@@ -7652,6 +7667,20 @@ function createHydrationFunctions(rendererInternals) {
7652
7667
  const { type, ref, shapeFlag, patchFlag } = vnode;
7653
7668
  let domType = node.nodeType;
7654
7669
  vnode.el = node;
7670
+ if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
7671
+ if (!("__vnode" in node)) {
7672
+ Object.defineProperty(node, "__vnode", {
7673
+ value: vnode,
7674
+ enumerable: false
7675
+ });
7676
+ }
7677
+ if (!("__vueParentComponent" in node)) {
7678
+ Object.defineProperty(node, "__vueParentComponent", {
7679
+ value: parentComponent,
7680
+ enumerable: false
7681
+ });
7682
+ }
7683
+ }
7655
7684
  if (patchFlag === -2) {
7656
7685
  optimized = false;
7657
7686
  vnode.dynamicChildren = null;
@@ -7682,15 +7711,15 @@ function createHydrationFunctions(rendererInternals) {
7682
7711
  }
7683
7712
  break;
7684
7713
  case Comment:
7685
- if (domType !== 8 /* COMMENT */ || isFragmentStart) {
7686
- if (node.tagName.toLowerCase() === "template") {
7687
- const content = vnode.el.content.firstChild;
7688
- replaceNode(content, node, parentComponent);
7689
- vnode.el = node = content;
7690
- nextNode = nextSibling(node);
7691
- } else {
7692
- nextNode = onMismatch();
7693
- }
7714
+ if (isTemplateNode(node)) {
7715
+ nextNode = nextSibling(node);
7716
+ replaceNode(
7717
+ vnode.el = node.content.firstChild,
7718
+ node,
7719
+ parentComponent
7720
+ );
7721
+ } else if (domType !== 8 /* COMMENT */ || isFragmentStart) {
7722
+ nextNode = onMismatch();
7694
7723
  } else {
7695
7724
  nextNode = nextSibling(node);
7696
7725
  }
@@ -7813,15 +7842,16 @@ function createHydrationFunctions(rendererInternals) {
7813
7842
  const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
7814
7843
  optimized = optimized || !!vnode.dynamicChildren;
7815
7844
  const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
7816
- const forcePatchValue = type === "input" && dirs || type === "option";
7817
- if (!!(process.env.NODE_ENV !== "production") || forcePatchValue || patchFlag !== -1) {
7845
+ const forcePatch = type === "input" || type === "option";
7846
+ if (!!(process.env.NODE_ENV !== "production") || forcePatch || patchFlag !== -1) {
7818
7847
  if (dirs) {
7819
7848
  invokeDirectiveHook(vnode, null, parentComponent, "created");
7820
7849
  }
7821
7850
  if (props) {
7822
- if (forcePatchValue || !optimized || patchFlag & (16 | 32)) {
7851
+ if (forcePatch || !optimized || patchFlag & (16 | 32)) {
7823
7852
  for (const key in props) {
7824
- if (forcePatchValue && key.endsWith("value") || isOn(key) && !isReservedProp(key)) {
7853
+ if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
7854
+ key[0] === ".") {
7825
7855
  patchProp(
7826
7856
  el,
7827
7857
  key,
@@ -8034,8 +8064,7 @@ function createHydrationFunctions(rendererInternals) {
8034
8064
  let parent = parentComponent;
8035
8065
  while (parent) {
8036
8066
  if (parent.vnode.el === oldNode) {
8037
- parent.vnode.el = newNode;
8038
- parent.subTree.el = newNode;
8067
+ parent.vnode.el = parent.subTree.el = newNode;
8039
8068
  }
8040
8069
  parent = parent.parent;
8041
8070
  }
@@ -9653,6 +9682,7 @@ const resolveTarget = (props, select) => {
9653
9682
  }
9654
9683
  };
9655
9684
  const TeleportImpl = {
9685
+ name: "Teleport",
9656
9686
  __isTeleport: true,
9657
9687
  process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals) {
9658
9688
  const {
@@ -10132,7 +10162,7 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
10132
10162
  if (!!(process.env.NODE_ENV !== "production") && shapeFlag & 4 && isProxy(type)) {
10133
10163
  type = toRaw(type);
10134
10164
  warn(
10135
- `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\`.`,
10165
+ `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\`.`,
10136
10166
  `
10137
10167
  Component that was made reactive: `,
10138
10168
  type
@@ -10996,7 +11026,7 @@ function isMemoSame(cached, memo) {
10996
11026
  return true;
10997
11027
  }
10998
11028
 
10999
- const version = "3.4.0-alpha.1";
11029
+ const version = "3.4.0-alpha.3";
11000
11030
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11001
11031
  const _ssrUtils = {
11002
11032
  createComponentInstance,
@@ -12253,21 +12283,20 @@ const vModelText = {
12253
12283
  el[assignKey] = getModelAssigner(vnode);
12254
12284
  if (el.composing)
12255
12285
  return;
12286
+ const elValue = number || el.type === "number" ? looseToNumber(el.value) : el.value;
12287
+ const newValue = value == null ? "" : value;
12288
+ if (elValue === newValue) {
12289
+ return;
12290
+ }
12256
12291
  if (document.activeElement === el && el.type !== "range") {
12257
12292
  if (lazy) {
12258
12293
  return;
12259
12294
  }
12260
- if (trim && el.value.trim() === value) {
12261
- return;
12262
- }
12263
- if ((number || el.type === "number") && looseToNumber(el.value) === value) {
12295
+ if (trim && el.value.trim() === newValue) {
12264
12296
  return;
12265
12297
  }
12266
12298
  }
12267
- const newValue = value == null ? "" : value;
12268
- if (el.value !== newValue) {
12269
- el.value = newValue;
12270
- }
12299
+ el.value = newValue;
12271
12300
  }
12272
12301
  };
12273
12302
  const vModelCheckbox = {
@@ -12867,83 +12896,6 @@ function createCompatVue() {
12867
12896
  return Vue;
12868
12897
  }
12869
12898
 
12870
- function defaultOnError(error) {
12871
- throw error;
12872
- }
12873
- function defaultOnWarn(msg) {
12874
- !!(process.env.NODE_ENV !== "production") && console.warn(`[Vue warn] ${msg.message}`);
12875
- }
12876
- function createCompilerError(code, loc, messages, additionalMessage) {
12877
- const msg = !!(process.env.NODE_ENV !== "production") || false ? (messages || errorMessages)[code] + (additionalMessage || ``) : code;
12878
- const error = new SyntaxError(String(msg));
12879
- error.code = code;
12880
- error.loc = loc;
12881
- return error;
12882
- }
12883
- const errorMessages = {
12884
- // parse errors
12885
- [0]: "Illegal comment.",
12886
- [1]: "CDATA section is allowed only in XML context.",
12887
- [2]: "Duplicate attribute.",
12888
- [3]: "End tag cannot have attributes.",
12889
- [4]: "Illegal '/' in tags.",
12890
- [5]: "Unexpected EOF in tag.",
12891
- [6]: "Unexpected EOF in CDATA section.",
12892
- [7]: "Unexpected EOF in comment.",
12893
- [8]: "Unexpected EOF in script.",
12894
- [9]: "Unexpected EOF in tag.",
12895
- [10]: "Incorrectly closed comment.",
12896
- [11]: "Incorrectly opened comment.",
12897
- [12]: "Illegal tag name. Use '&lt;' to print '<'.",
12898
- [13]: "Attribute value was expected.",
12899
- [14]: "End tag name was expected.",
12900
- [15]: "Whitespace was expected.",
12901
- [16]: "Unexpected '<!--' in comment.",
12902
- [17]: `Attribute name cannot contain U+0022 ("), U+0027 ('), and U+003C (<).`,
12903
- [18]: "Unquoted attribute value cannot contain U+0022 (\"), U+0027 ('), U+003C (<), U+003D (=), and U+0060 (`).",
12904
- [19]: "Attribute name cannot start with '='.",
12905
- [21]: "'<?' is allowed only in XML context.",
12906
- [20]: `Unexpected null character.`,
12907
- [22]: "Illegal '/' in tags.",
12908
- // Vue-specific parse errors
12909
- [23]: "Invalid end tag.",
12910
- [24]: "Element is missing end tag.",
12911
- [25]: "Interpolation end sign was not found.",
12912
- [27]: "End bracket for dynamic directive argument was not found. Note that dynamic directive argument cannot contain spaces.",
12913
- [26]: "Legal directive name was expected.",
12914
- // transform errors
12915
- [28]: `v-if/v-else-if is missing expression.`,
12916
- [29]: `v-if/else branches must use unique keys.`,
12917
- [30]: `v-else/v-else-if has no adjacent v-if or v-else-if.`,
12918
- [31]: `v-for is missing expression.`,
12919
- [32]: `v-for has invalid expression.`,
12920
- [33]: `<template v-for> key should be placed on the <template> tag.`,
12921
- [34]: `v-bind is missing expression.`,
12922
- [35]: `v-on is missing expression.`,
12923
- [36]: `Unexpected custom directive on <slot> outlet.`,
12924
- [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.`,
12925
- [38]: `Duplicate slot names found. `,
12926
- [39]: `Extraneous children found when component already has explicitly named default slot. These children will be ignored.`,
12927
- [40]: `v-slot can only be used on components or <template> tags.`,
12928
- [41]: `v-model is missing expression.`,
12929
- [42]: `v-model value must be a valid JavaScript member expression.`,
12930
- [43]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`,
12931
- [44]: `v-model cannot be used on a prop, because local prop bindings are not writable.
12932
- Use a v-bind binding combined with a v-on listener that emits update:x event instead.`,
12933
- [45]: `Error parsing JavaScript expression: `,
12934
- [46]: `<KeepAlive> expects exactly one child component.`,
12935
- // generic errors
12936
- [47]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
12937
- [48]: `ES module mode is not supported in this build of compiler.`,
12938
- [49]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
12939
- [50]: `"scopeId" option is only supported in module mode.`,
12940
- // deprecations
12941
- [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.`,
12942
- [52]: `v-is="component-name" has been deprecated. Use is="vue:component-name" instead. v-is support will be removed in 3.4.`,
12943
- // just to fulfill types
12944
- [53]: ``
12945
- };
12946
-
12947
12899
  const FRAGMENT = Symbol(!!(process.env.NODE_ENV !== "production") ? `Fragment` : ``);
12948
12900
  const TELEPORT = Symbol(!!(process.env.NODE_ENV !== "production") ? `Teleport` : ``);
12949
12901
  const SUSPENSE = Symbol(!!(process.env.NODE_ENV !== "production") ? `Suspense` : ``);
@@ -13033,13 +12985,14 @@ function registerRuntimeHelpers(helpers) {
13033
12985
  }
13034
12986
 
13035
12987
  const locStub = {
13036
- source: "",
13037
12988
  start: { line: 1, column: 1, offset: 0 },
13038
- end: { line: 1, column: 1, offset: 0 }
12989
+ end: { line: 1, column: 1, offset: 0 },
12990
+ source: ""
13039
12991
  };
13040
- function createRoot(children, loc = locStub) {
12992
+ function createRoot(children, source = "") {
13041
12993
  return {
13042
12994
  type: 0,
12995
+ source,
13043
12996
  children,
13044
12997
  helpers: /* @__PURE__ */ new Set(),
13045
12998
  components: [],
@@ -13049,7 +13002,7 @@ function createRoot(children, loc = locStub) {
13049
13002
  cached: 0,
13050
13003
  temps: 0,
13051
13004
  codegenNode: void 0,
13052
- loc
13005
+ loc: locStub
13053
13006
  };
13054
13007
  }
13055
13008
  function createVNodeCall(context, tag, props, children, patchFlag, dynamicProps, directives, isBlock = false, disableTracking = false, isComponent = false, loc = locStub) {
@@ -13175,40 +13128,993 @@ function convertToBlock(node, { helper, removeHelper, inSSR }) {
13175
13128
  }
13176
13129
  }
13177
13130
 
13178
- const isStaticExp = (p) => p.type === 4 && p.isStatic;
13179
- const isBuiltInType = (tag, expected) => tag === expected || tag === hyphenate(expected);
13180
- function isCoreComponent(tag) {
13181
- if (isBuiltInType(tag, "Teleport")) {
13182
- return TELEPORT;
13183
- } else if (isBuiltInType(tag, "Suspense")) {
13184
- return SUSPENSE;
13185
- } else if (isBuiltInType(tag, "KeepAlive")) {
13186
- return KEEP_ALIVE;
13187
- } else if (isBuiltInType(tag, "BaseTransition")) {
13188
- return BASE_TRANSITION;
13131
+ const defaultDelimitersOpen = new Uint8Array([123, 123]);
13132
+ const defaultDelimitersClose = new Uint8Array([125, 125]);
13133
+ function isTagStartChar(c) {
13134
+ return c >= 97 && c <= 122 || c >= 65 && c <= 90;
13135
+ }
13136
+ function isWhitespace(c) {
13137
+ return c === 32 || c === 10 || c === 9 || c === 12 || c === 13;
13138
+ }
13139
+ function isEndOfTagSection(c) {
13140
+ return c === 47 || c === 62 || isWhitespace(c);
13141
+ }
13142
+ function toCharCodes(str) {
13143
+ const ret = new Uint8Array(str.length);
13144
+ for (let i = 0; i < str.length; i++) {
13145
+ ret[i] = str.charCodeAt(i);
13189
13146
  }
13147
+ return ret;
13190
13148
  }
13191
- const nonIdentifierRE = /^\d|[^\$\w]/;
13192
- const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
13193
- const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
13194
- const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
13195
- const whitespaceRE = /\s+[.[]\s*|\s*[.[]\s+/g;
13196
- const isMemberExpressionBrowser = (path) => {
13197
- path = path.trim().replace(whitespaceRE, (s) => s.trim());
13198
- let state = 0 /* inMemberExp */;
13199
- let stateStack = [];
13200
- let currentOpenBracketCount = 0;
13201
- let currentOpenParensCount = 0;
13202
- let currentStringType = null;
13203
- for (let i = 0; i < path.length; i++) {
13204
- const char = path.charAt(i);
13205
- switch (state) {
13206
- case 0 /* inMemberExp */:
13207
- if (char === "[") {
13208
- stateStack.push(state);
13209
- state = 1 /* inBrackets */;
13210
- currentOpenBracketCount++;
13211
- } else if (char === "(") {
13149
+ const Sequences = {
13150
+ Cdata: new Uint8Array([67, 68, 65, 84, 65, 91]),
13151
+ // CDATA[
13152
+ CdataEnd: new Uint8Array([93, 93, 62]),
13153
+ // ]]>
13154
+ CommentEnd: new Uint8Array([45, 45, 62]),
13155
+ // `-->`
13156
+ ScriptEnd: new Uint8Array([60, 47, 115, 99, 114, 105, 112, 116]),
13157
+ // `<\/script`
13158
+ StyleEnd: new Uint8Array([60, 47, 115, 116, 121, 108, 101]),
13159
+ // `</style`
13160
+ TitleEnd: new Uint8Array([60, 47, 116, 105, 116, 108, 101]),
13161
+ // `</title`
13162
+ TextareaEnd: new Uint8Array([
13163
+ 60,
13164
+ 47,
13165
+ 116,
13166
+ 101,
13167
+ 120,
13168
+ 116,
13169
+ 97,
13170
+ 114,
13171
+ 101,
13172
+ 97
13173
+ ])
13174
+ // `</textarea
13175
+ };
13176
+ class Tokenizer {
13177
+ constructor(stack, cbs) {
13178
+ this.stack = stack;
13179
+ this.cbs = cbs;
13180
+ /** The current state the tokenizer is in. */
13181
+ this.state = 1;
13182
+ /** The read buffer. */
13183
+ this.buffer = "";
13184
+ /** The beginning of the section that is currently being read. */
13185
+ this.sectionStart = 0;
13186
+ /** The index within the buffer that we are currently looking at. */
13187
+ this.index = 0;
13188
+ /** The start of the last entity. */
13189
+ this.entityStart = 0;
13190
+ /** Some behavior, eg. when decoding entities, is done while we are in another state. This keeps track of the other state type. */
13191
+ this.baseState = 1;
13192
+ /** For special parsing behavior inside of script and style tags. */
13193
+ this.inRCDATA = false;
13194
+ /** For disabling RCDATA tags handling */
13195
+ this.inXML = false;
13196
+ /** Reocrd newline positions for fast line / column calculation */
13197
+ this.newlines = [];
13198
+ this.mode = 0;
13199
+ this.delimiterOpen = defaultDelimitersOpen;
13200
+ this.delimiterClose = defaultDelimitersClose;
13201
+ this.delimiterIndex = -1;
13202
+ this.currentSequence = void 0;
13203
+ this.sequenceIndex = 0;
13204
+ }
13205
+ get inSFCRoot() {
13206
+ return this.mode === 2 && this.stack.length === 0;
13207
+ }
13208
+ reset() {
13209
+ this.state = 1;
13210
+ this.mode = 0;
13211
+ this.buffer = "";
13212
+ this.sectionStart = 0;
13213
+ this.index = 0;
13214
+ this.baseState = 1;
13215
+ this.currentSequence = void 0;
13216
+ this.newlines.length = 0;
13217
+ this.delimiterOpen = defaultDelimitersOpen;
13218
+ this.delimiterClose = defaultDelimitersClose;
13219
+ }
13220
+ /**
13221
+ * Generate Position object with line / column information using recorded
13222
+ * newline positions. We know the index is always going to be an already
13223
+ * processed index, so all the newlines up to this index should have been
13224
+ * recorded.
13225
+ */
13226
+ getPos(index) {
13227
+ let line = 1;
13228
+ let column = index + 1;
13229
+ for (let i = this.newlines.length - 1; i >= 0; i--) {
13230
+ const newlineIndex = this.newlines[i];
13231
+ if (index > newlineIndex) {
13232
+ line = i + 2;
13233
+ column = index - newlineIndex;
13234
+ break;
13235
+ }
13236
+ }
13237
+ return {
13238
+ column,
13239
+ line,
13240
+ offset: index
13241
+ };
13242
+ }
13243
+ peek() {
13244
+ return this.buffer.charCodeAt(this.index + 1);
13245
+ }
13246
+ stateText(c) {
13247
+ if (c === 60) {
13248
+ if (this.index > this.sectionStart) {
13249
+ this.cbs.ontext(this.sectionStart, this.index);
13250
+ }
13251
+ this.state = 5;
13252
+ this.sectionStart = this.index;
13253
+ } else if (c === this.delimiterOpen[0]) {
13254
+ this.state = 2;
13255
+ this.delimiterIndex = 0;
13256
+ this.stateInterpolationOpen(c);
13257
+ }
13258
+ }
13259
+ stateInterpolationOpen(c) {
13260
+ if (c === this.delimiterOpen[this.delimiterIndex]) {
13261
+ if (this.delimiterIndex === this.delimiterOpen.length - 1) {
13262
+ const start = this.index + 1 - this.delimiterOpen.length;
13263
+ if (start > this.sectionStart) {
13264
+ this.cbs.ontext(this.sectionStart, start);
13265
+ }
13266
+ this.state = 3;
13267
+ this.sectionStart = start;
13268
+ } else {
13269
+ this.delimiterIndex++;
13270
+ }
13271
+ } else if (this.inRCDATA) {
13272
+ this.state = 32;
13273
+ this.stateInRCDATA(c);
13274
+ } else {
13275
+ this.state = 1;
13276
+ this.stateText(c);
13277
+ }
13278
+ }
13279
+ stateInterpolation(c) {
13280
+ if (c === this.delimiterClose[0]) {
13281
+ this.state = 4;
13282
+ this.delimiterIndex = 0;
13283
+ this.stateInterpolationClose(c);
13284
+ }
13285
+ }
13286
+ stateInterpolationClose(c) {
13287
+ if (c === this.delimiterClose[this.delimiterIndex]) {
13288
+ if (this.delimiterIndex === this.delimiterClose.length - 1) {
13289
+ this.cbs.oninterpolation(this.sectionStart, this.index + 1);
13290
+ if (this.inRCDATA) {
13291
+ this.state = 32;
13292
+ } else {
13293
+ this.state = 1;
13294
+ }
13295
+ this.sectionStart = this.index + 1;
13296
+ } else {
13297
+ this.delimiterIndex++;
13298
+ }
13299
+ } else {
13300
+ this.state = 3;
13301
+ this.stateInterpolation(c);
13302
+ }
13303
+ }
13304
+ stateSpecialStartSequence(c) {
13305
+ const isEnd = this.sequenceIndex === this.currentSequence.length;
13306
+ const isMatch = isEnd ? (
13307
+ // If we are at the end of the sequence, make sure the tag name has ended
13308
+ isEndOfTagSection(c)
13309
+ ) : (
13310
+ // Otherwise, do a case-insensitive comparison
13311
+ (c | 32) === this.currentSequence[this.sequenceIndex]
13312
+ );
13313
+ if (!isMatch) {
13314
+ this.inRCDATA = false;
13315
+ } else if (!isEnd) {
13316
+ this.sequenceIndex++;
13317
+ return;
13318
+ }
13319
+ this.sequenceIndex = 0;
13320
+ this.state = 6;
13321
+ this.stateInTagName(c);
13322
+ }
13323
+ /** Look for an end tag. For <title> and <textarea>, also decode entities. */
13324
+ stateInRCDATA(c) {
13325
+ if (this.sequenceIndex === this.currentSequence.length) {
13326
+ if (c === 62 || isWhitespace(c)) {
13327
+ const endOfText = this.index - this.currentSequence.length;
13328
+ if (this.sectionStart < endOfText) {
13329
+ const actualIndex = this.index;
13330
+ this.index = endOfText;
13331
+ this.cbs.ontext(this.sectionStart, endOfText);
13332
+ this.index = actualIndex;
13333
+ }
13334
+ this.sectionStart = endOfText + 2;
13335
+ this.stateInClosingTagName(c);
13336
+ this.inRCDATA = false;
13337
+ return;
13338
+ }
13339
+ this.sequenceIndex = 0;
13340
+ }
13341
+ if ((c | 32) === this.currentSequence[this.sequenceIndex]) {
13342
+ this.sequenceIndex += 1;
13343
+ } else if (this.sequenceIndex === 0) {
13344
+ if (this.currentSequence === Sequences.TitleEnd || this.currentSequence === Sequences.TextareaEnd && !this.inSFCRoot) {
13345
+ if (c === this.delimiterOpen[0]) {
13346
+ this.state = 2;
13347
+ this.delimiterIndex = 0;
13348
+ this.stateInterpolationOpen(c);
13349
+ }
13350
+ } else if (this.fastForwardTo(60)) {
13351
+ this.sequenceIndex = 1;
13352
+ }
13353
+ } else {
13354
+ this.sequenceIndex = Number(c === 60);
13355
+ }
13356
+ }
13357
+ stateCDATASequence(c) {
13358
+ if (c === Sequences.Cdata[this.sequenceIndex]) {
13359
+ if (++this.sequenceIndex === Sequences.Cdata.length) {
13360
+ this.state = 28;
13361
+ this.currentSequence = Sequences.CdataEnd;
13362
+ this.sequenceIndex = 0;
13363
+ this.sectionStart = this.index + 1;
13364
+ }
13365
+ } else {
13366
+ this.sequenceIndex = 0;
13367
+ this.state = 23;
13368
+ this.stateInDeclaration(c);
13369
+ }
13370
+ }
13371
+ /**
13372
+ * When we wait for one specific character, we can speed things up
13373
+ * by skipping through the buffer until we find it.
13374
+ *
13375
+ * @returns Whether the character was found.
13376
+ */
13377
+ fastForwardTo(c) {
13378
+ while (++this.index < this.buffer.length) {
13379
+ const cc = this.buffer.charCodeAt(this.index);
13380
+ if (cc === 10) {
13381
+ this.newlines.push(this.index);
13382
+ }
13383
+ if (cc === c) {
13384
+ return true;
13385
+ }
13386
+ }
13387
+ this.index = this.buffer.length - 1;
13388
+ return false;
13389
+ }
13390
+ /**
13391
+ * Comments and CDATA end with `-->` and `]]>`.
13392
+ *
13393
+ * Their common qualities are:
13394
+ * - Their end sequences have a distinct character they start with.
13395
+ * - That character is then repeated, so we have to check multiple repeats.
13396
+ * - All characters but the start character of the sequence can be skipped.
13397
+ */
13398
+ stateInCommentLike(c) {
13399
+ if (c === this.currentSequence[this.sequenceIndex]) {
13400
+ if (++this.sequenceIndex === this.currentSequence.length) {
13401
+ if (this.currentSequence === Sequences.CdataEnd) {
13402
+ this.cbs.oncdata(this.sectionStart, this.index - 2);
13403
+ } else {
13404
+ this.cbs.oncomment(this.sectionStart, this.index - 2);
13405
+ }
13406
+ this.sequenceIndex = 0;
13407
+ this.sectionStart = this.index + 1;
13408
+ this.state = 1;
13409
+ }
13410
+ } else if (this.sequenceIndex === 0) {
13411
+ if (this.fastForwardTo(this.currentSequence[0])) {
13412
+ this.sequenceIndex = 1;
13413
+ }
13414
+ } else if (c !== this.currentSequence[this.sequenceIndex - 1]) {
13415
+ this.sequenceIndex = 0;
13416
+ }
13417
+ }
13418
+ startSpecial(sequence, offset) {
13419
+ this.enterRCDATA(sequence, offset);
13420
+ this.state = 31;
13421
+ }
13422
+ enterRCDATA(sequence, offset) {
13423
+ this.inRCDATA = true;
13424
+ this.currentSequence = sequence;
13425
+ this.sequenceIndex = offset;
13426
+ }
13427
+ stateBeforeTagName(c) {
13428
+ if (c === 33) {
13429
+ this.state = 22;
13430
+ this.sectionStart = this.index + 1;
13431
+ } else if (c === 63) {
13432
+ this.state = 24;
13433
+ this.sectionStart = this.index + 1;
13434
+ } else if (isTagStartChar(c)) {
13435
+ this.sectionStart = this.index;
13436
+ if (this.mode === 0) {
13437
+ this.state = 6;
13438
+ } else if (this.inSFCRoot) {
13439
+ this.state = 34;
13440
+ } else if (!this.inXML) {
13441
+ const lower = c | 32;
13442
+ if (lower === 116) {
13443
+ this.state = 30;
13444
+ } else {
13445
+ this.state = lower === 115 ? 29 : 6;
13446
+ }
13447
+ } else {
13448
+ this.state = 6;
13449
+ }
13450
+ } else if (c === 47) {
13451
+ this.state = 8;
13452
+ } else {
13453
+ this.state = 1;
13454
+ this.stateText(c);
13455
+ }
13456
+ }
13457
+ stateInTagName(c) {
13458
+ if (isEndOfTagSection(c)) {
13459
+ this.handleTagName(c);
13460
+ }
13461
+ }
13462
+ stateInSFCRootTagName(c) {
13463
+ if (isEndOfTagSection(c)) {
13464
+ const tag = this.buffer.slice(this.sectionStart, this.index);
13465
+ if (tag !== "template") {
13466
+ this.enterRCDATA(toCharCodes(`</` + tag), 0);
13467
+ }
13468
+ this.handleTagName(c);
13469
+ }
13470
+ }
13471
+ handleTagName(c) {
13472
+ this.cbs.onopentagname(this.sectionStart, this.index);
13473
+ this.sectionStart = -1;
13474
+ this.state = 11;
13475
+ this.stateBeforeAttrName(c);
13476
+ }
13477
+ stateBeforeClosingTagName(c) {
13478
+ if (isWhitespace(c)) ; else if (c === 62) {
13479
+ if (!!(process.env.NODE_ENV !== "production") || false) {
13480
+ this.cbs.onerr(14, this.index);
13481
+ }
13482
+ this.state = 1;
13483
+ this.sectionStart = this.index + 1;
13484
+ } else {
13485
+ this.state = isTagStartChar(c) ? 9 : 27;
13486
+ this.sectionStart = this.index;
13487
+ }
13488
+ }
13489
+ stateInClosingTagName(c) {
13490
+ if (c === 62 || isWhitespace(c)) {
13491
+ this.cbs.onclosetag(this.sectionStart, this.index);
13492
+ this.sectionStart = -1;
13493
+ this.state = 10;
13494
+ this.stateAfterClosingTagName(c);
13495
+ }
13496
+ }
13497
+ stateAfterClosingTagName(c) {
13498
+ if (c === 62) {
13499
+ this.state = 1;
13500
+ this.sectionStart = this.index + 1;
13501
+ }
13502
+ }
13503
+ stateBeforeAttrName(c) {
13504
+ if (c === 62) {
13505
+ this.cbs.onopentagend(this.index);
13506
+ if (this.inRCDATA) {
13507
+ this.state = 32;
13508
+ } else {
13509
+ this.state = 1;
13510
+ }
13511
+ this.sectionStart = this.index + 1;
13512
+ } else if (c === 47) {
13513
+ this.state = 7;
13514
+ if ((!!(process.env.NODE_ENV !== "production") || false) && this.peek() !== 62) {
13515
+ this.cbs.onerr(22, this.index);
13516
+ }
13517
+ } else if (c === 60 && this.peek() === 47) {
13518
+ this.cbs.onopentagend(this.index);
13519
+ this.state = 5;
13520
+ this.sectionStart = this.index;
13521
+ } else if (!isWhitespace(c)) {
13522
+ if ((!!(process.env.NODE_ENV !== "production") || false) && c === 61) {
13523
+ this.cbs.onerr(
13524
+ 19,
13525
+ this.index
13526
+ );
13527
+ }
13528
+ this.handleAttrStart(c);
13529
+ }
13530
+ }
13531
+ handleAttrStart(c) {
13532
+ if (c === 118 && this.peek() === 45) {
13533
+ this.state = 13;
13534
+ this.sectionStart = this.index;
13535
+ } else if (c === 46 || c === 58 || c === 64 || c === 35) {
13536
+ this.cbs.ondirname(this.index, this.index + 1);
13537
+ this.state = 14;
13538
+ this.sectionStart = this.index + 1;
13539
+ } else {
13540
+ this.state = 12;
13541
+ this.sectionStart = this.index;
13542
+ }
13543
+ }
13544
+ stateInSelfClosingTag(c) {
13545
+ if (c === 62) {
13546
+ this.cbs.onselfclosingtag(this.index);
13547
+ this.state = 1;
13548
+ this.sectionStart = this.index + 1;
13549
+ this.inRCDATA = false;
13550
+ } else if (!isWhitespace(c)) {
13551
+ this.state = 11;
13552
+ this.stateBeforeAttrName(c);
13553
+ }
13554
+ }
13555
+ stateInAttrName(c) {
13556
+ if (c === 61 || isEndOfTagSection(c)) {
13557
+ this.cbs.onattribname(this.sectionStart, this.index);
13558
+ this.handleAttrNameEnd(c);
13559
+ } else if ((!!(process.env.NODE_ENV !== "production") || false) && (c === 34 || c === 39 || c === 60)) {
13560
+ this.cbs.onerr(
13561
+ 17,
13562
+ this.index
13563
+ );
13564
+ }
13565
+ }
13566
+ stateInDirName(c) {
13567
+ if (c === 61 || isEndOfTagSection(c)) {
13568
+ this.cbs.ondirname(this.sectionStart, this.index);
13569
+ this.handleAttrNameEnd(c);
13570
+ } else if (c === 58) {
13571
+ this.cbs.ondirname(this.sectionStart, this.index);
13572
+ this.state = 14;
13573
+ this.sectionStart = this.index + 1;
13574
+ } else if (c === 46) {
13575
+ this.cbs.ondirname(this.sectionStart, this.index);
13576
+ this.state = 16;
13577
+ this.sectionStart = this.index + 1;
13578
+ }
13579
+ }
13580
+ stateInDirArg(c) {
13581
+ if (c === 61 || isEndOfTagSection(c)) {
13582
+ this.cbs.ondirarg(this.sectionStart, this.index);
13583
+ this.handleAttrNameEnd(c);
13584
+ } else if (c === 91) {
13585
+ this.state = 15;
13586
+ } else if (c === 46) {
13587
+ this.cbs.ondirarg(this.sectionStart, this.index);
13588
+ this.state = 16;
13589
+ this.sectionStart = this.index + 1;
13590
+ }
13591
+ }
13592
+ stateInDynamicDirArg(c) {
13593
+ if (c === 93) {
13594
+ this.state = 14;
13595
+ } else if (c === 61 || isEndOfTagSection(c)) {
13596
+ this.cbs.ondirarg(this.sectionStart, this.index + 1);
13597
+ this.handleAttrNameEnd(c);
13598
+ if (!!(process.env.NODE_ENV !== "production") || false) {
13599
+ this.cbs.onerr(
13600
+ 27,
13601
+ this.index
13602
+ );
13603
+ }
13604
+ }
13605
+ }
13606
+ stateInDirModifier(c) {
13607
+ if (c === 61 || isEndOfTagSection(c)) {
13608
+ this.cbs.ondirmodifier(this.sectionStart, this.index);
13609
+ this.handleAttrNameEnd(c);
13610
+ } else if (c === 46) {
13611
+ this.cbs.ondirmodifier(this.sectionStart, this.index);
13612
+ this.sectionStart = this.index + 1;
13613
+ }
13614
+ }
13615
+ handleAttrNameEnd(c) {
13616
+ this.sectionStart = this.index;
13617
+ this.state = 17;
13618
+ this.cbs.onattribnameend(this.index);
13619
+ this.stateAfterAttrName(c);
13620
+ }
13621
+ stateAfterAttrName(c) {
13622
+ if (c === 61) {
13623
+ this.state = 18;
13624
+ } else if (c === 47 || c === 62) {
13625
+ this.cbs.onattribend(0, this.sectionStart);
13626
+ this.sectionStart = -1;
13627
+ this.state = 11;
13628
+ this.stateBeforeAttrName(c);
13629
+ } else if (!isWhitespace(c)) {
13630
+ this.cbs.onattribend(0, this.sectionStart);
13631
+ this.handleAttrStart(c);
13632
+ }
13633
+ }
13634
+ stateBeforeAttrValue(c) {
13635
+ if (c === 34) {
13636
+ this.state = 19;
13637
+ this.sectionStart = this.index + 1;
13638
+ } else if (c === 39) {
13639
+ this.state = 20;
13640
+ this.sectionStart = this.index + 1;
13641
+ } else if (!isWhitespace(c)) {
13642
+ this.sectionStart = this.index;
13643
+ this.state = 21;
13644
+ this.stateInAttrValueNoQuotes(c);
13645
+ }
13646
+ }
13647
+ handleInAttrValue(c, quote) {
13648
+ if (c === quote || this.fastForwardTo(quote)) {
13649
+ this.cbs.onattribdata(this.sectionStart, this.index);
13650
+ this.sectionStart = -1;
13651
+ this.cbs.onattribend(
13652
+ quote === 34 ? 3 : 2,
13653
+ this.index + 1
13654
+ );
13655
+ this.state = 11;
13656
+ }
13657
+ }
13658
+ stateInAttrValueDoubleQuotes(c) {
13659
+ this.handleInAttrValue(c, 34);
13660
+ }
13661
+ stateInAttrValueSingleQuotes(c) {
13662
+ this.handleInAttrValue(c, 39);
13663
+ }
13664
+ stateInAttrValueNoQuotes(c) {
13665
+ if (isWhitespace(c) || c === 62) {
13666
+ this.cbs.onattribdata(this.sectionStart, this.index);
13667
+ this.sectionStart = -1;
13668
+ this.cbs.onattribend(1, this.index);
13669
+ this.state = 11;
13670
+ this.stateBeforeAttrName(c);
13671
+ } else if ((!!(process.env.NODE_ENV !== "production") || false) && c === 34 || c === 39 || c === 60 || c === 61 || c === 96) {
13672
+ this.cbs.onerr(
13673
+ 18,
13674
+ this.index
13675
+ );
13676
+ } else ;
13677
+ }
13678
+ stateBeforeDeclaration(c) {
13679
+ if (c === 91) {
13680
+ this.state = 26;
13681
+ this.sequenceIndex = 0;
13682
+ } else {
13683
+ this.state = c === 45 ? 25 : 23;
13684
+ }
13685
+ }
13686
+ stateInDeclaration(c) {
13687
+ if (c === 62 || this.fastForwardTo(62)) {
13688
+ this.state = 1;
13689
+ this.sectionStart = this.index + 1;
13690
+ }
13691
+ }
13692
+ stateInProcessingInstruction(c) {
13693
+ if (c === 62 || this.fastForwardTo(62)) {
13694
+ this.cbs.onprocessinginstruction(this.sectionStart, this.index);
13695
+ this.state = 1;
13696
+ this.sectionStart = this.index + 1;
13697
+ }
13698
+ }
13699
+ stateBeforeComment(c) {
13700
+ if (c === 45) {
13701
+ this.state = 28;
13702
+ this.currentSequence = Sequences.CommentEnd;
13703
+ this.sequenceIndex = 2;
13704
+ this.sectionStart = this.index + 1;
13705
+ } else {
13706
+ this.state = 23;
13707
+ }
13708
+ }
13709
+ stateInSpecialComment(c) {
13710
+ if (c === 62 || this.fastForwardTo(62)) {
13711
+ this.cbs.oncomment(this.sectionStart, this.index);
13712
+ this.state = 1;
13713
+ this.sectionStart = this.index + 1;
13714
+ }
13715
+ }
13716
+ stateBeforeSpecialS(c) {
13717
+ const lower = c | 32;
13718
+ if (lower === Sequences.ScriptEnd[3]) {
13719
+ this.startSpecial(Sequences.ScriptEnd, 4);
13720
+ } else if (lower === Sequences.StyleEnd[3]) {
13721
+ this.startSpecial(Sequences.StyleEnd, 4);
13722
+ } else {
13723
+ this.state = 6;
13724
+ this.stateInTagName(c);
13725
+ }
13726
+ }
13727
+ stateBeforeSpecialT(c) {
13728
+ const lower = c | 32;
13729
+ if (lower === Sequences.TitleEnd[3]) {
13730
+ this.startSpecial(Sequences.TitleEnd, 4);
13731
+ } else if (lower === Sequences.TextareaEnd[3]) {
13732
+ this.startSpecial(Sequences.TextareaEnd, 4);
13733
+ } else {
13734
+ this.state = 6;
13735
+ this.stateInTagName(c);
13736
+ }
13737
+ }
13738
+ startEntity() {
13739
+ }
13740
+ stateInEntity() {
13741
+ }
13742
+ /**
13743
+ * Iterates through the buffer, calling the function corresponding to the current state.
13744
+ *
13745
+ * States that are more likely to be hit are higher up, as a performance improvement.
13746
+ */
13747
+ parse(input) {
13748
+ this.buffer = input;
13749
+ while (this.index < this.buffer.length) {
13750
+ const c = this.buffer.charCodeAt(this.index);
13751
+ if (c === 10) {
13752
+ this.newlines.push(this.index);
13753
+ }
13754
+ switch (this.state) {
13755
+ case 1: {
13756
+ this.stateText(c);
13757
+ break;
13758
+ }
13759
+ case 2: {
13760
+ this.stateInterpolationOpen(c);
13761
+ break;
13762
+ }
13763
+ case 3: {
13764
+ this.stateInterpolation(c);
13765
+ break;
13766
+ }
13767
+ case 4: {
13768
+ this.stateInterpolationClose(c);
13769
+ break;
13770
+ }
13771
+ case 31: {
13772
+ this.stateSpecialStartSequence(c);
13773
+ break;
13774
+ }
13775
+ case 32: {
13776
+ this.stateInRCDATA(c);
13777
+ break;
13778
+ }
13779
+ case 26: {
13780
+ this.stateCDATASequence(c);
13781
+ break;
13782
+ }
13783
+ case 19: {
13784
+ this.stateInAttrValueDoubleQuotes(c);
13785
+ break;
13786
+ }
13787
+ case 12: {
13788
+ this.stateInAttrName(c);
13789
+ break;
13790
+ }
13791
+ case 13: {
13792
+ this.stateInDirName(c);
13793
+ break;
13794
+ }
13795
+ case 14: {
13796
+ this.stateInDirArg(c);
13797
+ break;
13798
+ }
13799
+ case 15: {
13800
+ this.stateInDynamicDirArg(c);
13801
+ break;
13802
+ }
13803
+ case 16: {
13804
+ this.stateInDirModifier(c);
13805
+ break;
13806
+ }
13807
+ case 28: {
13808
+ this.stateInCommentLike(c);
13809
+ break;
13810
+ }
13811
+ case 27: {
13812
+ this.stateInSpecialComment(c);
13813
+ break;
13814
+ }
13815
+ case 11: {
13816
+ this.stateBeforeAttrName(c);
13817
+ break;
13818
+ }
13819
+ case 6: {
13820
+ this.stateInTagName(c);
13821
+ break;
13822
+ }
13823
+ case 34: {
13824
+ this.stateInSFCRootTagName(c);
13825
+ break;
13826
+ }
13827
+ case 9: {
13828
+ this.stateInClosingTagName(c);
13829
+ break;
13830
+ }
13831
+ case 5: {
13832
+ this.stateBeforeTagName(c);
13833
+ break;
13834
+ }
13835
+ case 17: {
13836
+ this.stateAfterAttrName(c);
13837
+ break;
13838
+ }
13839
+ case 20: {
13840
+ this.stateInAttrValueSingleQuotes(c);
13841
+ break;
13842
+ }
13843
+ case 18: {
13844
+ this.stateBeforeAttrValue(c);
13845
+ break;
13846
+ }
13847
+ case 8: {
13848
+ this.stateBeforeClosingTagName(c);
13849
+ break;
13850
+ }
13851
+ case 10: {
13852
+ this.stateAfterClosingTagName(c);
13853
+ break;
13854
+ }
13855
+ case 29: {
13856
+ this.stateBeforeSpecialS(c);
13857
+ break;
13858
+ }
13859
+ case 30: {
13860
+ this.stateBeforeSpecialT(c);
13861
+ break;
13862
+ }
13863
+ case 21: {
13864
+ this.stateInAttrValueNoQuotes(c);
13865
+ break;
13866
+ }
13867
+ case 7: {
13868
+ this.stateInSelfClosingTag(c);
13869
+ break;
13870
+ }
13871
+ case 23: {
13872
+ this.stateInDeclaration(c);
13873
+ break;
13874
+ }
13875
+ case 22: {
13876
+ this.stateBeforeDeclaration(c);
13877
+ break;
13878
+ }
13879
+ case 25: {
13880
+ this.stateBeforeComment(c);
13881
+ break;
13882
+ }
13883
+ case 24: {
13884
+ this.stateInProcessingInstruction(c);
13885
+ break;
13886
+ }
13887
+ case 33: {
13888
+ this.stateInEntity();
13889
+ break;
13890
+ }
13891
+ }
13892
+ this.index++;
13893
+ }
13894
+ this.cleanup();
13895
+ this.finish();
13896
+ }
13897
+ /**
13898
+ * Remove data that has already been consumed from the buffer.
13899
+ */
13900
+ cleanup() {
13901
+ if (this.sectionStart !== this.index) {
13902
+ if (this.state === 1 || this.state === 32 && this.sequenceIndex === 0) {
13903
+ this.cbs.ontext(this.sectionStart, this.index);
13904
+ this.sectionStart = this.index;
13905
+ } else if (this.state === 19 || this.state === 20 || this.state === 21) {
13906
+ this.cbs.onattribdata(this.sectionStart, this.index);
13907
+ this.sectionStart = this.index;
13908
+ }
13909
+ }
13910
+ }
13911
+ finish() {
13912
+ this.handleTrailingData();
13913
+ this.cbs.onend();
13914
+ }
13915
+ /** Handle any trailing data. */
13916
+ handleTrailingData() {
13917
+ const endIndex = this.buffer.length;
13918
+ if (this.sectionStart >= endIndex) {
13919
+ return;
13920
+ }
13921
+ if (this.state === 28) {
13922
+ if (this.currentSequence === Sequences.CdataEnd) {
13923
+ this.cbs.oncdata(this.sectionStart, endIndex);
13924
+ } else {
13925
+ this.cbs.oncomment(this.sectionStart, endIndex);
13926
+ }
13927
+ } 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 {
13928
+ this.cbs.ontext(this.sectionStart, endIndex);
13929
+ }
13930
+ }
13931
+ emitCodePoint(cp, consumed) {
13932
+ }
13933
+ }
13934
+
13935
+ const deprecationData = {
13936
+ ["COMPILER_IS_ON_ELEMENT"]: {
13937
+ 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:".`,
13938
+ link: `https://v3-migration.vuejs.org/breaking-changes/custom-elements-interop.html`
13939
+ },
13940
+ ["COMPILER_V_BIND_SYNC"]: {
13941
+ 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}\`.`,
13942
+ link: `https://v3-migration.vuejs.org/breaking-changes/v-model.html`
13943
+ },
13944
+ ["COMPILER_V_BIND_OBJECT_ORDER"]: {
13945
+ 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.`,
13946
+ link: `https://v3-migration.vuejs.org/breaking-changes/v-bind.html`
13947
+ },
13948
+ ["COMPILER_V_ON_NATIVE"]: {
13949
+ message: `.native modifier for v-on has been removed as is no longer necessary.`,
13950
+ link: `https://v3-migration.vuejs.org/breaking-changes/v-on-native-modifier-removed.html`
13951
+ },
13952
+ ["COMPILER_V_IF_V_FOR_PRECEDENCE"]: {
13953
+ 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.`,
13954
+ link: `https://v3-migration.vuejs.org/breaking-changes/v-if-v-for.html`
13955
+ },
13956
+ ["COMPILER_NATIVE_TEMPLATE"]: {
13957
+ message: `<template> with no special directives will render as a native template element instead of its inner content in Vue 3.`
13958
+ },
13959
+ ["COMPILER_INLINE_TEMPLATE"]: {
13960
+ message: `"inline-template" has been removed in Vue 3.`,
13961
+ link: `https://v3-migration.vuejs.org/breaking-changes/inline-template-attribute.html`
13962
+ },
13963
+ ["COMPILER_FILTER"]: {
13964
+ 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.`,
13965
+ link: `https://v3-migration.vuejs.org/breaking-changes/filters.html`
13966
+ }
13967
+ };
13968
+ function getCompatValue(key, { compatConfig }) {
13969
+ const value = compatConfig && compatConfig[key];
13970
+ if (key === "MODE") {
13971
+ return value || 3;
13972
+ } else {
13973
+ return value;
13974
+ }
13975
+ }
13976
+ function isCompatEnabled(key, context) {
13977
+ const mode = getCompatValue("MODE", context);
13978
+ const value = getCompatValue(key, context);
13979
+ return mode === 3 ? value === true : value !== false;
13980
+ }
13981
+ function checkCompatEnabled(key, context, loc, ...args) {
13982
+ const enabled = isCompatEnabled(key, context);
13983
+ if (!!(process.env.NODE_ENV !== "production") && enabled) {
13984
+ warnDeprecation(key, context, loc, ...args);
13985
+ }
13986
+ return enabled;
13987
+ }
13988
+ function warnDeprecation(key, context, loc, ...args) {
13989
+ const val = getCompatValue(key, context);
13990
+ if (val === "suppress-warning") {
13991
+ return;
13992
+ }
13993
+ const { message, link } = deprecationData[key];
13994
+ const msg = `(deprecation ${key}) ${typeof message === "function" ? message(...args) : message}${link ? `
13995
+ Details: ${link}` : ``}`;
13996
+ const err = new SyntaxError(msg);
13997
+ err.code = key;
13998
+ if (loc)
13999
+ err.loc = loc;
14000
+ context.onWarn(err);
14001
+ }
14002
+
14003
+ function defaultOnError(error) {
14004
+ throw error;
14005
+ }
14006
+ function defaultOnWarn(msg) {
14007
+ !!(process.env.NODE_ENV !== "production") && console.warn(`[Vue warn] ${msg.message}`);
14008
+ }
14009
+ function createCompilerError(code, loc, messages, additionalMessage) {
14010
+ const msg = !!(process.env.NODE_ENV !== "production") || false ? (messages || errorMessages)[code] + (additionalMessage || ``) : `https://vuejs.org/errors/#compiler-${code}`;
14011
+ const error = new SyntaxError(String(msg));
14012
+ error.code = code;
14013
+ error.loc = loc;
14014
+ return error;
14015
+ }
14016
+ const errorMessages = {
14017
+ // parse errors
14018
+ [0]: "Illegal comment.",
14019
+ [1]: "CDATA section is allowed only in XML context.",
14020
+ [2]: "Duplicate attribute.",
14021
+ [3]: "End tag cannot have attributes.",
14022
+ [4]: "Illegal '/' in tags.",
14023
+ [5]: "Unexpected EOF in tag.",
14024
+ [6]: "Unexpected EOF in CDATA section.",
14025
+ [7]: "Unexpected EOF in comment.",
14026
+ [8]: "Unexpected EOF in script.",
14027
+ [9]: "Unexpected EOF in tag.",
14028
+ [10]: "Incorrectly closed comment.",
14029
+ [11]: "Incorrectly opened comment.",
14030
+ [12]: "Illegal tag name. Use '&lt;' to print '<'.",
14031
+ [13]: "Attribute value was expected.",
14032
+ [14]: "End tag name was expected.",
14033
+ [15]: "Whitespace was expected.",
14034
+ [16]: "Unexpected '<!--' in comment.",
14035
+ [17]: `Attribute name cannot contain U+0022 ("), U+0027 ('), and U+003C (<).`,
14036
+ [18]: "Unquoted attribute value cannot contain U+0022 (\"), U+0027 ('), U+003C (<), U+003D (=), and U+0060 (`).",
14037
+ [19]: "Attribute name cannot start with '='.",
14038
+ [21]: "'<?' is allowed only in XML context.",
14039
+ [20]: `Unexpected null character.`,
14040
+ [22]: "Illegal '/' in tags.",
14041
+ // Vue-specific parse errors
14042
+ [23]: "Invalid end tag.",
14043
+ [24]: "Element is missing end tag.",
14044
+ [25]: "Interpolation end sign was not found.",
14045
+ [27]: "End bracket for dynamic directive argument was not found. Note that dynamic directive argument cannot contain spaces.",
14046
+ [26]: "Legal directive name was expected.",
14047
+ // transform errors
14048
+ [28]: `v-if/v-else-if is missing expression.`,
14049
+ [29]: `v-if/else branches must use unique keys.`,
14050
+ [30]: `v-else/v-else-if has no adjacent v-if or v-else-if.`,
14051
+ [31]: `v-for is missing expression.`,
14052
+ [32]: `v-for has invalid expression.`,
14053
+ [33]: `<template v-for> key should be placed on the <template> tag.`,
14054
+ [34]: `v-bind is missing expression.`,
14055
+ [35]: `v-on is missing expression.`,
14056
+ [36]: `Unexpected custom directive on <slot> outlet.`,
14057
+ [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.`,
14058
+ [38]: `Duplicate slot names found. `,
14059
+ [39]: `Extraneous children found when component already has explicitly named default slot. These children will be ignored.`,
14060
+ [40]: `v-slot can only be used on components or <template> tags.`,
14061
+ [41]: `v-model is missing expression.`,
14062
+ [42]: `v-model value must be a valid JavaScript member expression.`,
14063
+ [43]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`,
14064
+ [44]: `v-model cannot be used on a prop, because local prop bindings are not writable.
14065
+ Use a v-bind binding combined with a v-on listener that emits update:x event instead.`,
14066
+ [45]: `Error parsing JavaScript expression: `,
14067
+ [46]: `<KeepAlive> expects exactly one child component.`,
14068
+ // generic errors
14069
+ [47]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
14070
+ [48]: `ES module mode is not supported in this build of compiler.`,
14071
+ [49]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
14072
+ [50]: `"scopeId" option is only supported in module mode.`,
14073
+ // deprecations
14074
+ [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.`,
14075
+ [52]: `v-is="component-name" has been deprecated. Use is="vue:component-name" instead. v-is support will be removed in 3.4.`,
14076
+ // just to fulfill types
14077
+ [53]: ``
14078
+ };
14079
+
14080
+ const isStaticExp = (p) => p.type === 4 && p.isStatic;
14081
+ function isCoreComponent(tag) {
14082
+ switch (tag) {
14083
+ case "Teleport":
14084
+ case "teleport":
14085
+ return TELEPORT;
14086
+ case "Suspense":
14087
+ case "suspense":
14088
+ return SUSPENSE;
14089
+ case "KeepAlive":
14090
+ case "keep-alive":
14091
+ return KEEP_ALIVE;
14092
+ case "BaseTransition":
14093
+ case "base-transition":
14094
+ return BASE_TRANSITION;
14095
+ }
14096
+ }
14097
+ const nonIdentifierRE = /^\d|[^\$\w]/;
14098
+ const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
14099
+ const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
14100
+ const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
14101
+ const whitespaceRE = /\s+[.[]\s*|\s*[.[]\s+/g;
14102
+ const isMemberExpressionBrowser = (path) => {
14103
+ path = path.trim().replace(whitespaceRE, (s) => s.trim());
14104
+ let state = 0 /* inMemberExp */;
14105
+ let stateStack = [];
14106
+ let currentOpenBracketCount = 0;
14107
+ let currentOpenParensCount = 0;
14108
+ let currentStringType = null;
14109
+ for (let i = 0; i < path.length; i++) {
14110
+ const char = path.charAt(i);
14111
+ switch (state) {
14112
+ case 0 /* inMemberExp */:
14113
+ if (char === "[") {
14114
+ stateStack.push(state);
14115
+ state = 1 /* inBrackets */;
14116
+ currentOpenBracketCount++;
14117
+ } else if (char === "(") {
13212
14118
  stateStack.push(state);
13213
14119
  state = 2 /* inParens */;
13214
14120
  currentOpenParensCount++;
@@ -13256,43 +14162,6 @@ const isMemberExpressionBrowser = (path) => {
13256
14162
  return !currentOpenBracketCount && !currentOpenParensCount;
13257
14163
  };
13258
14164
  const isMemberExpression = isMemberExpressionBrowser ;
13259
- function getInnerRange(loc, offset, length) {
13260
- const source = loc.source.slice(offset, offset + length);
13261
- const newLoc = {
13262
- source,
13263
- start: advancePositionWithClone(loc.start, loc.source, offset),
13264
- end: loc.end
13265
- };
13266
- if (length != null) {
13267
- newLoc.end = advancePositionWithClone(
13268
- loc.start,
13269
- loc.source,
13270
- offset + length
13271
- );
13272
- }
13273
- return newLoc;
13274
- }
13275
- function advancePositionWithClone(pos, source, numberOfCharacters = source.length) {
13276
- return advancePositionWithMutation(
13277
- extend({}, pos),
13278
- source,
13279
- numberOfCharacters
13280
- );
13281
- }
13282
- function advancePositionWithMutation(pos, source, numberOfCharacters = source.length) {
13283
- let linesCount = 0;
13284
- let lastNewLinePos = -1;
13285
- for (let i = 0; i < numberOfCharacters; i++) {
13286
- if (source.charCodeAt(i) === 10) {
13287
- linesCount++;
13288
- lastNewLinePos = i;
13289
- }
13290
- }
13291
- pos.offset += numberOfCharacters;
13292
- pos.line += linesCount;
13293
- pos.column = lastNewLinePos === -1 ? pos.column + numberOfCharacters : numberOfCharacters - lastNewLinePos;
13294
- return pos;
13295
- }
13296
14165
  function assert(condition, msg) {
13297
14166
  if (!condition) {
13298
14167
  throw new Error(msg || `unexpected compiler condition`);
@@ -13395,512 +14264,603 @@ function injectProp(node, prop, context) {
13395
14264
  propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [
13396
14265
  createObjectExpression([prop]),
13397
14266
  props
13398
- ]);
13399
- if (parentCall && parentCall.callee === GUARD_REACTIVE_PROPS) {
13400
- parentCall = callPath[callPath.length - 2];
13401
- }
13402
- }
13403
- if (node.type === 13) {
13404
- if (parentCall) {
13405
- parentCall.arguments[0] = propsWithInjection;
13406
- } else {
13407
- node.props = propsWithInjection;
13408
- }
13409
- } else {
13410
- if (parentCall) {
13411
- parentCall.arguments[0] = propsWithInjection;
13412
- } else {
13413
- node.arguments[2] = propsWithInjection;
13414
- }
13415
- }
13416
- }
13417
- function hasProp(prop, props) {
13418
- let result = false;
13419
- if (prop.key.type === 4) {
13420
- const propKeyName = prop.key.content;
13421
- result = props.properties.some(
13422
- (p) => p.key.type === 4 && p.key.content === propKeyName
13423
- );
13424
- }
13425
- return result;
13426
- }
13427
- function toValidAssetId(name, type) {
13428
- return `_${type}_${name.replace(/[^\w]/g, (searchValue, replaceValue) => {
13429
- return searchValue === "-" ? "_" : name.charCodeAt(replaceValue).toString();
13430
- })}`;
13431
- }
13432
- function getMemoedVNodeCall(node) {
13433
- if (node.type === 14 && node.callee === WITH_MEMO) {
13434
- return node.arguments[1].returns;
13435
- } else {
13436
- return node;
13437
- }
13438
- }
13439
-
13440
- const deprecationData = {
13441
- ["COMPILER_IS_ON_ELEMENT"]: {
13442
- 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:".`,
13443
- link: `https://v3-migration.vuejs.org/breaking-changes/custom-elements-interop.html`
13444
- },
13445
- ["COMPILER_V_BIND_SYNC"]: {
13446
- 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}\`.`,
13447
- link: `https://v3-migration.vuejs.org/breaking-changes/v-model.html`
13448
- },
13449
- ["COMPILER_V_BIND_PROP"]: {
13450
- 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.`
13451
- },
13452
- ["COMPILER_V_BIND_OBJECT_ORDER"]: {
13453
- 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.`,
13454
- link: `https://v3-migration.vuejs.org/breaking-changes/v-bind.html`
13455
- },
13456
- ["COMPILER_V_ON_NATIVE"]: {
13457
- message: `.native modifier for v-on has been removed as is no longer necessary.`,
13458
- link: `https://v3-migration.vuejs.org/breaking-changes/v-on-native-modifier-removed.html`
13459
- },
13460
- ["COMPILER_V_IF_V_FOR_PRECEDENCE"]: {
13461
- 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.`,
13462
- link: `https://v3-migration.vuejs.org/breaking-changes/v-if-v-for.html`
13463
- },
13464
- ["COMPILER_NATIVE_TEMPLATE"]: {
13465
- message: `<template> with no special directives will render as a native template element instead of its inner content in Vue 3.`
13466
- },
13467
- ["COMPILER_INLINE_TEMPLATE"]: {
13468
- message: `"inline-template" has been removed in Vue 3.`,
13469
- link: `https://v3-migration.vuejs.org/breaking-changes/inline-template-attribute.html`
13470
- },
13471
- ["COMPILER_FILTER"]: {
13472
- 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.`,
13473
- link: `https://v3-migration.vuejs.org/breaking-changes/filters.html`
14267
+ ]);
14268
+ if (parentCall && parentCall.callee === GUARD_REACTIVE_PROPS) {
14269
+ parentCall = callPath[callPath.length - 2];
14270
+ }
13474
14271
  }
13475
- };
13476
- function getCompatValue(key, context) {
13477
- const config = context.options ? context.options.compatConfig : context.compatConfig;
13478
- const value = config && config[key];
13479
- if (key === "MODE") {
13480
- return value || 3;
14272
+ if (node.type === 13) {
14273
+ if (parentCall) {
14274
+ parentCall.arguments[0] = propsWithInjection;
14275
+ } else {
14276
+ node.props = propsWithInjection;
14277
+ }
13481
14278
  } else {
13482
- return value;
14279
+ if (parentCall) {
14280
+ parentCall.arguments[0] = propsWithInjection;
14281
+ } else {
14282
+ node.arguments[2] = propsWithInjection;
14283
+ }
13483
14284
  }
13484
14285
  }
13485
- function isCompatEnabled(key, context) {
13486
- const mode = getCompatValue("MODE", context);
13487
- const value = getCompatValue(key, context);
13488
- return mode === 3 ? value === true : value !== false;
13489
- }
13490
- function checkCompatEnabled(key, context, loc, ...args) {
13491
- const enabled = isCompatEnabled(key, context);
13492
- if (!!(process.env.NODE_ENV !== "production") && enabled) {
13493
- warnDeprecation(key, context, loc, ...args);
14286
+ function hasProp(prop, props) {
14287
+ let result = false;
14288
+ if (prop.key.type === 4) {
14289
+ const propKeyName = prop.key.content;
14290
+ result = props.properties.some(
14291
+ (p) => p.key.type === 4 && p.key.content === propKeyName
14292
+ );
13494
14293
  }
13495
- return enabled;
14294
+ return result;
13496
14295
  }
13497
- function warnDeprecation(key, context, loc, ...args) {
13498
- const val = getCompatValue(key, context);
13499
- if (val === "suppress-warning") {
13500
- return;
14296
+ function toValidAssetId(name, type) {
14297
+ return `_${type}_${name.replace(/[^\w]/g, (searchValue, replaceValue) => {
14298
+ return searchValue === "-" ? "_" : name.charCodeAt(replaceValue).toString();
14299
+ })}`;
14300
+ }
14301
+ function getMemoedVNodeCall(node) {
14302
+ if (node.type === 14 && node.callee === WITH_MEMO) {
14303
+ return node.arguments[1].returns;
14304
+ } else {
14305
+ return node;
13501
14306
  }
13502
- const { message, link } = deprecationData[key];
13503
- const msg = `(deprecation ${key}) ${typeof message === "function" ? message(...args) : message}${link ? `
13504
- Details: ${link}` : ``}`;
13505
- const err = new SyntaxError(msg);
13506
- err.code = key;
13507
- if (loc)
13508
- err.loc = loc;
13509
- context.onWarn(err);
13510
14307
  }
14308
+ const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
13511
14309
 
13512
- const decodeRE = /&(gt|lt|amp|apos|quot);/g;
13513
- const decodeMap = {
13514
- gt: ">",
13515
- lt: "<",
13516
- amp: "&",
13517
- apos: "'",
13518
- quot: '"'
13519
- };
13520
14310
  const defaultParserOptions = {
14311
+ parseMode: "base",
14312
+ ns: 0,
13521
14313
  delimiters: [`{{`, `}}`],
13522
14314
  getNamespace: () => 0,
13523
- getTextMode: () => 0,
13524
14315
  isVoidTag: NO,
13525
14316
  isPreTag: NO,
13526
14317
  isCustomElement: NO,
13527
- decodeEntities: (rawText) => rawText.replace(decodeRE, (_, p1) => decodeMap[p1]),
13528
14318
  onError: defaultOnError,
13529
14319
  onWarn: defaultOnWarn,
13530
14320
  comments: !!(process.env.NODE_ENV !== "production")
13531
14321
  };
13532
- function baseParse(content, options = {}) {
13533
- const context = createParserContext(content, options);
13534
- const start = getCursor(context);
13535
- return createRoot(
13536
- parseChildren(context, 0, []),
13537
- getSelection(context, start)
13538
- );
13539
- }
13540
- function createParserContext(content, rawOptions) {
13541
- const options = extend({}, defaultParserOptions);
13542
- let key;
13543
- for (key in rawOptions) {
13544
- options[key] = rawOptions[key] === void 0 ? defaultParserOptions[key] : rawOptions[key];
13545
- }
13546
- return {
13547
- options,
13548
- column: 1,
13549
- line: 1,
13550
- offset: 0,
13551
- originalSource: content,
13552
- source: content,
13553
- inPre: false,
13554
- inVPre: false,
13555
- onWarn: options.onWarn
13556
- };
13557
- }
13558
- function parseChildren(context, mode, ancestors) {
13559
- const parent = last(ancestors);
13560
- const ns = parent ? parent.ns : 0;
13561
- const nodes = [];
13562
- while (!isEnd(context, mode, ancestors)) {
13563
- const s = context.source;
13564
- let node = void 0;
13565
- if (mode === 0 || mode === 1) {
13566
- if (!context.inVPre && startsWith(s, context.options.delimiters[0])) {
13567
- node = parseInterpolation(context, mode);
13568
- } else if (mode === 0 && s[0] === "<") {
13569
- if (s.length === 1) {
13570
- emitError(context, 5, 1);
13571
- } else if (s[1] === "!") {
13572
- if (startsWith(s, "<!--")) {
13573
- node = parseComment(context);
13574
- } else if (startsWith(s, "<!DOCTYPE")) {
13575
- node = parseBogusComment(context);
13576
- } else if (startsWith(s, "<![CDATA[")) {
13577
- if (ns !== 0) {
13578
- node = parseCDATA(context, ancestors);
13579
- } else {
13580
- emitError(context, 1);
13581
- node = parseBogusComment(context);
13582
- }
13583
- } else {
13584
- emitError(context, 11);
13585
- node = parseBogusComment(context);
14322
+ let currentOptions = defaultParserOptions;
14323
+ let currentRoot = null;
14324
+ let currentInput = "";
14325
+ let currentOpenTag = null;
14326
+ let currentProp = null;
14327
+ let currentAttrValue = "";
14328
+ let currentAttrStartIndex = -1;
14329
+ let currentAttrEndIndex = -1;
14330
+ let inPre = 0;
14331
+ let inVPre = false;
14332
+ let currentVPreBoundary = null;
14333
+ const stack = [];
14334
+ const tokenizer = new Tokenizer(stack, {
14335
+ onerr: emitError,
14336
+ ontext(start, end) {
14337
+ onText(getSlice(start, end), start, end);
14338
+ },
14339
+ ontextentity(char, start, end) {
14340
+ onText(char, start, end);
14341
+ },
14342
+ oninterpolation(start, end) {
14343
+ if (inVPre) {
14344
+ return onText(getSlice(start, end), start, end);
14345
+ }
14346
+ let innerStart = start + tokenizer.delimiterOpen.length;
14347
+ let innerEnd = end - tokenizer.delimiterClose.length;
14348
+ while (isWhitespace(currentInput.charCodeAt(innerStart))) {
14349
+ innerStart++;
14350
+ }
14351
+ while (isWhitespace(currentInput.charCodeAt(innerEnd - 1))) {
14352
+ innerEnd--;
14353
+ }
14354
+ let exp = getSlice(innerStart, innerEnd);
14355
+ if (exp.includes("&")) {
14356
+ {
14357
+ exp = currentOptions.decodeEntities(exp, false);
14358
+ }
14359
+ }
14360
+ addNode({
14361
+ type: 5,
14362
+ content: createSimpleExpression(exp, false, getLoc(innerStart, innerEnd)),
14363
+ loc: getLoc(start, end)
14364
+ });
14365
+ },
14366
+ onopentagname(start, end) {
14367
+ const name = getSlice(start, end);
14368
+ currentOpenTag = {
14369
+ type: 1,
14370
+ tag: name,
14371
+ ns: currentOptions.getNamespace(name, stack[0], currentOptions.ns),
14372
+ tagType: 0,
14373
+ // will be refined on tag close
14374
+ props: [],
14375
+ children: [],
14376
+ loc: getLoc(start - 1, end),
14377
+ codegenNode: void 0
14378
+ };
14379
+ if (tokenizer.inSFCRoot) {
14380
+ currentOpenTag.innerLoc = getLoc(
14381
+ end + fastForward(end) + 1,
14382
+ end
14383
+ );
14384
+ }
14385
+ },
14386
+ onopentagend(end) {
14387
+ endOpenTag(end);
14388
+ },
14389
+ onclosetag(start, end) {
14390
+ const name = getSlice(start, end);
14391
+ if (!currentOptions.isVoidTag(name)) {
14392
+ let found = false;
14393
+ for (let i = 0; i < stack.length; i++) {
14394
+ const e = stack[i];
14395
+ if (e.tag.toLowerCase() === name.toLowerCase()) {
14396
+ found = true;
14397
+ if (i > 0) {
14398
+ emitError(24, stack[0].loc.start.offset);
13586
14399
  }
13587
- } else if (s[1] === "/") {
13588
- if (s.length === 2) {
13589
- emitError(context, 5, 2);
13590
- } else if (s[2] === ">") {
13591
- emitError(context, 14, 2);
13592
- advanceBy(context, 3);
13593
- continue;
13594
- } else if (/[a-z]/i.test(s[2])) {
13595
- emitError(context, 23);
13596
- parseTag(context, 1 /* End */, parent);
13597
- continue;
13598
- } else {
13599
- emitError(
13600
- context,
13601
- 12,
13602
- 2
13603
- );
13604
- node = parseBogusComment(context);
14400
+ for (let j = 0; j <= i; j++) {
14401
+ const el = stack.shift();
14402
+ onCloseTag(el, end, j < i);
13605
14403
  }
13606
- } else if (/[a-z]/i.test(s[1])) {
13607
- node = parseElement(context, ancestors);
13608
- if (isCompatEnabled(
13609
- "COMPILER_NATIVE_TEMPLATE",
13610
- context
13611
- ) && node && node.tag === "template" && !node.props.some(
13612
- (p) => p.type === 7 && isSpecialTemplateDirective(p.name)
13613
- )) {
13614
- !!(process.env.NODE_ENV !== "production") && warnDeprecation(
13615
- "COMPILER_NATIVE_TEMPLATE",
13616
- context,
13617
- node.loc
13618
- );
13619
- node = node.children;
14404
+ break;
14405
+ }
14406
+ }
14407
+ if (!found) {
14408
+ emitError(23, backTrack(start, 60));
14409
+ }
14410
+ }
14411
+ },
14412
+ onselfclosingtag(end) {
14413
+ var _a;
14414
+ const name = currentOpenTag.tag;
14415
+ currentOpenTag.isSelfClosing = true;
14416
+ endOpenTag(end);
14417
+ if (((_a = stack[0]) == null ? void 0 : _a.tag) === name) {
14418
+ onCloseTag(stack.shift(), end);
14419
+ }
14420
+ },
14421
+ onattribname(start, end) {
14422
+ currentProp = {
14423
+ type: 6,
14424
+ name: getSlice(start, end),
14425
+ nameLoc: getLoc(start, end),
14426
+ value: void 0,
14427
+ loc: getLoc(start)
14428
+ };
14429
+ },
14430
+ ondirname(start, end) {
14431
+ const raw = getSlice(start, end);
14432
+ const name = raw === "." || raw === ":" ? "bind" : raw === "@" ? "on" : raw === "#" ? "slot" : raw.slice(2);
14433
+ if (!inVPre && name === "") {
14434
+ emitError(26, start);
14435
+ }
14436
+ if (inVPre || name === "") {
14437
+ currentProp = {
14438
+ type: 6,
14439
+ name: raw,
14440
+ nameLoc: getLoc(start, end),
14441
+ value: void 0,
14442
+ loc: getLoc(start)
14443
+ };
14444
+ } else {
14445
+ currentProp = {
14446
+ type: 7,
14447
+ name,
14448
+ rawName: raw,
14449
+ exp: void 0,
14450
+ arg: void 0,
14451
+ modifiers: raw === "." ? ["prop"] : [],
14452
+ loc: getLoc(start)
14453
+ };
14454
+ if (name === "pre") {
14455
+ inVPre = true;
14456
+ currentVPreBoundary = currentOpenTag;
14457
+ const props = currentOpenTag.props;
14458
+ for (let i = 0; i < props.length; i++) {
14459
+ if (props[i].type === 7) {
14460
+ props[i] = dirToAttr(props[i]);
13620
14461
  }
13621
- } else if (s[1] === "?") {
13622
- emitError(
13623
- context,
13624
- 21,
13625
- 1
13626
- );
13627
- node = parseBogusComment(context);
13628
- } else {
13629
- emitError(context, 12, 1);
13630
14462
  }
13631
14463
  }
13632
14464
  }
13633
- if (!node) {
13634
- node = parseText(context, mode);
14465
+ },
14466
+ ondirarg(start, end) {
14467
+ if (start === end)
14468
+ return;
14469
+ const arg = getSlice(start, end);
14470
+ if (inVPre) {
14471
+ currentProp.name += arg;
14472
+ setLocEnd(currentProp.nameLoc, end);
14473
+ } else {
14474
+ const isStatic = arg[0] !== `[`;
14475
+ currentProp.arg = createSimpleExpression(
14476
+ isStatic ? arg : arg.slice(1, -1),
14477
+ isStatic,
14478
+ getLoc(start, end),
14479
+ isStatic ? 3 : 0
14480
+ );
13635
14481
  }
13636
- if (isArray(node)) {
13637
- for (let i = 0; i < node.length; i++) {
13638
- pushNode(nodes, node[i]);
14482
+ },
14483
+ ondirmodifier(start, end) {
14484
+ const mod = getSlice(start, end);
14485
+ if (inVPre) {
14486
+ currentProp.name += "." + mod;
14487
+ setLocEnd(currentProp.nameLoc, end);
14488
+ } else if (currentProp.name === "slot") {
14489
+ const arg = currentProp.arg;
14490
+ if (arg) {
14491
+ arg.content += "." + mod;
14492
+ setLocEnd(arg.loc, end);
13639
14493
  }
13640
14494
  } else {
13641
- pushNode(nodes, node);
14495
+ currentProp.modifiers.push(mod);
13642
14496
  }
13643
- }
13644
- let removedWhitespace = false;
13645
- if (mode !== 2 && mode !== 1) {
13646
- const shouldCondense = context.options.whitespace !== "preserve";
13647
- for (let i = 0; i < nodes.length; i++) {
13648
- const node = nodes[i];
13649
- if (node.type === 2) {
13650
- if (!context.inPre) {
13651
- if (!/[^\t\r\n\f ]/.test(node.content)) {
13652
- const prev = nodes[i - 1];
13653
- const next = nodes[i + 1];
13654
- 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))) {
13655
- removedWhitespace = true;
13656
- nodes[i] = null;
13657
- } else {
13658
- node.content = " ";
13659
- }
13660
- } else if (shouldCondense) {
13661
- node.content = node.content.replace(/[\t\r\n\f ]+/g, " ");
14497
+ },
14498
+ onattribdata(start, end) {
14499
+ currentAttrValue += getSlice(start, end);
14500
+ if (currentAttrStartIndex < 0)
14501
+ currentAttrStartIndex = start;
14502
+ currentAttrEndIndex = end;
14503
+ },
14504
+ onattribentity(char, start, end) {
14505
+ currentAttrValue += char;
14506
+ if (currentAttrStartIndex < 0)
14507
+ currentAttrStartIndex = start;
14508
+ currentAttrEndIndex = end;
14509
+ },
14510
+ onattribnameend(end) {
14511
+ const start = currentProp.loc.start.offset;
14512
+ const name = getSlice(start, end);
14513
+ if (currentProp.type === 7) {
14514
+ currentProp.rawName = name;
14515
+ }
14516
+ if (currentOpenTag.props.some(
14517
+ (p) => (p.type === 7 ? p.rawName : p.name) === name
14518
+ )) {
14519
+ emitError(2, start);
14520
+ }
14521
+ },
14522
+ onattribend(quote, end) {
14523
+ if (currentOpenTag && currentProp) {
14524
+ setLocEnd(currentProp.loc, end);
14525
+ if (quote !== 0) {
14526
+ if (currentAttrValue.includes("&")) {
14527
+ currentAttrValue = currentOptions.decodeEntities(
14528
+ currentAttrValue,
14529
+ true
14530
+ );
14531
+ }
14532
+ if (currentProp.type === 6) {
14533
+ if (currentProp.name === "class") {
14534
+ currentAttrValue = condense(currentAttrValue).trim();
14535
+ }
14536
+ if (quote === 1 && !currentAttrValue) {
14537
+ emitError(13, end);
14538
+ }
14539
+ currentProp.value = {
14540
+ type: 2,
14541
+ content: currentAttrValue,
14542
+ loc: quote === 1 ? getLoc(currentAttrStartIndex, currentAttrEndIndex) : getLoc(currentAttrStartIndex - 1, currentAttrEndIndex + 1)
14543
+ };
14544
+ if (tokenizer.inSFCRoot && currentOpenTag.tag === "template" && currentProp.name === "lang" && currentAttrValue && currentAttrValue !== "html") {
14545
+ tokenizer.enterRCDATA(toCharCodes(`</template`), 0);
13662
14546
  }
13663
14547
  } else {
13664
- node.content = node.content.replace(/\r\n/g, "\n");
14548
+ currentProp.exp = createSimpleExpression(
14549
+ currentAttrValue,
14550
+ false,
14551
+ getLoc(currentAttrStartIndex, currentAttrEndIndex)
14552
+ );
14553
+ if (currentProp.name === "for") {
14554
+ currentProp.forParseResult = parseForExpression(currentProp.exp);
14555
+ }
14556
+ let syncIndex = -1;
14557
+ if (currentProp.name === "bind" && (syncIndex = currentProp.modifiers.indexOf("sync")) > -1 && checkCompatEnabled(
14558
+ "COMPILER_V_BIND_SYNC",
14559
+ currentOptions,
14560
+ currentProp.loc,
14561
+ currentProp.rawName
14562
+ )) {
14563
+ currentProp.name = "model";
14564
+ currentProp.modifiers.splice(syncIndex, 1);
14565
+ }
13665
14566
  }
13666
- } else if (node.type === 3 && !context.options.comments) {
13667
- removedWhitespace = true;
13668
- nodes[i] = null;
13669
14567
  }
14568
+ if (currentProp.type !== 7 || currentProp.name !== "pre") {
14569
+ currentOpenTag.props.push(currentProp);
14570
+ }
14571
+ }
14572
+ currentAttrValue = "";
14573
+ currentAttrStartIndex = currentAttrEndIndex = -1;
14574
+ },
14575
+ oncomment(start, end) {
14576
+ if (currentOptions.comments) {
14577
+ addNode({
14578
+ type: 3,
14579
+ content: getSlice(start, end),
14580
+ loc: getLoc(start - 4, end + 3)
14581
+ });
13670
14582
  }
13671
- if (context.inPre && parent && context.options.isPreTag(parent.tag)) {
13672
- const first = nodes[0];
13673
- if (first && first.type === 2) {
13674
- first.content = first.content.replace(/^\r?\n/, "");
14583
+ },
14584
+ onend() {
14585
+ const end = currentInput.length;
14586
+ if ((!!(process.env.NODE_ENV !== "production") || false) && tokenizer.state !== 1) {
14587
+ switch (tokenizer.state) {
14588
+ case 5:
14589
+ case 8:
14590
+ emitError(5, end);
14591
+ break;
14592
+ case 3:
14593
+ case 4:
14594
+ emitError(
14595
+ 25,
14596
+ tokenizer.sectionStart
14597
+ );
14598
+ break;
14599
+ case 28:
14600
+ if (tokenizer.currentSequence === Sequences.CdataEnd) {
14601
+ emitError(6, end);
14602
+ } else {
14603
+ emitError(7, end);
14604
+ }
14605
+ break;
14606
+ case 6:
14607
+ case 7:
14608
+ case 9:
14609
+ case 11:
14610
+ case 12:
14611
+ case 13:
14612
+ case 14:
14613
+ case 15:
14614
+ case 16:
14615
+ case 17:
14616
+ case 18:
14617
+ case 19:
14618
+ case 20:
14619
+ case 21:
14620
+ emitError(9, end);
14621
+ break;
13675
14622
  }
13676
14623
  }
14624
+ for (let index = 0; index < stack.length; index++) {
14625
+ onCloseTag(stack[index], end - 1);
14626
+ emitError(24, stack[index].loc.start.offset);
14627
+ }
14628
+ },
14629
+ oncdata(start, end) {
14630
+ if (stack[0].ns !== 0) {
14631
+ onText(getSlice(start, end), start, end);
14632
+ } else {
14633
+ emitError(1, start - 9);
14634
+ }
14635
+ },
14636
+ onprocessinginstruction(start) {
14637
+ if ((stack[0] ? stack[0].ns : currentOptions.ns) === 0) {
14638
+ emitError(
14639
+ 21,
14640
+ start - 1
14641
+ );
14642
+ }
13677
14643
  }
13678
- return removedWhitespace ? nodes.filter(Boolean) : nodes;
13679
- }
13680
- function pushNode(nodes, node) {
13681
- if (node.type === 2) {
13682
- const prev = last(nodes);
13683
- if (prev && prev.type === 2 && prev.loc.end.offset === node.loc.start.offset) {
13684
- prev.content += node.content;
13685
- prev.loc.end = node.loc.end;
13686
- prev.loc.source += node.loc.source;
13687
- return;
14644
+ });
14645
+ const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
14646
+ const stripParensRE = /^\(|\)$/g;
14647
+ function parseForExpression(input) {
14648
+ const loc = input.loc;
14649
+ const exp = input.content;
14650
+ const inMatch = exp.match(forAliasRE);
14651
+ if (!inMatch)
14652
+ return;
14653
+ const [, LHS, RHS] = inMatch;
14654
+ const createAliasExpression = (content, offset) => {
14655
+ const start = loc.start.offset + offset;
14656
+ const end = start + content.length;
14657
+ return createSimpleExpression(content, false, getLoc(start, end));
14658
+ };
14659
+ const result = {
14660
+ source: createAliasExpression(RHS.trim(), exp.indexOf(RHS, LHS.length)),
14661
+ value: void 0,
14662
+ key: void 0,
14663
+ index: void 0,
14664
+ finalized: false
14665
+ };
14666
+ let valueContent = LHS.trim().replace(stripParensRE, "").trim();
14667
+ const trimmedOffset = LHS.indexOf(valueContent);
14668
+ const iteratorMatch = valueContent.match(forIteratorRE);
14669
+ if (iteratorMatch) {
14670
+ valueContent = valueContent.replace(forIteratorRE, "").trim();
14671
+ const keyContent = iteratorMatch[1].trim();
14672
+ let keyOffset;
14673
+ if (keyContent) {
14674
+ keyOffset = exp.indexOf(keyContent, trimmedOffset + valueContent.length);
14675
+ result.key = createAliasExpression(keyContent, keyOffset);
14676
+ }
14677
+ if (iteratorMatch[2]) {
14678
+ const indexContent = iteratorMatch[2].trim();
14679
+ if (indexContent) {
14680
+ result.index = createAliasExpression(
14681
+ indexContent,
14682
+ exp.indexOf(
14683
+ indexContent,
14684
+ result.key ? keyOffset + keyContent.length : trimmedOffset + valueContent.length
14685
+ )
14686
+ );
14687
+ }
13688
14688
  }
13689
14689
  }
13690
- nodes.push(node);
14690
+ if (valueContent) {
14691
+ result.value = createAliasExpression(valueContent, trimmedOffset);
14692
+ }
14693
+ return result;
13691
14694
  }
13692
- function parseCDATA(context, ancestors) {
13693
- advanceBy(context, 9);
13694
- const nodes = parseChildren(context, 3, ancestors);
13695
- if (context.source.length === 0) {
13696
- emitError(context, 6);
13697
- } else {
13698
- advanceBy(context, 3);
13699
- }
13700
- return nodes;
13701
- }
13702
- function parseComment(context) {
13703
- const start = getCursor(context);
13704
- let content;
13705
- const match = /--(\!)?>/.exec(context.source);
13706
- if (!match) {
13707
- content = context.source.slice(4);
13708
- advanceBy(context, context.source.length);
13709
- emitError(context, 7);
14695
+ function getSlice(start, end) {
14696
+ return currentInput.slice(start, end);
14697
+ }
14698
+ function endOpenTag(end) {
14699
+ addNode(currentOpenTag);
14700
+ const { tag, ns } = currentOpenTag;
14701
+ if (ns === 0 && currentOptions.isPreTag(tag)) {
14702
+ inPre++;
14703
+ }
14704
+ if (currentOptions.isVoidTag(tag)) {
14705
+ onCloseTag(currentOpenTag, end);
13710
14706
  } else {
13711
- if (match.index <= 3) {
13712
- emitError(context, 0);
13713
- }
13714
- if (match[1]) {
13715
- emitError(context, 10);
14707
+ stack.unshift(currentOpenTag);
14708
+ if (ns === 1 || ns === 2) {
14709
+ tokenizer.inXML = true;
13716
14710
  }
13717
- content = context.source.slice(4, match.index);
13718
- const s = context.source.slice(0, match.index);
13719
- let prevIndex = 1, nestedIndex = 0;
13720
- while ((nestedIndex = s.indexOf("<!--", prevIndex)) !== -1) {
13721
- advanceBy(context, nestedIndex - prevIndex + 1);
13722
- if (nestedIndex + 4 < s.length) {
13723
- emitError(context, 16);
13724
- }
13725
- prevIndex = nestedIndex + 1;
13726
- }
13727
- advanceBy(context, match.index + match[0].length - prevIndex + 1);
13728
14711
  }
13729
- return {
13730
- type: 3,
13731
- content,
13732
- loc: getSelection(context, start)
13733
- };
14712
+ currentOpenTag = null;
13734
14713
  }
13735
- function parseBogusComment(context) {
13736
- const start = getCursor(context);
13737
- const contentStart = context.source[1] === "?" ? 1 : 2;
13738
- let content;
13739
- const closeIndex = context.source.indexOf(">");
13740
- if (closeIndex === -1) {
13741
- content = context.source.slice(contentStart);
13742
- advanceBy(context, context.source.length);
14714
+ function onText(content, start, end) {
14715
+ var _a;
14716
+ {
14717
+ const tag = (_a = stack[0]) == null ? void 0 : _a.tag;
14718
+ if (tag !== "script" && tag !== "style" && content.includes("&")) {
14719
+ content = currentOptions.decodeEntities(content, false);
14720
+ }
14721
+ }
14722
+ const parent = stack[0] || currentRoot;
14723
+ const lastNode = parent.children[parent.children.length - 1];
14724
+ if ((lastNode == null ? void 0 : lastNode.type) === 2) {
14725
+ lastNode.content += content;
14726
+ setLocEnd(lastNode.loc, end);
13743
14727
  } else {
13744
- content = context.source.slice(contentStart, closeIndex);
13745
- advanceBy(context, closeIndex + 1);
14728
+ parent.children.push({
14729
+ type: 2,
14730
+ content,
14731
+ loc: getLoc(start, end)
14732
+ });
13746
14733
  }
13747
- return {
13748
- type: 3,
13749
- content,
13750
- loc: getSelection(context, start)
13751
- };
13752
14734
  }
13753
- function parseElement(context, ancestors) {
13754
- const wasInPre = context.inPre;
13755
- const wasInVPre = context.inVPre;
13756
- const parent = last(ancestors);
13757
- const element = parseTag(context, 0 /* Start */, parent);
13758
- const isPreBoundary = context.inPre && !wasInPre;
13759
- const isVPreBoundary = context.inVPre && !wasInVPre;
13760
- if (element.isSelfClosing || context.options.isVoidTag(element.tag)) {
13761
- if (isPreBoundary) {
13762
- context.inPre = false;
13763
- }
13764
- if (isVPreBoundary) {
13765
- context.inVPre = false;
13766
- }
13767
- return element;
13768
- }
13769
- ancestors.push(element);
13770
- const mode = context.options.getTextMode(element, parent);
13771
- const children = parseChildren(context, mode, ancestors);
13772
- ancestors.pop();
14735
+ function onCloseTag(el, end, isImplied = false) {
14736
+ if (isImplied) {
14737
+ setLocEnd(el.loc, backTrack(end, 60));
14738
+ } else {
14739
+ setLocEnd(el.loc, end + fastForward(end) + 1);
14740
+ }
14741
+ if (tokenizer.inSFCRoot) {
14742
+ if (el.children.length) {
14743
+ el.innerLoc.end = extend({}, el.children[el.children.length - 1].loc.end);
14744
+ } else {
14745
+ el.innerLoc.end = extend({}, el.innerLoc.start);
14746
+ }
14747
+ el.innerLoc.source = getSlice(
14748
+ el.innerLoc.start.offset,
14749
+ el.innerLoc.end.offset
14750
+ );
14751
+ }
14752
+ const { tag, ns } = el;
14753
+ if (!inVPre) {
14754
+ if (tag === "slot") {
14755
+ el.tagType = 2;
14756
+ } else if (isFragmentTemplate(el)) {
14757
+ el.tagType = 3;
14758
+ } else if (isComponent(el)) {
14759
+ el.tagType = 1;
14760
+ }
14761
+ }
14762
+ if (!tokenizer.inRCDATA) {
14763
+ el.children = condenseWhitespace(el.children, el.tag);
14764
+ }
14765
+ if (ns === 0 && currentOptions.isPreTag(tag)) {
14766
+ inPre--;
14767
+ }
14768
+ if (currentVPreBoundary === el) {
14769
+ inVPre = false;
14770
+ currentVPreBoundary = null;
14771
+ }
14772
+ if (tokenizer.inXML && (stack[0] ? stack[0].ns : currentOptions.ns) === 0) {
14773
+ tokenizer.inXML = false;
14774
+ }
13773
14775
  {
13774
- const inlineTemplateProp = element.props.find(
14776
+ const props = el.props;
14777
+ if (!!(process.env.NODE_ENV !== "production") && isCompatEnabled(
14778
+ "COMPILER_V_IF_V_FOR_PRECEDENCE",
14779
+ currentOptions
14780
+ )) {
14781
+ let hasIf = false;
14782
+ let hasFor = false;
14783
+ for (let i = 0; i < props.length; i++) {
14784
+ const p = props[i];
14785
+ if (p.type === 7) {
14786
+ if (p.name === "if") {
14787
+ hasIf = true;
14788
+ } else if (p.name === "for") {
14789
+ hasFor = true;
14790
+ }
14791
+ }
14792
+ if (hasIf && hasFor) {
14793
+ warnDeprecation(
14794
+ "COMPILER_V_IF_V_FOR_PRECEDENCE",
14795
+ currentOptions,
14796
+ el.loc
14797
+ );
14798
+ break;
14799
+ }
14800
+ }
14801
+ }
14802
+ if (isCompatEnabled(
14803
+ "COMPILER_NATIVE_TEMPLATE",
14804
+ currentOptions
14805
+ ) && el.tag === "template" && !isFragmentTemplate(el)) {
14806
+ !!(process.env.NODE_ENV !== "production") && warnDeprecation(
14807
+ "COMPILER_NATIVE_TEMPLATE",
14808
+ currentOptions,
14809
+ el.loc
14810
+ );
14811
+ const parent = stack[0] || currentRoot;
14812
+ const index = parent.children.indexOf(el);
14813
+ parent.children.splice(index, 1, ...el.children);
14814
+ }
14815
+ const inlineTemplateProp = props.find(
13775
14816
  (p) => p.type === 6 && p.name === "inline-template"
13776
14817
  );
13777
14818
  if (inlineTemplateProp && checkCompatEnabled(
13778
14819
  "COMPILER_INLINE_TEMPLATE",
13779
- context,
14820
+ currentOptions,
13780
14821
  inlineTemplateProp.loc
13781
- )) {
13782
- const loc = getSelection(context, element.loc.end);
14822
+ ) && el.children.length) {
13783
14823
  inlineTemplateProp.value = {
13784
14824
  type: 2,
13785
- content: loc.source,
13786
- loc
13787
- };
13788
- }
13789
- }
13790
- element.children = children;
13791
- if (startsWithEndTagOpen(context.source, element.tag)) {
13792
- parseTag(context, 1 /* End */, parent);
13793
- } else {
13794
- emitError(context, 24, 0, element.loc.start);
13795
- if (context.source.length === 0 && element.tag.toLowerCase() === "script") {
13796
- const first = children[0];
13797
- if (first && startsWith(first.loc.source, "<!--")) {
13798
- emitError(context, 8);
13799
- }
14825
+ content: getSlice(
14826
+ el.children[0].loc.start.offset,
14827
+ el.children[el.children.length - 1].loc.end.offset
14828
+ ),
14829
+ loc: inlineTemplateProp.loc
14830
+ };
13800
14831
  }
13801
14832
  }
13802
- element.loc = getSelection(context, element.loc.start);
13803
- if (isPreBoundary) {
13804
- context.inPre = false;
13805
- }
13806
- if (isVPreBoundary) {
13807
- context.inVPre = false;
13808
- }
13809
- return element;
13810
14833
  }
13811
- const isSpecialTemplateDirective = /* @__PURE__ */ makeMap(
13812
- `if,else,else-if,for,slot`
13813
- );
13814
- function parseTag(context, type, parent) {
13815
- const start = getCursor(context);
13816
- const match = /^<\/?([a-z][^\t\r\n\f />]*)/i.exec(context.source);
13817
- const tag = match[1];
13818
- const ns = context.options.getNamespace(tag, parent);
13819
- advanceBy(context, match[0].length);
13820
- advanceSpaces(context);
13821
- const cursor = getCursor(context);
13822
- const currentSource = context.source;
13823
- if (context.options.isPreTag(tag)) {
13824
- context.inPre = true;
13825
- }
13826
- let props = parseAttributes(context, type);
13827
- if (type === 0 /* Start */ && !context.inVPre && props.some((p) => p.type === 7 && p.name === "pre")) {
13828
- context.inVPre = true;
13829
- extend(context, cursor);
13830
- context.source = currentSource;
13831
- props = parseAttributes(context, type).filter((p) => p.name !== "v-pre");
13832
- }
13833
- let isSelfClosing = false;
13834
- if (context.source.length === 0) {
13835
- emitError(context, 9);
13836
- } else {
13837
- isSelfClosing = startsWith(context.source, "/>");
13838
- if (type === 1 /* End */ && isSelfClosing) {
13839
- emitError(context, 4);
13840
- }
13841
- advanceBy(context, isSelfClosing ? 2 : 1);
13842
- }
13843
- if (type === 1 /* End */) {
13844
- return;
14834
+ function fastForward(start, c) {
14835
+ let offset = 0;
14836
+ while (currentInput.charCodeAt(start + offset) !== 62 && start + offset < currentInput.length) {
14837
+ offset++;
13845
14838
  }
13846
- if (!!(process.env.NODE_ENV !== "production") && isCompatEnabled(
13847
- "COMPILER_V_IF_V_FOR_PRECEDENCE",
13848
- context
13849
- )) {
13850
- let hasIf = false;
13851
- let hasFor = false;
14839
+ return offset;
14840
+ }
14841
+ function backTrack(index, c) {
14842
+ let i = index;
14843
+ while (currentInput.charCodeAt(i) !== c && i >= 0)
14844
+ i--;
14845
+ return i;
14846
+ }
14847
+ const specialTemplateDir = /* @__PURE__ */ new Set(["if", "else", "else-if", "for", "slot"]);
14848
+ function isFragmentTemplate({ tag, props }) {
14849
+ if (tag === "template") {
13852
14850
  for (let i = 0; i < props.length; i++) {
13853
- const p = props[i];
13854
- if (p.type === 7) {
13855
- if (p.name === "if") {
13856
- hasIf = true;
13857
- } else if (p.name === "for") {
13858
- hasFor = true;
13859
- }
13860
- }
13861
- if (hasIf && hasFor) {
13862
- warnDeprecation(
13863
- "COMPILER_V_IF_V_FOR_PRECEDENCE",
13864
- context,
13865
- getSelection(context, start)
13866
- );
13867
- break;
13868
- }
13869
- }
13870
- }
13871
- let tagType = 0;
13872
- if (!context.inVPre) {
13873
- if (tag === "slot") {
13874
- tagType = 2;
13875
- } else if (tag === "template") {
13876
- if (props.some(
13877
- (p) => p.type === 7 && isSpecialTemplateDirective(p.name)
13878
- )) {
13879
- tagType = 3;
14851
+ if (props[i].type === 7 && specialTemplateDir.has(props[i].name)) {
14852
+ return true;
13880
14853
  }
13881
- } else if (isComponent(tag, props, context)) {
13882
- tagType = 1;
13883
14854
  }
13884
14855
  }
13885
- return {
13886
- type: 1,
13887
- ns,
13888
- tag,
13889
- tagType,
13890
- props,
13891
- isSelfClosing,
13892
- children: [],
13893
- loc: getSelection(context, start),
13894
- codegenNode: void 0
13895
- // to be created during transform phase
13896
- };
14856
+ return false;
13897
14857
  }
13898
- function isComponent(tag, props, context) {
13899
- const options = context.options;
13900
- if (options.isCustomElement(tag)) {
14858
+ function isComponent({ tag, props }) {
14859
+ var _a;
14860
+ if (currentOptions.isCustomElement(tag)) {
13901
14861
  return false;
13902
14862
  }
13903
- if (tag === "component" || /^[A-Z]/.test(tag) || isCoreComponent(tag) || options.isBuiltInComponent && options.isBuiltInComponent(tag) || options.isNativeTag && !options.isNativeTag(tag)) {
14863
+ if (tag === "component" || isUpperCase(tag.charCodeAt(0)) || isCoreComponent(tag) || ((_a = currentOptions.isBuiltInComponent) == null ? void 0 : _a.call(currentOptions, tag)) || currentOptions.isNativeTag && !currentOptions.isNativeTag(tag)) {
13904
14864
  return true;
13905
14865
  }
13906
14866
  for (let i = 0; i < props.length; i++) {
@@ -13911,374 +14871,179 @@ function isComponent(tag, props, context) {
13911
14871
  return true;
13912
14872
  } else if (checkCompatEnabled(
13913
14873
  "COMPILER_IS_ON_ELEMENT",
13914
- context,
14874
+ currentOptions,
13915
14875
  p.loc
13916
14876
  )) {
13917
14877
  return true;
13918
14878
  }
13919
14879
  }
13920
- } else {
13921
- if (p.name === "is") {
13922
- return true;
13923
- } else if (
13924
- // :is on plain element - only treat as component in compat mode
13925
- p.name === "bind" && isStaticArgOf(p.arg, "is") && true && checkCompatEnabled(
13926
- "COMPILER_IS_ON_ELEMENT",
13927
- context,
13928
- p.loc
13929
- )
13930
- ) {
13931
- return true;
13932
- }
14880
+ } else if (// :is on plain element - only treat as component in compat mode
14881
+ p.name === "bind" && isStaticArgOf(p.arg, "is") && checkCompatEnabled(
14882
+ "COMPILER_IS_ON_ELEMENT",
14883
+ currentOptions,
14884
+ p.loc
14885
+ )) {
14886
+ return true;
13933
14887
  }
13934
14888
  }
14889
+ return false;
13935
14890
  }
13936
- function parseAttributes(context, type) {
13937
- const props = [];
13938
- const attributeNames = /* @__PURE__ */ new Set();
13939
- while (context.source.length > 0 && !startsWith(context.source, ">") && !startsWith(context.source, "/>")) {
13940
- if (startsWith(context.source, "/")) {
13941
- emitError(context, 22);
13942
- advanceBy(context, 1);
13943
- advanceSpaces(context);
13944
- continue;
13945
- }
13946
- if (type === 1 /* End */) {
13947
- emitError(context, 3);
13948
- }
13949
- const attr = parseAttribute(context, attributeNames);
13950
- if (attr.type === 6 && attr.value && attr.name === "class") {
13951
- attr.value.content = attr.value.content.replace(/\s+/g, " ").trim();
13952
- }
13953
- if (type === 0 /* Start */) {
13954
- props.push(attr);
13955
- }
13956
- if (/^[^\t\r\n\f />]/.test(context.source)) {
13957
- emitError(context, 15);
13958
- }
13959
- advanceSpaces(context);
13960
- }
13961
- return props;
14891
+ function isUpperCase(c) {
14892
+ return c > 64 && c < 91;
13962
14893
  }
13963
- function parseAttribute(context, nameSet) {
13964
- var _a;
13965
- const start = getCursor(context);
13966
- const match = /^[^\t\r\n\f />][^\t\r\n\f />=]*/.exec(context.source);
13967
- const name = match[0];
13968
- if (nameSet.has(name)) {
13969
- emitError(context, 2);
13970
- }
13971
- nameSet.add(name);
13972
- if (name[0] === "=") {
13973
- emitError(context, 19);
13974
- }
13975
- {
13976
- const pattern = /["'<]/g;
13977
- let m;
13978
- while (m = pattern.exec(name)) {
13979
- emitError(
13980
- context,
13981
- 17,
13982
- m.index
13983
- );
13984
- }
13985
- }
13986
- advanceBy(context, name.length);
13987
- let value = void 0;
13988
- if (/^[\t\r\n\f ]*=/.test(context.source)) {
13989
- advanceSpaces(context);
13990
- advanceBy(context, 1);
13991
- advanceSpaces(context);
13992
- value = parseAttributeValue(context);
13993
- if (!value) {
13994
- emitError(context, 13);
13995
- }
13996
- }
13997
- const loc = getSelection(context, start);
13998
- if (!context.inVPre && /^(v-[A-Za-z0-9-]|:|\.|@|#)/.test(name)) {
13999
- const match2 = /(?:^v-([a-z0-9-]+))?(?:(?::|^\.|^@|^#)(\[[^\]]+\]|[^\.]+))?(.+)?$/i.exec(
14000
- name
14001
- );
14002
- let isPropShorthand = startsWith(name, ".");
14003
- let dirName = match2[1] || (isPropShorthand || startsWith(name, ":") ? "bind" : startsWith(name, "@") ? "on" : "slot");
14004
- let arg;
14005
- if (match2[2]) {
14006
- const isSlot = dirName === "slot";
14007
- const startOffset = name.lastIndexOf(
14008
- match2[2],
14009
- name.length - (((_a = match2[3]) == null ? void 0 : _a.length) || 0)
14010
- );
14011
- const loc2 = getSelection(
14012
- context,
14013
- getNewPosition(context, start, startOffset),
14014
- getNewPosition(
14015
- context,
14016
- start,
14017
- startOffset + match2[2].length + (isSlot && match2[3] || "").length
14018
- )
14019
- );
14020
- let content = match2[2];
14021
- let isStatic = true;
14022
- if (content.startsWith("[")) {
14023
- isStatic = false;
14024
- if (!content.endsWith("]")) {
14025
- emitError(
14026
- context,
14027
- 27
14028
- );
14029
- content = content.slice(1);
14030
- } else {
14031
- content = content.slice(1, content.length - 1);
14894
+ const windowsNewlineRE = /\r\n/g;
14895
+ function condenseWhitespace(nodes, tag) {
14896
+ var _a, _b;
14897
+ const shouldCondense = currentOptions.whitespace !== "preserve";
14898
+ let removedWhitespace = false;
14899
+ for (let i = 0; i < nodes.length; i++) {
14900
+ const node = nodes[i];
14901
+ if (node.type === 2) {
14902
+ if (!inPre) {
14903
+ if (isAllWhitespace(node.content)) {
14904
+ const prev = (_a = nodes[i - 1]) == null ? void 0 : _a.type;
14905
+ const next = (_b = nodes[i + 1]) == null ? void 0 : _b.type;
14906
+ if (!prev || !next || shouldCondense && (prev === 3 && (next === 3 || next === 1) || prev === 1 && (next === 3 || next === 1 && hasNewlineChar(node.content)))) {
14907
+ removedWhitespace = true;
14908
+ nodes[i] = null;
14909
+ } else {
14910
+ node.content = " ";
14911
+ }
14912
+ } else if (shouldCondense) {
14913
+ node.content = condense(node.content);
14032
14914
  }
14033
- } else if (isSlot) {
14034
- content += match2[3] || "";
14035
- }
14036
- arg = {
14037
- type: 4,
14038
- content,
14039
- isStatic,
14040
- constType: isStatic ? 3 : 0,
14041
- loc: loc2
14042
- };
14043
- }
14044
- if (value && value.isQuoted) {
14045
- const valueLoc = value.loc;
14046
- valueLoc.start.offset++;
14047
- valueLoc.start.column++;
14048
- valueLoc.end = advancePositionWithClone(valueLoc.start, value.content);
14049
- valueLoc.source = valueLoc.source.slice(1, -1);
14050
- }
14051
- const modifiers = match2[3] ? match2[3].slice(1).split(".") : [];
14052
- if (isPropShorthand)
14053
- modifiers.push("prop");
14054
- if (dirName === "bind" && arg) {
14055
- if (modifiers.includes("sync") && checkCompatEnabled(
14056
- "COMPILER_V_BIND_SYNC",
14057
- context,
14058
- loc,
14059
- arg.loc.source
14060
- )) {
14061
- dirName = "model";
14062
- modifiers.splice(modifiers.indexOf("sync"), 1);
14063
- }
14064
- if (!!(process.env.NODE_ENV !== "production") && modifiers.includes("prop")) {
14065
- checkCompatEnabled(
14066
- "COMPILER_V_BIND_PROP",
14067
- context,
14068
- loc
14069
- );
14915
+ } else {
14916
+ node.content = node.content.replace(windowsNewlineRE, "\n");
14070
14917
  }
14071
14918
  }
14072
- return {
14073
- type: 7,
14074
- name: dirName,
14075
- exp: value && {
14076
- type: 4,
14077
- content: value.content,
14078
- isStatic: false,
14079
- // Treat as non-constant by default. This can be potentially set to
14080
- // other values by `transformExpression` to make it eligible for hoisting.
14081
- constType: 0,
14082
- loc: value.loc
14083
- },
14084
- arg,
14085
- modifiers,
14086
- loc
14087
- };
14088
14919
  }
14089
- if (!context.inVPre && startsWith(name, "v-")) {
14090
- emitError(context, 26);
14920
+ if (inPre && tag && currentOptions.isPreTag(tag)) {
14921
+ const first = nodes[0];
14922
+ if (first && first.type === 2) {
14923
+ first.content = first.content.replace(/^\r?\n/, "");
14924
+ }
14091
14925
  }
14092
- return {
14093
- type: 6,
14094
- name,
14095
- value: value && {
14096
- type: 2,
14097
- content: value.content,
14098
- loc: value.loc
14099
- },
14100
- loc
14101
- };
14926
+ return removedWhitespace ? nodes.filter(Boolean) : nodes;
14102
14927
  }
14103
- function parseAttributeValue(context) {
14104
- const start = getCursor(context);
14105
- let content;
14106
- const quote = context.source[0];
14107
- const isQuoted = quote === `"` || quote === `'`;
14108
- if (isQuoted) {
14109
- advanceBy(context, 1);
14110
- const endIndex = context.source.indexOf(quote);
14111
- if (endIndex === -1) {
14112
- content = parseTextData(
14113
- context,
14114
- context.source.length,
14115
- 4
14116
- );
14117
- } else {
14118
- content = parseTextData(context, endIndex, 4);
14119
- advanceBy(context, 1);
14120
- }
14121
- } else {
14122
- const match = /^[^\t\r\n\f >]+/.exec(context.source);
14123
- if (!match) {
14124
- return void 0;
14125
- }
14126
- const unexpectedChars = /["'<=`]/g;
14127
- let m;
14128
- while (m = unexpectedChars.exec(match[0])) {
14129
- emitError(
14130
- context,
14131
- 18,
14132
- m.index
14133
- );
14928
+ function isAllWhitespace(str) {
14929
+ for (let i = 0; i < str.length; i++) {
14930
+ if (!isWhitespace(str.charCodeAt(i))) {
14931
+ return false;
14134
14932
  }
14135
- content = parseTextData(context, match[0].length, 4);
14136
- }
14137
- return { content, isQuoted, loc: getSelection(context, start) };
14138
- }
14139
- function parseInterpolation(context, mode) {
14140
- const [open, close] = context.options.delimiters;
14141
- const closeIndex = context.source.indexOf(close, open.length);
14142
- if (closeIndex === -1) {
14143
- emitError(context, 25);
14144
- return void 0;
14145
- }
14146
- const start = getCursor(context);
14147
- advanceBy(context, open.length);
14148
- const innerStart = getCursor(context);
14149
- const innerEnd = getCursor(context);
14150
- const rawContentLength = closeIndex - open.length;
14151
- const rawContent = context.source.slice(0, rawContentLength);
14152
- const preTrimContent = parseTextData(context, rawContentLength, mode);
14153
- const content = preTrimContent.trim();
14154
- const startOffset = preTrimContent.indexOf(content);
14155
- if (startOffset > 0) {
14156
- advancePositionWithMutation(innerStart, rawContent, startOffset);
14157
- }
14158
- const endOffset = rawContentLength - (preTrimContent.length - content.length - startOffset);
14159
- advancePositionWithMutation(innerEnd, rawContent, endOffset);
14160
- advanceBy(context, close.length);
14161
- return {
14162
- type: 5,
14163
- content: {
14164
- type: 4,
14165
- isStatic: false,
14166
- // Set `isConstant` to false by default and will decide in transformExpression
14167
- constType: 0,
14168
- content,
14169
- loc: getSelection(context, innerStart, innerEnd)
14170
- },
14171
- loc: getSelection(context, start)
14172
- };
14933
+ }
14934
+ return true;
14173
14935
  }
14174
- function parseText(context, mode) {
14175
- const endTokens = mode === 3 ? ["]]>"] : ["<", context.options.delimiters[0]];
14176
- let endIndex = context.source.length;
14177
- for (let i = 0; i < endTokens.length; i++) {
14178
- const index = context.source.indexOf(endTokens[i], 1);
14179
- if (index !== -1 && endIndex > index) {
14180
- endIndex = index;
14936
+ function hasNewlineChar(str) {
14937
+ for (let i = 0; i < str.length; i++) {
14938
+ const c = str.charCodeAt(i);
14939
+ if (c === 10 || c === 13) {
14940
+ return true;
14181
14941
  }
14182
14942
  }
14183
- const start = getCursor(context);
14184
- const content = parseTextData(context, endIndex, mode);
14185
- return {
14186
- type: 2,
14187
- content,
14188
- loc: getSelection(context, start)
14189
- };
14943
+ return false;
14190
14944
  }
14191
- function parseTextData(context, length, mode) {
14192
- const rawText = context.source.slice(0, length);
14193
- advanceBy(context, length);
14194
- if (mode === 2 || mode === 3 || !rawText.includes("&")) {
14195
- return rawText;
14196
- } else {
14197
- return context.options.decodeEntities(
14198
- rawText,
14199
- mode === 4
14200
- );
14945
+ function condense(str) {
14946
+ let ret = "";
14947
+ let prevCharIsWhitespace = false;
14948
+ for (let i = 0; i < str.length; i++) {
14949
+ if (isWhitespace(str.charCodeAt(i))) {
14950
+ if (!prevCharIsWhitespace) {
14951
+ ret += " ";
14952
+ prevCharIsWhitespace = true;
14953
+ }
14954
+ } else {
14955
+ ret += str[i];
14956
+ prevCharIsWhitespace = false;
14957
+ }
14201
14958
  }
14959
+ return ret;
14202
14960
  }
14203
- function getCursor(context) {
14204
- const { column, line, offset } = context;
14205
- return { column, line, offset };
14961
+ function addNode(node) {
14962
+ (stack[0] || currentRoot).children.push(node);
14206
14963
  }
14207
- function getSelection(context, start, end) {
14208
- end = end || getCursor(context);
14964
+ function getLoc(start, end) {
14209
14965
  return {
14210
- start,
14211
- end,
14212
- source: context.originalSource.slice(start.offset, end.offset)
14966
+ start: tokenizer.getPos(start),
14967
+ // @ts-expect-error allow late attachment
14968
+ end: end == null ? end : tokenizer.getPos(end),
14969
+ // @ts-expect-error allow late attachment
14970
+ source: end == null ? end : getSlice(start, end)
14213
14971
  };
14214
14972
  }
14215
- function last(xs) {
14216
- return xs[xs.length - 1];
14973
+ function setLocEnd(loc, end) {
14974
+ loc.end = tokenizer.getPos(end);
14975
+ loc.source = getSlice(loc.start.offset, end);
14217
14976
  }
14218
- function startsWith(source, searchString) {
14219
- return source.startsWith(searchString);
14220
- }
14221
- function advanceBy(context, numberOfCharacters) {
14222
- const { source } = context;
14223
- advancePositionWithMutation(context, source, numberOfCharacters);
14224
- context.source = source.slice(numberOfCharacters);
14225
- }
14226
- function advanceSpaces(context) {
14227
- const match = /^[\t\r\n\f ]+/.exec(context.source);
14228
- if (match) {
14229
- advanceBy(context, match[0].length);
14977
+ function dirToAttr(dir) {
14978
+ const attr = {
14979
+ type: 6,
14980
+ name: dir.rawName,
14981
+ nameLoc: getLoc(
14982
+ dir.loc.start.offset,
14983
+ dir.loc.start.offset + dir.rawName.length
14984
+ ),
14985
+ value: void 0,
14986
+ loc: dir.loc
14987
+ };
14988
+ if (dir.exp) {
14989
+ const loc = dir.exp.loc;
14990
+ if (loc.end.offset < dir.loc.end.offset) {
14991
+ loc.start.offset--;
14992
+ loc.start.column--;
14993
+ loc.end.offset++;
14994
+ loc.end.column++;
14995
+ }
14996
+ attr.value = {
14997
+ type: 2,
14998
+ content: dir.exp.content,
14999
+ loc
15000
+ };
14230
15001
  }
15002
+ return attr;
14231
15003
  }
14232
- function getNewPosition(context, start, numberOfCharacters) {
14233
- return advancePositionWithClone(
14234
- start,
14235
- context.originalSource.slice(start.offset, numberOfCharacters),
14236
- numberOfCharacters
14237
- );
15004
+ function emitError(code, index) {
15005
+ currentOptions.onError(createCompilerError(code, getLoc(index, index)));
14238
15006
  }
14239
- function emitError(context, code, offset, loc = getCursor(context)) {
14240
- if (offset) {
14241
- loc.offset += offset;
14242
- loc.column += offset;
14243
- }
14244
- context.options.onError(
14245
- createCompilerError(code, {
14246
- start: loc,
14247
- end: loc,
14248
- source: ""
14249
- })
14250
- );
15007
+ function reset() {
15008
+ tokenizer.reset();
15009
+ currentOpenTag = null;
15010
+ currentProp = null;
15011
+ currentAttrValue = "";
15012
+ currentAttrStartIndex = -1;
15013
+ currentAttrEndIndex = -1;
15014
+ stack.length = 0;
14251
15015
  }
14252
- function isEnd(context, mode, ancestors) {
14253
- const s = context.source;
14254
- switch (mode) {
14255
- case 0:
14256
- if (startsWith(s, "</")) {
14257
- for (let i = ancestors.length - 1; i >= 0; --i) {
14258
- if (startsWithEndTagOpen(s, ancestors[i].tag)) {
14259
- return true;
14260
- }
14261
- }
14262
- }
14263
- break;
14264
- case 1:
14265
- case 2: {
14266
- const parent = last(ancestors);
14267
- if (parent && startsWithEndTagOpen(s, parent.tag)) {
14268
- return true;
15016
+ function baseParse(input, options) {
15017
+ reset();
15018
+ currentInput = input;
15019
+ currentOptions = extend({}, defaultParserOptions);
15020
+ if (options) {
15021
+ let key;
15022
+ for (key in options) {
15023
+ if (options[key] != null) {
15024
+ currentOptions[key] = options[key];
14269
15025
  }
14270
- break;
14271
15026
  }
14272
- case 3:
14273
- if (startsWith(s, "]]>")) {
14274
- return true;
14275
- }
14276
- break;
14277
15027
  }
14278
- return !s;
14279
- }
14280
- function startsWithEndTagOpen(source, tag) {
14281
- return startsWith(source, "</") && source.slice(2, 2 + tag.length).toLowerCase() === tag.toLowerCase() && /[\t\r\n\f />]/.test(source[2 + tag.length] || ">");
15028
+ if (!!(process.env.NODE_ENV !== "production")) {
15029
+ if (!currentOptions.decodeEntities) {
15030
+ throw new Error(
15031
+ `[@vue/compiler-core] decodeEntities option is required in browser builds.`
15032
+ );
15033
+ }
15034
+ }
15035
+ tokenizer.mode = currentOptions.parseMode === "html" ? 1 : currentOptions.parseMode === "sfc" ? 2 : 0;
15036
+ const delimiters = options == null ? void 0 : options.delimiters;
15037
+ if (delimiters) {
15038
+ tokenizer.delimiterOpen = toCharCodes(delimiters[0]);
15039
+ tokenizer.delimiterClose = toCharCodes(delimiters[1]);
15040
+ }
15041
+ const root = currentRoot = createRoot([], input);
15042
+ tokenizer.parse(currentInput);
15043
+ root.loc = getLoc(0, input.length);
15044
+ root.children = condenseWhitespace(root.children);
15045
+ currentRoot = null;
15046
+ return root;
14282
15047
  }
14283
15048
 
14284
15049
  function hoistStatic(root, context) {
@@ -14691,6 +15456,7 @@ function transform(root, options) {
14691
15456
  root.hoists = context.hoists;
14692
15457
  root.temps = context.temps;
14693
15458
  root.cached = context.cached;
15459
+ root.transformed = true;
14694
15460
  {
14695
15461
  root.filters = [...context.filters];
14696
15462
  }
@@ -14847,7 +15613,7 @@ function createCodegenContext(ast, {
14847
15613
  ssr,
14848
15614
  isTS,
14849
15615
  inSSR,
14850
- source: ast.loc.source,
15616
+ source: ast.source,
14851
15617
  code: ``,
14852
15618
  column: 1,
14853
15619
  line: 1,
@@ -14858,7 +15624,7 @@ function createCodegenContext(ast, {
14858
15624
  helper(key) {
14859
15625
  return `_${helperNameMap[key]}`;
14860
15626
  },
14861
- push(code, node) {
15627
+ push(code, newlineIndex = -2 /* None */, node) {
14862
15628
  context.code += code;
14863
15629
  },
14864
15630
  indent() {
@@ -14876,7 +15642,7 @@ function createCodegenContext(ast, {
14876
15642
  }
14877
15643
  };
14878
15644
  function newline(n) {
14879
- context.push("\n" + ` `.repeat(n));
15645
+ context.push("\n" + ` `.repeat(n), 0 /* Start */);
14880
15646
  }
14881
15647
  return context;
14882
15648
  }
@@ -14913,9 +15679,11 @@ function generate(ast, options = {}) {
14913
15679
  push(`with (_ctx) {`);
14914
15680
  indent();
14915
15681
  if (hasHelpers) {
14916
- push(`const { ${helpers.map(aliasHelper).join(", ")} } = _Vue`);
14917
- push(`
14918
- `);
15682
+ push(
15683
+ `const { ${helpers.map(aliasHelper).join(", ")} } = _Vue
15684
+ `,
15685
+ -1 /* End */
15686
+ );
14919
15687
  newline();
14920
15688
  }
14921
15689
  }
@@ -14944,7 +15712,7 @@ function generate(ast, options = {}) {
14944
15712
  }
14945
15713
  if (ast.components.length || ast.directives.length || ast.temps) {
14946
15714
  push(`
14947
- `);
15715
+ `, 0 /* Start */);
14948
15716
  newline();
14949
15717
  }
14950
15718
  if (!ssr) {
@@ -14965,7 +15733,6 @@ function generate(ast, options = {}) {
14965
15733
  ast,
14966
15734
  code: context.code,
14967
15735
  preamble: isSetupInlined ? preambleContext.code : ``,
14968
- // SourceMapGenerator does have toJSON() method but it's not in the types
14969
15736
  map: context.map ? context.map.toJSON() : void 0
14970
15737
  };
14971
15738
  }
@@ -14984,7 +15751,7 @@ function genFunctionPreamble(ast, context) {
14984
15751
  if (helpers.length > 0) {
14985
15752
  {
14986
15753
  push(`const _Vue = ${VueBinding}
14987
- `);
15754
+ `, -1 /* End */);
14988
15755
  if (ast.hoists.length) {
14989
15756
  const staticHelpers = [
14990
15757
  CREATE_VNODE,
@@ -14994,7 +15761,7 @@ function genFunctionPreamble(ast, context) {
14994
15761
  CREATE_STATIC
14995
15762
  ].filter((helper) => helpers.includes(helper)).map(aliasHelper).join(", ");
14996
15763
  push(`const { ${staticHelpers} } = _Vue
14997
- `);
15764
+ `, -1 /* End */);
14998
15765
  }
14999
15766
  }
15000
15767
  }
@@ -15055,7 +15822,7 @@ function genNodeList(nodes, context, multilines = false, comma = true) {
15055
15822
  for (let i = 0; i < nodes.length; i++) {
15056
15823
  const node = nodes[i];
15057
15824
  if (isString(node)) {
15058
- push(node);
15825
+ push(node, -3 /* Unknown */);
15059
15826
  } else if (isArray(node)) {
15060
15827
  genNodeListAsArray(node, context);
15061
15828
  } else {
@@ -15073,7 +15840,7 @@ function genNodeList(nodes, context, multilines = false, comma = true) {
15073
15840
  }
15074
15841
  function genNode(node, context) {
15075
15842
  if (isString(node)) {
15076
- context.push(node);
15843
+ context.push(node, -3 /* Unknown */);
15077
15844
  return;
15078
15845
  }
15079
15846
  if (isSymbol(node)) {
@@ -15153,11 +15920,15 @@ function genNode(node, context) {
15153
15920
  }
15154
15921
  }
15155
15922
  function genText(node, context) {
15156
- context.push(JSON.stringify(node.content), node);
15923
+ context.push(JSON.stringify(node.content), -3 /* Unknown */, node);
15157
15924
  }
15158
15925
  function genExpression(node, context) {
15159
15926
  const { content, isStatic } = node;
15160
- context.push(isStatic ? JSON.stringify(content) : content, node);
15927
+ context.push(
15928
+ isStatic ? JSON.stringify(content) : content,
15929
+ -3 /* Unknown */,
15930
+ node
15931
+ );
15161
15932
  }
15162
15933
  function genInterpolation(node, context) {
15163
15934
  const { push, helper, pure } = context;
@@ -15171,7 +15942,7 @@ function genCompoundExpression(node, context) {
15171
15942
  for (let i = 0; i < node.children.length; i++) {
15172
15943
  const child = node.children[i];
15173
15944
  if (isString(child)) {
15174
- context.push(child);
15945
+ context.push(child, -3 /* Unknown */);
15175
15946
  } else {
15176
15947
  genNode(child, context);
15177
15948
  }
@@ -15185,9 +15956,9 @@ function genExpressionAsPropertyKey(node, context) {
15185
15956
  push(`]`);
15186
15957
  } else if (node.isStatic) {
15187
15958
  const text = isSimpleIdentifier(node.content) ? node.content : JSON.stringify(node.content);
15188
- push(text, node);
15959
+ push(text, -2 /* None */, node);
15189
15960
  } else {
15190
- push(`[${node.content}]`, node);
15961
+ push(`[${node.content}]`, -3 /* Unknown */, node);
15191
15962
  }
15192
15963
  }
15193
15964
  function genComment(node, context) {
@@ -15195,7 +15966,11 @@ function genComment(node, context) {
15195
15966
  if (pure) {
15196
15967
  push(PURE_ANNOTATION);
15197
15968
  }
15198
- push(`${helper(CREATE_COMMENT)}(${JSON.stringify(node.content)})`, node);
15969
+ push(
15970
+ `${helper(CREATE_COMMENT)}(${JSON.stringify(node.content)})`,
15971
+ -3 /* Unknown */,
15972
+ node
15973
+ );
15199
15974
  }
15200
15975
  function genVNodeCall(node, context) {
15201
15976
  const { push, helper, pure } = context;
@@ -15220,7 +15995,7 @@ function genVNodeCall(node, context) {
15220
15995
  push(PURE_ANNOTATION);
15221
15996
  }
15222
15997
  const callHelper = isBlock ? getVNodeBlockHelper(context.inSSR, isComponent) : getVNodeHelper(context.inSSR, isComponent);
15223
- push(helper(callHelper) + `(`, node);
15998
+ push(helper(callHelper) + `(`, -2 /* None */, node);
15224
15999
  genNodeList(
15225
16000
  genNullableArgs([tag, props, children, patchFlag, dynamicProps]),
15226
16001
  context
@@ -15249,7 +16024,7 @@ function genCallExpression(node, context) {
15249
16024
  if (pure) {
15250
16025
  push(PURE_ANNOTATION);
15251
16026
  }
15252
- push(callee + `(`, node);
16027
+ push(callee + `(`, -2 /* None */, node);
15253
16028
  genNodeList(node.arguments, context);
15254
16029
  push(`)`);
15255
16030
  }
@@ -15257,7 +16032,7 @@ function genObjectExpression(node, context) {
15257
16032
  const { push, indent, deindent, newline } = context;
15258
16033
  const { properties } = node;
15259
16034
  if (!properties.length) {
15260
- push(`{}`, node);
16035
+ push(`{}`, -2 /* None */, node);
15261
16036
  return;
15262
16037
  }
15263
16038
  const multilines = properties.length > 1 || !!(process.env.NODE_ENV !== "production") && properties.some((p) => p.value.type !== 4);
@@ -15285,7 +16060,7 @@ function genFunctionExpression(node, context) {
15285
16060
  if (isSlot) {
15286
16061
  push(`_${helperNameMap[WITH_CTX]}(`);
15287
16062
  }
15288
- push(`(`, node);
16063
+ push(`(`, -2 /* None */, node);
15289
16064
  if (isArray(params)) {
15290
16065
  genNodeList(params, context);
15291
16066
  } else if (params) {
@@ -15519,7 +16294,7 @@ function processIf(node, dir, context, processCodegen) {
15519
16294
  context.removeNode();
15520
16295
  const branch = createIfBranch(node, dir);
15521
16296
  if (!!(process.env.NODE_ENV !== "production") && comments.length && // #3619 ignore comments if the v-if is direct child of <transition>
15522
- !(context.parent && context.parent.type === 1 && isBuiltInType(context.parent.tag, "transition"))) {
16297
+ !(context.parent && context.parent.type === 1 && (context.parent.tag === "transition" || context.parent.tag === "Transition"))) {
15523
16298
  branch.children = [...comments, ...branch.children];
15524
16299
  }
15525
16300
  if (!!(process.env.NODE_ENV !== "production") || false) {
@@ -15801,18 +16576,14 @@ function processFor(node, dir, context, processCodegen) {
15801
16576
  );
15802
16577
  return;
15803
16578
  }
15804
- const parseResult = parseForExpression(
15805
- // can only be simple expression because vFor transform is applied
15806
- // before expression transform.
15807
- dir.exp,
15808
- context
15809
- );
16579
+ const parseResult = dir.forParseResult;
15810
16580
  if (!parseResult) {
15811
16581
  context.onError(
15812
16582
  createCompilerError(32, dir.loc)
15813
16583
  );
15814
16584
  return;
15815
16585
  }
16586
+ finalizeForParseResult(parseResult, context);
15816
16587
  const { addIdentifiers, removeIdentifiers, scopes } = context;
15817
16588
  const { source, value, key, index } = parseResult;
15818
16589
  const forNode = {
@@ -15834,71 +16605,26 @@ function processFor(node, dir, context, processCodegen) {
15834
16605
  onExit();
15835
16606
  };
15836
16607
  }
15837
- const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
15838
- const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
15839
- const stripParensRE = /^\(|\)$/g;
15840
- function parseForExpression(input, context) {
15841
- const loc = input.loc;
15842
- const exp = input.content;
15843
- const inMatch = exp.match(forAliasRE);
15844
- if (!inMatch)
16608
+ function finalizeForParseResult(result, context) {
16609
+ if (result.finalized)
15845
16610
  return;
15846
- const [, LHS, RHS] = inMatch;
15847
- const result = {
15848
- source: createAliasExpression(
15849
- loc,
15850
- RHS.trim(),
15851
- exp.indexOf(RHS, LHS.length)
15852
- ),
15853
- value: void 0,
15854
- key: void 0,
15855
- index: void 0
15856
- };
15857
16611
  if (!!(process.env.NODE_ENV !== "production") && true) {
15858
16612
  validateBrowserExpression(result.source, context);
15859
- }
15860
- let valueContent = LHS.trim().replace(stripParensRE, "").trim();
15861
- const trimmedOffset = LHS.indexOf(valueContent);
15862
- const iteratorMatch = valueContent.match(forIteratorRE);
15863
- if (iteratorMatch) {
15864
- valueContent = valueContent.replace(forIteratorRE, "").trim();
15865
- const keyContent = iteratorMatch[1].trim();
15866
- let keyOffset;
15867
- if (keyContent) {
15868
- keyOffset = exp.indexOf(keyContent, trimmedOffset + valueContent.length);
15869
- result.key = createAliasExpression(loc, keyContent, keyOffset);
15870
- if (!!(process.env.NODE_ENV !== "production") && true) {
15871
- validateBrowserExpression(
15872
- result.key,
15873
- context,
15874
- true
15875
- );
15876
- }
16613
+ if (result.key) {
16614
+ validateBrowserExpression(
16615
+ result.key,
16616
+ context,
16617
+ true
16618
+ );
15877
16619
  }
15878
- if (iteratorMatch[2]) {
15879
- const indexContent = iteratorMatch[2].trim();
15880
- if (indexContent) {
15881
- result.index = createAliasExpression(
15882
- loc,
15883
- indexContent,
15884
- exp.indexOf(
15885
- indexContent,
15886
- result.key ? keyOffset + keyContent.length : trimmedOffset + valueContent.length
15887
- )
15888
- );
15889
- if (!!(process.env.NODE_ENV !== "production") && true) {
15890
- validateBrowserExpression(
15891
- result.index,
15892
- context,
15893
- true
15894
- );
15895
- }
15896
- }
16620
+ if (result.index) {
16621
+ validateBrowserExpression(
16622
+ result.index,
16623
+ context,
16624
+ true
16625
+ );
15897
16626
  }
15898
- }
15899
- if (valueContent) {
15900
- result.value = createAliasExpression(loc, valueContent, trimmedOffset);
15901
- if (!!(process.env.NODE_ENV !== "production") && true) {
16627
+ if (result.value) {
15902
16628
  validateBrowserExpression(
15903
16629
  result.value,
15904
16630
  context,
@@ -15906,14 +16632,7 @@ function parseForExpression(input, context) {
15906
16632
  );
15907
16633
  }
15908
16634
  }
15909
- return result;
15910
- }
15911
- function createAliasExpression(range, content, offset) {
15912
- return createSimpleExpression(
15913
- content,
15914
- false,
15915
- getInnerRange(range, offset, content.length)
15916
- );
16635
+ result.finalized = true;
15917
16636
  }
15918
16637
  function createForLoopParams({ value, key, index }, memoArgs = []) {
15919
16638
  return createParamsList([value, key, index, ...memoArgs]);
@@ -16000,12 +16719,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
16000
16719
  hasDynamicSlots = true;
16001
16720
  }
16002
16721
  const vFor = findDir(slotElement, "for");
16003
- const slotFunction = buildSlotFn(
16004
- slotProps,
16005
- vFor == null ? void 0 : vFor.exp,
16006
- slotChildren,
16007
- slotLoc
16008
- );
16722
+ const slotFunction = buildSlotFn(slotProps, vFor, slotChildren, slotLoc);
16009
16723
  let vIf;
16010
16724
  let vElse;
16011
16725
  if (vIf = findDir(slotElement, "if")) {
@@ -16054,8 +16768,9 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
16054
16768
  }
16055
16769
  } else if (vFor) {
16056
16770
  hasDynamicSlots = true;
16057
- const parseResult = vFor.parseResult || parseForExpression(vFor.exp, context);
16771
+ const parseResult = vFor.forParseResult;
16058
16772
  if (parseResult) {
16773
+ finalizeForParseResult(parseResult, context);
16059
16774
  dynamicSlots.push(
16060
16775
  createCallExpression(context.helper(RENDER_LIST), [
16061
16776
  parseResult.source,
@@ -16318,17 +17033,6 @@ function resolveComponentType(node, context, ssr = false) {
16318
17033
  tag = isProp.value.content.slice(4);
16319
17034
  }
16320
17035
  }
16321
- const isDir = !isExplicitDynamic && findDir(node, "is");
16322
- if (isDir && isDir.exp) {
16323
- if (!!(process.env.NODE_ENV !== "production")) {
16324
- context.onWarn(
16325
- createCompilerError(52, isDir.loc)
16326
- );
16327
- }
16328
- return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [
16329
- isDir.exp
16330
- ]);
16331
- }
16332
17036
  const builtIn = isCoreComponent(tag) || context.isBuiltInComponent(tag);
16333
17037
  if (builtIn) {
16334
17038
  if (!ssr)
@@ -16400,7 +17104,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
16400
17104
  for (let i = 0; i < props.length; i++) {
16401
17105
  const prop = props[i];
16402
17106
  if (prop.type === 6) {
16403
- const { loc, name, value } = prop;
17107
+ const { loc, name, nameLoc, value } = prop;
16404
17108
  let isStatic = true;
16405
17109
  if (name === "ref") {
16406
17110
  hasRef = true;
@@ -16421,11 +17125,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
16421
17125
  }
16422
17126
  properties.push(
16423
17127
  createObjectProperty(
16424
- createSimpleExpression(
16425
- name,
16426
- true,
16427
- getInnerRange(loc, 0, name.length)
16428
- ),
17128
+ createSimpleExpression(name, true, nameLoc),
16429
17129
  createSimpleExpression(
16430
17130
  value ? value.content : "",
16431
17131
  isStatic,
@@ -16434,7 +17134,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
16434
17134
  )
16435
17135
  );
16436
17136
  } else {
16437
- const { name, arg, exp, loc } = prop;
17137
+ const { name, arg, exp, loc, modifiers } = prop;
16438
17138
  const isVBind = name === "bind";
16439
17139
  const isVOn = name === "on";
16440
17140
  if (name === "slot") {
@@ -16527,6 +17227,9 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
16527
17227
  }
16528
17228
  continue;
16529
17229
  }
17230
+ if (isVBind && modifiers.includes("prop")) {
17231
+ patchFlag |= 32;
17232
+ }
16530
17233
  const directiveTransform = context.directiveTransforms[name];
16531
17234
  if (directiveTransform) {
16532
17235
  const { props: props2, needRuntime } = directiveTransform(prop, node, context);
@@ -16904,8 +17607,13 @@ const transformOn$1 = (dir, node, context, augmentor) => {
16904
17607
  };
16905
17608
 
16906
17609
  const transformBind = (dir, _node, context) => {
16907
- const { exp, modifiers, loc } = dir;
17610
+ const { modifiers, loc } = dir;
16908
17611
  const arg = dir.arg;
17612
+ let { exp } = dir;
17613
+ if (!exp && arg.type === 4) {
17614
+ const propName = camelize(arg.content);
17615
+ exp = dir.exp = createSimpleExpression(propName, false, arg.loc);
17616
+ }
16909
17617
  if (arg.type !== 4) {
16910
17618
  arg.children.unshift(`(`);
16911
17619
  arg.children.push(`) || ""`);
@@ -17304,7 +18012,7 @@ function getBaseTransformPreset(prefixIdentifiers) {
17304
18012
  }
17305
18013
  ];
17306
18014
  }
17307
- function baseCompile(template, options = {}) {
18015
+ function baseCompile(source, options = {}) {
17308
18016
  const onError = options.onError || defaultOnError;
17309
18017
  const isModuleMode = options.mode === "module";
17310
18018
  {
@@ -17321,7 +18029,7 @@ function baseCompile(template, options = {}) {
17321
18029
  if (options.scopeId && !isModuleMode) {
17322
18030
  onError(createCompilerError(50));
17323
18031
  }
17324
- const ast = isString(template) ? baseParse(template, options) : template;
18032
+ const ast = isString(source) ? baseParse(source, options) : source;
17325
18033
  const [nodeTransforms, directiveTransforms] = getBaseTransformPreset();
17326
18034
  transform(
17327
18035
  ast,
@@ -17387,25 +18095,22 @@ function decodeHtmlBrowser(raw, asAttr = false) {
17387
18095
  }
17388
18096
  }
17389
18097
 
17390
- const isRawTextContainer = /* @__PURE__ */ makeMap(
17391
- "style,iframe,script,noscript",
17392
- true
17393
- );
17394
18098
  const parserOptions = {
18099
+ parseMode: "html",
17395
18100
  isVoidTag,
17396
18101
  isNativeTag: (tag) => isHTMLTag(tag) || isSVGTag(tag),
17397
18102
  isPreTag: (tag) => tag === "pre",
17398
18103
  decodeEntities: decodeHtmlBrowser ,
17399
18104
  isBuiltInComponent: (tag) => {
17400
- if (isBuiltInType(tag, `Transition`)) {
18105
+ if (tag === "Transition" || tag === "transition") {
17401
18106
  return TRANSITION;
17402
- } else if (isBuiltInType(tag, `TransitionGroup`)) {
18107
+ } else if (tag === "TransitionGroup" || tag === "transition-group") {
17403
18108
  return TRANSITION_GROUP;
17404
18109
  }
17405
18110
  },
17406
18111
  // https://html.spec.whatwg.org/multipage/parsing.html#tree-construction-dispatcher
17407
- getNamespace(tag, parent) {
17408
- let ns = parent ? parent.ns : 0;
18112
+ getNamespace(tag, parent, rootNamespace) {
18113
+ let ns = parent ? parent.ns : rootNamespace;
17409
18114
  if (parent && ns === 2) {
17410
18115
  if (parent.tag === "annotation-xml") {
17411
18116
  if (tag === "svg") {
@@ -17433,18 +18138,6 @@ const parserOptions = {
17433
18138
  }
17434
18139
  }
17435
18140
  return ns;
17436
- },
17437
- // https://html.spec.whatwg.org/multipage/parsing.html#parsing-html-fragments
17438
- getTextMode({ tag, ns }) {
17439
- if (ns === 0) {
17440
- if (tag === "textarea" || tag === "title") {
17441
- return 1;
17442
- }
17443
- if (isRawTextContainer(tag)) {
17444
- return 2;
17445
- }
17446
- }
17447
- return 0;
17448
18141
  }
17449
18142
  };
17450
18143
 
@@ -17559,8 +18252,8 @@ const transformModel = (dir, node, context) => {
17559
18252
  );
17560
18253
  }
17561
18254
  function checkDuplicatedValue() {
17562
- const value = findProp(node, "value");
17563
- if (value) {
18255
+ const value = findDir(node, "bind");
18256
+ if (value && isStaticArgOf(value.arg, "value")) {
17564
18257
  context.onError(
17565
18258
  createDOMCompilerError(
17566
18259
  60,
@@ -17765,6 +18458,7 @@ const transformTransition = (node, context) => {
17765
18458
  node.props.push({
17766
18459
  type: 6,
17767
18460
  name: "persisted",
18461
+ nameLoc: node.loc,
17768
18462
  value: void 0,
17769
18463
  loc: node.loc
17770
18464
  });
@@ -17809,9 +18503,9 @@ const DOMDirectiveTransforms = {
17809
18503
  // override compiler-core
17810
18504
  show: transformShow
17811
18505
  };
17812
- function compile(template, options = {}) {
18506
+ function compile(src, options = {}) {
17813
18507
  return baseCompile(
17814
- template,
18508
+ src,
17815
18509
  extend({}, parserOptions, options, {
17816
18510
  nodeTransforms: [
17817
18511
  // ignore <script> and <tag>