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

exportc

v0.0.20

Published

CLI to add export to existing projects

Downloads

2,476

Readme

exportc

Add export to existing Vite projects. One command sets up server-side functions with full TypeScript support.

Quick Start

# In your existing Vite project
npx exportc init

# Start development (Vite + Wrangler auto-start)
npm run dev

# Build and deploy to Workers Sites
npm run export

That's it. Dependencies are installed automatically.

What You Get

  • Single command dev -- npm run dev starts both Vite and Wrangler
  • Auto-generated types -- TypeScript definitions from your actual code
  • Workers Sites deploy -- Static assets + server exports in one deployment
  • Zero config -- Production URL auto-detected from package name

Usage

After initialization, import your server exports using the export/ prefix:

// In your Vite app
import { hello, Counter } from "export/";

const message = await hello("World");  // "Hello, World!"

const counter = await new Counter(0);
await counter.increment();  // 1

Commands

| Command | Description | |---------|-------------| | npm run dev | Start Vite + Wrangler together (auto-generates types) | | npm run export | Build Vite app and deploy to Workers Sites | | exportc init | Initialize export in your project | | exportc dev | Start Wrangler dev server standalone | | exportc deploy | Deploy exports only |

Vite Plugin

The exportPlugin handles everything automatically:

// vite.config.ts
import { defineConfig } from "vite";
import { exportPlugin } from "exportc/vite";

export default defineConfig({
  plugins: [exportPlugin()],
});

The production URL is auto-detected on first deploy. The subdomain is saved to cloudflare.subdomain in package.json.

Development (npm run dev)

  1. Automatically starts Wrangler dev server in the background
  2. Waits for it to be ready before serving your app
  3. Generates export-env.d.ts with TypeScript declarations
  4. Watches for changes and regenerates types automatically
  5. Transforms export/ imports to http://localhost:8787

Production (npm run export)

  1. Builds your Vite app with vite build
  2. Generates types and wrangler.toml from cloudflare config
  3. Deploys to Workers Sites (static assets + server exports)
  4. export/ imports auto-resolve to your Workers URL

Project Structure

After running exportc init:

my-vite-app/
├── src/                    # Your Vite app (unchanged)
├── export/                 # Server exports (Cloudflare Worker)
│   ├── index.ts           # Your server code
│   ├── package.json       # Minimal (dependencies only)
│   └── .gitignore         # Generated files excluded
├── export-env.d.ts        # TypeScript declarations (auto-generated)
├── package.json           # Contains cloudflare config
└── vite.config.ts         # Updated with exportPlugin

Configuration is in the root package.json:

{
  "cloudflare": {
    "name": "my-vite-app-api",
    "exports": "./export",
    "assets": "./dist"
  }
}

TypeScript Support

The export-env.d.ts file is automatically generated when you run npm run dev. The Vite plugin watches for changes to your export files and regenerates type declarations automatically.

// export-env.d.ts (auto-generated)
declare module "export/" {
  export function hello(name: string): Promise<string>;
  export class Counter {
    constructor(initial?: number);
    increment(): Promise<number>;
    [Symbol.dispose](): Promise<void>;
  }
}

declare module "export/utils" {
  export function formatDate(date: Date): Promise<string>;
}

Types are inferred from your actual export code, so you get accurate type information with zero manual maintenance.

License

MIT