@vue/runtime-core 3.3.8 → 3.3.9

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.
@@ -813,9 +813,19 @@ function renderComponentRoot(instance) {
813
813
  try {
814
814
  if (vnode.shapeFlag & 4) {
815
815
  const proxyToUse = withProxy || proxy;
816
+ const thisProxy = setupState.__isScriptSetup ? new Proxy(proxyToUse, {
817
+ get(target, key, receiver) {
818
+ warn(
819
+ `Property '${String(
820
+ key
821
+ )}' was accessed via 'this'. Avoid using 'this' in templates.`
822
+ );
823
+ return Reflect.get(target, key, receiver);
824
+ }
825
+ }) : proxyToUse;
816
826
  result = normalizeVNode(
817
827
  render.call(
818
- proxyToUse,
828
+ thisProxy,
819
829
  proxyToUse,
820
830
  renderCache,
821
831
  props,
@@ -1777,6 +1787,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
1777
1787
  let onCleanup = (fn) => {
1778
1788
  cleanup = effect.onStop = () => {
1779
1789
  callWithErrorHandling(fn, instance, 4);
1790
+ cleanup = effect.onStop = void 0;
1780
1791
  };
1781
1792
  };
1782
1793
  let ssrCleanup;
@@ -2268,7 +2279,11 @@ function emptyPlaceholder(vnode) {
2268
2279
  }
2269
2280
  }
2270
2281
  function getKeepAliveChild(vnode) {
2271
- return isKeepAlive(vnode) ? vnode.children ? vnode.children[0] : void 0 : vnode;
2282
+ return isKeepAlive(vnode) ? (
2283
+ // #7121 ensure get the child component subtree in case
2284
+ // it's been replaced during HMR
2285
+ vnode.component ? vnode.component.subTree : vnode.children ? vnode.children[0] : void 0
2286
+ ) : vnode;
2272
2287
  }
2273
2288
  function setTransitionHooks(vnode, hooks) {
2274
2289
  if (vnode.shapeFlag & 6 && vnode.component) {
@@ -4267,6 +4282,9 @@ function assertType(value, type) {
4267
4282
  };
4268
4283
  }
4269
4284
  function getInvalidTypeMessage(name, value, expectedTypes) {
4285
+ if (expectedTypes.length === 0) {
4286
+ return `Prop type [] for prop "${name}" won't match anything. Did you mean to use type Array instead?`;
4287
+ }
4270
4288
  let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(shared.capitalize).join(" | ")}`;
4271
4289
  const expectedType = expectedTypes[0];
4272
4290
  const receivedType = shared.toRawType(value);
@@ -4536,6 +4554,20 @@ function createHydrationFunctions(rendererInternals) {
4536
4554
  const { type, ref, shapeFlag, patchFlag } = vnode;
4537
4555
  let domType = node.nodeType;
4538
4556
  vnode.el = node;
4557
+ {
4558
+ if (!("__vnode" in node)) {
4559
+ Object.defineProperty(node, "__vnode", {
4560
+ value: vnode,
4561
+ enumerable: false
4562
+ });
4563
+ }
4564
+ if (!("__vueParentComponent" in node)) {
4565
+ Object.defineProperty(node, "__vueParentComponent", {
4566
+ value: parentComponent,
4567
+ enumerable: false
4568
+ });
4569
+ }
4570
+ }
4539
4571
  if (patchFlag === -2) {
4540
4572
  optimized = false;
4541
4573
  vnode.dynamicChildren = null;
@@ -4697,15 +4729,16 @@ function createHydrationFunctions(rendererInternals) {
4697
4729
  const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
4698
4730
  optimized = optimized || !!vnode.dynamicChildren;
4699
4731
  const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
4700
- const forcePatchValue = type === "input" && dirs || type === "option";
4732
+ const forcePatch = type === "input" || type === "option";
4701
4733
  {
4702
4734
  if (dirs) {
4703
4735
  invokeDirectiveHook(vnode, null, parentComponent, "created");
4704
4736
  }
4705
4737
  if (props) {
4706
- if (forcePatchValue || !optimized || patchFlag & (16 | 32)) {
4738
+ if (forcePatch || !optimized || patchFlag & (16 | 32)) {
4707
4739
  for (const key in props) {
4708
- if (forcePatchValue && key.endsWith("value") || shared.isOn(key) && !shared.isReservedProp(key)) {
4740
+ if (forcePatch && (key.endsWith("value") || key === "indeterminate") || shared.isOn(key) && !shared.isReservedProp(key) || // force hydrate v-bind with .prop modifiers
4741
+ key[0] === ".") {
4709
4742
  patchProp(
4710
4743
  el,
4711
4744
  key,
@@ -6462,6 +6495,7 @@ const resolveTarget = (props, select) => {
6462
6495
  }
6463
6496
  };
6464
6497
  const TeleportImpl = {
6498
+ name: "Teleport",
6465
6499
  __isTeleport: true,
6466
6500
  process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals) {
6467
6501
  const {
@@ -6883,7 +6917,7 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
6883
6917
  if (shapeFlag & 4 && reactivity.isProxy(type)) {
6884
6918
  type = reactivity.toRaw(type);
6885
6919
  warn(
6886
- `Vue received a Component which was made a reactive object. This can lead to unnecessary performance overhead, and should be avoided by marking the component with \`markRaw\` or using \`shallowRef\` instead of \`ref\`.`,
6920
+ `Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with \`markRaw\` or using \`shallowRef\` instead of \`ref\`.`,
6887
6921
  `
6888
6922
  Component that was made reactive: `,
6889
6923
  type
@@ -7720,7 +7754,7 @@ function isMemoSame(cached, memo) {
7720
7754
  return true;
7721
7755
  }
7722
7756
 
7723
- const version = "3.3.8";
7757
+ const version = "3.3.9";
7724
7758
  const _ssrUtils = {
7725
7759
  createComponentInstance,
7726
7760
  setupComponent,
@@ -400,9 +400,19 @@ function renderComponentRoot(instance) {
400
400
  try {
401
401
  if (vnode.shapeFlag & 4) {
402
402
  const proxyToUse = withProxy || proxy;
403
+ const thisProxy = false ? new Proxy(proxyToUse, {
404
+ get(target, key, receiver) {
405
+ warn(
406
+ `Property '${String(
407
+ key
408
+ )}' was accessed via 'this'. Avoid using 'this' in templates.`
409
+ );
410
+ return Reflect.get(target, key, receiver);
411
+ }
412
+ }) : proxyToUse;
403
413
  result = normalizeVNode(
404
414
  render.call(
405
- proxyToUse,
415
+ thisProxy,
406
416
  proxyToUse,
407
417
  renderCache,
408
418
  props,
@@ -1228,6 +1238,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
1228
1238
  let onCleanup = (fn) => {
1229
1239
  cleanup = effect.onStop = () => {
1230
1240
  callWithErrorHandling(fn, instance, 4);
1241
+ cleanup = effect.onStop = void 0;
1231
1242
  };
1232
1243
  };
1233
1244
  let ssrCleanup;
@@ -1699,7 +1710,11 @@ function emptyPlaceholder(vnode) {
1699
1710
  }
1700
1711
  }
1701
1712
  function getKeepAliveChild(vnode) {
1702
- return isKeepAlive(vnode) ? vnode.children ? vnode.children[0] : void 0 : vnode;
1713
+ return isKeepAlive(vnode) ? (
1714
+ // #7121 ensure get the child component subtree in case
1715
+ // it's been replaced during HMR
1716
+ vnode.children ? vnode.children[0] : void 0
1717
+ ) : vnode;
1703
1718
  }
1704
1719
  function setTransitionHooks(vnode, hooks) {
1705
1720
  if (vnode.shapeFlag & 6 && vnode.component) {
@@ -3627,15 +3642,16 @@ function createHydrationFunctions(rendererInternals) {
3627
3642
  const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
3628
3643
  optimized = optimized || !!vnode.dynamicChildren;
3629
3644
  const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
3630
- const forcePatchValue = type === "input" && dirs || type === "option";
3631
- if (forcePatchValue || patchFlag !== -1) {
3645
+ const forcePatch = type === "input" || type === "option";
3646
+ if (forcePatch || patchFlag !== -1) {
3632
3647
  if (dirs) {
3633
3648
  invokeDirectiveHook(vnode, null, parentComponent, "created");
3634
3649
  }
3635
3650
  if (props) {
3636
- if (forcePatchValue || !optimized || patchFlag & (16 | 32)) {
3651
+ if (forcePatch || !optimized || patchFlag & (16 | 32)) {
3637
3652
  for (const key in props) {
3638
- if (forcePatchValue && key.endsWith("value") || shared.isOn(key) && !shared.isReservedProp(key)) {
3653
+ if (forcePatch && (key.endsWith("value") || key === "indeterminate") || shared.isOn(key) && !shared.isReservedProp(key) || // force hydrate v-bind with .prop modifiers
3654
+ key[0] === ".") {
3639
3655
  patchProp(
3640
3656
  el,
3641
3657
  key,
@@ -5173,6 +5189,7 @@ const resolveTarget = (props, select) => {
5173
5189
  }
5174
5190
  };
5175
5191
  const TeleportImpl = {
5192
+ name: "Teleport",
5176
5193
  __isTeleport: true,
5177
5194
  process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals) {
5178
5195
  const {
@@ -6069,7 +6086,7 @@ function isMemoSame(cached, memo) {
6069
6086
  return true;
6070
6087
  }
6071
6088
 
6072
- const version = "3.3.8";
6089
+ const version = "3.3.9";
6073
6090
  const _ssrUtils = {
6074
6091
  createComponentInstance,
6075
6092
  setupComponent,
@@ -126,7 +126,7 @@ C extends ComputedOptions = {}, M extends MethodOptions = {}, E extends EmitsOpt
126
126
  $forceUpdate: () => void;
127
127
  $nextTick: typeof nextTick;
128
128
  $watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R]) => any : (...args: any) => any, options?: WatchOptions): WatchStopHandle;
129
- } & P & ShallowUnwrapRef<B> & UnwrapNestedRefs<D> & ExtractComputedReturns<C> & M & ComponentCustomProperties & InjectToObject<I>;
129
+ } & IfAny<P, P, Omit<P, keyof ShallowUnwrapRef<B>>> & ShallowUnwrapRef<B> & UnwrapNestedRefs<D> & ExtractComputedReturns<C> & M & ComponentCustomProperties & InjectToObject<I>;
130
130
 
131
131
  declare const enum LifecycleHooks {
132
132
  BEFORE_CREATE = "bc",
@@ -737,6 +737,25 @@ export declare function inject<T>(key: InjectionKey<T> | string, defaultValue: T
737
737
  */
738
738
  export declare function hasInjectionContext(): boolean;
739
739
 
740
+ type PublicProps = VNodeProps & AllowedComponentProps & ComponentCustomProps;
741
+ type ResolveProps<PropsOrPropOptions, E extends EmitsOptions> = Readonly<PropsOrPropOptions extends ComponentPropsOptions ? ExtractPropTypes<PropsOrPropOptions> : PropsOrPropOptions> & ({} extends E ? {} : EmitsToProps<E>);
742
+ export type DefineComponent<PropsOrPropOptions = {}, RawBindings = {}, D = {}, C extends ComputedOptions = ComputedOptions, M extends MethodOptions = MethodOptions, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = {}, EE extends string = string, PP = PublicProps, Props = ResolveProps<PropsOrPropOptions, E>, Defaults = ExtractDefaultPropTypes<PropsOrPropOptions>, S extends SlotsType = {}> = ComponentPublicInstanceConstructor<CreateComponentPublicInstance<Props, RawBindings, D, C, M, Mixin, Extends, E, PP & Props, Defaults, true, {}, S>> & ComponentOptionsBase<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, Defaults, {}, string, S> & PP;
743
+ export declare function defineComponent<Props extends Record<string, any>, E extends EmitsOptions = {}, EE extends string = string, S extends SlotsType = {}>(setup: (props: Props, ctx: SetupContext<E, S>) => RenderFunction | Promise<RenderFunction>, options?: Pick<ComponentOptions, 'name' | 'inheritAttrs'> & {
744
+ props?: (keyof Props)[];
745
+ emits?: E | EE[];
746
+ slots?: S;
747
+ }): (props: Props & EmitsToProps<E>) => any;
748
+ export declare function defineComponent<Props extends Record<string, any>, E extends EmitsOptions = {}, EE extends string = string, S extends SlotsType = {}>(setup: (props: Props, ctx: SetupContext<E, S>) => RenderFunction | Promise<RenderFunction>, options?: Pick<ComponentOptions, 'name' | 'inheritAttrs'> & {
749
+ props?: ComponentObjectPropsOptions<Props>;
750
+ emits?: E | EE[];
751
+ slots?: S;
752
+ }): (props: Props & EmitsToProps<E>) => any;
753
+ export declare function defineComponent<Props = {}, RawBindings = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = {}, EE extends string = string, S extends SlotsType = {}, I extends ComponentInjectOptions = {}, II extends string = string>(options: ComponentOptionsWithoutProps<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, I, II, S>): DefineComponent<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, PublicProps, ResolveProps<Props, E>, ExtractDefaultPropTypes<Props>, S>;
754
+ export declare function defineComponent<PropNames extends string, RawBindings, D, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = {}, EE extends string = string, S extends SlotsType = {}, I extends ComponentInjectOptions = {}, II extends string = string, Props = Readonly<{
755
+ [key in PropNames]?: any;
756
+ }>>(options: ComponentOptionsWithArrayProps<PropNames, RawBindings, D, C, M, Mixin, Extends, E, EE, I, II, S>): DefineComponent<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, PublicProps, ResolveProps<Props, E>, ExtractDefaultPropTypes<Props>, S>;
757
+ export declare function defineComponent<PropsOptions extends Readonly<ComponentPropsOptions>, RawBindings, D, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = {}, EE extends string = string, S extends SlotsType = {}, I extends ComponentInjectOptions = {}, II extends string = string>(options: ComponentOptionsWithObjectProps<PropsOptions, RawBindings, D, C, M, Mixin, Extends, E, EE, I, II, S>): DefineComponent<PropsOptions, RawBindings, D, C, M, Mixin, Extends, E, EE, PublicProps, ResolveProps<PropsOptions, E>, ExtractDefaultPropTypes<PropsOptions>, S>;
758
+
740
759
  export interface App<HostElement = any> {
741
760
  version: string;
742
761
  config: AppConfig;
@@ -744,7 +763,7 @@ export interface App<HostElement = any> {
744
763
  use<Options>(plugin: Plugin<Options>, options: Options): this;
745
764
  mixin(mixin: ComponentOptions): this;
746
765
  component(name: string): Component | undefined;
747
- component(name: string, component: Component): this;
766
+ component(name: string, component: Component | DefineComponent): this;
748
767
  directive(name: string): Directive | undefined;
749
768
  directive(name: string, directive: Directive): this;
750
769
  mount(rootContainer: HostElement | string, isHydrate?: boolean, isSVG?: boolean): ComponentPublicInstance;
@@ -814,6 +833,7 @@ export interface TeleportProps {
814
833
  disabled?: boolean;
815
834
  }
816
835
  declare const TeleportImpl: {
836
+ name: string;
817
837
  __isTeleport: boolean;
818
838
  process(n1: TeleportVNode | null, n2: TeleportVNode, container: RendererElement, anchor: RendererNode | null, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, isSVG: boolean, slotScopeIds: string[] | null, optimized: boolean, internals: RendererInternals): void;
819
839
  remove(vnode: VNode, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, optimized: boolean, { um: unmount, o: { remove: hostRemove } }: RendererInternals, doRemove: boolean): void;
@@ -883,7 +903,7 @@ export type VNodeProps = {
883
903
  onVnodeBeforeUnmount?: VNodeMountHook | VNodeMountHook[];
884
904
  onVnodeUnmounted?: VNodeMountHook | VNodeMountHook[];
885
905
  };
886
- type VNodeChildAtom = VNode | typeof NULL_DYNAMIC_COMPONENT | string | number | boolean | null | undefined | void;
906
+ type VNodeChildAtom = VNode | string | number | boolean | null | undefined | void;
887
907
  export type VNodeArrayChildren = Array<VNodeArrayChildren | VNodeChildAtom>;
888
908
  export type VNodeChild = VNodeChildAtom | VNodeArrayChildren;
889
909
  export type VNodeNormalizedChildren = string | VNodeArrayChildren | RawSlots | null;
@@ -1123,25 +1143,6 @@ export declare function watch<T extends Readonly<MultiWatchSources>, Immediate e
1123
1143
  export declare function watch<T, Immediate extends Readonly<boolean> = false>(source: WatchSource<T>, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchOptions<Immediate>): WatchStopHandle;
1124
1144
  export declare function watch<T extends object, Immediate extends Readonly<boolean> = false>(source: T, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchOptions<Immediate>): WatchStopHandle;
1125
1145
 
1126
- type PublicProps = VNodeProps & AllowedComponentProps & ComponentCustomProps;
1127
- type ResolveProps<PropsOrPropOptions, E extends EmitsOptions> = Readonly<PropsOrPropOptions extends ComponentPropsOptions ? ExtractPropTypes<PropsOrPropOptions> : PropsOrPropOptions> & ({} extends E ? {} : EmitsToProps<E>);
1128
- export type DefineComponent<PropsOrPropOptions = {}, RawBindings = {}, D = {}, C extends ComputedOptions = ComputedOptions, M extends MethodOptions = MethodOptions, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = {}, EE extends string = string, PP = PublicProps, Props = ResolveProps<PropsOrPropOptions, E>, Defaults = ExtractDefaultPropTypes<PropsOrPropOptions>, S extends SlotsType = {}> = ComponentPublicInstanceConstructor<CreateComponentPublicInstance<Props, RawBindings, D, C, M, Mixin, Extends, E, PP & Props, Defaults, true, {}, S> & Props> & ComponentOptionsBase<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, Defaults, {}, string, S> & PP;
1129
- export declare function defineComponent<Props extends Record<string, any>, E extends EmitsOptions = {}, EE extends string = string, S extends SlotsType = {}>(setup: (props: Props, ctx: SetupContext<E, S>) => RenderFunction | Promise<RenderFunction>, options?: Pick<ComponentOptions, 'name' | 'inheritAttrs'> & {
1130
- props?: (keyof Props)[];
1131
- emits?: E | EE[];
1132
- slots?: S;
1133
- }): (props: Props & EmitsToProps<E>) => any;
1134
- export declare function defineComponent<Props extends Record<string, any>, E extends EmitsOptions = {}, EE extends string = string, S extends SlotsType = {}>(setup: (props: Props, ctx: SetupContext<E, S>) => RenderFunction | Promise<RenderFunction>, options?: Pick<ComponentOptions, 'name' | 'inheritAttrs'> & {
1135
- props?: ComponentObjectPropsOptions<Props>;
1136
- emits?: E | EE[];
1137
- slots?: S;
1138
- }): (props: Props & EmitsToProps<E>) => any;
1139
- export declare function defineComponent<Props = {}, RawBindings = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = {}, EE extends string = string, S extends SlotsType = {}, I extends ComponentInjectOptions = {}, II extends string = string>(options: ComponentOptionsWithoutProps<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, I, II, S>): DefineComponent<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, PublicProps, ResolveProps<Props, E>, ExtractDefaultPropTypes<Props>, S>;
1140
- export declare function defineComponent<PropNames extends string, RawBindings, D, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = {}, EE extends string = string, S extends SlotsType = {}, I extends ComponentInjectOptions = {}, II extends string = string, Props = Readonly<{
1141
- [key in PropNames]?: any;
1142
- }>>(options: ComponentOptionsWithArrayProps<PropNames, RawBindings, D, C, M, Mixin, Extends, E, EE, I, II, S>): DefineComponent<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, PublicProps, ResolveProps<Props, E>, ExtractDefaultPropTypes<Props>, S>;
1143
- export declare function defineComponent<PropsOptions extends Readonly<ComponentPropsOptions>, RawBindings, D, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = {}, EE extends string = string, S extends SlotsType = {}, I extends ComponentInjectOptions = {}, II extends string = string>(options: ComponentOptionsWithObjectProps<PropsOptions, RawBindings, D, C, M, Mixin, Extends, E, EE, I, II, S>): DefineComponent<PropsOptions, RawBindings, D, C, M, Mixin, Extends, E, EE, PublicProps, ResolveProps<PropsOptions, E>, ExtractDefaultPropTypes<PropsOptions>, S>;
1144
-
1145
1146
  type AsyncComponentResolveResult<T = Component> = T | {
1146
1147
  default: T;
1147
1148
  };
@@ -1196,7 +1197,7 @@ export declare function defineProps<PropNames extends string = string>(props: Pr
1196
1197
  [key in PropNames]?: any;
1197
1198
  }>>;
1198
1199
  export declare function defineProps<PP extends ComponentObjectPropsOptions = ComponentObjectPropsOptions>(props: PP): Prettify<Readonly<ExtractPropTypes<PP>>>;
1199
- export declare function defineProps<TypeProps>(): DefineProps<TypeProps, BooleanKey<TypeProps>>;
1200
+ export declare function defineProps<TypeProps>(): DefineProps<LooseRequired<TypeProps>, BooleanKey<TypeProps>>;
1200
1201
  type DefineProps<T, BKeys extends keyof T> = Readonly<T> & {
1201
1202
  readonly [K in BKeys]-?: boolean;
1202
1203
  };
@@ -1319,8 +1320,8 @@ type InferDefaults<T> = {
1319
1320
  };
1320
1321
  type NativeType = null | number | string | boolean | symbol | Function;
1321
1322
  type InferDefault<P, T> = ((props: P) => T & {}) | (T extends NativeType ? T : never);
1322
- type PropsWithDefaults<T, Defaults extends InferDefaults<T>, BKeys extends keyof T> = Omit<T, keyof Defaults> & {
1323
- [K in keyof Defaults]-?: K extends keyof T ? Defaults[K] extends undefined ? T[K] : NotUndefined<T[K]> : never;
1323
+ type PropsWithDefaults<T, Defaults extends InferDefaults<T>, BKeys extends keyof T> = Readonly<Omit<T, keyof Defaults>> & {
1324
+ readonly [K in keyof Defaults]-?: K extends keyof T ? Defaults[K] extends undefined ? T[K] : NotUndefined<T[K]> : never;
1324
1325
  } & {
1325
1326
  readonly [K in BKeys]-?: K extends keyof Defaults ? Defaults[K] extends undefined ? boolean | undefined : boolean : boolean;
1326
1327
  };
@@ -817,9 +817,19 @@ function renderComponentRoot(instance) {
817
817
  try {
818
818
  if (vnode.shapeFlag & 4) {
819
819
  const proxyToUse = withProxy || proxy;
820
+ const thisProxy = !!(process.env.NODE_ENV !== "production") && setupState.__isScriptSetup ? new Proxy(proxyToUse, {
821
+ get(target, key, receiver) {
822
+ warn(
823
+ `Property '${String(
824
+ key
825
+ )}' was accessed via 'this'. Avoid using 'this' in templates.`
826
+ );
827
+ return Reflect.get(target, key, receiver);
828
+ }
829
+ }) : proxyToUse;
820
830
  result = normalizeVNode(
821
831
  render.call(
822
- proxyToUse,
832
+ thisProxy,
823
833
  proxyToUse,
824
834
  renderCache,
825
835
  props,
@@ -1781,6 +1791,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
1781
1791
  let onCleanup = (fn) => {
1782
1792
  cleanup = effect.onStop = () => {
1783
1793
  callWithErrorHandling(fn, instance, 4);
1794
+ cleanup = effect.onStop = void 0;
1784
1795
  };
1785
1796
  };
1786
1797
  let ssrCleanup;
@@ -2274,7 +2285,11 @@ function emptyPlaceholder(vnode) {
2274
2285
  }
2275
2286
  }
2276
2287
  function getKeepAliveChild(vnode) {
2277
- return isKeepAlive(vnode) ? vnode.children ? vnode.children[0] : void 0 : vnode;
2288
+ return isKeepAlive(vnode) ? (
2289
+ // #7121 ensure get the child component subtree in case
2290
+ // it's been replaced during HMR
2291
+ !!(process.env.NODE_ENV !== "production") && vnode.component ? vnode.component.subTree : vnode.children ? vnode.children[0] : void 0
2292
+ ) : vnode;
2278
2293
  }
2279
2294
  function setTransitionHooks(vnode, hooks) {
2280
2295
  if (vnode.shapeFlag & 6 && vnode.component) {
@@ -4277,6 +4292,9 @@ function assertType(value, type) {
4277
4292
  };
4278
4293
  }
4279
4294
  function getInvalidTypeMessage(name, value, expectedTypes) {
4295
+ if (expectedTypes.length === 0) {
4296
+ return `Prop type [] for prop "${name}" won't match anything. Did you mean to use type Array instead?`;
4297
+ }
4280
4298
  let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
4281
4299
  const expectedType = expectedTypes[0];
4282
4300
  const receivedType = toRawType(value);
@@ -4546,6 +4564,20 @@ function createHydrationFunctions(rendererInternals) {
4546
4564
  const { type, ref, shapeFlag, patchFlag } = vnode;
4547
4565
  let domType = node.nodeType;
4548
4566
  vnode.el = node;
4567
+ if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
4568
+ if (!("__vnode" in node)) {
4569
+ Object.defineProperty(node, "__vnode", {
4570
+ value: vnode,
4571
+ enumerable: false
4572
+ });
4573
+ }
4574
+ if (!("__vueParentComponent" in node)) {
4575
+ Object.defineProperty(node, "__vueParentComponent", {
4576
+ value: parentComponent,
4577
+ enumerable: false
4578
+ });
4579
+ }
4580
+ }
4549
4581
  if (patchFlag === -2) {
4550
4582
  optimized = false;
4551
4583
  vnode.dynamicChildren = null;
@@ -4707,15 +4739,16 @@ function createHydrationFunctions(rendererInternals) {
4707
4739
  const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
4708
4740
  optimized = optimized || !!vnode.dynamicChildren;
4709
4741
  const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
4710
- const forcePatchValue = type === "input" && dirs || type === "option";
4711
- if (!!(process.env.NODE_ENV !== "production") || forcePatchValue || patchFlag !== -1) {
4742
+ const forcePatch = type === "input" || type === "option";
4743
+ if (!!(process.env.NODE_ENV !== "production") || forcePatch || patchFlag !== -1) {
4712
4744
  if (dirs) {
4713
4745
  invokeDirectiveHook(vnode, null, parentComponent, "created");
4714
4746
  }
4715
4747
  if (props) {
4716
- if (forcePatchValue || !optimized || patchFlag & (16 | 32)) {
4748
+ if (forcePatch || !optimized || patchFlag & (16 | 32)) {
4717
4749
  for (const key in props) {
4718
- if (forcePatchValue && key.endsWith("value") || isOn(key) && !isReservedProp(key)) {
4750
+ if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
4751
+ key[0] === ".") {
4719
4752
  patchProp(
4720
4753
  el,
4721
4754
  key,
@@ -6506,6 +6539,7 @@ const resolveTarget = (props, select) => {
6506
6539
  }
6507
6540
  };
6508
6541
  const TeleportImpl = {
6542
+ name: "Teleport",
6509
6543
  __isTeleport: true,
6510
6544
  process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals) {
6511
6545
  const {
@@ -6927,7 +6961,7 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
6927
6961
  if (!!(process.env.NODE_ENV !== "production") && shapeFlag & 4 && isProxy(type)) {
6928
6962
  type = toRaw(type);
6929
6963
  warn(
6930
- `Vue received a Component which was made a reactive object. This can lead to unnecessary performance overhead, and should be avoided by marking the component with \`markRaw\` or using \`shallowRef\` instead of \`ref\`.`,
6964
+ `Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with \`markRaw\` or using \`shallowRef\` instead of \`ref\`.`,
6931
6965
  `
6932
6966
  Component that was made reactive: `,
6933
6967
  type
@@ -7780,7 +7814,7 @@ function isMemoSame(cached, memo) {
7780
7814
  return true;
7781
7815
  }
7782
7816
 
7783
- const version = "3.3.8";
7817
+ const version = "3.3.9";
7784
7818
  const _ssrUtils = {
7785
7819
  createComponentInstance,
7786
7820
  setupComponent,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/runtime-core",
3
- "version": "3.3.8",
3
+ "version": "3.3.9",
4
4
  "description": "@vue/runtime-core",
5
5
  "main": "index.js",
6
6
  "module": "dist/runtime-core.esm-bundler.js",
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "homepage": "https://github.com/vuejs/core/tree/main/packages/runtime-core#readme",
34
34
  "dependencies": {
35
- "@vue/shared": "3.3.8",
36
- "@vue/reactivity": "3.3.8"
35
+ "@vue/shared": "3.3.9",
36
+ "@vue/reactivity": "3.3.9"
37
37
  }
38
38
  }