Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
4c1bc50
perf(vite): skip the resource URL parse when no URL is spelled
Brooooooklyn Oct 21, 2026
490d0cc
fix(vite): pass preserveWhitespaces to the HMR template compile
Brooooooklyn Oct 21, 2026
e340aa5
perf(vite): preprocess an edited stylesheet once per HMR cycle
Brooooooklyn Oct 21, 2026
f64f27f
chore(vite): remove the unused styles plugin
Brooooooklyn Oct 21, 2026
23d2874
fix(i18n): port parseI18nMeta 1:1 so i18n metadata is trimmed once
Brooooooklyn Oct 21, 2026
601dcc9
fix(template): always run the interpolation parser, as Angular does
Brooooooklyn Oct 21, 2026
0f00648
perf(template): share the i18n source file and stop copying parser input
Brooooooklyn Oct 21, 2026
09cf3ef
perf(transform): compile the HMR template copy only when HMR is on
Brooooooklyn Oct 21, 2026
badf8c2
fix(factory): give classes with no constructor and no superclass empt…
Brooooooklyn Oct 21, 2026
f48c44c
perf(transform): build one oxc Semantic per file in the AOT transform
Brooooooklyn Oct 21, 2026
b1d497a
test(transform): pin HMR templateUpdates content
Brooooooklyn Oct 21, 2026
78e2d23
fix(linker): annotate linked define calls with /*@__PURE__*/
Brooooooklyn Oct 21, 2026
0ea670e
fix(output): emit $localize as a native tagged template
Brooooooklyn Oct 21, 2026
2b6e28d
fix(component): emit consts with initializers as an arrow function
Brooooooklyn Oct 21, 2026
c9ca4a7
fix(injectable): use expression-body arrow factories like ngtsc
Brooooooklyn Oct 21, 2026
8625afb
fix(compare): make the ngtsc fixture comparison honest
Brooooooklyn Oct 21, 2026
26c977f
fix(linker): parse host styleAttribute like the template pipeline
Brooooooklyn Oct 21, 2026
aa5c69c
fix(defer): port Angular's OnTriggerParser for @defer triggers
Brooooooklyn Oct 21, 2026
af567ef
fix(security): sanitize static and i18n attributes like ngtsc
Brooooooklyn Oct 21, 2026
e09bfc7
perf(pipeline): skip needless clones and walks in template phases
Brooooooklyn Oct 21, 2026
a5ae760
fix(ng_module): patch the scope on with a JIT-only ɵɵsetNgModuleScope…
Brooooooklyn Oct 21, 2026
2f89560
fix(styles): gate the legacy ShadowCss polyfill passes on the Angular…
Brooooooklyn Oct 21, 2026
b3464bb
fix(styles): align the CSS shim scanners with Angular v22 shadow_css.ts
Brooooooklyn Oct 21, 2026
22f98ca
perf(cross-file): skip evaluating top-level class and function exports
Brooooooklyn Oct 21, 2026
8915150
fix(linker,optimizer): honour the sourcemap option
Brooooooklyn Oct 21, 2026
0656688
perf(cross-file): parse each analyzed file once per analyzer
Brooooooklyn Oct 21, 2026
953b53b
perf(optimizer): build edit source maps in linear time
Brooooooklyn Oct 21, 2026
c3d1ae0
fix(ng_module): always run ɵɵsetNgModuleScope, without the ngJitMode …
Brooooooklyn Oct 21, 2026
b47c1e3
fix(styles): do not start an at-rule on an @ inside a value or header
Brooooooklyn Oct 21, 2026
3a78e36
fix(compare): compare top-level statements, export targets and BigInt…
Brooooooklyn Oct 21, 2026
6f128c7
fix(linker): annotate the declaration IIFE around define calls as pure
Brooooooklyn Oct 21, 2026
b55322f
fix(vite): drive linker source maps from sourceMap.vendor
Brooooooklyn Oct 21, 2026
bc20ddd
Merge branch 'wave1/p11-honest-compare' into perf/arch-alignment
Brooooooklyn Oct 21, 2026
5a10ecb
Merge branch 'wave1/p1-single-semantic' into perf/arch-alignment
Brooooooklyn Oct 21, 2026
ac55088
Merge branch 'wave1/p9-cross-file-single-parse' into perf/arch-alignment
Brooooooklyn Oct 21, 2026
451072a
Merge branch 'wave1/p8-plugin-quick-wins' into perf/arch-alignment
Brooooooklyn Oct 21, 2026
1ce6c1d
Merge branch 'wave1/p4-template-pipeline' into perf/arch-alignment
Brooooooklyn Oct 21, 2026
bfc3b55
Merge branch 'wave1/p3-template-parser' into perf/arch-alignment
Brooooooklyn Oct 21, 2026
5ab43d4
Merge branch 'wave1/p3b-defer-trigger-lexer' into perf/arch-alignment
Brooooooklyn Oct 21, 2026
5161476
Merge branch 'wave1/p2-css-shim' into perf/arch-alignment
Brooooooklyn Oct 21, 2026
c0e84b8
Merge branch 'wave1/p5-factory-ngmodule' into perf/arch-alignment
Brooooooklyn Oct 21, 2026
c0e0b0b
Merge branch 'wave1/p7-output-form' into perf/arch-alignment
Brooooooklyn Oct 21, 2026
e01de41
Merge branch 'wave1/p12-linker-optimizer' into perf/arch-alignment
Brooooooklyn Oct 21, 2026
1b48c12
test(compare): reconcile known differences after merging wave 1
Brooooooklyn Oct 21, 2026
c84b68e
fix(transform): order class metadata before debug info and module scope
Brooooooklyn Oct 21, 2026
d4ab5c3
feat(vite): load every resource the compiler needs, link stylesheets …
Brooooooklyn Oct 21, 2026
b25dc37
fix(defer): emit the idle trigger timeout
Brooooooklyn Oct 21, 2026
d4aff2a
fix(host): align host bindings and hostDirectives with ngtsc
Brooooooklyn Oct 21, 2026
d308b3e
fix(vite): read only URL fields for resources; register HMR link styles
Brooooooklyn Oct 21, 2026
0251370
fix(styles): port Angular's static style parser 1:1
Brooooooklyn Oct 21, 2026
39c33ef
fix(partial): report template errors in partial compilation
Brooooooklyn Oct 21, 2026
f1c4345
fix(ng-module): add the module's exports to ɵinj imports
Brooooooklyn Oct 21, 2026
ca5972d
feat(component): compile DOM-only templates for standalone components…
Brooooooklyn Oct 21, 2026
67cf8a7
fix(styles): port ShadowCss selector scoping to match Angular's white…
Brooooooklyn Oct 21, 2026
fd66b81
refactor(vite): decide HMR vs reload with a Rust fingerprint, drop th…
Brooooooklyn Oct 21, 2026
fcfb78c
test(ng-module): restore #[test] on test_jit_true_ng_module_skips_aot
Brooooooklyn Oct 21, 2026
419cc4d
fix(napi): keep TransformResult.componentDecorators as a deprecated f…
Brooooooklyn Oct 21, 2026
b6e9a0a
fix(styles): keep host markers together when splitting on a newline
Brooooooklyn Oct 21, 2026
8682353
feat(hmr): compile component updates with the full transform's options
Brooooooklyn Oct 21, 2026
18cf1af
Merge branch 'wave2/w2-boundary' into perf/arch-alignment
Brooooooklyn Oct 21, 2026
8d05315
Merge branch 'wave2/w2d-statement-alignment' into perf/arch-alignment
Brooooooklyn Oct 21, 2026
4046a4b
Merge branch 'wave2/w2f-host-alignment' into perf/arch-alignment
Brooooooklyn Oct 21, 2026
956ef58
Merge branch 'wave2/w2h-dom-only' into perf/arch-alignment
Brooooooklyn Oct 21, 2026
6bc14a2
Merge branch 'wave2/w2i-css-whitespace' into perf/arch-alignment
Brooooooklyn Oct 21, 2026
e4b7239
perf(vite-plugin): cut repeat binding calls on the error and first-HM…
Brooooooklyn Oct 21, 2026
cda5841
fix(styles): skip backslash escapes outside strings when scoping sele…
Brooooooklyn Oct 21, 2026
2fa008a
fix(styles): end an at-rule header at an escaped brace
Brooooooklyn Oct 21, 2026
07e0e37
Merge branch 'fix/review-css' into perf/arch-alignment
Brooooooklyn Oct 21, 2026
45e179c
Merge branch 'fix/review-plugin' into perf/arch-alignment
Brooooooklyn Oct 21, 2026
2cc1795
test(vite): use forward-slash module ids in the fast-path tests
Brooooooklyn Oct 21, 2026
92f6b19
perf(elision): keep only export maps when analyzing files
Brooooooklyn Oct 21, 2026
2caa383
fix(styles): keep the body of an unterminated at-rule
Brooooooklyn Oct 21, 2026
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
53 changes: 53 additions & 0 deletions crates/oxc_angular_compiler/src/class_debug_info/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,56 @@ impl<'a> R3ClassDebugInfo<'a> {
self
}
}

