@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(
@@ -1369,7 +1369,13 @@ class MutableReactiveHandler extends BaseReactiveHandler {
1369
1369
  }
1370
1370
  if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
1371
1371
  if (isOldValueReadonly) {
1372
- return false;
1372
+ if (!!(process.env.NODE_ENV !== "production")) {
1373
+ warn$2(
1374
+ `Set operation on key "${String(key)}" failed: target is readonly.`,
1375
+ target[key]
1376
+ );
1377
+ }
1378
+ return true;
1373
1379
  } else {
1374
1380
  oldValue.value = value;
1375
1381
  return true;
@@ -2747,7 +2753,9 @@ function rerender(id, newRender) {
2747
2753
  }
2748
2754
  instance.renderCache = [];
2749
2755
  isHmrUpdating = true;
2750
- instance.update();
2756
+ if (!(instance.job.flags & 8)) {
2757
+ instance.update();
2758
+ }
2751
2759
  isHmrUpdating = false;
2752
2760
  });
2753
2761
  }
@@ -4343,7 +4351,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4343
4351
  const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
4344
4352
  const setupState = owner.setupState;
4345
4353
  const rawSetupState = toRaw(setupState);
4346
- const canSetSetupRef = setupState === EMPTY_OBJ ? () => false : (key) => {
4354
+ const canSetSetupRef = setupState === EMPTY_OBJ ? NO : (key) => {
4347
4355
  if (!!(process.env.NODE_ENV !== "production")) {
4348
4356
  if (hasOwn(rawSetupState, key) && !isRef(rawSetupState[key])) {
4349
4357
  warn$1(
@@ -4356,6 +4364,9 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4356
4364
  }
4357
4365
  return hasOwn(rawSetupState, key);
4358
4366
  };
4367
+ const canSetRef = (ref2) => {
4368
+ return !!!(process.env.NODE_ENV !== "production") || !knownTemplateRefs.has(ref2);
4369
+ };
4359
4370
  if (oldRef != null && oldRef !== ref) {
4360
4371
  if (isString(oldRef)) {
4361
4372
  refs[oldRef] = null;
@@ -4363,7 +4374,11 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4363
4374
  setupState[oldRef] = null;
4364
4375
  }
4365
4376
  } else if (isRef(oldRef)) {
4366
- oldRef.value = null;
4377
+ if (canSetRef(oldRef)) {
4378
+ oldRef.value = null;
4379
+ }
4380
+ const oldRawRefAtom = oldRawRef;
4381
+ if (oldRawRefAtom.k) refs[oldRawRefAtom.k] = null;
4367
4382
  }
4368
4383
  }
4369
4384
  if (isFunction(ref)) {
@@ -4374,7 +4389,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4374
4389
  if (_isString || _isRef) {
4375
4390
  const doSet = () => {
4376
4391
  if (rawRef.f) {
4377
- const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : ref.value;
4392
+ const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : canSetRef(ref) || !rawRef.k ? ref.value : refs[rawRef.k];
4378
4393
  if (isUnmount) {
4379
4394
  isArray(existing) && remove(existing, refValue);
4380
4395
  } else {
@@ -4385,8 +4400,11 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4385
4400
  setupState[ref] = refs[ref];
4386
4401
  }
4387
4402
  } else {
4388
- ref.value = [refValue];
4389
- if (rawRef.k) refs[rawRef.k] = ref.value;
4403
+ const newVal = [refValue];
4404
+ if (canSetRef(ref)) {
4405
+ ref.value = newVal;
4406
+ }
4407
+ if (rawRef.k) refs[rawRef.k] = newVal;
4390
4408
  }
4391
4409
  } else if (!existing.includes(refValue)) {
4392
4410
  existing.push(refValue);
@@ -4398,7 +4416,9 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4398
4416
  setupState[ref] = value;
4399
4417
  }
4400
4418
  } else if (_isRef) {
4401
- ref.value = value;
4419
+ if (canSetRef(ref)) {
4420
+ ref.value = value;
4421
+ }
4402
4422
  if (rawRef.k) refs[rawRef.k] = value;
4403
4423
  } else if (!!(process.env.NODE_ENV !== "production")) {
4404
4424
  warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
@@ -6507,10 +6527,10 @@ const PublicInstanceProxyHandlers = {
6507
6527
  return true;
6508
6528
  },
6509
6529
  has({
6510
- _: { data, setupState, accessCache, ctx, appContext, propsOptions }
6530
+ _: { data, setupState, accessCache, ctx, appContext, propsOptions, type }
6511
6531
  }, key) {
6512
- let normalizedProps;
6513
- 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);
6532
+ let normalizedProps, cssModules;
6533
+ 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]);
6514
6534
  },
6515
6535
  defineProperty(target, key, descriptor) {
6516
6536
  if (descriptor.get != null) {
@@ -7257,7 +7277,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7257
7277
  return vm;
7258
7278
  }
7259
7279
  }
7260
- Vue.version = `2.6.14-compat:${"3.5.18"}`;
7280
+ Vue.version = `2.6.14-compat:${"3.5.19"}`;
7261
7281
  Vue.config = singletonApp.config;
7262
7282
  Vue.use = (plugin, ...options) => {
7263
7283
  if (plugin && isFunction(plugin.install)) {
@@ -7271,22 +7291,22 @@ function createCompatVue$1(createApp, createSingletonApp) {
7271
7291
  singletonApp.mixin(m);
7272
7292
  return Vue;
7273
7293
  };
7274
- Vue.component = (name, comp) => {
7294
+ Vue.component = ((name, comp) => {
7275
7295
  if (comp) {
7276
7296
  singletonApp.component(name, comp);
7277
7297
  return Vue;
7278
7298
  } else {
7279
7299
  return singletonApp.component(name);
7280
7300
  }
7281
- };
7282
- Vue.directive = (name, dir) => {
7301
+ });
7302
+ Vue.directive = ((name, dir) => {
7283
7303
  if (dir) {
7284
7304
  singletonApp.directive(name, dir);
7285
7305
  return Vue;
7286
7306
  } else {
7287
7307
  return singletonApp.directive(name);
7288
7308
  }
7289
- };
7309
+ });
7290
7310
  Vue.options = { _base: Vue };
7291
7311
  let cid = 1;
7292
7312
  Vue.cid = cid;
@@ -7349,14 +7369,14 @@ function createCompatVue$1(createApp, createSingletonApp) {
7349
7369
  assertCompatEnabled("GLOBAL_OBSERVABLE", null);
7350
7370
  return reactive(target);
7351
7371
  };
7352
- Vue.filter = (name, filter) => {
7372
+ Vue.filter = ((name, filter) => {
7353
7373
  if (filter) {
7354
7374
  singletonApp.filter(name, filter);
7355
7375
  return Vue;
7356
7376
  } else {
7357
7377
  return singletonApp.filter(name);
7358
7378
  }
7359
- };
7379
+ });
7360
7380
  const util = {
7361
7381
  warn: !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP,
7362
7382
  extend,
@@ -8352,7 +8372,7 @@ function isBoolean(...args) {
8352
8372
  return args.some((elem) => elem.toLowerCase() === "boolean");
8353
8373
  }
8354
8374
 
8355
- const isInternalKey = (key) => key === "_" || key === "__" || key === "_ctx" || key === "$stable";
8375
+ const isInternalKey = (key) => key === "_" || key === "_ctx" || key === "$stable";
8356
8376
  const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
8357
8377
  const normalizeSlot = (key, rawSlot, ctx) => {
8358
8378
  if (rawSlot._n) {
@@ -8406,8 +8426,6 @@ const assignSlots = (slots, children, optimized) => {
8406
8426
  const initSlots = (instance, children, optimized) => {
8407
8427
  const slots = instance.slots = createInternalObject();
8408
8428
  if (instance.vnode.shapeFlag & 32) {
8409
- const cacheIndexes = children.__;
8410
- if (cacheIndexes) def(slots, "__", cacheIndexes, true);
8411
8429
  const type = children._;
8412
8430
  if (type) {
8413
8431
  assignSlots(slots, children, optimized);
@@ -8468,12 +8486,10 @@ function endMeasure(instance, type) {
8468
8486
  if (instance.appContext.config.performance && isSupported()) {
8469
8487
  const startTag = `vue-${type}-${instance.uid}`;
8470
8488
  const endTag = startTag + `:end`;
8489
+ const measureName = `<${formatComponentName(instance, instance.type)}> ${type}`;
8471
8490
  perf.mark(endTag);
8472
- perf.measure(
8473
- `<${formatComponentName(instance, instance.type)}> ${type}`,
8474
- startTag,
8475
- endTag
8476
- );
8491
+ perf.measure(measureName, startTag, endTag);
8492
+ perf.clearMeasures(measureName);
8477
8493
  perf.clearMarks(startTag);
8478
8494
  perf.clearMarks(endTag);
8479
8495
  }
@@ -9728,6 +9744,12 @@ function baseCreateRenderer(options, createHydrationFns) {
9728
9744
  }
9729
9745
  };
9730
9746
  const performLeave = () => {
9747
+ if (el._isLeaving) {
9748
+ el[leaveCbKey](
9749
+ true
9750
+ /* cancelled */
9751
+ );
9752
+ }
9731
9753
  leave(el, () => {
9732
9754
  remove2();
9733
9755
  afterLeave && afterLeave();
@@ -9873,27 +9895,12 @@ function baseCreateRenderer(options, createHydrationFns) {
9873
9895
  if (!!(process.env.NODE_ENV !== "production") && instance.type.__hmrId) {
9874
9896
  unregisterHMR(instance);
9875
9897
  }
9876
- const {
9877
- bum,
9878
- scope,
9879
- job,
9880
- subTree,
9881
- um,
9882
- m,
9883
- a,
9884
- parent,
9885
- slots: { __: slotCacheKeys }
9886
- } = instance;
9898
+ const { bum, scope, job, subTree, um, m, a } = instance;
9887
9899
  invalidateMount(m);
9888
9900
  invalidateMount(a);
9889
9901
  if (bum) {
9890
9902
  invokeArrayFns(bum);
9891
9903
  }
9892
- if (parent && isArray(slotCacheKeys)) {
9893
- slotCacheKeys.forEach((v) => {
9894
- parent.renderCache[v] = void 0;
9895
- });
9896
- }
9897
9904
  if (isCompatEnabled$1("INSTANCE_EVENT_HOOKS", instance)) {
9898
9905
  instance.emit("hook:beforeDestroy");
9899
9906
  }
@@ -9914,12 +9921,6 @@ function baseCreateRenderer(options, createHydrationFns) {
9914
9921
  queuePostRenderEffect(() => {
9915
9922
  instance.isUnmounted = true;
9916
9923
  }, parentSuspense);
9917
- if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
9918
- parentSuspense.deps--;
9919
- if (parentSuspense.deps === 0) {
9920
- parentSuspense.resolve();
9921
- }
9922
- }
9923
9924
  if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
9924
9925
  devtoolsComponentRemoved(instance);
9925
9926
  }
@@ -10020,7 +10021,8 @@ function traverseStaticChildren(n1, n2, shallow = false) {
10020
10021
  if (!shallow && c2.patchFlag !== -2)
10021
10022
  traverseStaticChildren(c1, c2);
10022
10023
  }
10023
- if (c2.type === Text) {
10024
+ if (c2.type === Text && // avoid cached text nodes retaining detached dom nodes
10025
+ c2.patchFlag !== -1) {
10024
10026
  c2.el = c1.el;
10025
10027
  }
10026
10028
  if (c2.type === Comment && !c2.el) {
@@ -12479,7 +12481,7 @@ function isMemoSame(cached, memo) {
12479
12481
  return true;
12480
12482
  }
12481
12483
 
12482
- const version = "3.5.18";
12484
+ const version = "3.5.19";
12483
12485
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
12484
12486
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12485
12487
  const devtools = !!(process.env.NODE_ENV !== "production") || true ? devtools$1 : void 0;
@@ -12956,7 +12958,7 @@ const vShow = {
12956
12958
  setDisplay(el, value);
12957
12959
  }
12958
12960
  };
12959
- if (!!(process.env.NODE_ENV !== "production")) {
12961
+ if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) {
12960
12962
  vShow.name = "show";
12961
12963
  }
12962
12964
  function setDisplay(el, value) {
@@ -13424,10 +13426,10 @@ function defineCustomElement(options, extraOptions, _createApp) {
13424
13426
  VueCustomElement.def = Comp;
13425
13427
  return VueCustomElement;
13426
13428
  }
13427
- /*! #__NO_SIDE_EFFECTS__ */
13428
- const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
13429
+
13430
+ const defineSSRCustomElement = (/* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
13429
13431
  return /* @__PURE__ */ defineCustomElement(options, extraOptions, createSSRApp);
13430
- };
13432
+ });
13431
13433
  const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
13432
13434
  };
13433
13435
  class VueElement extends BaseClass {
@@ -14297,13 +14299,13 @@ const modifierGuards = {
14297
14299
  const withModifiers = (fn, modifiers) => {
14298
14300
  const cache = fn._withMods || (fn._withMods = {});
14299
14301
  const cacheKey = modifiers.join(".");
14300
- return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
14302
+ return cache[cacheKey] || (cache[cacheKey] = ((event, ...args) => {
14301
14303
  for (let i = 0; i < modifiers.length; i++) {
14302
14304
  const guard = modifierGuards[modifiers[i]];
14303
14305
  if (guard && guard(event, modifiers)) return;
14304
14306
  }
14305
14307
  return fn(event, ...args);
14306
- });
14308
+ }));
14307
14309
  };
14308
14310
  const keyNames = {
14309
14311
  esc: "escape",
@@ -14333,7 +14335,7 @@ const withKeys = (fn, modifiers) => {
14333
14335
  }
14334
14336
  const cache = fn._withKeys || (fn._withKeys = {});
14335
14337
  const cacheKey = modifiers.join(".");
14336
- return cache[cacheKey] || (cache[cacheKey] = (event) => {
14338
+ return cache[cacheKey] || (cache[cacheKey] = ((event) => {
14337
14339
  if (!("key" in event)) {
14338
14340
  return;
14339
14341
  }
@@ -14363,7 +14365,7 @@ const withKeys = (fn, modifiers) => {
14363
14365
  }
14364
14366
  }
14365
14367
  }
14366
- });
14368
+ }));
14367
14369
  };
14368
14370
 
14369
14371
  const rendererOptions = /* @__PURE__ */ extend({ patchProp }, nodeOps);
@@ -14377,13 +14379,13 @@ function ensureHydrationRenderer() {
14377
14379
  enabledHydration = true;
14378
14380
  return renderer;
14379
14381
  }
14380
- const render = (...args) => {
14382
+ const render = ((...args) => {
14381
14383
  ensureRenderer().render(...args);
14382
- };
14383
- const hydrate = (...args) => {
14384
+ });
14385
+ const hydrate = ((...args) => {
14384
14386
  ensureHydrationRenderer().hydrate(...args);
14385
- };
14386
- const createApp = (...args) => {
14387
+ });
14388
+ const createApp = ((...args) => {
14387
14389
  const app = ensureRenderer().createApp(...args);
14388
14390
  if (!!(process.env.NODE_ENV !== "production")) {
14389
14391
  injectNativeTagCheck(app);
@@ -14420,8 +14422,8 @@ const createApp = (...args) => {
14420
14422
  return proxy;
14421
14423
  };
14422
14424
  return app;
14423
- };
14424
- const createSSRApp = (...args) => {
14425
+ });
14426
+ const createSSRApp = ((...args) => {
14425
14427
  const app = ensureHydrationRenderer().createApp(...args);
14426
14428
  if (!!(process.env.NODE_ENV !== "production")) {
14427
14429
  injectNativeTagCheck(app);
@@ -14435,7 +14437,7 @@ const createSSRApp = (...args) => {
14435
14437
  }
14436
14438
  };
14437
14439
  return app;
14438
- };
14440
+ });
14439
14441
  function resolveRootNamespace(container) {
14440
14442
  if (container instanceof SVGElement) {
14441
14443
  return "svg";
@@ -16984,7 +16986,6 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
16984
16986
  }
16985
16987
  }
16986
16988
  let cachedAsArray = false;
16987
- const slotCacheKeys = [];
16988
16989
  if (toCache.length === children.length && node.type === 1) {
16989
16990
  if (node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
16990
16991
  node.codegenNode.children = getCacheExpression(
@@ -16994,7 +16995,6 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
16994
16995
  } else if (node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) {
16995
16996
  const slot = getSlotNode(node.codegenNode, "default");
16996
16997
  if (slot) {
16997
- slotCacheKeys.push(context.cached.length);
16998
16998
  slot.returns = getCacheExpression(
16999
16999
  createArrayExpression(slot.returns)
17000
17000
  );
@@ -17004,7 +17004,6 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
17004
17004
  const slotName = findDir(node, "slot", true);
17005
17005
  const slot = slotName && slotName.arg && getSlotNode(parent.codegenNode, slotName.arg);
17006
17006
  if (slot) {
17007
- slotCacheKeys.push(context.cached.length);
17008
17007
  slot.returns = getCacheExpression(
17009
17008
  createArrayExpression(slot.returns)
17010
17009
  );
@@ -17014,23 +17013,12 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
17014
17013
  }
17015
17014
  if (!cachedAsArray) {
17016
17015
  for (const child of toCache) {
17017
- slotCacheKeys.push(context.cached.length);
17018
17016
  child.codegenNode = context.cache(child.codegenNode);
17019
17017
  }
17020
17018
  }
17021
- 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) {
17022
- node.codegenNode.children.properties.push(
17023
- createObjectProperty(
17024
- `__`,
17025
- createSimpleExpression(JSON.stringify(slotCacheKeys), false)
17026
- )
17027
- );
17028
- }
17029
17019
  function getCacheExpression(value) {
17030
17020
  const exp = context.cache(value);
17031
- if (inFor && context.hmr) {
17032
- exp.needArraySpread = true;
17033
- }
17021
+ exp.needArraySpread = true;
17034
17022
  return exp;
17035
17023
  }
17036
17024
  function getSlotNode(node2, name) {
@@ -18229,7 +18217,7 @@ function processIf(node, dir, context, processCodegen) {
18229
18217
  continue;
18230
18218
  }
18231
18219
  if (sibling && sibling.type === 9) {
18232
- if (dir.name === "else-if" && sibling.branches[sibling.branches.length - 1].condition === void 0) {
18220
+ if ((dir.name === "else-if" || dir.name === "else") && sibling.branches[sibling.branches.length - 1].condition === void 0) {
18233
18221
  context.onError(
18234
18222
  createCompilerError(30, node.loc)
18235
18223
  );
@@ -19927,7 +19915,7 @@ const seen = /* @__PURE__ */ new WeakSet();
19927
19915
  const transformMemo = (node, context) => {
19928
19916
  if (node.type === 1) {
19929
19917
  const dir = findDir(node, "memo");
19930
- if (!dir || seen.has(node)) {
19918
+ if (!dir || seen.has(node) || context.inSSR) {
19931
19919
  return;
19932
19920
  }
19933
19921
  seen.add(node);