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

@ckpack/vite-plugin-wechat-fortify

v0.3.0

Published

微信小游戏 JavaScript 加固插件

Readme

@ckpack/vite-plugin-wechat-fortify

在 Vite 构建结束时调用微信小游戏深度保护 CLI,为 JavaScript 产物添加代码混淆和水印。适用于 Vite 8 和 Vite+。

安装与首次构建

npm install -D @ckpack/vite-plugin-wechat-fortify

在微信公众平台为目标小游戏登记加固公钥,把对应的 AppID 和私钥写入仓库外的 id_rsa.conf。文件格式及公钥生成步骤见微信小游戏深度保护说明。在项目的 Vite 配置中注册插件:

import { wechatFortify } from "@ckpack/vite-plugin-wechat-fortify";
import { defineConfig } from "vite";

export default defineConfig({
  plugins: [wechatFortify({ appid: "你的微信小游戏 AppID" })],
});

在项目根目录执行:

WECHAT_FORTIFY_SECRET=/absolute/path/to/id_rsa.conf npx vite build

输出目录由 Vite 的 build.outDir 决定,默认是 dist/。每个选中的 JS 文件和其加固 sourcemap 写入同一目录。

选项

| 选项 | 用途 | 默认值 | | ------------------ | --------------------------------------------------------------------------------- | ------------------------------------- | | appid | 必填,须与密钥配置中的 AppID 一致 | — | | files | Vite 产出的 JS chunk 相对路径数组,例如 ["game.js", "subpackages/race/main.js"] | 所有以 .js 结尾的 chunk,含动态导入 | | level | 混淆等级,可取 1、2、3 | 1 | | watermark | 添加文件水印 | true | | secretConfigPath | 仓库外 id_rsa.conf 的绝对路径 | 环境变量 WECHAT_FORTIFY_SECRET |

带哈希的文件名可以直接使用默认选择。显式指定的路径必须匹配本次构建产物,否则构建报错。Vite 直接复制的 public/ 文件不参与 chunk 选择。

生产构建将选中的 JS 发送到微信加固服务。若 Vite 为这些文件生成了 sourcemap,插件也会提交对应的 map,其中的 sourcesContent 可能包含原始源码。使用 --mode development 可离线构建。

插件要求每个选中的文件都返回加固代码和有效的 sourcemap。微信服务可能为很小的文件返回空 map,插件会报告文件名并中止本次构建。需要调整保护范围时,可通过 files 显式列出需要保护的产物。