@@ -119,6 +119,21 @@ fn write_resolved(
119
119
))
120
120
)?;
121
121
}
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
+ }
122
137
Ok(ResolvedSourceMapping::MappedProject {
123
138
frame,
124
139
project_path,
@@ -175,6 +190,10 @@ enum ResolvedSourceMapping {
175
190
project_path: FileSystemPathReadRef,
176
191
lines: FileLinesContentReadRef,
177
192
},
193
+ MappedLibrary {
194
+ frame: StackFrame<'static>,
195
+ project_path: FileSystemPathReadRef,
196
+ },
178
197
}
179
198
180
199
async fn resolve_source_mapping(
@@ -212,6 +231,7 @@ async fn resolve_source_mapping(
212
231
.await?;
213
232
match &*trace {
214
233
TraceResult::Found(frame) => {
234
+ let lib_code = frame.file.contains("/node_modules/");
215
235
if let Some(project_path) = frame.file.strip_prefix(concatcp!(
216
236
"/",
217
237
SOURCE_MAP_ROOT_NAME,
@@ -220,12 +240,19 @@ async fn resolve_source_mapping(
220
240
"]/"
221
241
)) {
222
242
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
+ }
229
256
}
230
257
Ok(ResolvedSourceMapping::Mapped {
231
258
frame: frame.clone(),
0 commit comments