summaryrefslogtreecommitdiff
path: root/js/main.ts
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2018-12-06 23:05:36 -0500
committerGitHub <noreply@github.com>2018-12-06 23:05:36 -0500
commitc113df1bb8a0c7d0c560ad32c0291c918c7da7b4 (patch)
tree0d15de448be602c22aecb2ec65ac7667c437a209 /js/main.ts
parent568ac0c9026b6f4012e2511a026bb5eb31a06020 (diff)
Process source maps in Rust instead of JS (#1280)
- Improves speed and binary size significantly. - Makes deno_last_exception() output a JSON structure. - Isolate::execute and Isolate::event_loop now return structured, mapped JSError objects on errors. - Removes libdeno functions: libdeno.setGlobalErrorHandler() libdeno.setPromiseRejectHandler() libdeno.setPromiseErrorExaminer() In collaboration with Ryan Dahl.
Diffstat (limited to 'js/main.ts')
-rw-r--r--js/main.ts33
1 files changed, 2 insertions, 31 deletions
diff --git a/js/main.ts b/js/main.ts
index 241e8d7d1..818713593 100644
--- a/js/main.ts
+++ b/js/main.ts
@@ -11,22 +11,9 @@ import { Runner } from "./runner";
import { libdeno } from "./libdeno";
import { args } from "./deno";
import { sendSync, handleAsyncMsgFromRust } from "./dispatch";
-import { promiseErrorExaminer, promiseRejectHandler } from "./promise_util";
import { replLoop } from "./repl";
-import * as sourceMaps from "./v8_source_maps";
import { version } from "typescript";
-// Install the source maps handler and do some pre-calculations so all of it is
-// available in the snapshot
-const compiler = Compiler.instance();
-sourceMaps.install({
- installPrepareStackTrace: true,
- getGeneratedContents: compiler.getGeneratedContents
-});
-const consumer = sourceMaps.loadConsumer("gen/bundle/main.js");
-assert(consumer != null);
-consumer!.computeColumnSpans();
-
function sendStart(): msg.StartRes {
const builder = flatbuffers.createBuilder();
msg.Start.startStart(builder);
@@ -39,27 +26,9 @@ function sendStart(): msg.StartRes {
return startRes;
}
-function onGlobalError(
- message: string,
- source: string,
- lineno: number,
- colno: number,
- error: any // tslint:disable-line:no-any
-) {
- if (error instanceof Error) {
- console.log(error.stack);
- } else {
- console.log(`Thrown: ${String(error)}`);
- }
- os.exit(1);
-}
-
/* tslint:disable-next-line:no-default-export */
export default function denoMain() {
libdeno.recv(handleAsyncMsgFromRust);
- libdeno.setGlobalErrorHandler(onGlobalError);
- libdeno.setPromiseRejectHandler(promiseRejectHandler);
- libdeno.setPromiseErrorExaminer(promiseErrorExaminer);
// First we send an empty "Start" message to let the privileged side know we
// are ready. The response should be a "StartRes" message containing the CLI
@@ -68,6 +37,8 @@ export default function denoMain() {
setLogDebug(startResMsg.debugFlag());
+ const compiler = Compiler.instance();
+
// handle `--types`
if (startResMsg.typesFlag()) {
const defaultLibFileName = compiler.getDefaultLibFileName();