@vue/compat 3.3.5 → 3.3.7

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.
@@ -594,7 +594,7 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
594
594
  } else if (key === "length" && isArray(target)) {
595
595
  const newLength = Number(newValue);
596
596
  depsMap.forEach((dep, key2) => {
597
- if (key2 === "length" || key2 >= newLength) {
597
+ if (key2 === "length" || !isSymbol(key2) && key2 >= newLength) {
598
598
  deps.push(dep);
599
599
  }
600
600
  });
@@ -1481,8 +1481,13 @@ function findInsertionIndex(id) {
1481
1481
  let end = queue.length;
1482
1482
  while (start < end) {
1483
1483
  const middle = start + end >>> 1;
1484
- const middleJobId = getId(queue[middle]);
1485
- middleJobId < id ? start = middle + 1 : end = middle;
1484
+ const middleJob = queue[middle];
1485
+ const middleJobId = getId(middleJob);
1486
+ if (middleJobId < id || middleJobId === id && middleJob.pre) {
1487
+ start = middle + 1;
1488
+ } else {
1489
+ end = middle;
1490
+ }
1486
1491
  }
1487
1492
  return start;
1488
1493
  }
@@ -2435,14 +2440,16 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
2435
2440
  parentComponent: parentComponent2,
2436
2441
  container: container2
2437
2442
  } = suspense;
2443
+ let delayEnter = false;
2438
2444
  if (suspense.isHydrating) {
2439
2445
  suspense.isHydrating = false;
2440
2446
  } else if (!resume) {
2441
- const delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
2447
+ delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
2442
2448
  if (delayEnter) {
2443
2449
  activeBranch.transition.afterLeave = () => {
2444
2450
  if (pendingId === suspense.pendingId) {
2445
2451
  move(pendingBranch, container2, anchor2, 0);
2452
+ queuePostFlushCb(effects);
2446
2453
  }
2447
2454
  };
2448
2455
  }
@@ -2468,7 +2475,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
2468
2475
  }
2469
2476
  parent = parent.parent;
2470
2477
  }
2471
- if (!hasUnresolvedAncestor) {
2478
+ if (!hasUnresolvedAncestor && !delayEnter) {
2472
2479
  queuePostFlushCb(effects);
2473
2480
  }
2474
2481
  suspense.effects = [];
@@ -4033,7 +4040,7 @@ function defineLegacyVNodeProperties(vnode) {
4033
4040
  }
4034
4041
  }
4035
4042
 
4036
- const normalizedFunctionalComponentMap = /* @__PURE__ */ new Map();
4043
+ const normalizedFunctionalComponentMap = /* @__PURE__ */ new WeakMap();
4037
4044
  const legacySlotProxyHandlers = {
4038
4045
  get(target, key) {
4039
4046
  const slot = target[key];
@@ -5065,7 +5072,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
5065
5072
  return vm;
5066
5073
  }
5067
5074
  }
5068
- Vue.version = `2.6.14-compat:${"3.3.5"}`;
5075
+ Vue.version = `2.6.14-compat:${"3.3.7"}`;
5069
5076
  Vue.config = singletonApp.config;
