deferredImports: partial output never loads the block, and the Angular 22.2 named form does not compile

Aperta
#654 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
angular, rust
Ambito
compilers

Direzione di ricerca

Start with component/decorator.rs, transform/control_flow.rs, and partial/component.rs, which the issue identifies as the parsing, trigger, and partial emit paths. Compare the array and named forms against the reproduction and the ngtsc 22.2 behavior described in the issue. The work is done when the intended array-form behavior is decided and both forms compile and emit deferred dependencies correctly in full and partial modes.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Summary

Two problems with @Component.deferredImports:

  1. With the array form, partial compilation emits no deferBlockDependencies and no dependencies. After linking, the block is ɵɵdefer(1, 0), and the deferred component never loads or renders.
  2. The Angular 22.2 named form (deferredImports: {blk: [ChildCmp]} with @defer (name blk)) does not compile at all. It fails with Unrecognized trigger.

Found while re-checking #623.

Reproduction

// (i) array form. ngtsc 22.2 rejects it in full and partial mode.
@Component({
  selector: 'app',
  // @ts-ignore
  deferredImports: [ChildCmp],
  template: '@defer { <child-cmp /> }',
})
export class App {}

// (ii) named form, Angular 22.2
@Component({
  selector: 'app',
  deferredImports: {blk: [ChildCmp]},
  template: '@defer (name blk) { <child-cmp /> }',
})
export class App {}

ChildCmp is imported from ./child.

ngtsc 22.2.3 oxc (main 5780233)
(i) full error: 'deferredImports' must be an object mapping block names to dependency arrays. accepted. The deps fn is inline, but import {ChildCmp} is kept, so the code is not split
(i) partial same error no deferBlockDependencies. After linking: ɵɵdefer(1, 0), and <child-cmp> never renders
(ii) full const App_Defer_1_DepsFn = () => [import("./child").then(m => m.ChildCmp)], and the import is removed Unrecognized trigger. The source is returned untouched
(ii) partial deferBlockDependencies: [() => [import("./child")…]] and ngDeclareClassMetadataAsync Unrecognized trigger

Where

  • The object form is not parsed: component/decorator.rs (extract_identifier_array).
  • name is rejected as a trigger: transform/control_flow.rs.
  • Partial emit skips deferBlockDependencies: partial/component.rs.

One question is a product call: should oxc keep accepting the array form, which ngtsc 22.2 rejects?

Lingua principale
Rust
Stelle
245
Fork
26
Merge medio
22h 27m
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

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di voidzero-dev/oxc-angular-compiler

Tutte le issue di voidzero-dev/oxc-angular-compiler

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.