index.ts 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. // Public API ------------------------------------------------------------------
  2. export const version = __VERSION__
  3. export * from './apiReactivity'
  4. export * from './apiWatch'
  5. export * from './apiLifecycle'
  6. export * from './apiInject'
  7. export { nextTick } from './scheduler'
  8. export { defineComponent } from './apiDefineComponent'
  9. // Advanced API ----------------------------------------------------------------
  10. // For getting a hold of the internal instance in setup() - useful for advanced
  11. // plugins
  12. export { getCurrentInstance } from './component'
  13. // For raw render function users
  14. export { h } from './h'
  15. export {
  16. createVNode,
  17. cloneVNode,
  18. mergeProps,
  19. openBlock,
  20. createBlock
  21. } from './vnode'
  22. // VNode type symbols
  23. export { Text, Comment, Fragment, Portal } from './vnode'
  24. // Internal Components
  25. export { Suspense, SuspenseProps } from './components/Suspense'
  26. export { KeepAlive, KeepAliveProps } from './components/KeepAlive'
  27. export {
  28. BaseTransition,
  29. BaseTransitionProps
  30. } from './components/BaseTransition'
  31. // VNode flags
  32. export { PublicShapeFlags as ShapeFlags } from './shapeFlags'
  33. import { PublicPatchFlags } from '@vue/shared'
  34. export const PatchFlags = PublicPatchFlags as {
  35. // export patch flags as plain numbers to avoid d.ts relying on @vue/shared
  36. // the enum type is internal anyway.
  37. TEXT: number
  38. CLASS: number
  39. STYLE: number
  40. PROPS: number
  41. NEED_PATCH: number
  42. FULL_PROPS: number
  43. STABLE_FRAGMENT: number
  44. KEYED_FRAGMENT: number
  45. UNKEYED_FRAGMENT: number
  46. DYNAMIC_SLOTS: number
  47. BAIL: number
  48. }
  49. // SFC CSS Modules
  50. export { useCSSModule } from './helpers/useCssModule'
  51. // For custom renderers
  52. export { createRenderer, RootRenderFunction } from './renderer'
  53. export { warn } from './warning'
  54. export {
  55. handleError,
  56. callWithErrorHandling,
  57. callWithAsyncErrorHandling
  58. } from './errorHandling'
  59. export {
  60. useTransitionState,
  61. TransitionState,
  62. resolveTransitionHooks,
  63. setTransitionHooks,
  64. TransitionHooks
  65. } from './components/BaseTransition'
  66. // Internal API ----------------------------------------------------------------
  67. // For compiler generated code
  68. // should sync with '@vue/compiler-core/src/runtimeConstants.ts'
  69. export { withDirectives } from './directives'
  70. export {
  71. resolveComponent,
  72. resolveDirective,
  73. resolveDynamicComponent
  74. } from './helpers/resolveAssets'
  75. export { renderList } from './helpers/renderList'
  76. export { toHandlers } from './helpers/toHandlers'
  77. export { renderSlot } from './helpers/renderSlot'
  78. export { createSlots } from './helpers/createSlots'
  79. export { pushScopeId, popScopeId, withScopeId } from './helpers/scopeId'
  80. export {
  81. setBlockTracking,
  82. createTextVNode,
  83. createCommentVNode,
  84. createStaticVNode
  85. } from './vnode'
  86. // Since @vue/shared is inlined into final builds,
  87. // when re-exporting from @vue/shared we need to avoid relying on their original
  88. // types so that the bundled d.ts does not attempt to import from it.
  89. import {
  90. toDisplayString as _toDisplayString,
  91. camelize as _camelize
  92. } from '@vue/shared'
  93. export const toDisplayString = _toDisplayString as (s: unknown) => string
  94. export const camelize = _camelize as (s: string) => string
  95. // For integration with runtime compiler
  96. export { registerRuntimeCompiler } from './component'
  97. // SSR -------------------------------------------------------------------------
  98. import { createComponentInstance, setupComponent } from './component'
  99. import {
  100. renderComponentRoot,
  101. setCurrentRenderingInstance
  102. } from './componentRenderUtils'
  103. import { isVNode, normalizeVNode } from './vnode'
  104. // SSR utils are only exposed in cjs builds.
  105. const _ssrUtils = {
  106. createComponentInstance,
  107. setupComponent,
  108. renderComponentRoot,
  109. setCurrentRenderingInstance,
  110. isVNode,
  111. normalizeVNode
  112. }
  113. export const ssrUtils = (__NODE_JS__ ? _ssrUtils : null) as typeof _ssrUtils
  114. // Types -----------------------------------------------------------------------
  115. export {
  116. App,
  117. AppConfig,
  118. AppContext,
  119. Plugin,
  120. CreateAppFunction
  121. } from './apiCreateApp'
  122. export {
  123. VNode,
  124. VNodeTypes,
  125. VNodeProps,
  126. VNodeArrayChildren,
  127. VNodeNormalizedChildren
  128. } from './vnode'
  129. export {
  130. Component,
  131. FunctionalComponent,
  132. ComponentInternalInstance,
  133. RenderFunction,
  134. SetupContext
  135. } from './component'
  136. export {
  137. ComponentOptions,
  138. ComponentOptionsWithoutProps,
  139. ComponentOptionsWithObjectProps as ComponentOptionsWithProps,
  140. ComponentOptionsWithArrayProps
  141. } from './apiOptions'
  142. export { ComponentPublicInstance } from './componentProxy'
  143. export { RendererOptions } from './renderer'
  144. export { Slot, Slots } from './componentSlots'
  145. export {
  146. Prop,
  147. PropType,
  148. ComponentPropsOptions,
  149. ComponentObjectPropsOptions
  150. } from './componentProps'
  151. export {
  152. Directive,
  153. DirectiveBinding,
  154. DirectiveHook,
  155. ObjectDirective,
  156. FunctionDirective,
  157. DirectiveArguments
  158. } from './directives'
  159. export { SuspenseBoundary } from './components/Suspense'
  160. export { HMRRuntime } from './hmr'