@vue/compat 3.5.4 → 3.5.6

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.4
2
+ * @vue/compat v3.5.6
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -532,7 +532,7 @@ class ReactiveEffect {
532
532
  /**
533
533
  * @internal
534
534
  */
535
- this.nextEffect = void 0;
535
+ this.next = void 0;
536
536
  /**
537
537
  * @internal
538
538
  */
@@ -562,9 +562,7 @@ class ReactiveEffect {
562
562
  return;
563
563
  }
564
564
  if (!(this.flags & 8)) {
565
- this.flags |= 8;
566
- this.nextEffect = batchedEffect;
567
- batchedEffect = this;
565
+ batch(this);
568
566
  }
569
567
  }
570
568
  run() {
@@ -625,7 +623,12 @@ class ReactiveEffect {
625
623
  }
626
624
  }
627
625
  let batchDepth = 0;
628
- let batchedEffect;
626
+ let batchedSub;
627
+ function batch(sub) {
628
+ sub.flags |= 8;
629
+ sub.next = batchedSub;
630
+ batchedSub = sub;
631
+ }
629
632
  function startBatch() {
630
633
  batchDepth++;
631
634
  }
@@ -634,15 +637,16 @@ function endBatch() {
634
637
  return;
635
638
  }
636
639
  let error;
