GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Expose incremental Compile-on-Save builder API · Issue #17493 · microsoft/TypeScript

Expose incremental Compile-on-Save builder API #17493

New issue
Copy link
New issue
Copy link
Closed
Closed
Expose incremental Compile-on-Save builder API#17493
Copy link
Assignees
sheetalkamat
Labels
CommittedThe team has roadmapped this issueThe team has roadmapped this issueCommunity ToolingThis might be better handled by tooling from the community instead of built into TypeScriptThis might be better handled by tooling from the community instead of built into TypeScriptDomain: APIRelates to the public API for TypeScriptRelates to the public API for TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issueSuggestionAn idea for TypeScriptAn idea for TypeScript
Milestone
TypeScript 2.7.1

Description

@DanielRosenwasser
Daniel Rosenwasser (DanielRosenwasser)
opened on Jul 28, 2017
Issue body actions

In #10879, Sheetal Nandi (@sheetalkamat) is working on bringing the same logic in the language server to Compile-on-Save. We would like to expose that as an API so that other build tools (e.g. Webpack loaders, gulp plugins, Broccoli plugins) and editors (any editor using TS Server) can get:

  • automated resolution logic to detect which files need to be "updated"
  • incremental type-checks to only check the bare minimum of files
    • this means that, for example, requesting errors & building will only trigger a type check on updated/new/impacted files. By "impacted files", I mean files whose type information could potentially have been changed by other updated/new files.

Some prior work that motivated the scenarios here can be seen on PR #3687 by Dirk Bäumer (@dbaeumer).

We'd like to elicit feedback from others in the community. Some folks that immediately come to mind are Sean Larkin (@TheLarkInn) John Reilly (@johnnyreilly) James Brantly (@jbrantly) Stanislav Panferov (@s-panferov) Matt Bierner (@mattbierner) Johannes Rieken (@jrieken) Dirk Bäumer (@dbaeumer) Alex Eagle (@alexeagle) Chuck Jazdzewski (@chuckjaz) Ivo Gabe de Wolff (@ivogabe) and Kris Selden (@krisselden) (Forgive me if I excluded anyone, that's already a decent number of people 😄).

Reacted by Herrington Darkholme, ikokostya, Romain Lepert, Jordi Oliveras Rovira, Stanislav Panferov, Anthony Ciccarello, Sean Larkin, Gulshan, Piotr Oleś, Filipe Silva and 47 more
Reacted by Yuri Pereira Constante, Daniel Yogel and Stanislav Sysoev

Activity

