1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00
denoland-deno/os.ts

27 lines
616 B
TypeScript
Raw Normal View History

2018-05-21 18:53:53 -04:00
import { ModuleInfo } from "./types";
2018-05-21 22:07:40 -04:00
import { sendMsgFromObject } from "./dispatch";
2018-05-14 17:27:34 -04:00
export function exit(code = 0): void {
2018-05-21 22:07:40 -04:00
sendMsgFromObject("os", { exit: { code } });
2018-05-14 17:27:34 -04:00
}
export function sourceCodeFetch(
2018-05-19 04:47:40 -04:00
moduleSpecifier: string,
containingFile: string
): ModuleInfo {
2018-05-21 22:07:40 -04:00
const res = sendMsgFromObject("os", {
2018-05-19 04:47:40 -04:00
sourceCodeFetch: { moduleSpecifier, containingFile }
});
2018-05-19 04:47:40 -04:00
return res.sourceCodeFetchRes;
}
export function sourceCodeCache(
filename: string,
sourceCode: string,
outputCode: string
): void {
2018-05-21 22:07:40 -04:00
sendMsgFromObject("os", {
sourceCodeCache: { filename, sourceCode, outputCode }
});
}