1/* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16import type {NameGeneratorType} from '../generator/NameFactory'; 17 18export interface INameObfuscationOption { 19 20 readonly mEnable: boolean; 21 22 readonly mNameGeneratorType?: NameGeneratorType; 23 24 readonly mRenameProperties: boolean; 25 26 mReservedNames?: string[]; 27 28 mReservedProperties: string[]; 29 30 mUniversalReservedProperties?: RegExp[]; 31 32 readonly mDictionaryList?: string[]; 33 34 readonly mKeepStringProperty?: boolean; 35 36 readonly mTopLevel?: boolean; 37 38 readonly mKeepParameterNames?: boolean; 39 40 mReservedToplevelNames?: string[]; 41 42 mUniversalReservedToplevelNames?: RegExp[]; 43 44 readonly mEnableAtKeep?: boolean; 45} 46 47export interface IFileNameObfuscationOption { 48 49 readonly mEnable: boolean; 50 51 readonly mNameGeneratorType: NameGeneratorType; 52 53 mReservedFileNames: string[]; 54 55 mUniversalReservedFileNames?: RegExp[]; 56 57 readonly mOhmUrlStatus?: OhmUrlStatus; 58} 59 60export interface IDeclarationCommentOption { 61 62 readonly mEnable: boolean, 63 64 mReservedComments: string[], 65 66 mUniversalReservedComments?: RegExp[] 67} 68 69export enum OhmUrlStatus { 70 NONE, 71 AT_BUNDLE, 72 NORMALIZED 73} 74 75export interface IPrinterOption { 76 77 //Print obfuscation time&memory usage of all files and obfuscation processes 78 readonly mFilesPrinter?: boolean; 79 80 //Print time&memory usage of a single file obfuscation in transform processes 81 readonly mSingleFilePrinter?: boolean; 82 83 //Print sum up time of transform processes during obfuscation 84 readonly mSumPrinter?: boolean; 85 86 //Output path of printer 87 readonly mOutputPath?: string; 88} 89 90/** 91 * It records which files cannot be obfuscated (except for file name obfuscation) and their dependent files. 92 * The names and properties exported in the dependent files are put into the whitelist. 93 */ 94export interface IKeepSourcePathsAndDependency { 95 mKeepSourceOfPaths: Set<string>; 96 mkeepFilesAndDependencies: Set<string>; 97} 98 99export interface IUnobfuscationOption { 100 mPrintKeptNames: boolean; 101 mPrintPath: string; 102} 103