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

@evjs/build-tools

v0.0.1-rc.9

Published

Bundler-agnostic build utilities for the ev framework

Readme

@evjs/build-tools

Bundler-agnostic build utilities for the ev framework. Contains all core logic for server function handling, decoupled from any specific bundler.

Installation

npm install @evjs/build-tools

Exports

| Export | Description | |--------|-------------| | generateServerEntry(config, modules) | Generate server entry source from discovered modules | | transformServerFile(source, options) | SWC-based transform for "use server" files | | detectUseServer(source) | Check if a file starts with the "use server" directive | | makeFnId(root, path, name) | Derive a stable SHA-256 function ID | | parseModuleRef(ref) | Parse "module#export" reference strings | | ServerEntryConfig | Config type for server entry generation | | TransformOptions | Options type for file transformation |

Usage

This package is consumed by bundler adapters (e.g., @evjs/webpack-plugin), not directly by application code.

import {
  generateServerEntry,
  transformServerFile,
  detectUseServer,
} from "@evjs/build-tools";

// Generate server entry source
const entrySource = generateServerEntry(
  { appFactory: "@evjs/runtime/server#createApp" },
  ["/path/to/api/users.server.ts"],
);

// Transform a "use server" file for client build
const clientStub = await transformServerFile(source, {
  resourcePath: "/path/to/api/users.server.ts",
  rootContext: "/path/to/project",
  isServer: false,
});

Architecture

Transform Pipeline

transformServerFile() parses the source with SWC, extracts exported function names via AST traversal, then delegates to the appropriate transform:

  • Client transform — replaces function bodies with __ev_call(fnId, args) transport stubs and attaches evId for query cache keys.
  • Server transform — keeps original source, prepends the registerServerFn import, and appends registration calls for each export.

Entry Generation

generateServerEntry() produces a self-contained server entry that imports all discovered "use server" modules, creates a Hono app via createApp(), and optionally invokes a runner (e.g., serve) for self-starting bundles.

Code Emitter

All generated code passes through emitCode() — a SWC parseSync → printSync roundtrip that validates syntax at build time and produces consistently formatted output.

RUNTIME Constants

All runtime identifiers (module paths, function names, property names) are centralized in a single RUNTIME constant — no hardcoded strings in templates:

RUNTIME.serverModule          // "@evjs/runtime/server"
RUNTIME.clientTransportModule // "@evjs/runtime/client/transport"
RUNTIME.registerServerFn      // "registerServerFn"
RUNTIME.clientCall            // "__ev_call"
RUNTIME.fnIdProp              // "evId"

Bundler Adapter Pattern

@evjs/build-tools (pure functions)     Bundler Adapters
────────────────────────────────       ─────────────────
• generateServerEntry()                @evjs/webpack-plugin
• transformServerFile()                  → EvWebpackPlugin
• detectUseServer()                      → server-fn-loader
• makeFnId()
• parseModuleRef()                     (future: @evjs/vite-plugin)