/// The 1-indexed line of byte `offset` in `source`, counting line breaks the
/// way TypeScript's `computeLineStarts` does: `\r\n`, `\r`, `\n`, U+2028 and
/// U+2029 each end a line.
///
/// ngtsc computes `ɵsetClassDebugInfo`'s `lineNumber` with
/// `getLineAndCharacterOfPosition`, which uses those line starts.
pub fn line_number_at(source: &str, offset: usize) -> u32 {
let bytes = &source.as_bytes()[..offset.min(source.len())];
let mut line = 1u32;
let mut i = 0;
while i < bytes.len() {
match bytes[i] {
b'\r' => {
line += 1;
if bytes.get(i + 1) == Some(&b'\n') {
i += 1;
}
}
b'\n' => line += 1,
// U+2028 LINE SEPARATOR and U+2029 PARAGRAPH SEPARATOR are
// E2 80 A8 / E2 80 A9 in UTF-8.
0xE2 if bytes.get(i + 1) == Some(&0x80)
&& matches!(bytes.get(i + 2), Some(&(0xA8 | 0xA9))) =>
{
line += 1;
i += 2;
}
_ => {}
}
i += 1;
}
line
}

#[cfg(test)]
mod tests {
use super::line_number_at;

#[test]
fn counts_typescript_line_breaks() {
assert_eq!(line_number_at("class A {}", 0), 1);
assert_eq!(line_number_at("a\nb\nclass", 4), 3);
// `\r\n` is one line break, a lone `\r` is another.
assert_eq!(line_number_at("a\r\nb\rclass", 6), 3);
// U+2028 and U+2029 end lines too.
let src = "a\u{2028}b\u{2029}class";
assert_eq!(line_number_at(src, src.find("class").unwrap()), 3);
// Other non-ASCII characters do not.
let src = "é\u{2027}class";
assert_eq!(line_number_at(src, src.find("class").unwrap()), 1);
}
}
2 changes: 1 addition & 1 deletion crates/oxc_angular_compiler/src/class_debug_info/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ mod compiler;
mod metadata;

pub use compiler::compile_class_debug_info;
pub use metadata::R3ClassDebugInfo;
pub use metadata::{R3ClassDebugInfo, line_number_at};
Loading
Loading