1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-22 15:10:44 -05:00
denoland-deno/deno2/js/main.ts

36 lines
882 B
TypeScript
Raw Normal View History

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";
const globalEval = eval;
const window = globalEval("this");
2018-06-11 22:29:34 +02:00
window["denoMain"] = () => {
2018-06-12 03:54:55 +02:00
denoPrint(`ts.version: ${ts.version}`);
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
};
function typedArrayToArrayBuffer(ta: Uint8Array): ArrayBuffer {
return ta.buffer.slice(
ta.byteOffset,
ta.byteOffset + ta.byteLength
) as ArrayBuffer;
}
function emptyArrayBuffer(): ArrayBuffer {
return typedArrayToArrayBuffer(new Uint8Array([]));
}