2018-06-12 03:54:55 +02:00
|
|
|
/// <reference path="deno.d.ts" />
|
2018-06-13 19:37:24 +02:00
|
|
|
import { deno as pb } from "./msg.pb";
|
2018-06-12 03:54:55 +02:00
|
|
|
import * as ts from "typescript";
|
|
|
|
|
2018-06-10 00:32:04 +02:00
|
|
|
const globalEval = eval;
|
|
|
|
const window = globalEval("this");
|
2018-06-13 19:38:22 +02:00
|
|
|
|
2018-06-11 22:29:34 +02:00
|
|
|
window["denoMain"] = () => {
|
2018-06-12 03:54:55 +02:00
|
|
|
denoPrint(`ts.version: ${ts.version}`);
|
2018-06-13 19:38:22 +02:00
|
|
|
const res = denoPub("startDeno2", emptyArrayBuffer());
|
|
|
|
//denoPrint(`after`);
|
|
|
|
const resUi8 = new Uint8Array(res);
|
|
|
|
denoPrint(`before`);
|
|
|
|
const msg = pb.Msg.decode(resUi8);
|
|
|
|
denoPrint(`after`);
|
|
|
|
const {
|
|
|
|
startCwd: cwd,
|
|
|
|
startArgv: argv,
|
|
|
|
startDebugFlag: debugFlag,
|
|
|
|
startMainJs: mainJs,
|
|
|
|
startMainMap: mainMap
|
|
|
|
} = msg;
|
|
|
|
denoPrint(`cwd: ${cwd}`);
|
2018-06-11 21:32:06 +02:00
|
|
|
};
|
2018-06-13 19:38:22 +02: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([]));
|
|
|
|
}
|