@vue/compat 3.5.21 → 3.5.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
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compat v3.5.21
2
+ * @vue/compat v3.5.23
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -1268,7 +1268,7 @@ function iterator(self, method, wrapValue) {
1268
1268
  iter._next = iter.next;
1269
1269
  iter.next = () => {
1270
1270
  const result = iter._next();
1271
- if (result.value) {
1271
+ if (!result.done) {
1272
1272
  result.value = wrapValue(result.value);
1273
1273
  }
1274
1274
  return result;
@@ -1395,7 +1395,8 @@ class BaseReactiveHandler {
1395
1395
  return res;
1396
1396
  }
1397
1397
  if (isRef(res)) {
1398
- return targetIsArray && isIntegerKey(key) ? res : res.value;
1398
+ const value = targetIsArray && isIntegerKey(key) ? res : res.value;
1399
+ return isReadonly2 && isObject(value) ? readonly(value) : value;
1399
1400
  }
1400
1401
  if (isObject(res)) {
1401
1402
  return isReadonly2 ? readonly(res) : reactive(res);
@@ -2745,14 +2746,11 @@ function checkRecursiveUpdates(seen, fn) {
2745
2746
  let isHmrUpdating = false;
2746
2747
  const hmrDirtyComponents = /* @__PURE__ */ new Map();
2747
2748
  {
2748
- const g = getGlobalThis();
2749
- if (!g.__VUE_HMR_RUNTIME__) {
2750
- g.__VUE_HMR_RUNTIME__ = {
2751
- createRecord: tryWrap(createRecord),
2752
- rerender: tryWrap(rerender),
2753
- reload: tryWrap(reload)
2754
- };
2755
- }
2749
+ getGlobalThis().__VUE_HMR_RUNTIME__ = {
2750
+ createRecord: tryWrap(createRecord),
2751
+ rerender: tryWrap(rerender),
2752
+ reload: tryWrap(reload)
2753
+ };
2756
2754
  }
2757
2755
  const map = /* @__PURE__ */ new Map();
2758
2756
  function registerHMR(instance) {
@@ -3647,9 +3645,6 @@ const TeleportImpl = {
3647
3645
  insert(mainAnchor, container, anchor);
3648
3646
  const mount = (container2, anchor2) => {
3649
3647
  if (shapeFlag & 16) {
3650
- if (parentComponent && parentComponent.isCE) {
3651
- parentComponent.ce._teleportTarget = container2;
3652
- }
3653
3648
  mountChildren(
3654
3649
  children,
3655
3650
  container2,
@@ -3671,6 +3666,9 @@ const TeleportImpl = {
3671
3666
  } else if (namespace !== "mathml" && isTargetMathML(target)) {
3672
3667
  namespace = "mathml";
3673
3668
  }
3669
+ if (parentComponent && parentComponent.isCE) {
3670
+ (parentComponent.ce._teleportTargets || (parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target);
3671
+ }
3674
3672
  if (!disabled) {
3675
3673
  mount(target, targetAnchor);
3676
3674
  updateCssVars(n2, false);
@@ -4780,14 +4778,16 @@ Server rendered element contains more child nodes than client vdom.`
4780
4778
  if (clientText[0] === "\n" && (el.tagName === "PRE" || el.tagName === "TEXTAREA")) {
4781
4779
  clientText = clientText.slice(1);
4782
4780
  }
4783
- if (el.textContent !== clientText) {
4781
+ const { textContent } = el;
4782
+ if (textContent !== clientText && // innerHTML normalize \r\n or \r into a single \n in the DOM
4783
+ textContent !== clientText.replace(/\r\n|\r/g, "\n")) {
4784
4784
  if (!isMismatchAllowed(el, 0 /* TEXT */)) {
4785
4785
  warn$1(
4786
4786
  `Hydration text content mismatch on`,
4787
4787
  el,
4788
4788
  `
4789
- - rendered on server: ${el.textContent}
4790
- - expected on client: ${vnode.children}`
4789
+ - rendered on server: ${textContent}
4790
+ - expected on client: ${clientText}`
4791
4791
  );
4792
4792
  logMismatchError();
4793
4793
  }
@@ -5382,7 +5382,10 @@ function defineAsyncComponent(source) {
5382
5382
  error: error.value
5383
5383
  });
5384
5384
  } else if (loadingComponent && !delayed.value) {
5385
- return createVNode(loadingComponent);
5385
+ return createInnerComp(
5386
+ loadingComponent,
5387
+ instance
5388
+ );
5386
5389
  }
5387
5390
  };
5388
5391
  }
@@ -6127,12 +6130,13 @@ function createSlots(slots, dynamicSlots) {
6127
6130
 
6128
6131
  function renderSlot(slots, name, props = {}, fallback, noSlotted) {
6129
6132
  if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
6133
+ const hasProps = Object.keys(props).length > 0;
6130
6134
  if (name !== "default") props.name = name;
6131
6135
  return openBlock(), createBlock(
6132
6136
  Fragment,
6133
6137
  null,
6134
6138
  [createVNode("slot", props, fallback && fallback())],
6135
- 64
6139
+ hasProps ? -2 : 64
6136
6140
  );
6137
6141
  }
6138
6142
  let slot = slots[name];
@@ -7323,7 +7327,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7323
7327
  return vm;
7324
7328
  }
7325
7329
  }
7326
- Vue.version = `2.6.14-compat:${"3.5.21"}`;
7330
+ Vue.version = `2.6.14-compat:${"3.5.23"}`;
7327
7331
  Vue.config = singletonApp.config;
7328
7332
  Vue.use = (plugin, ...options) => {
7329
7333
  if (plugin && isFunction(plugin.install)) {
@@ -8769,15 +8773,25 @@ function baseCreateRenderer(options, createHydrationFns) {
8769
8773
  optimized
8770
8774
  );
8771
8775
  } else {
8772
- patchElement(
8773
- n1,
8774
- n2,
8775
- parentComponent,
8776
- parentSuspense,
8777
- namespace,
8778
- slotScopeIds,
8779
- optimized
8780
- );
8776
+ const customElement = !!(n1.el && n1.el._isVueCE) ? n1.el : null;
8777
+ try {
8778
+ if (customElement) {
8779
+ customElement._beginPatch();
8780
+ }
8781
+ patchElement(
8782
+ n1,
8783
+ n2,
8784
+ parentComponent,
8785
+ parentSuspense,
8786
+ namespace,
8787
+ slotScopeIds,
8788
+ optimized
8789
+ );
8790
+ } finally {
8791
+ if (customElement) {
8792
+ customElement._endPatch();
8793
+ }
8794
+ }
8781
8795
  }
8782
8796
  };
8783
8797
  const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
@@ -11082,7 +11096,8 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11082
11096
  pendingId,
11083
11097
  effects,
11084
11098
  parentComponent: parentComponent2,
11085
- container: container2
11099
+ container: container2,
11100
+ isInFallback
11086
11101
  } = suspense;
11087
11102
  let delayEnter = false;
11088
11103
  if (suspense.isHydrating) {
@@ -11099,6 +11114,9 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11099
11114
  0
11100
11115
  );
11101
11116
  queuePostFlushCb(effects);
11117
+ if (isInFallback && vnode2.ssFallback) {
11118
+ vnode2.ssFallback.el = null;
11119
+ }
11102
11120
  }
11103
11121
  };
11104
11122
  }
@@ -11107,6 +11125,9 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11107
11125
  anchor = next(activeBranch);
11108
11126
  }
