@vue/runtime-core 3.2.44 → 3.2.46

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/README.md CHANGED
@@ -2,18 +2,18 @@
2
2
 
3
3
  > This package is published only for typing and building custom renderers. It is NOT meant to be used in applications.
4
4
 
5
- For full exposed APIs, see `src/index.ts`. You can also run `yarn build runtime-core --types` from repo root, which will generate an API report at `temp/runtime-core.api.md`.
5
+ For full exposed APIs, see `src/index.ts`. You can also run `pnpm build runtime-core --types` from repo root, which will generate an API report at `temp/runtime-core.api.md`.
6
6
 
7
7
  ## Building a Custom Renderer
8
8
 
9
- ``` ts
9
+ ```ts
10
10
  import { createRenderer } from '@vue/runtime-core'
11
11
 
12
12
  const { render, createApp } = createRenderer({
13
13
  patchProp,
14
14
  insert,
15
15
  remove,
16
- createElement,
16
+ createElement
17
17
  // ...
18
18
  })
19
19
 
@@ -1,7 +1,5 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  var reactivity = require('@vue/reactivity');
6
4
  var shared = require('@vue/shared');
7
5
 
@@ -118,6 +116,20 @@ function formatProp(key, value, raw) {
118
116
  return raw ? value : [`${key}=`, value];
119
117
  }
120
118
  }
119
+ /**
120
+ * @internal
121
+ */
122
+ function assertNumber(val, type) {
123
+ if (val === undefined) {
124
+ return;
125
+ }
126
+ else if (typeof val !== 'number') {
127
+ warn(`${type} is not a valid number - ` + `got ${JSON.stringify(val)}.`);
128
+ }
129
+ else if (isNaN(val)) {
130
+ warn(`${type} is NaN - ` + 'the duration expression might be incorrect.');
131
+ }
132
+ }
121
133
 
