```js // @noErrors import { VERSION, compile, compileModule, migrate, parse, preprocess, walk } from 'svelte/compiler'; ``` ## VERSION The current version, as set in package.json.
```dts const VERSION: string; ```
## compile `compile` converts your `.svelte` source code into a JavaScript module that exports a component
```dts function compile( source: string, options: CompileOptions ): CompileResult; ```
## compileModule `compileModule` takes your JavaScript source code containing runes, and turns it into a JavaScript module.
```dts function compileModule( source: string, options: ModuleCompileOptions ): CompileResult; ```
## migrate Does a best-effort migration of Svelte code towards using runes, event attributes and render tags. May throw an error if the code is too complex to migrate automatically.
```dts function migrate( source: string, { filename, use_ts }?: | { filename?: string; use_ts?: boolean; } | undefined ): { code: string; }; ```
## parse The parse function parses a component, returning only its abstract syntax tree. The `modern` option (`false` by default in Svelte 5) makes the parser return a modern AST instead of the legacy AST. `modern` will become `true` by default in Svelte 6, and the option will be removed in Svelte 7.
```dts function parse( source: string, options: { filename?: string; modern: true; loose?: boolean; } ): AST.Root; ```
```dts function parse( source: string, options?: | { filename?: string; modern?: false; loose?: boolean; } | undefined ): Record; ```
## preprocess The preprocess function provides convenient hooks for arbitrarily transforming component source code. For example, it can be used to convert a `