mirror of
https://github.com/javascript-obfuscator/javascript-obfuscator
synced 2026-08-09 12:42:29 +00:00
Merge pull request #819 from javascript-obfuscator/dependencies-update-20.11.20
Fixed wrong name of obfuscated files when input directory path is the `.` symbol
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
Change Log
|
||||
|
||||
v2.9.3
|
||||
---
|
||||
* **CLI**: Fixed wrong name of obfuscated files when input directory path is the `.` symbol. https://github.com/javascript-obfuscator/javascript-obfuscator/issues/816
|
||||
|
||||
v2.9.2
|
||||
---
|
||||
* Ignore object expressions as body of arrow function expression when `transformObjectKeys` option is enabled. Fixed https://github.com/javascript-obfuscator/javascript-obfuscator/issues/813
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
+4
-4
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "javascript-obfuscator",
|
||||
"version": "2.9.2",
|
||||
"version": "2.9.3",
|
||||
"description": "JavaScript obfuscator",
|
||||
"keywords": [
|
||||
"obfuscator",
|
||||
@@ -58,7 +58,7 @@
|
||||
"@types/mkdirp": "1.0.1",
|
||||
"@types/mocha": "8.0.4",
|
||||
"@types/multimatch": "4.0.0",
|
||||
"@types/node": "14.14.8",
|
||||
"@types/node": "14.14.9",
|
||||
"@types/rimraf": "3.0.0",
|
||||
"@types/sinon": "9.0.8",
|
||||
"@types/string-template": "1.0.2",
|
||||
@@ -86,8 +86,8 @@
|
||||
"threads": "1.6.3",
|
||||
"ts-loader": "8.0.11",
|
||||
"ts-node": "9.0.0",
|
||||
"typescript": "4.1.0-beta",
|
||||
"webpack": "5.5.1",
|
||||
"typescript": "4.1.2",
|
||||
"webpack": "5.6.0",
|
||||
"webpack-cli": "4.2.0",
|
||||
"webpack-node-externals": "2.5.2"
|
||||
},
|
||||
|
||||
@@ -60,7 +60,11 @@ export class ObfuscatedCodeWriter {
|
||||
|
||||
if (isDirectoryRawInputPath) {
|
||||
if (isDirectoryRawOutputPath) {
|
||||
const baseOutputPath: string = normalizedFilePath.replace(this.inputPath, '');
|
||||
const parsedNormalizedFilePath: path.ParsedPath = path.parse(normalizedFilePath);
|
||||
const baseOutputPath: string = path.join(
|
||||
parsedNormalizedFilePath.dir.replace(this.inputPath, ''),
|
||||
parsedNormalizedFilePath.base
|
||||
);
|
||||
|
||||
return path.join(normalizedRawOutputPath, baseOutputPath);
|
||||
} else {
|
||||
|
||||
@@ -88,6 +88,60 @@ describe('ObfuscatedCodeWriter', () => {
|
||||
|
||||
describe('Variant #4: raw input path is a directory path, raw output path is a directory path', () => {
|
||||
describe('Variant #1: base directory name', () => {
|
||||
const inputPath: string = path.join(tmpDirectoryPath, 'input', 'test-input.js');
|
||||
const rawInputPath: string = path.join(tmpDirectoryPath, 'input');
|
||||
const rawOutputPath: string = path.join(tmpDirectoryPath, 'output');
|
||||
const expectedOutputCodePath: string = path.join(
|
||||
tmpDirectoryPath,
|
||||
'output',
|
||||
'test-input.js'
|
||||
);
|
||||
|
||||
let outputCodePath: string;
|
||||
|
||||
before(() => {
|
||||
const obfuscatedCodeWriter: ObfuscatedCodeWriter = new ObfuscatedCodeWriter(
|
||||
rawInputPath,
|
||||
{
|
||||
output: rawOutputPath
|
||||
}
|
||||
);
|
||||
outputCodePath = obfuscatedCodeWriter.getOutputCodePath(inputPath);
|
||||
});
|
||||
|
||||
it('should return output path that contains raw output path and actual file input path', () => {
|
||||
assert.equal(outputCodePath, expectedOutputCodePath);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Variant #2: base directory name with leading dot in output path', () => {
|
||||
const inputPath: string = path.join(tmpDirectoryPath, 'input', 'test-input.js');
|
||||
const rawInputPath: string = path.join(tmpDirectoryPath, 'input');
|
||||
const rawOutputPath: string = path.join('.', tmpDirectoryPath, 'output');
|
||||
const expectedOutputCodePath: string = path.join(
|
||||
tmpDirectoryPath,
|
||||
'output',
|
||||
'test-input.js'
|
||||
);
|
||||
|
||||
let outputCodePath: string;
|
||||
|
||||
before(() => {
|
||||
const obfuscatedCodeWriter: ObfuscatedCodeWriter = new ObfuscatedCodeWriter(
|
||||
rawInputPath,
|
||||
{
|
||||
output: rawOutputPath
|
||||
}
|
||||
);
|
||||
outputCodePath = obfuscatedCodeWriter.getOutputCodePath(inputPath);
|
||||
});
|
||||
|
||||
it('should return output path that contains raw output path and actual file input path', () => {
|
||||
assert.equal(outputCodePath, expectedOutputCodePath);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Variant #3: base nested directory name', () => {
|
||||
const inputPath: string = path.join(tmpDirectoryPath, 'input', 'nested', 'test-input.js');
|
||||
const rawInputPath: string = path.join(tmpDirectoryPath, 'input');
|
||||
const rawOutputPath: string = path.join(tmpDirectoryPath, 'output');
|
||||
@@ -115,7 +169,7 @@ describe('ObfuscatedCodeWriter', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('Variant #2: directory name with dot', () => {
|
||||
describe('Variant #4: directory name with dot', () => {
|
||||
const inputPath: string = path.join(tmpDirectoryPath, 'input', 'nested', 'test-input.js');
|
||||
const rawInputPath: string = path.join(tmpDirectoryPath, 'input');
|
||||
const rawOutputPath: string = path.join(tmpDirectoryPath, 'output', 'foo.bar');
|
||||
@@ -143,6 +197,60 @@ describe('ObfuscatedCodeWriter', () => {
|
||||
assert.equal(outputCodePath, expectedOutputCodePath);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Variant #5: input directory name with dot only', () => {
|
||||
const inputPath: string = path.join('test-input.js');
|
||||
const rawInputPath: string = path.join('.');
|
||||
const rawOutputPath: string = path.join(tmpDirectoryPath, 'output');
|
||||
const expectedOutputCodePath: string = path.join(
|
||||
tmpDirectoryPath,
|
||||
'output',
|
||||
'test-input.js'
|
||||
);
|
||||
|
||||
let outputCodePath: string;
|
||||
|
||||
before(() => {
|
||||
const obfuscatedCodeWriter: ObfuscatedCodeWriter = new ObfuscatedCodeWriter(
|
||||
rawInputPath,
|
||||
{
|
||||
output: rawOutputPath
|
||||
}
|
||||
);
|
||||
outputCodePath = obfuscatedCodeWriter.getOutputCodePath(inputPath);
|
||||
});
|
||||
|
||||
it('should return output path that contains raw output path and actual file input path', () => {
|
||||
assert.equal(outputCodePath, expectedOutputCodePath);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Variant #6: input directory name with dot and slash only', () => {
|
||||
const inputPath: string = path.join('test-input.js');
|
||||
const rawInputPath: string = path.join('./');
|
||||
const rawOutputPath: string = path.join(tmpDirectoryPath, 'output');
|
||||
const expectedOutputCodePath: string = path.join(
|
||||
tmpDirectoryPath,
|
||||
'output',
|
||||
'test-input.js'
|
||||
);
|
||||
|
||||
let outputCodePath: string;
|
||||
|
||||
before(() => {
|
||||
const obfuscatedCodeWriter: ObfuscatedCodeWriter = new ObfuscatedCodeWriter(
|
||||
rawInputPath,
|
||||
{
|
||||
output: rawOutputPath
|
||||
}
|
||||
);
|
||||
outputCodePath = obfuscatedCodeWriter.getOutputCodePath(inputPath);
|
||||
});
|
||||
|
||||
it('should return output path that contains raw output path and actual file input path', () => {
|
||||
assert.equal(outputCodePath, expectedOutputCodePath);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('Variant #5: Win32 environment', () => {
|
||||
|
||||
@@ -530,10 +530,10 @@
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-13.9.3.tgz#6356df2647de9eac569f9a52eda3480fa9e70b4d"
|
||||
integrity sha512-01s+ac4qerwd6RHD+mVbOEsraDHSgUaefQlEdBbUolnQFjKwCr7luvAlEwW1RFojh67u0z4OUTjPn9LEl4zIkA==
|
||||
|
||||
"@types/node@14.14.8":
|
||||
version "14.14.8"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.8.tgz#2127bd81949a95c8b7d3240f3254352d72563aec"
|
||||
integrity sha512-z/5Yd59dCKI5kbxauAJgw6dLPzW+TNOItNE00PkpzNwUIEwdj/Lsqwq94H5DdYBX7C13aRA0CY32BK76+neEUA==
|
||||
"@types/node@14.14.9":
|
||||
version "14.14.9"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.9.tgz#04afc9a25c6ff93da14deabd65dc44485b53c8d6"
|
||||
integrity sha512-JsoLXFppG62tWTklIoO4knA+oDTYsmqWxHRvd4lpmfQRNhX6osheUOWETP2jMoV/2bEHuMra8Pp3Dmo/stBFcw==
|
||||
|
||||
"@types/normalize-package-data@^2.4.0":
|
||||
version "2.4.0"
|
||||
@@ -4413,10 +4413,10 @@ typedarray@^0.0.6:
|
||||
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
|
||||
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=
|
||||
|
||||
typescript@4.1.0-beta:
|
||||
version "4.1.0-beta"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.0-beta.tgz#e4d054035d253b7a37bdc077dd71706508573e69"
|
||||
integrity sha512-b/LAttdVl3G6FEmnMkDsK0xvfvaftXpSKrjXn+OVCRqrwz5WD/6QJOiN+dTorqDY+hkaH+r2gP5wI1jBDmdQ7A==
|
||||
typescript@4.1.2:
|
||||
version "4.1.2"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.2.tgz#6369ef22516fe5e10304aae5a5c4862db55380e9"
|
||||
integrity sha512-thGloWsGH3SOxv1SoY7QojKi0tc+8FnOmiarEGMbd/lar7QOEd3hvlx3Fp5y6FlDUGl9L+pd4n2e+oToGMmhRQ==
|
||||
|
||||
typical@^5.0.0, typical@^5.2.0:
|
||||
version "5.2.0"
|
||||
@@ -4536,10 +4536,10 @@ webpack-sources@^2.1.1:
|
||||
source-list-map "^2.0.1"
|
||||
source-map "^0.6.1"
|
||||
|
||||
webpack@5.5.1:
|
||||
version "5.5.1"
|
||||
resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.5.1.tgz#d6537f85554a0e59f15e6e683af11befdd0476aa"
|
||||
integrity sha512-v4RzZP9BG2xxMLhxcFIo89M+nyIqGjh35Bhm5EE+I2N8y3dc9jT5OSb1HewUMkzMPyyDscOkVD6pSn6EMtTwNQ==
|
||||
webpack@5.6.0:
|
||||
version "5.6.0"
|
||||
resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.6.0.tgz#282d10434c403b070ed91d459b385e873b51a07d"
|
||||
integrity sha512-SIeFuBhuheKElRbd84O35UhKc0nxlgSwtzm2ksZ0BVhRJqxVJxEguT/pYhfiR0le/pxTa1VsCp7EOYyTsa6XOA==
|
||||
dependencies:
|
||||
"@types/eslint-scope" "^3.7.0"
|
||||
"@types/estree" "^0.0.45"
|
||||
|
||||
Reference in New Issue
Block a user