@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.
package/dist/vue.cjs.js CHANGED
@@ -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
  **/
@@ -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
  };
@@ -215,8 +216,8 @@ function stringifyStyle(styles) {
215
216
  }
216
217
  for (const key in styles) {
217
218
  const value = styles[key];
218
- const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
219
219
  if (isString(value) || typeof value === "number") {
220
+ const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
220
221
  ret += `${normalizedKey}:${value};`;
221
222
  }
222
223
  }
@@ -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;
@@ -4927,7 +4927,7 @@ const KeepAliveImpl = {
4927
4927
  return () => {
4928
4928
  pendingCacheKey = null;
4929
4929
  if (!slots.default) {
4930
- return current = null;
4930
+ return null;
4931
4931
  }
4932
4932
  const children = slots.default();
4933
4933
  const rawVNode = children[0];
@@ -5645,14 +5645,7 @@ function installCompatInstanceProperties(map) {
5645
5645
  },
5646
5646
  $scopedSlots: (i) => {
5647
5647
  assertCompatEnabled("INSTANCE_SCOPED_SLOTS", i);
5648
- const res = {};
5649
- for (const key in i.slots) {
5650
- const fn = i.slots[key];
5651
- if (!fn._ns) {
5652
- res[key] = fn;
5653
- }
5654
- }
5655
- return res;
5648
+ return shallowReadonly(i.slots) ;
5656
5649
  },
5657
5650
  $on: (i) => on.bind(null, i),
5658
5651
  $once: (i) => once.bind(null, i),
@@ -6623,13 +6616,13 @@ function createCompatVue$1(createApp, createSingletonApp) {
6623
6616
  return vm;
6624
6617
  }
6625
6618
  }
6626
- Vue.version = `2.6.14-compat:${"3.4.25"}`;
6619
+ Vue.version = `2.6.14-compat:${"3.4.27"}`;
6627
6620
  Vue.config = singletonApp.config;
6628
- Vue.use = (p, ...options) => {
6629
- if (p && isFunction(p.install)) {
6630
- p.install(Vue, ...options);
6631
- } else if (isFunction(p)) {
6632
- p(Vue, ...options);
6621
+ Vue.use = (plugin, ...options) => {
6622
+ if (plugin && isFunction(plugin.install)) {
6623
+ plugin.install(Vue, ...options);
6624
+ } else if (isFunction(plugin)) {
6625
+ plugin(Vue, ...options);
6633
6626
  }
6634
6627
  return Vue;
6635
6628
  };
@@ -7747,7 +7740,7 @@ const initSlots = (instance, children) => {
7747
7740
  const type = children._;
7748
7741
  if (type) {
7749
7742
  extend(slots, children);
7750
- def(slots, "_", type);
7743
+ def(slots, "_", type, true);
7751
7744
  } else {
7752
7745
  normalizeObjectSlots(children, slots, instance);
7753
7746
  }
@@ -8361,7 +8354,7 @@ function propHasMismatch(el, key, clientValue, vnode, instance) {
8361
8354
  mismatchType = mismatchKey = `class`;
8362
8355
  }
8363
8356
  } else if (key === "style") {
8364
- actual = el.getAttribute("style");
8357
+ actual = el.getAttribute("style") || "";
8365
8358
  expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue));
8366
8359
  const actualMap = toStyleMap(actual);
8367
8360
  const expectedMap = toStyleMap(expected);
@@ -10586,8 +10579,8 @@ function guardReactiveProps(props) {
10586
10579
  return null;
10587
10580
  return isProxy(props) || isInternalObject(props) ? extend({}, props) : props;
10588
10581
  }
10589
- function cloneVNode(vnode, extraProps, mergeRef = false) {
10590
- const { props, ref, patchFlag, children } = vnode;
10582
+ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false) {
10583
+ const { props, ref, patchFlag, children, transition } = vnode;
10591
10584
  const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;
10592
10585
  const cloned = {
10593
10586
  __v_isVNode: true,
@@ -10617,7 +10610,7 @@ function cloneVNode(vnode, extraProps, mergeRef = false) {
10617
10610
  dynamicChildren: vnode.dynamicChildren,
10618
10611
  appContext: vnode.appContext,
10619
10612
  dirs: vnode.dirs,
10620
- transition: vnode.transition,
10613
+ transition,
10621
10614
  // These should technically only be non-null on mounted VNodes. However,
10622
10615
  // they *should* be copied for kept-alive vnodes. So we just always copy
10623
10616
  // them since them being non-null during a mount doesn't affect the logic as
@@ -10631,6 +10624,9 @@ function cloneVNode(vnode, extraProps, mergeRef = false) {
10631
10624
  ctx: vnode.ctx,
10632
10625
  ce: vnode.ce
10633
10626
  };
10627
+ if (transition && cloneTransition) {
10628
+ cloned.transition = transition.clone(cloned);
10629
+ }
10634
10630
  {
10635
10631
  defineLegacyVNodeProperties(cloned);
10636
10632
  }
@@ -11470,7 +11466,7 @@ function isMemoSame(cached, memo) {
11470
11466
  return true;
11471
11467
  }
11472
11468
 
11473
- const version = "3.4.25";
11469
+ const version = "3.4.27";
11474
11470
  const warn = warn$1 ;
11475
11471
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11476
11472
  const devtools = devtools$1 ;
@@ -15236,11 +15232,10 @@ const tokenizer = new Tokenizer(stack, {
15236
15232
  }
15237
15233
  },
15238
15234
  onselfclosingtag(end) {
15239
- var _a;
15240
15235
  const name = currentOpenTag.tag;
15241
15236
  currentOpenTag.isSelfClosing = true;
15242
15237
  endOpenTag(end);
15243
- if (((_a = stack[0]) == null ? void 0 : _a.tag) === name) {
15238
+ if (stack[0] && stack[0].tag === name) {
15244
15239
  onCloseTag(stack.shift(), end);
15245
15240
  }
15246
15241
  },
@@ -15556,7 +15551,7 @@ function endOpenTag(end) {
15556
15551
  function onText(content, start, end) {
15557
15552
  const parent = stack[0] || currentRoot;
15558
15553
  const lastNode = parent.children[parent.children.length - 1];
15559
- if ((lastNode == null ? void 0 : lastNode.type) === 2) {
15554
+ if (lastNode && lastNode.type === 2) {
15560
15555
  lastNode.content += content;
15561
15556
  setLocEnd(lastNode.loc, end);
15562
15557
  } else {
@@ -15690,11 +15685,10 @@ function isFragmentTemplate({ tag, props }) {
15690
15685
  return false;
15691
15686
  }
15692
15687
  function isComponent({ tag, props }) {
15693
- var _a;
15694
15688
  if (currentOptions.isCustomElement(tag)) {
15695
15689
  return false;
15696
15690
  }
15697
- if (tag === "component" || isUpperCase(tag.charCodeAt(0)) || isCoreComponent(tag) || ((_a = currentOptions.isBuiltInComponent) == null ? void 0 : _a.call(currentOptions, tag)) || currentOptions.isNativeTag && !currentOptions.isNativeTag(tag)) {
15691
+ if (tag === "component" || isUpperCase(tag.charCodeAt(0)) || isCoreComponent(tag) || currentOptions.isBuiltInComponent && currentOptions.isBuiltInComponent(tag) || currentOptions.isNativeTag && !currentOptions.isNativeTag(tag)) {
15698
15692
  return true;
15699
15693
  }
15700
15694
  for (let i = 0; i < props.length; i++) {
@@ -15727,7 +15721,6 @@ function isUpperCase(c) {
15727
15721
  }
15728
15722
  const windowsNewlineRE = /\r\n/g;
15729
15723
  function condenseWhitespace(nodes, tag) {
15730
- var _a, _b;
15731
15724
  const shouldCondense = currentOptions.whitespace !== "preserve";
15732
15725
  let removedWhitespace = false;
15733
15726
  for (let i = 0; i < nodes.length; i++) {
@@ -15735,8 +15728,8 @@ function condenseWhitespace(nodes, tag) {
15735
15728
  if (node.type === 2) {
15736
15729
  if (!inPre) {
15737
15730
  if (isAllWhitespace(node.content)) {
15738
- const prev = (_a = nodes[i - 1]) == null ? void 0 : _a.type;
15739
- const next = (_b = nodes[i + 1]) == null ? void 0 : _b.type;
15731
+ const prev = nodes[i - 1] && nodes[i - 1].type;
15732
+ const next = nodes[i + 1] && nodes[i + 1].type;
15740
15733
  if (!prev || !next || shouldCondense && (prev === 3 && (next === 3 || next === 1) || prev === 1 && (next === 3 || next === 1 && hasNewlineChar(node.content)))) {
15741
15734
  removedWhitespace = true;
15742
15735
  nodes[i] = null;
@@ -15896,7 +15889,7 @@ function baseParse(input, options) {
15896
15889
  }
15897
15890
  tokenizer.mode = currentOptions.parseMode === "html" ? 1 : currentOptions.parseMode === "sfc" ? 2 : 0;
15898
15891
  tokenizer.inXML = currentOptions.ns === 1 || currentOptions.ns === 2;
15899
- const delimiters = options == null ? void 0 : options.delimiters;
15892
+ const delimiters = options && options.delimiters;
15900
15893
  if (delimiters) {
15901
15894
  tokenizer.delimiterOpen = toCharCodes(delimiters[0]);
15902
15895
  tokenizer.delimiterClose = toCharCodes(delimiters[1]);
@@ -17254,7 +17247,6 @@ function genReturnStatement({ returns }, context) {
17254
17247
  }
17255
17248
 
17256
17249
  const isLiteralWhitelisted = /* @__PURE__ */ makeMap("true,false,null,this");
17257
- const constantBailRE = /\w\s*\(|\.[^\d]/;
17258
17250
  const transformExpression = (node, context) => {
17259
17251
  if (node.type === 5) {
17260
17252
  node.content = processExpression(
@@ -17349,7 +17341,6 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
17349
17341
  return `_ctx.${raw}`;
17350
17342
  };
17351
17343
  const rawExp = node.content;
17352
- const bailConstant = constantBailRE.test(rawExp);
17353
17344
  let ast = node.ast;
17354
17345
  if (ast === false) {
17355
17346
  return node;
@@ -17411,7 +17402,7 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
17411
17402
  node2.name = rewriteIdentifier(node2.name, parent, node2);
17412
17403
  ids.push(node2);
17413
17404
  } else {
17414
- if (!(needPrefix && isLocal) && !bailConstant) {
17405
+ if (!(needPrefix && isLocal) && parent.type !== "CallExpression" && parent.type !== "NewExpression" && parent.type !== "MemberExpression") {
17415
17406
  node2.isConstant = true;
17416
17407
  }
17417
17408
  ids.push(node2);
@@ -17455,7 +17446,7 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
17455
17446
  ret.ast = ast;
17456
17447
  } else {
17457
17448
  ret = node;
17458
- ret.constType = bailConstant ? 0 : 3;
17449
+ ret.constType = 3;
17459
17450
  }
17460
17451
  ret.identifiers = Object.keys(knownIds);
17461
17452
  return ret;
@@ -18938,7 +18929,7 @@ function processSlotOutlet(node, context) {
18938
18929
  };
18939
18930
  }
18940
18931
 
18941
- const fnExpRE = /^\s*([\w$_]+|(async\s*)?\([^)]*?\))\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
18932
+ const fnExpRE = /^\s*(async\s*)?(\([^)]*?\)|[\w$_]+)\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
18942
18933
  const transformOn$1 = (dir, node, context, augmentor) => {
18943
18934
  const { loc, modifiers, arg } = dir;
18944
18935
  if (!dir.exp && !modifiers.length) {
@@ -20022,6 +20013,7 @@ function analyzeNode(node) {
20022
20013
  return false;
20023
20014
  };
20024
20015
  function walk(node2) {
20016
+ const isOptionTag = node2.tag === "option" && node2.ns === 0;
20025
20017
  for (let i = 0; i < node2.props.length; i++) {
20026
20018
  const p = node2.props[i];
20027
20019
  if (p.type === 6 && !isStringifiableAttr(p.name, node2.ns)) {
@@ -20034,6 +20026,9 @@ function analyzeNode(node) {
20034
20026
  if (p.exp && (p.exp.type === 8 || p.exp.constType < 3)) {
20035
20027
  return bail();
20036
20028
  }
20029
+ if (isOptionTag && isStaticArgOf(p.arg, "value") && p.exp && p.exp.ast && p.exp.ast.type !== "StringLiteral") {
20030
+ return bail();
20031
+ }
20037
20032
  }
20038
20033
  }
20039
20034
  for (let i = 0; i < node2.children.length; i++) {