Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: path relative and join method #8903

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions crates/rspack_plugin_devtool/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ rspack_util = { workspace = true }
rustc-hash = { workspace = true }
simd-json = { workspace = true }
tracing = { workspace = true }
sugar_path = { workspace = true }

[package.metadata.cargo-shear]
ignored = ["tracing"]
22 changes: 11 additions & 11 deletions crates/rspack_plugin_devtool/src/source_map_dev_tool_plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@ use rspack_error::{error, miette::IntoDiagnostic, Result};
use rspack_hash::RspackHash;
use rspack_hook::{plugin, plugin_hook};
use rspack_util::asset_condition::AssetConditions;
use rspack_util::{
identifier::make_paths_absolute, infallible::ResultInfallibleExt, path::relative,
};
use rspack_util::{identifier::make_paths_absolute, infallible::ResultInfallibleExt};
use rustc_hash::{FxHashMap as HashMap, FxHashSet as HashSet};
use sugar_path::SugarPath;

use crate::{
mapped_assets_cache::MappedAssetsCache, module_filename_helpers::ModuleFilenameHelpers,
Expand Down Expand Up @@ -408,7 +407,8 @@ impl SourceMapDevToolPlugin {
let chunk = file_to_chunk.get(&source_filename);
let filename = match &self.file_context {
Some(file_context) => Cow::Owned(
relative(Path::new(file_context), Path::new(&source_filename))
Path::new(&source_filename)
.relative(Path::new(file_context))
.to_string_lossy()
.to_string(),
),
Expand Down Expand Up @@ -453,13 +453,13 @@ impl SourceMapDevToolPlugin {
source_map_path.push(Component::RootDir);
source_map_path.extend(Path::new(&source_map_filename).components());

relative(
#[allow(clippy::unwrap_used)]
file_path.parent().unwrap(),
&source_map_path,
)
.to_string_lossy()
.to_string()
source_map_path
.relative(
#[allow(clippy::unwrap_used)]
file_path.parent().unwrap(),
)
.to_string_lossy()
.to_string()
};
let data = data.url(&source_map_url);
let current_source_mapping_url_comment = match &current_source_mapping_url_comment {
Expand Down
1 change: 0 additions & 1 deletion crates/rspack_util/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ pub mod infallible;
pub mod itoa;
pub mod location;
pub mod number_hash;
pub mod path;
pub mod queue;
pub mod size;
pub mod source_map;
Expand Down
154 changes: 0 additions & 154 deletions crates/rspack_util/src/path.rs

This file was deleted.

Loading