@vue/compat 3.5.42 → 3.5.43

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.42
2
+ * @vue/compat v3.5.43
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -128,10 +128,10 @@ function normalizeStyle(value) {
128
128
  }
129
129
  const listDelimiterRE = /;(?![^(]*\))/g;
130
130
  const propertyDelimiterRE = /:([^]+)/;
131
- const styleCommentRE = /\/\*[^]*?\*\//g;
131
+ const styleCommentRE = /"(?:[^"\\]|\\[^])*"|'(?:[^'\\]|\\[^])*'|\\[^]|\/\*[^]*?\*\//g;
132
132
  function parseStringStyle(cssText) {
133
133
  const ret = {};
134
- cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
134
+ cssText.replace(styleCommentRE, (match) => match.startsWith("/*") ? "" : match).split(listDelimiterRE).forEach((item) => {
135
135
  if (item) {
136
136
  const tmp = item.split(propertyDelimiterRE);
137
137
  tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
@@ -221,22 +221,22 @@ function getEscapedCssVarName(key, doubleEscape) {
221
221
  );
222
222
  }
223
223
 
224
- function looseCompareArrays(a, b) {
224
+ function looseCompareArrays(a, b, seen) {
225
225
  if (a.length !== b.length) return false;
226
226
  let equal = true;
227
227
  for (let i = 0; equal && i < a.length; i++) {
228
- equal = looseEqual(a[i], b[i]);
228
+ equal = looseEqual(a[i], b[i], seen);
229
229
  }
230
230
  return equal;
231
231
  }
232
- function looseCompareCollections(a, b) {
232
+ function looseCompareCollections(a, b, seen) {
233
233
  if (a.size !== b.size) return false;
234
234
  const candidates = Array.from(b);
235
235
  const matched = new Uint8Array(candidates.length);
236
236
  for (const item of a) {
237
237
  let index = -1;
238
238
  for (let i = 0; i < candidates.length; i++) {
239
- if (!matched[i] && looseEqual(item, candidates[i])) {
239
+ if (!matched[i] && looseEqual(item, candidates[i], seen)) {
240
240
  index = i;
241
241
  break;
242
242
  }
@@ -246,7 +246,47 @@ function looseCompareCollections(a, b) {
246
246
  }
247
247
  return true;
248
248
  }
249
- function looseEqual(a, b) {
249
+ function looseCompareObjects(a, b, seen) {
250
+ let aValidType = isMap(a);
251
+ let bValidType = isMap(b);
252
+ if (aValidType || bValidType) {
253
+ return aValidType && bValidType ? looseCompareCollections(a, b, seen) : false;
254
+ }
255
+ aValidType = isSet(a);
256
+ bValidType = isSet(b);
257
+ if (aValidType || bValidType) {
258
+ return aValidType && bValidType ? looseCompareCollections(a, b, seen) : false;
259
+ }
260
+ const aKeysCount = Object.keys(a).length;
261
+ const bKeysCount = Object.keys(b).length;
262
+ if (aKeysCount !== bKeysCount) {
263
+ return false;
264
+ }
265
+ for (const key in a) {
266
+ const aHasKey = a.hasOwnProperty(key);
267
+ const bHasKey = b.hasOwnProperty(key);
268
+ if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key], seen)) {
269
+ return false;
270
+ }
271
+ }
272
+ return String(a) === String(b);
273
+ }
274
+ function looseCompareNested(a, b, seen, compare) {
275
+ if (!seen) {
276
+ seen = [/* @__PURE__ */ new Map(), /* @__PURE__ */ new Map()];
277
+ }
278
+ const [seenA, seenB] = seen;
279
+ if (seenA.has(a) || seenB.has(b)) {
280
+ return seenA.get(a) === b && seenB.get(b) === a;
281
+ }
282
+ seenA.set(a, b);
283
+ seenB.set(b, a);
284
+ const equal = compare(a, b, seen);
285
+ seenA.delete(a);
286
+ seenB.delete(b);
287
+ return equal;
288
+ }
289
+ function looseEqual(a, b, seen) {
250
290
  if (a === b) return true;
251
291
  let aValidType = isDate(a);
252
292
  let bValidType = isDate(b);
@@ -261,7 +301,7 @@ function looseEqual(a, b) {
261
301
  aValidType = isArray(a);
262
302
  bValidType = isArray(b);
263
303
  if (aValidType || bValidType) {
264
- return aValidType && bValidType ? looseCompareArrays(a, b) : false;
304
+ return aValidType && bValidType ? looseCompareNested(a, b, seen, looseCompareArrays) : false;
265
305
  }
266
306
  aValidType = isObject(a);
267
307
  bValidType = isObject(b);
@@ -269,28 +309,7 @@ function looseEqual(a, b) {
269
309
  if (!aValidType || !bValidType) {
270
310
  return false;
271
311
  }
272
- aValidType = isMap(a);
273
- bValidType = isMap(b);
274
- if (aValidType || bValidType) {
275
- return aValidType && bValidType ? looseCompareCollections(a, b) : false;
276
- }
277
- aValidType = isSet(a);
278
- bValidType = isSet(b);
279
- if (aValidType || bValidType) {
280
- return aValidType && bValidType ? looseCompareCollections(a, b) : false;
281
- }
282
- const aKeysCount = Object.keys(a).length;
283
- const bKeysCount = Object.keys(b).length;
284
- if (aKeysCount !== bKeysCount) {
285
- return false;
286
- }
287
- for (const key in a) {
288
- const aHasKey = a.hasOwnProperty(key);
289
- const bHasKey = b.hasOwnProperty(key);
290
- if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
291
- return false;
292
- }
293
- }
312
+ return looseCompareNested(a, b, seen, looseCompareObjects);
294
313
  }
295
314
  return String(a) === String(b);
296
315
  }
@@ -1091,7 +1110,9 @@ function reactiveReadArray(array) {
1091
1110
  const raw = toRaw(array);
1092
1111
  if (raw === array) return raw;
1093
1112
  track(raw, "iterate", ARRAY_ITERATE_KEY);
1094
- return isShallow(array) ? raw : raw.map(toReactive);
1113
+ if (isShallow(array)) return raw;
1114
+ if (!isReadonly(array)) return raw.map(toReactive);
1115
+ return isReactive(array) ? raw.map((item) => toReadonly(toReactive(item))) : raw.map(toReadonly);
1095
1116
  }
1096
1117
  function shallowReadArray(arr) {
1097
1118
  track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY);
@@ -4832,13 +4853,15 @@ function createHydrationFunctions(rendererInternals) {
4832
4853
  getContainerType(container),
4833
4854
  optimized
4834
4855
  );
4835
- if (isAsyncWrapper(vnode) && !vnode.component.subTree) {
4856
+ if ((isAsyncWrapper(vnode) || vnode.component.asyncDep) && !vnode.component.subTree) {
4836
4857
  let subTree;
4837
4858
  if (isFragmentStart) {
4838
4859
  subTree = createVNode(Static);
4839
4860
  subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
4840
4861
  } else {
4841
- subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
4862
+ subTree = node.nodeType === 3 ? createTextVNode("") : createVNode(
4863
+ node.nodeType === 8 ? Comment : "div"
4864
+ );
4842
4865
  }
4843
4866
  subTree.el = node;
4844
4867
  vnode.component.subTree = subTree;
@@ -7616,7 +7639,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7616
7639
  return vm;
7617
7640
  }
7618
7641
  }
7619
- Vue.version = `2.6.14-compat:${"3.5.42"}`;
7642
+ Vue.version = `2.6.14-compat:${"3.5.43"}`;
7620
7643
  Vue.config = singletonApp.config;
7621
7644
  Vue.use = (plugin, ...options) => {
7622
7645
  if (plugin && isFunction(plugin.install)) {
@@ -9472,6 +9495,12 @@ function baseCreateRenderer(options, createHydrationFns) {
9472
9495
  optimized = false;
9473
9496
  n2.dynamicChildren = null;
9474
9497
  }
9498
+ if (n2.dynamicChildren && n1 && n1.dynamicChildren && n1.dynamicChildren.hasOnce) {
9499
+ if (n2.dynamicChildren === EMPTY_ARR) {
9500
+ n2.dynamicChildren = [];
9501
+ }
9502
+ n2.dynamicChildren.hasOnce = true;
9503
+ }
9475
9504
  const { type, ref, shapeFlag } = n2;
9476
9505
  switch (type) {
9477
9506
  case Text:
@@ -10080,6 +10109,7 @@ function baseCreateRenderer(options, createHydrationFns) {
10080
10109
  {
10081
10110
  pushWarningContext(n2);
10082
10111
  }
10112
+ n2.el = n1.el;
10083
10113
  updateComponentPreRender(instance, n2, optimized);
10084
10114
  {
10085
10115
  popWarningContext();
@@ -10695,7 +10725,7 @@ function baseCreateRenderer(options, createHydrationFns) {
10695
10725
  cacheIndex,
10696
10726
  memo
10697
10727
  } = vnode;
10698
- if (patchFlag === -2) {
10728
+ if (patchFlag === -2 || dynamicChildren && dynamicChildren.hasOnce) {
10699
10729
  optimized = false;
10700
10730
  }
10701
10731
  if (ref != null) {
@@ -10703,7 +10733,7 @@ function baseCreateRenderer(options, createHydrationFns) {
10703
10733
  setRef(ref, null, parentSuspense, vnode, true);
10704
10734
  resetTracking();
10705
10735
  }
10706
- if (cacheIndex != null) {
10736
+ if (cacheIndex != null && (!vnode.ctx || vnode.ctx === parentComponent)) {
10707
10737
  parentComponent.renderCache[cacheIndex] = void 0;
10708
10738
  }
10709
10739
  if (shapeFlag & 256) {
@@ -10784,6 +10814,9 @@ function baseCreateRenderer(options, createHydrationFns) {
10784
10814
  }
10785
10815
  if (type === Static) {
10786
10816
  removeStaticNode(vnode);
10817
+ if (transition && !transition.persisted && transition.afterLeave) {
10818
+ transition.afterLeave();
10819
+ }
10787
10820
  return;
10788
10821
  }
10789
10822
  const performRemove = () => {
@@ -10830,6 +10863,9 @@ function baseCreateRenderer(options, createHydrationFns) {
10830
10863
  if (job) {
10831
10864
  job.flags |= 8;
10832
10865
  unmount(subTree, instance, parentSuspense, doRemove);
10866
+ } else if (instance.vnode.el && subTree) {
10867
+ subTree.transition = instance.vnode.transition;
10868
+ unmount(subTree, instance, parentSuspense, doRemove);
10833
10869
  }
10834
10870
  if (um) {
10835
10871
  queuePostRenderEffect(um, parentSuspense);
@@ -11050,7 +11086,7 @@ const SuspenseImpl = {
11050
11086
  rendererInternals
11051
11087
  );
11052
11088
  } else {
11053
- if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) {
11089
+ if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback && !parentSuspense.isHydrating) {
11054
11090
  n2.suspense = n1.suspense;
11055
11091
  n2.suspense.vnode = n2;
11056
11092
  n2.el = n1.el;
@@ -11136,10 +11172,12 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
11136
11172
  if (pendingBranch) {
11137
11173
  suspense.pendingBranch = newBranch;
11138
11174
  if (isSameVNodeType(pendingBranch, newBranch)) {
11175
+ suspense.deps++;
11139
11176
  patch(
11140
11177
  pendingBranch,
11141
11178
  newBranch,
11142
- suspense.hiddenContainer,
11179
+ // a hydrating pending branch is adopted SSR DOM, already in place
11180
+ isHydrating ? container : suspense.hiddenContainer,
11143
11181
  null,
11144
11182
  parentComponent,
11145
11183
  suspense,
@@ -11147,6 +11185,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
11147
11185
  slotScopeIds,
11148
11186
  optimized
11149
11187
  );
11188
+ suspense.deps--;
11150
11189
  if (suspense.deps <= 0) {
11151
11190
  suspense.resolve();
11152
11191
  } else if (isInFallback) {
@@ -11412,6 +11451,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11412
11451
  suspense.effects = [];
11413
11452
  if (isSuspensible) {
11414
11453
  if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
11454
+ parentSuspenseId = void 0;
11415
11455
  parentSuspense.deps--;
11416
11456
  if (parentSuspense.deps === 0 && !sync) {
11417
11457
  parentSuspense.resolve();
@@ -11485,6 +11525,12 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11485
11525
  return;
11486
11526
  }
11487
11527
  unsetCurrentInstance();
11528
+ if (hydratedEl && !instance.scope.active) {
11529
+ if (isInPendingSuspense && --suspense.deps === 0) {
11530
+ suspense.resolve();
11531
+ }
11532
+ return;
11533
+ }
11488
11534
  instance.asyncResolved = true;
11489
11535
  const { vnode: vnode2 } = instance;
11490
11536
  {
@@ -11970,7 +12016,8 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
11970
12016
  el: vnode.el,
11971
12017
  anchor: vnode.anchor,
11972
12018
  ctx: vnode.ctx,
11973
- ce: vnode.ce
12019
+ ce: vnode.ce,
12020
+ cacheIndex: vnode.cacheIndex
11974
12021
  };
11975
12022
  if (transition && cloneTransition) {
11976
12023
  setTransitionHooks(
@@ -12790,7 +12837,7 @@ function isMemoSame(cached, memo) {
12790
12837
  return true;
12791
12838
  }
12792
12839
 
12793
- const version = "3.5.42";
12840
+ const version = "3.5.43";
12794
12841
  const warn = warn$1 ;
12795
12842
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12796
12843
  const devtools = devtools$1 ;