diff options
| author | Ryan Dahl <ry@tinyclouds.org> | 2018-05-25 15:24:24 -0400 |
|---|---|---|
| committer | Ryan Dahl <ry@tinyclouds.org> | 2018-05-25 15:24:29 -0400 |
| commit | d765300de5b2786e236b4aea8a61e32faf4ba605 (patch) | |
| tree | 8c3744593acaf6aeb710512241745fcd509b9eb2 /os.ts | |
| parent | 8eeededd90c9c44bf5c7c50e444cf632930402f5 (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.ts | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -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( |
