1.2.1 • Published 10 months ago

vite-plugin-bundle-obfuscator v1.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

vite-plugin-bundle-obfuscator

适用于Vite环境的JavaScript混淆器插件

awesome-vite

Changelog · Report Bug · Request Feature

npm.io

⭐️ 特性

  • ⚡ 支持Vite项目中的JavaScript混淆。
  • ⚙️ 可定制的混淆器选项,以满足您的需求。
  • 🛡️ 自动排除node_modules
  • 🚀 多线程支持,以获得更好的性能。
  • 📦 ?支持node_modules拆分块。

⚠️ 注意

  • 如果混淆选项stringArraytrue
    • 您的结果可能会丢失一些捆绑包(在__vite__mapDeps数组中)。
    • 我正在寻找一个准确的案例。

📦 安装

# 使用npm
npm install vite-plugin-bundle-obfuscator -D

# 使用pnpm
pnpm add vite-plugin-bundle-obfuscator -D

# 使用yarn
yarn add vite-plugin-bundle-obfuscator -D

👨‍💻 使用

  1. 使用您首选的软件包管理器安装插件。
  2. vite.config.js中注册插件。
  3. 自定义混淆器配置或使用默认选项。

示例:

import vitePluginBundleObfuscator from 'vite-plugin-bundle-obfuscator';

const defaultObfuscatorConfig = {
  excludes: [],
  enable: true,
  log: true,
  autoExcludeNodeModules: false,
  threadPool: false,
  options: {
    compact: true,
    controlFlowFlattening: true,
    controlFlowFlatteningThreshold: 1,
    deadCodeInjection: false,
    debugProtection: false,
    debugProtectionInterval: 0,
    disableConsoleOutput: false,
    identifierNamesGenerator: 'hexadecimal',
    log: false,
    numbersToExpressions: false,
    renameGlobals: false,
    selfDefending: true,
    simplify: true,
    splitStrings: false,
    stringArray: false,
    stringArrayCallsTransform: false,
    stringArrayCallsTransformThreshold: 0.5,
    stringArrayEncoding: [],
    stringArrayIndexShift: true,
    stringArrayRotate: true,
    stringArrayShuffle: true,
    stringArrayWrappersCount: 1,
    stringArrayWrappersChainedCalls: true,
    stringArrayWrappersParametersMaxCount: 2,
    stringArrayWrappersType: 'variable',
    stringArrayThreshold: 0.75,
    unicodeEscapeSequence: false,
  }
};

export default {
  plugins: [
    // vitePluginBundleObfuscator()
    vitePluginBundleObfuscator(defaultObfuscatorConfig)
  ]
};

🛠️ 选项

属性描述类型默认值版本
threadPool线程池的配置。boolean | ({ enable: true; size: number } | { enable: false })falsev1.2.0
apply仅将插件应用于服务或构建,或在特定条件下。'serve' | 'build' | ((this: void, config: UserConfig, env: ConfigEnv) => boolean)buildv1.1.0
autoExcludeNodeModules启用自动排除node_modules。booleanfalsev1.0.9
log显示或隐藏日志输出。booleantruev1.0.4
enable启用或禁用混淆器。booleantruev1.0.1
excludes排除的bundle名。从v1.0.8开始,支持正则。(RegExp | string)[][]v1.0.0
optionsJavaScript混淆器的选项。ObfuscatorOptionsdefaultObfuscatorConfigv1.0.0

📄 License

MIT License Copyright (c) 2024-present, Zoffy

1.2.1

10 months ago

1.2.0

11 months ago

1.1.0

11 months ago

1.0.9

12 months ago

1.0.8

12 months ago

1.0.7

12 months ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago