8000 Merge pull request #467 from javascript-obfuscator/dependencies-updat… · sec-js/javascript-obfuscator@f14077c · GitHub
[go: up one dir, main page]

Skip to content

Commit f14077c

Browse files
authored
Merge pull request javascript-obfuscator#467 from javascript-obfuscator/dependencies-update-01.01.2020
Dependencies update #1
2 parents 248f634 + 2527fe3 commit f14077c

File tree

13 files changed

+807
-610
lines changed

13 files changed

+807
-610
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.awcache
22
.DS_Store
33
.idea
4+
.nyc_output
45
npm-debug.log
56
*.js.map
67
/coverage

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.awcache
22
.github
33
.idea
4+
.nyc_output
45
coverage
56
images
67
test/fixtures/compile-performance.js

dist/index.browser.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,28 +21,28 @@
2121
},
2222
"types": "index.d.ts",
2323
"dependencies": {
24+
"@nuxtjs/opencollective": "0.2.2",
2425
"chalk": "3.0.0",
25-
"chance": "1.1.3",
26+
"chance": "1.1.4",
2627
"class-validator": "0.11.0",
2728
"commander": "4.0.1",
2829
"escodegen-wallaby": "1.6.27",
29-
"espree": "^6.1.2",
30+
"espree": "6.1.2",
3031
"estraverse": "4.3.0",
3132
"eventemitter3": "4.0.0",
3233
"inversify": "5.0.1",
3334
"js-string-escape": "1.0.1",
3435
"md5": "2.2.1",
3536
"mkdirp": "0.5.1",
3637
"multimatch": "4.0.0",
37-
"opencollective": "1.0.3",
3838
"reflect-metadata": "0.1.13",
3939
"source-map-support": "0.5.16",
4040
"string-template": "1.0.0",
4141
"tslib": "1.10.0"
4242
},
4343
"devDependencies": {
44-
"@types/chai": "4.2.5",
45-
"@types/chance": "1.0.7",
44+
"@types/chai": "4.2.7",
45+
"@types/chance": "1.0.8",
4646
"@types/escodegen": "0.0.6",
4747
"@types/estraverse": "0.0.6",
4848
"@types/estree": "0.0.38",
@@ -58,21 +58,21 @@
5858
"awesome-typescript-loader": "5.2.1",
5959
"chai": "4.2.0",
6060
"coveralls": "3.0.9",
61-
"istanbul": "1.1.0-alpha.1",
6261
"mocha": "6.2.2",
62+
"nyc": "15.0.0",
6363
"pjson": "1.0.9",
6464
"pre-commit": "1.2.2",
6565
"rimraf": "3.0.0",
6666
"sinon": "7.5.0",
67-
"threads": "0.12.0",
67+
"threads": "1.0.0",
6868
"ts-node": "6.1.0",
69-
"tslint": "5.11.0",
70-
"tslint-eslint-rules": "5.3.1",
69+
"tslint": "5.20.1" F438 ,
70+
"tslint-eslint-rules": "5.4.0",
7171
"tslint-language-service": "0.9.9",
72-
"tslint-microsoft-contrib": "5.2.0",
72+
"tslint-microsoft-contrib": "6.2.0",
7373
"tslint-webpack-plugin": "1.2.2",
74-
"typescript": "3.7.2",
75-
"webpack": "4.41.2",
74+
"typescript": "3.7.4",
75+
"webpack": "4.41.5",
7676
"webpack-cli": "3.3.10",
7777
"webpack-node-externals": "1.7.2"
7878
},
@@ -99,7 +99,7 @@
9999
"tslint": "scripts/tslint",
100100
"travis": "scripts/travis",
101101
"git:addFiles": "scripts/git-add-files",
102-
"postinstall": "opencollective postinstall"
102+
"postinstall": "opencollective || exit 0"
103103
},
104104
"pre-commit": [
105105
"build",
@@ -114,8 +114,6 @@
114114
],
115115
"license": "BSD-2-Clause",
116116
"collective": {
117-
"type": "opencollective",
118-
"url": "https://opencollective.com/javascript-obfuscator",
119-
"logo": "https://opencollective.com/opencollective/logo.txt"
117+
"url": "https://opencollective.com/javascript-obfuscator"
120118
}
121119
}

scripts/test-coveralls

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
yarn run test:removeTmpDir &&
44
yarn run test:compile &&
5-
$(yarn bin)/istanbul cover $(yarn bin)/_mocha -- test-tmp/test/index.spec.js --report lcovonly &&
6-
cat ./coverage/lcov.info | $(yarn bin)/coveralls &&
5+
$(yarn bin)/nyc $(yarn bin)/mocha -- test-tmp/test/index.spec.js --exit &&
6+
$(yarn bin)/nyc report --reporter=text-lcov | $(yarn bin)/coveralls &&
77
yarn run test:removeTmpDir

scripts/test-full

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
yarn run test:removeTmpDir &&
44
yarn run test:compile &&
55
node test-tmp/test/dev/dev.js &&
6-
$(yarn bin)/istanbul cover $(yarn bin)/_mocha -- test-tmp/test/index.spec.js &&
6+
$(yarn bin)/nyc --reporter text-summary $(yarn bin)/mocha -- test-tmp/test/index.spec.js --exit &&
77
yarn run test:removeTmpDir

