Skip to content

Commit

Permalink
revert: feat: support custom source root (#5522) (#5561)
Browse files Browse the repository at this point in the history
Revert "feat: support custom source root (#5522)"

This reverts commit fe785af.
  • Loading branch information
SyMind authored Feb 1, 2024
1 parent 8072775 commit eaa293c
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 43 deletions.
6 changes: 4 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ quote = { version = "1.0.35" }
rayon = { version = "1.8.1" }
regex = { version = "1.10.3" }
rkyv = { version = "0.7.43" }
rspack_sources = { version = "=0.2.9" }
rspack_sources = { version = "=0.2.7" }
rustc-hash = { version = "1.1.0" }
schemars = { version = "0.8.16" }
serde = { version = "1.0.196" }
Expand Down
17 changes: 6 additions & 11 deletions crates/rspack_plugin_devtool/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ pub struct SourceMapDevToolPlugin {
no_sources: bool,
public_path: Option<String>,
module: bool,
source_root: Option<String>,
#[derivative(Debug = "ignore")]
test: Option<TestFn>,
}
Expand Down Expand Up @@ -179,7 +178,6 @@ impl SourceMapDevToolPlugin {
no_sources: options.no_sources,
public_path: options.public_path,
module: options.module,
source_root: options.source_root,
test: options.test,
}
}
Expand Down Expand Up @@ -303,7 +301,7 @@ impl Plugin for SourceMapDevToolPlugin {
let mut has_name = used_names_set.contains(&source_name);
if !has_name {
used_names_set.insert(source_name.clone());
*source = Cow::from(source_name);
*source = source_name;
continue;
}

Expand All @@ -325,7 +323,7 @@ impl Plugin for SourceMapDevToolPlugin {
has_name = used_names_set.contains(&source_name);
if !has_name {
used_names_set.insert(source_name.clone());
*source = Cow::from(source_name);
*source = source_name;
continue;
}

Expand All @@ -335,16 +333,13 @@ impl Plugin for SourceMapDevToolPlugin {
has_name = used_names_set.contains(&source_name);
}
used_names_set.insert(source_name.clone());
*source = Cow::from(source_name);
*source = source_name;
}
if self.no_sources {
for content in source_map.sources_content_mut() {
*content = Cow::from(String::default());
*content = String::default();
}
}
if let Some(source_root) = &self.source_root {
source_map.set_source_root(Some(source_root.clone()));
}
let mut source_map_buffer = Vec::new();
source_map
.to_writer(&mut source_map_buffer)
Expand Down Expand Up @@ -796,11 +791,11 @@ impl EvalSourceMapDevToolPlugin {
for source in map.sources_mut() {
let resource_path = normalize_custom_filename(source);
let resource_path = contextify(&compilation.options.context, resource_path);
*source = Cow::from(resource_path);
*source = resource_path;
}
if self.no_sources {
for content in map.sources_content_mut() {
*content = Cow::from(String::default());
*content = String::default();
}
}
let mut map_buffer = Vec::new();
Expand Down

This file was deleted.

This file was deleted.

1 comment on commit eaa293c

@rspack-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Benchmark detail: Open

Name Base (2024-02-01 e4dc2f4) Current Change
10000_development-mode + exec 1.7 s ± 14 ms 1.7 s ± 25 ms +0.05 %
10000_development-mode_hmr + exec 950 ms ± 10 ms 955 ms ± 8.5 ms +0.59 %
10000_production-mode + exec 2.75 s ± 46 ms 2.75 s ± 69 ms +0.10 %
arco-pro_development-mode + exec 2.69 s ± 32 ms 2.72 s ± 43 ms +1.19 %
arco-pro_development-mode_hmr + exec 1.09 s ± 16 ms 1.09 s ± 9.5 ms -0.11 %
arco-pro_production-mode + exec 4.29 s ± 57 ms 4.29 s ± 66 ms +0.16 %
threejs_development-mode_10x + exec 1.99 s ± 25 ms 2 s ± 24 ms +0.67 %
threejs_development-mode_10x_hmr + exec 1.23 s ± 14 ms 1.25 s ± 22 ms +1.96 %
threejs_production-mode_10x + exec 5.81 s ± 40 ms 5.85 s ± 37 ms +0.57 %

Please sign in to comment.