index.ts 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. // Core API ------------------------------------------------------------------
  2. export const version = __VERSION__
  3. export {
  4. // core
  5. reactive,
  6. ref,
  7. readonly,
  8. // utilities
  9. unref,
  10. isRef,
  11. toRef,
  12. toRefs,
  13. isProxy,
  14. isReactive,
  15. isReadonly,
  16. // advanced
  17. customRef,
  18. triggerRef,
  19. shallowRef,
  20. shallowReactive,
  21. shallowReadonly,
  22. markRaw,
  23. toRaw
  24. } from '@vue/reactivity'
  25. export { computed } from './apiComputed'
  26. export { watch, watchEffect } from './apiWatch'
  27. export {
  28. onBeforeMount,
  29. onMounted,
  30. onBeforeUpdate,
  31. onUpdated,
  32. onBeforeUnmount,
  33. onUnmounted,
  34. onActivated,
  35. onDeactivated,
  36. onRenderTracked,
  37. onRenderTriggered,
  38. onErrorCaptured
  39. } from './apiLifecycle'
  40. export { provide, inject } from './apiInject'
  41. export { nextTick } from './scheduler'
  42. export { defineComponent } from './apiDefineComponent'
  43. export { defineAsyncComponent } from './apiAsyncComponent'
  44. // Advanced API ----------------------------------------------------------------
  45. // For getting a hold of the internal instance in setup() - useful for advanced
  46. // plugins
  47. export { getCurrentInstance } from './component'
  48. // For raw render function users
  49. export { h } from './h'
  50. // Advanced render function utilities
  51. export { createVNode, cloneVNode, mergeProps, isVNode } from './vnode'
  52. // VNode types
  53. export { Fragment, Text, Comment, Static } from './vnode'
  54. // Built-in components
  55. export { Teleport, TeleportProps } from './components/Teleport'
  56. export { Suspense, SuspenseProps } from './components/Suspense'
  57. export { KeepAlive, KeepAliveProps } from './components/KeepAlive'
  58. export {
  59. BaseTransition,
  60. BaseTransitionProps
  61. } from './components/BaseTransition'
  62. // For using custom directives
  63. export { withDirectives } from './directives'
  64. // SFC CSS Modules
  65. export { useCSSModule } from './helpers/useCssModule'
  66. // SSR context
  67. export { useSSRContext, ssrContextKey } from './helpers/useSsrContext'
  68. // Custom Renderer API ---------------------------------------------------------
  69. export { createRenderer, createHydrationRenderer } from './renderer'
  70. export { queuePostFlushCb } from './scheduler'
  71. export { warn } from './warning'
  72. export {
  73. handleError,
  74. callWithErrorHandling,
  75. callWithAsyncErrorHandling,
  76. ErrorCodes
  77. } from './errorHandling'
  78. export {
  79. resolveComponent,
  80. resolveDirective,
  81. resolveDynamicComponent
  82. } from './helpers/resolveAssets'
  83. // For integration with runtime compiler
  84. export { registerRuntimeCompiler } from './component'
  85. export {
  86. useTransitionState,
  87. resolveTransitionHooks,
  88. setTransitionHooks
  89. } from './components/BaseTransition'
  90. // Types -----------------------------------------------------------------------
  91. import { VNode } from './vnode'
  92. import { ComponentInternalInstance } from './component'
  93. // Augment Ref unwrap bail types.
  94. // Note: if updating this, also update `types/refBail.d.ts`.
  95. declare module '@vue/reactivity' {
  96. export interface RefUnwrapBailTypes {
  97. runtimeCoreBailTypes:
  98. | VNode
  99. | {
  100. // directly bailing on ComponentPublicInstance results in recursion
  101. // so we use this as a bail hint
  102. $: ComponentInternalInstance
  103. }
  104. }
  105. }
  106. export {
  107. ReactiveEffect,
  108. ReactiveEffectOptions,
  109. DebuggerEvent,
  110. TrackOpTypes,
  111. TriggerOpTypes,
  112. Ref,
  113. ComputedRef,
  114. UnwrapRef,
  115. WritableComputedOptions,
  116. ToRefs
  117. } from '@vue/reactivity'
  118. export {
  119. // types
  120. WatchEffect,
  121. WatchOptions,
  122. WatchOptionsBase,
  123. WatchCallback,
  124. WatchSource,
  125. WatchStopHandle
  126. } from './apiWatch'
  127. export { InjectionKey } from './apiInject'
  128. export {
  129. App,
  130. AppConfig,
  131. AppContext,
  132. Plugin,
  133. CreateAppFunction,
  134. OptionMergeFunction
  135. } from './apiCreateApp'
  136. export {
  137. VNode,
  138. VNodeChild,
  139. VNodeTypes,
  140. VNodeProps,
  141. VNodeArrayChildren,
  142. VNodeNormalizedChildren
  143. } from './vnode'
  144. export {
  145. Component,
  146. FunctionalComponent,
  147. ComponentInternalInstance,
  148. SetupContext
  149. } from './component'
  150. export {
  151. ComponentOptions,
  152. ComponentOptionsWithoutProps,
  153. ComponentOptionsWithObjectProps,
  154. ComponentOptionsWithArrayProps,
  155. ComponentCustomOptions,
  156. ComponentOptionsBase,
  157. RenderFunction
  158. } from './componentOptions'
  159. export {
  160. ComponentPublicInstance,
  161. ComponentCustomProperties
  162. } from './componentProxy'
  163. export {
  164. Renderer,
  165. RendererNode,
  166. RendererElement,
  167. HydrationRenderer,
  168. RendererOptions,
  169. RootRenderFunction
  170. } from './renderer'
  171. export { RootHydrateFunction } from './hydration'
  172. export { Slot, Slots } from './componentSlots'
  173. export {
  174. Prop,
  175. PropType,
  176. ComponentPropsOptions,
  177. ComponentObjectPropsOptions,
  178. ExtractPropTypes
  179. } from './componentProps'
  180. export {
  181. Directive,
  182. DirectiveBinding,
  183. DirectiveHook,
  184. ObjectDirective,
  185. FunctionDirective,
  186. DirectiveArguments
  187. } from './directives'
  188. export { SuspenseBoundary } from './components/Suspense'
  189. export { TransitionState, TransitionHooks } from './components/BaseTransition'
  190. export {
  191. AsyncComponentOptions,
  192. AsyncComponentLoader
  193. } from './apiAsyncComponent'
  194. export { HMRRuntime } from './hmr'
  195. // Internal API ----------------------------------------------------------------
  196. // **IMPORTANT** Internal APIs may change without notice between versions and
  197. // user code should avoid relying on them.
  198. // For compiler generated code
  199. // should sync with '@vue/compiler-core/src/runtimeConstants.ts'
  200. export { withCtx } from './helpers/withRenderContext'
  201. export { renderList } from './helpers/renderList'
  202. export { toHandlers } from './helpers/toHandlers'
  203. export { renderSlot } from './helpers/renderSlot'
  204. export { createSlots } from './helpers/createSlots'
  205. export { pushScopeId, popScopeId, withScopeId } from './helpers/scopeId'
  206. export {
  207. openBlock,
  208. createBlock,
  209. setBlockTracking,
  210. createTextVNode,
  211. createCommentVNode,
  212. createStaticVNode
  213. } from './vnode'
  214. // a bit of ceremony to mark these internal only here because we need to include
  215. // them in @vue/shared's typings
  216. import { toDisplayString, camelize } from '@vue/shared'
  217. /**
  218. * @internal
  219. */
  220. const _toDisplayString = toDisplayString
  221. /**
  222. * @internal
  223. */
  224. const _camelize = camelize
  225. export { _toDisplayString as toDisplayString, _camelize as camelize }
  226. // For test-utils
  227. export { transformVNodeArgs } from './vnode'
  228. // SSR -------------------------------------------------------------------------
  229. // **IMPORTANT** These APIs are exposed solely for @vue/server-renderer and may
  230. // change without notice between versions. User code should never rely on them.
  231. import { createComponentInstance, setupComponent } from './component'
  232. import {
  233. renderComponentRoot,
  234. setCurrentRenderingInstance
  235. } from './componentRenderUtils'
  236. import { isVNode, normalizeVNode } from './vnode'
  237. import { normalizeSuspenseChildren } from './components/Suspense'
  238. const _ssrUtils = {
  239. createComponentInstance,
  240. setupComponent,
  241. renderComponentRoot,
  242. setCurrentRenderingInstance,
  243. isVNode,
  244. normalizeVNode,
  245. normalizeSuspenseChildren
  246. }
  247. /**
  248. * SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
  249. * @internal
  250. */
  251. export const ssrUtils = (__NODE_JS__ ? _ssrUtils : null) as typeof _ssrUtils