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
|
|
|
}
|
|
|
|
|
2018-05-17 09:47:09 -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-17 09:47:09 -04:00
|
|
|
});
|
2018-05-19 04:47:40 -04:00
|
|
|
return res.sourceCodeFetchRes;
|
2018-05-17 09:47:09 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
export function sourceCodeCache(
|
|
|
|
filename: string,
|
|
|
|
sourceCode: string,
|
|
|
|
outputCode: string
|
|
|
|
): void {
|
2018-05-21 22:07:40 -04:00
|
|
|
sendMsgFromObject("os", {
|
2018-05-17 09:47:09 -04:00
|
|
|
sourceCodeCache: { filename, sourceCode, outputCode }
|
2018-05-15 04:39:03 -04:00
|
|
|
});
|
2018-05-17 09:47:09 -04:00
|
|
|
}
|