@vue/compat 3.5.16 → 3.5.18

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.5.16
2
+ * @vue/compat v3.5.18
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -813,6 +813,7 @@ class Link {
813
813
  }
814
814
  }
815
815
  class Dep {
816
+ // TODO isolatedDeclarations "__v_skip"
816
817
  constructor(computed) {
817
818
  this.computed = computed;
818
819
  this.version = 0;
@@ -833,6 +834,10 @@ class Dep {
833
834
  * Subscriber counter
834
835
  */
835
836
  this.sc = 0;
837
+ /**
838
+ * @internal
839
+ */
840
+ this.__v_skip = true;
836
841
  }
837
842
  track(debugInfo) {
838
843
  if (!activeSub || !shouldTrack || activeSub === this.computed) {
@@ -3938,7 +3943,7 @@ function isMismatchAllowed(el, allowedType) {
3938
3943
  if (allowedType === 0 /* TEXT */ && list.includes("children")) {
3939
3944
  return true;
3940
3945
  }
3941
- return allowedAttr.split(",").includes(MismatchTypeString[allowedType]);
3946
+ return list.includes(MismatchTypeString[allowedType]);
3942
3947
  }
3943
3948
  }
3944
3949
 
@@ -4087,10 +4092,15 @@ function defineAsyncComponent(source) {
4087
4092
  name: "AsyncComponentWrapper",
4088
4093
  __asyncLoader: load,
4089
4094
  __asyncHydrate(el, instance, hydrate) {
4095
+ let patched = false;
4096
+ (instance.bu || (instance.bu = [])).push(() => patched = true);
4097
+ const performHydrate = () => {
4098
+ if (patched) {
4099
+ return;
4100
+ }
4101
+ hydrate();
4102
+ };
4090
4103
  const doHydrate = hydrateStrategy ? () => {
4091
- const performHydrate = () => {
4092
- hydrate();
4093
- };
4094
4104
  const teardown = hydrateStrategy(
4095
4105
  performHydrate,
4096
4106
  (cb) => forEachElement(el, cb)
@@ -4098,8 +4108,7 @@ function defineAsyncComponent(source) {
4098
4108
  if (teardown) {
4099
4109
  (instance.bum || (instance.bum = [])).push(teardown);
4100
4110
  }
4101
- (instance.u || (instance.u = [])).push(() => true);
4102
- } : hydrate;
4111
+ } : performHydrate;
4103
4112
  if (resolvedComp) {
4104
4113
  doHydrate();
4105
4114
  } else {
@@ -5348,7 +5357,7 @@ function useSlots() {
5348
5357
  function useAttrs() {
5349
5358
  return getContext().attrs;
5350
5359
  }
5351
- function getContext() {
5360
+ function getContext(calledFunctionName) {
5352
5361
  const i = getCurrentInstance();
5353
5362
  return i.setupContext || (i.setupContext = createSetupContext(i));
5354
5363
  }
@@ -5535,7 +5544,8 @@ function applyOptions(instance) {
5535
5544
  expose.forEach((key) => {
5536
5545
  Object.defineProperty(exposed, key, {
5537
5546
  get: () => publicThis[key],
5538
- set: (val) => publicThis[key] = val
5547
+ set: (val) => publicThis[key] = val,
5548
+ enumerable: true
5539
5549
  });
5540
5550
  });
5541
5551
  } else if (!instance.exposed) {
@@ -5822,7 +5832,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
5822
5832
  return vm;
5823
5833
  }
5824
5834
  }
5825
- Vue.version = `2.6.14-compat:${"3.5.16"}`;
5835
+ Vue.version = `2.6.14-compat:${"3.5.18"}`;
5826
5836
  Vue.config = singletonApp.config;
5827
5837
  Vue.use = (plugin, ...options) => {
5828
5838
  if (plugin && isFunction(plugin.install)) {
@@ -6300,7 +6310,7 @@ function provide(key, value) {
6300
6310
  }
6301
6311
  }
6302
6312
  function inject(key, defaultValue, treatDefaultAsFactory = false) {
6303
- const instance = currentInstance || currentRenderingInstance;
6313
+ const instance = getCurrentInstance();
6304
6314
  if (instance || currentApp) {
6305
6315
  let provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null || instance.ce ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
6306
6316
  if (provides && key in provides) {
@@ -6311,7 +6321,7 @@ function inject(key, defaultValue, treatDefaultAsFactory = false) {
6311
6321
  }
6312
6322
  }
6313
6323
  function hasInjectionContext() {
6314
- return !!(currentInstance || currentRenderingInstance || currentApp);
6324
+ return !!(getCurrentInstance() || currentApp);
6315
6325
  }
6316
6326
 
6317
6327
  function createPropsDefaultThis(instance, rawProps, propKey) {
@@ -6661,7 +6671,7 @@ function validatePropName(key) {
6661
6671
  return false;
6662
6672
  }
6663
6673
 
6664
- const isInternalKey = (key) => key[0] === "_" || key === "$stable";
6674
+ const isInternalKey = (key) => key === "_" || key === "__" || key === "_ctx" || key === "$stable";
6665
6675
  const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
6666
6676
  const normalizeSlot = (key, rawSlot, ctx) => {
6667
6677
  if (rawSlot._n) {
@@ -6701,6 +6711,8 @@ const assignSlots = (slots, children, optimized) => {
6701
6711
  const initSlots = (instance, children, optimized) => {
6702
6712
  const slots = instance.slots = createInternalObject();
6703
6713
  if (instance.vnode.shapeFlag & 32) {
6714
+ const cacheIndexes = children.__;
6715
+ if (cacheIndexes) def(slots, "__", cacheIndexes, true);
6704
6716
  const type = children._;
6705
6717
  if (type) {
6706
6718
  assignSlots(slots, children, optimized);
@@ -6862,6 +6874,8 @@ function baseCreateRenderer(options, createHydrationFns) {
6862
6874
  }
6863
6875
  if (ref != null && parentComponent) {
6864
6876
  setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2);
6877
+ } else if (ref == null && n1 && n1.ref != null) {
6878
+ setRef(n1.ref, null, parentSuspense, n1, true);
6865
6879
  }
6866
6880
  };
6867
6881
  const processText = (n1, n2, container, anchor) => {
@@ -7292,6 +7306,7 @@ function baseCreateRenderer(options, createHydrationFns) {
7292
7306
  if (!initialVNode.el) {
7293
7307
  const placeholder = instance.subTree = createVNode(Comment);
7294
7308
  processCommentNode(null, placeholder, container, anchor);
7309
+ initialVNode.placeholder = placeholder.el;
7295
7310
  }
7296
7311
  } else {
7297
7312
  setupRenderEffect(
@@ -7359,7 +7374,8 @@ function baseCreateRenderer(options, createHydrationFns) {
7359
7374
  hydrateSubTree();
7360
7375
  }
7361
7376
  } else {
7362
- if (root.ce) {
7377
+ if (root.ce && // @ts-expect-error _def is private
7378
+ root.ce._def.shadowRoot !== false) {
7363
7379
  root.ce._injectChildStyle(type);
7364
7380
  }
7365
7381
  const subTree = instance.subTree = renderComponentRoot(instance);
@@ -7747,7 +7763,11 @@ function baseCreateRenderer(options, createHydrationFns) {
7747
7763
  for (i = toBePatched - 1; i >= 0; i--) {
7748
7764
  const nextIndex = s2 + i;
7749
7765
  const nextChild = c2[nextIndex];
7750
- const anchor = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor;
7766
+ const anchorVNode = c2[nextIndex + 1];
7767
+ const anchor = nextIndex + 1 < l2 ? (
7768
+ // #13559, fallback to el placeholder for unresolved async component
7769
+ anchorVNode.el || anchorVNode.placeholder
7770
+ ) : parentAnchor;
7751
7771
  if (newIndexToOldIndexMap[i] === 0) {
7752
7772
  patch(
7753
7773
  null,
@@ -8330,8 +8350,9 @@ function emit(instance, event, ...rawArgs) {
8330
8350
  if (instance.isUnmounted) return;
8331
8351
  const props = instance.vnode.props || EMPTY_OBJ;
8332
8352
  let args = rawArgs;
8333
- const isModelListener = event.startsWith("update:");
8334
- const modifiers = isModelListener && getModelModifiers(props, event.slice(7));
8353
+ const isCompatModelListener = compatModelEventPrefix + event in props;
8354
+ const isModelListener = isCompatModelListener || event.startsWith("update:");
8355
+ const modifiers = isCompatModelListener ? props.modelModifiers : isModelListener && getModelModifiers(props, event.slice(7));
8335
8356
  if (modifiers) {
8336
8357
  if (modifiers.trim) {
8337
8358
  args = rawArgs.map((a) => isString(a) ? a.trim() : a);
@@ -9500,6 +9521,7 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
9500
9521
  suspense: vnode.suspense,
9501
9522
  ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
9502
9523
  ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
9524
+ placeholder: vnode.placeholder,
9503
9525
  el: vnode.el,
9504
9526
  anchor: vnode.anchor,
9505
9527
  ctx: vnode.ctx,
@@ -9977,7 +9999,7 @@ function isMemoSame(cached, memo) {
9977
9999
  return true;
9978
10000
  }
9979
10001
 
9980
- const version = "3.5.16";
10002
+ const version = "3.5.18";
9981
10003
  const warn$1 = NOOP;
9982
10004
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
9983
10005
  const devtools = void 0;
@@ -10956,9 +10978,10 @@ class VueElement extends BaseClass {
10956
10978
  };
10957
10979
  const asyncDef = this._def.__asyncLoader;
10958
10980
  if (asyncDef) {
10959
- this._pendingResolve = asyncDef().then(
10960
- (def) => resolve(this._def = def, true)
10961
- );
10981
+ this._pendingResolve = asyncDef().then((def) => {
10982
+ def.configureApp = this._def.configureApp;
10983
+ resolve(this._def = def, true);
10984
+ });
10962
10985
  } else {
10963
10986
  resolve(this._def);
10964
10987
  }
@@ -12870,7 +12893,7 @@ class Tokenizer {
12870
12893
  this.buffer = input;
12871
12894
  while (this.index < this.buffer.length) {
12872
12895
  const c = this.buffer.charCodeAt(this.index);
12873
- if (c === 10) {
12896
+ if (c === 10 && this.state !== 33) {
12874
12897
  this.newlines.push(this.index);
12875
12898
  }
12876
12899
  switch (this.state) {
@@ -13243,14 +13266,15 @@ function isReferencedIdentifier(id, parent, parentStack) {
13243
13266
  if (id.name === "arguments") {
13244
13267
  return false;
13245
13268
  }
13246
- if (isReferenced(id, parent)) {
13269
+ if (isReferenced(id, parent, parentStack[parentStack.length - 2])) {
13247
13270
  return true;
13248
13271
  }
13249
13272
  switch (parent.type) {
13250
13273
  case "AssignmentExpression":
13251
13274
  case "AssignmentPattern":
13252
13275
  return true;
13253
- case "ObjectPattern":
13276
+ case "ObjectProperty":
13277
+ return parent.key !== id && isInDestructureAssignment(parent, parentStack);
13254
13278
  case "ArrayPattern":
13255
13279
  return isInDestructureAssignment(parent, parentStack);
13256
13280
  }
@@ -13419,7 +13443,7 @@ function isReferenced(node, parent, grandparent) {
13419
13443
  if (parent.key === node) {
13420
13444
  return !!parent.computed;
13421
13445
  }
13422
- return true;
13446
+ return !grandparent || grandparent.type !== "ObjectPattern";
13423
13447
  // no: class { NODE = value; }
13424
13448
  // yes: class { [NODE] = value; }
13425
13449
  // yes: class { key = NODE; }
@@ -13469,6 +13493,9 @@ function isReferenced(node, parent, grandparent) {
13469
13493
  // yes: export { NODE as foo };
13470
13494
  // no: export { NODE as foo } from "foo";
13471
13495
  case "ExportSpecifier":
13496
+ if (grandparent == null ? void 0 : grandparent.source) {
13497
+ return false;
13498
+ }
13472
13499
  return parent.local === node;
13473
13500
  // no: import NODE from "foo";
13474
13501
  // no: import * as NODE from "foo";
@@ -13549,7 +13576,7 @@ function isCoreComponent(tag) {
13549
13576
  return BASE_TRANSITION;
13550
13577
  }
13551
13578
  }
13552
- const nonIdentifierRE = /^\d|[^\$\w\xA0-\uFFFF]/;
13579
+ const nonIdentifierRE = /^$|^\d|[^\$\w\xA0-\uFFFF]/;
13553
13580
  const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
13554
13581
  const getExpSource = (exp) => exp.type === 4 ? exp.content : exp.loc.source;
13555
13582
  const isMemberExpressionNode = (exp, context) => {
@@ -13642,6 +13669,9 @@ function hasDynamicKeyVBind(node) {
13642
13669
  function isText$1(node) {
13643
13670
  return node.type === 5 || node.type === 2;
13644
13671
  }
13672
+ function isVPre(p) {
13673
+ return p.type === 7 && p.name === "pre";
13674
+ }
13645
13675
  function isVSlot(p) {
13646
13676
  return p.type === 7 && p.name === "slot";
13647
13677
  }
@@ -13940,7 +13970,7 @@ const tokenizer = new Tokenizer(stack, {
13940
13970
  ondirarg(start, end) {
13941
13971
  if (start === end) return;
13942
13972
  const arg = getSlice(start, end);
13943
- if (inVPre) {
13973
+ if (inVPre && !isVPre(currentProp)) {
13944
13974
  currentProp.name += arg;
13945
13975
  setLocEnd(currentProp.nameLoc, end);
13946
13976
  } else {
@@ -13955,7 +13985,7 @@ const tokenizer = new Tokenizer(stack, {
13955
13985
  },
13956
13986
  ondirmodifier(start, end) {
13957
13987
  const mod = getSlice(start, end);
13958
- if (inVPre) {
13988
+ if (inVPre && !isVPre(currentProp)) {
13959
13989
  currentProp.name += "." + mod;
13960
13990
  setLocEnd(currentProp.nameLoc, end);
13961
13991
  } else if (currentProp.name === "slot") {
@@ -14348,7 +14378,7 @@ function isUpperCase(c) {
14348
14378
  return c > 64 && c < 91;
14349
14379
  }
14350
14380
  const windowsNewlineRE = /\r\n/g;
14351
- function condenseWhitespace(nodes, tag) {
14381
+ function condenseWhitespace(nodes) {
14352
14382
  const shouldCondense = currentOptions.whitespace !== "preserve";
14353
14383
  let removedWhitespace = false;
14354
14384
  for (let i = 0; i < nodes.length; i++) {
@@ -14527,12 +14557,12 @@ function cacheStatic(root, context) {
14527
14557
  context,
14528
14558
  // Root node is unfortunately non-hoistable due to potential parent
14529
14559
  // fallthrough attributes.
14530
- isSingleElementRoot(root, root.children[0])
14560
+ !!getSingleElementRoot(root)
14531
14561
  );
14532
14562
  }
14533
- function isSingleElementRoot(root, child) {
14534
- const { children } = root;
14535
- return children.length === 1 && child.type === 1 && !isSlotOutlet(child);
14563
+ function getSingleElementRoot(root) {
14564
+ const children = root.children.filter((x) => x.type !== 3);
14565
+ return children.length === 1 && children[0].type === 1 && !isSlotOutlet(children[0]) ? children[0] : null;
14536
14566
  }
14537
14567
  function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
14538
14568
  const { children } = node;
@@ -14565,6 +14595,11 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
14565
14595
  } else if (child.type === 12) {
14566
14596
  const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
14567
14597
  if (constantType >= 2) {
14598
+ if (child.codegenNode.type === 14 && child.codegenNode.arguments.length > 0) {
14599
+ child.codegenNode.arguments.push(
14600
+ -1 + (``)
14601
+ );
14602
+ }
14568
14603
  toCache.push(child);
14569
14604
  continue;
14570
14605
  }
@@ -15012,15 +15047,15 @@ function createRootCodegen(root, context) {
15012
15047
  const { helper } = context;
15013
15048
  const { children } = root;
15014
15049
  if (children.length === 1) {
15015
- const child = children[0];
15016
- if (isSingleElementRoot(root, child) && child.codegenNode) {
15017
- const codegenNode = child.codegenNode;
15050
+ const singleElementRootChild = getSingleElementRoot(root);
15051
+ if (singleElementRootChild && singleElementRootChild.codegenNode) {
15052
+ const codegenNode = singleElementRootChild.codegenNode;
15018
15053
  if (codegenNode.type === 13) {
15019
15054
  convertToBlock(codegenNode, context);
15020
15055
  }
15021
15056
  root.codegenNode = codegenNode;
15022
15057
  } else {
15023
- root.codegenNode = child;
15058
+ root.codegenNode = children[0];
15024
15059
  }
15025
15060
  } else if (children.length > 1) {
15026
15061
  let patchFlag = 64;
@@ -16361,7 +16396,7 @@ const transformBind = (dir, _node, context) => {
16361
16396
  arg.children.unshift(`(`);
16362
16397
  arg.children.push(`) || ""`);
16363
16398
  } else if (!arg.isStatic) {
16364
- arg.content = `${arg.content} || ""`;
16399
+ arg.content = arg.content ? `${arg.content} || ""` : `""`;
16365
16400
  }
16366
16401
  if (modifiers.some((mod) => mod.content === "camel")) {
16367
16402
  if (arg.type === 4) {
@@ -16774,7 +16809,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
16774
16809
  let prev;
16775
16810
  while (j--) {
16776
16811
  prev = children[j];
16777
- if (prev.type !== 3) {
16812
+ if (prev.type !== 3 && isNonWhitespaceContent(prev)) {
16778
16813
  break;
16779
16814
  }
16780
16815
  }