index.ts 7.0 KB

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