Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

SourceNode

class SourceNode {
constructor();
constructor(
line: number | null,
column: number | null,
source: string | null,
chunks?: Array<(string | SourceNode)> | SourceNode | string,
name?: string,
);
children: SourceNode[];
column: number;
line: number;
name: string;
source: string;
sourceContents: any;
 
add(chunk: Array<(string | SourceNode)> | SourceNode | string): SourceNode;
join(sep: string): SourceNode;
prepend(chunk: Array<(string | SourceNode)> | SourceNode | string): SourceNode;
replaceRight(pattern: string, replacement: string): SourceNode;
setSourceContent(sourceFile: string, sourceContent: string): void;
toString(): string;
toStringWithSourceMap(startOfSourceMap?: StartOfSourceMap): CodeWithSourceMap;
walk(fn: (chunk: string, mapping: MappedPosition) => void): void;
walkSourceContents(fn: (file: string, content: string) => void): void;
 
static fromStringWithSourceMap(
code: string,
sourceMapConsumer: SourceMapConsumer,
relativePath?: string,
): SourceNode;
}

§Constructors

§
new SourceNode()
[src]
§
new SourceNode(line: number | null, column: number | null, source: string | null, chunks?: Array<(string | SourceNode)> | SourceNode | string, name?: string)
[src]

§Properties

§
children: SourceNode[]
[src]
§
column: number
[src]
§
line: number
[src]
§
name: string
[src]
§
source: string
[src]
§
sourceContents: any
[src]

§Methods

§
add(chunk: Array<(string | SourceNode)> | SourceNode | string): SourceNode
[src]
§
join(sep: string): SourceNode
[src]
§
prepend(chunk: Array<(string | SourceNode)> | SourceNode | string): SourceNode
[src]
§
replaceRight(pattern: string, replacement: string): SourceNode
[src]
§
setSourceContent(sourceFile: string, sourceContent: string): void
[src]
§
toString(): string
[src]
§
toStringWithSourceMap(startOfSourceMap?: StartOfSourceMap): CodeWithSourceMap
[src]
§
walk(fn: (chunk: string, mapping: MappedPosition) => void): void
[src]
§
walkSourceContents(fn: (file: string, content: string) => void): void
[src]

§Static Methods

§
fromStringWithSourceMap(code: string, sourceMapConsumer: SourceMapConsumer, relativePath?: string): SourceNode
[src]