637
- while (batchedEffect) {
638
- let e = batchedEffect;
639
- batchedEffect = void 0;
640
+ while (batchedSub) {
641
+ let e = batchedSub;
642
+ batchedSub = void 0;
640
643
  while (e) {
641
- const next = e.nextEffect;
642
- e.nextEffect = void 0;
644
+ const next = e.next;
645
+ e.next = void 0;
643
646
  e.flags &= ~8;
644
647
  if (e.flags & 1) {
645
648
  try {
649
+ ;
646
650
  e.trigger();
647
651
  } catch (err) {
648
652
  if (!error) error = err;
@@ -663,9 +667,11 @@ function prepareDeps(sub) {
663
667
  function cleanupDeps(sub) {
664
668
  let head;
665
669
  let tail = sub.depsTail;
666
- for (let link = tail; link; link = link.prevDep) {
670
+ let link = tail;
671
+ while (link) {
672
+ const prev = link.prevDep;
667
673
  if (link.version === -1) {
668
- if (link === tail) tail = link.prevDep;
674
+ if (link === tail) tail = prev;
669
675
  removeSub(link);
670
676
  removeDep(link);
671
677
  } else {
@@ -673,13 +679,14 @@ function cleanupDeps(sub) {
673
679
  }
674
680
  link.dep.activeLink = link.prevActiveLink;
675
681
  link.prevActiveLink = void 0;
682
+ link = prev;
676
683
  }
677
684
  sub.deps = head;
678
685
  sub.depsTail = tail;
679
686
  }
680
687
  function isDirty(sub) {
681
688
  for (let link = sub.deps; link; link = link.nextDep) {
682
- if (link.dep.version !== link.version || link.dep.computed && refreshComputed(link.dep.computed) || link.dep.version !== link.version) {
689
+ if (link.dep.version !== link.version || link.dep.computed && (refreshComputed(link.dep.computed) || link.dep.version !== link.version)) {
683
690
  return true;
684
691
  }
685
692
  }
@@ -699,7 +706,7 @@ function refreshComputed(computed) {
699
706
  computed.globalVersion = globalVersion;
700
707
  const dep = computed.dep;
701
708
  computed.flags |= 2;
702
- if (dep.version > 0 && !computed.isSSR && !isDirty(computed)) {
709
+ if (dep.version > 0 && !computed.isSSR && computed.deps && !isDirty(computed)) {
703
710
  computed.flags &= ~2;
704
711
  return;
705
712
  }
@@ -801,6 +808,14 @@ function cleanupEffect(e) {
801
808
  }
802
809
 
803
810
  let globalVersion = 0;
811
+ class Link {
812
+ constructor(sub, dep) {
813
+ this.sub = sub;
814
+ this.dep = dep;
815
+ this.version = dep.version;
816
+ this.nextDep = this.prevDep = this.nextSub = this.prevSub = this.prevActiveLink = void 0;
817
+ }
818
+ }
804
819
  class Dep {
805
820
  constructor(computed) {
806
821
  this.computed = computed;
@@ -823,16 +838,7 @@ class Dep {
823
838
  }
824
839
  let link = this.activeLink;
825
840
  if (link === void 0 || link.sub !== activeSub) {
826
- link = this.activeLink = {
827
- dep: this,
828
- sub: activeSub,
829
- version: this.version,
830
- nextDep: void 0,
831
- prevDep: void 0,
832
- nextSub: void 0,
833
- prevSub: void 0,
834
- prevActiveLink: void 0
835
- };
841
+ link = this.activeLink = new Link(activeSub, this);
836
842
  if (!activeSub.deps) {
837
843
  activeSub.deps = activeSub.depsTail = link;
838
844
  } else {
@@ -882,7 +888,7 @@ class Dep {
882
888
  try {
883
889
  if (!!(process.env.NODE_ENV !== "production")) {
884
890
  for (let head = this.subsHead; head; head = head.nextSub) {
885
- if (!!(process.env.NODE_ENV !== "production") && head.sub.onTrigger && !(head.sub.flags & 8)) {
891
+ if (head.sub.onTrigger && !(head.sub.flags & 8)) {
886
892
  head.sub.onTrigger(
887
893
  extend(
888
894
  {
@@ -895,7 +901,10 @@ class Dep {
895
901
  }
896
902
  }
897
903
  for (let link = this.subs; link; link = link.prevSub) {
898
- link.sub.notify();
904
+ if (link.sub.notify()) {
905
+ ;
906
+ link.sub.dep.notify();
907
+ }
899
908
  }
900
909
  } finally {
901
910
  endBatch();
@@ -1974,8 +1983,10 @@ class ComputedRefImpl {
1974
1983
  */
1975
1984
  notify() {
1976
1985
  this.flags |= 16;
1977
- if (activeSub !== this) {
1978
- this.dep.notify();
1986
+ if (!(this.flags & 8) && // avoid infinite self recursion
1987
+ activeSub !== this) {
1988
+ batch(this);
1989
+ return true;
1979
1990
  } else if (!!(process.env.NODE_ENV !== "production")) ;
1980
1991
  }
1981
1992
  get value() {
@@ -2123,20 +2134,12 @@ function watch$1(source, cb, options = EMPTY_OBJ) {
2123
2134
  remove(scope.effects, effect);
2124
2135
  }
2125
2136
  };
2126
- if (once) {
2127
- if (cb) {
2128
- const _cb = cb;
2129
- cb = (...args) => {
2130
- _cb(...args);
2131
- watchHandle();
2132
- };
2133
- } else {
2134
- const _getter = getter;
2135
- getter = () => {
2136
- _getter();
2137
- watchHandle();
2138
- };
2139
- }
2137
+ if (once && cb) {
2138
+ const _cb = cb;
2139
+ cb = (...args) => {
2140
+ _cb(...args);
2141
+ watchHandle();
2142
+ };
2140
2143
  }
2141
2144
  let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
2142
2145
  const job = (immediateFirstRun) => {
@@ -2760,7 +2763,9 @@ function reload(id, newComp) {
2760
2763
  dirtyInstances.delete(instance);
2761
2764
  } else if (instance.parent) {
2762
2765
  queueJob(() => {
2766
+ isHmrUpdating = true;
2763
2767
  instance.parent.update();
2768
+ isHmrUpdating = false;
2764
2769
  dirtyInstances.delete(instance);
2765
2770
  });
2766
2771
  } else if (instance.appContext.reload) {
@@ -3582,6 +3587,9 @@ const TeleportImpl = {
3582
3587
  insert(mainAnchor, container, anchor);
3583
3588
  const mount = (container2, anchor2) => {
3584
3589
  if (shapeFlag & 16) {
3590
+ if (parentComponent && parentComponent.isCE) {
3591
+ parentComponent.ce._teleportTarget = container2;
3592
+ }
3585
3593
  mountChildren(
3586
3594
  children,
3587
3595
  container2,
@@ -4616,7 +4624,11 @@ Server rendered element contains more child nodes than client vdom.`
4616
4624
  remove(cur);
4617
4625
  }
4618
4626
  } else if (shapeFlag & 8) {
4619
- if (el.textContent !== vnode.children) {
4627
+ let clientText = vnode.children;
4628
+ if (clientText[0] === "\n" && (el.tagName === "PRE" || el.tagName === "TEXTAREA")) {
4629
+ clientText = clientText.slice(1);
4630
+ }
4631
+ if (el.textContent !== clientText) {
4620
4632
  if (!isMismatchAllowed(el, 0 /* TEXT */)) {
4621
4633
  (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && warn$1(
4622
4634
  `Hydration text content mismatch on`,
@@ -4826,7 +4838,7 @@ Server rendered element contains fewer child nodes than client vdom.`
4826
4838
  }
4827
4839
  };
4828
4840
  const isTemplateNode = (node) => {
4829
- return node.nodeType === 1 && node.tagName.toLowerCase() === "template";
4841
+ return node.nodeType === 1 && node.tagName === "TEMPLATE";
4830
4842
  };
4831
4843
  return [hydrate, hydrateNode];
4832
4844
  }
@@ -5178,7 +5190,7 @@ function defineAsyncComponent(source) {
5178
5190
  load().then(() => {
5179
5191
  loaded.value = true;
5180
5192
  if (instance.parent && isKeepAlive(instance.parent.vnode)) {
5181
- queueJob(instance.parent.update);
5193
+ instance.parent.update();
5182
5194
  }
5183
5195
  }).catch((err) => {
5184
5196
  onError(err);
@@ -7131,7 +7143,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7131
7143
  return vm;
7132
7144
  }
7133
7145
  }
7134
- Vue.version = `2.6.14-compat:${"3.5.4"}`;
7146
+ Vue.version = `2.6.14-compat:${"3.5.6"}`;
7135
7147
  Vue.config = singletonApp.config;
7136
7148
  Vue.use = (plugin, ...options) => {
7137
7149
  if (plugin && isFunction(plugin.install)) {
@@ -8993,6 +9005,7 @@ function baseCreateRenderer(options, createHydrationFns) {
8993
9005
  }
8994
9006
  }
8995
9007
  if (instance.asyncDep) {
9008
+ if (!!(process.env.NODE_ENV !== "production") && isHmrUpdating) initialVNode.el = null;
8996
9009
  parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized);
8997
9010
  if (!initialVNode.el) {
8998
9011
  const placeholder = instance.subTree = createVNode(Comment);
@@ -9988,11 +10001,12 @@ function doWatch(source, cb, options = EMPTY_OBJ) {
9988
10001
  } else if (!cb || immediate) {
9989
10002
  baseWatchOptions.once = true;
9990
10003
  } else {
9991
- return {
9992
- stop: NOOP,
9993
- resume: NOOP,
9994
- pause: NOOP
10004
+ const watchStopHandle = () => {
9995
10005
  };
10006
+ watchStopHandle.stop = NOOP;
10007
+ watchStopHandle.resume = NOOP;
10008
+ watchStopHandle.pause = NOOP;
10009
+ return watchStopHandle;
9996
10010
  }
9997
10011
  }
9998
10012
  const instance = currentInstance;
@@ -12298,7 +12312,7 @@ function isMemoSame(cached, memo) {
12298
12312
  return true;
12299
12313
  }
12300
12314
 
12301
- const version = "3.5.4";
12315
+ const version = "3.5.6";
12302
12316
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
12303
12317
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12304
12318
  const devtools = !!(process.env.NODE_ENV !== "production") || true ? devtools$1 : void 0;
@@ -13286,6 +13300,7 @@ class VueElement extends BaseClass {
13286
13300
  }
13287
13301
  }
13288
13302
  connectedCallback() {
13303
+ if (!this.isConnected) return;
13289
13304
  if (!this.shadowRoot) {
13290
13305
  this._parseSlots();
13291
13306
  }
@@ -13328,7 +13343,7 @@ class VueElement extends BaseClass {
13328
13343
  this._ob = null;
13329
13344
  }
13330
13345
  this._app && this._app.unmount();
13331
- this._instance.ce = void 0;
13346
+ if (this._instance) this._instance.ce = void 0;
13332
13347
  this._app = this._instance = null;
13333
13348
  }
13334
13349
  });
@@ -13547,7 +13562,7 @@ class VueElement extends BaseClass {
13547
13562
  }
13548
13563
  }
13549
13564
  /**
13550
- * Only called when shaddowRoot is false
13565
+ * Only called when shadowRoot is false
13551
13566
  */
13552
13567
  _parseSlots() {
13553
13568
  const slots = this._slots = {};
@@ -13559,10 +13574,10 @@ class VueElement extends BaseClass {
13559
13574
  }
13560
13575
  }
13561
13576
  /**
13562
- * Only called when shaddowRoot is false
13577
+ * Only called when shadowRoot is false
13563
13578
  */
13564
13579
  _renderSlots() {
13565
- const outlets = this.querySelectorAll("slot");
13580
+ const outlets = (this._teleportTarget || this).querySelectorAll("slot");
13566
13581
  const scopeId = this._instance.type.__scopeId;
13567
13582
  for (let i = 0; i < outlets.length; i++) {
13568
13583
  const o = outlets[i];
@@ -13750,7 +13765,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
13750
13765
  child,
13751
13766
  resolveTransitionHooks(child, cssTransitionProps, state, instance)
13752
13767
  );
13753
- } else if (!!(process.env.NODE_ENV !== "production")) {
13768
+ } else if (!!(process.env.NODE_ENV !== "production") && child.type !== Text) {
13754
13769
  warn(`<TransitionGroup> children must be keyed.`);
13755
13770
  }
13756
13771
  }
@@ -14986,7 +15001,7 @@ class Tokenizer {
14986
15001
  this.sequenceIndex += 1;
14987
15002
  } else if (this.sequenceIndex === 0) {
14988
15003
  if (this.currentSequence === Sequences.TitleEnd || this.currentSequence === Sequences.TextareaEnd && !this.inSFCRoot) {
14989
- if (c === this.delimiterOpen[0]) {
15004
+ if (!this.inVPre && c === this.delimiterOpen[0]) {
14990
15005
  this.state = 2;
14991
15006
  this.delimiterIndex = 0;
14992
15007
  this.stateInterpolationOpen(c);
@@ -15956,6 +15971,7 @@ const defaultParserOptions = {
15956
15971
  getNamespace: () => 0,
15957
15972
  isVoidTag: NO,
15958
15973
  isPreTag: NO,
15974
+ isIgnoreNewlineTag: NO,
15959
15975
  isCustomElement: NO,
15960
15976
  onError: defaultOnError,
15961
15977
  onWarn: defaultOnWarn,
@@ -16398,7 +16414,7 @@ function onCloseTag(el, end, isImplied = false) {
16398
16414
  el.innerLoc.end.offset
16399
16415
  );
16400
16416
  }
16401
- const { tag, ns } = el;
16417
+ const { tag, ns, children } = el;
16402
16418
  if (!inVPre) {
16403
16419
  if (tag === "slot") {
16404
16420
  el.tagType = 2;
@@ -16409,7 +16425,13 @@ function onCloseTag(el, end, isImplied = false) {
16409
16425
  }
16410
16426
  }
16411
16427
  if (!tokenizer.inRCDATA) {
16412
- el.children = condenseWhitespace(el.children, el.tag);
16428
+ el.children = condenseWhitespace(children);
16429
+ }
16430
+ if (ns === 0 && currentOptions.isIgnoreNewlineTag(tag)) {
16431
+ const first = children[0];
16432
+ if (first && first.type === 2) {
16433
+ first.content = first.content.replace(/^\r?\n/, "");
16434
+ }
16413
16435
  }
16414
16436
  if (ns === 0 && currentOptions.isPreTag(tag)) {
16415
16437
  inPre--;
@@ -16561,12 +16583,6 @@ function condenseWhitespace(nodes, tag) {
16561
16583
  }
16562
16584
  }
16563
16585
  }
16564
- if (inPre && tag && currentOptions.isPreTag(tag)) {
16565
- const first = nodes[0];
16566
- if (first && first.type === 2) {
16567
- first.content = first.content.replace(/^\r?\n/, "");
16568
- }
16569
- }
16570
16586
  return removedWhitespace ? nodes.filter(Boolean) : nodes;
16571
16587
  }
16572
16588
  function isAllWhitespace(str) {
@@ -19835,6 +19851,7 @@ const parserOptions = {
19835
19851
  isVoidTag,
19836
19852
  isNativeTag: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag),
19837
19853
  isPreTag: (tag) => tag === "pre",
19854
+ isIgnoreNewlineTag: (tag) => tag === "pre" || tag === "textarea",
19838
19855
  decodeEntities: decodeHtmlBrowser ,
19839
19856
  isBuiltInComponent: (tag) => {
19840
19857
  if (tag === "Transition" || tag === "transition") {