@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
  **/
@@ -56,10 +56,10 @@ const isBuiltInDirective = /* @__PURE__ */ makeMap(
56
56
  );
57
57
  const cacheStringFunction = (fn) => {
58
58
  const cache = /* @__PURE__ */ Object.create(null);
59
- return (str) => {
59
+ return ((str) => {
60
60
  const hit = cache[str];
61
61
  return hit || (cache[str] = fn(str));
62
- };
62
+ });
63
63
  };
64
64
  const camelizeRE = /-(\w)/g;
65
65
  const camelize = cacheStringFunction(
@@ -1365,7 +1365,13 @@ class MutableReactiveHandler extends BaseReactiveHandler {
1365
1365
  }
1366
1366
  if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
1367
1367
  if (isOldValueReadonly) {
1368
- return false;
1368
+ {
1369
+ warn$2(
1370
+ `Set operation on key "${String(key)}" failed: target is readonly.`,
1371
+ target[key]
1372
+ );
1373
+ }
1374
+ return true;
1369
1375
  } else {
1370
1376
  oldValue.value = value;
1371
1377
  return true;
@@ -2732,7 +2738,9 @@ function rerender(id, newRender) {
2732
2738
  }
2733
2739
  instance.renderCache = [];
2734
2740
  isHmrUpdating = true;
2735
- instance.update();
2741
+ if (!(instance.job.flags & 8)) {
2742
+ instance.update();
2743
+ }
2736
2744
  isHmrUpdating = false;
2737
2745
  });
2738
2746
  }
@@ -4324,7 +4332,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4324
4332
  const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
4325
4333
  const setupState = owner.setupState;
4326
4334
  const rawSetupState = toRaw(setupState);
