@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.
@@ -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
  **/
@@ -59,10 +59,10 @@ var Vue = (function () {
59
59
  );
60
60
  const cacheStringFunction = (fn) => {
61
61
  const cache = /* @__PURE__ */ Object.create(null);
62
- return (str) => {
62
+ return ((str) => {
63
63
  const hit = cache[str];
64
64
  return hit || (cache[str] = fn(str));
65
- };
65
+ });
66
66
  };
67
67
  const camelizeRE = /-(\w)/g;
68
68
  const camelize = cacheStringFunction(
@@ -1368,7 +1368,13 @@ var Vue = (function () {
1368
1368
  }
1369
1369
  if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
1370
1370
  if (isOldValueReadonly) {
1371
- return false;
1371
+ {
1372
+ warn$2(
1373
+ `Set operation on key "${String(key)}" failed: target is readonly.`,
1374
+ target[key]
1375
+ );
1376
+ }
1377
+ return true;
1372
1378
  } else {
1373
1379
  oldValue.value = value;
1374
1380
  return true;
@@ -2735,7 +2741,9 @@ var Vue = (function () {
2735
2741
  }
2736
2742
  instance.renderCache = [];
2737
2743
  isHmrUpdating = true;
2738
- instance.update();
2744
+ if (!(instance.job.flags & 8)) {
2745
+ instance.update();
2746
+ }
2739
2747
  isHmrUpdating = false;
2740
2748
  });
2741
2749
  }
@@ -4327,7 +4335,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4327
4335
  const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
4328
4336
  const setupState = owner.setupState;
4329
4337
  const rawSetupState = toRaw(setupState);
4330
- const canSetSetupRef = setupState === EMPTY_OBJ ? () => false : (key) => {
4338
+ const canSetSetupRef = setupState === EMPTY_OBJ ? NO : (key) => {
4331
4339
  {
4332
4340
  if (hasOwn(rawSetupState, key) && !isRef(rawSetupState[key])) {
4333
4341
  warn$1(
@@ -4340,6 +4348,9 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4340
4348
  }
4341
4349
  return hasOwn(rawSetupState, key);
4342
4350
  };
4351
+ const canSetRef = (ref2) => {
4352
+ return !knownTemplateRefs.has(ref2);
4353
+ };
4343
4354
  if (oldRef != null && oldRef !== ref) {
4344
4355
  if (isString(oldRef)) {
4345
4356
  refs[oldRef] = null;
@@ -4347,7 +4358,11 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4347
4358
  setupState[oldRef] = null;
4348
4359
  }
4349
4360
  } else if (isRef(oldRef)) {
4350
- oldRef.value = null;
4361
+ if (canSetRef(oldRef)) {
4362
+ oldRef.value = null;
4363
+ }
4364
+ const oldRawRefAtom = oldRawRef;
4365
+ if (oldRawRefAtom.k) refs[oldRawRefAtom.k] = null;
4351
4366
  }
4352
4367
  }
4353
4368
  if (isFunction(ref)) {
@@ -4358,7 +4373,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4358
4373
  if (_isString || _isRef) {
4359
4374
  const doSet = () => {
4360
4375
  if (rawRef.f) {
4361
- const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : ref.value;
4376
+ const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : canSetRef(ref) || !rawRef.k ? ref.value : refs[rawRef.k];
4362
4377
  if (isUnmount) {
4363
4378
  isArray(existing) && remove(existing, refValue);
4364
4379
  } else {
@@ -4369,8 +4384,11 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4369
4384
  setupState[ref] = refs[ref];
4370
4385
  }
4371
4386
  } else {
4372
- ref.value = [refValue];
4373
- if (rawRef.k) refs[rawRef.k] = ref.value;
4387
+ const newVal = [refValue];
4388
+ if (canSetRef(ref)) {
4389
+ ref.value = newVal;
4390
+ }
4391
+ if (rawRef.k) refs[rawRef.k] = newVal;
4374
4392
  }
4375
4393
  } else if (!existing.includes(refValue)) {
4376
4394
  existing.push(refValue);
@@ -4382,7 +4400,9 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4382
4400
  setupState[ref] = value;
4383
4401
  }
4384
4402
  } else if (_isRef) {
4385
- ref.value = value;
4403
+ if (canSetRef(ref)) {
4404
+ ref.value = value;
4405
+ }
4386
4406
  if (rawRef.k) refs[rawRef.k] = value;
4387
4407
  } else {
4388
4408
  warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
@@ -6474,10 +6494,10 @@ If this is a native custom element, make sure to exclude it from component resol
6474
6494
  return true;
6475
6495
  },
6476
6496
  has({
6477
- _: { data, setupState, accessCache, ctx, appContext, propsOptions }
6497
+ _: { data, setupState, accessCache, ctx, appContext, propsOptions, type }
6478
6498
  }, key) {
6479
- let normalizedProps;
6480
- 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);
6499
+ let normalizedProps, cssModules;
6500
+ 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]);
6481
6501
  },
6482
6502
  defineProperty(target, key, descriptor) {
6483
6503
  if (descriptor.get != null) {
@@ -7219,7 +7239,7 @@ If this is a native custom element, make sure to exclude it from component resol
7219
7239
  return vm;
7220
7240
  }
7221
7241
  }
7222
- Vue.version = `2.6.14-compat:${"3.5.18"}`;
7242
+ Vue.version = `2.6.14-compat:${"3.5.19"}`;
7223
7243
  Vue.config = singletonApp.config;
7224
7244
  Vue.use = (plugin, ...options) => {
7225
7245
  if (plugin && isFunction(plugin.install)) {
@@ -7233,22 +7253,22 @@ If this is a native custom element, make sure to exclude it from component resol
7233
7253
  singletonApp.mixin(m);
7234
7254
  return Vue;
7235
7255
  };
7236
- Vue.component = (name, comp) => {
7256
+ Vue.component = ((name, comp) => {
7237
7257
  if (comp) {
7238
7258
  singletonApp.component(name, comp);
7239
7259
  return Vue;
7240
7260
  } else {
7241
7261
  return singletonApp.component(name);
7242
7262
  }
7243
- };
7244
- Vue.directive = (name, dir) => {
7263
+ });
7264
+ Vue.directive = ((name, dir) => {
7245
7265
  if (dir) {
7246
7266
  singletonApp.directive(name, dir);
7247
7267
  return Vue;
7248
7268
  } else {
7249
7269
  return singletonApp.directive(name);
7250
7270
  }
7251
- };
7271
+ });
7252
7272
  Vue.options = { _base: Vue };
7253
7273
  let cid = 1;
7254
7274
  Vue.cid = cid;
@@ -7311,14 +7331,14 @@ If this is a native custom element, make sure to exclude it from component resol
7311
7331
  assertCompatEnabled("GLOBAL_OBSERVABLE", null);
7312
7332
  return reactive(target);
7313
7333
  };
7314
- Vue.filter = (name, filter) => {
7334
+ Vue.filter = ((name, filter) => {
7315
7335
  if (filter) {
7316
7336
  singletonApp.filter(name, filter);
7317
7337
  return Vue;
7318
7338
  } else {
7319
7339
  return singletonApp.filter(name);
7320
7340
  }
7321
- };
7341
+ });
7322
7342
  const util = {
7323
7343
  warn: warn$1 ,
7324
7344
  extend,
@@ -8312,7 +8332,7 @@ If you want to remount the same app, move your app creation logic into a factory
8312
8332
  return args.some((elem) => elem.toLowerCase() === "boolean");
8313
8333
  }
8314
8334
 
8315
- const isInternalKey = (key) => key === "_" || key === "__" || key === "_ctx" || key === "$stable";
8335
+ const isInternalKey = (key) => key === "_" || key === "_ctx" || key === "$stable";
8316
8336
  const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
8317
8337
  const normalizeSlot = (key, rawSlot, ctx) => {
8318
8338
  if (rawSlot._n) {
@@ -8366,8 +8386,6 @@ If you want to remount the same app, move your app creation logic into a factory
8366
8386
  const initSlots = (instance, children, optimized) => {
8367
8387
  const slots = instance.slots = createInternalObject();
8368
8388
  if (instance.vnode.shapeFlag & 32) {
8369
- const cacheIndexes = children.__;
8370
- if (cacheIndexes) def(slots, "__", cacheIndexes, true);
8371
8389
  const type = children._;
8372
8390
  if (type) {
8373
8391
  assignSlots(slots, children, optimized);
@@ -8428,12 +8446,10 @@ If you want to remount the same app, move your app creation logic into a factory
8428
8446
  if (instance.appContext.config.performance && isSupported()) {
8429
8447
  const startTag = `vue-${type}-${instance.uid}`;
8430
8448
  const endTag = startTag + `:end`;
8449
+ const measureName = `<${formatComponentName(instance, instance.type)}> ${type}`;
8431
8450
  perf.mark(endTag);
8432
- perf.measure(
8433
- `<${formatComponentName(instance, instance.type)}> ${type}`,
8434
- startTag,
8435
- endTag
8436
- );
8451
+ perf.measure(measureName, startTag, endTag);
8452
+ perf.clearMeasures(measureName);
8437
8453
  perf.clearMarks(startTag);
8438
8454
  perf.clearMarks(endTag);
8439
8455
  }
@@ -9650,6 +9666,12 @@ If you want to remount the same app, move your app creation logic into a factory
9650
9666
  }
9651
9667
  };
9652
9668
  const performLeave = () => {
9669
+ if (el._isLeaving) {
9670
+ el[leaveCbKey](
9671
+ true
9672
+ /* cancelled */
9673
+ );
9674
+ }
9653
9675
  leave(el, () => {
9654
9676
  remove2();
9655
9677
  afterLeave && afterLeave();
@@ -9795,27 +9817,12 @@ If you want to remount the same app, move your app creation logic into a factory
9795
9817
  if (instance.type.__hmrId) {
9796
9818
  unregisterHMR(instance);
9797
9819
  }
9798
- const {
9799
- bum,
9800
- scope,
9801
- job,
9802
- subTree,
9803
- um,
9804
- m,
9805
- a,
9806
- parent,
9807
- slots: { __: slotCacheKeys }
9808
- } = instance;
9820
+ const { bum, scope, job, subTree, um, m, a } = instance;
9809
9821
  invalidateMount(m);
9810
9822
  invalidateMount(a);
9811
9823
  if (bum) {
9812
9824
  invokeArrayFns(bum);
9813
9825
  }
9814
- if (parent && isArray(slotCacheKeys)) {
9815
- slotCacheKeys.forEach((v) => {
9816
- parent.renderCache[v] = void 0;
9817
- });
9818
- }
9819
9826
  if (isCompatEnabled$1("INSTANCE_EVENT_HOOKS", instance)) {
9820
9827
  instance.emit("hook:beforeDestroy");
9821
9828
  }
@@ -9836,12 +9843,6 @@ If you want to remount the same app, move your app creation logic into a factory
9836
9843
  queuePostRenderEffect(() => {
9837
9844
  instance.isUnmounted = true;
9838
9845
  }, parentSuspense);
9839
- if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
9840
- parentSuspense.deps--;
9841
- if (parentSuspense.deps === 0) {
9842
- parentSuspense.resolve();
9843
- }
9844
- }
9845
9846
  {
9846
9847
  devtoolsComponentRemoved(instance);
9847
9848
  }
@@ -9942,7 +9943,8 @@ If you want to remount the same app, move your app creation logic into a factory
9942
9943
  if (!shallow && c2.patchFlag !== -2)
9943
9944
  traverseStaticChildren(c1, c2);
9944
9945
  }
9945
- if (c2.type === Text) {
9946
+ if (c2.type === Text && // avoid cached text nodes retaining detached dom nodes
9947
+ c2.patchFlag !== -1) {
9946
9948
  c2.el = c1.el;
9947
9949
  }
9948
9950
  if (c2.type === Comment && !c2.el) {
@@ -12345,7 +12347,7 @@ Component that was made reactive: `,
12345
12347
  return true;
12346
12348
  }
12347
12349
 
12348
- const version = "3.5.18";
12350
+ const version = "3.5.19";
12349
12351
  const warn = warn$1 ;
12350
12352
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12351
12353
  const devtools = devtools$1 ;
@@ -13271,10 +13273,10 @@ Expected function or array of functions, received type ${typeof value}.`
13271
13273
  VueCustomElement.def = Comp;
13272
13274
  return VueCustomElement;
13273
13275
  }
13274
- /*! #__NO_SIDE_EFFECTS__ */
13275
- const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
13276
+
13277
+ const defineSSRCustomElement = (/* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
13276
13278
  return /* @__PURE__ */ defineCustomElement(options, extraOptions, createSSRApp);
13277
- };
13279
+ });
13278
13280
  const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
13279
13281
  };
13280
13282
  class VueElement extends BaseClass {
@@ -14098,13 +14100,13 @@ Expected function or array of functions, received type ${typeof value}.`
14098
14100
  const withModifiers = (fn, modifiers) => {
14099
14101
  const cache = fn._withMods || (fn._withMods = {});
14100
14102
  const cacheKey = modifiers.join(".");
14101
- return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
14103
+ return cache[cacheKey] || (cache[cacheKey] = ((event, ...args) => {
14102
14104
  for (let i = 0; i < modifiers.length; i++) {
14103
14105
  const guard = modifierGuards[modifiers[i]];
14104
14106
  if (guard && guard(event, modifiers)) return;
14105
14107
  }
14106
14108
  return fn(event, ...args);
14107
- });
14109
+ }));
14108
14110
  };
14109
14111
  const keyNames = {
14110
14112
  esc: "escape",
@@ -14134,7 +14136,7 @@ Expected function or array of functions, received type ${typeof value}.`
14134
14136
  }
14135
14137
  const cache = fn._withKeys || (fn._withKeys = {});
14136
14138
  const cacheKey = modifiers.join(".");
14137
- return cache[cacheKey] || (cache[cacheKey] = (event) => {
14139
+ return cache[cacheKey] || (cache[cacheKey] = ((event) => {
14138
14140
  if (!("key" in event)) {
14139
14141
  return;
14140
14142
  }
@@ -14164,7 +14166,7 @@ Expected function or array of functions, received type ${typeof value}.`
14164
14166
  }
14165
14167
  }
14166
14168
  }
14167
- });
14169
+ }));
14168
14170
  };
14169
14171
 
14170
14172
  const rendererOptions = /* @__PURE__ */ extend({ patchProp }, nodeOps);
@@ -14178,13 +14180,13 @@ Expected function or array of functions, received type ${typeof value}.`
14178
14180
  enabledHydration = true;
14179
14181
  return renderer;
14180
14182
  }
14181
- const render = (...args) => {
14183
+ const render = ((...args) => {
14182
14184
  ensureRenderer().render(...args);
14183
- };
14184
- const hydrate = (...args) => {
14185
+ });
14186
+ const hydrate = ((...args) => {
14185
14187
  ensureHydrationRenderer().hydrate(...args);
14186
- };
14187
- const createApp = (...args) => {
14188
+ });
14189
+ const createApp = ((...args) => {
14188
14190
  const app = ensureRenderer().createApp(...args);
14189
14191
  {
14190
14192
  injectNativeTagCheck(app);
@@ -14221,8 +14223,8 @@ Expected function or array of functions, received type ${typeof value}.`
14221
14223
  return proxy;
14222
14224
  };
14223
14225
  return app;
14224
- };
14225
- const createSSRApp = (...args) => {
14226
+ });
14227
+ const createSSRApp = ((...args) => {
14226
14228
  const app = ensureHydrationRenderer().createApp(...args);
14227
14229
  {
14228
14230
  injectNativeTagCheck(app);
@@ -14236,7 +14238,7 @@ Expected function or array of functions, received type ${typeof value}.`
14236
14238
  }
14237
14239
  };
14238
14240
  return app;
14239
- };
14241
+ });
14240
14242
  function resolveRootNamespace(container) {
14241
14243
  if (container instanceof SVGElement) {
14242
14244
  return "svg";
@@ -16784,7 +16786,6 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
16784
16786
  }
16785
16787
  }
16786
16788
  let cachedAsArray = false;
16787
- const slotCacheKeys = [];
16788
16789
  if (toCache.length === children.length && node.type === 1) {
16789
16790
  if (node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
16790
16791
  node.codegenNode.children = getCacheExpression(
@@ -16794,7 +16795,6 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
16794
16795
  } else if (node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) {
16795
16796
  const slot = getSlotNode(node.codegenNode, "default");
16796
16797
  if (slot) {
16797
- slotCacheKeys.push(context.cached.length);
16798
16798
  slot.returns = getCacheExpression(
16799
16799
  createArrayExpression(slot.returns)
16800
16800
  );
@@ -16804,7 +16804,6 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
16804
16804
  const slotName = findDir(node, "slot", true);
16805
16805
  const slot = slotName && slotName.arg && getSlotNode(parent.codegenNode, slotName.arg);
16806
16806
  if (slot) {
16807
- slotCacheKeys.push(context.cached.length);
16808
16807
  slot.returns = getCacheExpression(
16809
16808
  createArrayExpression(slot.returns)
16810
16809
  );
@@ -16814,23 +16813,12 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
16814
16813
  }
16815
16814
  if (!cachedAsArray) {
16816
16815
  for (const child of toCache) {
16817
- slotCacheKeys.push(context.cached.length);
16818
16816
  child.codegenNode = context.cache(child.codegenNode);
16819
16817
  }
16820
16818
  }
16821
- 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) {
16822
- node.codegenNode.children.properties.push(
16823
- createObjectProperty(
16824
- `__`,
16825
- createSimpleExpression(JSON.stringify(slotCacheKeys), false)
16826
- )
16827
- );
16828
- }
16829
16819
  function getCacheExpression(value) {
16830
16820
  const exp = context.cache(value);
16831
- if (inFor && context.hmr) {
16832
- exp.needArraySpread = true;
16833
- }
16821
+ exp.needArraySpread = true;
16834
16822
  return exp;
16835
16823
  }
16836
16824
  function getSlotNode(node2, name) {
@@ -18026,7 +18014,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
18026
18014
  continue;
18027
18015
  }
18028
18016
  if (sibling && sibling.type === 9) {
18029
- if (dir.name === "else-if" && sibling.branches[sibling.branches.length - 1].condition === void 0) {
18017
+ if ((dir.name === "else-if" || dir.name === "else") && sibling.branches[sibling.branches.length - 1].condition === void 0) {
18030
18018
  context.onError(
18031
18019
  createCompilerError(30, node.loc)
18032
18020
  );
@@ -19724,7 +19712,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
19724
19712
  const transformMemo = (node, context) => {
19725
19713
  if (node.type === 1) {
19726
19714
  const dir = findDir(node, "memo");
19727
- if (!dir || seen.has(node)) {
19715
+ if (!dir || seen.has(node) || context.inSSR) {
19728
19716
  return;
19729
19717
  }
19730
19718
  seen.add(node);