@vue/compat 3.5.20 → 3.5.21

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.20
2
+ * @vue/compat v3.5.21
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -10,7 +10,6 @@ var estreeWalker = require('estree-walker');
10
10
  var decode_js = require('entities/lib/decode.js');
11
11
  var sourceMapJs = require('source-map-js');
12
12
 
13
- /*! #__NO_SIDE_EFFECTS__ */
14
13
  // @__NO_SIDE_EFFECTS__
15
14
  function makeMap(str) {
16
15
  const map = /* @__PURE__ */ Object.create(null);
@@ -68,10 +67,10 @@ const cacheStringFunction = (fn) => {
68
67
  return hit || (cache[str] = fn(str));
69
68
  });
70
69
  };
71
- const camelizeRE = /-(\w)/g;
70
+ const camelizeRE = /-\w/g;
72
71
  const camelize = cacheStringFunction(
73
72
  (str) => {
74
- return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
73
+ return str.replace(camelizeRE, (c) => c.slice(1).toUpperCase());
75
74
  }
76
75
  );
77
76
  const hyphenateRE = /\B([A-Z])/g;
@@ -2280,11 +2279,11 @@ function traverse(value, depth = Infinity, seen) {
2280
2279
  if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
2281
2280
  return value;
2282
2281
  }
