@vue/compat 3.5.18 → 3.5.19

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.18
2
+ * @vue/compat v3.5.19
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -63,10 +63,10 @@ const isBuiltInDirective = /* @__PURE__ */ makeMap(
63
63
  );
64
64
  const cacheStringFunction = (fn) => {
65
65
  const cache = /* @__PURE__ */ Object.create(null);
66
- return (str) => {
66
+ return ((str) => {
67
67
  const hit = cache[str];
68
68
  return hit || (cache[str] = fn(str));
69
- };
69
+ });
70
70
  };
71
71
  const camelizeRE = /-(\w)/g;
72
72
  const camelize = cacheStringFunction(
@@ -1418,7 +1418,13 @@ class MutableReactiveHandler extends BaseReactiveHandler {
1418
1418
  }
1419
1419
  if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
1420
1420
  if (isOldValueReadonly) {
1421
- return false;
1421
+ {
1422
+ warn$2(
1423
+ `Set operation on key "${String(key)}" failed: target is readonly.`,
1424
+ target[key]
1425
+ );
1426
+ }
1427
+ return true;
1422
1428
  } else {
1423
1429
  oldValue.value = value;
1424
1430
  return true;
@@ -2785,7 +2791,9 @@ function rerender(id, newRender) {
2785
2791
  }
2786
2792
  instance.renderCache = [];
2787
2793
  isHmrUpdating = true;
2788
- instance.update();
2794
+ if (!(instance.job.flags & 8)) {
2795
+ instance.update();
2796
+ }
2789
2797
  isHmrUpdating = false;
2790
2798
  });
2791
2799
  }
@@ -4377,7 +4385,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4377
4385
  const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
4378
4386
  const setupState = owner.setupState;
4379
4387
  const rawSetupState = toRaw(setupState);
