From 8b31fc23cd80de9baa62535e95367da7a21c9cfd Mon Sep 17 00:00:00 2001 From: Nayeem Rahman Date: Fri, 15 Apr 2022 15:08:09 +0100 Subject: refactor: Move source map lookups to core (#14274) The following transformations gradually faced by "JsError" have all been moved up front to "JsError::from_v8_exception()": - finding the first non-"deno:" source line; - moving "JsError::script_resource_name" etc. into the first error stack in case of syntax errors; - source mapping "JsError::script_resource_name" etc. when wrapping the error even though the frame locations are source mapped earlier; - removing "JsError::{script_resource_name,line_number,start_column,end_column}" entirely in favour of "js_error.frames.get(0)". We also no longer pass a js-side callback to "core/02_error.js" from cli. I avoided doing this on previous occasions because the source map lookups were in an awkward place. --- core/lib.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'core/lib.rs') diff --git a/core/lib.rs b/core/lib.rs index 652ad2cd6..9a8cc8ef9 100644 --- a/core/lib.rs +++ b/core/lib.rs @@ -16,6 +16,7 @@ mod ops_builtin; mod ops_metrics; mod resources; mod runtime; +mod source_map; // Re-exports pub use anyhow; @@ -28,6 +29,7 @@ pub use serde_v8::Buffer as ZeroCopyBuf; pub use serde_v8::ByteString; pub use serde_v8::StringOrBuffer; pub use serde_v8::U16String; +pub use sourcemap; pub use url; pub use v8; @@ -96,6 +98,7 @@ pub use crate::runtime::JsRuntime; pub use crate::runtime::RuntimeOptions; pub use crate::runtime::SharedArrayBufferStore; pub use crate::runtime::Snapshot; +pub use crate::source_map::SourceMapGetter; pub use deno_ops::op; pub fn v8_version() -> &'static str { -- cgit v1.2.3