2283
- seen = seen || /* @__PURE__ */ new Set();
2284
- if (seen.has(value)) {
2282
+ seen = seen || /* @__PURE__ */ new Map();
2283
+ if ((seen.get(value) || 0) >= depth) {
2285
2284
  return value;
2286
2285
  }
2287
- seen.add(value);
2286
+ seen.set(value, depth);
2288
2287
  depth--;
2289
2288
  if (isRef(value)) {
2290
2289
  traverse(value.value, depth, seen);
@@ -2746,11 +2745,14 @@ function checkRecursiveUpdates(seen, fn) {
2746
2745
  let isHmrUpdating = false;
2747
2746
  const hmrDirtyComponents = /* @__PURE__ */ new Map();
2748
2747
  {
2749
- getGlobalThis().__VUE_HMR_RUNTIME__ = {
2750
- createRecord: tryWrap(createRecord),
2751
- rerender: tryWrap(rerender),
2752
- reload: tryWrap(reload)
2753
- };
2748
+ const g = getGlobalThis();
2749
+ if (!g.__VUE_HMR_RUNTIME__) {
2750
+ g.__VUE_HMR_RUNTIME__ = {
2751
+ createRecord: tryWrap(createRecord),
2752
+ rerender: tryWrap(rerender),
2753
+ reload: tryWrap(reload)
2754
+ };
2755
+ }
2754
2756
  }
2755
2757
  const map = /* @__PURE__ */ new Map();
2756
2758
  function registerHMR(instance) {
@@ -2823,10 +2825,12 @@ function reload(id, newComp) {
2823
2825
  dirtyInstances.delete(instance);
2824
2826
  } else if (instance.parent) {
2825
2827
  queueJob(() => {
2826
- isHmrUpdating = true;
2827
- instance.parent.update();
2828
- isHmrUpdating = false;
2829
- dirtyInstances.delete(instance);
2828
+ if (!(instance.job.flags & 8)) {
2829
+ isHmrUpdating = true;
2830
+ instance.parent.update();
2831
+ isHmrUpdating = false;
2832
+ dirtyInstances.delete(instance);
2833
+ }
2830
2834
  });
2831
2835
  } else if (instance.appContext.reload) {
2832
2836
  instance.appContext.reload();
@@ -2930,7 +2934,6 @@ const devtoolsComponentRemoved = (component) => {
2930
2934
  _devtoolsComponentRemoved(component);
2931
2935
  }
2932
2936
  };
2933
- /*! #__NO_SIDE_EFFECTS__ */
2934
2937
  // @__NO_SIDE_EFFECTS__
2935
2938
  function createDevtoolsComponentHook(hook) {
2936
2939
  return (component) => {
@@ -3856,26 +3859,34 @@ function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }
3856
3859
  function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, {
3857
3860
  o: { nextSibling, parentNode, querySelector, insert, createText }
3858
3861
  }, hydrateChildren) {
3862
+ function hydrateDisabledTeleport(node2, vnode2, targetStart, targetAnchor) {
3863
+ vnode2.anchor = hydrateChildren(
3864
+ nextSibling(node2),
3865
+ vnode2,
3866
+ parentNode(node2),
3867
+ parentComponent,
3868
+ parentSuspense,
3869
+ slotScopeIds,
3870
+ optimized
3871
+ );
3872
+ vnode2.targetStart = targetStart;
3873
+ vnode2.targetAnchor = targetAnchor;
3874
+ }
3859
3875
  const target = vnode.target = resolveTarget(
3860
3876
  vnode.props,
3861
3877
  querySelector
3862
3878
  );
3879
+ const disabled = isTeleportDisabled(vnode.props);
3863
3880
  if (target) {
3864
- const disabled = isTeleportDisabled(vnode.props);
3865
3881
  const targetNode = target._lpa || target.firstChild;
3866
3882
  if (vnode.shapeFlag & 16) {
3867
3883
  if (disabled) {
3868
- vnode.anchor = hydrateChildren(
3869
- nextSibling(node),
3884
+ hydrateDisabledTeleport(
3885
+ node,
3870
3886
  vnode,
3871
- parentNode(node),
3872
- parentComponent,
3873
- parentSuspense,
3874
- slotScopeIds,
3875
- optimized
3887
+ targetNode,
3888
+ targetNode && nextSibling(targetNode)
3876
3889
  );
3877
- vnode.targetStart = targetNode;
3878
- vnode.targetAnchor = targetNode && nextSibling(targetNode);
3879
3890
  } else {
3880
3891
  vnode.anchor = nextSibling(node);
3881
3892
  let targetAnchor = targetNode;
@@ -3906,6 +3917,10 @@ function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScope
3906
3917
  }
3907
3918
  }
3908
3919
  updateCssVars(vnode, disabled);
3920
+ } else if (disabled) {
3921
+ if (vnode.shapeFlag & 16) {
3922
+ hydrateDisabledTeleport(node, vnode, node, nextSibling(node));
3923
+ }
3909
3924
  }
3910
3925
  return vnode.anchor && nextSibling(vnode.anchor);
3911
3926
  }
@@ -4017,7 +4032,7 @@ const BaseTransitionImpl = {
4017
4032
  setTransitionHooks(innerChild, enterHooks);
4018
4033
  }
4019
4034
  let oldInnerChild = instance.subTree && getInnerChild$1(instance.subTree);
4020
- if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild) && recursiveGetSubtree(instance).type !== Comment) {
4035
+ if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(oldInnerChild, innerChild) && recursiveGetSubtree(instance).type !== Comment) {
4021
4036
  let leavingHooks = resolveTransitionHooks(
4022
4037
  oldInnerChild,
4023
4038
  rawProps,
@@ -4300,7 +4315,6 @@ function getTransitionRawChildren(children, keepComment = false, parentKey) {
4300
4315
  return ret;
4301
4316
  }
4302
4317
 
4303
- /*! #__NO_SIDE_EFFECTS__ */
4304
4318
  // @__NO_SIDE_EFFECTS__
4305
4319
  function defineComponent(options, extraOptions) {
4306
4320
  return isFunction(options) ? (
@@ -4353,6 +4367,7 @@ function useTemplateRef(key) {
4353
4367
  return ret;
4354
4368
  }
4355
4369
 
4370
+ const pendingSetRefMap = /* @__PURE__ */ new WeakMap();
4356
4371
  function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4357
4372
  if (isArray(rawRef)) {
4358
4373
  rawRef.forEach(
@@ -4402,6 +4417,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4402
4417
  return !knownTemplateRefs.has(ref2);
4403
4418
  };
4404
4419
  if (oldRef != null && oldRef !== ref) {
4420
+ invalidatePendingSetRef(oldRawRef);
4405
4421
  if (isString(oldRef)) {
4406
4422
  refs[oldRef] = null;
4407
4423
  if (canSetSetupRef(oldRef)) {
@@ -4459,9 +4475,15 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4459
4475
  }
4460
4476
  };
4461
4477
  if (value) {
4462
- doSet.id = -1;
4463
- queuePostRenderEffect(doSet, parentSuspense);
4478
+ const job = () => {
4479
+ doSet();
4480
+ pendingSetRefMap.delete(rawRef);
4481
+ };
4482
+ job.id = -1;
4483
+ pendingSetRefMap.set(rawRef, job);
4484
+ queuePostRenderEffect(job, parentSuspense);
4464
4485
  } else {
4486
+ invalidatePendingSetRef(rawRef);
4465
4487
  doSet();
4466
4488
  }
4467
4489
  } else {
@@ -4469,6 +4491,13 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4469
4491
  }
4470
4492
  }
4471
4493
  }
4494
+ function invalidatePendingSetRef(rawRef) {
4495
+ const pendingSetRef = pendingSetRefMap.get(rawRef);
4496
+ if (pendingSetRef) {
4497
+ pendingSetRef.flags |= 8;
4498
+ pendingSetRefMap.delete(rawRef);
4499
+ }
4500
+ }
4472
4501
 
4473
4502
  let hasLoggedMismatchError = false;
4474
4503
  const logMismatchError = () => {
@@ -5201,7 +5230,6 @@ function forEachElement(node, cb) {
5201
5230
  }
5202
5231
 
5203
5232
  const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
5204
- /*! #__NO_SIDE_EFFECTS__ */
5205
5233
  // @__NO_SIDE_EFFECTS__
5206
5234
  function defineAsyncComponent(source) {
5207
5235
  if (isFunction(source)) {
@@ -7295,7 +7323,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7295
7323
  return vm;
7296
7324
  }
7297
7325
  }
7298
- Vue.version = `2.6.14-compat:${"3.5.20"}`;
7326
+ Vue.version = `2.6.14-compat:${"3.5.21"}`;
7299
7327
  Vue.config = singletonApp.config;
7300
7328
  Vue.use = (plugin, ...options) => {
7301
7329
  if (plugin && isFunction(plugin.install)) {
@@ -7553,7 +7581,7 @@ function installCompatMount(app, context, render) {
7553
7581
  {
7554
7582
  for (let i = 0; i < container.attributes.length; i++) {
7555
7583
  const attr = container.attributes[i];
7556
- if (attr.name !== "v-cloak" && /^(v-|:|@)/.test(attr.name)) {
7584
+ if (attr.name !== "v-cloak" && /^(?:v-|:|@)/.test(attr.name)) {
7557
7585
  warnDeprecation$1("GLOBAL_MOUNT_CONTAINER", null);
7558
7586
  break;
7559
7587
  }
@@ -10365,8 +10393,9 @@ function emit(instance, event, ...rawArgs) {
10365
10393
  return emit$1(instance, event, args);
10366
10394
  }
10367
10395
  }
10396
+ const mixinEmitsCache = /* @__PURE__ */ new WeakMap();
10368
10397
  function normalizeEmitsOptions(comp, appContext, asMixin = false) {
10369
- const cache = appContext.emitsCache;
10398
+ const cache = asMixin ? mixinEmitsCache : appContext.emitsCache;
10370
10399
  const cached = cache.get(comp);
10371
10400
  if (cached !== void 0) {
10372
10401
  return cached;
@@ -10838,7 +10867,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
10838
10867
  const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense;
10839
10868
  if (pendingBranch) {
10840
10869
  suspense.pendingBranch = newBranch;
10841
- if (isSameVNodeType(newBranch, pendingBranch)) {
10870
+ if (isSameVNodeType(pendingBranch, newBranch)) {
10842
10871
  patch(
10843
10872
  pendingBranch,
10844
10873
  newBranch,
@@ -10909,7 +10938,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
10909
10938
  );
10910
10939
  setActiveBranch(suspense, newFallback);
10911
10940
  }
10912
- } else if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
10941
+ } else if (activeBranch && isSameVNodeType(activeBranch, newBranch)) {
10913
10942
  patch(
10914
10943
  activeBranch,
10915
10944
  newBranch,
@@ -10940,7 +10969,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
10940
10969
  }
10941
10970
  }
10942
10971
  } else {
10943
- if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
10972
+ if (activeBranch && isSameVNodeType(activeBranch, newBranch)) {
10944
10973
  patch(
10945
10974
  activeBranch,
10946
10975
  newBranch,
@@ -12176,7 +12205,7 @@ function getComponentPublicInstance(instance) {
12176
12205
  return instance.proxy;
12177
12206
  }
12178
12207
  }
12179
- const classifyRE = /(?:^|[-_])(\w)/g;
12208
+ const classifyRE = /(?:^|[-_])\w/g;
12180
12209
  const classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, "");
12181
12210
  function getComponentName(Component, includeInferred = true) {
12182
12211
  return isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name;
@@ -12219,15 +12248,23 @@ const computed = (getterOrOptions, debugOptions) => {
12219
12248
  };
12220
12249
 
12221
12250
  function h(type, propsOrChildren, children) {
12251
+ const doCreateVNode = (type2, props, children2) => {
12252
+ setBlockTracking(-1);
12253
+ try {
12254
+ return createVNode(type2, props, children2);
12255
+ } finally {
12256
+ setBlockTracking(1);
12257
+ }
12258
+ };
12222
12259
  const l = arguments.length;
12223
12260
  if (l === 2) {
12224
12261
  if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
12225
12262
  if (isVNode(propsOrChildren)) {
12226
- return createVNode(type, null, [propsOrChildren]);
12263
+ return doCreateVNode(type, null, [propsOrChildren]);
12227
12264
  }
12228
- return createVNode(type, propsOrChildren);
12265
+ return doCreateVNode(type, propsOrChildren);
12229
12266
  } else {
12230
- return createVNode(type, null, propsOrChildren);
12267
+ return doCreateVNode(type, null, propsOrChildren);
12231
12268
  }
12232
12269
  } else {
12233
12270
  if (l > 3) {
@@ -12235,7 +12272,7 @@ function h(type, propsOrChildren, children) {
12235
12272
  } else if (l === 3 && isVNode(children)) {
12236
12273
  children = [children];
12237
12274
  }
12238
- return createVNode(type, propsOrChildren, children);
12275
+ return doCreateVNode(type, propsOrChildren, children);
12239
12276
  }
12240
12277
  }
12241
12278
 
@@ -12445,7 +12482,7 @@ function isMemoSame(cached, memo) {
12445
12482
  return true;
12446
12483
  }
12447
12484
 
12448
- const version = "3.5.20";
12485
+ const version = "3.5.21";
12449
12486
  const warn = warn$1 ;
12450
12487
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12451
12488
  const devtools = devtools$1 ;
@@ -12848,7 +12885,7 @@ function getTransitionInfo(el, expectedType) {
12848
12885
  type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION$1 : ANIMATION : null;
12849
12886
  propCount = type ? type === TRANSITION$1 ? transitionDurations.length : animationDurations.length : 0;
12850
12887
  }
12851
- const hasTransform = type === TRANSITION$1 && /\b(transform|all)(,|$)/.test(
12888
+ const hasTransform = type === TRANSITION$1 && /\b(?:transform|all)(?:,|$)/.test(
12852
12889
  getStyleProperties(`${TRANSITION$1}Property`).toString()
12853
12890
  );
12854
12891
  return {
@@ -12941,7 +12978,7 @@ function useCssVars(getter) {
12941
12978
  return;
12942
12979
  }
12943
12980
 
12944
- const displayRE = /(^|;)\s*display\s*:/;
12981
+ const displayRE = /(?:^|;)\s*display\s*:/;
12945
12982
  function patchStyle(el, prev, next) {
12946
12983
  const style = el.style;
12947
12984
  const isCssString = isString(next);
@@ -13308,11 +13345,10 @@ function shouldSetAsProp(el, key, value, isSVG) {
13308
13345
  }
13309
13346
 
13310
13347
  const REMOVAL = {};
13311
- /*! #__NO_SIDE_EFFECTS__ */
13312
13348
  // @__NO_SIDE_EFFECTS__
13313
13349
  function defineCustomElement(options, extraOptions, _createApp) {
13314
- const Comp = defineComponent(options, extraOptions);
13315
- if (isPlainObject(Comp)) extend(Comp, extraOptions);
13350
+ let Comp = defineComponent(options, extraOptions);
13351
+ if (isPlainObject(Comp)) Comp = extend({}, Comp, extraOptions);
13316
13352
  class VueCustomElement extends VueElement {
13317
13353
  constructor(initialProps) {
13318
13354
  super(Comp, initialProps, _createApp);
@@ -13321,7 +13357,6 @@ function defineCustomElement(options, extraOptions, _createApp) {
13321
13357
  VueCustomElement.def = Comp;
13322
13358
  return VueCustomElement;
13323
13359
  }
13324
-
13325
13360
  const defineSSRCustomElement = (/* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
13326
13361
  return /* @__PURE__ */ defineCustomElement(options, extraOptions, createSSRApp);
13327
13362
  });
@@ -13797,7 +13832,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
13797
13832
  if (e && e.target !== el) {
13798
13833
  return;
13799
13834
  }
13800
- if (!e || /transform$/.test(e.propertyName)) {
13835
+ if (!e || e.propertyName.endsWith("transform")) {
13801
13836
  el.removeEventListener("transitionend", cb);
13802
13837
  el[moveCbKey] = null;
13803
13838
  removeTransitionClass(el, moveClass);
@@ -14296,7 +14331,7 @@ const createApp = ((...args) => {
14296
14331
  if (container.nodeType === 1) {
14297
14332
  for (let i = 0; i < container.attributes.length; i++) {
14298
14333
  const attr = container.attributes[i];
14299
- if (attr.name !== "v-cloak" && /^(v-|:|@)/.test(attr.name)) {
14334
+ if (attr.name !== "v-cloak" && /^(?:v-|:|@)/.test(attr.name)) {
14300
14335
  compatUtils.warnDeprecation(
14301
14336
  "GLOBAL_MOUNT_CONTAINER",
14302
14337
  null
@@ -18882,7 +18917,7 @@ function isConst(type) {
18882
18917
  }
18883
18918
 
18884
18919
  const transformIf = createStructuralDirectiveTransform(
18885
- /^(if|else|else-if)$/,
18920
+ /^(?:if|else|else-if)$/,
18886
18921
  (node, dir, context) => {
18887
18922
  return processIf(node, dir, context, (ifNode, branch, isRoot) => {
18888
18923
  const siblings = context.parent.children;
@@ -19479,7 +19514,9 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
19479
19514
  const dynamicSlots = [];
19480
19515
  let hasDynamicSlots = context.scopes.vSlot > 0 || context.scopes.vFor > 0;
19481
19516
  if (!context.ssr && context.prefixIdentifiers) {
19482
- hasDynamicSlots = hasScopeRef(node, context.identifiers);
19517
+ hasDynamicSlots = node.props.some(
19518
+ (prop) => isVSlot(prop) && (hasScopeRef(prop.arg, context.identifiers) || hasScopeRef(prop.exp, context.identifiers))
19519
+ ) || children.some((child) => hasScopeRef(child, context.identifiers));
19483
19520
  }
19484
19521
  const onComponentSlot = findDir(node, "slot", true);
19485
19522
  if (onComponentSlot) {
@@ -19542,7 +19579,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
19542
19579
  );
19543
19580
  } else if (vElse = findDir(
19544
19581
  slotElement,
19545
- /^else(-if)?$/,
19582
+ /^else(?:-if)?$/,
19546
19583
  true
19547
19584
  /* allowEmpty */
19548
19585
  )) {
@@ -19554,7 +19591,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
19554
19591
  break;
19555
19592
  }
19556
19593
  }
19557
- if (prev && isTemplateNode(prev) && findDir(prev, /^(else-)?if$/)) {
19594
+ if (prev && isTemplateNode(prev) && findDir(prev, /^(?:else-)?if$/)) {
19558
19595
  let conditional = dynamicSlots[dynamicSlots.length - 1];
19559
19596
  while (conditional.alternate.type === 19) {
19560
19597
  conditional = conditional.alternate;
@@ -21420,7 +21457,7 @@ const getCachedNode = (node) => {
21420
21457
  return node.codegenNode;
21421
21458
  }
21422
21459
  };
21423
- const dataAriaRE = /^(data|aria)-/;
21460
+ const dataAriaRE = /^(?:data|aria)-/;
21424
21461
  const isStringifiableAttr = (name, ns) => {
21425
21462
  return (ns === 0 ? isKnownHtmlAttr(name) : ns === 1 ? isKnownSvgAttr(name) : ns === 2 ? isKnownMathMLAttr(name) : false) || dataAriaRE.test(name);
21426
21463
  };