4380
- const canSetSetupRef = setupState === EMPTY_OBJ ? () => false : (key) => {
4388
+ const canSetSetupRef = setupState === EMPTY_OBJ ? NO : (key) => {
4381
4389
  {
4382
4390
  if (hasOwn(rawSetupState, key) && !isRef(rawSetupState[key])) {
4383
4391
  warn$1(
@@ -4390,6 +4398,9 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4390
4398
  }
4391
4399
  return hasOwn(rawSetupState, key);
4392
4400
  };
4401
+ const canSetRef = (ref2) => {
4402
+ return !knownTemplateRefs.has(ref2);
4403
+ };
4393
4404
  if (oldRef != null && oldRef !== ref) {
4394
4405
  if (isString(oldRef)) {
4395
4406
  refs[oldRef] = null;
@@ -4397,7 +4408,11 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4397
4408
  setupState[oldRef] = null;
4398
4409
  }
4399
4410
  } else if (isRef(oldRef)) {
4400
- oldRef.value = null;
4411
+ if (canSetRef(oldRef)) {
4412
+ oldRef.value = null;
4413
+ }
4414
+ const oldRawRefAtom = oldRawRef;
4415
+ if (oldRawRefAtom.k) refs[oldRawRefAtom.k] = null;
4401
4416
  }
4402
4417
  }
4403
4418
  if (isFunction(ref)) {
@@ -4408,7 +4423,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4408
4423
  if (_isString || _isRef) {
4409
4424
  const doSet = () => {
4410
4425
  if (rawRef.f) {
4411
- const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : ref.value;
4426
+ const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : canSetRef(ref) || !rawRef.k ? ref.value : refs[rawRef.k];
4412
4427
  if (isUnmount) {
4413
4428
  isArray(existing) && remove(existing, refValue);
4414
4429
  } else {
@@ -4419,8 +4434,11 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4419
4434
  setupState[ref] = refs[ref];
4420
4435
  }
4421
4436
  } else {
4422
- ref.value = [refValue];
4423
- if (rawRef.k) refs[rawRef.k] = ref.value;
4437
+ const newVal = [refValue];
4438
+ if (canSetRef(ref)) {
4439
+ ref.value = newVal;
4440
+ }
4441
+ if (rawRef.k) refs[rawRef.k] = newVal;
4424
4442
  }
4425
4443
  } else if (!existing.includes(refValue)) {
4426
4444
  existing.push(refValue);
@@ -4432,7 +4450,9 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4432
4450
  setupState[ref] = value;
4433
4451
  }
4434
4452
  } else if (_isRef) {
4435
- ref.value = value;
4453
+ if (canSetRef(ref)) {
4454
+ ref.value = value;
4455
+ }
4436
4456
  if (rawRef.k) refs[rawRef.k] = value;
4437
4457
  } else {
4438
4458
  warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
@@ -6527,10 +6547,10 @@ const PublicInstanceProxyHandlers = {
6527
6547
  return true;
6528
6548
  },
6529
6549
  has({
6530
- _: { data, setupState, accessCache, ctx, appContext, propsOptions }
6550
+ _: { data, setupState, accessCache, ctx, appContext, propsOptions, type }
6531
6551
  }, key) {
6532
- let normalizedProps;
6533
- return !!accessCache[key] || data !== EMPTY_OBJ && hasOwn(data, key) || hasSetupBinding(setupState, key) || (normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key) || hasOwn(ctx, key) || hasOwn(publicPropertiesMap, key) || hasOwn(appContext.config.globalProperties, key);
6552
+ let normalizedProps, cssModules;
6553
+ return !!(accessCache[key] || data !== EMPTY_OBJ && key[0] !== "$" && hasOwn(data, key) || hasSetupBinding(setupState, key) || (normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key) || hasOwn(ctx, key) || hasOwn(publicPropertiesMap, key) || hasOwn(appContext.config.globalProperties, key) || (cssModules = type.__cssModules) && cssModules[key]);
6534
6554
  },
6535
6555
  defineProperty(target, key, descriptor) {
6536
6556
  if (descriptor.get != null) {
@@ -7275,7 +7295,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7275
7295
  return vm;
7276
7296
  }
7277
7297
  }
7278
- Vue.version = `2.6.14-compat:${"3.5.18"}`;
7298
+ Vue.version = `2.6.14-compat:${"3.5.19"}`;
7279
7299
  Vue.config = singletonApp.config;
7280
7300
  Vue.use = (plugin, ...options) => {
7281
7301
  if (plugin && isFunction(plugin.install)) {
@@ -7289,22 +7309,22 @@ function createCompatVue$1(createApp, createSingletonApp) {
7289
7309
  singletonApp.mixin(m);
7290
7310
  return Vue;
7291
7311
  };
7292
- Vue.component = (name, comp) => {
7312
+ Vue.component = ((name, comp) => {
7293
7313
  if (comp) {
7294
7314
  singletonApp.component(name, comp);
7295
7315
  return Vue;
7296
7316
  } else {
7297
7317
  return singletonApp.component(name);
7298
7318
  }
7299
- };
7300
- Vue.directive = (name, dir) => {
7319
+ });
7320
+ Vue.directive = ((name, dir) => {
7301
7321
  if (dir) {
7302
7322
  singletonApp.directive(name, dir);
7303
7323
  return Vue;
7304
7324
  } else {
7305
7325
  return singletonApp.directive(name);
7306
7326
  }
7307
- };
7327
+ });
7308
7328
  Vue.options = { _base: Vue };
7309
7329
  let cid = 1;
7310
7330
  Vue.cid = cid;
@@ -7367,14 +7387,14 @@ function createCompatVue$1(createApp, createSingletonApp) {
7367
7387
  assertCompatEnabled("GLOBAL_OBSERVABLE", null);
7368
7388
  return reactive(target);
7369
7389
  };
7370
- Vue.filter = (name, filter) => {
7390
+ Vue.filter = ((name, filter) => {
7371
7391
  if (filter) {
7372
7392
  singletonApp.filter(name, filter);
7373
7393
  return Vue;
7374
7394
  } else {
7375
7395
  return singletonApp.filter(name);
7376
7396
  }
7377
- };
7397
+ });
7378
7398
  const util = {
7379
7399
  warn: warn$1 ,
7380
7400
  extend,
@@ -8368,7 +8388,7 @@ function isBoolean(...args) {
8368
8388
  return args.some((elem) => elem.toLowerCase() === "boolean");
8369
8389
  }
8370
8390
 
8371
- const isInternalKey = (key) => key === "_" || key === "__" || key === "_ctx" || key === "$stable";
8391
+ const isInternalKey = (key) => key === "_" || key === "_ctx" || key === "$stable";
8372
8392
  const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
8373
8393
  const normalizeSlot = (key, rawSlot, ctx) => {
8374
8394
  if (rawSlot._n) {
@@ -8422,8 +8442,6 @@ const assignSlots = (slots, children, optimized) => {
8422
8442
  const initSlots = (instance, children, optimized) => {
8423
8443
  const slots = instance.slots = createInternalObject();
8424
8444
  if (instance.vnode.shapeFlag & 32) {
8425
- const cacheIndexes = children.__;
8426
- if (cacheIndexes) def(slots, "__", cacheIndexes, true);
8427
8445
  const type = children._;
8428
8446
  if (type) {
8429
8447
  assignSlots(slots, children, optimized);
@@ -8484,12 +8502,10 @@ function endMeasure(instance, type) {
8484
8502
  if (instance.appContext.config.performance && isSupported()) {
8485
8503
  const startTag = `vue-${type}-${instance.uid}`;
8486
8504
  const endTag = startTag + `:end`;
8505
+ const measureName = `<${formatComponentName(instance, instance.type)}> ${type}`;
8487
8506
  perf.mark(endTag);
8488
- perf.measure(
8489
- `<${formatComponentName(instance, instance.type)}> ${type}`,
8490
- startTag,
8491
- endTag
8492
- );
8507
+ perf.measure(measureName, startTag, endTag);
8508
+ perf.clearMeasures(measureName);
8493
8509
  perf.clearMarks(startTag);
8494
8510
  perf.clearMarks(endTag);
8495
8511
  }
@@ -9706,6 +9722,12 @@ function baseCreateRenderer(options, createHydrationFns) {
9706
9722
  }
9707
9723
  };
9708
9724
  const performLeave = () => {
9725
+ if (el._isLeaving) {
9726
+ el[leaveCbKey](
9727
+ true
9728
+ /* cancelled */
9729
+ );
9730
+ }
9709
9731
  leave(el, () => {
9710
9732
  remove2();
9711
9733
  afterLeave && afterLeave();
@@ -9851,27 +9873,12 @@ function baseCreateRenderer(options, createHydrationFns) {
9851
9873
  if (instance.type.__hmrId) {
9852
9874
  unregisterHMR(instance);
9853
9875
  }
9854
- const {
9855
- bum,
9856
- scope,
9857
- job,
9858
- subTree,
9859
- um,
9860
- m,
9861
- a,
9862
- parent,
9863
- slots: { __: slotCacheKeys }
9864
- } = instance;
9876
+ const { bum, scope, job, subTree, um, m, a } = instance;
9865
9877
  invalidateMount(m);
9866
9878
  invalidateMount(a);
9867
9879
  if (bum) {
9868
9880
  invokeArrayFns(bum);
9869
9881
  }
9870
- if (parent && isArray(slotCacheKeys)) {
9871
- slotCacheKeys.forEach((v) => {
9872
- parent.renderCache[v] = void 0;
9873
- });
9874
- }
9875
9882
  if (isCompatEnabled$1("INSTANCE_EVENT_HOOKS", instance)) {
9876
9883
  instance.emit("hook:beforeDestroy");
9877
9884
  }
@@ -9892,12 +9899,6 @@ function baseCreateRenderer(options, createHydrationFns) {
9892
9899
  queuePostRenderEffect(() => {
9893
9900
  instance.isUnmounted = true;
9894
9901
  }, parentSuspense);
9895
- if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
9896
- parentSuspense.deps--;
9897
- if (parentSuspense.deps === 0) {
9898
- parentSuspense.resolve();
9899
- }
9900
- }
9901
9902
  {
9902
9903
  devtoolsComponentRemoved(instance);
9903
9904
  }
@@ -9998,7 +9999,8 @@ function traverseStaticChildren(n1, n2, shallow = false) {
9998
9999
  if (!shallow && c2.patchFlag !== -2)
9999
10000
  traverseStaticChildren(c1, c2);
10000
10001
  }
10001
- if (c2.type === Text) {
10002
+ if (c2.type === Text && // avoid cached text nodes retaining detached dom nodes
10003
+ c2.patchFlag !== -1) {
10002
10004
  c2.el = c1.el;
10003
10005
  }
10004
10006
  if (c2.type === Comment && !c2.el) {
@@ -12443,7 +12445,7 @@ function isMemoSame(cached, memo) {
12443
12445
  return true;
12444
12446
  }
12445
12447
 
12446
- const version = "3.5.18";
12448
+ const version = "3.5.19";
12447
12449
  const warn = warn$1 ;
12448
12450
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12449
12451
  const devtools = devtools$1 ;
@@ -13320,10 +13322,10 @@ function defineCustomElement(options, extraOptions, _createApp) {
13320
13322
  VueCustomElement.def = Comp;
13321
13323
  return VueCustomElement;
13322
13324
  }
13323
- /*! #__NO_SIDE_EFFECTS__ */
13324
- const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
13325
+
13326
+ const defineSSRCustomElement = (/* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
13325
13327
  return /* @__PURE__ */ defineCustomElement(options, extraOptions, createSSRApp);
13326
- };
13328
+ });
13327
13329
  const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
13328
13330
  };
13329
13331
  class VueElement extends BaseClass {
@@ -14193,13 +14195,13 @@ const modifierGuards = {
14193
14195
  const withModifiers = (fn, modifiers) => {
14194
14196
  const cache = fn._withMods || (fn._withMods = {});
14195
14197
  const cacheKey = modifiers.join(".");
14196
- return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
14198
+ return cache[cacheKey] || (cache[cacheKey] = ((event, ...args) => {
14197
14199
  for (let i = 0; i < modifiers.length; i++) {
14198
14200
  const guard = modifierGuards[modifiers[i]];
14199
14201
  if (guard && guard(event, modifiers)) return;
14200
14202
  }
14201
14203
  return fn(event, ...args);
14202
- });
14204
+ }));
14203
14205
  };
14204
14206
  const keyNames = {
14205
14207
  esc: "escape",
@@ -14229,7 +14231,7 @@ const withKeys = (fn, modifiers) => {
14229
14231
  }
14230
14232
  const cache = fn._withKeys || (fn._withKeys = {});
14231
14233
  const cacheKey = modifiers.join(".");
14232
- return cache[cacheKey] || (cache[cacheKey] = (event) => {
14234
+ return cache[cacheKey] || (cache[cacheKey] = ((event) => {
14233
14235
  if (!("key" in event)) {
14234
14236
  return;
14235
14237
  }
@@ -14259,7 +14261,7 @@ const withKeys = (fn, modifiers) => {
14259
14261
  }
14260
14262
  }
14261
14263
  }
14262
- });
14264
+ }));
14263
14265
  };
14264
14266
 
14265
14267
  const rendererOptions = /* @__PURE__ */ extend({ patchProp }, nodeOps);
@@ -14273,13 +14275,13 @@ function ensureHydrationRenderer() {
14273
14275
  enabledHydration = true;
14274
14276
  return renderer;
14275
14277
  }
14276
- const render = (...args) => {
14278
+ const render = ((...args) => {
14277
14279
  ensureRenderer().render(...args);
14278
- };
14279
- const hydrate = (...args) => {
14280
+ });
14281
+ const hydrate = ((...args) => {
14280
14282
  ensureHydrationRenderer().hydrate(...args);
14281
- };
14282
- const createApp = (...args) => {
14283
+ });
14284
+ const createApp = ((...args) => {
14283
14285
  const app = ensureRenderer().createApp(...args);
14284
14286
  {
14285
14287
  injectNativeTagCheck(app);
@@ -14316,8 +14318,8 @@ const createApp = (...args) => {
14316
14318
  return proxy;
14317
14319
  };
14318
14320
  return app;
14319
- };
14320
- const createSSRApp = (...args) => {
14321
+ });
14322
+ const createSSRApp = ((...args) => {
14321
14323
  const app = ensureHydrationRenderer().createApp(...args);
14322
14324
  {
14323
14325
  injectNativeTagCheck(app);
@@ -14331,7 +14333,7 @@ const createSSRApp = (...args) => {
14331
14333
  }
14332
14334
  };
14333
14335
  return app;
14334
- };
14336
+ });
14335
14337
  function resolveRootNamespace(container) {
14336
14338
  if (container instanceof SVGElement) {
14337
14339
  return "svg";
@@ -17338,7 +17340,6 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
17338
17340
  }
17339
17341
  }
17340
17342
  let cachedAsArray = false;
17341
- const slotCacheKeys = [];
17342
17343
  if (toCache.length === children.length && node.type === 1) {
17343
17344
  if (node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
17344
17345
  node.codegenNode.children = getCacheExpression(
@@ -17348,7 +17349,6 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
17348
17349
  } else if (node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) {
17349
17350
  const slot = getSlotNode(node.codegenNode, "default");
17350
17351
  if (slot) {
17351
- slotCacheKeys.push(context.cached.length);
17352
17352
  slot.returns = getCacheExpression(
17353
17353
  createArrayExpression(slot.returns)
17354
17354
  );
@@ -17358,7 +17358,6 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
17358
17358
  const slotName = findDir(node, "slot", true);
17359
17359
  const slot = slotName && slotName.arg && getSlotNode(parent.codegenNode, slotName.arg);
17360
17360
  if (slot) {
17361
- slotCacheKeys.push(context.cached.length);
17362
17361
  slot.returns = getCacheExpression(
17363
17362
  createArrayExpression(slot.returns)
17364
17363
  );
@@ -17368,23 +17367,12 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
17368
17367
  }
17369
17368
  if (!cachedAsArray) {
17370
17369
  for (const child of toCache) {
17371
- slotCacheKeys.push(context.cached.length);
17372
17370
  child.codegenNode = context.cache(child.codegenNode);
17373
17371
  }
17374
17372
  }
17375
- if (slotCacheKeys.length && node.type === 1 && node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) {
17376
- node.codegenNode.children.properties.push(
17377
- createObjectProperty(
17378
- `__`,
17379
- createSimpleExpression(JSON.stringify(slotCacheKeys), false)
17380
- )
17381
- );
17382
- }
17383
17373
  function getCacheExpression(value) {
17384
17374
  const exp = context.cache(value);
17385
- if (inFor && context.hmr) {
17386
- exp.needArraySpread = true;
17387
- }
17375
+ exp.needArraySpread = true;
17388
17376
  return exp;
17389
17377
  }
17390
17378
  function getSlotNode(node2, name) {
@@ -18964,7 +18952,7 @@ function processIf(node, dir, context, processCodegen) {
18964
18952
  continue;
18965
18953
  }
18966
18954
  if (sibling && sibling.type === 9) {
18967
- if (dir.name === "else-if" && sibling.branches[sibling.branches.length - 1].condition === void 0) {
18955
+ if ((dir.name === "else-if" || dir.name === "else") && sibling.branches[sibling.branches.length - 1].condition === void 0) {
18968
18956
  context.onError(
18969
18957
  createCompilerError(30, node.loc)
18970
18958
  );
@@ -20858,7 +20846,7 @@ const seen = /* @__PURE__ */ new WeakSet();
20858
20846
  const transformMemo = (node, context) => {
20859
20847
  if (node.type === 1) {
20860
20848
  const dir = findDir(node, "memo");
20861
- if (!dir || seen.has(node)) {
20849
+ if (!dir || seen.has(node) || context.inSSR) {
20862
20850
  return;
20863
20851
  }
20864
20852
  seen.add(node);