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

bw-offline-sdk

v0.0.22

Published

这是一个经过代码混淆和加密的离线 SDK 库,用于保护源代码不被轻易逆向工程。

Downloads

20

Readme

Offline SDK Library

这是一个经过代码混淆和加密的离线 SDK 库,用于保护源代码不被轻易逆向工程。

特性

  • 多格式支持:支持 ES Module、UMD、CommonJS 三种格式
  • 代码混淆:使用 JavaScript Obfuscator 进行深度混淆
  • 调试保护:防止开发者工具调试
  • 字符串加密:字符串使用 Base64 和 RC4 加密
  • 控制流扁平化:让代码结构难以理解
  • 死代码注入:增加逆向工程难度
  • 变量名混淆:所有变量名转换为十六进制格式
  • 自我保护:防止代码被美化和重命名

构建配置

输出格式

项目支持三种输出格式:

  • ES Module (portallib.es.js) - 现代浏览器和打包工具
  • UMD (portallib.umd.js) - 通用模块定义,支持 AMD 和全局变量
  • CommonJS (portallib.cjs) - Node.js 环境
  • CSS (portallib.css) - 样式文件

代码混淆设置

项目使用 rollup-plugin-javascript-obfuscator 插件进行代码混淆,主要配置包括:

// 基础混淆设置
compact: true,                    // 删除换行符,代码更紧凑
controlFlowFlattening: true,     // 控制流扁平化
deadCodeInjection: true,         // 注入死代码
debugProtection: true,           // 调试保护
identifierNamesGenerator: 'hexadecimal', // 十六进制标识符
selfDefending: true,             // 自我保护
stringArrayEncoding: ['base64', 'rc4'], // 字符串编码
unicodeEscapeSequence: true,     // Unicode转义序列

构建优化

  • 使用 Terser 进行代码压缩
  • 删除 console 输出和 debugger 语句
  • 混淆顶级作用域变量名
  • 禁用源码映射

使用方法

安装

npm install bw-offline-sdk

引入方式

ES Module (推荐)

// 现代浏览器和打包工具
import portallib from 'bw-offline-sdk';

// 或者使用具名导入
import { someFunction } from 'bw-offline-sdk';

CommonJS

// Node.js 环境
const portallib = require('bw-offline-sdk');

// 或者使用解构
const { someFunction } = require('bw-offline-sdk');

UMD (浏览器)

<!-- 通过 CDN 引入 -->
<script src="https://unpkg.com/bw-offline-sdk@latest/portaldist/portallib.umd.js"></script>

<!-- 或者本地文件 -->
<script src="portaldist/portallib.umd.js"></script>

<script>
// 全局变量方式使用
window.portallib.someFunction();
</script>

使用示例

// 使用库的功能
portallib.someFunction();

开发

本地开发

npm run dev

构建生产版本

npm run build

构建后的文件位于 portaldist/ 目录。

安全特性

  1. 代码混淆:所有变量名、函数名都被混淆
  2. 字符串保护:字符串被编码和分割
  3. 控制流混淆:代码执行流程被重新组织
  4. 调试保护:防止在开发者工具中调试
  5. 反格式化:代码无法被美化工具格式化
  6. 死代码注入:增加虚假代码增加分析难度

注意事项

  • 混淆后的代码会略微影响性能
  • 调试困难,建议在开发环境使用未混淆版本
  • 混淆配置可以根据需要调整安全级别

许可证

MIT License