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

@migrex/ts-plugin

v1.0.0-alpha.2

Published

TypeScript Language Service Plugin for migrex

Readme

@migrex/ts-plugin

TypeScript Language Service Plugin for migrex - provides IDE integration including diagnostics, hover information, and quick fixes for migration code.

Features

  • Diagnostics on consume() calls: Detects when code doesn't properly handle single vs multi-value preserved fields
  • Hover information: Shows field profiles ('always-single' or 'sometimes-multi') when hovering over field names
  • Quick fixes: Suggests code fixes for handling multi-value cases

Installation

npm install @migrex/ts-plugin typescript @migrex/core

Configuration

Add the plugin to your tsconfig.json:

{
  "compilerOptions": {
    "plugins": [
      {
        "name": "@migrex/ts-plugin",
        "graphPath": "./src/migrations/graph.ts",
        "enableHover": true,
        "enableQuickFixes": true
      }
    ]
  }
}

Configuration Options

  • graphPath (string, optional): Path to migration graph file (relative to project root)
  • enableHover (boolean, optional): Enable hover information for field profiles (default: true)
  • enableQuickFixes (boolean, optional): Enable quick fixes for multi-value handling (default: true)

IDE Setup

VS Code

The plugin will be automatically loaded by the TypeScript language server when you open a TypeScript file. Make sure you're using the workspace TypeScript version:

  1. Open a .ts file
  2. Press Cmd+Shift+P (Mac) or Ctrl+Shift+P (Windows/Linux)
  3. Select "TypeScript: Select TypeScript Version..."
  4. Choose "Use Workspace Version"

Other Editors

Any editor that uses the TypeScript Language Service should automatically load the plugin from your tsconfig.json.

Usage

Diagnostics

The plugin will show warnings when you consume a field that can have multiple values without checking the kind property:

// ⚠️ Warning: Field "theme" can have multiple preserved values
const theme = ctx.consume('theme');

// ✅ Correct: Check kind before using
const theme = ctx.consume('theme');
if (theme) {
  if (theme.kind === 'single') {
    // Handle single value: theme.value
  } else {
    // Handle multiple values: theme.values
  }
}

Hover Information

Hover over a field name in a consume() or preserve() call to see its profile:

// Hover over 'theme' to see:
// **migrex field profile**
// Field `theme` is preserved at most once on any migration path.
// Safe to use: `field.kind === "single"` is always true.
const theme = ctx.consume('theme');

Quick Fixes

When a diagnostic appears, you can use the quick fix (light bulb) to automatically generate proper multi-value handling code.

How It Works

The plugin:

  1. Loads your migration graph from the configured path
  2. Analyzes the graph to determine field profiles
  3. Checks consume() calls against the field profiles
  4. Provides diagnostics, hover info, and quick fixes through the TypeScript Language Service

Architecture

The plugin uses the proxy pattern to wrap the base TypeScript Language Service:

  • plugin.ts: Main proxy logic that intercepts specific LanguageService methods
  • diagnostics.ts: Generates diagnostics for consume() calls
  • hover.ts: Augments hover information with field profiles
  • quick-fixes.ts: Provides code fixes for multi-value handling
  • analysis-cache.ts: Caches graph analysis results for performance
  • graph-loader.ts: Loads migration graph from user code

Development

# Build the plugin
pnpm build

# Run tests
pnpm test

# Build types
pnpm build:types

# Update API report
pnpm api:update

# Check API report
pnpm api:check

License

UNLICENSED