Project-wide preserveWhitespaces option is ignored
维护者通常 1 天内回复
评估
调研方向
Start with compile_component_full and trace how it builds template parse options from metadata.preserve_whitespaces; compare that with the project default described in the issue. Check transformAngularFile and compileComponentHmrUpdate for the same option handling, then run the mentioned ngtsc spec, "should take preserveWhitespaces config option into account." Done means the project-wide setting is honored while a component decorator can override it; pull request #637 is already open.
由索引模型根据 Issue 内容生成。
描述
Summary
The project-wide preserveWhitespaces option (ngc's angularCompilerOptions.preserveWhitespaces) is ignored. TransformOptions.preserveWhitespaces exists, but transformAngularFile and compileComponentHmrUpdate only read the decorator's own preserveWhitespaces. A project that sets true globally therefore renders with collapsed whitespace, which can change the gaps between inline elements. The Vite plugin also has no way to set it.
Found by running Angular's ngtsc spec ngtsc_spec.ts: "should take preserveWhitespaces config option into account" against oxc.
Reproduction
import {Component} from '@angular/core';
@Component({selector: 'test', template: `<div>
Template with whitespaces
</div>`})
export class TestCmp {}
compiled with transformAngularFileSync(src, file, { preserveWhitespaces: true }).
Actual
i0.ɵɵtext(1, " Template with whitespaces ");
Expected (ngc, preserveWhitespaces: true)
i0.ɵɵtext(1, "\n Template with whitespaces\n ");
Cause
compile_component_full builds the template parse options from metadata.preserve_whitespaces only. ngtsc's parseTemplateDeclaration (annotations/component/src/resources.ts) starts from the project default and lets the decorator override it.
- 主要语言
- Rust
- 星标
- 244
- 派生
- 26
- 平均合并
- 1 天 16 分钟
- 30 天内合并 PR
- 87
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
voidzero-dev/oxc-angular-compiler 的其他 Issue
-
vite: async/await is not lowered for zone.js, so fakeAsync/tick cannot control awaits可能已有人在做 @edbzn 于 1 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 35/100
voidzero-dev/oxc-angular-compiler#641 ·
维护者通常 1 天内回复
-
Constructor param typed `ns.Foo` (namespace-qualified) compiles to ɵɵinvalidFactoryDep可能已有人在做 @edbzn 于 1 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 25/100
voidzero-dev/oxc-angular-compiler#633 ·
维护者通常 1 天内回复
-
@defer doesn't lazy-load an imports entry written as forwardRef(() => X)可能已有人在做 @edbzn 于 1 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 35/100
voidzero-dev/oxc-angular-compiler#632 ·
维护者通常 1 天内回复
-
Constructor overloads: factory and metadata read the first overload, not the implementation可能已有人在做 @edbzn 于 1 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 35/100
voidzero-dev/oxc-angular-compiler#630 ·
维护者通常 1 天内回复
-
@Injectable deps entries written as [new Optional(), new Self(), Dep] inject the array as the token可能已有人在做 @edbzn 于 1 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 35/100
voidzero-dev/oxc-angular-compiler#629 ·
维护者通常 1 天内回复
查看 voidzero-dev/oxc-angular-compiler 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 70/100
FavioVazquez/mollify#62 ·
-
难度 2/5 1-3 小时 新手友好度 61/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
fendouai/awesome-deepseek-harness#125 ·
维护者通常 4 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
rust-embedded/heapless#694 ·
-
难度 1/5 1 小时以内 新手友好度 75/100
维护者通常 1 天内回复