@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
  **/
@@ -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
  };
@@ -152,8 +153,8 @@ function stringifyStyle(styles) {
152
153
  }
153
154
  for (const key in styles) {
154
155
  const value = styles[key];
155
- const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
156
156
  if (isString(value) || typeof value === "number") {
157
+ const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
157
158
  ret += `${normalizedKey}:${value};`;
158
159
  }
159
160
  }
@@ -512,11 +513,10 @@ class ReactiveEffect {
512
513
  }
513
514
  }
514
515
  stop() {
515
- var _a;
516
516
  if (this.active) {
517
517
  preCleanupEffect(this);
518
518
  postCleanupEffect(this);
519
- (_a = this.onStop) == null ? void 0 : _a.call(this);
519
+ this.onStop && this.onStop();
520
520
  this.active = false;
521
521
  }
522
522
  }
@@ -706,8 +706,8 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
706
706
  resetScheduling();
707
707
  }
708
708
  function getDepFromReactive(object, key) {
709
- var _a;
710
- return (_a = targetMap.get(object)) == null ? void 0 : _a.get(key);
709
+ const depsMap = targetMap.get(object);
710
+ return depsMap && depsMap.get(key);
711
711
  }
712
712
 
713
713
  const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
@@ -2151,7 +2151,7 @@ function renderComponentRoot(instance) {
2151
2151
  false ? {
2152
2152
  get attrs() {
2153
2153
  markAttrsAccessed();
2154
- return attrs;
2154
+ return shallowReadonly(attrs);
2155
2155
  },
2156
2156
  slots,
2157
2157
  emit
@@ -2180,21 +2180,26 @@ function renderComponentRoot(instance) {
2180
2180
  propsOptions
2181
2181
  );
2182
2182
  }
2183
- root = cloneVNode(root, fallthroughAttrs);
2183
+ root = cloneVNode(root, fallthroughAttrs, false, true);
2184
2184
  }
2185
2185
  }
2186
2186
  }
2187
2187
  if (isCompatEnabled$1("INSTANCE_ATTRS_CLASS_STYLE", instance) && vnode.shapeFlag & 4 && root.shapeFlag & (1 | 6)) {
2188
2188
  const { class: cls, style } = vnode.props || {};
2189
2189
  if (cls || style) {
2190
- root = cloneVNode(root, {
2191
- class: cls,
2192
- style
2193
- });
2190
+ root = cloneVNode(
2191
+ root,
2192
+ {
2193
+ class: cls,
2194
+ style
2195
+ },
2196
+ false,
2197
+ true
2198
+ );
2194
2199
  }
2195
2200
  }
2196
2201
  if (vnode.dirs) {
2197
- root = cloneVNode(root);
2202
+ root = cloneVNode(root, null, false, true);
2198
2203
  root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
2199
2204
  }
