dts: Ivy members are matched to classes by name only (wrong component metadata, renamed `X$1` left plain)

Aperta
#691 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
43/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
javascript, typescript

Direzione di ricerca

Start in vite-plugin/index.ts, in generateBundle and the byClassName lookup described in the issue. Trace how declaration classes are collected and matched to bundled .d.ts files, especially when names collide or gain $N suffixes. Reproduce the two cases with rolldown-plugin-dts or tsdown; done means each declaration receives only its own component metadata, and a plain class is not given another module's metadata.

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

Descrizione

Found while reviewing #683. Older than it (the asset path has always done this), but #683 makes it reachable for rolldown-plugin-dts / tsdown, where bundling and renames happen.

The dts plugin (vite-plugin/index.ts, generateBundle, byClassName) keys the collected declarations by class name only (last one wins), and injects them into every .d.ts in the bundle by the name it finds there. The source module is never compared.

case 1: same name, two modules, one bundled .d.ts
  src/b/card.component.ts  class Card  (b-card, input title)
  src/c/card.component.ts  class Card  (c-card, input size)
  second.ts: export { Card as BCard } from './b/…'; export { Card as CCard } from './c/…'

  second.d.ts (rolldown-plugin-dts renames the clash):
    declare class Card   { title…; static ɵcmp: ComponentDeclaration<Card, "c-card", …{size}…> }  <- wrong component
    declare class Card$1 { size… }                                                             <- no members → NG2012
  (which module wins changes between runs: wrong metadata in 8 of 12 identical builds)

case 2: same name in another entry
  angular.ts → @Component({selector:'lib-button'}) class Button
  utils.ts   → plain class Button { label = 'x' }

  utils.d.ts: import * as i0 from "@angular/core"; class Button { static ɵfac…; static ɵcmp<Button, "lib-button"…> }

Possible direction: match by source module (the chunk's module ids, the rolldown-plugin-dts $N renames), or at least skip and warn on names that come from more than one module rather than write another class's metadata.

Lingua principale
Rust
Stelle
245
Fork
26
Merge medio
1g 42m
PR unite (30g)
83

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.