2018-07-01 19:23:21 +00:00
|
|
|
// tslint:disable-next-line:no-reference
|
2018-06-12 01:54:55 +00:00
|
|
|
/// <reference path="deno.d.ts" />
|
|
|
|
import * as ts from "typescript";
|
2018-07-04 18:50:28 +00:00
|
|
|
|
|
|
|
import { flatbuffers } from "flatbuffers";
|
|
|
|
import { deno as fbs } from "./msg_generated";
|
2018-06-12 01:54:55 +00:00
|
|
|
|
2018-06-09 22:32:04 +00:00
|
|
|
const globalEval = eval;
|
|
|
|
const window = globalEval("this");
|
2018-06-13 17:38:22 +00:00
|
|
|
|
2018-06-11 20:29:34 +00:00
|
|
|
window["denoMain"] = () => {
|
2018-06-14 12:31:31 +00:00
|
|
|
deno.print(`ts.version: ${ts.version}`);
|
2018-07-01 16:07:12 +00:00
|
|
|
const res = deno.send("startDeno2", emptyArrayBuffer());
|
2018-07-01 19:23:21 +00:00
|
|
|
// deno.print(`after`);
|
2018-06-13 17:38:22 +00:00
|
|
|
const resUi8 = new Uint8Array(res);
|
2018-06-13 23:40:35 +00:00
|
|
|
|
2018-07-04 18:50:28 +00:00
|
|
|
const bb = new flatbuffers.ByteBuffer(resUi8);
|
|
|
|
const msg = fbs.Msg.getRootAsMsg(bb);
|
|
|
|
|
|
|
|
// startDebugFlag: debugFlag,
|
|
|
|
// startMainJs: mainJs,
|
|
|
|
// startMainMap: mainMap
|
|
|
|
const cwd = msg.startCwd();
|
2018-06-14 12:31:31 +00:00
|
|
|
deno.print(`cwd: ${cwd}`);
|
2018-06-13 23:40:35 +00:00
|
|
|
|
2018-07-04 18:50:28 +00:00
|
|
|
const argv: string[] = [];
|
|
|
|
for (let i = 0; i < msg.startArgvLength(); i++) {
|
2018-07-06 15:20:35 +00:00
|
|
|
argv.push(msg.startArgv(i));
|
2018-06-13 23:40:35 +00:00
|
|
|
}
|
2018-07-06 15:20:35 +00:00
|
|
|
deno.print(`argv ${argv}`);
|
2018-06-11 19:32:06 +00:00
|
|
|
};
|
2018-06-13 17:38:22 +00:00
|
|
|
|
|
|
|
function typedArrayToArrayBuffer(ta: Uint8Array): ArrayBuffer {
|
|
|
|
return ta.buffer.slice(
|
|
|
|
ta.byteOffset,
|
|
|
|
ta.byteOffset + ta.byteLength
|
|
|
|
) as ArrayBuffer;
|
|
|
|
}
|
|
|
|
|
|
|
|
function emptyArrayBuffer(): ArrayBuffer {
|
|
|
|
return typedArrayToArrayBuffer(new Uint8Array([]));
|
|
|
|
}
|