2200
2205
  if (vnode.transition) {
@@ -2634,7 +2639,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
2634
2639
  let parentSuspenseId;
2635
2640
  const isSuspensible = isVNodeSuspensible(vnode);
2636
2641
  if (isSuspensible) {
2637
- if (parentSuspense == null ? void 0 : parentSuspense.pendingBranch) {
2642
+ if (parentSuspense && parentSuspense.pendingBranch) {
2638
2643
  parentSuspenseId = parentSuspense.pendingId;
2639
2644
  parentSuspense.deps++;
2640
2645
  }
@@ -2922,8 +2927,8 @@ function setActiveBranch(suspense, branch) {
2922
2927
  }
2923
2928
  }
2924
2929
  function isVNodeSuspensible(vnode) {
2925
- var _a;
2926
- return ((_a = vnode.props) == null ? void 0 : _a.suspensible) != null && vnode.props.suspensible !== false;
2930
+ const suspensible = vnode.props && vnode.props.suspensible;
2931
+ return suspensible != null && suspensible !== false;
2927
2932
  }
2928
2933
 
2929
2934
  const legacyDirectiveHookMap = {
@@ -3179,34 +3184,29 @@ function createPathGetter(ctx, path) {
3179
3184
  return cur;
3180
3185
  };
3181
3186
  }
3182
- function traverse(value, depth, currentDepth = 0, seen) {
3183
- if (!isObject(value) || value["__v_skip"]) {
3187
+ function traverse(value, depth = Infinity, seen) {
3188
+ if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
3184
3189
  return value;
3185
3190
  }
3186
- if (depth && depth > 0) {
3187
- if (currentDepth >= depth) {
3188
- return value;
3189
- }
3190
- currentDepth++;
3191
- }
3192
3191
  seen = seen || /* @__PURE__ */ new Set();
3193
3192
  if (seen.has(value)) {
3194
3193
  return value;
3195
3194
  }
3196
3195
  seen.add(value);
3196
+ depth--;
3197
3197
  if (isRef(value)) {
3198
- traverse(value.value, depth, currentDepth, seen);
3198
+ traverse(value.value, depth, seen);
3199
3199
  } else if (isArray(value)) {
3200
3200
  for (let i = 0; i < value.length; i++) {
3201
- traverse(value[i], depth, currentDepth, seen);
3201
+ traverse(value[i], depth, seen);
3202
3202
  }
3203
3203
  } else if (isSet(value) || isMap(value)) {
3204
3204
  value.forEach((v) => {
3205
- traverse(v, depth, currentDepth, seen);
3205
+ traverse(v, depth, seen);
3206
3206
  });
3207
3207
  } else if (isPlainObject(value)) {
3208
3208
  for (const key in value) {
3209
- traverse(value[key], depth, currentDepth, seen);
3209
+ traverse(value[key], depth, seen);
3210
3210
  }
3211
3211
  }
3212
3212
  return value;
@@ -3351,7 +3351,7 @@ const BaseTransitionImpl = {
3351
3351
  instance
3352
3352
  );
3353
3353
  setTransitionHooks(oldInnerChild, leavingHooks);
3354
- if (mode === "out-in") {
3354
+ if (mode === "out-in" && innerChild.type !== Comment) {
3355
3355
  state.isLeaving = true;
3356
3356
  leavingHooks.afterLeave = () => {
3357
3357
  state.isLeaving = false;
@@ -3855,7 +3855,7 @@ const KeepAliveImpl = {
3855
3855
  return () => {
3856
3856
  pendingCacheKey = null;
3857
3857
  if (!slots.default) {
3858
- return current = null;
3858
+ return null;
3859
3859
  }
3860
3860
  const children = slots.default();
3861
3861
  const rawVNode = children[0];
@@ -4552,14 +4552,7 @@ function installCompatInstanceProperties(map) {
4552
4552
  },
4553
4553
  $scopedSlots: (i) => {
4554
4554
  assertCompatEnabled("INSTANCE_SCOPED_SLOTS", i);
4555
- const res = {};
4556
- for (const key in i.slots) {
4557
- const fn = i.slots[key];
4558
- if (!fn._ns) {
4559
- res[key] = fn;
4560
- }
4561
- }
4562
- return res;
4555
+ return i.slots;
4563
4556
  },
4564
4557
  $on: (i) => on.bind(null, i),
4565
4558
  $once: (i) => once.bind(null, i),
@@ -5281,13 +5274,13 @@ function createCompatVue$1(createApp, createSingletonApp) {
5281
5274
  return vm;
5282
5275
  }
5283
5276
  }
5284
- Vue.version = `2.6.14-compat:${"3.4.25"}`;
5277
+ Vue.version = `2.6.14-compat:${"3.4.27"}`;
5285
5278
  Vue.config = singletonApp.config;
5286
- Vue.use = (p, ...options) => {
5287
- if (p && isFunction(p.install)) {
5288
- p.install(Vue, ...options);
5289
- } else if (isFunction(p)) {
5290
- p(Vue, ...options);
5279
+ Vue.use = (plugin, ...options) => {
5280
+ if (plugin && isFunction(plugin.install)) {
5281
+ plugin.install(Vue, ...options);
5282
+ } else if (isFunction(plugin)) {
5283
+ plugin(Vue, ...options);
5291
5284
  }
5292
5285
  return Vue;
5293
5286
  };
@@ -6157,7 +6150,7 @@ const initSlots = (instance, children) => {
6157
6150
  const type = children._;
6158
6151
  if (type) {
6159
6152
  extend(slots, children);
6160
- def(slots, "_", type);
6153
+ def(slots, "_", type, true);
6161
6154
  } else {
6162
6155
  normalizeObjectSlots(children, slots);
6163
6156
  }
@@ -8588,8 +8581,8 @@ function guardReactiveProps(props) {
8588
8581
  return null;
8589
8582
  return isProxy(props) || isInternalObject(props) ? extend({}, props) : props;
8590
8583
  }
8591
- function cloneVNode(vnode, extraProps, mergeRef = false) {
8592
- const { props, ref, patchFlag, children } = vnode;
8584
+ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false) {
8585
+ const { props, ref, patchFlag, children, transition } = vnode;
8593
8586
  const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;
8594
8587
  const cloned = {
8595
8588
  __v_isVNode: true,
@@ -8619,7 +8612,7 @@ function cloneVNode(vnode, extraProps, mergeRef = false) {
8619
8612
  dynamicChildren: vnode.dynamicChildren,
8620
8613
  appContext: vnode.appContext,
8621
8614
  dirs: vnode.dirs,
8622
- transition: vnode.transition,
8615
+ transition,
8623
8616
  // These should technically only be non-null on mounted VNodes. However,
8624
8617
  // they *should* be copied for kept-alive vnodes. So we just always copy
8625
8618
  // them since them being non-null during a mount doesn't affect the logic as
@@ -8633,6 +8626,9 @@ function cloneVNode(vnode, extraProps, mergeRef = false) {
8633
8626
  ctx: vnode.ctx,
8634
8627
  ce: vnode.ce
8635
8628
  };
8629
+ if (transition && cloneTransition) {
8630
+ cloned.transition = transition.clone(cloned);
8631
+ }
8636
8632
  {
8637
8633
  defineLegacyVNodeProperties(cloned);
8638
8634
  }
@@ -9140,7 +9136,7 @@ function isMemoSame(cached, memo) {
9140
9136
  return true;
9141
9137
  }
9142
9138
 
9143
- const version = "3.4.25";
9139
+ const version = "3.4.27";
9144
9140
  const warn$1 = NOOP;
9145
9141
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
9146
9142
  const devtools = void 0;
@@ -12717,11 +12713,10 @@ const tokenizer = new Tokenizer(stack, {
12717
12713
  }
12718
12714
  },
12719
12715
  onselfclosingtag(end) {
12720
- var _a;
12721
12716
  const name = currentOpenTag.tag;
12722
12717
  currentOpenTag.isSelfClosing = true;
12723
12718
  endOpenTag(end);
12724
- if (((_a = stack[0]) == null ? void 0 : _a.tag) === name) {
12719
+ if (stack[0] && stack[0].tag === name) {
12725
12720
  onCloseTag(stack.shift(), end);
12726
12721
  }
12727
12722
  },
@@ -13037,7 +13032,7 @@ function endOpenTag(end) {
13037
13032
  function onText(content, start, end) {
13038
13033
  const parent = stack[0] || currentRoot;
13039
13034
  const lastNode = parent.children[parent.children.length - 1];
13040
- if ((lastNode == null ? void 0 : lastNode.type) === 2) {
13035
+ if (lastNode && lastNode.type === 2) {
13041
13036
  lastNode.content += content;
13042
13037
  setLocEnd(lastNode.loc, end);
13043
13038
  } else {
@@ -13141,11 +13136,10 @@ function isFragmentTemplate({ tag, props }) {
13141
13136
  return false;
13142
13137
  }
13143
13138
  function isComponent({ tag, props }) {
13144
- var _a;
13145
13139
  if (currentOptions.isCustomElement(tag)) {
13146
13140
  return false;
13147
13141
  }
13148
- if (tag === "component" || isUpperCase(tag.charCodeAt(0)) || isCoreComponent(tag) || ((_a = currentOptions.isBuiltInComponent) == null ? void 0 : _a.call(currentOptions, tag)) || currentOptions.isNativeTag && !currentOptions.isNativeTag(tag)) {
13142
+ if (tag === "component" || isUpperCase(tag.charCodeAt(0)) || isCoreComponent(tag) || currentOptions.isBuiltInComponent && currentOptions.isBuiltInComponent(tag) || currentOptions.isNativeTag && !currentOptions.isNativeTag(tag)) {
13149
13143
  return true;
13150
13144
  }
13151
13145
  for (let i = 0; i < props.length; i++) {
@@ -13178,7 +13172,6 @@ function isUpperCase(c) {
13178
13172
  }
13179
13173
  const windowsNewlineRE = /\r\n/g;
13180
13174
  function condenseWhitespace(nodes, tag) {
13181
- var _a, _b;
13182
13175
  const shouldCondense = currentOptions.whitespace !== "preserve";
13183
13176
  let removedWhitespace = false;
13184
13177
  for (let i = 0; i < nodes.length; i++) {
@@ -13186,8 +13179,8 @@ function condenseWhitespace(nodes, tag) {
13186
13179
  if (node.type === 2) {
13187
13180
  if (!inPre) {
13188
13181
  if (isAllWhitespace(node.content)) {
13189
- const prev = (_a = nodes[i - 1]) == null ? void 0 : _a.type;
13190
- const next = (_b = nodes[i + 1]) == null ? void 0 : _b.type;
13182
+ const prev = nodes[i - 1] && nodes[i - 1].type;
13183
+ const next = nodes[i + 1] && nodes[i + 1].type;
13191
13184
  if (!prev || !next || shouldCondense && (prev === 3 && (next === 3 || next === 1) || prev === 1 && (next === 3 || next === 1 && hasNewlineChar(node.content)))) {
13192
13185
  removedWhitespace = true;
13193
13186
  nodes[i] = null;
@@ -13340,7 +13333,7 @@ function baseParse(input, options) {
13340
13333
  }
13341
13334
  tokenizer.mode = currentOptions.parseMode === "html" ? 1 : currentOptions.parseMode === "sfc" ? 2 : 0;
13342
13335
  tokenizer.inXML = currentOptions.ns === 1 || currentOptions.ns === 2;
13343
- const delimiters = options == null ? void 0 : options.delimiters;
13336
+ const delimiters = options && options.delimiters;
13344
13337
  if (delimiters) {
13345
13338
  tokenizer.delimiterOpen = toCharCodes(delimiters[0]);
13346
13339
  tokenizer.delimiterClose = toCharCodes(delimiters[1]);
@@ -14667,7 +14660,6 @@ function genReturnStatement({ returns }, context) {
14667
14660
  }
14668
14661
 
14669
14662
  const isLiteralWhitelisted = /* @__PURE__ */ makeMap("true,false,null,this");
14670
- const constantBailRE = /\w\s*\(|\.[^\d]/;
14671
14663
  const transformExpression = (node, context) => {
14672
14664
  if (node.type === 5) {
14673
14665
  node.content = processExpression(
@@ -14762,7 +14754,6 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
14762
14754
  return `_ctx.${raw}`;
14763
14755
  };
14764
14756
  const rawExp = node.content;
14765
- const bailConstant = constantBailRE.test(rawExp);
14766
14757
  let ast = node.ast;
14767
14758
  if (ast === false) {
14768
14759
  return node;
@@ -14824,7 +14815,7 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
14824
14815
  node2.name = rewriteIdentifier(node2.name, parent, node2);
14825
14816
  ids.push(node2);
14826
14817
  } else {
14827
- if (!(needPrefix && isLocal) && !bailConstant) {
14818
+ if (!(needPrefix && isLocal) && parent.type !== "CallExpression" && parent.type !== "NewExpression" && parent.type !== "MemberExpression") {
14828
14819
  node2.isConstant = true;
14829
14820
  }
14830
14821
  ids.push(node2);
@@ -14868,7 +14859,7 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
14868
14859
  ret.ast = ast;
14869
14860
  } else {
14870
14861
  ret = node;
14871
- ret.constType = bailConstant ? 0 : 3;
14862
+ ret.constType = 3;
14872
14863
  }
14873
14864
  ret.identifiers = Object.keys(knownIds);
14874
14865
  return ret;
@@ -16305,7 +16296,7 @@ function processSlotOutlet(node, context) {
16305
16296
  };
16306
16297
  }
16307
16298
 
16308
- const fnExpRE = /^\s*([\w$_]+|(async\s*)?\([^)]*?\))\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
16299
+ const fnExpRE = /^\s*(async\s*)?(\([^)]*?\)|[\w$_]+)\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
16309
16300
  const transformOn$1 = (dir, node, context, augmentor) => {
16310
16301
  const { loc, modifiers, arg } = dir;
16311
16302
  if (!dir.exp && !modifiers.length) {
@@ -17315,6 +17306,7 @@ function analyzeNode(node) {
17315
17306
  return false;
17316
17307
  };
17317
17308
  function walk(node2) {
17309
+ const isOptionTag = node2.tag === "option" && node2.ns === 0;
17318
17310
  for (let i = 0; i < node2.props.length; i++) {
17319
17311
  const p = node2.props[i];
17320
17312
  if (p.type === 6 && !isStringifiableAttr(p.name, node2.ns)) {
@@ -17327,6 +17319,9 @@ function analyzeNode(node) {
17327
17319
  if (p.exp && (p.exp.type === 8 || p.exp.constType < 3)) {
17328
17320
  return bail();
17329
17321
  }
17322
+ if (isOptionTag && isStaticArgOf(p.arg, "value") && p.exp && p.exp.ast && p.exp.ast.type !== "StringLiteral") {
17323
+ return bail();
17324
+ }
17330
17325
  }
17331
17326
  }
17332
17327
  for (let i = 0; i < node2.children.length; i++) {