mirror of
https://github.com/denoland/deno.git
synced 2024-11-24 15:19:26 -05:00
d765300de5
This is due to the size added to msg.pb.js for every new message. See comment in msg.proto.
34 lines
890 B
TypeScript
34 lines
890 B
TypeScript
import { ModuleInfo } from "./types";
|
|
import { sendMsg } from "./dispatch";
|
|
import { main as pb } from "./msg.pb";
|
|
import { assert } from "./util";
|
|
|
|
export function exit(code = 0): void {
|
|
sendMsg("os", { exit: { code } });
|
|
}
|
|
|
|
export function sourceCodeFetch(
|
|
moduleSpecifier: string,
|
|
containingFile: string
|
|
): ModuleInfo {
|
|
const res = sendMsg("os", {
|
|
sourceCodeFetch: { moduleSpecifier, containingFile }
|
|
});
|
|
assert(res.command === pb.Msg.Command.SOURCE_CODE_FETCH_RES);
|
|
return {
|
|
moduleName: res.sourceCodeFetchResModuleName,
|
|
filename: res.sourceCodeFetchResFilename,
|
|
sourceCode: res.sourceCodeFetchResSourceCode,
|
|
outputCode: res.sourceCodeFetchResOutputCode
|
|
};
|
|
}
|
|
|
|
export function sourceCodeCache(
|
|
filename: string,
|
|
sourceCode: string,
|
|
outputCode: string
|
|
): void {
|
|
sendMsg("os", {
|
|
sourceCodeCache: { filename, sourceCode, outputCode }
|
|
});
|
|
}
|