Skip to content

[I] CompilerHost

Extends

  • SystemHost

Properties

PropertyTypeDescription
logSinkLogSink-
parseCache?WeakMap<SourceFile, TypeSpecScriptNode>Optional cache to reuse the results of parsing and binding across programs.

Methods

fileURLToPath()

fileURLToPath(url): string;

Parameters

ParameterType
urlstring

Returns

string


getExecutionRoot()

getExecutionRoot(): string;

Returns

string


getJsImport()

getJsImport(path): Promise<Record<string, any>>;

Parameters

ParameterType
pathstring

Returns

Promise<Record<string, any>>


getLibDirs()

getLibDirs(): string[];

Returns

string[]


getSourceFileKind()

getSourceFileKind(path): undefined | SourceFileKind;

Parameters

ParameterType
pathstring

Returns

undefined | SourceFileKind


mkdirp()

mkdirp(path): Promise<undefined | string>;

create directory recursively.

Parameters

ParameterTypeDescription
pathstringPath to the directory.

Returns

Promise<undefined | string>

Inherited from

SystemHost.mkdirp

pathToFileURL()

pathToFileURL(path): string;

Parameters

ParameterType
pathstring

Returns

string


readDir()

readDir(path): Promise<string[]>;

Read directory.

Parameters

ParameterTypeDescription
pathstringPath to the directory.

Returns

Promise<string[]>

list of file/directory in the given directory. Returns the name not the full path.

Inherited from

SystemHost.readDir

readFile()

readFile(path): Promise<SourceFile>;

read a utf-8 or utf-8 with bom encoded file

Parameters

ParameterType
pathstring

Returns

Promise<SourceFile>

Inherited from

SystemHost.readFile

readUrl()

readUrl(url): Promise<SourceFile>;

read a file at the given url.

Parameters

ParameterType
urlstring

Returns

Promise<SourceFile>

Inherited from

SystemHost.readUrl

realpath()

realpath(path): Promise<string>;

Parameters

ParameterType
pathstring

Returns

Promise<string>

Inherited from

SystemHost.realpath

rm()

rm(path, options?): Promise<void>;

Deletes a directory or file.

Parameters

ParameterTypeDescription
pathstringPath to the directory or file.
options?RmOptions-

Returns

Promise<void>

Inherited from

SystemHost.rm

stat()

stat(path): Promise<{
isDirectory: boolean;
isFile: boolean;
}>;

Parameters

ParameterType
pathstring

Returns

Promise<{ isDirectory: boolean; isFile: boolean; }>

Inherited from

SystemHost.stat

writeFile()

writeFile(path, content): Promise<void>;

Write the file.

Parameters

ParameterTypeDescription
pathstringPath to the file.
contentstringContent of the file.

Returns

Promise<void>

Inherited from

SystemHost.writeFile