Skip to content

Commit 868f40e

Browse files
committed
version update
1 parent bdcfc56 commit 868f40e

File tree

5 files changed

+88
-31
lines changed

5 files changed

+88
-31
lines changed

LICENSE.BSD

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Redistribution and use in source and binary forms, with or without
2+
modification, are permitted provided that the following conditions are met:
3+
4+
* Redistributions of source code must retain the above copyright
5+
notice, this list of conditions and the following disclaimer.
6+
* Redistributions in binary form must reproduce the above copyright
7+
notice, this list of conditions and the following disclaimer in the
8+
documentation and/or other materials provided with the distribution.
9+
10+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
11+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
12+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
13+
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
14+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
15+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
16+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
17+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
18+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
19+
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

index.js

+21-18
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,42 @@
11
"use strict";
2-
let JavaScriptObfuscator = require('javascript-obfuscator'), multimatch = require('multimatch'), RawSource = require('webpack-core/lib/RawSource');
3-
class WebpackObfuscator {
4-
constructor(options, excludes) {
2+
var JavaScriptObfuscator = require('javascript-obfuscator'), multimatch = require('multimatch'), RawSource = require('webpack-core/lib/RawSource');
3+
var WebpackObfuscator = (function () {
4+
function WebpackObfuscator(options, excludes) {
55
this.options = {};
66
this.PLUGIN_NAME = 'webpack-obfuscator';
77
this.options = options;
88
this.excludes = typeof excludes === 'string' ? [excludes] : excludes || [];
99
}
10-
apply(compiler) {
11-
compiler.plugin('compilation', (compilation) => {
12-
compilation.plugin("optimize-chunk-assets", (chunks, callback) => {
13-
let files = [];
14-
chunks.forEach((chunk) => {
15-
chunk['files'].forEach((file) => {
10+
WebpackObfuscator.prototype.apply = function (compiler) {
11+
var _this = this;
12+
compiler.plugin('compilation', function (compilation) {
13+
compilation.plugin("optimize-chunk-assets", function (chunks, callback) {
14+
var files = [];
15+
chunks.forEach(function (chunk) {
16+
chunk['files'].forEach(function (file) {
1617
files.push(file);
1718
});
1819
});
19-
compilation.additionalChunkAssets.forEach((file) => {
20+
compilation.additionalChunkAssets.forEach(function (file) {
2021
files.push(file);
2122
});
22-
files.forEach((file) => {
23-
let asset = compilation.assets[file];
24-
compilation.assets[file] = new RawSource(JavaScriptObfuscator.obfuscate(asset.source(), this.options));
23+
files.forEach(function (file) {
24+
var asset = compilation.assets[file];
25+
compilation.assets[file] = new RawSource(JavaScriptObfuscator.obfuscate(asset.source(), _this.options));
2526
});
2627
callback();
2728
});
2829
});
29-
}
30-
shouldExclude(filePath, excludes) {
31-
for (let exclude of excludes) {
30+
};
31+
WebpackObfuscator.prototype.shouldExclude = function (filePath, excludes) {
32+
for (var _i = 0, excludes_1 = excludes; _i < excludes_1.length; _i++) {
33+
var exclude = excludes_1[_i];
3234
if (multimatch(filePath, exclude).length > 0) {
3335
return true;
3436
}
3537
}
3638
return false;
37-
}
38-
}
39+
};
40+
return WebpackObfuscator;
41+
}());
3942
module.exports = WebpackObfuscator;

package.json

+17-7
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,29 @@
11
{
22
"name": "webpack-obfuscator",
3-
"version": "0.5.4",
3+
"version": "0.6.0",
44
"description": "javascript-obfuscator plugin for Webpack",
5+
"keywords": [
6+
"obfuscator",
7+
"obfuscation",
8+
"uglify",
9+
"crush",
10+
"code protection",
11+
"javascript obfuscator",
12+
"js obfuscator",
13+
"webpack obfuscator"
14+
],
515
"main": "index.js",
616
"dependencies": {
17+
"javascript-obfuscator": "^0.6.0"
18+
},
19+
"devDependencies": {
720
"gulp-util": "^3.0.5",
8-
"javascript-obfuscator": "^0.5.3",
21+
"lite-server": "^1.3.1",
922
"multimatch": "^2.0.0",
1023
"through2": "^2.0.0",
1124
"webpack-core": "^0.6.8",
1225
"typescript": "^1.8.10"
1326
},
14-
"devDependencies": {
15-
"lite-server": "^1.3.1"
16-
},
1727
"repository": {
1828
"type": "git",
1929
"url": "git+https://github.com/sanex3339/webpack-obfuscator.git"
@@ -25,7 +35,7 @@
2535
"start": "concurrent \"npm run tsc:w\" \"npm run lite\" "
2636
},
2737
"author": {
28-
"name": "sanex3339"
38+
"name": "Timofey Kachalov"
2939
},
30-
"license": "ISC"
40+
"license": "BSD-2-Clause"
3141
}

readme.md

+30-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
#javascript-obfuscator plugin for Webpack
22

3-
###Installation
3+
[![npm version](https://badge.fury.io/js/webpack-obfuscator.svg)](https://badge.fury.io/js/webpack-obfuscator)
4+
5+
### Installation
46

57
Install the package with NPM and add it to your devDependencies:
68

79
`npm install --save-dev webpack-obfuscator`
810

9-
###Usage:
11+
### Usage:
1012

1113
```javascript
1214
var WebpackObfuscator = require('webpack-obfuscator');
@@ -21,14 +23,37 @@ plugins: [
2123
],
2224
```
2325

24-
###obfuscatorOptions
26+
### obfuscatorOptions
2527
Type: `Object` Default: `null`
2628

2729
Options for [javascript-obfuscator](https://github.com/sanex3339/javascript-obfuscator). Should be passed exactly like described on their page.
2830

29-
###excludes
31+
### excludes
3032
Type: `Array` or `String` Default: `[]`
3133

3234
Examples: `['excluded_bundle_name.js', '**_bundle_name.js']` or `'excluded_bundle_name.js'`
3335

34-
Can be used to bypass obfuscation of some files.
36+
Can be used to bypass obfuscation of some files.
37+
38+
### License
39+
Copyright (C) 2016 [Timofey Kachalov](http://github.com/sanex3339).
40+
41+
Redistribution and use in source and binary forms, with or without
42+
modification, are permitted provided that the following conditions are met:
43+
44+
* Redistributions of source code must retain the above copyright
45+
notice, this list of conditions and the following disclaimer.
46+
* Redistributions in binary form must reproduce the above copyright
47+
notice, this list of conditions and the following disclaimer in the
48+
documentation and/or other materials provided with the distribution.
49+
50+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
51+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
52+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
53+
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
54+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
55+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
56+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
57+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
58+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
59+
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"compilerOptions": {
3-
"target": "ES6",
3+
"target": "ES5",
44
"module": "commonjs",
55
"sourceMap": false,
66
"emitDecoratorMetadata": true,

0 commit comments

Comments
 (0)