@vue/compat 3.5.4 → 3.5.5

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.4
2
+ * @vue/compat v3.5.5
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -713,9 +713,11 @@ function prepareDeps(sub) {
713
713
  function cleanupDeps(sub) {
714
714
  let head;
715
715
  let tail = sub.depsTail;
716
- for (let link = tail; link; link = link.prevDep) {
716
+ let link = tail;
717
+ while (link) {
718
+ const prev = link.prevDep;
717
719
  if (link.version === -1) {
718
- if (link === tail) tail = link.prevDep;
720
+ if (link === tail) tail = prev;
719
721
  removeSub(link);
720
722
  removeDep(link);
721
723
  } else {
@@ -723,6 +725,7 @@ function cleanupDeps(sub) {
723
725
  }
724
726
  link.dep.activeLink = link.prevActiveLink;
725
727
  link.prevActiveLink = void 0;
728
+ link = prev;
726
729
  }
727
730
  sub.deps = head;
728
731
  sub.depsTail = tail;
@@ -851,6 +854,14 @@ function cleanupEffect(e) {
851
854
  }
852
855
 
853
856
  let globalVersion = 0;
857
+ class Link {
858
+ constructor(sub, dep) {
859
+ this.sub = sub;
860
+ this.dep = dep;
861
+ this.version = dep.version;
862
+ this.nextDep = this.prevDep = this.nextSub = this.prevSub = this.prevActiveLink = void 0;
863
+ }
864
+ }
854
865
  class Dep {
855
866
  constructor(computed) {
856
867
  this.computed = computed;
@@ -873,16 +884,7 @@ class Dep {
873
884
  }
874
885
  let link = this.activeLink;
875
886
  if (link === void 0 || link.sub !== activeSub) {
876
- link = this.activeLink = {
877
- dep: this,
878
- sub: activeSub,
879
- version: this.version,
880
- nextDep: void 0,
881
- prevDep: void 0,
882
- nextSub: void 0,
883
- prevSub: void 0,
884
- prevActiveLink: void 0
885
- };
887
+ link = this.activeLink = new Link(activeSub, this);
886
888
  if (!activeSub.deps) {
887
889
  activeSub.deps = activeSub.depsTail = link;
888
890
  } else {
@@ -2795,7 +2797,9 @@ function reload(id, newComp) {
2795
2797
  dirtyInstances.delete(instance);
2796
2798
  } else if (instance.parent) {
2797
2799
  queueJob(() => {
2800
+ isHmrUpdating = true;
2798
2801
  instance.parent.update();
2802
+ isHmrUpdating = false;
2799
2803
  dirtyInstances.delete(instance);
2800
2804
  });
2801
2805
  } else if (instance.appContext.reload) {
@@ -3614,6 +3618,9 @@ const TeleportImpl = {
3614
3618
  insert(mainAnchor, container, anchor);
3615
3619
  const mount = (container2, anchor2) => {
3616
3620
  if (shapeFlag & 16) {
3621
+ if (parentComponent && parentComponent.isCE) {
3622
+ parentComponent.ce._teleportTarget = container2;
3623
+ }
3617
3624
  mountChildren(
3618
3625
  children,
3619
3626
  container2,
@@ -4647,7 +4654,11 @@ Server rendered element contains more child nodes than client vdom.`
4647
4654
  remove(cur);
4648
4655
  }
4649
4656
  } else if (shapeFlag & 8) {
4650
- if (el.textContent !== vnode.children) {
4657
+ let clientText = vnode.children;
4658
+ if (clientText[0] === "\n" && (el.tagName === "PRE" || el.tagName === "TEXTAREA")) {
4659
+ clientText = clientText.slice(1);
4660
+ }
4661
+ if (el.textContent !== clientText) {
4651
4662
  if (!isMismatchAllowed(el, 0 /* TEXT */)) {
4652
4663
  warn$1(
4653
4664
  `Hydration text content mismatch on`,
@@ -4846,7 +4857,7 @@ Server rendered element contains fewer child nodes than client vdom.`
4846
4857
  }
4847
4858
  };
4848
4859
  const isTemplateNode = (node) => {
4849
- return node.nodeType === 1 && node.tagName.toLowerCase() === "template";
4860
+ return node.nodeType === 1 && node.tagName === "TEMPLATE";
4850
4861
  };
4851
4862
  return [hydrate, hydrateNode];
4852
4863
  }
@@ -5198,7 +5209,7 @@ function defineAsyncComponent(source) {
5198
5209
  load().then(() => {
5199
5210
  loaded.value = true;
5200
5211
  if (instance.parent && isKeepAlive(instance.parent.vnode)) {
5201
- queueJob(instance.parent.update);
5212
+ instance.parent.update();
5202
5213
  }
5203
5214
  }).catch((err) => {
5204
5215
  onError(err);
@@ -7149,7 +7160,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7149
7160
  return vm;
7150
7161
  }
7151
7162
  }
7152
- Vue.version = `2.6.14-compat:${"3.5.4"}`;
7163
+ Vue.version = `2.6.14-compat:${"3.5.5"}`;
7153
7164
  Vue.config = singletonApp.config;
7154
7165
  Vue.use = (plugin, ...options) => {
7155
7166
  if (plugin && isFunction(plugin.install)) {
@@ -8971,6 +8982,7 @@ function baseCreateRenderer(options, createHydrationFns) {
8971
8982
  }
8972
8983
  }
8973
8984
  if (instance.asyncDep) {
8985
+ if (isHmrUpdating) initialVNode.el = null;
8974
8986
  parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized);
8975
8987
  if (!initialVNode.el) {
8976
8988
  const placeholder = instance.subTree = createVNode(Comment);
@@ -12262,7 +12274,7 @@ function isMemoSame(cached, memo) {
12262
12274
  return true;
12263
12275
  }
12264
12276
 
12265
- const version = "3.5.4";
12277
+ const version = "3.5.5";
12266
12278
  const warn = warn$1 ;
12267
12279
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12268
12280
  const devtools = devtools$1 ;
@@ -13184,6 +13196,7 @@ class VueElement extends BaseClass {
13184
13196
  }
13185
13197
  }
13186
13198
  connectedCallback() {
13199
+ if (!this.isConnected) return;
13187
13200
  if (!this.shadowRoot) {
13188
13201
  this._parseSlots();
13189
13202
  }
@@ -13226,7 +13239,7 @@ class VueElement extends BaseClass {
13226
13239
  this._ob = null;
13227
13240
  }
13228
13241
  this._app && this._app.unmount();
13229
- this._instance.ce = void 0;
13242
+ if (this._instance) this._instance.ce = void 0;
13230
13243
  this._app = this._instance = null;
13231
13244
  }
13232
13245
  });
@@ -13445,7 +13458,7 @@ class VueElement extends BaseClass {
13445
13458
  }
13446
13459
  }
13447
13460
  /**
13448
- * Only called when shaddowRoot is false
13461
+ * Only called when shadowRoot is false
13449
13462
  */
13450
13463
  _parseSlots() {
13451
13464
  const slots = this._slots = {};
@@ -13457,10 +13470,10 @@ class VueElement extends BaseClass {
13457
13470
  }
13458
13471
  }
13459
13472
  /**
13460
- * Only called when shaddowRoot is false
13473
+ * Only called when shadowRoot is false
13461
13474
  */
13462
13475
  _renderSlots() {
13463
- const outlets = this.querySelectorAll("slot");
13476
+ const outlets = (this._teleportTarget || this).querySelectorAll("slot");
13464
13477
  const scopeId = this._instance.type.__scopeId;
13465
13478
  for (let i = 0; i < outlets.length; i++) {
13466
13479
  const o = outlets[i];
@@ -13648,7 +13661,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
13648
13661
  child,
13649
13662
  resolveTransitionHooks(child, cssTransitionProps, state, instance)
13650
13663
  );
13651
- } else {
13664
+ } else if (child.type !== Text) {
13652
13665
  warn(`<TransitionGroup> children must be keyed.`);
13653
13666
  }
13654
13667
  }
@@ -14885,7 +14898,7 @@ class Tokenizer {
14885
14898
  if (this.currentSequence === Sequences.TitleEnd || this.currentSequence === Sequences.TextareaEnd && !this.inSFCRoot) {
14886
14899
  if (c === 38) {
14887
14900
  this.startEntity();
14888
- } else if (c === this.delimiterOpen[0]) {
14901
+ } else if (!this.inVPre && c === this.delimiterOpen[0]) {
14889
14902
  this.state = 2;
14890
14903
  this.delimiterIndex = 0;
14891
14904
  this.stateInterpolationOpen(c);
@@ -16289,6 +16302,7 @@ const defaultParserOptions = {
16289
16302
  getNamespace: () => 0,
16290
16303
  isVoidTag: NO,
16291
16304
  isPreTag: NO,
16305
+ isIgnoreNewlineTag: NO,
16292
16306
  isCustomElement: NO,
16293
16307
  onError: defaultOnError,
16294
16308
  onWarn: defaultOnWarn,
@@ -16728,7 +16742,7 @@ function onCloseTag(el, end, isImplied = false) {
16728
16742
  el.innerLoc.end.offset
16729
16743
  );
16730
16744
  }
16731
- const { tag, ns } = el;
16745
+ const { tag, ns, children } = el;
16732
16746
  if (!inVPre) {
16733
16747
  if (tag === "slot") {
16734
16748
  el.tagType = 2;
@@ -16739,7 +16753,13 @@ function onCloseTag(el, end, isImplied = false) {
16739
16753
  }
16740
16754
  }
16741
16755
  if (!tokenizer.inRCDATA) {
16742
- el.children = condenseWhitespace(el.children, el.tag);
16756
+ el.children = condenseWhitespace(children);
16757
+ }
16758
+ if (ns === 0 && currentOptions.isIgnoreNewlineTag(tag)) {
16759
+ const first = children[0];
16760
+ if (first && first.type === 2) {
16761
+ first.content = first.content.replace(/^\r?\n/, "");
16762
+ }
16743
16763
  }
16744
16764
  if (ns === 0 && currentOptions.isPreTag(tag)) {
16745
16765
  inPre--;
@@ -16891,12 +16911,6 @@ function condenseWhitespace(nodes, tag) {
16891
16911
  }
16892
16912
  }
16893
16913
  }
16894
- if (inPre && tag && currentOptions.isPreTag(tag)) {
16895
- const first = nodes[0];
16896
- if (first && first.type === 2) {
16897
- first.content = first.content.replace(/^\r?\n/, "");
16898
- }
16899
- }
16900
16914
  return removedWhitespace ? nodes.filter(Boolean) : nodes;
16901
16915
  }
16902
16916
  function isAllWhitespace(str) {
@@ -20742,6 +20756,7 @@ const parserOptions = {
20742
20756
  isVoidTag,
20743
20757
  isNativeTag: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag),
20744
20758
  isPreTag: (tag) => tag === "pre",
20759
+ isIgnoreNewlineTag: (tag) => tag === "pre" || tag === "textarea",
20745
20760
  decodeEntities: void 0,
20746
20761
  isBuiltInComponent: (tag) => {
20747
20762
  if (tag === "Transition" || tag === "transition") {
@@ -21134,12 +21149,17 @@ const stringifyStatic = (children, context, parent) => {
21134
21149
  // will insert / hydrate
21135
21150
  String(currentChunk.length)
21136
21151
  ]);
21152
+ const deleteCount = currentChunk.length - 1;
21137
21153
  if (isParentCached) {
21138
- parent.codegenNode.children.value = createArrayExpression([staticCall]);
21154
+ children.splice(
21155
+ currentIndex - currentChunk.length,
21156
+ currentChunk.length,
21157
+ // @ts-expect-error
21158
+ staticCall
21159
+ );
21139
21160
  } else {
21140
21161
  currentChunk[0].codegenNode.value = staticCall;
21141
21162
  if (currentChunk.length > 1) {
21142
- const deleteCount = currentChunk.length - 1;
21143
21163
  children.splice(currentIndex - currentChunk.length + 1, deleteCount);
21144
21164
  const cacheIndex = context.cached.indexOf(
21145
21165
  currentChunk[currentChunk.length - 1].codegenNode
@@ -21151,9 +21171,9 @@ const stringifyStatic = (children, context, parent) => {
21151
21171
  }
21152
21172
  context.cached.splice(cacheIndex - deleteCount + 1, deleteCount);
21153
21173
  }
21154
- return deleteCount;
21155
21174
  }
21156
21175
  }
21176
+ return deleteCount;
21157
21177
  }
21158
21178
  return 0;
21159
21179
  };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compat v3.5.4
2
+ * @vue/compat v3.5.5
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -619,9 +619,11 @@ function prepareDeps(sub) {
619
619
  function cleanupDeps(sub) {
620
620
  let head;
621
621
  let tail = sub.depsTail;
622
- for (let link = tail; link; link = link.prevDep) {
622
+ let link = tail;
623
+ while (link) {
624
+ const prev = link.prevDep;
623
625
  if (link.version === -1) {
624
- if (link === tail) tail = link.prevDep;
626
+ if (link === tail) tail = prev;
625
627
  removeSub(link);
626
628
  removeDep(link);
627
629
  } else {
@@ -629,6 +631,7 @@ function cleanupDeps(sub) {
629
631
  }
630
632
  link.dep.activeLink = link.prevActiveLink;
631
633
  link.prevActiveLink = void 0;
634
+ link = prev;
632
635
  }
633
636
  sub.deps = head;
634
637
  sub.depsTail = tail;
@@ -757,6 +760,14 @@ function cleanupEffect(e) {
757
760
  }
758
761
 
759
762
  let globalVersion = 0;
763
+ class Link {
764
+ constructor(sub, dep) {
765
+ this.sub = sub;
766
+ this.dep = dep;
767
+ this.version = dep.version;
768
+ this.nextDep = this.prevDep = this.nextSub = this.prevSub = this.prevActiveLink = void 0;
769
+ }
770
+ }
760
771
  class Dep {
761
772
  constructor(computed) {
762
773
  this.computed = computed;
@@ -776,16 +787,7 @@ class Dep {
776
787
  }
777
788
  let link = this.activeLink;
778
789
  if (link === void 0 || link.sub !== activeSub) {
779
- link = this.activeLink = {
780
- dep: this,
781
- sub: activeSub,
782
- version: this.version,
783
- nextDep: void 0,
784
- prevDep: void 0,
785
- nextSub: void 0,
786
- prevSub: void 0,
787
- prevActiveLink: void 0
788
- };
790
+ link = this.activeLink = new Link(activeSub, this);
789
791
  if (!activeSub.deps) {
790
792
  activeSub.deps = activeSub.depsTail = link;
791
793
  } else {
@@ -2725,6 +2727,9 @@ const TeleportImpl = {
2725
2727
  insert(mainAnchor, container, anchor);
2726
2728
  const mount = (container2, anchor2) => {
2727
2729
  if (shapeFlag & 16) {
2730
+ if (parentComponent && parentComponent.isCE) {
2731
+ parentComponent.ce._teleportTarget = container2;
2732
+ }
2728
2733
  mountChildren(
2729
2734
  children,
2730
2735
  container2,
@@ -3677,7 +3682,11 @@ function createHydrationFunctions(rendererInternals) {
3677
3682
  remove(cur);
3678
3683
  }
3679
3684
  } else if (shapeFlag & 8) {
3680
- if (el.textContent !== vnode.children) {
3685
+ let clientText = vnode.children;
3686
+ if (clientText[0] === "\n" && (el.tagName === "PRE" || el.tagName === "TEXTAREA")) {
3687
+ clientText = clientText.slice(1);
3688
+ }
3689
+ if (el.textContent !== clientText) {
3681
3690
  if (!isMismatchAllowed(el, 0 /* TEXT */)) {
3682
3691
  logMismatchError();
3683
3692
  }
@@ -3856,7 +3865,7 @@ function createHydrationFunctions(rendererInternals) {
3856
3865
  }
3857
3866
  };
3858
3867
  const isTemplateNode = (node) => {
3859
- return node.nodeType === 1 && node.tagName.toLowerCase() === "template";
3868
+ return node.nodeType === 1 && node.tagName === "TEMPLATE";
3860
3869
  };
3861
3870
  return [hydrate, hydrateNode];
3862
3871
  }
@@ -4080,7 +4089,7 @@ function defineAsyncComponent(source) {
4080
4089
  load().then(() => {
4081
4090
  loaded.value = true;
4082
4091
  if (instance.parent && isKeepAlive(instance.parent.vnode)) {
4083
- queueJob(instance.parent.update);
4092
+ instance.parent.update();
4084
4093
  }
4085
4094
  }).catch((err) => {
4086
4095
  onError(err);
@@ -5743,7 +5752,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
5743
5752
  return vm;
5744
5753
  }
5745
5754
  }
5746
- Vue.version = `2.6.14-compat:${"3.5.4"}`;
5755
+ Vue.version = `2.6.14-compat:${"3.5.5"}`;
5747
5756
  Vue.config = singletonApp.config;
5748
5757
  Vue.use = (plugin, ...options) => {
5749
5758
  if (plugin && isFunction(plugin.install)) {
@@ -9863,7 +9872,7 @@ function isMemoSame(cached, memo) {
9863
9872
  return true;
9864
9873
  }
9865
9874
 
9866
- const version = "3.5.4";
9875
+ const version = "3.5.5";
9867
9876
  const warn$1 = NOOP;
9868
9877
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
9869
9878
  const devtools = void 0;
@@ -10744,6 +10753,7 @@ class VueElement extends BaseClass {
10744
10753
  }
10745
10754
  }
10746
10755
  connectedCallback() {
10756
+ if (!this.isConnected) return;
10747
10757
  if (!this.shadowRoot) {
10748
10758
  this._parseSlots();
10749
10759
  }
@@ -10786,7 +10796,7 @@ class VueElement extends BaseClass {
10786
10796
  this._ob = null;
10787
10797
  }
10788
10798
  this._app && this._app.unmount();
10789
- this._instance.ce = void 0;
10799
+ if (this._instance) this._instance.ce = void 0;
10790
10800
  this._app = this._instance = null;
10791
10801
  }
10792
10802
  });
@@ -10971,7 +10981,7 @@ class VueElement extends BaseClass {
10971
10981
  }
10972
10982
  }
10973
10983
  /**
10974
- * Only called when shaddowRoot is false
10984
+ * Only called when shadowRoot is false
10975
10985
  */
10976
10986
  _parseSlots() {
10977
10987
  const slots = this._slots = {};
@@ -10983,10 +10993,10 @@ class VueElement extends BaseClass {
10983
10993
  }
10984
10994
  }
10985
10995
  /**
10986
- * Only called when shaddowRoot is false
10996
+ * Only called when shadowRoot is false
10987
10997
  */
10988
10998
  _renderSlots() {
10989
- const outlets = this.querySelectorAll("slot");
10999
+ const outlets = (this._teleportTarget || this).querySelectorAll("slot");
10990
11000
  const scopeId = this._instance.type.__scopeId;
10991
11001
  for (let i = 0; i < outlets.length; i++) {
10992
11002
  const o = outlets[i];
@@ -12312,7 +12322,7 @@ class Tokenizer {
12312
12322
  if (this.currentSequence === Sequences.TitleEnd || this.currentSequence === Sequences.TextareaEnd && !this.inSFCRoot) {
12313
12323
  if (c === 38) {
12314
12324
  this.startEntity();
12315
- } else if (c === this.delimiterOpen[0]) {
12325
+ } else if (!this.inVPre && c === this.delimiterOpen[0]) {
12316
12326
  this.state = 2;
12317
12327
  this.delimiterIndex = 0;
12318
12328
  this.stateInterpolationOpen(c);
@@ -13661,6 +13671,7 @@ const defaultParserOptions = {
13661
13671
  getNamespace: () => 0,
13662
13672
  isVoidTag: NO,
13663
13673
  isPreTag: NO,
13674
+ isIgnoreNewlineTag: NO,
13664
13675
  isCustomElement: NO,
13665
13676
  onError: defaultOnError,
13666
13677
  onWarn: defaultOnWarn,
@@ -14100,7 +14111,7 @@ function onCloseTag(el, end, isImplied = false) {
14100
14111
  el.innerLoc.end.offset
14101
14112
  );
14102
14113
  }
14103
- const { tag, ns } = el;
14114
+ const { tag, ns, children } = el;
14104
14115
  if (!inVPre) {
14105
14116
  if (tag === "slot") {
14106
14117
  el.tagType = 2;
@@ -14111,7 +14122,13 @@ function onCloseTag(el, end, isImplied = false) {
14111
14122
  }
14112
14123
  }
14113
14124
  if (!tokenizer.inRCDATA) {
14114
- el.children = condenseWhitespace(el.children, el.tag);
14125
+ el.children = condenseWhitespace(children);
14126
+ }
14127
+ if (ns === 0 && currentOptions.isIgnoreNewlineTag(tag)) {
14128
+ const first = children[0];
14129
+ if (first && first.type === 2) {
14130
+ first.content = first.content.replace(/^\r?\n/, "");
14131
+ }
14115
14132
  }
14116
14133
  if (ns === 0 && currentOptions.isPreTag(tag)) {
14117
14134
  inPre--;
@@ -14233,12 +14250,6 @@ function condenseWhitespace(nodes, tag) {
14233
14250
  }
14234
14251
  }
14235
14252
  }
14236
- if (inPre && tag && currentOptions.isPreTag(tag)) {
14237
- const first = nodes[0];
14238
- if (first && first.type === 2) {
14239
- first.content = first.content.replace(/^\r?\n/, "");
14240
- }
14241
- }
14242
14253
  return removedWhitespace ? nodes.filter(Boolean) : nodes;
14243
14254
  }
14244
14255
  function isAllWhitespace(str) {
@@ -17995,6 +18006,7 @@ const parserOptions = {
17995
18006
  isVoidTag,
17996
18007
  isNativeTag: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag),
17997
18008
  isPreTag: (tag) => tag === "pre",
18009
+ isIgnoreNewlineTag: (tag) => tag === "pre" || tag === "textarea",
17998
18010
  decodeEntities: void 0,
17999
18011
  isBuiltInComponent: (tag) => {
18000
18012
  if (tag === "Transition" || tag === "transition") {
@@ -18321,12 +18333,17 @@ const stringifyStatic = (children, context, parent) => {
18321
18333
  // will insert / hydrate
18322
18334
  String(currentChunk.length)
18323
18335
  ]);
18336
+ const deleteCount = currentChunk.length - 1;
18324
18337
  if (isParentCached) {
18325
- parent.codegenNode.children.value = createArrayExpression([staticCall]);
18338
+ children.splice(
18339
+ currentIndex - currentChunk.length,
18340
+ currentChunk.length,
18341
+ // @ts-expect-error
18342
+ staticCall
18343
+ );
18326
18344
  } else {
18327
18345
  currentChunk[0].codegenNode.value = staticCall;
18328
18346
  if (currentChunk.length > 1) {
18329
- const deleteCount = currentChunk.length - 1;
18330
18347
  children.splice(currentIndex - currentChunk.length + 1, deleteCount);
18331
18348
  const cacheIndex = context.cached.indexOf(
18332
18349
  currentChunk[currentChunk.length - 1].codegenNode
@@ -18338,9 +18355,9 @@ const stringifyStatic = (children, context, parent) => {
18338
18355
  }
18339
18356
  context.cached.splice(cacheIndex - deleteCount + 1, deleteCount);
18340
18357
  }
18341
- return deleteCount;
18342
18358
  }
18343
18359
  }
18360
+ return deleteCount;
18344
18361
  }
18345
18362
  return 0;
18346
18363
  };