4327
- const canSetSetupRef = setupState === EMPTY_OBJ ? () => false : (key) => {
4335
+ const canSetSetupRef = setupState === EMPTY_OBJ ? NO : (key) => {
4328
4336
  {
4329
4337
  if (hasOwn(rawSetupState, key) && !isRef(rawSetupState[key])) {
4330
4338
  warn$1(
@@ -4337,6 +4345,9 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4337
4345
  }
4338
4346
  return hasOwn(rawSetupState, key);
4339
4347
  };
4348
+ const canSetRef = (ref2) => {
4349
+ return !knownTemplateRefs.has(ref2);
4350
+ };
4340
4351
  if (oldRef != null && oldRef !== ref) {
4341
4352
  if (isString(oldRef)) {
4342
4353
  refs[oldRef] = null;
@@ -4344,7 +4355,11 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4344
4355
  setupState[oldRef] = null;
4345
4356
  }
4346
4357
  } else if (isRef(oldRef)) {
4347
- oldRef.value = null;
4358
+ if (canSetRef(oldRef)) {
4359
+ oldRef.value = null;
4360
+ }
4361
+ const oldRawRefAtom = oldRawRef;
4362
+ if (oldRawRefAtom.k) refs[oldRawRefAtom.k] = null;
4348
4363
  }
4349
4364
  }
4350
4365
  if (isFunction(ref)) {
@@ -4355,7 +4370,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4355
4370
  if (_isString || _isRef) {
4356
4371
  const doSet = () => {
4357
4372
  if (rawRef.f) {
4358
- const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : ref.value;
4373
+ const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : canSetRef(ref) || !rawRef.k ? ref.value : refs[rawRef.k];
4359
4374
  if (isUnmount) {
4360
4375
  isArray(existing) && remove(existing, refValue);
4361
4376
  } else {
@@ -4366,8 +4381,11 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4366
4381
  setupState[ref] = refs[ref];
4367
4382
  }
4368
4383
  } else {
4369
- ref.value = [refValue];
4370
- if (rawRef.k) refs[rawRef.k] = ref.value;
4384
+ const newVal = [refValue];
4385
+ if (canSetRef(ref)) {
4386
+ ref.value = newVal;
4387
+ }
4388
+ if (rawRef.k) refs[rawRef.k] = newVal;
4371
4389
  }
4372
4390
  } else if (!existing.includes(refValue)) {
4373
4391
  existing.push(refValue);
@@ -4379,7 +4397,9 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4379
4397
  setupState[ref] = value;
4380
4398
  }
4381
4399
  } else if (_isRef) {
4382
- ref.value = value;
4400
+ if (canSetRef(ref)) {
4401
+ ref.value = value;
4402
+ }
4383
4403
  if (rawRef.k) refs[rawRef.k] = value;
4384
4404
  } else {
4385
4405
  warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
@@ -6477,10 +6497,10 @@ const PublicInstanceProxyHandlers = {
6477
6497
  return true;
6478
6498
  },
6479
6499
  has({
6480
- _: { data, setupState, accessCache, ctx, appContext, propsOptions }
6500
+ _: { data, setupState, accessCache, ctx, appContext, propsOptions, type }
6481
6501
  }, key) {
6482
- let normalizedProps;
6483
- 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);
6502
+ let normalizedProps, cssModules;
6503
+ 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]);
6484
6504
  },
6485
6505
  defineProperty(target, key, descriptor) {
6486
6506
  if (descriptor.get != null) {
@@ -7225,7 +7245,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7225
7245
  return vm;
7226
7246
  }
7227
7247
  }
7228
- Vue.version = `2.6.14-compat:${"3.5.18"}`;
7248
+ Vue.version = `2.6.14-compat:${"3.5.19"}`;
7229
7249
  Vue.config = singletonApp.config;
7230
7250
  Vue.use = (plugin, ...options) => {
7231
7251
  if (plugin && isFunction(plugin.install)) {
@@ -7239,22 +7259,22 @@ function createCompatVue$1(createApp, createSingletonApp) {
7239
7259
  singletonApp.mixin(m);
7240
7260
  return Vue;
7241
7261
  };
7242
- Vue.component = (name, comp) => {
7262
+ Vue.component = ((name, comp) => {
7243
7263
  if (comp) {
7244
7264
  singletonApp.component(name, comp);
7245
7265
  return Vue;
7246
7266
  } else {
7247
7267
  return singletonApp.component(name);
7248
7268
  }
7249
- };
7250
- Vue.directive = (name, dir) => {
7269
+ });
7270
+ Vue.directive = ((name, dir) => {
7251
7271
  if (dir) {
7252
7272
  singletonApp.directive(name, dir);
7253
7273
  return Vue;
7254
7274
  } else {
7255
7275
  return singletonApp.directive(name);
7256
7276
  }
7257
- };
7277
+ });
7258
7278
  Vue.options = { _base: Vue };
7259
7279
  let cid = 1;
7260
7280
  Vue.cid = cid;
@@ -7317,14 +7337,14 @@ function createCompatVue$1(createApp, createSingletonApp) {
7317
7337
  assertCompatEnabled("GLOBAL_OBSERVABLE", null);
7318
7338
  return reactive(target);
7319
7339
  };
7320
- Vue.filter = (name, filter) => {
7340
+ Vue.filter = ((name, filter) => {
7321
7341
  if (filter) {
7322
7342
  singletonApp.filter(name, filter);
7323
7343
  return Vue;
7324
7344
  } else {
7325
7345
  return singletonApp.filter(name);
7326
7346
  }
7327
- };
7347
+ });
7328
7348
  const util = {
7329
7349
  warn: warn$1 ,
7330
7350
  extend,
@@ -8318,7 +8338,7 @@ function isBoolean(...args) {
8318
8338
  return args.some((elem) => elem.toLowerCase() === "boolean");
8319
8339
  }
8320
8340
 
8321
- const isInternalKey = (key) => key === "_" || key === "__" || key === "_ctx" || key === "$stable";
8341
+ const isInternalKey = (key) => key === "_" || key === "_ctx" || key === "$stable";
8322
8342
  const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
8323
8343
  const normalizeSlot = (key, rawSlot, ctx) => {
8324
8344
  if (rawSlot._n) {
@@ -8372,8 +8392,6 @@ const assignSlots = (slots, children, optimized) => {
8372
8392
  const initSlots = (instance, children, optimized) => {
8373
8393
  const slots = instance.slots = createInternalObject();
8374
8394
  if (instance.vnode.shapeFlag & 32) {
8375
- const cacheIndexes = children.__;
8376
- if (cacheIndexes) def(slots, "__", cacheIndexes, true);
8377
8395
  const type = children._;
8378
8396
  if (type) {
8379
8397
  assignSlots(slots, children, optimized);
@@ -8434,12 +8452,10 @@ function endMeasure(instance, type) {
8434
8452
  if (instance.appContext.config.performance && isSupported()) {
8435
8453
  const startTag = `vue-${type}-${instance.uid}`;
8436
8454
  const endTag = startTag + `:end`;
8455
+ const measureName = `<${formatComponentName(instance, instance.type)}> ${type}`;
8437
8456
  perf.mark(endTag);
8438
- perf.measure(
8439
- `<${formatComponentName(instance, instance.type)}> ${type}`,
8440
- startTag,
8441
- endTag
8442
- );
8457
+ perf.measure(measureName, startTag, endTag);
8458
+ perf.clearMeasures(measureName);
8443
8459
  perf.clearMarks(startTag);
8444
8460
  perf.clearMarks(endTag);
8445
8461
  }
@@ -9656,6 +9672,12 @@ function baseCreateRenderer(options, createHydrationFns) {
9656
9672
  }
9657
9673
  };
9658
9674
  const performLeave = () => {
9675
+ if (el._isLeaving) {
9676
+ el[leaveCbKey](
9677
+ true
9678
+ /* cancelled */
9679
+ );
9680
+ }
9659
9681
  leave(el, () => {
9660
9682
  remove2();
9661
9683
  afterLeave && afterLeave();
@@ -9801,27 +9823,12 @@ function baseCreateRenderer(options, createHydrationFns) {
9801
9823
  if (instance.type.__hmrId) {
9802
9824
  unregisterHMR(instance);
9803
9825
  }
9804
- const {
9805
- bum,
9806
- scope,
9807
- job,
9808
- subTree,
9809
- um,
9810
- m,
9811
- a,
9812
- parent,
9813
- slots: { __: slotCacheKeys }
9814
- } = instance;
9826
+ const { bum, scope, job, subTree, um, m, a } = instance;
9815
9827
  invalidateMount(m);
9816
9828
  invalidateMount(a);
9817
9829
  if (bum) {
9818
9830
  invokeArrayFns(bum);
9819
9831
  }
9820
- if (parent && isArray(slotCacheKeys)) {
9821
- slotCacheKeys.forEach((v) => {
9822
- parent.renderCache[v] = void 0;
9823
- });
9824
- }
9825
9832
  if (isCompatEnabled$1("INSTANCE_EVENT_HOOKS", instance)) {
9826
9833
  instance.emit("hook:beforeDestroy");
9827
9834
  }
@@ -9842,12 +9849,6 @@ function baseCreateRenderer(options, createHydrationFns) {
9842
9849
  queuePostRenderEffect(() => {
9843
9850
  instance.isUnmounted = true;
9844
9851
  }, parentSuspense);
9845
- if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
9846
- parentSuspense.deps--;
9847
- if (parentSuspense.deps === 0) {
9848
- parentSuspense.resolve();
9849
- }
9850
- }
9851
9852
  {
9852
9853
  devtoolsComponentRemoved(instance);
9853
9854
  }
@@ -9948,7 +9949,8 @@ function traverseStaticChildren(n1, n2, shallow = false) {
9948
9949
  if (!shallow && c2.patchFlag !== -2)
9949
9950
  traverseStaticChildren(c1, c2);
9950
9951
  }
9951
- if (c2.type === Text) {
9952
+ if (c2.type === Text && // avoid cached text nodes retaining detached dom nodes
9953
+ c2.patchFlag !== -1) {
9952
9954
  c2.el = c1.el;
9953
9955
  }
9954
9956
  if (c2.type === Comment && !c2.el) {
@@ -12393,7 +12395,7 @@ function isMemoSame(cached, memo) {
12393
12395
  return true;
12394
12396
  }
12395
12397
 
12396
- const version = "3.5.18";
12398
+ const version = "3.5.19";
12397
12399
  const warn = warn$1 ;
12398
12400
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12399
12401
  const devtools = devtools$1 ;
@@ -13338,10 +13340,10 @@ function defineCustomElement(options, extraOptions, _createApp) {
13338
13340
  VueCustomElement.def = Comp;
13339
13341
  return VueCustomElement;
13340
13342
  }
13341
- /*! #__NO_SIDE_EFFECTS__ */
13342
- const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
13343
+
13344
+ const defineSSRCustomElement = (/* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
13343
13345
  return /* @__PURE__ */ defineCustomElement(options, extraOptions, createSSRApp);
13344
- };
13346
+ });
13345
13347
  const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
13346
13348
  };
13347
13349
  class VueElement extends BaseClass {
@@ -14211,13 +14213,13 @@ const modifierGuards = {
14211
14213
  const withModifiers = (fn, modifiers) => {
14212
14214
  const cache = fn._withMods || (fn._withMods = {});
14213
14215
  const cacheKey = modifiers.join(".");
14214
- return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
14216
+ return cache[cacheKey] || (cache[cacheKey] = ((event, ...args) => {
14215
14217
  for (let i = 0; i < modifiers.length; i++) {
14216
14218
  const guard = modifierGuards[modifiers[i]];
14217
14219
  if (guard && guard(event, modifiers)) return;
14218
14220
  }
14219
14221
  return fn(event, ...args);
14220
- });
14222
+ }));
14221
14223
  };
14222
14224
  const keyNames = {
14223
14225
  esc: "escape",
@@ -14247,7 +14249,7 @@ const withKeys = (fn, modifiers) => {
14247
14249
  }
14248
14250
  const cache = fn._withKeys || (fn._withKeys = {});
14249
14251
  const cacheKey = modifiers.join(".");
14250
- return cache[cacheKey] || (cache[cacheKey] = (event) => {
14252
+ return cache[cacheKey] || (cache[cacheKey] = ((event) => {
14251
14253
  if (!("key" in event)) {
14252
14254
  return;
14253
14255
  }
@@ -14277,7 +14279,7 @@ const withKeys = (fn, modifiers) => {
14277
14279
  }
14278
14280
  }
14279
14281
  }
14280
- });
14282
+ }));
14281
14283
  };
14282
14284
 
14283
14285
  const rendererOptions = /* @__PURE__ */ extend({ patchProp }, nodeOps);
@@ -14291,13 +14293,13 @@ function ensureHydrationRenderer() {
14291
14293
  enabledHydration = true;
14292
14294
  return renderer;
14293
14295
  }
14294
- const render = (...args) => {
14296
+ const render = ((...args) => {
14295
14297
  ensureRenderer().render(...args);
14296
- };
14297
- const hydrate = (...args) => {
14298
+ });
14299
+ const hydrate = ((...args) => {
14298
14300
  ensureHydrationRenderer().hydrate(...args);
14299
- };
14300
- const createApp = (...args) => {
14301
+ });
14302
+ const createApp = ((...args) => {
14301
14303
  const app = ensureRenderer().createApp(...args);
14302
14304
  {
14303
14305
  injectNativeTagCheck(app);
@@ -14334,8 +14336,8 @@ const createApp = (...args) => {
14334
14336
  return proxy;
14335
14337
  };
14336
14338
  return app;
14337
- };
14338
- const createSSRApp = (...args) => {
14339
+ });
14340
+ const createSSRApp = ((...args) => {
14339
14341
  const app = ensureHydrationRenderer().createApp(...args);
14340
14342
  {
14341
14343
  injectNativeTagCheck(app);
@@ -14349,7 +14351,7 @@ const createSSRApp = (...args) => {
14349
14351
  }
14350
14352
  };
14351
14353
  return app;
14352
- };
14354
+ });
14353
14355
  function resolveRootNamespace(container) {
14354
14356
  if (container instanceof SVGElement) {
14355
14357
  return "svg";
@@ -16904,7 +16906,6 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
16904
16906
  }
16905
16907
  }
16906
16908
  let cachedAsArray = false;
16907
- const slotCacheKeys = [];
16908
16909
  if (toCache.length === children.length && node.type === 1) {
16909
16910
  if (node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
16910
16911
  node.codegenNode.children = getCacheExpression(
@@ -16914,7 +16915,6 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
16914
16915
  } else if (node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) {
16915
16916
  const slot = getSlotNode(node.codegenNode, "default");
16916
16917
  if (slot) {
16917
- slotCacheKeys.push(context.cached.length);
16918
16918
  slot.returns = getCacheExpression(
16919
16919
  createArrayExpression(slot.returns)
16920
16920
  );
@@ -16924,7 +16924,6 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
16924
16924
  const slotName = findDir(node, "slot", true);
16925
16925
  const slot = slotName && slotName.arg && getSlotNode(parent.codegenNode, slotName.arg);
16926
16926
  if (slot) {
16927
- slotCacheKeys.push(context.cached.length);
16928
16927
  slot.returns = getCacheExpression(
16929
16928
  createArrayExpression(slot.returns)
16930
16929
  );
@@ -16934,23 +16933,12 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
16934
16933
  }
16935
16934
  if (!cachedAsArray) {
16936
16935
  for (const child of toCache) {
16937
- slotCacheKeys.push(context.cached.length);
16938
16936
  child.codegenNode = context.cache(child.codegenNode);
16939
16937
  }
16940
16938
  }
16941
- 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) {
16942
- node.codegenNode.children.properties.push(
16943
- createObjectProperty(
16944
- `__`,
16945
- createSimpleExpression(JSON.stringify(slotCacheKeys), false)
16946
- )
16947
- );
16948
- }
16949
16939
  function getCacheExpression(value) {
16950
16940
  const exp = context.cache(value);
16951
- if (inFor && context.hmr) {
16952
- exp.needArraySpread = true;
16953
- }
16941
+ exp.needArraySpread = true;
16954
16942
  return exp;
16955
16943
  }
16956
16944
  function getSlotNode(node2, name) {
@@ -18146,7 +18134,7 @@ function processIf(node, dir, context, processCodegen) {
18146
18134
  continue;
18147
18135
  }
18148
18136
  if (sibling && sibling.type === 9) {
18149
- if (dir.name === "else-if" && sibling.branches[sibling.branches.length - 1].condition === void 0) {
18137
+ if ((dir.name === "else-if" || dir.name === "else") && sibling.branches[sibling.branches.length - 1].condition === void 0) {
18150
18138
  context.onError(
18151
18139
  createCompilerError(30, node.loc)
18152
18140
  );
@@ -19844,7 +19832,7 @@ const seen = /* @__PURE__ */ new WeakSet();
19844
19832
  const transformMemo = (node, context) => {
19845
19833
  if (node.type === 1) {
19846
19834
  const dir = findDir(node, "memo");
19847
- if (!dir || seen.has(node)) {
19835
+ if (!dir || seen.has(node) || context.inSSR) {
19848
19836
  return;
19849
19837
  }
19850
19838
  seen.add(node);