Skip to content
Merged
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
18 changes: 13 additions & 5 deletions crates/oxc_angular_compiler/src/component/transform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6296,6 +6296,7 @@ pub fn compile_host_bindings_for_linker(
selector: Option<&str>,
pool_starting_index: u32,
core_namespace: &str,
angular_version: Option<crate::AngularVersion>,
) -> Option<LinkerHostBindingOutput> {
let allocator = Allocator::default();
let result = compile_host_bindings_from_input(
Expand All @@ -6305,8 +6306,11 @@ pub fn compile_host_bindings_for_linker(
component_name,
selector,
pool_starting_index,
None, // Linker always targets latest Angular version
None, // legacyOptionalChaining: derive from (absent) version
angular_version,
// Angular's linker uses native `?.` for declarations at version 22+ (and the
// placeholder), which is not modeled here yet: keep legacy, and never let the
// application's `angular_version` switch it.
Some(true),
)?;

let emitter = JsEmitter::with_core_namespace(core_namespace);
Expand Down Expand Up @@ -6370,6 +6374,7 @@ pub fn compile_template_for_linker<'a>(
file_path: &str,
preserve_whitespaces: bool,
core_namespace: &str,
angular_version: Option<crate::AngularVersion>,
) -> Result<LinkerTemplateOutput, std::vec::Vec<OxcDiagnostic>> {
use crate::pipeline::ingest::{IngestOptions, ingest_component_with_options};
use oxc_allocator::FromIn;
Expand Down Expand Up @@ -6406,7 +6411,7 @@ pub fn compile_template_for_linker<'a>(
// Stage 2: Transform HTML to R3 AST
let r3_transform_options = R3TransformOptions {
collect_comment_nodes: parse_options.collect_comment_nodes,
angular_version: None,
angular_version,
};
let transformer = HtmlToR3Transform::new(allocator, template, r3_transform_options);
let r3_result = transformer.transform(nodes);
Expand All @@ -6429,8 +6434,11 @@ pub fn compile_template_for_linker<'a>(
template_source: Some(template),
all_deferrable_deps_fn: None,
pool_starting_index: 0,
angular_version: None,
legacy_optional_chaining: None,
angular_version,
// Angular's linker uses native `?.` for declarations at version 22+ (and the
// placeholder), which is not modeled here yet: keep legacy, and never let the
// application's `angular_version` switch it.
legacy_optional_chaining: Some(true),
};

let component_name_atom = Ident::from_in(component_name, &allocator);
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_angular_compiler/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ pub use dts::{
pub use dts_inject::{DtsInjectDeclaration, inject_dts_declarations};

// Re-export linker types
pub use linker::{LinkResult, link};
pub use linker::{LinkOptions, LinkResult, link, link_with_options};

// Re-export optimizer types
pub use optimizer::{OptimizeOptions, OptimizeResult, optimize};
Loading
Loading