diff --git a/arkguard/README-cn.md b/arkguard/README-cn.md index 4fd81d1f55cb66f70063a38cd7f244c028402c90..2dcf5271ef9a9fe5a90fd44f78b5258635a20e11 100644 --- a/arkguard/README-cn.md +++ b/arkguard/README-cn.md @@ -200,10 +200,7 @@ Arkguard只混淆参数名和局部变量名(通过将它们重新命名为随 **注意**:编译生成的源码文件中的注释默认会被全部删除,不支持配置保留。 ### 保留选项 -保留选项只有在使用`enable-property-obfuscation`或`enable-toplevel-obfuscation`以及`-remove-comments`选项时发挥作用。 - -#### `-keep-property-name` [,identifiers,...] - +#### `-keep-property-name` [,identifiers,...] 指定你想保留的属性名。比如下面的例子: ``` -keep-property-name @@ -211,13 +208,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 330a093e868883c86b6cc5675e237fa93b24c057..c193f163902636edc4c86449f22344b8fc0deca4 100644 --- a/arkguard/README.md +++ b/arkguard/README.md @@ -218,8 +218,6 @@ 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,...] Specifies property names that you want to keep. For example, @@ -229,13 +227,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.