microsoft / microsoft/vscode-languageserver-node
Reduce number of d.ts files and types published in packages
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.8k
- Forks
- 404
- Avg merge
- 2d 8h
- Merged PRs (30d)
- 14
Description
Problem
The published npm package for vscode-languageclient currently includes a d.ts file for every .js file under lib:
This is problematic for two reasons:
-
It bloats the package size. All the
d.tsfiles invscode-languageclienttake up 300KB or so -
We are likely publishing interfaces and types that are not meant to be exposed externally. For example, there are files like
utils/async.d.ts.
Proposed fix
To fix this, I suggest adopting a tool such as api extractor. This lets you bundle all the types for a project into a single d.ts file. You can also control which types are exposed and which ones stay internal
I adopted this for the markdown language service: https://github.com/microsoft/vscode-markdown-languageservice/blob/main/api-extractor.json
This helped me make sure I only exposed a well defined API to library consumers
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by inspecting the declarations generated for lib, including the example utils/async.d.ts, and compare the proposed approach with the referenced api-extractor.json configuration. Done means the published packages expose only the intended types, consolidate declarations, and reduce the current package bloat.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nodejs, typescript
- Domain
- build-system, release
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100