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 小時 新手友好度 61/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 84/100
rust-embedded/heapless#694 ·
-
難度 1/5 1 小時以內 新手友好度 75/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 72/100
farion1231/cc-switch#8899 · 2 則留言 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 82/100
manuscript-lang/manuscript#1364 ·
維護者通常 1 天內回覆