Project-wide preserveWhitespaces option is ignored
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 35/100
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Rust
- Stelle
- 244
- Fork
- 26
- Merge medio
- 23h 41m
- PR unite (30g)
- 106
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di voidzero-dev/oxc-angular-compiler
-
Partial mode: NgModule-declared components get no dependencies, so their directives never matchAperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
voidzero-dev/oxc-angular-compiler#655 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
voidzero-dev/oxc-angular-compiler#654 ·
I maintainer di solito rispondono entro 1 giorno
-
Constructor param typed by a same-file interface is injected as a token (ReferenceError at runtime)Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 73/100
voidzero-dev/oxc-angular-compiler#653 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 28/100
voidzero-dev/oxc-angular-compiler#623 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Support useDefineForClassFields: false (Class Field Lowering)Forse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
voidzero-dev/oxc-angular-compiler#73 · 11 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di voidzero-dev/oxc-angular-compiler
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
BurntSushi/jiff#668 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
router-for-me/EasyCLIProxyAPI#534 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
astral-sh/astral-codec#244 ·
I maintainer di solito rispondono entro 1 giorno
-
ready-for-agent
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
bug dependencies kind:fix priority: P3 ready-for-agent
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
shep-pm/shep#1318 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno