TypeScript icon indicating copy to clipboard operation
TypeScript copied to clipboard

Enables passing `--declaration`, `--emitDeclarationOnly`, `--declarationMap`, `--soureMap` and `--inlineSourceMap` to `tsc --build`

Open sheetalkamat opened this issue 3 years ago • 0 comments

This enables passing --declaration, --emitDeclarationOnly, --declarationMap, --soureMap and --inlineSourceMap to tsc --build. As part of this change:

  1. tsbuildInfo stores these options so that we can check if we need to re-emit because of the flag changes,
  2. Changes to builder include, storing affectedFilesPendingEmit as has BuilderFileEmit which is flag of JS, Dts, DtsMap etc. determining what kind of emit is pending
  3. emit signatures for composite project encode if emit was done using declrationMap options different from what the current compilerOptions are (eg if there are errors there wont be emit and emitSignature can go out of sync with options). This helps with checking if d.ts has changed or not irrespective of it being emitted with map
  4. Source file version also excludes sourceMappingUrl so that sourceFile version is independent of sourceMap. Both of these steps helps with avoidin unnecessary builds in downstream projects
  5. With --out we store all fileInfos and options so we can correctly calcualte the uptodateness and pending emit(js, dts or none)
  6. Enables the js only emit and handles --out bundling story when doing partial emit (keeping existing js or dts bundle information in buildInfo)

Fixes #51164

sheetalkamat avatar Oct 20 '22 17:10 sheetalkamat