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 🙏

© 2024 – Pkg Stats / Ryan Hefner

fast-bundle

v0.0.2

Published

`fast-bundle` 是一个基于 [`rollup.js`]('https://www.rollupjs.com/') 封装的轻量级 js(ts) 库文件打包工具。

Downloads

2

Readme

fast-bundle

fast-bundle 是一个基于 rollup.js 封装的轻量级 js(ts) 库文件打包工具。

特性

  • 🪶 轻量级 2.67kB(gzipped)
  • ⚙️ 零配置,开箱即用
  • 🚀 基于 rollup.js ,构建速度快,产物体积小
  • ✨ 可扩展性强,支持自定义 rollup 插件以及多种格式单独构建
  • 👀 集成了 Watch Mode,优化本地开发调试流程
  • 🔥 可选使用 swc 打包

使用方法

  1. 安装 fast-bundle
# with npm
npm install fast-bundle --save-dev
# with pnpm
pnpm add fast-bundle --save-dev
  1. 在项目根目录配置 fast-bundle.config.cjs (可选)
// fast-bundle.config.cjs
module.exports = {
    input: 'src/index.ts', // 库入口文件,默认为 src/index.ts
    outDir: 'dist' // 产物的输出目录,默认为 dist
};

完整配置:

export interface FastConfig {
    /**
     * 打包文件入口。
     *
     * @defaultValue `src/index.ts`
     */
    input?: string;
    /**
     * 打包后的输出目录。
     *
     * @defaultValue `dist`
     */
    outDir?: string;
    /**
     * 打包后的文件名。
     *
     * @defaultValue `index`
     */
    outName?: string;
    /**
     * 底层代码transform引擎,默认为 rollup ,可选 [swc](https://swc.rs/) (打包速度非常快,仅供体验😃)。
     *
     * @defaultValue `rollup`
     */
    engine?: 'rollup' | 'swc';
    /**
     * rollup 相关配置。
     *
     * @see https://www.rollupjs.com/guide/big-list-of-options
     */
    rollup?: RollupOptions;
    babel?: {
        /**
         * 是否启用 babel 插件。
         *
         * @defaultValue `true`
         */
        enabled?: boolean;
        /**
         * `@rollup/plugin-babel` 插件相关配置。
         */
        options?: RollupBabelInputPluginOptions;
    };
    watch?: {
        /**
         * 本地调试的项目绝对路径。
         */
        bizProjectPath?: string;
        /**
         * watch mode 的时候默认不会编译ts类型,减少每次 compile 的时间。
         *
         * @defaultValue `true`
         */
        skipDts?: boolean;
        /**
         * 开启后,文件变动时仅会打包,不会使用 yalc 同步到业务代码。
         *
         * @defaultValue `false`
         */
        onlyBuild?: boolean;
        /**
         * 自定义每次文件变动时需要执行的逻辑。如果传入字符串会被当作一条终端命令执行,替换默认的 build 命令。
         */
        customScript?: string | (() => Promise<void>);
    };
}
  1. package.json 中新建命令
{
    "scripts": {
        "build": "fast-bundle build"
    }
}

构建命令默认的输出格式为 cjs ,打包完毕后会在 dist 目录生成产物 index.cjs 。可以通过不同的命令参数输出不同格式的打包产物。

npm run build
  1. 构建命令
fast-bundle build [cjs | esm | umd | iife | types]