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

@soda-gql/tsc-plugin

v0.9.0

Published

TypeScript compiler plugin for soda-gql

Readme

@soda-gql/tsc-plugin

npm version License: MIT

TypeScript compiler plugin for soda-gql zero-runtime GraphQL transformations.

Installation

bun add -D @soda-gql/tsc-plugin

Overview

This plugin integrates soda-gql's zero-runtime transformations directly into the TypeScript compiler. It works with:

  • NestJS compiler
  • ts-patch
  • Any TypeScript compiler that supports transformer plugins

Configuration

With NestJS

Add the plugin to your nest-cli.json:

{
  "collection": "@nestjs/schematics",
  "sourceRoot": "src",
  "compilerOptions": {
    "builder": "tsc",
    "deleteOutDir": true,
    "plugins": [
      {
        "name": "@soda-gql/tsc-plugin",
        "options": {
          "configPath": "./soda-gql.config.ts",
          "importIdentifier": "@/graphql-system"
        }
      }
    ]
  }
}

With ts-patch

First, install ts-patch:

bun add -D ts-patch
npx ts-patch install

Then add the plugin to your tsconfig.json:

{
  "compilerOptions": {
    "plugins": [
      {
        "transform": "@soda-gql/tsc-plugin",
        "configPath": "./soda-gql.config.ts"
      }
    ]
  }
}

Plugin Options

| Option | Type | Required | Description | |--------|------|----------|-------------| | configPath | string | No | Path to soda-gql config file (auto-discovered if not specified) | | importIdentifier | string | No | Import identifier for GraphQL system (e.g., "@/graphql-system") |

How It Works

The plugin transforms gql.default() calls at compile time:

Input:

import { gql } from "@/graphql-system";

export const userQuery = gql.default(({ query, $var }) =>
  query.operation({
    name: "GetUser",
    variables: { ...$var("id").ID("!") },
    fields: ({ f, $ }) => ({ ...f.user({ id: $.id })(({ f }) => ({ ...f.id(), ...f.name() })) }),
  }),
);

Output:

import { gqlRuntime } from "@soda-gql/runtime";

export const userQuery = gqlRuntime.getOperation("canonicalId");

Complete NestJS Example

1. Project Setup

# Create new NestJS project
nest new my-app
cd my-app

# Install dependencies
bun add @soda-gql/core @soda-gql/runtime
bun add -D @soda-gql/cli @soda-gql/config @soda-gql/tsc-plugin

2. Configure soda-gql

Create soda-gql.config.ts:

import { defineConfig } from "@soda-gql/config";

export default defineConfig({
  outdir: "./graphql-system",
  graphqlSystemAliases: ["@/graphql-system"],
  include: ["./src/**/*.ts"],
  analyzer: "ts",
  schemas: {
    default: {
      schema: "./schema.graphql",
      inject: "./inject-module/default.inject.ts",
    },
  },
});

3. Configure NestJS

Update nest-cli.json:

{
  "collection": "@nestjs/schematics",
  "sourceRoot": "src",
  "compilerOptions": {
    "builder": "tsc",
    "deleteOutDir": true,
    "plugins": [
      {
        "name": "@soda-gql/tsc-plugin",
        "options": {
          "configPath": "./soda-gql.config.ts",
          "importIdentifier": "@/graphql-system"
        }
      }
    ]
  }
}

4. Configure TypeScript Paths (Optional)

If you're using path aliases like @/graphql-system, update tsconfig.json:

{
  "compilerOptions": {
    "paths": {
      "@/graphql-system": ["./graphql-system"]
    }
  }
}

5. Generate GraphQL System

bun run soda-gql codegen

6. Build and Run

nest build
nest start

Troubleshooting

Plugin Not Transforming Code

  1. Ensure configPath points to a valid config file
  2. Verify the GraphQL system is generated (bun run soda-gql codegen)
  3. Check that importIdentifier matches your tsconfig paths

Type Errors After Transformation

  1. Ensure @soda-gql/runtime is installed
  2. Verify GraphQL system types are up to date
  3. Run bun run soda-gql codegen to regenerate types

NestJS Build Errors

  1. Verify nest-cli.json plugin configuration is correct
  2. Ensure builder is set to "tsc" (not "swc" or "webpack")
  3. Check for TypeScript version compatibility (requires TypeScript 5.x)

Related Packages

License

MIT