@vue/compat 3.6.0-beta.9 → 3.6.0-rc.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/README.md +2 -2
- package/dist/vue-compat.d.ts +25 -16
- package/dist/vue.cjs.js +459 -212
- package/dist/vue.cjs.prod.js +385 -164
- package/dist/vue.esm-browser.js +430 -204
- package/dist/vue.esm-browser.prod.js +6 -6
- package/dist/vue.esm-bundler.js +440 -208
- package/dist/vue.global.js +430 -204
- package/dist/vue.global.prod.js +6 -6
- package/dist/vue.runtime.esm-browser.js +430 -204
- package/dist/vue.runtime.esm-browser.prod.js +6 -6
- package/dist/vue.runtime.esm-bundler.js +440 -208
- package/dist/vue.runtime.global.js +430 -204
- package/dist/vue.runtime.global.prod.js +6 -6
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ While we've tried hard to make the migration build mimic Vue 2 behavior as much
|
|
|
18
18
|
|
|
19
19
|
- Internet Explorer 11 support: [Vue 3 has officially dropped the plan for IE11 support](https://github.com/vuejs/rfcs/blob/master/active-rfcs/0038-vue3-ie11-support.md). If you still need to support IE11 or below, you will have to stay on Vue 2.
|
|
20
20
|
|
|
21
|
-
- Server-side rendering: the migration build can be used for SSR, but migrating a custom SSR setup is much more involved. The general idea is replacing `vue-server-renderer` with [`@vue/server-renderer`](https://github.com/vuejs/core/tree/main/packages/server-renderer). Vue 3 no longer provides a bundle renderer and it is recommended to use Vue 3 SSR with [Vite](https://
|
|
21
|
+
- Server-side rendering: the migration build can be used for SSR, but migrating a custom SSR setup is much more involved. The general idea is replacing `vue-server-renderer` with [`@vue/server-renderer`](https://github.com/vuejs/core/tree/main/packages/server-renderer). Vue 3 no longer provides a bundle renderer and it is recommended to use Vue 3 SSR with [Vite](https://vite.dev/guide/ssr). If you are using [Nuxt.js](https://nuxtjs.org/), it is probably better to wait for Nuxt 3.
|
|
22
22
|
|
|
23
23
|
### Expectations
|
|
24
24
|
|
|
@@ -43,7 +43,7 @@ The following workflow walks through the steps of migrating an actual Vue 2 app
|
|
|
43
43
|
1. Upgrade tooling if applicable.
|
|
44
44
|
- If using custom webpack setup: Upgrade `vue-loader` to `^16.0.0`.
|
|
45
45
|
- If using `vue-cli`: upgrade to the latest `@vue/cli-service` with `vue upgrade`
|
|
46
|
-
- (Alternative) migrate to [Vite](https://
|
|
46
|
+
- (Alternative) migrate to [Vite](https://vite.dev/) + [vite-plugin-vue2](https://github.com/underfin/vite-plugin-vue2). [[Example commit](https://github.com/vuejs/vue-hackernews-2.0/commit/565b948919eb58f22a32afca7e321b490cb3b074)]
|
|
47
47
|
|
|
48
48
|
2. In `package.json`, update `vue` to 3.1, install `@vue/compat` of the same version, and replace `vue-template-compiler` (if present) with `@vue/compiler-sfc`:
|
|
49
49
|
|
package/dist/vue-compat.d.ts
CHANGED
|
@@ -227,7 +227,10 @@ type Reactive<T> = UnwrapNestedRefs<T> & (T extends readonly any[] ? ReactiveMar
|
|
|
227
227
|
* @see {@link https://vuejs.org/api/reactivity-core.html#reactive}
|
|
228
228
|
*/
|
|
229
229
|
declare function reactive<T extends object>(target: T): Reactive<T>;
|
|
230
|
-
declare
|
|
230
|
+
declare class ShallowReactiveBrandClass {
|
|
231
|
+
private __shallowReactiveBrand?;
|
|
232
|
+
}
|
|
233
|
+
type ShallowReactiveBrand = ShallowReactiveBrandClass;
|
|
231
234
|
type Primitive = string | number | boolean | bigint | symbol | undefined | null;
|
|
232
235
|
type Builtin = Primitive | Function | Date | Error | RegExp;
|
|
233
236
|
//#endregion
|
|
@@ -262,14 +265,12 @@ type ShallowRef<T = any, S = T> = Ref<T, S> & {
|
|
|
262
265
|
* ```
|
|
263
266
|
*/
|
|
264
267
|
interface RefUnwrapBailTypes {}
|
|
265
|
-
type ShallowUnwrapRef<T> = { [K in keyof T]: DistributeRef<T[K]> };
|
|
268
|
+
type ShallowUnwrapRef<T> = T extends ShallowReactiveBrand ? T : { [K in keyof T]: DistributeRef<T[K]> };
|
|
266
269
|
type DistributeRef<T> = T extends Ref<infer V, unknown> ? V : T;
|
|
267
270
|
type UnwrapRef<T> = T extends ShallowRef<infer V, unknown> ? V : T extends Ref<infer V, unknown> ? UnwrapRefSimple<V> : UnwrapRefSimple<T>;
|
|
268
271
|
type UnwrapRefSimple<T> = T extends Builtin | Ref | RefUnwrapBailTypes[keyof RefUnwrapBailTypes] | {
|
|
269
272
|
[RawSymbol]?: true;
|
|
270
|
-
} ? T : T extends Map<infer K, infer V> ? Map<K, UnwrapRefSimple<V>> & UnwrapRef<Omit<T, keyof Map<any, any>>> : T extends WeakMap<infer K, infer V> ? WeakMap<K, UnwrapRefSimple<V>> & UnwrapRef<Omit<T, keyof WeakMap<any, any>>> : T extends Set<infer V> ? Set<UnwrapRefSimple<V>> & UnwrapRef<Omit<T, keyof Set<any>>> : T extends WeakSet<infer V> ? WeakSet<UnwrapRefSimple<V>> & UnwrapRef<Omit<T, keyof WeakSet<any>>> : T extends ReadonlyArray<any> ? { [K in keyof T]: UnwrapRefSimple<T[K]> } : T extends object
|
|
271
|
-
[ShallowReactiveMarker]: never;
|
|
272
|
-
} ? T : T extends object ? { [P in keyof T]: P extends symbol ? T[P] : UnwrapRef<T[P]> } : T;
|
|
273
|
+
} ? T : T extends ShallowReactiveBrand ? T : T extends Map<infer K, infer V> ? Map<K, UnwrapRefSimple<V>> & UnwrapRef<Omit<T, keyof Map<any, any>>> : T extends WeakMap<infer K, infer V> ? WeakMap<K, UnwrapRefSimple<V>> & UnwrapRef<Omit<T, keyof WeakMap<any, any>>> : T extends Set<infer V> ? Set<UnwrapRefSimple<V>> & UnwrapRef<Omit<T, keyof Set<any>>> : T extends WeakSet<infer V> ? WeakSet<UnwrapRefSimple<V>> & UnwrapRef<Omit<T, keyof WeakSet<any>>> : T extends ReadonlyArray<any> ? { [K in keyof T]: UnwrapRefSimple<T[K]> } : T extends object ? { [P in keyof T]: P extends symbol ? T[P] : UnwrapRef<T[P]> } : T;
|
|
273
274
|
//#endregion
|
|
274
275
|
//#region packages/reactivity/src/watch.d.ts
|
|
275
276
|
type WatchCallback<V = any, OV = any> = (value: V, oldValue: OV, onCleanup: OnCleanup) => any;
|
|
@@ -435,9 +436,9 @@ type NormalizedPropsOptions = [NormalizedProps, string[]] | [];
|
|
|
435
436
|
type ComponentTypeEmits = ((...args: any[]) => any) | Record<string, any>;
|
|
436
437
|
//#endregion
|
|
437
438
|
//#region packages/runtime-core/src/componentEmits.d.ts
|
|
438
|
-
type ObjectEmitsOptions = Record<string, ((...args: any[]) => any) | null>;
|
|
439
|
+
type ObjectEmitsOptions = Record<string, ((...args: any[]) => any) | null | any[]>;
|
|
439
440
|
type EmitsOptions = ObjectEmitsOptions | string[];
|
|
440
|
-
type EmitsToProps<T extends EmitsOptions | ComponentTypeEmits> = T extends string[] ? { [K in `on${Capitalize<T[number]>}`]?: (...args: any[]) => any } : T extends ObjectEmitsOptions ? { [K in string & keyof T as `on${Capitalize<K>}`]?: (...args: T[K] extends ((...args: infer P) => any) ? P : T[K] extends null ? any[] : never) => any } : {};
|
|
441
|
+
type EmitsToProps<T extends EmitsOptions | ComponentTypeEmits> = T extends string[] ? { [K in `on${Capitalize<T[number]>}`]?: (...args: any[]) => any } : T extends ObjectEmitsOptions ? { [K in string & keyof T as `on${Capitalize<K>}`]?: (...args: T[K] extends ((...args: infer P) => any) ? P : T[K] extends null ? any[] : T[K] extends any[] ? T[K] : never) => any } : {};
|
|
441
442
|
type ShortEmitsToObject<E> = E extends Record<string, any[]> ? { [K in keyof E]: (...args: E[K]) => any } : E;
|
|
442
443
|
type EmitFn<Options = ObjectEmitsOptions, Event extends keyof Options = keyof Options> = Options extends Array<infer V> ? (event: V, ...args: any[]) => void : {} extends Options ? (event: string, ...args: any[]) => void : UnionToIntersection<{ [key in Event]: Options[key] extends ((...args: infer Args) => any) ? (event: key, ...args: Args) => void : Options[key] extends any[] ? (event: key, ...args: Options[key]) => void : (event: key, ...args: any[]) => void }[Event]>;
|
|
443
444
|
//#endregion
|
|
@@ -521,9 +522,9 @@ type ComponentPublicInstanceConstructor<T extends ComponentPublicInstance<Props,
|
|
|
521
522
|
* inference everywhere internally, but it has to be a new type to avoid
|
|
522
523
|
* breaking types that relies on previous arguments order (#10842)
|
|
523
524
|
*/
|
|
524
|
-
type CreateComponentPublicInstanceWithMixins<P = {}, B = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = {}, PublicProps = P, Defaults = {}, MakeDefaultsOptional extends boolean = false, I extends ComponentInjectOptions = {}, S extends SlotsType = {}, LC extends Record<string, Component> = {}, Directives extends Record<string, Directive> = {}, Exposed extends string = string, TypeRefs extends Data = {}, TypeEl
|
|
525
|
+
type CreateComponentPublicInstanceWithMixins<P = {}, B = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = {}, PublicProps = P, Defaults = {}, MakeDefaultsOptional extends boolean = false, I extends ComponentInjectOptions = {}, S extends SlotsType = {}, LC extends Record<string, Component> = {}, Directives extends Record<string, Directive> = {}, Exposed extends string = string, TypeRefs extends Data = {}, TypeEl = any, Provide extends ComponentProvideOptions = ComponentProvideOptions, PublicMixin = IntersectionMixin<Mixin> & IntersectionMixin<Extends>, PublicP = UnwrapMixinsType<PublicMixin, "P"> & EnsureNonVoid<P>, PublicB = UnwrapMixinsType<PublicMixin, "B"> & EnsureNonVoid<B>, PublicD = UnwrapMixinsType<PublicMixin, "D"> & EnsureNonVoid<D>, PublicC extends ComputedOptions = UnwrapMixinsType<PublicMixin, "C"> & EnsureNonVoid<C>, PublicM extends MethodOptions = UnwrapMixinsType<PublicMixin, "M"> & EnsureNonVoid<M>, PublicDefaults = UnwrapMixinsType<PublicMixin, "Defaults"> & EnsureNonVoid<Defaults>> = ComponentPublicInstance<PublicP, PublicB, PublicD, PublicC, PublicM, E, PublicProps, PublicDefaults, MakeDefaultsOptional, ComponentOptionsBase<P, B, D, C, M, Mixin, Extends, E, string, Defaults, {}, string, S, LC, Directives, Exposed, Provide>, I, S, Exposed, TypeRefs, TypeEl>;
|
|
525
526
|
type ExposedKeys<T, Exposed extends string & keyof T> = "" extends Exposed ? T : Pick<T, Exposed>;
|
|
526
|
-
type ComponentPublicInstance<P = {}, B = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, E extends EmitsOptions = {}, PublicProps = {}, Defaults = {}, MakeDefaultsOptional extends boolean = false, Options = ComponentOptionsBase<any, any, any, any, any, any, any, any, any>, I extends ComponentInjectOptions = {}, S extends SlotsType = {}, Exposed extends string = "", TypeRefs extends Data = {}, TypeEl
|
|
527
|
+
type ComponentPublicInstance<P = {}, B = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, E extends EmitsOptions = {}, PublicProps = {}, Defaults = {}, MakeDefaultsOptional extends boolean = false, Options = ComponentOptionsBase<any, any, any, any, any, any, any, any, any>, I extends ComponentInjectOptions = {}, S extends SlotsType = {}, Exposed extends string = "", TypeRefs extends Data = {}, TypeEl = any> = {
|
|
527
528
|
$: ComponentInternalInstance;
|
|
528
529
|
$data: D;
|
|
529
530
|
$props: MakeDefaultsOptional extends true ? Partial<Defaults> & Omit<Prettify<P> & PublicProps, keyof Defaults> : Prettify<P> & PublicProps;
|
|
@@ -928,7 +929,7 @@ type InjectionKey<T> = symbol & InjectionConstraint<T>;
|
|
|
928
929
|
//#region packages/runtime-core/src/apiDefineComponent.d.ts
|
|
929
930
|
type PublicProps = VNodeProps & AllowedComponentProps & ComponentCustomProps;
|
|
930
931
|
type ResolveProps<PropsOrPropOptions, E extends EmitsOptions> = Readonly<PropsOrPropOptions extends ComponentPropsOptions ? ExtractPropTypes<PropsOrPropOptions> : PropsOrPropOptions> & ({} extends E ? {} : EmitsToProps<E>);
|
|
931
|
-
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 = {}, LC extends Record<string, Component> = {}, Directives extends Record<string, Directive> = {}, Exposed extends string = string, Provide extends ComponentProvideOptions = ComponentProvideOptions, MakeDefaultsOptional extends boolean = true, TypeRefs extends Record<string, unknown> = {}, TypeEl
|
|
932
|
+
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 = {}, LC extends Record<string, Component> = {}, Directives extends Record<string, Directive> = {}, Exposed extends string = string, Provide extends ComponentProvideOptions = ComponentProvideOptions, MakeDefaultsOptional extends boolean = true, TypeRefs extends Record<string, unknown> = {}, TypeEl = any> = ComponentPublicInstanceConstructor<CreateComponentPublicInstanceWithMixins<Props, RawBindings, D, C, M, Mixin, Extends, E, PP, Defaults, MakeDefaultsOptional, {}, S, LC & GlobalComponents, Directives & GlobalDirectives, Exposed, TypeRefs, TypeEl>> & ComponentOptionsBase<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, Defaults, {}, string, S, LC & GlobalComponents, Directives & GlobalDirectives, Exposed, Provide> & PP;
|
|
932
933
|
//#endregion
|
|
933
934
|
//#region packages/runtime-core/src/apiCreateApp.d.ts
|
|
934
935
|
interface App<HostElement = any> {
|
|
@@ -1014,19 +1015,19 @@ interface AppConfig extends GenericAppConfig {
|
|
|
1014
1015
|
* The vapor in vdom implementation is in runtime-vapor/src/vdomInterop.ts
|
|
1015
1016
|
*/
|
|
1016
1017
|
interface VaporInteropInterface {
|
|
1017
|
-
mount(vnode: VNode, container: any, anchor: any, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, onBeforeMount?: () => void): GenericComponentInstance;
|
|
1018
|
-
update(n1: VNode, n2: VNode, shouldUpdate: boolean, onBeforeUpdate?: () => void): void;
|
|
1018
|
+
mount(vnode: VNode, container: any, anchor: any, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, onBeforeMount?: () => void, onVnodeBeforeMount?: () => void): GenericComponentInstance;
|
|
1019
|
+
update(n1: VNode, n2: VNode, shouldUpdate: boolean, onBeforeUpdate?: () => void, onVnodeBeforeUpdate?: () => void): void;
|
|
1019
1020
|
unmount(vnode: VNode, doRemove?: boolean): void;
|
|
1020
1021
|
move(vnode: VNode, container: any, anchor: any, moveType: MoveType): void;
|
|
1021
1022
|
slot(n1: VNode | null, n2: VNode, container: any, anchor: any, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null): void;
|
|
1022
|
-
hydrate(vnode: VNode, node: any, container: any, anchor: any, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null): Node;
|
|
1023
|
-
hydrateSlot(vnode: VNode, node: any): Node;
|
|
1023
|
+
hydrate(vnode: VNode, node: any, container: any, anchor: any, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, onBeforeMount?: () => void, onVnodeBeforeMount?: () => void): Node;
|
|
1024
|
+
hydrateSlot(vnode: VNode, node: any, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null): Node;
|
|
1024
1025
|
activate(vnode: VNode, container: any, anchor: any, parentComponent: ComponentInternalInstance): void;
|
|
1025
1026
|
deactivate(vnode: VNode, container: any): void;
|
|
1026
1027
|
setTransitionHooks(component: ComponentInternalInstance, transition: TransitionHooks): void;
|
|
1027
|
-
vdomMount: (component: ConcreteComponent, parentComponent: any, props?: any, slots?: any) => any;
|
|
1028
|
+
vdomMount: (component: ConcreteComponent, parentComponent: any, props?: any, slots?: any, once?: boolean) => any;
|
|
1028
1029
|
vdomUnmount: UnmountComponentFn;
|
|
1029
|
-
vdomSlot: (slots: any, name: string | (() => string), props: Record<string, any>, parentComponent: any, fallback?: any) => any;
|
|
1030
|
+
vdomSlot: (slots: any, name: string | (() => string), props: Record<string, any>, parentComponent: any, fallback?: any, once?: boolean, slotRoot?: boolean) => any;
|
|
1030
1031
|
vdomMountVNode: (vnode: VNode, parentComponent: any) => any;
|
|
1031
1032
|
}
|
|
1032
1033
|
/**
|
|
@@ -1278,7 +1279,10 @@ interface VNode<HostNode = RendererNode, HostElement = RendererElement, ExtraPro
|
|
|
1278
1279
|
vs?: {
|
|
1279
1280
|
slot: (props: any) => any;
|
|
1280
1281
|
fallback: (() => VNodeArrayChildren) | undefined;
|
|
1282
|
+
outletFallback?: (() => VNodeArrayChildren) | undefined;
|
|
1283
|
+
state?: unknown;
|
|
1281
1284
|
ref?: ShallowRef<any>;
|
|
1285
|
+
scope?: EffectScope;
|
|
1282
1286
|
};
|
|
1283
1287
|
/**
|
|
1284
1288
|
* @internal Vapor slot Block
|
|
@@ -1549,6 +1553,11 @@ interface GenericComponentInstance {
|
|
|
1549
1553
|
*/
|
|
1550
1554
|
asyncResolved: boolean;
|
|
1551
1555
|
/**
|
|
1556
|
+
* restore renderer-specific async context after `withAsyncContext()`
|
|
1557
|
+
* @internal
|
|
1558
|
+
*/
|
|
1559
|
+
restoreAsyncContext?: () => void | (() => void);
|
|
1560
|
+
/**
|
|
1552
1561
|
* `updateTeleportCssVars`
|
|
1553
1562
|
* For updating css vars on contained teleports
|
|
1554
1563
|
* @internal
|