diff options
author | Kitson Kelly <me@kitsonkelly.com> | 2020-01-21 01:30:30 +1100 |
---|---|---|
committer | Ry Dahl <ry@tinyclouds.org> | 2020-01-20 09:30:30 -0500 |
commit | 60b53fd6b6dc2af83a64c332b9f3a1926f43d631 (patch) | |
tree | 4f4ef1aadb8c79ef2319d728b9d5b132af40ef83 /deno_typescript | |
parent | 23e67eb5153bd26dbae471b27dc6a21a6d283b0b (diff) |
Use globalThis to reference global scope (#3719)
Co-authored-by: Bartek IwaĆczuk <biwanczuk@gmail.com>
Diffstat (limited to 'deno_typescript')
-rw-r--r-- | deno_typescript/compiler_main.js | 2 | ||||
-rw-r--r-- | deno_typescript/lib.deno_core.d.ts | 66 | ||||
-rw-r--r-- | deno_typescript/lib.rs | 6 |
3 files changed, 2 insertions, 72 deletions
diff --git a/deno_typescript/compiler_main.js b/deno_typescript/compiler_main.js index 5cf44b689..94b38e070 100644 --- a/deno_typescript/compiler_main.js +++ b/deno_typescript/compiler_main.js @@ -144,7 +144,7 @@ class Host { * @param {ts.CompilerOptions} _options */ getDefaultLibFileName(_options) { - return "lib.deno_core.d.ts"; + return "lib.esnext.d.ts"; } getDefaultLibLocation() { diff --git a/deno_typescript/lib.deno_core.d.ts b/deno_typescript/lib.deno_core.d.ts deleted file mode 100644 index 21ce6a67f..000000000 --- a/deno_typescript/lib.deno_core.d.ts +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. - -// This file contains APIs that are introduced into the global namespace by -// Deno core. These are not intended to be used directly by runtime users of -// Deno and therefore do not flow through to the runtime type library. - -declare interface MessageCallback { - (msg: Uint8Array): void; -} - -interface EvalErrorInfo { - // Is the object thrown a native Error? - isNativeError: boolean; - // Was the error happened during compilation? - isCompileError: boolean; - // The actual thrown entity - // (might be an Error or anything else thrown by the user) - // If isNativeError is true, this is an Error - // eslint-disable-next-line @typescript-eslint/no-explicit-any - thrown: any; -} - -declare interface DenoCore { - print(s: string, isErr?: boolean): void; - dispatch( - opId: number, - control: Uint8Array, - zeroCopy?: ArrayBufferView | null - ): Uint8Array | null; - setAsyncHandler(opId: number, cb: MessageCallback): void; - sharedQueue: { - head(): number; - numRecords(): number; - size(): number; - push(buf: Uint8Array): boolean; - reset(): void; - shift(): Uint8Array | null; - }; - - ops(): Record<string, number>; - - recv(cb: (opId: number, msg: Uint8Array) => void): void; - - send( - opId: number, - control: null | ArrayBufferView, - data?: ArrayBufferView - ): null | Uint8Array; - - shared: SharedArrayBuffer; - - /** Evaluate provided code in the current context. - * It differs from eval(...) in that it does not create a new context. - * Returns an array: [output, errInfo]. - * If an error occurs, `output` becomes null and `errInfo` is non-null. - */ - // eslint-disable-next-line @typescript-eslint/no-explicit-any - evalContext(code: string): [any, EvalErrorInfo | null]; - - errorToJSON: (e: Error) => string; -} - -declare interface DenoInterface { - core: DenoCore; -} -declare let Deno: DenoInterface; diff --git a/deno_typescript/lib.rs b/deno_typescript/lib.rs index 779e6fd70..370079fa1 100644 --- a/deno_typescript/lib.rs +++ b/deno_typescript/lib.rs @@ -146,7 +146,7 @@ pub fn compile_bundle( }, }); - let mut root_names_str: Vec<String> = root_names + let root_names_str: Vec<String> = root_names .iter() .map(|p| { if !p.exists() { @@ -158,7 +158,6 @@ pub fn compile_bundle( module_specifier.as_str().to_string() }) .collect(); - root_names_str.push("$asset$/lib.deno_core.d.ts".to_string()); // TODO lift js_check to caller? let state = js_check(ts_isolate.compile(&config_json, root_names_str)); @@ -267,9 +266,6 @@ pub fn get_asset(name: &str) -> Option<String> { "bundle_loader.js" => { Some(read_file("../deno_typescript/bundle_loader.js")) } - "lib.deno_core.d.ts" => { - Some(read_file("../deno_typescript/lib.deno_core.d.ts")) - } "lib.deno_runtime.d.ts" => Some(read_file("js/lib.deno_runtime.d.ts")), "bootstrap.ts" => Some("console.log(\"hello deno\");".to_string()), "typescript.d.ts" => inc!("typescript.d.ts"), |