@vue/compat 3.2.19 → 3.2.23

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.
package/dist/vue.cjs.js CHANGED
@@ -339,12 +339,12 @@ function escapeHtml(string) {
339
339
  continue;
340
340
  }
341
341
  if (lastIndex !== index) {
342
- html += str.substring(lastIndex, index);
342
+ html += str.slice(lastIndex, index);
343
343
  }
344
344
  lastIndex = index + 1;
345
345
  html += escaped;
346
346
  }
347
- return lastIndex !== index ? html + str.substring(lastIndex, index) : html;
347
+ return lastIndex !== index ? html + str.slice(lastIndex, index) : html;
348
348
  }
349
349
 
350
350
  function looseCompareArrays(a, b) {
@@ -434,17 +434,6 @@ const replacer = (_key, val) => {
434
434
  return val;
435
435
  };
436
436
 
437
- /**
438
- * List of @babel/parser plugins that are used for template expression
439
- * transforms and SFC script transforms. By default we enable proposals slated
440
- * for ES2020. This will need to be updated as the spec moves forward.
441
- * Full list at https://babeljs.io/docs/en/next/babel-parser#plugins
442
- */
443
- const babelParserDefaultPlugins = [
444
- 'bigInt',
445
- 'optionalChaining',
446
- 'nullishCoalescingOperator'
447
- ];
448
437
  const EMPTY_OBJ = Object.freeze({})
449
438
  ;
450
439
  const EMPTY_ARR = Object.freeze([]) ;
@@ -678,7 +667,7 @@ const targetMap = new WeakMap();
678
667
  let effectTrackDepth = 0;
679
668
  let trackOpBit = 1;
680
669
  /**
681
- * The bitwise track markers support at most 30 levels op recursion.
670
+ * The bitwise track markers support at most 30 levels of recursion.
682
671
  * This value is chosen to enable modern JS engines to use a SMI on all platforms.
683
672
  * When recursion depth is greater, fall back to using a full cleanup.
684
673
  */
@@ -999,7 +988,7 @@ const shallowSet = /*#__PURE__*/ createSetter(true);
999
988
  function createSetter(shallow = false) {
1000
989
  return function set(target, key, value, receiver) {
1001
990
  let oldValue = target[key];
1002
- if (!shallow) {
991
+ if (!shallow && !isReadonly(value)) {
1003
992
  value = toRaw(value);
1004
993
  oldValue = toRaw(oldValue);
1005
994
  if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
@@ -1672,19 +1661,22 @@ function registerHMR(instance) {
1672
1661
  const id = instance.type.__hmrId;
1673
1662
  let record = map.get(id);
1674
1663
  if (!record) {
1675
- createRecord(id);
1664
+ createRecord(id, instance.type);
1676
1665
  record = map.get(id);
1677
1666
  }
1678
- record.add(instance);
1667
+ record.instances.add(instance);
1679
1668
  }
1680
1669
  function unregisterHMR(instance) {
1681
- map.get(instance.type.__hmrId).delete(instance);
1670
+ map.get(instance.type.__hmrId).instances.delete(instance);
1682
1671
  }
1683
- function createRecord(id) {
1672
+ function createRecord(id, initialDef) {
1684
1673
  if (map.has(id)) {
1685
1674
  return false;
1686
1675
  }
1687
- map.set(id, new Set());
1676
+ map.set(id, {
1677
+ initialDef: normalizeClassComponent(initialDef),
1678
+ instances: new Set()
1679
+ });
1688
1680
  return true;
1689
1681
  }
1690
1682
  function normalizeClassComponent(component) {
@@ -1695,7 +1687,9 @@ function rerender(id, newRender) {
1695
1687
  if (!record) {
1696
1688
  return;
1697
1689
  }
1698
- [...record].forEach(instance => {
1690
+ // update initial record (for not-yet-rendered component)
1691
+ record.initialDef.render = newRender;
1692
+ [...record.instances].forEach(instance => {
1699
1693
  if (newRender) {
1700
1694
  instance.render = newRender;
1701
1695
  normalizeClassComponent(instance.type).render = newRender;
@@ -1712,17 +1706,16 @@ function reload(id, newComp) {
1712
1706
  if (!record)
1713
1707
  return;
1714
1708
  newComp = normalizeClassComponent(newComp);
1709
+ // update initial def (for not-yet-rendered components)
1710
+ updateComponentDef(record.initialDef, newComp);
1715
1711
  // create a snapshot which avoids the set being mutated during updates
1716
- const instances = [...record];
1712
+ const instances = [...record.instances];
1717
1713
  for (const instance of instances) {
1718
1714
  const oldComp = normalizeClassComponent(instance.type);
1719
1715
  if (!hmrDirtyComponents.has(oldComp)) {
1720
1716
  // 1. Update existing comp definition to match new one
1721
- extend(oldComp, newComp);
1722
- for (const key in oldComp) {
1723
- if (key !== '__file' && !(key in newComp)) {
1724
- delete oldComp[key];
1725
- }
1717
+ if (oldComp !== record.initialDef) {
1718
+ updateComponentDef(oldComp, newComp);
1726
1719
  }
1727
1720
  // 2. mark definition dirty. This forces the renderer to replace the
1728
1721
  // component on patch.
@@ -1768,6 +1761,14 @@ function reload(id, newComp) {
1768
1761
  }
1769
1762
  });
1770
1763
  }
1764
+ function updateComponentDef(oldComp, newComp) {
1765
+ extend(oldComp, newComp);
1766
+ for (const key in oldComp) {
1767
+ if (key !== '__file' && !(key in newComp)) {
1768
+ delete oldComp[key];
1769
+ }
1770
+ }
1771
+ }
1771
1772
  function tryWrap(fn) {
1772
1773
  return (id, arg) => {
1773
1774
  try {
@@ -1783,27 +1784,52 @@ function tryWrap(fn) {
1783
1784
 
1784
1785
  let devtools;
1785
1786
  let buffer = [];
1787
+ let devtoolsNotInstalled = false;
1786
1788
  function emit(event, ...args) {
1787
1789
  if (devtools) {
1788
1790
  devtools.emit(event, ...args);
1789
1791
  }
1790
- else {
1792
+ else if (!devtoolsNotInstalled) {
1791
1793
  buffer.push({ event, args });
1792
1794
  }
1793
1795
  }
1794
1796
  function setDevtoolsHook(hook, target) {
1797
+ var _a, _b;
1795
1798
  devtools = hook;
1796
1799
  if (devtools) {
1797
1800
  devtools.enabled = true;
1798
1801
  buffer.forEach(({ event, args }) => devtools.emit(event, ...args));
1799
1802
  buffer = [];
1800
1803
  }
1801
- else {
1804
+ else if (
1805
+ // handle late devtools injection - only do this if we are in an actual
1806
+ // browser environment to avoid the timer handle stalling test runner exit
1807
+ // (#4815)
1808
+ // eslint-disable-next-line no-restricted-globals
1809
+ typeof window !== 'undefined' &&
1810
+ // some envs mock window but not fully
1811
+ window.HTMLElement &&
1812
+ // also exclude jsdom
1813
+ !((_b = (_a = window.navigator) === null || _a === void 0 ? void 0 : _a.userAgent) === null || _b === void 0 ? void 0 : _b.includes('jsdom'))) {
1802
1814
  const replay = (target.__VUE_DEVTOOLS_HOOK_REPLAY__ =
1803
1815
  target.__VUE_DEVTOOLS_HOOK_REPLAY__ || []);
1804
1816
  replay.push((newHook) => {
1805
1817
  setDevtoolsHook(newHook, target);
1806
1818
  });
1819
+ // clear buffer after 3s - the user probably doesn't have devtools installed
1820
+ // at all, and keeping the buffer will cause memory leaks (#4738)
1821
+ setTimeout(() => {
1822
+ if (!devtools) {
1823
+ target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
1824
+ devtoolsNotInstalled = true;
1825
+ buffer = [];
1826
+ }
1827
+ }, 3000);
1828
+ }
1829
+ else {
1830
+ // non-browser env, assume not installed
1831
+ devtoolsNotInstalled = true;
1832
+ buffer = [];
1807
1833
  }
1808
1834
  }
1809
1835
  function devtoolsInitApp(app, version) {
@@ -3418,7 +3444,8 @@ const BaseTransitionImpl = {
3418
3444
  const rawProps = toRaw(props);
3419
3445
  const { mode } = rawProps;
3420
3446
  // check mode
3421
- if (mode && !['in-out', 'out-in', 'default'].includes(mode)) {
3447
+ if (mode &&
3448
+ mode !== 'in-out' && mode !== 'out-in' && mode !== 'default') {
3422
3449
  warn$1(`invalid <transition> mode: ${mode}`);
3423
3450
  }
3424
3451
  // at this point children has a guaranteed length of 1.
@@ -4064,7 +4091,7 @@ function registerKeepAliveHook(hook, type, target = currentInstance) {
4064
4091
  }
4065
4092
  current = current.parent;
4066
4093
  }
4067
- hook();
4094
+ return hook();
4068
4095
  });
4069
4096
  injectHook(type, wrappedHook, target);
4070
4097
  // In addition to registering it on the target instance, we walk up the parent
@@ -5288,7 +5315,7 @@ return withDirectives(h(comp), [
5288
5315
  [bar, this.y]
5289
5316
  ])
5290
5317
  */
5291
- const isBuiltInDirective = /*#__PURE__*/ makeMap('bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text');
5318
+ const isBuiltInDirective = /*#__PURE__*/ makeMap('bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo');
5292
5319
  function validateDirectiveName(name) {
5293
5320
  if (isBuiltInDirective(name)) {
5294
5321
  warn$1('Do not use built-in directive ids as custom directive id: ' + name);
@@ -5423,7 +5450,7 @@ function createCompatVue(createApp, createSingletonApp) {
5423
5450
  return vm;
5424
5451
  }
5425
5452
  }
5426
- Vue.version = "3.2.19";
5453
+ Vue.version = "3.2.23";
5427
5454
  Vue.config = singletonApp.config;
5428
5455
  Vue.use = (p, ...options) => {
5429
5456
  if (p && isFunction(p.install)) {
@@ -6869,7 +6896,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6869
6896
  }
6870
6897
  };
6871
6898
  const mountComponent = (initialVNode, container, anchor, parentComponent, parentSuspense, isSVG, optimized) => {
6872
- // 2.x compat may pre-creaate the component instance before actually
6899
+ // 2.x compat may pre-create the component instance before actually
6873
6900
  // mounting
6874
6901
  const compatMountInstance = initialVNode.isCompatRoot && initialVNode.component;
6875
6902
  const instance = compatMountInstance ||
@@ -7749,8 +7776,8 @@ function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
7749
7776
  *
7750
7777
  * #2080
7751
7778
  * Inside keyed `template` fragment static children, if a fragment is moved,
7752
- * the children will always moved so that need inherit el form previous nodes
7753
- * to ensure correct moved position.
7779
+ * the children will always be moved. Therefore, in order to ensure correct move
7780
+ * position, el should be inherited from previous nodes.
7754
7781
  */
7755
7782
  function traverseStaticChildren(n1, n2, shallow = false) {
7756
7783
  const ch1 = n1.children;
@@ -8877,7 +8904,8 @@ function mergeProps(...args) {
8877
8904
  else if (isOn(key)) {
8878
8905
  const existing = ret[key];
8879
8906
  const incoming = toMerge[key];
8880
- if (existing !== incoming) {
8907
+ if (existing !== incoming &&
8908
+ !(isArray(existing) && existing.includes(incoming))) {
8881
8909
  ret[key] = existing
8882
8910
  ? [].concat(existing, incoming)
8883
8911
  : incoming;
@@ -9321,23 +9349,23 @@ const PublicInstanceProxyHandlers = {
9321
9349
  const n = accessCache[key];
9322
9350
  if (n !== undefined) {
9323
9351
  switch (n) {
9324
- case 0 /* SETUP */:
9352
+ case 1 /* SETUP */:
9325
9353
  return setupState[key];
9326
- case 1 /* DATA */:
9354
+ case 2 /* DATA */:
9327
9355
  return data[key];
9328
- case 3 /* CONTEXT */:
9356
+ case 4 /* CONTEXT */:
9329
9357
  return ctx[key];
9330
- case 2 /* PROPS */:
9358
+ case 3 /* PROPS */:
9331
9359
  return props[key];
9332
9360
  // default: just fallthrough
9333
9361
  }
9334
9362
  }
9335
9363
  else if (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) {
9336
- accessCache[key] = 0 /* SETUP */;
9364
+ accessCache[key] = 1 /* SETUP */;
9337
9365
  return setupState[key];
9338
9366
  }
9339
9367
  else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
9340
- accessCache[key] = 1 /* DATA */;
9368
+ accessCache[key] = 2 /* DATA */;
9341
9369
  return data[key];
9342
9370
  }
9343
9371
  else if (
@@ -9345,15 +9373,15 @@ const PublicInstanceProxyHandlers = {
9345
9373
  // props
9346
9374
  (normalizedProps = instance.propsOptions[0]) &&
9347
9375
  hasOwn(normalizedProps, key)) {
9348
- accessCache[key] = 2 /* PROPS */;
9376
+ accessCache[key] = 3 /* PROPS */;
9349
9377
  return props[key];
9350
9378
  }
9351
9379
  else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
9352
- accessCache[key] = 3 /* CONTEXT */;
9380
+ accessCache[key] = 4 /* CONTEXT */;
9353
9381
  return ctx[key];
9354
9382
  }
9355
9383
  else if (shouldCacheAccess) {
9356
- accessCache[key] = 4 /* OTHER */;
9384
+ accessCache[key] = 0 /* OTHER */;
9357
9385
  }
9358
9386
  }
9359
9387
  const publicGetter = publicPropertiesMap[key];
@@ -9374,7 +9402,7 @@ const PublicInstanceProxyHandlers = {
9374
9402
  }
9375
9403
  else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
9376
9404
  // user may set custom properties to `this` that start with `$`
9377
- accessCache[key] = 3 /* CONTEXT */;
9405
+ accessCache[key] = 4 /* CONTEXT */;
9378
9406
  return ctx[key];
9379
9407
  }
9380
9408
  else if (
@@ -9442,7 +9470,7 @@ const PublicInstanceProxyHandlers = {
9442
9470
  },
9443
9471
  has({ _: { data, setupState, accessCache, ctx, appContext, propsOptions } }, key) {
9444
9472
  let normalizedProps;
9445
- return (accessCache[key] !== undefined ||
9473
+ return (!!accessCache[key] ||
9446
9474
  (data !== EMPTY_OBJ && hasOwn(data, key)) ||
9447
9475
  (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) ||
9448
9476
  ((normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key)) ||
@@ -10706,15 +10734,21 @@ function getContext() {
10706
10734
  * only.
10707
10735
  * @internal
10708
10736
  */
10709
- function mergeDefaults(
10710
- // the base props is compiler-generated and guaranteed to be in this shape.
10711
- props, defaults) {
10737
+ function mergeDefaults(raw, defaults) {
10738
+ const props = isArray(raw)
10739
+ ? raw.reduce((normalized, p) => ((normalized[p] = {}), normalized), {})
10740
+ : raw;
10712
10741
  for (const key in defaults) {
10713
- const val = props[key];
10714
- if (val) {
10715
- val.default = defaults[key];
10742
+ const opt = props[key];
10743
+ if (opt) {
10744
+ if (isArray(opt) || isFunction(opt)) {
10745
+ props[key] = { type: opt, default: defaults[key] };
10746
+ }
10747
+ else {
10748
+ opt.default = defaults[key];
10749
+ }
10716
10750
  }
10717
- else if (val === null) {
10751
+ else if (opt === null) {
10718
10752
  props[key] = { default: defaults[key] };
10719
10753
  }
10720
10754
  else {
@@ -10723,6 +10757,23 @@ props, defaults) {
10723
10757
  }
10724
10758
  return props;
10725
10759
  }
10760
+ /**
10761
+ * Used to create a proxy for the rest element when destructuring props with
10762
+ * defineProps().
10763
+ * @internal
10764
+ */
10765
+ function createPropsRestProxy(props, excludedKeys) {
10766
+ const ret = {};
10767
+ for (const key in props) {
10768
+ if (!excludedKeys.includes(key)) {
10769
+ Object.defineProperty(ret, key, {
10770
+ enumerable: true,
10771
+ get: () => props[key]
10772
+ });
10773
+ }
10774
+ }
10775
+ return ret;
10776
+ }
10726
10777
  /**
10727
10778
  * `<script setup>` helper for persisting the current instance context over
10728
10779
  * async/await flows.
@@ -11015,7 +11066,7 @@ function isMemoSame(cached, memo) {
11015
11066
  }
11016
11067
 
11017
11068
  // Core API ------------------------------------------------------------------
11018
- const version = "3.2.19";
11069
+ const version = "3.2.23";
11019
11070
  const _ssrUtils = {
11020
11071
  createComponentInstance,
11021
11072
  setupComponent,
@@ -11152,16 +11203,8 @@ function patchClass(el, value, isSVG) {
11152
11203
 
11153
11204
  function patchStyle(el, prev, next) {
11154
11205
  const style = el.style;
11155
- const currentDisplay = style.display;
11156
- if (!next) {
11157
- el.removeAttribute('style');
11158
- }
11159
- else if (isString(next)) {
11160
- if (prev !== next) {
11161
- style.cssText = next;
11162
- }
11163
- }
11164
- else {
11206
+ const isCssString = isString(next);
11207
+ if (next && !isCssString) {
11165
11208
  for (const key in next) {
11166
11209
  setStyle(style, key, next[key]);
11167
11210
  }
@@ -11173,11 +11216,22 @@ function patchStyle(el, prev, next) {
11173
11216
  }
11174
11217
  }
11175
11218
  }
11176
- // indicates that the `display` of the element is controlled by `v-show`,
11177
- // so we always keep the current `display` value regardless of the `style` value,
11178
- // thus handing over control to `v-show`.
11179
- if ('_vod' in el) {
11180
- style.display = currentDisplay;
11219
+ else {
11220
+ const currentDisplay = style.display;
11221
+ if (isCssString) {
11222
+ if (prev !== next) {
11223
+ style.cssText = next;
11224
+ }
11225
+ }
11226
+ else if (prev) {
11227
+ el.removeAttribute('style');
11228
+ }
11229
+ // indicates that the `display` of the element is controlled by `v-show`,
11230
+ // so we always keep the current `display` value regardless of the `style`
11231
+ // value, thus handing over control to `v-show`.
11232
+ if ('_vod' in el) {
11233
+ style.display = currentDisplay;
11234
+ }
11181
11235
  }
11182
11236
  }
11183
11237
  const importantRE = /\s*!important$/;
@@ -11287,12 +11341,19 @@ prevChildren, parentComponent, parentSuspense, unmountChildren) {
11287
11341
  el[key] = value == null ? '' : value;
11288
11342
  return;
11289
11343
  }
11290
- if (key === 'value' && el.tagName !== 'PROGRESS') {
11344
+ if (key === 'value' &&
11345
+ el.tagName !== 'PROGRESS' &&
11346
+ // custom elements may use _value internally
11347
+ !el.tagName.includes('-')) {
11291
11348
  // store value as _value as well since
11292
11349
  // non-string values will be stringified.
11293
11350
  el._value = value;
11294
11351
  const newValue = value == null ? '' : value;
11295
- if (el.value !== newValue) {
11352
+ if (el.value !== newValue ||
11353
+ // #4956: always set for OPTION elements because its value falls back to
11354
+ // textContent if no value attribute is present. And setting .value for
11355
+ // OPTION has no side effect
11356
+ el.tagName === 'OPTION') {
11296
11357
  el.value = newValue;
11297
11358
  }
11298
11359
  if (value == null) {
@@ -11560,22 +11621,11 @@ class VueElement extends BaseClass {
11560
11621
  }
11561
11622
  this.attachShadow({ mode: 'open' });
11562
11623
  }
11563
- // set initial attrs
11564
- for (let i = 0; i < this.attributes.length; i++) {
11565
- this._setAttr(this.attributes[i].name);
11566
- }
11567
- // watch future attr changes
11568
- new MutationObserver(mutations => {
11569
- for (const m of mutations) {
11570
- this._setAttr(m.attributeName);
11571
- }
11572
- }).observe(this, { attributes: true });
11573
11624
  }
11574
11625
  connectedCallback() {
11575
11626
  this._connected = true;
11576
11627
  if (!this._instance) {
11577
11628
  this._resolveDef();
11578
- this._update();
11579
11629
  }
11580
11630
  }
11581
11631
  disconnectedCallback() {
@@ -11594,8 +11644,18 @@ class VueElement extends BaseClass {
11594
11644
  if (this._resolved) {
11595
11645
  return;
11596
11646
  }
11647
+ this._resolved = true;
11648
+ // set initial attrs
11649
+ for (let i = 0; i < this.attributes.length; i++) {
11650
+ this._setAttr(this.attributes[i].name);
11651
+ }
11652
+ // watch future attr changes
11653
+ new MutationObserver(mutations => {
11654
+ for (const m of mutations) {
11655
+ this._setAttr(m.attributeName);
11656
+ }
11657
+ }).observe(this, { attributes: true });
11597
11658
  const resolve = (def) => {
11598
- this._resolved = true;
11599
11659
  const { props, styles } = def;
11600
11660
  const hasOptions = !isArray(props);
11601
11661
  const rawKeys = props ? (hasOptions ? Object.keys(props) : props) : [];
@@ -11610,14 +11670,11 @@ class VueElement extends BaseClass {
11610
11670
  }
11611
11671
  }
11612
11672
  }
11613
- if (numberProps) {
11614
- this._numberProps = numberProps;
11615
- this._update();
11616
- }
11673
+ this._numberProps = numberProps;
11617
11674
  // check if there are props set pre-upgrade or connect
11618
11675
  for (const key of Object.keys(this)) {
11619
11676
  if (key[0] !== '_') {
11620
- this._setProp(key, this[key]);
11677
+ this._setProp(key, this[key], true, false);
11621
11678
  }
11622
11679
  }
11623
11680
  // defining getter/setters on prototype
@@ -11631,7 +11688,10 @@ class VueElement extends BaseClass {
11631
11688
  }
11632
11689
  });
11633
11690
  }
11691
+ // apply CSS
11634
11692
  this._applyStyles(styles);
11693
+ // initial render
11694
+ this._update();
11635
11695
  };
11636
11696
  const asyncDef = this._def.__asyncLoader;
11637
11697
  if (asyncDef) {
@@ -11657,10 +11717,10 @@ class VueElement extends BaseClass {
11657
11717
  /**
11658
11718
  * @internal
11659
11719
  */
11660
- _setProp(key, val, shouldReflect = true) {
11720
+ _setProp(key, val, shouldReflect = true, shouldUpdate = true) {
11661
11721
  if (val !== this._props[key]) {
11662
11722
  this._props[key] = val;
11663
- if (this._instance) {
11723
+ if (shouldUpdate && this._instance) {
11664
11724
  this._update();
11665
11725
  }
11666
11726
  // reflect
@@ -12848,6 +12908,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
12848
12908
  defineExpose: defineExpose,
12849
12909
  withDefaults: withDefaults,
12850
12910
  mergeDefaults: mergeDefaults,
12911
+ createPropsRestProxy: createPropsRestProxy,
12851
12912
  withAsyncContext: withAsyncContext,
12852
12913
  getCurrentInstance: getCurrentInstance,
12853
12914
  h: h,
@@ -13263,7 +13324,7 @@ const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
13263
13324
  const isMemberExpressionNode = (path, context) => {
13264
13325
  try {
13265
13326
  let ret = parser.parseExpression(path, {
13266
- plugins: [...context.expressionPlugins, ...babelParserDefaultPlugins]
13327
+ plugins: context.expressionPlugins
13267
13328
  });
13268
13329
  if (ret.type === 'TSAsExpression' || ret.type === 'TSTypeAssertion') {
13269
13330
  ret = ret.expression;
@@ -13278,7 +13339,7 @@ const isMemberExpressionNode = (path, context) => {
13278
13339
  };
13279
13340
  const isMemberExpression = isMemberExpressionNode;
13280
13341
  function getInnerRange(loc, offset, length) {
13281
- const source = loc.source.substr(offset, length);
13342
+ const source = loc.source.slice(offset, offset + length);
13282
13343
  const newLoc = {
13283
13344
  source,
13284
13345
  start: advancePositionWithClone(loc.start, loc.source, offset),
@@ -14035,6 +14096,7 @@ function parseTag(context, type, parent) {
14035
14096
  }
14036
14097
  if (hasIf && hasFor) {
14037
14098
  warnDeprecation$1("COMPILER_V_IF_V_FOR_PRECEDENCE" /* COMPILER_V_IF_V_FOR_PRECEDENCE */, context, getSelection(context, start));
14099
+ break;
14038
14100
  }
14039
14101
  }
14040
14102
  }
@@ -14192,10 +14254,10 @@ function parseAttribute(context, nameSet) {
14192
14254
  isStatic = false;
14193
14255
  if (!content.endsWith(']')) {
14194
14256
  emitError(context, 27 /* X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END */);
14195
- content = content.substr(1);
14257
+ content = content.slice(1);
14196
14258
  }
14197
14259
  else {
14198
- content = content.substr(1, content.length - 2);
14260
+ content = content.slice(1, content.length - 1);
14199
14261
  }
14200
14262
  }
14201
14263
  else if (isSlot) {
@@ -14221,7 +14283,7 @@ function parseAttribute(context, nameSet) {
14221
14283
  valueLoc.end = advancePositionWithClone(valueLoc.start, value.content);
14222
14284
  valueLoc.source = valueLoc.source.slice(1, -1);
14223
14285
  }
14224
- const modifiers = match[3] ? match[3].substr(1).split('.') : [];
14286
+ const modifiers = match[3] ? match[3].slice(1).split('.') : [];
14225
14287
  if (isPropShorthand)
14226
14288
  modifiers.push('prop');
14227
14289
  // 2.x compat v-bind:foo.sync -> v-model:foo
@@ -14442,7 +14504,7 @@ function isEnd(context, mode, ancestors) {
14442
14504
  }
14443
14505
  function startsWithEndTagOpen(source, tag) {
14444
14506
  return (startsWith(source, '</') &&
14445
- source.substr(2, tag.length).toLowerCase() === tag.toLowerCase() &&
14507
+ source.slice(2, 2 + tag.length).toLowerCase() === tag.toLowerCase() &&
14446
14508
  /[\t\r\n\f />]/.test(source[2 + tag.length] || '>'));
14447
14509
  }
14448
14510
 
@@ -16242,12 +16304,19 @@ asRawStatements = false, localVars = Object.create(context.identifiers)) {
16242
16304
  // it gets correct type
16243
16305
  return `__props.${raw}`;
16244
16306
  }
16307
+ else if (type === "props-aliased" /* PROPS_ALIASED */) {
16308
+ // prop with a different local alias (from defineProps() destructure)
16309
+ return `__props.${bindingMetadata.__propsAliases[raw]}`;
16310
+ }
16245
16311
  }
16246
16312
  else {
16247
16313
  if (type && type.startsWith('setup')) {
16248
16314
  // setup bindings in non-inline mode
16249
16315
  return `$setup.${raw}`;
16250
16316
  }
16317
+ else if (type === "props-aliased" /* PROPS_ALIASED */) {
16318
+ return `$props.${bindingMetadata.__propsAliases[raw]}`;
16319
+ }
16251
16320
  else if (type) {
16252
16321
  return `$${type}.${raw}`;
16253
16322
  }
@@ -16292,7 +16361,7 @@ asRawStatements = false, localVars = Object.create(context.identifiers)) {
16292
16361
  : `(${rawExp})${asParams ? `=>{}` : ``}`;
16293
16362
  try {
16294
16363
  ast = parser.parse(source, {
16295
- plugins: [...context.expressionPlugins, ...babelParserDefaultPlugins]
16364
+ plugins: context.expressionPlugins
16296
16365
  }).program;
16297
16366
  }
16298
16367
  catch (e) {
@@ -17756,7 +17825,7 @@ function stringifyDynamicPropNames(props) {
17756
17825
  return propsNamesString + `]`;
17757
17826
  }
17758
17827
  function isComponentTag(tag) {
17759
- return tag[0].toLowerCase() + tag.slice(1) === 'component';
17828
+ return tag === 'component' || tag === 'Component';
17760
17829
  }
17761
17830
  function processInlineRef(context, raw) {
17762
17831
  const body = [createSimpleExpression(`_refs['${raw}'] = _value`)];
@@ -20755,7 +20824,7 @@ const decodeHtml = (rawText, asAttr) => {
20755
20824
  maxCRNameLength = Object.keys(namedCharacterReferences).reduce((max, name) => Math.max(max, name.length), 0);
20756
20825
  }
20757
20826
  for (let length = maxCRNameLength; !value && length > 0; --length) {
20758
- name = rawText.substr(1, length);
20827
+ name = rawText.slice(1, 1 + length);
20759
20828
  value = namedCharacterReferences[name];
20760
20829
  }
20761
20830
  if (value) {