@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
  **/
@@ -199,10 +199,10 @@ function normalizeStyle(value) {
199
199
  }
200
200
  const listDelimiterRE = /;(?![^(]*\))/g;
201
201
  const propertyDelimiterRE = /:([^]+)/;
202
- const styleCommentRE = /\/\*[^]*?\*\//g;
202
+ const styleCommentRE = /"(?:[^"\\]|\\[^])*"|'(?:[^'\\]|\\[^])*'|\\[^]|\/\*[^]*?\*\//g;
203
203
  function parseStringStyle(cssText) {
204
204
  const ret = {};
205
- cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
205
+ cssText.replace(styleCommentRE, (match) => match.startsWith("/*") ? "" : match).split(listDelimiterRE).forEach((item) => {
206
206
  if (item) {
207
207
  const tmp = item.split(propertyDelimiterRE);
208
208
  tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
@@ -294,22 +294,22 @@ function getEscapedCssVarName(key, doubleEscape) {
294
294
  );
295
295
  }
296
296
 
297
- function looseCompareArrays(a, b) {
297
+ function looseCompareArrays(a, b, seen) {
298
298
  if (a.length !== b.length) return false;
299
299
  let equal = true;
300
300
  for (let i = 0; equal && i < a.length; i++) {
301
- equal = looseEqual(a[i], b[i]);
301
+ equal = looseEqual(a[i], b[i], seen);
302
302
  }
303
303
  return equal;
304
304
  }
305
- function looseCompareCollections(a, b) {
305
+ function looseCompareCollections(a, b, seen) {
306
306
  if (a.size !== b.size) return false;
307
307
  const candidates = Array.from(b);
308
308
  const matched = new Uint8Array(candidates.length);
309
309
  for (const item of a) {
310
310
  let index = -1;
311
311
  for (let i = 0; i < candidates.length; i++) {
312
- if (!matched[i] && looseEqual(item, candidates[i])) {
312
+ if (!matched[i] && looseEqual(item, candidates[i], seen)) {
313
313
  index = i;
314
314
  break;
315
315
  }
@@ -319,7 +319,47 @@ function looseCompareCollections(a, b) {
319
319
  }
320
320
  return true;
321
321
  }
322
- function looseEqual(a, b) {
322
+ function looseCompareObjects(a, b, seen) {
323
+ let aValidType = isMap(a);
324
+ let bValidType = isMap(b);
325
+ if (aValidType || bValidType) {
326
+ return aValidType && bValidType ? looseCompareCollections(a, b, seen) : false;
327
+ }
328
+ aValidType = isSet(a);
329
+ bValidType = isSet(b);
330
+ if (aValidType || bValidType) {
331
+ return aValidType && bValidType ? looseCompareCollections(a, b, seen) : false;
332
+ }
333
+ const aKeysCount = Object.keys(a).length;
334
+ const bKeysCount = Object.keys(b).length;
335
+ if (aKeysCount !== bKeysCount) {
336
+ return false;
337
+ }
338
+ for (const key in a) {
339
+ const aHasKey = a.hasOwnProperty(key);
340
+ const bHasKey = b.hasOwnProperty(key);
341
+ if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key], seen)) {
342
+ return false;
343
+ }
344
+ }
345
+ return String(a) === String(b);
346
+ }
347
+ function looseCompareNested(a, b, seen, compare) {
348
+ if (!seen) {
349
+ seen = [/* @__PURE__ */ new Map(), /* @__PURE__ */ new Map()];
350
+ }
351
+ const [seenA, seenB] = seen;
352
+ if (seenA.has(a) || seenB.has(b)) {
353
+ return seenA.get(a) === b && seenB.get(b) === a;
354
+ }
355
+ seenA.set(a, b);
356
+ seenB.set(b, a);
357
+ const equal = compare(a, b, seen);
358
+ seenA.delete(a);
359
+ seenB.delete(b);
360
+ return equal;
361
+ }
362
+ function looseEqual(a, b, seen) {
323
363
  if (a === b) return true;
324
364
  let aValidType = isDate(a);
325
365
  let bValidType = isDate(b);
@@ -334,7 +374,7 @@ function looseEqual(a, b) {
334
374
  aValidType = isArray(a);
335
375
  bValidType = isArray(b);
336
376
  if (aValidType || bValidType) {
337
- return aValidType && bValidType ? looseCompareArrays(a, b) : false;
377
+ return aValidType && bValidType ? looseCompareNested(a, b, seen, looseCompareArrays) : false;
338
378
  }
339
379
  aValidType = isObject(a);
340
380
  bValidType = isObject(b);
@@ -342,28 +382,7 @@ function looseEqual(a, b) {
342
382
  if (!aValidType || !bValidType) {
343
383
  return false;
344
384
  }
345
- aValidType = isMap(a);
346
- bValidType = isMap(b);
347
- if (aValidType || bValidType) {
348
- return aValidType && bValidType ? looseCompareCollections(a, b) : false;
349
- }
350
- aValidType = isSet(a);
351
- bValidType = isSet(b);
352
- if (aValidType || bValidType) {
353
- return aValidType && bValidType ? looseCompareCollections(a, b) : false;
354
- }
355
- const aKeysCount = Object.keys(a).length;
356
- const bKeysCount = Object.keys(b).length;
357
- if (aKeysCount !== bKeysCount) {
358
- return false;
359
- }
360
- for (const key in a) {
361
- const aHasKey = a.hasOwnProperty(key);
362
- const bHasKey = b.hasOwnProperty(key);
363
- if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
364
- return false;
365
- }
366
- }
385
+ return looseCompareNested(a, b, seen, looseCompareObjects);
367
386
  }
368
387
  return String(a) === String(b);
369
388
  }
@@ -1164,7 +1183,9 @@ function reactiveReadArray(array) {
1164
1183
  const raw = toRaw(array);
1165
1184
  if (raw === array) return raw;
1166
1185
  track(raw, "iterate", ARRAY_ITERATE_KEY);
1167
- return isShallow(array) ? raw : raw.map(toReactive);
1186
+ if (isShallow(array)) return raw;
1187
+ if (!isReadonly(array)) return raw.map(toReactive);
1188
+ return isReactive(array) ? raw.map((item) => toReadonly(toReactive(item))) : raw.map(toReadonly);
1168
1189
  }
1169
1190
  function shallowReadArray(arr) {
1170
1191
  track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY);
@@ -4905,13 +4926,15 @@ function createHydrationFunctions(rendererInternals) {
4905
4926
  getContainerType(container),
4906
4927
  optimized
4907
4928
  );
4908
- if (isAsyncWrapper(vnode) && !vnode.component.subTree) {
4929
+ if ((isAsyncWrapper(vnode) || vnode.component.asyncDep) && !vnode.component.subTree) {
4909
4930
  let subTree;
4910
4931
  if (isFragmentStart) {
4911
4932
  subTree = createVNode(Static);
4912
4933
  subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
4913
4934
  } else {
4914
- subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
4935
+ subTree = node.nodeType === 3 ? createTextVNode("") : createVNode(
4936
+ node.nodeType === 8 ? Comment : "div"
4937
+ );
4915
4938
  }
4916
4939
  subTree.el = node;
4917
4940
  vnode.component.subTree = subTree;
@@ -7689,7 +7712,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7689
7712
  return vm;
7690
7713
  }
7691
7714
  }
7692
- Vue.version = `2.6.14-compat:${"3.5.42"}`;
7715
+ Vue.version = `2.6.14-compat:${"3.5.43"}`;
7693
7716
  Vue.config = singletonApp.config;
7694
7717
  Vue.use = (plugin, ...options) => {
7695
7718
  if (plugin && isFunction(plugin.install)) {
@@ -9545,6 +9568,12 @@ function baseCreateRenderer(options, createHydrationFns) {
9545
9568
  optimized = false;
9546
9569
  n2.dynamicChildren = null;
9547
9570
  }
9571
+ if (n2.dynamicChildren && n1 && n1.dynamicChildren && n1.dynamicChildren.hasOnce) {
9572
+ if (n2.dynamicChildren === EMPTY_ARR) {
9573
+ n2.dynamicChildren = [];
9574
+ }
9575
+ n2.dynamicChildren.hasOnce = true;
9576
+ }
9548
9577
  const { type, ref, shapeFlag } = n2;
9549
9578
  switch (type) {
9550
9579
  case Text:
@@ -10153,6 +10182,7 @@ function baseCreateRenderer(options, createHydrationFns) {
10153
10182
  {
10154
10183
  pushWarningContext(n2);
10155
10184
  }
10185
+ n2.el = n1.el;
10156
10186
  updateComponentPreRender(instance, n2, optimized);
10157
10187
  {
10158
10188
  popWarningContext();
@@ -10768,7 +10798,7 @@ function baseCreateRenderer(options, createHydrationFns) {
10768
10798
  cacheIndex,
10769
10799
  memo
10770
10800
  } = vnode;
10771
- if (patchFlag === -2) {
10801
+ if (patchFlag === -2 || dynamicChildren && dynamicChildren.hasOnce) {
10772
10802
  optimized = false;
10773
10803
  }
10774
10804
  if (ref != null) {
@@ -10776,7 +10806,7 @@ function baseCreateRenderer(options, createHydrationFns) {
10776
10806
  setRef(ref, null, parentSuspense, vnode, true);
10777
10807
  resetTracking();
10778
10808
  }
10779
- if (cacheIndex != null) {
10809
+ if (cacheIndex != null && (!vnode.ctx || vnode.ctx === parentComponent)) {
10780
10810
  parentComponent.renderCache[cacheIndex] = void 0;
10781
10811
  }
10782
10812
  if (shapeFlag & 256) {
@@ -10857,6 +10887,9 @@ function baseCreateRenderer(options, createHydrationFns) {
10857
10887
  }
10858
10888
  if (type === Static) {
10859
10889
  removeStaticNode(vnode);
10890
+ if (transition && !transition.persisted && transition.afterLeave) {
10891
+ transition.afterLeave();
10892
+ }
10860
10893
  return;
10861
10894
  }
10862
10895
  const performRemove = () => {
@@ -10903,6 +10936,9 @@ function baseCreateRenderer(options, createHydrationFns) {
10903
10936
  if (job) {
10904
10937
  job.flags |= 8;
10905
10938
  unmount(subTree, instance, parentSuspense, doRemove);
10939
+ } else if (instance.vnode.el && subTree) {
10940
+ subTree.transition = instance.vnode.transition;
10941
+ unmount(subTree, instance, parentSuspense, doRemove);
10906
10942
  }
10907
10943
  if (um) {
10908
10944
  queuePostRenderEffect(um, parentSuspense);
@@ -11123,7 +11159,7 @@ const SuspenseImpl = {
11123
11159
  rendererInternals
11124
11160
  );
11125
11161
  } else {
11126
- if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) {
11162
+ if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback && !parentSuspense.isHydrating) {
11127
11163
  n2.suspense = n1.suspense;
11128
11164
  n2.suspense.vnode = n2;
11129
11165
  n2.el = n1.el;
@@ -11209,10 +11245,12 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
11209
11245
  if (pendingBranch) {
11210
11246
  suspense.pendingBranch = newBranch;
11211
11247
  if (isSameVNodeType(pendingBranch, newBranch)) {
11248
+ suspense.deps++;
11212
11249
  patch(
11213
11250
  pendingBranch,
11214
11251
  newBranch,
11215
- suspense.hiddenContainer,
11252
+ // a hydrating pending branch is adopted SSR DOM, already in place
11253
+ isHydrating ? container : suspense.hiddenContainer,
11216
11254
  null,
11217
11255
  parentComponent,
11218
11256
  suspense,
@@ -11220,6 +11258,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
11220
11258
  slotScopeIds,
11221
11259
  optimized
11222
11260
  );
11261
+ suspense.deps--;
11223
11262
  if (suspense.deps <= 0) {
11224
11263
  suspense.resolve();
11225
11264
  } else if (isInFallback) {
@@ -11485,6 +11524,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11485
11524
  suspense.effects = [];
11486
11525
  if (isSuspensible) {
11487
11526
  if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
11527
+ parentSuspenseId = void 0;
11488
11528
  parentSuspense.deps--;
11489
11529
  if (parentSuspense.deps === 0 && !sync) {
11490
11530
  parentSuspense.resolve();
@@ -11558,6 +11598,12 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11558
11598
  return;
11559
11599
  }
11560
11600
  unsetCurrentInstance();
11601
+ if (hydratedEl && !instance.scope.active) {
11602
+ if (isInPendingSuspense && --suspense.deps === 0) {
11603
+ suspense.resolve();
11604
+ }
11605
+ return;
11606
+ }
11561
11607
  instance.asyncResolved = true;
11562
11608
  const { vnode: vnode2 } = instance;
11563
11609
  {
@@ -12043,7 +12089,8 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
12043
12089
  el: vnode.el,
12044
12090
  anchor: vnode.anchor,
12045
12091
  ctx: vnode.ctx,
12046
- ce: vnode.ce
12092
+ ce: vnode.ce,
12093
+ cacheIndex: vnode.cacheIndex
12047
12094
  };
12048
12095
  if (transition && cloneTransition) {
12049
12096
  setTransitionHooks(
@@ -12863,7 +12910,7 @@ function isMemoSame(cached, memo) {
12863
12910
  return true;
12864
12911
  }
12865
12912
 
12866
- const version = "3.5.42";
12913
+ const version = "3.5.43";
12867
12914
  const warn = warn$1 ;
12868
12915
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12869
12916
  const devtools = devtools$1 ;