src/declarations/threads.d.ts

Lines changed: 0 additions & 15 deletions
This file was deleted.

test/declarations/index.d.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@
22
/// <reference path="../../src/declarations/escodegen-wallaby.d.ts" />
33
/// <reference path="../../src/declarations/espree.d.ts" />
44
/// <reference path="../../src/declarations/ESTree.d.ts" />
5-
/// <reference path="../../src/declarations/js-string-escape.d.ts" />
6-
/// <reference path="../../src/declarations/threads.d.ts" />
5+
/// <reference path="../../src/declarations/js-string-escape.d.ts" />

test/functional-tests/javascript-obfuscator/JavaScriptObfuscator.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,9 @@ describe('JavaScriptObfuscator', () => {
667667
});
668668
});
669669

670-
describe('Identifier names collision between base code and appended string array nodes', () => {
670+
describe('Identifier names collision between base code and appended string array nodes', function () {
671+
this.timeout(10000);
672+
671673
const samplesCount: number = 30;
672674

673675
let areCollisionsExists: boolean = false;

test/functional-tests/templates/debug-protection-nodes/DebugProtectionFunctionCallTemplate.spec.ts

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { assert } from 'chai';
2-
import { spawn } from 'threads';
2+
import { spawn, Thread, Worker } from 'threads/dist';
33

44
import { readFileAsString } from '../../../helpers/readFileAsString';
55

@@ -10,26 +10,26 @@ import { ObfuscationTarget } from '../../../../src/enums/ObfuscationTarget';
1010

1111
import { JavaScriptObfuscator } from '../../../../src/JavaScriptObfuscatorFacade';
1212

13-
function spawnThread(inputCallback: Function, threadCallback: Function, timeoutCallback: Function): void {
14-
const thread = spawn<string, number>((input: string, postMessage: Function) => {
15-
postMessage(eval(input));
16-
});
13+
14+
15+
async function spawnThread(obfuscatedCode: string, threadCallback: Function, timeoutCallback: Function): Promise<void> {
16+
const evaluationWorker = await spawn(new Worker('./workers/evaluation-worker'));
1717

1818
const timeout = setTimeout(() => {
19-
thread.kill();
19+
Thread.terminate(evaluationWorker);
2020
timeoutCallback();
2121
}, 1500);
2222

23-
thread
24-
.send(inputCallback())
25-
.on('message', (response: number) => {
26-
clearTimeout(timeout);
27-
thread.kill();
28-
threadCallback(response);
29-
});
23+
const result: string = await evaluationWorker.evaluate(obfuscatedCode);
24+
25+
clearTimeout(timeout);
26+
Thread.terminate(evaluationWorker);
27+
threadCallback(result);
3028
}
3129

32-
describe('DebugProtectionFunctionCallTemplate', () => {
30+
describe('DebugProtectionFunctionCallTemplate', function () {
31+
this.timeout(5000);
32+
3333
describe('Variant #1: correctly obfuscate code with `HexadecimalIdentifierNamesGenerator``', () => {
3434
const expectedEvaluationResult: number = 1;
3535

@@ -49,7 +49,7 @@ describe('DebugProtectionFunctionCallTemplate', () => {
4949
).getObfuscatedCode();
5050

5151
spawnThread(
52-
() => obfuscatedCode,
52+
obfuscatedCode,
5353
(response: number) => {
5454
evaluationResult = response;
5555
done();
@@ -84,7 +84,7 @@ describe('DebugProtectionFunctionCallTemplate', () => {
8484
).getObfuscatedCode();
8585

8686
spawnThread(
87-
() => obfuscatedCode,
87+
obfuscatedCode,
8888
(response: number) => {
8989
evaluationResult = response;
9090
done();
@@ -120,7 +120,7 @@ describe('DebugProtectionFunctionCallTemplate', () => {
120120
).getObfuscatedCode();
121121

122122
spawnThread(
123-
() => obfuscatedCode,
123+
obfuscatedCode,
124124
(response: number) => {
125125
evaluationResult = response;
126126
done();
@@ -155,7 +155,7 @@ describe('DebugProtectionFunctionCallTemplate', () => {
155155
).getObfuscatedCode();
156156

157157
spawnThread(
158-
() => obfuscatedCode,
158+
obfuscatedCode,
159159
(response: number) => {
160160
evaluationResult = response;
161161
done();
@@ -190,7 +190,7 @@ describe('DebugProtectionFunctionCallTemplate', () => {
190190
obfuscatedCode = obfuscatedCode.replace(/\+\+ *_0x([a-f0-9]){4,6}/, '');
191191

192192
spawnThread(
193-
() => obfuscatedCode,
193+
obfuscatedCode,
194194
(response: number) => {
195195
evaluationResult = response;
196196
done();
@@ -224,7 +224,7 @@ describe('DebugProtectionFunctionCallTemplate', () => {
224224
).getObfuscatedCode();
225225

226226
spawnThread(
227-
() => obfuscatedCode,
227+
obfuscatedCode,
228228
(response: number) => {
229229
evaluationResult = response;
230230
done();

0 commit comments

Comments
 (0)
0