vue-cli-plugin-javascript-obfuscator 1.0.5 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/index.js +2 -4
- package/jsconfig.json +7 -0
- package/package.json +2 -2
- package/plugin.js +6 -2
package/README.md
CHANGED
|
@@ -10,18 +10,20 @@ To install the plugin, run the following command:
|
|
|
10
10
|
vue add javascript-obfuscator
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
|
|
14
13
|
## Configuration
|
|
15
14
|
|
|
16
15
|
After installing the plugin, you can configure it in your vue.config.js file under the pluginOptions field.
|
|
17
16
|
|
|
18
17
|
Example Configuration:
|
|
18
|
+
|
|
19
19
|
```
|
|
20
20
|
// vue.config.js
|
|
21
21
|
|
|
22
22
|
module.exports = {
|
|
23
23
|
pluginOptions: {
|
|
24
24
|
javascriptObfuscator: {
|
|
25
|
+
// Enable obfuscator
|
|
26
|
+
enable: false
|
|
25
27
|
// Files to include in obfuscation (can be a string or an array of strings/regex patterns)
|
|
26
28
|
includes: [
|
|
27
29
|
'app.*.js',
|
package/index.js
CHANGED
|
@@ -4,10 +4,8 @@ module.exports = (api, options = {}) => {
|
|
|
4
4
|
api.chainWebpack((config) => {
|
|
5
5
|
const pluginOptions = options.pluginOptions?.javascriptObfuscator
|
|
6
6
|
|
|
7
|
-
if (!pluginOptions) return
|
|
7
|
+
if (!pluginOptions || pluginOptions.enable === false) return
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
config.plugin('javascript-obfuscator').use(pluginInstance, [pluginOptions])
|
|
9
|
+
config.plugin('javascript-obfuscator').use(JavascriptObfuscatorPlugin, [pluginOptions])
|
|
12
10
|
})
|
|
13
11
|
}
|
package/jsconfig.json
ADDED
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue-cli-plugin-javascript-obfuscator",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "Vue CLI plugin for JavaScript obfuscation using javascript-obfuscator@4.x",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"
|
|
7
|
+
"release": "npm version patch && npm publish"
|
|
8
8
|
},
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
package/plugin.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
const JavaScriptObfuscator = require('javascript-obfuscator')
|
|
3
2
|
const micromatch = require('micromatch')
|
|
4
3
|
|
|
@@ -8,16 +7,21 @@ const micromatch = require('micromatch')
|
|
|
8
7
|
class JavascriptObfuscatorPlugin {
|
|
9
8
|
/**
|
|
10
9
|
* @param {Object} options
|
|
10
|
+
* @param {boolean} enable - enable obfuscator
|
|
11
11
|
* @param {string[]} [options.includes] - Glob patterns for files to include.
|
|
12
12
|
* @param {string[]} [options.excludes] - Glob patterns for files to exclude.
|
|
13
13
|
* @param {Object} [options.obfuscatorOptions] - Options for javascript-obfuscator.
|
|
14
14
|
*/
|
|
15
|
-
constructor({ includes = [], obfuscatorOptions = {} } = {}) {
|
|
15
|
+
constructor({ enable = true, includes = [], obfuscatorOptions = {} } = {}) {
|
|
16
|
+
this.enable = enable
|
|
16
17
|
this.includes = Array.isArray(includes) ? includes : includes ? [includes] : []
|
|
17
18
|
this.obfuscatorOptions = obfuscatorOptions
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
apply(compiler) {
|
|
22
|
+
if (!this.enable) {
|
|
23
|
+
return
|
|
24
|
+
}
|
|
21
25
|
compiler.hooks.emit.tapAsync(
|
|
22
26
|
'JavascriptObfuscatorPlugin',
|
|
23
27
|
async (compilation, callback) => {
|