@vue/compat 3.3.0-alpha.9 → 3.3.0-beta.1

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
@@ -2,7 +2,7 @@
2
2
 
3
3
  var parser = require('@babel/parser');
4
4
  var estreeWalker = require('estree-walker');
5
- var sourceMap = require('source-map');
5
+ var sourceMapJs = require('source-map-js');
6
6
 
7
7
  function makeMap(str, expectsLowerCase) {
8
8
  const map = /* @__PURE__ */ Object.create(null);
@@ -130,7 +130,7 @@ const slotFlagsText = {
130
130
  [3]: "FORWARDED"
131
131
  };
132
132
 
133
- const GLOBALS_WHITE_LISTED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt";
133
+ const GLOBALS_WHITE_LISTED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console";
134
134
  const isGloballyWhitelisted = /* @__PURE__ */ makeMap(GLOBALS_WHITE_LISTED);
135
135
 
136
136
  const range = 2;
@@ -1994,6 +1994,8 @@ function reload(id, newComp) {
1994
1994
  }
1995
1995
  hmrDirtyComponents.add(oldComp);
1996
1996
  }
1997
+ instance.appContext.propsCache.delete(instance.type);
1998
+ instance.appContext.emitsCache.delete(instance.type);
1997
1999
  instance.appContext.optionsCache.delete(instance.type);
1998
2000
  if (instance.ceReload) {
1999
2001
  hmrDirtyComponents.add(oldComp);
@@ -3309,7 +3311,8 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotSc
3309
3311
  }
3310
3312
  }
3311
3313
  let hasWarned = false;
3312
- function createSuspenseBoundary(vnode, parent, parentComponent, container, hiddenContainer, anchor, isSVG, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
3314
+ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, isSVG, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
3315
+ var _a;
3313
3316
  if (!hasWarned) {
3314
3317
  hasWarned = true;
3315
3318
  console[console.info ? "info" : "log"](
@@ -3323,13 +3326,21 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
3323
3326
  n: next,
3324
3327
  o: { parentNode, remove }
3325
3328
  } = rendererInternals;
3329
+ let parentSuspenseId;
3330
+ const isSuspensible = ((_a = vnode.props) == null ? void 0 : _a.suspensible) != null && vnode.props.suspensible !== false;
3331
+ if (isSuspensible) {
3332
+ if (parentSuspense == null ? void 0 : parentSuspense.pendingBranch) {
3333
+ parentSuspenseId = parentSuspense == null ? void 0 : parentSuspense.pendingId;
3334
+ parentSuspense.deps++;
3335
+ }
3336
+ }
3326
3337
  const timeout = vnode.props ? toNumber(vnode.props.timeout) : void 0;
3327
3338
  {
3328
3339
  assertNumber(timeout, `Suspense timeout`);
3329
3340
  }
3330
3341
  const suspense = {
3331
3342
  vnode,
3332
- parent,
3343
+ parent: parentSuspense,
3333
3344
  parentComponent,
3334
3345
  isSVG,
3335
3346
  container,
@@ -3389,20 +3400,28 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
3389
3400
  setActiveBranch(suspense, pendingBranch);
3390
3401
  suspense.pendingBranch = null;
3391
3402
  suspense.isInFallback = false;
3392
- let parent2 = suspense.parent;
3403
+ let parent = suspense.parent;
3393
3404
  let hasUnresolvedAncestor = false;
3394
- while (parent2) {
3395
- if (parent2.pendingBranch) {
3396
- parent2.effects.push(...effects);
3405
+ while (parent) {
3406
+ if (parent.pendingBranch) {
3407
+ parent.effects.push(...effects);
3397
3408
  hasUnresolvedAncestor = true;
3398
3409
  break;
3399
3410
  }
3400
- parent2 = parent2.parent;
3411
+ parent = parent.parent;
3401
3412
  }
3402
3413
  if (!hasUnresolvedAncestor) {
3403
3414
  queuePostFlushCb(effects);
3404
3415
  }
3405
3416
  suspense.effects = [];
3417
+ if (isSuspensible) {
3418
+ if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
3419
+ parentSuspense.deps--;
3420
+ if (parentSuspense.deps === 0) {
3421
+ parentSuspense.resolve();
3422
+ }
3423
+ }
3424
+ }
3406
3425
  triggerEvent(vnode2, "onResolve");
3407
3426
  },
3408
3427
  fallback(fallbackVNode) {
@@ -3502,13 +3521,13 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
3502
3521
  }
3503
3522
  });
3504
3523
  },
