summaryrefslogtreecommitdiff
path: root/os.ts
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2018-05-25 15:24:24 -0400
committerRyan Dahl <ry@tinyclouds.org>2018-05-25 15:24:29 -0400
commitd765300de5b2786e236b4aea8a61e32faf4ba605 (patch)
tree8c3744593acaf6aeb710512241745fcd509b9eb2 /os.ts
parent8eeededd90c9c44bf5c7c50e444cf632930402f5 (diff)
Move away from oneof in msg.proto
This is due to the size added to msg.pb.js for every new message. See comment in msg.proto.
Diffstat (limited to 'os.ts')
-rw-r--r--os.ts10
1 files changed, 9 insertions, 1 deletions
diff --git a/os.ts b/os.ts
index 409c1186f..de4bdf436 100644
--- a/os.ts
+++ b/os.ts
@@ -1,5 +1,7 @@
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 } });
@@ -12,7 +14,13 @@ export function sourceCodeFetch(
const res = sendMsg("os", {
sourceCodeFetch: { moduleSpecifier, containingFile }
});
- return res.sourceCodeFetchRes;
+ 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(