mirror of
https://github.com/javascript-obfuscator/javascript-obfuscator
synced 2026-08-09 12:42:29 +00:00
0.18.5 version. Dependencies update
This commit is contained in:
@@ -47,7 +47,7 @@ export class CLIUtils {
|
||||
* @returns {TObject}
|
||||
*/
|
||||
public static getUserConfig (configPath: string): TObject {
|
||||
let config: Object;
|
||||
let config: TObject;
|
||||
|
||||
try {
|
||||
config = require(configPath);
|
||||
|
||||
+3
-4
@@ -1,10 +1,9 @@
|
||||
import * as ESTree from 'estree';
|
||||
import { TObject } from '../../types/TObject';
|
||||
|
||||
export interface IAnalyzer {
|
||||
export interface IAnalyzer <T> {
|
||||
/**
|
||||
* @param {Program} astTree
|
||||
* @returns {TObject[]}
|
||||
* @returns {T[]}
|
||||
*/
|
||||
analyze (astTree: ESTree.Program): TObject[];
|
||||
analyze (astTree: ESTree.Program): T[];
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import * as ESTree from 'estree';
|
||||
import { IAnalyzer } from '../IAnalyzer';
|
||||
import { IStackTraceData } from './IStackTraceData';
|
||||
|
||||
export interface IStackTraceAnalyzer extends IAnalyzer {
|
||||
export interface IStackTraceAnalyzer extends IAnalyzer<IStackTraceData> {
|
||||
/**
|
||||
* @param {Program} astTree
|
||||
* @returns {IStackTraceData[]}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import Events = NodeJS.Events;
|
||||
import EventEmitter = NodeJS.EventEmitter;
|
||||
|
||||
import { ObfuscationEvent } from '../../enums/event-emitters/ObfuscationEvent';
|
||||
|
||||
export interface IObfuscationEventEmitter extends Events {
|
||||
export interface IObfuscationEventEmitter extends EventEmitter {
|
||||
/**
|
||||
* @param event
|
||||
* @param listener
|
||||
|
||||
@@ -76,21 +76,21 @@ export class LiteralTransformer extends AbstractNodeTransformer {
|
||||
case 'boolean':
|
||||
newLiteralNode = this.literalObfuscatingReplacerFactory(
|
||||
LiteralObfuscatingReplacer.BooleanLiteralObfuscatingReplacer
|
||||
).replace(<boolean>literalNode.value);
|
||||
).replace(literalNode.value);
|
||||
|
||||
break;
|
||||
|
||||
case 'number':
|
||||
newLiteralNode = this.literalObfuscatingReplacerFactory(
|
||||
LiteralObfuscatingReplacer.NumberLiteralObfuscatingReplacer
|
||||
).replace(<number>literalNode.value);
|
||||
).replace(literalNode.value);
|
||||
|
||||
break;
|
||||
|
||||
case 'string':
|
||||
newLiteralNode = this.literalObfuscatingReplacerFactory(
|
||||
LiteralObfuscatingReplacer.StringLiteralObfuscatingReplacer
|
||||
).replace(<string>literalNode.value);
|
||||
).replace(literalNode.value);
|
||||
|
||||
break;
|
||||
|
||||
|
||||
@@ -3,8 +3,6 @@ import * as espree from 'espree';
|
||||
import * as estraverse from 'estraverse';
|
||||
import * as ESTree from 'estree';
|
||||
|
||||
import { TObject } from '../types/TObject';
|
||||
|
||||
import { NodeGuards } from './NodeGuards';
|
||||
import { NodeMetadata } from './NodeMetadata';
|
||||
|
||||
@@ -110,16 +108,16 @@ export class NodeUtils {
|
||||
return node;
|
||||
}
|
||||
|
||||
const copy: TObject = {};
|
||||
const copy: Partial<T> = {};
|
||||
const nodeKeys: (keyof T)[] = <(keyof T)[]>Object.keys(node);
|
||||
|
||||
Object
|
||||
.keys(node)
|
||||
.forEach((property: string) => {
|
||||
nodeKeys
|
||||
.forEach((property: keyof T) => {
|
||||
if (property === 'parentNode') {
|
||||
return;
|
||||
}
|
||||
|
||||
const value: T[keyof T] = node[<keyof T>property];
|
||||
const value: T[keyof T] = node[property];
|
||||
|
||||
let clonedValue: T[keyof T] | T[keyof T][] | null;
|
||||
|
||||
@@ -133,7 +131,7 @@ export class NodeUtils {
|
||||
clonedValue = value;
|
||||
}
|
||||
|
||||
copy[property] = clonedValue;
|
||||
copy[property] = <T[keyof T]>clonedValue;
|
||||
});
|
||||
|
||||
return <T>copy;
|
||||
|
||||
Reference in New Issue
Block a user