@vue/compat 3.4.25 → 3.4.27

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.4.25
2
+ * @vue/compat v3.4.27
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -81,10 +81,11 @@ const invokeArrayFns = (fns, arg) => {
81
81
  fns[i](arg);
82
82
  }
83
83
  };
84
- const def = (obj, key, value) => {
84
+ const def = (obj, key, value, writable = false) => {
85
85
  Object.defineProperty(obj, key, {
86
86
  configurable: true,
87
87
  enumerable: false,
88
+ writable,
88
89
  value
89
90
  });
90
91
  };
@@ -204,8 +205,8 @@ function stringifyStyle(styles) {
204
205
  }
205
206
  for (const key in styles) {
206
207
  const value = styles[key];
207
- const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
208
208
  if (isString(value) || typeof value === "number") {
209
+ const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
209
210
  ret += `${normalizedKey}:${value};`;
210
211
  }
211
212
  }
@@ -541,11 +542,10 @@ class ReactiveEffect {
541
542
  }
542
543
  }
543
544
  stop() {
544
- var _a;
545
545
  if (this.active) {
546
546
  preCleanupEffect(this);
547
547
  postCleanupEffect(this);
548
- (_a = this.onStop) == null ? void 0 : _a.call(this);
548
+ this.onStop && this.onStop();
549
549
  this.active = false;
550
550
  }
551
551
  }
@@ -758,8 +758,8 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
758
758
  resetScheduling();
759
759
  }
760
760
  function getDepFromReactive(object, key) {
761
- var _a;
762
- return (_a = targetMap.get(object)) == null ? void 0 : _a.get(key);
761
+ const depsMap = targetMap.get(object);
762
+ return depsMap && depsMap.get(key);
763
763
  }
764
764
 
765
765
  const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
@@ -2971,7 +2971,7 @@ function renderComponentRoot(instance) {
2971
2971
  true ? {
2972
2972
  get attrs() {
2973
2973
  markAttrsAccessed();
2974
- return attrs;
2974
+ return shallowReadonly(attrs);
2975
2975
  },
2976
2976
  slots,
2977
2977
  emit
@@ -3004,7 +3004,7 @@ function renderComponentRoot(instance) {
3004
3004
  propsOptions
3005
3005
  );
3006
3006
  }
3007
- root = cloneVNode(root, fallthroughAttrs);
3007
+ root = cloneVNode(root, fallthroughAttrs, false, true);
3008
3008
  } else if (!accessedAttrs && root.type !== Comment) {
3009
3009
  const allAttrs = Object.keys(attrs);
3010
3010
  const eventAttrs = [];
@@ -3042,10 +3042,15 @@ function renderComponentRoot(instance) {
3042
3042
  getComponentName(instance.type)
3043
3043
  );
3044
3044
  }
3045
- root = cloneVNode(root, {
3046
- class: cls,
3047
- style
3048
- });
3045
+ root = cloneVNode(
3046
+ root,
3047
+ {
3048
+ class: cls,
3049
+ style
3050
+ },
3051
+ false,
3052
+ true
3053
+ );
3049
3054
  }
3050
3055
  }
3051
3056
  if (vnode.dirs) {
@@ -3054,7 +3059,7 @@ function renderComponentRoot(instance) {
3054
3059
  `Runtime directive used on component with non-element root node. The directives will not function as intended.`
3055
3060
  );
3056
3061
  }
3057
- root = cloneVNode(root);
3062
+ root = cloneVNode(root, null, false, true);
3058
3063
  root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
3059
3064
  }
