2018-06-11 21:54:55 -04:00
|
|
|
/// <reference path="deno.d.ts" />
|
2018-06-13 13:37:24 -04:00
|
|
|
import { deno as pb } from "./msg.pb";
|
2018-06-11 21:54:55 -04:00
|
|
|
import * as ts from "typescript";
|
|
|
|
|
2018-06-09 18:32:04 -04:00
|
|
|
const globalEval = eval;
|
|
|
|
const window = globalEval("this");
|
2018-06-13 13:38:22 -04:00
|
|
|
|
2018-06-11 16:29:34 -04:00
|
|
|
window["denoMain"] = () => {
|
2018-06-14 08:31:31 -04:00
|
|
|
deno.print(`ts.version: ${ts.version}`);
|
|
|
|
const res = deno.pub("startDeno2", emptyArrayBuffer());
|
|
|
|
//deno.print(`after`);
|
2018-06-13 13:38:22 -04:00
|
|
|
const resUi8 = new Uint8Array(res);
|
2018-06-14 08:31:31 -04:00
|
|
|
deno.print(`before`);
|
2018-06-13 13:38:22 -04:00
|
|
|
const msg = pb.Msg.decode(resUi8);
|
2018-06-14 08:31:31 -04:00
|
|
|
deno.print(`after`);
|
2018-06-13 13:38:22 -04:00
|
|
|
const {
|
|
|
|
startCwd: cwd,
|
|
|
|
startArgv: argv,
|
|
|
|
startDebugFlag: debugFlag,
|
|
|
|
startMainJs: mainJs,
|
|
|
|
startMainMap: mainMap
|
|
|
|
} = msg;
|
2018-06-13 19:40:35 -04:00
|
|
|
|
2018-06-14 08:31:31 -04:00
|
|
|
deno.print(`cwd: ${cwd}`);
|
|
|
|
deno.print(`debugFlag: ${debugFlag}`);
|
2018-06-13 19:40:35 -04:00
|
|
|
|
|
|
|
for (let i = 0; i < argv.length; i++) {
|
2018-06-14 08:31:31 -04:00
|
|
|
deno.print(`argv[${i}] ${argv[i]}`);
|
2018-06-13 19:40:35 -04:00
|
|
|
}
|
2018-06-11 15:32:06 -04:00
|
|
|
};
|
2018-06-13 13:38:22 -04: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([]));
|
|
|
|
}
|