Closed
Description
Search Terms
size, bloat, install
Suggestion
The typescript package is large, and it only getting larger.
Version 3.1.3 is a whopping 40MB.
Use Cases
TypeScript is used in many contexts.
A TypeScript formatter (e.g. prettier) does not need an entire compiler. It only needs a parser. And 45MB scripted parser is orders of magnitude larger than one would normally expect. (For reference, the installed npm package for Esprima -- the most compatible and compliant ES parser in the ecosystem -- is a mere 0.3MB.)
Examples
Solution 1: Split up packages
- typescript (existing package; depends on typescript-compiler, typescript-parser, typescript-server)
- typescript-compiler (depends on typescript-parser)
- typescript-parser
- typescript-server (depends on typescript-compiler)
Optionally, there could be separate packages for typescript-config and typescript-i18n.
Solution 2: Don't duplicate code
There is a lot of code duplication between
- lib/typescriptServices.js
- lib/typescriptServices.js
- lib/tsserver.js
- lib/tsserverlibrary.js
Don't duplicate the code.
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. new expression-level syntax)