mirror of
https://github.com/denoland/deno.git
synced 2025-08-02 18:12:39 +00:00
Merge deno_cli_snapshots into deno_cli (#3064)
This commit is contained in:
parent
9049213867
commit
b81e5db17a
148 changed files with 38 additions and 83 deletions
41
cli/js/main.ts
Normal file
41
cli/js/main.ts
Normal file
|
@ -0,0 +1,41 @@
|
|||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||
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 { window } from "./window.ts";
|
||||
import { setLocation } from "./location.ts";
|
||||
import { setBuildInfo } from "./build.ts";
|
||||
import { setSignals } from "./process.ts";
|
||||
|
||||
function denoMain(preserveDenoNamespace = true, name?: string): void {
|
||||
const s = os.start(preserveDenoNamespace, name);
|
||||
|
||||
setBuildInfo(s.os, s.arch);
|
||||
setSignals();
|
||||
setVersions(s.denoVersion, s.v8Version, s.tsVersion);
|
||||
|
||||
setPrepareStackTrace(Error);
|
||||
|
||||
if (s.mainModule) {
|
||||
assert(s.mainModule.length > 0);
|
||||
setLocation(s.mainModule);
|
||||
}
|
||||
|
||||
log("cwd", s.cwd);
|
||||
|
||||
for (let i = 1; i < s.argv.length; i++) {
|
||||
args.push(s.argv[i]);
|
||||
}
|
||||
log("args", args);
|
||||
Object.freeze(args);
|
||||
|
||||
if (!s.mainModule) {
|
||||
replLoop();
|
||||
}
|
||||
}
|
||||
window["denoMain"] = denoMain;
|
Loading…
Add table
Add a link
Reference in a new issue