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

obscure-test

v0.0.3

Published

byvue模板项目专用的文件加密插件

Downloads

2

Readme

byvue-obscure

byvue模板项目专用的文件加密插件

Warn

非必要情况下请不要使用该功能,因为加密后的代码存在下述缺点;如果确实需要使用,请尽量不要修改混淆配置,过高的混淆配置会大大增加文件体积并严重降低代码运行效率。

  1. 不是绝对的安全性:JavaScript混淆是一种安全性通过增加代码复杂性来困难化逆向工程的手段,但并不能提供绝对的安全性。有经验的攻击者仍然可能通过各种手段解析和理解混淆后的代码。

  2. 性能影响:混淆后的代码会影响到JavaScript引擎的性能,即使是较为简单的加密选项也会使得性能降低20%~30%。

  3. 调试困难:由于混淆会改变代码的结构和标识符,因此在混淆后的代码上进行调试变得更加困难。这对于开发人员来说可能是一个不便之处,特别是在生产环境中出现问题时。

  4. 增加开发和维护成本:混淆增加了代码的复杂性,可能引发某些意料之外的bug,使得开发和维护代码变得更为困难。

Install

npm i byvue-obscure

Usage

// 生成obscureConfig.json配置文件
npx obscure init

// 运行加密程序
npx obscure run 

obscureConfig options

destDir

Type: string
混淆后输出的文件夹名,默认为{ 目标文件夹名称 }-obscure

// 例如当前项目名为 byvue-test
// 运行后则会在项目同级目录下新增byvue-test-obscure文件夹用于存放混淆加密后的文件

fileExtensions

Type: array
需要混淆的文件扩展名,目前仅支持.js.vue文件的混淆加密

excludes

Type: array
要排除的文件夹或文件名

// 如某项目文件结构如下,加密时不需要加密public文件夹下的内容,则可在obscureConfig.json中配置"excludes": ["public"]
byvue-test
|-- public // 不需要进行混淆加密                
|   |-- favicon.ico           
|   |-- help                  
|-- scripts                  
|   |-- docker-entrypoint.sh  
|-- shims-vue.d.ts         
|-- src                     
|   |-- App.vue              
|   |-- api                   
|   |-- assets                
|   |-- components             

targetCodes

Type: array
需要添加注释的代码,一些特殊的js代码加密后可能无法正确转义,如在vite项目中import.meta...此类语句不能进行混淆,则可在obscureConfig.json中配置"targetCodes": [ "import.meta" ],配置后"import.meta"相关代码会被编译为

// javascript-obfuscator:disable
import.meta...
// javascript-obfuscator:enable

从而跳过混淆。
如果在实际使用中遇到了个别混淆后无法编译的代码,也可在该代码前后添加// javascript-obfuscator:disable和// javascript-obfuscator:enable跳过混淆。

appoint

Type: array
指定要混淆的文件夹或文件名

// 如某项目文件结构如下,仅需要加密src文件夹下的内容,则可在obscureConfig.json中配置"appoint": ["src"]
byvue-test
|-- public                 
|   |-- favicon.ico           
|   |-- help                  
|-- scripts                  
|   |-- docker-entrypoint.sh  
|-- shims-vue.d.ts         
|-- src // 仅需要对src目录下的内容进行混淆加密                   
|   |-- App.vue              
|   |-- api                   
|   |-- assets                
|   |-- components             

obfuscationOptions

Type: object
javascript-obfuscator的配置项
javascript-obfuscator官方文档