diff options
Diffstat (limited to 'cli/js/compiler')
-rw-r--r-- | cli/js/compiler/bootstrap.ts | 2 | ||||
-rw-r--r-- | cli/js/compiler/host.ts | 18 |
2 files changed, 17 insertions, 3 deletions
diff --git a/cli/js/compiler/bootstrap.ts b/cli/js/compiler/bootstrap.ts index 63de783cf..5f9dfad92 100644 --- a/cli/js/compiler/bootstrap.ts +++ b/cli/js/compiler/bootstrap.ts @@ -20,6 +20,7 @@ ts.libMap.set("deno.ns", "lib.deno.ns.d.ts"); ts.libMap.set("deno.window", "lib.deno.window.d.ts"); ts.libMap.set("deno.worker", "lib.deno.worker.d.ts"); ts.libMap.set("deno.shared_globals", "lib.deno.shared_globals.d.ts"); +ts.libMap.set("deno.unstable", "lib.deno.unstable.d.ts"); // this pre-populates the cache at snapshot time of our library files, so they // are available in the future when needed. @@ -30,6 +31,7 @@ host.getSourceFile( `${ASSETS}/lib.deno.shared_globals.d.ts`, ts.ScriptTarget.ESNext ); +host.getSourceFile(`${ASSETS}/lib.deno.unstable.d.ts`, ts.ScriptTarget.ESNext); export const TS_SNAPSHOT_PROGRAM = ts.createProgram({ rootNames: [`${ASSETS}/bootstrap.ts`], diff --git a/cli/js/compiler/host.ts b/cli/js/compiler/host.ts index 70e712ffe..afe184d3e 100644 --- a/cli/js/compiler/host.ts +++ b/cli/js/compiler/host.ts @@ -14,9 +14,8 @@ export enum CompilerHostTarget { export interface CompilerHostOptions { bundle?: boolean; - target: CompilerHostTarget; - + unstable?: boolean; writeFile: WriteFileCallback; } @@ -146,13 +145,26 @@ export class Host implements ts.CompilerHost { /* Deno specific APIs */ - constructor({ bundle = false, target, writeFile }: CompilerHostOptions) { + constructor({ + bundle = false, + target, + unstable, + writeFile, + }: CompilerHostOptions) { this.#target = target; this.#writeFile = writeFile; if (bundle) { // options we need to change when we are generating a bundle Object.assign(this.#options, defaultBundlerOptions); } + if (unstable) { + this.#options.lib = [ + target === CompilerHostTarget.Worker + ? "lib.deno.worker.d.ts" + : "lib.deno.window.d.ts", + "lib.deno.unstable.d.ts", + ]; + } } configure(path: string, configurationText: string): ConfigureResponse { |