@vue/compat 3.5.3 → 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.3
2
+ * @vue/compat v3.5.5
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -12,9 +12,10 @@ var sourceMapJs = require('source-map-js');
12
12
 
13
13
  /*! #__NO_SIDE_EFFECTS__ */
14
14
  // @__NO_SIDE_EFFECTS__
15
- function makeMap(str, expectsLowerCase) {
16
- const set = new Set(str.split(","));
17
- return expectsLowerCase ? (val) => set.has(val.toLowerCase()) : (val) => set.has(val);
15
+ function makeMap(str) {
16
+ const map = /* @__PURE__ */ Object.create(null);
17
+ for (const key of str.split(",")) map[key] = 1;
18
+ return (val) => val in map;
18
19
  }
19
20
 
20
21
  const EMPTY_OBJ = Object.freeze({}) ;
@@ -712,9 +713,11 @@ function prepareDeps(sub) {
712
713
  function cleanupDeps(sub) {
713
714
  let head;
714
715
  let tail = sub.depsTail;
715
- for (let link = tail; link; link = link.prevDep) {
716
+ let link = tail;
717
+ while (link) {
718
+ const prev = link.prevDep;
716
719
  if (link.version === -1) {
717
- if (link === tail) tail = link.prevDep;
720
+ if (link === tail) tail = prev;
718
721
  removeSub(link);
719
722
  removeDep(link);
720
723
  } else {
@@ -722,13 +725,14 @@ function cleanupDeps(sub) {
722
725
  }
723
726
  link.dep.activeLink = link.prevActiveLink;
724
727
  link.prevActiveLink = void 0;
728
+ link = prev;
725
729
  }
726
730
  sub.deps = head;
727
731
  sub.depsTail = tail;
728
732
  }
729
733
  function isDirty(sub) {
730
734
  for (let link = sub.deps; link; link = link.nextDep) {
731
- if (link.dep.version !== link.version || link.dep.computed && refreshComputed(link.dep.computed) === false || link.dep.version !== link.version) {
735
+ if (link.dep.version !== link.version || link.dep.computed && refreshComputed(link.dep.computed) || link.dep.version !== link.version) {
732
736
  return true;
733
737
  }
734
738
  }
@@ -738,9 +742,6 @@ function isDirty(sub) {
738
742
  return false;
739
743
  }
740
744
  function refreshComputed(computed) {
741
- if (computed.flags & 2) {
742
- return false;
743
- }
744
745
  if (computed.flags & 4 && !(computed.flags & 16)) {
745
746
  return;
746
747
  }
@@ -853,6 +854,14 @@ function cleanupEffect(e) {
853
854
  }
854
855
 
855
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
+ }
856
865
  class Dep {
857
866
  constructor(computed) {
858
867
  this.computed = computed;
@@ -875,16 +884,7 @@ class Dep {
875
884
  }
876
885
  let link = this.activeLink;
877
886
  if (link === void 0 || link.sub !== activeSub) {
878
- link = this.activeLink = {
879
- dep: this,
880
- sub: activeSub,
881
- version: this.version,
882
- nextDep: void 0,
883
- prevDep: void 0,
884
- nextSub: void 0,
885
- prevSub: void 0,
886
- prevActiveLink: void 0
887
- };
887
+ link = this.activeLink = new Link(activeSub, this);
888
888
  if (!activeSub.deps) {
889
889
  activeSub.deps = activeSub.depsTail = link;
890
890
  } else {
@@ -1007,9 +1007,23 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
1007
1007
  globalVersion++;
1008
1008
  return;
1009
1009
  }
1010
- let deps = [];
1010
+ const run = (dep) => {
1011
+ if (dep) {
1012
+ {
1013
+ dep.trigger({
1014
+ target,
1015
+ type,
1016
+ key,
1017
+ newValue,
1018
+ oldValue,
1019
+ oldTarget
1020
+ });
1021
+ }
1022
+ }
1023
+ };
1024
+ startBatch();
1011
1025
  if (type === "clear") {
1012
- deps = [...depsMap.values()];
1026
+ depsMap.forEach(run);
1013
1027
  } else {
1014
1028
  const targetIsArray = isArray(target);
1015
1029
  const isArrayIndex = targetIsArray && isIntegerKey(key);
@@ -1017,57 +1031,43 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
1017
1031
  const newLength = Number(newValue);
1018
1032
  depsMap.forEach((dep, key2) => {
1019
1033
  if (key2 === "length" || key2 === ARRAY_ITERATE_KEY || !isSymbol(key2) && key2 >= newLength) {
1020
- deps.push(dep);
1034
+ run(dep);
1021
1035
  }
1022
1036
  });
1023
1037
  } else {
1024
- const push = (dep) => dep && deps.push(dep);
1025
1038
  if (key !== void 0) {
1026
- push(depsMap.get(key));
1039
+ run(depsMap.get(key));
1027
1040
  }
1028
1041
  if (isArrayIndex) {
1029
- push(depsMap.get(ARRAY_ITERATE_KEY));
1042
+ run(depsMap.get(ARRAY_ITERATE_KEY));
1030
1043
  }
1031
1044
  switch (type) {
1032
1045
  case "add":
1033
1046
  if (!targetIsArray) {
1034
- push(depsMap.get(ITERATE_KEY));
1047
+ run(depsMap.get(ITERATE_KEY));
1035
1048
  if (isMap(target)) {
1036
- push(depsMap.get(MAP_KEY_ITERATE_KEY));
1049
+ run(depsMap.get(MAP_KEY_ITERATE_KEY));
1037
1050
  }
1038
1051
  } else if (isArrayIndex) {
1039
- push(depsMap.get("length"));
1052
+ run(depsMap.get("length"));
1040
1053
  }
1041
1054
  break;
1042
1055
  case "delete":
1043
1056
  if (!targetIsArray) {
1044
- push(depsMap.get(ITERATE_KEY));
1057
+ run(depsMap.get(ITERATE_KEY));
1045
1058
  if (isMap(target)) {
1046
- push(depsMap.get(MAP_KEY_ITERATE_KEY));
1059
+ run(depsMap.get(MAP_KEY_ITERATE_KEY));
1047
1060
  }
1048
1061
  }
1049
1062
  break;
1050
1063
  case "set":
1051
1064
  if (isMap(target)) {
1052
- push(depsMap.get(ITERATE_KEY));
1065
+ run(depsMap.get(ITERATE_KEY));
1053
1066
  }
1054
1067
  break;
1055
1068
  }
1056
1069
  }
1057
1070
  }
1058
- startBatch();
1059
- for (const dep of deps) {
1060
- {
1061
- dep.trigger({
1062
- target,
1063
- type,
1064
- key,
1065
- newValue,
1066
- oldValue,
1067
- oldTarget
1068
- });
1069
- }
1070
- }
1071
1071
  endBatch();
1072
1072
  }
1073
1073
  function getDepFromReactive(object, key) {
@@ -1805,7 +1805,7 @@ function toRaw(observed) {
1805
1805
  return raw ? toRaw(raw) : observed;
1806
1806
  }
1807
1807
  function markRaw(value) {
1808
- if (Object.isExtensible(value)) {
1808
+ if (!hasOwn(value, "__v_skip") && Object.isExtensible(value)) {
1809
1809
  def(value, "__v_skip", true);
1810
1810
  }
1811
1811
  return value;
@@ -2015,8 +2015,8 @@ class ComputedRefImpl {
2015
2015
  * @internal
2016
2016
  */
2017
2017
  notify() {
2018
+ this.flags |= 16;
2018
2019
  if (activeSub !== this) {
2019
- this.flags |= 16;
2020
2020
  this.dep.notify();
2021
2021
  }
2022
2022
  }
@@ -2704,23 +2704,19 @@ function flushJobs(seen) {
2704
2704
  }
2705
2705
  }
2706
2706
  function checkRecursiveUpdates(seen, fn) {
2707
- if (!seen.has(fn)) {
2708
- seen.set(fn, 1);
2709
- } else {
2710
- const count = seen.get(fn);
2711
- if (count > RECURSION_LIMIT) {
2712
- const instance = fn.i;
2713
- const componentName = instance && getComponentName(instance.type);
2714
- handleError(
2715
- `Maximum recursive updates exceeded${componentName ? ` in component <${componentName}>` : ``}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`,
2716
- null,
2717
- 10
2718
- );
2719
- return true;
2720
- } else {
2721
- seen.set(fn, count + 1);
2722
- }
2707
+ const count = seen.get(fn) || 0;
2708
+ if (count > RECURSION_LIMIT) {
2709
+ const instance = fn.i;
2710
+ const componentName = instance && getComponentName(instance.type);
2711
+ handleError(
2712
+ `Maximum recursive updates exceeded${componentName ? ` in component <${componentName}>` : ``}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`,
2713
+ null,
2714
+ 10
2715
+ );
2716
+ return true;
2723
2717
  }
2718
+ seen.set(fn, count + 1);
2719
+ return false;
2724
2720
  }
2725
2721
 
2726
2722
  let isHmrUpdating = false;
@@ -2801,7 +2797,9 @@ function reload(id, newComp) {
2801
2797
  dirtyInstances.delete(instance);
2802
2798
  } else if (instance.parent) {
2803
2799
  queueJob(() => {
2800
+ isHmrUpdating = true;
2804
2801
  instance.parent.update();
2802
+ isHmrUpdating = false;
2805
2803
  dirtyInstances.delete(instance);
2806
2804
  });
2807
2805
  } else if (instance.appContext.reload) {
@@ -3620,6 +3618,9 @@ const TeleportImpl = {
3620
3618
  insert(mainAnchor, container, anchor);
3621
3619
  const mount = (container2, anchor2) => {
3622
3620
  if (shapeFlag & 16) {
3621
+ if (parentComponent && parentComponent.isCE) {
3622
+ parentComponent.ce._teleportTarget = container2;
3623
+ }
3623
3624
  mountChildren(
3624
3625
  children,
3625
3626
  container2,
@@ -4653,7 +4654,11 @@ Server rendered element contains more child nodes than client vdom.`
4653
4654
  remove(cur);
4654
4655
  }
4655
4656
  } else if (shapeFlag & 8) {
4656
- 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) {
4657
4662
  if (!isMismatchAllowed(el, 0 /* TEXT */)) {
4658
4663
  warn$1(
4659
4664
  `Hydration text content mismatch on`,
@@ -4852,7 +4857,7 @@ Server rendered element contains fewer child nodes than client vdom.`
4852
4857
  }
4853
4858
  };
4854
4859
  const isTemplateNode = (node) => {
4855
- return node.nodeType === 1 && node.tagName.toLowerCase() === "template";
4860
+ return node.nodeType === 1 && node.tagName === "TEMPLATE";
4856
4861
  };
4857
4862
  return [hydrate, hydrateNode];
4858
4863
  }
@@ -5204,7 +5209,7 @@ function defineAsyncComponent(source) {
5204
5209
  load().then(() => {
5205
5210
  loaded.value = true;
5206
5211
  if (instance.parent && isKeepAlive(instance.parent.vnode)) {
5207
- queueJob(instance.parent.update);
5212
+ instance.parent.update();
5208
5213
  }
5209
5214
  }).catch((err) => {
5210
5215
  onError(err);
@@ -5896,13 +5901,15 @@ function renderList(source, renderItem, cache, index) {
5896
5901
  const sourceIsArray = isArray(source);
5897
5902
  if (sourceIsArray || isString(source)) {
5898
5903
  const sourceIsReactiveArray = sourceIsArray && isReactive(source);
5904
+ let needsWrap = false;
5899
5905
  if (sourceIsReactiveArray) {
5906
+ needsWrap = !isShallow(source);
5900
5907
  source = shallowReadArray(source);
5901
5908
  }
5902
5909
  ret = new Array(source.length);
5903
5910
  for (let i = 0, l = source.length; i < l; i++) {
5904
5911
  ret[i] = renderItem(
5905
- sourceIsReactiveArray ? toReactive(source[i]) : source[i],
5912
+ needsWrap ? toReactive(source[i]) : source[i],
5906
5913
  i,
5907
5914
  void 0,
5908
5915
  cached && cached[i]
@@ -7153,7 +7160,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7153
7160
  return vm;
7154
7161
  }
7155
7162
  }
7156
- Vue.version = `2.6.14-compat:${"3.5.3"}`;
7163
+ Vue.version = `2.6.14-compat:${"3.5.5"}`;
7157
7164
  Vue.config = singletonApp.config;
7158
7165
  Vue.use = (plugin, ...options) => {
7159
7166
  if (plugin && isFunction(plugin.install)) {
@@ -8975,6 +8982,7 @@ function baseCreateRenderer(options, createHydrationFns) {
8975
8982
  }
8976
8983
  }
8977
8984
  if (instance.asyncDep) {
8985
+ if (isHmrUpdating) initialVNode.el = null;
8978
8986
  parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized);
8979
8987
  if (!initialVNode.el) {
8980
8988
  const placeholder = instance.subTree = createVNode(Comment);
@@ -12266,7 +12274,7 @@ function isMemoSame(cached, memo) {
12266
12274
  return true;
12267
12275
  }
12268
12276
 
12269
- const version = "3.5.3";
12277
+ const version = "3.5.5";
12270
12278
  const warn = warn$1 ;
12271
12279
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12272
12280
  const devtools = devtools$1 ;
@@ -13188,6 +13196,7 @@ class VueElement extends BaseClass {
13188
13196
  }
13189
13197
  }
13190
13198
  connectedCallback() {
13199
+ if (!this.isConnected) return;
13191
13200
  if (!this.shadowRoot) {
13192
13201
  this._parseSlots();
13193
13202
  }
@@ -13230,7 +13239,7 @@ class VueElement extends BaseClass {
13230
13239
  this._ob = null;
13231
13240
  }
13232
13241
  this._app && this._app.unmount();
13233
- this._instance.ce = void 0;
13242
+ if (this._instance) this._instance.ce = void 0;
13234
13243
  this._app = this._instance = null;
13235
13244
  }
13236
13245
  });
@@ -13449,7 +13458,7 @@ class VueElement extends BaseClass {
13449
13458
  }
13450
13459
  }
13451
13460
  /**
13452
- * Only called when shaddowRoot is false
13461
+ * Only called when shadowRoot is false
13453
13462
  */
13454
13463
  _parseSlots() {
13455
13464
  const slots = this._slots = {};
@@ -13461,10 +13470,10 @@ class VueElement extends BaseClass {
13461
13470
  }
13462
13471
  }
13463
13472
  /**
13464
- * Only called when shaddowRoot is false
13473
+ * Only called when shadowRoot is false
13465
13474
  */
13466
13475
  _renderSlots() {
13467
- const outlets = this.querySelectorAll("slot");
13476
+ const outlets = (this._teleportTarget || this).querySelectorAll("slot");
13468
13477
  const scopeId = this._instance.type.__scopeId;
13469
13478
  for (let i = 0; i < outlets.length; i++) {
13470
13479
  const o = outlets[i];
@@ -13652,7 +13661,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
13652
13661
  child,
13653
13662
  resolveTransitionHooks(child, cssTransitionProps, state, instance)
13654
13663
  );
13655
- } else {
13664
+ } else if (child.type !== Text) {
13656
13665
  warn(`<TransitionGroup> children must be keyed.`);
13657
13666
  }
13658
13667
  }
@@ -14889,7 +14898,7 @@ class Tokenizer {
14889
14898
  if (this.currentSequence === Sequences.TitleEnd || this.currentSequence === Sequences.TextareaEnd && !this.inSFCRoot) {
14890
14899
  if (c === 38) {
14891
14900
  this.startEntity();
14892
- } else if (c === this.delimiterOpen[0]) {
14901
+ } else if (!this.inVPre && c === this.delimiterOpen[0]) {
14893
14902
  this.state = 2;
14894
14903
  this.delimiterIndex = 0;
14895
14904
  this.stateInterpolationOpen(c);
@@ -16293,6 +16302,7 @@ const defaultParserOptions = {
16293
16302
  getNamespace: () => 0,
16294
16303
  isVoidTag: NO,
16295
16304
  isPreTag: NO,
16305
+ isIgnoreNewlineTag: NO,
16296
16306
  isCustomElement: NO,
16297
16307
  onError: defaultOnError,
16298
16308
  onWarn: defaultOnWarn,
@@ -16732,7 +16742,7 @@ function onCloseTag(el, end, isImplied = false) {
16732
16742
  el.innerLoc.end.offset
16733
16743
  );
16734
16744
  }
16735
- const { tag, ns } = el;
16745
+ const { tag, ns, children } = el;
16736
16746
  if (!inVPre) {
16737
16747
  if (tag === "slot") {
16738
16748
  el.tagType = 2;
@@ -16743,7 +16753,13 @@ function onCloseTag(el, end, isImplied = false) {
16743
16753
  }
16744
16754
  }
16745
16755
  if (!tokenizer.inRCDATA) {
16746
- 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
+ }
16747
16763
  }
16748
16764
  if (ns === 0 && currentOptions.isPreTag(tag)) {
16749
16765
  inPre--;
@@ -16895,12 +16911,6 @@ function condenseWhitespace(nodes, tag) {
16895
16911
  }
16896
16912
  }
16897
16913
  }
16898
- if (inPre && tag && currentOptions.isPreTag(tag)) {
16899
- const first = nodes[0];
16900
- if (first && first.type === 2) {
16901
- first.content = first.content.replace(/^\r?\n/, "");
16902
- }
16903
- }
16904
16914
  return removedWhitespace ? nodes.filter(Boolean) : nodes;
16905
16915
  }
16906
16916
  function isAllWhitespace(str) {
@@ -17558,10 +17568,8 @@ function createRootCodegen(root, context) {
17558
17568
  }
17559
17569
  } else if (children.length > 1) {
17560
17570
  let patchFlag = 64;
17561
- let patchFlagText = PatchFlagNames[64];
17562
17571
  if (children.filter((c) => c.type !== 3).length === 1) {
17563
17572
  patchFlag |= 2048;
17564
- patchFlagText += `, ${PatchFlagNames[2048]}`;
17565
17573
  }
17566
17574
  root.codegenNode = createVNodeCall(
17567
17575
  context,
@@ -18823,10 +18831,8 @@ function createChildrenCodegenNode(branch, keyIndex, context) {
18823
18831
  return vnodeCall;
18824
18832
  } else {
18825
18833
  let patchFlag = 64;
18826
- let patchFlagText = PatchFlagNames[64];
18827
18834
  if (!branch.isTemplateIf && children.filter((c) => c.type !== 3).length === 1) {
18828
18835
  patchFlag |= 2048;
18829
- patchFlagText += `, ${PatchFlagNames[2048]}`;
18830
18836
  }
18831
18837
  return createVNodeCall(
18832
18838
  context,
@@ -20750,6 +20756,7 @@ const parserOptions = {
20750
20756
  isVoidTag,
20751
20757
  isNativeTag: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag),
20752
20758
  isPreTag: (tag) => tag === "pre",
20759
+ isIgnoreNewlineTag: (tag) => tag === "pre" || tag === "textarea",
20753
20760
  decodeEntities: void 0,
20754
20761
  isBuiltInComponent: (tag) => {
20755
20762
  if (tag === "Transition" || tag === "transition") {
@@ -20977,10 +20984,7 @@ const isNonKeyModifier = /* @__PURE__ */ makeMap(
20977
20984
  `stop,prevent,self,ctrl,shift,alt,meta,exact,middle`
20978
20985
  );
20979
20986
  const maybeKeyModifier = /* @__PURE__ */ makeMap("left,right");
20980
- const isKeyboardEvent = /* @__PURE__ */ makeMap(
20981
- `onkeyup,onkeydown,onkeypress`,
20982
- true
20983
- );
20987
+ const isKeyboardEvent = /* @__PURE__ */ makeMap(`onkeyup,onkeydown,onkeypress`);
20984
20988
  const resolveModifiers = (key, modifiers, context, loc) => {
20985
20989
  const keyModifiers = [];
20986
20990
  const nonKeyModifiers = [];
@@ -20998,7 +21002,7 @@ const resolveModifiers = (key, modifiers, context, loc) => {
20998
21002
  } else {
20999
21003
  if (maybeKeyModifier(modifier)) {
21000
21004
  if (isStaticExp(key)) {
21001
- if (isKeyboardEvent(key.content)) {
21005
+ if (isKeyboardEvent(key.content.toLowerCase())) {
21002
21006
  keyModifiers.push(modifier);
21003
21007
  } else {
21004
21008
  nonKeyModifiers.push(modifier);
@@ -21051,7 +21055,7 @@ const transformOn = (dir, node, context) => {
21051
21055
  ]);
21052
21056
  }
21053
21057
  if (keyModifiers.length && // if event name is dynamic, always wrap with keys guard
21054
- (!isStaticExp(key) || isKeyboardEvent(key.content))) {
21058
+ (!isStaticExp(key) || isKeyboardEvent(key.content.toLowerCase()))) {
21055
21059
  handlerExp = createCallExpression(context.helper(V_ON_WITH_KEYS), [
21056
21060
  handlerExp,
21057
21061
  JSON.stringify(keyModifiers)
@@ -21145,12 +21149,17 @@ const stringifyStatic = (children, context, parent) => {
21145
21149
  // will insert / hydrate
21146
21150
  String(currentChunk.length)
21147
21151
  ]);
21152
+ const deleteCount = currentChunk.length - 1;
21148
21153
  if (isParentCached) {
21149
- parent.codegenNode.children.value = createArrayExpression([staticCall]);
21154
+ children.splice(
21155
+ currentIndex - currentChunk.length,
21156
+ currentChunk.length,
21157
+ // @ts-expect-error
21158
+ staticCall
21159
+ );
21150
21160
  } else {
21151
21161
  currentChunk[0].codegenNode.value = staticCall;
21152
21162
  if (currentChunk.length > 1) {
21153
- const deleteCount = currentChunk.length - 1;
21154
21163
  children.splice(currentIndex - currentChunk.length + 1, deleteCount);
21155
21164
  const cacheIndex = context.cached.indexOf(
21156
21165
  currentChunk[currentChunk.length - 1].codegenNode
@@ -21162,9 +21171,9 @@ const stringifyStatic = (children, context, parent) => {
21162
21171
  }
21163
21172
  context.cached.splice(cacheIndex - deleteCount + 1, deleteCount);
21164
21173
  }
21165
- return deleteCount;
21166
21174
  }
21167
21175
  }
21176
+ return deleteCount;
21168
21177
  }
21169
21178
  return 0;
21170
21179
  };