Next
  1. Daniel Rosenwasser (DanielRosenwasser)
    added
    Domain: APIRelates to the public API for TypeScriptRelates to the public API for TypeScript
    CommittedThe team has roadmapped this issueThe team has roadmapped this issue
    Community ToolingThis might be better handled by tooling from the community instead of built into TypeScriptThis might be better handled by tooling from the community instead of built into TypeScript
    SuggestionAn idea for TypeScriptAn idea for TypeScript
    on Jul 28, 2017
  2. Daniel Rosenwasser (DanielRosenwasser)
    added this to the TypeScript 2.5 milestone on Jul 28, 2017
  3. Daniel Rosenwasser (DanielRosenwasser)
    assigned
    Sheetal Nandi (sheetalkamat)
    on Jul 28, 2017
  4. johnnyreilly commented on Jul 29, 2017

    @johnnyreilly
    John Reilly (johnnyreilly)
    on Jul 29, 2017
    More actions

    Exciting!! cc Piotr Oleś (@piotr-oles) Basarat Ali Syed (@basarat) Blake Embrey (@blakeembrey) Herrington Darkholme (@HerringtonDarkholme) Morten Houston Ludvigsen (@MortenHoustonLudvigsen)

    It sounds like the addition of this will make for simpler build tools. Put simply, I figure certain tools will need to do less work with this is in place. Perhaps it would be useful for people to list "things their tools do" which, with the addition of this functionality, they think they won't need to anymore.

    If we cover that we will hopefully ensure that what lands will work in the way that everyone hopes.

    James Brantly (@jbrantly) - I know you're less involved with ts-loader these days but whenever you pitch in your insights are really useful. If you could get a moment to comment on this I think it would be really valuable for everyone. (Obviously no worries if you can't)
    ❤️ 🌻

    Reacted by Daniel Rosenwasser
  5. TheLarkInn commented on Jul 31, 2017

    @TheLarkInn
    Sean Larkin (TheLarkInn)
    on Jul 31, 2017
    Member
    More actions

    Will this be an api that has both sync and async variants?

    Additionally, this sounds awesome so far. I think this lets both John Reilly (@johnnyreilly) and Stanislav Panferov (@s-panferov) remove the soon-to-be deprecated accessing of tapable instances inside the loaders. (Which means tools like happypack Hans Larsen (@hansl) and friends can use @ngtools/webpack maybe as a loader instead (if not much has changed there). Just many many opportunities are now possible, etc.

    💯 💯 💯 💯 💯 💯 💯 💯 💯 💯 💯 💯 💯 💯 💯 💯 💯 💯 💯 💯 💯 💯 💯 💯 💯 💯 💯 💯 💯 💯 💯 💯 💯 💯 💯

  6. johnnyreilly commented on Jul 31, 2017

    @johnnyreilly
    John Reilly (johnnyreilly)
    on Jul 31, 2017
    More actions

    Hi Sean Larkin (@TheLarkInn),

    soon-to-be deprecated accessing of tapable instances inside the loaders

    Do you have a link you could share to this please Sean? I hadn't heard this was happening and would like to read up on it. Thanks!

    Which means tools like happypack Hans Larsen (@hansl) and friends can use maybe as a loader instead

    As an aside, you can use ts-loader with happypack right now. It essentially works by flipping ts-loader into transpile mode and preventing reporting of errors to webpack in the way that ts-loader normally does. (Type checking is moved into another process via a plugin.)

    The reason I mention that is the preventing of reporting to webpack etc is I suspect where we make use of tapable instances. I just want to be clear that I understand where we're hooking into this if that's going to need to change. Thanks!

  7. Daniel Rosenwasser (DanielRosenwasser)
    changed the title [-]Expose Compile-on-Save builder API[/-] [+]Expose incremental Compile-on-Save builder API[/+] on Jul 31, 2017
  8. DanielRosenwasser commented on Aug 1, 2017

    @DanielRosenwasser
    Daniel Rosenwasser (DanielRosenwasser)
    on Aug 1, 2017
    MemberAuthor
    More actions

    To answer the question about sync vs async, I don't think we will have an async API since the compiler runs synchronously.

    Otherwise, something that would be helpful for Sheetal Nandi (@sheetalkamat) to know is what sort of API you all expect to be able to use. Do we have users who need to be able to query for only new diagnostics from files, or is it whole-program errors every time?

    Currently the stripped down design is something like the following

    createWatchMode(
        sysHost: System, 
        callback: (program: Program, changedFiles: string[]) => void,
    ): void
    

    With that, a callback could potentially always just query the program for when it needs new diagnostics, or needs to emit those specific files. It could be that consumers are responsible for caching diagnostics themselves.

  9. krisselden commented on Aug 1, 2017

    @krisselden
    Kris Selden (krisselden)
    on Aug 1, 2017
    More actions

    Daniel Rosenwasser (@DanielRosenwasser) for additions/removals would one diff the prior program source files to the program passed to the callback?

  10. sheetalkamat commented on Aug 1, 2017

    @sheetalkamat
    Sheetal Nandi (sheetalkamat)
    on Aug 1, 2017
    Member
    More actions

    Kris Selden (@krisselden) The changedFiles is list of addition/removed/changed files name list.

  11. johnnyreilly commented on Aug 2, 2017

    @johnnyreilly
    John Reilly (johnnyreilly)
    on Aug 2, 2017
    More actions

    Do we have users who need to be able to query for only new diagnostics from files, or is it whole-program errors every time? .... It could be that consumers are responsible for caching diagnostics themselves.

    My feeling is that having "whole-program errors every time" is simpler from a consumption perspective. Less scope for getting things wrong, less work to do (selfish I know!)

    Looking at the API, I'm assuming the idea is you'd call the callback with changed files and then query for diagnostics immediately after? And this would be fine as the API is sync not async?

    Obviously you're only at design stages right now but if you have a chance, I'd love to see some simple code examples of how you would expect this API to be used. Personally, I find it easier to think about things when I see examples of how something plugs together (and also I've found that when I take things out of the abstract to the practical it shows up considerations I hadn't pondered.) 🌻

  12. DanielRosenwasser commented on Aug 4, 2017

    @DanielRosenwasser
    Daniel Rosenwasser (DanielRosenwasser)
    on Aug 4, 2017
    MemberAuthor
    More actions

    Also I guess this is #9282, sorry Alex Eagle (@alexeagle).

  13. 2 remaining items

  14. Daniel Rosenwasser (DanielRosenwasser)
    removed this from the TypeScript 2.5 milestone on Aug 15, 2017
  15. masaeedu commented on Sep 28, 2017

    @masaeedu
    Asad Saeeduddin (masaeedu)
    on Sep 28, 2017
    Contributor
    More actions

    This is interesting. Could you provide some more details on what features this compile-on-save API exposes? Is it a "read-only" API that simply informs external services of TypeScript's dependency model, or can it also be used to inject other tasks into the dependency graph? Something like the latter would be pretty useful for doing codegen.

  16. Mohamed Hegazy (mhegazy)
    modified the milestones: TypeScript 2.6, TypeScript 2.7 on Oct 9, 2017
  17. csvn commented on Nov 1, 2017

    @csvn
    Christian Svensson (csvn)
    on Nov 1, 2017
    More actions

    With the current Compiler API, a custom CompilerHost can be provided with adjusted methods for e.g. getSourceFile. Will this proposed createWatchMode API allow such modifications (such as for createProgram)? I haven't worked on any open source tool, so I don't know if that would be required. Though it would be useful for an internal watch script I made recently with the Compiler API.

  18. ikokostya commented on Jan 8, 2018

    @ikokostya
    ikokostya
    on Jan 8, 2018
    Contributor
    More actions

    It will be great if command line interface of TypeScript compiler (tsc) will also support incremental building. This mode allows embed tsc in command pipeline much easier, e.g.

    # Compile and run tests
    tsc -p tests --outDir tests-out && mocha tests-out

    Now this command has two disadvantages:

    1. need wait for full rebuild of the project described by tests/tsconfig.json;
    2. or need keep watch mode (tsc --watch) as separate process.
  19. kenotron commented on Jan 8, 2018

    @kenotron
    Ken Chau (kenotron)
    on Jan 8, 2018
    More actions

    ikokostya there are projects like ts-watch that allows you to do watch + trigger onSuccess.

  20. OneCyrus commented on Jan 8, 2018

    @OneCyrus
    Daniel Gut (OneCyrus)
    on Jan 8, 2018
    More actions

    is the builder API still on track for 2.7?

  21. Mohamed Hegazy (mhegazy)
    modified the milestones: TypeScript 2.7, TypeScript 2.7.1 on Jan 12, 2018
  22. gilamran commented on Jan 13, 2018

    @gilamran
    Gil Amran (gilamran)
    on Jan 13, 2018
    More actions

    ikokostya for now you can use tsc-watch to re-run a task on successful build

  23. Mohamed Hegazy (mhegazy)
    added
    FixedA PR has been merged for this issueA PR has been merged for this issue
    on Jan 19, 2018
  24. mhegazy commented on Jan 20, 2018

    @mhegazy
    Mohamed Hegazy (mhegazy)
    on Jan 20, 2018
    Contributor
    More actions

    Should be fixed by #20234

    Reacted by Ken Chau and WanderWang
    Reacted by bmayen, David Sherret, Gulshan, Ken Chau, WanderWang, zheng and Damian Pieczynski
  25. Mohamed Hegazy (mhegazy)
    closed this as completedon Jan 20, 2018
  26. microsoft
    locked and limited conversation to collaborators on Jul 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @sheetalkamat
    Sheetal Nandi (sheetalkamat)

Labels

CommittedThe team has roadmapped this issueThe team has roadmapped this issueCommunity ToolingThis might be better handled by tooling from the community instead of built into TypeScriptThis might be better handled by tooling from the community instead of built into TypeScriptDomain: APIRelates to the public API for TypeScriptRelates to the public API for TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issueSuggestionAn idea for TypeScriptAn idea for TypeScript

Type

No type

Projects

No projects

    Milestone

    • TypeScript 2.7.1

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.