index.ts 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365
  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. isShallow,
  18. // advanced
  19. customRef,
  20. triggerRef,
  21. shallowRef,
  22. shallowReactive,
  23. shallowReadonly,
  24. markRaw,
  25. toRaw,
  26. // effect
  27. effect,
  28. stop,
  29. ReactiveEffect,
  30. // effect scope
  31. effectScope,
  32. EffectScope,
  33. getCurrentScope,
  34. onScopeDispose
  35. } from '@vue/reactivity'
  36. export { computed } from './apiComputed'
  37. export {
  38. watch,
  39. watchEffect,
  40. watchPostEffect,
  41. watchSyncEffect
  42. } from './apiWatch'
  43. export {
  44. onBeforeMount,
  45. onMounted,
  46. onBeforeUpdate,
  47. onUpdated,
  48. onBeforeUnmount,
  49. onUnmounted,
  50. onActivated,
  51. onDeactivated,
  52. onRenderTracked,
  53. onRenderTriggered,
  54. onErrorCaptured,
  55. onServerPrefetch
  56. } from './apiLifecycle'
  57. export { provide, inject } from './apiInject'
  58. export { nextTick } from './scheduler'
  59. export { defineComponent } from './apiDefineComponent'
  60. export { defineAsyncComponent } from './apiAsyncComponent'
  61. export { useAttrs, useSlots } from './apiSetupHelpers'
  62. // <script setup> API ----------------------------------------------------------
  63. export {
  64. // macros runtime, for typing and warnings only
  65. defineProps,
  66. defineEmits,
  67. defineExpose,
  68. withDefaults,
  69. // internal
  70. mergeDefaults,
  71. createPropsRestProxy,
  72. withAsyncContext
  73. } from './apiSetupHelpers'
  74. // Advanced API ----------------------------------------------------------------
  75. // For getting a hold of the internal instance in setup() - useful for advanced
  76. // plugins
  77. export { getCurrentInstance } from './component'
  78. // For raw render function users
  79. export { h } from './h'
  80. // Advanced render function utilities
  81. export { createVNode, cloneVNode, mergeProps, isVNode } from './vnode'
  82. // VNode types
  83. export { Fragment, Text, Comment, Static } from './vnode'
  84. // Built-in components
  85. export { Teleport, TeleportProps } from './components/Teleport'
  86. export { Suspense, SuspenseProps } from './components/Suspense'
  87. export { KeepAlive, KeepAliveProps } from './components/KeepAlive'
  88. export {
  89. BaseTransition,
  90. BaseTransitionProps
  91. } from './components/BaseTransition'
  92. // For using custom directives
  93. export { withDirectives } from './directives'
  94. // SSR context
  95. export { useSSRContext, ssrContextKey } from './helpers/useSsrContext'
  96. // Custom Renderer API ---------------------------------------------------------
  97. export { createRenderer, createHydrationRenderer } from './renderer'
  98. export { queuePostFlushCb } from './scheduler'
  99. export { warn } from './warning'
  100. export {
  101. handleError,
  102. callWithErrorHandling,
  103. callWithAsyncErrorHandling,
  104. ErrorCodes
  105. } from './errorHandling'
  106. export {
  107. resolveComponent,
  108. resolveDirective,
  109. resolveDynamicComponent
  110. } from './helpers/resolveAssets'
  111. // For integration with runtime compiler
  112. export { registerRuntimeCompiler, isRuntimeOnly } from './component'
  113. export {
  114. useTransitionState,
  115. resolveTransitionHooks,
  116. setTransitionHooks,
  117. getTransitionRawChildren
  118. } from './components/BaseTransition'
  119. export { initCustomFormatter } from './customFormatter'
  120. // For devtools
  121. export { devtools, setDevtoolsHook } from './devtools'
  122. // Types -------------------------------------------------------------------------
  123. import { VNode } from './vnode'
  124. import { ComponentInternalInstance } from './component'
  125. // Augment Ref unwrap bail types.
  126. // Note: if updating this, also update `types/refBail.d.ts`.
  127. declare module '@vue/reactivity' {
  128. export interface RefUnwrapBailTypes {
  129. runtimeCoreBailTypes:
  130. | VNode
  131. | {
  132. // directly bailing on ComponentPublicInstance results in recursion
  133. // so we use this as a bail hint
  134. $: ComponentInternalInstance
  135. }
  136. }
  137. }
  138. export {
  139. Ref,
  140. ToRef,
  141. ToRefs,
  142. UnwrapRef,
  143. ShallowRef,
  144. ShallowUnwrapRef,
  145. CustomRefFactory,
  146. ReactiveFlags,
  147. DeepReadonly,
  148. ShallowReactive,
  149. UnwrapNestedRefs,
  150. ComputedRef,
  151. WritableComputedRef,
  152. WritableComputedOptions,
  153. ComputedGetter,
  154. ComputedSetter,
  155. ReactiveEffectRunner,
  156. ReactiveEffectOptions,
  157. EffectScheduler,
  158. DebuggerOptions,
  159. DebuggerEvent,
  160. DebuggerEventExtraInfo,
  161. TrackOpTypes,
  162. TriggerOpTypes
  163. } from '@vue/reactivity'
  164. export {
  165. WatchEffect,
  166. WatchOptions,
  167. WatchOptionsBase,
  168. WatchCallback,
  169. WatchSource,
  170. WatchStopHandle
  171. } from './apiWatch'
  172. export { InjectionKey } from './apiInject'
  173. export {
  174. App,
  175. AppConfig,
  176. AppContext,
  177. Plugin,
  178. CreateAppFunction,
  179. OptionMergeFunction
  180. } from './apiCreateApp'
  181. export {
  182. VNode,
  183. VNodeChild,
  184. VNodeTypes,
  185. VNodeProps,
  186. VNodeArrayChildren,
  187. VNodeNormalizedChildren
  188. } from './vnode'
  189. export {
  190. Component,
  191. ConcreteComponent,
  192. FunctionalComponent,
  193. ComponentInternalInstance,
  194. SetupContext,
  195. ComponentCustomProps,
  196. AllowedComponentProps
  197. } from './component'
  198. export { DefineComponent } from './apiDefineComponent'
  199. export {
  200. ComponentOptions,
  201. ComponentOptionsMixin,
  202. ComponentOptionsWithoutProps,
  203. ComponentOptionsWithObjectProps,
  204. ComponentOptionsWithArrayProps,
  205. ComponentCustomOptions,
  206. ComponentOptionsBase,
  207. RenderFunction,
  208. MethodOptions,
  209. ComputedOptions,
  210. RuntimeCompilerOptions
  211. } from './componentOptions'
  212. export { EmitsOptions, ObjectEmitsOptions } from './componentEmits'
  213. export {
  214. ComponentPublicInstance,
  215. ComponentCustomProperties,
  216. CreateComponentPublicInstance
  217. } from './componentPublicInstance'
  218. export {
  219. Renderer,
  220. RendererNode,
  221. RendererElement,
  222. HydrationRenderer,
  223. RendererOptions,
  224. RootRenderFunction
  225. } from './renderer'
  226. export { RootHydrateFunction } from './hydration'
  227. export { Slot, Slots } from './componentSlots'
  228. export {
  229. Prop,
  230. PropType,
  231. ComponentPropsOptions,
  232. ComponentObjectPropsOptions,
  233. ExtractPropTypes,
  234. ExtractDefaultPropTypes
  235. } from './componentProps'
  236. export {
  237. Directive,
  238. DirectiveBinding,
  239. DirectiveHook,
  240. ObjectDirective,
  241. FunctionDirective,
  242. DirectiveArguments
  243. } from './directives'
  244. export { SuspenseBoundary } from './components/Suspense'
  245. export { TransitionState, TransitionHooks } from './components/BaseTransition'
  246. export {
  247. AsyncComponentOptions,
  248. AsyncComponentLoader
  249. } from './apiAsyncComponent'
  250. export { HMRRuntime } from './hmr'
  251. // Internal API ----------------------------------------------------------------
  252. // **IMPORTANT** Internal APIs may change without notice between versions and
  253. // user code should avoid relying on them.
  254. // For compiler generated code
  255. // should sync with '@vue/compiler-core/src/runtimeHelpers.ts'
  256. export {
  257. withCtx,
  258. pushScopeId,
  259. popScopeId,
  260. withScopeId
  261. } from './componentRenderContext'
  262. export { renderList } from './helpers/renderList'
  263. export { toHandlers } from './helpers/toHandlers'
  264. export { renderSlot } from './helpers/renderSlot'
  265. export { createSlots } from './helpers/createSlots'
  266. export { withMemo, isMemoSame } from './helpers/withMemo'
  267. export {
  268. openBlock,
  269. createBlock,
  270. setBlockTracking,
  271. createTextVNode,
  272. createCommentVNode,
  273. createStaticVNode,
  274. createElementVNode,
  275. createElementBlock,
  276. guardReactiveProps
  277. } from './vnode'
  278. export {
  279. toDisplayString,
  280. camelize,
  281. capitalize,
  282. toHandlerKey,
  283. normalizeProps,
  284. normalizeClass,
  285. normalizeStyle
  286. } from '@vue/shared'
  287. // For test-utils
  288. export { transformVNodeArgs } from './vnode'
  289. // SSR -------------------------------------------------------------------------
  290. // **IMPORTANT** These APIs are exposed solely for @vue/server-renderer and may
  291. // change without notice between versions. User code should never rely on them.
  292. import { createComponentInstance, setupComponent } from './component'
  293. import { renderComponentRoot } from './componentRenderUtils'
  294. import { setCurrentRenderingInstance } from './componentRenderContext'
  295. import { isVNode, normalizeVNode } from './vnode'
  296. const _ssrUtils = {
  297. createComponentInstance,
  298. setupComponent,
  299. renderComponentRoot,
  300. setCurrentRenderingInstance,
  301. isVNode,
  302. normalizeVNode
  303. }
  304. /**
  305. * SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
  306. * @internal
  307. */
  308. export const ssrUtils = (__SSR__ ? _ssrUtils : null) as typeof _ssrUtils
  309. // 2.x COMPAT ------------------------------------------------------------------
  310. export { DeprecationTypes } from './compat/compatConfig'
  311. export { CompatVue } from './compat/global'
  312. export { LegacyConfig } from './compat/globalConfig'
  313. import { warnDeprecation } from './compat/compatConfig'
  314. import { createCompatVue } from './compat/global'
  315. import {
  316. isCompatEnabled,
  317. checkCompatEnabled,
  318. softAssertCompatEnabled
  319. } from './compat/compatConfig'
  320. import { resolveFilter as _resolveFilter } from './helpers/resolveAssets'
  321. /**
  322. * @internal only exposed in compat builds
  323. */
  324. export const resolveFilter = __COMPAT__ ? _resolveFilter : null
  325. const _compatUtils = {
  326. warnDeprecation,
  327. createCompatVue,
  328. isCompatEnabled,
  329. checkCompatEnabled,
  330. softAssertCompatEnabled
  331. }
  332. /**
  333. * @internal only exposed in compat builds.
  334. */
  335. export const compatUtils = (
  336. __COMPAT__ ? _compatUtils : null
  337. ) as typeof _compatUtils