3060
3065
  if (vnode.transition) {
@@ -3549,7 +3554,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
3549
3554
  let parentSuspenseId;
3550
3555
  const isSuspensible = isVNodeSuspensible(vnode);
3551
3556
  if (isSuspensible) {
3552
- if (parentSuspense == null ? void 0 : parentSuspense.pendingBranch) {
3557
+ if (parentSuspense && parentSuspense.pendingBranch) {
3553
3558
  parentSuspenseId = parentSuspense.pendingId;
3554
3559
  parentSuspense.deps++;
3555
3560
  }
@@ -3861,8 +3866,8 @@ function setActiveBranch(suspense, branch) {
3861
3866
  }
3862
3867
  }
3863
3868
  function isVNodeSuspensible(vnode) {
3864
- var _a;
3865
- return ((_a = vnode.props) == null ? void 0 : _a.suspensible) != null && vnode.props.suspensible !== false;
3869
+ const suspensible = vnode.props && vnode.props.suspensible;
3870
+ return suspensible != null && suspensible !== false;
3866
3871
  }
3867
3872
 
3868
3873
  const legacyDirectiveHookMap = {
@@ -4143,34 +4148,29 @@ function createPathGetter(ctx, path) {
4143
4148
  return cur;
4144
4149
  };
4145
4150
  }
4146
- function traverse(value, depth, currentDepth = 0, seen) {
4147
- if (!isObject(value) || value["__v_skip"]) {
4151
+ function traverse(value, depth = Infinity, seen) {
4152
+ if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
4148
4153
  return value;
4149
4154
  }
4150
- if (depth && depth > 0) {
4151
- if (currentDepth >= depth) {
4152
- return value;
4153
- }
4154
- currentDepth++;
4155
- }
4156
4155
  seen = seen || /* @__PURE__ */ new Set();
4157
4156
  if (seen.has(value)) {
4158
4157
  return value;
4159
4158
  }
4160
4159
  seen.add(value);
4160
+ depth--;
4161
4161
  if (isRef(value)) {
4162
- traverse(value.value, depth, currentDepth, seen);
4162
+ traverse(value.value, depth, seen);
4163
4163
  } else if (isArray(value)) {
4164
4164
  for (let i = 0; i < value.length; i++) {
4165
- traverse(value[i], depth, currentDepth, seen);
4165
+ traverse(value[i], depth, seen);
4166
4166
  }
4167
4167
  } else if (isSet(value) || isMap(value)) {
4168
4168
  value.forEach((v) => {
4169
- traverse(v, depth, currentDepth, seen);
4169
+ traverse(v, depth, seen);
4170
4170
  });
4171
4171
  } else if (isPlainObject(value)) {
4172
4172
  for (const key in value) {
4173
- traverse(value[key], depth, currentDepth, seen);
4173
+ traverse(value[key], depth, seen);
4174
4174
  }
4175
4175
  }
4176
4176
  return value;
@@ -4331,7 +4331,7 @@ const BaseTransitionImpl = {
4331
4331
  instance
4332
4332
  );
4333
4333
  setTransitionHooks(oldInnerChild, leavingHooks);
4334
- if (mode === "out-in") {
4334
+ if (mode === "out-in" && innerChild.type !== Comment) {
4335
4335
  state.isLeaving = true;
4336
4336
  leavingHooks.afterLeave = () => {
4337
4337
  state.isLeaving = false;
@@ -4849,7 +4849,7 @@ const KeepAliveImpl = {
4849
4849
  return () => {
4850
4850
  pendingCacheKey = null;
4851
4851
  if (!slots.default) {
4852
- return current = null;
4852
+ return null;
4853
4853
  }
4854
4854
  const children = slots.default();
4855
4855
  const rawVNode = children[0];
@@ -5567,14 +5567,7 @@ function installCompatInstanceProperties(map) {
5567
5567
  },
5568
5568
  $scopedSlots: (i) => {
5569
5569
  assertCompatEnabled("INSTANCE_SCOPED_SLOTS", i);
5570
- const res = {};
5571
- for (const key in i.slots) {
5572
- const fn = i.slots[key];
5573
- if (!fn._ns) {
5574
- res[key] = fn;
5575
- }
5576
- }
5577
- return res;
5570
+ return shallowReadonly(i.slots) ;
5578
5571
  },
5579
5572
  $on: (i) => on.bind(null, i),
5580
5573
  $once: (i) => once.bind(null, i),
@@ -6545,13 +6538,13 @@ function createCompatVue$1(createApp, createSingletonApp) {
6545
6538
  return vm;
6546
6539
  }
6547
6540
  }
6548
- Vue.version = `2.6.14-compat:${"3.4.25"}`;
6541
+ Vue.version = `2.6.14-compat:${"3.4.27"}`;
6549
6542
  Vue.config = singletonApp.config;
6550
- Vue.use = (p, ...options) => {
6551
- if (p && isFunction(p.install)) {
6552
- p.install(Vue, ...options);
6553
- } else if (isFunction(p)) {
6554
- p(Vue, ...options);
6543
+ Vue.use = (plugin, ...options) => {
6544
+ if (plugin && isFunction(plugin.install)) {
6545
+ plugin.install(Vue, ...options);
6546
+ } else if (isFunction(plugin)) {
6547
+ plugin(Vue, ...options);
6555
6548
  }
6556
6549
  return Vue;
6557
6550
  };
@@ -7669,7 +7662,7 @@ const initSlots = (instance, children) => {
7669
7662
  const type = children._;
7670
7663
  if (type) {
7671
7664
  extend(slots, children);
7672
- def(slots, "_", type);
7665
+ def(slots, "_", type, true);
7673
7666
  } else {
7674
7667
  normalizeObjectSlots(children, slots, instance);
7675
7668
  }
@@ -8283,7 +8276,7 @@ function propHasMismatch(el, key, clientValue, vnode, instance) {
8283
8276
  mismatchType = mismatchKey = `class`;
8284
8277
  }
8285
8278
  } else if (key === "style") {
8286
- actual = el.getAttribute("style");
8279
+ actual = el.getAttribute("style") || "";
8287
8280
  expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue));
8288
8281
  const actualMap = toStyleMap(actual);
8289
8282
  const expectedMap = toStyleMap(expected);
@@ -10508,8 +10501,8 @@ function guardReactiveProps(props) {
10508
10501
  return null;
10509
10502
  return isProxy(props) || isInternalObject(props) ? extend({}, props) : props;
10510
10503
  }
10511
- function cloneVNode(vnode, extraProps, mergeRef = false) {
10512
- const { props, ref, patchFlag, children } = vnode;
10504
+ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false) {
10505
+ const { props, ref, patchFlag, children, transition } = vnode;
10513
10506
  const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;
10514
10507
  const cloned = {
10515
10508
  __v_isVNode: true,
@@ -10539,7 +10532,7 @@ function cloneVNode(vnode, extraProps, mergeRef = false) {
10539
10532
  dynamicChildren: vnode.dynamicChildren,
10540
10533
  appContext: vnode.appContext,
10541
10534
  dirs: vnode.dirs,
10542
- transition: vnode.transition,
10535
+ transition,
10543
10536
  // These should technically only be non-null on mounted VNodes. However,
10544
10537
  // they *should* be copied for kept-alive vnodes. So we just always copy
10545
10538
  // them since them being non-null during a mount doesn't affect the logic as
@@ -10553,6 +10546,9 @@ function cloneVNode(vnode, extraProps, mergeRef = false) {
10553
10546
  ctx: vnode.ctx,
10554
10547
  ce: vnode.ce
10555
10548
  };
10549
+ if (transition && cloneTransition) {
10550
+ cloned.transition = transition.clone(cloned);
10551
+ }
10556
10552
  {
10557
10553
  defineLegacyVNodeProperties(cloned);
10558
10554
  }
@@ -11375,7 +11371,7 @@ function isMemoSame(cached, memo) {
11375
11371
  return true;
11376
11372
  }
11377
11373
 
11378
- const version = "3.4.25";
11374
+ const version = "3.4.27";
11379
11375
  const warn = warn$1 ;
11380
11376
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11381
11377
  const devtools = devtools$1 ;
@@ -14801,11 +14797,10 @@ const tokenizer = new Tokenizer(stack, {
14801
14797
  }
14802
14798
  },
14803
14799
  onselfclosingtag(end) {
14804
- var _a;
14805
14800
  const name = currentOpenTag.tag;
14806
14801
  currentOpenTag.isSelfClosing = true;
14807
14802
  endOpenTag(end);
14808
- if (((_a = stack[0]) == null ? void 0 : _a.tag) === name) {
14803
+ if (stack[0] && stack[0].tag === name) {
14809
14804
  onCloseTag(stack.shift(), end);
14810
14805
  }
14811
14806
  },
@@ -15116,16 +15111,15 @@ function endOpenTag(end) {
15116
15111
  currentOpenTag = null;
15117
15112
  }
15118
15113
  function onText(content, start, end) {
15119
- var _a;
15120
15114
  {
15121
- const tag = (_a = stack[0]) == null ? void 0 : _a.tag;
15115
+ const tag = stack[0] && stack[0].tag;
15122
15116
  if (tag !== "script" && tag !== "style" && content.includes("&")) {
15123
15117
  content = currentOptions.decodeEntities(content, false);
15124
15118
  }
15125
15119
  }
15126
15120
  const parent = stack[0] || currentRoot;
15127
15121
  const lastNode = parent.children[parent.children.length - 1];
15128
- if ((lastNode == null ? void 0 : lastNode.type) === 2) {
15122
+ if (lastNode && lastNode.type === 2) {
15129
15123
  lastNode.content += content;
15130
15124
  setLocEnd(lastNode.loc, end);
15131
15125
  } else {
@@ -15259,11 +15253,10 @@ function isFragmentTemplate({ tag, props }) {
15259
15253
  return false;
15260
15254
  }
15261
15255
  function isComponent({ tag, props }) {
15262
- var _a;
15263
15256
  if (currentOptions.isCustomElement(tag)) {
15264
15257
  return false;
15265
15258
  }
15266
- if (tag === "component" || isUpperCase(tag.charCodeAt(0)) || isCoreComponent(tag) || ((_a = currentOptions.isBuiltInComponent) == null ? void 0 : _a.call(currentOptions, tag)) || currentOptions.isNativeTag && !currentOptions.isNativeTag(tag)) {
15259
+ if (tag === "component" || isUpperCase(tag.charCodeAt(0)) || isCoreComponent(tag) || currentOptions.isBuiltInComponent && currentOptions.isBuiltInComponent(tag) || currentOptions.isNativeTag && !currentOptions.isNativeTag(tag)) {
15267
15260
  return true;
15268
15261
  }
15269
15262
  for (let i = 0; i < props.length; i++) {
@@ -15296,7 +15289,6 @@ function isUpperCase(c) {
15296
15289
  }
15297
15290
  const windowsNewlineRE = /\r\n/g;
15298
15291
  function condenseWhitespace(nodes, tag) {
15299
- var _a, _b;
15300
15292
  const shouldCondense = currentOptions.whitespace !== "preserve";
15301
15293
  let removedWhitespace = false;
15302
15294
  for (let i = 0; i < nodes.length; i++) {
@@ -15304,8 +15296,8 @@ function condenseWhitespace(nodes, tag) {
15304
15296
  if (node.type === 2) {
15305
15297
  if (!inPre) {
15306
15298
  if (isAllWhitespace(node.content)) {
15307
- const prev = (_a = nodes[i - 1]) == null ? void 0 : _a.type;
15308
- const next = (_b = nodes[i + 1]) == null ? void 0 : _b.type;
15299
+ const prev = nodes[i - 1] && nodes[i - 1].type;
15300
+ const next = nodes[i + 1] && nodes[i + 1].type;
15309
15301
  if (!prev || !next || shouldCondense && (prev === 3 && (next === 3 || next === 1) || prev === 1 && (next === 3 || next === 1 && hasNewlineChar(node.content)))) {
15310
15302
  removedWhitespace = true;
15311
15303
  nodes[i] = null;
@@ -15443,7 +15435,7 @@ function baseParse(input, options) {
15443
15435
  }
15444
15436
  tokenizer.mode = currentOptions.parseMode === "html" ? 1 : currentOptions.parseMode === "sfc" ? 2 : 0;
15445
15437
  tokenizer.inXML = currentOptions.ns === 1 || currentOptions.ns === 2;
15446
- const delimiters = options == null ? void 0 : options.delimiters;
15438
+ const delimiters = options && options.delimiters;
15447
15439
  if (delimiters) {
15448
15440
  tokenizer.delimiterOpen = toCharCodes(delimiters[0]);
15449
15441
  tokenizer.delimiterClose = toCharCodes(delimiters[1]);
@@ -17950,7 +17942,7 @@ function processSlotOutlet(node, context) {
17950
17942
  };
17951
17943
  }
17952
17944
 
17953
- const fnExpRE = /^\s*([\w$_]+|(async\s*)?\([^)]*?\))\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
17945
+ const fnExpRE = /^\s*(async\s*)?(\([^)]*?\)|[\w$_]+)\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
17954
17946
  const transformOn$1 = (dir, node, context, augmentor) => {
17955
17947
  const { loc, modifiers, arg } = dir;
17956
17948
  if (!dir.exp && !modifiers.length) {