11109
11127
  unmount(activeBranch, parentComponent2, suspense, true);
11128
+ if (!delayEnter && isInFallback && vnode2.ssFallback) {
11129
+ vnode2.ssFallback.el = null;
11130
+ }
11110
11131
  }
11111
11132
  if (!delayEnter) {
11112
11133
  move(pendingBranch, container2, anchor, 0);
@@ -11225,6 +11246,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11225
11246
  optimized2
11226
11247
  );
11227
11248
  if (placeholder) {
11249
+ vnode2.placeholder = null;
11228
11250
  remove(placeholder);
11229
11251
  }
11230
11252
  updateHOCHostEl(instance, vnode2.el);
@@ -12248,31 +12270,28 @@ const computed = (getterOrOptions, debugOptions) => {
12248
12270
  };
12249
12271
 
12250
12272
  function h(type, propsOrChildren, children) {
12251
- const doCreateVNode = (type2, props, children2) => {
12273
+ try {
12252
12274
  setBlockTracking(-1);
12253
- try {
12254
- return createVNode(type2, props, children2);
12255
- } finally {
12256
- setBlockTracking(1);
12257
- }
12258
- };
12259
- const l = arguments.length;
12260
- if (l === 2) {
12261
- if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
12262
- if (isVNode(propsOrChildren)) {
12263
- return doCreateVNode(type, null, [propsOrChildren]);
12275
+ const l = arguments.length;
12276
+ if (l === 2) {
12277
+ if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
12278
+ if (isVNode(propsOrChildren)) {
12279
+ return createVNode(type, null, [propsOrChildren]);
12280
+ }
12281
+ return createVNode(type, propsOrChildren);
12282
+ } else {
12283
+ return createVNode(type, null, propsOrChildren);
12264
12284
  }
12265
- return doCreateVNode(type, propsOrChildren);
12266
12285
  } else {
12267
- return doCreateVNode(type, null, propsOrChildren);
12268
- }
12269
- } else {
12270
- if (l > 3) {
12271
- children = Array.prototype.slice.call(arguments, 2);
12272
- } else if (l === 3 && isVNode(children)) {
12273
- children = [children];
12286
+ if (l > 3) {
12287
+ children = Array.prototype.slice.call(arguments, 2);
12288
+ } else if (l === 3 && isVNode(children)) {
12289
+ children = [children];
12290
+ }
12291
+ return createVNode(type, propsOrChildren, children);
12274
12292
  }
12275
- return doCreateVNode(type, propsOrChildren, children);
12293
+ } finally {
12294
+ setBlockTracking(1);
12276
12295
  }
12277
12296
  }
12278
12297
 
@@ -12482,7 +12501,7 @@ function isMemoSame(cached, memo) {
12482
12501
  return true;
12483
12502
  }
12484
12503
 
12485
- const version = "3.5.21";
12504
+ const version = "3.5.23";
12486
12505
  const warn = warn$1 ;
12487
12506
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12488
12507
  const devtools = devtools$1 ;
@@ -12752,11 +12771,11 @@ function resolveTransitionProps(rawProps) {
12752
12771
  addTransitionClass(el, legacyLeaveFromClass);
12753
12772
  }
12754
12773
  if (!el._enterCancelled) {
12755
- forceReflow();
12774
+ forceReflow(el);
12756
12775
  addTransitionClass(el, leaveActiveClass);
12757
12776
  } else {
12758
12777
  addTransitionClass(el, leaveActiveClass);
12759
- forceReflow();
12778
+ forceReflow(el);
12760
12779
  }
12761
12780
  nextFrame(() => {
12762
12781
  if (!el._isLeaving) {
@@ -12905,8 +12924,9 @@ function toMs(s) {
12905
12924
  if (s === "auto") return 0;
12906
12925
  return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
12907
12926
  }
12908
- function forceReflow() {
12909
- return document.body.offsetHeight;
12927
+ function forceReflow(el) {
12928
+ const targetDocument = el ? el.ownerDocument : document;
12929
+ return targetDocument.body.offsetHeight;
12910
12930
  }
12911
12931
 
12912
12932
  function patchClass(el, value, isSVG) {
@@ -13323,6 +13343,9 @@ function shouldSetAsProp(el, key, value, isSVG) {
13323
13343
  if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") {
13324
13344
  return false;
13325
13345
  }
13346
+ if (key === "sandbox" && el.tagName === "IFRAME") {
13347
+ return false;
13348
+ }
13326
13349
  if (key === "form") {
13327
13350
  return false;
13328
13351
  }
@@ -13383,6 +13406,8 @@ class VueElement extends BaseClass {
13383
13406
  this._nonce = this._def.nonce;
13384
13407
  this._connected = false;
13385
13408
  this._resolved = false;
13409
+ this._patching = false;
13410
+ this._dirty = false;
13386
13411
  this._numberProps = null;
13387
13412
  this._styleChildren = /* @__PURE__ */ new WeakSet();
13388
13413
  this._ob = null;
@@ -13395,7 +13420,11 @@ class VueElement extends BaseClass {
13395
13420
  );
13396
13421
  }
13397
13422
  if (_def.shadowRoot !== false) {
13398
- this.attachShadow({ mode: "open" });
13423
+ this.attachShadow(
13424
+ extend({}, _def.shadowRootOptions, {
13425
+ mode: "open"
13426
+ })
13427
+ );
13399
13428
  this._root = this.shadowRoot;
13400
13429
  } else {
13401
13430
  this._root = this;
@@ -13455,9 +13484,18 @@ class VueElement extends BaseClass {
13455
13484
  this._app && this._app.unmount();
13456
13485
  if (this._instance) this._instance.ce = void 0;
13457
13486
  this._app = this._instance = null;
13487
+ if (this._teleportTargets) {
13488
+ this._teleportTargets.clear();
13489
+ this._teleportTargets = void 0;
13490
+ }
13458
13491
  }
13459
13492
  });
13460
13493
  }
13494
+ _processMutations(mutations) {
13495
+ for (const m of mutations) {
13496
+ this._setAttr(m.attributeName);
13497
+ }
13498
+ }
13461
13499
  /**
13462
13500
  * resolve inner component definition (handle possible async component)
13463
13501
  */
@@ -13468,11 +13506,7 @@ class VueElement extends BaseClass {
13468
13506
  for (let i = 0; i < this.attributes.length; i++) {
13469
13507
  this._setAttr(this.attributes[i].name);
13470
13508
  }
13471
- this._ob = new MutationObserver((mutations) => {
13472
- for (const m of mutations) {
13473
- this._setAttr(m.attributeName);
13474
- }
13475
- });
13509
+ this._ob = new MutationObserver(this._processMutations.bind(this));
13476
13510
  this._ob.observe(this, { attributes: true });
13477
13511
  const resolve = (def, isAsync = false) => {
13478
13512
  this._resolved = true;
@@ -13549,7 +13583,7 @@ class VueElement extends BaseClass {
13549
13583
  return this._getProp(key);
13550
13584
  },
13551
13585
  set(val) {
13552
- this._setProp(key, val, true, true);
13586
+ this._setProp(key, val, true, !this._patching);
13553
13587
  }
13554
13588
  });
13555
13589
  }
@@ -13575,6 +13609,7 @@ class VueElement extends BaseClass {
13575
13609
  */
13576
13610
  _setProp(key, val, shouldReflect = true, shouldUpdate = false) {
13577
13611
  if (val !== this._props[key]) {
13612
+ this._dirty = true;
13578
13613
  if (val === REMOVAL) {
13579
13614
  delete this._props[key];
13580
13615
  } else {
@@ -13588,7 +13623,10 @@ class VueElement extends BaseClass {
13588
13623
  }
13589
13624
  if (shouldReflect) {
13590
13625
  const ob = this._ob;
13591
- ob && ob.disconnect();
13626
+ if (ob) {
13627
+ this._processMutations(ob.takeRecords());
13628
+ ob.disconnect();
13629
+ }
13592
13630
  if (val === true) {
13593
13631
  this.setAttribute(hyphenate(key), "");
13594
13632
  } else if (typeof val === "string" || typeof val === "number") {
@@ -13692,7 +13730,7 @@ class VueElement extends BaseClass {
13692
13730
  * Only called when shadowRoot is false
13693
13731
  */
13694
13732
  _renderSlots() {
13695
- const outlets = (this._teleportTarget || this).querySelectorAll("slot");
13733
+ const outlets = this._getSlots();
13696
13734
  const scopeId = this._instance.type.__scopeId;
13697
13735
  for (let i = 0; i < outlets.length; i++) {
13698
13736
  const o = outlets[i];
@@ -13718,12 +13756,45 @@ class VueElement extends BaseClass {
13718
13756
  parent.removeChild(o);
13719
13757
  }
13720
13758
  }
13759
+ /**
13760
+ * @internal
13761
+ */
13762
+ _getSlots() {
13763
+ const roots = [this];
13764
+ if (this._teleportTargets) {
13765
+ roots.push(...this._teleportTargets);
13766
+ }
13767
+ const slots = /* @__PURE__ */ new Set();
13768
+ for (const root of roots) {
13769
+ const found = root.querySelectorAll("slot");
13770
+ for (let i = 0; i < found.length; i++) {
13771
+ slots.add(found[i]);
13772
+ }
13773
+ }
13774
+ return Array.from(slots);
13775
+ }
13721
13776
  /**
13722
13777
  * @internal
13723
13778
  */
13724
13779
  _injectChildStyle(comp) {
13725
13780
  this._applyStyles(comp.styles, comp);
13726
13781
  }
13782
+ /**
13783
+ * @internal
13784
+ */
13785
+ _beginPatch() {
13786
+ this._patching = true;
13787
+ this._dirty = false;
13788
+ }
13789
+ /**
13790
+ * @internal
13791
+ */
13792
+ _endPatch() {
13793
+ this._patching = false;
13794
+ if (this._dirty && this._instance) {
13795
+ this._update();
13796
+ }
13797
+ }
13727
13798
  /**
13728
13799
  * @internal
13729
13800
  */
@@ -13822,7 +13893,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
13822
13893
  prevChildren.forEach(callPendingCbs);
13823
13894
  prevChildren.forEach(recordPosition);
13824
13895
  const movedChildren = prevChildren.filter(applyTranslation);
13825
- forceReflow();
13896
+ forceReflow(instance.vnode.el);
13826
13897
  movedChildren.forEach((c) => {
13827
13898
  const el = c.el;
13828
13899
  const style = el.style;
@@ -13867,10 +13938,10 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
13867
13938
  instance
13868
13939
  )
13869
13940
  );
13870
- positionMap.set(
13871
- child,
13872
- child.el.getBoundingClientRect()
13873
- );
13941
+ positionMap.set(child, {
13942
+ left: child.el.offsetLeft,
13943
+ top: child.el.offsetTop
13944
+ });
13874
13945
  }
13875
13946
  }
13876
13947
  }
@@ -13901,7 +13972,10 @@ function callPendingCbs(c) {
13901
13972
  }
13902
13973
  }
13903
13974
  function recordPosition(c) {
13904
- newPositionMap.set(c, c.el.getBoundingClientRect());
13975
+ newPositionMap.set(c, {
13976
+ left: c.el.offsetLeft,
13977
+ top: c.el.offsetTop
13978
+ });
13905
13979
  }
13906
13980
  function applyTranslation(c) {
13907
13981
  const oldPos = positionMap.get(c);
@@ -13947,24 +14021,22 @@ function onCompositionEnd(e) {
13947
14021
  }
13948
14022
  }
13949
14023
  const assignKey = Symbol("_assign");
14024
+ function castValue(value, trim, number) {
14025
+ if (trim) value = value.trim();
14026
+ if (number) value = looseToNumber(value);
14027
+ return value;
14028
+ }
13950
14029
  const vModelText = {
13951
14030
  created(el, { modifiers: { lazy, trim, number } }, vnode) {
13952
14031
  el[assignKey] = getModelAssigner(vnode);
13953
14032
  const castToNumber = number || vnode.props && vnode.props.type === "number";
13954
14033
  addEventListener(el, lazy ? "change" : "input", (e) => {
13955
14034
  if (e.target.composing) return;
13956
- let domValue = el.value;
13957
- if (trim) {
13958
- domValue = domValue.trim();
13959
- }
13960
- if (castToNumber) {
13961
- domValue = looseToNumber(domValue);
13962
- }
13963
- el[assignKey](domValue);
14035
+ el[assignKey](castValue(el.value, trim, castToNumber));
13964
14036
  });
13965
- if (trim) {
14037
+ if (trim || castToNumber) {
13966
14038
  addEventListener(el, "change", () => {
13967
- el.value = el.value.trim();
14039
+ el.value = castValue(el.value, trim, castToNumber);
13968
14040
  });
13969
14041
  }
13970
14042
  if (!lazy) {
@@ -15938,16 +16010,34 @@ function walkIdentifiers(root, onIdentifier, includeAll = false, parentStack = [
15938
16010
  (id) => markScopeIdentifier(node, id, knownIds)
15939
16011
  );
15940
16012
  }
16013
+ } else if (node.type === "SwitchStatement") {
16014
+ if (node.scopeIds) {
16015
+ node.scopeIds.forEach((id) => markKnownIds(id, knownIds));
16016
+ } else {
16017
+ walkSwitchStatement(
16018
+ node,
16019
+ false,
16020
+ (id) => markScopeIdentifier(node, id, knownIds)
16021
+ );
16022
+ }
15941
16023
  } else if (node.type === "CatchClause" && node.param) {
15942
- for (const id of extractIdentifiers(node.param)) {
15943
- markScopeIdentifier(node, id, knownIds);
16024
+ if (node.scopeIds) {
16025
+ node.scopeIds.forEach((id) => markKnownIds(id, knownIds));
16026
+ } else {
16027
+ for (const id of extractIdentifiers(node.param)) {
16028
+ markScopeIdentifier(node, id, knownIds);
16029
+ }
15944
16030
  }
15945
16031
  } else if (isForStatement(node)) {
15946
- walkForStatement(
15947
- node,
15948
- false,
15949
- (id) => markScopeIdentifier(node, id, knownIds)
15950
- );
16032
+ if (node.scopeIds) {
16033
+ node.scopeIds.forEach((id) => markKnownIds(id, knownIds));
16034
+ } else {
16035
+ walkForStatement(
16036
+ node,
16037
+ false,
16038
+ (id) => markScopeIdentifier(node, id, knownIds)
16039
+ );
16040
+ }
15951
16041
  }
15952
16042
  },
15953
16043
  leave(node, parent) {
@@ -16018,7 +16108,8 @@ function walkFunctionParams(node, onIdent) {
16018
16108
  }
16019
16109
  }
16020
16110
  function walkBlockDeclarations(block, onIdent) {
16021
- for (const stmt of block.body) {
16111
+ const body = block.type === "SwitchCase" ? block.consequent : block.body;
16112
+ for (const stmt of body) {
16022
16113
  if (stmt.type === "VariableDeclaration") {
16023
16114
  if (stmt.declare) continue;
16024
16115
  for (const decl of stmt.declarations) {
@@ -16031,6 +16122,8 @@ function walkBlockDeclarations(block, onIdent) {
16031
16122
  onIdent(stmt.id);
16032
16123
  } else if (isForStatement(stmt)) {
16033
16124
  walkForStatement(stmt, true, onIdent);
16125
+ } else if (stmt.type === "SwitchStatement") {
16126
+ walkSwitchStatement(stmt, true, onIdent);
16034
16127
  }
16035
16128
  }
16036
16129
  }
@@ -16047,6 +16140,20 @@ function walkForStatement(stmt, isVar, onIdent) {
16047
16140
  }
16048
16141
  }
16049
16142
  }
16143
+ function walkSwitchStatement(stmt, isVar, onIdent) {
16144
+ for (const cs of stmt.cases) {
16145
+ for (const stmt2 of cs.consequent) {
16146
+ if (stmt2.type === "VariableDeclaration" && (stmt2.kind === "var" ? isVar : !isVar)) {
16147
+ for (const decl of stmt2.declarations) {
16148
+ for (const id of extractIdentifiers(decl.id)) {
16149
+ onIdent(id);
16150
+ }
16151
+ }
16152
+ }
16153
+ }
16154
+ walkBlockDeclarations(cs, onIdent);
16155
+ }
16156
+ }
16050
16157
  function extractIdentifiers(param, nodes = []) {
16051
16158
  switch (param.type) {
16052
16159
  case "Identifier":
@@ -16282,6 +16389,7 @@ function isCoreComponent(tag) {
16282
16389
  }
16283
16390
  const nonIdentifierRE = /^$|^\d|[^\$\w\xA0-\uFFFF]/;
16284
16391
  const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
16392
+ const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
16285
16393
  const getExpSource = (exp) => exp.type === 4 ? exp.content : exp.loc.source;
16286
16394
  const isMemberExpressionNode = (exp, context) => {
16287
16395
  try {
@@ -18857,14 +18965,17 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
18857
18965
  knownIds
18858
18966
  );
18859
18967
  const children = [];
18968
+ const isTSNode = TS_NODE_TYPES.includes(ast.type);
18860
18969
  ids.sort((a, b) => a.start - b.start);
18861
18970
  ids.forEach((id, i) => {
18862
18971
  const start = id.start - 1;
18863
18972
  const end = id.end - 1;
18864
18973
  const last = ids[i - 1];
18865
- const leadingText = rawExp.slice(last ? last.end - 1 : 0, start);
18866
- if (leadingText.length || id.prefix) {
18867
- children.push(leadingText + (id.prefix || ``));
18974
+ if (!(isTSNode && i === 0)) {
18975
+ const leadingText = rawExp.slice(last ? last.end - 1 : 0, start);
18976
+ if (leadingText.length || id.prefix) {
18977
+ children.push(leadingText + (id.prefix || ``));
18978
+ }
18868
18979
  }
18869
18980
  const source = rawExp.slice(start, end);
18870
18981
  children.push(
@@ -18879,7 +18990,7 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
18879
18990
  id.isConstant ? 3 : 0
18880
18991
  )
18881
18992
  );
18882
- if (i === ids.length - 1 && end < rawExp.length) {
18993
+ if (i === ids.length - 1 && end < rawExp.length && !isTSNode) {
18883
18994
  children.push(rawExp.slice(end));
18884
18995
  }
18885
18996
  });
@@ -19135,90 +19246,6 @@ function getParentCondition(node) {
19135
19246
  }
19136
19247
  }
19137
19248
 
19138
- const transformBind = (dir, _node, context) => {
19139
- const { modifiers, loc } = dir;
19140
- const arg = dir.arg;
19141
- let { exp } = dir;
19142
- if (exp && exp.type === 4 && !exp.content.trim()) {
19143
- {
19144
- context.onError(
19145
- createCompilerError(34, loc)
19146
- );
19147
- return {
19148
- props: [
19149
- createObjectProperty(arg, createSimpleExpression("", true, loc))
19150
- ]
19151
- };
19152
- }
19153
- }
19154
- if (!exp) {
19155
- if (arg.type !== 4 || !arg.isStatic) {
19156
- context.onError(
19157
- createCompilerError(
19158
- 52,
19159
- arg.loc
19160
- )
19161
- );
19162
- return {
19163
- props: [
19164
- createObjectProperty(arg, createSimpleExpression("", true, loc))
19165
- ]
19166
- };
19167
- }
19168
- transformBindShorthand(dir, context);
19169
- exp = dir.exp;
19170
- }
19171
- if (arg.type !== 4) {
19172
- arg.children.unshift(`(`);
19173
- arg.children.push(`) || ""`);
19174
- } else if (!arg.isStatic) {
19175
- arg.content = arg.content ? `${arg.content} || ""` : `""`;
19176
- }
19177
- if (modifiers.some((mod) => mod.content === "camel")) {
19178
- if (arg.type === 4) {
19179
- if (arg.isStatic) {
19180
- arg.content = camelize(arg.content);
19181
- } else {
19182
- arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
19183
- }
19184
- } else {
19185
- arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
19186
- arg.children.push(`)`);
19187
- }
19188
- }
19189
- if (!context.inSSR) {
19190
- if (modifiers.some((mod) => mod.content === "prop")) {
19191
- injectPrefix(arg, ".");
19192
- }
19193
- if (modifiers.some((mod) => mod.content === "attr")) {
19194
- injectPrefix(arg, "^");
19195
- }
19196
- }
19197
- return {
19198
- props: [createObjectProperty(arg, exp)]
19199
- };
19200
- };
19201
- const transformBindShorthand = (dir, context) => {
19202
- const arg = dir.arg;
19203
- const propName = camelize(arg.content);
19204
- dir.exp = createSimpleExpression(propName, false, arg.loc);
19205
- {
19206
- dir.exp = processExpression(dir.exp, context);
19207
- }
19208
- };
19209
- const injectPrefix = (arg, prefix) => {
19210
- if (arg.type === 4) {
19211
- if (arg.isStatic) {
19212
- arg.content = prefix + arg.content;
19213
- } else {
19214
- arg.content = `\`${prefix}\${${arg.content}}\``;
19215
- }
19216
- } else {
19217
- arg.children.unshift(`'${prefix}' + (`);
19218
- arg.children.push(`)`);
19219
- }
19220
- };
19221
-
19222
19249
  const transformFor = createStructuralDirectiveTransform(
19223
19250
  "for",
19224
19251
  (node, dir, context) => {
@@ -19231,9 +19258,6 @@ const transformFor = createStructuralDirectiveTransform(
19231
19258
  const memo = findDir(node, "memo");
19232
19259
  const keyProp = findProp(node, `key`, false, true);
19233
19260
  const isDirKey = keyProp && keyProp.type === 7;
19234
- if (isDirKey && !keyProp.exp) {
19235
- transformBindShorthand(keyProp, context);
19236
- }
19237
19261
  let keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
19238
19262
  if (memo && keyExp && isDirKey) {
19239
19263
  {
@@ -20549,6 +20573,65 @@ const transformOn$1 = (dir, node, context, augmentor) => {
20549
20573
  return ret;
20550
20574
  };
20551
20575
 
20576
+ const transformBind = (dir, _node, context) => {
20577
+ const { modifiers, loc } = dir;
20578
+ const arg = dir.arg;
20579
+ let { exp } = dir;
20580
+ if (exp && exp.type === 4 && !exp.content.trim()) {
20581
+ {
20582
+ context.onError(
20583
+ createCompilerError(34, loc)
20584
+ );
20585
+ return {
20586
+ props: [
20587
+ createObjectProperty(arg, createSimpleExpression("", true, loc))
20588
+ ]
20589
+ };
20590
+ }
20591
+ }
20592
+ if (arg.type !== 4) {
20593
+ arg.children.unshift(`(`);
20594
+ arg.children.push(`) || ""`);
20595
+ } else if (!arg.isStatic) {
20596
+ arg.content = arg.content ? `${arg.content} || ""` : `""`;
20597
+ }
20598
+ if (modifiers.some((mod) => mod.content === "camel")) {
20599
+ if (arg.type === 4) {
20600
+ if (arg.isStatic) {
20601
+ arg.content = camelize(arg.content);
20602
+ } else {
20603
+ arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
20604
+ }
20605
+ } else {
20606
+ arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
20607
+ arg.children.push(`)`);
20608
+ }
20609
+ }
20610
+ if (!context.inSSR) {
20611
+ if (modifiers.some((mod) => mod.content === "prop")) {
20612
+ injectPrefix(arg, ".");
20613
+ }
20614
+ if (modifiers.some((mod) => mod.content === "attr")) {
20615
+ injectPrefix(arg, "^");
20616
+ }
20617
+ }
20618
+ return {
20619
+ props: [createObjectProperty(arg, exp)]
20620
+ };
20621
+ };
20622
+ const injectPrefix = (arg, prefix) => {
20623
+ if (arg.type === 4) {
20624
+ if (arg.isStatic) {
20625
+ arg.content = prefix + arg.content;
20626
+ } else {
20627
+ arg.content = `\`${prefix}\${${arg.content}}\``;
20628
+ }
20629
+ } else {
20630
+ arg.children.unshift(`'${prefix}' + (`);
20631
+ arg.children.push(`)`);
20632
+ }
20633
+ };
20634
+
20552
20635
  const transformText = (node, context) => {
20553
20636
  if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) {
20554
20637
  return () => {
@@ -20904,9 +20987,36 @@ const transformMemo = (node, context) => {
20904
20987
  }
20905
20988
  };
20906
20989
 
20990
+ const transformVBindShorthand = (node, context) => {
20991
+ if (node.type === 1) {
20992
+ for (const prop of node.props) {
20993
+ if (prop.type === 7 && prop.name === "bind" && (!prop.exp || // #13930 :foo in in-DOM templates will be parsed into :foo="" by browser
20994
+ false) && prop.arg) {
20995
+ const arg = prop.arg;
20996
+ if (arg.type !== 4 || !arg.isStatic) {
20997
+ context.onError(
20998
+ createCompilerError(
20999
+ 52,
21000
+ arg.loc
21001
+ )
21002
+ );
21003
+ prop.exp = createSimpleExpression("", true, arg.loc);
21004
+ } else {
21005
+ const propName = camelize(arg.content);
21006
+ if (validFirstIdentCharRE.test(propName[0]) || // allow hyphen first char for https://github.com/vuejs/language-tools/pull/3424
21007
+ propName[0] === "-") {
21008
+ prop.exp = createSimpleExpression(propName, false, arg.loc);
21009
+ }
21010
+ }
21011
+ }
21012
+ }
21013
+ }
21014
+ };
21015
+
20907
21016
  function getBaseTransformPreset(prefixIdentifiers) {
20908
21017
  return [
20909
21018
  [
21019
+ transformVBindShorthand,
20910
21020
  transformOnce,
20911
21021
  transformIf,
20912
21022
  transformMemo,
@@ -21468,6 +21578,9 @@ function analyzeNode(node) {
21468
21578
  if (node.type === 1 && isNonStringifiable(node.tag)) {
21469
21579
  return false;
21470
21580
  }
21581
+ if (node.type === 1 && findDir(node, "once", true)) {
21582
+ return false;
21583
+ }
21471
21584
  if (node.type === 12) {
21472
21585
  return [1, 0];
21473
21586
  }