2020-01-02 20:13:47 +00:00
|
|
|
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
2019-09-02 21:07:11 +00:00
|
|
|
import "./globals.ts";
|
|
|
|
|
|
|
|
import { assert, log } from "./util.ts";
|
|
|
|
import * as os from "./os.ts";
|
|
|
|
import { args } from "./deno.ts";
|
|
|
|
import { setPrepareStackTrace } from "./error_stack.ts";
|
|
|
|
import { replLoop } from "./repl.ts";
|
|
|
|
import { setVersions } from "./version.ts";
|
|
|
|
import { setLocation } from "./location.ts";
|
2019-09-06 16:57:15 +00:00
|
|
|
import { setBuildInfo } from "./build.ts";
|
|
|
|
import { setSignals } from "./process.ts";
|
2019-09-02 21:07:11 +00:00
|
|
|
|
2020-01-21 14:53:29 +00:00
|
|
|
function bootstrapMainRuntime(): void {
|
|
|
|
const s = os.start(true);
|
2018-08-02 17:13:32 +00:00
|
|
|
|
2019-09-06 16:57:15 +00:00
|
|
|
setBuildInfo(s.os, s.arch);
|
|
|
|
setSignals();
|
2019-09-04 02:12:21 +00:00
|
|
|
setVersions(s.denoVersion, s.v8Version, s.tsVersion);
|
2019-01-29 01:41:28 +00:00
|
|
|
|
2019-07-29 09:11:08 +00:00
|
|
|
setPrepareStackTrace(Error);
|
|
|
|
|
2019-08-26 12:50:21 +00:00
|
|
|
if (s.mainModule) {
|
|
|
|
assert(s.mainModule.length > 0);
|
|
|
|
setLocation(s.mainModule);
|
2019-02-13 02:14:02 +00:00
|
|
|
}
|
2019-08-26 12:50:21 +00:00
|
|
|
log("cwd", s.cwd);
|
2020-01-09 18:37:01 +00:00
|
|
|
for (let i = 0; i < s.argv.length; i++) {
|
2019-08-26 12:50:21 +00:00
|
|
|
args.push(s.argv[i]);
|
2018-06-13 23:40:35 +00:00
|
|
|
}
|
2018-09-22 12:47:44 +00:00
|
|
|
log("args", args);
|
|
|
|
Object.freeze(args);
|
2018-08-17 20:34:30 +00:00
|
|
|
|
2019-10-04 13:02:36 +00:00
|
|
|
if (!s.mainModule) {
|
2018-11-05 17:55:59 +00:00
|
|
|
replLoop();
|
|
|
|
}
|
2018-07-22 01:14:52 +00:00
|
|
|
}
|
2020-01-21 14:53:29 +00:00
|
|
|
globalThis["bootstrapMainRuntime"] = bootstrapMainRuntime;
|