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

@adjfut/vite-plugin-zip-pack

v2.0.3

Published

Vite plugin for packing distribution/build folder into a zip file.

Downloads

112

Readme

vite-plugin-zip-pack

📦 一个为 Vite 设计的打包插件,用于在构建完成后自动将构建输出目录打包成 ZIP 压缩文件。

Lint Status Test Status npm License

✨ 功能特性

  • 🎯 类型安全 - 完整的 TypeScript 类型定义
  • ⚙️ 灵活配置 - 丰富的配置选项,满足各种使用场景
  • 🔒 文件签名 - 支持输出文件的 MD5 和 SHA256 哈希值
  • 📝 详细日志 - 清晰的构建日志输出
  • 🎨 自定义过滤 - 支持自定义文件过滤规则
  • 🚀 零配置 - 开箱即用,默认配置即可满足大部分需求

📦 安装

使用 npm:

npm install -D @adjfut/vite-plugin-zip-pack

使用 pnpm:

pnpm add -D @adjfut/vite-plugin-zip-pack

使用 yarn:

yarn add -D @adjfut/vite-plugin-zip-pack

🚀 快速开始

基础使用

vite.config.jsvite.config.ts 中引入并配置插件:

import { defineConfig } from 'vite';
import zipPack from '@adjfut/vite-plugin-zip-pack';

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

运行构建命令后,插件会自动将 dist 目录打包成 dist.zip 文件。

自定义配置

import { defineConfig } from 'vite';
import zipPack from '@adjfut/vite-plugin-zip-pack';

export default defineConfig({
    plugins: [
        zipPack({
            inDir: './dist',
            outDir: './output',
            outFileName: 'my-app.zip',
            pathPrefix: 'my-app',
            logLevel: ['info', 'fileHash', 'error']
        })
    ]
});

📖 配置选项

| 选项 | 类型 | 默认值 | 说明 | | ------------- | ------------------------------------------------------------------ | ------------ | -------------------- | | inDir | string | './dist' | 需要打包的目录路径 | | outDir | string | './' | 输出压缩包的目录路径 | | outFileName | string | 'dist.zip' | 输出压缩包的文件名 | | pathPrefix | string | '' | 压缩包内的目录前缀 | | filter | function(fileName: string,filePath: string,isDirectory: boolean) | undefined | 文件过滤函数 | | done | function(file: File) | undefined | 压缩完成回调 | | error | function(error: Error) | undefined | 压缩异常回调 | | logLevel | boolean | ['info','fileHash','error'] | true | 是否输出日志 |

配置示例

文件过滤

zipPack({
    filter: (fileName, filePath, isDirectory) => {
        // 排除 .map 文件
        if (fileName.endsWith('.map')) {
            return false;
        }
        // 排除 node_modules 目录
        if (isDirectory && fileName === 'node_modules') {
            return false;
        }
        return true;
    }
});

自定义回调

zipPack({
    done: (file) => {
        console.log(`压缩完成: ${file.toString()}`);
        // 可以在这里执行上传、通知等操作
    },
    error: (error) => {
        console.error('压缩失败:', error);
        // 错误处理逻辑
    }
});

添加路径前缀

必须是相对路径

zipPack({
    pathPrefix: 'my-app-v1.0.0'
    // 压缩包内的文件将位于 my-app-v1.0.0/ 目录下
});

📚 更多文档

🤝 贡献

我们欢迎所有形式的贡献!请查看 贡献指南 了解详细信息。

📄 License

MIT

🔗 相关链接