mirror of
https://github.com/denoland/deno.git
synced 2024-12-21 23:04:45 -05:00
Fix stacktraces in deno_ns
This commit is contained in:
parent
c4cafcecb1
commit
2c8bdd2f5f
2 changed files with 19 additions and 4 deletions
13
BUILD.gn
13
BUILD.gn
|
@ -321,6 +321,11 @@ run_node("bundle") {
|
|||
}
|
||||
|
||||
source_set("libdeno_nosnapshot") {
|
||||
bundle_outputs = get_target_outputs(":bundle")
|
||||
bundle_location = rebase_path(bundle_outputs[0])
|
||||
bundle_rel_location = rebase_path(bundle_outputs[0], root_build_dir)
|
||||
bundle_map_location = rebase_path(bundle_outputs[1])
|
||||
inputs = bundle_outputs
|
||||
sources = [
|
||||
"src/from_filesystem.cc",
|
||||
]
|
||||
|
@ -329,9 +334,11 @@ source_set("libdeno_nosnapshot") {
|
|||
":deno_bindings",
|
||||
]
|
||||
configs += [ ":deno_config" ]
|
||||
bundle_outputs = get_target_outputs(":bundle")
|
||||
bundle_location = rebase_path(bundle_outputs[0])
|
||||
defines = [ "BUNDLE_LOCATION=\"$bundle_location\"" ]
|
||||
defines = [
|
||||
"BUNDLE_LOCATION=\"$bundle_location\"",
|
||||
"BUNDLE_REL_LOCATION=\"$bundle_rel_location\"",
|
||||
"BUNDLE_MAP_LOCATION=\"$bundle_map_location\"",
|
||||
]
|
||||
}
|
||||
|
||||
ts_flatbuffer("msg_ts") {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue