@vue/compat 3.4.24 → 3.4.26

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.
package/dist/vue.cjs.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compat v3.4.24
2
+ * @vue/compat v3.4.26
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -88,10 +88,11 @@ const invokeArrayFns = (fns, arg) => {
88
88
  fns[i](arg);
89
89
  }
90
90
  };
91
- const def = (obj, key, value) => {
91
+ const def = (obj, key, value, writable = false) => {
92
92
  Object.defineProperty(obj, key, {
93
93
  configurable: true,
94
94
  enumerable: false,
95
+ writable,
95
96
  value
96
97
  });
97
98
  };
@@ -592,11 +593,10 @@ class ReactiveEffect {
592
593
  }
593
594
  }
594
595
  stop() {
595
- var _a;
596
596
  if (this.active) {
597
597
  preCleanupEffect(this);
598
598
  postCleanupEffect(this);
599
- (_a = this.onStop) == null ? void 0 : _a.call(this);
599
+ this.onStop && this.onStop();
600
600
  this.active = false;
601
601
  }
602
602
  }
@@ -809,8 +809,8 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
809
809
  resetScheduling();
810
810
  }
811
811
  function getDepFromReactive(object, key) {
812
- var _a;
813
- return (_a = targetMap.get(object)) == null ? void 0 : _a.get(key);
812
+ const depsMap = targetMap.get(object);
813
+ return depsMap && depsMap.get(key);
814
814
  }
815
815
 
816
816
  const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
@@ -3022,7 +3022,7 @@ function renderComponentRoot(instance) {
3022
3022
  true ? {
3023
3023
  get attrs() {
3024
3024
  markAttrsAccessed();
3025
- return attrs;
3025
+ return shallowReadonly(attrs);
3026
3026
  },
3027
3027
  slots,
3028
3028
  emit
@@ -3055,7 +3055,7 @@ function renderComponentRoot(instance) {
3055
3055
  propsOptions
3056
3056
  );
3057
3057
  }
3058
- root = cloneVNode(root, fallthroughAttrs);
3058
+ root = cloneVNode(root, fallthroughAttrs, false, true);
3059
3059
  } else if (!accessedAttrs && root.type !== Comment) {
3060
3060
  const allAttrs = Object.keys(attrs);
3061
3061
  const eventAttrs = [];
@@ -3093,10 +3093,15 @@ function renderComponentRoot(instance) {
3093
3093
  getComponentName(instance.type)
3094
3094
  );
3095
3095
  }
3096
- root = cloneVNode(root, {
3097
- class: cls,
3098
- style
3099
- });
3096
+ root = cloneVNode(
3097
+ root,
3098
+ {
3099
+ class: cls,
3100
+ style
3101
+ },
3102
+ false,
3103
+ true
3104
+ );
3100
3105
  }
3101
3106
  }
3102
3107
  if (vnode.dirs) {
@@ -3105,7 +3110,7 @@ function renderComponentRoot(instance) {
3105
3110
  `Runtime directive used on component with non-element root node. The directives will not function as intended.`
3106
3111
  );
3107
3112
  }
3108
- root = cloneVNode(root);
3113
+ root = cloneVNode(root, null, false, true);
3109
3114
  root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
3110
3115
  }
