mirror of
https://github.com/javascript-obfuscator/javascript-obfuscator
synced 2026-08-09 12:42:29 +00:00
Merge branch 'master' into cli-options-kebab-case-naming
# Conflicts: # dist/index.js
This commit is contained in:
@@ -4,6 +4,7 @@ import { ServiceIdentifiers } from './container/ServiceIdentifiers';
|
||||
import * as esprima from 'esprima';
|
||||
import * as escodegen from 'escodegen-wallaby';
|
||||
import * as ESTree from 'estree';
|
||||
import * as packageJson from 'pjson';
|
||||
|
||||
import { ICustomNodeGroup } from './interfaces/custom-nodes/ICustomNodeGroup';
|
||||
import { IGeneratorOutput } from './interfaces/IGeneratorOutput';
|
||||
@@ -157,6 +158,7 @@ export class JavaScriptObfuscator implements IJavaScriptObfuscator {
|
||||
*/
|
||||
public obfuscate (sourceCode: string): IObfuscationResult {
|
||||
const timeStart: number = Date.now();
|
||||
this.logger.info(LoggingMessage.Version, packageJson.version);
|
||||
this.logger.info(LoggingMessage.ObfuscationStarted);
|
||||
this.logger.info(LoggingMessage.RandomGeneratorSeed, this.randomGenerator.getSeed());
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import * as commander from 'commander';
|
||||
import * as packageJson from 'pjson';
|
||||
import * as path from 'path';
|
||||
|
||||
import { TInputCLIOptions } from '../types/options/TInputCLIOptions';
|
||||
@@ -182,7 +183,7 @@ export class JavaScriptObfuscatorCLI implements IInitializable {
|
||||
this.commands
|
||||
.usage('<inputPath> [options]')
|
||||
.version(
|
||||
CLIUtils.getPackageConfig().version,
|
||||
packageJson.version,
|
||||
'-v, --version'
|
||||
)
|
||||
.option(
|
||||
|
||||
@@ -4,8 +4,6 @@ import * as path from 'path';
|
||||
|
||||
import { TObject } from '../../types/TObject';
|
||||
|
||||
import { IPackageConfig } from '../../interfaces/cli/IPackageConfig';
|
||||
|
||||
import { JavaScriptObfuscatorCLI } from '../JavaScriptObfuscatorCLI';
|
||||
|
||||
export class CLIUtils {
|
||||
@@ -43,23 +41,6 @@ export class CLIUtils {
|
||||
return outputCodePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {IPackageConfig}
|
||||
*/
|
||||
public static getPackageConfig (): IPackageConfig {
|
||||
return JSON.parse(
|
||||
fs.readFileSync(
|
||||
path.join(
|
||||
path.dirname(
|
||||
fs.realpathSync(process.argv[1])
|
||||
),
|
||||
'../package.json'
|
||||
),
|
||||
JavaScriptObfuscatorCLI.encoding
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} configPath
|
||||
* @returns {TObject}
|
||||
|
||||
@@ -7,5 +7,6 @@ export enum LoggingMessage {
|
||||
StageAnalyzingASTTree = 'Stage: analyzing AST-tree...',
|
||||
StageControlFlowFlattening = 'Stage: control flow flattening...',
|
||||
StageDeadCodeInjection = 'Stage: dead code injection...',
|
||||
StageObfuscation = 'Stage: obfuscation...'
|
||||
StageObfuscation = 'Stage: obfuscation...',
|
||||
Version = 'Version: %s'
|
||||
}
|
||||
|
||||
-30
@@ -1,30 +0,0 @@
|
||||
export interface IPackageConfig {
|
||||
bin?: string | {[name: string]: string};
|
||||
bugs?: {[key: string]: string};
|
||||
bundledDependencies?: {[name: string]: string};
|
||||
config?: {[name: string]: string};
|
||||
cpu?: string[];
|
||||
dependencies?: {[name: string]: string};
|
||||
description?: string;
|
||||
devDependencies?: {[name: string]: string};
|
||||
directories?: any;
|
||||
engines?: {[name: string]: string};
|
||||
files?: string[];
|
||||
homepage?: string;
|
||||
keywords?: string[];
|
||||
license?: string;
|
||||
main?: string;
|
||||
man?: string | string[];
|
||||
name: string;
|
||||
optionalDependencies?: {[name: string]: string};
|
||||
os?: string[];
|
||||
peerDependencies?: {[name: string]: string};
|
||||
preferGlobal?: boolean;
|
||||
'private'?: boolean;
|
||||
repository?: string | {
|
||||
type: string;
|
||||
url: string;
|
||||
};
|
||||
scripts?: {[name: string]: string};
|
||||
version: string;
|
||||
}
|
||||
Reference in New Issue
Block a user