SourceMap Class — svelte Architecture
Architecture documentation for the SourceMap class in index.d.ts from the svelte codebase.
Entity Profile
Dependency Diagram
graph TD 3490d200_e953_3fec_142a_dbfaada3eb75["SourceMap"] 6bd9d090_a582_e05c_669e_d53d4e7245f2["index.d.ts"] 3490d200_e953_3fec_142a_dbfaada3eb75 -->|defined in| 6bd9d090_a582_e05c_669e_d53d4e7245f2 e1e5b0bf_d80a_47ed_4444_1bcc0bf6e53a["compile()"] 3490d200_e953_3fec_142a_dbfaada3eb75 -->|method| e1e5b0bf_d80a_47ed_4444_1bcc0bf6e53a b5b0a14e_ea70_98c4_b1fb_e10b9042875a["compileModule()"] 3490d200_e953_3fec_142a_dbfaada3eb75 -->|method| b5b0a14e_ea70_98c4_b1fb_e10b9042875a e54bf136_6910_da1a_3b7e_aa8a4f44463e["parse()"] 3490d200_e953_3fec_142a_dbfaada3eb75 -->|method| e54bf136_6910_da1a_3b7e_aa8a4f44463e 03c676f4_a758_456a_43ff_471e91fdbe21["parseCss()"] 3490d200_e953_3fec_142a_dbfaada3eb75 -->|method| 03c676f4_a758_456a_43ff_471e91fdbe21 45079a3c_2eed_ca9d_4b91_f22076959fdb["walk()"] 3490d200_e953_3fec_142a_dbfaada3eb75 -->|method| 45079a3c_2eed_ca9d_4b91_f22076959fdb 17919a1a_54bd_84a5_aa37_73a374e7198b["preprocess()"] 3490d200_e953_3fec_142a_dbfaada3eb75 -->|method| 17919a1a_54bd_84a5_aa37_73a374e7198b 6b1e03bd_ed32_4b31_2450_5087c292fd0d["print()"] 3490d200_e953_3fec_142a_dbfaada3eb75 -->|method| 6b1e03bd_ed32_4b31_2450_5087c292fd0d 0dd0926d_534f_dc7c_acdc_364e16e9b328["migrate()"] 3490d200_e953_3fec_142a_dbfaada3eb75 -->|method| 0dd0926d_534f_dc7c_acdc_364e16e9b328
Relationship Graph
Source Code
packages/svelte/types/index.d.ts lines 845–1834
declare module 'svelte/compiler' {
import type { SourceMap } from 'magic-string';
import type { ArrayExpression, ArrowFunctionExpression, VariableDeclaration, VariableDeclarator, Expression, Identifier, MemberExpression, Node, ObjectExpression, Pattern, Program, ChainExpression, SimpleCallExpression, SequenceExpression, SourceLocation } from 'estree';
import type { Location } from 'locate-character';
import type { default as ts } from 'esrap/languages/ts';
/**
* `compile` converts your `.svelte` source code into a JavaScript module that exports a component
*
* @param source The component source code
* @param options The compiler options
* */
export function compile(source: string, options: CompileOptions): CompileResult;
/**
* `compileModule` takes your JavaScript source code containing runes, and turns it into a JavaScript module.
*
* @param source The component source code
* */
export function compileModule(source: string, options: ModuleCompileOptions): CompileResult;
/**
* 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.
*
* */
export function parse(source: string, options: {
filename?: string;
modern: true;
loose?: boolean;
}): AST.Root;
/**
* 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.
*
* */
export function parse(source: string, options?: {
filename?: string;
modern?: false;
loose?: boolean;
} | undefined): Record<string, any>;
/**
* The parseCss function parses a CSS stylesheet, returning its abstract syntax tree.
*
* @param source The CSS source code
* */
export function parseCss(source: string): Omit<AST.CSS.StyleSheet, "attributes" | "content">;
/**
* @deprecated Replace this with `import { walk } from 'estree-walker'`
* */
export function walk(): never;
/**
* The result of a preprocessor run. If the preprocessor does not return a result, it is assumed that the code is unchanged.
*/
export interface Processed {
/**
* The new code
*/
code: string;
/**
* A source map mapping back to the original code
*/
map?: string | object; // we are opaque with the type here to avoid dependency on the remapping module for our public types.
/**
* A list of additional files to watch for changes
*/
dependencies?: string[];
/**
* Only for script/style preprocessors: The updated attributes to set on the tag. If undefined, attributes stay unchanged.
*/
attributes?: Record<string, string | boolean>;
toString?: () => string;
}
/**
* A markup preprocessor that takes a string of code and returns a processed version.
*/
export type MarkupPreprocessor = (options: {
/**
* The whole Svelte file content
Defined In
Source
Frequently Asked Questions
What is the SourceMap class?
SourceMap is a class in the svelte codebase, defined in packages/svelte/types/index.d.ts.
Where is SourceMap defined?
SourceMap is defined in packages/svelte/types/index.d.ts at line 845.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free