diff --git a/arkguard/README-cn.md b/arkguard/README-cn.md index 83b75f6ebd493a78fe270ec0bb66d09169dac16c..30e87e1dd0ff7ac112cbda6a566ad5b0c81d1dbb 100644 --- a/arkguard/README-cn.md +++ b/arkguard/README-cn.md @@ -176,9 +176,7 @@ Arkguard只混淆参数名和局部变量名(通过将它们重新命名为随 **注意**:编译生成的源码文件中的注释默认会被全部删除,不支持配置保留。 ### 保留选项 -保留选项只有在使用`enable-property-obfuscation`或`enable-toplevel-obfuscation`以及`-remove-comments`选项时发挥作用。 -`-keep-property-name` [,identifiers,...] - +#### `-keep-property-name` [,identifiers,...] 指定你想保留的属性名。比如下面的例子: ``` -keep-property-name @@ -186,13 +184,25 @@ age firstName lastName ``` +**注意**:该选项在开启`-enable-property-obfuscation`时生效 -`-keep-comments` -保留JsDoc注释的方法与上述属性名的保留方法类似。比如保留某个声明文件中类名为Human的类上方的JsDoc注释: +`-keep-comments` +保留声明文件中元素上方的JsDoc注释。比如想保留声明文件中Human类上方的JsDoc注释,可进行以下配置: ``` -keep-comments Human ``` +**注意**: +1. 该选项在开启`-remove-comments`时生效 +2. 当声明文件中某个元素名称被混淆时,该元素上方的JsDoc注释无法通过`-keep-comments`保留。比如当在`-keep-comments`中配置了 +exportClass时,如果下面的类名被混淆,其JsDoc注释无法被保留: +``` +/** +** @class exportClass +*/ +export class exportClass {} +``` + **哪些属性名应该被保留?** 为了保障混淆的正确性,我们建议你保留所有不通过点语法访问的属性。 diff --git a/arkguard/README.md b/arkguard/README.md index d71357eea15a96318774367379e92ea070781114..896fa731ed3f09392744e9caac116a60d32fcf63 100644 --- a/arkguard/README.md +++ b/arkguard/README.md @@ -194,8 +194,7 @@ Remove all comments including single line, multi line and JsDoc comments, in a p **Note**: `-keep-comments` doesn't work for comments in generated source files, which will be deleted. ### Keep options -Keep options are useful only when you use `enable-property-obfuscation`, `enable-toplevel-obfuscation` and `-keep-comments`. -`-keep-property-name` [,identifiers,...] +#### `-keep-property-name` [,identifiers,...] Specifies property names that you want to keep. For example, ``` @@ -204,13 +203,27 @@ age firstName lastName ``` +**Note**: This option is avaliable when `-enable-property-obfuscation` is enabled. `-keep-comments` -You can have the following configs to keep certain JsDoc comments above a class, for example, class human: +To retain JsDoc comments above elements in declaration files, such as preserving the JsDoc comment above the Human class, +you can make the following configuration: ``` -keep-comments Human ``` +**Note**: +1. This option is avaliable when `-remove-comments` is enabled. +2. If the name of an element is obfuscated, the JsDoc comments +above that element cannot be kept using `-keep-comments`. For example, when you have exportClass in `-keep-comments`, +you should make sure that the following class will not be obfuscated, or the JsDoc comments above the class will still be removed: +``` +/** +** @class exportClass +*/ +export class exportClass {} +``` + **What property names should be kept?** For safety, we would suggest keeping all property names that are not accessed through dot syntax.