diff options
author | Kitson Kelly <me@kitsonkelly.com> | 2018-08-10 10:41:12 -0700 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2018-08-10 11:50:45 -0700 |
commit | 2c8bdd2f5fda04254551d04923ef91c79524282f (patch) | |
tree | 28a1a4f69bd318f9c123782fad8fd913835d6707 /src | |
parent | c4cafcecb1f50e38275b7d82852fd33b63964fb2 (diff) |
Fix stacktraces in deno_ns
Diffstat (limited to 'src')
-rw-r--r-- | src/from_filesystem.cc | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/from_filesystem.cc b/src/from_filesystem.cc index 797659de0..fa50c0515 100644 --- a/src/from_filesystem.cc +++ b/src/from_filesystem.cc @@ -1,4 +1,5 @@ // Copyright 2018 the Deno authors. All rights reserved. MIT license. +// This file is used to load the bundle at start for deno_ns. #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -17,6 +18,9 @@ Deno* NewFromFileSystem(void* data, deno_recv_cb cb) { std::string js_source; CHECK(deno::ReadFileToString(BUNDLE_LOCATION, &js_source)); + std::string js_source_map; + CHECK(deno::ReadFileToString(BUNDLE_MAP_LOCATION, &js_source_map)); + Deno* d = new Deno; d->currentArgs = nullptr; d->cb = cb; @@ -32,7 +36,11 @@ Deno* NewFromFileSystem(void* data, deno_recv_cb cb) { { v8::HandleScope handle_scope(isolate); auto context = v8::Context::New(isolate); - InitializeContext(isolate, context, BUNDLE_LOCATION, js_source, nullptr); + // BUNDLE_LOCATION is absolute so deno_ns can load the bundle independently + // of the cwd. However for source maps to work, the bundle location relative + // to the build path must be supplied: BUNDLE_REL_LOCATION. + InitializeContext(isolate, context, BUNDLE_REL_LOCATION, js_source, + &js_source_map); d->context.Reset(d->isolate, context); } |