Skip to content
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 and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 12 commits into from
Nov 7, 2022

Conversation

sheetalkamat
Copy link
Member

@sheetalkamat sheetalkamat commented Oct 20, 2022

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 sheetalkamat force-pushed the commandLineBuildSelected branch 4 times, most recently from 648ce65 to 35994b1 Compare October 21, 2022 22:11
@typescript-bot typescript-bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Oct 21, 2022
@sheetalkamat sheetalkamat force-pushed the commandLineBuildSelected branch 4 times, most recently from 32921e8 to 0efa044 Compare October 21, 2022 23:34
@sheetalkamat sheetalkamat force-pushed the commandLineBuildSelected branch 13 times, most recently from e5a439f to a1390a0 Compare November 3, 2022 21:30
@sheetalkamat sheetalkamat marked this pull request as ready for review November 3, 2022 21:40
@sheetalkamat sheetalkamat changed the title [WIP] Some of the selected options of --build Nov 3, 2022
@jakebailey
Copy link
Member

@typescript-bot pack this

Going to try this on the module branch.

@typescript-bot
Copy link
Collaborator

typescript-bot commented Nov 4, 2022

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

@typescript-bot
Copy link
Collaborator

typescript-bot commented Nov 4, 2022

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
Copy link
Member

jakebailey commented Nov 5, 2022

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.

@typescript-bot typescript-bot added For Milestone Bug PRs that fix a bug with a specific milestone and removed For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Nov 7, 2022
@Conaclos
Copy link

Conaclos commented Jan 27, 2023

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
Copy link
Member Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Milestone Bug PRs that fix a bug with a specific milestone
5 participants