vue3-yuanma/packages/runtime-core/src/index.ts

318 lines
7.9 KiB
TypeScript
Raw Normal View History

// Core API ------------------------------------------------------------------
2019-08-22 23:12:37 +08:00
export const version = __VERSION__
export {
// core
reactive,
ref,
readonly,
// utilities
unref,
proxyRefs,
isRef,
toRef,
toRefs,
isProxy,
isReactive,
isReadonly,
// advanced
customRef,
triggerRef,
shallowRef,
shallowReactive,
shallowReadonly,
markRaw,
toRaw
} from '@vue/reactivity'
export { computed } from './apiComputed'
export { watch, watchEffect } from './apiWatch'
export {
onBeforeMount,
onMounted,
onBeforeUpdate,
onUpdated,
onBeforeUnmount,
onUnmounted,
onActivated,
onDeactivated,
onRenderTracked,
onRenderTriggered,
onErrorCaptured
} from './apiLifecycle'
export { provide, inject } from './apiInject'
2019-11-03 00:18:35 +08:00
export { nextTick } from './scheduler'
export { defineComponent } from './apiDefineComponent'
export { defineAsyncComponent } from './apiAsyncComponent'
export { defineProps, defineEmit, useContext } from './apiSetupHelpers'
2019-08-22 23:12:37 +08:00
2019-08-23 09:38:00 +08:00
// Advanced API ----------------------------------------------------------------
2019-11-03 00:18:35 +08:00
// For getting a hold of the internal instance in setup() - useful for advanced
// plugins
export { getCurrentInstance } from './component'
2019-08-23 09:38:00 +08:00
// For raw render function users
2019-08-24 03:27:17 +08:00
export { h } from './h'
// Advanced render function utilities
2020-05-11 23:09:36 +08:00
export { createVNode, cloneVNode, mergeProps, isVNode } from './vnode'
// VNode types
export { Fragment, Text, Comment, Static } from './vnode'
// Built-in components
export { Teleport, TeleportProps } from './components/Teleport'
export { Suspense, SuspenseProps } from './components/Suspense'
export { KeepAlive, KeepAliveProps } from './components/KeepAlive'
2019-11-25 05:00:46 +08:00
export {
BaseTransition,
BaseTransitionProps
} from './components/BaseTransition'
// For using custom directives
export { withDirectives } from './directives'
2020-02-19 02:26:15 +08:00
// SSR context
export { useSSRContext, ssrContextKey } from './helpers/useSsrContext'
// Custom Renderer API ---------------------------------------------------------
export { createRenderer, createHydrationRenderer } from './renderer'
export { queuePostFlushCb } from './scheduler'
2019-10-11 06:02:51 +08:00
export { warn } from './warning'
export {
handleError,
callWithErrorHandling,
callWithAsyncErrorHandling,
ErrorCodes
} from './errorHandling'
export {
resolveComponent,
resolveDirective,
resolveDynamicComponent
} from './helpers/resolveAssets'
// For integration with runtime compiler
export { registerRuntimeCompiler, isRuntimeOnly } from './component'
2019-11-29 07:41:01 +08:00
export {
useTransitionState,
resolveTransitionHooks,
setTransitionHooks,
getTransitionRawChildren
2019-11-29 07:41:01 +08:00
} from './components/BaseTransition'
2020-10-13 23:50:09 +08:00
export { initCustomFormatter } from './customFormatter'
2019-08-23 09:38:00 +08:00
2020-07-17 06:18:52 +08:00
// For devtools
export { devtools, setDevtoolsHook } from './devtools'
// Types -------------------------------------------------------------------------
2019-08-23 09:38:00 +08:00
import { VNode } from './vnode'
import { ComponentInternalInstance } from './component'
// Augment Ref unwrap bail types.
// Note: if updating this, also update `types/refBail.d.ts`.
declare module '@vue/reactivity' {
export interface RefUnwrapBailTypes {
runtimeCoreBailTypes:
| VNode
| {
// directly bailing on ComponentPublicInstance results in recursion
// so we use this as a bail hint
$: ComponentInternalInstance
}
}
}
export {
ReactiveEffect,
ReactiveEffectOptions,
DebuggerEvent,
TrackOpTypes,
TriggerOpTypes,
Ref,
ComputedRef,
WritableComputedRef,
UnwrapRef,
ShallowUnwrapRef,
WritableComputedOptions,
ToRefs,
DeepReadonly
} from '@vue/reactivity'
export {
// types
WatchEffect,
WatchOptions,
WatchOptionsBase,
WatchCallback,
WatchSource,
WatchStopHandle
} from './apiWatch'
export { InjectionKey } from './apiInject'
export {
App,
AppConfig,
AppContext,
Plugin,
CreateAppFunction,
OptionMergeFunction
} from './apiCreateApp'
export {
VNode,
VNodeChild,
VNodeTypes,
VNodeProps,
VNodeArrayChildren,
VNodeNormalizedChildren
} from './vnode'
2019-09-07 00:58:31 +08:00
export {
Component,
ConcreteComponent,
2019-09-07 00:58:31 +08:00
FunctionalComponent,
ComponentInternalInstance,
SetupContext,
ComponentCustomProps,
AllowedComponentProps
2019-09-07 00:58:31 +08:00
} from './component'
export { DefineComponent } from './apiDefineComponent'
2019-09-07 00:58:31 +08:00
export {
ComponentOptions,
ComponentOptionsMixin,
2019-09-07 00:58:31 +08:00
ComponentOptionsWithoutProps,
ComponentOptionsWithObjectProps,
ComponentOptionsWithArrayProps,
2020-04-28 01:31:40 +08:00
ComponentCustomOptions,
ComponentOptionsBase,
RenderFunction,
MethodOptions,
ComputedOptions,
RuntimeCompilerOptions
} from './componentOptions'
export { EmitsOptions, ObjectEmitsOptions } from './componentEmits'
export {
ComponentPublicInstance,
ComponentCustomProperties
} from './componentPublicInstance'
export {
Renderer,
RendererNode,
RendererElement,
HydrationRenderer,
RendererOptions,
RootRenderFunction
} from './renderer'
export { RootHydrateFunction } from './hydration'
2019-08-23 09:38:00 +08:00
export { Slot, Slots } from './componentSlots'
2019-10-08 21:26:09 +08:00
export {
Prop,
PropType,
ComponentPropsOptions,
ComponentObjectPropsOptions,
ExtractPropTypes,
ExtractDefaultPropTypes
2019-10-08 21:26:09 +08:00
} from './componentProps'
2019-09-07 00:58:31 +08:00
export {
Directive,
DirectiveBinding,
DirectiveHook,
ObjectDirective,
FunctionDirective,
2019-09-07 00:58:31 +08:00
DirectiveArguments
} from './directives'
export { SuspenseBoundary } from './components/Suspense'
export { TransitionState, TransitionHooks } from './components/BaseTransition'
export {
AsyncComponentOptions,
AsyncComponentLoader
} from './apiAsyncComponent'
2019-12-17 06:57:34 +08:00
export { HMRRuntime } from './hmr'
// Internal API ----------------------------------------------------------------
// **IMPORTANT** Internal APIs may change without notice between versions and
// user code should avoid relying on them.
// For compiler generated code
// should sync with '@vue/compiler-core/src/runtimeHelpers.ts'
export {
withCtx,
pushScopeId,
popScopeId,
withScopeId
} from './componentRenderContext'
export { renderList } from './helpers/renderList'
export { toHandlers } from './helpers/toHandlers'
export { renderSlot } from './helpers/renderSlot'
export { createSlots } from './helpers/createSlots'
export {
openBlock,
createBlock,
setBlockTracking,
createTextVNode,
createCommentVNode,
createStaticVNode
} from './vnode'
export {
toDisplayString,
camelize,
capitalize,
toHandlerKey
} from '@vue/shared'
// For test-utils
export { transformVNodeArgs } from './vnode'
// SSR -------------------------------------------------------------------------
// **IMPORTANT** These APIs are exposed solely for @vue/server-renderer and may
// change without notice between versions. User code should never rely on them.
import { createComponentInstance, setupComponent } from './component'
import { renderComponentRoot } from './componentRenderUtils'
import { setCurrentRenderingInstance } from './componentRenderContext'
import { isVNode, normalizeVNode } from './vnode'
const _ssrUtils = {
createComponentInstance,
setupComponent,
renderComponentRoot,
setCurrentRenderingInstance,
isVNode,
normalizeVNode
}
/**
* SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
* @internal
*/
export const ssrUtils = (__NODE_JS__ ? _ssrUtils : null) as typeof _ssrUtils
// 2.x COMPAT ------------------------------------------------------------------
export { DeprecationTypes } from './compat/compatConfig'
2021-04-07 23:22:56 +08:00
export { CompatVue } from './compat/global'
2021-04-07 05:38:43 +08:00
export { LegacyConfig } from './compat/globalConfig'
2021-04-07 23:22:56 +08:00
import { warnDeprecation } from './compat/compatConfig'
2021-04-07 23:22:56 +08:00
import { createCompatVue } from './compat/global'
2021-04-10 11:51:50 +08:00
import {
isCompatEnabled,
checkCompatEnabled,
softAssertCompatEnabled
} from './compat/compatConfig'
2021-04-20 00:08:26 +08:00
import { resolveFilter as _resolveFilter } from './helpers/resolveAssets'
/**
* @internal only exposed in compat builds
*/
export const resolveFilter = __COMPAT__ ? _resolveFilter : null
2021-04-07 23:22:56 +08:00
const _compatUtils = {
warnDeprecation,
createCompatVue,
2021-04-08 03:54:36 +08:00
isCompatEnabled,
2021-04-10 11:51:50 +08:00
checkCompatEnabled,
2021-04-08 03:54:36 +08:00
softAssertCompatEnabled
2021-04-07 23:22:56 +08:00
}
2021-04-09 05:15:02 +08:00
/**
* @internal only exposed in compat builds.
*/
2021-04-07 23:22:56 +08:00
export const compatUtils = (__COMPAT__
? _compatUtils
: null) as typeof _compatUtils