summaryrefslogtreecommitdiff
path: root/cli/js/compiler_bootstrap.ts
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2020-01-29 18:54:23 +0100
committerGitHub <noreply@github.com>2020-01-29 18:54:23 +0100
commit161adfc51b750a7c8c62a898ea9948c2ad5b6cd9 (patch)
tree6d53db2a4acd30207372f665a3ba463e26db6fcf /cli/js/compiler_bootstrap.ts
parentd14864c57cebbd1d5bc18b8a9e05e522eb9987b0 (diff)
workers: proper TS libs, more spec-compliant APIs (#3812)
* split lib.deno_main.d.ts into: - lib.deno.shared_globals.d.ts - lib.deno.window.d.ts - lib.deno.worker.d.ts * remove no longer used libs: - lib.deno_main.d.ts - lib.deno_worker.d.ts * change module loading to use proper TS library for compilation * align to Worker API spec: - Worker.terminate() - self.close() - self.name
Diffstat (limited to 'cli/js/compiler_bootstrap.ts')
-rw-r--r--cli/js/compiler_bootstrap.ts24
1 files changed, 17 insertions, 7 deletions
diff --git a/cli/js/compiler_bootstrap.ts b/cli/js/compiler_bootstrap.ts
index afb3d2be5..585aec016 100644
--- a/cli/js/compiler_bootstrap.ts
+++ b/cli/js/compiler_bootstrap.ts
@@ -15,17 +15,27 @@ const options = host.getCompilationSettings();
// This is a hacky way of adding our libs to the libs available in TypeScript()
// as these are internal APIs of TypeScript which maintain valid libs
/* eslint-disable @typescript-eslint/no-explicit-any */
-(ts as any).libs.push("deno_main", "deno_worker", "deno");
-(ts as any).libMap.set("deno_main", "lib.deno_main.d.ts");
-(ts as any).libMap.set("deno_worker", "lib.deno_worker.d.ts");
-(ts as any).libMap.set("deno", "lib.deno.d.ts");
+(ts as any).libs.push(
+ "deno_ns",
+ "deno_window",
+ "deno_worker",
+ "deno_shared_globals"
+);
+(ts as any).libMap.set("deno_ns", "lib.deno.ns.d.ts");
+(ts as any).libMap.set("deno_window", "lib.deno.window.d.ts");
+(ts as any).libMap.set("deno_worker", "lib.deno.worker.d.ts");
+(ts as any).libMap.set("deno_shared_globals", "lib.deno.shared_globals.d.ts");
/* eslint-enable @typescript-eslint/no-explicit-any */
// this pre-populates the cache at snapshot time of our library files, so they
// are available in the future when needed.
-host.getSourceFile(`${ASSETS}/lib.deno_main.d.ts`, ts.ScriptTarget.ESNext);
-host.getSourceFile(`${ASSETS}/lib.deno_worker.d.ts`, ts.ScriptTarget.ESNext);
-host.getSourceFile(`${ASSETS}/lib.deno.d.ts`, ts.ScriptTarget.ESNext);
+host.getSourceFile(`${ASSETS}/lib.deno.ns.d.ts`, ts.ScriptTarget.ESNext);
+host.getSourceFile(`${ASSETS}/lib.deno.window.d.ts`, ts.ScriptTarget.ESNext);
+host.getSourceFile(`${ASSETS}/lib.deno.worker.d.ts`, ts.ScriptTarget.ESNext);
+host.getSourceFile(
+ `${ASSETS}/lib.deno.shared_globals.d.ts`,
+ ts.ScriptTarget.ESNext
+);
/**
* This function spins up TS compiler and loads all available libraries