122
134
  const ErrorTypeStrings = {
123
135
  ["sp" /* LifecycleHooks.SERVER_PREFETCH */]: 'serverPrefetch hook',
@@ -514,12 +526,6 @@ function reload(id, newComp) {
514
526
  // components to be unmounted and re-mounted. Queue the update so that we
515
527
  // don't end up forcing the same parent to re-render multiple times.
516
528
  queueJob(instance.parent.update);
517
- // instance is the inner component of an async custom element
518
- // invoke to reset styles
519
- if (instance.parent.type.__asyncLoader &&
520
- instance.parent.ceReload) {
521
- instance.parent.ceReload(newComp.styles);
522
- }
523
529
  }
524
530
  else if (instance.appContext.reload) {
525
531
  // root instance mounted via createApp() has a reload method
@@ -561,9 +567,10 @@ function tryWrap(fn) {
561
567
  };
562
568
  }
563
569
 
570
+ exports.devtools = void 0;
564
571
  let buffer = [];
565
572
  let devtoolsNotInstalled = false;
566
- function emit(event, ...args) {
573
+ function emit$1(event, ...args) {
567
574
  if (exports.devtools) {
568
575
  exports.devtools.emit(event, ...args);
569
576
  }
@@ -610,7 +617,7 @@ function setDevtoolsHook(hook, target) {
610
617
  }
611
618
  }
612
619
  function devtoolsInitApp(app, version) {
613
- emit("app:init" /* DevtoolsHooks.APP_INIT */, app, version, {
620
+ emit$1("app:init" /* DevtoolsHooks.APP_INIT */, app, version, {
614
621
  Fragment,
615
622
  Text,
616
623
  Comment,
@@ -618,7 +625,7 @@ function devtoolsInitApp(app, version) {
618
625
  });
619
626
  }
620
627
  function devtoolsUnmountApp(app) {
621
- emit("app:unmount" /* DevtoolsHooks.APP_UNMOUNT */, app);
628
+ emit$1("app:unmount" /* DevtoolsHooks.APP_UNMOUNT */, app);
622
629
  }
623
630
  const devtoolsComponentAdded = /*#__PURE__*/ createDevtoolsComponentHook("component:added" /* DevtoolsHooks.COMPONENT_ADDED */);
624
631
  const devtoolsComponentUpdated =
@@ -634,21 +641,21 @@ const devtoolsComponentRemoved = (component) => {
634
641
  };
635
642
  function createDevtoolsComponentHook(hook) {
636
643
  return (component) => {
637
- emit(hook, component.appContext.app, component.uid, component.parent ? component.parent.uid : undefined, component);
644
+ emit$1(hook, component.appContext.app, component.uid, component.parent ? component.parent.uid : undefined, component);
638
645
  };
639
646
  }
640
647
  const devtoolsPerfStart = /*#__PURE__*/ createDevtoolsPerformanceHook("perf:start" /* DevtoolsHooks.PERFORMANCE_START */);
641
648
  const devtoolsPerfEnd = /*#__PURE__*/ createDevtoolsPerformanceHook("perf:end" /* DevtoolsHooks.PERFORMANCE_END */);
642
649
  function createDevtoolsPerformanceHook(hook) {
643
650
  return (component, type, time) => {
644
- emit(hook, component.appContext.app, component.uid, component, type, time);
651
+ emit$1(hook, component.appContext.app, component.uid, component, type, time);
645
652
  };
646
653
  }
647
654
  function devtoolsComponentEmit(component, event, params) {
648
- emit("component:emit" /* DevtoolsHooks.COMPONENT_EMIT */, component.appContext.app, component, event, params);
655
+ emit$1("component:emit" /* DevtoolsHooks.COMPONENT_EMIT */, component.appContext.app, component, event, params);
649
656
  }
650
657
 
651
- function emit$1(instance, event, ...rawArgs) {
658
+ function emit(instance, event, ...rawArgs) {
652
659
  if (instance.isUnmounted)
653
660
  return;
654
661
  const props = instance.vnode.props || shared.EMPTY_OBJ;
@@ -684,7 +691,7 @@ function emit$1(instance, event, ...rawArgs) {
684
691
  args = rawArgs.map(a => (shared.isString(a) ? a.trim() : a));
685
692
  }
686
693
  if (number) {
687
- args = rawArgs.map(shared.toNumber);
694
+ args = rawArgs.map(shared.looseToNumber);
688
695
  }
689
696
  }
690
697
  {
@@ -1332,7 +1339,10 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
1332
1339
  console[console.info ? 'info' : 'log'](`<Suspense> is an experimental feature and its API will likely change.`);
1333
1340
  }
1334
1341
  const { p: patch, m: move, um: unmount, n: next, o: { parentNode, remove } } = rendererInternals;
1335
- const timeout = shared.toNumber(vnode.props && vnode.props.timeout);
1342
+ const timeout = vnode.props ? shared.toNumber(vnode.props.timeout) : undefined;
1343
+ {
1344
+ assertNumber(timeout, `Suspense timeout`);
1345
+ }
1336
1346
  const suspense = {
1337
1347
  vnode,
1338
1348
  parent,
@@ -1650,12 +1660,10 @@ function watchEffect(effect, options) {
1650
1660
  return doWatch(effect, null, options);
1651
1661
  }
1652
1662
  function watchPostEffect(effect, options) {
1653
- return doWatch(effect, null, ({ ...options, flush: 'post' }
1654
- ));
1663
+ return doWatch(effect, null, { ...options, flush: 'post' } );
1655
1664
  }
1656
1665
  function watchSyncEffect(effect, options) {
1657
- return doWatch(effect, null, ({ ...options, flush: 'sync' }
1658
- ));
1666
+ return doWatch(effect, null, { ...options, flush: 'sync' } );
1659
1667
  }
1660
1668
  // initial value for watchers to trigger on undefined initial values
1661
1669
  const INITIAL_WATCHER_VALUE = {};
@@ -1683,7 +1691,8 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
1683
1691
  warn(`Invalid watch source: `, s, `A watch source can only be a getter/effect function, a ref, ` +
1684
1692
  `a reactive object, or an array of these types.`);
1685
1693
  };
1686
- const instance = currentInstance;
1694
+ const instance = reactivity.getCurrentScope() === (currentInstance === null || currentInstance === void 0 ? void 0 : currentInstance.scope) ? currentInstance : null;
1695
+ // const instance = currentInstance
1687
1696
  let getter;
1688
1697
  let forceTrigger = false;
1689
1698
  let isMultiSource = false;
@@ -1794,7 +1803,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
1794
1803
  // pass undefined as the old value when it's changed for the first time
1795
1804
  oldValue === INITIAL_WATCHER_VALUE
1796
1805
  ? undefined
1797
- : (isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE)
1806
+ : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE
1798
1807
  ? []
1799
1808
  : oldValue,
1800
1809
  onCleanup
@@ -2395,10 +2404,15 @@ function defineAsyncComponent(source) {
2395
2404
  }
2396
2405
  });
2397
2406
  }
2398
- function createInnerComp(comp, { vnode: { ref, props, children, shapeFlag }, parent }) {
2407
+ function createInnerComp(comp, parent) {
2408
+ const { ref, props, children, ce } = parent.vnode;
2399
2409
  const vnode = createVNode(comp, props, children);
2400
2410
  // ensure inner component inherits the async wrapper's ref owner
2401
2411
  vnode.ref = ref;
2412
+ // pass the custom element callback on to the inner comp
2413
+ // and remove it from the async wrapper
2414
+ vnode.ce = ce;
2415
+ delete parent.vnode.ce;
2402
2416
  return vnode;
2403
2417
  }
2404
2418
 
@@ -2492,7 +2506,7 @@ const KeepAliveImpl = {
2492
2506
  }
2493
2507
  function pruneCacheEntry(key) {
2494
2508
  const cached = cache.get(key);
2495
- if (!current || cached.type !== current.type) {
2509
+ if (!current || !isSameVNodeType(cached, current)) {
2496
2510
  unmount(cached);
2497
2511
  }
2498
2512
  else if (current) {
@@ -2524,7 +2538,7 @@ const KeepAliveImpl = {
2524
2538
  cache.forEach(cached => {
2525
2539
  const { subTree, suspense } = instance;
2526
2540
  const vnode = getInnerChild(subTree);
2527
- if (cached.type === vnode.type) {
2541
+ if (cached.type === vnode.type && cached.key === vnode.key) {
2528
2542
  // current instance will be unmounted as part of keep-alive's unmount
2529
2543
  resetShapeFlag(vnode);
2530
2544
  // but invoke its deactivated hook here
@@ -2564,8 +2578,7 @@ const KeepAliveImpl = {
2564
2578
  : comp);
2565
2579
  const { include, exclude, max } = props;
2566
2580
  if ((include && (!name || !matches(include, name))) ||
2567
- (exclude && name && matches(exclude, name)) ||
2568
- (hmrDirtyComponents.has(comp))) {
2581
+ (exclude && name && matches(exclude, name))) {
2569
2582
  current = vnode;
2570
2583
  return rawVNode;
2571
2584
  }
@@ -2622,7 +2635,7 @@ function matches(pattern, name) {
2622
2635
  else if (shared.isString(pattern)) {
2623
2636
  return pattern.split(',').includes(name);
2624
2637
  }
2625
- else if (pattern.test) {
2638
+ else if (shared.isRegExp(pattern)) {
2626
2639
  return pattern.test(name);
2627
2640
  }
2628
2641
  /* istanbul ignore next */
@@ -2675,14 +2688,9 @@ function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
2675
2688
  }, target);
2676
2689
  }
2677
2690
  function resetShapeFlag(vnode) {
2678
- let shapeFlag = vnode.shapeFlag;
2679
- if (shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */) {
2680
- shapeFlag -= 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */;
2681
- }
2682
- if (shapeFlag & 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */) {
2683
- shapeFlag -= 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */;
2684
- }
2685
- vnode.shapeFlag = shapeFlag;
2691
+ // bitwise operations to remove keep alive flags
2692
+ vnode.shapeFlag &= ~256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */;
2693
+ vnode.shapeFlag &= ~512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */;
2686
2694
  }
2687
2695
  function getInnerChild(vnode) {
2688
2696
  return vnode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */ ? vnode.ssContent : vnode;
@@ -2981,7 +2989,9 @@ fallback, noSlotted) {
2981
2989
  (currentRenderingInstance.parent &&
2982
2990
  isAsyncWrapper(currentRenderingInstance.parent) &&
2983
2991
  currentRenderingInstance.parent.isCE)) {
2984
- return createVNode('slot', name === 'default' ? null : { name }, fallback && fallback());
2992
+ if (name !== 'default')
2993
+ props.name = name;
2994
+ return createVNode('slot', props, fallback && fallback());
2985
2995
  }
2986
2996
  let slot = slots[name];
2987
2997
  if (slot && slot.length > 1) {
@@ -3081,6 +3091,7 @@ const publicPropertiesMap =
3081
3091
  $watch: i => (instanceWatch.bind(i) )
3082
3092
  });
3083
3093
  const isReservedPrefix = (key) => key === '_' || key === '$';
3094
+ const hasSetupBinding = (state, key) => state !== shared.EMPTY_OBJ && !state.__isScriptSetup && shared.hasOwn(state, key);
3084
3095
  const PublicInstanceProxyHandlers = {
3085
3096
  get({ _: instance }, key) {
3086
3097
  const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
@@ -3088,15 +3099,6 @@ const PublicInstanceProxyHandlers = {
3088
3099
  if (key === '__isVue') {
3089
3100
  return true;
3090
3101
  }
3091
- // prioritize <script setup> bindings during dev.
3092
- // this allows even properties that start with _ or $ to be used - so that
3093
- // it aligns with the production behavior where the render fn is inlined and
3094
- // indeed has access to all declared variables.
3095
- if (setupState !== shared.EMPTY_OBJ &&
3096
- setupState.__isScriptSetup &&
3097
- shared.hasOwn(setupState, key)) {
3098
- return setupState[key];
3099
- }
3100
3102
  // data / props / ctx
3101
3103
  // This getter gets called for every property access on the render context
3102
3104
  // during render and is a major hotspot. The most expensive part of this
@@ -3119,7 +3121,7 @@ const PublicInstanceProxyHandlers = {
3119
3121
  // default: just fallthrough
3120
3122
  }
3121
3123
  }
3122
- else if (setupState !== shared.EMPTY_OBJ && shared.hasOwn(setupState, key)) {
3124
+ else if (hasSetupBinding(setupState, key)) {
3123
3125
  accessCache[key] = 1 /* AccessTypes.SETUP */;
3124
3126
  return setupState[key];
3125
3127
  }
@@ -3189,21 +3191,26 @@ const PublicInstanceProxyHandlers = {
3189
3191
  },
3190
3192
  set({ _: instance }, key, value) {
3191
3193
  const { data, setupState, ctx } = instance;
3192
- if (setupState !== shared.EMPTY_OBJ && shared.hasOwn(setupState, key)) {
3194
+ if (hasSetupBinding(setupState, key)) {
3193
3195
  setupState[key] = value;
3194
3196
  return true;
3195
3197
  }
3198
+ else if (setupState.__isScriptSetup &&
3199
+ shared.hasOwn(setupState, key)) {
3200
+ warn(`Cannot mutate <script setup> binding "${key}" from Options API.`);
3201
+ return false;
3202
+ }
3196
3203
  else if (data !== shared.EMPTY_OBJ && shared.hasOwn(data, key)) {
3197
3204
  data[key] = value;
3198
3205
  return true;
3199
3206
  }
3200
3207
  else if (shared.hasOwn(instance.props, key)) {
3201
- warn(`Attempting to mutate prop "${key}". Props are readonly.`, instance);
3208
+ warn(`Attempting to mutate prop "${key}". Props are readonly.`);
3202
3209
  return false;
3203
3210
  }
3204
3211
  if (key[0] === '$' && key.slice(1) in instance) {
3205
3212
  warn(`Attempting to mutate public property "${key}". ` +
3206
- `Properties starting with $ are reserved and readonly.`, instance);
3213
+ `Properties starting with $ are reserved and readonly.`);
3207
3214
  return false;
3208
3215
  }
3209
3216
  else {
@@ -3224,7 +3231,7 @@ const PublicInstanceProxyHandlers = {
3224
3231
  let normalizedProps;
3225
3232
  return (!!accessCache[key] ||
3226
3233
  (data !== shared.EMPTY_OBJ && shared.hasOwn(data, key)) ||
3227
- (setupState !== shared.EMPTY_OBJ && shared.hasOwn(setupState, key)) ||
3234
+ hasSetupBinding(setupState, key) ||
3228
3235
  ((normalizedProps = propsOptions[0]) && shared.hasOwn(normalizedProps, key)) ||
3229
3236
  shared.hasOwn(ctx, key) ||
3230
3237
  shared.hasOwn(publicPropertiesMap, key) ||
@@ -4041,8 +4048,8 @@ function validatePropName(key) {
4041
4048
  // use function string name to check type constructors
4042
4049
  // so that it works across vms / iframes.
4043
4050
  function getType(ctor) {
4044
- const match = ctor && ctor.toString().match(/^\s*function (\w+)/);
4045
- return match ? match[1] : ctor === null ? 'null' : '';
4051
+ const match = ctor && ctor.toString().match(/^\s*(function|class) (\w+)/);
4052
+ return match ? match[2] : ctor === null ? 'null' : '';
4046
4053
  }
4047
4054
  function isSameType(a, b) {
4048
4055
  return getType(a) === getType(b);
@@ -4330,7 +4337,7 @@ function createAppContext() {
4330
4337
  emitsCache: new WeakMap()
4331
4338
  };
4332
4339
  }
4333
- let uid = 0;
4340
+ let uid$1 = 0;
4334
4341
  function createAppAPI(render, hydrate) {
4335
4342
  return function createApp(rootComponent, rootProps = null) {
4336
4343
  if (!shared.isFunction(rootComponent)) {
@@ -4344,7 +4351,7 @@ function createAppAPI(render, hydrate) {
4344
4351
  const installedPlugins = new Set();
4345
4352
  let isMounted = false;
4346
4353
  const app = (context.app = {
4347
- _uid: uid++,
4354
+ _uid: uid$1++,
4348
4355
  _component: rootComponent,
4349
4356
  _props: rootProps,
4350
4357
  _container: null,
@@ -5146,6 +5153,8 @@ function baseCreateRenderer(options, createHydrationFns) {
5146
5153
  if (dirs) {
5147
5154
  invokeDirectiveHook(vnode, null, parentComponent, 'created');
5148
5155
  }
5156
+ // scopeId
5157
+ setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent);
5149
5158
  // props
5150
5159
  if (props) {
5151
5160
  for (const key in props) {
@@ -5169,8 +5178,6 @@ function baseCreateRenderer(options, createHydrationFns) {
5169
5178
  invokeVNodeHook(vnodeHook, parentComponent, vnode);
5170
5179
  }
5171
5180
  }
5172
- // scopeId
5173
- setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent);
5174
5181
  {
5175
5182
  Object.defineProperty(el, '__vnode', {
5176
5183
  value: vnode,
@@ -6263,6 +6270,10 @@ function traverseStaticChildren(n1, n2, shallow = false) {
6263
6270
  if (!shallow)
6264
6271
  traverseStaticChildren(c1, c2);
6265
6272
  }
6273
+ // #6852 also inherit for text nodes
6274
+ if (c2.type === Text) {
6275
+ c2.el = c1.el;
6276
+ }
6266
6277
  // also inherit for comment nodes, but not placeholders (e.g. v-if which
6267
6278
  // would have received .el during block patch)
6268
6279
  if (c2.type === Comment && !c2.el) {
@@ -6433,6 +6444,7 @@ const TeleportImpl = {
6433
6444
  }
6434
6445
  }
6435
6446
  }
6447
+ updateCssVars(n2);
6436
6448
  },
6437
6449
  remove(vnode, parentComponent, parentSuspense, optimized, { um: unmount, o: { remove: hostRemove } }, doRemove) {
6438
6450
  const { shapeFlag, children, anchor, targetAnchor, target, props } = vnode;
@@ -6511,11 +6523,26 @@ function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScope
6511
6523
  hydrateChildren(targetNode, vnode, target, parentComponent, parentSuspense, slotScopeIds, optimized);
6512
6524
  }
6513
6525
  }
6526
+ updateCssVars(vnode);
6514
6527
  }
6515
6528
  return vnode.anchor && nextSibling(vnode.anchor);
6516
6529
  }
6517
6530
  // Force-casted public typing for h and TSX props inference
6518
6531
  const Teleport = TeleportImpl;
6532
+ function updateCssVars(vnode) {
6533
+ // presence of .ut method indicates owner component uses css vars.
6534
+ // code path here can assume browser environment.
6535
+ const ctx = vnode.ctx;
6536
+ if (ctx && ctx.ut) {
6537
+ let node = vnode.children[0].el;
6538
+ while (node !== vnode.targetAnchor) {
6539
+ if (node.nodeType === 1)
6540
+ node.setAttribute('data-v-owner', ctx.uid);
6541
+ node = node.nextSibling;
6542
+ }
6543
+ ctx.ut();
6544
+ }
6545
+ }
6519
6546
 
6520
6547
  const Fragment = Symbol('Fragment' );
6521
6548
  const Text = Symbol('Text' );
@@ -6610,6 +6637,10 @@ function isVNode(value) {
6610
6637
  function isSameVNodeType(n1, n2) {
6611
6638
  if (n2.shapeFlag & 6 /* ShapeFlags.COMPONENT */ &&
6612
6639
  hmrDirtyComponents.has(n2.type)) {
6640
+ // #7042, ensure the vnode being unmounted during HMR
6641
+ // bitwise operations to remove keep alive flags
6642
+ n1.shapeFlag &= ~256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */;
6643
+ n2.shapeFlag &= ~512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */;
6613
6644
  // HMR only: if the component has been hot-updated, force a reload.
6614
6645
  return false;
6615
6646
  }
@@ -6665,7 +6696,8 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
6665
6696
  patchFlag,
6666
6697
  dynamicProps,
6667
6698
  dynamicChildren: null,
6668
- appContext: null
6699
+ appContext: null,
6700
+ ctx: currentRenderingInstance
6669
6701
  };
6670
6702
  if (needFullChildrenNormalization) {
6671
6703
  normalizeChildren(vnode, children);
@@ -6832,7 +6864,9 @@ function cloneVNode(vnode, extraProps, mergeRef = false) {
6832
6864
  ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
6833
6865
  ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
6834
6866
  el: vnode.el,
6835
- anchor: vnode.anchor
6867
+ anchor: vnode.anchor,
6868
+ ctx: vnode.ctx,
6869
+ ce: vnode.ce
6836
6870
  };
6837
6871
  return cloned;
6838
6872
  }
@@ -6999,13 +7033,13 @@ function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
6999
7033
  }
7000
7034
 
7001
7035
  const emptyAppContext = createAppContext();
7002
- let uid$1 = 0;
7036
+ let uid = 0;
7003
7037
  function createComponentInstance(vnode, parent, suspense) {
7004
7038
  const type = vnode.type;
7005
7039
  // inherit parent app context - or - if root, adopt from root vnode
7006
7040
  const appContext = (parent ? parent.appContext : vnode.appContext) || emptyAppContext;
7007
7041
  const instance = {
7008
- uid: uid$1++,
7042
+ uid: uid++,
7009
7043
  vnode,
7010
7044
  type,
7011
7045
  parent,
@@ -7075,7 +7109,7 @@ function createComponentInstance(vnode, parent, suspense) {
7075
7109
  instance.ctx = createDevRenderContext(instance);
7076
7110
  }
7077
7111
  instance.root = parent ? parent.root : instance;
7078
- instance.emit = emit$1.bind(null, instance);
7112
+ instance.emit = emit.bind(null, instance);
7079
7113
  // apply custom element special handling
7080
7114
  if (vnode.ce) {
7081
7115
  vnode.ce(instance);
@@ -7315,8 +7349,24 @@ function createAttrsProxy(instance) {
7315
7349
  }
7316
7350
  function createSetupContext(instance) {
7317
7351
  const expose = exposed => {
7318
- if (instance.exposed) {
7319
- warn(`expose() should be called only once per setup().`);
7352
+ {
7353
+ if (instance.exposed) {
7354
+ warn(`expose() should be called only once per setup().`);
7355
+ }
7356
+ if (exposed != null) {
7357
+ let exposedType = typeof exposed;
7358
+ if (exposedType === 'object') {
7359
+ if (shared.isArray(exposed)) {
7360
+ exposedType = 'array';
7361
+ }
7362
+ else if (reactivity.isRef(exposed)) {
7363
+ exposedType = 'ref';
7364
+ }
7365
+ }
7366
+ if (exposedType !== 'object') {
7367
+ warn(`expose() should be passed a plain object, received ${exposedType}.`);
7368
+ }
7369
+ }
7320
7370
  }
7321
7371
  instance.exposed = exposed || {};
7322
7372
  };
@@ -7809,7 +7859,7 @@ function isMemoSame(cached, memo) {
7809
7859
  }
7810
7860
 
7811
7861
  // Core API ------------------------------------------------------------------
7812
- const version = "3.2.44";
7862
+ const version = "3.2.46";
7813
7863
  const _ssrUtils = {
7814
7864
  createComponentInstance,
7815
7865
  setupComponent,
@@ -7873,6 +7923,7 @@ exports.Static = Static;
7873
7923
  exports.Suspense = Suspense;
7874
7924
  exports.Teleport = Teleport;
7875
7925
  exports.Text = Text;
7926
+ exports.assertNumber = assertNumber;
7876
7927
  exports.callWithAsyncErrorHandling = callWithAsyncErrorHandling;
7877
7928
  exports.callWithErrorHandling = callWithErrorHandling;
7878
7929
  exports.cloneVNode = cloneVNode;