diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2018-12-06 23:05:36 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-06 23:05:36 -0500 |
commit | c113df1bb8a0c7d0c560ad32c0291c918c7da7b4 (patch) | |
tree | 0d15de448be602c22aecb2ec65ac7667c437a209 /src/deno_dir.rs | |
parent | 568ac0c9026b6f4012e2511a026bb5eb31a06020 (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 'src/deno_dir.rs')
-rw-r--r-- | src/deno_dir.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/deno_dir.rs b/src/deno_dir.rs index 8f13fd843..a6a741ec1 100644 --- a/src/deno_dir.rs +++ b/src/deno_dir.rs @@ -5,7 +5,9 @@ use errors::DenoResult; use errors::ErrorKind; use fs as deno_fs; use http_util; +use js_errors::SourceMapGetter; use msg; + use ring; use std; use std::fmt::Write; @@ -346,6 +348,24 @@ impl DenoDir { } } +impl SourceMapGetter for DenoDir { + fn get_source_map(&self, script_name: &str) -> Option<String> { + match self.code_fetch(script_name, ".") { + Err(_e) => { + return None; + } + Ok(out) => match out.maybe_source_map { + None => { + return None; + } + Some(source_map) => { + return Some(source_map); + } + }, + } + } +} + fn get_cache_filename(basedir: &Path, url: &Url) -> PathBuf { let host = url.host_str().unwrap(); let host_port = match url.port() { |