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

cocos-obfuscator

v1.0.3

Published

Cocos Creator 项目代码混淆工具,支持字节跳动小游戏和微信小游戏平台

Readme

Cocos Obfuscator

Cocos Creator 项目代码混淆工具,支持字节跳动小游戏和微信小游戏平台。

功能特性

  • ✅ 支持 Cocos Creator 2.x 和 3.x 版本
  • ✅ 支持字节跳动小游戏(bytedance/bytedance-mini-game)
  • ✅ 支持微信小游戏(wechatgame)
  • ✅ 交互式选择界面(使用键盘上下键)
  • ✅ 自动备份原文件
  • ✅ 支持分包文件混淆
  • ✅ 优化的混淆配置,平衡安全性和文件大小

安装

方式一:作为项目依赖安装

npm install cocos-obfuscator --save-dev

方式二:全局安装

npm install -g cocos-obfuscator

方式三:从本地目录安装

npm install /path/to/cocos-obfuscator

方式四:从 Git 仓库安装(支持 Gitee、GitHub、GitLab)

# Gitee
npm install git+https://gitee.com/your-username/cocos-obfuscator.git

# GitHub
npm install git+https://github.com/your-username/cocos-obfuscator.git

# 私有仓库(使用 SSH)
npm install git+ssh://[email protected]/your-username/cocos-obfuscator.git

注意:Gitee 目前不支持 npm 包托管,但可以从 Git 仓库直接安装。详细说明请查看 GITEE.md

使用方法

交互式选择模式(推荐)

在项目根目录运行:

# 如果作为项目依赖安装
npx cocos-obfuscate

# 如果全局安装
cocos-obfuscate

运行后会进入交互式选择:

  1. 选择平台(bytedance 2.x / bytedance-mini-game 3.x / wechatgame)
  2. 选择是否包含分包文件

命令行参数模式

# 指定平台
cocos-obfuscate --platform bytedance
cocos-obfuscate --platform bytedance-mini-game
cocos-obfuscate --platform wechatgame

# 包含分包文件
cocos-obfuscate --platform wechatgame --include-subpackages

# 指定项目目录
cocos-obfuscate --platform bytedance --project-dir /path/to/project

在 package.json 中添加脚本

{
  "scripts": {
    "obfuscate": "cocos-obfuscate"
  }
}

然后运行:

npm run obfuscate

命令行选项

  • --platform <平台> - 指定平台: bytedance (2.x版本) 或 bytedance-mini-game (3.x版本) 或 wechatgame
  • --include-subpackages - 包含分包文件进行混淆
  • --no-subpackages - 不包含分包文件
  • --project-dir <目录> - 指定项目目录(默认为当前目录)
  • --help, -h - 显示帮助信息

项目结构要求

工具会在以下路径查找文件:

  • 主包文件: build/{platform}/assets/main/index.*.js
  • 分包文件: build/{platform}/subpackages/*/game.js

注意事项

  1. 混淆前会自动创建 .backup 备份文件
  2. 如果混淆后游戏无法正常运行,可以使用备份文件恢复
  3. 建议在构建完成后、发布前进行混淆
  4. 混淆会增加文件大小,但会提高代码安全性

支持的平台

  • bytedance - 字节跳动小游戏(Cocos Creator 2.x)
  • bytedance-mini-game - 字节跳动小游戏(Cocos Creator 3.x)
  • wechatgame - 微信小游戏

许可证

ISC