Enables passing --declaration, --emitDeclarationOnly, --declarationMap, --soureMap and --inlineSourceMap to tsc --build by sheetalkamat · Pull Request #51241 · microsoft/TypeScript (original) (raw)

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation11 Commits12 Checks0 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

sheetalkamat

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

jakebailey

@sheetalkamat sheetalkamat changed the title[WIP] Some of the selected options of --build Enables passing --declaration, --emitDeclarationOnly, --declarationMap, --soureMap and --inlineSourceMap to tsc --build

Nov 3, 2022

@sheetalkamat

@sheetalkamat

@sheetalkamat

… sourceMap and inlineSourceMap on commandline of --build

@sheetalkamat

@sheetalkamat

@sheetalkamat

@sheetalkamat

@sheetalkamat

@sheetalkamat

@sheetalkamat

…ggest emitting d.ts files as well

@sheetalkamat

jakebailey

@jakebailey

@typescript-bot

Heya @jakebailey, I've started to run the tarball bundle task on this PR at 34e5ec2. You can monitor the build here.

@typescript-bot

Hey @jakebailey, I've packed this into an installable tgz. You can install it for testing by referencing it in your package.json like so:

{
    "devDependencies": {
        "typescript": "https://typescript.visualstudio.com/cf7ac146-d525-443c-b23c-0d58337efebc/_apis/build/builds/137645/artifacts?artifactName=tgz&fileId=F047FEE07F98961F99E4D66E9BE280123DA2BEDF5528C75C0D43136275FB686E02&fileName=/typescript-5.0.0-insiders.20221104.tgz"
    }
}

and then running npm install.


There is also a playground for this build and an npm module you can use via "typescript": "npm:@typescript-deploys/pr-build@5.0.0-pr-51241-2".;

@jakebailey

Tested it out, and it does appear to work, nice!

Not sure Andrew has had time to look at this quite yet, but it seems reasonable to me. Mostly test baseline changes.

@sheetalkamat

andrewbranch

@Conaclos

Should outDir be accepted as well?
e.g.

tsc --build src --emitDeclarationOnly --outDir dist

For now I got the following error: Compiler option '--outDir' may not be used with '--build'

@sheetalkamat

Should outDir be accepted as well?

all the path related options are per project specific so will not be part of --build because it's for building multiple projects.