@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`);
@@ -2978,7 +2978,7 @@ function renderComponentRoot(instance) {
2978
2978
  !!(process.env.NODE_ENV !== "production") ? {
2979
2979
  get attrs() {
2980
2980
  markAttrsAccessed();
2981
- return attrs;
2981
+ return shallowReadonly(attrs);
2982
2982
  },
2983
2983
  slots,
2984
2984
  emit
@@ -3011,7 +3011,7 @@ function renderComponentRoot(instance) {
3011
3011
  propsOptions
3012
3012
  );
3013
3013
  }
3014
- root = cloneVNode(root, fallthroughAttrs);
3014
+ root = cloneVNode(root, fallthroughAttrs, false, true);
3015
3015
  } else if (!!(process.env.NODE_ENV !== "production") && !accessedAttrs && root.type !== Comment) {
3016
3016
  const allAttrs = Object.keys(attrs);
3017
3017
  const eventAttrs = [];
@@ -3049,10 +3049,15 @@ function renderComponentRoot(instance) {
3049
3049
  getComponentName(instance.type)
3050
3050
  );
3051
3051
  }
3052
- root = cloneVNode(root, {
3053
- class: cls,
3054
- style
3055
- });
3052
+ root = cloneVNode(
3053
+ root,
3054
+ {
3055
+ class: cls,
3056
+ style
3057
+ },
3058
+ false,
3059
+ true
3060
+ );
3056
3061
  }
3057
3062
  }
3058
3063
  if (vnode.dirs) {
@@ -3061,7 +3066,7 @@ function renderComponentRoot(instance) {
3061
3066
  `Runtime directive used on component with non-element root node. The directives will not function as intended.`
3062
3067
  );
3063
3068
  }
3064
- root = cloneVNode(root);
3069
+ root = cloneVNode(root, null, false, true);
3065
3070
  root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
3066
3071
  }
3067
3072
  if (vnode.transition) {
@@ -3556,7 +3561,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
3556
3561
  let parentSuspenseId;
3557
3562
  const isSuspensible = isVNodeSuspensible(vnode);
3558
3563
  if (isSuspensible) {
3559
- if (parentSuspense == null ? void 0 : parentSuspense.pendingBranch) {
3564
+ if (parentSuspense && parentSuspense.pendingBranch) {
3560
3565
  parentSuspenseId = parentSuspense.pendingId;
3561
3566
  parentSuspense.deps++;
3562
3567
  }
@@ -3868,8 +3873,8 @@ function setActiveBranch(suspense, branch) {
3868
3873
  }
3869
3874
  }
3870
3875
  function isVNodeSuspensible(vnode) {
3871
- var _a;
3872
- return ((_a = vnode.props) == null ? void 0 : _a.suspensible) != null && vnode.props.suspensible !== false;
3876
+ const suspensible = vnode.props && vnode.props.suspensible;
3877
+ return suspensible != null && suspensible !== false;
3873
3878
  }
3874
3879
 
3875
3880
  const legacyDirectiveHookMap = {
@@ -4171,34 +4176,29 @@ function createPathGetter(ctx, path) {
4171
4176
  return cur;
4172
4177
  };
4173
4178
  }
4174
- function traverse(value, depth, currentDepth = 0, seen) {
4175
- if (!isObject(value) || value["__v_skip"]) {
4179
+ function traverse(value, depth = Infinity, seen) {
4180
+ if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
4176
4181
  return value;
4177
4182
  }
4178
- if (depth && depth > 0) {
4179
- if (currentDepth >= depth) {
4180
- return value;
4181
- }
4182
- currentDepth++;
4183
- }
4184
4183
  seen = seen || /* @__PURE__ */ new Set();
4185
4184
  if (seen.has(value)) {
4186
4185
  return value;
4187
4186
  }
4188
4187
  seen.add(value);
4188
+ depth--;
4189
4189
  if (isRef(value)) {
4190
- traverse(value.value, depth, currentDepth, seen);
4190
+ traverse(value.value, depth, seen);
4191
4191
  } else if (isArray(value)) {
4192
4192
  for (let i = 0; i < value.length; i++) {
4193
- traverse(value[i], depth, currentDepth, seen);
4193
+ traverse(value[i], depth, seen);
4194
4194
  }
4195
4195
  } else if (isSet(value) || isMap(value)) {
4196
4196
  value.forEach((v) => {
4197
- traverse(v, depth, currentDepth, seen);
4197
+ traverse(v, depth, seen);
4198
4198
  });
4199
4199
  } else if (isPlainObject(value)) {
4200
4200
  for (const key in value) {
4201
- traverse(value[key], depth, currentDepth, seen);
4201
+ traverse(value[key], depth, seen);
4202
4202
  }
4203
4203
  }
4204
4204
  return value;
@@ -4361,7 +4361,7 @@ const BaseTransitionImpl = {
4361
4361
  instance
4362
4362
  );
4363
4363
  setTransitionHooks(oldInnerChild, leavingHooks);
4364
- if (mode === "out-in") {
4364
+ if (mode === "out-in" && innerChild.type !== Comment) {
4365
4365
  state.isLeaving = true;
4366
4366
  leavingHooks.afterLeave = () => {
4367
4367
  state.isLeaving = false;
@@ -4885,7 +4885,7 @@ const KeepAliveImpl = {
4885
4885
  return () => {
4886
4886
  pendingCacheKey = null;
4887
4887
  if (!slots.default) {
4888
- return current = null;
4888
+ return null;
4889
4889
  }
4890
4890
  const children = slots.default();
4891
4891
  const rawVNode = children[0];
@@ -5603,14 +5603,7 @@ function installCompatInstanceProperties(map) {
5603
5603
  },
5604
5604
  $scopedSlots: (i) => {
5605
5605
  assertCompatEnabled("INSTANCE_SCOPED_SLOTS", i);
5606
- const res = {};
5607
- for (const key in i.slots) {
5608
- const fn = i.slots[key];
5609
- if (!fn._ns) {
5610
- res[key] = fn;
5611
- }
5612
- }
5613
- return res;
5606
+ return !!(process.env.NODE_ENV !== "production") ? shallowReadonly(i.slots) : i.slots;
5614
5607
  },
5615
5608
  $on: (i) => on.bind(null, i),
5616
5609
  $once: (i) => once.bind(null, i),
@@ -6583,13 +6576,13 @@ function createCompatVue$1(createApp, createSingletonApp) {
6583
6576
  return vm;
6584
6577
  }
6585
6578
  }
6586
- Vue.version = `2.6.14-compat:${"3.4.25"}`;
6579
+ Vue.version = `2.6.14-compat:${"3.4.27"}`;
6587
6580
  Vue.config = singletonApp.config;
6588
- Vue.use = (p, ...options) => {
6589
- if (p && isFunction(p.install)) {
6590
- p.install(Vue, ...options);
6591
- } else if (isFunction(p)) {
6592
- p(Vue, ...options);
6581
+ Vue.use = (plugin, ...options) => {
6582
+ if (plugin && isFunction(plugin.install)) {
6583
+ plugin.install(Vue, ...options);
6584
+ } else if (isFunction(plugin)) {
6585
+ plugin(Vue, ...options);
6593
6586
  }
6594
6587
  return Vue;
6595
6588
  };
@@ -7710,7 +7703,7 @@ const initSlots = (instance, children) => {
7710
7703
  const type = children._;
7711
7704
  if (type) {
7712
7705
  extend(slots, children);
7713
- def(slots, "_", type);
7706
+ def(slots, "_", type, true);
7714
7707
  } else {
7715
7708
  normalizeObjectSlots(children, slots, instance);
7716
7709
  }
@@ -8334,7 +8327,7 @@ function propHasMismatch(el, key, clientValue, vnode, instance) {
8334
8327
  mismatchType = mismatchKey = `class`;
8335
8328
  }
8336
8329
  } else if (key === "style") {
8337
- actual = el.getAttribute("style");
8330
+ actual = el.getAttribute("style") || "";
8338
8331
  expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue));
8339
8332
  const actualMap = toStyleMap(actual);
8340
8333
  const expectedMap = toStyleMap(expected);
@@ -10597,8 +10590,8 @@ function guardReactiveProps(props) {
10597
10590
  return null;
10598
10591
  return isProxy(props) || isInternalObject(props) ? extend({}, props) : props;
10599
10592
  }
10600
- function cloneVNode(vnode, extraProps, mergeRef = false) {
10601
- const { props, ref, patchFlag, children } = vnode;
10593
+ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false) {
10594
+ const { props, ref, patchFlag, children, transition } = vnode;
10602
10595
  const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;
10603
10596
  const cloned = {
10604
10597
  __v_isVNode: true,
@@ -10628,7 +10621,7 @@ function cloneVNode(vnode, extraProps, mergeRef = false) {
10628
10621
  dynamicChildren: vnode.dynamicChildren,
10629
10622
  appContext: vnode.appContext,
10630
10623
  dirs: vnode.dirs,
10631
- transition: vnode.transition,
10624
+ transition,
10632
10625
  // These should technically only be non-null on mounted VNodes. However,
10633
10626
  // they *should* be copied for kept-alive vnodes. So we just always copy
10634
10627
  // them since them being non-null during a mount doesn't affect the logic as
@@ -10642,6 +10635,9 @@ function cloneVNode(vnode, extraProps, mergeRef = false) {
10642
10635
  ctx: vnode.ctx,
10643
10636
  ce: vnode.ce
10644
10637
  };
10638
+ if (transition && cloneTransition) {
10639
+ cloned.transition = transition.clone(cloned);
10640
+ }
10645
10641
  {
10646
10642
  defineLegacyVNodeProperties(cloned);
10647
10643
  }
@@ -11495,7 +11491,7 @@ function isMemoSame(cached, memo) {
11495
11491
  return true;
11496
11492
  }
11497
11493
 
11498
- const version = "3.4.25";
11494
+ const version = "3.4.27";
11499
11495
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
11500
11496
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11501
11497
  const devtools = !!(process.env.NODE_ENV !== "production") || true ? devtools$1 : void 0;
@@ -14971,11 +14967,10 @@ const tokenizer = new Tokenizer(stack, {
14971
14967
  }
14972
14968
  },
14973
14969
  onselfclosingtag(end) {
14974
- var _a;
14975
14970
  const name = currentOpenTag.tag;
14976
14971
  currentOpenTag.isSelfClosing = true;
14977
14972
  endOpenTag(end);
14978
- if (((_a = stack[0]) == null ? void 0 : _a.tag) === name) {
14973
+ if (stack[0] && stack[0].tag === name) {
14979
14974
  onCloseTag(stack.shift(), end);
14980
14975
  }
14981
14976
  },
@@ -15286,16 +15281,15 @@ function endOpenTag(end) {
15286
15281
  currentOpenTag = null;
15287
15282
  }
15288
15283
  function onText(content, start, end) {
15289
- var _a;
15290
15284
  {
15291
- const tag = (_a = stack[0]) == null ? void 0 : _a.tag;
15285
+ const tag = stack[0] && stack[0].tag;
15292
15286
  if (tag !== "script" && tag !== "style" && content.includes("&")) {
15293
15287
  content = currentOptions.decodeEntities(content, false);
15294
15288
  }
15295
15289
  }
15296
15290
  const parent = stack[0] || currentRoot;
15297
15291
  const lastNode = parent.children[parent.children.length - 1];
15298
- if ((lastNode == null ? void 0 : lastNode.type) === 2) {
15292
+ if (lastNode && lastNode.type === 2) {
15299
15293
  lastNode.content += content;
15300
15294
  setLocEnd(lastNode.loc, end);
15301
15295
  } else {
@@ -15429,11 +15423,10 @@ function isFragmentTemplate({ tag, props }) {
15429
15423
  return false;
15430
15424
  }
15431
15425
  function isComponent({ tag, props }) {
15432
- var _a;
15433
15426
  if (currentOptions.isCustomElement(tag)) {
15434
15427
  return false;
15435
15428
  }
15436
- if (tag === "component" || isUpperCase(tag.charCodeAt(0)) || isCoreComponent(tag) || ((_a = currentOptions.isBuiltInComponent) == null ? void 0 : _a.call(currentOptions, tag)) || currentOptions.isNativeTag && !currentOptions.isNativeTag(tag)) {
15429
+ if (tag === "component" || isUpperCase(tag.charCodeAt(0)) || isCoreComponent(tag) || currentOptions.isBuiltInComponent && currentOptions.isBuiltInComponent(tag) || currentOptions.isNativeTag && !currentOptions.isNativeTag(tag)) {
15437
15430
  return true;
15438
15431
  }
15439
15432
  for (let i = 0; i < props.length; i++) {
@@ -15466,7 +15459,6 @@ function isUpperCase(c) {
15466
15459
  }
15467
15460
  const windowsNewlineRE = /\r\n/g;
15468
15461
  function condenseWhitespace(nodes, tag) {
15469
- var _a, _b;
15470
15462
  const shouldCondense = currentOptions.whitespace !== "preserve";
15471
15463
  let removedWhitespace = false;
15472
15464
  for (let i = 0; i < nodes.length; i++) {
@@ -15474,8 +15466,8 @@ function condenseWhitespace(nodes, tag) {
15474
15466
  if (node.type === 2) {
15475
15467
  if (!inPre) {
15476
15468
  if (isAllWhitespace(node.content)) {
15477
- const prev = (_a = nodes[i - 1]) == null ? void 0 : _a.type;
15478
- const next = (_b = nodes[i + 1]) == null ? void 0 : _b.type;
15469
+ const prev = nodes[i - 1] && nodes[i - 1].type;
15470
+ const next = nodes[i + 1] && nodes[i + 1].type;
15479
15471
  if (!prev || !next || shouldCondense && (prev === 3 && (next === 3 || next === 1) || prev === 1 && (next === 3 || next === 1 && hasNewlineChar(node.content)))) {
15480
15472
  removedWhitespace = true;
15481
15473
  nodes[i] = null;
@@ -15613,7 +15605,7 @@ function baseParse(input, options) {
15613
15605
  }
15614
15606
  tokenizer.mode = currentOptions.parseMode === "html" ? 1 : currentOptions.parseMode === "sfc" ? 2 : 0;
15615
15607
  tokenizer.inXML = currentOptions.ns === 1 || currentOptions.ns === 2;
15616
- const delimiters = options == null ? void 0 : options.delimiters;
15608
+ const delimiters = options && options.delimiters;
15617
15609
  if (delimiters) {
15618
15610
  tokenizer.delimiterOpen = toCharCodes(delimiters[0]);
15619
15611
  tokenizer.delimiterClose = toCharCodes(delimiters[1]);
@@ -18123,7 +18115,7 @@ function processSlotOutlet(node, context) {
18123
18115
  };
18124
18116
  }
18125
18117
 
18126
- const fnExpRE = /^\s*([\w$_]+|(async\s*)?\([^)]*?\))\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
18118
+ const fnExpRE = /^\s*(async\s*)?(\([^)]*?\)|[\w$_]+)\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
18127
18119
  const transformOn$1 = (dir, node, context, augmentor) => {
18128
18120
  const { loc, modifiers, arg } = dir;
18129
18121
  if (!dir.exp && !modifiers.length) {