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 🙏

© 2024 – Pkg Stats / Ryan Hefner

vite-plugin-bundle-obfuscator

v1.1.0

Published

JavaScript obfuscator plugin for Vite environments

Downloads

1,493

Readme

vite-plugin-bundle-obfuscator

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

awesome-vite OSS Compass Analyze

Changelog · Report Bug · Request Feature

✨ 待支持

  • [ ] 💎 支持字符串数组选项
  • [ ] 💎 支持node_modules拆分块

📦 安装

npm install vite-plugin-bundle-obfuscator -D

👨‍💻 使用

  1. 运行npm install vite-plugin-bundle-obfuscator -D
  2. vite.config.js中注册插件
  3. 设置您自己的配置或设置为空以使用默认选项
import vitePluginBundleObfuscator from 'vite-plugin-bundle-obfuscator';

const obfuscatorConfig = {
  enable: true,
  log: true,
  autoExcludeNodeModules: true,
  excludes: [],
  options: {}
};

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

💪 配置

| 属性 | 描述 | 类型 | 默认值 | 版本 | |------------------------|----------------------------|-------------------------------------------------------------------------------------|----------------|--------| | log | 显示或隐藏日志输出。 | boolean | true | v1.0.4 | | enable | 启用或禁用混淆器。 | boolean | true | v1.0.1 | | autoExcludeNodeModules | 启用自动排除node_modules。 | boolean | false | v1.0.9 | | apply | 仅将插件应用于服务或构建,或在特定条件下。 | 'serve' | 'build' | ((this: void, config: UserConfig, env: ConfigEnv) => boolean) | build | v1.1.0 | | excludes | 排除的bundle名。从v1.0.8开始,支持正则。 | (RegExp | string)[] | [] | v1.0.0 | | options | JavaScript混淆器的选项。 | ObfuscatorOptions | Config example | v1.0.0 |

💡 配置示例

const obfuscatorConfig = {
  excludes: [],
  enable: true,
  log: true,
  autoExcludeNodeModules: 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,如果您设置为true。您的样式表将缺少一些。
    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,
  }
};