microsoft / microsoft/TypeScript

Add "sourceMapDir", "declarationMapDir", "inlineDeclarationMap", and "declarationMapInlineSources" compiler options

Aperta
#38,966 3 commenti 38 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Awaiting More Feedback Suggestion
Lingua principale
Go
Stelle
111k
Fork
14.4k
Merge medio
1g 19h
PR unite (30g)
117

Descrizione

Search Terms

TypeScript, Compiler Options, Source Maps, Declaration Files

Suggestion

Currently, there exist the TypeScript compiler options sourceMap, inlineSourceMap, inlineSources, declaration, declarationMap, and declarationDir but there is no way to tell the compiler the folder for the source map files and the declaration map files. The declaration map cannot be part of the declaration file, too, and the source code cannot be inlined into a declaration map.

Therefore, please add the compiler options:

  • sourceMapDir: the folder of the emitted source map files;
  • declarationMapDir: the folder of the declaration map files;
  • inlineDeclarationMap: the declaration map is put into the declaration file using a comment;
  • declarationMapInlineSources: the source code becomes part of the declaration map similar to the option inlineSources for generated JavaScript files inlining TypeScript sources.

The options inlineDeclarationMap and declarationMapInlineSources should also be usable together. It is similar to using inlineSourceMap and inlineSources together.

Using Gulp together with gulp-typescript and gulp-sourcemaps there is already the possibility to specify a source map folder and declaration map folder using sourcemaps.write("<folder>", options) but it would be better to have that possibility as part of a TypeScript compiler option.

Use Cases

Of course, these compiler options are not necessary in most cases but they open up more flexibility to the user, and the implemetation should not be very difficult.

At least the option inlineDeclarationMap would reduce the cluttering of files in the declarationDir folder, and declarationMapInlineSources together with inlineDeclarationMap would make it possible to ship a declaration file with the sources as one file.

Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
  • This feature would agree with the rest of TypeScript's Design Goals.

Guida per i contributori

Apri la guida per i contributori

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.

Direzione di ricerca

Esamina le opzioni esistenti sourceMap, declarationMap, declarationDir, inlineSourceMap, inlineSources e declaration e la loro gestione come opzioni del compilatore. Traccia il modo in cui le mappe del codice sorgente e delle dichiarazioni generate vengono posizionate o incorporate inline, quindi definisci la copertura per ogni opzione richiesta e per le relative combinazioni. Il lavoro è completato quando le quattro opzioni funzionano insieme come descritto senza modificare il comportamento esistente.

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

Valutazione

Stack tecnologico
typescript
Ambito
compilers
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
30/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.