3505
- unmount(parentSuspense, doRemove) {
3524
+ unmount(parentSuspense2, doRemove) {
3506
3525
  suspense.isUnmounted = true;
3507
3526
  if (suspense.activeBranch) {
3508
3527
  unmount(
3509
3528
  suspense.activeBranch,
3510
3529
  parentComponent,
3511
- parentSuspense,
3530
+ parentSuspense2,
3512
3531
  doRemove
3513
3532
  );
3514
3533
  }
@@ -3516,7 +3535,7 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
3516
3535
  unmount(
3517
3536
  suspense.pendingBranch,
3518
3537
  parentComponent,
3519
- parentSuspense,
3538
+ parentSuspense2,
3520
3539
  doRemove
3521
3540
  );
3522
3541
  }
@@ -5484,6 +5503,8 @@ const PublicInstanceProxyHandlers = {
5484
5503
  if (key === "$attrs") {
5485
5504
  track(instance, "get", key);
5486
5505
  markAttrsAccessed();
5506
+ } else if (key === "$slots") {
5507
+ track(instance, "get", key);
5487
5508
  }
5488
5509
  return publicGetter(instance);
5489
5510
  } else if (
@@ -5673,6 +5694,161 @@ function deepMergeData(to, from) {
5673
5694
  return to;
5674
5695
  }
5675
5696
 
5697
+ const warnRuntimeUsage = (method) => warn(
5698
+ `${method}() is a compiler-hint helper that is only usable inside <script setup> of a single file component. Its arguments should be compiled away and passing it at runtime has no effect.`
5699
+ );
5700
+ function defineProps() {
5701
+ {
5702
+ warnRuntimeUsage(`defineProps`);
5703
+ }
5704
+ return null;
5705
+ }
5706
+ function defineEmits() {
5707
+ {
5708
+ warnRuntimeUsage(`defineEmits`);
5709
+ }
5710
+ return null;
5711
+ }
5712
+ function defineExpose(exposed) {
5713
+ {
5714
+ warnRuntimeUsage(`defineExpose`);
5715
+ }
5716
+ }
5717
+ function defineOptions(options) {
5718
+ {
5719
+ warnRuntimeUsage(`defineOptions`);
5720
+ }
5721
+ }
5722
+ function defineSlots() {
5723
+ {
5724
+ warnRuntimeUsage(`defineSlots`);
5725
+ }
5726
+ return null;
5727
+ }
5728
+ function defineModel() {
5729
+ {
5730
+ warnRuntimeUsage("defineModel");
5731
+ }
5732
+ }
5733
+ function withDefaults(props, defaults) {
5734
+ {
5735
+ warnRuntimeUsage(`withDefaults`);
5736
+ }
5737
+ return null;
5738
+ }
5739
+ function useSlots() {
5740
+ return getContext().slots;
5741
+ }
5742
+ function useAttrs() {
5743
+ return getContext().attrs;
5744
+ }
5745
+ function useModel(props, name, options) {
5746
+ const i = getCurrentInstance();
5747
+ if (!i) {
5748
+ warn(`useModel() called without active instance.`);
5749
+ return ref();
5750
+ }
5751
+ if (!i.propsOptions[0][name]) {
5752
+ warn(`useModel() called with prop "${name}" which is not declared.`);
5753
+ return ref();
5754
+ }
5755
+ if (options && options.local) {
5756
+ const proxy = ref(props[name]);
5757
+ watch(
5758
+ () => props[name],
5759
+ (v) => proxy.value = v
5760
+ );
5761
+ watch(proxy, (value) => {
5762
+ if (value !== props[name]) {
5763
+ i.emit(`update:${name}`, value);
5764
+ }
5765
+ });
5766
+ return proxy;
5767
+ } else {
5768
+ return {
5769
+ __v_isRef: true,
5770
+ get value() {
5771
+ return props[name];
5772
+ },
5773
+ set value(value) {
5774
+ i.emit(`update:${name}`, value);
5775
+ }
5776
+ };
5777
+ }
5778
+ }
5779
+ function getContext() {
5780
+ const i = getCurrentInstance();
5781
+ if (!i) {
5782
+ warn(`useContext() called without active instance.`);
5783
+ }
5784
+ return i.setupContext || (i.setupContext = createSetupContext(i));
5785
+ }
5786
+ function normalizePropsOrEmits(props) {
5787
+ return isArray(props) ? props.reduce(
5788
+ (normalized, p) => (normalized[p] = null, normalized),
5789
+ {}
5790
+ ) : props;
5791
+ }
5792
+ function mergeDefaults(raw, defaults) {
5793
+ const props = normalizePropsOrEmits(raw);
5794
+ for (const key in defaults) {
5795
+ if (key.startsWith("__skip"))
5796
+ continue;
5797
+ let opt = props[key];
5798
+ if (opt) {
5799
+ if (isArray(opt) || isFunction(opt)) {
5800
+ opt = props[key] = { type: opt, default: defaults[key] };
5801
+ } else {
5802
+ opt.default = defaults[key];
5803
+ }
5804
+ } else if (opt === null) {
5805
+ opt = props[key] = { default: defaults[key] };
5806
+ } else {
5807
+ warn(`props default key "${key}" has no corresponding declaration.`);
5808
+ }
5809
+ if (opt && defaults[`__skip_${key}`]) {
5810
+ opt.skipFactory = true;
5811
+ }
5812
+ }
5813
+ return props;
5814
+ }
5815
+ function mergeModels(a, b) {
5816
+ if (!a || !b)
5817
+ return a || b;
5818
+ if (isArray(a) && isArray(b))
5819
+ return a.concat(b);
5820
+ return extend({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b));
5821
+ }
5822
+ function createPropsRestProxy(props, excludedKeys) {
5823
+ const ret = {};
5824
+ for (const key in props) {
5825
+ if (!excludedKeys.includes(key)) {
5826
+ Object.defineProperty(ret, key, {
5827
+ enumerable: true,
5828
+ get: () => props[key]
5829
+ });
5830
+ }
5831
+ }
5832
+ return ret;
5833
+ }
5834
+ function withAsyncContext(getAwaitable) {
5835
+ const ctx = getCurrentInstance();
5836
+ if (!ctx) {
5837
+ warn(
5838
+ `withAsyncContext called without active current instance. This is likely a bug.`
5839
+ );
5840
+ }
5841
+ let awaitable = getAwaitable();
5842
+ unsetCurrentInstance();
5843
+ if (isPromise(awaitable)) {
5844
+ awaitable = awaitable.catch((e) => {
5845
+ setCurrentInstance(ctx);
5846
+ throw e;
5847
+ });
5848
+ }
5849
+ return [awaitable, () => setCurrentInstance(ctx)];
5850
+ }
5851
+
5676
5852
  function createDuplicateChecker() {
5677
5853
  const cache = /* @__PURE__ */ Object.create(null);
5678
5854
  return (type, key) => {
@@ -5735,12 +5911,7 @@ function applyOptions(instance) {
5735
5911
  }
5736
5912
  }
5737
5913
  if (injectOptions) {
5738
- resolveInjections(
5739
- injectOptions,
5740
- ctx,
5741
- checkDuplicateProperties,
5742
- instance.appContext.config.unwrapInjectedRef
5743
- );
5914
+ resolveInjections(injectOptions, ctx, checkDuplicateProperties);
5744
5915
  }
5745
5916
  if (methods) {
5746
5917
  for (const key in methods) {
@@ -5891,7 +6062,7 @@ function applyOptions(instance) {
5891
6062
  instance.filters = filters;
5892
6063
  }
5893
6064
  }
5894
- function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP, unwrapRef = false) {
6065
+ function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP) {
5895
6066
  if (isArray(injectOptions)) {
5896
6067
  injectOptions = normalizeInject(injectOptions);
5897
6068
  }
@@ -5913,21 +6084,12 @@ function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP,
5913
6084
  injected = inject(opt);
5914
6085
  }
5915
6086
  if (isRef(injected)) {
5916
- if (unwrapRef) {
5917
- Object.defineProperty(ctx, key, {
5918
- enumerable: true,
5919
- configurable: true,
5920
- get: () => injected.value,
5921
- set: (v) => injected.value = v
5922
- });
5923
- } else {
5924
- {
5925
- warn(
5926
- `injected property "${key}" is a ref and will be auto-unwrapped and no longer needs \`.value\` in the next minor release. To opt-in to the new behavior now, set \`app.config.unwrapInjectedRef = true\` (this config is temporary and will not be needed in the future.)`
5927
- );
5928
- }
5929
- ctx[key] = injected;
5930
- }
6087
+ Object.defineProperty(ctx, key, {
6088
+ enumerable: true,
6089
+ configurable: true,
6090
+ get: () => injected.value,
6091
+ set: (v) => injected.value = v
6092
+ });
5931
6093
  } else {
5932
6094
  ctx[key] = injected;
5933
6095
  }
@@ -6030,10 +6192,8 @@ function mergeOptions(to, from, strats, asMixin = false) {
6030
6192
  }
6031
6193
  const internalOptionMergeStrats = {
6032
6194
  data: mergeDataFn,
6033
- props: mergeObjectOptions,
6034
- // TODO
6035
- emits: mergeObjectOptions,
6036
- // TODO
6195
+ props: mergeEmitsOrPropsOptions,
6196
+ emits: mergeEmitsOrPropsOptions,
6037
6197
  // objects
6038
6198
  methods: mergeObjectOptions,
6039
6199
  computed: mergeObjectOptions,
@@ -6095,7 +6255,21 @@ function mergeAsArray$1(to, from) {
6095
6255
  return to ? [...new Set([].concat(to, from))] : from;
6096
6256
  }
6097
6257
  function mergeObjectOptions(to, from) {
6098
- return to ? extend(extend(/* @__PURE__ */ Object.create(null), to), from) : from;
6258
+ return to ? extend(/* @__PURE__ */ Object.create(null), to, from) : from;
6259
+ }
6260
+ function mergeEmitsOrPropsOptions(to, from) {
6261
+ if (to) {
6262
+ if (isArray(to) && isArray(from)) {
6263
+ return [.../* @__PURE__ */ new Set([...to, ...from])];
6264
+ }
6265
+ return extend(
6266
+ /* @__PURE__ */ Object.create(null),
6267
+ normalizePropsOrEmits(to),
6268
+ normalizePropsOrEmits(from != null ? from : {})
6269
+ );
6270
+ } else {
6271
+ return from;
6272
+ }
6099
6273
  }
6100
6274
  function mergeWatchOptions(to, from) {
6101
6275
  if (!to)
@@ -6174,7 +6348,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6174
6348
  return vm;
6175
6349
  }
6176
6350
  }
6177
- Vue.version = `2.6.14-compat:${"3.3.0-alpha.9"}`;
6351
+ Vue.version = `2.6.14-compat:${"3.3.0-beta.1"}`;
6178
6352
  Vue.config = singletonApp.config;
6179
6353
  Vue.use = (p, ...options) => {
6180
6354
  if (p && isFunction(p.install)) {
@@ -6575,6 +6749,18 @@ function createAppAPI(render, hydrate) {
6575
6749
  rootProps = null;
6576
6750
  }
6577
6751
  const context = createAppContext();
6752
+ {
6753
+ Object.defineProperty(context.config, "unwrapInjectedRef", {
6754
+ get() {
6755
+ return true;
6756
+ },
6757
+ set() {
6758
+ warn(
6759
+ `app.config.unwrapInjectedRef has been deprecated. 3.3 now alawys unwraps injected refs in Options API.`
6760
+ );
6761
+ }
6762
+ });
6763
+ }
6578
6764
  const installedPlugins = /* @__PURE__ */ new Set();
6579
6765
  let isMounted = false;
6580
6766
  const app = context.app = {
@@ -6754,6 +6940,9 @@ function inject(key, defaultValue, treatDefaultAsFactory = false) {
6754
6940
  warn(`inject() can only be used inside setup() or functional components.`);
6755
6941
  }
6756
6942
  }
6943
+ function hasInjectionContext() {
6944
+ return !!(currentInstance || currentRenderingInstance || currentApp);
6945
+ }
6757
6946
 
6758
6947
  function createPropsDefaultThis(instance, rawProps, propKey) {
6759
6948
  return new Proxy(
@@ -7296,6 +7485,7 @@ const updateSlots = (instance, children, optimized) => {
7296
7485
  if (type) {
7297
7486
  if (isHmrUpdating) {
7298
7487
  extend(slots, children);
7488
+ trigger(instance, "set", "$slots");
7299
7489
  } else if (optimized && type === 1) {
7300
7490
  needDeletionCheck = false;
7301
7491
  } else {
@@ -8224,7 +8414,7 @@ function baseCreateRenderer(options, createHydrationFns) {
8224
8414
  areChildrenSVG,
8225
8415
  slotScopeIds
8226
8416
  );
8227
- if (parentComponent && parentComponent.type.__hmrId) {
8417
+ {
8228
8418
  traverseStaticChildren(n1, n2);
8229
8419
  }
8230
8420
  } else if (!optimized) {
@@ -8420,21 +8610,8 @@ function baseCreateRenderer(options, createHydrationFns) {
8420
8610
  isSVG,
8421
8611
  slotScopeIds
8422
8612
  );
8423
- if (parentComponent && parentComponent.type.__hmrId) {
8613
+ {
8424
8614
  traverseStaticChildren(n1, n2);
8425
- } else if (
8426
- // #2080 if the stable fragment has a key, it's a <template v-for> that may
8427
- // get moved around. Make sure all root level vnodes inherit el.
8428
- // #2134 or if it's a component root, it may also get moved around
8429
- // as the component is being moved.
8430
- n2.key != null || parentComponent && n2 === parentComponent.subTree
8431
- ) {
8432
- traverseStaticChildren(
8433
- n1,
8434
- n2,
8435
- true
8436
- /* shallow */
8437
- );
8438
8615
  }
8439
8616
  } else {
8440
8617
  patchChildren(
@@ -10103,6 +10280,8 @@ function createComponentInstance(vnode, parent, suspense) {
10103
10280
  refs: EMPTY_OBJ,
10104
10281
  setupState: EMPTY_OBJ,
10105
10282
  setupContext: null,
10283
+ attrsProxy: null,
10284
+ slotsProxy: null,
10106
10285
  // suspense related
10107
10286
  suspense,
10108
10287
  suspenseId: suspense ? suspense.pendingId : 0,
@@ -10354,8 +10533,8 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
10354
10533
  }
10355
10534
  }
10356
10535
  }
10357
- function createAttrsProxy(instance) {
10358
- return new Proxy(
10536
+ function getAttrsProxy(instance) {
10537
+ return instance.attrsProxy || (instance.attrsProxy = new Proxy(
10359
10538
  instance.attrs,
10360
10539
  {
10361
10540
  get(target, key) {
@@ -10372,7 +10551,23 @@ function createAttrsProxy(instance) {
10372
10551
  return false;
10373
10552
  }
10374
10553
  }
10375
- );
10554
+ ));
10555
+ }
10556
+ function getSlotsProxy(instance) {
10557
+ return instance.slotsProxy || (instance.slotsProxy = new Proxy(instance.slots, {
10558
+ get(target, key) {
10559
+ track(instance, "get", "$slots");
10560
+ return target[key];
10561
+ },
10562
+ set() {
10563
+ warn(`setupContext.slots is readonly.`);
10564
+ return false;
10565
+ },
10566
+ deleteProperty() {
10567
+ warn(`setupContext.slots is readonly.`);
10568
+ return false;
10569
+ }
10570
+ }));
10376
10571
  }
10377
10572
  function createSetupContext(instance) {
10378
10573
  const expose = (exposed) => {
@@ -10398,14 +10593,13 @@ function createSetupContext(instance) {
10398
10593
  }
10399
10594
  instance.exposed = exposed || {};
10400
10595
  };
10401
- let attrs;
10402
10596
  {
10403
10597
  return Object.freeze({
10404
10598
  get attrs() {
10405
- return attrs || (attrs = createAttrsProxy(instance));
10599
+ return getAttrsProxy(instance);
10406
10600
  },
10407
10601
  get slots() {
10408
- return shallowReadonly(instance.slots);
10602
+ return getSlotsProxy(instance);
10409
10603
  },
10410
10604
  get emit() {
10411
10605
  return (event, ...args) => instance.emit(event, ...args);
@@ -10465,161 +10659,6 @@ const computed = (getterOrOptions, debugOptions) => {
10465
10659
  return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
10466
10660
  };
10467
10661
 
10468
- const warnRuntimeUsage = (method) => warn(
10469
- `${method}() is a compiler-hint helper that is only usable inside <script setup> of a single file component. Its arguments should be compiled away and passing it at runtime has no effect.`
10470
- );
10471
- function defineProps() {
10472
- {
10473
- warnRuntimeUsage(`defineProps`);
10474
- }
10475
- return null;
10476
- }
10477
- function defineEmits() {
10478
- {
10479
- warnRuntimeUsage(`defineEmits`);
10480
- }
10481
- return null;
10482
- }
10483
- function defineExpose(exposed) {
10484
- {
10485
- warnRuntimeUsage(`defineExpose`);
10486
- }
10487
- }
10488
- function defineOptions(options) {
10489
- {
10490
- warnRuntimeUsage(`defineOptions`);
10491
- }
10492
- }
10493
- function defineSlots() {
10494
- {
10495
- warnRuntimeUsage(`defineSlots`);
10496
- }
10497
- return null;
10498
- }
10499
- function defineModel() {
10500
- {
10501
- warnRuntimeUsage("defineModel");
10502
- }
10503
- }
10504
- function withDefaults(props, defaults) {
10505
- {
10506
- warnRuntimeUsage(`withDefaults`);
10507
- }
10508
- return null;
10509
- }
10510
- function useSlots() {
10511
- return getContext().slots;
10512
- }
10513
- function useAttrs() {
10514
- return getContext().attrs;
10515
- }
10516
- function useModel(props, name, options) {
10517
- const i = getCurrentInstance();
10518
- if (!i) {
10519
- warn(`useModel() called without active instance.`);
10520
- return ref();
10521
- }
10522
- if (!i.propsOptions[0][name]) {
10523
- warn(`useModel() called with prop "${name}" which is not declared.`);
10524
- return ref();
10525
- }
10526
- if (options && options.local) {
10527
- const proxy = ref(props[name]);
10528
- watch(
10529
- () => props[name],
10530
- (v) => proxy.value = v
10531
- );
10532
- watch(proxy, (value) => {
10533
- if (value !== props[name]) {
10534
- i.emit(`update:${name}`, value);
10535
- }
10536
- });
10537
- return proxy;
10538
- } else {
10539
- return {
10540
- __v_isRef: true,
10541
- get value() {
10542
- return props[name];
10543
- },
10544
- set value(value) {
10545
- i.emit(`update:${name}`, value);
10546
- }
10547
- };
10548
- }
10549
- }
10550
- function getContext() {
10551
- const i = getCurrentInstance();
10552
- if (!i) {
10553
- warn(`useContext() called without active instance.`);
10554
- }
10555
- return i.setupContext || (i.setupContext = createSetupContext(i));
10556
- }
10557
- function normalizePropsOrEmits(props) {
10558
- return isArray(props) ? props.reduce(
10559
- (normalized, p) => (normalized[p] = {}, normalized),
10560
- {}
10561
- ) : props;
10562
- }
10563
- function mergeDefaults(raw, defaults) {
10564
- const props = normalizePropsOrEmits(raw);
10565
- for (const key in defaults) {
10566
- if (key.startsWith("__skip"))
10567
- continue;
10568
- let opt = props[key];
10569
- if (opt) {
10570
- if (isArray(opt) || isFunction(opt)) {
10571
- opt = props[key] = { type: opt, default: defaults[key] };
10572
- } else {
10573
- opt.default = defaults[key];
10574
- }
10575
- } else if (opt === null) {
10576
- opt = props[key] = { default: defaults[key] };
10577
- } else {
10578
- warn(`props default key "${key}" has no corresponding declaration.`);
10579
- }
10580
- if (opt && defaults[`__skip_${key}`]) {
10581
- opt.skipFactory = true;
10582
- }
10583
- }
10584
- return props;
10585
- }
10586
- function mergeModels(a, b) {
10587
- if (!a || !b)
10588
- return a || b;
10589
- if (isArray(a) && isArray(b))
10590
- return a.concat(b);
10591
- return extend({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b));
10592
- }
10593
- function createPropsRestProxy(props, excludedKeys) {
10594
- const ret = {};
10595
- for (const key in props) {
10596
- if (!excludedKeys.includes(key)) {
10597
- Object.defineProperty(ret, key, {
10598
- enumerable: true,
10599
- get: () => props[key]
10600
- });
10601
- }
10602
- }
10603
- return ret;
10604
- }
10605
- function withAsyncContext(getAwaitable) {
10606
- const ctx = getCurrentInstance();
10607
- if (!ctx) {
10608
- warn(
10609
- `withAsyncContext called without active current instance. This is likely a bug.`
10610
- );
10611
- }
10612
- let awaitable = getAwaitable();
10613
- unsetCurrentInstance();
10614
- if (isPromise(awaitable)) {
10615
- awaitable = awaitable.catch((e) => {
10616
- setCurrentInstance(ctx);
10617
- throw e;
10618
- });
10619
- }
10620
- return [awaitable, () => setCurrentInstance(ctx)];
10621
- }
10622
-
10623
10662
  function h(type, propsOrChildren, children) {
10624
10663
  const l = arguments.length;
10625
10664
  if (l === 2) {
@@ -10855,7 +10894,7 @@ function isMemoSame(cached, memo) {
10855
10894
  return true;
10856
10895
  }
10857
10896
 
10858
- const version = "3.3.0-alpha.9";
10897
+ const version = "3.3.0-beta.1";
10859
10898
  const _ssrUtils = {
10860
10899
  createComponentInstance,
10861
10900
  setupComponent,
@@ -12526,6 +12565,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
12526
12565
  guardReactiveProps: guardReactiveProps,
12527
12566
  h: h,
12528
12567
  handleError: handleError,
12568
+ hasInjectionContext: hasInjectionContext,
12529
12569
  hydrate: hydrate,
12530
12570
  initCustomFormatter: initCustomFormatter,
12531
12571
  initDirectivesForSSR: initDirectivesForSSR,
@@ -12712,8 +12752,11 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
12712
12752
  [48]: `ES module mode is not supported in this build of compiler.`,
12713
12753
  [49]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
12714
12754
  [50]: `"scopeId" option is only supported in module mode.`,
12755
+ // deprecations
12756
+ [51]: `@vnode-* hooks in templates are deprecated. Use the vue: prefix instead. For example, @vnode-mounted should be changed to @vue:mounted. @vnode-* hooks support will be removed in 3.4.`,
12757
+ [52]: `v-is="component-name" has been deprecated. Use is="vue:component-name" instead. v-is support will be removed in 3.4.`,
12715
12758
  // just to fulfill types
12716
- [51]: ``
12759
+ [53]: ``
12717
12760
  };
12718
12761
 
12719
12762
  const FRAGMENT = Symbol(`Fragment` );
@@ -14604,7 +14647,7 @@ const aliasHelper = (s) => `${helperNameMap[s]}: _${helperNameMap[s]}`;
14604
14647
  function createCodegenContext(ast, {
14605
14648
  mode = "function",
14606
14649
  prefixIdentifiers = mode === "module",
14607
- sourceMap: sourceMap$1 = false,
14650
+ sourceMap = false,
14608
14651
  filename = `template.vue.html`,
14609
14652
  scopeId = null,
14610
14653
  optimizeImports = false,
@@ -14618,7 +14661,7 @@ function createCodegenContext(ast, {
14618
14661
  const context = {
14619
14662
  mode,
14620
14663
  prefixIdentifiers,
14621
- sourceMap: sourceMap$1,
14664
+ sourceMap,
14622
14665
  filename,
14623
14666
  scopeId,
14624
14667
  optimizeImports,
@@ -14690,8 +14733,8 @@ function createCodegenContext(ast, {
14690
14733
  }
14691
14734
  });
14692
14735
  }
14693
- if (sourceMap$1) {
14694
- context.map = new sourceMap.SourceMapGenerator();
14736
+ if (sourceMap) {
14737
+ context.map = new sourceMapJs.SourceMapGenerator();
14695
14738
  context.map.setSourceContent(filename, context.source);
14696
14739
  }
14697
14740
  return context;
@@ -15675,12 +15718,10 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
15675
15718
  return genPropsAccessExp(bindingMetadata.__propsAliases[raw]);
15676
15719
  }
15677
15720
  } else {
15678
- if (type && type.startsWith("setup")) {
15721
+ if (type && type.startsWith("setup") || type === "literal-const") {
15679
15722
  return `$setup.${raw}`;
15680
15723
  } else if (type === "props-aliased") {
15681
15724
  return `$props['${bindingMetadata.__propsAliases[raw]}']`;
15682
- } else if (type === "literal-const") {
15683
- return raw;
15684
15725
  } else if (type) {
15685
15726
  return `$${type}.${raw}`;
15686
15727
  }
@@ -16731,6 +16772,11 @@ function resolveComponentType(node, context, ssr = false) {
16731
16772
  }
16732
16773
  const isDir = !isExplicitDynamic && findDir(node, "is");
16733
16774
  if (isDir && isDir.exp) {
16775
+ {
16776
+ context.onWarn(
16777
+ createCompilerError(52, isDir.loc)
16778
+ );
16779
+ }
16734
16780
  return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [
16735
16781
  isDir.exp
16736
16782
  ]);
@@ -17302,6 +17348,11 @@ const transformOn$1 = (dir, node, context, augmentor) => {
17302
17348
  if (arg.type === 4) {
17303
17349
  if (arg.isStatic) {
17304
17350
  let rawName = arg.content;
17351
+ if (rawName.startsWith("vnode")) {
17352
+ context.onWarn(
17353
+ createCompilerError(51, arg.loc)
17354
+ );
17355
+ }
17305
17356
  if (rawName.startsWith("vue:")) {
17306
17357
  rawName = `vnode-${rawName.slice(4)}`;
17307
17358
  }
@@ -20323,29 +20374,29 @@ function createDOMCompilerError(code, loc) {
20323
20374
  );
20324
20375
  }
20325
20376
  const DOMErrorMessages = {
20326
- [51]: `v-html is missing expression.`,
20327
- [52]: `v-html will override element children.`,
20328
- [53]: `v-text is missing expression.`,
20329
- [54]: `v-text will override element children.`,
20330
- [55]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
20331
- [56]: `v-model argument is not supported on plain elements.`,
20332
- [57]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
20333
- [58]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
20334
- [59]: `v-show is missing expression.`,
20335
- [60]: `<Transition> expects exactly one child element or component.`,
20336
- [61]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
20377
+ [53]: `v-html is missing expression.`,
20378
+ [54]: `v-html will override element children.`,
20379
+ [55]: `v-text is missing expression.`,
20380
+ [56]: `v-text will override element children.`,
20381
+ [57]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
20382
+ [58]: `v-model argument is not supported on plain elements.`,
20383
+ [59]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
20384
+ [60]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
20385
+ [61]: `v-show is missing expression.`,
20386
+ [62]: `<Transition> expects exactly one child element or component.`,
20387
+ [63]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
20337
20388
  };
20338
20389
 
20339
20390
  const transformVHtml = (dir, node, context) => {
20340
20391
  const { exp, loc } = dir;
20341
20392
  if (!exp) {
20342
20393
  context.onError(
20343
- createDOMCompilerError(51, loc)
20394
+ createDOMCompilerError(53, loc)
20344
20395
  );
20345
20396
  }
20346
20397
  if (node.children.length) {
20347
20398
  context.onError(
20348
- createDOMCompilerError(52, loc)
20399
+ createDOMCompilerError(54, loc)
20349
20400
  );
20350
20401
  node.children.length = 0;
20351
20402
  }
@@ -20363,12 +20414,12 @@ const transformVText = (dir, node, context) => {
20363
20414
  const { exp, loc } = dir;
20364
20415
  if (!exp) {
20365
20416
  context.onError(
20366
- createDOMCompilerError(53, loc)
20417
+ createDOMCompilerError(55, loc)
20367
20418
  );
20368
20419
  }
20369
20420
  if (node.children.length) {
20370
20421
  context.onError(
20371
- createDOMCompilerError(54, loc)
20422
+ createDOMCompilerError(56, loc)
20372
20423
  );
20373
20424
  node.children.length = 0;
20374
20425
  }
@@ -20394,7 +20445,7 @@ const transformModel = (dir, node, context) => {
20394
20445
  if (dir.arg) {
20395
20446
  context.onError(
20396
20447
  createDOMCompilerError(
20397
- 56,
20448
+ 58,
20398
20449
  dir.arg.loc
20399
20450
  )
20400
20451
  );
@@ -20404,7 +20455,7 @@ const transformModel = (dir, node, context) => {
20404
20455
  if (value) {
20405
20456
  context.onError(
20406
20457
  createDOMCompilerError(
20407
- 58,
20458
+ 60,
20408
20459
  value.loc
20409
20460
  )
20410
20461
  );
@@ -20432,7 +20483,7 @@ const transformModel = (dir, node, context) => {
20432
20483
  isInvalidType = true;
20433
20484
  context.onError(
20434
20485
  createDOMCompilerError(
20435
- 57,
20486
+ 59,
20436
20487
  dir.loc
20437
20488
  )
20438
20489
  );
@@ -20458,7 +20509,7 @@ const transformModel = (dir, node, context) => {
20458
20509
  } else {
20459
20510
  context.onError(
20460
20511
  createDOMCompilerError(
20461
- 55,
20512
+ 57,
20462
20513
  dir.loc
20463
20514
  )
20464
20515
  );
@@ -20570,7 +20621,7 @@ const transformShow = (dir, node, context) => {
20570
20621
  const { exp, loc } = dir;
20571
20622
  if (!exp) {
20572
20623
  context.onError(
20573
- createDOMCompilerError(59, loc)
20624
+ createDOMCompilerError(61, loc)
20574
20625
  );
20575
20626
  }
20576
20627
  return {
@@ -20590,7 +20641,7 @@ const transformTransition = (node, context) => {
20590
20641
  if (hasMultipleChildren(node)) {
20591
20642
  context.onError(
20592
20643
  createDOMCompilerError(
20593
- 60,
20644
+ 62,
20594
20645
  {
20595
20646
  start: node.children[0].loc.start,
20596
20647
  end: node.children[node.children.length - 1].loc.end,
@@ -20838,7 +20889,7 @@ function evaluateConstant(exp) {
20838
20889
  const ignoreSideEffectTags = (node, context) => {
20839
20890
  if (node.type === 1 && node.tagType === 0 && (node.tag === "script" || node.tag === "style")) {
20840
20891
  context.onError(
20841
- createDOMCompilerError(61, node.loc)
20892
+ createDOMCompilerError(63, node.loc)
20842
20893
  );
20843
20894
  context.removeNode();
20844
20895
  }