angular/packages/compiler-cli
Kristiyan Kostadinov 3441f7b914 fix(compiler): error if rawText isn't estimated correctly (#60529) (#60753)
The `TemplateLiteralElementExpr` has some logic where it tries to estimate the `rawText` if one isn't provided by looking at the node's source span. The problem with this approach is that we have some long-standing issues with our expression AST parser (see https://github.com/angular/angular/pull/60267#discussion_r1986402524) where it might not produce accurate spans if escape sequences are involved. This in turn can lead to unrecoverable errors, because TypeScript will throw an error if the raw string doesn't match the cooked one when constructing a TypeScript AST node.

These changes remove the logic that depends on the source span and relies purely on the secondary fallback that inserts escaped characters manually.

It's also worth noting that the `rawText` doesn't seem to matter much at this point, because the main usage of it is when downlevelling template literals to ES5 which we no longer support.

Fixes #60528.

PR Close #60529

PR Close #60753
2025-04-07 13:15:02 -07:00
..
integrationtest Revert "refactor(core): remove unused injection props (#59209)" (#59386) 2025-01-06 21:35:58 +00:00
linker refactor(compiler-cli): convert scripts within packages/compiler-cli to relative imports (#60655) 2025-04-01 11:59:14 +00:00
ngcc refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
private build: properly compile tests in core with Angular compiler (#60268) 2025-03-07 11:00:48 -08:00
src refactor(compiler-cli): convert scripts within packages/compiler-cli to relative imports (#60655) 2025-04-01 11:59:14 +00:00
test fix(compiler): error if rawText isn't estimated correctly (#60529) (#60753) 2025-04-07 13:15:02 -07:00
BUILD.bazel refactor(platform-server): Add an ssr benchmark setup. (#57647) 2024-10-04 10:45:22 -07:00
esbuild.config.js refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
index.ts refactor(compiler-cli): expose diagnostic error code (#59353) 2025-01-06 16:21:26 +00:00
package.json build: update babel dependencies to v7.26.9 (#59743) 2025-02-14 19:15:15 +00:00
tsconfig-build.json refactor(compiler-cli): dismantle View Engine implementation of ngc (#44269) 2021-12-01 10:36:30 -08:00
tsconfig.json build: update tsconfigs to use ES2020 as target and module (#43431) 2021-10-01 18:28:42 +00:00