編譯器
階層
- 編譯器
建構函式
私有
建構函式
- new
Compiler (): Compiler -
如果直接建構,而不是透過 initCompiler 建構,則會拋出錯誤。
返回 Compiler
方法
compile
- compile(path: string, options?: Options<"sync">): CompileResult
-
Compiler 實例處於活動狀態時,透過它公開的 compile 方法。如果在 Compiler 實例上呼叫 dispose 之後呼叫此方法,則會拋出錯誤。
在 Compiler 實例的生命週期內,給定相同的輸入,此方法將返回與模組根目錄公開的 compile 方法相同的結果。
參數
-
path: string
-
選選項
options: Options<"sync">
返回 CompileResult
-
compileString
- compile
String (source: string, options?: StringOptions<"sync">): CompileResult -
Compiler 實例處於活動狀態時,透過它公開的 compileString 方法。如果在 Compiler 實例上呼叫 dispose 之後呼叫此方法,則會拋出錯誤。
在 Compiler 實例的生命週期內,給定相同的輸入,這將返回與模組根目錄公開的 compileString 方法相同的結果。
參數
-
來源 (source): 字串 (string)
-
可選 (Optional)
選項 (options): 字串選項 (StringOptions)<"同步 (sync)">
返回 CompileResult
-
釋放 (dispose)
- 釋放 (dispose)(): 無 (void)
-
結束此 Compiler 實例的生命週期。呼叫此方法後,所有對 Compiler 實例的 compile 或 compileString 方法的呼叫都將導致錯誤。
返回 無 (void)
建立同步編譯器的結果。由
initCompiler
返回。