@vue/compat 3.4.0-rc.1 → 3.4.0-rc.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.
@@ -1448,9 +1448,6 @@ const TriggerOpTypes = {
1448
1448
  "CLEAR": "clear"
1449
1449
  };
1450
1450
 
1451
- function warn$1(msg, ...args) {
1452
- return;
1453
- }
1454
1451
  function assertNumber(val, type) {
1455
1452
  return;
1456
1453
  }
@@ -1487,6 +1484,37 @@ const ErrorCodes = {
1487
1484
  "SCHEDULER": 14,
1488
1485
  "14": "SCHEDULER"
1489
1486
  };
1487
+ const ErrorTypeStrings$1 = {
1488
+ ["sp"]: "serverPrefetch hook",
1489
+ ["bc"]: "beforeCreate hook",
1490
+ ["c"]: "created hook",
1491
+ ["bm"]: "beforeMount hook",
1492
+ ["m"]: "mounted hook",
1493
+ ["bu"]: "beforeUpdate hook",
1494
+ ["u"]: "updated",
1495
+ ["bum"]: "beforeUnmount hook",
1496
+ ["um"]: "unmounted hook",
1497
+ ["a"]: "activated hook",
1498
+ ["da"]: "deactivated hook",
1499
+ ["ec"]: "errorCaptured hook",
1500
+ ["rtc"]: "renderTracked hook",
1501
+ ["rtg"]: "renderTriggered hook",
1502
+ [0]: "setup function",
1503
+ [1]: "render function",
1504
+ [2]: "watcher getter",
1505
+ [3]: "watcher callback",
1506
+ [4]: "watcher cleanup function",
1507
+ [5]: "native event handler",
1508
+ [6]: "component event handler",
1509
+ [7]: "vnode hook",
1510
+ [8]: "directive hook",
1511
+ [9]: "transition hook",
1512
+ [10]: "app errorHandler",
1513
+ [11]: "app warnHandler",
1514
+ [12]: "ref function",
1515
+ [13]: "async component loader",
1516
+ [14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core ."
1517
+ };
1490
1518
  function callWithErrorHandling(fn, instance, type, args) {
1491
1519
  let res;
1492
1520
  try {
@@ -1679,38 +1707,6 @@ function flushJobs(seen) {
1679
1707
  }
1680
1708
  }
1681
1709
 
1682
- let devtools;
1683
- let buffer = [];
1684
- function setDevtoolsHook(hook, target) {
1685
- var _a, _b;
1686
- devtools = hook;
1687
- if (devtools) {
1688
- devtools.enabled = true;
1689
- buffer.forEach(({ event, args }) => devtools.emit(event, ...args));
1690
- buffer = [];
1691
- } else if (
1692
- // handle late devtools injection - only do this if we are in an actual
1693
- // browser environment to avoid the timer handle stalling test runner exit
1694
- // (#4815)
1695
- typeof window !== "undefined" && // some envs mock window but not fully
1696
- window.HTMLElement && // also exclude jsdom
1697
- !((_b = (_a = window.navigator) == null ? void 0 : _a.userAgent) == null ? void 0 : _b.includes("jsdom"))
1698
- ) {
1699
- const replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || [];
1700
- replay.push((newHook) => {
1701
- setDevtoolsHook(newHook, target);
1702
- });
1703
- setTimeout(() => {
1704
- if (!devtools) {
1705
- target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
1706
- buffer = [];
1707
- }
1708
- }, 3e3);
1709
- } else {
1710
- buffer = [];
1711
- }
1712
- }
1713
-
1714
1710
  const DeprecationTypes$1 = {
1715
1711
  "GLOBAL_MOUNT": "GLOBAL_MOUNT",
1716
1712
  "GLOBAL_MOUNT_CONTAINER": "GLOBAL_MOUNT_CONTAINER",
@@ -2329,7 +2325,6 @@ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false
2329
2325
  const selfName = getComponentName(
2330
2326
  Component,
2331
2327
  false
2332
- /* do not include inferred name to avoid breaking existing code */
2333
2328
  );
2334
2329
  if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
2335
2330
  return Component;
@@ -2822,6 +2817,7 @@ function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace
2822
2817
  parentSuspense,
2823
2818
  parentComponent,
2824
2819
  node.parentNode,
2820
+ // eslint-disable-next-line no-restricted-globals
2825
2821
  document.createElement("div"),
2826
2822
  null,
2827
2823
  namespace,
@@ -2829,7 +2825,6 @@ function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace
2829
2825
  optimized,
2830
2826
  rendererInternals,
2831
2827
  true
2832
- /* hydrating */
2833
2828
  );
2834
2829
  const result = hydrateNode(
2835
2830
  node,
@@ -2961,7 +2956,14 @@ const INITIAL_WATCHER_VALUE = {};
2961
2956
  function watch(source, cb, options) {
2962
2957
  return doWatch(source, cb, options);
2963
2958
  }
2964
- function doWatch(source, cb, { immediate, deep, flush, once, onTrack, onTrigger } = EMPTY_OBJ) {
2959
+ function doWatch(source, cb, {
2960
+ immediate,
2961
+ deep,
2962
+ flush,
2963
+ once,
2964
+ onTrack,
2965
+ onTrigger
2966
+ } = EMPTY_OBJ) {
2965
2967
  var _a;
2966
2968
  if (cb && once) {
2967
2969
  const _cb = cb;
@@ -3628,7 +3630,6 @@ function defineAsyncComponent(source) {
3628
3630
  instance,
3629
3631
  13,
3630
3632
  !errorComponent
3631
- /* do not throw in dev if user provided error component */
3632
3633
  );
3633
3634
  };
3634
3635
  if (suspensible && instance.suspense || isInSSRComponentSetup) {
@@ -4013,8 +4014,8 @@ function getCompatListeners(instance) {
4013
4014
  }
4014
4015
 
4015
4016
  function convertLegacyRenderFn(instance) {
4016
- const Component2 = instance.type;
4017
- const render = Component2.render;
4017
+ const Component = instance.type;
4018
+ const render = Component.render;
4018
4019
  if (!render || render._rc || render._compatChecked || render._compatWrapped) {
4019
4020
  return;
4020
4021
  }
@@ -4023,7 +4024,7 @@ function convertLegacyRenderFn(instance) {
4023
4024
  return;
4024
4025
  }
4025
4026
  if (checkCompatEnabled$1("RENDER_FUNCTION", instance)) {
4026
- const wrapped = Component2.render = function compatRender() {
4027
+ const wrapped = Component.render = function compatRender() {
4027
4028
  return render.call(this, compatH);
4028
4029
  };
4029
4030
  wrapped._compatWrapped = true;
@@ -4182,12 +4183,10 @@ function defineLegacyVNodeProperties(vnode) {
4182
4183
  "RENDER_FUNCTION",
4183
4184
  currentRenderingInstance,
4184
4185
  true
4185
- /* enable for built-ins */
4186
4186
  ) && isCompatEnabled$1(
4187
4187
  "PRIVATE_APIS",
4188
4188
  currentRenderingInstance,
4189
4189
  true
4190
- /* enable for built-ins */
4191
4190
  )) {
4192
4191
  const context = currentRenderingInstance;
4193
4192
  const getInstance = () => vnode.component && vnode.component.proxy;
@@ -4504,7 +4503,6 @@ function installCompatInstanceProperties(map) {
4504
4503
  assertCompatEnabled(
4505
4504
  "GLOBAL_MOUNT",
4506
4505
  null
4507
- /* this warning is global */
4508
4506
  );
4509
4507
  return i.ctx._compat_mount || NOOP;
4510
4508
  },
@@ -4768,9 +4766,9 @@ function useSlots() {
4768
4766
  function useAttrs() {
4769
4767
  return getContext().attrs;
4770
4768
  }
4771
- function useModel(props, name) {
4769
+ function useModel(props, name, options = EMPTY_OBJ) {
4772
4770
  const i = getCurrentInstance();
4773
- return customRef((track, trigger) => {
4771
+ const res = customRef((track, trigger) => {
4774
4772
  let localValue;
4775
4773
  watchSyncEffect(() => {
4776
4774
  const propValue = props[name];
@@ -4782,7 +4780,7 @@ function useModel(props, name) {
4782
4780
  return {
4783
4781
  get() {
4784
4782
  track();
4785
- return localValue;
4783
+ return options.get ? options.get(localValue) : localValue;
4786
4784
  },
4787
4785
  set(value) {
4788
4786
  const rawProps = i.vnode.props;
@@ -4790,10 +4788,24 @@ function useModel(props, name) {
4790
4788
  localValue = value;
4791
4789
  trigger();
4792
4790
  }
4793
- i.emit(`update:${name}`, value);
4791
+ i.emit(`update:${name}`, options.set ? options.set(value) : value);
4794
4792
  }
4795
4793
  };
4796
4794
  });
4795
+ const modifierKey = name === "modelValue" ? "modelModifiers" : `${name}Modifiers`;
4796
+ res[Symbol.iterator] = () => {
4797
+ let i2 = 0;
4798
+ return {
4799
+ next() {
4800
+ if (i2 < 2) {
4801
+ return { value: i2++ ? props[modifierKey] : res, done: false };
4802
+ } else {
4803
+ return { done: true };
4804
+ }
4805
+ }
4806
+ };
4807
+ };
4808
+ return res;
4797
4809
  }
4798
4810
  function getContext() {
4799
4811
  const i = getCurrentInstance();
@@ -5019,7 +5031,6 @@ function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP)
5019
5031
  opt.from || key,
5020
5032
  opt.default,
5021
5033
  true
5022
- /* treat default function as factory */
5023
5034
  );
5024
5035
  } else {
5025
5036
  injected = inject(opt.from || key);
@@ -5254,7 +5265,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
5254
5265
  return vm;
5255
5266
  }
5256
5267
  }
5257
- Vue.version = `2.6.14-compat:${"3.4.0-rc.1"}`;
5268
+ Vue.version = `2.6.14-compat:${"3.4.0-rc.3"}`;
5258
5269
  Vue.config = singletonApp.config;
5259
5270
  Vue.use = (p, ...options) => {
5260
5271
  if (p && isFunction(p.install)) {
@@ -5841,7 +5852,6 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
5841
5852
  value,
5842
5853
  instance,
5843
5854
  false
5844
- /* isAbsent */
5845
5855
  );
5846
5856
  }
5847
5857
  } else {
@@ -5880,7 +5890,6 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
5880
5890
  void 0,
5881
5891
  instance,
5882
5892
  true
5883
- /* isAbsent */
5884
5893
  );
5885
5894
  }
5886
5895
  } else {
@@ -8398,7 +8407,6 @@ function createElementBlock(type, props, children, patchFlag, dynamicProps, shap
8398
8407
  dynamicProps,
8399
8408
  shapeFlag,
8400
8409
  true
8401
- /* isBlock */
8402
8410
  )
8403
8411
  );
8404
8412
  }
@@ -8411,7 +8419,6 @@ function createBlock(type, props, children, patchFlag, dynamicProps) {
8411
8419
  patchFlag,
8412
8420
  dynamicProps,
8413
8421
  true
8414
- /* isBlock: prevent a block from tracking itself */
8415
8422
  )
8416
8423
  );
8417
8424
  }
@@ -8859,7 +8866,10 @@ function setupStatefulComponent(instance, isSSR) {
8859
8866
  setup,
8860
8867
  instance,
8861
8868
  0,
8862
- [instance.props, setupContext]
8869
+ [
8870
+ instance.props,
8871
+ setupContext
8872
+ ]
8863
8873
  );
8864
8874
  resetTracking();
8865
8875
  unsetCurrentInstance();
@@ -9063,8 +9073,11 @@ function isMemoSame(cached, memo) {
9063
9073
  return true;
9064
9074
  }
9065
9075
 
9066
- const version = "3.4.0-rc.1";
9067
- const ErrorTypeStrings = null;
9076
+ const version = "3.4.0-rc.3";
9077
+ const warn$1 = NOOP;
9078
+ const ErrorTypeStrings = ErrorTypeStrings$1 ;
9079
+ const devtools = void 0;
9080
+ const setDevtoolsHook = NOOP;
9068
9081
  const _ssrUtils = {
9069
9082
  createComponentInstance,
9070
9083
  setupComponent,
@@ -10654,7 +10667,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
10654
10667
  defineProps: defineProps,
10655
10668
  defineSSRCustomElement: defineSSRCustomElement,
10656
10669
  defineSlots: defineSlots,
10657
- get devtools () { return devtools; },
10670
+ devtools: devtools,
10658
10671
  effect: effect,
10659
10672
  effectScope: effectScope,
10660
10673
  getCurrentInstance: getCurrentInstance,
@@ -13671,7 +13684,6 @@ function createRootCodegen(root, context) {
13671
13684
  true,
13672
13685
  void 0,
13673
13686
  false
13674
- /* isComponent */
13675
13687
  );
13676
13688
  } else ;
13677
13689
  }
@@ -13862,7 +13874,7 @@ function createCodegenContext(ast, {
13862
13874
  generatedLine: context.line,
13863
13875
  generatedColumn: context.column - 1,
13864
13876
  source: filename,
13865
- // @ts-ignore it is possible to be null
13877
+ // @ts-expect-error it is possible to be null
13866
13878
  name
13867
13879
  });
13868
13880
  }
@@ -15043,7 +15055,6 @@ const transformFor = createStructuralDirectiveTransform(
15043
15055
  true,
15044
15056
  void 0,
15045
15057
  false
15046
- /* isComponent */
15047
15058
  );
15048
15059
  } else {
15049
15060
  childBlock = children[0].codegenNode;
@@ -15100,7 +15111,6 @@ const transformFor = createStructuralDirectiveTransform(
15100
15111
  createForLoopParams(forNode.parseResult),
15101
15112
  childBlock,
15102
15113
  true
15103
- /* force newline */
15104
15114
  )
15105
15115
  );
15106
15116
  }
@@ -15358,13 +15368,15 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
15358
15368
  createForLoopParams(parseResult),
15359
15369
  buildDynamicSlot(slotName, slotFunction),
15360
15370
  true
15361
- /* force newline */
15362
15371
  )
15363
15372
  ])
15364
15373
  );
15365
15374
  } else {
15366
15375
  context.onError(
15367
- createCompilerError(32, vFor.loc)
15376
+ createCompilerError(
15377
+ 32,
15378
+ vFor.loc
15379
+ )
15368
15380
  );
15369
15381
  }
15370
15382
  } else {