mirror of
https://github.com/javascript-obfuscator/javascript-obfuscator
synced 2026-08-09 12:42:29 +00:00
Switched esprima on espree. Obfuscation of export declarations
This commit is contained in:
@@ -96,6 +96,14 @@ export class NodeGuards {
|
||||
return node.type === NodeType.ContinueStatement;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Node} node
|
||||
* @returns {boolean}
|
||||
*/
|
||||
public static isExportNamedDeclarationNode (node: ESTree.Node): node is ESTree.ExportNamedDeclaration {
|
||||
return node.type === NodeType.ExportNamedDeclaration;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Node} node
|
||||
* @returns {boolean}
|
||||
@@ -136,6 +144,14 @@ export class NodeGuards {
|
||||
return node.type === NodeType.IfStatement;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Node} node
|
||||
* @returns {boolean}
|
||||
*/
|
||||
public static isImportDeclarationNode (node: ESTree.Node): node is ESTree.ImportDeclaration {
|
||||
return node.type === NodeType.ImportDeclaration;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Node} node
|
||||
* @param {Node} parentNode
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as escodegen from 'escodegen-wallaby';
|
||||
import * as esprima from 'esprima';
|
||||
import * as espree from 'espree';
|
||||
import * as estraverse from 'estraverse';
|
||||
import * as ESTree from 'estree';
|
||||
|
||||
@@ -44,7 +44,7 @@ export class NodeUtils {
|
||||
* @returns {Statement[]}
|
||||
*/
|
||||
public static convertCodeToStructure (code: string): ESTree.Statement[] {
|
||||
let structure: ESTree.Program = esprima.parseScript(code);
|
||||
let structure: ESTree.Program = espree.parse(code, { sourceType: 'script' });
|
||||
|
||||
structure = NodeUtils.addXVerbatimPropertyToLiterals(structure);
|
||||
structure = NodeUtils.parentize(structure);
|
||||
|
||||
Reference in New Issue
Block a user