npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ts-scope-trimmer-plugin

v1.0.4

Published

TypeScript plugin to speed up the experience in code editors

Readme

ts-scope-trimmer-plugin

A TypeScript server plugin that limits the scope of tsserver to speed up the experience in code editors by processing only the open files and their dependencies.

Motivation

Poor TypeScript performance in code editors and high memory usage is a common issue in large codebases, especially in monorepos. To mitigate this, the community has been tweaking configs, refactoring code and waiting for TypeScript 7. But what if we could get a visible performance boost by changing the way tsserver treats projects? Let’s take a look at the project example and see what happens after opening a single file.

workspaceA
  - global.d.ts
  - fileA.ts
  - fileB.ts
  - tsconfig.json

workspaceB
  - fileC.ts
  - fileD.ts
  - tsconfig.json

workspaceA/tsconfig.json is the following:

"compilerOptions" {
  ...
},
"include": ["."]

After opening workspaceA/fileA.ts, tsserver processes and adds watchers for all files in workspaceA and their dependencies, so 4 files in total:

flowchart TD
    subgraph workspaceA
        A[fileA.ts]
        B[fileB.ts]
        D[global.d.ts]
    end

    subgraph workspaceB
        C[fileC.ts]
        E[fileD.ts]
    end

    B --> C

    class E transparent;
    class A chosen;

    classDef transparent fill:#ffffff00,stroke:#999,stroke-width:1px,color:#999;
    classDef chosen stroke-width:3px;

To illustrate the problem, here is a simple file without any TS dependencies: loading it in VSCode takes >5s because tsserver processes 6510 files. ts-scope-trimmer-plugin changes this behavior by limiting the tsserver scope only to the open files, their dependencies and global types:

flowchart TD
    subgraph workspaceA
        A[fileA.ts]
        B[fileB.ts]
        D[global.d.ts]
    end

    subgraph workspaceB
        C[fileC.ts]
        E[fileD.ts]
    end

    B --> C

    class E transparent;
    class B transparent;
    class C transparent;
    class A chosen;

    classDef transparent fill:#ffffff00,stroke:#999,stroke-width:1px,color:#999;
    classDef chosen stroke-width:3px;

So opening the same file in VSCode takes around 500ms because tsserver loads only 183 files.

[!WARNING]
Features like "find all references" and "find usages" are not fully functional since they need the full project context. This seems like an acceptable trade-off, considering the opt-in nature of the plugin. See configuration for more details.

Usage

Installation

Add this plugin as a dev dependency to your project:

npm install ts-scope-trimmer-plugin --save-dev

Add this plugin to your tsconfig.json:

{
  "compilerOptions": {
    "plugins": [
      {
        "name": "ts-scope-trimmer-plugin"
      }
    ]
  }
}

VSCode/Cursor/Windsurf only: make sure to use the workspace version of TypeScript.

Configuration

| Option | Type | Default | Description | | --------------- | -------- | ------- | ---------------------------------- | | enabled | boolean | false | Enable/disable the plugin | | alwaysInclude | string[] | [] | Glob patterns for files that should always be included, e.g. global types. Relative to the project root. Example | | debug | boolean | false | Enable/disable debug logging |

These options can be specified in tsconfig.json (example) or in ts-scope-trimmer.json (example) in your project root. The latter has higher priority and can be added to .gitignore, so engineers can toggle the plugin locally on demand.

Requirements

This plugin is tested with TypeScript >=5.0.0, Node.js >=18.0.0 and the following code editors:

  • VSCode
  • Cursor
  • IntelliJ IDEA
  • WebStorm
  • Neovim
  • Zed

Benchmark

Benchmark was performed in a test repo on this commit with TypeScript 5.9.2, VSCode 1.102.3 (default settings), Mac M1 Pro, 32GB RAM.

  • ms: shows the time in milliseconds it takes to fully load the file (updateOpen event)
  • files: shows the number of files that tsserver processes

| File | Before (ms) | After (ms) | Before (files) | After (files) | | --- | --- | --- | --- | --- | | apps/crew/pages/_app.tsx | 5100 | 530 | 6510 | 187 | | apps/crew/pages/important-feature-0.tsx | 5100 | 1400 | 6510 | 1695 | | packages/crew/important-feature-0/src/lib/important-component-0/important-component-0.tsx | 1400 | 1300 | 1653 | 1402 |

The performance improvement varies by file: the fewer the dependencies it has, the greater the benefit.

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for details.