Skip to content

Commit 47e426d

Browse files
ref: Rename fixup_js_file_end (#2475)
Depends on #2470
1 parent f5ea48c commit 47e426d

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/utils/sourcemaps.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -931,7 +931,7 @@ impl SourceMapProcessor {
931931
// If we don't have a sourcemap, it's not safe to inject the code snippet at the beginning,
932932
// because that would throw off all the mappings. Instead, inject the snippet at the very end.
933933
// This isn't ideal, but it's the best we can do in this case.
934-
inject::fixup_js_file_end(Arc::make_mut(&mut source_file.contents), debug_id)
934+
inject::inject_at_end(Arc::make_mut(&mut source_file.contents), debug_id)
935935
.context(format!("Failed to process {}", source_file.path.display()))?;
936936
debug_id
937937
}
@@ -981,7 +981,7 @@ impl SourceMapProcessor {
981981
source_file_contents.extend(injected.as_bytes());
982982
} else {
983983
// We can't adjust the section offset rows, so we have to inject at the end
984-
inject::fixup_js_file_end(source_file_contents, debug_id)
984+
inject::inject_at_end(source_file_contents, debug_id)
985985
.with_context(|| {
986986
format!(
987987
"Failed to inject debug id into {}",
@@ -1079,13 +1079,13 @@ impl SourceMapProcessor {
10791079
source_file_contents.extend(injected.as_bytes());
10801080
} else {
10811081
// We can't adjust the section offset rows, so we have to inject at the end
1082-
inject::fixup_js_file_end(source_file_contents, debug_id)
1082+
inject::inject_at_end(source_file_contents, debug_id)
10831083
.with_context(|| {
1084-
format!(
1085-
"Failed to inject debug id into {}",
1086-
source_file.path.display()
1087-
)
1088-
})?;
1084+
format!(
1085+
"Failed to inject debug id into {}",
1086+
source_file.path.display()
1087+
)
1088+
})?;
10891089
}
10901090
}
10911091
}
@@ -1131,7 +1131,7 @@ impl SourceMapProcessor {
11311131
// If we don't have a sourcemap, it's not safe to inject the code snippet at the beginning,
11321132
// because that would throw off all the mappings. Instead, inject the snippet at the very end.
11331133
// This isn't ideal, but it's the best we can do in this case.
1134-
inject::fixup_js_file_end(
1134+
inject::inject_at_end(
11351135
Arc::make_mut(&mut source_file.contents),
11361136
debug_id,
11371137
)

src/utils/sourcemaps/inject.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ pub fn fixup_js_file(js_contents: &mut Vec<u8>, debug_id: DebugId) -> Result<Sou
208208
Ok(SourceMap::from_slice(map.as_bytes()).unwrap())
209209
}
210210

211-
/// Fixes up a minified JS source file with a debug id without messing with mappings.
211+
/// Inject a minified JS source file with a debug id without changing mappings.
212212
///
213213
/// This changes the source file in several ways:
214214
/// 1. The source code snippet `<CODE_SNIPPET>[<debug_id>]` is appended to the file.
@@ -221,7 +221,7 @@ pub fn fixup_js_file(js_contents: &mut Vec<u8>, debug_id: DebugId) -> Result<Sou
221221
/// might mess up the mappings by inserting a line, with no opportunity to adjust the
222222
/// sourcemap accordingly. However, in general it is desirable to insert the code snippet
223223
/// as early as possible to make sure it runs even when an error is raised in the file.
224-
pub fn fixup_js_file_end(js_contents: &mut Vec<u8>, debug_id: DebugId) -> Result<()> {
224+
pub fn inject_at_end(js_contents: &mut Vec<u8>, debug_id: DebugId) -> Result<()> {
225225
let mut js_lines = js_contents.lines().collect::<Result<Vec<_>, _>>()?;
226226

227227
js_contents.clear();

0 commit comments

Comments
 (0)