dts: declaration maps (.d.ts.map) are not updated after Ivy members are injected

Ouverte
#693 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
4/5
Temps estimé
3-5 jours
Accessibilité débutants
48/100
Type d'issue
Bug
Clarté
Plutôt claire
Activité
Active
Stack technique
rust, typescript

Piste de recherche

Start by tracing injectDtsDeclarations and dts_inject, then inspect the dts plugin's generateBundle hook and how Rolldown handles declaration map assets and renderChunk maps. Reproduce with tsdown and rolldown-plugin-dts using declaration sourcemaps. Done means injected declaration members have correct source mappings and hashed .d.ts chunk names stay in sync.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

Found while reviewing #683.

The dts plugin rewrites .d.ts text in generateBundle (adds import * as i0 … and the static ɵ… members) but leaves the declaration map alone. In rolldown, the written .d.mts.map is a separate asset that is already in the bundle at that point, so it keeps the old line numbers.

tsdown / rolldown-plugin-dts with dts sourcemap: .d.mts.map is byte-identical with and without the members
line 1 is now `import * as i0 …`, so the first mapping (meant for HelloComponent) points at the import,
and every later class is off by 1 + (number of added member lines)
→ go-to-definition in a consumer's IDE opens the wrong line of the source .ts

The asset path has the same gap. A fix needs the injection points: injectDtsDeclarations only returns the new string, and it doesn't always add whole lines (it splits declare class X {} before the }). Options: have dts_inject return its splices and shift the map (mappings groups per line), or inject from a renderChunk (order: 'post') hook that returns a map. Reviewers checked that rolldown chains such a map, and it also keeps the [hash] of hashed .d.ts chunks in sync.

Langage dominant
Rust
Étoiles
245
Forks
26
Merge moyen
1 j 42 min
PR mergées (30 j)
83

Préparer son environnement

Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de voidzero-dev/oxc-angular-compiler

Toutes les issues de voidzero-dev/oxc-angular-compiler

Issues similaires

Plus d'issues Rust

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.