Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tsserver-lean

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tsserver-lean

lean subset of tsserver that only supports typechecking

  • 0.0.0-pre-alpha.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
10
Maintainers
1
Weekly downloads
 
Created
Source

lean-tsserver

Implements a tiny sub-set of tsserver, also using different internal APIs. Its reason d'etré is to i) emit diagnostics for a particular TypeScript module; ii) doing the least amount of work possible.

High-level working description

tsserver-lean expects communication to be done through its stdin and stdout pipes, like tsserver. It expects a set of requests defined in protocol.ts that are mapped to responses in a handler, on session.ts.

After a refactor, we are now using TypeScript's ProjectService API, that is responsible for managing multiple configured projects. With current setup, that means that we have a ProjectService for each project that we've requested diagnostics for. It has several efficiency affordances like caching of many adjacent functionality (ScriptInfo, module resolution, dependency type checkings) and the ability to extract diagnostics directly from a source file.

Contracts

There are some contracts and premises that is worth being aware of:

  • tsserver-lean uses readline to read its input, so whenever we want to programmatically write to the process' stdin, it is required that a \n is added to the end of the request message.
  • After each response, tsserver-lean will write a \n to its stdout, so it is required that the client reads until it finds a \n to know that the response has ended.

Supported commands

So far, the only need for this server is to emit diagnostics for a particular module, on demand.

Type check a module

{ "command": "geterr", "type": "request", "seq": 0, "arguments": { "files": ["path/a/.ts", "path/b/.ts"] } }

Handshake

Used as a first message sent to stdout to indicate a successful start-up.

{ "command": "handshake", "type": "request", "seq": 0 }

FAQs

Package last updated on 17 May 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc