diff options
author | Kitson Kelly <me@kitsonkelly.com> | 2020-02-19 16:34:11 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-19 00:34:11 -0500 |
commit | 046bbb26913f9da58b0d23ae331e9dab9dc19e59 (patch) | |
tree | 74dd5945ed1ff10ce84fea05c73d9c13b31ad376 /cli/js/compiler_bootstrap.ts | |
parent | 3d5bed35e032ee20e4fe34cad925202c6f0c0d3e (diff) |
Support loading additional TS lib files (#3863)
Fixes #3726
This PR provides support for referencing other lib files (like lib.dom.d.ts that are not
used by default in Deno.
Diffstat (limited to 'cli/js/compiler_bootstrap.ts')
-rw-r--r-- | cli/js/compiler_bootstrap.ts | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/cli/js/compiler_bootstrap.ts b/cli/js/compiler_bootstrap.ts index 817486d12..c502e2e01 100644 --- a/cli/js/compiler_bootstrap.ts +++ b/cli/js/compiler_bootstrap.ts @@ -1,6 +1,7 @@ // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. -import { ASSETS, CompilerHostTarget, Host } from "./compiler_host.ts"; +import { CompilerHostTarget, Host } from "./compiler_host.ts"; +import { ASSETS } from "./compiler_sourcefile.ts"; import { getAsset } from "./compiler_util.ts"; // NOTE: target doesn't really matter here, @@ -14,18 +15,11 @@ 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_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 */ +ts.libs.push("deno.ns", "deno.window", "deno.worker", "deno.shared_globals"); +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"); // this pre-populates the cache at snapshot time of our library files, so they // are available in the future when needed. |