From 7792fb0be3ab36af2f3925c4e754b24a5a4008fa Mon Sep 17 00:00:00 2001 From: Timofey Kachalov Date: Sat, 21 Mar 2026 23:55:38 +0700 Subject: [PATCH 01/24] Fixed class expression name references inside class body being incorrectly resolved to an import binding with the same name, causing broken code at runtime (#1387) --- CHANGELOG.md | 4 ++ package.json | 2 +- src/analyzers/scope-analyzer/ScopeAnalyzer.ts | 6 +- .../scope-analyzer/ScopeAnalyzer.spec.ts | 60 +++++++++++++++++++ .../class-expression-name-shadowing-import.js | 17 ++++++ 5 files changed, 87 insertions(+), 2 deletions(-) create mode 100644 test/functional-tests/analyzers/scope-analyzer/fixtures/class-expression-name-shadowing-import.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 35118b467..9e4ac0062 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ Change Log +v5.3.1 +--- +* Fixed class expression name references inside class body being incorrectly resolved to an import binding with the same name, causing broken code at runtime. Fixes https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1386 + v5.3.0 --- * Add Pro API support to CLI diff --git a/package.json b/package.json index 2519534eb..005f5a90d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "javascript-obfuscator", - "version": "5.3.0", + "version": "5.3.1", "description": "JavaScript obfuscator", "keywords": [ "obfuscator", diff --git a/src/analyzers/scope-analyzer/ScopeAnalyzer.ts b/src/analyzers/scope-analyzer/ScopeAnalyzer.ts index b4001cf6d..1c001e376 100644 --- a/src/analyzers/scope-analyzer/ScopeAnalyzer.ts +++ b/src/analyzers/scope-analyzer/ScopeAnalyzer.ts @@ -238,7 +238,11 @@ export class ScopeAnalyzer implements IScopeAnalyzer { (definition: eslintScope.Definition) => definition.type === 'ClassName' ); - return isValidClassNameVariable && variable.name === classNameVariable.name; + const isImportBinding: boolean = variable.defs.some( + (definition: eslintScope.Definition) => definition.type === 'ImportBinding' + ); + + return isValidClassNameVariable && variable.name === classNameVariable.name && !isImportBinding; } ); diff --git a/test/functional-tests/analyzers/scope-analyzer/ScopeAnalyzer.spec.ts b/test/functional-tests/analyzers/scope-analyzer/ScopeAnalyzer.spec.ts index 188f6d0cc..b5539fe26 100644 --- a/test/functional-tests/analyzers/scope-analyzer/ScopeAnalyzer.spec.ts +++ b/test/functional-tests/analyzers/scope-analyzer/ScopeAnalyzer.spec.ts @@ -6,6 +6,7 @@ import { evalLocal } from '../../../helpers/evalLocal'; import { readFileAsString } from '../../../helpers/readFileAsString'; import { JavaScriptObfuscator } from '../../../../src/JavaScriptObfuscatorFacade'; +import { NO_ADDITIONAL_NODES_PRESET } from '../../../../src/options/presets/NoCustomNodes'; describe('ScopeAnalyzer', () => { describe('analyze', () => { @@ -121,5 +122,64 @@ describe('ScopeAnalyzer', () => { }); }); }); + + describe('Variant #3: class expression name shadowing import binding', () => { + const samplesCount: number = 50; + + let obfuscatedCode: string; + let importBindingName: string | null; + let classExpressionName: string | null; + + beforeEach(() => { + const code: string = readFileAsString( + __dirname + '/fixtures/class-expression-name-shadowing-import.js' + ); + + importBindingName = null; + classExpressionName = null; + + for (let i = 0; i < samplesCount; i++) { + obfuscatedCode = JavaScriptObfuscator.obfuscate(code, { + ...NO_ADDITIONAL_NODES_PRESET, + compact: false, + stringArray: false, + seed: i + }).getObfuscatedCode(); + + const importMatch = obfuscatedCode.match(/import\s*\{\s*i\s+as\s+(\w+)\s*\}/); + const classMatch = obfuscatedCode.match(/=\s*class\s+(\w+)\s*\{/); + + if (importMatch && classMatch) { + importBindingName = importMatch[1]; + classExpressionName = classMatch[1]; + + if (importBindingName !== classExpressionName) { + break; + } + } + } + }); + + it('should not rename class expression self-references to the import binding', () => { + assert.isNotNull(importBindingName, 'should find import binding name'); + assert.isNotNull(classExpressionName, 'should find class expression name'); + + const getInstanceMatch = obfuscatedCode.match(/getInstance[^}]*\{([^}]*)\}/s); + assert.isNotNull(getInstanceMatch, 'should find getInstance body'); + + const getInstanceBody: string = getInstanceMatch![1]; + + assert.include( + getInstanceBody, + `new ${classExpressionName!}()`, + 'new () inside getInstance should reference the class expression name' + ); + assert.notInclude( + getInstanceBody, + `new ${importBindingName!}()`, + 'new () inside getInstance should NOT reference the import binding' + ); + }); + }); }); }); diff --git a/test/functional-tests/analyzers/scope-analyzer/fixtures/class-expression-name-shadowing-import.js b/test/functional-tests/analyzers/scope-analyzer/fixtures/class-expression-name-shadowing-import.js new file mode 100644 index 000000000..3d14de717 --- /dev/null +++ b/test/functional-tests/analyzers/scope-analyzer/fixtures/class-expression-name-shadowing-import.js @@ -0,0 +1,17 @@ +import { i as e } from './runtime.js'; + +function factory() { + return 'factory-result'; +} + +var P = class e { + static instance; + + static getInstance() { + return ((e.instance ||= new e()), e.instance); + } +}; + +var x = e(factory(), 1); + +export { P, x }; From 1aadbacc06cc6c0b6862f10f62cea636c13c62db Mon Sep 17 00:00:00 2001 From: Roli Bosch Date: Sun, 22 Mar 2026 00:26:33 -0400 Subject: [PATCH 02/24] Replace mkdirp with native fs.mkdirSync({ recursive: true }) (#1384) --- package.json | 2 -- src/cli/utils/ObfuscatedCodeFileUtils.ts | 3 +-- .../cli/JavaScriptObfuscatorCLI.spec.ts | 3 +-- .../cli/utils/IdentifierNamesCacheFileUtils.spec.ts | 3 +-- .../cli/utils/ObfuscatedCodeFileUtils.spec.ts | 5 ++--- .../unit-tests/cli/utils/SourceCodeFileUtils.spec.ts | 9 ++++----- yarn.lock | 12 ------------ 7 files changed, 9 insertions(+), 28 deletions(-) diff --git a/package.json b/package.json index 005f5a90d..ad496b54f 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,6 @@ "inversify": "6.1.4", "js-string-escape": "1.0.1", "md5": "2.3.0", - "mkdirp": "3.0.1", "multimatch": "5.0.0", "process": "0.11.10", "reflect-metadata": "0.2.2", @@ -58,7 +57,6 @@ "@types/js-beautify": "1.14.3", "@types/js-string-escape": "1.0.3", "@types/md5": "2.3.6", - "@types/mkdirp": "1.0.2", "@types/mocha": "10.0.10", "@types/multimatch": "4.0.0", "@types/node": "22.10.2", diff --git a/src/cli/utils/ObfuscatedCodeFileUtils.ts b/src/cli/utils/ObfuscatedCodeFileUtils.ts index da157c6a8..443f225d3 100644 --- a/src/cli/utils/ObfuscatedCodeFileUtils.ts +++ b/src/cli/utils/ObfuscatedCodeFileUtils.ts @@ -1,5 +1,4 @@ import * as fs from 'fs'; -import * as mkdirp from 'mkdirp'; import * as path from 'path'; import { TInputCLIOptions } from '../../types/options/TInputCLIOptions'; @@ -135,7 +134,7 @@ export class ObfuscatedCodeFileUtils { * @param {string} data */ public writeFile(outputPath: string, data: string): void { - mkdirp.sync(path.dirname(outputPath)); + fs.mkdirSync(path.dirname(outputPath), { recursive: true }); fs.writeFileSync(outputPath, data, { encoding: JavaScriptObfuscatorCLI.encoding diff --git a/test/functional-tests/cli/JavaScriptObfuscatorCLI.spec.ts b/test/functional-tests/cli/JavaScriptObfuscatorCLI.spec.ts index 7fe0a1a8d..541e33108 100644 --- a/test/functional-tests/cli/JavaScriptObfuscatorCLI.spec.ts +++ b/test/functional-tests/cli/JavaScriptObfuscatorCLI.spec.ts @@ -1,5 +1,4 @@ import * as fs from 'fs'; -import * as mkdirp from 'mkdirp'; import * as path from 'path'; import * as rimraf from 'rimraf'; import * as sinon from 'sinon'; @@ -32,7 +31,7 @@ describe('JavaScriptObfuscatorCLI', function (): void { describe('run', () => { before(async () => { - mkdirp.sync(outputDirName); + fs.mkdirSync(outputDirName, { recursive: true }); }); describe('Variant #1: obfuscation of single file', () => { diff --git a/test/unit-tests/cli/utils/IdentifierNamesCacheFileUtils.spec.ts b/test/unit-tests/cli/utils/IdentifierNamesCacheFileUtils.spec.ts index 6e2b47c03..08d7c49f7 100644 --- a/test/unit-tests/cli/utils/IdentifierNamesCacheFileUtils.spec.ts +++ b/test/unit-tests/cli/utils/IdentifierNamesCacheFileUtils.spec.ts @@ -1,5 +1,4 @@ import * as fs from 'fs'; -import * as mkdirp from 'mkdirp'; import * as path from 'path'; import * as rimraf from 'rimraf'; @@ -24,7 +23,7 @@ describe('IdentifierNamesCacheFileUtils', () => { const tmpDirectoryPath: string = path.join('test', 'tmp'); before(() => { - mkdirp.sync(tmpDirectoryPath); + fs.mkdirSync(tmpDirectoryPath, { recursive: true }); }); describe('readFile', () => { diff --git a/test/unit-tests/cli/utils/ObfuscatedCodeFileUtils.spec.ts b/test/unit-tests/cli/utils/ObfuscatedCodeFileUtils.spec.ts index ce87401ed..db0fac264 100644 --- a/test/unit-tests/cli/utils/ObfuscatedCodeFileUtils.spec.ts +++ b/test/unit-tests/cli/utils/ObfuscatedCodeFileUtils.spec.ts @@ -1,6 +1,5 @@ import { assert } from 'chai'; import * as fs from 'fs'; -import * as mkdirp from 'mkdirp'; import * as path from 'path'; import * as rimraf from 'rimraf'; @@ -11,7 +10,7 @@ describe('obfuscatedCodeFileUtils', () => { describe('getOutputCodePath', () => { before(() => { - mkdirp.sync(path.join(tmpDirectoryPath, 'input', 'nested')); + fs.mkdirSync(path.join(tmpDirectoryPath, 'input', 'nested'), { recursive: true }); fs.writeFileSync(path.join(tmpDirectoryPath, 'input', 'nested', 'test-input.js'), 'var foo = 1;'); }); @@ -206,7 +205,7 @@ describe('obfuscatedCodeFileUtils', () => { const baseDirnamePath: string = __dirname; before(() => { - mkdirp.sync(path.join(baseDirnamePath, tmpDirectoryPath, 'input', 'nested')); + fs.mkdirSync(path.join(baseDirnamePath, tmpDirectoryPath, 'input', 'nested'), { recursive: true }); fs.writeFileSync( path.join(baseDirnamePath, tmpDirectoryPath, 'input', 'nested', 'test-input.js'), 'var foo = 1;' diff --git a/test/unit-tests/cli/utils/SourceCodeFileUtils.spec.ts b/test/unit-tests/cli/utils/SourceCodeFileUtils.spec.ts index f7dbb8437..ab66b8ad7 100644 --- a/test/unit-tests/cli/utils/SourceCodeFileUtils.spec.ts +++ b/test/unit-tests/cli/utils/SourceCodeFileUtils.spec.ts @@ -1,5 +1,4 @@ import * as fs from 'fs'; -import * as mkdirp from 'mkdirp'; import * as path from 'path'; import * as rimraf from 'rimraf'; @@ -15,7 +14,7 @@ describe('SourceCodeFileUtils', () => { const tmpDirectoryPath: string = path.join('test', 'tmp'); before(() => { - mkdirp.sync(tmpDirectoryPath); + fs.mkdirSync(tmpDirectoryPath, { recursive: true }); }); describe('readSourceCode', () => { @@ -277,8 +276,8 @@ describe('SourceCodeFileUtils', () => { let result: IFileData[]; before(() => { - mkdirp.sync(parentDirectoryPath1); - mkdirp.sync(parentDirectoryPath2); + fs.mkdirSync(parentDirectoryPath1, { recursive: true }); + fs.mkdirSync(parentDirectoryPath2, { recursive: true }); fs.writeFileSync(filePath1, fileContent); fs.writeFileSync(filePath2, fileContent); fs.writeFileSync(filePath3, fileContent); @@ -534,7 +533,7 @@ describe('SourceCodeFileUtils', () => { let result: IFileData[]; before(() => { - mkdirp.sync(tmpDirectoryWithDotPath); + fs.mkdirSync(tmpDirectoryWithDotPath, { recursive: true }); fs.writeFileSync(filePath, fileContent); result = new SourceCodeFileUtils(tmpDirectoryWithDotPath, {}).readSourceCode(); }); diff --git a/yarn.lock b/yarn.lock index b65d31b1a..79f0d7111 100644 --- a/yarn.lock +++ b/yarn.lock @@ -693,13 +693,6 @@ resolved "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz" integrity sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA== -"@types/mkdirp@1.0.2": - version "1.0.2" - resolved "https://registry.yarnpkg.com/@types/mkdirp/-/mkdirp-1.0.2.tgz#8d0bad7aa793abe551860be1f7ae7f3198c16666" - integrity sha512-o0K1tSO0Dx5X6xlU5F1D6625FawhC3dU3iqr25lluNv/+/QIVH8RLNEiVokgIZo+mz+87w/3Mkg/VvQS+J51fQ== - dependencies: - "@types/node" "*" - "@types/mocha@10.0.10": version "10.0.10" resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-10.0.10.tgz#91f62905e8d23cbd66225312f239454a23bebfa0" @@ -3919,11 +3912,6 @@ minimist@^1.2.6: resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.1.2.tgz#93a9626ce5e5e66bd4db86849e7515e92340a707" integrity sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw== -mkdirp@3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-3.0.1.tgz#e44e4c5607fb279c168241713cc6e0fea9adcb50" - integrity sha512-+NsyUUAZDmo6YVHzL/stxSu3t9YS1iljliy3BSDrXJ/dkn1KYdmtZODGGjLcc9XLgVVpH4KshHB8XmZgMhaBXg== - mocha@11.7.4: version "11.7.4" resolved "https://registry.yarnpkg.com/mocha/-/mocha-11.7.4.tgz#f161b17aeccb0762484b33bdb3f7ab9410ba5c82" From 560212c0c48537bf2302fe139720965f64257263 Mon Sep 17 00:00:00 2001 From: Timofey Kachalov Date: Sun, 22 Mar 2026 11:56:53 +0700 Subject: [PATCH 03/24] Add import attributes support (#1388) --- CHANGELOG.md | 5 + package.json | 5 +- src/ASTParserFacade.ts | 5 +- src/declarations/acorn-import-attributes.d.ts | 9 ++ .../JavaScriptObfuscator.spec.ts | 110 ++++++++++++++++++ .../ASTParserFacade.spec.ts | 74 ++++++++++++ yarn.lock | 13 ++- 7 files changed, 214 insertions(+), 7 deletions(-) create mode 100644 src/declarations/acorn-import-attributes.d.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e4ac0062..60ea00dd1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ Change Log +v5.4.0 +--- +* Add support for `import attributes`. Fixes https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1256 +* Replaced `mkdirp` dependency with native `fs.mkdirSync({ recursive: true })`. Fixes https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1275. Thank you https://github.com/roli-lpci! + v5.3.1 --- * Fixed class expression name references inside class body being incorrectly resolved to an import binding with the same name, causing broken code at runtime. Fixes https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1386 diff --git a/package.json b/package.json index ad496b54f..ecbf746c2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "javascript-obfuscator", - "version": "5.3.1", + "version": "5.4.0", "description": "JavaScript obfuscator", "keywords": [ "obfuscator", @@ -21,10 +21,11 @@ }, "types": "typings/index.d.ts", "dependencies": { - "@javascript-obfuscator/escodegen": "2.3.1", + "@javascript-obfuscator/escodegen": "2.4.0", "@javascript-obfuscator/estraverse": "5.4.0", "@vercel/blob": ">=0.23.0", "acorn": "8.15.0", + "acorn-import-attributes": "^1.9.5", "assert": "2.1.0", "chalk": "4.1.2", "chance": "1.1.13", diff --git a/src/ASTParserFacade.ts b/src/ASTParserFacade.ts index 8e3c27bfb..ade6007c4 100644 --- a/src/ASTParserFacade.ts +++ b/src/ASTParserFacade.ts @@ -1,6 +1,9 @@ import * as acorn from 'acorn'; import * as ESTree from 'estree'; import chalk, { Chalk } from 'chalk'; +import { importAttributesOrAssertions } from 'acorn-import-attributes'; + +const AcornParser = acorn.Parser.extend(importAttributesOrAssertions); /** * Facade over AST parser `acorn` @@ -67,7 +70,7 @@ export class ASTParserFacade { sourceType }; - const program: acorn.Node & ESTree.Program = acorn.parse(sourceCode, config); + const program: acorn.Node & ESTree.Program = AcornParser.parse(sourceCode, config); if (comments.length) { program.comments = comments; diff --git a/src/declarations/acorn-import-attributes.d.ts b/src/declarations/acorn-import-attributes.d.ts new file mode 100644 index 000000000..76ea39ab9 --- /dev/null +++ b/src/declarations/acorn-import-attributes.d.ts @@ -0,0 +1,9 @@ +declare module 'acorn-import-attributes' { + import { Parser } from 'acorn'; + + type TParserExtension = (BaseParser: typeof Parser) => typeof Parser; + + export const importAttributes: TParserExtension; + export const importAssertions: TParserExtension; + export const importAttributesOrAssertions: TParserExtension; +} diff --git a/test/functional-tests/javascript-obfuscator/JavaScriptObfuscator.spec.ts b/test/functional-tests/javascript-obfuscator/JavaScriptObfuscator.spec.ts index 4955b44d8..d347675f9 100644 --- a/test/functional-tests/javascript-obfuscator/JavaScriptObfuscator.spec.ts +++ b/test/functional-tests/javascript-obfuscator/JavaScriptObfuscator.spec.ts @@ -1478,6 +1478,116 @@ describe('JavaScriptObfuscator', () => { }); }); + describe('Import attributes', () => { + describe('Variant #1: import with "with" syntax', () => { + const importAttributesRegExp: RegExp = /from\s*'\.\/config\.json'\s*with\s*\{\s*type\s*:\s*'json'\s*\}/; + + let obfuscatedCode: string; + + before(() => { + const code: string = `import config from './config.json' with { type: 'json' };\nconsole.log(config);`; + + obfuscatedCode = JavaScriptObfuscator.obfuscate(code, { + ...NO_ADDITIONAL_NODES_PRESET + }).getObfuscatedCode(); + }); + + it('should preserve import attributes in obfuscated code', () => { + assert.match(obfuscatedCode, importAttributesRegExp); + }); + }); + + describe('Variant #2: import with multiple attributes', () => { + const importAttributesRegExp: RegExp = /from\s*'\.\/data\.json'\s*with\s*\{\s*type\s*:\s*'json'\s*,\s*integrity\s*:\s*'sha384-abc'\s*\}/; + + let obfuscatedCode: string; + + before(() => { + const code: string = `import data from './data.json' with { type: 'json', integrity: 'sha384-abc' };\nconsole.log(data);`; + + obfuscatedCode = JavaScriptObfuscator.obfuscate(code, { + ...NO_ADDITIONAL_NODES_PRESET + }).getObfuscatedCode(); + }); + + it('should preserve multiple import attributes in obfuscated code', () => { + assert.match(obfuscatedCode, importAttributesRegExp); + }); + }); + + describe('Variant #3: import with "assert" syntax (deprecated)', () => { + const importAssertionsRegExp: RegExp = /from\s*'\.\/config\.json'\s*assert\s*\{\s*type\s*:\s*'json'\s*\}/; + + let obfuscatedCode: string; + + before(() => { + const code: string = `import config from './config.json' assert { type: 'json' };\nconsole.log(config);`; + + obfuscatedCode = JavaScriptObfuscator.obfuscate(code, { + ...NO_ADDITIONAL_NODES_PRESET + }).getObfuscatedCode(); + }); + + it('should preserve import assertions in obfuscated code', () => { + assert.match(obfuscatedCode, importAssertionsRegExp); + }); + }); + + describe('Variant #4: export with "with" syntax', () => { + const exportAttributesRegExp: RegExp = /from\s*'\.\/config\.json'\s*with\s*\{\s*type\s*:\s*'json'\s*\}/; + + let obfuscatedCode: string; + + before(() => { + const code: string = `export { default as config } from './config.json' with { type: 'json' };`; + + obfuscatedCode = JavaScriptObfuscator.obfuscate(code, { + ...NO_ADDITIONAL_NODES_PRESET + }).getObfuscatedCode(); + }); + + it('should preserve export attributes in obfuscated code', () => { + assert.match(obfuscatedCode, exportAttributesRegExp); + }); + }); + + describe('Variant #5: export all with "with" syntax', () => { + const exportAllAttributesRegExp: RegExp = /export\s*\*\s*from\s*'\.\/utils\.js'\s*with\s*\{\s*type\s*:\s*'javascript'\s*\}/; + + let obfuscatedCode: string; + + before(() => { + const code: string = `export * from './utils.js' with { type: 'javascript' };`; + + obfuscatedCode = JavaScriptObfuscator.obfuscate(code, { + ...NO_ADDITIONAL_NODES_PRESET + }).getObfuscatedCode(); + }); + + it('should preserve export all attributes in obfuscated code', () => { + assert.match(obfuscatedCode, exportAllAttributesRegExp); + }); + }); + + describe('Variant #6: side-effect import with "with" syntax', () => { + const sideEffectImportRegExp: RegExp = /import\s*'\.\/styles\.css'\s*with\s*\{\s*type\s*:\s*'css'\s*\}/; + + let obfuscatedCode: string; + + before(() => { + const code: string = `import './styles.css' with { type: 'css' };`; + + obfuscatedCode = JavaScriptObfuscator.obfuscate(code, { + ...NO_ADDITIONAL_NODES_PRESET + }).getObfuscatedCode(); + }); + + it('should preserve side-effect import attributes in obfuscated code', () => { + assert.match(obfuscatedCode, sideEffectImportRegExp); + }); + }); + }); + describe('getOptionsByPreset', () => { describe('Variant #1: base behaviour', () => { const optionsPresetName: TOptionsPreset = OptionsPreset.HighObfuscation; diff --git a/test/unit-tests/javascript-obfuscator/ASTParserFacade.spec.ts b/test/unit-tests/javascript-obfuscator/ASTParserFacade.spec.ts index 2546cebea..44323483b 100644 --- a/test/unit-tests/javascript-obfuscator/ASTParserFacade.spec.ts +++ b/test/unit-tests/javascript-obfuscator/ASTParserFacade.spec.ts @@ -87,5 +87,79 @@ describe('ASTParserFacade', () => { }); }); }); + + describe('Import attributes', () => { + describe('Variant #1: import with "with" syntax', () => { + const sourceCode: string = `import config from "./config.json" with { type: "json" };`; + + let astTree: any; + + before(() => { + astTree = ASTParserFacade.parse(sourceCode, { ecmaVersion }); + }); + + it('should parse import with "with" syntax without error', () => { + assert.exists(astTree); + assert.equal(astTree.type, 'Program'); + assert.equal(astTree.body[0].type, 'ImportDeclaration'); + }); + + it('should preserve import attributes in AST', () => { + const importDecl = astTree.body[0]; + assert.exists(importDecl.attributes); + assert.isArray(importDecl.attributes); + assert.equal(importDecl.attributes.length, 1); + assert.equal(importDecl.attributes[0].key.name, 'type'); + assert.equal(importDecl.attributes[0].value.value, 'json'); + }); + }); + + describe('Variant #2: import with "assert" syntax (deprecated)', () => { + const sourceCode: string = `import config from "./config.json" assert { type: "json" };`; + + let astTree: any; + + before(() => { + astTree = ASTParserFacade.parse(sourceCode, { ecmaVersion }); + }); + + it('should parse import with "assert" syntax without error', () => { + assert.exists(astTree); + assert.equal(astTree.type, 'Program'); + assert.equal(astTree.body[0].type, 'ImportDeclaration'); + }); + }); + + describe('Variant #3: export with "with" syntax', () => { + const sourceCode: string = `export { default as config } from "./config.json" with { type: "json" };`; + + let astTree: any; + + before(() => { + astTree = ASTParserFacade.parse(sourceCode, { ecmaVersion }); + }); + + it('should parse export with "with" syntax without error', () => { + assert.exists(astTree); + assert.equal(astTree.type, 'Program'); + assert.equal(astTree.body[0].type, 'ExportNamedDeclaration'); + }); + }); + + describe('Variant #4: dynamic import with "with" syntax', () => { + const sourceCode: string = `const config = await import("./config.json", { with: { type: "json" } });`; + + let astTree: any; + + before(() => { + astTree = ASTParserFacade.parse(sourceCode, { ecmaVersion }); + }); + + it('should parse dynamic import with "with" syntax without error', () => { + assert.exists(astTree); + assert.equal(astTree.type, 'Program'); + }); + }); + }); }); }); diff --git a/yarn.lock b/yarn.lock index 79f0d7111..36a02aaed 100644 --- a/yarn.lock +++ b/yarn.lock @@ -329,10 +329,10 @@ resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.3.tgz#e45e384e4b8ec16bce2fd903af78450f6bf7ec98" integrity sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA== -"@javascript-obfuscator/escodegen@2.3.1": - version "2.3.1" - resolved "https://registry.yarnpkg.com/@javascript-obfuscator/escodegen/-/escodegen-2.3.1.tgz#a534e73740830d6c7546ca686773b40b09a6b9d1" - integrity sha512-Z0HEAVwwafOume+6LFXirAVZeuEMKWuPzpFbQhCEU9++BMz0IwEa9bmedJ+rMn/IlXRBID9j3gQ0XYAa6jM10g== +"@javascript-obfuscator/escodegen@2.4.0": + version "2.4.0" + resolved "https://registry.yarnpkg.com/@javascript-obfuscator/escodegen/-/escodegen-2.4.0.tgz#9d2b19b94793106cafa5cd5041c4e40d42943fb7" + integrity sha512-h9cJ/qb3Y3c1jMQPWypt2CGTFgP34V5OtWLqoOCjV6CT/DUXMZFpoTAfDHpuUrRP0oxNd0UwnVAsPtPuYsoXxQ== dependencies: "@javascript-obfuscator/estraverse" "^5.3.0" esprima "^4.0.1" @@ -1017,6 +1017,11 @@ abbrev@^2.0.0: resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-2.0.0.tgz#cf59829b8b4f03f89dda2771cb7f3653828c89bf" integrity sha512-6/mh1E2u2YgEsCHdY0Yx5oW+61gZU+1vXaoiHHrpKeuRNNgFvS+/jrwHiQhB5apAf5oB7UB7E19ol2R2LKH8hQ== +acorn-import-attributes@^1.9.5: + version "1.9.5" + resolved "https://registry.yarnpkg.com/acorn-import-attributes/-/acorn-import-attributes-1.9.5.tgz#7eb1557b1ba05ef18b5ed0ec67591bfab04688ef" + integrity sha512-n02Vykv5uA3eHGM/Z2dQrcD56kL8TyDb2p1+0P83PClMnC/nc+anbQRhIOWnSq4Ke/KvDPrY3C9hDtC/A3eHnQ== + acorn-import-phases@^1.0.3: version "1.0.4" resolved "https://registry.yarnpkg.com/acorn-import-phases/-/acorn-import-phases-1.0.4.tgz#16eb850ba99a056cb7cbfe872ffb8972e18c8bd7" From 1385963ecba7e276d212fb89fd1ecc70d1f457bb Mon Sep 17 00:00:00 2001 From: sanex3339 Date: Sun, 22 Mar 2026 11:59:35 +0700 Subject: [PATCH 04/24] Remove removed in Pro@6.0.0 options from README.md --- README.md | 89 ++----------------------------------------------------- 1 file changed, 2 insertions(+), 87 deletions(-) diff --git a/README.md b/README.md index fe9b9759a..d86338ae9 100644 --- a/README.md +++ b/README.md @@ -302,7 +302,6 @@ const result = await JavaScriptObfuscator.obfuscatePro( `function hello() { console.log("Hello World"); }`, { vmObfuscation: true, // Required! - vmObfuscationThreshold: 1, compact: true }, { @@ -338,8 +337,7 @@ You can specify which obfuscator version to use via the `version` option: const result = await JavaScriptObfuscator.obfuscatePro( sourceCode, { - vmObfuscation: true, - vmObfuscationThreshold: 1 + vmObfuscation: true }, { apiToken: 'your_javascript_obfuscator_pro_api_token', @@ -356,8 +354,7 @@ The API uses streaming mode to provide real-time progress updates during obfusca const result = await JavaScriptObfuscator.obfuscatePro( sourceCode, { - vmObfuscation: true, - vmObfuscationThreshold: 1 + vmObfuscation: true }, { apiToken: 'your_javascript_obfuscator_pro_api_token' @@ -1865,20 +1862,6 @@ Enables VM-based bytecode obfuscation. When enabled, JavaScript functions are co **Example:** Your readable code like `return qty * price` becomes a list of numbers like `[0x15,0x03,0x17,...]` that only the embedded VM interpreter can execute. The original logic is no longer visible as JavaScript. -### `vmObfuscationThreshold` -Type: `number` Default: `1` - -Controls what percentage of your root-level functions get VM protection. - -> **Warning:** Values other than `1` may cause runtime bugs when VM-obfuscated and non-VM-obfuscated code share top-level variables. A value of `1` is strongly recommended. For selective function obfuscation, use `vmTargetFunctionsMode: 'comment'` with the `// javascript-obfuscator:vm` directive instead. - -### `vmPreprocessIdentifiers` -Type: `boolean` Default: `true` - -Renames all non-global identifiers to unique hexadecimal names before VM obfuscation. This eliminates variable shadowing that can cause scope resolution issues in the VM bytecode. - -**When to disable:** Only disable this if you encounter specific compatibility issues. The preprocessing step ensures correct variable resolution in complex nested scopes. - ### `vmTargetFunctions` Type: `string[]` Default: `[]` @@ -1987,11 +1970,6 @@ Makes the VM interpreter smaller and unique for each build. As the result - smaller output and each build looks different. -### `vmOpcodeShuffle` -Type: `boolean` Default: `false` - -Randomizes the numeric values assigned to each opcode. For example, the `LOAD` instruction might be `1` in one build and `47` in another. - ### `vmBytecodeEncoding` Type: `boolean` Default: `false` @@ -2067,39 +2045,6 @@ Type: `boolean` Default: `false` Injects fake bytecode sequences that are never executed. These look like real instructions but are skipped during runtime, confusing analysis tools that process them. -### `vmSplitDispatcher` -Type: `boolean` Default: `false` - -Splits the VM dispatcher into multiple smaller switch statements organized by opcode category, instead of one large monolithic switch. Each category (stack, arithmetic, control flow, etc.) gets its own switch, routed by if/else range checks. - -This option supports `vmDynamicOpcodes` in both modes: `true` (shuffle first, then split into groups) and `false`. - -> :warning: When `vmIndirectDispatch` is enabled, this option is ignored. Prefer `vmIndirectDispatch` as it provides better obfuscation with similar performance. - -### `vmIndirectDispatch` -Type: `boolean` Default: `false` - -Uses compile-time generated handler functions for opcode dispatch instead of switch statements. Handlers are generated at compile-time with inlined opcode logic and shuffled positions. - -Instead of: -```javascript -switch(op) { - case 0: /* handle opcode 0 */ break; - case 1: /* handle opcode 1 */ break; -} -``` - -It generates: -```javascript -var _hm = {0:42, 1:17, ...}; // opcode → handler index mapping -var _h = [handler0, handler1, ...]; // shuffled handler array -_h[_hm[op]](arg); // single lookup + function call -``` - -This option supports `vmDynamicOpcodes` in both modes. - -> :warning: When enabled, this takes priority over `vmSplitDispatcher`. Both options cannot be active simultaneously. - ### `vmCompactDispatcher` Type: `boolean` Default: `false` @@ -2121,11 +2066,6 @@ Type: `boolean` Default: `false` Adds anti-debugging measures to the VM runtime. Detects debugger presence and alters behavior when debugging is detected. -### `vmRuntimeOpcodeDerivation` -Type: `boolean` Default: `false` - -Derives the opcode mapping table at runtime from a seed value instead of hardcoding it. The seed is stored in the bytecode and used to generate the opcode-to-handler mapping via Fisher-Yates shuffle during execution. - ### `vmStatefulOpcodes` Type: `boolean` Default: `false` @@ -2138,31 +2078,6 @@ Encrypts values on the VM stack during execution. Values are encoded when pushed This option heavily affects performance. -### `vmInstructionShuffle` -Type: `boolean` Default: `false` - -Randomizes the bytecode instruction layout per function. Each function can have a different instruction array format: -- Layout 0: `[op, arg, op, arg, ...]` (interleaved - default) -- Layout 1: `[arg, op, arg, op, ...]` (swapped interleaved) -- Layout 2: `[op0, op1, ..., arg0, arg1, ...]` (opcodes first, then arguments) -- Layout 3: `[arg0, arg1, ..., op0, op1, ...]` (arguments first, then opcodes) - -This makes pattern recognition across functions harder during analysis. - -### `vmRandomizeKeys` -Type: `boolean` Default: `false` - -Randomizes the property key names used in bytecode objects. Standard keys like `i` (instructions), `c` (constants) become random 2-character identifiers, making the bytecode structure different for each build. - -### `vmBytecodeFormat` -Type: `string` Default: `binary` - -Controls how bytecode is stored in the output. - -**Options:** -- `binary` - Compact binary format. Smaller size, recommended for production. -- `json` - Human-readable JSON format. Larger size, useful for debugging. - ### `strictMode` Type: `boolean | null` Default: `null` From 2246099bb683ac8562afa0bca0c80bca3d5b0a51 Mon Sep 17 00:00:00 2001 From: Timofey Kachalov Date: Sun, 22 Mar 2026 12:41:56 +0700 Subject: [PATCH 05/24] Fixed `reservedNames` not preserving class method and property names when `stringArray` or `deadCodeInjection` is enabled (#1389) --- CHANGELOG.md | 1 + .../ClassFieldTransformer.ts | 21 ++++++++---- .../replacer/IdentifierReplacer.ts | 33 ++++++++++--------- .../ClassFieldTransformer.spec.ts | 27 +++++++++++++++ .../fixtures/class-with-function.js | 6 ++++ .../IdentifierReplacer.spec.ts | 2 +- 6 files changed, 67 insertions(+), 23 deletions(-) create mode 100644 test/functional-tests/node-transformers/converting-transformers/class-field-transformer/fixtures/class-with-function.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 60ea00dd1..d626ae830 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ Change Log v5.4.0 --- * Add support for `import attributes`. Fixes https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1256 +* Fixed `reservedNames` not preserving class method and property names when `stringArray` or `deadCodeInjection` is enabled. Fixes https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1279 * Replaced `mkdirp` dependency with native `fs.mkdirSync({ recursive: true })`. Fixes https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1275. Thank you https://github.com/roli-lpci! v5.3.1 diff --git a/src/node-transformers/converting-transformers/ClassFieldTransformer.ts b/src/node-transformers/converting-transformers/ClassFieldTransformer.ts index f19ca4e96..6ed14af3c 100644 --- a/src/node-transformers/converting-transformers/ClassFieldTransformer.ts +++ b/src/node-transformers/converting-transformers/ClassFieldTransformer.ts @@ -12,6 +12,7 @@ import { NodeTransformationStage } from '../../enums/node-transformers/NodeTrans import { AbstractNodeTransformer } from '../AbstractNodeTransformer'; import { NodeFactory } from '../../node/NodeFactory'; import { NodeGuards } from '../../node/NodeGuards'; +import { IdentifierReplacer } from '../rename-identifiers-transformers/replacer/IdentifierReplacer'; /** * replaces: @@ -89,6 +90,18 @@ export class ClassFieldTransformer extends AbstractNodeTransformer { return classFieldNode; } + /** + * @param {string} name + * @returns {boolean} + */ + private isIgnoredName(name: string): boolean { + if (name === ClassFieldTransformer.ignoredName) { + return true; + } + + return IdentifierReplacer.isReservedName(name, this.options.reservedNames); + } + /** * @param {MethodDefinition | PropertyDefinition} classFieldNode * @param {Identifier} keyNode @@ -98,7 +111,7 @@ export class ClassFieldTransformer extends AbstractNodeTransformer { classFieldNode: ESTree.MethodDefinition | ESTree.PropertyDefinition, keyNode: ESTree.Identifier ): ESTree.MethodDefinition | ESTree.PropertyDefinition { - if (keyNode.name !== ClassFieldTransformer.ignoredName && !classFieldNode.computed) { + if (!this.isIgnoredName(keyNode.name) && !classFieldNode.computed) { classFieldNode.computed = true; classFieldNode.key = NodeFactory.literalNode(keyNode.name); } @@ -115,11 +128,7 @@ export class ClassFieldTransformer extends AbstractNodeTransformer { classFieldNode: ESTree.MethodDefinition | ESTree.PropertyDefinition, keyNode: ESTree.Literal ): ESTree.MethodDefinition | ESTree.PropertyDefinition { - if ( - typeof keyNode.value === 'string' && - keyNode.value !== ClassFieldTransformer.ignoredName && - !classFieldNode.computed - ) { + if (typeof keyNode.value === 'string' && !this.isIgnoredName(keyNode.value) && !classFieldNode.computed) { classFieldNode.computed = true; } diff --git a/src/node-transformers/rename-identifiers-transformers/replacer/IdentifierReplacer.ts b/src/node-transformers/rename-identifiers-transformers/replacer/IdentifierReplacer.ts index 8a7d70846..7c2847fa0 100644 --- a/src/node-transformers/rename-identifiers-transformers/replacer/IdentifierReplacer.ts +++ b/src/node-transformers/rename-identifiers-transformers/replacer/IdentifierReplacer.ts @@ -52,6 +52,21 @@ export class IdentifierReplacer implements IIdentifierReplacer { this.identifierNamesGenerator = identifierNamesGeneratorFactory(options); } + /** + * @param {string} name + * @param {string} reservedNames + * @returns {boolean} + */ + public static isReservedName(name: string, reservedNames: string[]): boolean { + if (!reservedNames.length) { + return false; + } + + return reservedNames.some((reservedName: string) => { + return new RegExp(reservedName, 'g').exec(name) !== null; + }); + } + /** * Store identifier node `name` of global identifiers as key in map with random name as value. * Reserved name will be ignored. @@ -62,7 +77,7 @@ export class IdentifierReplacer implements IIdentifierReplacer { public storeGlobalName(identifierNode: ESTree.Identifier, lexicalScopeNode: TNodeWithLexicalScope): void { const identifierName: string = identifierNode.name; - if (this.isReservedName(identifierName)) { + if (IdentifierReplacer.isReservedName(identifierName, this.options.reservedNames)) { return; } @@ -89,7 +104,7 @@ export class IdentifierReplacer implements IIdentifierReplacer { public storeLocalName(identifierNode: ESTree.Identifier, lexicalScopeNode: TNodeWithLexicalScope): void { const identifierName: string = identifierNode.name; - if (this.isReservedName(identifierName)) { + if (IdentifierReplacer.isReservedName(identifierName, this.options.reservedNames)) { return; } @@ -142,18 +157,4 @@ export class IdentifierReplacer implements IIdentifierReplacer { ): void { this.identifierNamesGenerator.preserveNameForLexicalScope(identifierNode.name, lexicalScopeNode); } - - /** - * @param {string} name - * @returns {boolean} - */ - private isReservedName(name: string): boolean { - if (!this.options.reservedNames.length) { - return false; - } - - return this.options.reservedNames.some((reservedName: string) => { - return new RegExp(reservedName, 'g').exec(name) !== null; - }); - } } diff --git a/test/functional-tests/node-transformers/converting-transformers/class-field-transformer/ClassFieldTransformer.spec.ts b/test/functional-tests/node-transformers/converting-transformers/class-field-transformer/ClassFieldTransformer.spec.ts index 7dae5624e..ecc0fc387 100644 --- a/test/functional-tests/node-transformers/converting-transformers/class-field-transformer/ClassFieldTransformer.spec.ts +++ b/test/functional-tests/node-transformers/converting-transformers/class-field-transformer/ClassFieldTransformer.spec.ts @@ -273,4 +273,31 @@ describe('ClassFieldTransformer', () => { }); }); }); + + describe('Variant #3: class method not obfuscated if option `reservedNames` is set', () => { + const samplesCount: number = 100; + + let obfuscations: string[]; + + beforeEach(() => { + obfuscations = []; + const code: string = readFileAsString(__dirname + '/fixtures/class-with-function.js'); + + for (let i = 0; i < samplesCount; i++) { + const obfuscatedCode: string = JavaScriptObfuscator.obfuscate(code, { + controlFlowFlattening: true, + deadCodeInjection: true, + reservedNames: ['bar'] + }).getObfuscatedCode(); + + obfuscations.push(obfuscatedCode); + } + }); + + it('class should always have `bar` method not obfuscated', () => { + for (const codeAsString of obfuscations) { + assert.match(codeAsString, /\bbar\s*\(/); + } + }); + }); }); diff --git a/test/functional-tests/node-transformers/converting-transformers/class-field-transformer/fixtures/class-with-function.js b/test/functional-tests/node-transformers/converting-transformers/class-field-transformer/fixtures/class-with-function.js new file mode 100644 index 000000000..42686f069 --- /dev/null +++ b/test/functional-tests/node-transformers/converting-transformers/class-field-transformer/fixtures/class-with-function.js @@ -0,0 +1,6 @@ +class Foo { + bar() { + console.log(1); + baz(); + } +} diff --git a/test/functional-tests/node-transformers/rename-identifiers-transformers/identifier-replacer/IdentifierReplacer.spec.ts b/test/functional-tests/node-transformers/rename-identifiers-transformers/identifier-replacer/IdentifierReplacer.spec.ts index 26da60efd..80b4308dc 100644 --- a/test/functional-tests/node-transformers/rename-identifiers-transformers/identifier-replacer/IdentifierReplacer.spec.ts +++ b/test/functional-tests/node-transformers/rename-identifiers-transformers/identifier-replacer/IdentifierReplacer.spec.ts @@ -25,7 +25,7 @@ describe('IdentifierReplacer', () => { }); }); - describe('Variant #1: ignore global reserved names', () => { + describe('Variant #2: ignore global reserved names', () => { let obfuscatedCode: string; before(() => { From 8ade200077a106981a2b98d5dd0d66cf9291a7d6 Mon Sep 17 00:00:00 2001 From: Timofey Kachalov Date: Sun, 22 Mar 2026 13:32:09 +0700 Subject: [PATCH 06/24] Remove `conf` package in favor of a custom implementation (#1391) --- CHANGELOG.md | 1 + package.json | 2 +- src/utils/AdvertisementUtils.ts | 140 ++++++------------ src/utils/Utils.ts | 7 + .../utils/AdvertisementUtils.spec.ts | 75 ++++++---- yarn.lock | 107 ++----------- 6 files changed, 112 insertions(+), 220 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d626ae830..29d164864 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ v5.4.0 * Add support for `import attributes`. Fixes https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1256 * Fixed `reservedNames` not preserving class method and property names when `stringArray` or `deadCodeInjection` is enabled. Fixes https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1279 * Replaced `mkdirp` dependency with native `fs.mkdirSync({ recursive: true })`. Fixes https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1275. Thank you https://github.com/roli-lpci! +* Replaced `conf` dependency with custom implementation using `env-paths` and native `fs` v5.3.1 --- diff --git a/package.json b/package.json index ecbf746c2..70760a6b8 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "chance": "1.1.13", "class-validator": "0.14.3", "commander": "12.1.0", - "conf": "15.0.2", + "env-paths": "4.0.0", "eslint-scope": "8.4.0", "eslint-visitor-keys": "4.2.1", "fast-deep-equal": "3.1.3", diff --git a/src/utils/AdvertisementUtils.ts b/src/utils/AdvertisementUtils.ts index f9c5c6008..992e09a0c 100644 --- a/src/utils/AdvertisementUtils.ts +++ b/src/utils/AdvertisementUtils.ts @@ -1,3 +1,10 @@ +import { Utils } from './Utils'; + +interface IConfigData { + adDisplayCount?: number; + adFirstDisplayTime?: number; +} + /** * Utility class for managing PRO advertisement display * - Limits display to first N times @@ -10,16 +17,6 @@ export class AdvertisementUtils { */ private static readonly maxDisplayCount: number = 5; - /** - * Storage key for the display count - */ - private static readonly storageKey: string = 'adDisplayCount'; - - /** - * Storage key for the timestamp of first display - */ - private static readonly timestampKey: string = 'adFirstDisplayTime'; - /** * Reset period in milliseconds (3 days) */ @@ -53,9 +50,14 @@ export class AdvertisementUtils { ]; /** - * Cached conf instance + * Config directory name for env-paths + */ + private static readonly projectName: string = 'javascript-obfuscator'; + + /** + * Cached config file path */ - private static config: any = null; + private static configPath: string | null = null; /** * Check if running in a CI environment @@ -98,36 +100,27 @@ export class AdvertisementUtils { return false; } - // Initialize config if needed - const config = this.getConfig(); - - if (!config) { - return false; - } - - // Check if reset period has passed (3 days) - const firstDisplayTime = this.getFirstDisplayTime(config); + const data = this.readConfig(); const now = Date.now(); - if (firstDisplayTime && now - firstDisplayTime >= this.resetPeriodMs) { - // Reset counter after 3 days - this.resetDisplayData(config); + // Check if reset period has passed (3 days) + if (data.adFirstDisplayTime && now - data.adFirstDisplayTime >= this.resetPeriodMs) { + data.adDisplayCount = 0; + data.adFirstDisplayTime = undefined; } - // Check display count - const count = this.getDisplayCount(config); + const count = data.adDisplayCount ?? 0; if (count >= this.maxDisplayCount) { return false; } - // Set first display time if not set - if (!firstDisplayTime || now - firstDisplayTime >= this.resetPeriodMs) { - this.setFirstDisplayTime(config, now); + if (!data.adFirstDisplayTime) { + data.adFirstDisplayTime = now; } - // Increment count for next time - this.setDisplayCount(config, count + 1); + data.adDisplayCount = count + 1; + this.writeConfig(data); return true; } @@ -140,87 +133,44 @@ export class AdvertisementUtils { } /** - * Get or create conf instance + * Get the config file path */ - private static getConfig(): any { - if (this.config) { - return this.config; + private static getConfigPath(): string { + if (!this.configPath) { + const envPaths = Utils.nodeRequire('env-paths').default; + const fs = Utils.nodeRequire('fs'); + const path = Utils.nodeRequire('path'); + const configDir: string = envPaths(this.projectName).config; + + fs.mkdirSync(configDir, { recursive: true }); + this.configPath = path.join(configDir, 'config.json'); } - if (typeof window === 'undefined') { - try { - // Dynamic import to avoid bundling in browser - // eslint-disable-next-line no-eval - const Conf = eval('require')('conf').default; - - this.config = new Conf({ - projectName: 'javascript-obfuscator' - }); - - return this.config; - } catch { - return null; - } - } - - return null; + return this.configPath!; } /** - * Get current display count from config + * Read config data from disk */ - private static getDisplayCount(config: any): number { + private static readConfig(): IConfigData { try { - const count = config.get(this.storageKey, 0); + const fs = Utils.nodeRequire('fs'); + const raw = fs.readFileSync(this.getConfigPath(), 'utf8'); - return typeof count === 'number' ? count : 0; + return JSON.parse(raw); } catch { - return 0; + return {}; } } /** - * Set display count in config + * Write config data to disk */ - private static setDisplayCount(config: any, count: number): void { + private static writeConfig(data: IConfigData): void { try { - config.set(this.storageKey, count); - } catch { - // Ignore errors - } - } - - /** - * Get first display timestamp from config - */ - private static getFirstDisplayTime(config: any): number | null { - try { - const timestamp = config.get(this.timestampKey, null); - - return typeof timestamp === 'number' ? timestamp : null; - } catch { - return null; - } - } + const fs = Utils.nodeRequire('fs'); - /** - * Set first display timestamp in config - */ - private static setFirstDisplayTime(config: any, timestamp: number): void { - try { - config.set(this.timestampKey, timestamp); - } catch { - // Ignore errors - } - } - - /** - * Reset display data (count and timestamp) - */ - private static resetDisplayData(config: any): void { - try { - config.delete(this.storageKey); - config.delete(this.timestampKey); + fs.writeFileSync(this.getConfigPath(), JSON.stringify(data)); } catch { // Ignore errors } diff --git a/src/utils/Utils.ts b/src/utils/Utils.ts index fc44fa209..9800c807a 100644 --- a/src/utils/Utils.ts +++ b/src/utils/Utils.ts @@ -9,6 +9,13 @@ export class Utils { */ public static readonly hexadecimalPrefix: string = '0x'; + /** + * Dynamic require that bypasses webpack bundling. + * Use for Node.js-only modules that should not be included in the browser build. + */ + // eslint-disable-next-line no-eval + public static readonly nodeRequire: NodeRequire = eval('require'); + /** * @param {string} version * @param {string} buildTimestamp diff --git a/test/unit-tests/utils/AdvertisementUtils.spec.ts b/test/unit-tests/utils/AdvertisementUtils.spec.ts index b110e2f19..079b1b764 100644 --- a/test/unit-tests/utils/AdvertisementUtils.spec.ts +++ b/test/unit-tests/utils/AdvertisementUtils.spec.ts @@ -1,8 +1,37 @@ +import * as fs from 'fs'; +import * as path from 'path'; + import { assert } from 'chai'; import { AdvertisementUtils } from '../../../src/utils/AdvertisementUtils'; +import { Utils } from '../../../src/utils/Utils'; + +const envPaths = Utils.nodeRequire('env-paths').default; describe('AdvertisementUtils', () => { + const configPath = path.join(envPaths('javascript-obfuscator').config, 'config.json'); + + function readConfig(): any { + try { + return JSON.parse(fs.readFileSync(configPath, 'utf8')); + } catch { + return {}; + } + } + + function writeConfig(data: any): void { + fs.mkdirSync(path.dirname(configPath), { recursive: true }); + fs.writeFileSync(configPath, JSON.stringify(data)); + } + + function deleteConfig(): void { + try { + fs.unlinkSync(configPath); + } catch { + // Ignore + } + } + describe('isCI', () => { const originalEnv = { ...process.env }; @@ -105,22 +134,10 @@ describe('AdvertisementUtils', () => { }); describe('Variant #3: display counter and reset', () => { - let config: any; - - before(() => { - // Get config instance using eval('require') - same as AdvertisementUtils - // conf is an ES Module, so we need to access .default - // eslint-disable-next-line no-eval - const Conf = eval('require')('conf').default; - config = new Conf({ projectName: 'javascript-obfuscator' }); - }); - beforeEach(() => { - // Clear ad-related config before each test - config.delete('adDisplayCount'); - config.delete('adFirstDisplayTime'); - // Reset cached config in AdvertisementUtils - (AdvertisementUtils as any).config = null; + deleteConfig(); + // Reset cached config path + (AdvertisementUtils as any).configPath = null; // Ensure TTY and non-CI environment process.stdout.isTTY = true; delete process.env.CI; @@ -130,10 +147,8 @@ describe('AdvertisementUtils', () => { }); afterEach(() => { - // Clean up - config.delete('adDisplayCount'); - config.delete('adFirstDisplayTime'); - (AdvertisementUtils as any).config = null; + deleteConfig(); + (AdvertisementUtils as any).configPath = null; }); it('should return true for first 5 calls', () => { @@ -154,13 +169,13 @@ describe('AdvertisementUtils', () => { it('should increment counter on each call', () => { AdvertisementUtils.shouldShowAdvertisement(); - assert.strictEqual(config.get('adDisplayCount'), 1); + assert.strictEqual(readConfig().adDisplayCount, 1); AdvertisementUtils.shouldShowAdvertisement(); - assert.strictEqual(config.get('adDisplayCount'), 2); + assert.strictEqual(readConfig().adDisplayCount, 2); AdvertisementUtils.shouldShowAdvertisement(); - assert.strictEqual(config.get('adDisplayCount'), 3); + assert.strictEqual(readConfig().adDisplayCount, 3); }); it('should set first display timestamp on first call', () => { @@ -168,7 +183,7 @@ describe('AdvertisementUtils', () => { AdvertisementUtils.shouldShowAdvertisement(); const afterTime = Date.now(); - const timestamp = config.get('adFirstDisplayTime'); + const timestamp = readConfig().adFirstDisplayTime; assert.isNumber(timestamp); assert.isAtLeast(timestamp, beforeTime); assert.isAtMost(timestamp, afterTime); @@ -183,14 +198,14 @@ describe('AdvertisementUtils', () => { // Simulate 3 days passing by setting old timestamp const threeDaysAgo = Date.now() - 3 * 24 * 60 * 60 * 1000 - 1000; - config.set('adFirstDisplayTime', threeDaysAgo); - // Reset cached config - (AdvertisementUtils as any).config = null; + const data = readConfig(); + data.adFirstDisplayTime = threeDaysAgo; + writeConfig(data); // Should return true again after reset assert.isTrue(AdvertisementUtils.shouldShowAdvertisement()); // Counter should be reset to 1 - assert.strictEqual(config.get('adDisplayCount'), 1); + assert.strictEqual(readConfig().adDisplayCount, 1); }); it('should not reset counter before 3 days', () => { @@ -201,9 +216,9 @@ describe('AdvertisementUtils', () => { // Simulate 2 days passing (less than 3 days) const twoDaysAgo = Date.now() - 2 * 24 * 60 * 60 * 1000; - config.set('adFirstDisplayTime', twoDaysAgo); - // Reset cached config - (AdvertisementUtils as any).config = null; + const data = readConfig(); + data.adFirstDisplayTime = twoDaysAgo; + writeConfig(data); // Should still return false assert.isFalse(AdvertisementUtils.shouldShowAdvertisement()); diff --git a/yarn.lock b/yarn.lock index 36a02aaed..45b47f685 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1062,13 +1062,6 @@ ajv-formats@^2.1.1: dependencies: ajv "^8.0.0" -ajv-formats@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/ajv-formats/-/ajv-formats-3.0.1.tgz#3d5dc762bca17679c3c2ea7e90ad6b7532309578" - integrity sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ== - dependencies: - ajv "^8.0.0" - ajv-keywords@^3.5.2: version "3.5.2" resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.5.2.tgz#31f29da5ab6e00d1c2d329acf7b5929614d5014d" @@ -1101,7 +1094,7 @@ ajv@^8.0.0: require-from-string "^2.0.2" uri-js "^4.2.2" -ajv@^8.17.1, ajv@^8.9.0: +ajv@^8.9.0: version "8.17.1" resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.17.1.tgz#37d9a5c776af6bc92d7f4f9510eba4c0a60d11a6" integrity sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g== @@ -1296,14 +1289,6 @@ atob@^2.1.2: resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg== -atomically@^2.0.3: - version "2.1.0" - resolved "https://registry.yarnpkg.com/atomically/-/atomically-2.1.0.tgz#5a3ce8ea5ab57b65df589a3b63ef7b753cc0af07" - integrity sha512-+gDffFXRW6sl/HCwbta7zK4uNqbPjv4YJEAdz7Vu+FLQHe77eZ4bvbJGi4hE0QPeJlMYMA3piXEr1UL3dAwx7Q== - dependencies: - stubborn-fs "^2.0.0" - when-exit "^2.1.4" - available-typed-arrays@^1.0.0, available-typed-arrays@^1.0.2: version "1.0.2" resolved "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.2.tgz" @@ -1653,21 +1638,6 @@ concat-map@0.0.1: resolved "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz" integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= -conf@15.0.2: - version "15.0.2" - resolved "https://registry.yarnpkg.com/conf/-/conf-15.0.2.tgz#b983be81227a304b9f885fde6c86c7fe5902dc9d" - integrity sha512-JBSrutapCafTrddF9dH3lc7+T2tBycGF4uPkI4Js+g4vLLEhG6RZcFi3aJd5zntdf5tQxAejJt8dihkoQ/eSJw== - dependencies: - ajv "^8.17.1" - ajv-formats "^3.0.1" - atomically "^2.0.3" - debounce-fn "^6.0.0" - dot-prop "^10.0.0" - env-paths "^3.0.0" - json-schema-typed "^8.0.1" - semver "^7.7.2" - uint8array-extras "^1.5.0" - config-chain@^1.1.13: version "1.1.13" resolved "https://registry.yarnpkg.com/config-chain/-/config-chain-1.1.13.tgz#fad0795aa6a6cdaff9ed1b68e9dff94372c232f4" @@ -1786,13 +1756,6 @@ data-view-byte-offset@^1.0.1: es-errors "^1.3.0" is-data-view "^1.0.1" -debounce-fn@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/debounce-fn/-/debounce-fn-6.0.0.tgz#558169aed853eb3cf3a17c0a2438e1a91a7ba44f" - integrity sha512-rBMW+F2TXryBwB54Q0d8drNEI+TfoS9JpNTAoVpukbWEhjXQq4rySFYLaqXMFXwdv61Zb2OHtj5bviSoimqxRQ== - dependencies: - mimic-function "^5.0.0" - debug@^3.2.7: version "3.2.7" resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.7.tgz#72580b7e9145fb39b6676f9c5e5fb100b934179a" @@ -1938,13 +1901,6 @@ doctrine@^3.0.0: dependencies: esutils "^2.0.2" -dot-prop@^10.0.0: - version "10.1.0" - resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-10.1.0.tgz#91dbeb6771a9d2c31eab11ade3fdb1d83c4376c4" - integrity sha512-MVUtAugQMOff5RnBy2d9N31iG0lNwg1qAoAOn7pOK5wf94WIaE3My2p3uwTQuvS2AcqchkcR3bHByjaM0mmi7Q== - dependencies: - type-fest "^5.0.0" - dunder-proto@^1.0.0, dunder-proto@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/dunder-proto/-/dunder-proto-1.0.1.tgz#d7ae667e1dc83482f8b70fd0f6eefc50da30f58a" @@ -2000,10 +1956,12 @@ enhanced-resolve@^5.17.3: graceful-fs "^4.2.4" tapable "^2.2.0" -env-paths@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/env-paths/-/env-paths-3.0.0.tgz#2f1e89c2f6dbd3408e1b1711dd82d62e317f58da" - integrity sha512-dtJUTepzMW3Lm/NPxRf3wP4642UWhjL2sQxc+ym2YMj1m/H2zDNQOlezafzkHwn6sMstjHTwG6iQQsctDW/b1A== +env-paths@4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/env-paths/-/env-paths-4.0.0.tgz#d0bb1f84a81d2542581bf7b7e8085d0683b39097" + integrity sha512-pxP8eL2SwwaTRi/KHYwLYXinDs7gL3jxFcBYmEdYfZmZXbaVDvdppd0XBU8qVz03rDfKZMXg1omHCbsJjZrMsw== + dependencies: + is-safe-filename "^0.1.0" envinfo@^7.14.0: version "7.19.0" @@ -3339,6 +3297,11 @@ is-regex@^1.2.1: has-tostringtag "^1.0.2" hasown "^2.0.2" +is-safe-filename@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/is-safe-filename/-/is-safe-filename-0.1.1.tgz#fb22eead097c614c47aa674de5d79a1648a53e66" + integrity sha512-4SrR7AdnY11LHfDKTZY1u6Ga3RuxZdl3YKWWShO5iyuG5h8QS4GD2tOb04peBJ5I7pXbR+CGBNEhTcwK+FzN3g== + is-set@^2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/is-set/-/is-set-2.0.3.tgz#8ab209ea424608141372ded6e0cb200ef1d9d01d" @@ -3651,11 +3614,6 @@ json-schema-traverse@^1.0.0: resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz#ae7bcb3656ab77a73ba5c49bf654f38e6b6860e2" integrity sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug== -json-schema-typed@^8.0.1: - version "8.0.2" - resolved "https://registry.yarnpkg.com/json-schema-typed/-/json-schema-typed-8.0.2.tgz#e98ee7b1899ff4a184534d1f167c288c66bbeff4" - integrity sha512-fQhoXdcvc3V28x7C7BMs4P5+kNlgUURe2jmUT1T//oBRMDrqy1QPelJimwZGo7Hg9VPV3EQV5Bnq4hbFy2vetA== - json-stable-stringify-without-jsonify@^1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz" @@ -3857,11 +3815,6 @@ mime-types@^2.1.27: dependencies: mime-db "1.44.0" -mimic-function@^5.0.0: - version "5.0.1" - resolved "https://registry.yarnpkg.com/mimic-function/-/mimic-function-5.0.1.tgz#acbe2b3349f99b9deaca7fb70e48b83e94e67076" - integrity sha512-VP79XUPxV2CigYP3jWwAUFSku2aKqBH7uTAapFWCBqutsbmDo96KY5o8uh6U+/YSIn5OxJnXp73beVkpqMIGhA== - min-indent@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/min-indent/-/min-indent-1.0.1.tgz#a63f681673b30571fbe8bc25686ae746eefa9869" @@ -4714,7 +4667,7 @@ semver@^7.3.5: dependencies: lru-cache "^6.0.0" -semver@^7.5.3, semver@^7.5.4, semver@^7.6.0, semver@^7.6.3, semver@^7.7.2: +semver@^7.5.3, semver@^7.5.4, semver@^7.6.0, semver@^7.6.3: version "7.7.3" resolved "https://registry.yarnpkg.com/semver/-/semver-7.7.3.tgz#4b5f4143d007633a8dc671cd0a6ef9147b8bb946" integrity sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q== @@ -5098,18 +5051,6 @@ strip-json-comments@^3.1.1: resolved "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz" integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== -stubborn-fs@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/stubborn-fs/-/stubborn-fs-2.0.0.tgz#628750f81c51c44c04ef50fc70ed4d1caea4f1e9" - integrity sha512-Y0AvSwDw8y+nlSNFXMm2g6L51rBGdAQT20J3YSOqxC53Lo3bjWRtr2BKcfYoAf352WYpsZSTURrA0tqhfgudPA== - dependencies: - stubborn-utils "^1.0.1" - -stubborn-utils@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/stubborn-utils/-/stubborn-utils-1.0.2.tgz#0d9c58ab550f40936235056c7ea6febd925c4d41" - integrity sha512-zOh9jPYI+xrNOyisSelgym4tolKTJCQd5GBhK0+0xJvcYDcwlOoxF/rnFKQ2KRZknXSG9jWAp66fwP6AxN9STg== - supports-color@^5.3.0: version "5.5.0" resolved "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz" @@ -5158,11 +5099,6 @@ synckit@^0.9.1: "@pkgr/core" "^0.1.0" tslib "^2.6.2" -tagged-tag@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/tagged-tag/-/tagged-tag-1.0.0.tgz#a0b5917c2864cba54841495abfa3f6b13edcf4d6" - integrity sha512-yEFYrVhod+hdNyx7g5Bnkkb0G6si8HJurOoOEgC8B/O0uXLHlaey/65KRv6cuWBNhBgHKAROVpc7QyYqE5gFng== - tapable@^2.2.0: version "2.2.0" resolved "https://registry.npmjs.org/tapable/-/tapable-2.2.0.tgz" @@ -5338,13 +5274,6 @@ type-fest@^0.8.0, type-fest@^0.8.1: resolved "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz" integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA== -type-fest@^5.0.0: - version "5.3.0" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-5.3.0.tgz#9422125b3094b1087d8446ba151b72fb9f39411a" - integrity sha512-d9CwU93nN0IA1QL+GSNDdwLAu1Ew5ZjTwupvedwg3WdfoH6pIDvYQ2hV0Uc2nKBLPq7NB5apCx57MLS5qlmO5g== - dependencies: - tagged-tag "^1.0.0" - typed-array-buffer@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/typed-array-buffer/-/typed-array-buffer-1.0.3.tgz#a72395450a4869ec033fd549371b47af3a2ee536" @@ -5402,11 +5331,6 @@ typescript@5.9.3: resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.9.3.tgz#5b4f59e15310ab17a216f5d6cf53ee476ede670f" integrity sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw== -uint8array-extras@^1.5.0: - version "1.5.0" - resolved "https://registry.yarnpkg.com/uint8array-extras/-/uint8array-extras-1.5.0.tgz#10d2a85213de3ada304fea1c454f635c73839e86" - integrity sha512-rvKSBiC5zqCCiDZ9kAOszZcDvdAHwwIKJG33Ykj43OKcWsnmcBRL09YTU4nOeHZ8Y2a7l1MgTd08SBe9A8Qj6A== - unbox-primitive@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/unbox-primitive/-/unbox-primitive-1.1.0.tgz#8d9d2c9edeea8460c7f35033a88867944934d1e2" @@ -5568,11 +5492,6 @@ webpack@5.102.1: watchpack "^2.4.4" webpack-sources "^3.3.3" -when-exit@^2.1.4: - version "2.1.5" - resolved "https://registry.yarnpkg.com/when-exit/-/when-exit-2.1.5.tgz#53fa4ffa2ba4c792213fb6617eb7d08f0dcb1a9f" - integrity sha512-VGkKJ564kzt6Ms1dbgPP/yuIoQCrsFAnRbptpC5wOEsDaNsbCB2bnfnaA8i/vRs5tjUSEOtIuvl9/MyVsvQZCg== - which-boxed-primitive@^1.1.0, which-boxed-primitive@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/which-boxed-primitive/-/which-boxed-primitive-1.1.1.tgz#d76ec27df7fa165f18d5808374a5fe23c29b176e" From bac513e73d4729eef344f36bfea0dd79ba98b781 Mon Sep 17 00:00:00 2001 From: Timofey Kachalov Date: Sun, 22 Mar 2026 14:14:07 +0700 Subject: [PATCH 07/24] Fix `transformObjectKeys` to preserve evaluation order in sequence expressions with side effects (#1392) --- CHANGELOG.md | 1 + .../ObjectExpressionKeysTransformer.ts | 83 +++++++++++++++---- .../ObjectExpressionKeysTransformer.spec.ts | 62 +++++++++++++- ...xpression-nested-assignment-side-effect.js | 9 ++ ...atement-sequence-expression-side-effect.js | 9 ++ 5 files changed, 146 insertions(+), 18 deletions(-) create mode 100644 test/functional-tests/node-transformers/converting-transformers/object-expression-keys-transformer/fixtures/return-statement-sequence-expression-nested-assignment-side-effect.js create mode 100644 test/functional-tests/node-transformers/converting-transformers/object-expression-keys-transformer/fixtures/return-statement-sequence-expression-side-effect.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 29d164864..a2442c85d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ v5.4.0 --- * Add support for `import attributes`. Fixes https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1256 * Fixed `reservedNames` not preserving class method and property names when `stringArray` or `deadCodeInjection` is enabled. Fixes https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1279 +* Fixed `transformObjectKeys` changing evaluation order when object expression is inside a sequence expression with preceding side effects (e.g. `return aux(ys), { min }`). Fixes https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1246 * Replaced `mkdirp` dependency with native `fs.mkdirSync({ recursive: true })`. Fixes https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1275. Thank you https://github.com/roli-lpci! * Replaced `conf` dependency with custom implementation using `env-paths` and native `fs` diff --git a/src/node-transformers/converting-transformers/ObjectExpressionKeysTransformer.ts b/src/node-transformers/converting-transformers/ObjectExpressionKeysTransformer.ts index 05bc0af6c..9918d1d23 100644 --- a/src/node-transformers/converting-transformers/ObjectExpressionKeysTransformer.ts +++ b/src/node-transformers/converting-transformers/ObjectExpressionKeysTransformer.ts @@ -124,10 +124,7 @@ export class ObjectExpressionKeysTransformer extends AbstractNodeTransformer { objectExpressionNode, objectExpressionParentNode ) || - ObjectExpressionKeysTransformer.isProhibitedSequenceExpression( - objectExpressionNode, - objectExpressionHostStatement - ) || + ObjectExpressionKeysTransformer.isProhibitedSequenceExpression(objectExpressionNode) || ObjectExpressionKeysTransformer.isProhibitedLoopBody(objectExpressionNode) ) { return true; @@ -191,21 +188,73 @@ export class ObjectExpressionKeysTransformer extends AbstractNodeTransformer { /** * @param {ObjectExpression} objectExpressionNode - * @param {Node} objectExpressionHostNode * @returns {boolean} */ - private static isProhibitedSequenceExpression( - objectExpressionNode: ESTree.ObjectExpression, - objectExpressionHostNode: ESTree.Node - ): boolean { - return ( - NodeGuards.isExpressionStatementNode(objectExpressionHostNode) && - NodeGuards.isSequenceExpressionNode(objectExpressionHostNode.expression) && - objectExpressionHostNode.expression.expressions.some( - (expressionNode: ESTree.Expression) => - NodeGuards.isCallExpressionNode(expressionNode) && NodeGuards.isSuperNode(expressionNode.callee) - ) - ); + private static isProhibitedSequenceExpression(objectExpressionNode: ESTree.ObjectExpression): boolean { + const parentNode: ESTree.Node | undefined = objectExpressionNode.parentNode; + + if (!parentNode) { + return false; + } + + // Case 1: object is a direct child of a sequence expression + // e.g. `return aux(ys), { min }` + if (NodeGuards.isSequenceExpressionNode(parentNode)) { + const index: number = parentNode.expressions.indexOf(objectExpressionNode); + + return index > 0; + } + + // Case 2: object is nested inside a sequence expression via assignment/etc + // e.g. `super(), this.state = { foo: 1 }` + // Walk up to find if we're inside a sequence expression at a non-first position + let currentNode: ESTree.Node = parentNode; + + while (currentNode.parentNode) { + const currentParent: ESTree.Node = currentNode.parentNode; + + if (NodeGuards.isSequenceExpressionNode(currentParent)) { + const index: number = currentParent.expressions.indexOf(currentNode); + + if (index > 0) { + // Only prohibit if earlier expressions contain calls (side effects) + return currentParent.expressions.slice(0, index).some( + (expr: ESTree.Expression) => { + let hasCall: boolean = false; + + estraverse.traverse(expr, { + enter: (node: ESTree.Node) => { + if ( + NodeGuards.isCallExpressionNode(node) || + NodeGuards.isNewExpressionNode(node) + ) { + hasCall = true; + + return estraverse.VisitorOption.Break; + } + } + }); + + return hasCall; + } + ); + } + + return false; + } + + if ( + NodeGuards.isFunctionNode(currentParent) || + NodeGuards.isProgramNode(currentParent) || + NodeGuards.isBlockStatementNode(currentParent) + ) { + break; + } + + currentNode = currentParent; + } + + return false; } /** diff --git a/test/functional-tests/node-transformers/converting-transformers/object-expression-keys-transformer/ObjectExpressionKeysTransformer.spec.ts b/test/functional-tests/node-transformers/converting-transformers/object-expression-keys-transformer/ObjectExpressionKeysTransformer.spec.ts index 41b4e9eb9..da3408845 100644 --- a/test/functional-tests/node-transformers/converting-transformers/object-expression-keys-transformer/ObjectExpressionKeysTransformer.spec.ts +++ b/test/functional-tests/node-transformers/converting-transformers/object-expression-keys-transformer/ObjectExpressionKeysTransformer.spec.ts @@ -2100,7 +2100,67 @@ describe('ObjectExpressionKeysTransformer', () => { }); }); - describe('Variant #16: conditional expression `this` reference', () => { + describe('Variant #16: return statement sequence expression with side effects', () => { + let testFunc: () => void; + + before(() => { + const code: string = readFileAsString( + __dirname + '/fixtures/return-statement-sequence-expression-side-effect.js' + ); + + testFunc = () => { + const obfuscatedCode: string = JavaScriptObfuscator.obfuscate(code, { + ...NO_ADDITIONAL_NODES_PRESET, + transformObjectKeys: true + }).getObfuscatedCode(); + + const result = eval(`${obfuscatedCode} compErr(5);`); + + if (result.min !== 5) { + throw new Error( + `Expected min to be 5, got ${result.min}. ` + + `Object extraction changed evaluation order in sequence expression.` + ); + } + }; + }); + + it('should not change evaluation order when extracting object keys from sequence expression', () => { + assert.doesNotThrow(testFunc); + }); + }); + + describe('Variant #17: return statement sequence expression with nested assignment and side effects', () => { + let testFunc: () => void; + + before(() => { + const code: string = readFileAsString( + __dirname + '/fixtures/return-statement-sequence-expression-nested-assignment-side-effect.js' + ); + + testFunc = () => { + const obfuscatedCode: string = JavaScriptObfuscator.obfuscate(code, { + ...NO_ADDITIONAL_NODES_PRESET, + transformObjectKeys: true + }).getObfuscatedCode(); + + const result = eval(`${obfuscatedCode} test();`); + + if (result.foo !== 42) { + throw new Error( + `Expected foo to be 42, got ${result.foo}. ` + + `Object extraction changed evaluation order in nested sequence expression.` + ); + } + }; + }); + + it('should not change evaluation order when extracting object keys from nested assignment in sequence expression', () => { + assert.doesNotThrow(testFunc); + }); + }); + + describe('Variant #18: conditional expression `this` reference', () => { describe('Variant #1: conditional expression identifier reference', () => { const match: string = `` + diff --git a/test/functional-tests/node-transformers/converting-transformers/object-expression-keys-transformer/fixtures/return-statement-sequence-expression-nested-assignment-side-effect.js b/test/functional-tests/node-transformers/converting-transformers/object-expression-keys-transformer/fixtures/return-statement-sequence-expression-nested-assignment-side-effect.js new file mode 100644 index 000000000..d0e1892c5 --- /dev/null +++ b/test/functional-tests/node-transformers/converting-transformers/object-expression-keys-transformer/fixtures/return-statement-sequence-expression-nested-assignment-side-effect.js @@ -0,0 +1,9 @@ +function test() { + let x, y, val = 0; + + function sideEffect() { + val = 42; + } + + return (sideEffect(), x = (y = { foo: val })); +} diff --git a/test/functional-tests/node-transformers/converting-transformers/object-expression-keys-transformer/fixtures/return-statement-sequence-expression-side-effect.js b/test/functional-tests/node-transformers/converting-transformers/object-expression-keys-transformer/fixtures/return-statement-sequence-expression-side-effect.js new file mode 100644 index 000000000..279259a6e --- /dev/null +++ b/test/functional-tests/node-transformers/converting-transformers/object-expression-keys-transformer/fixtures/return-statement-sequence-expression-side-effect.js @@ -0,0 +1,9 @@ +function compErr(ys) { + let min = Infinity; + + function aux(y) { + if (y < min) min = y; + } + + return (aux(ys), { min }); +} From e1d9435468b750de5723b5b10ae3bcf98b925472 Mon Sep 17 00:00:00 2001 From: Timofey Kachalov Date: Sun, 22 Mar 2026 14:22:58 +0700 Subject: [PATCH 08/24] Fixed infinite loop / stack overflow when `reservedNames` patterns match all generated identifier names (#1390) --- CHANGELOG.md | 1 + .../AbstractIdentifierNamesGenerator.ts | 18 ++++++++++++++ .../HexadecimalIdentifierNamesGenerator.ts | 24 +++++++++++++------ .../MangledIdentifierNamesGenerator.ts | 16 ++++++++++++- .../MangledIdentifierNamesGenerator.spec.ts | 19 +++++++++++++++ .../fixtures/reserved-names-match-all.js | 1 + ...exadecimalIdentifierNamesGenerator.spec.ts | 22 +++++++++++++++++ ...dShuffledlIdentifierNamesGenerator.spec.ts | 22 +++++++++++++++++ .../MangledlIdentifierNamesGenerator.spec.ts | 22 +++++++++++++++++ 9 files changed, 137 insertions(+), 8 deletions(-) create mode 100644 test/functional-tests/generators/identifier-names-generators/mangled-identifier-names-generator/fixtures/reserved-names-match-all.js diff --git a/CHANGELOG.md b/CHANGELOG.md index a2442c85d..7133fa025 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ v5.4.0 --- * Add support for `import attributes`. Fixes https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1256 * Fixed `reservedNames` not preserving class method and property names when `stringArray` or `deadCodeInjection` is enabled. Fixes https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1279 +* Fixed infinite loop / stack overflow when `reservedNames` patterns match all generated identifier names. Now throws a descriptive error instead. Fixes https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1382 * Fixed `transformObjectKeys` changing evaluation order when object expression is inside a sequence expression with preceding side effects (e.g. `return aux(ys), { min }`). Fixes https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1246 * Replaced `mkdirp` dependency with native `fs.mkdirSync({ recursive: true })`. Fixes https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1275. Thank you https://github.com/roli-lpci! * Replaced `conf` dependency with custom implementation using `env-paths` and native `fs` diff --git a/src/generators/identifier-names-generators/AbstractIdentifierNamesGenerator.ts b/src/generators/identifier-names-generators/AbstractIdentifierNamesGenerator.ts index a9655ad1f..329b7f414 100644 --- a/src/generators/identifier-names-generators/AbstractIdentifierNamesGenerator.ts +++ b/src/generators/identifier-names-generators/AbstractIdentifierNamesGenerator.ts @@ -11,6 +11,11 @@ import { NodeGuards } from '../../node/NodeGuards'; @injectable() export abstract class AbstractIdentifierNamesGenerator implements IIdentifierNamesGenerator { + /** + * @type {number} + */ + private static readonly maxGenerationAttempts: number = 10000; + /** * @type {IOptions} */ @@ -132,6 +137,19 @@ export abstract class AbstractIdentifierNamesGenerator implements IIdentifierNam return !this.allLexicalScopePreservedNames.has(name); } + /** + * @param {number} attempts + */ + protected checkGenerationAttempts(attempts: number): void { + if (attempts > AbstractIdentifierNamesGenerator.maxGenerationAttempts) { + throw new Error( + 'Unable to generate a valid identifier name. ' + + 'This is likely caused by `reservedNames` patterns that match all generated names. ' + + 'Please check your `reservedNames` option.' + ); + } + } + /** * @param {string} name * @returns {boolean} diff --git a/src/generators/identifier-names-generators/HexadecimalIdentifierNamesGenerator.ts b/src/generators/identifier-names-generators/HexadecimalIdentifierNamesGenerator.ts index 59df523e5..97020c724 100644 --- a/src/generators/identifier-names-generators/HexadecimalIdentifierNamesGenerator.ts +++ b/src/generators/identifier-names-generators/HexadecimalIdentifierNamesGenerator.ts @@ -87,21 +87,31 @@ export class HexadecimalIdentifierNamesGenerator extends AbstractIdentifierNames /** * @param {number} nameLength * @param {(name: string) => boolean} validationFn + * @param {number} attempts * @returns {string} */ - private generateNextName(nameLength: number | undefined, validationFn: (name: string) => boolean): string { + private generateNextName( + nameLength: number | undefined, + validationFn: (name: string) => boolean + ): string { const rangeMinInteger: number = 10000; const rangeMaxInteger: number = 99_999_999; - const randomInteger: number = this.randomGenerator.getRandomInteger(rangeMinInteger, rangeMaxInteger); - const hexadecimalNumber: string = NumberUtils.toHex(randomInteger); const prefixLength: number = Utils.hexadecimalPrefix.length; const baseNameLength: number = (nameLength ?? HexadecimalIdentifierNamesGenerator.baseIdentifierNameLength) + prefixLength; - const baseIdentifierName: string = hexadecimalNumber.slice(0, baseNameLength); - const identifierName: string = `_${baseIdentifierName}`; - if (!validationFn(identifierName)) { - return this.generateNextName(nameLength, validationFn); + let identifierName: string = ''; + let isValid: boolean = false; + + for (let attempts: number = 0; !isValid; attempts++) { + this.checkGenerationAttempts(attempts); + + const randomInteger: number = this.randomGenerator.getRandomInteger(rangeMinInteger, rangeMaxInteger); + const hexadecimalNumber: string = NumberUtils.toHex(randomInteger); + const baseIdentifierName: string = hexadecimalNumber.slice(0, baseNameLength); + + identifierName = `_${baseIdentifierName}`; + isValid = validationFn(identifierName); } this.preserveName(identifierName); diff --git a/src/generators/identifier-names-generators/MangledIdentifierNamesGenerator.ts b/src/generators/identifier-names-generators/MangledIdentifierNamesGenerator.ts index 96d6c3371..f76c71c97 100644 --- a/src/generators/identifier-names-generators/MangledIdentifierNamesGenerator.ts +++ b/src/generators/identifier-names-generators/MangledIdentifierNamesGenerator.ts @@ -282,11 +282,25 @@ export class MangledIdentifierNamesGenerator extends AbstractIdentifierNamesGene }; let identifierName: string = previousMangledName; - let isValidIdentifierName: boolean; + let isValidIdentifierName: boolean = false; + let reservedNameAttempts: number = 0; do { identifierName = generateNewMangledName(identifierName); + + if ( + this.preservedNamesSet.has(identifierName) || + MangledIdentifierNamesGenerator.reservedNamesSet.has(identifierName) + ) { + continue; + } + isValidIdentifierName = validationFunction?.(identifierName) ?? this.isValidIdentifierName(identifierName); + + if (!isValidIdentifierName) { + this.checkGenerationAttempts(reservedNameAttempts); + reservedNameAttempts++; + } } while (!isValidIdentifierName); return identifierName; diff --git a/test/functional-tests/generators/identifier-names-generators/mangled-identifier-names-generator/MangledIdentifierNamesGenerator.spec.ts b/test/functional-tests/generators/identifier-names-generators/mangled-identifier-names-generator/MangledIdentifierNamesGenerator.spec.ts index 1dc01f542..28a927821 100644 --- a/test/functional-tests/generators/identifier-names-generators/mangled-identifier-names-generator/MangledIdentifierNamesGenerator.spec.ts +++ b/test/functional-tests/generators/identifier-names-generators/mangled-identifier-names-generator/MangledIdentifierNamesGenerator.spec.ts @@ -368,4 +368,23 @@ describe('MangledIdentifierNamesGenerator', () => { }); }); }); + + describe('`reservedNames` that match all generated names', () => { + let testFunc: () => void; + + before(() => { + const code: string = readFileAsString(__dirname + '/fixtures/reserved-names-match-all.js'); + + testFunc = () => + JavaScriptObfuscator.obfuscate(code, { + ...NO_ADDITIONAL_NODES_PRESET, + identifierNamesGenerator: IdentifierNamesGenerator.MangledIdentifierNamesGenerator, + reservedNames: ['^(?!renameMeOnly$)'] + }); + }); + + it('should throw an error when all generated names match reservedNames', () => { + assert.throws(testFunc, 'Unable to generate a valid identifier name'); + }); + }); }); diff --git a/test/functional-tests/generators/identifier-names-generators/mangled-identifier-names-generator/fixtures/reserved-names-match-all.js b/test/functional-tests/generators/identifier-names-generators/mangled-identifier-names-generator/fixtures/reserved-names-match-all.js new file mode 100644 index 000000000..2ab5e9368 --- /dev/null +++ b/test/functional-tests/generators/identifier-names-generators/mangled-identifier-names-generator/fixtures/reserved-names-match-all.js @@ -0,0 +1 @@ +(function(){function pleasedontrename (){}; function renameMeOnly(){}}) diff --git a/test/unit-tests/generators/identifier-names-generators/HexadecimalIdentifierNamesGenerator.spec.ts b/test/unit-tests/generators/identifier-names-generators/HexadecimalIdentifierNamesGenerator.spec.ts index 190edad8c..2fb8c7d8d 100644 --- a/test/unit-tests/generators/identifier-names-generators/HexadecimalIdentifierNamesGenerator.spec.ts +++ b/test/unit-tests/generators/identifier-names-generators/HexadecimalIdentifierNamesGenerator.spec.ts @@ -121,4 +121,26 @@ describe('HexadecimalIdentifierNamesGenerator', () => { assert.notEqual(hexadecimalIdentifierName1, hexadecimalIdentifierName2); }); }); + + describe('`reservedNames` that match all generated names', () => { + let testFunc: () => void; + + before(() => { + const inversifyContainerFacade: IInversifyContainerFacade = new InversifyContainerFacade(); + + inversifyContainerFacade.load('', '', { + reservedNames: ['^(?!renameMeOnly$)'] + }); + const identifierNamesGenerator = inversifyContainerFacade.getNamed( + ServiceIdentifiers.IIdentifierNamesGenerator, + IdentifierNamesGenerator.HexadecimalIdentifierNamesGenerator + ); + + testFunc = () => identifierNamesGenerator.generateNext(); + }); + + it('should throw an error when all generated names match reservedNames', () => { + assert.throws(testFunc, 'Unable to generate a valid identifier name'); + }); + }); }); diff --git a/test/unit-tests/generators/identifier-names-generators/MangledShuffledlIdentifierNamesGenerator.spec.ts b/test/unit-tests/generators/identifier-names-generators/MangledShuffledlIdentifierNamesGenerator.spec.ts index 79519a24a..08286dafd 100644 --- a/test/unit-tests/generators/identifier-names-generators/MangledShuffledlIdentifierNamesGenerator.spec.ts +++ b/test/unit-tests/generators/identifier-names-generators/MangledShuffledlIdentifierNamesGenerator.spec.ts @@ -217,4 +217,26 @@ describe('MangledShuffledIdentifierNamesGenerator', () => { }); }); }); + + describe('`reservedNames` that match all generated names', () => { + let testFunc: () => void; + + beforeEach(() => { + const inversifyContainerFacade: IInversifyContainerFacade = new InversifyContainerFacade(); + + inversifyContainerFacade.load('', '', { + reservedNames: ['^(?!renameMeOnly$)'] + }); + const identifierNamesGenerator = inversifyContainerFacade.getNamed( + ServiceIdentifiers.IIdentifierNamesGenerator, + IdentifierNamesGenerator.MangledShuffledIdentifierNamesGenerator + ); + + testFunc = () => identifierNamesGenerator.generateNext(); + }); + + it('should throw an error when all generated names match reservedNames', () => { + assert.throws(testFunc, 'Unable to generate a valid identifier name'); + }); + }); }); diff --git a/test/unit-tests/generators/identifier-names-generators/MangledlIdentifierNamesGenerator.spec.ts b/test/unit-tests/generators/identifier-names-generators/MangledlIdentifierNamesGenerator.spec.ts index e64af8560..773b0421d 100644 --- a/test/unit-tests/generators/identifier-names-generators/MangledlIdentifierNamesGenerator.spec.ts +++ b/test/unit-tests/generators/identifier-names-generators/MangledlIdentifierNamesGenerator.spec.ts @@ -342,4 +342,26 @@ describe('MangledIdentifierNamesGenerator', () => { }); }); }); + + describe('`reservedNames` that match all generated names', () => { + let testFunc: () => void; + + beforeEach(() => { + const inversifyContainerFacade: IInversifyContainerFacade = new InversifyContainerFacade(); + + inversifyContainerFacade.load('', '', { + reservedNames: ['^(?!renameMeOnly$)'] + }); + const identifierNamesGenerator = inversifyContainerFacade.getNamed( + ServiceIdentifiers.IIdentifierNamesGenerator, + IdentifierNamesGenerator.MangledIdentifierNamesGenerator + ); + + testFunc = () => identifierNamesGenerator.generateNext(); + }); + + it('should throw an error when all generated names match reservedNames', () => { + assert.throws(testFunc, 'Unable to generate a valid identifier name'); + }); + }); }); From d8db02336dbdf0fef81641910544b4437271798b Mon Sep 17 00:00:00 2001 From: Timofey Kachalov Date: Sun, 22 Mar 2026 14:33:36 +0700 Subject: [PATCH 09/24] Add `renameProperties` support for private class fields and methods (#1393) --- CHANGELOG.md | 1 + .../replacer/IRenamePropertiesReplacer.ts | 6 +++--- .../RenamePropertiesTransformer.ts | 9 +++++++-- .../replacer/RenamePropertiesReplacer.ts | 10 +++++++--- src/node/NodeFactory.ts | 12 +++++++++++ src/node/NodeMetadata.ts | 4 +++- .../JavaScriptObfuscator.spec.ts | 20 ++++++++++++++----- .../fixtures/private-identifier.js | 11 +++++++++- 8 files changed, 58 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7133fa025..8f3c63e2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ Change Log v5.4.0 --- * Add support for `import attributes`. Fixes https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1256 +* Add `renameProperties` support for private class fields and methods (`#foo`, `#bar()`). Fixes https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1220 * Fixed `reservedNames` not preserving class method and property names when `stringArray` or `deadCodeInjection` is enabled. Fixes https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1279 * Fixed infinite loop / stack overflow when `reservedNames` patterns match all generated identifier names. Now throws a descriptive error instead. Fixes https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1382 * Fixed `transformObjectKeys` changing evaluation order when object expression is inside a sequence expression with preceding side effects (e.g. `return aux(ys), { min }`). Fixes https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1246 diff --git a/src/interfaces/node-transformers/rename-properties-transformers/replacer/IRenamePropertiesReplacer.ts b/src/interfaces/node-transformers/rename-properties-transformers/replacer/IRenamePropertiesReplacer.ts index 18abe84cf..b86590c2c 100644 --- a/src/interfaces/node-transformers/rename-properties-transformers/replacer/IRenamePropertiesReplacer.ts +++ b/src/interfaces/node-transformers/rename-properties-transformers/replacer/IRenamePropertiesReplacer.ts @@ -7,8 +7,8 @@ export interface IRenamePropertiesReplacer { excludePropertyName(propertyName: string): void; /** - * @param {ESTree.Identifier | ESTree.Literal} node - * @returns {ESTree.Identifier | ESTree.Literal} + * @param {ESTree.Identifier | ESTree.Literal | ESTree.PrivateIdentifier} node + * @returns {ESTree.Identifier | ESTree.Literal | ESTree.PrivateIdentifier} */ - replace(node: ESTree.Identifier | ESTree.Literal): ESTree.Identifier | ESTree.Literal; + replace(node: ESTree.Identifier | ESTree.Literal | ESTree.PrivateIdentifier): ESTree.Identifier | ESTree.Literal | ESTree.PrivateIdentifier; } diff --git a/src/node-transformers/rename-properties-transformers/RenamePropertiesTransformer.ts b/src/node-transformers/rename-properties-transformers/RenamePropertiesTransformer.ts index 685b6d0d4..4a0b45b68 100644 --- a/src/node-transformers/rename-properties-transformers/RenamePropertiesTransformer.ts +++ b/src/node-transformers/rename-properties-transformers/RenamePropertiesTransformer.ts @@ -48,7 +48,7 @@ export class RenamePropertiesTransformer extends AbstractNodeTransformer { >( propertyNode: TNode, propertyKeyNode: ESTree.Expression | ESTree.PrivateIdentifier - ): propertyKeyNode is ESTree.Identifier | ESTree.Literal { + ): propertyKeyNode is ESTree.Identifier | ESTree.Literal | ESTree.PrivateIdentifier { if (NodeGuards.isIdentifierNode(propertyKeyNode) && propertyNode.computed) { return false; } @@ -111,8 +111,13 @@ export class RenamePropertiesTransformer extends AbstractNodeTransformer { * @param {NodeGuards} parentNode * @returns {Node} */ + // eslint-disable-next-line complexity public transformNode(node: ESTree.Node, parentNode: ESTree.Node): ESTree.Node { - if (!NodeGuards.isIdentifierNode(node) && !NodeGuards.isLiteralNode(node)) { + if ( + !NodeGuards.isIdentifierNode(node) && + !NodeGuards.isLiteralNode(node) && + !NodeGuards.isPrivateIdentifierNode(node) + ) { return node; } diff --git a/src/node-transformers/rename-properties-transformers/replacer/RenamePropertiesReplacer.ts b/src/node-transformers/rename-properties-transformers/replacer/RenamePropertiesReplacer.ts index 707a49251..f657b0aaa 100644 --- a/src/node-transformers/rename-properties-transformers/replacer/RenamePropertiesReplacer.ts +++ b/src/node-transformers/rename-properties-transformers/replacer/RenamePropertiesReplacer.ts @@ -80,10 +80,14 @@ export class RenamePropertiesReplacer implements IRenamePropertiesReplacer { } /** - * @param {ESTree.Identifier | ESTree.Literal} node - * @returns {ESTree.Identifier | ESTree.Literal} + * @param {ESTree.Identifier | ESTree.Literal | ESTree.PrivateIdentifier} node + * @returns {ESTree.Identifier | ESTree.Literal | ESTree.PrivateIdentifier} */ - public replace(node: ESTree.Identifier | ESTree.Literal): ESTree.Identifier | ESTree.Literal { + public replace(node: ESTree.Identifier | ESTree.Literal | ESTree.PrivateIdentifier): ESTree.Identifier | ESTree.Literal | ESTree.PrivateIdentifier { + if (NodeGuards.isPrivateIdentifierNode(node)) { + return NodeFactory.privateIdentifierNode(this.replacePropertyName(node.name)); + } + if (NodeGuards.isIdentifierNode(node)) { return NodeFactory.identifierNode(this.replacePropertyName(node.name)); } diff --git a/src/node/NodeFactory.ts b/src/node/NodeFactory.ts index 6057ea1ca..4bb3a813b 100644 --- a/src/node/NodeFactory.ts +++ b/src/node/NodeFactory.ts @@ -373,6 +373,18 @@ export class NodeFactory { }; } + /** + * @param {string} name + * @returns {PrivateIdentifier} + */ + public static privateIdentifierNode(name: string): ESTree.PrivateIdentifier { + return { + type: NodeType.PrivateIdentifier, + name, + metadata: { ignoredNode: false } + }; + } + /** * @param {(ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier)[]} specifiers * @param {Literal} source diff --git a/src/node/NodeMetadata.ts b/src/node/NodeMetadata.ts index 30fc98d8e..adb735d04 100644 --- a/src/node/NodeMetadata.ts +++ b/src/node/NodeMetadata.ts @@ -49,7 +49,9 @@ export class NodeMetadata { * @param {Identifier | Literal} node * @returns {boolean} */ - public static isPropertyKeyToRenameNode(node: ESTree.Identifier | ESTree.Literal): boolean { + public static isPropertyKeyToRenameNode( + node: ESTree.Identifier | ESTree.PrivateIdentifier | ESTree.Literal + ): boolean { return ( NodeMetadata.get( node, diff --git a/test/functional-tests/javascript-obfuscator/JavaScriptObfuscator.spec.ts b/test/functional-tests/javascript-obfuscator/JavaScriptObfuscator.spec.ts index d347675f9..a268e201c 100644 --- a/test/functional-tests/javascript-obfuscator/JavaScriptObfuscator.spec.ts +++ b/test/functional-tests/javascript-obfuscator/JavaScriptObfuscator.spec.ts @@ -910,9 +910,7 @@ describe('JavaScriptObfuscator', () => { }); describe('Private identifiers support', () => { - const regExp: RegExp = new RegExp( - 'class Foo *{ *' + '#bar *= *0x1; *' + "\\['method'] *\\(\\) *{ *" + 'this\.#bar *= *0x2;' + '} *' + '}' - ); + const variableMatch: string = '_0x([a-f0-9]){4,6}'; let obfuscatedCode: string; @@ -925,8 +923,20 @@ describe('JavaScriptObfuscator', () => { }).getObfuscatedCode(); }); - it('should support private identifiers', () => { - assert.match(obfuscatedCode, regExp); + it('should rename private field', () => { + assert.match(obfuscatedCode, new RegExp(`#${variableMatch} *= *0x1`)); + }); + + it('should rename private field access', () => { + assert.match(obfuscatedCode, new RegExp(`this\\.#${variableMatch} *= *0x2`)); + }); + + it('should rename private method declaration', () => { + assert.match(obfuscatedCode, new RegExp(`#${variableMatch}\\(\\) *\\{`)); + }); + + it('should rename private method call', () => { + assert.match(obfuscatedCode, new RegExp(`this\\.#${variableMatch}\\(\\)`)); }); }); diff --git a/test/functional-tests/javascript-obfuscator/fixtures/private-identifier.js b/test/functional-tests/javascript-obfuscator/fixtures/private-identifier.js index fff5f2562..96faea9bc 100644 --- a/test/functional-tests/javascript-obfuscator/fixtures/private-identifier.js +++ b/test/functional-tests/javascript-obfuscator/fixtures/private-identifier.js @@ -4,4 +4,13 @@ class Foo { method() { this.#bar = 2; } -} \ No newline at end of file + + #privateMethod() { + return this.#bar; + } + + run() { + this.method(); + return this.#privateMethod(); + } +} From b4993e67988d37a5f962524ebae8b810fe7816f2 Mon Sep 17 00:00:00 2001 From: Timofey Kachalov Date: Sun, 22 Mar 2026 14:42:58 +0700 Subject: [PATCH 10/24] Fix coveralls error on CI (#1394) --- .github/workflows/ci.yml | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 635547b33..9f85a9b02 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,7 +47,20 @@ jobs: - run: yarn run test:mocha-coverage - run: yarn run test:mocha-coverage:report - name: Coveralls - uses: coverallsapp/github-action@master + uses: coverallsapp/github-action@v2 with: github-token: ${{ secrets.GITHUB_TOKEN }} - path-to-lcov: './coverage/lcov.info' \ No newline at end of file + path-to-lcov: './coverage/lcov.info' + parallel: true + flag-name: node-${{ matrix.node-version }}-${{ matrix.os }} + + coveralls-finish: + needs: build + if: always() + runs-on: ubuntu-latest + steps: + - name: Coveralls Finished + uses: coverallsapp/github-action@v2 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + parallel-finished: true \ No newline at end of file From aa3c9fd3441f28572ba416f5a23ef7544feb3357 Mon Sep 17 00:00:00 2001 From: Timofey Kachalov Date: Sun, 22 Mar 2026 15:10:12 +0700 Subject: [PATCH 11/24] Fixed CLI `--options-preset` not applying preset values for options not explicitly set via command line (#1395) --- CHANGELOG.md | 1 + src/cli/JavaScriptObfuscatorCLI.ts | 28 +++++++++--- test/fixtures/sample-long-string.js | 2 + .../cli/JavaScriptObfuscatorCLI.spec.ts | 45 +++++++++++++++++++ 4 files changed, 69 insertions(+), 7 deletions(-) create mode 100644 test/fixtures/sample-long-string.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f3c63e2f..b050fb812 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ v5.4.0 * Fixed `reservedNames` not preserving class method and property names when `stringArray` or `deadCodeInjection` is enabled. Fixes https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1279 * Fixed infinite loop / stack overflow when `reservedNames` patterns match all generated identifier names. Now throws a descriptive error instead. Fixes https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1382 * Fixed `transformObjectKeys` changing evaluation order when object expression is inside a sequence expression with preceding side effects (e.g. `return aux(ys), { min }`). Fixes https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1246 +* Fixed CLI `--options-preset` not applying preset values for options not explicitly set via command line (e.g. `splitStrings` from `high-obfuscation` preset was ignored). Fixes https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1236 * Replaced `mkdirp` dependency with native `fs.mkdirSync({ recursive: true })`. Fixes https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1275. Thank you https://github.com/roli-lpci! * Replaced `conf` dependency with custom implementation using `env-paths` and native `fs` diff --git a/src/cli/JavaScriptObfuscatorCLI.ts b/src/cli/JavaScriptObfuscatorCLI.ts index 99b16d53a..95eb5b78d 100644 --- a/src/cli/JavaScriptObfuscatorCLI.ts +++ b/src/cli/JavaScriptObfuscatorCLI.ts @@ -4,6 +4,7 @@ import * as path from 'path'; import { TInputCLIOptions } from '../types/options/TInputCLIOptions'; import { TInputOptions } from '../types/options/TInputOptions'; +import { TOptionsPreset } from '../types/options/TOptionsPreset'; import { IFileData } from '../interfaces/cli/IFileData'; import { IInitializable } from '../interfaces/IInitializable'; @@ -24,11 +25,10 @@ import { StringArrayEncoding } from '../enums/node-transformers/string-array-tra import { StringArrayIndexesType } from '../enums/node-transformers/string-array-transformers/StringArrayIndexesType'; import { StringArrayWrappersType } from '../enums/node-transformers/string-array-transformers/StringArrayWrappersType'; -import { DEFAULT_PRESET } from '../options/presets/Default'; - import { ArraySanitizer } from './sanitizers/ArraySanitizer'; import { BooleanSanitizer } from './sanitizers/BooleanSanitizer'; +import { Options } from '../options/Options'; import { CLIUtils } from './utils/CLIUtils'; import { IdentifierNamesCacheFileUtils } from './utils/IdentifierNamesCacheFileUtils'; import { JavaScriptObfuscator } from '../JavaScriptObfuscatorFacade'; @@ -112,26 +112,36 @@ export class JavaScriptObfuscatorCLI implements IInitializable { /** * @param {TInputCLIOptions} inputOptions + * @param {commander.Command} command * @returns {TInputOptions} */ - private static buildOptions(inputOptions: TInputCLIOptions): TInputOptions { - const inputCLIOptions: TInputOptions = JavaScriptObfuscatorCLI.filterOptions(inputOptions); + private static buildOptions(inputOptions: TInputCLIOptions, command: commander.Command): TInputOptions { + const inputCLIOptions: TInputOptions = JavaScriptObfuscatorCLI.filterOptions(inputOptions, command); const configFilePath: string | undefined = inputOptions.config; const configFileLocation: string = configFilePath ? path.resolve(configFilePath, '.') : ''; const configFileOptions: TInputOptions = configFileLocation ? CLIUtils.getUserConfig(configFileLocation) : {}; + const presetName: TOptionsPreset = + inputCLIOptions.optionsPreset ?? configFileOptions.optionsPreset ?? OptionsPreset.Default; + const presetOptions: TInputOptions = Options.getOptionsByPreset(presetName); + return { - ...DEFAULT_PRESET, + ...presetOptions, ...configFileOptions, ...inputCLIOptions }; } /** + * Filters out options that were not explicitly set by the user. + * Commander.js sets default values for all options, which would + * override preset values. Only user-provided options should be kept. + * * @param {TObject} options + * @param {commander.Command} command * @returns {TInputOptions} */ - private static filterOptions(options: TInputCLIOptions): TInputOptions { + private static filterOptions(options: TInputCLIOptions, command: commander.Command): TInputOptions { const filteredOptions: TInputOptions = {}; Object.keys(options).forEach((option: keyof TInputCLIOptions) => { @@ -139,6 +149,10 @@ export class JavaScriptObfuscatorCLI implements IInitializable { return; } + if (command.getOptionValueSource(String(option)) === 'default') { + return; + } + filteredOptions[option] = options[option]; }); @@ -152,7 +166,7 @@ export class JavaScriptObfuscatorCLI implements IInitializable { this.configureHelp(); this.inputPath = path.normalize(this.commands.args[0] || ''); - this.inputCLIOptions = JavaScriptObfuscatorCLI.buildOptions(this.commands.opts()); + this.inputCLIOptions = JavaScriptObfuscatorCLI.buildOptions(this.commands.opts(), this.commands); this.sourceCodeFileUtils = new SourceCodeFileUtils(this.inputPath, this.inputCLIOptions); this.obfuscatedCodeFileUtils = new ObfuscatedCodeFileUtils(this.inputPath, this.inputCLIOptions); this.identifierNamesCacheFileUtils = new IdentifierNamesCacheFileUtils( diff --git a/test/fixtures/sample-long-string.js b/test/fixtures/sample-long-string.js new file mode 100644 index 000000000..c259a23a8 --- /dev/null +++ b/test/fixtures/sample-long-string.js @@ -0,0 +1,2 @@ +var x = "This is a long string and it should really be split by the obfuscator"; +console.log(x); diff --git a/test/functional-tests/cli/JavaScriptObfuscatorCLI.spec.ts b/test/functional-tests/cli/JavaScriptObfuscatorCLI.spec.ts index 541e33108..8b9462599 100644 --- a/test/functional-tests/cli/JavaScriptObfuscatorCLI.spec.ts +++ b/test/functional-tests/cli/JavaScriptObfuscatorCLI.spec.ts @@ -1511,6 +1511,51 @@ describe('JavaScriptObfuscatorCLI', function (): void { }); }); + /** + * https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1236 + */ + describe('`--options-preset` should apply preset options that are not explicitly set via CLI', () => { + const longStringFixturePath: string = path.join(fixturesDirName, 'sample-long-string.js'); + + let obfuscatedCode: string; + + before(async () => { + await JavaScriptObfuscatorCLI.obfuscate([ + 'node', + 'javascript-obfuscator', + longStringFixturePath, + '--output', + outputFilePath, + '--options-preset', + 'medium-obfuscation', + '--string-array', + 'false', + '--dead-code-injection', + 'false', + '--control-flow-flattening', + 'false', + '--self-defending', + 'false', + '--debug-protection', + 'false', + '--disable-console-output', + 'false', + '--seed', + '1' + ]); + + obfuscatedCode = fs.readFileSync(outputFilePath, 'utf8'); + }); + + it('should apply `splitStrings` from preset without explicit `--split-strings` flag', () => { + assert.match(obfuscatedCode, /'.+'\s*\+\s*'.+'\s*\+\s*'.+'/); + }); + + after(() => { + fs.unlinkSync(outputFilePath); + }); + }); + after(() => { rimraf.sync(outputDirName); }); From 2ec6e13d8f5cada230415ab95d0c87cf12e5f0bf Mon Sep 17 00:00:00 2001 From: Timofey Kachalov Date: Sun, 22 Mar 2026 15:45:29 +0700 Subject: [PATCH 12/24] Fixed destructuring patterns inside class static blocks not being renamed when `renameGlobals` is disabled (#1396) --- CHANGELOG.md | 1 + .../ObjectPatternPropertiesTransformer.ts | 25 ++++++- ...ObjectPatternPropertiesTransformer.spec.ts | 67 +++++++++++++++++++ .../static-block-destructuring-assignment.js | 11 +++ .../static-block-destructuring-declaration.js | 10 +++ .../ClassDeclaration.spec.ts | 1 + 6 files changed, 114 insertions(+), 1 deletion(-) create mode 100644 test/functional-tests/node-transformers/converting-transformers/object-pattern-properties-transformer/fixtures/static-block-destructuring-assignment.js create mode 100644 test/functional-tests/node-transformers/converting-transformers/object-pattern-properties-transformer/fixtures/static-block-destructuring-declaration.js diff --git a/CHANGELOG.md b/CHANGELOG.md index b050fb812..7f491a7c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ v5.4.0 * Fixed `reservedNames` not preserving class method and property names when `stringArray` or `deadCodeInjection` is enabled. Fixes https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1279 * Fixed infinite loop / stack overflow when `reservedNames` patterns match all generated identifier names. Now throws a descriptive error instead. Fixes https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1382 * Fixed `transformObjectKeys` changing evaluation order when object expression is inside a sequence expression with preceding side effects (e.g. `return aux(ys), { min }`). Fixes https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1246 +* Fixed destructuring patterns inside class static blocks not being renamed when `renameGlobals` is disabled. Fixes https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1141 * Fixed CLI `--options-preset` not applying preset values for options not explicitly set via command line (e.g. `splitStrings` from `high-obfuscation` preset was ignored). Fixes https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1236 * Replaced `mkdirp` dependency with native `fs.mkdirSync({ recursive: true })`. Fixes https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1275. Thank you https://github.com/roli-lpci! * Replaced `conf` dependency with custom implementation using `env-paths` and native `fs` diff --git a/src/node-transformers/converting-transformers/ObjectPatternPropertiesTransformer.ts b/src/node-transformers/converting-transformers/ObjectPatternPropertiesTransformer.ts index d4a80e39e..3b9b378f3 100644 --- a/src/node-transformers/converting-transformers/ObjectPatternPropertiesTransformer.ts +++ b/src/node-transformers/converting-transformers/ObjectPatternPropertiesTransformer.ts @@ -67,8 +67,9 @@ export class ObjectPatternPropertiesTransformer extends AbstractNodeTransformer if (!this.options.renameGlobals) { const lexicalScope: TNodeWithLexicalScope | undefined = NodeLexicalScopeUtils.getLexicalScope(propertyNode); + const isInsideStaticBlock: boolean = this.isInsideStaticBlock(propertyNode); const shouldNotTransformGlobalPropertyNode: boolean = - !!lexicalScope && NodeGuards.isProgramNode(lexicalScope); + !!lexicalScope && NodeGuards.isProgramNode(lexicalScope) && !isInsideStaticBlock; if (shouldNotTransformGlobalPropertyNode) { return propertyNode; @@ -82,4 +83,26 @@ export class ObjectPatternPropertiesTransformer extends AbstractNodeTransformer return propertyNode; } + + /** + * @param {Node} node + * @returns {boolean} + */ + private isInsideStaticBlock(node: ESTree.Node): boolean { + let currentNode: ESTree.Node | undefined = node; + + while (currentNode) { + if (NodeGuards.isStaticBlockNode(currentNode)) { + return true; + } + + if (NodeGuards.isFunctionNode(currentNode) || NodeGuards.isProgramNode(currentNode)) { + return false; + } + + currentNode = currentNode.parentNode; + } + + return false; + } } diff --git a/test/functional-tests/node-transformers/converting-transformers/object-pattern-properties-transformer/ObjectPatternPropertiesTransformer.spec.ts b/test/functional-tests/node-transformers/converting-transformers/object-pattern-properties-transformer/ObjectPatternPropertiesTransformer.spec.ts index dd43acb1d..724ba94d8 100644 --- a/test/functional-tests/node-transformers/converting-transformers/object-pattern-properties-transformer/ObjectPatternPropertiesTransformer.spec.ts +++ b/test/functional-tests/node-transformers/converting-transformers/object-pattern-properties-transformer/ObjectPatternPropertiesTransformer.spec.ts @@ -201,4 +201,71 @@ describe('ObjectPatternPropertiesTransformer', () => { }); }); }); + + /** + * https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1141 + */ + describe('Variant #4: class static block', () => { + describe('Variant #1: destructuring declaration', () => { + let testFunc: () => void; + + before(() => { + const code: string = readFileAsString( + __dirname + '/fixtures/static-block-destructuring-declaration.js' + ); + + testFunc = () => { + const obfuscatedCode: string = JavaScriptObfuscator.obfuscate(code, { + ...NO_ADDITIONAL_NODES_PRESET, + renameGlobals: false, + seed: 1 + }).getObfuscatedCode(); + + const result = eval(obfuscatedCode); + + if (result !== 42) { + throw new Error( + `Expected 42, got ${result}. ` + + `Destructuring declaration not renamed correctly in static block.` + ); + } + }; + }); + + it('should correctly rename destructuring declaration in class static block', () => { + assert.doesNotThrow(testFunc); + }); + }); + + describe('Variant #2: destructuring assignment', () => { + let testFunc: () => void; + + before(() => { + const code: string = readFileAsString( + __dirname + '/fixtures/static-block-destructuring-assignment.js' + ); + + testFunc = () => { + const obfuscatedCode: string = JavaScriptObfuscator.obfuscate(code, { + ...NO_ADDITIONAL_NODES_PRESET, + renameGlobals: false, + seed: 1 + }).getObfuscatedCode(); + + const result = eval(obfuscatedCode); + + if (result !== 42) { + throw new Error( + `Expected 42, got ${result}. ` + + `Destructuring assignment not renamed correctly in static block.` + ); + } + }; + }); + + it('should correctly rename destructuring assignment in class static block', () => { + assert.doesNotThrow(testFunc); + }); + }); + }); }); diff --git a/test/functional-tests/node-transformers/converting-transformers/object-pattern-properties-transformer/fixtures/static-block-destructuring-assignment.js b/test/functional-tests/node-transformers/converting-transformers/object-pattern-properties-transformer/fixtures/static-block-destructuring-assignment.js new file mode 100644 index 000000000..b754b2ff0 --- /dev/null +++ b/test/functional-tests/node-transformers/converting-transformers/object-pattern-properties-transformer/fixtures/static-block-destructuring-assignment.js @@ -0,0 +1,11 @@ +(function() { + class Foo { + static result; + static { + let x; + ({ x } = { x: 42 }); + Foo.result = x; + } + } + return Foo.result; +})() diff --git a/test/functional-tests/node-transformers/converting-transformers/object-pattern-properties-transformer/fixtures/static-block-destructuring-declaration.js b/test/functional-tests/node-transformers/converting-transformers/object-pattern-properties-transformer/fixtures/static-block-destructuring-declaration.js new file mode 100644 index 000000000..97a307c2f --- /dev/null +++ b/test/functional-tests/node-transformers/converting-transformers/object-pattern-properties-transformer/fixtures/static-block-destructuring-declaration.js @@ -0,0 +1,10 @@ +(function() { + class Foo { + static result; + static { + let { x } = { x: 42 }; + Foo.result = x; + } + } + return Foo.result; +})() diff --git a/test/functional-tests/node-transformers/rename-identifiers-transformers/scope-identifiers-transformer/class-declaration/ClassDeclaration.spec.ts b/test/functional-tests/node-transformers/rename-identifiers-transformers/scope-identifiers-transformer/class-declaration/ClassDeclaration.spec.ts index 989eb4d92..5a35cf880 100644 --- a/test/functional-tests/node-transformers/rename-identifiers-transformers/scope-identifiers-transformer/class-declaration/ClassDeclaration.spec.ts +++ b/test/functional-tests/node-transformers/rename-identifiers-transformers/scope-identifiers-transformer/class-declaration/ClassDeclaration.spec.ts @@ -805,5 +805,6 @@ describe('ScopeIdentifiersTransformer ClassDeclaration identifiers', () => { assert.match(obfuscatedCode, defaultExportRegExp); }); }); + }); }); From 6659c8252a784029efe70f03b996a035409f7c21 Mon Sep 17 00:00:00 2001 From: sanex3339 Date: Sun, 22 Mar 2026 15:56:01 +0700 Subject: [PATCH 13/24] Add domain lock case with `-` char --- .../templates/DomainLockNodeTemplate.spec.ts | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/test/functional-tests/custom-code-helpers/domain-lock/templates/DomainLockNodeTemplate.spec.ts b/test/functional-tests/custom-code-helpers/domain-lock/templates/DomainLockNodeTemplate.spec.ts index 6f30afa6e..cd55ae393 100644 --- a/test/functional-tests/custom-code-helpers/domain-lock/templates/DomainLockNodeTemplate.spec.ts +++ b/test/functional-tests/custom-code-helpers/domain-lock/templates/DomainLockNodeTemplate.spec.ts @@ -955,4 +955,60 @@ describe('DomainLockTemplate', () => { }); }); }); + + describe('Variant #10: domain with hyphen', () => { + const samplesCount: number = 50; + const domainsString: string = ['my-website.com'].join(';'); + const domainLockRedirectUrl: string = 'about:blank'; + const currentDomain: string = 'my-website.com'; + + let testFunc: () => void; + + before(() => { + testFunc = () => { + for (let i = 0; i < samplesCount; i++) { + const [hiddenDomainsString, domainsStringDiff] = cryptUtils.hideString( + domainsString, + domainsString.length * 3 + ); + + const [hiddenDomainLockRedirectUrl, domainLockRedirectUrlDiff] = cryptUtils.hideString( + domainLockRedirectUrl, + domainLockRedirectUrl.length * 3 + ); + + const root: any = { + document: { + domain: currentDomain, + location: undefined + } + }; + + const fn = getFunctionFromTemplate( + { + domainLockFunctionName: 'domainLockFunction', + domainsStringDiff, + domains: hiddenDomainsString, + domainLockRedirectUrlDiff: domainLockRedirectUrlDiff, + hiddenDomainLockRedirectUrl: hiddenDomainLockRedirectUrl, + globalVariableTemplate: '', + singleCallControllerFunctionName + }, + singleCallControllerFunctionName, + thatThisTemplate + ); + + fn.apply(root); + + if (root.document.location !== undefined) { + throw new Error(`Domain lock redirected for matching hyphenated domain (iteration ${i})`); + } + } + }; + }); + + it('should correctly match domain containing hyphens', () => { + assert.doesNotThrow(testFunc); + }); + }); }); From 84861e8e397179d6597195626fe6783757eee3e0 Mon Sep 17 00:00:00 2001 From: Timofey Kachalov Date: Sun, 22 Mar 2026 16:03:29 +0700 Subject: [PATCH 14/24] Updated reserved DOM properties list (#1397) --- CHANGELOG.md | 1 + src/constants/ReservedDomProperties.json | 1470 +++++++++++++++++++++- 2 files changed, 1448 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f491a7c1..0203f6efc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ v5.4.0 * Fixed destructuring patterns inside class static blocks not being renamed when `renameGlobals` is disabled. Fixes https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1141 * Fixed CLI `--options-preset` not applying preset values for options not explicitly set via command line (e.g. `splitStrings` from `high-obfuscation` preset was ignored). Fixes https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1236 * Replaced `mkdirp` dependency with native `fs.mkdirSync({ recursive: true })`. Fixes https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1275. Thank you https://github.com/roli-lpci! +* Updated reserved DOM properties list, fixing `renameProperties` breaking modern built-in methods like `Array.prototype.at()`. Fixes https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1066 * Replaced `conf` dependency with custom implementation using `env-paths` and native `fs` v5.3.1 diff --git a/src/constants/ReservedDomProperties.json b/src/constants/ReservedDomProperties.json index 1a3c53adc..633d7b921 100644 --- a/src/constants/ReservedDomProperties.json +++ b/src/constants/ReservedDomProperties.json @@ -107,6 +107,7 @@ "-webkit-box-pack", "-webkit-box-shadow", "-webkit-box-sizing", + "-webkit-clip-path", "-webkit-filter", "-webkit-flex", "-webkit-flex-basis", @@ -115,6 +116,7 @@ "-webkit-flex-grow", "-webkit-flex-shrink", "-webkit-flex-wrap", + "-webkit-font-feature-settings", "-webkit-justify-content", "-webkit-line-clamp", "-webkit-mask", @@ -131,6 +133,7 @@ "-webkit-perspective", "-webkit-perspective-origin", "-webkit-text-fill-color", + "-webkit-text-security", "-webkit-text-size-adjust", "-webkit-text-stroke", "-webkit-text-stroke-color", @@ -144,27 +147,6 @@ "-webkit-transition-property", "-webkit-transition-timing-function", "-webkit-user-select", - "0", - "1", - "10", - "11", - "12", - "13", - "14", - "15", - "16", - "17", - "18", - "19", - "2", - "20", - "3", - "4", - "5", - "6", - "7", - "8", - "9", "@@iterator", "ABORT_ERR", "ACTIVE", @@ -175,6 +157,7 @@ "ADDITION", "ALIASED_LINE_WIDTH_RANGE", "ALIASED_POINT_SIZE_RANGE", + "ALL", "ALLOW_KEYBOARD_INPUT", "ALLPASS", "ALPHA", @@ -206,24 +189,30 @@ "AnimationTimeline", "AnonXMLHttpRequest", "Any", + "AnyPermissions", "ApplicationCache", "ApplicationCacheErrorEvent", "Array", "ArrayBuffer", "ArrayType", + "AsyncDisposableStack", "Atomics", "Attr", "Audio", "AudioBuffer", "AudioBufferSourceNode", "AudioContext", + "AudioData", + "AudioDecoder", "AudioDestinationNode", + "AudioEncoder", "AudioListener", "AudioNode", "AudioParam", "AudioParamMap", "AudioProcessingEvent", "AudioScheduledSourceNode", + "AudioSinkInfo", "AudioStreamTrack", "AudioWorklet", "AudioWorkletNode", @@ -244,6 +233,7 @@ "BLEND_EQUATION_RGB", "BLEND_SRC_ALPHA", "BLEND_SRC_RGB", + "BLUE", "BLUE_BITS", "BLUR", "BOOL", @@ -285,6 +275,8 @@ "BluetoothUUID", "Boolean", "BroadcastChannel", + "BrowserCaptureMediaStreamTrack", + "BrowserInfo", "ByteLengthQueuingStrategy", "CAPTURING_PHASE", "CCW", @@ -320,11 +312,13 @@ "COMMENT_NODE", "COMPARE_REF_TO_TEXTURE", "COMPILE_STATUS", + "COMPLETION_STATUS_KHR", "COMPRESSED_RGBA_S3TC_DXT1_EXT", "COMPRESSED_RGBA_S3TC_DXT3_EXT", "COMPRESSED_RGBA_S3TC_DXT5_EXT", "COMPRESSED_RGB_S3TC_DXT1_EXT", "COMPRESSED_TEXTURE_FORMATS", + "COMPUTE", "CONDITION_SATISFIED", "CONFIGURATION_UNSUPPORTED", "CONNECTING", @@ -333,25 +327,37 @@ "CONSTRAINT_ERR", "CONTEXT_LOST_WEBGL", "CONTROL_MASK", + "COPY_DST", "COPY_READ_BUFFER", "COPY_READ_BUFFER_BINDING", + "COPY_SRC", "COPY_WRITE_BUFFER", "COPY_WRITE_BUFFER_BINDING", "COUNTER_STYLE_RULE", + "CSPViolationReportBody", "CSS", "CSS2Properties", "CSSAnimation", "CSSCharsetRule", "CSSConditionRule", + "CSSContainerRule", "CSSCounterStyleRule", "CSSFontFaceRule", "CSSFontFeatureValuesRule", + "CSSFontPaletteValuesRule", + "CSSFunctionDeclarations", + "CSSFunctionDescriptors", + "CSSFunctionRule", "CSSGroupingRule", "CSSImageValue", "CSSImportRule", "CSSKeyframeRule", "CSSKeyframesRule", "CSSKeywordValue", + "CSSLayerBlockRule", + "CSSLayerStatementRule", + "CSSMarginRule", + "CSSMathClamp", "CSSMathInvert", "CSSMathMax", "CSSMathMin", @@ -364,20 +370,28 @@ "CSSMozDocumentRule", "CSSNameSpaceRule", "CSSNamespaceRule", + "CSSNestedDeclarations", "CSSNumericArray", "CSSNumericValue", + "CSSPageDescriptors", "CSSPageRule", "CSSPerspective", + "CSSPositionTryDescriptors", + "CSSPositionTryRule", "CSSPositionValue", "CSSPrimitiveValue", + "CSSPropertyRule", "CSSRotate", "CSSRule", "CSSRuleList", "CSSScale", + "CSSScopeRule", "CSSSkew", "CSSSkewX", "CSSSkewY", + "CSSStartingStyleRule", "CSSStyleDeclaration", + "CSSStyleProperties", "CSSStyleRule", "CSSStyleSheet", "CSSStyleValue", @@ -394,6 +408,7 @@ "CSSVariableReferenceValue", "CSSVariablesDeclaration", "CSSVariablesRule", + "CSSViewTransitionRule", "CSSViewportRule", "CSS_ATTR", "CSS_CM", @@ -476,9 +491,12 @@ "CanvasGradient", "CanvasPattern", "CanvasRenderingContext2D", + "CaptureController", "CaretPosition", "ChannelMergerNode", "ChannelSplitterNode", + "ChapterInformation", + "CharacterBoundsUpdateEvent", "CharacterData", "ClientRect", "ClientRectList", @@ -486,7 +504,10 @@ "ClipboardEvent", "ClipboardItem", "CloseEvent", + "CloseWatcher", "Collator", + "ColorArray", + "ColorValue", "CommandEvent", "Comment", "CompileError", @@ -494,16 +515,26 @@ "CompressionStream", "Console", "ConstantSourceNode", + "ContentVisibilityAutoStateChangeEvent", + "ContextFilter", + "ContextType", "Controllers", "ConvolverNode", + "CookieChangeEvent", + "CookieStore", + "CookieStoreManager", "CountQueuingStrategy", "Counter", + "CreateMonitor", + "CreateType", "Credential", "CredentialsContainer", + "CropTarget", "Crypto", "CryptoKey", "CustomElementRegistry", "CustomEvent", + "CustomStateSet", "DATABASE_ERR", "DATA_CLONE_ERR", "DATA_ERR", @@ -994,24 +1025,33 @@ "DateTimeFormat", "DecompressionStream", "DelayNode", + "DelegatedInkTrailPresenter", "DeprecationReportBody", "DesktopNotification", "DesktopNotificationCenter", + "Details", "DeviceLightEvent", "DeviceMotionEvent", "DeviceMotionEventAcceleration", "DeviceMotionEventRotationRate", "DeviceOrientationEvent", + "DevicePosture", "DeviceProximityEvent", "DeviceStorage", "DeviceStorageChangeEvent", + "DigitalCredential", "Directory", "DisplayNames", + "DisposableStack", "Document", "DocumentFragment", + "DocumentPictureInPicture", + "DocumentPictureInPictureEvent", "DocumentTimeline", "DocumentType", "DragEvent", + "Duration", + "DurationFormat", "DynamicsCompressorNode", "E", "ELEMENT_ARRAY_BUFFER", @@ -1029,10 +1069,12 @@ "EQUALPOWER", "ERROR", "EXPONENTIAL_DISTANCE", - "exports", + "EditContext", "Element", "ElementInternals", "ElementQuery", + "EncodedAudioChunk", + "EncodedVideoChunk", "EnterPictureInPictureEvent", "Entity", "EntityReference", @@ -1040,10 +1082,18 @@ "ErrorEvent", "EvalError", "Event", + "EventCounts", "EventException", "EventSource", "EventTarget", + "Exception", + "ExtensionContext", + "ExtensionDisabledReason", + "ExtensionInfo", + "ExtensionInstallType", + "ExtensionType", "External", + "EyeDropper", "FASTEST", "FIDOSDK", "FILTER_ACCEPT", @@ -1069,6 +1119,7 @@ "FOCUS", "FONT_FACE_RULE", "FONT_FEATURE_VALUES_RULE", + "FRAGMENT", "FRAGMENT_SHADER", "FRAGMENT_SHADER_DERIVATIVE_HINT", "FRAGMENT_SHADER_DERIVATIVE_HINT_OES", @@ -1105,20 +1156,30 @@ "FederatedCredential", "Feed", "FeedEntry", + "Fence", + "FencedFrameConfig", + "FetchLaterResult", "File", "FileError", "FileList", "FileReader", "FileSystem", "FileSystemDirectoryEntry", + "FileSystemDirectoryHandle", "FileSystemDirectoryReader", "FileSystemEntry", "FileSystemFileEntry", + "FileSystemFileHandle", + "FileSystemHandle", + "FileSystemObserver", + "FileSystemWritableFileStream", "FinalizationRegistry", "FindInPage", + "Float16Array", "Float32Array", "Float64Array", "FocusEvent", + "FontData", "FontFace", "FontFaceSet", "FontFaceSetLoadEvent", @@ -1128,7 +1189,48 @@ "Function", "GENERATE_MIPMAP_HINT", "GEQUAL", + "GPU", + "GPUAdapter", + "GPUAdapterInfo", + "GPUBindGroup", + "GPUBindGroupLayout", + "GPUBuffer", + "GPUBufferUsage", + "GPUCanvasContext", + "GPUColorWrite", + "GPUCommandBuffer", + "GPUCommandEncoder", + "GPUCompilationInfo", + "GPUCompilationMessage", + "GPUComputePassEncoder", + "GPUComputePipeline", + "GPUDevice", + "GPUDeviceLostInfo", + "GPUError", + "GPUExternalTexture", + "GPUInternalError", + "GPUMapMode", + "GPUOutOfMemoryError", + "GPUPipelineError", + "GPUPipelineLayout", + "GPUQuerySet", + "GPUQueue", + "GPURenderBundle", + "GPURenderBundleEncoder", + "GPURenderPassEncoder", + "GPURenderPipeline", + "GPUSampler", + "GPUShaderModule", + "GPUShaderStage", + "GPUSupportedFeatures", + "GPUSupportedLimits", + "GPUTexture", + "GPUTextureUsage", + "GPUTextureView", + "GPUUncapturedErrorEvent", + "GPUValidationError", "GREATER", + "GREEN", "GREEN_BITS", "GainNode", "Gamepad", @@ -1143,7 +1245,9 @@ "GeolocationPosition", "GeolocationPositionError", "GestureEvent", + "GetInfo", "Global", + "GravitySensor", "Gyroscope", "HALF_FLOAT", "HAVE_CURRENT_DATA", @@ -1152,7 +1256,11 @@ "HAVE_METADATA", "HAVE_NOTHING", "HEADERS_RECEIVED", + "HID", + "HIDConnectionEvent", "HIDDEN", + "HIDDevice", + "HIDInputReportEvent", "HIERARCHY_REQUEST_ERR", "HIGHPASS", "HIGHSHELF", @@ -1186,6 +1294,7 @@ "HTMLDocument", "HTMLElement", "HTMLEmbedElement", + "HTMLFencedFrameElement", "HTMLFieldSetElement", "HTMLFontElement", "HTMLFormControlsCollection", @@ -1228,6 +1337,7 @@ "HTMLQuoteElement", "HTMLScriptElement", "HTMLSelectElement", + "HTMLSelectedContentElement", "HTMLShadowElement", "HTMLSlotElement", "HTMLSourceElement", @@ -1249,6 +1359,8 @@ "HTMLVideoElement", "HashChangeEvent", "Headers", + "Highlight", + "HighlightRegistry", "History", "Hz", "ICE_CHECKING", @@ -1270,6 +1382,7 @@ "IDBMutableFile", "IDBObjectStore", "IDBOpenDBRequest", + "IDBRecord", "IDBRequest", "IDBTransaction", "IDBVersionChangeEvent", @@ -1280,7 +1393,9 @@ "IMPORT_RULE", "INCR", "INCR_WRAP", + "INDEX", "INDEX_SIZE_ERR", + "INDIRECT", "INT", "INTERLEAVED_ATTRIBS", "INT_2_10_10_10_REV", @@ -1306,13 +1421,23 @@ "INVERSE_DISTANCE", "INVERT", "IceCandidate", + "IconInfo", + "IdentityCredential", + "IdentityCredentialError", + "IdentityProvider", "IdleDeadline", + "IdleDetector", "Image", "ImageBitmap", "ImageBitmapRenderingContext", "ImageCapture", "ImageData", + "ImageDataType", + "ImageDecoder", + "ImageTrack", + "ImageTrackList", "Infinity", + "Ink", "InputDeviceCapabilities", "InputDeviceInfo", "InputEvent", @@ -1320,10 +1445,13 @@ "InstallTrigger", "InstallTriggerImpl", "Instance", + "Instant", "Int16Array", "Int32Array", "Int8Array", + "IntegrityViolationReportBody", "Intent", + "InterestEvent", "InternalError", "IntersectionObserver", "IntersectionObserverEntry", @@ -1331,6 +1459,7 @@ "IsSearchProviderInstalled", "Iterator", "JSON", + "JSTag", "KEEP", "KEYDOWN", "KEYFRAMES_RULE", @@ -1371,7 +1500,12 @@ "LSParserFilter", "LUMINANCE", "LUMINANCE_ALPHA", + "LanguageCode", + "LanguageDetector", "LargestContentfulPaint", + "LaunchParams", + "LaunchQueue", + "LaunchType", "LayoutShift", "LayoutShiftAttribution", "LinearAccelerationSensor", @@ -1382,9 +1516,13 @@ "Location", "Lock", "LockManager", + "MAP_READ", + "MAP_WRITE", + "MARGIN_RULE", "MAX", "MAX_3D_TEXTURE_SIZE", "MAX_ARRAY_TEXTURE_LAYERS", + "MAX_CAPTURE_VISIBLE_TAB_CALLS_PER_SECOND", "MAX_CLIENT_WAIT_TIMEOUT_WEBGL", "MAX_COLOR_ATTACHMENTS", "MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS", @@ -1529,17 +1667,23 @@ "MediaSession", "MediaSettingsRange", "MediaSource", + "MediaSourceHandle", "MediaStream", "MediaStreamAudioDestinationNode", "MediaStreamAudioSourceNode", "MediaStreamEvent", "MediaStreamTrack", "MediaStreamTrackAudioSourceNode", + "MediaStreamTrackAudioStats", "MediaStreamTrackEvent", + "MediaStreamTrackGenerator", + "MediaStreamTrackProcessor", + "MediaStreamTrackVideoStats", "Memory", "MessageChannel", "MessageEvent", "MessagePort", + "MessageSender", "Methods", "MimeType", "MimeTypeArray", @@ -1641,6 +1785,8 @@ "MutationEvent", "MutationObserver", "MutationRecord", + "MutedInfo", + "MutedInfoReason", "NAMESPACE_ERR", "NAMESPACE_RULE", "NEAREST", @@ -1679,17 +1825,31 @@ "NUM_COMPRESSED_TEXTURE_FORMATS", "NaN", "NamedNodeMap", + "NavigateEvent", + "Navigation", + "NavigationActivation", + "NavigationCurrentEntryChangeEvent", + "NavigationDestination", + "NavigationHistoryEntry", + "NavigationPrecommitController", "NavigationPreloadManager", + "NavigationTransition", "Navigator", + "NavigatorLogin", + "NavigatorManagedData", + "NavigatorUAData", "NearbyLinks", "NetworkInformation", "Node", "NodeFilter", "NodeIterator", "NodeList", + "NotRestoredReasonDetails", + "NotRestoredReasons", "Notation", "Notification", "NotifyPaintEvent", + "Now", "Number", "NumberFormat", "OBJECT_TYPE", @@ -1708,13 +1868,20 @@ "ORDERED_NODE_ITERATOR_TYPE", "ORDERED_NODE_SNAPSHOT_TYPE", "OTHER_ERROR", + "OTPCredential", "OUT_OF_MEMORY", "Object", + "Observable", "OfflineAudioCompletionEvent", "OfflineAudioContext", "OfflineResourceList", "OffscreenCanvas", "OffscreenCanvasRenderingContext2D", + "OnClickData", + "OnInstalledReason", + "OnPerformanceWarningCategory", + "OnPerformanceWarningSeverity", + "OnRestartRequiredReason", "Option", "OrientationSensor", "OscillatorNode", @@ -1766,6 +1933,9 @@ "PREV_NO_DUPLICATE", "PROCESSING_INSTRUCTION_NODE", "PageChangeEvent", + "PageRevealEvent", + "PageSettings", + "PageSwapEvent", "PageTransitionEvent", "PaintRequest", "PaintRequestList", @@ -1783,6 +1953,7 @@ "PerformanceElementTiming", "PerformanceEntry", "PerformanceEventTiming", + "PerformanceLongAnimationFrameTiming", "PerformanceLongTaskTiming", "PerformanceMark", "PerformanceMeasure", @@ -1792,6 +1963,7 @@ "PerformanceObserverEntryList", "PerformancePaintTiming", "PerformanceResourceTiming", + "PerformanceScriptTiming", "PerformanceServerTiming", "PerformanceTiming", "PeriodicSyncManager", @@ -1799,13 +1971,24 @@ "PermissionStatus", "Permissions", "PhotoCapabilities", + "PictureInPictureEvent", "PictureInPictureWindow", + "PlainDate", + "PlainDateTime", + "PlainMonthDay", + "PlainTime", + "PlainYearMonth", + "PlatformArch", + "PlatformInfo", + "PlatformNaclArch", + "PlatformOs", "Plugin", "PluginArray", "PluralRules", "PointerEvent", "PopStateEvent", "PopupBlockedEvent", + "Port", "Presentation", "PresentationAvailability", "PresentationConnection", @@ -1814,22 +1997,28 @@ "PresentationConnectionList", "PresentationReceiver", "PresentationRequest", + "PressureObserver", + "PressureRecord", "ProcessingInstruction", + "Profiler", "ProgressEvent", "Promise", "PromiseRejectionEvent", "PropertyNodeList", + "ProtectedAudience", "Proxy", "PublicKeyCredential", "PushManager", "PushSubscription", "PushSubscriptionOptions", "Q", + "QUERY_RESOLVE", "QUERY_RESULT", "QUERY_RESULT_AVAILABLE", "QUOTA_ERR", "QUOTA_EXCEEDED_ERR", "QueryInterface", + "QuotaExceededError", "R11F_G11F_B10F", "R16F", "R16I", @@ -1842,6 +2031,7 @@ "R8UI", "R8_SNORM", "RASTERIZER_DISCARD", + "READ", "READ_BUFFER", "READ_FRAMEBUFFER", "READ_FRAMEBUFFER_BINDING", @@ -1871,6 +2061,7 @@ "RENDERING_INTENT_RELATIVE_COLORIMETRIC", "RENDERING_INTENT_SATURATION", "RENDERING_INTENT_UNKNOWN", + "RENDER_ATTACHMENT", "REPEAT", "REPLACE", "RG", @@ -1924,6 +2115,8 @@ "RTCDataChannel", "RTCDataChannelEvent", "RTCDtlsTransport", + "RTCEncodedAudioFrame", + "RTCEncodedVideoFrame", "RTCError", "RTCErrorEvent", "RTCIceCandidate", @@ -1932,6 +2125,7 @@ "RTCPeerConnectionIceErrorEvent", "RTCPeerConnectionIceEvent", "RTCRtpReceiver", + "RTCRtpScriptTransform", "RTCRtpSender", "RTCRtpTransceiver", "RTCSctpTransport", @@ -1942,7 +2136,11 @@ "Range", "RangeError", "RangeException", + "ReadableByteStreamController", "ReadableStream", + "ReadableStreamBYOBReader", + "ReadableStreamBYOBRequest", + "ReadableStreamDefaultController", "ReadableStreamDefaultReader", "RecordErrorEvent", "Rect", @@ -1956,10 +2154,12 @@ "ReportBody", "ReportingObserver", "Request", + "RequestUpdateCheckStatus", "ResizeObserver", "ResizeObserverEntry", "ResizeObserverSize", "Response", + "RestrictionTarget", "RuntimeError", "SAMPLER_2D", "SAMPLER_2D_ARRAY", @@ -2051,6 +2251,8 @@ "STENCIL_TEST", "STENCIL_VALUE_MASK", "STENCIL_WRITEMASK", + "STORAGE", + "STORAGE_BINDING", "STREAM_COPY", "STREAM_DRAW", "STREAM_READ", @@ -2253,6 +2455,7 @@ "SVG_FECOMPOSITE_OPERATOR_ARITHMETIC", "SVG_FECOMPOSITE_OPERATOR_ATOP", "SVG_FECOMPOSITE_OPERATOR_IN", + "SVG_FECOMPOSITE_OPERATOR_LIGHTER", "SVG_FECOMPOSITE_OPERATOR_OUT", "SVG_FECOMPOSITE_OPERATOR_OVER", "SVG_FECOMPOSITE_OPERATOR_UNKNOWN", @@ -2274,6 +2477,7 @@ "SVG_MARKERUNITS_USERSPACEONUSE", "SVG_MARKER_ORIENT_ANGLE", "SVG_MARKER_ORIENT_AUTO", + "SVG_MARKER_ORIENT_AUTO_START_REVERSE", "SVG_MARKER_ORIENT_UNKNOWN", "SVG_MASKTYPE_ALPHA", "SVG_MASKTYPE_LUMINANCE", @@ -2337,15 +2541,23 @@ "SYNC_STATUS", "SYNTAX_ERR", "SavedPages", + "Scheduler", + "Scheduling", "Screen", + "ScreenDetailed", + "ScreenDetails", "ScreenOrientation", "Script", "ScriptProcessorNode", "ScrollAreaEvent", + "ScrollTimeline", "SecurityPolicyViolationEvent", + "Segmenter", "Selection", "Sensor", "SensorErrorEvent", + "Serial", + "SerialPort", "ServiceWorker", "ServiceWorkerContainer", "ServiceWorkerRegistration", @@ -2353,10 +2565,25 @@ "Set", "ShadowRoot", "SharedArrayBuffer", + "SharedStorage", + "SharedStorageAppendMethod", + "SharedStorageClearMethod", + "SharedStorageDeleteMethod", + "SharedStorageModifierMethod", + "SharedStorageSetMethod", + "SharedStorageWorklet", "SharedWorker", + "SharingState", "SimpleGestureEvent", + "SnapEvent", "SourceBuffer", "SourceBufferList", + "SpeechGrammar", + "SpeechGrammarList", + "SpeechRecognition", + "SpeechRecognitionErrorEvent", + "SpeechRecognitionEvent", + "SpeechRecognitionPhrase", "SpeechSynthesis", "SpeechSynthesisErrorEvent", "SpeechSynthesisEvent", @@ -2366,6 +2593,8 @@ "StereoPannerNode", "StopIteration", "Storage", + "StorageBucket", + "StorageBucketManager", "StorageEvent", "StorageManager", "String", @@ -2375,10 +2604,17 @@ "StyleSheet", "StyleSheetList", "SubmitEvent", + "Subscriber", "SubtleCrypto", + "Summarizer", + "SuppressedError", + "SuspendError", + "Suspending", "Symbol", "SyncManager", "SyntaxError", + "TAB_ID_NONE", + "TAB_INDEX_NONE", "TEMPORARY", "TEXTPATH_METHODTYPE_ALIGN", "TEXTPATH_METHODTYPE_STRETCH", @@ -2423,6 +2659,7 @@ "TEXTURE_2D_ARRAY", "TEXTURE_3D", "TEXTURE_BASE_LEVEL", + "TEXTURE_BINDING", "TEXTURE_BINDING_2D", "TEXTURE_BINDING_2D_ARRAY", "TEXTURE_BINDING_3D", @@ -2475,27 +2712,40 @@ "TYPE_NAVIGATE", "TYPE_RELOAD", "TYPE_RESERVED", + "Tab", + "TabStatus", "Table", + "Tag", "TaskAttributionTiming", + "TaskController", + "TaskPriorityChangeEvent", + "TaskSignal", + "Temporal", "Text", "TextDecoder", "TextDecoderStream", "TextEncoder", "TextEncoderStream", "TextEvent", + "TextFormat", + "TextFormatUpdateEvent", "TextMetrics", "TextTrack", "TextTrackCue", "TextTrackCueList", "TextTrackList", + "TextUpdateEvent", "TimeEvent", "TimeRanges", + "ToggleEvent", "Touch", "TouchEvent", "TouchList", "TrackEvent", "TransformStream", + "TransformStreamDefaultController", "TransitionEvent", + "Translator", "TreeWalker", "TrustedHTML", "TrustedScript", @@ -2507,6 +2757,7 @@ "U2F", "UIEvent", "UNCACHED", + "UNIFORM", "UNIFORM_ARRAY_STRIDE", "UNIFORM_BLOCK_ACTIVE_UNIFORMS", "UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES", @@ -2565,6 +2816,7 @@ "UPDATEREADY", "URIError", "URL", + "URLPattern", "URLSearchParams", "URLUnencoded", "URL_MISMATCH_ERR", @@ -2586,6 +2838,8 @@ "Uint32Array", "Uint8Array", "Uint8ClampedArray", + "UpdateFilter", + "UpdatePropertyName", "UserActivation", "UserMessageHandler", "UserMessageHandlersNamespace", @@ -2597,6 +2851,7 @@ "VERSION", "VERSION_CHANGE", "VERSION_ERR", + "VERTEX", "VERTEX_ARRAY_BINDING", "VERTEX_ATTRIB_ARRAY_BUFFER_BINDING", "VERTEX_ATTRIB_ARRAY_DIVISOR", @@ -2625,14 +2880,30 @@ "VTTCue", "VTTRegion", "ValidityState", + "VideoColorSpace", + "VideoDecoder", + "VideoEncoder", + "VideoFrame", "VideoPlaybackQuality", "VideoStreamTrack", + "ViewTimeline", + "ViewTransition", + "ViewTransitionTypeSet", + "ViewType", + "Viewport", + "VirtualKeyboard", + "VirtualKeyboardGeometryChangeEvent", + "VisibilityStateEntry", "VisualViewport", "WAIT_FAILED", "WEBKIT_FILTER_RULE", "WEBKIT_KEYFRAMES_RULE", "WEBKIT_KEYFRAME_RULE", "WEBKIT_REGION_RULE", + "WGSLLanguageFeatures", + "WINDOW_ID_CURRENT", + "WINDOW_ID_NONE", + "WRITE", "WRONG_DOCUMENT_ERR", "WakeLock", "WakeLockSentinel", @@ -2647,6 +2918,7 @@ "WebGLBuffer", "WebGLContextEvent", "WebGLFramebuffer", + "WebGLObject", "WebGLProgram", "WebGLQuery", "WebGLRenderbuffer", @@ -2685,6 +2957,14 @@ "WebKitSourceBufferList", "WebKitTransitionEvent", "WebSocket", + "WebSocketError", + "WebSocketStream", + "WebTransport", + "WebTransportBidirectionalStream", + "WebTransportDatagramDuplexStream", + "WebTransportError", + "WebTransportReceiveStream", + "WebTransportSendStream", "WebkitAlignContent", "WebkitAlignItems", "WebkitAlignSelf", @@ -2716,6 +2996,7 @@ "WebkitBoxPack", "WebkitBoxShadow", "WebkitBoxSizing", + "WebkitClipPath", "WebkitFilter", "WebkitFlex", "WebkitFlexBasis", @@ -2724,6 +3005,7 @@ "WebkitFlexGrow", "WebkitFlexShrink", "WebkitFlexWrap", + "WebkitFontFeatureSettings", "WebkitJustifyContent", "WebkitLineClamp", "WebkitMask", @@ -2740,6 +3022,7 @@ "WebkitPerspective", "WebkitPerspectiveOrigin", "WebkitTextFillColor", + "WebkitTextSecurity", "WebkitTextSizeAdjust", "WebkitTextStroke", "WebkitTextStrokeColor", @@ -2755,9 +3038,14 @@ "WebkitUserSelect", "WheelEvent", "Window", + "WindowControlsOverlay", + "WindowControlsOverlayGeometryChangeEvent", + "WindowState", + "WindowType", "Worker", "Worklet", "WritableStream", + "WritableStreamDefaultController", "WritableStreamDefaultWriter", "XMLDocument", "XMLHttpRequest", @@ -2772,16 +3060,26 @@ "XPathExpression", "XPathNSResolver", "XPathResult", + "XRAnchor", + "XRAnchorSet", "XRBoundedReferenceSpace", + "XRCPUDepthInformation", + "XRCamera", "XRDOMOverlayState", + "XRDepthInformation", "XRFrame", + "XRHand", "XRHitTestResult", "XRHitTestSource", "XRInputSource", "XRInputSourceArray", "XRInputSourceEvent", "XRInputSourcesChangeEvent", + "XRJointPose", + "XRJointSpace", "XRLayer", + "XRLightEstimate", + "XRLightProbe", "XRPose", "XRRay", "XRReferenceSpace", @@ -2797,11 +3095,19 @@ "XRView", "XRViewerPose", "XRViewport", + "XRWebGLBinding", + "XRWebGLDepthInformation", "XRWebGLLayer", "XSLTProcessor", "ZERO", + "ZonedDateTime", + "ZoomSettings", + "ZoomSettingsMode", + "ZoomSettingsScope", "_XD0M_", "_YD0M_", + "__REACT_DEVTOOLS_GLOBAL_HOOK__", + "__brand", "__defineGetter__", "__defineSetter__", "__lookupGetter__", @@ -2814,14 +3120,18 @@ "abbr", "abort", "aborted", + "aboutConfigPrefs", "abs", "absolute", "acceleration", "accelerationIncludingGravity", "accelerator", + "accent-color", + "accentColor", "accept", "acceptCharset", "acceptNode", + "access", "accessKey", "accessKeyLabel", "accuracy", @@ -2831,6 +3141,8 @@ "actionURL", "actions", "activated", + "activation", + "activationStart", "active", "activeCues", "activeElement", @@ -2838,10 +3150,15 @@ "activeSourceCount", "activeTexture", "activeVRDisplays", + "activeViewTransition", + "activityLog", "actualBoundingBoxAscent", "actualBoundingBoxDescent", "actualBoundingBoxLeft", "actualBoundingBoxRight", + "adAuctionComponents", + "adAuctionHeaders", + "adapterInfo", "add", "addAll", "addBehavior", @@ -2867,6 +3184,7 @@ "addSearchEngine", "addSourceBuffer", "addStream", + "addTeardown", "addTextTrack", "addTrack", "addTransceiver", @@ -2878,11 +3196,17 @@ "addons", "address", "addressLine", + "addressModeU", + "addressModeV", + "addressModeW", + "adopt", "adoptNode", + "adoptedCallback", "adoptedStyleSheets", "adr", "advance", "after", + "alarms", "album", "alert", "algorithm", @@ -2897,6 +3221,7 @@ "alinkColor", "all", "allSettled", + "allocationSize", "allow", "allowFullscreen", "allowPaymentRequest", @@ -2905,6 +3230,9 @@ "allowedToPlay", "allowsFeature", "alpha", + "alphaMode", + "alphaToCoverageEnabled", + "alphabeticBaseline", "alt", "altGraphKey", "altHtml", @@ -2915,11 +3243,15 @@ "alternates", "altitude", "altitudeAccuracy", + "altitudeAngle", "amplitude", "ancestorOrigins", "anchor", + "anchorName", "anchorNode", "anchorOffset", + "anchorScope", + "anchorSpace", "anchors", "and", "angle", @@ -2927,11 +3259,13 @@ "angularVelocity", "animVal", "animate", + "animated", "animatedInstanceRoot", "animatedNormalizedPathSegList", "animatedPathSegList", "animatedPoints", "animation", + "animation-composition", "animation-delay", "animation-direction", "animation-duration", @@ -2940,6 +3274,7 @@ "animation-name", "animation-play-state", "animation-timing-function", + "animationComposition", "animationDelay", "animationDirection", "animationDuration", @@ -2951,6 +3286,7 @@ "animationTimingFunction", "animationsPaused", "anniversary", + "annotation", "antialias", "anticipatedRemoval", "any", @@ -2980,30 +3316,45 @@ "applyElement", "arc", "arcTo", + "arch", + "architecture", "archive", "areas", "arguments", + "ariaActiveDescendantElement", "ariaAtomic", "ariaAutoComplete", + "ariaBrailleLabel", + "ariaBrailleRoleDescription", "ariaBusy", "ariaChecked", "ariaColCount", "ariaColIndex", + "ariaColIndexText", "ariaColSpan", + "ariaControlsElements", "ariaCurrent", + "ariaDescribedByElements", "ariaDescription", + "ariaDetailsElements", "ariaDisabled", + "ariaErrorMessageElements", "ariaExpanded", + "ariaFlowToElements", "ariaHasPopup", "ariaHidden", + "ariaInvalid", "ariaKeyShortcuts", "ariaLabel", + "ariaLabelledByElements", "ariaLevel", "ariaLive", "ariaModal", "ariaMultiLine", "ariaMultiSelectable", + "ariaNotify", "ariaOrientation", + "ariaOwnsElements", "ariaPlaceholder", "ariaPosInSet", "ariaPressed", @@ -3013,6 +3364,7 @@ "ariaRoleDescription", "ariaRowCount", "ariaRowIndex", + "ariaRowIndexText", "ariaRowSpan", "ariaSelected", "ariaSetSize", @@ -3022,20 +3374,28 @@ "ariaValueNow", "ariaValueText", "arrayBuffer", + "arrayLayerCount", + "arrayStride", "artist", "artwork", "as", "asIntN", "asUintN", + "ascentOverride", "asin", "asinh", + "aspect", + "aspect-ratio", + "aspectRatio", "assert", "assign", "assignedElements", "assignedNodes", "assignedSlot", "async", + "asyncDispose", "asyncIterator", + "at", "atEnd", "atan", "atan2", @@ -3045,11 +3405,13 @@ "attachInternals", "attachShader", "attachShadow", + "attachedElements", "attachments", "attack", "attestationObject", "attrChange", "attrName", + "attributeChangedCallback", "attributeFilter", "attributeName", "attributeNamespace", @@ -3057,10 +3419,13 @@ "attributeStyleMap", "attributes", "attribution", + "attributionSrc", + "audioBitrateMode", "audioBitsPerSecond", "audioTracks", "audioWorklet", "authenticatedSignedWrites", + "authenticatorAttachment", "authenticatorData", "autoIncrement", "autobuffer", @@ -3076,14 +3441,19 @@ "availWidth", "availability", "available", + "averageLatency", "aversion", "ax", "axes", "axis", "ay", "azimuth", + "azimuthAngle", "b", "back", + "backdrop-filter", + "backdropFilter", + "backends", "backface-visibility", "backfaceVisibility", "background", @@ -3113,23 +3483,33 @@ "badInput", "badge", "balance", + "baseArrayLayer", "baseFrequencyX", "baseFrequencyY", "baseLatency", "baseLayer", + "baseMipLevel", "baseNode", "baseOffset", + "basePalette", "baseURI", "baseVal", + "baseline-source", "baselineShift", + "baselineSource", + "batchUpdate", "battery", "bday", "before", + "beginComputePass", "beginElement", "beginElementAt", + "beginOcclusionQuery", "beginPath", "beginQuery", + "beginRenderPass", "beginTransformFeedback", + "beginningOfPassWriteIndex", "behavior", "behaviorCookie", "behaviorPart", @@ -3149,11 +3529,15 @@ "bindBufferBase", "bindBufferRange", "bindFramebuffer", + "bindGroupLayouts", "bindRenderbuffer", "bindSampler", "bindTexture", "bindTransformFeedback", "bindVertexArray", + "binding", + "bitness", + "blend", "blendColor", "blendEquation", "blendEquationSeparate", @@ -3166,6 +3550,9 @@ "blockDirection", "blockSize", "blockedURI", + "blockedURL", + "blocking", + "blockingDuration", "blue", "bluetooth", "blur", @@ -3174,6 +3561,7 @@ "bold", "bookmarks", "booleanValue", + "boost", "border", "border-block", "border-block-color", @@ -3305,6 +3693,7 @@ "boundingClientRect", "boundingHeight", "boundingLeft", + "boundingRect", "boundingTop", "boundingWidth", "bounds", @@ -3315,6 +3704,8 @@ "boxDecorationBreak", "boxShadow", "boxSizing", + "brand", + "brands", "break-after", "break-before", "break-inside", @@ -3322,7 +3713,11 @@ "breakBefore", "breakInside", "broadcast", + "browser", "browserLanguage", + "browserSettings", + "browsingData", + "browsingTopics", "btoa", "bubbles", "buffer", @@ -3333,28 +3728,42 @@ "buffered", "bufferedAmount", "bufferedAmountLowThreshold", + "buffers", "buildID", "buildNumber", "button", "buttonID", "buttons", + "byobRequest", "byteLength", "byteOffset", + "bytes", + "bytesPerRow", "bytesWritten", "c", "cache", "caches", "call", "caller", + "camera", "canBeFormatted", "canBeMounted", "canBeShared", + "canConstructInDedicatedWorker", + "canGoBack", + "canGoForward", "canHaveChildren", "canHaveHTML", "canInsertDTMF", + "canIntercept", + "canLoadAdAuctionFencedFrame", + "canLoadOpaqueURL", "canMakePayment", + "canParse", "canPlayType", "canPresent", + "canShare", + "canTransition", "canTrickleIceCandidates", "cancel", "cancelAndHoldAtTime", @@ -3368,14 +3777,18 @@ "candidate", "canonicalUUID", "canvas", + "cap", "capabilities", "caption", "caption-side", "captionSide", + "captivePortal", "capture", "captureEvents", "captureStackTrace", "captureStream", + "captureTab", + "captureVisibleTab", "caret-color", "caretBidiLevel", "caretColor", @@ -3396,29 +3809,36 @@ "chain", "challenge", "changeType", + "changed", "changedTouches", "channel", "channelCount", "channelCountMode", "channelInterpretation", + "chapterInfo", "char", "charAt", "charCode", "charCodeAt", "charIndex", "charLength", + "characterBounds", + "characterBoundsRangeStart", "characterData", "characterDataOldValue", "characterSet", + "characterVariant", "characteristic", "charging", "chargingTime", "charset", "check", + "checkDCE", "checkEnclosure", "checkFramebufferStatus", "checkIntersection", "checkValidity", + "checkVisibility", "checked", "childElementCount", "childList", @@ -3436,6 +3856,7 @@ "clear", "clearAppBadge", "clearAttributes", + "clearBuffer", "clearBufferfi", "clearBufferfv", "clearBufferiv", @@ -3450,12 +3871,14 @@ "clearMarks", "clearMaxGCPauseAccumulator", "clearMeasures", + "clearOriginJoinedAdInterestGroups", "clearParameters", "clearRect", "clearResourceTimings", "clearShadow", "clearStencil", "clearTimeout", + "clearValue", "clearWatch", "click", "clickCount", @@ -3482,13 +3905,16 @@ "clipTop", "clipboard", "clipboardData", + "clonable", "clone", "cloneContents", "cloneNode", "cloneRange", "close", + "closeCode", "closePath", "closed", + "closedBy", "closest", "clz", "clz32", @@ -3498,22 +3924,31 @@ "codeBase", "codePointAt", "codeType", + "codedHeight", + "codedRect", + "codedWidth", "colSpan", "collapse", "collapseToEnd", "collapseToStart", "collapsed", "collect", + "collections", "colno", "color", "color-adjust", "color-interpolation", "color-interpolation-filters", + "color-scheme", "colorAdjust", + "colorAttachments", "colorDepth", + "colorFormats", "colorInterpolation", "colorInterpolationFilters", "colorMask", + "colorScheme", + "colorSpace", "colorType", "cols", "column-count", @@ -3537,11 +3972,16 @@ "columnWidth", "columns", "command", + "commandForElement", + "commands", "commit", + "commitLoadTime", "commitPreferences", "commitStyles", + "committed", "commonAncestorContainer", "compact", + "compare", "compareBoundaryPoints", "compareDocumentPosition", "compareEndPoints", @@ -3554,6 +3994,7 @@ "compileShader", "compileStreaming", "complete", + "completed", "component", "componentFromPoint", "composed", @@ -3565,58 +4006,92 @@ "compressedTexImage3D", "compressedTexSubImage2D", "compressedTexSubImage3D", + "compute", "computedStyleMap", "concat", "conditionText", "coneInnerAngle", "coneOuterAngle", "coneOuterGain", + "config", + "configURL", + "configurable", "configuration", "configurationName", "configurationValue", "configurations", + "configure", "confirm", "confirmComposition", "confirmSiteSpecificTrackingException", "confirmWebWideTrackingException", + "congestionControl", "connect", "connectEnd", + "connectNative", "connectShark", "connectStart", "connected", + "connectedCallback", + "connectedMoveCallback", "connection", + "connectionInfo", "connectionList", "connectionSpeed", "connectionState", "connections", "console", "consolidate", + "constants", "constraint", "constrictionActive", "construct", "constructor", "contactID", "contain", + "contain-intrinsic-block-size", + "contain-intrinsic-height", + "contain-intrinsic-inline-size", + "contain-intrinsic-size", + "contain-intrinsic-width", + "containIntrinsicBlockSize", + "containIntrinsicHeight", + "containIntrinsicInlineSize", + "containIntrinsicSize", + "containIntrinsicWidth", + "container", + "container-name", + "container-type", "containerId", "containerName", + "containerQuery", "containerSrc", "containerType", "contains", "containsNode", "content", + "content-visibility", "contentBoxSize", "contentDocument", "contentEditable", + "contentEncoding", "contentHint", "contentOverflow", "contentRect", "contentScriptType", "contentStyleType", "contentType", + "contentVisibility", "contentWindow", "context", + "contextId", + "contextIds", "contextMenu", + "contextMenus", + "contextType", + "contextTypes", "contextmenu", + "contextualIdentities", "continue", "continuePrimaryKey", "continuous", @@ -3633,12 +4108,20 @@ "convertToSpecifiedUnits", "cookie", "cookieEnabled", + "cookieStore", + "cookies", "coords", "copyBufferSubData", + "copyBufferToBuffer", + "copyBufferToTexture", + "copyExternalImageToTexture", "copyFromChannel", "copyTexImage2D", "copyTexSubImage2D", "copyTexSubImage3D", + "copyTextureToBuffer", + "copyTextureToTexture", + "copyTo", "copyToChannel", "copyWithin", "correspondingElement", @@ -3657,11 +4140,22 @@ "country", "cpuClass", "cpuSleepAllowed", + "cqb", + "cqh", + "cqi", + "cqmax", + "cqmin", + "cqw", "create", "createAnalyser", + "createAnchor", "createAnswer", "createAttribute", "createAttributeNS", + "createAuctionNonce", + "createBidirectionalStream", + "createBindGroup", + "createBindGroupLayout", "createBiquadFilter", "createBuffer", "createBufferSource", @@ -3670,7 +4164,11 @@ "createCaption", "createChannelMerger", "createChannelSplitter", + "createCommandEncoder", "createComment", + "createComputePipeline", + "createComputePipelineAsync", + "createConicGradient", "createConstantSource", "createContextualFragment", "createControlRange", @@ -3685,6 +4183,7 @@ "createDynamicsCompressor", "createElement", "createElementNS", + "createEncodedStreams", "createEntityReference", "createEvent", "createEventObject", @@ -3717,15 +4216,20 @@ "createPanner", "createPattern", "createPeriodicWave", + "createPipelineLayout", "createPolicy", "createPopup", "createProcessingInstruction", "createProgram", "createQuery", + "createQuerySet", "createRadialGradient", "createRange", "createRangeCollection", "createReader", + "createRenderBundleEncoder", + "createRenderPipeline", + "createRenderPipelineAsync", "createRenderbuffer", "createSVGAngle", "createSVGLength", @@ -3760,12 +4264,14 @@ "createScriptURL", "createSession", "createShader", + "createShaderModule", "createShadowRoot", "createStereoPanner", "createStyleSheet", "createTBody", "createTFoot", "createTHead", + "createTask", "createTextNode", "createTextRange", "createTexture", @@ -3773,10 +4279,17 @@ "createTouchList", "createTransformFeedback", "createTreeWalker", + "createUnidirectionalStream", "createVertexArray", + "createView", "createWaveShaper", + "createWorklet", + "createWritable", "creationTime", + "credentialless", "credentials", + "criticalCHRestart", + "cropTo", "crossOrigin", "crossOriginIsolated", "crypto", @@ -3790,13 +4303,17 @@ "ctrlLeft", "cues", "cullFace", + "cullMode", + "currentCSSZoom", "currentDirection", + "currentEntry", "currentLocalDescription", "currentNode", "currentPage", "currentRect", "currentRemoteDescription", "currentScale", + "currentScreen", "currentScript", "currentSrc", "currentState", @@ -3822,19 +4339,23 @@ "dataTransfer", "database", "databases", + "datagrams", "dataset", "dateTime", "db", "debug", "debuggerEnabled", + "declarativeNetRequest", "declare", "decode", "decodeAudioData", + "decodeQueueSize", "decodeURI", "decodeURIComponent", "decodedBodySize", "decoding", "decodingInfo", + "decreaseZoomLevel", "decrypt", "default", "defaultCharset", @@ -3843,6 +4364,7 @@ "defaultPlaybackRate", "defaultPolicy", "defaultPrevented", + "defaultQueue", "defaultRequest", "defaultSelected", "defaultStatus", @@ -3886,37 +4408,66 @@ "deleteTexture", "deleteTransformFeedback", "deleteVertexArray", + "deleted", "deliverChangeRecords", + "deliveredFrames", + "deliveredFramesDuration", "delivery", "deliveryInfo", "deliveryStatus", "deliveryTimestamp", + "deliveryType", "delta", "deltaMode", "deltaX", "deltaY", "deltaZ", "dependentLocality", + "deprecatedReplaceInURN", + "deprecatedRunAdAuctionEnforcesKAnonymity", + "deprecatedURNToURL", + "depthActive", + "depthBias", + "depthBiasClamp", + "depthBiasSlopeScale", + "depthClearValue", + "depthCompare", + "depthDataFormat", + "depthFailOp", "depthFar", "depthFunc", + "depthLoadOp", "depthMask", "depthNear", + "depthOrArrayLayers", "depthRange", + "depthReadOnly", + "depthStencil", + "depthStencilAttachment", + "depthStencilFormat", + "depthStoreOp", + "depthType", + "depthUsage", + "depthWriteEnabled", "deref", "deriveBits", "deriveKey", + "descentOverride", "description", "deselectAll", "designMode", "desiredSize", "destination", "destinationURL", + "destroy", "detach", "detachEvent", "detachShader", + "detached", "detail", "details", "detect", + "detectLanguage", "detune", "device", "deviceClass", @@ -3924,6 +4475,7 @@ "deviceMemory", "devicePixelContentBoxSize", "devicePixelRatio", + "devicePosture", "deviceProtocol", "deviceSubclass", "deviceVersionMajor", @@ -3931,9 +4483,13 @@ "deviceVersionSubminor", "deviceXDPI", "deviceYDPI", + "devtools", + "devtools_panels", "didTimeout", + "difference", "diffuseConstant", "digest", + "dimension", "dimensions", "dir", "dirName", @@ -3944,31 +4500,52 @@ "disableRemotePlayback", "disableVertexAttribArray", "disabled", + "discard", + "discardedFrames", "dischargingTime", "disconnect", "disconnectShark", + "disconnectedCallback", "dispatchEvent", + "dispatchWorkgroups", + "dispatchWorkgroupsIndirect", "display", + "displayHeight", "displayId", "displayName", + "displayWidth", + "dispose", + "disposeAsync", + "disposed", "disposition", "distanceModel", "div", "divisor", "djsapi", "djsproxy", + "dns", "doImport", "doNotTrack", "doScroll", "doctype", "document", "documentElement", + "documentId", + "documentIds", + "documentLifecycle", "documentMode", + "documentOrigin", + "documentOrigins", + "documentPictureInPicture", "documentURI", + "documentURL", + "documentUrl", + "documentUrls", "dolphin", "dolphinGameCenter", "dolphininfo", "dolphinmeta", + "dom", "domComplete", "domContentLoadedEventEnd", "domContentLoadedEventStart", @@ -3986,13 +4563,16 @@ "downDegrees", "downlink", "download", + "downloadRequest", "downloadTotal", "downloaded", + "downloads", "dpcm", "dpi", "dppx", "dragDrop", "draggable", + "draw", "drawArrays", "drawArraysInstanced", "drawArraysInstancedANGLE", @@ -4004,30 +4584,48 @@ "drawFocusIfNeeded", "drawImage", "drawImageFromRect", + "drawIndexed", + "drawIndexedIndirect", + "drawIndirect", "drawRangeElements", "drawSystemFocusRing", + "drawingBufferColorSpace", + "drawingBufferFormat", "drawingBufferHeight", + "drawingBufferStorage", "drawingBufferWidth", + "drop", "dropEffect", "droppedVideoFrames", "dropzone", + "dstFactor", "dtmf", "dump", "dumpProfile", + "duplex", "duplicate", "durability", "duration", + "dvb", + "dvh", + "dvi", + "dvmax", + "dvmin", "dvname", "dvnum", + "dvw", "dx", "dy", + "dynamicId", "dynsrc", "e", "edgeMode", + "editContext", "effect", "effectAllowed", "effectiveDirective", "effectiveType", + "effects", "elapsedTime", "element", "elementFromPoint", @@ -4037,8 +4635,11 @@ "elevation", "ellipse", "em", + "emHeightAscent", + "emHeightDescent", "email", "embeds", + "emit", "emma", "empty", "empty-cells", @@ -4052,9 +4653,11 @@ "enableStyleSheetsForSet", "enableVertexAttribArray", "enabled", + "enabledFeatures", "enabledPlugin", "encode", "encodeInto", + "encodeQueueSize", "encodeURI", "encodeURIComponent", "encodedBodySize", @@ -4066,6 +4669,8 @@ "endContainer", "endElement", "endElementAt", + "endOcclusionQuery", + "endOfPassWriteIndex", "endOfStream", "endOffset", "endQuery", @@ -4076,10 +4681,14 @@ "endpointNumber", "endpoints", "endsWith", + "enqueue", "enterKeyHint", "entities", "entries", + "entry", + "entryPoint", "entryType", + "enumerable", "enumerate", "enumerateDevices", "enumerateEditable", @@ -4094,7 +4703,9 @@ "eval", "evaluate", "event", + "eventCounts", "eventPhase", + "events", "every", "ex", "exception", @@ -4103,6 +4714,8 @@ "execCommand", "execCommandShowHelp", "execScript", + "executeBundles", + "executionStart", "exitFullscreen", "exitPictureInPicture", "exitPointerLock", @@ -4112,6 +4725,10 @@ "expandEntityReferences", "expando", "expansion", + "expectedContextLanguages", + "expectedImprovement", + "expectedInputLanguages", + "experiments", "expiration", "expirationTime", "expires", @@ -4121,18 +4738,24 @@ "exponent", "exponentialRampToValueAtTime", "exportKey", + "exports", "extend", + "extension", + "extensionTypes", "extensions", "extentNode", "extentOffset", "external", "externalResourcesRequired", + "externalTexture", "extractContents", "extractable", "eye", "f", + "f16round", "face", "factoryReset", + "failOp", "failureReason", "fallback", "family", @@ -4144,8 +4767,11 @@ "featurePolicy", "featureSettings", "features", + "fence", "fenceSync", "fetch", + "fetchLater", + "fetchPriority", "fetchStart", "fftSize", "fgColor", @@ -4163,8 +4789,10 @@ "fill", "fill-opacity", "fill-rule", + "fillJointRadii", "fillLightMode", "fillOpacity", + "fillPoses", "fillRect", "fillRule", "fillStyle", @@ -4174,18 +4802,28 @@ "filterResY", "filterUnits", "filters", + "finalResponseHeadersStart", "finally", "find", "findIndex", + "findLast", + "findLastIndex", "findRule", "findText", "finish", + "finishDocumentLoadTime", + "finishLoadTime", "finished", "fireEvent", "firesTouchEvents", + "first", "firstChild", "firstElementChild", + "firstInterimResponseStart", "firstPage", + "firstPaintAfterLoadTime", + "firstPaintTime", + "firstUIEventTimestamp", "fixed", "flags", "flat", @@ -4203,6 +4841,7 @@ "flexGrow", "flexShrink", "flexWrap", + "flip", "flipX", "flipY", "float", @@ -4223,11 +4862,16 @@ "font-kerning", "font-language-override", "font-optical-sizing", + "font-palette", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-synthesis", + "font-synthesis-position", + "font-synthesis-small-caps", + "font-synthesis-style", + "font-synthesis-weight", "font-variant", "font-variant-alternates", "font-variant-caps", @@ -4237,21 +4881,29 @@ "font-variant-position", "font-variation-settings", "font-weight", + "fontBoundingBoxAscent", + "fontBoundingBoxDescent", "fontFamily", "fontFeatureSettings", "fontKerning", "fontLanguageOverride", "fontOpticalSizing", + "fontPalette", "fontSize", "fontSizeAdjust", "fontSmoothingEnabled", "fontStretch", "fontStyle", "fontSynthesis", + "fontSynthesisPosition", + "fontSynthesisSmallCaps", + "fontSynthesisStyle", + "fontSynthesisWeight", "fontVariant", "fontVariantAlternates", "fontVariantCaps", "fontVariantEastAsian", + "fontVariantEmoji", "fontVariantLigatures", "fontVariantNumeric", "fontVariantPosition", @@ -4264,7 +4916,12 @@ "for", "forEach", "force", + "forceFallbackAdapter", "forceRedraw", + "forced-color-adjust", + "forcedColorAdjust", + "forcedStyleAndLayoutDuration", + "forget", "form", "formAction", "formData", @@ -4276,15 +4933,20 @@ "formatToParts", "forms", "forward", + "forwardWheel", "forwardX", "forwardY", "forwardZ", "foundation", "fr", + "fragment", "fragmentDirective", "frame", "frameBorder", + "frameCount", "frameElement", + "frameId", + "frameIds", "frameSpacing", "framebuffer", "framebufferHeight", @@ -4298,31 +4960,39 @@ "frequency", "frequencyBinCount", "from", + "fromAsync", + "fromBase64", "fromCharCode", "fromCodePoint", "fromElement", "fromEntries", "fromFloat32Array", "fromFloat64Array", + "fromHex", "fromMatrix", "fromPoint", "fromQuad", "fromRect", "frontFace", "fround", + "fullName", "fullPath", + "fullRange", "fullScreen", + "fullVersionList", "fullscreen", "fullscreenElement", "fullscreenEnabled", "fx", "fy", + "g", "gain", "gamepad", "gamma", "gap", "gatheringState", "gatt", + "geckoProfiler", "genderIdentity", "generateCertificate", "generateKey", @@ -4331,6 +5001,7 @@ "geolocation", "gestureObject", "get", + "getAcceptLanguages", "getActiveAttrib", "getActiveUniform", "getActiveUniformBlockName", @@ -4339,10 +5010,12 @@ "getAdjacentText", "getAll", "getAllKeys", + "getAllRecords", "getAllResponseHeaders", "getAllowlistForFeature", "getAnimations", "getAsFile", + "getAsFileSystemHandle", "getAsString", "getAttachedShaders", "getAttribLocation", @@ -4353,33 +5026,46 @@ "getAttributeNodeNS", "getAttributeType", "getAudioTracks", + "getAuthenticatorData", + "getAutoplayPolicy", "getAvailability", "getBBox", + "getBackgroundPage", + "getBadgeBackgroundColor", + "getBadgeText", + "getBadgeTextColor", "getBattery", "getBigInt64", "getBigUint64", + "getBindGroupLayout", "getBlob", "getBookmark", "getBoundingClientRect", "getBounds", "getBoxQuads", + "getBrowserInfo", "getBufferParameter", "getBufferSubData", "getByteFrequencyData", "getByteTimeDomainData", "getCSSCanvasContext", "getCTM", + "getCameraImage", "getCandidateWindowClientRect", "getCanonicalLocales", "getCapabilities", + "getCaptureHandle", "getChannelData", "getCharNumAtPosition", "getCharacteristic", "getCharacteristics", + "getClientCapabilities", "getClientExtensionResults", "getClientRect", "getClientRects", "getCoalescedEvents", + "getCompilationInfo", + "getComposedRanges", "getCompositionAlternatives", "getComputedStyle", "getComputedTextLength", @@ -4388,22 +5074,28 @@ "getConstraints", "getContext", "getContextAttributes", + "getContexts", "getContributingSources", "getCounterValue", "getCueAsHTML", "getCueById", + "getCurrent", "getCurrentPosition", + "getCurrentTexture", "getCurrentTime", "getData", "getDatabaseNames", "getDate", "getDay", "getDefaultComputedStyle", + "getDepthInMeters", + "getDepthInformation", "getDescriptor", "getDescriptors", "getDestinationInsertionPoints", "getDevices", "getDirectory", + "getDirectoryHandle", "getDisplayMedia", "getDistributedNodes", "getEditable", @@ -4422,10 +5114,13 @@ "getExtentOfChar", "getEyeParameters", "getFeature", + "getFiberRoots", "getFile", + "getFileHandle", "getFiles", "getFilesAndDirectories", "getFingerprints", + "getFloat16", "getFloat32", "getFloat64", "getFloatFrequencyData", @@ -4433,10 +5128,14 @@ "getFloatValue", "getFragDataLocation", "getFrameData", + "getFrameId", "getFramebufferAttachmentParameter", "getFrequencyResponse", "getFullYear", "getGamepads", + "getHTML", + "getHeaderExtensionsToNegotiate", + "getHighEntropyValues", "getHitTestResults", "getHitTestResultsForTransientInput", "getHours", @@ -4444,38 +5143,54 @@ "getIds", "getImageData", "getIndexedParameter", + "getInfo", + "getInnerHTML", "getInstalledRelatedApps", "getInt16", "getInt32", "getInt8", + "getInterestGroupAdAuctionData", + "getInternalModuleRanges", "getInternalformatParameter", "getIntersectionList", "getItem", "getItems", + "getJointPose", "getKey", "getKeyframes", + "getLastFocused", "getLayers", "getLayoutMap", + "getLightEstimate", "getLineDash", "getLocalCandidates", "getLocalParameters", "getLocalStreams", + "getManagedConfiguration", + "getManifest", + "getMappedRange", "getMarks", "getMatchedCSSRules", "getMaxGCPauseSinceClear", "getMeasures", + "getMessage", "getMetadata", "getMilliseconds", "getMinutes", "getModifierState", "getMonth", + "getName", "getNamedItem", "getNamedItemNS", "getNativeFramebufferScaleFactor", + "getNegotiatedHeaderExtensions", + "getNestedConfigs", "getNotifications", "getNotifier", "getNumberOfChars", "getOffsetReferenceSpace", + "getOrInsert", + "getOrInsertComputed", "getOutputTimestamp", "getOverrideHistoryNavigationMode", "getOverrideStyle", @@ -4483,17 +5198,25 @@ "getOwnPropertyDescriptors", "getOwnPropertyNames", "getOwnPropertySymbols", + "getPackageDirectoryEntry", "getParameter", "getParameters", "getParent", + "getPathData", "getPathSegAtLength", + "getPathSegmentAtLength", + "getPermissionWarningsByManifest", "getPhotoCapabilities", "getPhotoSettings", + "getPlatformInfo", "getPointAtLength", + "getPopup", + "getPorts", "getPose", "getPredictedEvents", "getPreference", "getPreferenceDefault", + "getPreferredCanvasFormat", "getPresentationAttribute", "getPreventDefault", "getPrimaryService", @@ -4506,6 +5229,8 @@ "getPropertyType", "getPropertyValue", "getPrototypeOf", + "getPublicKey", + "getPublicKeyAlgorithm", "getQuery", "getQueryParameter", "getRGBColorValue", @@ -4514,6 +5239,7 @@ "getReader", "getReceivers", "getRectValue", + "getReflectionCubeMap", "getRegistration", "getRegistrations", "getRemoteCandidates", @@ -4528,16 +5254,20 @@ "getSVGDocument", "getSamplerParameter", "getScreenCTM", + "getScreenDetails", "getSeconds", "getSelectedCandidatePair", "getSelection", + "getSelf", "getSenders", "getService", + "getSetCookie", "getSettings", "getShaderInfoLog", "getShaderParameter", "getShaderPrecisionFormat", "getShaderSource", + "getSignals", "getSimpleDuration", "getSiteIcons", "getSources", @@ -4552,17 +5282,22 @@ "getStringValue", "getSubStringLength", "getSubscription", + "getSubscriptions", "getSupportedConstraints", "getSupportedExtensions", "getSupportedFormats", + "getSupportedZoomLevels", "getSyncParameter", "getSynchronizationSources", "getTags", "getTargetRanges", "getTexParameter", + "getTextFormats", "getTime", "getTimezoneOffset", "getTiming", + "getTitle", + "getTitlebarAreaRect", "getTotalLength", "getTrackById", "getTracks", @@ -4573,6 +5308,8 @@ "getTransports", "getType", "getTypeMapping", + "getUILanguage", + "getURL", "getUTCDate", "getUTCDay", "getUTCFullYear", @@ -4588,7 +5325,9 @@ "getUniformBlockIndex", "getUniformIndices", "getUniformLocation", + "getUserInfo", "getUserMedia", + "getUserSettings", "getVRDisplays", "getValues", "getVarDate", @@ -4599,19 +5338,26 @@ "getVideoTracks", "getViewerPose", "getViewport", + "getViews", "getVoices", "getWakeLockState", "getWriter", "getYear", + "getZoom", + "getZoomSettings", "givenName", "global", "globalAlpha", "globalCompositeOperation", + "globalPrivacyControl", "globalThis", "glyphOrientationHorizontal", "glyphOrientationVertical", "glyphRef", "go", + "goBack", + "goForward", + "gpu", "grabFrame", "grad", "gradientTransform", @@ -4655,12 +5401,19 @@ "gridTemplateRows", "gripSpace", "group", + "groupBy", "groupCollapsed", "groupEnd", "groupId", + "groups", + "grow", + "growable", + "guestProcessId", + "guestRenderFrameRoutingId", "hadRecentInput", "hand", "handedness", + "hangingBaseline", "hapticActuators", "hardwareConcurrency", "has", @@ -4670,30 +5423,45 @@ "hasBeenActive", "hasChildNodes", "hasComposition", + "hasDynamicOffset", "hasEnrolledInstrument", "hasExtension", "hasExternalDisplay", "hasFeature", "hasFocus", + "hasIndices", "hasInstance", "hasLayout", "hasOrientation", + "hasOwn", "hasOwnProperty", "hasPointerCapture", "hasPosition", + "hasPrivateToken", "hasReading", + "hasRedemptionRecord", + "hasRegExpGroups", "hasStorageAccess", + "hasUAVisualTransition", + "hasUnpartitionedCookieAccess", "hash", + "hashChange", "head", "headers", "heading", "height", + "hid", "hidden", "hide", "hideFocus", + "hidePopover", "high", "highWaterMark", + "highlight", + "highlights", + "highlightsFromPoint", "hint", + "hints", "history", "honorificPrefix", "honorificSuffix", @@ -4711,8 +5479,13 @@ "httpEquiv", "httpRequestStatusCode", "hwTimestamp", + "hyphenate-character", + "hyphenateCharacter", + "hyphenateLimitChars", "hyphens", "hypot", + "i18n", + "ic", "iccId", "iceConnectionState", "iceGatheringState", @@ -4722,10 +5495,13 @@ "id", "identifier", "identity", + "ideographicBaseline", + "idle", "idpLoginUrl", "ignoreBOM", "ignoreCase", "ignoreDepthValues", + "image", "image-orientation", "image-rendering", "imageHeight", @@ -4740,6 +5516,7 @@ "ime-mode", "imeMode", "implementation", + "importExternalTexture", "importKey", "importNode", "importStylesheet", @@ -4750,8 +5527,15 @@ "in1", "in2", "inBandMetadataTrackDispatchType", + "inIncognitoContext", "inRange", "includes", + "incognito", + "incomingBidirectionalStreams", + "incomingHighWaterMark", + "incomingMaxAge", + "incomingUnidirectionalStreams", + "increaseZoomLevel", "incremental", "indeterminate", "index", @@ -4759,9 +5543,12 @@ "indexOf", "indexedDB", "indicate", + "indices", + "inert", "inertiaDestinationX", "inertiaDestinationY", "info", + "inherits", "init", "initAnimationEvent", "initBeforeLoadEvent", @@ -4808,8 +5595,11 @@ "initWebKitWheelEvent", "initWheelEvent", "initialTime", + "initialValue", "initialize", "initiatorType", + "inject", + "ink", "inline-size", "inlineSize", "inlineVerticalFieldOfView", @@ -4823,6 +5613,7 @@ "inputEncoding", "inputMethod", "inputMode", + "inputQuota", "inputSource", "inputSources", "inputType", @@ -4834,6 +5625,7 @@ "insertCell", "insertDTMF", "insertData", + "insertDebugMarker", "insertItemBefore", "insertNode", "insertRow", @@ -4851,6 +5643,8 @@ "insetInline", "insetInlineEnd", "insetInlineStart", + "inspect", + "install", "installing", "instanceRoot", "instantiate", @@ -4860,8 +5654,11 @@ "int32", "int8", "integrity", + "interactionCount", + "interactionId", "interactionMode", "intercept", + "interestForElement", "interfaceClass", "interfaceName", "interfaceNumber", @@ -4871,6 +5668,7 @@ "interimResults", "internalSubset", "interpretation", + "intersection", "intersectionRatio", "intersectionRect", "intersectsNode", @@ -4880,11 +5678,16 @@ "invalidateSubFramebuffer", "inverse", "invertSelf", + "invoker", + "invokerType", "is", "is2D", "isActive", + "isAllowedFileSchemeAccess", + "isAllowedIncognitoAccess", "isAlternate", "isArray", + "isAutoSelected", "isBingCurrentSearchDefault", "isBuffer", "isCandidateWindowVisible", @@ -4892,6 +5695,8 @@ "isCollapsed", "isComposing", "isConcatSpreadable", + "isConditionalMediationAvailable", + "isConfigSupported", "isConnected", "isContentEditable", "isContentHandlerRegistered", @@ -4899,13 +5704,18 @@ "isDefaultNamespace", "isDirectory", "isDisabled", + "isDisjointFrom", "isEnabled", "isEqual", "isEqualNode", + "isError", + "isExtended", "isExtensible", "isExternalCTAP2SecurityKeySupported", + "isFallbackAdapter", "isFile", "isFinite", + "isFirstPersonObserver", "isFramebuffer", "isFrozen", "isGenerator", @@ -4914,7 +5724,9 @@ "isId", "isIdentity", "isInjected", + "isInputPending", "isInteger", + "isInternal", "isIntersecting", "isLockFree", "isMap", @@ -4933,8 +5745,10 @@ "isProtocolHandlerRegistered", "isPrototypeOf", "isQuery", + "isRawJSON", "isRenderbuffer", "isSafeInteger", + "isSameEntry", "isSameNode", "isSampler", "isScript", @@ -4943,6 +5757,8 @@ "isSecureContext", "isSessionSupported", "isShader", + "isSubsetOf", + "isSupersetOf", "isSupported", "isSync", "isTextEdit", @@ -4954,6 +5770,7 @@ "isVertexArray", "isView", "isVisible", + "isWellFormed", "isochronousTransferIn", "isochronousTransferOut", "isolation", @@ -4970,8 +5787,11 @@ "iterationComposite", "iterator", "javaEnabled", + "jitterBufferTarget", "jobTitle", "join", + "joinAdInterestGroup", + "jointName", "json", "justify-content", "justify-items", @@ -5005,14 +5825,17 @@ "keytype", "kind", "knee", + "knownSources", "label", "labels", "lang", "language", "languages", "largeArcFlag", + "last", "lastChild", "lastElementChild", + "lastError", "lastEventId", "lastIndex", "lastIndexOf", @@ -5026,9 +5849,13 @@ "lastParen", "lastState", "lastStyleSheetSet", + "latency", "latitude", + "launchQueue", + "layerName", "layerX", "layerY", + "layout", "layoutFlow", "layoutGrid", "layoutGridChar", @@ -5036,6 +5863,7 @@ "layoutGridMode", "layoutGridType", "lbound", + "leaveAdInterestGroup", "left", "leftContext", "leftDegrees", @@ -5048,9 +5876,11 @@ "letter-spacing", "letterSpacing", "level", + "lh", "lighting-color", "lightingColor", "limitingConeAngle", + "limits", "line", "line-break", "line-height", @@ -5058,9 +5888,12 @@ "lineBreak", "lineCap", "lineDashOffset", + "lineGapOverride", "lineHeight", "lineJoin", + "lineNum", "lineNumber", + "linePos", "lineTo", "lineWidth", "linearAcceleration", @@ -5082,9 +5915,11 @@ "listStylePosition", "listStyleType", "listener", + "listeners", "load", "loadEventEnd", "loadEventStart", + "loadOp", "loadTime", "loadTimes", "loaded", @@ -5101,12 +5936,16 @@ "locked", "lockedFile", "locks", + "lodMaxClamp", + "lodMinClamp", "log", "log10", "log1p", "log2", "logicalXDPI", "logicalYDPI", + "login", + "loglevel", "longDesc", "longitude", "lookupNamespaceURI", @@ -5115,11 +5954,18 @@ "loopEnd", "loopStart", "looping", + "lost", "low", "lower", "lowerBound", "lowerOpen", "lowsrc", + "lvb", + "lvh", + "lvi", + "lvmax", + "lvmin", + "lvw", "m11", "m12", "m13", @@ -5136,11 +5982,17 @@ "m42", "m43", "m44", + "magFilter", "makeXRCompatible", + "managed", + "management", "manifest", "manufacturer", "manufacturerName", "map", + "mapAsync", + "mapState", + "mappedAtCreation", "mapping", "margin", "margin-block", @@ -5208,7 +6060,13 @@ "matchAll", "matchMedia", "matchMedium", + "matchPatterns", "matches", + "math-depth", + "math-style", + "mathDepth", + "mathShift", + "mathStyle", "matrix", "matrixTransform", "max", @@ -5218,23 +6076,59 @@ "max-width", "maxActions", "maxAlternatives", + "maxAnisotropy", + "maxBindGroups", + "maxBindGroupsPlusVertexBuffers", + "maxBindingsPerBindGroup", "maxBlockSize", + "maxBufferSize", + "maxByteLength", "maxChannelCount", "maxChannels", + "maxColorAttachmentBytesPerSample", + "maxColorAttachments", + "maxComputeInvocationsPerWorkgroup", + "maxComputeWorkgroupSizeX", + "maxComputeWorkgroupSizeY", + "maxComputeWorkgroupSizeZ", + "maxComputeWorkgroupStorageSize", + "maxComputeWorkgroupsPerDimension", "maxConnectionsPerServer", + "maxDatagramSize", "maxDecibels", "maxDistance", + "maxDrawCount", + "maxDynamicStorageBuffersPerPipelineLayout", + "maxDynamicUniformBuffersPerPipelineLayout", "maxHeight", "maxInlineSize", + "maxInterStageShaderComponents", + "maxInterStageShaderVariables", "maxLayers", "maxLength", "maxMessageSize", "maxPacketLifeTime", "maxRetransmits", + "maxSampledTexturesPerShaderStage", + "maxSamplersPerShaderStage", + "maxStorageBufferBindingSize", + "maxStorageBuffersPerShaderStage", + "maxStorageTexturesPerShaderStage", + "maxTextureArrayLayers", + "maxTextureDimension1D", + "maxTextureDimension2D", + "maxTextureDimension3D", "maxTouchPoints", + "maxUniformBufferBindingSize", + "maxUniformBuffersPerShaderStage", "maxValue", + "maxVertexAttributes", + "maxVertexBufferArrayStride", + "maxVertexBuffers", "maxWidth", + "maximumLatency", "measure", + "measureInputUsage", "measureText", "media", "mediaCapabilities", @@ -5248,11 +6142,15 @@ "meetOrSlice", "memory", "menubar", + "menus", + "menusChild", + "menusInternal", "mergeAttributes", "message", "messageClass", "messageHandlers", "messageType", + "messages", "metaKey", "metadata", "method", @@ -5266,21 +6164,33 @@ "min-height", "min-inline-size", "min-width", + "minBindingSize", "minBlockSize", "minDecibels", + "minFilter", "minHeight", "minInlineSize", "minLength", + "minStorageBufferOffsetAlignment", + "minUniformBufferOffsetAlignment", "minValue", "minWidth", + "minimumLatency", + "mipLevel", + "mipLevelCount", + "mipmapFilter", "miterLimit", "mix-blend-mode", "mixBlendMode", "mm", + "mobile", "mode", + "model", "modify", + "module", "mount", "move", + "moveBefore", "moveBy", "moveEnd", "moveFirst", @@ -5288,6 +6198,7 @@ "moveFocusLeft", "moveFocusRight", "moveFocusUp", + "moveInSuccession", "moveNext", "moveRow", "moveStart", @@ -5529,16 +6440,25 @@ "multiple", "multiply", "multiplySelf", + "multisample", + "multisampled", "mutableFile", "muted", "n", + "nacl_arch", "name", + "nameList", "nameProp", "namedItem", "namedRecordset", "names", "namespaceURI", "namespaces", + "nativeApplication", + "nativeMap", + "nativeObjectCreate", + "nativeSet", + "nativeWeakMap", "naturalHeight", "naturalWidth", "navigate", @@ -5546,6 +6466,7 @@ "navigationMode", "navigationPreload", "navigationStart", + "navigationType", "navigator", "near", "nearestViewportElement", @@ -5553,7 +6474,9 @@ "negotiated", "netscape", "networkState", + "networkStatus", "newScale", + "newState", "newTranslate", "newURL", "newValue", @@ -5578,19 +6501,25 @@ "nodeType", "nodeValue", "nonce", + "normDepthBufferFromNormView", "normalize", "normalizedPathSegList", + "normandyAddonStudy", + "notRestoredReasons", "notationName", "notations", "note", "noteGrainOn", "noteOff", "noteOn", + "notifications", "notify", "now", + "npnNegotiatedProtocol", "numOctaves", "number", "numberOfChannels", + "numberOfFrames", "numberOfInputs", "numberOfItems", "numberOfOutputs", @@ -5605,12 +6534,16 @@ "objectStoreNames", "objectType", "observe", + "observedAttributes", + "occlusionQuerySet", "of", + "off", "offscreenBuffering", "offset", "offset-anchor", "offset-distance", "offset-path", + "offset-position", "offset-rotate", "offsetAnchor", "offsetDistance", @@ -5619,17 +6552,58 @@ "offsetNode", "offsetParent", "offsetPath", + "offsetPosition", "offsetRotate", "offsetTop", "offsetWidth", "offsetX", "offsetY", "ok", + "oldState", "oldURL", "oldValue", "oldVersion", "olderShadowRoot", + "omnibox", + "on", + "onActivated", + "onAdded", + "onAttached", + "onBoundsChanged", + "onBrowserUpdateAvailable", + "onClicked", + "onCommitFiberRoot", + "onCommitFiberUnmount", + "onConnect", + "onConnectExternal", + "onConnectNative", + "onCreated", + "onDetached", + "onDisabled", + "onEnabled", + "onFocusChanged", + "onHighlighted", + "onInstalled", "onLine", + "onMessage", + "onMessageExternal", + "onMoved", + "onPerformanceWarning", + "onPostCommitFiberRoot", + "onRemoved", + "onReplaced", + "onRestartRequired", + "onStartup", + "onSubmittedWorkDone", + "onSuspend", + "onSuspendCanceled", + "onUninstalled", + "onUpdateAvailable", + "onUpdated", + "onUserScriptConnect", + "onUserScriptMessage", + "onUserSettingsChanged", + "onZoomChange", "onabort", "onabsolutedeviceorientation", "onactivate", @@ -5656,10 +6630,13 @@ "onbeforecut", "onbeforedeactivate", "onbeforeeditfocus", + "onbeforeinput", "onbeforeinstallprompt", + "onbeforematch", "onbeforepaste", "onbeforeprint", "onbeforescriptexecute", + "onbeforetoggle", "onbeforeunload", "onbeforeupdate", "onbeforexrselect", @@ -5676,9 +6653,11 @@ "oncandidatewindowupdate", "oncanplay", "oncanplaythrough", + "oncapturehandlechange", "once", "oncellchange", "onchange", + "oncharacterboundsupdate", "oncharacteristicvaluechanged", "onchargingchange", "onchargingtimechange", @@ -5686,17 +6665,25 @@ "onclick", "onclose", "onclosing", + "oncommand", "oncompassneedscalibration", "oncomplete", + "oncompositionend", + "oncompositionstart", "onconnect", "onconnecting", "onconnectionavailable", "onconnectionstatechange", + "oncontentvisibilityautostatechange", + "oncontextlost", "oncontextmenu", + "oncontextrestored", "oncontrollerchange", "oncontrolselect", "oncopy", "oncuechange", + "oncurrententrychange", + "oncurrentscreenchange", "oncut", "ondataavailable", "ondatachannel", @@ -5704,6 +6691,7 @@ "ondatasetcomplete", "ondblclick", "ondeactivate", + "ondequeue", "ondevicechange", "ondevicelight", "ondevicemotion", @@ -5713,7 +6701,9 @@ "ondischargingtimechange", "ondisconnect", "ondisplay", + "ondispose", "ondownloading", + "ondownloadprogress", "ondrag", "ondragend", "ondragenter", @@ -5732,6 +6722,7 @@ "onerror", "onerrorupdate", "onexit", + "onfencedtreeclick", "onfilterchange", "onfinish", "onfocus", @@ -5741,8 +6732,11 @@ "onfreeze", "onfullscreenchange", "onfullscreenerror", + "ongamepadconnected", + "ongamepaddisconnected", "ongatheringstatechange", "ongattserverdisconnected", + "ongeometrychange", "ongesturechange", "ongestureend", "ongesturestart", @@ -5755,6 +6749,7 @@ "onicegatheringstatechange", "oninactive", "oninput", + "oninputreport", "oninputsourceschange", "oninvalid", "onkeydown", @@ -5766,6 +6761,7 @@ "onleavepictureinpicture", "onlevelchange", "onload", + "onloadT", "onloadeddata", "onloadedmetadata", "onloadend", @@ -5776,6 +6772,7 @@ "onlosecapture", "onlostpointercapture", "only", + "onmanagedconfigurationchange", "onmark", "onmessage", "onmessageerror", @@ -5823,6 +6820,9 @@ "onmssitemodejumplistitemremoved", "onmsthumbnailclick", "onmute", + "onnavigate", + "onnavigateerror", + "onnavigatesuccess", "onnegotiationneeded", "onnomatch", "onnoupdate", @@ -5833,7 +6833,9 @@ "onorientationchange", "onpagechange", "onpagehide", + "onpagereveal", "onpageshow", + "onpageswap", "onpaste", "onpause", "onpayerdetailchange", @@ -5853,12 +6855,15 @@ "onpointerrawupdate", "onpointerup", "onpopstate", + "onprerenderingchange", + "onprioritychange", "onprocessorerror", "onprogress", "onpropertychange", "onratechange", "onreading", "onreadystatechange", + "onreflectionchange", "onrejectionhandled", "onrelease", "onremove", @@ -5877,7 +6882,11 @@ "onrowexit", "onrowsdelete", "onrowsinserted", + "onscreenschange", "onscroll", + "onscrollend", + "onscrollsnapchange", + "onscrollsnapchanging", "onsearch", "onsecuritypolicyviolation", "onseeked", @@ -5891,6 +6900,8 @@ "onshippingoptionchange", "onshow", "onsignalingstatechange", + "onsinkchange", + "onslotchange", "onsoundend", "onsoundstart", "onsourceclose", @@ -5912,7 +6923,9 @@ "onsuccess", "onsuspend", "onterminate", + "ontextformatupdate", "ontextinput", + "ontextupdate", "ontimeout", "ontimeupdate", "ontoggle", @@ -5926,6 +6939,7 @@ "ontransitionend", "ontransitionrun", "ontransitionstart", + "onuncapturederror", "onunhandledrejection", "onunload", "onunmute", @@ -5966,14 +6980,19 @@ "onwebkittransitionend", "onwheel", "onzoom", + "onzoomlevelchange", "opacity", "open", "openCursor", "openDatabase", "openKeyCursor", + "openOptionsPage", + "openOrClosedShadowRoot", + "openPopup", "opened", "opener", "opera", + "operation", "operationType", "operator", "opr", @@ -5994,14 +7013,19 @@ "orientationY", "orientationZ", "origin", + "originAgentCluster", "originalPolicy", "originalTarget", + "ornaments", "orphans", + "os", "oscpu", "outerHTML", "outerHeight", "outerText", "outerWidth", + "outgoingHighWaterMark", + "outgoingMaxAge", "outline", "outline-color", "outline-offset", @@ -6012,21 +7036,28 @@ "outlineStyle", "outlineWidth", "outputBuffer", + "outputChannelCount", + "outputLanguage", "outputLatency", "outputs", + "overallProgress", "overflow", "overflow-anchor", "overflow-block", + "overflow-clip-margin", "overflow-inline", "overflow-wrap", "overflow-x", "overflow-y", "overflowAnchor", "overflowBlock", + "overflowClipMargin", "overflowInline", "overflowWrap", "overflowX", "overflowY", + "overlaysContent", + "overrideColors", "overrideMimeType", "oversample", "overscroll-behavior", @@ -6080,11 +7111,15 @@ "page-break-after", "page-break-before", "page-break-inside", + "page-orientation", + "pageAction", "pageBreakAfter", "pageBreakBefore", "pageBreakInside", "pageCount", "pageLeft", + "pageOrientation", + "pageT", "pageTop", "pageX", "pageXOffset", @@ -6094,11 +7129,13 @@ "paint-order", "paintOrder", "paintRequests", + "paintTime", "paintType", "paintWorklet", "palette", "pan", "panningModel", + "parameterData", "parameters", "parent", "parentElement", @@ -6109,11 +7146,15 @@ "parentWindow", "parse", "parseAll", + "parseCreationOptionsFromJSON", "parseFloat", "parseFromString", + "parseHTMLUnsafe", "parseInt", + "parseRequestOptionsFromJSON", "part", "participants", + "passOp", "passive", "password", "pasteHTML", @@ -6130,6 +7171,8 @@ "patternUnits", "pause", "pauseAnimations", + "pauseDepthSensing", + "pauseDuration", "pauseOnExit", "pauseProfilers", "pauseTransformFeedback", @@ -6139,6 +7182,7 @@ "payerPhone", "paymentManager", "pc", + "pdfViewerEnabled", "peerIdentity", "pending", "pendingLocalDescription", @@ -6151,6 +7195,7 @@ "permissions", "persist", "persisted", + "persistentDeviceId", "personalbar", "perspective", "perspective-origin", @@ -6159,6 +7204,9 @@ "phoneticFamilyName", "phoneticGivenName", "photo", + "phrase", + "phrases", + "pictureInPictureChild", "pictureInPictureElement", "pictureInPictureEnabled", "pictureInPictureWindow", @@ -6168,6 +7216,7 @@ "pitch", "pixelBottom", "pixelDepth", + "pixelFormat", "pixelHeight", "pixelLeft", "pixelRight", @@ -6176,6 +7225,7 @@ "pixelUnitToMillimeterX", "pixelUnitToMillimeterY", "pixelWidth", + "pkcs11", "place-content", "place-items", "place-self", @@ -6184,6 +7234,7 @@ "placeSelf", "placeholder", "platform", + "platformVersion", "platforms", "play", "playEffect", @@ -6210,6 +7261,11 @@ "pointsAtZ", "polygonOffset", "pop", + "popDebugGroup", + "popErrorScope", + "popover", + "popoverTargetAction", + "popoverTargetElement", "populateMatrix", "popupWindowFeatures", "popupWindowName", @@ -6226,28 +7282,45 @@ "posWidth", "pose", "position", + "position-anchor", + "position-area", "positionAlign", + "positionAnchor", + "positionArea", + "positionTry", + "positionTryFallbacks", + "positionVisibility", "positionX", "positionY", "positionZ", "postError", "postMessage", + "postTask", "postalCode", "poster", + "postscriptName", "pow", "powerEfficient", "powerOff", + "powerPreference", "preMultiplySelf", "precision", + "preferredReflectionFormat", "preferredStyleSheetSet", "preferredStylesheetSet", "prefix", "preload", + "premultipliedAlpha", "prepend", + "prerendering", "presentation", + "presentationArea", + "presentationStyle", + "presentationTime", "preserveAlpha", "preserveAspectRatio", "preserveAspectRatioString", + "preservesPitch", "pressed", "pressure", "prevValue", @@ -6257,22 +7330,35 @@ "previousElementSibling", "previousNode", "previousPage", + "previousPriority", "previousRect", "previousScale", "previousSibling", "previousTranslate", + "primaries", "primaryKey", + "primaryLightDirection", + "primaryLightIntensity", + "primitive", "primitiveType", "primitiveUnits", "principals", "print", + "print-color-adjust", + "printColorAdjust", + "printPreview", "priority", + "privacy", "privateKey", + "privateToken", "probablySupportsContext", + "probeSpace", "process", "processIceMessage", + "processLocally", "processingEnd", "processingStart", + "processorOptions", "product", "productId", "productName", @@ -6282,14 +7368,17 @@ "profiles", "projectionMatrix", "promise", + "promising", "prompt", "properties", "propertyIsEnumerable", "propertyName", + "protectedAudience", "protocol", "protocolLong", "prototype", "provider", + "proxy", "pseudoClass", "pseudoElement", "pt", @@ -6298,6 +7387,8 @@ "published", "pulse", "push", + "pushDebugGroup", + "pushErrorScope", "pushManager", "pushNotification", "pushState", @@ -6314,9 +7405,15 @@ "queryCommandSupported", "queryCommandText", "queryCommandValue", + "queryFeatureSupport", + "queryLocalFonts", + "queryPermission", "querySelector", "querySelectorAll", + "querySet", + "queue", "queueMicrotask", + "quota", "quote", "quotes", "r", @@ -6325,21 +7422,29 @@ "race", "rad", "radiogroup", + "radius", "radiusX", "radiusY", "random", + "randomUUID", "range", "rangeCount", + "rangeEnd", "rangeMax", "rangeMin", "rangeOffset", "rangeOverflow", "rangeParent", + "rangeStart", "rangeUnderflow", "rate", "ratio", "raw", "rawId", + "rawJSON", + "rawValueToMeters", + "rcap", + "rch", "read", "readAsArrayBuffer", "readAsBinaryString", @@ -6357,11 +7462,14 @@ "ready", "readyState", "reason", + "reasons", "reboot", + "receiveFeatureReport", "receivedAlert", "receiver", "receivers", "recipient", + "recommendedViewportScale", "reconnect", "recordNumber", "recordsAvailable", @@ -6393,6 +7501,8 @@ "register", "registerContentHandler", "registerElement", + "registerInternalModuleStart", + "registerInternalModuleStop", "registerProperty", "registerProtocolHandler", "reject", @@ -6402,6 +7512,7 @@ "relatedNode", "relatedPort", "relatedTarget", + "relayProtocol", "release", "releaseCapture", "releaseEvents", @@ -6409,6 +7520,8 @@ "releaseLock", "releasePointerCapture", "releaseShaderCompiler", + "released", + "reliability", "reliable", "reliableWrite", "reload", @@ -6424,6 +7537,7 @@ "removeBehavior", "removeChild", "removeCue", + "removeEntry", "removeEventListener", "removeFilter", "removeImport", @@ -6446,16 +7560,21 @@ "removeWebWideTrackingException", "removed", "removedNodes", + "renderBlockingStatus", "renderHeight", + "renderStart", "renderState", "renderTime", "renderWidth", "renderbufferStorage", "renderbufferStorageMultisample", "renderedBuffer", + "rendererInterfaces", + "renderers", "renderingMode", "renotify", "repeat", + "repetitionCount", "replace", "replaceAdjacentText", "replaceAll", @@ -6470,10 +7589,17 @@ "replaceTrack", "replaceWholeText", "replaceWith", + "reportError", + "reportEvent", + "reportId", + "reportOnly", "reportValidity", "request", + "requestAdapter", + "requestAdapterInfo", "requestAnimationFrame", "requestAutocomplete", + "requestClose", "requestData", "requestDevice", "requestFrame", @@ -6482,62 +7608,89 @@ "requestHitTestSourceForTransientInput", "requestId", "requestIdleCallback", + "requestLightProbe", "requestMIDIAccess", "requestMediaKeySystemAccess", "requestPermission", "requestPictureInPicture", "requestPointerLock", + "requestPort", "requestPresent", + "requestPresenter", "requestReferenceSpace", "requestSession", "requestStart", "requestStorageAccess", + "requestStorageAccessFor", "requestSubmit", + "requestTime", + "requestUpdateCheck", "requestVideoFrameCallback", + "requestViewportScale", + "requestWindow", + "requested", "requestingWindow", "requireInteraction", "required", "requiredExtensions", "requiredFeatures", + "requiredLimits", "reset", + "resetLatency", "resetPose", "resetTransform", + "resetZoomLevel", + "resizable", "resize", "resizeBy", "resizeTo", "resolve", + "resolveQuerySet", + "resolveTarget", + "resource", + "respond", + "respondWithNewView", "response", "responseBody", "responseEnd", "responseReady", "responseStart", + "responseStatus", "responseText", "responseType", "responseURL", "responseXML", + "restart", + "restartAfterDelay", "restartIce", "restore", + "restrictTo", "result", "resultIndex", "resultType", "results", "resume", + "resumeDepthSensing", "resumeProfilers", "resumeTransformFeedback", "retry", + "returnType", "returnValue", "rev", "reverse", "reversed", "revocable", "revokeObjectURL", + "rex", "rgbColor", + "ric", "right", "rightContext", "rightDegrees", "rightMargin", "rightProjectionMatrix", "rightViewMatrix", + "rlh", "role", "rolloffFactor", "root", @@ -6554,11 +7707,13 @@ "rotationAngle", "rotationRate", "round", + "roundRect", "row-gap", "rowGap", "rowIndex", "rowSpan", "rows", + "rowsPerImage", "rtcpTransport", "rtt", "ruby-align", @@ -6567,19 +7722,27 @@ "rubyOverhang", "rubyPosition", "rules", + "run", + "runAdAuction", "runtime", "runtimeStyle", "rx", "ry", "s", "safari", + "sameDocument", "sample", + "sampleCount", "sampleCoverage", + "sampleInterval", "sampleRate", + "sampleType", + "sampler", "samplerParameterf", "samplerParameteri", "sandbox", "save", + "saveAsPDF", "saveData", "scale", "scale3d", @@ -6587,6 +7750,8 @@ "scaleNonUniform", "scaleNonUniformSelf", "scaleSelf", + "scheduler", + "scheduling", "scheme", "scissor", "scope", @@ -6598,10 +7763,13 @@ "screenLeft", "screenPixelToMillimeterX", "screenPixelToMillimeterY", + "screenState", "screenTop", "screenX", "screenY", + "screens", "scriptURL", + "scripting", "scripts", "scroll", "scroll-behavior", @@ -6628,6 +7796,7 @@ "scroll-padding-right", "scroll-padding-top", "scroll-snap-align", + "scroll-snap-stop", "scroll-snap-type", "scrollAmount", "scrollBehavior", @@ -6666,6 +7835,7 @@ "scrollPaddingTop", "scrollRestoration", "scrollSnapAlign", + "scrollSnapStop", "scrollSnapType", "scrollTo", "scrollTop", @@ -6674,6 +7844,7 @@ "scrollX", "scrollY", "scrollbar-color", + "scrollbar-gutter", "scrollbar-width", "scrollbar3dLightColor", "scrollbarArrowColor", @@ -6681,6 +7852,7 @@ "scrollbarColor", "scrollbarDarkShadowColor", "scrollbarFaceColor", + "scrollbarGutter", "scrollbarHighlightColor", "scrollbarShadowColor", "scrollbarTrackColor", @@ -6701,25 +7873,31 @@ "searchParams", "sectionRowIndex", "secureConnectionStart", + "securePaymentConfirmationAvailability", "security", "seed", + "seek", "seekToNextFrame", "seekable", "seeking", + "segments", "select", "selectAllChildren", "selectAlternateInterface", + "selectAudioOutput", "selectConfiguration", "selectNode", "selectNodeContents", "selectNodes", "selectSingleNode", "selectSubString", + "selectURL", "selected", "selectedIndex", "selectedOptions", "selectedStyleSheetSet", "selectedStylesheetSet", + "selectedTrack", "selection", "selectionDirection", "selectionEnd", @@ -6730,11 +7908,18 @@ "send", "sendAsBinary", "sendBeacon", + "sendFeatureReport", + "sendMessage", + "sendNativeMessage", + "sendOrder", + "sendReport", "sender", "sentAlert", "sentTimestamp", "separator", + "serial", "serialNumber", + "serializable", "serializeToString", "serverTiming", "service", @@ -6742,6 +7927,7 @@ "session", "sessionId", "sessionStorage", + "sessions", "set", "setActionHandler", "setActive", @@ -6751,35 +7937,54 @@ "setAttributeNS", "setAttributeNode", "setAttributeNodeNS", + "setAttributionReporting", + "setBadgeBackgroundColor", + "setBadgeText", + "setBadgeTextColor", "setBaseAndExtent", "setBigInt64", "setBigUint64", + "setBindGroup", "setBingCurrentSearchDefault", + "setBlendConstant", + "setCameraActive", "setCapture", + "setCaptureHandleConfig", "setCodecPreferences", "setColor", "setCompositeOperation", "setConfiguration", + "setConsumer", "setCurrentTime", "setCustomValidity", "setData", "setDate", "setDragImage", + "setEnabled", "setEnd", "setEndAfter", "setEndBefore", "setEndPoint", + "setExpires", "setFillColor", "setFilterRes", + "setFloat16", "setFloat32", "setFloat64", "setFloatValue", + "setFocusBehavior", "setFormValue", + "setFromBase64", + "setFromHex", "setFullYear", + "setHTMLUnsafe", + "setHeaderExtensionsToNegotiate", "setHeaderValue", "setHours", + "setIcon", "setIdentityProvider", "setImmediate", + "setIndexBuffer", "setInt16", "setInt32", "setInt8", @@ -6795,6 +8000,7 @@ "setMatrix", "setMatrixValue", "setMediaKeys", + "setMicrophoneActive", "setMilliseconds", "setMinutes", "setMiterLimit", @@ -6809,11 +8015,16 @@ "setPaint", "setParameter", "setParameters", + "setPathData", "setPeriodicWave", + "setPipeline", "setPointerCapture", + "setPopup", "setPosition", "setPositionState", "setPreference", + "setPriority", + "setPrivateToken", "setProperty", "setPrototypeOf", "setRGBColor", @@ -6821,23 +8032,30 @@ "setRadius", "setRangeText", "setRemoteDescription", + "setReportEventDataForAutomaticBeacons", "setRequestHeader", "setResizable", "setResourceTimingBufferSize", "setRotate", "setScale", + "setScissorRect", "setSeconds", "setSelectionRange", "setServerCertificate", "setShadow", + "setSharedStorageContext", + "setSignals", "setSinkId", "setSkewX", "setSkewY", "setStart", "setStartAfter", "setStartBefore", + "setStatus", "setStdDeviation", + "setStencilReference", "setStreams", + "setStrictMode", "setStringValue", "setStrokeColor", "setSuggestResult", @@ -6845,6 +8063,7 @@ "setTargetValueAtTime", "setTime", "setTimeout", + "setTitle", "setTransform", "setTranslate", "setUTCDate", @@ -6857,6 +8076,8 @@ "setUint16", "setUint32", "setUint8", + "setUninstallURL", + "setUpdateUrlData", "setUri", "setValidity", "setValueAtTime", @@ -6864,16 +8085,25 @@ "setVariable", "setVelocity", "setVersion", + "setVertexBuffer", + "setViewport", "setYear", + "setZoom", + "setZoomSettings", "settingName", "settingValue", "sex", + "shaderLocation", "shaderSource", "shadowBlur", "shadowColor", "shadowOffsetX", "shadowOffsetY", "shadowRoot", + "shadowRootClonable", + "shadowRootDelegatesFocus", + "shadowRootMode", + "shadowRootSerializable", "shape", "shape-image-threshold", "shape-margin", @@ -6883,6 +8113,10 @@ "shapeMargin", "shapeOutside", "shapeRendering", + "share", + "sharedContext", + "sharedStorage", + "sharedStorageWritable", "sheet", "shift", "shiftKey", @@ -6891,14 +8125,23 @@ "shippingOption", "shippingType", "show", + "showDirectoryPicker", "showHelp", "showModal", "showModalDialog", "showModelessDialog", "showNotification", + "showOpenFilePicker", + "showPicker", + "showPopover", + "showSaveFilePicker", "sidebar", + "sidebarAction", "sign", "signal", + "signalAllAcceptedCredentials", + "signalCurrentUserDetails", + "signalUnknownCredential", "signalingState", "signature", "silent", @@ -6908,6 +8151,7 @@ "sinkId", "sittingToStandingTransform", "size", + "sizeAdjust", "sizeToContent", "sizeX", "sizeZ", @@ -6916,13 +8160,18 @@ "skewXSelf", "skewY", "skewYSelf", + "skipTransition", + "skipped", "slice", "slope", "slot", + "slotAssignment", "small", "smil", "smooth", "smoothingTimeConstant", + "snapTargetBlock", + "snapTargetInline", "snapToLines", "snapshotItem", "snapshotLength", @@ -6933,8 +8182,14 @@ "sourceBuffer", "sourceBuffers", "sourceCapabilities", + "sourceCharPosition", + "sourceElement", "sourceFile", + "sourceFunctionName", "sourceIndex", + "sourceLanguage", + "sourceMap", + "sourceURL", "sources", "spacing", "span", @@ -6949,6 +8204,7 @@ "speed", "speedOfSound", "spellcheck", + "sphericalHarmonicsCoefficients", "splice", "split", "splitText", @@ -6956,6 +8212,7 @@ "sqrt", "src", "srcElement", + "srcFactor", "srcFilter", "srcObject", "srcUrn", @@ -6970,7 +8227,9 @@ "standby", "start", "startContainer", + "startE", "startIce", + "startLoadTime", "startMessages", "startNotifications", "startOffset", @@ -6978,8 +8237,11 @@ "startRendering", "startShark", "startTime", + "startViewTransition", "startsWith", "state", + "states", + "stats", "status", "statusCode", "statusMessage", @@ -6987,15 +8249,24 @@ "statusbar", "stdDeviationX", "stdDeviationY", + "stencilBack", + "stencilClearValue", + "stencilFront", "stencilFunc", "stencilFuncSeparate", + "stencilLoadOp", "stencilMask", "stencilMaskSeparate", "stencilOp", "stencilOpSeparate", + "stencilReadMask", + "stencilReadOnly", + "stencilStoreOp", + "stencilWriteMask", "step", "stepDown", "stepMismatch", + "stepMode", "stepUp", "sticky", "stitchTiles", @@ -7012,19 +8283,24 @@ "stopped", "storage", "storageArea", + "storageBuckets", "storageName", "storageStatus", + "storageTexture", "store", + "storeOp", "storeSiteSpecificTrackingException", "storeWebWideTrackingException", "stpVersion", "stream", + "streamErrorCode", "streams", "stretch", "strike", "string", "stringValue", "stringify", + "stripIndexFormat", "stroke", "stroke-dasharray", "stroke-dashoffset", @@ -7043,15 +8319,21 @@ "strokeStyle", "strokeText", "strokeWidth", + "structuredClone", "style", + "styleAndLayoutStart", "styleFloat", "styleMap", "styleMedia", "styleSheet", "styleSheetSets", "styleSheets", + "styleset", + "stylistic", "sub", "subarray", + "subgroupMaxSize", + "subgroupMinSize", "subject", "submit", "submitFrame", @@ -7064,22 +8346,39 @@ "subtree", "suffix", "suffixes", + "sumPrecise", + "summarize", + "summarizeStreaming", "summary", "sup", "supported", "supportedContentEncodings", "supportedEntryTypes", + "supportedValuesOf", "supports", + "supportsFiber", "supportsSession", + "supportsText", + "suppressed", "surfaceScale", "surroundContents", "suspend", "suspendRedraw", + "svb", + "svh", + "svi", + "svmax", + "svmin", + "svw", "swapCache", "swapNode", + "swash", "sweepFlag", + "switchMap", "symbols", + "symmetricDifference", "sync", + "syntax", "sysexEnabled", "system", "systemCode", @@ -7090,31 +8389,44 @@ "tBodies", "tFoot", "tHead", + "tab", + "tab-size", + "tabId", + "tabIds", "tabIndex", + "tabSize", "table", "table-layout", "tableLayout", "tableValues", + "tabs", "tag", "tagName", "tagUrn", "tags", "taintEnabled", + "take", "takePhoto", "takeRecords", + "takeUntil", "tan", "tangentialPressure", "tanh", "target", + "targetAddressSpace", "targetElement", + "targetLanguage", "targetRayMode", "targetRaySpace", "targetTouches", + "targetURL", "targetX", "targetY", + "targets", "tcpType", "tee", "tel", + "telemetry", "terminate", "test", "texImage2D", @@ -7149,6 +8461,9 @@ "text-transform", "text-underline-offset", "text-underline-position", + "text-wrap", + "text-wrap-mode", + "text-wrap-style", "textAlign", "textAlignLast", "textAnchor", @@ -7159,6 +8474,7 @@ "textDecoration", "textDecorationBlink", "textDecorationColor", + "textDecorationInset", "textDecorationLine", "textDecorationLineThrough", "textDecorationNone", @@ -7185,10 +8501,16 @@ "textTransform", "textUnderlineOffset", "textUnderlinePosition", + "textWrap", + "textWrapMode", + "textWrapStyle", + "texture", + "theme", "then", "threadId", "threshold", "thresholds", + "throwIfAborted", "tiltX", "tiltY", "time", @@ -7203,10 +8525,14 @@ "timeout", "timestamp", "timestampOffset", + "timestampWrites", "timing", "title", + "titlebarAreaRect", + "tlsChannelId", "to", "toArray", + "toBase64", "toBlob", "toDataURL", "toDateString", @@ -7216,6 +8542,7 @@ "toFloat32Array", "toFloat64Array", "toGMTString", + "toHex", "toISOString", "toJSON", "toLocaleDateString", @@ -7229,18 +8556,26 @@ "toMethod", "toPrecision", "toPrimitive", + "toReversed", "toSdp", + "toSorted", "toSource", + "toSpliced", "toStaticHTML", "toString", "toStringTag", "toSum", + "toTemporalInstant", "toTimeString", "toUTCString", "toUpperCase", + "toWellFormed", "toggle", "toggleAttribute", "toggleLongPressEnabled", + "togglePopover", + "toggleReaderMode", + "token", "tone", "toneBuffer", "tooLong", @@ -7248,8 +8583,12 @@ "toolbar", "top", "topMargin", + "topSites", + "topology", "total", "totalFrameDelay", + "totalFrames", + "totalFramesDuration", "totalVideoFrames", "touch-action", "touchAction", @@ -7258,15 +8597,20 @@ "trace", "track", "trackVisibility", + "trackedAnchors", + "tracks", + "tran", "transaction", "transactions", "transceiver", + "transfer", "transferControlToOffscreen", "transferFromImageBitmap", "transferImageBitmap", "transferIn", "transferOut", "transferSize", + "transferToFixedLength", "transferToImageBitmap", "transform", "transform-box", @@ -7281,19 +8625,23 @@ "transformToDocument", "transformToFragment", "transition", + "transition-behavior", "transition-delay", "transition-duration", "transition-property", "transition-timing-function", + "transitionBehavior", "transitionDelay", "transitionDuration", "transitionProperty", "transitionTimingFunction", "translate", "translateSelf", + "translateStreaming", "translationX", "translationY", "transport", + "traverseTo", "trim", "trimEnd", "trimLeft", @@ -7303,6 +8651,7 @@ "trunc", "truncate", "trustedTypes", + "try", "turn", "twist", "type", @@ -7316,13 +8665,20 @@ "uint32", "uint8", "uint8Clamped", + "unadjustedMovement", + "unclippedDepth", + "unconfigure", "undefined", + "underlineStyle", + "underlineThickness", "unescape", "uneval", + "ungroup", "unicode", "unicode-bidi", "unicodeBidi", "unicodeRange", + "unicodeSets", "uniform1f", "uniform1fv", "uniform1i", @@ -7357,6 +8713,8 @@ "uniformMatrix4fv", "uniformMatrix4x2fv", "uniformMatrix4x3fv", + "uninstallSelf", + "union", "unique", "uniqueID", "uniqueNumber", @@ -7366,8 +8724,10 @@ "unloadEventEnd", "unloadEventStart", "unlock", + "unmap", "unmount", "unobserve", + "unpackColorSpace", "unpause", "unpauseAnimations", "unreadCount", @@ -7387,12 +8747,23 @@ "upY", "upZ", "update", + "updateAdInterestGroups", + "updateCallbackDone", + "updateCharacterBounds", "updateCommands", + "updateControlBounds", + "updateCurrentEntry", "updateIce", + "updateInkTrailStartPoint", "updateInterval", "updatePlaybackRate", + "updateRangeEnd", + "updateRangeStart", "updateRenderState", + "updateSelection", + "updateSelectionBounds", "updateSettings", + "updateText", "updateTiming", "updateViaCache", "updateWith", @@ -7409,11 +8780,13 @@ "url", "urn", "urns", + "usage", "usages", "usb", "usbVersionMajor", "usbVersionMinor", "usbVersionSubminor", + "use", "useCurrentView", "useMap", "useProgram", @@ -7421,11 +8794,15 @@ "user-select", "userActivation", "userAgent", + "userAgentAllowsProtocol", + "userAgentData", "userChoice", "userHandle", "userHint", + "userInitiated", "userLanguage", "userSelect", + "userState", "userVisibleOnly", "username", "usernameFragment", @@ -7452,6 +8829,7 @@ "variable", "variant", "variationSettings", + "vb", "vector-effect", "vectorEffect", "velocityAngular", @@ -7463,6 +8841,7 @@ "vendorSub", "verify", "version", + "vertex", "vertexAttrib1f", "vertexAttrib1fv", "vertexAttrib2f", @@ -7484,6 +8863,7 @@ "verticalAlign", "verticalOverflow", "vh", + "vi", "vibrate", "vibrationActuator", "videoBitsPerSecond", @@ -7493,17 +8873,25 @@ "view", "viewBox", "viewBoxString", + "viewDimension", + "viewFormats", "viewTarget", "viewTargetString", + "viewTransition", + "viewTransitionClass", + "viewTransitionName", "viewport", "viewportAnchorX", "viewportAnchorY", "viewportElement", "views", "violatedDirective", + "virtualKeyboard", + "virtualKeyboardPolicy", "visibility", "visibilityState", "visible", + "visibleRect", "visualViewport", "vlinkColor", "vmax", @@ -7516,17 +8904,24 @@ "vw", "w", "wait", + "waitAsync", "waitSync", "waiting", "wake", "wakeLock", "wand", + "warmup", "warn", + "wasAlternateProtocolAvailable", "wasClean", "wasDiscarded", + "wasFetchedViaSpdy", + "wasNpnNegotiated", "watch", "watchAvailability", "watchPosition", + "webNavigation", + "webRequest", "webdriver", "webkitAddKey", "webkitAlignContent", @@ -7582,6 +8977,7 @@ "webkitCancelKeyRequest", "webkitCancelRequestAnimationFrame", "webkitClearResourceTimings", + "webkitClipPath", "webkitClosedCaptionsVisible", "webkitConvertPointFromNodeToPage", "webkitConvertPointFromPageToNode", @@ -7606,6 +9002,7 @@ "webkitFlexGrow", "webkitFlexShrink", "webkitFlexWrap", + "webkitFontFeatureSettings", "webkitFullScreenKeyboardInputAllowed", "webkitFullscreenElement", "webkitFullscreenEnabled", @@ -7689,6 +9086,7 @@ "webkitSupportsFullscreen", "webkitTemporaryStorage", "webkitTextFillColor", + "webkitTextSecurity", "webkitTextSizeAdjust", "webkitTextStroke", "webkitTextStrokeColor", @@ -7711,14 +9109,18 @@ "webkitdropzone", "webstore", "weight", + "wgslLanguageFeatures", "whatToShow", "wheelDelta", "wheelDeltaX", "wheelDeltaY", + "when", "whenDefined", "which", "white-space", + "white-space-collapse", "whiteSpace", + "whiteSpaceCollapse", "wholeText", "widows", "width", @@ -7726,25 +9128,45 @@ "willChange", "willValidate", "window", + "windowAttribution", + "windowControlsOverlay", + "windowId", + "windowIds", + "windows", + "with", "withCredentials", + "withResolvers", "word-break", "word-spacing", "word-wrap", "wordBreak", "wordSpacing", "wordWrap", + "workerCacheLookupStart", + "workerFinalSourceType", + "workerMatchedSourceType", + "workerRouterEvaluationStart", "workerStart", + "worklet", + "wow64", "wrap", "wrapKey", "writable", "writableAuxiliaries", "write", + "writeBuffer", + "writeMask", "writeText", + "writeTexture", + "writeTimestamp", "writeValue", + "writeValueWithResponse", + "writeValueWithoutResponse", "writeWithoutResponse", "writeln", "writing-mode", "writingMode", + "writingSuggestions", "x", "x1", "x2", @@ -7762,10 +9184,12 @@ "y2", "yChannelSelector", "yandex", + "yield", "z", "z-index", "zIndex", "zoom", "zoomAndPan", + "zoomLevel", "zoomRectScreen" -] \ No newline at end of file +] From 8a67a829144a06d21aa74a0c1c7120a7fb494ad9 Mon Sep 17 00:00:00 2001 From: Timofey Kachalov Date: Sun, 22 Mar 2026 19:02:22 +0700 Subject: [PATCH 15/24] Fixed missing space between keywords (`return`, `throw`, `typeof`) and Unicode surrogate pair identifiers in compact mode (#1398) --- CHANGELOG.md | 4 ++ package.json | 4 +- .../issues/fixtures/issue1112.js | 3 ++ .../functional-tests/issues/issue1112.spec.ts | 39 +++++++++++++++++++ yarn.lock | 8 ++-- 5 files changed, 52 insertions(+), 6 deletions(-) create mode 100644 test/functional-tests/issues/fixtures/issue1112.js create mode 100644 test/functional-tests/issues/issue1112.spec.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 0203f6efc..8eeaafc7e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ Change Log +v5.4.1 +--- +* Fixed missing space between keywords (`return`, `throw`, `typeof`) and Unicode surrogate pair identifiers in compact mode. Fixes https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1112 + v5.4.0 --- * Add support for `import attributes`. Fixes https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1256 diff --git a/package.json b/package.json index 70760a6b8..6965d2b8c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "javascript-obfuscator", - "version": "5.4.0", + "version": "5.4.1", "description": "JavaScript obfuscator", "keywords": [ "obfuscator", @@ -21,7 +21,7 @@ }, "types": "typings/index.d.ts", "dependencies": { - "@javascript-obfuscator/escodegen": "2.4.0", + "@javascript-obfuscator/escodegen": "2.4.1", "@javascript-obfuscator/estraverse": "5.4.0", "@vercel/blob": ">=0.23.0", "acorn": "8.15.0", diff --git a/test/functional-tests/issues/fixtures/issue1112.js b/test/functional-tests/issues/fixtures/issue1112.js new file mode 100644 index 000000000..2002d83fb --- /dev/null +++ b/test/functional-tests/issues/fixtures/issue1112.js @@ -0,0 +1,3 @@ +(function(𝐜𝐨𝐧𝐭𝐞𝐱𝐭) { + return 𝐜𝐨𝐧𝐭𝐞𝐱𝐭; +})(42) diff --git a/test/functional-tests/issues/issue1112.spec.ts b/test/functional-tests/issues/issue1112.spec.ts new file mode 100644 index 000000000..8a8508b6c --- /dev/null +++ b/test/functional-tests/issues/issue1112.spec.ts @@ -0,0 +1,39 @@ +import { assert } from 'chai'; +import { NO_ADDITIONAL_NODES_PRESET } from '../../../src/options/presets/NoCustomNodes'; +import { readFileAsString } from '../../helpers/readFileAsString'; +import { JavaScriptObfuscator } from '../../../src/JavaScriptObfuscatorFacade'; + +// +// https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1112 +// +describe('Issue #1112', () => { + describe('Unicode mathematical bold identifiers should have correct spacing after keywords', () => { + let testFunc: () => void; + + before(() => { + const code: string = readFileAsString(__dirname + '/fixtures/issue1112.js'); + + testFunc = () => { + const obfuscatedCode: string = JavaScriptObfuscator.obfuscate(code, { + ...NO_ADDITIONAL_NODES_PRESET, + reservedNames: ['𝐜𝐨𝐧𝐭𝐞𝐱𝐭'], + compact: true, + seed: 1 + }).getObfuscatedCode(); + + const result = eval(obfuscatedCode); + + if (result !== 42) { + throw new Error( + `Expected 42, got ${result}. ` + + `Missing space between keyword and Unicode identifier.` + ); + } + }; + }); + + it('should produce valid code with Unicode surrogate pair identifiers', () => { + assert.doesNotThrow(testFunc); + }); + }); +}); diff --git a/yarn.lock b/yarn.lock index 45b47f685..5eaf4644a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -329,10 +329,10 @@ resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.3.tgz#e45e384e4b8ec16bce2fd903af78450f6bf7ec98" integrity sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA== -"@javascript-obfuscator/escodegen@2.4.0": - version "2.4.0" - resolved "https://registry.yarnpkg.com/@javascript-obfuscator/escodegen/-/escodegen-2.4.0.tgz#9d2b19b94793106cafa5cd5041c4e40d42943fb7" - integrity sha512-h9cJ/qb3Y3c1jMQPWypt2CGTFgP34V5OtWLqoOCjV6CT/DUXMZFpoTAfDHpuUrRP0oxNd0UwnVAsPtPuYsoXxQ== +"@javascript-obfuscator/escodegen@2.4.1": + version "2.4.1" + resolved "https://registry.yarnpkg.com/@javascript-obfuscator/escodegen/-/escodegen-2.4.1.tgz#6062541cb3027912e9304dd15f8a5ee5946de247" + integrity sha512-YrEJJDr4cb+pIQKWzHFoDlDkQzatcrNB6OhAD6iTSwiKwzZUMVdobwbOuLpF4EiLxUj0qP28Xl1saTHYzIPCLg== dependencies: "@javascript-obfuscator/estraverse" "^5.3.0" esprima "^4.0.1" From fb747445555be712063522a200fbed18e8bd32f7 Mon Sep 17 00:00:00 2001 From: Timofey Kachalov Date: Sun, 22 Mar 2026 19:18:03 +0700 Subject: [PATCH 16/24] Removed `source-map-support` runtime dependency (#1399) --- CHANGELOG.md | 1 + package.json | 8 ++++++-- webpack/utils/WebpackUtils.js | 4 ---- webpack/webpack.node.config.js | 3 +-- yarn.lock | 12 ++++++++++++ 5 files changed, 20 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8eeaafc7e..edb665ad8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ Change Log v5.4.1 --- * Fixed missing space between keywords (`return`, `throw`, `typeof`) and Unicode surrogate pair identifiers in compact mode. Fixes https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1112 +* Removed `source-map-support` runtime dependency. Use `node --enable-source-maps` instead. Fixes https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1149 v5.4.0 --- diff --git a/package.json b/package.json index 6965d2b8c..3f6f3f765 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,6 @@ "multimatch": "5.0.0", "process": "0.11.10", "reflect-metadata": "0.2.2", - "source-map-support": "0.5.21", "string-template": "1.0.0", "stringz": "2.1.0", "tslib": "2.8.1" @@ -85,11 +84,13 @@ "js-beautify": "1.15.4", "mocha": "11.7.4", "nyc": "17.1.0", + "parse5": "^8.0.0", "pjson": "1.0.9", "prettier": "3.6.2", "rimraf": "6.0.1", "sinon": "19.0.2", "source-map-resolve": "0.6.0", + "source-map-support": "0.5.21", "terser": "5.44.0", "threads": "1.7.0", "ts-loader": "9.5.4", @@ -131,7 +132,10 @@ "author": { "name": "Timofei Kachalov" }, - "contributors": ["Timofei Kachalov (https://github.com/sanex3339)", "Dmitry Zamotkin (https://github.com/zamotkin)"], + "contributors": [ + "Timofei Kachalov (https://github.com/sanex3339)", + "Dmitry Zamotkin (https://github.com/zamotkin)" + ], "license": "BSD-2-Clause", "packageManager": "yarn@1.22.21+sha512.ca75da26c00327d26267ce33536e5790f18ebd53266796fbb664d2a4a5116308042dd8ee7003b276a20eace7d3c5561c3577bdd71bcb67071187af124779620a" } diff --git a/webpack/utils/WebpackUtils.js b/webpack/utils/WebpackUtils.js index 811923509..fe5a52f93 100644 --- a/webpack/utils/WebpackUtils.js +++ b/webpack/utils/WebpackUtils.js @@ -1,7 +1,6 @@ const fs = require('fs'); const copyright = 'Copyright (C) 2016-2026 Timofei Kachalov '; -const sourceMapSupportRequire = 'require("source-map-support").install();'; class WebpackUtils { /** @@ -21,9 +20,6 @@ class WebpackUtils { fs.readFileSync('./LICENSE.BSD', 'utf8') + "\n*/"; } - static getSourceMapSupportImport () { - return sourceMapSupportRequire; - } } module.exports.WebpackUtils = WebpackUtils; diff --git a/webpack/webpack.node.config.js b/webpack/webpack.node.config.js index 3da2d2da5..1ba5b32ad 100644 --- a/webpack/webpack.node.config.js +++ b/webpack/webpack.node.config.js @@ -48,8 +48,7 @@ module.exports = { new webpack.BannerPlugin( { banner: WebpackUtils.getBannerText( - WebpackUtils.getLicenseText(), - WebpackUtils.getSourceMapSupportImport() + WebpackUtils.getLicenseText() ), raw: true, entryOnly: false diff --git a/yarn.lock b/yarn.lock index 5eaf4644a..0d919ff1b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1956,6 +1956,11 @@ enhanced-resolve@^5.17.3: graceful-fs "^4.2.4" tapable "^2.2.0" +entities@^6.0.0: + version "6.0.1" + resolved "https://registry.yarnpkg.com/entities/-/entities-6.0.1.tgz#c28c34a43379ca7f61d074130b2f5f7020a30694" + integrity sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g== + env-paths@4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/env-paths/-/env-paths-4.0.0.tgz#d0bb1f84a81d2542581bf7b7e8085d0683b39097" @@ -4268,6 +4273,13 @@ parse-json@^5.2.0: json-parse-even-better-errors "^2.3.0" lines-and-columns "^1.1.6" +parse5@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/parse5/-/parse5-8.0.0.tgz#aceb267f6b15f9b6e6ba9e35bfdd481fc2167b12" + integrity sha512-9m4m5GSgXjL4AjumKzq1Fgfp3Z8rsvjRNbnkVwfu2ImRqE5D0LnY2QfDen18FSY9C573YU5XxSapdHZTZ2WolA== + dependencies: + entities "^6.0.0" + path-exists@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz" From 459fb31c12f22558cdd2d2215a4f30db7573dc0a Mon Sep 17 00:00:00 2001 From: Timofey Kachalov Date: Sun, 22 Mar 2026 19:43:41 +0700 Subject: [PATCH 17/24] Fix domain lock to be case-insensitive by normalizing domain values to lowercase (#1400) --- CHANGELOG.md | 1 + .../normalizer-rules/DomainLockRule.ts | 2 +- .../issues/fixtures/issue1182.js | 1 + .../functional-tests/issues/issue1182.spec.ts | 43 +++++++++++++++++++ 4 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 test/functional-tests/issues/fixtures/issue1182.js create mode 100644 test/functional-tests/issues/issue1182.spec.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index edb665ad8..0c4b66d1c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ Change Log v5.4.1 --- * Fixed missing space between keywords (`return`, `throw`, `typeof`) and Unicode surrogate pair identifiers in compact mode. Fixes https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1112 +* Fixed `domainLock` being case-sensitive — domain values are now normalized to lowercase. Fixes https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1182 * Removed `source-map-support` runtime dependency. Use `node --enable-source-maps` instead. Fixes https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1149 v5.4.0 diff --git a/src/options/normalizer-rules/DomainLockRule.ts b/src/options/normalizer-rules/DomainLockRule.ts index 030f035f4..677b645ca 100644 --- a/src/options/normalizer-rules/DomainLockRule.ts +++ b/src/options/normalizer-rules/DomainLockRule.ts @@ -13,7 +13,7 @@ export const DomainLockRule: TOptionsNormalizerRule = (options: IOptions): IOpti const normalizedDomains: string[] = []; for (const domain of options.domainLock) { - normalizedDomains.push(Utils.extractDomainFrom(domain)); + normalizedDomains.push(Utils.extractDomainFrom(domain).toLowerCase()); } options = { diff --git a/test/functional-tests/issues/fixtures/issue1182.js b/test/functional-tests/issues/fixtures/issue1182.js new file mode 100644 index 000000000..8e2f88daa --- /dev/null +++ b/test/functional-tests/issues/fixtures/issue1182.js @@ -0,0 +1 @@ +var result = 42; diff --git a/test/functional-tests/issues/issue1182.spec.ts b/test/functional-tests/issues/issue1182.spec.ts new file mode 100644 index 000000000..428e8c9c2 --- /dev/null +++ b/test/functional-tests/issues/issue1182.spec.ts @@ -0,0 +1,43 @@ +import { assert } from 'chai'; + +import { DomainLockRule } from '../../../src/options/normalizer-rules/DomainLockRule'; +import { IOptions } from '../../../src/interfaces/options/IOptions'; + +// +// https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1182 +// +describe('Issue #1182', () => { + describe('domainLock should be case-insensitive', () => { + it('should normalize mixed-case domain to lowercase', () => { + const options = DomainLockRule({ + domainLock: ['Example.COM'] + } as IOptions); + + assert.deepEqual(options.domainLock, ['example.com']); + }); + + it('should normalize domain with subdomain to lowercase', () => { + const options = DomainLockRule({ + domainLock: ['.Example.COM'] + } as IOptions); + + assert.deepEqual(options.domainLock, ['.example.com']); + }); + + it('should normalize multiple mixed-case domains', () => { + const options = DomainLockRule({ + domainLock: ['Foo.Bar.COM', 'EXAMPLE.ORG'] + } as IOptions); + + assert.deepEqual(options.domainLock, ['foo.bar.com', 'example.org']); + }); + + it('should not change already-lowercase domains', () => { + const options = DomainLockRule({ + domainLock: ['example.com'] + } as IOptions); + + assert.deepEqual(options.domainLock, ['example.com']); + }); + }); +}); From dd62feadaea6de64eb743eea6ea475949f1c4974 Mon Sep 17 00:00:00 2001 From: Timofey Kachalov Date: Sun, 22 Mar 2026 20:08:16 +0700 Subject: [PATCH 18/24] Make `Utils.nodeRequire` lazy-evaluated to avoid ReferenceError in browser environments (#1401) --- CHANGELOG.md | 1 + src/utils/Utils.ts | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c4b66d1c..35feddad8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ Change Log v5.4.1 --- +* Fixed `Utils.nodeRequire` causing `ReferenceError: require is not defined` in browser build by making it lazy-evaluated * Fixed missing space between keywords (`return`, `throw`, `typeof`) and Unicode surrogate pair identifiers in compact mode. Fixes https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1112 * Fixed `domainLock` being case-sensitive — domain values are now normalized to lowercase. Fixes https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1182 * Removed `source-map-support` runtime dependency. Use `node --enable-source-maps` instead. Fixes https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1149 diff --git a/src/utils/Utils.ts b/src/utils/Utils.ts index 9800c807a..f6f47d6f7 100644 --- a/src/utils/Utils.ts +++ b/src/utils/Utils.ts @@ -12,9 +12,12 @@ export class Utils { /** * Dynamic require that bypasses webpack bundling. * Use for Node.js-only modules that should not be included in the browser build. + * Lazy-evaluated to avoid ReferenceError in browser environments. */ // eslint-disable-next-line no-eval - public static readonly nodeRequire: NodeRequire = eval('require'); + public static get nodeRequire(): NodeRequire { + return eval('require'); + } /** * @param {string} version From ea26067e5f63a9ce264f59a9b2003ca25bab3ba4 Mon Sep 17 00:00:00 2001 From: zoffy Date: Mon, 23 Mar 2026 19:15:14 +0800 Subject: [PATCH 19/24] Add Vite plugin to README (#1402) --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index d86338ae9..503d597d7 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,7 @@ The example of obfuscated code: [github.com](https://github.com/javascript-obfus * Malta: [malta-js-obfuscator](https://github.com/fedeghe/malta-js-obfuscator) * Netlify plugin: [netlify-plugin-js-obfuscator](https://www.npmjs.com/package/netlify-plugin-js-obfuscator) * Snowpack plugin: [snowpack-javascript-obfuscator](https://www.npmjs.com/package/snowpack-javascript-obfuscator) +* Vite plugin: [vite-plugin-bundle-obfuscator](https://github.com/z0ffy/vite-plugin-bundle-obfuscator) [![npm version](https://badge.fury.io/js/javascript-obfuscator.svg)](https://badge.fury.io/js/javascript-obfuscator) [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fjavascript-obfuscator%2Fjavascript-obfuscator.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fjavascript-obfuscator%2Fjavascript-obfuscator?ref=badge_shield) From 6a31817910dbf5be2470a07f5ab90b457f901134 Mon Sep 17 00:00:00 2001 From: sanex3339 Date: Thu, 2 Apr 2026 10:56:10 +0700 Subject: [PATCH 20/24] Update VM options --- README.md | 74 ++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 46 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 503d597d7..38666c22b 100644 --- a/README.md +++ b/README.md @@ -1871,8 +1871,8 @@ Specify exactly which root-level functions should get VM protection by name. **Example:** ```javascript { - vmObfuscation: true, - vmTargetFunctions: ['someFunctionName'] + vmObfuscation: true, + vmTargetFunctions: ['someFunctionName'] } ``` @@ -1886,8 +1886,8 @@ Specify root-level functions that should never get VM protection. Takes preceden **Example:** ```javascript { - vmObfuscation: true, - vmExcludeFunctions: ['someFunctionName'] + vmObfuscation: true, + vmExcludeFunctions: ['someFunctionName'] } ``` @@ -1907,28 +1907,28 @@ Controls how functions/methods are selected for VM obfuscation. ```javascript // Source code function regularFunction() { - return 'not virtualized'; + return 'not virtualized'; } /* javascript-obfuscator:vm */ function sensitiveFunction() { - return 'this will be VM-protected'; + return 'this will be VM-protected'; } function outer() { - /* javascript-obfuscator:vm */ - function nestedSensitive() { - return 'nested but still VM-protected'; - } - return nestedSensitive(); + /* javascript-obfuscator:vm */ + function nestedSensitive() { + return 'nested but still VM-protected'; + } + return nestedSensitive(); } ``` ```javascript // Obfuscator options { - vmObfuscation: true, - vmTargetFunctionsMode: 'comment' + vmObfuscation: true, + vmTargetFunctionsMode: 'comment' } ``` @@ -2021,10 +2021,10 @@ vmBytecodeArrayEncodingKeyGetter: "window.config.encryption.key" ```ts // Build time JavaScriptObfuscator.obfuscate(code, { - vmObfuscation: true, - vmBytecodeArrayEncoding: true, - vmBytecodeArrayEncodingKey: 'mySecretKey123', - vmBytecodeArrayEncodingKeyGetter: 'window.__VM_KEY__' + vmObfuscation: true, + vmBytecodeArrayEncoding: true, + vmBytecodeArrayEncodingKey: 'mySecretKey123', + vmBytecodeArrayEncodingKeyGetter: 'window.__VM_KEY__' }); // Runtime - key must be set before obfuscated code runs @@ -2046,26 +2046,24 @@ Type: `boolean` Default: `false` Injects fake bytecode sequences that are never executed. These look like real instructions but are skipped during runtime, confusing analysis tools that process them. -### `vmCompactDispatcher` +### `vmMacroOps` Type: `boolean` Default: `false` -Uses a single unified dispatcher (generator-based) for both sync and async/generator code execution. By default (`false`), the VM generates two separate dispatchers: a non-generator version for sync code (faster) and a generator version for async/generator code. When enabled, only the generator-based dispatcher is used for all execution. +Combines common instruction sequences into single "macro" opcodes. For example, `LOAD + ADD + STORE` might become a single `MACRO_ADD_TO_VAR` instruction. This breaks pattern recognition and can improve performance. -**Trade-offs:** -- `false` (default): Larger code size due to dual dispatchers, but faster sync execution (no generator overhead) -- `true`: Smaller code size with single dispatcher, but sync code has generator protocol overhead +### `vmDebugProtection` +Type: `boolean` Default: `false` -Use this when code size is more important than sync execution speed. +Adds multi-layered anti-debugging, anti-analysis, and anti-LLM defenses to the VM runtime. For best results, allow `unsafe-eval` in your Content Security Policy. Works best with `browser`/`browser-no-eval` targets. -### `vmMacroOps` +### `vmSelfDefending` Type: `boolean` Default: `false` -Combines common instruction sequences into single "macro" opcodes. For example, `LOAD + ADD + STORE` might become a single `MACRO_ADD_TO_VAR` instruction. This breaks pattern recognition and can improve performance. +Adds multi-layered tamper detection, anti-hooking, and anti-reverse-engineering protection to the VM runtime. -### `vmDebugProtection` -Type: `boolean` Default: `false` +> :warning: This option force-enables [`vmBytecodeArrayEncoding`](#vmbytecodeArrayEncoding). -Adds anti-debugging measures to the VM runtime. Detects debugger presence and alters behavior when debugging is detected. +Strongly recommended to use together with [`vmDebugProtection`](#vmDebugProtection), [`vmBytecodeArrayEncodingKey`](#vmbytecodeArrayEncodingKey), and [`vmBytecodeArrayEncodingKeyGetter`](#vmbytecodeArrayEncodingKeyGetter). ### `vmStatefulOpcodes` Type: `boolean` Default: `false` @@ -2079,6 +2077,26 @@ Encrypts values on the VM stack during execution. Values are encoded when pushed This option heavily affects performance. +### `vmCompactDispatcher` +Type: `boolean` Default: `false` + +Uses a single VM executor instead of dual executors (sync + generator). Reduces obfuscated code size but adds ~20% performance overhead on recursion-heavy code. + +- `false` (default): dual executors — optimal performance, larger output +- `true`: single executor — smaller output, slightly slower + +### `vmStringArrayBytecodeOnly` +Type: `boolean` Default: `false` + +When enabled, the string array will **only** extract strings from bytecode data — no other strings in the code are transformed. This force-enables `stringArray` even if it's not explicitly set. + +**Why use this:** Extracting all VM runtime strings to a string array is slow. This option targets only bytecode content for string array extraction, improving performance while still protecting bytecode constants. + +- When `vmBytecodeArrayEncoding: false` — strings inside bytecode constant pools (`c` arrays) are extracted +- When `vmBytecodeArrayEncoding: true` — top-level base64 encoded bytecode strings are extracted +- `stringArrayThreshold` still controls what percentage of those bytecode strings are extracted + + ### `strictMode` Type: `boolean | null` Default: `null` From 185784914527db7fffc872a5df37531a99f15c46 Mon Sep 17 00:00:00 2001 From: Timofey Kachalov Date: Fri, 17 Apr 2026 13:59:03 +0700 Subject: [PATCH 21/24] Fix self-defending obfuscated code hanging in Bun environments (#1407) --- CHANGELOG.md | 4 + package.json | 7 +- .../AtobTemplate.ts | 19 ++- .../SelfDefendingTemplate.ts | 4 +- .../StringArrayCallsWrapperTemplate.spec.ts | 120 +++++++++++++++++- 5 files changed, 141 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 35feddad8..839cef024 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ Change Log +v5.4.2 +--- +* Fixed obfuscated code hanging in Bun when `selfDefending` is enabled. Fixes https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1404 + v5.4.1 --- * Fixed `Utils.nodeRequire` causing `ReferenceError: require is not defined` in browser build by making it lazy-evaluated diff --git a/package.json b/package.json index 3f6f3f765..3c29944bc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "javascript-obfuscator", - "version": "5.4.1", + "version": "5.4.2", "description": "JavaScript obfuscator", "keywords": [ "obfuscator", @@ -132,10 +132,7 @@ "author": { "name": "Timofei Kachalov" }, - "contributors": [ - "Timofei Kachalov (https://github.com/sanex3339)", - "Dmitry Zamotkin (https://github.com/zamotkin)" - ], + "contributors": ["Timofei Kachalov (https://github.com/sanex3339)", "Dmitry Zamotkin (https://github.com/zamotkin)"], "license": "BSD-2-Clause", "packageManager": "yarn@1.22.21+sha512.ca75da26c00327d26267ce33536e5790f18ebd53266796fbb664d2a4a5116308042dd8ee7003b276a20eace7d3c5561c3577bdd71bcb67071187af124779620a" } diff --git a/src/custom-code-helpers/string-array/templates/string-array-calls-wrapper/AtobTemplate.ts b/src/custom-code-helpers/string-array/templates/string-array-calls-wrapper/AtobTemplate.ts index 340d7b42a..f94a27569 100644 --- a/src/custom-code-helpers/string-array/templates/string-array-calls-wrapper/AtobTemplate.ts +++ b/src/custom-code-helpers/string-array/templates/string-array-calls-wrapper/AtobTemplate.ts @@ -12,8 +12,15 @@ export function AtobTemplate(selfDefending: boolean): string { let output = ''; let tempEncodedString = ''; - ${selfDefending ? 'let func = output + {atobFunctionName};' : ''} - + ${ + selfDefending + ? ` + let func = output + {atobFunctionName}; + let __ = ('' + function(){return 0;}).indexOf('\\n') !== -1; + ` + : '' + } + for ( let bc = 0, bs, buffer, idx = 0; buffer = input.charAt(idx++); @@ -21,7 +28,13 @@ export function AtobTemplate(selfDefending: boolean): string { ? output += ${((): string => { const basePart: string = 'String.fromCharCode(255 & bs >> (-2 * bc & 6))'; - return selfDefending ? `((func.charCodeAt(idx + 10) - 10 !== 0) ? ${basePart} : bc)` : basePart; + return selfDefending + ? ` + ((__ || func.charCodeAt(idx + 10) - 10 !== 0) + ? ${basePart} + : bc) + ` + : basePart; })()} : 0 ) { diff --git a/src/custom-code-helpers/string-array/templates/string-array-calls-wrapper/SelfDefendingTemplate.ts b/src/custom-code-helpers/string-array/templates/string-array-calls-wrapper/SelfDefendingTemplate.ts index def5c29e9..92abd981d 100644 --- a/src/custom-code-helpers/string-array/templates/string-array-calls-wrapper/SelfDefendingTemplate.ts +++ b/src/custom-code-helpers/string-array/templates/string-array-calls-wrapper/SelfDefendingTemplate.ts @@ -57,6 +57,8 @@ export function SelfDefendingTemplate( return ${rc4BytesIdentifier}(this.${statesIdentifier}[0]); }; - new StatesClass({stringArrayCallsWrapperName}).${checkStateIdentifier}(); + if (('' + function(){return 0;}).indexOf('\\n') === -1) { + new StatesClass({stringArrayCallsWrapperName}).${checkStateIdentifier}(); + } `; } diff --git a/test/functional-tests/custom-code-helpers/string-array/templates/string-array-calls-wrapper-node-template/StringArrayCallsWrapperTemplate.spec.ts b/test/functional-tests/custom-code-helpers/string-array/templates/string-array-calls-wrapper-node-template/StringArrayCallsWrapperTemplate.spec.ts index 68a393509..393fd2e71 100644 --- a/test/functional-tests/custom-code-helpers/string-array/templates/string-array-calls-wrapper-node-template/StringArrayCallsWrapperTemplate.spec.ts +++ b/test/functional-tests/custom-code-helpers/string-array/templates/string-array-calls-wrapper-node-template/StringArrayCallsWrapperTemplate.spec.ts @@ -332,9 +332,9 @@ describe('StringArrayCallsWrapperTemplate', () => { decodedValue = Function(` ${stringArrayTemplate} - + ${stringArrayCallsWrapperTemplate} - + return ${stringArrayCallsWrapperName}(${index}); `)(); }); @@ -379,9 +379,9 @@ describe('StringArrayCallsWrapperTemplate', () => { decodedValue = Function(` ${stringArrayTemplate} - + ${stringArrayCallsWrapperTemplate} - + return ${stringArrayCallsWrapperName}(${index}); `)(); }); @@ -391,6 +391,118 @@ describe('StringArrayCallsWrapperTemplate', () => { }); }); }); + + describe('Variant #3: correct code evaluation when engine reformats Function.prototype.toString', () => { + const origToString = Function.prototype.toString; + + afterEach(() => { + Function.prototype.toString = origToString; + }); + + describe('Variant #1: long decoded string', () => { + const index: string = '0x0'; + + const indexShiftAmount: number = 0; + + const expectedDecodedValue: string = 'test1test1'; + + let decodedValue: string; + + before(() => { + const stringArrayTemplate = format(StringArrayTemplate(), { + stringArrayName, + stringArrayFunctionName, + stringArrayStorageItems: `'${cryptUtilsSwappedAlphabet.btoa('test1test1')}'` + }); + const atobPolyfill = format(AtobTemplate(selfDefendingEnabled), { + atobFunctionName + }); + const atobDecodeTemplate: string = format(StringArrayBase64DecodeTemplate(randomGenerator), { + atobPolyfill, + atobFunctionName, + selfDefendingCode: '', + stringArrayCacheName, + stringArrayCallsWrapperName + }); + const stringArrayCallsWrapperTemplate: string = format(StringArrayCallsWrapperTemplate(), { + decodeCodeHelperTemplate: atobDecodeTemplate, + indexShiftAmount, + stringArrayCacheName, + stringArrayCallsWrapperName, + stringArrayFunctionName + }); + + // Simulate Bun/JSC: Function.prototype.toString adds newlines + Function.prototype.toString = function () { + return origToString.call(this).replace('){', '){\n'); + }; + + decodedValue = Function(` + ${stringArrayTemplate} + + ${stringArrayCallsWrapperTemplate} + + return ${stringArrayCallsWrapperName}(${index}); + `)(); + }); + + it('should correctly return decoded value when engine reformats toString', () => { + assert.deepEqual(decodedValue, expectedDecodedValue); + }); + }); + + describe('Variant #2: 3-characters decoded string', () => { + const index: string = '0x0'; + + const indexShiftAmount: number = 0; + + const expectedDecodedValue: string = 'foo'; + + let decodedValue: string; + + before(() => { + const stringArrayTemplate = format(StringArrayTemplate(), { + stringArrayName, + stringArrayFunctionName, + stringArrayStorageItems: `'${cryptUtilsSwappedAlphabet.btoa('foo')}'` + }); + const atobPolyfill = format(AtobTemplate(selfDefendingEnabled), { + atobFunctionName + }); + const atobDecodeTemplate: string = format(StringArrayBase64DecodeTemplate(randomGenerator), { + atobPolyfill, + atobFunctionName, + selfDefendingCode: '', + stringArrayCacheName, + stringArrayCallsWrapperName + }); + const stringArrayCallsWrapperTemplate: string = format(StringArrayCallsWrapperTemplate(), { + decodeCodeHelperTemplate: atobDecodeTemplate, + indexShiftAmount, + stringArrayCacheName, + stringArrayCallsWrapperName, + stringArrayFunctionName + }); + + // Simulate Bun/JSC: Function.prototype.toString adds newlines + Function.prototype.toString = function () { + return origToString.call(this).replace('){', '){\n'); + }; + + decodedValue = Function(` + ${stringArrayTemplate} + + ${stringArrayCallsWrapperTemplate} + + return ${stringArrayCallsWrapperName}(${index}); + `)(); + }); + + it('should correctly return decoded value when engine reformats toString', () => { + assert.deepEqual(decodedValue, expectedDecodedValue); + }); + }); + }); }); }); From e2abba300d2d85fbad7cd69eaa46d54ceadbbf2e Mon Sep 17 00:00:00 2001 From: sanex3339 Date: Fri, 24 Apr 2026 12:23:00 +0700 Subject: [PATCH 22/24] Update readme --- README.md | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 38666c22b..937bc642a 100644 --- a/README.md +++ b/README.md @@ -15,13 +15,25 @@ Huge thanks to all supporters! --- -### :rocket: Obfuscator.io with VM Obfuscation is out! +### :rocket: Obfuscator.io with VM Obfuscation -**Obfuscator.io** features **VM-based bytecode obfuscation** — the most advanced code protection available. Your JavaScript functions are transformed into custom bytecode running on an embedded virtual machine, making reverse engineering extremely difficult. +**Obfuscator.io** adds **VM-based bytecode obfuscation** to this package - your JavaScript functions are compiled to custom bytecode that runs on an embedded virtual machine. Each build produces unique opcodes and VM structure, making reverse engineering and automated deobfuscation dramatically harder. -[Try it at obfuscator.io](https://obfuscator.io) +| Protection goal | Free (this package) | [obfuscator.io](https://obfuscator.io) | +| --- |-----------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Rename identifiers | ✅ variable/function renaming | ✅ + VM-local symbols never exposed as JavaScript | +| Obscure strings | ✅ string array + base64/rc4 | ✅ + strings embedded in bytecode constants | +| Obscure control flow | ✅ control flow flattening | ✅ full bytecode virtualization, [`vmJumpsEncoding`](#vmjumpsencoding) (runtime-computed jump targets), [`vmDeadCodeInjection`](#vmdeadcodeinjection) (fake bytecode sequences) | +| Resist decompilation | ⚠️ output is still JavaScript | ✅ custom opcodes, [`vmStatefulOpcodes`](#vmstatefulopcodes) (position-dependent opcode mapping), [`vmMacroOps`](#vmmacroops) (fused instructions), [`vmDecoyOpcodes`](#vmdecoyopcodes) (fake opcode handlers) | +| Resist automated LLM-based analysis | ❌ fully vulnerable (no LLM-specific defenses) | ✅ bytecode encryption + anti-LLM defenses in [`vmSelfDefending`](#vmselfdefending) and [`vmDebugProtection`](#vmdebugProtection) | +| Encryption | ✅ [`stringArrayEncoding`](#stringarrayencoding) (base64/rc4 on extracted strings) | ✅ [`vmBytecodeEncoding`](#vmbytecodeencoding) (per-instruction encoding), [`vmBytecodeArrayEncoding`](#vmbytecodeArrayEncoding) (whole bytecode array as single block) | +| Anti-debugging | ✅ `debugProtection` (freezes browser DevTools) | ✅ [`vmDebugProtection`](#vmdebugProtection) (multi-layered anti-debugging and anti-analysis defenses) | +| Tamper detection | ✅ `selfDefending` (breaks if beautified) | ✅ [`vmSelfDefending`](#vmselfdefending) (multi-layered tamper detection, anti-hooking, anti-reverse-engineering protection) | +| Runs offline, no network | ✅ | ❌ uses obfuscator.io API (requires token) | -This package provides access to Obfuscator.io Pro API via CLI and Node.js API. +[Visit Obfuscator.io](https://obfuscator.io) · [Pro API methods](#shield-pro-api-methods-vm-obfuscation) + +This package provides access to Obfuscator.io API via CLI and Node.js API. --- @@ -514,6 +526,8 @@ When using CLI this prefix will be added automatically. ## JavaScript Obfuscator Options +> :shield: **Looking for VM obfuscation?** Options like `vmObfuscation`, `parseHtml`, and every `vm*` option are Pro-only and require an API token from [obfuscator.io](https://obfuscator.io). Use them via the [`obfuscatePro()`](#shield-pro-api-methods-vm-obfuscation) method, or the `--pro-api-token` CLI flag — see [Pro API Methods](#shield-pro-api-methods-vm-obfuscation). + Following options are available for the JS Obfuscator: #### options: From 4ebced34902309fc48ae6429955884a122016e45 Mon Sep 17 00:00:00 2001 From: notaphplover Date: Mon, 27 Apr 2026 06:32:41 +0200 Subject: [PATCH 23/24] Inversify v7 migration (#1368) --- CLAUDE.md | 11 +- package.json | 2 +- .../FunctionDeclarationCalleeDataExtractor.ts | 3 +- .../FunctionExpressionCalleeDataExtractor.ts | 3 +- .../ObjectExpressionCalleeDataExtractor.ts | 3 +- .../CodeTransformerNamesGroupsBuilder.ts | 3 +- .../HashbangOperatorTransformer.ts | 3 +- src/container/InversifyContainerFacade.ts | 104 ++++---- .../modules/analyzers/AnalyzersModule.ts | 47 ++-- .../CodeTransformersModule.ts | 26 +- .../CustomCodeHelpersModule.ts | 123 +++++---- .../modules/custom-nodes/CustomNodesModule.ts | 245 ++++++++++-------- .../modules/generators/GeneratorsModule.ts | 57 ++-- .../ControlFlowTransformersModule.ts | 63 +++-- .../ConvertingTransformersModule.ts | 148 ++++++----- .../DeadCodeInjectionTransformersModule.ts | 10 +- .../FinalizingTransformersModule.ts | 12 +- .../InitializingTransformersModule.ts | 10 +- .../NodeTransformersModule.ts | 21 +- .../PreparingTransformersModule.ts | 155 ++++++----- .../RenameIdentifiersTransformersModule.ts | 26 +- .../RenamePropertiesTransformersModule.ts | 12 +- .../SimplifyingTransformersModule.ts | 22 +- .../StringArrayTransformersModule.ts | 18 +- src/container/modules/node/NodeModule.ts | 6 +- .../modules/options/OptionsModule.ts | 8 +- .../modules/storages/StoragesModule.ts | 55 ++-- src/container/modules/utils/UtilsModule.ts | 18 +- .../CallsControllerFunctionCodeHelper.ts | 3 +- .../ConsoleOutputDisableCodeHelper.ts | 3 +- .../group/ConsoleOutputCodeHelperGroup.ts | 3 +- .../DebugProtectionFunctionCallCodeHelper.ts | 3 +- .../DebugProtectionFunctionCodeHelper.ts | 3 +- ...bugProtectionFunctionIntervalCodeHelper.ts | 3 +- .../group/DebugProtectionCodeHelperGroup.ts | 3 +- .../domain-lock/DomainLockCodeHelper.ts | 3 +- .../group/DomainLockCustomCodeHelperGroup.ts | 3 +- .../self-defending/SelfDefendingCodeHelper.ts | 3 +- .../group/SelfDefendingCodeHelperGroup.ts | 3 +- ...StringArrayCallsWrapperBase64CodeHelper.ts | 3 +- .../StringArrayCallsWrapperCodeHelper.ts | 3 +- .../StringArrayCallsWrapperRc4CodeHelper.ts | 3 +- .../string-array/StringArrayCodeHelper.ts | 3 +- .../StringArrayRotateFunctionCodeHelper.ts | 3 +- .../group/StringArrayCodeHelperGroup.ts | 3 +- .../BinaryExpressionFunctionNode.ts | 3 +- ...BlockStatementControlFlowFlatteningNode.ts | 3 +- .../CallExpressionFunctionNode.ts | 3 +- .../LiteralNode.ts | 3 +- .../LogicalExpressionFunctionNode.ts | 3 +- ...allExpressionControlFlowStorageCallNode.ts | 3 +- .../ControlFlowStorageNode.ts | 3 +- ...nWithOperatorControlFlowStorageCallNode.ts | 3 +- ...StringLiteralControlFlowStorageCallNode.ts | 3 +- .../BlockStatementDeadCodeInjectionNode.ts | 3 +- ...ctExpressionVariableDeclarationHostNode.ts | 3 +- .../AbstractStringArrayCallNode.ts | 3 +- .../string-array-nodes/StringArrayCallNode.ts | 3 +- ...tringArrayScopeCallsWrapperFunctionNode.ts | 3 +- ...tringArrayScopeCallsWrapperVariableNode.ts | 3 +- .../StringArrayHexadecimalNumberIndexNode.ts | 3 +- ...gArrayHexadecimalNumericStringIndexNode.ts | 3 +- .../DictionaryIdentifierNamesGenerator.ts | 3 +- .../HexadecimalIdentifierNamesGenerator.ts | 3 +- .../MangledIdentifierNamesGenerator.ts | 3 +- ...MangledShuffledIdentifierNamesGenerator.ts | 3 +- .../container/IInversifyContainerFacade.ts | 6 +- .../NodeTransformerNamesGroupsBuilder.ts | 3 +- .../BlockStatementControlFlowTransformer.ts | 3 +- .../FunctionControlFlowTransformer.ts | 3 +- .../StringArrayControlFlowTransformer.ts | 3 +- .../BinaryExpressionControlFlowReplacer.ts | 3 +- .../CallExpressionControlFlowReplacer.ts | 3 +- ...pressionWithOperatorControlFlowReplacer.ts | 3 +- .../LogicalExpressionControlFlowReplacer.ts | 3 +- .../StringArrayCallControlFlowReplacer.ts | 3 +- .../StringLiteralControlFlowReplacer.ts | 3 +- .../BooleanLiteralTransformer.ts | 3 +- .../ClassFieldTransformer.ts | 3 +- .../ExportSpecifierTransformer.ts | 3 +- .../MemberExpressionTransformer.ts | 3 +- .../NumberLiteralTransformer.ts | 3 +- .../NumberToNumericalExpressionTransformer.ts | 3 +- .../ObjectExpressionKeysTransformer.ts | 3 +- .../ObjectExpressionTransformer.ts | 3 +- .../ObjectPatternPropertiesTransformer.ts | 3 +- .../SplitStringTransformer.ts | 3 +- .../TemplateLiteralTransformer.ts | 3 +- ...DeadCodeInjectionIdentifiersTransformer.ts | 3 +- .../DeadCodeInjectionTransformer.ts | 3 +- .../DirectivePlacementTransformer.ts | 3 +- .../EscapeSequenceTransformer.ts | 3 +- .../CommentsTransformer.ts | 3 +- .../CustomCodeHelpersTransformer.ts | 3 +- .../EvalCallExpressionTransformer.ts | 3 +- .../MetadataTransformer.ts | 3 +- .../ObfuscatingGuardsTransformer.ts | 3 +- .../ParentificationTransformer.ts | 3 +- .../VariablePreserveTransformer.ts | 3 +- .../LabeledStatementTransformer.ts | 3 +- .../ScopeIdentifiersTransformer.ts | 3 +- .../ScopeThroughIdentifiersTransformer.ts | 3 +- .../RenamePropertiesTransformer.ts | 3 +- .../AbstractStatementSimplifyTransformer.ts | 3 +- .../BlockStatementSimplifyTransformer.ts | 3 +- .../ExpressionStatementsMergeTransformer.ts | 3 +- .../IfStatementSimplifyTransformer.ts | 3 +- .../VariableDeclarationsMergeTransformer.ts | 3 +- .../StringArrayRotateFunctionTransformer.ts | 3 +- ...StringArrayScopeCallsWrapperTransformer.ts | 3 +- .../StringArrayTransformer.ts | 3 +- .../FunctionControlFlowStorage.ts | 3 +- .../StringControlFlowStorage.ts | 3 +- .../CustomCodeHelperGroupStorage.ts | 3 +- .../GlobalIdentifierNamesCacheStorage.ts | 3 +- .../PropertyIdentifierNamesCacheStorage.ts | 3 +- .../LiteralNodesCacheStorage.ts | 3 +- ...tringArrayScopeCallsWrappersDataStorage.ts | 3 +- .../StringArrayStorage.ts | 3 +- .../VisitedLexicalScopeNodesStackStorage.ts | 3 +- src/utils/CryptUtilsStringArray.ts | 3 +- yarn.lock | 85 ++++-- 122 files changed, 914 insertions(+), 667 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 03d0777fb..0074f22d0 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -42,7 +42,7 @@ - **Parser**: Acorn 8.8.2 (ES3-ES2020 support) - **Code Generator**: @javascript-obfuscator/escodegen 2.3.0 - **AST Traversal**: @javascript-obfuscator/estraverse 5.4.0 -- **DI Framework**: InversifyJS 6.0.1 +- **DI Framework**: InversifyJS 7.10.8 - **Testing**: Mocha 10.4.0 + Chai 4.3.7 - **Build System**: Webpack 5.75.0 @@ -210,7 +210,7 @@ The obfuscation process follows a multi-stage pipeline defined in `JavaScriptObf ### Dependency Injection Architecture -The project uses **InversifyJS** for dependency injection, providing: +The project uses **InversifyJS v7** for dependency injection, providing: - **Modularity**: Clean separation of concerns - **Testability**: Easy mocking and testing @@ -219,6 +219,13 @@ The project uses **InversifyJS** for dependency injection, providing: All components are registered in container modules located in `src/container/modules/`. +**Key Changes in InversifyJS v7:** +- Container modules now use `ContainerModuleLoadOptions` instead of separate `bind`, `unbind`, etc. parameters +- `getNamed`, `getTagged`, etc. are replaced by `get(serviceId, { name: ... })` or `get(serviceId, { tag: ... })` +- `load()` and `unload()` are now async, with `loadSync()` and `unloadSync()` alternatives for synchronous operations +- Types like `Context`, `Newable`, `Factory` are now directly exported instead of through `interfaces` namespace +- Custom metadata and middleware features have been removed + ## Key Components Deep Dive ### 1. JavaScriptObfuscator (Main Engine) diff --git a/package.json b/package.json index 3c29944bc..0612d2257 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "eslint-scope": "8.4.0", "eslint-visitor-keys": "4.2.1", "fast-deep-equal": "3.1.3", - "inversify": "6.1.4", + "inversify": "7.11.0", "js-string-escape": "1.0.1", "md5": "2.3.0", "multimatch": "5.0.0", diff --git a/src/analyzers/calls-graph-analyzer/callee-data-extractors/FunctionDeclarationCalleeDataExtractor.ts b/src/analyzers/calls-graph-analyzer/callee-data-extractors/FunctionDeclarationCalleeDataExtractor.ts index 2a3667155..ee5ce750a 100644 --- a/src/analyzers/calls-graph-analyzer/callee-data-extractors/FunctionDeclarationCalleeDataExtractor.ts +++ b/src/analyzers/calls-graph-analyzer/callee-data-extractors/FunctionDeclarationCalleeDataExtractor.ts @@ -1,4 +1,4 @@ -import { injectable } from 'inversify'; +import { injectable, injectFromBase } from 'inversify'; import * as estraverse from '@javascript-obfuscator/estraverse'; import * as ESTree from 'estree'; @@ -9,6 +9,7 @@ import { AbstractCalleeDataExtractor } from './AbstractCalleeDataExtractor'; import { NodeGuards } from '../../../node/NodeGuards'; import { NodeStatementUtils } from '../../../node/NodeStatementUtils'; +@injectFromBase() @injectable() export class FunctionDeclarationCalleeDataExtractor extends AbstractCalleeDataExtractor { /** diff --git a/src/analyzers/calls-graph-analyzer/callee-data-extractors/FunctionExpressionCalleeDataExtractor.ts b/src/analyzers/calls-graph-analyzer/callee-data-extractors/FunctionExpressionCalleeDataExtractor.ts index a24cb5c04..c0b8e0c0d 100644 --- a/src/analyzers/calls-graph-analyzer/callee-data-extractors/FunctionExpressionCalleeDataExtractor.ts +++ b/src/analyzers/calls-graph-analyzer/callee-data-extractors/FunctionExpressionCalleeDataExtractor.ts @@ -1,4 +1,4 @@ -import { injectable } from 'inversify'; +import { injectable, injectFromBase } from 'inversify'; import * as estraverse from '@javascript-obfuscator/estraverse'; import * as ESTree from 'estree'; @@ -9,6 +9,7 @@ import { AbstractCalleeDataExtractor } from './AbstractCalleeDataExtractor'; import { NodeGuards } from '../../../node/NodeGuards'; import { NodeStatementUtils } from '../../../node/NodeStatementUtils'; +@injectFromBase() @injectable() export class FunctionExpressionCalleeDataExtractor extends AbstractCalleeDataExtractor { /** diff --git a/src/analyzers/calls-graph-analyzer/callee-data-extractors/ObjectExpressionCalleeDataExtractor.ts b/src/analyzers/calls-graph-analyzer/callee-data-extractors/ObjectExpressionCalleeDataExtractor.ts index 57e22783e..8f24f7675 100644 --- a/src/analyzers/calls-graph-analyzer/callee-data-extractors/ObjectExpressionCalleeDataExtractor.ts +++ b/src/analyzers/calls-graph-analyzer/callee-data-extractors/ObjectExpressionCalleeDataExtractor.ts @@ -1,4 +1,4 @@ -import { injectable } from 'inversify'; +import { injectable, injectFromBase } from 'inversify'; import * as estraverse from '@javascript-obfuscator/estraverse'; import * as ESTree from 'estree'; @@ -11,6 +11,7 @@ import { AbstractCalleeDataExtractor } from './AbstractCalleeDataExtractor'; import { NodeGuards } from '../../../node/NodeGuards'; import { NodeStatementUtils } from '../../../node/NodeStatementUtils'; +@injectFromBase() @injectable() export class ObjectExpressionCalleeDataExtractor extends AbstractCalleeDataExtractor { /** diff --git a/src/code-transformers/CodeTransformerNamesGroupsBuilder.ts b/src/code-transformers/CodeTransformerNamesGroupsBuilder.ts index b4a592052..13c5349cc 100644 --- a/src/code-transformers/CodeTransformerNamesGroupsBuilder.ts +++ b/src/code-transformers/CodeTransformerNamesGroupsBuilder.ts @@ -1,4 +1,4 @@ -import { injectable } from 'inversify'; +import { injectable, injectFromBase } from 'inversify'; import { ICodeTransformer } from '../interfaces/code-transformers/ICodeTransformer'; @@ -6,6 +6,7 @@ import { CodeTransformer } from '../enums/code-transformers/CodeTransformer'; import { AbstractTransformerNamesGroupsBuilder } from '../utils/AbstractTransformerNamesGroupsBuilder'; +@injectFromBase() @injectable() export class CodeTransformerNamesGroupsBuilder extends AbstractTransformerNamesGroupsBuilder< CodeTransformer, diff --git a/src/code-transformers/preparing-transformers/HashbangOperatorTransformer.ts b/src/code-transformers/preparing-transformers/HashbangOperatorTransformer.ts index 02cdbd4b8..5cb95fa6a 100644 --- a/src/code-transformers/preparing-transformers/HashbangOperatorTransformer.ts +++ b/src/code-transformers/preparing-transformers/HashbangOperatorTransformer.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import { IOptions } from '../../interfaces/options/IOptions'; @@ -8,6 +8,7 @@ import { CodeTransformationStage } from '../../enums/code-transformers/CodeTrans import { AbstractCodeTransformer } from '../AbstractCodeTransformer'; +@injectFromBase() @injectable() export class HashbangOperatorTransformer extends AbstractCodeTransformer { /** diff --git a/src/container/InversifyContainerFacade.ts b/src/container/InversifyContainerFacade.ts index 21eac245e..ec54fc936 100644 --- a/src/container/InversifyContainerFacade.ts +++ b/src/container/InversifyContainerFacade.ts @@ -1,4 +1,4 @@ -import { Container, interfaces } from 'inversify'; +import { Container, ResolutionContext, ServiceIdentifier, Factory } from 'inversify'; import { ServiceIdentifiers } from './ServiceIdentifiers'; import { analyzersModule } from './modules/analyzers/AnalyzersModule'; @@ -42,9 +42,9 @@ import { SourceCode } from '../source-code/SourceCode'; export class InversifyContainerFacade implements IInversifyContainerFacade { /** - * @type {interfaces.Container} + * @type {Container} */ - private readonly container: interfaces.Container; + private readonly container: Container; public constructor() { this.container = new Container(); @@ -55,11 +55,11 @@ export class InversifyContainerFacade implements IInversifyContainerFacade { * @returns {U} */ public static getFactory( - serviceIdentifier: interfaces.ServiceIdentifier - ): (context: interfaces.Context) => (bindingName: T) => U { - return (context: interfaces.Context): ((bindingName: T) => U) => { + serviceIdentifier: ServiceIdentifier + ): (context: ResolutionContext) => (bindingName: T) => U { + return (context: ResolutionContext): ((bindingName: T) => U) => { return (bindingName: T): U => { - return context.container.getNamed(serviceIdentifier, bindingName); + return context.get(serviceIdentifier, { name: bindingName }); }; }; } @@ -69,9 +69,9 @@ export class InversifyContainerFacade implements IInversifyContainerFacade { * @returns {U} */ public static getCacheFactory( - serviceIdentifier: interfaces.ServiceIdentifier - ): (context: interfaces.Context) => (bindingName: T) => U { - return (context: interfaces.Context): ((bindingName: T) => U) => { + serviceIdentifier: ServiceIdentifier + ): (context: ResolutionContext) => (bindingName: T) => U { + return (context: ResolutionContext): ((bindingName: T) => U) => { const cache: Map = new Map(); return (bindingName: T): U => { @@ -79,7 +79,7 @@ export class InversifyContainerFacade implements IInversifyContainerFacade { return cache.get(bindingName); } - const object: U = context.container.getNamed(serviceIdentifier, bindingName); + const object: U = context.get(serviceIdentifier, { name: bindingName }); cache.set(bindingName, object); @@ -91,24 +91,21 @@ export class InversifyContainerFacade implements IInversifyContainerFacade { /** * @param {interfaces.ServiceIdentifier[], U>>} serviceIdentifier * @param {interfaces.ServiceIdentifier[], U>>} dependencies - * @returns {(context: interfaces.Context) => (bindingName: T) => U} + * @returns {(context: ResolutionContext) => (bindingName: T) => U} */ public static getConstructorFactory( - serviceIdentifier: interfaces.ServiceIdentifier[], U>>, - ...dependencies: interfaces.ServiceIdentifier[], U>>[] - ): (context: interfaces.Context) => (bindingName: T) => U { - return (context: interfaces.Context): ((bindingName: T) => U) => { + serviceIdentifier: ServiceIdentifier[], U>>, + ...dependencies: ServiceIdentifier[], U>>[] + ): (context: ResolutionContext) => (bindingName: T) => U { + return (context: ResolutionContext): ((bindingName: T) => U) => { const cache: Map[], U>> = new Map(); const cachedDependencies: Record[] = []; return (bindingName: T): U => { dependencies.forEach( - ( - dependency: interfaces.ServiceIdentifier[], U>>, - index: number - ) => { + (dependency: ServiceIdentifier[], U>>, index: number) => { if (!cachedDependencies[index]) { - cachedDependencies[index] = context.container.get(dependency); + cachedDependencies[index] = context.get(dependency); } } ); @@ -117,10 +114,9 @@ export class InversifyContainerFacade implements IInversifyContainerFacade { return new ([], U>>cache.get(bindingName))(...cachedDependencies); } - const constructor = context.container.getNamed[], U>>( - serviceIdentifier, - bindingName - ); + const constructor = context.get[], U>>(serviceIdentifier, { + name: bindingName + }); cache.set(bindingName, constructor); @@ -130,20 +126,20 @@ export class InversifyContainerFacade implements IInversifyContainerFacade { } /** - * @param {interfaces.ServiceIdentifier} serviceIdentifier + * @param {ServiceIdentifier} serviceIdentifier * @returns {T} */ - public get(serviceIdentifier: interfaces.ServiceIdentifier): T { + public get(serviceIdentifier: ServiceIdentifier): T { return this.container.get(serviceIdentifier); } /** - * @param {interfaces.ServiceIdentifier} serviceIdentifier + * @param {ServiceIdentifier} serviceIdentifier * @param {string | number | symbol} named * @returns {T} */ - public getNamed(serviceIdentifier: interfaces.ServiceIdentifier, named: string | number | symbol): T { - return this.container.getNamed(serviceIdentifier, named); + public getNamed(serviceIdentifier: ServiceIdentifier, named: string | number | symbol): T { + return this.container.get(serviceIdentifier, { name: named }); } /** @@ -182,10 +178,10 @@ export class InversifyContainerFacade implements IInversifyContainerFacade { this.container.bind(ServiceIdentifiers.IObfuscationResult).to(ObfuscationResult); this.container - .bind(ServiceIdentifiers.Factory__IObfuscationResult) - .toFactory((context: interfaces.Context) => { + .bind>(ServiceIdentifiers.Factory__IObfuscationResult) + .toFactory((context: ResolutionContext) => { return (obfuscatedCodeAsString: string, sourceMapAsString: string): IObfuscationResult => { - const obfuscationResult: IObfuscationResult = context.container.get( + const obfuscationResult: IObfuscationResult = context.get( ServiceIdentifiers.IObfuscationResult ); @@ -196,29 +192,29 @@ export class InversifyContainerFacade implements IInversifyContainerFacade { }); // modules - this.container.load(analyzersModule); - this.container.load(codeTransformersModule); - this.container.load(controlFlowTransformersModule); - this.container.load(convertingTransformersModule); - this.container.load(customCodeHelpersModule); - this.container.load(customNodesModule); - this.container.load(deadCodeInjectionTransformersModule); - this.container.load(finalizingTransformersModule); - this.container.load(generatorsModule); - this.container.load(initializingTransformersModule); - this.container.load(nodeModule); - this.container.load(nodeTransformersModule); - this.container.load(optionsModule); - this.container.load(preparingTransformersModule); - this.container.load(renameIdentifiersTransformersModule); - this.container.load(renamePropertiesTransformersModule); - this.container.load(simplifyingTransformersModule); - this.container.load(storagesModule); - this.container.load(stringArrayTransformersModule); - this.container.load(utilsModule); + this.container.loadSync(analyzersModule); + this.container.loadSync(codeTransformersModule); + this.container.loadSync(controlFlowTransformersModule); + this.container.loadSync(convertingTransformersModule); + this.container.loadSync(customCodeHelpersModule); + this.container.loadSync(customNodesModule); + this.container.loadSync(deadCodeInjectionTransformersModule); + this.container.loadSync(finalizingTransformersModule); + this.container.loadSync(generatorsModule); + this.container.loadSync(initializingTransformersModule); + this.container.loadSync(nodeModule); + this.container.loadSync(nodeTransformersModule); + this.container.loadSync(optionsModule); + this.container.loadSync(preparingTransformersModule); + this.container.loadSync(renameIdentifiersTransformersModule); + this.container.loadSync(renamePropertiesTransformersModule); + this.container.loadSync(simplifyingTransformersModule); + this.container.loadSync(storagesModule); + this.container.loadSync(stringArrayTransformersModule); + this.container.loadSync(utilsModule); } public unload(): void { - this.container.unbindAll(); + this.container.unbindAllSync(); } } diff --git a/src/container/modules/analyzers/AnalyzersModule.ts b/src/container/modules/analyzers/AnalyzersModule.ts index ae327cc2b..0de97d579 100644 --- a/src/container/modules/analyzers/AnalyzersModule.ts +++ b/src/container/modules/analyzers/AnalyzersModule.ts @@ -1,5 +1,5 @@ import { InversifyContainerFacade } from '../../InversifyContainerFacade'; -import { ContainerModule, interfaces } from 'inversify'; +import { ContainerModule, ContainerModuleLoadOptions, Factory } from 'inversify'; import { ServiceIdentifiers } from '../../ServiceIdentifiers'; import { ICalleeDataExtractor } from '../../../interfaces/analyzers/calls-graph-analyzer/ICalleeDataExtractor'; @@ -19,48 +19,53 @@ import { PrevailingKindOfVariablesAnalyzer } from '../../../analyzers/prevailing import { ScopeAnalyzer } from '../../../analyzers/scope-analyzer/ScopeAnalyzer'; import { StringArrayStorageAnalyzer } from '../../../analyzers/string-array-storage-analyzer/StringArrayStorageAnalyzer'; -export const analyzersModule: interfaces.ContainerModule = new ContainerModule((bind: interfaces.Bind) => { +export const analyzersModule: ContainerModule = new ContainerModule((options: ContainerModuleLoadOptions) => { // calls graph analyzer - bind(ServiceIdentifiers.ICallsGraphAnalyzer).to(CallsGraphAnalyzer).inSingletonScope(); + options.bind(ServiceIdentifiers.ICallsGraphAnalyzer).to(CallsGraphAnalyzer).inSingletonScope(); // number numerical expression analyzer - bind(ServiceIdentifiers.INumberNumericalExpressionAnalyzer) + options + .bind(ServiceIdentifiers.INumberNumericalExpressionAnalyzer) .to(NumberNumericalExpressionAnalyzer) .inSingletonScope(); // prevailing kind of variables analyzer - bind(ServiceIdentifiers.IPrevailingKindOfVariablesAnalyzer) + options + .bind(ServiceIdentifiers.IPrevailingKindOfVariablesAnalyzer) .to(PrevailingKindOfVariablesAnalyzer) .inSingletonScope(); // scope analyzer - bind(ServiceIdentifiers.IScopeAnalyzer).to(ScopeAnalyzer).inSingletonScope(); + options.bind(ServiceIdentifiers.IScopeAnalyzer).to(ScopeAnalyzer).inSingletonScope(); // string array storage analyzer - bind(ServiceIdentifiers.IStringArrayStorageAnalyzer) + options + .bind(ServiceIdentifiers.IStringArrayStorageAnalyzer) .to(StringArrayStorageAnalyzer) .inSingletonScope(); // callee data extractors - bind(ServiceIdentifiers.ICalleeDataExtractor) + options + .bind(ServiceIdentifiers.ICalleeDataExtractor) .to(FunctionDeclarationCalleeDataExtractor) - .whenTargetNamed(CalleeDataExtractor.FunctionDeclarationCalleeDataExtractor); + .whenNamed(CalleeDataExtractor.FunctionDeclarationCalleeDataExtractor); - bind(ServiceIdentifiers.ICalleeDataExtractor) + options + .bind(ServiceIdentifiers.ICalleeDataExtractor) .to(FunctionExpressionCalleeDataExtractor) - .whenTargetNamed(CalleeDataExtractor.FunctionExpressionCalleeDataExtractor); + .whenNamed(CalleeDataExtractor.FunctionExpressionCalleeDataExtractor); - bind(ServiceIdentifiers.ICalleeDataExtractor) + options + .bind(ServiceIdentifiers.ICalleeDataExtractor) .to(ObjectExpressionCalleeDataExtractor) - .whenTargetNamed(CalleeDataExtractor.ObjectExpressionCalleeDataExtractor); + .whenNamed(CalleeDataExtractor.ObjectExpressionCalleeDataExtractor); // callee data extractor factory - bind(ServiceIdentifiers.Factory__ICalleeDataExtractor).toFactory< - ICalleeDataExtractor, - [CalleeDataExtractor] - >( - InversifyContainerFacade.getCacheFactory( - ServiceIdentifiers.ICalleeDataExtractor - ) - ); + options + .bind>(ServiceIdentifiers.Factory__ICalleeDataExtractor) + .toFactory( + InversifyContainerFacade.getCacheFactory( + ServiceIdentifiers.ICalleeDataExtractor + ) + ); }); diff --git a/src/container/modules/code-transformers/CodeTransformersModule.ts b/src/container/modules/code-transformers/CodeTransformersModule.ts index ad8af23e3..33951e0d1 100644 --- a/src/container/modules/code-transformers/CodeTransformersModule.ts +++ b/src/container/modules/code-transformers/CodeTransformersModule.ts @@ -1,5 +1,5 @@ import { InversifyContainerFacade } from '../../InversifyContainerFacade'; -import { ContainerModule, interfaces } from 'inversify'; +import { ContainerModule, ContainerModuleLoadOptions, Factory } from 'inversify'; import { ServiceIdentifiers } from '../../ServiceIdentifiers'; import { ICodeTransformer } from '../../../interfaces/code-transformers/ICodeTransformer'; @@ -10,21 +10,27 @@ import { CodeTransformer } from '../../../enums/code-transformers/CodeTransforme import { CodeTransformerNamesGroupsBuilder } from '../../../code-transformers/CodeTransformerNamesGroupsBuilder'; import { HashbangOperatorTransformer } from '../../../code-transformers/preparing-transformers/HashbangOperatorTransformer'; -export const codeTransformersModule: interfaces.ContainerModule = new ContainerModule((bind: interfaces.Bind) => { +export const codeTransformersModule: ContainerModule = new ContainerModule((options: ContainerModuleLoadOptions) => { // code transformers factory - bind(ServiceIdentifiers.Factory__ICodeTransformer).toFactory( - InversifyContainerFacade.getCacheFactory(ServiceIdentifiers.ICodeTransformer) - ); + options + .bind>(ServiceIdentifiers.Factory__ICodeTransformer) + .toFactory( + InversifyContainerFacade.getCacheFactory( + ServiceIdentifiers.ICodeTransformer + ) + ); // code transformer names groups builder - bind>( - ServiceIdentifiers.ICodeTransformerNamesGroupsBuilder - ) + options + .bind< + ITransformerNamesGroupsBuilder + >(ServiceIdentifiers.ICodeTransformerNamesGroupsBuilder) .to(CodeTransformerNamesGroupsBuilder) .inSingletonScope(); // preparing code transformers - bind(ServiceIdentifiers.ICodeTransformer) + options + .bind(ServiceIdentifiers.ICodeTransformer) .to(HashbangOperatorTransformer) - .whenTargetNamed(CodeTransformer.HashbangOperatorTransformer); + .whenNamed(CodeTransformer.HashbangOperatorTransformer); }); diff --git a/src/container/modules/custom-code-helpers/CustomCodeHelpersModule.ts b/src/container/modules/custom-code-helpers/CustomCodeHelpersModule.ts index 6ddca83dd..fdd2c7c5a 100644 --- a/src/container/modules/custom-code-helpers/CustomCodeHelpersModule.ts +++ b/src/container/modules/custom-code-helpers/CustomCodeHelpersModule.ts @@ -1,5 +1,5 @@ import { InversifyContainerFacade } from '../../InversifyContainerFacade'; -import { ContainerModule, interfaces } from 'inversify'; +import { ContainerModule, ContainerModuleLoadOptions, Factory } from 'inversify'; import { ServiceIdentifiers } from '../../ServiceIdentifiers'; import { ICustomCodeHelper } from '../../../interfaces/custom-code-helpers/ICustomCodeHelper'; @@ -31,100 +31,123 @@ import { StringArrayCallsWrapperRc4CodeHelper } from '../../../custom-code-helpe import { StringArrayCodeHelper } from '../../../custom-code-helpers/string-array/StringArrayCodeHelper'; import { StringArrayRotateFunctionCodeHelper } from '../../../custom-code-helpers/string-array/StringArrayRotateFunctionCodeHelper'; -export const customCodeHelpersModule: interfaces.ContainerModule = new ContainerModule((bind: interfaces.Bind) => { +export const customCodeHelpersModule: ContainerModule = new ContainerModule((options: ContainerModuleLoadOptions) => { // custom code helpers - bind(ServiceIdentifiers.ICustomCodeHelper) + options + .bind(ServiceIdentifiers.ICustomCodeHelper) .to(ConsoleOutputDisableCodeHelper) - .whenTargetNamed(CustomCodeHelper.ConsoleOutputDisable); + .whenNamed(CustomCodeHelper.ConsoleOutputDisable); - bind(ServiceIdentifiers.ICustomCodeHelper) + options + .bind(ServiceIdentifiers.ICustomCodeHelper) .to(DebugProtectionFunctionCallCodeHelper) - .whenTargetNamed(CustomCodeHelper.DebugProtectionFunctionCall); + .whenNamed(CustomCodeHelper.DebugProtectionFunctionCall); - bind(ServiceIdentifiers.ICustomCodeHelper) + options + .bind(ServiceIdentifiers.ICustomCodeHelper) .to(DebugProtectionFunctionIntervalCodeHelper) - .whenTargetNamed(CustomCodeHelper.DebugProtectionFunctionInterval); + .whenNamed(CustomCodeHelper.DebugProtectionFunctionInterval); - bind(ServiceIdentifiers.ICustomCodeHelper) + options + .bind(ServiceIdentifiers.ICustomCodeHelper) .to(DebugProtectionFunctionCodeHelper) - .whenTargetNamed(CustomCodeHelper.DebugProtectionFunction); + .whenNamed(CustomCodeHelper.DebugProtectionFunction); - bind(ServiceIdentifiers.ICustomCodeHelper) + options + .bind(ServiceIdentifiers.ICustomCodeHelper) .to(DomainLockCodeHelper) - .whenTargetNamed(CustomCodeHelper.DomainLock); + .whenNamed(CustomCodeHelper.DomainLock); - bind(ServiceIdentifiers.ICustomCodeHelper) + options + .bind(ServiceIdentifiers.ICustomCodeHelper) .to(CallsControllerFunctionCodeHelper) - .whenTargetNamed(CustomCodeHelper.CallsControllerFunction); + .whenNamed(CustomCodeHelper.CallsControllerFunction); - bind(ServiceIdentifiers.ICustomCodeHelper) + options + .bind(ServiceIdentifiers.ICustomCodeHelper) .to(SelfDefendingCodeHelper) - .whenTargetNamed(CustomCodeHelper.SelfDefending); + .whenNamed(CustomCodeHelper.SelfDefending); - bind(ServiceIdentifiers.ICustomCodeHelper) + options + .bind(ServiceIdentifiers.ICustomCodeHelper) .to(StringArrayCallsWrapperCodeHelper) - .whenTargetNamed(CustomCodeHelper.StringArrayCallsWrapper); + .whenNamed(CustomCodeHelper.StringArrayCallsWrapper); - bind(ServiceIdentifiers.ICustomCodeHelper) + options + .bind(ServiceIdentifiers.ICustomCodeHelper) .to(StringArrayCallsWrapperBase64CodeHelper) - .whenTargetNamed(CustomCodeHelper.StringArrayCallsWrapperBase64); + .whenNamed(CustomCodeHelper.StringArrayCallsWrapperBase64); - bind(ServiceIdentifiers.ICustomCodeHelper) + options + .bind(ServiceIdentifiers.ICustomCodeHelper) .to(StringArrayCallsWrapperRc4CodeHelper) - .whenTargetNamed(CustomCodeHelper.StringArrayCallsWrapperRc4); + .whenNamed(CustomCodeHelper.StringArrayCallsWrapperRc4); - bind(ServiceIdentifiers.ICustomCodeHelper) + options + .bind(ServiceIdentifiers.ICustomCodeHelper) .to(StringArrayCodeHelper) - .whenTargetNamed(CustomCodeHelper.StringArray); + .whenNamed(CustomCodeHelper.StringArray); - bind(ServiceIdentifiers.ICustomCodeHelper) + options + .bind(ServiceIdentifiers.ICustomCodeHelper) .to(StringArrayRotateFunctionCodeHelper) - .whenTargetNamed(CustomCodeHelper.StringArrayRotateFunction); + .whenNamed(CustomCodeHelper.StringArrayRotateFunction); // code helper groups - bind(ServiceIdentifiers.ICustomCodeHelperGroup) + options + .bind(ServiceIdentifiers.ICustomCodeHelperGroup) .to(ConsoleOutputCodeHelperGroup) - .whenTargetNamed(CustomCodeHelperGroup.ConsoleOutput); + .whenNamed(CustomCodeHelperGroup.ConsoleOutput); - bind(ServiceIdentifiers.ICustomCodeHelperGroup) + options + .bind(ServiceIdentifiers.ICustomCodeHelperGroup) .to(DebugProtectionCodeHelperGroup) - .whenTargetNamed(CustomCodeHelperGroup.DebugProtection); + .whenNamed(CustomCodeHelperGroup.DebugProtection); - bind(ServiceIdentifiers.ICustomCodeHelperGroup) + options + .bind(ServiceIdentifiers.ICustomCodeHelperGroup) .to(DomainLockCustomCodeHelperGroup) - .whenTargetNamed(CustomCodeHelperGroup.DomainLock); + .whenNamed(CustomCodeHelperGroup.DomainLock); - bind(ServiceIdentifiers.ICustomCodeHelperGroup) + options + .bind(ServiceIdentifiers.ICustomCodeHelperGroup) .to(SelfDefendingCodeHelperGroup) - .whenTargetNamed(CustomCodeHelperGroup.SelfDefending); + .whenNamed(CustomCodeHelperGroup.SelfDefending); - bind(ServiceIdentifiers.ICustomCodeHelperGroup) + options + .bind(ServiceIdentifiers.ICustomCodeHelperGroup) .to(StringArrayCodeHelperGroup) - .whenTargetNamed(CustomCodeHelperGroup.StringArray); + .whenNamed(CustomCodeHelperGroup.StringArray); // customCodeHelper factory - bind(ServiceIdentifiers.Factory__ICustomCodeHelper).toFactory< - ICustomCodeHelper, - [CustomCodeHelper] - >(InversifyContainerFacade.getFactory(ServiceIdentifiers.ICustomCodeHelper)); + options + .bind>(ServiceIdentifiers.Factory__ICustomCodeHelper) + .toFactory( + InversifyContainerFacade.getFactory( + ServiceIdentifiers.ICustomCodeHelper + ) + ); // customCodeHelperGroup factory - bind(ServiceIdentifiers.Factory__ICustomCodeHelperGroup).toFactory< - ICustomCodeHelperGroup, - [CustomCodeHelperGroup] - >( - InversifyContainerFacade.getFactory( - ServiceIdentifiers.ICustomCodeHelperGroup - ) - ); + options + .bind< + Factory + >(ServiceIdentifiers.Factory__ICustomCodeHelperGroup) + .toFactory( + InversifyContainerFacade.getFactory( + ServiceIdentifiers.ICustomCodeHelperGroup + ) + ); // custom code helper formatter - bind(ServiceIdentifiers.ICustomCodeHelperFormatter) + options + .bind(ServiceIdentifiers.ICustomCodeHelperFormatter) .to(CustomCodeHelperFormatter) .inSingletonScope(); // custom code helper obfuscator - bind(ServiceIdentifiers.ICustomCodeHelperObfuscator) + options + .bind(ServiceIdentifiers.ICustomCodeHelperObfuscator) .to(CustomCodeHelperObfuscator) .inSingletonScope(); }); diff --git a/src/container/modules/custom-nodes/CustomNodesModule.ts b/src/container/modules/custom-nodes/CustomNodesModule.ts index 2d813f0c5..1cc9fe269 100644 --- a/src/container/modules/custom-nodes/CustomNodesModule.ts +++ b/src/container/modules/custom-nodes/CustomNodesModule.ts @@ -1,5 +1,5 @@ import { InversifyContainerFacade } from '../../InversifyContainerFacade'; -import { ContainerModule, interfaces } from 'inversify'; +import { ContainerModule, ContainerModuleLoadOptions, Newable, Factory } from 'inversify'; import { ServiceIdentifiers } from '../../ServiceIdentifiers'; import { ICustomNode } from '../../../interfaces/custom-nodes/ICustomNode'; @@ -28,144 +28,159 @@ import { StringArrayScopeCallsWrapperVariableNode } from '../../../custom-nodes/ import { StringLiteralControlFlowStorageCallNode } from '../../../custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/StringLiteralControlFlowStorageCallNode'; import { LiteralNode } from '../../../custom-nodes/control-flow-flattening-nodes/LiteralNode'; -export const customNodesModule: interfaces.ContainerModule = new ContainerModule((bind: interfaces.Bind) => { +export const customNodesModule: ContainerModule = new ContainerModule((options: ContainerModuleLoadOptions) => { // control flow custom nodes - bind>(ServiceIdentifiers.Newable__ICustomNode) - .toConstructor(BinaryExpressionFunctionNode) - .whenTargetNamed(ControlFlowCustomNode.BinaryExpressionFunctionNode); - - bind>(ServiceIdentifiers.Newable__ICustomNode) - .toConstructor(BlockStatementControlFlowFlatteningNode) - .whenTargetNamed(ControlFlowCustomNode.BlockStatementControlFlowFlatteningNode); - - bind>(ServiceIdentifiers.Newable__ICustomNode) - .toConstructor(CallExpressionControlFlowStorageCallNode) - .whenTargetNamed(ControlFlowCustomNode.CallExpressionControlFlowStorageCallNode); - - bind>(ServiceIdentifiers.Newable__ICustomNode) - .toConstructor(CallExpressionFunctionNode) - .whenTargetNamed(ControlFlowCustomNode.CallExpressionFunctionNode); - - bind>(ServiceIdentifiers.Newable__ICustomNode) - .toConstructor(ControlFlowStorageNode) - .whenTargetNamed(ControlFlowCustomNode.ControlFlowStorageNode); - - bind>(ServiceIdentifiers.Newable__ICustomNode) - .toConstructor(ExpressionWithOperatorControlFlowStorageCallNode) - .whenTargetNamed(ControlFlowCustomNode.ExpressionWithOperatorControlFlowStorageCallNode); - - bind>(ServiceIdentifiers.Newable__ICustomNode) - .toConstructor(LiteralNode) - .whenTargetNamed(ControlFlowCustomNode.LiteralNode); - - bind>(ServiceIdentifiers.Newable__ICustomNode) - .toConstructor(LogicalExpressionFunctionNode) - .whenTargetNamed(ControlFlowCustomNode.LogicalExpressionFunctionNode); - - bind>(ServiceIdentifiers.Newable__ICustomNode) - .toConstructor(StringLiteralControlFlowStorageCallNode) - .whenTargetNamed(ControlFlowCustomNode.StringLiteralControlFlowStorageCallNode); + options + .bind>(ServiceIdentifiers.Newable__ICustomNode) + .toConstantValue(BinaryExpressionFunctionNode) + .whenNamed(ControlFlowCustomNode.BinaryExpressionFunctionNode); + + options + .bind>(ServiceIdentifiers.Newable__ICustomNode) + .toConstantValue(BlockStatementControlFlowFlatteningNode) + .whenNamed(ControlFlowCustomNode.BlockStatementControlFlowFlatteningNode); + + options + .bind>(ServiceIdentifiers.Newable__ICustomNode) + .toConstantValue(CallExpressionControlFlowStorageCallNode) + .whenNamed(ControlFlowCustomNode.CallExpressionControlFlowStorageCallNode); + + options + .bind>(ServiceIdentifiers.Newable__ICustomNode) + .toConstantValue(CallExpressionFunctionNode) + .whenNamed(ControlFlowCustomNode.CallExpressionFunctionNode); + + options + .bind>(ServiceIdentifiers.Newable__ICustomNode) + .toConstantValue(ControlFlowStorageNode) + .whenNamed(ControlFlowCustomNode.ControlFlowStorageNode); + + options + .bind>(ServiceIdentifiers.Newable__ICustomNode) + .toConstantValue(ExpressionWithOperatorControlFlowStorageCallNode) + .whenNamed(ControlFlowCustomNode.ExpressionWithOperatorControlFlowStorageCallNode); + + options + .bind>(ServiceIdentifiers.Newable__ICustomNode) + .toConstantValue(LiteralNode) + .whenNamed(ControlFlowCustomNode.LiteralNode); + + options + .bind>(ServiceIdentifiers.Newable__ICustomNode) + .toConstantValue(LogicalExpressionFunctionNode) + .whenNamed(ControlFlowCustomNode.LogicalExpressionFunctionNode); + + options + .bind>(ServiceIdentifiers.Newable__ICustomNode) + .toConstantValue(StringLiteralControlFlowStorageCallNode) + .whenNamed(ControlFlowCustomNode.StringLiteralControlFlowStorageCallNode); // dead code injection custom nodes - bind>(ServiceIdentifiers.Newable__ICustomNode) - .toConstructor(BlockStatementDeadCodeInjectionNode) - .whenTargetNamed(DeadCodeInjectionCustomNode.BlockStatementDeadCodeInjectionNode); + options + .bind>(ServiceIdentifiers.Newable__ICustomNode) + .toConstantValue(BlockStatementDeadCodeInjectionNode) + .whenNamed(DeadCodeInjectionCustomNode.BlockStatementDeadCodeInjectionNode); // object expression keys transformer nodes - bind>(ServiceIdentifiers.Newable__ICustomNode) - .toConstructor(ObjectExpressionVariableDeclarationHostNode) - .whenTargetNamed(ObjectExpressionKeysTransformerCustomNode.ObjectExpressionVariableDeclarationHostNode); + options + .bind>(ServiceIdentifiers.Newable__ICustomNode) + .toConstantValue(ObjectExpressionVariableDeclarationHostNode) + .whenNamed(ObjectExpressionKeysTransformerCustomNode.ObjectExpressionVariableDeclarationHostNode); // string array nodes - bind>(ServiceIdentifiers.Newable__ICustomNode) - .toConstructor(StringArrayCallNode) - .whenTargetNamed(StringArrayCustomNode.StringArrayCallNode); + options + .bind>(ServiceIdentifiers.Newable__ICustomNode) + .toConstantValue(StringArrayCallNode) + .whenNamed(StringArrayCustomNode.StringArrayCallNode); - bind>(ServiceIdentifiers.Newable__ICustomNode) - .toConstructor(StringArrayScopeCallsWrapperFunctionNode) - .whenTargetNamed(StringArrayCustomNode.StringArrayScopeCallsWrapperFunctionNode); + options + .bind>(ServiceIdentifiers.Newable__ICustomNode) + .toConstantValue(StringArrayScopeCallsWrapperFunctionNode) + .whenNamed(StringArrayCustomNode.StringArrayScopeCallsWrapperFunctionNode); - bind>(ServiceIdentifiers.Newable__ICustomNode) - .toConstructor(StringArrayScopeCallsWrapperVariableNode) - .whenTargetNamed(StringArrayCustomNode.StringArrayScopeCallsWrapperVariableNode); + options + .bind>(ServiceIdentifiers.Newable__ICustomNode) + .toConstantValue(StringArrayScopeCallsWrapperVariableNode) + .whenNamed(StringArrayCustomNode.StringArrayScopeCallsWrapperVariableNode); // string array index nodes - bind(ServiceIdentifiers.IStringArrayIndexNode) + options + .bind(ServiceIdentifiers.IStringArrayIndexNode) .to(StringArrayHexadecimalNumberIndexNode) .inSingletonScope() - .whenTargetNamed(StringArrayIndexNode.StringArrayHexadecimalNumberIndexNode); + .whenNamed(StringArrayIndexNode.StringArrayHexadecimalNumberIndexNode); - bind(ServiceIdentifiers.IStringArrayIndexNode) + options + .bind(ServiceIdentifiers.IStringArrayIndexNode) .to(StringArrayHexadecimalNumericStringIndexNode) .inSingletonScope() - .whenTargetNamed(StringArrayIndexNode.StringArrayHexadecimalNumericStringIndexNode); + .whenNamed(StringArrayIndexNode.StringArrayHexadecimalNumericStringIndexNode); // control flow customNode constructor factory - bind(ServiceIdentifiers.Factory__IControlFlowCustomNode).toFactory< - ICustomNode, - [ControlFlowCustomNode] - >( - InversifyContainerFacade.getConstructorFactory( - ServiceIdentifiers.Newable__ICustomNode, - ServiceIdentifiers.Factory__IIdentifierNamesGenerator, - ServiceIdentifiers.ICustomCodeHelperFormatter, - ServiceIdentifiers.IRandomGenerator, - ServiceIdentifiers.IOptions - ) - ); + options + .bind>(ServiceIdentifiers.Factory__IControlFlowCustomNode) + .toFactory( + InversifyContainerFacade.getConstructorFactory( + ServiceIdentifiers.Newable__ICustomNode, + ServiceIdentifiers.Factory__IIdentifierNamesGenerator, + ServiceIdentifiers.ICustomCodeHelperFormatter, + ServiceIdentifiers.IRandomGenerator, + ServiceIdentifiers.IOptions + ) + ); // dead code injection customNode constructor factory - bind(ServiceIdentifiers.Factory__IDeadCodeInjectionCustomNode).toFactory< - ICustomNode, - [DeadCodeInjectionCustomNode] - >( - InversifyContainerFacade.getConstructorFactory( - ServiceIdentifiers.Newable__ICustomNode, - ServiceIdentifiers.Factory__IIdentifierNamesGenerator, - ServiceIdentifiers.ICustomCodeHelperFormatter, - ServiceIdentifiers.IRandomGenerator, - ServiceIdentifiers.IOptions - ) - ); + options + .bind< + Factory + >(ServiceIdentifiers.Factory__IDeadCodeInjectionCustomNode) + .toFactory( + InversifyContainerFacade.getConstructorFactory( + ServiceIdentifiers.Newable__ICustomNode, + ServiceIdentifiers.Factory__IIdentifierNamesGenerator, + ServiceIdentifiers.ICustomCodeHelperFormatter, + ServiceIdentifiers.IRandomGenerator, + ServiceIdentifiers.IOptions + ) + ); // object expression keys transformer customNode constructor factory - bind(ServiceIdentifiers.Factory__IObjectExpressionKeysTransformerCustomNode).toFactory< - ICustomNode, - [ObjectExpressionKeysTransformerCustomNode] - >( - InversifyContainerFacade.getConstructorFactory( - ServiceIdentifiers.Newable__ICustomNode, - ServiceIdentifiers.Factory__IIdentifierNamesGenerator, - ServiceIdentifiers.ICustomCodeHelperFormatter, - ServiceIdentifiers.IRandomGenerator, - ServiceIdentifiers.IOptions - ) - ); + options + .bind< + Factory + >(ServiceIdentifiers.Factory__IObjectExpressionKeysTransformerCustomNode) + .toFactory( + InversifyContainerFacade.getConstructorFactory( + ServiceIdentifiers.Newable__ICustomNode, + ServiceIdentifiers.Factory__IIdentifierNamesGenerator, + ServiceIdentifiers.ICustomCodeHelperFormatter, + ServiceIdentifiers.IRandomGenerator, + ServiceIdentifiers.IOptions + ) + ); // string array customNode constructor factory - bind(ServiceIdentifiers.Factory__IStringArrayCustomNode).toFactory< - ICustomNode, - [StringArrayCustomNode] - >( - InversifyContainerFacade.getConstructorFactory( - ServiceIdentifiers.Newable__ICustomNode, - ServiceIdentifiers.Factory__IIdentifierNamesGenerator, - ServiceIdentifiers.Factory__IStringArrayIndexNode, - ServiceIdentifiers.ICustomCodeHelperFormatter, - ServiceIdentifiers.IStringArrayStorage, - ServiceIdentifiers.IArrayUtils, - ServiceIdentifiers.IRandomGenerator, - ServiceIdentifiers.IOptions - ) - ); + options + .bind>(ServiceIdentifiers.Factory__IStringArrayCustomNode) + .toFactory( + InversifyContainerFacade.getConstructorFactory( + ServiceIdentifiers.Newable__ICustomNode, + ServiceIdentifiers.Factory__IIdentifierNamesGenerator, + ServiceIdentifiers.Factory__IStringArrayIndexNode, + ServiceIdentifiers.ICustomCodeHelperFormatter, + ServiceIdentifiers.IStringArrayStorage, + ServiceIdentifiers.IArrayUtils, + ServiceIdentifiers.IRandomGenerator, + ServiceIdentifiers.IOptions + ) + ); // string array index node factory - bind(ServiceIdentifiers.Factory__IStringArrayIndexNode).toFactory< - IStringArrayIndexNode, - [StringArrayIndexNode] - >( - InversifyContainerFacade.getCacheFactory( - ServiceIdentifiers.IStringArrayIndexNode - ) - ); + options + .bind>(ServiceIdentifiers.Factory__IStringArrayIndexNode) + .toFactory( + InversifyContainerFacade.getCacheFactory( + ServiceIdentifiers.IStringArrayIndexNode + ) + ); }); diff --git a/src/container/modules/generators/GeneratorsModule.ts b/src/container/modules/generators/GeneratorsModule.ts index c1ff48e3e..70f62dc0f 100644 --- a/src/container/modules/generators/GeneratorsModule.ts +++ b/src/container/modules/generators/GeneratorsModule.ts @@ -1,4 +1,4 @@ -import { ContainerModule, interfaces } from 'inversify'; +import { ContainerModule, ContainerModuleLoadOptions, ResolutionContext, Factory } from 'inversify'; import { ServiceIdentifiers } from '../../ServiceIdentifiers'; import { IIdentifierNamesGenerator } from '../../../interfaces/generators/identifier-names-generators/IIdentifierNamesGenerator'; @@ -11,72 +11,76 @@ import { HexadecimalIdentifierNamesGenerator } from '../../../generators/identif import { MangledIdentifierNamesGenerator } from '../../../generators/identifier-names-generators/MangledIdentifierNamesGenerator'; import { MangledShuffledIdentifierNamesGenerator } from '../../../generators/identifier-names-generators/MangledShuffledIdentifierNamesGenerator'; -export const generatorsModule: interfaces.ContainerModule = new ContainerModule((bind: interfaces.Bind) => { +export const generatorsModule: ContainerModule = new ContainerModule((options: ContainerModuleLoadOptions) => { // identifier name generators - bind(ServiceIdentifiers.IIdentifierNamesGenerator) + options + .bind(ServiceIdentifiers.IIdentifierNamesGenerator) .to(DictionaryIdentifierNamesGenerator) .inSingletonScope() - .whenTargetNamed(IdentifierNamesGenerator.DictionaryIdentifierNamesGenerator); + .whenNamed(IdentifierNamesGenerator.DictionaryIdentifierNamesGenerator); - bind(ServiceIdentifiers.IIdentifierNamesGenerator) + options + .bind(ServiceIdentifiers.IIdentifierNamesGenerator) .to(HexadecimalIdentifierNamesGenerator) .inSingletonScope() - .whenTargetNamed(IdentifierNamesGenerator.HexadecimalIdentifierNamesGenerator); + .whenNamed(IdentifierNamesGenerator.HexadecimalIdentifierNamesGenerator); - bind(ServiceIdentifiers.IIdentifierNamesGenerator) + options + .bind(ServiceIdentifiers.IIdentifierNamesGenerator) .to(MangledIdentifierNamesGenerator) .inSingletonScope() - .whenTargetNamed(IdentifierNamesGenerator.MangledIdentifierNamesGenerator); + .whenNamed(IdentifierNamesGenerator.MangledIdentifierNamesGenerator); - bind(ServiceIdentifiers.IIdentifierNamesGenerator) + options + .bind(ServiceIdentifiers.IIdentifierNamesGenerator) .to(MangledShuffledIdentifierNamesGenerator) .inSingletonScope() - .whenTargetNamed(IdentifierNamesGenerator.MangledShuffledIdentifierNamesGenerator); + .whenNamed(IdentifierNamesGenerator.MangledShuffledIdentifierNamesGenerator); // identifier name generator factory function identifierNameGeneratorFactory(): ( - context: interfaces.Context - ) => (options: IOptions) => IIdentifierNamesGenerator { + context: ResolutionContext + ) => (generatorOptions: IOptions) => IIdentifierNamesGenerator { let cachedIdentifierNamesGenerator: IIdentifierNamesGenerator | null = null; - return (context: interfaces.Context): ((options: IOptions) => IIdentifierNamesGenerator) => - (options: IOptions): IIdentifierNamesGenerator => { + return (context: ResolutionContext): ((generatorOptions: IOptions) => IIdentifierNamesGenerator) => + (generatorOptions: IOptions): IIdentifierNamesGenerator => { if (cachedIdentifierNamesGenerator) { return cachedIdentifierNamesGenerator; } let identifierNamesGenerator: IIdentifierNamesGenerator; - switch (options.identifierNamesGenerator) { + switch (generatorOptions.identifierNamesGenerator) { case IdentifierNamesGenerator.DictionaryIdentifierNamesGenerator: - identifierNamesGenerator = context.container.getNamed( + identifierNamesGenerator = context.get( ServiceIdentifiers.IIdentifierNamesGenerator, - IdentifierNamesGenerator.DictionaryIdentifierNamesGenerator + { name: IdentifierNamesGenerator.DictionaryIdentifierNamesGenerator } ); break; case IdentifierNamesGenerator.MangledIdentifierNamesGenerator: - identifierNamesGenerator = context.container.getNamed( + identifierNamesGenerator = context.get( ServiceIdentifiers.IIdentifierNamesGenerator, - IdentifierNamesGenerator.MangledIdentifierNamesGenerator + { name: IdentifierNamesGenerator.MangledIdentifierNamesGenerator } ); break; case IdentifierNamesGenerator.MangledShuffledIdentifierNamesGenerator: - identifierNamesGenerator = context.container.getNamed( + identifierNamesGenerator = context.get( ServiceIdentifiers.IIdentifierNamesGenerator, - IdentifierNamesGenerator.MangledShuffledIdentifierNamesGenerator + { name: IdentifierNamesGenerator.MangledShuffledIdentifierNamesGenerator } ); break; case IdentifierNamesGenerator.HexadecimalIdentifierNamesGenerator: default: - identifierNamesGenerator = context.container.getNamed( + identifierNamesGenerator = context.get( ServiceIdentifiers.IIdentifierNamesGenerator, - IdentifierNamesGenerator.HexadecimalIdentifierNamesGenerator + { name: IdentifierNamesGenerator.HexadecimalIdentifierNamesGenerator } ); } @@ -85,8 +89,7 @@ export const generatorsModule: interfaces.ContainerModule = new ContainerModule( return identifierNamesGenerator; }; } - bind(ServiceIdentifiers.Factory__IIdentifierNamesGenerator).toFactory< - IIdentifierNamesGenerator, - [IOptions] - >(identifierNameGeneratorFactory()); + options + .bind>(ServiceIdentifiers.Factory__IIdentifierNamesGenerator) + .toFactory(identifierNameGeneratorFactory()); }); diff --git a/src/container/modules/node-transformers/ControlFlowTransformersModule.ts b/src/container/modules/node-transformers/ControlFlowTransformersModule.ts index 02a458e5c..054e2ada0 100644 --- a/src/container/modules/node-transformers/ControlFlowTransformersModule.ts +++ b/src/container/modules/node-transformers/ControlFlowTransformersModule.ts @@ -1,5 +1,5 @@ import { InversifyContainerFacade } from '../../InversifyContainerFacade'; -import { ContainerModule, interfaces } from 'inversify'; +import { ContainerModule, ContainerModuleLoadOptions, Factory } from 'inversify'; import { ServiceIdentifiers } from '../../ServiceIdentifiers'; import { IControlFlowReplacer } from '../../../interfaces/node-transformers/control-flow-transformers/IControlFlowReplacer'; @@ -17,50 +17,59 @@ import { StringArrayCallControlFlowReplacer } from '../../../node-transformers/c import { StringArrayControlFlowTransformer } from '../../../node-transformers/control-flow-transformers/StringArrayControlFlowTransformer'; import { StringLiteralControlFlowReplacer } from '../../../node-transformers/control-flow-transformers/control-flow-replacers/StringLiteralControlFlowReplacer'; -export const controlFlowTransformersModule: interfaces.ContainerModule = new ContainerModule( - (bind: interfaces.Bind) => { +export const controlFlowTransformersModule: ContainerModule = new ContainerModule( + (options: ContainerModuleLoadOptions) => { // control flow transformers - bind(ServiceIdentifiers.INodeTransformer) + options + .bind(ServiceIdentifiers.INodeTransformer) .to(BlockStatementControlFlowTransformer) - .whenTargetNamed(NodeTransformer.BlockStatementControlFlowTransformer); + .whenNamed(NodeTransformer.BlockStatementControlFlowTransformer); - bind(ServiceIdentifiers.INodeTransformer) + options + .bind(ServiceIdentifiers.INodeTransformer) .to(FunctionControlFlowTransformer) - .whenTargetNamed(NodeTransformer.FunctionControlFlowTransformer); + .whenNamed(NodeTransformer.FunctionControlFlowTransformer); - bind(ServiceIdentifiers.INodeTransformer) + options + .bind(ServiceIdentifiers.INodeTransformer) .to(StringArrayControlFlowTransformer) - .whenTargetNamed(NodeTransformer.StringArrayControlFlowTransformer); + .whenNamed(NodeTransformer.StringArrayControlFlowTransformer); // control flow replacers - bind(ServiceIdentifiers.IControlFlowReplacer) + options + .bind(ServiceIdentifiers.IControlFlowReplacer) .to(BinaryExpressionControlFlowReplacer) - .whenTargetNamed(ControlFlowReplacer.BinaryExpressionControlFlowReplacer); + .whenNamed(ControlFlowReplacer.BinaryExpressionControlFlowReplacer); - bind(ServiceIdentifiers.IControlFlowReplacer) + options + .bind(ServiceIdentifiers.IControlFlowReplacer) .to(CallExpressionControlFlowReplacer) - .whenTargetNamed(ControlFlowReplacer.CallExpressionControlFlowReplacer); + .whenNamed(ControlFlowReplacer.CallExpressionControlFlowReplacer); - bind(ServiceIdentifiers.IControlFlowReplacer) + options + .bind(ServiceIdentifiers.IControlFlowReplacer) .to(LogicalExpressionControlFlowReplacer) - .whenTargetNamed(ControlFlowReplacer.LogicalExpressionControlFlowReplacer); + .whenNamed(ControlFlowReplacer.LogicalExpressionControlFlowReplacer); - bind(ServiceIdentifiers.IControlFlowReplacer) + options + .bind(ServiceIdentifiers.IControlFlowReplacer) .to(StringArrayCallControlFlowReplacer) - .whenTargetNamed(ControlFlowReplacer.StringArrayCallControlFlowReplacer); + .whenNamed(ControlFlowReplacer.StringArrayCallControlFlowReplacer); - bind(ServiceIdentifiers.IControlFlowReplacer) + options + .bind(ServiceIdentifiers.IControlFlowReplacer) .to(StringLiteralControlFlowReplacer) - .whenTargetNamed(ControlFlowReplacer.StringLiteralControlFlowReplacer); + .whenNamed(ControlFlowReplacer.StringLiteralControlFlowReplacer); // control flow replacer factory - bind(ServiceIdentifiers.Factory__IControlFlowReplacer).toFactory< - IControlFlowReplacer, - [ControlFlowReplacer] - >( - InversifyContainerFacade.getCacheFactory( - ServiceIdentifiers.IControlFlowReplacer - ) - ); + options + .bind< + Factory + >(ServiceIdentifiers.Factory__IControlFlowReplacer) + .toFactory( + InversifyContainerFacade.getCacheFactory( + ServiceIdentifiers.IControlFlowReplacer + ) + ); } ); diff --git a/src/container/modules/node-transformers/ConvertingTransformersModule.ts b/src/container/modules/node-transformers/ConvertingTransformersModule.ts index 682550e0c..9d84a7e5b 100644 --- a/src/container/modules/node-transformers/ConvertingTransformersModule.ts +++ b/src/container/modules/node-transformers/ConvertingTransformersModule.ts @@ -1,4 +1,4 @@ -import { ContainerModule, interfaces } from 'inversify'; +import { ContainerModule, ContainerModuleLoadOptions, Factory } from 'inversify'; import { InversifyContainerFacade } from '../../InversifyContainerFacade'; import { ServiceIdentifiers } from '../../ServiceIdentifiers'; @@ -22,68 +22,84 @@ import { ObjectPatternPropertiesTransformer } from '../../../node-transformers/c import { SplitStringTransformer } from '../../../node-transformers/converting-transformers/SplitStringTransformer'; import { TemplateLiteralTransformer } from '../../../node-transformers/converting-transformers/TemplateLiteralTransformer'; -export const convertingTransformersModule: interfaces.ContainerModule = new ContainerModule((bind: interfaces.Bind) => { - // converting transformers - bind(ServiceIdentifiers.INodeTransformer) - .to(BooleanLiteralTransformer) - .whenTargetNamed(NodeTransformer.BooleanLiteralTransformer); - - bind(ServiceIdentifiers.INodeTransformer) - .to(ExportSpecifierTransformer) - .whenTargetNamed(NodeTransformer.ExportSpecifierTransformer); - - bind(ServiceIdentifiers.INodeTransformer) - .to(MemberExpressionTransformer) - .whenTargetNamed(NodeTransformer.MemberExpressionTransformer); - - bind(ServiceIdentifiers.INodeTransformer) - .to(ClassFieldTransformer) - .whenTargetNamed(NodeTransformer.ClassFieldTransformer); - - bind(ServiceIdentifiers.INodeTransformer) - .to(NumberLiteralTransformer) - .whenTargetNamed(NodeTransformer.NumberLiteralTransformer); - - bind(ServiceIdentifiers.INodeTransformer) - .to(NumberToNumericalExpressionTransformer) - .whenTargetNamed(NodeTransformer.NumberToNumericalExpressionTransformer); - - bind(ServiceIdentifiers.INodeTransformer) - .to(ObjectExpressionKeysTransformer) - .whenTargetNamed(NodeTransformer.ObjectExpressionKeysTransformer); - - bind(ServiceIdentifiers.INodeTransformer) - .to(ObjectExpressionTransformer) - .whenTargetNamed(NodeTransformer.ObjectExpressionTransformer); - - bind(ServiceIdentifiers.INodeTransformer) - .to(ObjectPatternPropertiesTransformer) - .whenTargetNamed(NodeTransformer.ObjectPatternPropertiesTransformer); - - bind(ServiceIdentifiers.INodeTransformer) - .to(SplitStringTransformer) - .whenTargetNamed(NodeTransformer.SplitStringTransformer); - - bind(ServiceIdentifiers.INodeTransformer) - .to(TemplateLiteralTransformer) - .whenTargetNamed(NodeTransformer.TemplateLiteralTransformer); - - // object expression extractors - bind(ServiceIdentifiers.IObjectExpressionExtractor) - .to(ObjectExpressionToVariableDeclarationExtractor) - .whenTargetNamed(ObjectExpressionExtractor.ObjectExpressionToVariableDeclarationExtractor); - - bind(ServiceIdentifiers.IObjectExpressionExtractor) - .to(BasePropertiesExtractor) - .whenTargetNamed(ObjectExpressionExtractor.BasePropertiesExtractor); - - // object expression extractor factory - bind(ServiceIdentifiers.Factory__IObjectExpressionExtractor).toFactory< - IObjectExpressionExtractor, - [ObjectExpressionExtractor] - >( - InversifyContainerFacade.getCacheFactory( - ServiceIdentifiers.IObjectExpressionExtractor - ) - ); -}); +export const convertingTransformersModule: ContainerModule = new ContainerModule( + (options: ContainerModuleLoadOptions) => { + // converting transformers + options + .bind(ServiceIdentifiers.INodeTransformer) + .to(BooleanLiteralTransformer) + .whenNamed(NodeTransformer.BooleanLiteralTransformer); + + options + .bind(ServiceIdentifiers.INodeTransformer) + .to(ExportSpecifierTransformer) + .whenNamed(NodeTransformer.ExportSpecifierTransformer); + + options + .bind(ServiceIdentifiers.INodeTransformer) + .to(MemberExpressionTransformer) + .whenNamed(NodeTransformer.MemberExpressionTransformer); + + options + .bind(ServiceIdentifiers.INodeTransformer) + .to(ClassFieldTransformer) + .whenNamed(NodeTransformer.ClassFieldTransformer); + + options + .bind(ServiceIdentifiers.INodeTransformer) + .to(NumberLiteralTransformer) + .whenNamed(NodeTransformer.NumberLiteralTransformer); + + options + .bind(ServiceIdentifiers.INodeTransformer) + .to(NumberToNumericalExpressionTransformer) + .whenNamed(NodeTransformer.NumberToNumericalExpressionTransformer); + + options + .bind(ServiceIdentifiers.INodeTransformer) + .to(ObjectExpressionKeysTransformer) + .whenNamed(NodeTransformer.ObjectExpressionKeysTransformer); + + options + .bind(ServiceIdentifiers.INodeTransformer) + .to(ObjectExpressionTransformer) + .whenNamed(NodeTransformer.ObjectExpressionTransformer); + + options + .bind(ServiceIdentifiers.INodeTransformer) + .to(ObjectPatternPropertiesTransformer) + .whenNamed(NodeTransformer.ObjectPatternPropertiesTransformer); + + options + .bind(ServiceIdentifiers.INodeTransformer) + .to(SplitStringTransformer) + .whenNamed(NodeTransformer.SplitStringTransformer); + + options + .bind(ServiceIdentifiers.INodeTransformer) + .to(TemplateLiteralTransformer) + .whenNamed(NodeTransformer.TemplateLiteralTransformer); + + // object expression extractors + options + .bind(ServiceIdentifiers.IObjectExpressionExtractor) + .to(ObjectExpressionToVariableDeclarationExtractor) + .whenNamed(ObjectExpressionExtractor.ObjectExpressionToVariableDeclarationExtractor); + + options + .bind(ServiceIdentifiers.IObjectExpressionExtractor) + .to(BasePropertiesExtractor) + .whenNamed(ObjectExpressionExtractor.BasePropertiesExtractor); + + // object expression extractor factory + options + .bind< + Factory + >(ServiceIdentifiers.Factory__IObjectExpressionExtractor) + .toFactory( + InversifyContainerFacade.getCacheFactory( + ServiceIdentifiers.IObjectExpressionExtractor + ) + ); + } +); diff --git a/src/container/modules/node-transformers/DeadCodeInjectionTransformersModule.ts b/src/container/modules/node-transformers/DeadCodeInjectionTransformersModule.ts index 211d510b2..eb62efdd4 100644 --- a/src/container/modules/node-transformers/DeadCodeInjectionTransformersModule.ts +++ b/src/container/modules/node-transformers/DeadCodeInjectionTransformersModule.ts @@ -1,4 +1,4 @@ -import { ContainerModule, interfaces } from 'inversify'; +import { ContainerModule, ContainerModuleLoadOptions } from 'inversify'; import { ServiceIdentifiers } from '../../ServiceIdentifiers'; import { INodeTransformer } from '../../../interfaces/node-transformers/INodeTransformer'; @@ -7,11 +7,11 @@ import { NodeTransformer } from '../../../enums/node-transformers/NodeTransforme import { DeadCodeInjectionTransformer } from '../../../node-transformers/dead-code-injection-transformers/DeadCodeInjectionTransformer'; -export const deadCodeInjectionTransformersModule: interfaces.ContainerModule = new ContainerModule( - (bind: interfaces.Bind) => { +export const deadCodeInjectionTransformersModule: ContainerModule = new ContainerModule( + (options: ContainerModuleLoadOptions) => { // dead code injection - bind(ServiceIdentifiers.INodeTransformer) + options.bind(ServiceIdentifiers.INodeTransformer) .to(DeadCodeInjectionTransformer) - .whenTargetNamed(NodeTransformer.DeadCodeInjectionTransformer); + .whenNamed(NodeTransformer.DeadCodeInjectionTransformer); } ); diff --git a/src/container/modules/node-transformers/FinalizingTransformersModule.ts b/src/container/modules/node-transformers/FinalizingTransformersModule.ts index c1e0f4338..9c2728deb 100644 --- a/src/container/modules/node-transformers/FinalizingTransformersModule.ts +++ b/src/container/modules/node-transformers/FinalizingTransformersModule.ts @@ -1,4 +1,4 @@ -import { ContainerModule, interfaces } from 'inversify'; +import { ContainerModule, ContainerModuleLoadOptions } from 'inversify'; import { ServiceIdentifiers } from '../../ServiceIdentifiers'; import { INodeTransformer } from '../../../interfaces/node-transformers/INodeTransformer'; @@ -8,13 +8,13 @@ import { NodeTransformer } from '../../../enums/node-transformers/NodeTransforme import { DirectivePlacementTransformer } from '../../../node-transformers/finalizing-transformers/DirectivePlacementTransformer'; import { EscapeSequenceTransformer } from '../../../node-transformers/finalizing-transformers/EscapeSequenceTransformer'; -export const finalizingTransformersModule: interfaces.ContainerModule = new ContainerModule((bind: interfaces.Bind) => { +export const finalizingTransformersModule: ContainerModule = new ContainerModule((options: ContainerModuleLoadOptions) => { // finalizing transformers - bind(ServiceIdentifiers.INodeTransformer) + options.bind(ServiceIdentifiers.INodeTransformer) .to(DirectivePlacementTransformer) - .whenTargetNamed(NodeTransformer.DirectivePlacementTransformer); + .whenNamed(NodeTransformer.DirectivePlacementTransformer); - bind(ServiceIdentifiers.INodeTransformer) + options.bind(ServiceIdentifiers.INodeTransformer) .to(EscapeSequenceTransformer) - .whenTargetNamed(NodeTransformer.EscapeSequenceTransformer); + .whenNamed(NodeTransformer.EscapeSequenceTransformer); }); diff --git a/src/container/modules/node-transformers/InitializingTransformersModule.ts b/src/container/modules/node-transformers/InitializingTransformersModule.ts index b7753ba5f..a38b916e6 100644 --- a/src/container/modules/node-transformers/InitializingTransformersModule.ts +++ b/src/container/modules/node-transformers/InitializingTransformersModule.ts @@ -1,4 +1,4 @@ -import { ContainerModule, interfaces } from 'inversify'; +import { ContainerModule, ContainerModuleLoadOptions } from 'inversify'; import { ServiceIdentifiers } from '../../ServiceIdentifiers'; import { INodeTransformer } from '../../../interfaces/node-transformers/INodeTransformer'; @@ -7,11 +7,11 @@ import { NodeTransformer } from '../../../enums/node-transformers/NodeTransforme import { CommentsTransformer } from '../../../node-transformers/initializing-transformers/CommentsTransformer'; -export const initializingTransformersModule: interfaces.ContainerModule = new ContainerModule( - (bind: interfaces.Bind) => { +export const initializingTransformersModule: ContainerModule = new ContainerModule( + (options: ContainerModuleLoadOptions) => { // preparing transformers - bind(ServiceIdentifiers.INodeTransformer) + options.bind(ServiceIdentifiers.INodeTransformer) .to(CommentsTransformer) - .whenTargetNamed(NodeTransformer.CommentsTransformer); + .whenNamed(NodeTransformer.CommentsTransformer); } ); diff --git a/src/container/modules/node-transformers/NodeTransformersModule.ts b/src/container/modules/node-transformers/NodeTransformersModule.ts index a637ce34b..aab9ca263 100644 --- a/src/container/modules/node-transformers/NodeTransformersModule.ts +++ b/src/container/modules/node-transformers/NodeTransformersModule.ts @@ -1,5 +1,5 @@ import { InversifyContainerFacade } from '../../InversifyContainerFacade'; -import { ContainerModule, interfaces } from 'inversify'; +import { ContainerModule, ContainerModuleLoadOptions, Factory } from 'inversify'; import { ServiceIdentifiers } from '../../ServiceIdentifiers'; import { INodeTransformer } from '../../../interfaces/node-transformers/INodeTransformer'; @@ -9,16 +9,21 @@ import { NodeTransformer } from '../../../enums/node-transformers/NodeTransforme import { NodeTransformerNamesGroupsBuilder } from '../../../node-transformers/NodeTransformerNamesGroupsBuilder'; -export const nodeTransformersModule: interfaces.ContainerModule = new ContainerModule((bind: interfaces.Bind) => { +export const nodeTransformersModule: ContainerModule = new ContainerModule((options: ContainerModuleLoadOptions) => { // node transformers factory - bind(ServiceIdentifiers.Factory__INodeTransformer).toFactory( - InversifyContainerFacade.getCacheFactory(ServiceIdentifiers.INodeTransformer) - ); + options + .bind>(ServiceIdentifiers.Factory__INodeTransformer) + .toFactory( + InversifyContainerFacade.getCacheFactory( + ServiceIdentifiers.INodeTransformer + ) + ); // node transformer names groups builder - bind>( - ServiceIdentifiers.INodeTransformerNamesGroupsBuilder - ) + options + .bind< + ITransformerNamesGroupsBuilder + >(ServiceIdentifiers.INodeTransformerNamesGroupsBuilder) .to(NodeTransformerNamesGroupsBuilder) .inSingletonScope(); }); diff --git a/src/container/modules/node-transformers/PreparingTransformersModule.ts b/src/container/modules/node-transformers/PreparingTransformersModule.ts index 296b632f3..85235ac6d 100644 --- a/src/container/modules/node-transformers/PreparingTransformersModule.ts +++ b/src/container/modules/node-transformers/PreparingTransformersModule.ts @@ -1,5 +1,5 @@ import { InversifyContainerFacade } from '../../InversifyContainerFacade'; -import { ContainerModule, interfaces } from 'inversify'; +import { ContainerModule, ContainerModuleLoadOptions, Factory } from 'inversify'; import { ServiceIdentifiers } from '../../ServiceIdentifiers'; import { INodeTransformer } from '../../../interfaces/node-transformers/INodeTransformer'; @@ -22,70 +22,89 @@ import { ParentificationTransformer } from '../../../node-transformers/preparing import { ReservedStringObfuscatingGuard } from '../../../node-transformers/preparing-transformers/obfuscating-guards/ReservedStringObfuscatingGuard'; import { VariablePreserveTransformer } from '../../../node-transformers/preparing-transformers/VariablePreserveTransformer'; -export const preparingTransformersModule: interfaces.ContainerModule = new ContainerModule((bind: interfaces.Bind) => { - // preparing transformers - bind(ServiceIdentifiers.INodeTransformer) - .to(CustomCodeHelpersTransformer) - .whenTargetNamed(NodeTransformer.CustomCodeHelpersTransformer); - - bind(ServiceIdentifiers.INodeTransformer) - .to(EvalCallExpressionTransformer) - .whenTargetNamed(NodeTransformer.EvalCallExpressionTransformer); - - bind(ServiceIdentifiers.INodeTransformer) - .to(MetadataTransformer) - .whenTargetNamed(NodeTransformer.MetadataTransformer); - - bind(ServiceIdentifiers.INodeTransformer) - .to(ObfuscatingGuardsTransformer) - .whenTargetNamed(NodeTransformer.ObfuscatingGuardsTransformer); - - bind(ServiceIdentifiers.INodeTransformer) - .to(ParentificationTransformer) - .whenTargetNamed(NodeTransformer.ParentificationTransformer); - - bind(ServiceIdentifiers.INodeTransformer) - .to(VariablePreserveTransformer) - .whenTargetNamed(NodeTransformer.VariablePreserveTransformer); - - // obfuscating guards - bind(ServiceIdentifiers.INodeGuard) - .to(BlackListObfuscatingGuard) - .inSingletonScope() - .whenTargetNamed(ObfuscatingGuard.BlackListObfuscatingGuard); - - bind(ServiceIdentifiers.INodeGuard) - .to(ConditionalCommentObfuscatingGuard) - .inSingletonScope() - .whenTargetNamed(ObfuscatingGuard.ConditionalCommentObfuscatingGuard); - - bind(ServiceIdentifiers.INodeGuard) - .to(ForceTransformStringObfuscatingGuard) - .inSingletonScope() - .whenTargetNamed(ObfuscatingGuard.ForceTransformStringObfuscatingGuard); - - bind(ServiceIdentifiers.INodeGuard) - .to(IgnoredImportObfuscatingGuard) - .inSingletonScope() - .whenTargetNamed(ObfuscatingGuard.IgnoredImportObfuscatingGuard); - - bind(ServiceIdentifiers.INodeGuard) - .to(ImportMetaObfuscationGuard) - .inSingletonScope() - .whenTargetNamed(ObfuscatingGuard.ImportMetaObfuscationGuard); - - bind(ServiceIdentifiers.INodeGuard) - .to(ProcessEnvObfuscationGuard) - .inSingletonScope() - .whenTargetNamed(ObfuscatingGuard.ProcessEnvObfuscationGuard); - - bind(ServiceIdentifiers.INodeGuard) - .to(ReservedStringObfuscatingGuard) - .inSingletonScope() - .whenTargetNamed(ObfuscatingGuard.ReservedStringObfuscatingGuard); - - // obfuscating guards factory - bind(ServiceIdentifiers.Factory__INodeGuard).toFactory( - InversifyContainerFacade.getCacheFactory(ServiceIdentifiers.INodeGuard) - ); -}); +export const preparingTransformersModule: ContainerModule = new ContainerModule( + (options: ContainerModuleLoadOptions) => { + // preparing transformers + options + .bind(ServiceIdentifiers.INodeTransformer) + .to(CustomCodeHelpersTransformer) + .whenNamed(NodeTransformer.CustomCodeHelpersTransformer); + + options + .bind(ServiceIdentifiers.INodeTransformer) + .to(EvalCallExpressionTransformer) + .whenNamed(NodeTransformer.EvalCallExpressionTransformer); + + options + .bind(ServiceIdentifiers.INodeTransformer) + .to(MetadataTransformer) + .whenNamed(NodeTransformer.MetadataTransformer); + + options + .bind(ServiceIdentifiers.INodeTransformer) + .to(ObfuscatingGuardsTransformer) + .whenNamed(NodeTransformer.ObfuscatingGuardsTransformer); + + options + .bind(ServiceIdentifiers.INodeTransformer) + .to(ParentificationTransformer) + .whenNamed(NodeTransformer.ParentificationTransformer); + + options + .bind(ServiceIdentifiers.INodeTransformer) + .to(VariablePreserveTransformer) + .whenNamed(NodeTransformer.VariablePreserveTransformer); + + // obfuscating guards + options + .bind(ServiceIdentifiers.INodeGuard) + .to(BlackListObfuscatingGuard) + .inSingletonScope() + .whenNamed(ObfuscatingGuard.BlackListObfuscatingGuard); + + options + .bind(ServiceIdentifiers.INodeGuard) + .to(ConditionalCommentObfuscatingGuard) + .inSingletonScope() + .whenNamed(ObfuscatingGuard.ConditionalCommentObfuscatingGuard); + + options + .bind(ServiceIdentifiers.INodeGuard) + .to(ForceTransformStringObfuscatingGuard) + .inSingletonScope() + .whenNamed(ObfuscatingGuard.ForceTransformStringObfuscatingGuard); + + options + .bind(ServiceIdentifiers.INodeGuard) + .to(IgnoredImportObfuscatingGuard) + .inSingletonScope() + .whenNamed(ObfuscatingGuard.IgnoredImportObfuscatingGuard); + + options + .bind(ServiceIdentifiers.INodeGuard) + .to(ImportMetaObfuscationGuard) + .inSingletonScope() + .whenNamed(ObfuscatingGuard.ImportMetaObfuscationGuard); + + options + .bind(ServiceIdentifiers.INodeGuard) + .to(ProcessEnvObfuscationGuard) + .inSingletonScope() + .whenNamed(ObfuscatingGuard.ProcessEnvObfuscationGuard); + + options + .bind(ServiceIdentifiers.INodeGuard) + .to(ReservedStringObfuscatingGuard) + .inSingletonScope() + .whenNamed(ObfuscatingGuard.ReservedStringObfuscatingGuard); + + // obfuscating guards factory + options + .bind>(ServiceIdentifiers.Factory__INodeGuard) + .toFactory( + InversifyContainerFacade.getCacheFactory( + ServiceIdentifiers.INodeGuard + ) + ); + } +); diff --git a/src/container/modules/node-transformers/RenameIdentifiersTransformersModule.ts b/src/container/modules/node-transformers/RenameIdentifiersTransformersModule.ts index 00fcaf836..972dabfaf 100644 --- a/src/container/modules/node-transformers/RenameIdentifiersTransformersModule.ts +++ b/src/container/modules/node-transformers/RenameIdentifiersTransformersModule.ts @@ -1,4 +1,4 @@ -import { ContainerModule, interfaces } from 'inversify'; +import { ContainerModule, ContainerModuleLoadOptions } from 'inversify'; import { ServiceIdentifiers } from '../../ServiceIdentifiers'; import { IIdentifierReplacer } from '../../../interfaces/node-transformers/rename-identifiers-transformers/replacer/IIdentifierReplacer'; @@ -14,29 +14,29 @@ import { ScopeThroughIdentifiersTransformer } from '../../../node-transformers/r import { ThroughIdentifierReplacer } from '../../../node-transformers/rename-identifiers-transformers/through-replacer/ThroughIdentifierReplacer'; import { IThroughIdentifierReplacer } from '../../../interfaces/node-transformers/rename-identifiers-transformers/replacer/IThroughIdentifierReplacer'; -export const renameIdentifiersTransformersModule: interfaces.ContainerModule = new ContainerModule( - (bind: interfaces.Bind) => { +export const renameIdentifiersTransformersModule: ContainerModule = new ContainerModule( + (options: ContainerModuleLoadOptions) => { // rename identifiers transformers - bind(ServiceIdentifiers.INodeTransformer) + options.bind(ServiceIdentifiers.INodeTransformer) .to(DeadCodeInjectionIdentifiersTransformer) - .whenTargetNamed(NodeTransformer.DeadCodeInjectionIdentifiersTransformer); + .whenNamed(NodeTransformer.DeadCodeInjectionIdentifiersTransformer); - bind(ServiceIdentifiers.INodeTransformer) + options.bind(ServiceIdentifiers.INodeTransformer) .to(LabeledStatementTransformer) - .whenTargetNamed(NodeTransformer.LabeledStatementTransformer); + .whenNamed(NodeTransformer.LabeledStatementTransformer); - bind(ServiceIdentifiers.INodeTransformer) + options.bind(ServiceIdentifiers.INodeTransformer) .to(ScopeIdentifiersTransformer) - .whenTargetNamed(NodeTransformer.ScopeIdentifiersTransformer); + .whenNamed(NodeTransformer.ScopeIdentifiersTransformer); - bind(ServiceIdentifiers.INodeTransformer) + options.bind(ServiceIdentifiers.INodeTransformer) .to(ScopeThroughIdentifiersTransformer) - .whenTargetNamed(NodeTransformer.ScopeThroughIdentifiersTransformer); + .whenNamed(NodeTransformer.ScopeThroughIdentifiersTransformer); // identifier replacer - bind(ServiceIdentifiers.IIdentifierReplacer).to(IdentifierReplacer).inSingletonScope(); + options.bind(ServiceIdentifiers.IIdentifierReplacer).to(IdentifierReplacer).inSingletonScope(); - bind(ServiceIdentifiers.IThroughIdentifierReplacer) + options.bind(ServiceIdentifiers.IThroughIdentifierReplacer) .to(ThroughIdentifierReplacer) .inSingletonScope(); } diff --git a/src/container/modules/node-transformers/RenamePropertiesTransformersModule.ts b/src/container/modules/node-transformers/RenamePropertiesTransformersModule.ts index 2d1c79c07..fcdb9bd68 100644 --- a/src/container/modules/node-transformers/RenamePropertiesTransformersModule.ts +++ b/src/container/modules/node-transformers/RenamePropertiesTransformersModule.ts @@ -1,4 +1,4 @@ -import { ContainerModule, interfaces } from 'inversify'; +import { ContainerModule, ContainerModuleLoadOptions } from 'inversify'; import { ServiceIdentifiers } from '../../ServiceIdentifiers'; import { IRenamePropertiesReplacer } from '../../../interfaces/node-transformers/rename-properties-transformers/replacer/IRenamePropertiesReplacer'; @@ -9,14 +9,14 @@ import { NodeTransformer } from '../../../enums/node-transformers/NodeTransforme import { RenamePropertiesReplacer } from '../../../node-transformers/rename-properties-transformers/replacer/RenamePropertiesReplacer'; import { RenamePropertiesTransformer } from '../../../node-transformers/rename-properties-transformers/RenamePropertiesTransformer'; -export const renamePropertiesTransformersModule: interfaces.ContainerModule = new ContainerModule( - (bind: interfaces.Bind) => { +export const renamePropertiesTransformersModule: ContainerModule = new ContainerModule( + (options: ContainerModuleLoadOptions) => { // rename properties transformers - bind(ServiceIdentifiers.INodeTransformer) + options.bind(ServiceIdentifiers.INodeTransformer) .to(RenamePropertiesTransformer) - .whenTargetNamed(NodeTransformer.RenamePropertiesTransformer); + .whenNamed(NodeTransformer.RenamePropertiesTransformer); // rename properties obfuscating replacer - bind(ServiceIdentifiers.IRenamePropertiesReplacer).to(RenamePropertiesReplacer); + options.bind(ServiceIdentifiers.IRenamePropertiesReplacer).to(RenamePropertiesReplacer); } ); diff --git a/src/container/modules/node-transformers/SimplifyingTransformersModule.ts b/src/container/modules/node-transformers/SimplifyingTransformersModule.ts index ea1c8163c..b5ad95e4c 100644 --- a/src/container/modules/node-transformers/SimplifyingTransformersModule.ts +++ b/src/container/modules/node-transformers/SimplifyingTransformersModule.ts @@ -1,4 +1,4 @@ -import { ContainerModule, interfaces } from 'inversify'; +import { ContainerModule, ContainerModuleLoadOptions } from 'inversify'; import { ServiceIdentifiers } from '../../ServiceIdentifiers'; import { INodeTransformer } from '../../../interfaces/node-transformers/INodeTransformer'; @@ -10,23 +10,23 @@ import { ExpressionStatementsMergeTransformer } from '../../../node-transformers import { IfStatementSimplifyTransformer } from '../../../node-transformers/simplifying-transformers/IfStatementSimplifyTransformer'; import { VariableDeclarationsMergeTransformer } from '../../../node-transformers/simplifying-transformers/VariableDeclarationsMergeTransformer'; -export const simplifyingTransformersModule: interfaces.ContainerModule = new ContainerModule( - (bind: interfaces.Bind) => { +export const simplifyingTransformersModule: ContainerModule = new ContainerModule( + (options: ContainerModuleLoadOptions) => { // simplifying transformers - bind(ServiceIdentifiers.INodeTransformer) + options.bind(ServiceIdentifiers.INodeTransformer) .to(BlockStatementSimplifyTransformer) - .whenTargetNamed(NodeTransformer.BlockStatementSimplifyTransformer); + .whenNamed(NodeTransformer.BlockStatementSimplifyTransformer); - bind(ServiceIdentifiers.INodeTransformer) + options.bind(ServiceIdentifiers.INodeTransformer) .to(ExpressionStatementsMergeTransformer) - .whenTargetNamed(NodeTransformer.ExpressionStatementsMergeTransformer); + .whenNamed(NodeTransformer.ExpressionStatementsMergeTransformer); - bind(ServiceIdentifiers.INodeTransformer) + options.bind(ServiceIdentifiers.INodeTransformer) .to(IfStatementSimplifyTransformer) - .whenTargetNamed(NodeTransformer.IfStatementSimplifyTransformer); + .whenNamed(NodeTransformer.IfStatementSimplifyTransformer); - bind(ServiceIdentifiers.INodeTransformer) + options.bind(ServiceIdentifiers.INodeTransformer) .to(VariableDeclarationsMergeTransformer) - .whenTargetNamed(NodeTransformer.VariableDeclarationsMergeTransformer); + .whenNamed(NodeTransformer.VariableDeclarationsMergeTransformer); } ); diff --git a/src/container/modules/node-transformers/StringArrayTransformersModule.ts b/src/container/modules/node-transformers/StringArrayTransformersModule.ts index 1c5d1c4ae..d614a1c0f 100644 --- a/src/container/modules/node-transformers/StringArrayTransformersModule.ts +++ b/src/container/modules/node-transformers/StringArrayTransformersModule.ts @@ -1,4 +1,4 @@ -import { ContainerModule, interfaces } from 'inversify'; +import { ContainerModule, ContainerModuleLoadOptions } from 'inversify'; import { ServiceIdentifiers } from '../../ServiceIdentifiers'; import { INodeTransformer } from '../../../interfaces/node-transformers/INodeTransformer'; @@ -9,19 +9,19 @@ import { StringArrayRotateFunctionTransformer } from '../../../node-transformers import { StringArrayScopeCallsWrapperTransformer } from '../../../node-transformers/string-array-transformers/StringArrayScopeCallsWrapperTransformer'; import { StringArrayTransformer } from '../../../node-transformers/string-array-transformers/StringArrayTransformer'; -export const stringArrayTransformersModule: interfaces.ContainerModule = new ContainerModule( - (bind: interfaces.Bind) => { +export const stringArrayTransformersModule: ContainerModule = new ContainerModule( + (options: ContainerModuleLoadOptions) => { // strings transformers - bind(ServiceIdentifiers.INodeTransformer) + options.bind(ServiceIdentifiers.INodeTransformer) .to(StringArrayRotateFunctionTransformer) - .whenTargetNamed(NodeTransformer.StringArrayRotateFunctionTransformer); + .whenNamed(NodeTransformer.StringArrayRotateFunctionTransformer); - bind(ServiceIdentifiers.INodeTransformer) + options.bind(ServiceIdentifiers.INodeTransformer) .to(StringArrayScopeCallsWrapperTransformer) - .whenTargetNamed(NodeTransformer.StringArrayScopeCallsWrapperTransformer); + .whenNamed(NodeTransformer.StringArrayScopeCallsWrapperTransformer); - bind(ServiceIdentifiers.INodeTransformer) + options.bind(ServiceIdentifiers.INodeTransformer) .to(StringArrayTransformer) - .whenTargetNamed(NodeTransformer.StringArrayTransformer); + .whenNamed(NodeTransformer.StringArrayTransformer); } ); diff --git a/src/container/modules/node/NodeModule.ts b/src/container/modules/node/NodeModule.ts index 71f2143de..36ebec7cd 100644 --- a/src/container/modules/node/NodeModule.ts +++ b/src/container/modules/node/NodeModule.ts @@ -1,13 +1,13 @@ -import { ContainerModule, interfaces } from 'inversify'; +import { ContainerModule, ContainerModuleLoadOptions } from 'inversify'; import { ServiceIdentifiers } from '../../ServiceIdentifiers'; import { IScopeIdentifiersTraverser } from '../../../interfaces/node/IScopeIdentifiersTraverser'; import { ScopeIdentifiersTraverser } from '../../../node/ScopeIdentifiersTraverser'; -export const nodeModule: interfaces.ContainerModule = new ContainerModule((bind: interfaces.Bind) => { +export const nodeModule: ContainerModule = new ContainerModule((options: ContainerModuleLoadOptions) => { // scope identifiers traverser - bind(ServiceIdentifiers.IScopeIdentifiersTraverser) + options.bind(ServiceIdentifiers.IScopeIdentifiersTraverser) .to(ScopeIdentifiersTraverser) .inSingletonScope(); }); diff --git a/src/container/modules/options/OptionsModule.ts b/src/container/modules/options/OptionsModule.ts index 1e6fc1502..309e215d7 100644 --- a/src/container/modules/options/OptionsModule.ts +++ b/src/container/modules/options/OptionsModule.ts @@ -1,4 +1,4 @@ -import { ContainerModule, interfaces } from 'inversify'; +import { ContainerModule, ContainerModuleLoadOptions } from 'inversify'; import { ServiceIdentifiers } from '../../ServiceIdentifiers'; import { IOptions } from '../../../interfaces/options/IOptions'; @@ -7,8 +7,8 @@ import { IOptionsNormalizer } from '../../../interfaces/options/IOptionsNormaliz import { Options } from '../../../options/Options'; import { OptionsNormalizer } from '../../../options/OptionsNormalizer'; -export const optionsModule: interfaces.ContainerModule = new ContainerModule((bind: interfaces.Bind) => { - bind(ServiceIdentifiers.IOptions).to(Options).inSingletonScope(); +export const optionsModule: ContainerModule = new ContainerModule((options: ContainerModuleLoadOptions) => { + options.bind(ServiceIdentifiers.IOptions).to(Options).inSingletonScope(); - bind(ServiceIdentifiers.IOptionsNormalizer).to(OptionsNormalizer).inSingletonScope(); + options.bind(ServiceIdentifiers.IOptionsNormalizer).to(OptionsNormalizer).inSingletonScope(); }); diff --git a/src/container/modules/storages/StoragesModule.ts b/src/container/modules/storages/StoragesModule.ts index ead8cdc42..a744cd1f0 100644 --- a/src/container/modules/storages/StoragesModule.ts +++ b/src/container/modules/storages/StoragesModule.ts @@ -1,8 +1,6 @@ -import { ContainerModule, interfaces } from 'inversify'; +import { ContainerModule, ContainerModuleLoadOptions, ResolutionContext, Factory } from 'inversify'; import { ServiceIdentifiers } from '../../ServiceIdentifiers'; -import { TControlFlowStorageFactory } from '../../../types/container/node-transformers/TControlFlowStorageFactory'; -import { TControlFlowStorageFactoryCreator } from '../../../types/container/node-transformers/TControlFlowStorageFactoryCreator'; import { TCustomCodeHelperGroupStorage } from '../../../types/storages/TCustomCodeHelperGroupStorage'; import { IControlFlowStorage } from '../../../interfaces/storages/control-flow-transformers/IControlFlowStorage'; @@ -25,50 +23,59 @@ import { StringControlFlowStorage } from '../../../storages/control-flow-transfo import { StringArrayStorage } from '../../../storages/string-array-transformers/StringArrayStorage'; import { VisitedLexicalScopeNodesStackStorage } from '../../../storages/string-array-transformers/VisitedLexicalScopeNodesStackStorage'; -export const storagesModule: interfaces.ContainerModule = new ContainerModule((bind: interfaces.Bind) => { +export const storagesModule: ContainerModule = new ContainerModule((options: ContainerModuleLoadOptions) => { // storages - bind(ServiceIdentifiers.TCustomNodeGroupStorage) + options + .bind(ServiceIdentifiers.TCustomNodeGroupStorage) .to(CustomCodeHelperGroupStorage) .inSingletonScope(); - bind(ServiceIdentifiers.IControlFlowStorage) + options + .bind(ServiceIdentifiers.IControlFlowStorage) .to(FunctionControlFlowStorage) - .whenTargetNamed(ControlFlowStorage.FunctionControlFlowStorage); + .whenNamed(ControlFlowStorage.FunctionControlFlowStorage); - bind(ServiceIdentifiers.IGlobalIdentifierNamesCacheStorage) + options + .bind(ServiceIdentifiers.IGlobalIdentifierNamesCacheStorage) .to(GlobalIdentifierNamesCacheStorage) .inSingletonScope(); - bind(ServiceIdentifiers.ILiteralNodesCacheStorage) + options + .bind(ServiceIdentifiers.ILiteralNodesCacheStorage) .to(LiteralNodesCacheStorage) .inSingletonScope(); - bind(ServiceIdentifiers.IPropertyIdentifierNamesCacheStorage) + options + .bind(ServiceIdentifiers.IPropertyIdentifierNamesCacheStorage) .to(PropertyIdentifierNamesCacheStorage) .inSingletonScope(); - bind(ServiceIdentifiers.IStringArrayStorage).to(StringArrayStorage).inSingletonScope(); + options.bind(ServiceIdentifiers.IStringArrayStorage).to(StringArrayStorage).inSingletonScope(); - bind(ServiceIdentifiers.IStringArrayScopeCallsWrappersDataStorage) + options + .bind(ServiceIdentifiers.IStringArrayScopeCallsWrappersDataStorage) .to(StringArrayScopeCallsWrappersDataStorage) .inSingletonScope(); - bind(ServiceIdentifiers.IControlFlowStorage) + options + .bind(ServiceIdentifiers.IControlFlowStorage) .to(StringControlFlowStorage) - .whenTargetNamed(ControlFlowStorage.StringControlFlowStorage); + .whenNamed(ControlFlowStorage.StringControlFlowStorage); - bind(ServiceIdentifiers.IVisitedLexicalScopeNodesStackStorage) + options + .bind(ServiceIdentifiers.IVisitedLexicalScopeNodesStackStorage) .to(VisitedLexicalScopeNodesStackStorage) .inSingletonScope(); // controlFlowStorage factory - bind(ServiceIdentifiers.Factory__TControlFlowStorage).toFactory( - (context: interfaces.Context): TControlFlowStorageFactoryCreator => - (controlFlowStorageName: ControlFlowStorage): TControlFlowStorageFactory => - (): IControlFlowStorage => - context.container.getNamed( - ServiceIdentifiers.IControlFlowStorage, - controlFlowStorageName - ) - ); + options + .bind IControlFlowStorage, [ControlFlowStorage]>>(ServiceIdentifiers.Factory__TControlFlowStorage) + .toFactory( + (context: ResolutionContext) => + (controlFlowStorageName: ControlFlowStorage): (() => IControlFlowStorage) => + () => + context.get(ServiceIdentifiers.IControlFlowStorage, { + name: controlFlowStorageName + }) + ); }); diff --git a/src/container/modules/utils/UtilsModule.ts b/src/container/modules/utils/UtilsModule.ts index 5b31f33ae..d5d7fbc0d 100644 --- a/src/container/modules/utils/UtilsModule.ts +++ b/src/container/modules/utils/UtilsModule.ts @@ -1,4 +1,4 @@ -import { ContainerModule, interfaces } from 'inversify'; +import { ContainerModule, ContainerModuleLoadOptions } from 'inversify'; import { ServiceIdentifiers } from '../../ServiceIdentifiers'; import { IArrayUtils } from '../../../interfaces/utils/IArrayUtils'; @@ -17,29 +17,29 @@ import { LevelledTopologicalSorter } from '../../../utils/LevelledTopologicalSor import { RandomGenerator } from '../../../utils/RandomGenerator'; import { SetUtils } from '../../../utils/SetUtils'; -export const utilsModule: interfaces.ContainerModule = new ContainerModule((bind: interfaces.Bind) => { +export const utilsModule: ContainerModule = new ContainerModule((options: ContainerModuleLoadOptions) => { // array utils - bind(ServiceIdentifiers.IArrayUtils).to(ArrayUtils).inSingletonScope(); + options.bind(ServiceIdentifiers.IArrayUtils).to(ArrayUtils).inSingletonScope(); // random generator - bind(ServiceIdentifiers.IRandomGenerator).to(RandomGenerator).inSingletonScope(); + options.bind(ServiceIdentifiers.IRandomGenerator).to(RandomGenerator).inSingletonScope(); // crypt utils - bind(ServiceIdentifiers.ICryptUtils).to(CryptUtils).inSingletonScope(); + options.bind(ServiceIdentifiers.ICryptUtils).to(CryptUtils).inSingletonScope(); // crypt utils for string array - bind(ServiceIdentifiers.ICryptUtilsStringArray) + options.bind(ServiceIdentifiers.ICryptUtilsStringArray) .to(CryptUtilsStringArray) .inSingletonScope(); // escape sequence encoder - bind(ServiceIdentifiers.IEscapeSequenceEncoder) + options.bind(ServiceIdentifiers.IEscapeSequenceEncoder) .to(EscapeSequenceEncoder) .inSingletonScope(); // levelled topological sorter - bind(ServiceIdentifiers.ILevelledTopologicalSorter).to(LevelledTopologicalSorter); + options.bind(ServiceIdentifiers.ILevelledTopologicalSorter).to(LevelledTopologicalSorter); // set utils - bind(ServiceIdentifiers.ISetUtils).to(SetUtils).inSingletonScope(); + options.bind(ServiceIdentifiers.ISetUtils).to(SetUtils).inSingletonScope(); }); diff --git a/src/custom-code-helpers/calls-controller/CallsControllerFunctionCodeHelper.ts b/src/custom-code-helpers/calls-controller/CallsControllerFunctionCodeHelper.ts index 4f6758ef7..50eb9eb37 100644 --- a/src/custom-code-helpers/calls-controller/CallsControllerFunctionCodeHelper.ts +++ b/src/custom-code-helpers/calls-controller/CallsControllerFunctionCodeHelper.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory'; @@ -18,6 +18,7 @@ import { SingleCallControllerTemplate } from '../common/templates/SingleCallCont import { AbstractCustomCodeHelper } from '../AbstractCustomCodeHelper'; import { NodeUtils } from '../../node/NodeUtils'; +@injectFromBase() @injectable() export class CallsControllerFunctionCodeHelper extends AbstractCustomCodeHelper { /** diff --git a/src/custom-code-helpers/console-output/ConsoleOutputDisableCodeHelper.ts b/src/custom-code-helpers/console-output/ConsoleOutputDisableCodeHelper.ts index f342aedf2..5a25edc65 100644 --- a/src/custom-code-helpers/console-output/ConsoleOutputDisableCodeHelper.ts +++ b/src/custom-code-helpers/console-output/ConsoleOutputDisableCodeHelper.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory'; @@ -16,6 +16,7 @@ import { initializable } from '../../decorators/Initializable'; import { AbstractCustomCodeHelper } from '../AbstractCustomCodeHelper'; import { NodeUtils } from '../../node/NodeUtils'; +@injectFromBase() @injectable() export class ConsoleOutputDisableCodeHelper extends AbstractCustomCodeHelper { /** diff --git a/src/custom-code-helpers/console-output/group/ConsoleOutputCodeHelperGroup.ts b/src/custom-code-helpers/console-output/group/ConsoleOutputCodeHelperGroup.ts index 75f584ea1..4f2c8013c 100644 --- a/src/custom-code-helpers/console-output/group/ConsoleOutputCodeHelperGroup.ts +++ b/src/custom-code-helpers/console-output/group/ConsoleOutputCodeHelperGroup.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers'; import { TCustomCodeHelperFactory } from '../../../types/container/custom-code-helpers/TCustomCodeHelperFactory'; @@ -23,6 +23,7 @@ import { ConsoleOutputDisableCodeHelper } from '../ConsoleOutputDisableCodeHelpe import { NodeAppender } from '../../../node/NodeAppender'; import { NodeLexicalScopeUtils } from '../../../node/NodeLexicalScopeUtils'; +@injectFromBase() @injectable() export class ConsoleOutputCodeHelperGroup extends AbstractCustomCodeHelperGroup { /** diff --git a/src/custom-code-helpers/debug-protection/DebugProtectionFunctionCallCodeHelper.ts b/src/custom-code-helpers/debug-protection/DebugProtectionFunctionCallCodeHelper.ts index c00476ecd..7d61c16b2 100644 --- a/src/custom-code-helpers/debug-protection/DebugProtectionFunctionCallCodeHelper.ts +++ b/src/custom-code-helpers/debug-protection/DebugProtectionFunctionCallCodeHelper.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory'; @@ -16,6 +16,7 @@ import { DebugProtectionFunctionCallTemplate } from './templates/debug-protectio import { AbstractCustomCodeHelper } from '../AbstractCustomCodeHelper'; import { NodeUtils } from '../../node/NodeUtils'; +@injectFromBase() @injectable() export class DebugProtectionFunctionCallCodeHelper extends AbstractCustomCodeHelper { /** diff --git a/src/custom-code-helpers/debug-protection/DebugProtectionFunctionCodeHelper.ts b/src/custom-code-helpers/debug-protection/DebugProtectionFunctionCodeHelper.ts index 381521de2..798bfe730 100644 --- a/src/custom-code-helpers/debug-protection/DebugProtectionFunctionCodeHelper.ts +++ b/src/custom-code-helpers/debug-protection/DebugProtectionFunctionCodeHelper.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory'; @@ -20,6 +20,7 @@ import { DebugProtectionFunctionTemplate } from './templates/debug-protection-fu import { AbstractCustomCodeHelper } from '../AbstractCustomCodeHelper'; import { NodeUtils } from '../../node/NodeUtils'; +@injectFromBase() @injectable() export class DebugProtectionFunctionCodeHelper extends AbstractCustomCodeHelper { /** diff --git a/src/custom-code-helpers/debug-protection/DebugProtectionFunctionIntervalCodeHelper.ts b/src/custom-code-helpers/debug-protection/DebugProtectionFunctionIntervalCodeHelper.ts index 78e8dc187..29c990b55 100644 --- a/src/custom-code-helpers/debug-protection/DebugProtectionFunctionIntervalCodeHelper.ts +++ b/src/custom-code-helpers/debug-protection/DebugProtectionFunctionIntervalCodeHelper.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory'; @@ -19,6 +19,7 @@ import { GlobalVariableNoEvalTemplate } from '../common/templates/GlobalVariable import { AbstractCustomCodeHelper } from '../AbstractCustomCodeHelper'; import { NodeUtils } from '../../node/NodeUtils'; +@injectFromBase() @injectable() export class DebugProtectionFunctionIntervalCodeHelper extends AbstractCustomCodeHelper { /** diff --git a/src/custom-code-helpers/debug-protection/group/DebugProtectionCodeHelperGroup.ts b/src/custom-code-helpers/debug-protection/group/DebugProtectionCodeHelperGroup.ts index 14ad7cfdb..1ae1faac5 100644 --- a/src/custom-code-helpers/debug-protection/group/DebugProtectionCodeHelperGroup.ts +++ b/src/custom-code-helpers/debug-protection/group/DebugProtectionCodeHelperGroup.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers'; import { TCustomCodeHelperFactory } from '../../../types/container/custom-code-helpers/TCustomCodeHelperFactory'; @@ -26,6 +26,7 @@ import { NodeAppender } from '../../../node/NodeAppender'; import { NodeGuards } from '../../../node/NodeGuards'; import { NodeLexicalScopeUtils } from '../../../node/NodeLexicalScopeUtils'; +@injectFromBase() @injectable() export class DebugProtectionCodeHelperGroup extends AbstractCustomCodeHelperGroup { /** diff --git a/src/custom-code-helpers/domain-lock/DomainLockCodeHelper.ts b/src/custom-code-helpers/domain-lock/DomainLockCodeHelper.ts index eb683161a..740530e69 100644 --- a/src/custom-code-helpers/domain-lock/DomainLockCodeHelper.ts +++ b/src/custom-code-helpers/domain-lock/DomainLockCodeHelper.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory'; @@ -20,6 +20,7 @@ import { GlobalVariableNoEvalTemplate } from '../common/templates/GlobalVariable import { AbstractCustomCodeHelper } from '../AbstractCustomCodeHelper'; import { NodeUtils } from '../../node/NodeUtils'; +@injectFromBase() @injectable() export class DomainLockCodeHelper extends AbstractCustomCodeHelper { /** diff --git a/src/custom-code-helpers/domain-lock/group/DomainLockCustomCodeHelperGroup.ts b/src/custom-code-helpers/domain-lock/group/DomainLockCustomCodeHelperGroup.ts index e768d03fa..0213a83d6 100644 --- a/src/custom-code-helpers/domain-lock/group/DomainLockCustomCodeHelperGroup.ts +++ b/src/custom-code-helpers/domain-lock/group/DomainLockCustomCodeHelperGroup.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers'; import { TCustomCodeHelperFactory } from '../../../types/container/custom-code-helpers/TCustomCodeHelperFactory'; @@ -23,6 +23,7 @@ import { DomainLockCodeHelper } from '../DomainLockCodeHelper'; import { NodeAppender } from '../../../node/NodeAppender'; import { NodeLexicalScopeUtils } from '../../../node/NodeLexicalScopeUtils'; +@injectFromBase() @injectable() export class DomainLockCustomCodeHelperGroup extends AbstractCustomCodeHelperGroup { /** diff --git a/src/custom-code-helpers/self-defending/SelfDefendingCodeHelper.ts b/src/custom-code-helpers/self-defending/SelfDefendingCodeHelper.ts index b03a052c2..e35856251 100644 --- a/src/custom-code-helpers/self-defending/SelfDefendingCodeHelper.ts +++ b/src/custom-code-helpers/self-defending/SelfDefendingCodeHelper.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory'; @@ -16,6 +16,7 @@ import { SelfDefendingTemplate } from './templates/SelfDefendingTemplate'; import { AbstractCustomCodeHelper } from '../AbstractCustomCodeHelper'; import { NodeUtils } from '../../node/NodeUtils'; +@injectFromBase() @injectable() export class SelfDefendingCodeHelper extends AbstractCustomCodeHelper { /** diff --git a/src/custom-code-helpers/self-defending/group/SelfDefendingCodeHelperGroup.ts b/src/custom-code-helpers/self-defending/group/SelfDefendingCodeHelperGroup.ts index ebb46590c..810db865d 100644 --- a/src/custom-code-helpers/self-defending/group/SelfDefendingCodeHelperGroup.ts +++ b/src/custom-code-helpers/self-defending/group/SelfDefendingCodeHelperGroup.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers'; import { TCustomCodeHelperFactory } from '../../../types/container/custom-code-helpers/TCustomCodeHelperFactory'; @@ -23,6 +23,7 @@ import { NodeAppender } from '../../../node/NodeAppender'; import { NodeLexicalScopeUtils } from '../../../node/NodeLexicalScopeUtils'; import { SelfDefendingCodeHelper } from '../SelfDefendingCodeHelper'; +@injectFromBase() @injectable() export class SelfDefendingCodeHelperGroup extends AbstractCustomCodeHelperGroup { /** diff --git a/src/custom-code-helpers/string-array/StringArrayCallsWrapperBase64CodeHelper.ts b/src/custom-code-helpers/string-array/StringArrayCallsWrapperBase64CodeHelper.ts index 61cf1113d..42e1e76df 100644 --- a/src/custom-code-helpers/string-array/StringArrayCallsWrapperBase64CodeHelper.ts +++ b/src/custom-code-helpers/string-array/StringArrayCallsWrapperBase64CodeHelper.ts @@ -1,10 +1,11 @@ -import { injectable } from 'inversify'; +import { injectable, injectFromBase } from 'inversify'; import { AtobTemplate } from './templates/string-array-calls-wrapper/AtobTemplate'; import { StringArrayBase64DecodeTemplate } from './templates/string-array-calls-wrapper/StringArrayBase64DecodeTemplate'; import { StringArrayCallsWrapperCodeHelper } from './StringArrayCallsWrapperCodeHelper'; +@injectFromBase() @injectable() export class StringArrayCallsWrapperBase64CodeHelper extends StringArrayCallsWrapperCodeHelper { /** diff --git a/src/custom-code-helpers/string-array/StringArrayCallsWrapperCodeHelper.ts b/src/custom-code-helpers/string-array/StringArrayCallsWrapperCodeHelper.ts index ac4e30051..b7dfee192 100644 --- a/src/custom-code-helpers/string-array/StringArrayCallsWrapperCodeHelper.ts +++ b/src/custom-code-helpers/string-array/StringArrayCallsWrapperCodeHelper.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory'; @@ -18,6 +18,7 @@ import { StringArrayCallsWrapperTemplate } from './templates/string-array-calls- import { AbstractCustomCodeHelper } from '../AbstractCustomCodeHelper'; import { NodeUtils } from '../../node/NodeUtils'; +@injectFromBase() @injectable() export class StringArrayCallsWrapperCodeHelper extends AbstractCustomCodeHelper { /** diff --git a/src/custom-code-helpers/string-array/StringArrayCallsWrapperRc4CodeHelper.ts b/src/custom-code-helpers/string-array/StringArrayCallsWrapperRc4CodeHelper.ts index 2f830cbda..b9c7dd223 100644 --- a/src/custom-code-helpers/string-array/StringArrayCallsWrapperRc4CodeHelper.ts +++ b/src/custom-code-helpers/string-array/StringArrayCallsWrapperRc4CodeHelper.ts @@ -1,4 +1,4 @@ -import { injectable } from 'inversify'; +import { injectable, injectFromBase } from 'inversify'; import { AtobTemplate } from './templates/string-array-calls-wrapper/AtobTemplate'; import { Rc4Template } from './templates/string-array-calls-wrapper/Rc4Template'; @@ -6,6 +6,7 @@ import { StringArrayRC4DecodeTemplate } from './templates/string-array-calls-wra import { StringArrayCallsWrapperCodeHelper } from './StringArrayCallsWrapperCodeHelper'; +@injectFromBase() @injectable() export class StringArrayCallsWrapperRc4CodeHelper extends StringArrayCallsWrapperCodeHelper { /** diff --git a/src/custom-code-helpers/string-array/StringArrayCodeHelper.ts b/src/custom-code-helpers/string-array/StringArrayCodeHelper.ts index 47ce86139..b0822be96 100644 --- a/src/custom-code-helpers/string-array/StringArrayCodeHelper.ts +++ b/src/custom-code-helpers/string-array/StringArrayCodeHelper.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory'; @@ -19,6 +19,7 @@ import { AbstractCustomCodeHelper } from '../AbstractCustomCodeHelper'; import { NodeUtils } from '../../node/NodeUtils'; import { StringUtils } from '../../utils/StringUtils'; +@injectFromBase() @injectable() export class StringArrayCodeHelper extends AbstractCustomCodeHelper { /** diff --git a/src/custom-code-helpers/string-array/StringArrayRotateFunctionCodeHelper.ts b/src/custom-code-helpers/string-array/StringArrayRotateFunctionCodeHelper.ts index 563c87495..f36159ba0 100644 --- a/src/custom-code-helpers/string-array/StringArrayRotateFunctionCodeHelper.ts +++ b/src/custom-code-helpers/string-array/StringArrayRotateFunctionCodeHelper.ts @@ -1,5 +1,5 @@ import type { Expression } from 'estree'; -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory'; @@ -17,6 +17,7 @@ import { StringArrayRotateFunctionTemplate } from './templates/string-array-rota import { AbstractCustomCodeHelper } from '../AbstractCustomCodeHelper'; import { NodeUtils } from '../../node/NodeUtils'; +@injectFromBase() @injectable() export class StringArrayRotateFunctionCodeHelper extends AbstractCustomCodeHelper { /** diff --git a/src/custom-code-helpers/string-array/group/StringArrayCodeHelperGroup.ts b/src/custom-code-helpers/string-array/group/StringArrayCodeHelperGroup.ts index 242dd8e34..0368e7cbc 100644 --- a/src/custom-code-helpers/string-array/group/StringArrayCodeHelperGroup.ts +++ b/src/custom-code-helpers/string-array/group/StringArrayCodeHelperGroup.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers'; import { TCustomCodeHelperFactory } from '../../../types/container/custom-code-helpers/TCustomCodeHelperFactory'; @@ -24,6 +24,7 @@ import { NodeAppender } from '../../../node/NodeAppender'; import { StringArrayCallsWrapperCodeHelper } from '../StringArrayCallsWrapperCodeHelper'; import { StringArrayCodeHelper } from '../StringArrayCodeHelper'; +@injectFromBase() @injectable() export class StringArrayCodeHelperGroup extends AbstractCustomCodeHelperGroup { /** diff --git a/src/custom-nodes/control-flow-flattening-nodes/BinaryExpressionFunctionNode.ts b/src/custom-nodes/control-flow-flattening-nodes/BinaryExpressionFunctionNode.ts index 55c02da8a..d7bc4e670 100644 --- a/src/custom-nodes/control-flow-flattening-nodes/BinaryExpressionFunctionNode.ts +++ b/src/custom-nodes/control-flow-flattening-nodes/BinaryExpressionFunctionNode.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import type { BinaryOperator } from 'estree'; @@ -14,6 +14,7 @@ import { AbstractCustomNode } from '../AbstractCustomNode'; import { NodeFactory } from '../../node/NodeFactory'; import { NodeUtils } from '../../node/NodeUtils'; +@injectFromBase() @injectable() export class BinaryExpressionFunctionNode extends AbstractCustomNode { /** diff --git a/src/custom-nodes/control-flow-flattening-nodes/BlockStatementControlFlowFlatteningNode.ts b/src/custom-nodes/control-flow-flattening-nodes/BlockStatementControlFlowFlatteningNode.ts index 84f64b935..b17f8d70c 100644 --- a/src/custom-nodes/control-flow-flattening-nodes/BlockStatementControlFlowFlatteningNode.ts +++ b/src/custom-nodes/control-flow-flattening-nodes/BlockStatementControlFlowFlatteningNode.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import * as ESTree from 'estree'; @@ -19,6 +19,7 @@ import { NodeFactory } from '../../node/NodeFactory'; import { NodeGuards } from '../../node/NodeGuards'; import { NodeUtils } from '../../node/NodeUtils'; +@injectFromBase() @injectable() export class BlockStatementControlFlowFlatteningNode extends AbstractCustomNode { /** diff --git a/src/custom-nodes/control-flow-flattening-nodes/CallExpressionFunctionNode.ts b/src/custom-nodes/control-flow-flattening-nodes/CallExpressionFunctionNode.ts index 8202db775..eba2a228f 100644 --- a/src/custom-nodes/control-flow-flattening-nodes/CallExpressionFunctionNode.ts +++ b/src/custom-nodes/control-flow-flattening-nodes/CallExpressionFunctionNode.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import * as ESTree from 'estree'; @@ -17,6 +17,7 @@ import { NodeFactory } from '../../node/NodeFactory'; import { NodeUtils } from '../../node/NodeUtils'; import { NodeGuards } from '../../node/NodeGuards'; +@injectFromBase() @injectable() export class CallExpressionFunctionNode extends AbstractCustomNode { /** diff --git a/src/custom-nodes/control-flow-flattening-nodes/LiteralNode.ts b/src/custom-nodes/control-flow-flattening-nodes/LiteralNode.ts index 29097ceb7..a0f5c9c20 100644 --- a/src/custom-nodes/control-flow-flattening-nodes/LiteralNode.ts +++ b/src/custom-nodes/control-flow-flattening-nodes/LiteralNode.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import type * as ESTree from 'estree'; @@ -15,6 +15,7 @@ import { initializable } from '../../decorators/Initializable'; import { AbstractCustomNode } from '../AbstractCustomNode'; import { NodeFactory } from '../../node/NodeFactory'; +@injectFromBase() @injectable() export class LiteralNode extends AbstractCustomNode { /** diff --git a/src/custom-nodes/control-flow-flattening-nodes/LogicalExpressionFunctionNode.ts b/src/custom-nodes/control-flow-flattening-nodes/LogicalExpressionFunctionNode.ts index 65da3d95c..cc728f735 100644 --- a/src/custom-nodes/control-flow-flattening-nodes/LogicalExpressionFunctionNode.ts +++ b/src/custom-nodes/control-flow-flattening-nodes/LogicalExpressionFunctionNode.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import type { LogicalOperator } from 'estree'; @@ -14,6 +14,7 @@ import { AbstractCustomNode } from '../AbstractCustomNode'; import { NodeFactory } from '../../node/NodeFactory'; import { NodeUtils } from '../../node/NodeUtils'; +@injectFromBase() @injectable() export class LogicalExpressionFunctionNode extends AbstractCustomNode { /** diff --git a/src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/CallExpressionControlFlowStorageCallNode.ts b/src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/CallExpressionControlFlowStorageCallNode.ts index a024ec1a3..972f97650 100644 --- a/src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/CallExpressionControlFlowStorageCallNode.ts +++ b/src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/CallExpressionControlFlowStorageCallNode.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers'; import type * as ESTree from 'estree'; @@ -16,6 +16,7 @@ import { AbstractCustomNode } from '../../AbstractCustomNode'; import { NodeFactory } from '../../../node/NodeFactory'; import { NodeUtils } from '../../../node/NodeUtils'; +@injectFromBase() @injectable() export class CallExpressionControlFlowStorageCallNode extends AbstractCustomNode { /** diff --git a/src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/ControlFlowStorageNode.ts b/src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/ControlFlowStorageNode.ts index 463f6a16e..c0e7718c9 100644 --- a/src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/ControlFlowStorageNode.ts +++ b/src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/ControlFlowStorageNode.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers'; import * as ESTree from 'estree'; @@ -18,6 +18,7 @@ import { AbstractCustomNode } from '../../AbstractCustomNode'; import { NodeFactory } from '../../../node/NodeFactory'; import { NodeGuards } from '../../../node/NodeGuards'; +@injectFromBase() @injectable() export class ControlFlowStorageNode extends AbstractCustomNode { /** diff --git a/src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/ExpressionWithOperatorControlFlowStorageCallNode.ts b/src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/ExpressionWithOperatorControlFlowStorageCallNode.ts index a5cc0eec5..d4fc1740d 100644 --- a/src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/ExpressionWithOperatorControlFlowStorageCallNode.ts +++ b/src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/ExpressionWithOperatorControlFlowStorageCallNode.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers'; import type { Expression } from 'estree'; @@ -16,6 +16,7 @@ import { AbstractCustomNode } from '../../AbstractCustomNode'; import { NodeFactory } from '../../../node/NodeFactory'; import { NodeUtils } from '../../../node/NodeUtils'; +@injectFromBase() @injectable() export class ExpressionWithOperatorControlFlowStorageCallNode extends AbstractCustomNode { /** diff --git a/src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/StringLiteralControlFlowStorageCallNode.ts b/src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/StringLiteralControlFlowStorageCallNode.ts index a597e0161..daa632fa6 100644 --- a/src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/StringLiteralControlFlowStorageCallNode.ts +++ b/src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/StringLiteralControlFlowStorageCallNode.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers'; import { TIdentifierNamesGeneratorFactory } from '../../../types/container/generators/TIdentifierNamesGeneratorFactory'; @@ -14,6 +14,7 @@ import { AbstractCustomNode } from '../../AbstractCustomNode'; import { NodeFactory } from '../../../node/NodeFactory'; import { NodeUtils } from '../../../node/NodeUtils'; +@injectFromBase() @injectable() export class StringLiteralControlFlowStorageCallNode extends AbstractCustomNode { /** diff --git a/src/custom-nodes/dead-code-injection-nodes/BlockStatementDeadCodeInjectionNode.ts b/src/custom-nodes/dead-code-injection-nodes/BlockStatementDeadCodeInjectionNode.ts index c711d1525..dc2bbe9da 100644 --- a/src/custom-nodes/dead-code-injection-nodes/BlockStatementDeadCodeInjectionNode.ts +++ b/src/custom-nodes/dead-code-injection-nodes/BlockStatementDeadCodeInjectionNode.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import type { BinaryOperator, BlockStatement } from 'estree'; @@ -14,6 +14,7 @@ import { AbstractCustomNode } from '../AbstractCustomNode'; import { NodeFactory } from '../../node/NodeFactory'; import { NodeUtils } from '../../node/NodeUtils'; +@injectFromBase() @injectable() export class BlockStatementDeadCodeInjectionNode extends AbstractCustomNode { /** diff --git a/src/custom-nodes/object-expression-keys-transformer-nodes/ObjectExpressionVariableDeclarationHostNode.ts b/src/custom-nodes/object-expression-keys-transformer-nodes/ObjectExpressionVariableDeclarationHostNode.ts index dfdd1a152..9477c3bde 100644 --- a/src/custom-nodes/object-expression-keys-transformer-nodes/ObjectExpressionVariableDeclarationHostNode.ts +++ b/src/custom-nodes/object-expression-keys-transformer-nodes/ObjectExpressionVariableDeclarationHostNode.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import * as ESTree from 'estree'; @@ -15,6 +15,7 @@ import { AbstractCustomNode } from '../AbstractCustomNode'; import { NodeFactory } from '../../node/NodeFactory'; import { NodeGuards } from '../../node/NodeGuards'; +@injectFromBase() @injectable() export class ObjectExpressionVariableDeclarationHostNode extends AbstractCustomNode { /** diff --git a/src/custom-nodes/string-array-nodes/AbstractStringArrayCallNode.ts b/src/custom-nodes/string-array-nodes/AbstractStringArrayCallNode.ts index 296d4f7ce..026b98bb9 100644 --- a/src/custom-nodes/string-array-nodes/AbstractStringArrayCallNode.ts +++ b/src/custom-nodes/string-array-nodes/AbstractStringArrayCallNode.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import * as ESTree from 'estree'; @@ -21,6 +21,7 @@ import { NodeMetadata } from '../../node/NodeMetadata'; import { NodeUtils } from '../../node/NodeUtils'; import { IArrayUtils } from '../../interfaces/utils/IArrayUtils'; +@injectFromBase() @injectable() export abstract class AbstractStringArrayCallNode extends AbstractCustomNode { /** diff --git a/src/custom-nodes/string-array-nodes/StringArrayCallNode.ts b/src/custom-nodes/string-array-nodes/StringArrayCallNode.ts index d330eecd0..2934893e4 100644 --- a/src/custom-nodes/string-array-nodes/StringArrayCallNode.ts +++ b/src/custom-nodes/string-array-nodes/StringArrayCallNode.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import * as ESTree from 'estree'; @@ -20,6 +20,7 @@ import { NodeFactory } from '../../node/NodeFactory'; import { NodeUtils } from '../../node/NodeUtils'; import { IStringArrayScopeCallsWrapperData } from '../../interfaces/node-transformers/string-array-transformers/IStringArrayScopeCallsWrapperData'; +@injectFromBase() @injectable() export class StringArrayCallNode extends AbstractStringArrayCallNode { /** diff --git a/src/custom-nodes/string-array-nodes/StringArrayScopeCallsWrapperFunctionNode.ts b/src/custom-nodes/string-array-nodes/StringArrayScopeCallsWrapperFunctionNode.ts index 7ebf4e707..9710671bf 100644 --- a/src/custom-nodes/string-array-nodes/StringArrayScopeCallsWrapperFunctionNode.ts +++ b/src/custom-nodes/string-array-nodes/StringArrayScopeCallsWrapperFunctionNode.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import * as ESTree from 'estree'; @@ -20,6 +20,7 @@ import { AbstractStringArrayCallNode } from './AbstractStringArrayCallNode'; import { NodeFactory } from '../../node/NodeFactory'; import { NodeUtils } from '../../node/NodeUtils'; +@injectFromBase() @injectable() export class StringArrayScopeCallsWrapperFunctionNode extends AbstractStringArrayCallNode { /** diff --git a/src/custom-nodes/string-array-nodes/StringArrayScopeCallsWrapperVariableNode.ts b/src/custom-nodes/string-array-nodes/StringArrayScopeCallsWrapperVariableNode.ts index 2a19f05be..d3f43068d 100644 --- a/src/custom-nodes/string-array-nodes/StringArrayScopeCallsWrapperVariableNode.ts +++ b/src/custom-nodes/string-array-nodes/StringArrayScopeCallsWrapperVariableNode.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory'; @@ -18,6 +18,7 @@ import { AbstractStringArrayCallNode } from './AbstractStringArrayCallNode'; import { NodeFactory } from '../../node/NodeFactory'; import { NodeUtils } from '../../node/NodeUtils'; +@injectFromBase() @injectable() export class StringArrayScopeCallsWrapperVariableNode extends AbstractStringArrayCallNode { /** diff --git a/src/custom-nodes/string-array-nodes/string-array-index-nodes/StringArrayHexadecimalNumberIndexNode.ts b/src/custom-nodes/string-array-nodes/string-array-index-nodes/StringArrayHexadecimalNumberIndexNode.ts index ed3fb3e38..46894c114 100644 --- a/src/custom-nodes/string-array-nodes/string-array-index-nodes/StringArrayHexadecimalNumberIndexNode.ts +++ b/src/custom-nodes/string-array-nodes/string-array-index-nodes/StringArrayHexadecimalNumberIndexNode.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import * as ESTree from 'estree'; @@ -11,6 +11,7 @@ import { AbstractStringArrayIndexNode } from './AbstractStringArrayIndexNode'; import { NodeFactory } from '../../../node/NodeFactory'; import { NumberUtils } from '../../../utils/NumberUtils'; +@injectFromBase() @injectable() export class StringArrayHexadecimalNumberIndexNode extends AbstractStringArrayIndexNode { /** diff --git a/src/custom-nodes/string-array-nodes/string-array-index-nodes/StringArrayHexadecimalNumericStringIndexNode.ts b/src/custom-nodes/string-array-nodes/string-array-index-nodes/StringArrayHexadecimalNumericStringIndexNode.ts index afaa3d2e3..ad5c98f72 100644 --- a/src/custom-nodes/string-array-nodes/string-array-index-nodes/StringArrayHexadecimalNumericStringIndexNode.ts +++ b/src/custom-nodes/string-array-nodes/string-array-index-nodes/StringArrayHexadecimalNumericStringIndexNode.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import * as ESTree from 'estree'; @@ -11,6 +11,7 @@ import { AbstractStringArrayIndexNode } from './AbstractStringArrayIndexNode'; import { NodeFactory } from '../../../node/NodeFactory'; import { NumberUtils } from '../../../utils/NumberUtils'; +@injectFromBase() @injectable() export class StringArrayHexadecimalNumericStringIndexNode extends AbstractStringArrayIndexNode { /** diff --git a/src/generators/identifier-names-generators/DictionaryIdentifierNamesGenerator.ts b/src/generators/identifier-names-generators/DictionaryIdentifierNamesGenerator.ts index 4db36fccd..946a05a4d 100644 --- a/src/generators/identifier-names-generators/DictionaryIdentifierNamesGenerator.ts +++ b/src/generators/identifier-names-generators/DictionaryIdentifierNamesGenerator.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import { IArrayUtils } from '../../interfaces/utils/IArrayUtils'; @@ -9,6 +9,7 @@ import { AbstractIdentifierNamesGenerator } from './AbstractIdentifierNamesGener import { TNodeWithLexicalScope } from '../../types/node/TNodeWithLexicalScope'; import { NodeLexicalScopeUtils } from '../../node/NodeLexicalScopeUtils'; +@injectFromBase() @injectable() export class DictionaryIdentifierNamesGenerator extends AbstractIdentifierNamesGenerator { /** diff --git a/src/generators/identifier-names-generators/HexadecimalIdentifierNamesGenerator.ts b/src/generators/identifier-names-generators/HexadecimalIdentifierNamesGenerator.ts index 97020c724..c97659c60 100644 --- a/src/generators/identifier-names-generators/HexadecimalIdentifierNamesGenerator.ts +++ b/src/generators/identifier-names-generators/HexadecimalIdentifierNamesGenerator.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import { TNodeWithLexicalScope } from '../../types/node/TNodeWithLexicalScope'; @@ -10,6 +10,7 @@ import { AbstractIdentifierNamesGenerator } from './AbstractIdentifierNamesGener import { NumberUtils } from '../../utils/NumberUtils'; import { Utils } from '../../utils/Utils'; +@injectFromBase() @injectable() export class HexadecimalIdentifierNamesGenerator extends AbstractIdentifierNamesGenerator { /** diff --git a/src/generators/identifier-names-generators/MangledIdentifierNamesGenerator.ts b/src/generators/identifier-names-generators/MangledIdentifierNamesGenerator.ts index f76c71c97..9d4b16269 100644 --- a/src/generators/identifier-names-generators/MangledIdentifierNamesGenerator.ts +++ b/src/generators/identifier-names-generators/MangledIdentifierNamesGenerator.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import { TNodeWithLexicalScope } from '../../types/node/TNodeWithLexicalScope'; @@ -15,6 +15,7 @@ import { reservedIdentifierNames } from '../../constants/ReservedIdentifierNames import { AbstractIdentifierNamesGenerator } from './AbstractIdentifierNamesGenerator'; import { NodeLexicalScopeUtils } from '../../node/NodeLexicalScopeUtils'; +@injectFromBase() @injectable() export class MangledIdentifierNamesGenerator extends AbstractIdentifierNamesGenerator { /** diff --git a/src/generators/identifier-names-generators/MangledShuffledIdentifierNamesGenerator.ts b/src/generators/identifier-names-generators/MangledShuffledIdentifierNamesGenerator.ts index e4705ae3b..b9f9452a2 100644 --- a/src/generators/identifier-names-generators/MangledShuffledIdentifierNamesGenerator.ts +++ b/src/generators/identifier-names-generators/MangledShuffledIdentifierNamesGenerator.ts @@ -1,4 +1,4 @@ -import { inject, injectable, postConstruct } from 'inversify'; +import { inject, injectable, injectFromBase, postConstruct } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import { IArrayUtils } from '../../interfaces/utils/IArrayUtils'; @@ -12,6 +12,7 @@ import { alphabetStringUppercase } from '../../constants/AlphabetStringUppercase import { MangledIdentifierNamesGenerator } from './MangledIdentifierNamesGenerator'; +@injectFromBase() @injectable() export class MangledShuffledIdentifierNamesGenerator extends MangledIdentifierNamesGenerator { /** diff --git a/src/interfaces/container/IInversifyContainerFacade.ts b/src/interfaces/container/IInversifyContainerFacade.ts index ccd4bbe74..db129069a 100644 --- a/src/interfaces/container/IInversifyContainerFacade.ts +++ b/src/interfaces/container/IInversifyContainerFacade.ts @@ -1,4 +1,4 @@ -import { interfaces } from 'inversify'; +import { ServiceIdentifier } from 'inversify'; import { TInputOptions } from '../../types/options/TInputOptions'; @@ -6,13 +6,13 @@ export interface IInversifyContainerFacade { /** * @param serviceIdentifier */ - get(serviceIdentifier: interfaces.ServiceIdentifier): T; + get(serviceIdentifier: ServiceIdentifier): T; /** * @param serviceIdentifier * @param named */ - getNamed(serviceIdentifier: interfaces.ServiceIdentifier, named: string | number | symbol): T; + getNamed(serviceIdentifier: ServiceIdentifier, named: string | number | symbol): T; /** * @param {string} sourceCode diff --git a/src/node-transformers/NodeTransformerNamesGroupsBuilder.ts b/src/node-transformers/NodeTransformerNamesGroupsBuilder.ts index d29fca702..de0588ef4 100644 --- a/src/node-transformers/NodeTransformerNamesGroupsBuilder.ts +++ b/src/node-transformers/NodeTransformerNamesGroupsBuilder.ts @@ -1,4 +1,4 @@ -import { injectable } from 'inversify'; +import { injectable, injectFromBase } from 'inversify'; import { INodeTransformer } from '../interfaces/node-transformers/INodeTransformer'; @@ -6,6 +6,7 @@ import { NodeTransformer } from '../enums/node-transformers/NodeTransformer'; import { AbstractTransformerNamesGroupsBuilder } from '../utils/AbstractTransformerNamesGroupsBuilder'; +@injectFromBase() @injectable() export class NodeTransformerNamesGroupsBuilder extends AbstractTransformerNamesGroupsBuilder< NodeTransformer, diff --git a/src/node-transformers/control-flow-transformers/BlockStatementControlFlowTransformer.ts b/src/node-transformers/control-flow-transformers/BlockStatementControlFlowTransformer.ts index 9a09ca261..89e15b742 100644 --- a/src/node-transformers/control-flow-transformers/BlockStatementControlFlowTransformer.ts +++ b/src/node-transformers/control-flow-transformers/BlockStatementControlFlowTransformer.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import * as estraverse from '@javascript-obfuscator/estraverse'; @@ -22,6 +22,7 @@ import { BlockStatementControlFlowFlatteningNode } from '../../custom-nodes/cont import { NodeGuards } from '../../node/NodeGuards'; import { NodeUtils } from '../../node/NodeUtils'; +@injectFromBase() @injectable() export class BlockStatementControlFlowTransformer extends AbstractNodeTransformer { /** diff --git a/src/node-transformers/control-flow-transformers/FunctionControlFlowTransformer.ts b/src/node-transformers/control-flow-transformers/FunctionControlFlowTransformer.ts index 362317f03..6e64c55e8 100644 --- a/src/node-transformers/control-flow-transformers/FunctionControlFlowTransformer.ts +++ b/src/node-transformers/control-flow-transformers/FunctionControlFlowTransformer.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import * as estraverse from '@javascript-obfuscator/estraverse'; @@ -31,6 +31,7 @@ import { NodeMetadata } from '../../node/NodeMetadata'; import { NodeStatementUtils } from '../../node/NodeStatementUtils'; import { NodeUtils } from '../../node/NodeUtils'; +@injectFromBase() @injectable() export class FunctionControlFlowTransformer extends AbstractNodeTransformer { /** diff --git a/src/node-transformers/control-flow-transformers/StringArrayControlFlowTransformer.ts b/src/node-transformers/control-flow-transformers/StringArrayControlFlowTransformer.ts index 0de2115a9..3f6d287f4 100644 --- a/src/node-transformers/control-flow-transformers/StringArrayControlFlowTransformer.ts +++ b/src/node-transformers/control-flow-transformers/StringArrayControlFlowTransformer.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import * as estraverse from '@javascript-obfuscator/estraverse'; @@ -23,6 +23,7 @@ import { NodeTransformer } from '../../enums/node-transformers/NodeTransformer'; import { FunctionControlFlowTransformer } from './FunctionControlFlowTransformer'; import { NodeGuards } from '../../node/NodeGuards'; +@injectFromBase() @injectable() export class StringArrayControlFlowTransformer extends FunctionControlFlowTransformer { /** diff --git a/src/node-transformers/control-flow-transformers/control-flow-replacers/BinaryExpressionControlFlowReplacer.ts b/src/node-transformers/control-flow-transformers/control-flow-replacers/BinaryExpressionControlFlowReplacer.ts index af926ae08..7b308cdeb 100644 --- a/src/node-transformers/control-flow-transformers/control-flow-replacers/BinaryExpressionControlFlowReplacer.ts +++ b/src/node-transformers/control-flow-transformers/control-flow-replacers/BinaryExpressionControlFlowReplacer.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers'; import * as ESTree from 'estree'; @@ -17,6 +17,7 @@ import { ControlFlowCustomNode } from '../../../enums/custom-nodes/ControlFlowCu import { BinaryExpressionFunctionNode } from '../../../custom-nodes/control-flow-flattening-nodes/BinaryExpressionFunctionNode'; import { ExpressionWithOperatorControlFlowReplacer } from './ExpressionWithOperatorControlFlowReplacer'; +@injectFromBase() @injectable() export class BinaryExpressionControlFlowReplacer extends ExpressionWithOperatorControlFlowReplacer { /** diff --git a/src/node-transformers/control-flow-transformers/control-flow-replacers/CallExpressionControlFlowReplacer.ts b/src/node-transformers/control-flow-transformers/control-flow-replacers/CallExpressionControlFlowReplacer.ts index e6362c81e..a3d17e589 100644 --- a/src/node-transformers/control-flow-transformers/control-flow-replacers/CallExpressionControlFlowReplacer.ts +++ b/src/node-transformers/control-flow-transformers/control-flow-replacers/CallExpressionControlFlowReplacer.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers'; import * as ESTree from 'estree'; @@ -20,6 +20,7 @@ import { CallExpressionFunctionNode } from '../../../custom-nodes/control-flow-f import { CallExpressionControlFlowStorageCallNode } from '../../../custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/CallExpressionControlFlowStorageCallNode'; import { NodeGuards } from '../../../node/NodeGuards'; +@injectFromBase() @injectable() export class CallExpressionControlFlowReplacer extends AbstractControlFlowReplacer { /** diff --git a/src/node-transformers/control-flow-transformers/control-flow-replacers/ExpressionWithOperatorControlFlowReplacer.ts b/src/node-transformers/control-flow-transformers/control-flow-replacers/ExpressionWithOperatorControlFlowReplacer.ts index be9604ff8..6107cb3f1 100644 --- a/src/node-transformers/control-flow-transformers/control-flow-replacers/ExpressionWithOperatorControlFlowReplacer.ts +++ b/src/node-transformers/control-flow-transformers/control-flow-replacers/ExpressionWithOperatorControlFlowReplacer.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers'; import * as ESTree from 'estree'; @@ -18,6 +18,7 @@ import { AbstractControlFlowReplacer } from './AbstractControlFlowReplacer'; import { ExpressionWithOperatorControlFlowStorageCallNode } from '../../../custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/ExpressionWithOperatorControlFlowStorageCallNode'; import { NodeGuards } from '../../../node/NodeGuards'; +@injectFromBase() @injectable() export abstract class ExpressionWithOperatorControlFlowReplacer extends AbstractControlFlowReplacer { /** diff --git a/src/node-transformers/control-flow-transformers/control-flow-replacers/LogicalExpressionControlFlowReplacer.ts b/src/node-transformers/control-flow-transformers/control-flow-replacers/LogicalExpressionControlFlowReplacer.ts index d4f5d6265..bd14e0aa1 100644 --- a/src/node-transformers/control-flow-transformers/control-flow-replacers/LogicalExpressionControlFlowReplacer.ts +++ b/src/node-transformers/control-flow-transformers/control-flow-replacers/LogicalExpressionControlFlowReplacer.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers'; import * as ESTree from 'estree'; @@ -20,6 +20,7 @@ import { LogicalExpressionFunctionNode } from '../../../custom-nodes/control-flo import { NodeGuards } from '../../../node/NodeGuards'; import { NodeUtils } from '../../../node/NodeUtils'; +@injectFromBase() @injectable() export class LogicalExpressionControlFlowReplacer extends ExpressionWithOperatorControlFlowReplacer { /** diff --git a/src/node-transformers/control-flow-transformers/control-flow-replacers/StringArrayCallControlFlowReplacer.ts b/src/node-transformers/control-flow-transformers/control-flow-replacers/StringArrayCallControlFlowReplacer.ts index ea5340056..4a2ca6856 100644 --- a/src/node-transformers/control-flow-transformers/control-flow-replacers/StringArrayCallControlFlowReplacer.ts +++ b/src/node-transformers/control-flow-transformers/control-flow-replacers/StringArrayCallControlFlowReplacer.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers'; import * as ESTree from 'estree'; @@ -22,6 +22,7 @@ import { NodeMetadata } from '../../../node/NodeMetadata'; import { StringLiteralControlFlowStorageCallNode } from '../../../custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/StringLiteralControlFlowStorageCallNode'; import { LiteralNode } from '../../../custom-nodes/control-flow-flattening-nodes/LiteralNode'; +@injectFromBase() @injectable() export class StringArrayCallControlFlowReplacer extends AbstractControlFlowReplacer { /** diff --git a/src/node-transformers/control-flow-transformers/control-flow-replacers/StringLiteralControlFlowReplacer.ts b/src/node-transformers/control-flow-transformers/control-flow-replacers/StringLiteralControlFlowReplacer.ts index f4de203ee..eafbb188f 100644 --- a/src/node-transformers/control-flow-transformers/control-flow-replacers/StringLiteralControlFlowReplacer.ts +++ b/src/node-transformers/control-flow-transformers/control-flow-replacers/StringLiteralControlFlowReplacer.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers'; import * as ESTree from 'estree'; @@ -21,6 +21,7 @@ import { NodeLiteralUtils } from '../../../node/NodeLiteralUtils'; import { StringLiteralControlFlowStorageCallNode } from '../../../custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/StringLiteralControlFlowStorageCallNode'; import { LiteralNode } from '../../../custom-nodes/control-flow-flattening-nodes/LiteralNode'; +@injectFromBase() @injectable() export class StringLiteralControlFlowReplacer extends AbstractControlFlowReplacer { /** diff --git a/src/node-transformers/converting-transformers/BooleanLiteralTransformer.ts b/src/node-transformers/converting-transformers/BooleanLiteralTransformer.ts index f1bc652bc..d3a6672ce 100644 --- a/src/node-transformers/converting-transformers/BooleanLiteralTransformer.ts +++ b/src/node-transformers/converting-transformers/BooleanLiteralTransformer.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import * as ESTree from 'estree'; @@ -14,6 +14,7 @@ import { NodeGuards } from '../../node/NodeGuards'; import { NodeUtils } from '../../node/NodeUtils'; import { NodeFactory } from '../../node/NodeFactory'; +@injectFromBase() @injectable() export class BooleanLiteralTransformer extends AbstractNodeTransformer { /** diff --git a/src/node-transformers/converting-transformers/ClassFieldTransformer.ts b/src/node-transformers/converting-transformers/ClassFieldTransformer.ts index 6ed14af3c..5b4ac2023 100644 --- a/src/node-transformers/converting-transformers/ClassFieldTransformer.ts +++ b/src/node-transformers/converting-transformers/ClassFieldTransformer.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import * as ESTree from 'estree'; @@ -29,6 +29,7 @@ import { IdentifierReplacer } from '../rename-identifiers-transformers/replacer/ * * Literal node will be obfuscated by LiteralTransformer */ +@injectFromBase() @injectable() export class ClassFieldTransformer extends AbstractNodeTransformer { /** diff --git a/src/node-transformers/converting-transformers/ExportSpecifierTransformer.ts b/src/node-transformers/converting-transformers/ExportSpecifierTransformer.ts index fd49aad2c..5962dff03 100644 --- a/src/node-transformers/converting-transformers/ExportSpecifierTransformer.ts +++ b/src/node-transformers/converting-transformers/ExportSpecifierTransformer.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import * as ESTree from 'estree'; @@ -13,6 +13,7 @@ import { AbstractNodeTransformer } from '../AbstractNodeTransformer'; import { NodeGuards } from '../../node/NodeGuards'; import { NodeUtils } from '../../node/NodeUtils'; +@injectFromBase() @injectable() export class ExportSpecifierTransformer extends AbstractNodeTransformer { /** diff --git a/src/node-transformers/converting-transformers/MemberExpressionTransformer.ts b/src/node-transformers/converting-transformers/MemberExpressionTransformer.ts index bf1e9cd6f..0bd5738de 100644 --- a/src/node-transformers/converting-transformers/MemberExpressionTransformer.ts +++ b/src/node-transformers/converting-transformers/MemberExpressionTransformer.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import * as ESTree from 'estree'; @@ -14,6 +14,7 @@ import { NodeFactory } from '../../node/NodeFactory'; import { NodeGuards } from '../../node/NodeGuards'; import { NodeMetadata } from '../../node/NodeMetadata'; +@injectFromBase() @injectable() export class MemberExpressionTransformer extends AbstractNodeTransformer { /** diff --git a/src/node-transformers/converting-transformers/NumberLiteralTransformer.ts b/src/node-transformers/converting-transformers/NumberLiteralTransformer.ts index cc84588c5..2d340cde3 100644 --- a/src/node-transformers/converting-transformers/NumberLiteralTransformer.ts +++ b/src/node-transformers/converting-transformers/NumberLiteralTransformer.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import * as ESTree from 'estree'; @@ -15,6 +15,7 @@ import { NodeFactory } from '../../node/NodeFactory'; import { NodeGuards } from '../../node/NodeGuards'; import { NumberUtils } from '../../utils/NumberUtils'; +@injectFromBase() @injectable() export class NumberLiteralTransformer extends AbstractNodeTransformer { /** diff --git a/src/node-transformers/converting-transformers/NumberToNumericalExpressionTransformer.ts b/src/node-transformers/converting-transformers/NumberToNumericalExpressionTransformer.ts index 8ceaa0bda..80430a82f 100644 --- a/src/node-transformers/converting-transformers/NumberToNumericalExpressionTransformer.ts +++ b/src/node-transformers/converting-transformers/NumberToNumericalExpressionTransformer.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import * as ESTree from 'estree'; @@ -26,6 +26,7 @@ import { NumericalExpressionDataToNodeConverter } from '../../node/NumericalExpr * on: * var number = 50 + (100 * 2) - 127; */ +@injectFromBase() @injectable() export class NumberToNumericalExpressionTransformer extends AbstractNodeTransformer { /** diff --git a/src/node-transformers/converting-transformers/ObjectExpressionKeysTransformer.ts b/src/node-transformers/converting-transformers/ObjectExpressionKeysTransformer.ts index 9918d1d23..c700cfa8c 100644 --- a/src/node-transformers/converting-transformers/ObjectExpressionKeysTransformer.ts +++ b/src/node-transformers/converting-transformers/ObjectExpressionKeysTransformer.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import * as estraverse from '@javascript-obfuscator/estraverse'; @@ -17,6 +17,7 @@ import { AbstractNodeTransformer } from '../AbstractNodeTransformer'; import { NodeGuards } from '../../node/NodeGuards'; import { NodeStatementUtils } from '../../node/NodeStatementUtils'; +@injectFromBase() @injectable() export class ObjectExpressionKeysTransformer extends AbstractNodeTransformer { /** diff --git a/src/node-transformers/converting-transformers/ObjectExpressionTransformer.ts b/src/node-transformers/converting-transformers/ObjectExpressionTransformer.ts index 828c60dd9..07ae38601 100644 --- a/src/node-transformers/converting-transformers/ObjectExpressionTransformer.ts +++ b/src/node-transformers/converting-transformers/ObjectExpressionTransformer.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import * as ESTree from 'estree'; @@ -20,6 +20,7 @@ import { NodeGuards } from '../../node/NodeGuards'; * on: * var object = { 'PSEUDO': 1 }; */ +@injectFromBase() @injectable() export class ObjectExpressionTransformer extends AbstractNodeTransformer { /** diff --git a/src/node-transformers/converting-transformers/ObjectPatternPropertiesTransformer.ts b/src/node-transformers/converting-transformers/ObjectPatternPropertiesTransformer.ts index 3b9b378f3..6122c0c15 100644 --- a/src/node-transformers/converting-transformers/ObjectPatternPropertiesTransformer.ts +++ b/src/node-transformers/converting-transformers/ObjectPatternPropertiesTransformer.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import * as ESTree from 'estree'; @@ -16,6 +16,7 @@ import { NodeGuards } from '../../node/NodeGuards'; import { NodeLexicalScopeUtils } from '../../node/NodeLexicalScopeUtils'; import { NodeUtils } from '../../node/NodeUtils'; +@injectFromBase() @injectable() export class ObjectPatternPropertiesTransformer extends AbstractNodeTransformer { /** diff --git a/src/node-transformers/converting-transformers/SplitStringTransformer.ts b/src/node-transformers/converting-transformers/SplitStringTransformer.ts index 3ab4de010..fbe614a0a 100644 --- a/src/node-transformers/converting-transformers/SplitStringTransformer.ts +++ b/src/node-transformers/converting-transformers/SplitStringTransformer.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import * as estraverse from '@javascript-obfuscator/estraverse'; @@ -21,6 +21,7 @@ import { NodeUtils } from '../../node/NodeUtils'; /** * Splits strings into parts */ +@injectFromBase() @injectable() export class SplitStringTransformer extends AbstractNodeTransformer { /** diff --git a/src/node-transformers/converting-transformers/TemplateLiteralTransformer.ts b/src/node-transformers/converting-transformers/TemplateLiteralTransformer.ts index 9de8392a2..422187f90 100644 --- a/src/node-transformers/converting-transformers/TemplateLiteralTransformer.ts +++ b/src/node-transformers/converting-transformers/TemplateLiteralTransformer.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import * as ESTree from 'estree'; @@ -18,6 +18,7 @@ import { NodeUtils } from '../../node/NodeUtils'; * Transform ES2015 template literals to ES5 * Thanks to Babel for algorithm */ +@injectFromBase() @injectable() export class TemplateLiteralTransformer extends AbstractNodeTransformer { /** diff --git a/src/node-transformers/dead-code-injection-transformers/DeadCodeInjectionIdentifiersTransformer.ts b/src/node-transformers/dead-code-injection-transformers/DeadCodeInjectionIdentifiersTransformer.ts index 04044b2ae..9f253f346 100644 --- a/src/node-transformers/dead-code-injection-transformers/DeadCodeInjectionIdentifiersTransformer.ts +++ b/src/node-transformers/dead-code-injection-transformers/DeadCodeInjectionIdentifiersTransformer.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import * as eslintScope from 'eslint-scope'; @@ -21,6 +21,7 @@ import { NodeGuards } from '../../node/NodeGuards'; /** * Renames all scope through identifiers for Dead Code Injection */ +@injectFromBase() @injectable() export class DeadCodeInjectionIdentifiersTransformer extends AbstractNodeTransformer { /** diff --git a/src/node-transformers/dead-code-injection-transformers/DeadCodeInjectionTransformer.ts b/src/node-transformers/dead-code-injection-transformers/DeadCodeInjectionTransformer.ts index cb706d338..c73860022 100644 --- a/src/node-transformers/dead-code-injection-transformers/DeadCodeInjectionTransformer.ts +++ b/src/node-transformers/dead-code-injection-transformers/DeadCodeInjectionTransformer.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import * as estraverse from '@javascript-obfuscator/estraverse'; @@ -27,6 +27,7 @@ import { NodeMetadata } from '../../node/NodeMetadata'; import { NodeStatementUtils } from '../../node/NodeStatementUtils'; import { NodeUtils } from '../../node/NodeUtils'; +@injectFromBase() @injectable() export class DeadCodeInjectionTransformer extends AbstractNodeTransformer { /** diff --git a/src/node-transformers/finalizing-transformers/DirectivePlacementTransformer.ts b/src/node-transformers/finalizing-transformers/DirectivePlacementTransformer.ts index 8d25c0f93..2ae60c7e5 100644 --- a/src/node-transformers/finalizing-transformers/DirectivePlacementTransformer.ts +++ b/src/node-transformers/finalizing-transformers/DirectivePlacementTransformer.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import * as estraverse from '@javascript-obfuscator/estraverse'; @@ -23,6 +23,7 @@ import { NodeUtils } from '../../node/NodeUtils'; * It's easier to fix "use strict"; placement after obfuscation as a separate stage * than ignore this directive in other transformers like control flow and dead code injection transformers */ +@injectFromBase() @injectable() export class DirectivePlacementTransformer extends AbstractNodeTransformer { /** diff --git a/src/node-transformers/finalizing-transformers/EscapeSequenceTransformer.ts b/src/node-transformers/finalizing-transformers/EscapeSequenceTransformer.ts index 19dde7dfc..d4ffd593b 100644 --- a/src/node-transformers/finalizing-transformers/EscapeSequenceTransformer.ts +++ b/src/node-transformers/finalizing-transformers/EscapeSequenceTransformer.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import * as ESTree from 'estree'; @@ -17,6 +17,7 @@ import { NodeLiteralUtils } from '../../node/NodeLiteralUtils'; import { NodeFactory } from '../../node/NodeFactory'; import { NodeUtils } from '../../node/NodeUtils'; +@injectFromBase() @injectable() export class EscapeSequenceTransformer extends AbstractNodeTransformer { /** diff --git a/src/node-transformers/initializing-transformers/CommentsTransformer.ts b/src/node-transformers/initializing-transformers/CommentsTransformer.ts index d3877052e..4f0aca83a 100644 --- a/src/node-transformers/initializing-transformers/CommentsTransformer.ts +++ b/src/node-transformers/initializing-transformers/CommentsTransformer.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import * as ESTree from 'estree'; @@ -14,6 +14,7 @@ import { AbstractNodeTransformer } from '../AbstractNodeTransformer'; import { ConditionalCommentObfuscatingGuard } from '../preparing-transformers/obfuscating-guards/ConditionalCommentObfuscatingGuard'; import { NodeGuards } from '../../node/NodeGuards'; +@injectFromBase() @injectable() export class CommentsTransformer extends AbstractNodeTransformer { /** diff --git a/src/node-transformers/preparing-transformers/CustomCodeHelpersTransformer.ts b/src/node-transformers/preparing-transformers/CustomCodeHelpersTransformer.ts index b8cc19c42..436199356 100644 --- a/src/node-transformers/preparing-transformers/CustomCodeHelpersTransformer.ts +++ b/src/node-transformers/preparing-transformers/CustomCodeHelpersTransformer.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import * as ESTree from 'estree'; @@ -23,6 +23,7 @@ import { NodeGuards } from '../../node/NodeGuards'; /** * Analyzing AST-tree and appending custom code helpers */ +@injectFromBase() @injectable() export class CustomCodeHelpersTransformer extends AbstractNodeTransformer { /** diff --git a/src/node-transformers/preparing-transformers/EvalCallExpressionTransformer.ts b/src/node-transformers/preparing-transformers/EvalCallExpressionTransformer.ts index 137a4557c..c8576f0eb 100644 --- a/src/node-transformers/preparing-transformers/EvalCallExpressionTransformer.ts +++ b/src/node-transformers/preparing-transformers/EvalCallExpressionTransformer.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import * as ESTree from 'estree'; @@ -17,6 +17,7 @@ import { NodeMetadata } from '../../node/NodeMetadata'; import { NodeUtils } from '../../node/NodeUtils'; import { StringUtils } from '../../utils/StringUtils'; +@injectFromBase() @injectable() export class EvalCallExpressionTransformer extends AbstractNodeTransformer { /** diff --git a/src/node-transformers/preparing-transformers/MetadataTransformer.ts b/src/node-transformers/preparing-transformers/MetadataTransformer.ts index dd916c8b2..b74ccc037 100644 --- a/src/node-transformers/preparing-transformers/MetadataTransformer.ts +++ b/src/node-transformers/preparing-transformers/MetadataTransformer.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import * as ESTree from 'estree'; @@ -17,6 +17,7 @@ import { NodeMetadata } from '../../node/NodeMetadata'; /** * Adds metadata properties to each node */ +@injectFromBase() @injectable() export class MetadataTransformer extends AbstractNodeTransformer { /** diff --git a/src/node-transformers/preparing-transformers/ObfuscatingGuardsTransformer.ts b/src/node-transformers/preparing-transformers/ObfuscatingGuardsTransformer.ts index 8d10290c8..713210417 100644 --- a/src/node-transformers/preparing-transformers/ObfuscatingGuardsTransformer.ts +++ b/src/node-transformers/preparing-transformers/ObfuscatingGuardsTransformer.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import * as ESTree from 'estree'; @@ -22,6 +22,7 @@ import { NodeMetadata } from '../../node/NodeMetadata'; /** * Adds `ignoredNode` properties to each node */ +@injectFromBase() @injectable() export class ObfuscatingGuardsTransformer extends AbstractNodeTransformer { /** diff --git a/src/node-transformers/preparing-transformers/ParentificationTransformer.ts b/src/node-transformers/preparing-transformers/ParentificationTransformer.ts index 4e2f27608..bcdc872ac 100644 --- a/src/node-transformers/preparing-transformers/ParentificationTransformer.ts +++ b/src/node-transformers/preparing-transformers/ParentificationTransformer.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import * as ESTree from 'estree'; @@ -15,6 +15,7 @@ import { NodeUtils } from '../../node/NodeUtils'; /** * Adds `parentNode` properties to each node */ +@injectFromBase() @injectable() export class ParentificationTransformer extends AbstractNodeTransformer { /** diff --git a/src/node-transformers/preparing-transformers/VariablePreserveTransformer.ts b/src/node-transformers/preparing-transformers/VariablePreserveTransformer.ts index dc9326100..2d6f8b3a5 100644 --- a/src/node-transformers/preparing-transformers/VariablePreserveTransformer.ts +++ b/src/node-transformers/preparing-transformers/VariablePreserveTransformer.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import * as ESTree from 'estree'; import * as eslintScope from 'eslint-scope'; @@ -21,6 +21,7 @@ import { NodeGuards } from '../../node/NodeGuards'; /** * Preserve non-replaceable variables */ +@injectFromBase() @injectable() export class VariablePreserveTransformer extends AbstractNodeTransformer { /** diff --git a/src/node-transformers/rename-identifiers-transformers/LabeledStatementTransformer.ts b/src/node-transformers/rename-identifiers-transformers/LabeledStatementTransformer.ts index b56ddbea3..5c3556ced 100644 --- a/src/node-transformers/rename-identifiers-transformers/LabeledStatementTransformer.ts +++ b/src/node-transformers/rename-identifiers-transformers/LabeledStatementTransformer.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import * as estraverse from '@javascript-obfuscator/estraverse'; @@ -33,6 +33,7 @@ import { NodeLexicalScopeUtils } from '../../node/NodeLexicalScopeUtils'; * } * */ +@injectFromBase() @injectable() export class LabeledStatementTransformer extends AbstractNodeTransformer { /** diff --git a/src/node-transformers/rename-identifiers-transformers/ScopeIdentifiersTransformer.ts b/src/node-transformers/rename-identifiers-transformers/ScopeIdentifiersTransformer.ts index 028a51350..689d8ec0e 100644 --- a/src/node-transformers/rename-identifiers-transformers/ScopeIdentifiersTransformer.ts +++ b/src/node-transformers/rename-identifiers-transformers/ScopeIdentifiersTransformer.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import * as eslintScope from 'eslint-scope'; @@ -23,6 +23,7 @@ import { NodeMetadata } from '../../node/NodeMetadata'; /** * Replaces all replaceable identifiers in scope */ +@injectFromBase() @injectable() export class ScopeIdentifiersTransformer extends AbstractNodeTransformer { /** diff --git a/src/node-transformers/rename-identifiers-transformers/ScopeThroughIdentifiersTransformer.ts b/src/node-transformers/rename-identifiers-transformers/ScopeThroughIdentifiersTransformer.ts index 242bcecdb..ff2c93d88 100644 --- a/src/node-transformers/rename-identifiers-transformers/ScopeThroughIdentifiersTransformer.ts +++ b/src/node-transformers/rename-identifiers-transformers/ScopeThroughIdentifiersTransformer.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import * as eslintScope from 'eslint-scope'; @@ -21,6 +21,7 @@ import { NodeGuards } from '../../node/NodeGuards'; /** * Renames all through identifiers */ +@injectFromBase() @injectable() export class ScopeThroughIdentifiersTransformer extends AbstractNodeTransformer { /** diff --git a/src/node-transformers/rename-properties-transformers/RenamePropertiesTransformer.ts b/src/node-transformers/rename-properties-transformers/RenamePropertiesTransformer.ts index 4a0b45b68..7dc409628 100644 --- a/src/node-transformers/rename-properties-transformers/RenamePropertiesTransformer.ts +++ b/src/node-transformers/rename-properties-transformers/RenamePropertiesTransformer.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import * as ESTree from 'estree'; @@ -16,6 +16,7 @@ import { NodeGuards } from '../../node/NodeGuards'; import { NodeLiteralUtils } from '../../node/NodeLiteralUtils'; import { NodeMetadata } from '../../node/NodeMetadata'; +@injectFromBase() @injectable() export class RenamePropertiesTransformer extends AbstractNodeTransformer { /** diff --git a/src/node-transformers/simplifying-transformers/AbstractStatementSimplifyTransformer.ts b/src/node-transformers/simplifying-transformers/AbstractStatementSimplifyTransformer.ts index 9014aa3a5..c7d2b63a5 100644 --- a/src/node-transformers/simplifying-transformers/AbstractStatementSimplifyTransformer.ts +++ b/src/node-transformers/simplifying-transformers/AbstractStatementSimplifyTransformer.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import * as ESTree from 'estree'; @@ -17,6 +17,7 @@ import { NodeFactory } from '../../node/NodeFactory'; /** * Simplifies `Statement` node */ +@injectFromBase() @injectable() export abstract class AbstractStatementSimplifyTransformer extends AbstractNodeTransformer { /** diff --git a/src/node-transformers/simplifying-transformers/BlockStatementSimplifyTransformer.ts b/src/node-transformers/simplifying-transformers/BlockStatementSimplifyTransformer.ts index 010f9b5c9..14d139a11 100644 --- a/src/node-transformers/simplifying-transformers/BlockStatementSimplifyTransformer.ts +++ b/src/node-transformers/simplifying-transformers/BlockStatementSimplifyTransformer.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import * as ESTree from 'estree'; @@ -19,6 +19,7 @@ import { NodeUtils } from '../../node/NodeUtils'; /** * Simplifies `BlockStatement` node */ +@injectFromBase() @injectable() export class BlockStatementSimplifyTransformer extends AbstractStatementSimplifyTransformer { /** diff --git a/src/node-transformers/simplifying-transformers/ExpressionStatementsMergeTransformer.ts b/src/node-transformers/simplifying-transformers/ExpressionStatementsMergeTransformer.ts index ef2dcf818..0ae976eaa 100644 --- a/src/node-transformers/simplifying-transformers/ExpressionStatementsMergeTransformer.ts +++ b/src/node-transformers/simplifying-transformers/ExpressionStatementsMergeTransformer.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import * as estraverse from '@javascript-obfuscator/estraverse'; @@ -26,6 +26,7 @@ import { NodeUtils } from '../../node/NodeUtils'; * on: * (console.log(1), console.log(2)); */ +@injectFromBase() @injectable() export class ExpressionStatementsMergeTransformer extends AbstractNodeTransformer { /** diff --git a/src/node-transformers/simplifying-transformers/IfStatementSimplifyTransformer.ts b/src/node-transformers/simplifying-transformers/IfStatementSimplifyTransformer.ts index 7ff89e296..cde029aa3 100644 --- a/src/node-transformers/simplifying-transformers/IfStatementSimplifyTransformer.ts +++ b/src/node-transformers/simplifying-transformers/IfStatementSimplifyTransformer.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import * as ESTree from 'estree'; @@ -18,6 +18,7 @@ import { NodeUtils } from '../../node/NodeUtils'; /** * Simplifies `IfStatement` node */ +@injectFromBase() @injectable() export class IfStatementSimplifyTransformer extends AbstractStatementSimplifyTransformer { /** diff --git a/src/node-transformers/simplifying-transformers/VariableDeclarationsMergeTransformer.ts b/src/node-transformers/simplifying-transformers/VariableDeclarationsMergeTransformer.ts index d89c5c03a..c9c9101cf 100644 --- a/src/node-transformers/simplifying-transformers/VariableDeclarationsMergeTransformer.ts +++ b/src/node-transformers/simplifying-transformers/VariableDeclarationsMergeTransformer.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import * as estraverse from '@javascript-obfuscator/estraverse'; @@ -25,6 +25,7 @@ import { NodeStatementUtils } from '../../node/NodeStatementUtils'; * var foo = 1, * bar = 2; */ +@injectFromBase() @injectable() export class VariableDeclarationsMergeTransformer extends AbstractNodeTransformer { /** diff --git a/src/node-transformers/string-array-transformers/StringArrayRotateFunctionTransformer.ts b/src/node-transformers/string-array-transformers/StringArrayRotateFunctionTransformer.ts index 4788a9434..50b7c5d90 100644 --- a/src/node-transformers/string-array-transformers/StringArrayRotateFunctionTransformer.ts +++ b/src/node-transformers/string-array-transformers/StringArrayRotateFunctionTransformer.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import * as estraverse from '@javascript-obfuscator/estraverse'; @@ -33,6 +33,7 @@ import { NodeUtils } from '../../node/NodeUtils'; import { NumericalExpressionDataToNodeConverter } from '../../node/NumericalExpressionDataToNodeConverter'; import { StringArrayRotateFunctionCodeHelper } from '../../custom-code-helpers/string-array/StringArrayRotateFunctionCodeHelper'; +@injectFromBase() @injectable() export class StringArrayRotateFunctionTransformer extends AbstractNodeTransformer { /** diff --git a/src/node-transformers/string-array-transformers/StringArrayScopeCallsWrapperTransformer.ts b/src/node-transformers/string-array-transformers/StringArrayScopeCallsWrapperTransformer.ts index 5aa19210a..513da4a26 100644 --- a/src/node-transformers/string-array-transformers/StringArrayScopeCallsWrapperTransformer.ts +++ b/src/node-transformers/string-array-transformers/StringArrayScopeCallsWrapperTransformer.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import * as ESTree from 'estree'; @@ -30,6 +30,7 @@ import { NodeGuards } from '../../node/NodeGuards'; import { StringArrayScopeCallsWrapperFunctionNode } from '../../custom-nodes/string-array-nodes/StringArrayScopeCallsWrapperFunctionNode'; import { StringArrayScopeCallsWrapperVariableNode } from '../../custom-nodes/string-array-nodes/StringArrayScopeCallsWrapperVariableNode'; +@injectFromBase() @injectable() export class StringArrayScopeCallsWrapperTransformer extends AbstractNodeTransformer { /** diff --git a/src/node-transformers/string-array-transformers/StringArrayTransformer.ts b/src/node-transformers/string-array-transformers/StringArrayTransformer.ts index 6993f1f9c..dbc487fbc 100644 --- a/src/node-transformers/string-array-transformers/StringArrayTransformer.ts +++ b/src/node-transformers/string-array-transformers/StringArrayTransformer.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import * as ESTree from 'estree'; @@ -36,6 +36,7 @@ import { NodeMetadata } from '../../node/NodeMetadata'; import { NodeUtils } from '../../node/NodeUtils'; import { StringArrayCallNode } from '../../custom-nodes/string-array-nodes/StringArrayCallNode'; +@injectFromBase() @injectable() export class StringArrayTransformer extends AbstractNodeTransformer { /** diff --git a/src/storages/control-flow-transformers/FunctionControlFlowStorage.ts b/src/storages/control-flow-transformers/FunctionControlFlowStorage.ts index 30b4b9c0e..30ea688c6 100644 --- a/src/storages/control-flow-transformers/FunctionControlFlowStorage.ts +++ b/src/storages/control-flow-transformers/FunctionControlFlowStorage.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory'; @@ -11,6 +11,7 @@ import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator'; import { MapStorage } from '../MapStorage'; +@injectFromBase() @injectable() export class FunctionControlFlowStorage extends MapStorage implements IControlFlowStorage { /** diff --git a/src/storages/control-flow-transformers/StringControlFlowStorage.ts b/src/storages/control-flow-transformers/StringControlFlowStorage.ts index 7288e7b22..148c6ee07 100644 --- a/src/storages/control-flow-transformers/StringControlFlowStorage.ts +++ b/src/storages/control-flow-transformers/StringControlFlowStorage.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory'; @@ -8,6 +8,7 @@ import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator'; import { FunctionControlFlowStorage } from './FunctionControlFlowStorage'; +@injectFromBase() @injectable() export class StringControlFlowStorage extends FunctionControlFlowStorage { /** diff --git a/src/storages/custom-code-helpers/CustomCodeHelperGroupStorage.ts b/src/storages/custom-code-helpers/CustomCodeHelperGroupStorage.ts index d43fa5aff..3e22750b4 100644 --- a/src/storages/custom-code-helpers/CustomCodeHelperGroupStorage.ts +++ b/src/storages/custom-code-helpers/CustomCodeHelperGroupStorage.ts @@ -1,4 +1,4 @@ -import { inject, injectable, postConstruct } from 'inversify'; +import { inject, injectable, injectFromBase, postConstruct } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import { TCustomCodeHelperGroupFactory } from '../../types/container/custom-code-helpers/TCustomCodeHelperGroupFactory'; @@ -11,6 +11,7 @@ import { CustomCodeHelperGroup } from '../../enums/custom-code-helpers/CustomCod import { MapStorage } from '../MapStorage'; +@injectFromBase() @injectable() export class CustomCodeHelperGroupStorage extends MapStorage { /** diff --git a/src/storages/identifier-names-cache/GlobalIdentifierNamesCacheStorage.ts b/src/storages/identifier-names-cache/GlobalIdentifierNamesCacheStorage.ts index 04fc83a13..f2115d299 100644 --- a/src/storages/identifier-names-cache/GlobalIdentifierNamesCacheStorage.ts +++ b/src/storages/identifier-names-cache/GlobalIdentifierNamesCacheStorage.ts @@ -1,4 +1,4 @@ -import { inject, injectable, postConstruct } from 'inversify'; +import { inject, injectable, injectFromBase, postConstruct } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import { IGlobalIdentifierNamesCacheStorage } from '../../interfaces/storages/identifier-names-cache/IGlobalIdentifierNamesCacheStorage'; @@ -7,6 +7,7 @@ import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator'; import { MapStorage } from '../MapStorage'; +@injectFromBase() @injectable() export class GlobalIdentifierNamesCacheStorage extends MapStorage diff --git a/src/storages/identifier-names-cache/PropertyIdentifierNamesCacheStorage.ts b/src/storages/identifier-names-cache/PropertyIdentifierNamesCacheStorage.ts index de7015281..4de03cce3 100644 --- a/src/storages/identifier-names-cache/PropertyIdentifierNamesCacheStorage.ts +++ b/src/storages/identifier-names-cache/PropertyIdentifierNamesCacheStorage.ts @@ -1,4 +1,4 @@ -import { inject, injectable, postConstruct } from 'inversify'; +import { inject, injectable, injectFromBase, postConstruct } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import { IOptions } from '../../interfaces/options/IOptions'; @@ -7,6 +7,7 @@ import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator'; import { MapStorage } from '../MapStorage'; +@injectFromBase() @injectable() export class PropertyIdentifierNamesCacheStorage extends MapStorage diff --git a/src/storages/string-array-transformers/LiteralNodesCacheStorage.ts b/src/storages/string-array-transformers/LiteralNodesCacheStorage.ts index 1df62350e..31d3e3c6e 100644 --- a/src/storages/string-array-transformers/LiteralNodesCacheStorage.ts +++ b/src/storages/string-array-transformers/LiteralNodesCacheStorage.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import * as ESTree from 'estree'; @@ -12,6 +12,7 @@ import { StringArrayEncoding } from '../../enums/node-transformers/string-array- import { MapStorage } from '../MapStorage'; +@injectFromBase() @injectable() export class LiteralNodesCacheStorage extends MapStorage implements ILiteralNodesCacheStorage { /** diff --git a/src/storages/string-array-transformers/StringArrayScopeCallsWrappersDataStorage.ts b/src/storages/string-array-transformers/StringArrayScopeCallsWrappersDataStorage.ts index 11d15a671..9d933bf3e 100644 --- a/src/storages/string-array-transformers/StringArrayScopeCallsWrappersDataStorage.ts +++ b/src/storages/string-array-transformers/StringArrayScopeCallsWrappersDataStorage.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import { TNodeWithLexicalScopeStatements } from '../../types/node/TNodeWithLexicalScopeStatements'; @@ -10,6 +10,7 @@ import { IStringArrayScopeCallsWrappersDataStorage } from '../../interfaces/stor import { WeakMapStorage } from '../WeakMapStorage'; +@injectFromBase() @injectable() export class StringArrayScopeCallsWrappersDataStorage extends WeakMapStorage diff --git a/src/storages/string-array-transformers/StringArrayStorage.ts b/src/storages/string-array-transformers/StringArrayStorage.ts index d58c8586d..7bf7bde79 100644 --- a/src/storages/string-array-transformers/StringArrayStorage.ts +++ b/src/storages/string-array-transformers/StringArrayStorage.ts @@ -1,4 +1,4 @@ -import { inject, injectable, postConstruct } from 'inversify'; +import { inject, injectable, injectFromBase, postConstruct } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory'; @@ -17,6 +17,7 @@ import { StringArrayEncoding } from '../../enums/node-transformers/string-array- import { MapStorage } from '../MapStorage'; +@injectFromBase() @injectable() export class StringArrayStorage extends MapStorage<`${string}-${TStringArrayEncoding}`, IStringArrayStorageItemData> diff --git a/src/storages/string-array-transformers/VisitedLexicalScopeNodesStackStorage.ts b/src/storages/string-array-transformers/VisitedLexicalScopeNodesStackStorage.ts index cbc72fd3e..16a8779f6 100644 --- a/src/storages/string-array-transformers/VisitedLexicalScopeNodesStackStorage.ts +++ b/src/storages/string-array-transformers/VisitedLexicalScopeNodesStackStorage.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../../container/ServiceIdentifiers'; import { TNodeWithLexicalScopeStatements } from '../../types/node/TNodeWithLexicalScopeStatements'; @@ -10,6 +10,7 @@ import { IVisitedLexicalScopeNodesStackStorage } from '../../interfaces/storages import { ArrayStorage } from '../ArrayStorage'; +@injectFromBase() @injectable() export class VisitedLexicalScopeNodesStackStorage extends ArrayStorage diff --git a/src/utils/CryptUtilsStringArray.ts b/src/utils/CryptUtilsStringArray.ts index b51049274..f704d4036 100644 --- a/src/utils/CryptUtilsStringArray.ts +++ b/src/utils/CryptUtilsStringArray.ts @@ -1,4 +1,4 @@ -import { inject, injectable } from 'inversify'; +import { inject, injectable, injectFromBase } from 'inversify'; import { ServiceIdentifiers } from '../container/ServiceIdentifiers'; import { ICryptUtilsStringArray } from '../interfaces/utils/ICryptUtilsStringArray'; @@ -8,6 +8,7 @@ import { base64alphabetSwapped } from '../constants/Base64AlphabetSwapped'; import { CryptUtils } from './CryptUtils'; +@injectFromBase() @injectable() export class CryptUtilsStringArray extends CryptUtils implements ICryptUtilsStringArray { /** diff --git a/yarn.lock b/yarn.lock index 0d919ff1b..832bb6048 100644 --- a/yarn.lock +++ b/yarn.lock @@ -260,23 +260,46 @@ resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz#4a2868d75d6d6963e423bcf90b7fd1be343409d3" integrity sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA== -"@inversifyjs/common@1.3.3": - version "1.3.3" - resolved "https://registry.yarnpkg.com/@inversifyjs/common/-/common-1.3.3.tgz#c34bba10be8c511bf3cd25473bd32c2a08987111" - integrity sha512-ZH0wrgaJwIo3s9gMCDM2wZoxqrJ6gB97jWXncROfYdqZJv8f3EkqT57faZqN5OTeHWgtziQ6F6g3L8rCvGceCw== +"@inversifyjs/common@1.5.2": + version "1.5.2" + resolved "https://registry.yarnpkg.com/@inversifyjs/common/-/common-1.5.2.tgz#6836287fef1c25dddbdf6af345a33a6d6caf6835" + integrity sha512-WlzR9xGadABS9gtgZQ+luoZ8V6qm4Ii6RQfcfC9Ho2SOlE6ZuemFo7PKJvKI0ikm8cmKbU8hw5UK6E4qovH21w== + +"@inversifyjs/container@1.15.0": + version "1.15.0" + resolved "https://registry.yarnpkg.com/@inversifyjs/container/-/container-1.15.0.tgz#e92e2a881f5300f373a855fd74aa8280dc863825" + integrity sha512-U2xYsPrJTz5za2TExi5lg8qOWf8TEVBpN+pQM7B8BVA2rajtbRE9A66SLRHk8c1eGXmg+0K4Hdki6tWAsSQBUA== + dependencies: + "@inversifyjs/common" "1.5.2" + "@inversifyjs/core" "9.2.0" + "@inversifyjs/plugin" "0.2.0" + "@inversifyjs/reflect-metadata-utils" "1.4.1" + +"@inversifyjs/core@9.2.0": + version "9.2.0" + resolved "https://registry.yarnpkg.com/@inversifyjs/core/-/core-9.2.0.tgz#f587ccb917c82698ac0f9ceb2a544af42acff36f" + integrity sha512-Nm7BR6KmpgshIHpVQWuEDehqRVb6GBm8LFEuhc2s4kSZWrArZ15RmXQzROLk4m+hkj4kMXgvMm5Qbopot/D6Sg== + dependencies: + "@inversifyjs/common" "1.5.2" + "@inversifyjs/prototype-utils" "0.1.3" + "@inversifyjs/reflect-metadata-utils" "1.4.1" + +"@inversifyjs/plugin@0.2.0": + version "0.2.0" + resolved "https://registry.yarnpkg.com/@inversifyjs/plugin/-/plugin-0.2.0.tgz#03957c7d02803f32254a2ff2f8f8ffb05ec57eec" + integrity sha512-R/JAdkTSD819pV1zi0HP54mWHyX+H2m8SxldXRgPQarS3ySV4KPyRdosWcfB8Se0JJZWZLHYiUNiS6JvMWSPjw== -"@inversifyjs/core@1.3.4": - version "1.3.4" - resolved "https://registry.yarnpkg.com/@inversifyjs/core/-/core-1.3.4.tgz#17d2614ff48fc6e0db20c2fe3258c3d5bef9b5e0" - integrity sha512-gCCmA4BdbHEFwvVZ2elWgHuXZWk6AOu/1frxsS+2fWhjEk2c/IhtypLo5ytSUie1BCiT6i9qnEo4bruBomQsAA== +"@inversifyjs/prototype-utils@0.1.3": + version "0.1.3" + resolved "https://registry.yarnpkg.com/@inversifyjs/prototype-utils/-/prototype-utils-0.1.3.tgz#c720e7d2d847e4748534c5986b25e271186898d2" + integrity sha512-EzRamZzNgE9Sn3QtZ8NncNa2lpPMZfspqbK6BWFguWnOpK8ymp2TUuH46ruFHZhrHKnknPd7fG22ZV7iF517TQ== dependencies: - "@inversifyjs/common" "1.3.3" - "@inversifyjs/reflect-metadata-utils" "0.2.3" + "@inversifyjs/common" "1.5.2" -"@inversifyjs/reflect-metadata-utils@0.2.3": - version "0.2.3" - resolved "https://registry.yarnpkg.com/@inversifyjs/reflect-metadata-utils/-/reflect-metadata-utils-0.2.3.tgz#b17359fd4fdfc85726d3b1af7ad3647136950ea0" - integrity sha512-d3D0o9TeSlvaGM2I24wcNw/Aj3rc4OYvHXOKDC09YEph5fMMiKd6fq1VTQd9tOkDNWvVbw+cnt45Wy9P/t5Lvw== +"@inversifyjs/reflect-metadata-utils@1.4.1": + version "1.4.1" + resolved "https://registry.yarnpkg.com/@inversifyjs/reflect-metadata-utils/-/reflect-metadata-utils-1.4.1.tgz#6219df487e6aab1810a0feee4a625a0e11397340" + integrity sha512-Cp77C4d2wLaHXiUB7iH6Cxb7i1lD/YDuTIHLTDzKINqGSz0DCSoL/Dg2wVkW/6Qx03r/yQMLJ+32Agl32N2X8g== "@isaacs/balanced-match@^4.0.1": version "4.0.1" @@ -3042,13 +3065,14 @@ interpret@^3.1.1: resolved "https://registry.yarnpkg.com/interpret/-/interpret-3.1.1.tgz#5be0ceed67ca79c6c4bc5cf0d7ee843dcea110c4" integrity sha512-6xwYfHbajpoF0xLW+iwLkhwgvLoZDfjYfoFNu8ftMoXINzwuymNLd9u/KmwtdT2GbR+/Cz66otEGEVVUHX9QLQ== -inversify@6.1.4: - version "6.1.4" - resolved "https://registry.yarnpkg.com/inversify/-/inversify-6.1.4.tgz#7dc288b190bc6c0e2081d7a003cbf6c4f94d946f" - integrity sha512-PbxrZH/gTa1fpPEEGAjJQzK8tKMIp5gRg6EFNJlCtzUcycuNdmhv3uk5P8Itm/RIjgHJO16oQRLo9IHzQN51bA== +inversify@7.11.0: + version "7.11.0" + resolved "https://registry.yarnpkg.com/inversify/-/inversify-7.11.0.tgz#571cede6346081b5af224eaea49bb97a91268f92" + integrity sha512-yZDprSSr8TyVeMGI/AOV4ws6gwjX22hj9Z8/oHAVpJORY6WRFTcUzhnZtibBUHEw2U8ArvHcR+i863DplQ3Cwg== dependencies: - "@inversifyjs/common" "1.3.3" - "@inversifyjs/core" "1.3.4" + "@inversifyjs/common" "1.5.2" + "@inversifyjs/container" "1.15.0" + "@inversifyjs/core" "9.2.0" is-arguments@^1.0.4: version "1.0.4" @@ -4921,8 +4945,7 @@ string-template@1.0.0: resolved "https://registry.npmjs.org/string-template/-/string-template-1.0.0.tgz" integrity sha1-np8iM9wA8hhxjsN5oopWc+zKi5Y= -"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.2.3: - name string-width-cjs +"string-width-cjs@npm:string-width@^4.2.0": version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -4940,6 +4963,15 @@ string-width@^4.1.0, string-width@^4.2.0: is-fullwidth-code-point "^3.0.0" strip-ansi "^6.0.0" +string-width@^4.2.3: + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + string-width@^5.0.1, string-width@^5.1.2: version "5.1.2" resolved "https://registry.yarnpkg.com/string-width/-/string-width-5.1.2.tgz#14f8daec6d81e7221d2a357e668cab73bdbca794" @@ -5020,7 +5052,7 @@ stringz@2.1.0: dependencies: char-regex "^1.0.2" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1": version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -5034,6 +5066,13 @@ strip-ansi@^6.0.0: dependencies: ansi-regex "^5.0.0" +strip-ansi@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + strip-ansi@^7.0.1: version "7.1.2" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.2.tgz#132875abde678c7ea8d691533f2e7e22bb744dba" From 10c763fa65674932ab2ab90ac83720f018e04050 Mon Sep 17 00:00:00 2001 From: Timofey Kachalov Date: Mon, 27 Apr 2026 12:18:29 +0400 Subject: [PATCH 24/24] Add reference letter mention --- README.md | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 937bc642a..3cd0786d4 100644 --- a/README.md +++ b/README.md @@ -4,17 +4,34 @@ Author: Timofei Kachalov --> -#### You can support this project by donating: -* (Github) https://github.com/sponsors/sanex3339 - -Huge thanks to all supporters! - # JavaScript obfuscator ![logo](https://raw.githubusercontent.com/javascript-obfuscator/javascript-obfuscator/master/images/logo.png) --- +### Do you use JavaScript Obfuscator at your company? + +JavaScript Obfuscator has reached over **1 million npm downloads per week**. I am currently preparing an **EB-1 immigration case** and collecting independent evidence of the project’s real-world professional usage and impact. + +If you use JavaScript Obfuscator in a company project — especially at a well-known company, large organization, or widely used product — I would be very grateful if you could contact me. + +Helpful evidence may include a brief confirmation or, ideally, a 1–2 page reference letter describing: + +- how your team or company used JavaScript Obfuscator; +- why you chose it; +- what problem it helped solve; +- whether it was used in production or an important internal workflow; +- your role and how you are familiar with the usage. + +I can provide a simple draft/template to make this easy. + +Please contact me at: **referenceletter@obfuscator.io** + +Thank you for supporting the project. + +--- + ### :rocket: Obfuscator.io with VM Obfuscation **Obfuscator.io** adds **VM-based bytecode obfuscation** to this package - your JavaScript functions are compiled to custom bytecode that runs on an embedded virtual machine. Each build produces unique opcodes and VM structure, making reverse engineering and automated deobfuscation dramatically harder.