@@ -119,6 +119,21 @@ fn write_resolved(
119119 ) )
120120 ) ?;
121121 }
122+ Ok ( ResolvedSourceMapping :: MappedLibrary {
123+ frame,
124+ project_path,
125+ } ) => {
126+ // There is a mapping to a file in the project directory, but to library code
127+ write ! (
128+ writable,
129+ "{PADDING}{}" ,
130+ formatting_mode. lowlight( & format_args!(
131+ "at {} [{}]" ,
132+ frame. with_path( & project_path. path) ,
133+ original_frame. with_name( None )
134+ ) )
135+ ) ?;
136+ }
122137 Ok ( ResolvedSourceMapping :: MappedProject {
123138 frame,
124139 project_path,
@@ -175,6 +190,10 @@ enum ResolvedSourceMapping {
175190 project_path : FileSystemPathReadRef ,
176191 lines : FileLinesContentReadRef ,
177192 } ,
193+ MappedLibrary {
194+ frame : StackFrame < ' static > ,
195+ project_path : FileSystemPathReadRef ,
196+ } ,
178197}
179198
180199async fn resolve_source_mapping (
@@ -212,6 +231,7 @@ async fn resolve_source_mapping(
212231 . await ?;
213232 match & * trace {
214233 TraceResult :: Found ( frame) => {
234+ let lib_code = frame. file . contains ( "/node_modules/" ) ;
215235 if let Some ( project_path) = frame. file . strip_prefix ( concatcp ! (
216236 "/" ,
217237 SOURCE_MAP_ROOT_NAME ,
@@ -220,12 +240,19 @@ async fn resolve_source_mapping(
220240 "]/"
221241 ) ) {
222242 let fs_path = project_dir. join ( project_path) ;
223- let lines = fs_path. read ( ) . lines ( ) . await ?;
224- return Ok ( ResolvedSourceMapping :: MappedProject {
225- frame : frame. clone ( ) ,
226- project_path : fs_path. await ?,
227- lines,
228- } ) ;
243+ if lib_code {
244+ return Ok ( ResolvedSourceMapping :: MappedLibrary {
245+ frame : frame. clone ( ) ,
246+ project_path : fs_path. await ?,
247+ } ) ;
248+ } else {
249+ let lines = fs_path. read ( ) . lines ( ) . await ?;
250+ return Ok ( ResolvedSourceMapping :: MappedProject {
251+ frame : frame. clone ( ) ,
252+ project_path : fs_path. await ?,
253+ lines,
254+ } ) ;
255+ }
229256 }
230257 Ok ( ResolvedSourceMapping :: Mapped {
231258 frame : frame. clone ( ) ,
0 commit comments