Skip to content
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
17 changes: 15 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 @@ -95,7 +95,7 @@ oxc_napi = "0.133"
oxc_parser = "0.133"
oxc_semantic = "0.133"
oxc_span = "0.133"
oxc_sourcemap = "6.0.1"
oxc_sourcemap = "7.0.0"
oxc_str = "0.133"
oxc_transformer = "0.133"
oxc_codegen = "0.133"
Expand Down
4 changes: 2 additions & 2 deletions crates/oxc_angular_compiler/src/component/transform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ pub struct TemplateCompileOutput {
pub code: String,

/// Source map (if sourcemap option was enabled).
pub map: Option<oxc_sourcemap::SourceMap>,
pub map: Option<oxc_sourcemap::OwnedSourceMap>,
}

impl TemplateCompileOutput {
Expand All @@ -344,7 +344,7 @@ impl TemplateCompileOutput {
}

/// Create a new template compile output with code and source map.
pub fn with_source_map(code: String, map: Option<oxc_sourcemap::SourceMap>) -> Self {
pub fn with_source_map(code: String, map: Option<oxc_sourcemap::OwnedSourceMap>) -> Self {
Self { code, map }
}
}
Expand Down
12 changes: 6 additions & 6 deletions crates/oxc_angular_compiler/src/output/emitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ impl EmitterContext {
/// Returns `None` if no source file information was provided or no mappings exist.
///
/// See: `packages/compiler/src/output/abstract_emitter.ts:126-184`
pub fn to_source_map(&self, generated_file: Option<&str>) -> Option<oxc_sourcemap::SourceMap> {
pub fn to_source_map(&self, generated_file: Option<&str>) -> Option<oxc_sourcemap::OwnedSourceMap> {
// Need source file to generate a source map
let source_file = self.source_file.as_ref()?;
let source_url = &source_file.url;
Expand Down Expand Up @@ -297,7 +297,7 @@ impl EmitterContext {
}
}

if has_mappings { Some(builder.into_sourcemap()) } else { None }
if has_mappings { Some(builder.into_owned_sourcemap()) } else { None }
}

/// Generate source and source map together.
Expand All @@ -307,7 +307,7 @@ impl EmitterContext {
pub fn to_source_with_map(
&self,
generated_file: Option<&str>,
) -> (String, Option<oxc_sourcemap::SourceMap>) {
) -> (String, Option<oxc_sourcemap::OwnedSourceMap>) {
(self.to_source(), self.to_source_map(generated_file))
}
}
Expand Down Expand Up @@ -408,7 +408,7 @@ impl JsEmitter {
expr: &OutputExpression<'a>,
source_file: Arc<ParseSourceFile>,
generated_file: Option<&str>,
) -> (String, Option<oxc_sourcemap::SourceMap>) {
) -> (String, Option<oxc_sourcemap::OwnedSourceMap>) {
let mut ctx = EmitterContext::with_source_file(source_file);
self.visit_expression(expr, &mut ctx);
ctx.to_source_with_map(generated_file)
Expand All @@ -423,7 +423,7 @@ impl JsEmitter {
stmts: &[OutputStatement<'a>],
source_file: Arc<ParseSourceFile>,
generated_file: Option<&str>,
) -> (String, Option<oxc_sourcemap::SourceMap>) {
) -> (String, Option<oxc_sourcemap::OwnedSourceMap>) {
let mut ctx = EmitterContext::with_source_file(source_file);
self.visit_all_statements(stmts, &mut ctx);
ctx.to_source_with_map(generated_file)
Expand Down Expand Up @@ -1640,7 +1640,7 @@ mod tests {
let map = ctx.to_source_map(Some("test.js")).expect("should generate source map");

// Verify the source map has the expected structure
assert!(map.get_sources().any(|s| s.as_ref() == "test.ts"));
assert!(map.get_sources().any(|s| s == "test.ts"));
assert!(map.get_tokens().count() > 0);
}

Expand Down