Prevent circular imports in ts code (#576)

This commit is contained in:
Francesco Borzì 2018-08-25 21:42:49 +02:00 committed by Ryan Dahl
parent 3bcf7e271f
commit 84c38f34ee
12 changed files with 42 additions and 26 deletions

18
js/libdeno.ts Normal file
View file

@ -0,0 +1,18 @@
import { RawSourceMap } from "./types";
import { globalEval } from "./global-eval";
// The libdeno functions are moved so that users can't access them.
type MessageCallback = (msg: Uint8Array) => void;
interface Libdeno {
recv(cb: MessageCallback): void;
send(msg: ArrayBufferView): null | Uint8Array;
print(x: string): void;
mainSource: string;
mainSourceMap: RawSourceMap;
}
const window = globalEval("this");
export const libdeno = window.libdeno as Libdeno;