mirror of
https://github.com/javascript-obfuscator/javascript-obfuscator
synced 2026-08-09 12:42:29 +00:00
Removed isNodeScope option, added more tests
This commit is contained in:
@@ -1,15 +1,11 @@
|
||||
import { inject, injectable, } from 'inversify';
|
||||
import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
|
||||
import { injectable, } from 'inversify';
|
||||
|
||||
import * as eslintScope from 'eslint-scope';
|
||||
import * as estraverse from 'estraverse';
|
||||
import * as ESTree from 'estree';
|
||||
|
||||
import { IOptions } from '../../interfaces/options/IOptions';
|
||||
import { IScopeAnalyzer } from '../../interfaces/analyzers/scope-analyzer/IScopeAnalyzer';
|
||||
|
||||
import { ObfuscationTarget } from '../../enums/ObfuscationTarget';
|
||||
|
||||
import { ecmaVersion } from '../../constants/EcmaVersion';
|
||||
|
||||
import { NodeGuards } from '../../node/NodeGuards';
|
||||
@@ -37,25 +33,11 @@ export class ScopeAnalyzer implements IScopeAnalyzer {
|
||||
*/
|
||||
private static readonly emptyRangeValue: number = 0;
|
||||
|
||||
/**
|
||||
* @type {IOptions}
|
||||
*/
|
||||
private readonly options: IOptions;
|
||||
|
||||
/**
|
||||
* @type {eslintScope.ScopeManager | null}
|
||||
*/
|
||||
private scopeManager: eslintScope.ScopeManager | null = null;
|
||||
|
||||
/**
|
||||
* @param {IOptions} options
|
||||
*/
|
||||
constructor (
|
||||
@inject(ServiceIdentifiers.IOptions) options: IOptions
|
||||
) {
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
/**
|
||||
* `eslint-scope` reads `ranges` property of a nodes
|
||||
* Should attach that property to the some custom nodes
|
||||
@@ -97,7 +79,6 @@ export class ScopeAnalyzer implements IScopeAnalyzer {
|
||||
try {
|
||||
this.scopeManager = eslintScope.analyze(astTree, {
|
||||
...ScopeAnalyzer.eslintScopeOptions,
|
||||
nodejsScope: this.options.target === ObfuscationTarget.Node,
|
||||
sourceType: ScopeAnalyzer.sourceTypes[i]
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user