5070
5077
  Vue.use = (p, ...options) => {
5071
5078
  if (p && isFunction(p.install)) {
@@ -5427,7 +5434,7 @@ function createAppAPI(render, hydrate) {
5427
5434
  rootProps = null;
5428
5435
  }
5429
5436
  const context = createAppContext();
5430
- const installedPlugins = /* @__PURE__ */ new Set();
5437
+ const installedPlugins = /* @__PURE__ */ new WeakSet();
5431
5438
  let isMounted = false;
5432
5439
  const app = context.app = {
5433
5440
  _uid: uid$1++,
@@ -5962,7 +5969,7 @@ const updateSlots = (instance, children, optimized) => {
5962
5969
  }
5963
5970
  if (needDeletionCheck) {
5964
5971
  for (const key in slots) {
5965
- if (!isInternalKey(key) && !(key in deletionComparisonTarget)) {
5972
+ if (!isInternalKey(key) && deletionComparisonTarget[key] == null) {
5966
5973
  delete slots[key];
5967
5974
  }
5968
5975
  }
@@ -6118,7 +6125,14 @@ function createHydrationFunctions(rendererInternals) {
6118
6125
  break;
6119
6126
  case Comment:
6120
6127
  if (domType !== 8 /* COMMENT */ || isFragmentStart) {
6121
- nextNode = onMismatch();
6128
+ if (node.tagName.toLowerCase() === "template") {
6129
+ const content = vnode.el.content.firstChild;
6130
+ replaceNode(content, node, parentComponent);
6131
+ vnode.el = node = content;
6132
+ nextNode = nextSibling(node);
6133
+ } else {
6134
+ nextNode = onMismatch();
6135
+ }
6122
6136
  } else {
6123
6137
  nextNode = nextSibling(node);
6124
6138
  }
@@ -6160,7 +6174,7 @@ function createHydrationFunctions(rendererInternals) {
6160
6174
  break;
6161
6175
  default:
6162
6176
  if (shapeFlag & 1) {
6163
- if (domType !== 1 /* ELEMENT */ || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) {
6177
+ if ((domType !== 1 /* ELEMENT */ || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) {
6164
6178
  nextNode = onMismatch();
6165
6179
  } else {
6166
6180
  nextNode = hydrateElement(
@@ -6175,6 +6189,13 @@ function createHydrationFunctions(rendererInternals) {
6175
6189
  } else if (shapeFlag & 6) {
6176
6190
  vnode.slotScopeIds = slotScopeIds;
6177
6191
  const container = parentNode(node);
6192
+ if (isFragmentStart) {
6193
+ nextNode = locateClosingAnchor(node);
6194
+ } else if (isComment(node) && node.data === "teleport start") {
6195
+ nextNode = locateClosingAnchor(node, node.data, "teleport end");
6196
+ } else {
6197
+ nextNode = nextSibling(node);
6198
+ }
6178
6199
  mountComponent(
6179
6200
  vnode,
6180
6201
  container,
@@ -6184,10 +6205,6 @@ function createHydrationFunctions(rendererInternals) {
6184
6205
  isSVGContainer(container),
6185
6206
  optimized
6186
6207
  );
6187
- nextNode = isFragmentStart ? locateClosingAsyncAnchor(node) : nextSibling(node);
6188
- if (nextNode && isComment(nextNode) && nextNode.data === "teleport end") {
6189
- nextNode = nextSibling(nextNode);
6190
- }
6191
6208
  if (isAsyncWrapper(vnode)) {
6192
6209
  let subTree;
6193
6210
  if (isFragmentStart) {
@@ -6235,7 +6252,7 @@ function createHydrationFunctions(rendererInternals) {
6235
6252
  };
6236
6253
  const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
6237
6254
  optimized = optimized || !!vnode.dynamicChildren;
6238
- const { type, props, patchFlag, shapeFlag, dirs } = vnode;
6255
+ const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
6239
6256
  const forcePatchValue = type === "input" && dirs || type === "option";
6240
6257
  if (forcePatchValue || patchFlag !== -1) {
6241
6258
  if (dirs) {
@@ -6272,12 +6289,23 @@ function createHydrationFunctions(rendererInternals) {
6272
6289
  if (vnodeHooks = props && props.onVnodeBeforeMount) {
6273
6290
  invokeVNodeHook(vnodeHooks, parentComponent, vnode);
6274
6291
  }
6292
+ let needCallTransitionHooks = false;
6293
+ if (isTemplateNode(el)) {
6294
+ needCallTransitionHooks = needTransition(parentSuspense, transition) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
6295
+ const content = el.content.firstChild;
6296
+ if (needCallTransitionHooks) {
6297
+ transition.beforeEnter(content);
6298
+ }
6299
+ replaceNode(content, el, parentComponent);
6300
+ vnode.el = el = content;
6301
+ }
6275
6302
  if (dirs) {
6276
6303
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
6277
6304
  }
6278
- if ((vnodeHooks = props && props.onVnodeMounted) || dirs) {
6305
+ if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) {
6279
6306
  queueEffectWithSuspense(() => {
6280
6307
  vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
6308
+ needCallTransitionHooks && transition.enter(el);
6281
6309
  dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
6282
6310
  }, parentSuspense);
6283
6311
  }
@@ -6367,7 +6395,7 @@ function createHydrationFunctions(rendererInternals) {
6367
6395
  hasMismatch = true;
6368
6396
  vnode.el = null;
6369
6397
  if (isFragment) {
6370
- const end = locateClosingAsyncAnchor(node);
6398
+ const end = locateClosingAnchor(node);
6371
6399
  while (true) {
6372
6400
  const next2 = nextSibling(node);
6373
6401
  if (next2 && next2 !== end) {
@@ -6392,14 +6420,14 @@ function createHydrationFunctions(rendererInternals) {
6392
6420
  );
6393
6421
  return next;
6394
6422
  };
6395
- const locateClosingAsyncAnchor = (node) => {
6423
+ const locateClosingAnchor = (node, open = "[", close = "]") => {
6396
6424
  let match = 0;
6397
6425
  while (node) {
6398
6426
  node = nextSibling(node);
6399
6427
  if (node && isComment(node)) {
6400
- if (node.data === "[")
6428
+ if (node.data === open)
6401
6429
  match++;
6402
- if (node.data === "]") {
6430
+ if (node.data === close) {
6403
6431
  if (match === 0) {
6404
6432
  return nextSibling(node);
6405
6433
  } else {
@@ -6410,6 +6438,23 @@ function createHydrationFunctions(rendererInternals) {
6410
6438
  }
6411
6439
  return node;
6412
6440
  };
6441
+ const replaceNode = (newNode, oldNode, parentComponent) => {
6442
+ const parentNode2 = oldNode.parentNode;
6443
+ if (parentNode2) {
6444
+ parentNode2.replaceChild(newNode, oldNode);
6445
+ }
6446
+ let parent = parentComponent;
6447
+ while (parent) {
6448
+ if (parent.vnode.el === oldNode) {
6449
+ parent.vnode.el = newNode;
6450
+ parent.subTree.el = newNode;
6451
+ }
6452
+ parent = parent.parent;
6453
+ }
6454
+ };
6455
+ const isTemplateNode = (node) => {
6456
+ return node.nodeType === 1 /* ELEMENT */ && node.tagName.toLowerCase() === "template";
6457
+ };
6413
6458
  return [hydrate, hydrateNode];
6414
6459
  }
6415
6460
 
@@ -6665,7 +6710,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6665
6710
  if (dirs) {
6666
6711
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
6667
6712
  }
6668
- const needCallTransitionHooks = (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
6713
+ const needCallTransitionHooks = needTransition(parentSuspense, transition);
6669
6714
  if (needCallTransitionHooks) {
6670
6715
  transition.beforeEnter(el);
6671
6716
  }
@@ -7491,8 +7536,8 @@ function baseCreateRenderer(options, createHydrationFns) {
7491
7536
  moveStaticNode(vnode, container, anchor);
7492
7537
  return;
7493
7538
  }
7494
- const needTransition = moveType !== 2 && shapeFlag & 1 && transition;
7495
- if (needTransition) {
7539
+ const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
7540
+ if (needTransition2) {
7496
7541
  if (moveType === 0) {
7497
7542
  transition.beforeEnter(el);
7498
7543
  hostInsert(el, container, anchor);
@@ -7707,6 +7752,9 @@ function baseCreateRenderer(options, createHydrationFns) {
7707
7752
  function toggleRecurse({ effect, update }, allowed) {
7708
7753
  effect.allowRecurse = update.allowRecurse = allowed;
7709
7754
  }
7755
+ function needTransition(parentSuspense, transition) {
7756
+ return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
7757
+ }
7710
7758
  function traverseStaticChildren(n1, n2, shallow = false) {
7711
7759
  const ch1 = n1.children;
7712
7760
  const ch2 = n2.children;
@@ -7906,19 +7954,18 @@ const TeleportImpl = {
7906
7954
  if (target) {
7907
7955
  hostRemove(targetAnchor);
7908
7956
  }
7909
- if (doRemove || !isTeleportDisabled(props)) {
7910
- hostRemove(anchor);
7911
- if (shapeFlag & 16) {
7912
- for (let i = 0; i < children.length; i++) {
7913
- const child = children[i];
7914
- unmount(
7915
- child,
7916
- parentComponent,
7917
- parentSuspense,
7918
- true,
7919
- !!child.dynamicChildren
7920
- );
7921
- }
7957
+ doRemove && hostRemove(anchor);
7958
+ if (shapeFlag & 16) {
7959
+ const shouldRemove = doRemove || !isTeleportDisabled(props);
7960
+ for (let i = 0; i < children.length; i++) {
7961
+ const child = children[i];
7962
+ unmount(
7963
+ child,
7964
+ parentComponent,
7965
+ parentSuspense,
7966
+ shouldRemove,
7967
+ !!child.dynamicChildren
7968
+ );
7922
7969
  }
7923
7970
  }
7924
7971
  },
@@ -8002,7 +8049,7 @@ function updateCssVars(vnode) {
8002
8049
  const ctx = vnode.ctx;
8003
8050
  if (ctx && ctx.ut) {
8004
8051
  let node = vnode.children[0].el;
8005
- while (node !== vnode.targetAnchor) {
8052
+ while (node && node !== vnode.targetAnchor) {
8006
8053
  if (node.nodeType === 1)
8007
8054
  node.setAttribute("data-v-owner", ctx.uid);
8008
8055
  node = node.nextSibling;
@@ -8011,7 +8058,7 @@ function updateCssVars(vnode) {
8011
8058
  }
8012
8059
  }
8013
8060
 
8014
- const normalizedAsyncComponentMap = /* @__PURE__ */ new Map();
8061
+ const normalizedAsyncComponentMap = /* @__PURE__ */ new WeakMap();
8015
8062
  function convertLegacyAsyncComponent(comp) {
8016
8063
  if (normalizedAsyncComponentMap.has(comp)) {
8017
8064
  return normalizedAsyncComponentMap.get(comp);
@@ -8753,7 +8800,7 @@ function isMemoSame(cached, memo) {
8753
8800
  return true;
8754
8801
  }
8755
8802
 
8756
- const version = "3.3.5";
8803
+ const version = "3.3.7";
8757
8804
  const _ssrUtils = {
8758
8805
  createComponentInstance,
8759
8806
  setupComponent,
@@ -11812,9 +11859,13 @@ function walk(node, context, doNotHoistNode = false) {
11812
11859
  context.transformHoist(children, context, node);
11813
11860
  }
11814
11861
  if (hoistedCount && hoistedCount === originalCount && node.type === 1 && node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
11815
- node.codegenNode.children = context.hoist(
11862
+ const hoisted = context.hoist(
11816
11863
  createArrayExpression(node.codegenNode.children)
11817
11864
  );
11865
+ if (context.hmr) {
11866
+ hoisted.content = `[...${hoisted.content}]`;
11867
+ }
11868
+ node.codegenNode.children = hoisted;
11818
11869
  }
11819
11870
  }
11820
11871
  function getConstantType(node, context) {
@@ -11987,6 +12038,7 @@ function createTransformContext(root, {
11987
12038
  filename = "",
11988
12039
  prefixIdentifiers = false,
11989
12040
  hoistStatic: hoistStatic2 = false,
12041
+ hmr = false,
11990
12042
  cacheHandlers = false,
11991
12043
  nodeTransforms = [],
11992
12044
  directiveTransforms = {},
@@ -12012,6 +12064,7 @@ function createTransformContext(root, {
12012
12064
  selfName: nameMatch && capitalize(camelize(nameMatch[1])),
12013
12065
  prefixIdentifiers,
12014
12066
  hoistStatic: hoistStatic2,
12067
+ hmr,
12015
12068
  cacheHandlers,
12016
12069
  nodeTransforms,
12017
12070
  directiveTransforms,
@@ -12037,7 +12090,7 @@ function createTransformContext(root, {
12037
12090
  directives: /* @__PURE__ */ new Set(),
12038
12091
  hoists: [],
12039
12092
  imports: [],
12040
- constantCache: /* @__PURE__ */ new Map(),
12093
+ constantCache: /* @__PURE__ */ new WeakMap(),
12041
12094
  temps: 0,
12042
12095
  cached: 0,
12043
12096
  identifiers: /* @__PURE__ */ Object.create(null),
@@ -14014,7 +14067,7 @@ const trackVForSlotScopes = (node, context) => {
14014
14067
  }
14015
14068
  }
14016
14069
  };
14017
- const buildClientSlotFn = (props, children, loc) => createFunctionExpression(
14070
+ const buildClientSlotFn = (props, _vForExp, children, loc) => createFunctionExpression(
14018
14071
  props,
14019
14072
  children,
14020
14073
  false,
@@ -14039,7 +14092,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
14039
14092
  slotsProperties.push(
14040
14093
  createObjectProperty(
14041
14094
  arg || createSimpleExpression("default", true),
14042
- buildSlotFn(exp, children, loc)
14095
+ buildSlotFn(exp, void 0, children, loc)
14043
14096
  )
14044
14097
  );
14045
14098
  }
@@ -14076,10 +14129,15 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
14076
14129
  } else {
14077
14130
  hasDynamicSlots = true;
14078
14131
  }
14079
- const slotFunction = buildSlotFn(slotProps, slotChildren, slotLoc);
14132
+ const vFor = findDir(slotElement, "for");
14133
+ const slotFunction = buildSlotFn(
14134
+ slotProps,
14135
+ vFor == null ? void 0 : vFor.exp,
14136
+ slotChildren,
14137
+ slotLoc
14138
+ );
14080
14139
  let vIf;
14081
14140
  let vElse;
14082
- let vFor;
14083
14141
  if (vIf = findDir(slotElement, "if")) {
14084
14142
  hasDynamicSlots = true;
14085
14143
  dynamicSlots.push(
@@ -14124,7 +14182,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
14124
14182
  createCompilerError(30, vElse.loc)
14125
14183
  );
14126
14184
  }
14127
- } else if (vFor = findDir(slotElement, "for")) {
14185
+ } else if (vFor) {
14128
14186
  hasDynamicSlots = true;
14129
14187
  const parseResult = vFor.parseResult || parseForExpression(vFor.exp, context);
14130
14188
  if (parseResult) {
@@ -14165,7 +14223,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
14165
14223
  }
14166
14224
  if (!onComponentSlot) {
14167
14225
  const buildDefaultSlotProperty = (props, children2) => {
14168
- const fn = buildSlotFn(props, children2, loc);
14226
+ const fn = buildSlotFn(props, void 0, children2, loc);
14169
14227
  if (context.compatConfig) {
14170
14228
  fn.isNonScopedSlot = true;
14171
14229
  }