2
0

index.ts 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. export const version: string = __VERSION__
  2. // API
  3. export { parse } from './parse'
  4. export { compileTemplate } from './compileTemplate'
  5. export { compileStyle, compileStyleAsync } from './compileStyle'
  6. export { compileScript } from './compileScript'
  7. export { rewriteDefault, rewriteDefaultAST } from './rewriteDefault'
  8. export { resolveTypeElements, inferRuntimeType } from './script/resolveType'
  9. import { type SFCParseResult, parseCache as _parseCache } from './parse'
  10. // #9521 export parseCache as a simple map to avoid exposing LRU types
  11. export const parseCache = _parseCache as Map<string, SFCParseResult>
  12. // error messages
  13. import {
  14. DOMErrorMessages,
  15. errorMessages as coreErrorMessages,
  16. } from '@vue/compiler-dom'
  17. export const errorMessages: Record<number, string> = {
  18. ...coreErrorMessages,
  19. ...DOMErrorMessages,
  20. }
  21. // Utilities
  22. export { parse as babelParse } from '@babel/parser'
  23. import MagicString from 'magic-string'
  24. export { MagicString }
  25. // technically internal but we want it in @vue/repl, cast it as any to avoid
  26. // relying on estree types
  27. import { walk as _walk } from 'estree-walker'
  28. export const walk = _walk as any
  29. export {
  30. generateCodeFrame,
  31. walkIdentifiers,
  32. extractIdentifiers,
  33. isInDestructureAssignment,
  34. isStaticProperty,
  35. } from '@vue/compiler-core'
  36. // Internals for type resolution
  37. export { invalidateTypeCache, registerTS } from './script/resolveType'
  38. export { extractRuntimeProps } from './script/defineProps'
  39. export { extractRuntimeEmits } from './script/defineEmits'
  40. // Types
  41. export type {
  42. SFCParseOptions,
  43. SFCParseResult,
  44. SFCDescriptor,
  45. SFCBlock,
  46. SFCTemplateBlock,
  47. SFCScriptBlock,
  48. SFCStyleBlock,
  49. } from './parse'
  50. export type {
  51. TemplateCompiler,
  52. SFCTemplateCompileOptions,
  53. SFCTemplateCompileResults,
  54. } from './compileTemplate'
  55. export type {
  56. SFCStyleCompileOptions,
  57. SFCAsyncStyleCompileOptions,
  58. SFCStyleCompileResults,
  59. } from './compileStyle'
  60. export type { SFCScriptCompileOptions } from './compileScript'
  61. export type { ScriptCompileContext } from './script/context'
  62. export type {
  63. TypeResolveContext,
  64. SimpleTypeResolveOptions,
  65. SimpleTypeResolveContext,
  66. } from './script/resolveType'
  67. export type {
  68. AssetURLOptions,
  69. AssetURLTagConfig,
  70. } from './template/transformAssetUrl'
  71. export type {
  72. CompilerOptions,
  73. CompilerError,
  74. BindingMetadata,
  75. } from '@vue/compiler-core'
  76. /**
  77. * @deprecated this is preserved to avoid breaking vite-plugin-vue < 5.0
  78. * with reactivityTransform: true. The desired behavior should be silently
  79. * ignoring the option instead of breaking.
  80. */
  81. export const shouldTransformRef = () => false