mirror of
https://github.com/denoland/deno.git
synced 2025-01-24 16:08:03 -05:00
d43b43ca78
Instead of using core/snapshot_creator.rs, instead two crates are introduced which allow building the snapshot during build.rs. Rollup is removed and replaced with our own bundler. This removes the Node build dependency. Modules in //js now use Deno-style imports with file extensions, rather than Node style extensionless imports. This improves incremental build time when changes are made to //js files by about 40 seconds.
51 lines
1.4 KiB
TypeScript
51 lines
1.4 KiB
TypeScript
// 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 { xevalMain, XevalFunc } from "./xeval.ts";
|
|
import { setVersions } from "./version.ts";
|
|
import { window } from "./window.ts";
|
|
import { setLocation } from "./location.ts";
|
|
import * as Deno from "./deno.ts";
|
|
|
|
function denoMain(preserveDenoNamespace: boolean = true, name?: string): void {
|
|
const s = os.start(preserveDenoNamespace, name);
|
|
|
|
setVersions(s.denoVersion, s.v8Version);
|
|
|
|
// handle `--version`
|
|
if (s.versionFlag) {
|
|
const { console } = window;
|
|
console.log("deno:", Deno.version.deno);
|
|
console.log("v8:", Deno.version.v8);
|
|
console.log("typescript:", Deno.version.typescript);
|
|
os.exit(0);
|
|
}
|
|
|
|
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 (window["_xevalWrapper"] !== undefined) {
|
|
xevalMain(window["_xevalWrapper"] as XevalFunc, s.xevalDelim);
|
|
} else if (!s.mainModule) {
|
|
replLoop();
|
|
}
|
|
}
|
|
window["denoMain"] = denoMain;
|