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分
- マージ済み PR(30日)
- 87
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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
-
`mise doctor` Shows Not Installed Lazy Tools as Problems対応中かも @jdx が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
メンテナーはふだん 1 日以内に返信
-
nn::linear: weight initialization depends on `bias` because the bias is created before the weight対応中かも @monfortema が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
LaurentMazare/tch-rs#1067 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
astral-sh/astral-codec#234 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100