3111
3116
  if (vnode.transition) {
@@ -3600,7 +3605,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
3600
3605
  let parentSuspenseId;
3601
3606
  const isSuspensible = isVNodeSuspensible(vnode);
3602
3607
  if (isSuspensible) {
3603
- if (parentSuspense == null ? void 0 : parentSuspense.pendingBranch) {
3608
+ if (parentSuspense && parentSuspense.pendingBranch) {
3604
3609
  parentSuspenseId = parentSuspense.pendingId;
3605
3610
  parentSuspense.deps++;
3606
3611
  }
@@ -3912,8 +3917,8 @@ function setActiveBranch(suspense, branch) {
3912
3917
  }
3913
3918
  }
3914
3919
  function isVNodeSuspensible(vnode) {
3915
- var _a;
3916
- return ((_a = vnode.props) == null ? void 0 : _a.suspensible) != null && vnode.props.suspensible !== false;
3920
+ const suspensible = vnode.props && vnode.props.suspensible;
3921
+ return suspensible != null && suspensible !== false;
3917
3922
  }
3918
3923
 
3919
3924
  const legacyDirectiveHookMap = {
@@ -4215,34 +4220,29 @@ function createPathGetter(ctx, path) {
4215
4220
  return cur;
4216
4221
  };
4217
4222
  }
4218
- function traverse(value, depth, currentDepth = 0, seen) {
4219
- if (!isObject(value) || value["__v_skip"]) {
4223
+ function traverse(value, depth = Infinity, seen) {
4224
+ if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
4220
4225
  return value;
4221
4226
  }
4222
- if (depth && depth > 0) {
4223
- if (currentDepth >= depth) {
4224
- return value;
4225
- }
4226
- currentDepth++;
4227
- }
4228
4227
  seen = seen || /* @__PURE__ */ new Set();
4229
4228
  if (seen.has(value)) {
4230
4229
  return value;
4231
4230
  }
4232
4231
  seen.add(value);
4232
+ depth--;
4233
4233
  if (isRef(value)) {
4234
- traverse(value.value, depth, currentDepth, seen);
4234
+ traverse(value.value, depth, seen);
4235
4235
  } else if (isArray(value)) {
4236
4236
  for (let i = 0; i < value.length; i++) {
4237
- traverse(value[i], depth, currentDepth, seen);
4237
+ traverse(value[i], depth, seen);
4238
4238
  }
4239
4239
  } else if (isSet(value) || isMap(value)) {
4240
4240
  value.forEach((v) => {
4241
- traverse(v, depth, currentDepth, seen);
4241
+ traverse(v, depth, seen);
4242
4242
  });
4243
4243
  } else if (isPlainObject(value)) {
4244
4244
  for (const key in value) {
4245
- traverse(value[key], depth, currentDepth, seen);
4245
+ traverse(value[key], depth, seen);
4246
4246
  }
4247
4247
  }
4248
4248
  return value;
@@ -4403,7 +4403,7 @@ const BaseTransitionImpl = {
4403
4403
  instance
4404
4404
  );
4405
4405
  setTransitionHooks(oldInnerChild, leavingHooks);
4406
- if (mode === "out-in") {
4406
+ if (mode === "out-in" && innerChild.type !== Comment) {
4407
4407
  state.isLeaving = true;
4408
4408
  leavingHooks.afterLeave = () => {
4409
4409
  state.isLeaving = false;
@@ -4598,11 +4598,13 @@ function getKeepAliveChild(vnode) {
4598
4598
  return vnode.component.subTree;
4599
4599
  }
4600
4600
  const { shapeFlag, children } = vnode;
4601
- if (shapeFlag & 16) {
4602
- return children[0];
4603
- }
4604
- if (shapeFlag & 32 && isFunction(children.default)) {
4605
- return children.default();
4601
+ if (children) {
4602
+ if (shapeFlag & 16) {
4603
+ return children[0];
4604
+ }
4605
+ if (shapeFlag & 32 && isFunction(children.default)) {
4606
+ return children.default();
4607
+ }
4606
4608
  }
4607
4609
  }
4608
4610
  function setTransitionHooks(vnode, hooks) {
@@ -4925,7 +4927,7 @@ const KeepAliveImpl = {
4925
4927
  return () => {
4926
4928
  pendingCacheKey = null;
4927
4929
  if (!slots.default) {
4928
- return current = null;
4930
+ return null;
4929
4931
  }
4930
4932
  const children = slots.default();
4931
4933
  const rawVNode = children[0];
@@ -6621,13 +6623,13 @@ function createCompatVue$1(createApp, createSingletonApp) {
6621
6623
  return vm;
6622
6624
  }
6623
6625
  }
6624
- Vue.version = `2.6.14-compat:${"3.4.24"}`;
6626
+ Vue.version = `2.6.14-compat:${"3.4.26"}`;
6625
6627
  Vue.config = singletonApp.config;
6626
- Vue.use = (p, ...options) => {
6627
- if (p && isFunction(p.install)) {
6628
- p.install(Vue, ...options);
6629
- } else if (isFunction(p)) {
6630
- p(Vue, ...options);
6628
+ Vue.use = (plugin, ...options) => {
6629
+ if (plugin && isFunction(plugin.install)) {
6630
+ plugin.install(Vue, ...options);
6631
+ } else if (isFunction(plugin)) {
6632
+ plugin(Vue, ...options);
6631
6633
  }
6632
6634
  return Vue;
6633
6635
  };
@@ -7258,7 +7260,7 @@ function shouldSkipAttr(key, instance) {
7258
7260
  return false;
7259
7261
  }
7260
7262
 
7261
- const internalObjectProto = /* @__PURE__ */ Object.create(null);
7263
+ const internalObjectProto = {};
7262
7264
  const createInternalObject = () => Object.create(internalObjectProto);
7263
7265
  const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto;
7264
7266
 
@@ -7745,7 +7747,7 @@ const initSlots = (instance, children) => {
7745
7747
  const type = children._;
7746
7748
  if (type) {
7747
7749
  extend(slots, children);
7748
- def(slots, "_", type);
7750
+ def(slots, "_", type, true);
7749
7751
  } else {
7750
7752
  normalizeObjectSlots(children, slots, instance);
7751
7753
  }
@@ -10584,8 +10586,8 @@ function guardReactiveProps(props) {
10584
10586
  return null;
10585
10587
  return isProxy(props) || isInternalObject(props) ? extend({}, props) : props;
10586
10588
  }
10587
- function cloneVNode(vnode, extraProps, mergeRef = false) {
10588
- const { props, ref, patchFlag, children } = vnode;
10589
+ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false) {
10590
+ const { props, ref, patchFlag, children, transition } = vnode;
10589
10591
  const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;
10590
10592
  const cloned = {
10591
10593
  __v_isVNode: true,
@@ -10615,7 +10617,7 @@ function cloneVNode(vnode, extraProps, mergeRef = false) {
10615
10617
  dynamicChildren: vnode.dynamicChildren,
10616
10618
  appContext: vnode.appContext,
10617
10619
  dirs: vnode.dirs,
10618
- transition: vnode.transition,
10620
+ transition,
10619
10621
  // These should technically only be non-null on mounted VNodes. However,
10620
10622
  // they *should* be copied for kept-alive vnodes. So we just always copy
10621
10623
  // them since them being non-null during a mount doesn't affect the logic as
@@ -10629,6 +10631,9 @@ function cloneVNode(vnode, extraProps, mergeRef = false) {
10629
10631
  ctx: vnode.ctx,
10630
10632
  ce: vnode.ce
10631
10633
  };
10634
+ if (transition && cloneTransition) {
10635
+ cloned.transition = transition.clone(cloned);
10636
+ }
10632
10637
  {
10633
10638
  defineLegacyVNodeProperties(cloned);
10634
10639
  }
@@ -11468,7 +11473,7 @@ function isMemoSame(cached, memo) {
11468
11473
  return true;
11469
11474
  }
11470
11475
 
11471
- const version = "3.4.24";
11476
+ const version = "3.4.26";
11472
11477
  const warn = warn$1 ;
11473
11478
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11474
11479
  const devtools = devtools$1 ;
@@ -15234,11 +15239,10 @@ const tokenizer = new Tokenizer(stack, {
15234
15239
  }
15235
15240
  },
15236
15241
  onselfclosingtag(end) {
15237
- var _a;
15238
15242
  const name = currentOpenTag.tag;
15239
15243
  currentOpenTag.isSelfClosing = true;
15240
15244
  endOpenTag(end);
15241
- if (((_a = stack[0]) == null ? void 0 : _a.tag) === name) {
15245
+ if (stack[0] && stack[0].tag === name) {
15242
15246
  onCloseTag(stack.shift(), end);
15243
15247
  }
15244
15248
  },
@@ -15554,7 +15558,7 @@ function endOpenTag(end) {
15554
15558
  function onText(content, start, end) {
15555
15559
  const parent = stack[0] || currentRoot;
15556
15560
  const lastNode = parent.children[parent.children.length - 1];
15557
- if ((lastNode == null ? void 0 : lastNode.type) === 2) {
15561
+ if (lastNode && lastNode.type === 2) {
15558
15562
  lastNode.content += content;
15559
15563
  setLocEnd(lastNode.loc, end);
15560
15564
  } else {
@@ -15688,11 +15692,10 @@ function isFragmentTemplate({ tag, props }) {
15688
15692
  return false;
15689
15693
  }
15690
15694
  function isComponent({ tag, props }) {
15691
- var _a;
15692
15695
  if (currentOptions.isCustomElement(tag)) {
15693
15696
  return false;
15694
15697
  }
15695
- if (tag === "component" || isUpperCase(tag.charCodeAt(0)) || isCoreComponent(tag) || ((_a = currentOptions.isBuiltInComponent) == null ? void 0 : _a.call(currentOptions, tag)) || currentOptions.isNativeTag && !currentOptions.isNativeTag(tag)) {
15698
+ if (tag === "component" || isUpperCase(tag.charCodeAt(0)) || isCoreComponent(tag) || currentOptions.isBuiltInComponent && currentOptions.isBuiltInComponent(tag) || currentOptions.isNativeTag && !currentOptions.isNativeTag(tag)) {
15696
15699
  return true;
15697
15700
  }
15698
15701
  for (let i = 0; i < props.length; i++) {
@@ -15725,7 +15728,6 @@ function isUpperCase(c) {
15725
15728
  }
15726
15729
  const windowsNewlineRE = /\r\n/g;
15727
15730
  function condenseWhitespace(nodes, tag) {
15728
- var _a, _b;
15729
15731
  const shouldCondense = currentOptions.whitespace !== "preserve";
15730
15732
  let removedWhitespace = false;
15731
15733
  for (let i = 0; i < nodes.length; i++) {
@@ -15733,8 +15735,8 @@ function condenseWhitespace(nodes, tag) {
15733
15735
  if (node.type === 2) {
15734
15736
  if (!inPre) {
15735
15737
  if (isAllWhitespace(node.content)) {
15736
- const prev = (_a = nodes[i - 1]) == null ? void 0 : _a.type;
15737
- const next = (_b = nodes[i + 1]) == null ? void 0 : _b.type;
15738
+ const prev = nodes[i - 1] && nodes[i - 1].type;
15739
+ const next = nodes[i + 1] && nodes[i + 1].type;
15738
15740
  if (!prev || !next || shouldCondense && (prev === 3 && (next === 3 || next === 1) || prev === 1 && (next === 3 || next === 1 && hasNewlineChar(node.content)))) {
15739
15741
  removedWhitespace = true;
15740
15742
  nodes[i] = null;
@@ -15894,7 +15896,7 @@ function baseParse(input, options) {
15894
15896
  }
15895
15897
  tokenizer.mode = currentOptions.parseMode === "html" ? 1 : currentOptions.parseMode === "sfc" ? 2 : 0;
15896
15898
  tokenizer.inXML = currentOptions.ns === 1 || currentOptions.ns === 2;
15897
- const delimiters = options == null ? void 0 : options.delimiters;
15899
+ const delimiters = options && options.delimiters;
15898
15900
  if (delimiters) {
15899
15901
  tokenizer.delimiterOpen = toCharCodes(delimiters[0]);
15900
15902
  tokenizer.delimiterClose = toCharCodes(delimiters[1]);
@@ -17252,7 +17254,6 @@ function genReturnStatement({ returns }, context) {
17252
17254
  }
17253
17255
 
17254
17256
  const isLiteralWhitelisted = /* @__PURE__ */ makeMap("true,false,null,this");
17255
- const constantBailRE = /\w\s*\(|\.[^\d]/;
17256
17257
  const transformExpression = (node, context) => {
17257
17258
  if (node.type === 5) {
17258
17259
  node.content = processExpression(
@@ -17347,7 +17348,6 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
17347
17348
  return `_ctx.${raw}`;
17348
17349
  };
17349
17350
  const rawExp = node.content;
17350
- const bailConstant = constantBailRE.test(rawExp);
17351
17351
  let ast = node.ast;
17352
17352
  if (ast === false) {
17353
17353
  return node;
@@ -17409,7 +17409,7 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
17409
17409
  node2.name = rewriteIdentifier(node2.name, parent, node2);
17410
17410
  ids.push(node2);
17411
17411
  } else {
17412
- if (!(needPrefix && isLocal) && !bailConstant) {
17412
+ if (!(needPrefix && isLocal) && parent.type !== "CallExpression" && parent.type !== "NewExpression" && parent.type !== "MemberExpression") {
17413
17413
  node2.isConstant = true;
17414
17414
  }
17415
17415
  ids.push(node2);
@@ -17453,7 +17453,7 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
17453
17453
  ret.ast = ast;
17454
17454
  } else {
17455
17455
  ret = node;
17456
- ret.constType = bailConstant ? 0 : 3;
17456
+ ret.constType = 3;
17457
17457
  }
17458
17458
  ret.identifiers = Object.keys(knownIds);
17459
17459
  return ret;