@nodesecure/js-x-ray
Version:
JavaScript AST XRay analysis
44 lines • 1.77 kB
TypeScript
import type { ESTree } from "meriyah";
import { VariableTracer } from "./VariableTracer.ts";
import type { Dependency, Sensitivity } from "./AstAnalyser.ts";
import { Deobfuscator } from "./Deobfuscator.ts";
import { type Warning } from "./warnings.ts";
import { CollectableSetRegistry } from "./CollectableSetRegistry.ts";
import type { CollectableSet } from "./CollectableSet.ts";
export type SourceFlags = "fetch" | "oneline-require" | "is-minified";
export type SourceFileOptions = {
metadata?: Record<string, unknown>;
collectables?: CollectableSet[];
packageName?: string;
};
export declare class SourceFile {
tracer: VariableTracer;
inTryStatement: boolean;
dependencyAutoWarning: boolean;
deobfuscator: Deobfuscator;
dependencies: Map<string, Dependency>;
encodedLiterals: Map<string, string>;
warnings: Warning[];
flags: Set<SourceFlags>;
path: SourceFilePath;
sensitivity?: Sensitivity;
metadata?: Record<string, unknown>;
collectablesSetRegistry: CollectableSetRegistry;
packageName?: string;
constructor(sourceLocation?: string, options?: SourceFileOptions);
addDependency(name: string, location?: ESTree.SourceLocation | null, unsafe?: boolean): void;
addEncodedLiteral(value: string, location: ESTree.SourceLocation | undefined | null): void;
analyzeLiteral(node: ESTree.Literal, inArrayExpr?: boolean): void;
getResult(isMinified: boolean): {
idsLengthAvg: number;
stringScore: number;
warnings: Warning[];
};
walk(node: ESTree.Node): ESTree.Node[];
}
export declare class SourceFilePath {
location: string | null;
use(location?: string): void;
resolve(...parts: string[]): string;
}
//# sourceMappingURL=SourceFile.d.ts.map