@vue/compat 3.5.1 → 3.5.3

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.1
2
+ * @vue/compat v3.5.3
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -711,7 +711,7 @@ function refreshComputed(computed) {
711
711
  shouldTrack = true;
712
712
  try {
713
713
  prepareDeps(computed);
714
- const value = computed.fn();
714
+ const value = computed.fn(computed._value);
715
715
  if (dep.version === 0 || hasChanged(value, computed._value)) {
716
716
  computed._value = value;
717
717
  dep.version++;
@@ -820,7 +820,7 @@ class Dep {
820
820
  }
821
821
  }
822
822
  track(debugInfo) {
823
- if (!activeSub || !shouldTrack) {
823
+ if (!activeSub || !shouldTrack || activeSub === this.computed) {
824
824
  return;
825
825
  }
826
826
  let link = this.activeLink;
@@ -1833,7 +1833,7 @@ function toValue(source) {
1833
1833
  return isFunction(source) ? source() : unref(source);
1834
1834
  }
1835
1835
  const shallowUnwrapHandlers = {
1836
- get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
1836
+ get: (target, key, receiver) => key === "__v_raw" ? target : unref(Reflect.get(target, key, receiver)),
1837
1837
  set: (target, key, value, receiver) => {
1838
1838
  const oldValue = target[key];
1839
1839
  if (isRef(oldValue) && !isRef(value)) {
@@ -2535,9 +2535,7 @@ function queueJob(job) {
2535
2535
  } else {
2536
2536
  queue.splice(findInsertionIndex(jobId), 0, job);
2537
2537
  }
2538
- if (!(job.flags & 4)) {
2539
- job.flags |= 1;
2540
- }
2538
+ job.flags |= 1;
2541
2539
  queueFlush();
2542
2540
  }
2543
2541
  }
@@ -2553,9 +2551,7 @@ function queuePostFlushCb(cb) {
2553
2551
  activePostFlushCbs.splice(postFlushIndex + 1, 0, cb);
2554
2552
  } else if (!(cb.flags & 1)) {
2555
2553
  pendingPostFlushCbs.push(cb);
2556
- if (!(cb.flags & 4)) {
2557
- cb.flags |= 1;
2558
- }
2554
+ cb.flags |= 1;
2559
2555
  }
2560
2556
  } else {
2561
2557
  pendingPostFlushCbs.push(...cb);
@@ -2577,6 +2573,9 @@ function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
2577
2573
  }
2578
2574
  queue.splice(i, 1);
2579
2575
  i--;
2576
+ if (cb.flags & 4) {
2577
+ cb.flags &= ~1;
2578
+ }
2580
2579
  cb();
2581
2580
  cb.flags &= ~1;
2582
2581
  }
@@ -2601,6 +2600,9 @@ function flushPostFlushCbs(seen) {
2601
2600
  if (checkRecursiveUpdates(seen, cb)) {
2602
2601
  continue;
2603
2602
  }
2603
+ if (cb.flags & 4) {
2604
+ cb.flags &= ~1;
2605
+ }
2604
2606
  if (!(cb.flags & 8)) cb();
2605
2607
  cb.flags &= ~1;
2606
2608
  }
@@ -2623,6 +2625,9 @@ function flushJobs(seen) {
2623
2625
  if (check(job)) {
2624
2626
  continue;
2625
2627
  }
2628
+ if (job.flags & 4) {
2629
+ job.flags &= ~1;
2630
+ }
2626
2631
  callWithErrorHandling(
2627
2632
  job,
2628
2633
  job.i,
@@ -2632,6 +2637,12 @@ function flushJobs(seen) {
2632
2637
  }
2633
2638
  }
2634
2639
  } finally {
2640
+ for (; flushIndex < queue.length; flushIndex++) {
2641
+ const job = queue[flushIndex];
2642
+ if (job) {
2643
+ job.flags &= ~1;
2644
+ }
2645
+ }
2635
2646
  flushIndex = 0;
2636
2647
  queue.length = 0;
2637
2648
  flushPostFlushCbs(seen);
@@ -3916,6 +3927,7 @@ const BaseTransitionImpl = {
3916
3927
  if (!(instance.job.flags & 8)) {
3917
3928
  instance.update();
3918
3929
  }
3930
+ delete leavingHooks.afterLeave;
3919
3931
  };
3920
3932
  return emptyPlaceholder(child);
3921
3933
  } else if (mode === "in-out" && innerChild.type !== Comment) {
@@ -4141,6 +4153,7 @@ function getInnerChild$1(vnode) {
4141
4153
  }
4142
4154
  function setTransitionHooks(vnode, hooks) {
4143
4155
  if (vnode.shapeFlag & 6 && vnode.component) {
4156
+ vnode.transition = hooks;
4144
4157
  setTransitionHooks(vnode.component.subTree, hooks);
4145
4158
  } else if (vnode.shapeFlag & 128) {
4146
4159
  vnode.ssContent.transition = hooks.clone(vnode.ssContent);
@@ -4185,7 +4198,7 @@ function defineComponent(options, extraOptions) {
4185
4198
  function useId() {
4186
4199
  const i = getCurrentInstance();
4187
4200
  if (i) {
4188
- return (i.appContext.config.idPrefix || "v") + ":" + i.ids[0] + i.ids[1]++;
4201
+ return (i.appContext.config.idPrefix || "v") + "-" + i.ids[0] + i.ids[1]++;
4189
4202
  } else {
4190
4203
  warn$1(
4191
4204
  `useId() is called when there is no active component instance to be associated with.`
@@ -4196,6 +4209,34 @@ function markAsyncBoundary(instance) {
4196
4209
  instance.ids = [instance.ids[0] + instance.ids[2]++ + "-", 0, 0];
4197
4210
  }
4198
4211
 
4212
+ const knownTemplateRefs = /* @__PURE__ */ new WeakSet();
4213
+ function useTemplateRef(key) {
4214
+ const i = getCurrentInstance();
4215
+ const r = shallowRef(null);
4216
+ if (i) {
4217
+ const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
4218
+ let desc;
4219
+ if ((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable) {
4220
+ warn$1(`useTemplateRef('${key}') already exists.`);
4221
+ } else {
4222
+ Object.defineProperty(refs, key, {
4223
+ enumerable: true,
4224
+ get: () => r.value,
4225
+ set: (val) => r.value = val
4226
+ });
4227
+ }
4228
+ } else {
4229
+ warn$1(
4230
+ `useTemplateRef() is called when there is no active component instance to be associated with.`
4231
+ );
4232
+ }
4233
+ const ret = readonly(r) ;
4234
+ {
4235
+ knownTemplateRefs.add(ret);
4236
+ }
4237
+ return ret;
4238
+ }
4239
+
4199
4240
  function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4200
4241
  if (isArray(rawRef)) {
4201
4242
  rawRef.forEach(
@@ -4224,7 +4265,13 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4224
4265
  const oldRef = oldRawRef && oldRawRef.r;
4225
4266
  const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
4226
4267
  const setupState = owner.setupState;
4227
- const canSetSetupRef = setupState === EMPTY_OBJ ? () => false : (key) => hasOwn(setupState, key) && !(Object.getOwnPropertyDescriptor(refs, key) || EMPTY_OBJ).get;
4268
+ const rawSetupState = toRaw(setupState);
4269
+ const canSetSetupRef = setupState === EMPTY_OBJ ? () => false : (key) => {
4270
+ if (knownTemplateRefs.has(rawSetupState[key])) {
4271
+ return false;
4272
+ }
4273
+ return hasOwn(rawSetupState, key);
4274
+ };
4228
4275
  if (oldRef != null && oldRef !== ref) {
4229
4276
  if (isString(oldRef)) {
4230
4277
  refs[oldRef] = null;
@@ -5281,7 +5328,7 @@ const KeepAliveImpl = {
5281
5328
  return () => {
5282
5329
  pendingCacheKey = null;
5283
5330
  if (!slots.default) {
5284
- return null;
5331
+ return current = null;
5285
5332
  }
5286
5333
  const children = slots.default();
5287
5334
  const rawVNode = children[0];
@@ -7056,7 +7103,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7056
7103
  return vm;
7057
7104
  }
7058
7105
  }
7059
- Vue.version = `2.6.14-compat:${"3.5.1"}`;
7106
+ Vue.version = `2.6.14-compat:${"3.5.3"}`;
7060
7107
  Vue.config = singletonApp.config;
7061
7108
  Vue.use = (plugin, ...options) => {
7062
7109
  if (plugin && isFunction(plugin.install)) {
@@ -8961,7 +9008,7 @@ function baseCreateRenderer(options, createHydrationFns) {
8961
9008
  endMeasure(instance, `hydrate`);
8962
9009
  }
8963
9010
  };
8964
- if (isAsyncWrapperVNode) {
9011
+ if (isAsyncWrapperVNode && type.__asyncHydrate) {
8965
9012
  type.__asyncHydrate(
8966
9013
  el,
8967
9014
  instance,
@@ -10310,7 +10357,7 @@ function renderComponentRoot(instance) {
10310
10357
  `Component inside <Transition> renders non-element root node that cannot be animated.`
10311
10358
  );
10312
10359
  }
10313
- root.transition = vnode.transition;
10360
+ setTransitionHooks(root, vnode.transition);
10314
10361
  }
10315
10362
  if (setRoot) {
10316
10363
  setRoot(root);
@@ -10804,7 +10851,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
10804
10851
  };
10805
10852
  }
10806
10853
  if (activeBranch) {
10807
- if (parentNode(activeBranch.el) !== suspense.hiddenContainer) {
10854
+ if (parentNode(activeBranch.el) === container2) {
10808
10855
  anchor = next(activeBranch);
10809
10856
  }
10810
10857
  unmount(activeBranch, parentComponent2, suspense, true);
@@ -11944,29 +11991,6 @@ const computed = (getterOrOptions, debugOptions) => {
11944
11991
  return c;
11945
11992
  };
11946
11993
 
11947
- function useTemplateRef(key) {
11948
- const i = getCurrentInstance();
11949
- const r = shallowRef(null);
11950
- if (i) {
11951
- const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
11952
- let desc;
11953
- if ((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable) {
11954
- warn$1(`useTemplateRef('${key}') already exists.`);
11955
- } else {
11956
- Object.defineProperty(refs, key, {
11957
- enumerable: true,
11958
- get: () => r.value,
11959
- set: (val) => r.value = val
11960
- });
11961
- }
11962
- } else {
11963
- warn$1(
11964
- `useTemplateRef() is called when there is no active component instance to be associated with.`
11965
- );
11966
- }
11967
- return readonly(r) ;
11968
- }
11969
-
11970
11994
  function h(type, propsOrChildren, children) {
11971
11995
  const l = arguments.length;
11972
11996
  if (l === 2) {
@@ -12192,7 +12216,7 @@ function isMemoSame(cached, memo) {
12192
12216
  return true;
12193
12217
  }
12194
12218
 
12195
- const version = "3.5.1";
12219
+ const version = "3.5.3";
12196
12220
  const warn = warn$1 ;
12197
12221
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12198
12222
  const devtools = devtools$1 ;
@@ -12205,7 +12229,9 @@ const _ssrUtils = {
12205
12229
  isVNode: isVNode,
12206
12230
  normalizeVNode,
12207
12231
  getComponentPublicInstance,
12208
- ensureValidVNode
12232
+ ensureValidVNode,
12233
+ pushWarningContext,
12234
+ popWarningContext
12209
12235
  };
12210
12236
  const ssrUtils = _ssrUtils ;
12211
12237
  const resolveFilter = resolveFilter$1 ;
@@ -15982,7 +16008,7 @@ const tokenizer = new Tokenizer(stack, {
15982
16008
  rawName: raw,
15983
16009
  exp: void 0,
15984
16010
  arg: void 0,
15985
- modifiers: raw === "." ? ["prop"] : [],
16011
+ modifiers: raw === "." ? [createSimpleExpression("prop")] : [],
15986
16012
  loc: getLoc(start)
15987
16013
  };
15988
16014
  if (name === "pre") {
@@ -16025,7 +16051,8 @@ const tokenizer = new Tokenizer(stack, {
16025
16051
  setLocEnd(arg.loc, end);
16026
16052
  }
16027
16053
  } else {
16028
- currentProp.modifiers.push(mod);
16054
+ const exp = createSimpleExpression(mod, true, getLoc(start, end));
16055
+ currentProp.modifiers.push(exp);
16029
16056
  }
16030
16057
  },
16031
16058
  onattribdata(start, end) {
@@ -16088,7 +16115,9 @@ const tokenizer = new Tokenizer(stack, {
16088
16115
  currentProp.forParseResult = parseForExpression(currentProp.exp);
16089
16116
  }
16090
16117
  let syncIndex = -1;
16091
- if (currentProp.name === "bind" && (syncIndex = currentProp.modifiers.indexOf("sync")) > -1 && checkCompatEnabled(
16118
+ if (currentProp.name === "bind" && (syncIndex = currentProp.modifiers.findIndex(
16119
+ (mod) => mod.content === "sync"
16120
+ )) > -1 && checkCompatEnabled(
16092
16121
  "COMPILER_V_BIND_SYNC",
16093
16122
  currentOptions,
16094
16123
  currentProp.loc,
@@ -18075,7 +18104,7 @@ const transformBind = (dir, _node, context) => {
18075
18104
  } else if (!arg.isStatic) {
18076
18105
  arg.content = `${arg.content} || ""`;
18077
18106
  }
18078
- if (modifiers.includes("camel")) {
18107
+ if (modifiers.some((mod) => mod.content === "camel")) {
18079
18108
  if (arg.type === 4) {
18080
18109
  if (arg.isStatic) {
18081
18110
  arg.content = camelize(arg.content);
@@ -18088,10 +18117,10 @@ const transformBind = (dir, _node, context) => {
18088
18117
  }
18089
18118
  }
18090
18119
  if (!context.inSSR) {
18091
- if (modifiers.includes("prop")) {
18120
+ if (modifiers.some((mod) => mod.content === "prop")) {
18092
18121
  injectPrefix(arg, ".");
18093
18122
  }
18094
- if (modifiers.includes("attr")) {
18123
+ if (modifiers.some((mod) => mod.content === "attr")) {
18095
18124
  injectPrefix(arg, "^");
18096
18125
  }
18097
18126
  }
@@ -18904,7 +18933,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
18904
18933
  }
18905
18934
  continue;
18906
18935
  }
18907
- if (isVBind && modifiers.includes("prop")) {
18936
+ if (isVBind && modifiers.some((mod) => mod.content === "prop")) {
18908
18937
  patchFlag |= 32;
18909
18938
  }
18910
18939
  const directiveTransform = context.directiveTransforms[name];
@@ -19418,7 +19447,7 @@ const transformModel$1 = (dir, node, context) => {
19418
19447
  createObjectProperty(eventName, assignmentExp)
19419
19448
  ];
19420
19449
  if (dir.modifiers.length && node.tagType === 1) {
19421
- const modifiers = dir.modifiers.map((m) => (isSimpleIdentifier(m) ? m : JSON.stringify(m)) + `: true`).join(`, `);
19450
+ const modifiers = dir.modifiers.map((m) => m.content).map((m) => (isSimpleIdentifier(m) ? m : JSON.stringify(m)) + `: true`).join(`, `);
19422
19451
  const modifiersKey = arg ? isStaticExp(arg) ? `${arg.content}Modifiers` : createCompoundExpression([arg, ' + "Modifiers"']) : `modelModifiers`;
19423
19452
  props.push(
19424
19453
  createObjectProperty(
@@ -19967,7 +19996,7 @@ const resolveModifiers = (key, modifiers, context, loc) => {
19967
19996
  const nonKeyModifiers = [];
19968
19997
  const eventOptionModifiers = [];
19969
19998
  for (let i = 0; i < modifiers.length; i++) {
19970
- const modifier = modifiers[i];
19999
+ const modifier = modifiers[i].content;
19971
20000
  if (modifier === "native" && checkCompatEnabled(
19972
20001
  "COMPILER_V_ON_NATIVE",
19973
20002
  context,