@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.
@@ -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
  **/
@@ -1113,7 +1113,7 @@ function iterator(self, method, wrapValue) {
1113
1113
  iter._next = iter.next;
1114
1114
  iter.next = () => {
1115
1115
  const result = iter._next();
1116
- if (result.value) {
1116
+ if (!result.done) {
1117
1117
  result.value = wrapValue(result.value);
1118
1118
  }
1119
1119
  return result;
@@ -1240,7 +1240,8 @@ class BaseReactiveHandler {
1240
1240
  return res;
1241
1241
  }
1242
1242
  if (isRef(res)) {
1243
- return targetIsArray && isIntegerKey(key) ? res : res.value;
1243
+ const value = targetIsArray && isIntegerKey(key) ? res : res.value;
1244
+ return isReadonly2 && isObject(value) ? readonly(value) : value;
1244
1245
  }
1245
1246
  if (isObject(res)) {
1246
1247
  return isReadonly2 ? readonly(res) : reactive(res);
@@ -2721,9 +2722,6 @@ const TeleportImpl = {
2721
2722
  insert(mainAnchor, container, anchor);
2722
2723
  const mount = (container2, anchor2) => {
2723
2724
  if (shapeFlag & 16) {
2724
- if (parentComponent && parentComponent.isCE) {
2725
- parentComponent.ce._teleportTarget = container2;
2726
- }
2727
2725
  mountChildren(
2728
2726
  children,
2729
2727
  container2,
@@ -2745,6 +2743,9 @@ const TeleportImpl = {
2745
2743
  } else if (namespace !== "mathml" && isTargetMathML(target)) {
2746
2744
  namespace = "mathml";
2747
2745
  }
2746
+ if (parentComponent && parentComponent.isCE) {
2747
+ (parentComponent.ce._teleportTargets || (parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target);
2748
+ }
2748
2749
  if (!disabled) {
2749
2750
  mount(target, targetAnchor);
2750
2751
  updateCssVars(n2, false);
@@ -3766,7 +3767,9 @@ function createHydrationFunctions(rendererInternals) {
3766
3767
  if (clientText[0] === "\n" && (el.tagName === "PRE" || el.tagName === "TEXTAREA")) {
3767
3768
  clientText = clientText.slice(1);
3768
3769
  }
3769
- if (el.textContent !== clientText) {
3770
+ const { textContent } = el;
3771
+ if (textContent !== clientText && // innerHTML normalize \r\n or \r into a single \n in the DOM
3772
+ textContent !== clientText.replace(/\r\n|\r/g, "\n")) {
3770
3773
  if (!isMismatchAllowed(el, 0 /* TEXT */)) {
3771
3774
  logMismatchError();
3772
3775
  }
@@ -4212,7 +4215,10 @@ function defineAsyncComponent(source) {
4212
4215
  error: error.value
4213
4216
  });
4214
4217
  } else if (loadingComponent && !delayed.value) {
4215
- return createVNode(loadingComponent);
4218
+ return createInnerComp(
4219
+ loadingComponent,
4220
+ instance
4221
+ );
4216
4222
  }
4217
4223
  };
4218
4224
  }
@@ -4928,12 +4934,13 @@ function createSlots(slots, dynamicSlots) {
4928
4934
 
4929
4935
  function renderSlot(slots, name, props = {}, fallback, noSlotted) {
4930
4936
  if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
4937
+ const hasProps = Object.keys(props).length > 0;
4931
4938
  if (name !== "default") props.name = name;
4932
4939
  return openBlock(), createBlock(
4933
4940
  Fragment,
4934
4941
  null,
4935
4942
  [createVNode("slot", props, fallback && fallback())],
4936
- 64
4943
+ hasProps ? -2 : 64
4937
4944
  );
4938
4945
  }
4939
4946
  let slot = slots[name];
@@ -5865,7 +5872,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
5865
5872
  return vm;
5866
5873
  }
5867
5874
  }
5868
- Vue.version = `2.6.14-compat:${"3.5.21"}`;
5875
+ Vue.version = `2.6.14-compat:${"3.5.23"}`;
5869
5876
  Vue.config = singletonApp.config;
5870
5877
  Vue.use = (plugin, ...options) => {
5871
5878
  if (plugin && isFunction(plugin.install)) {
@@ -6980,15 +6987,25 @@ function baseCreateRenderer(options, createHydrationFns) {
6980
6987
  optimized
6981
6988
  );
6982
6989
  } else {
6983
- patchElement(
6984
- n1,
6985
- n2,
6986
- parentComponent,
6987
- parentSuspense,
6988
- namespace,
6989
- slotScopeIds,
6990
- optimized
6991
- );
6990
+ const customElement = !!(n1.el && n1.el._isVueCE) ? n1.el : null;
6991
+ try {
6992
+ if (customElement) {
6993
+ customElement._beginPatch();
6994
+ }
6995
+ patchElement(
6996
+ n1,
6997
+ n2,
6998
+ parentComponent,
6999
+ parentSuspense,
7000
+ namespace,
7001
+ slotScopeIds,
7002
+ optimized
7003
+ );
7004
+ } finally {
7005
+ if (customElement) {
7006
+ customElement._endPatch();
7007
+ }
7008
+ }
6992
7009
  }
6993
7010
  };
6994
7011
  const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
@@ -8993,7 +9010,8 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
8993
9010
  pendingId,
8994
9011
  effects,
8995
9012
  parentComponent: parentComponent2,
8996
- container: container2
9013
+ container: container2,
9014
+ isInFallback
8997
9015
  } = suspense;
8998
9016
  let delayEnter = false;
8999
9017
  if (suspense.isHydrating) {
@@ -9010,6 +9028,9 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
9010
9028
  0
9011
9029
  );
9012
9030
  queuePostFlushCb(effects);
9031
+ if (isInFallback && vnode2.ssFallback) {
9032
+ vnode2.ssFallback.el = null;
9033
+ }
9013
9034
  }
9014
9035
  };
9015
9036
  }
@@ -9018,6 +9039,9 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
9018
9039
  anchor = next(activeBranch);
9019
9040
  }
9020
9041
  unmount(activeBranch, parentComponent2, suspense, true);
9042
+ if (!delayEnter && isInFallback && vnode2.ssFallback) {
9043
+ vnode2.ssFallback.el = null;
9044
+ }
9021
9045
  }
9022
9046
  if (!delayEnter) {
9023
9047
  move(pendingBranch, container2, anchor, 0);
@@ -9133,6 +9157,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
9133
9157
  optimized2
9134
9158
  );
9135
9159
  if (placeholder) {
9160
+ vnode2.placeholder = null;
9136
9161
  remove(placeholder);
9137
9162
  }
9138
9163
  updateHOCHostEl(instance, vnode2.el);
@@ -9965,31 +9990,28 @@ const computed = (getterOrOptions, debugOptions) => {
9965
9990
  };
9966
9991
 
9967
9992
  function h(type, propsOrChildren, children) {
9968
- const doCreateVNode = (type2, props, children2) => {
9993
+ try {
9969
9994
  setBlockTracking(-1);
9970
- try {
9971
- return createVNode(type2, props, children2);
9972
- } finally {
9973
- setBlockTracking(1);
9974
- }
9975
- };
9976
- const l = arguments.length;
9977
- if (l === 2) {
9978
- if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
9979
- if (isVNode(propsOrChildren)) {
9980
- return doCreateVNode(type, null, [propsOrChildren]);
9995
+ const l = arguments.length;
9996
+ if (l === 2) {
9997
+ if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
9998
+ if (isVNode(propsOrChildren)) {
9999
+ return createVNode(type, null, [propsOrChildren]);
10000
+ }
10001
+ return createVNode(type, propsOrChildren);
10002
+ } else {
10003
+ return createVNode(type, null, propsOrChildren);
9981
10004
  }
9982
- return doCreateVNode(type, propsOrChildren);
9983
10005
  } else {
9984
- return doCreateVNode(type, null, propsOrChildren);
9985
- }
9986
- } else {
9987
- if (l > 3) {
9988
- children = Array.prototype.slice.call(arguments, 2);
9989
- } else if (l === 3 && isVNode(children)) {
9990
- children = [children];
10006
+ if (l > 3) {
10007
+ children = Array.prototype.slice.call(arguments, 2);
10008
+ } else if (l === 3 && isVNode(children)) {
10009
+ children = [children];
10010
+ }
10011
+ return createVNode(type, propsOrChildren, children);
9991
10012
  }
9992
- return doCreateVNode(type, propsOrChildren, children);
10013
+ } finally {
10014
+ setBlockTracking(1);
9993
10015
  }
9994
10016
  }
9995
10017
 
@@ -10025,7 +10047,7 @@ function isMemoSame(cached, memo) {
10025
10047
  return true;
10026
10048
  }
10027
10049
 
10028
- const version = "3.5.21";
10050
+ const version = "3.5.23";
10029
10051
  const warn$1 = NOOP;
10030
10052
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10031
10053
  const devtools = void 0;
@@ -10294,11 +10316,11 @@ function resolveTransitionProps(rawProps) {
10294
10316
  addTransitionClass(el, legacyLeaveFromClass);
10295
10317
  }
10296
10318
  if (!el._enterCancelled) {
10297
- forceReflow();
10319
+ forceReflow(el);
10298
10320
  addTransitionClass(el, leaveActiveClass);
10299
10321
  } else {
10300
10322
  addTransitionClass(el, leaveActiveClass);
10301
- forceReflow();
10323
+ forceReflow(el);
10302
10324
  }
10303
10325
  nextFrame(() => {
10304
10326
  if (!el._isLeaving) {
@@ -10444,8 +10466,9 @@ function toMs(s) {
10444
10466
  if (s === "auto") return 0;
10445
10467
  return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
10446
10468
  }
10447
- function forceReflow() {
10448
- return document.body.offsetHeight;
10469
+ function forceReflow(el) {
10470
+ const targetDocument = el ? el.ownerDocument : document;
10471
+ return targetDocument.body.offsetHeight;
10449
10472
  }
10450
10473
 
10451
10474
  function patchClass(el, value, isSVG) {
@@ -10833,6 +10856,9 @@ function shouldSetAsProp(el, key, value, isSVG) {
10833
10856
  if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") {
10834
10857
  return false;
10835
10858
  }
10859
+ if (key === "sandbox" && el.tagName === "IFRAME") {
10860
+ return false;
10861
+ }
10836
10862
  if (key === "form") {
10837
10863
  return false;
10838
10864
  }
@@ -10893,6 +10919,8 @@ class VueElement extends BaseClass {
10893
10919
  this._nonce = this._def.nonce;
10894
10920
  this._connected = false;
10895
10921
  this._resolved = false;
10922
+ this._patching = false;
10923
+ this._dirty = false;
10896
10924
  this._numberProps = null;
10897
10925
  this._styleChildren = /* @__PURE__ */ new WeakSet();
10898
10926
  this._ob = null;
@@ -10900,7 +10928,11 @@ class VueElement extends BaseClass {
10900
10928
  this._root = this.shadowRoot;
10901
10929
  } else {
10902
10930
  if (_def.shadowRoot !== false) {
10903
- this.attachShadow({ mode: "open" });
10931
+ this.attachShadow(
10932
+ extend$1({}, _def.shadowRootOptions, {
10933
+ mode: "open"
10934
+ })
10935
+ );
10904
10936
  this._root = this.shadowRoot;
10905
10937
  } else {
10906
10938
  this._root = this;
@@ -10960,9 +10992,18 @@ class VueElement extends BaseClass {
10960
10992
  this._app && this._app.unmount();
10961
10993
  if (this._instance) this._instance.ce = void 0;
10962
10994
  this._app = this._instance = null;
10995
+ if (this._teleportTargets) {
10996
+ this._teleportTargets.clear();
10997
+ this._teleportTargets = void 0;
10998
+ }
10963
10999
  }
10964
11000
  });
10965
11001
  }
11002
+ _processMutations(mutations) {
11003
+ for (const m of mutations) {
11004
+ this._setAttr(m.attributeName);
11005
+ }
11006
+ }
10966
11007
  /**
10967
11008
  * resolve inner component definition (handle possible async component)
10968
11009
  */
@@ -10973,11 +11014,7 @@ class VueElement extends BaseClass {
10973
11014
  for (let i = 0; i < this.attributes.length; i++) {
10974
11015
  this._setAttr(this.attributes[i].name);
10975
11016
  }
10976
- this._ob = new MutationObserver((mutations) => {
10977
- for (const m of mutations) {
10978
- this._setAttr(m.attributeName);
10979
- }
10980
- });
11017
+ this._ob = new MutationObserver(this._processMutations.bind(this));
10981
11018
  this._ob.observe(this, { attributes: true });
10982
11019
  const resolve = (def, isAsync = false) => {
10983
11020
  this._resolved = true;
@@ -11045,7 +11082,7 @@ class VueElement extends BaseClass {
11045
11082
  return this._getProp(key);
11046
11083
  },
11047
11084
  set(val) {
11048
- this._setProp(key, val, true, true);
11085
+ this._setProp(key, val, true, !this._patching);
11049
11086
  }
11050
11087
  });
11051
11088
  }
@@ -11071,6 +11108,7 @@ class VueElement extends BaseClass {
11071
11108
  */
11072
11109
  _setProp(key, val, shouldReflect = true, shouldUpdate = false) {
11073
11110
  if (val !== this._props[key]) {
11111
+ this._dirty = true;
11074
11112
  if (val === REMOVAL) {
11075
11113
  delete this._props[key];
11076
11114
  } else {
@@ -11084,7 +11122,10 @@ class VueElement extends BaseClass {
11084
11122
  }
11085
11123
  if (shouldReflect) {
11086
11124
  const ob = this._ob;
11087
- ob && ob.disconnect();
11125
+ if (ob) {
11126
+ this._processMutations(ob.takeRecords());
11127
+ ob.disconnect();
11128
+ }
11088
11129
  if (val === true) {
11089
11130
  this.setAttribute(hyphenate(key), "");
11090
11131
  } else if (typeof val === "string" || typeof val === "number") {
@@ -11163,7 +11204,7 @@ class VueElement extends BaseClass {
11163
11204
  * Only called when shadowRoot is false
11164
11205
  */
11165
11206
  _renderSlots() {
11166
- const outlets = (this._teleportTarget || this).querySelectorAll("slot");
11207
+ const outlets = this._getSlots();
11167
11208
  const scopeId = this._instance.type.__scopeId;
11168
11209
  for (let i = 0; i < outlets.length; i++) {
11169
11210
  const o = outlets[i];
@@ -11189,12 +11230,45 @@ class VueElement extends BaseClass {
11189
11230
  parent.removeChild(o);
11190
11231
  }
11191
11232
  }
11233
+ /**
11234
+ * @internal
11235
+ */
11236
+ _getSlots() {
11237
+ const roots = [this];
11238
+ if (this._teleportTargets) {
11239
+ roots.push(...this._teleportTargets);
11240
+ }
11241
+ const slots = /* @__PURE__ */ new Set();
11242
+ for (const root of roots) {
11243
+ const found = root.querySelectorAll("slot");
11244
+ for (let i = 0; i < found.length; i++) {
11245
+ slots.add(found[i]);
11246
+ }
11247
+ }
11248
+ return Array.from(slots);
11249
+ }
11192
11250
  /**
11193
11251
  * @internal
11194
11252
  */
11195
11253
  _injectChildStyle(comp) {
11196
11254
  this._applyStyles(comp.styles, comp);
11197
11255
  }
11256
+ /**
11257
+ * @internal
11258
+ */
11259
+ _beginPatch() {
11260
+ this._patching = true;
11261
+ this._dirty = false;
11262
+ }
11263
+ /**
11264
+ * @internal
11265
+ */
11266
+ _endPatch() {
11267
+ this._patching = false;
11268
+ if (this._dirty && this._instance) {
11269
+ this._update();
11270
+ }
11271
+ }
11198
11272
  /**
11199
11273
  * @internal
11200
11274
  */
@@ -11270,7 +11344,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
11270
11344
  prevChildren.forEach(callPendingCbs);
11271
11345
  prevChildren.forEach(recordPosition);
11272
11346
  const movedChildren = prevChildren.filter(applyTranslation);
11273
- forceReflow();
11347
+ forceReflow(instance.vnode.el);
11274
11348
  movedChildren.forEach((c) => {
11275
11349
  const el = c.el;
11276
11350
  const style = el.style;
@@ -11315,10 +11389,10 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
11315
11389
  instance
11316
11390
  )
11317
11391
  );
11318
- positionMap.set(
11319
- child,
11320
- child.el.getBoundingClientRect()
11321
- );
11392
+ positionMap.set(child, {
11393
+ left: child.el.offsetLeft,
11394
+ top: child.el.offsetTop
11395
+ });
11322
11396
  }
11323
11397
  }
11324
11398
  }
@@ -11347,7 +11421,10 @@ function callPendingCbs(c) {
11347
11421
  }
11348
11422
  }
11349
11423
  function recordPosition(c) {
11350
- newPositionMap.set(c, c.el.getBoundingClientRect());
11424
+ newPositionMap.set(c, {
11425
+ left: c.el.offsetLeft,
11426
+ top: c.el.offsetTop
11427
+ });
11351
11428
  }
11352
11429
  function applyTranslation(c) {
11353
11430
  const oldPos = positionMap.get(c);
@@ -11393,24 +11470,22 @@ function onCompositionEnd(e) {
11393
11470
  }
11394
11471
  }
11395
11472
  const assignKey = Symbol("_assign");
11473
+ function castValue(value, trim, number) {
11474
+ if (trim) value = value.trim();
11475
+ if (number) value = looseToNumber(value);
11476
+ return value;
11477
+ }
11396
11478
  const vModelText = {
11397
11479
  created(el, { modifiers: { lazy, trim, number } }, vnode) {
11398
11480
  el[assignKey] = getModelAssigner(vnode);
11399
11481
  const castToNumber = number || vnode.props && vnode.props.type === "number";
11400
11482
  addEventListener(el, lazy ? "change" : "input", (e) => {
11401
11483
  if (e.target.composing) return;
11402
- let domValue = el.value;
11403
- if (trim) {
11404
- domValue = domValue.trim();
11405
- }
11406
- if (castToNumber) {
11407
- domValue = looseToNumber(domValue);
11408
- }
11409
- el[assignKey](domValue);
11484
+ el[assignKey](castValue(el.value, trim, castToNumber));
11410
11485
  });
11411
- if (trim) {
11486
+ if (trim || castToNumber) {
11412
11487
  addEventListener(el, "change", () => {
11413
- el.value = el.value.trim();
11488
+ el.value = castValue(el.value, trim, castToNumber);
11414
11489
  });
11415
11490
  }
11416
11491
  if (!lazy) {
@@ -13260,16 +13335,34 @@ function walkIdentifiers(root, onIdentifier, includeAll = false, parentStack = [
13260
13335
  (id) => markScopeIdentifier(node, id, knownIds)
13261
13336
  );
13262
13337
  }
13338
+ } else if (node.type === "SwitchStatement") {
13339
+ if (node.scopeIds) {
13340
+ node.scopeIds.forEach((id) => markKnownIds(id, knownIds));
13341
+ } else {
13342
+ walkSwitchStatement(
13343
+ node,
13344
+ false,
13345
+ (id) => markScopeIdentifier(node, id, knownIds)
13346
+ );
13347
+ }
13263
13348
  } else if (node.type === "CatchClause" && node.param) {
13264
- for (const id of extractIdentifiers(node.param)) {
13265
- markScopeIdentifier(node, id, knownIds);
13349
+ if (node.scopeIds) {
13350
+ node.scopeIds.forEach((id) => markKnownIds(id, knownIds));
13351
+ } else {
13352
+ for (const id of extractIdentifiers(node.param)) {
13353
+ markScopeIdentifier(node, id, knownIds);
13354
+ }
13266
13355
  }
13267
13356
  } else if (isForStatement(node)) {
13268
- walkForStatement(
13269
- node,
13270
- false,
13271
- (id) => markScopeIdentifier(node, id, knownIds)
13272
- );
13357
+ if (node.scopeIds) {
13358
+ node.scopeIds.forEach((id) => markKnownIds(id, knownIds));
13359
+ } else {
13360
+ walkForStatement(
13361
+ node,
13362
+ false,
13363
+ (id) => markScopeIdentifier(node, id, knownIds)
13364
+ );
13365
+ }
13273
13366
  }
13274
13367
  },
13275
13368
  leave(node, parent) {
@@ -13340,7 +13433,8 @@ function walkFunctionParams(node, onIdent) {
13340
13433
  }
13341
13434
  }
13342
13435
  function walkBlockDeclarations(block, onIdent) {
13343
- for (const stmt of block.body) {
13436
+ const body = block.type === "SwitchCase" ? block.consequent : block.body;
13437
+ for (const stmt of body) {
13344
13438
  if (stmt.type === "VariableDeclaration") {
13345
13439
  if (stmt.declare) continue;
13346
13440
  for (const decl of stmt.declarations) {
@@ -13353,6 +13447,8 @@ function walkBlockDeclarations(block, onIdent) {
13353
13447
  onIdent(stmt.id);
13354
13448
  } else if (isForStatement(stmt)) {
13355
13449
  walkForStatement(stmt, true, onIdent);
13450
+ } else if (stmt.type === "SwitchStatement") {
13451
+ walkSwitchStatement(stmt, true, onIdent);
13356
13452
  }
13357
13453
  }
13358
13454
  }
@@ -13369,6 +13465,20 @@ function walkForStatement(stmt, isVar, onIdent) {
13369
13465
  }
13370
13466
  }
13371
13467
  }
13468
+ function walkSwitchStatement(stmt, isVar, onIdent) {
13469
+ for (const cs of stmt.cases) {
13470
+ for (const stmt2 of cs.consequent) {
13471
+ if (stmt2.type === "VariableDeclaration" && (stmt2.kind === "var" ? isVar : !isVar)) {
13472
+ for (const decl of stmt2.declarations) {
13473
+ for (const id of extractIdentifiers(decl.id)) {
13474
+ onIdent(id);
13475
+ }
13476
+ }
13477
+ }
13478
+ }
13479
+ walkBlockDeclarations(cs, onIdent);
13480
+ }
13481
+ }
13372
13482
  function extractIdentifiers(param, nodes = []) {
13373
13483
  switch (param.type) {
13374
13484
  case "Identifier":
@@ -13604,6 +13714,7 @@ function isCoreComponent(tag) {
13604
13714
  }
13605
13715
  const nonIdentifierRE = /^$|^\d|[^\$\w\xA0-\uFFFF]/;
13606
13716
  const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
13717
+ const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
13607
13718
  const getExpSource = (exp) => exp.type === 4 ? exp.content : exp.loc.source;
13608
13719
  const isMemberExpressionNode = (exp, context) => {
13609
13720
  try {
@@ -16102,14 +16213,17 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
16102
16213
  knownIds
16103
16214
  );
16104
16215
  const children = [];
16216
+ const isTSNode = TS_NODE_TYPES.includes(ast.type);
16105
16217
  ids.sort((a, b) => a.start - b.start);
16106
16218
  ids.forEach((id, i) => {
16107
16219
  const start = id.start - 1;
16108
16220
  const end = id.end - 1;
16109
16221
  const last = ids[i - 1];
16110
- const leadingText = rawExp.slice(last ? last.end - 1 : 0, start);
16111
- if (leadingText.length || id.prefix) {
16112
- children.push(leadingText + (id.prefix || ``));
16222
+ if (!(isTSNode && i === 0)) {
16223
+ const leadingText = rawExp.slice(last ? last.end - 1 : 0, start);
16224
+ if (leadingText.length || id.prefix) {
16225
+ children.push(leadingText + (id.prefix || ``));
16226
+ }
16113
16227
  }
16114
16228
  const source = rawExp.slice(start, end);
16115
16229
  children.push(
@@ -16124,7 +16238,7 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
16124
16238
  id.isConstant ? 3 : 0
16125
16239
  )
16126
16240
  );
16127
- if (i === ids.length - 1 && end < rawExp.length) {
16241
+ if (i === ids.length - 1 && end < rawExp.length && !isTSNode) {
16128
16242
  children.push(rawExp.slice(end));
16129
16243
  }
16130
16244
  });
@@ -16371,90 +16485,6 @@ function getParentCondition(node) {
16371
16485
  }
16372
16486
  }
16373
16487
 
16374
- const transformBind = (dir, _node, context) => {
16375
- const { modifiers, loc } = dir;
16376
- const arg = dir.arg;
16377
- let { exp } = dir;
16378
- if (exp && exp.type === 4 && !exp.content.trim()) {
16379
- {
16380
- context.onError(
16381
- createCompilerError(34, loc)
16382
- );
16383
- return {
16384
- props: [
16385
- createObjectProperty(arg, createSimpleExpression("", true, loc))
16386
- ]
16387
- };
16388
- }
16389
- }
16390
- if (!exp) {
16391
- if (arg.type !== 4 || !arg.isStatic) {
16392
- context.onError(
16393
- createCompilerError(
16394
- 52,
16395
- arg.loc
16396
- )
16397
- );
16398
- return {
16399
- props: [
16400
- createObjectProperty(arg, createSimpleExpression("", true, loc))
16401
- ]
16402
- };
16403
- }
16404
- transformBindShorthand(dir, context);
16405
- exp = dir.exp;
16406
- }
16407
- if (arg.type !== 4) {
16408
- arg.children.unshift(`(`);
16409
- arg.children.push(`) || ""`);
16410
- } else if (!arg.isStatic) {
16411
- arg.content = arg.content ? `${arg.content} || ""` : `""`;
16412
- }
16413
- if (modifiers.some((mod) => mod.content === "camel")) {
16414
- if (arg.type === 4) {
16415
- if (arg.isStatic) {
16416
- arg.content = camelize(arg.content);
16417
- } else {
16418
- arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
16419
- }
16420
- } else {
16421
- arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
16422
- arg.children.push(`)`);
16423
- }
16424
- }
16425
- if (!context.inSSR) {
16426
- if (modifiers.some((mod) => mod.content === "prop")) {
16427
- injectPrefix(arg, ".");
16428
- }
16429
- if (modifiers.some((mod) => mod.content === "attr")) {
16430
- injectPrefix(arg, "^");
16431
- }
16432
- }
16433
- return {
16434
- props: [createObjectProperty(arg, exp)]
16435
- };
16436
- };
16437
- const transformBindShorthand = (dir, context) => {
16438
- const arg = dir.arg;
16439
- const propName = camelize(arg.content);
16440
- dir.exp = createSimpleExpression(propName, false, arg.loc);
16441
- {
16442
- dir.exp = processExpression(dir.exp, context);
16443
- }
16444
- };
16445
- const injectPrefix = (arg, prefix) => {
16446
- if (arg.type === 4) {
16447
- if (arg.isStatic) {
16448
- arg.content = prefix + arg.content;
16449
- } else {
16450
- arg.content = `\`${prefix}\${${arg.content}}\``;
16451
- }
16452
- } else {
16453
- arg.children.unshift(`'${prefix}' + (`);
16454
- arg.children.push(`)`);
16455
- }
16456
- };
16457
-
16458
16488
  const transformFor = createStructuralDirectiveTransform(
16459
16489
  "for",
16460
16490
  (node, dir, context) => {
@@ -16467,9 +16497,6 @@ const transformFor = createStructuralDirectiveTransform(
16467
16497
  const memo = findDir(node, "memo");
16468
16498
  const keyProp = findProp(node, `key`, false, true);
16469
16499
  const isDirKey = keyProp && keyProp.type === 7;
16470
- if (isDirKey && !keyProp.exp) {
16471
- transformBindShorthand(keyProp, context);
16472
- }
16473
16500
  let keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
16474
16501
  if (memo && keyExp && isDirKey) {
16475
16502
  {
@@ -17752,6 +17779,65 @@ const transformOn$1 = (dir, node, context, augmentor) => {
17752
17779
  return ret;
17753
17780
  };
17754
17781
 
17782
+ const transformBind = (dir, _node, context) => {
17783
+ const { modifiers, loc } = dir;
17784
+ const arg = dir.arg;
17785
+ let { exp } = dir;
17786
+ if (exp && exp.type === 4 && !exp.content.trim()) {
17787
+ {
17788
+ context.onError(
17789
+ createCompilerError(34, loc)
17790
+ );
17791
+ return {
17792
+ props: [
17793
+ createObjectProperty(arg, createSimpleExpression("", true, loc))
17794
+ ]
17795
+ };
17796
+ }
17797
+ }
17798
+ if (arg.type !== 4) {
17799
+ arg.children.unshift(`(`);
17800
+ arg.children.push(`) || ""`);
17801
+ } else if (!arg.isStatic) {
17802
+ arg.content = arg.content ? `${arg.content} || ""` : `""`;
17803
+ }
17804
+ if (modifiers.some((mod) => mod.content === "camel")) {
17805
+ if (arg.type === 4) {
17806
+ if (arg.isStatic) {
17807
+ arg.content = camelize(arg.content);
17808
+ } else {
17809
+ arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
17810
+ }
17811
+ } else {
17812
+ arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
17813
+ arg.children.push(`)`);
17814
+ }
17815
+ }
17816
+ if (!context.inSSR) {
17817
+ if (modifiers.some((mod) => mod.content === "prop")) {
17818
+ injectPrefix(arg, ".");
17819
+ }
17820
+ if (modifiers.some((mod) => mod.content === "attr")) {
17821
+ injectPrefix(arg, "^");
17822
+ }
17823
+ }
17824
+ return {
17825
+ props: [createObjectProperty(arg, exp)]
17826
+ };
17827
+ };
17828
+ const injectPrefix = (arg, prefix) => {
17829
+ if (arg.type === 4) {
17830
+ if (arg.isStatic) {
17831
+ arg.content = prefix + arg.content;
17832
+ } else {
17833
+ arg.content = `\`${prefix}\${${arg.content}}\``;
17834
+ }
17835
+ } else {
17836
+ arg.children.unshift(`'${prefix}' + (`);
17837
+ arg.children.push(`)`);
17838
+ }
17839
+ };
17840
+
17755
17841
  const transformText = (node, context) => {
17756
17842
  if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) {
17757
17843
  return () => {
@@ -18102,9 +18188,36 @@ const transformMemo = (node, context) => {
18102
18188
  }
18103
18189
  };
18104
18190
 
18191
+ const transformVBindShorthand = (node, context) => {
18192
+ if (node.type === 1) {
18193
+ for (const prop of node.props) {
18194
+ if (prop.type === 7 && prop.name === "bind" && (!prop.exp || // #13930 :foo in in-DOM templates will be parsed into :foo="" by browser
18195
+ false) && prop.arg) {
18196
+ const arg = prop.arg;
18197
+ if (arg.type !== 4 || !arg.isStatic) {
18198
+ context.onError(
18199
+ createCompilerError(
18200
+ 52,
18201
+ arg.loc
18202
+ )
18203
+ );
18204
+ prop.exp = createSimpleExpression("", true, arg.loc);
18205
+ } else {
18206
+ const propName = camelize(arg.content);
18207
+ if (validFirstIdentCharRE.test(propName[0]) || // allow hyphen first char for https://github.com/vuejs/language-tools/pull/3424
18208
+ propName[0] === "-") {
18209
+ prop.exp = createSimpleExpression(propName, false, arg.loc);
18210
+ }
18211
+ }
18212
+ }
18213
+ }
18214
+ }
18215
+ };
18216
+
18105
18217
  function getBaseTransformPreset(prefixIdentifiers) {
18106
18218
  return [
18107
18219
  [
18220
+ transformVBindShorthand,
18108
18221
  transformOnce,
18109
18222
  transformIf,
18110
18223
  transformMemo,
@@ -18600,6 +18713,9 @@ function analyzeNode(node) {
18600
18713
  if (node.type === 1 && isNonStringifiable(node.tag)) {
18601
18714
  return false;
18602
18715
  }
18716
+ if (node.type === 1 && findDir(node, "once", true)) {
18717
+ return false;
18718
+ }
18603
18719
  if (node.type === 12) {
18604
18720
  return [1, 0];
18605
18721
  }