refactor: use explicit exports for runtime-core

This commit is contained in:
Evan You
2020-02-14 00:13:54 -05:00
parent 42d80b5888
commit 112d8f7d86
11 changed files with 103 additions and 124 deletions

View File

@@ -1,10 +1,35 @@
// Public API ------------------------------------------------------------------
export const version = __VERSION__
export * from './apiReactivity'
export * from './apiWatch'
export * from './apiLifecycle'
export * from './apiInject'
export {
ref,
isRef,
toRefs,
reactive,
isReactive,
readonly,
isReadonly,
shallowReactive,
toRaw,
markReadonly,
markNonReactive
} from '@vue/reactivity'
export { computed } from './apiComputed'
export { watch } from './apiWatch'
export {
onBeforeMount,
onMounted,
onBeforeUpdate,
onUpdated,
onBeforeUnmount,
onUnmounted,
onActivated,
onDeactivated,
onRenderTracked,
onRenderTriggered,
onErrorCaptured
} from './apiLifecycle'
export { provide, inject } from './apiInject'
export { nextTick } from './scheduler'
export { defineComponent } from './apiDefineComponent'
@@ -24,37 +49,23 @@ export {
createBlock
} from './vnode'
// Internal Components
export { Fragment, Portal } from './vnode'
export { Text, Comment, Fragment, Portal } from './vnode'
export { Suspense, SuspenseProps } from './components/Suspense'
export { KeepAlive, KeepAliveProps } from './components/KeepAlive'
export {
BaseTransition,
BaseTransitionProps
} from './components/BaseTransition'
// VNode flags
export { PublicShapeFlags as ShapeFlags } from './shapeFlags'
import { PublicPatchFlags } from '@vue/shared'
export const PatchFlags = PublicPatchFlags as {
// export patch 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
STABLE_FRAGMENT: number
KEYED_FRAGMENT: number
UNKEYED_FRAGMENT: number
DYNAMIC_SLOTS: number
BAIL: number
}
export { PatchFlags } from '@vue/shared'
export { ShapeFlags } from './shapeFlags'
// SFC CSS Modules
export { useCSSModule } from './helpers/useCssModule'
// Internal API ----------------------------------------------------------------
// For custom renderers
export { createRenderer, RootRenderFunction } from './renderer'
export { createRenderer } from './renderer'
export { warn } from './warning'
export {
handleError,
@@ -63,14 +74,10 @@ export {
} from './errorHandling'
export {
useTransitionState,
TransitionState,
resolveTransitionHooks,
setTransitionHooks,
TransitionHooks
setTransitionHooks
} from './components/BaseTransition'
// Internal API ----------------------------------------------------------------
// For compiler generated code
// should sync with '@vue/compiler-core/src/runtimeConstants.ts'
export { withDirectives } from './directives'
@@ -104,6 +111,7 @@ export const camelize = _camelize as (s: string) => string
export { registerRuntimeCompiler } from './component'
// SSR -------------------------------------------------------------------------
import { createComponentInstance, setupComponent } from './component'
import {
renderComponentRoot,
@@ -125,6 +133,26 @@ export const ssrUtils = (__NODE_JS__ ? _ssrUtils : null) as typeof _ssrUtils
// Types -----------------------------------------------------------------------
export {
ReactiveEffect,
ReactiveEffectOptions,
DebuggerEvent,
TrackOpTypes,
TriggerOpTypes,
Ref,
ComputedRef,
UnwrapRef,
WritableComputedOptions
} from '@vue/reactivity'
export {
// types
WatchOptions,
WatchCallback,
CleanupRegistrator,
WatchSource,
StopHandle
} from './apiWatch'
export { InjectionKey } from './apiInject'
export {
App,
AppConfig,
@@ -152,9 +180,8 @@ export {
ComponentOptionsWithObjectProps as ComponentOptionsWithProps,
ComponentOptionsWithArrayProps
} from './apiOptions'
export { ComponentPublicInstance } from './componentProxy'
export { RendererOptions } from './renderer'
export { RendererOptions, RootRenderFunction } from './renderer'
export { Slot, Slots } from './componentSlots'
export {
Prop,
@@ -171,4 +198,5 @@ export {
DirectiveArguments
} from './directives'
export { SuspenseBoundary } from './components/Suspense'
export { TransitionState, TransitionHooks } from './components/BaseTransition'
export { HMRRuntime } from './hmr'