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

swiftlet

v1.2.2

Published

Web dev build tool

Downloads

365

Readme

Swiftlet

npm version license

现代化、零配置的 JavaScript/TypeScript 库构建工具。基于 Rollup,开箱即用。

English

特性

  • 零配置 — 大多数库项目开箱即用
  • TypeScript 优先 — 原生 TS 支持,自动生成 .d.ts 类型声明
  • 多格式输出 — 一次构建输出 ESM、CJS、UMD、IIFE
  • Rollup 驱动 — 完整访问 Rollup 插件生态
  • 统一配置 — 单一配置文件,支持 JS/TS、CJS/ESM(通过 jiti)
  • Hooks API — 可扩展的插件系统,基于编译器钩子

快速开始

# 安装
pnpm add -D swiftlet

# 构建
swiftlet build

# 开发模式(监听 + sourcemap)
swiftlet dev

创建 swiftlet.config.ts(可选):

import { defineConfig } from 'swiftlet';

export default defineConfig({
  entry: 'src/index.ts',
  format: ['esm', 'cjs', 'umd'],
  outDir: 'dist',
});

配置项

所有配置项均为可选,具有合理的默认值。

| 配置项 | 类型 | 默认值 | 说明 | | --------------- | --------------------------------------- | -------------------------------- | ------------------------------------ | | entry | string \| string[] | src/index.tssrc/index.js | 构建入口 | | outDir | string | 'dist' | 输出目录 | | format | ('esm' \| 'cjs' \| 'umd' \| 'iife')[] | ['esm'] | 输出格式 | | dts | boolean | true | 生成 TypeScript 类型声明 | | target | string | — | TypeScript 编译目标(如 'esnext') | | sourcemap | boolean | false | 生成 source map | | minify | boolean \| 'terser' | false | 代码压缩 | | external | string[] \| (id: string) => boolean | — | 外部依赖 | | clean | boolean | true | 构建前清理输出目录 | | globalName | string | 从 package.json name 推导 | UMD/IIFE 全局变量名 | | globals | Record<string, string> | — | UMD/IIFE 外部依赖映射 | | plugins | SwiftletPlugin[] | [] | Swiftlet 插件(编译器钩子) | | pluginsRollup | RollupPlugin[] | [] | 原生 Rollup 插件 | | rollupOptions | (config) => config | — | 底层 Rollup 配置定制 |

完整配置示例

import { defineConfig } from 'swiftlet';

export default defineConfig({
  entry: 'src/index.ts',
  outDir: 'dist',
  format: ['esm', 'cjs', 'umd'],
  dts: true,
  target: 'es2020',
  sourcemap: true,
  minify: true,
  clean: true,
  external: ['react', 'vue'],
  globalName: 'MyLibrary',
  globals: {
    react: 'React',
    vue: 'Vue',
  },
});

CLI 命令

# 生产构建
swiftlet build

# 开发模式(监听)
swiftlet dev

# 打印 Rollup 配置
swiftlet build --print-rollup

# 构建成功后执行命令
swiftlet build --on-success "echo done"

许可证

MIT © GavinRay