Skip to main content
Version: Next 🚧

[I] CompilerHost

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>


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.


readFile()

readFile(path): Promise<SourceFile>

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

Parameters

ParameterType
pathstring

Returns

Promise<SourceFile>


readUrl()

readUrl(url): Promise<SourceFile>

read a file at the given url.

Parameters

ParameterType
urlstring

Returns

Promise<SourceFile>


realpath()

realpath(path): Promise<string>

Parameters

ParameterType
pathstring

Returns

Promise<string>


rm()

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

Deletes a directory or file.

Parameters

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

Returns

Promise<void>


stat()

stat(path): Promise<object>

Parameters

ParameterType
pathstring

Returns

Promise<object>

NameType
isDirectoryboolean
isFileboolean

writeFile()

writeFile(path, content): Promise<void>

Write the file.

Parameters

ParameterTypeDescription
pathstringPath to the file.
contentstringContent of the file.

Returns

Promise<void>