types: fix dts reliance on @vue/shared
This commit is contained in:
parent
8325f2de2a
commit
fc5b2964de
@ -22,9 +22,22 @@ export {
|
|||||||
export { Text, Comment, Fragment, Portal, Suspense } from './vnode'
|
export { Text, Comment, Fragment, Portal, Suspense } from './vnode'
|
||||||
// Internal Components
|
// Internal Components
|
||||||
export { KeepAlive } from './keepAlive'
|
export { KeepAlive } from './keepAlive'
|
||||||
// VNode flags
|
// VNode patchFlags
|
||||||
export { PublicShapeFlags as ShapeFlags } from './shapeFlags'
|
import { PublicPatchFlags } from '@vue/shared'
|
||||||
export { PublicPatchFlags as PatchFlags } from '@vue/shared'
|
export const PatchFlags = PublicPatchFlags as {
|
||||||
|
// export flags as plain numbers to avoid d.ts relying on @vue/shared
|
||||||
|
// the enum type is internal anyway.
|
||||||
|
TEXT: number
|
||||||
|
CLASS: number
|
||||||
|
STYLE: number
|
||||||
|
PROPS: number
|
||||||
|
NEED_PATCH: number
|
||||||
|
FULL_PROPS: number
|
||||||
|
KEYED_FRAGMENT: number
|
||||||
|
UNKEYED_FRAGMENT: number
|
||||||
|
DYNAMIC_SLOTS: number
|
||||||
|
BAIL: number
|
||||||
|
}
|
||||||
|
|
||||||
// For advanced plugins
|
// For advanced plugins
|
||||||
export { getCurrentInstance } from './component'
|
export { getCurrentInstance } from './component'
|
||||||
@ -52,7 +65,12 @@ export { toHandlers } from './helpers/toHandlers'
|
|||||||
export { renderSlot } from './helpers/renderSlot'
|
export { renderSlot } from './helpers/renderSlot'
|
||||||
export { createSlots } from './helpers/createSlots'
|
export { createSlots } from './helpers/createSlots'
|
||||||
export { setBlockTracking, createTextVNode, createCommentVNode } from './vnode'
|
export { setBlockTracking, createTextVNode, createCommentVNode } from './vnode'
|
||||||
export { capitalize, camelize } from '@vue/shared'
|
// Since @vue/shared is inlined into final builds,
|
||||||
|
// when re-exporting from @vue/shared we need to avoid relying on their original
|
||||||
|
// types so that the bundled d.ts does not attempt to import from it.
|
||||||
|
import { capitalize as _capitalize, camelize as _camelize } from '@vue/shared'
|
||||||
|
export const capitalize = _capitalize as (s: string) => string
|
||||||
|
export const camelize = _camelize as (s: string) => string
|
||||||
|
|
||||||
// Internal, for integration with runtime compiler
|
// Internal, for integration with runtime compiler
|
||||||
export { registerRuntimeCompiler } from './component'
|
export { registerRuntimeCompiler } from './component'
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
// internally the const enum flags are used to avoid overhead of property
|
|
||||||
// access
|
|
||||||
export const enum ShapeFlags {
|
export const enum ShapeFlags {
|
||||||
ELEMENT = 1,
|
ELEMENT = 1,
|
||||||
FUNCTIONAL_COMPONENT = 1 << 1,
|
FUNCTIONAL_COMPONENT = 1 << 1,
|
||||||
@ -12,15 +10,3 @@ export const enum ShapeFlags {
|
|||||||
STATEFUL_COMPONENT_KEPT_ALIVE = 1 << 8,
|
STATEFUL_COMPONENT_KEPT_ALIVE = 1 << 8,
|
||||||
COMPONENT = ShapeFlags.STATEFUL_COMPONENT | ShapeFlags.FUNCTIONAL_COMPONENT
|
COMPONENT = ShapeFlags.STATEFUL_COMPONENT | ShapeFlags.FUNCTIONAL_COMPONENT
|
||||||
}
|
}
|
||||||
|
|
||||||
// but the flags are also exported as an actual object for external use
|
|
||||||
export const PublicShapeFlags = {
|
|
||||||
ELEMENT: ShapeFlags.ELEMENT,
|
|
||||||
FUNCTIONAL_COMPONENT: ShapeFlags.FUNCTIONAL_COMPONENT,
|
|
||||||
STATEFUL_COMPONENT: ShapeFlags.STATEFUL_COMPONENT,
|
|
||||||
TEXT_CHILDREN: ShapeFlags.TEXT_CHILDREN,
|
|
||||||
ARRAY_CHILDREN: ShapeFlags.ARRAY_CHILDREN,
|
|
||||||
SLOTS_CHILDREN: ShapeFlags.SLOTS_CHILDREN,
|
|
||||||
SUSPENSE: ShapeFlags.SUSPENSE,
|
|
||||||
COMPONENT: ShapeFlags.COMPONENT
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user