@adguard/agtree 4.0.0 → 4.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -3
- package/dist/ast-utils/clone.js +12 -8
- package/dist/ast-utils/modifiers.js +13 -11
- package/dist/ast-utils/network-rules.js +10 -9
- package/dist/ast-utils/scriptlets.js +20 -18
- package/dist/common/abp-snippet-injection-body-common.js +1 -1
- package/dist/common/agent-common.js +1 -1
- package/dist/common/ubo-html-filtering-body-common.js +1 -1
- package/dist/common/ubo-selector-common.js +1 -1
- package/dist/compatibility-tables/base.js +7 -6
- package/dist/compatibility-tables/compatibility-table-data.js +1 -1
- package/dist/compatibility-tables/modifiers.js +4 -3
- package/dist/compatibility-tables/platforms.js +1 -1
- package/dist/compatibility-tables/redirects.js +4 -4
- package/dist/compatibility-tables/schemas/base.js +2 -2
- package/dist/compatibility-tables/schemas/modifier.js +4 -4
- package/dist/compatibility-tables/schemas/platform.js +3 -2
- package/dist/compatibility-tables/schemas/redirect.js +1 -1
- package/dist/compatibility-tables/schemas/resource-type.js +1 -1
- package/dist/compatibility-tables/schemas/scriptlet.js +1 -1
- package/dist/compatibility-tables/scriptlets.js +2 -2
- package/dist/compatibility-tables/utils/platform-helpers.js +6 -4
- package/dist/compatibility-tables/utils/resource-type-helpers.js +1 -1
- package/dist/compatibility-tables/utils/zod-camelcase.js +3 -3
- package/dist/converter/base-interfaces/base-converter.js +22 -16
- package/dist/converter/base-interfaces/conversion-result.js +15 -11
- package/dist/converter/base-interfaces/rule-converter-base.js +19 -13
- package/dist/converter/comment/index.js +11 -9
- package/dist/converter/cosmetic/css.js +12 -10
- package/dist/converter/cosmetic/element-hiding.js +12 -10
- package/dist/converter/cosmetic/header-removal.js +16 -13
- package/dist/converter/cosmetic/html.js +18 -18
- package/dist/converter/cosmetic/index.js +28 -24
- package/dist/converter/cosmetic/rule-modifiers/adg.js +15 -12
- package/dist/converter/cosmetic/rule-modifiers/ubo.js +22 -19
- package/dist/converter/cosmetic/scriptlet.js +26 -22
- package/dist/converter/css/index.js +13 -11
- package/dist/converter/data/css.js +8 -8
- package/dist/converter/filter-list.js +12 -10
- package/dist/converter/index.js +1 -1
- package/dist/converter/misc/network-rule-modifier.js +20 -16
- package/dist/converter/network/index.js +16 -12
- package/dist/converter/raw-filter-list.js +12 -10
- package/dist/converter/raw-rule.js +14 -12
- package/dist/converter/rule.js +17 -13
- package/dist/errors/adblock-syntax-error.js +1 -1
- package/dist/errors/not-implemented-error.js +2 -2
- package/dist/errors/rule-conversion-error.js +2 -2
- package/dist/generator/base-generator.js +1 -1
- package/dist/generator/comment/agent-comment-generator.js +4 -3
- package/dist/generator/comment/agent-generator.js +5 -4
- package/dist/generator/comment/comment-rule-generator.js +6 -5
- package/dist/generator/comment/config-comment-generator.js +5 -4
- package/dist/generator/comment/hint-comment-generator.js +5 -4
- package/dist/generator/comment/hint-generator.js +4 -3
- package/dist/generator/comment/metadata-comment-generator.js +3 -2
- package/dist/generator/comment/pre-processor-comment-generator.js +6 -5
- package/dist/generator/comment/simple-comment-generator.js +3 -2
- package/dist/generator/cosmetic/cosmetic-rule-body-generator.js +13 -11
- package/dist/generator/cosmetic/cosmetic-rule-generator.js +5 -4
- package/dist/generator/cosmetic/cosmetic-rule-pattern-generator.js +7 -5
- package/dist/generator/cosmetic/html-filtering-body/adg-html-filtering-body-generator.js +3 -3
- package/dist/generator/cosmetic/html-filtering-body/html-filtering-body-generator.js +1 -1
- package/dist/generator/cosmetic/html-filtering-body/ubo-html-filtering-body-generator.js +2 -2
- package/dist/generator/cosmetic/scriptlet-body/abp-snippet-injection-body-generator.js +7 -5
- package/dist/generator/cosmetic/scriptlet-body/adg-scriptlet-injection-body-generator.js +7 -5
- package/dist/generator/cosmetic/scriptlet-body/ubo-scriptlet-injection-body-generator.js +8 -6
- package/dist/generator/cosmetic/selector/attribute-selector-generator.js +2 -2
- package/dist/generator/cosmetic/selector/class-selector-generator.js +1 -1
- package/dist/generator/cosmetic/selector/complex-selector-generator.js +4 -4
- package/dist/generator/cosmetic/selector/id-selector-generator.js +1 -1
- package/dist/generator/cosmetic/selector/pseudo-class-selector-generator.js +1 -1
- package/dist/generator/cosmetic/selector/selector-combinator-generator.js +1 -1
- package/dist/generator/cosmetic/selector/selector-list-generator.js +1 -1
- package/dist/generator/cosmetic/selector/type-selector-generator.js +1 -1
- package/dist/generator/css/adg-css-injection-generator.js +5 -1
- package/dist/generator/filterlist-generator.js +5 -4
- package/dist/generator/index.js +1 -1
- package/dist/generator/misc/domain-list-generator.js +1 -1
- package/dist/generator/misc/list-items-generator.js +5 -3
- package/dist/generator/misc/logical-expression-generator.js +5 -4
- package/dist/generator/misc/modifier-generator.js +4 -3
- package/dist/generator/misc/modifier-list-generator.js +5 -4
- package/dist/generator/misc/parameter-list-generator.js +6 -5
- package/dist/generator/misc/value-generator.js +2 -1
- package/dist/generator/network/host-rule-generator.js +2 -1
- package/dist/generator/network/network-rule-generator.js +2 -1
- package/dist/generator/rule-generator.js +6 -4
- package/dist/index.js +1 -2
- package/dist/nodes/index.js +1 -1
- package/dist/package.json.js +2 -2
- package/dist/parser/base-parser.js +1 -1
- package/dist/parser/comment/agent-comment-parser.js +11 -9
- package/dist/parser/comment/agent-parser.js +12 -9
- package/dist/parser/comment/comment-parser.js +8 -7
- package/dist/parser/comment/config-comment-parser.js +9 -6
- package/dist/parser/comment/hint-comment-parser.js +17 -12
- package/dist/parser/comment/hint-parser.js +10 -7
- package/dist/parser/comment/metadata-comment-parser.js +9 -7
- package/dist/parser/comment/preprocessor-parser.js +14 -11
- package/dist/parser/comment/simple-comment-parser.js +5 -2
- package/dist/parser/cosmetic/cosmetic-rule-parser.js +29 -25
- package/dist/parser/cosmetic/html-filtering-body/adg-html-filtering-body-parser.js +3 -3
- package/dist/parser/cosmetic/html-filtering-body/html-filtering-body-parser.js +4 -4
- package/dist/parser/cosmetic/html-filtering-body/ubo-html-filtering-body-parser.js +7 -7
- package/dist/parser/cosmetic/scriptlet-body/abp-snippet-injection-body-parser.js +12 -9
- package/dist/parser/cosmetic/scriptlet-body/adg-scriptlet-injection-body-parser.js +12 -9
- package/dist/parser/cosmetic/scriptlet-body/ubo-scriptlet-injection-body-parser.js +11 -8
- package/dist/parser/cosmetic/selector/handlers/attribute-selector-handler.js +1 -1
- package/dist/parser/cosmetic/selector/handlers/class-selector-handler.js +1 -1
- package/dist/parser/cosmetic/selector/handlers/complex-selector-handler.js +1 -1
- package/dist/parser/cosmetic/selector/handlers/compound-selector-handler.js +2 -2
- package/dist/parser/cosmetic/selector/handlers/id-selector-handler.js +1 -1
- package/dist/parser/cosmetic/selector/handlers/pseudo-class-selector-handler.js +5 -3
- package/dist/parser/cosmetic/selector/handlers/type-selector-handler.js +1 -1
- package/dist/parser/cosmetic/selector/selector-list-parser.js +7 -7
- package/dist/parser/css/adg-css-injection-parser.js +4 -3
- package/dist/parser/css/balancing.js +22 -18
- package/dist/parser/css/constants.js +1 -1
- package/dist/parser/css/css-token-stream.js +15 -4
- package/dist/parser/css/ubo-selector-parser.js +8 -4
- package/dist/parser/filterlist-parser.js +8 -5
- package/dist/parser/index.js +1 -1
- package/dist/parser/misc/app-list-parser.js +4 -3
- package/dist/parser/misc/domain-list-parser.js +8 -6
- package/dist/parser/misc/list-items-parser.js +8 -6
- package/dist/parser/misc/logical-expression-parser.js +25 -18
- package/dist/parser/misc/method-list-parser.js +4 -3
- package/dist/parser/misc/modifier-list.js +3 -3
- package/dist/parser/misc/modifier-parser.js +5 -4
- package/dist/parser/misc/parameter-list-parser.js +6 -5
- package/dist/parser/misc/stealth-option-list-parser.js +4 -3
- package/dist/parser/misc/ubo-parameter-list-parser.js +10 -9
- package/dist/parser/misc/value-parser.js +2 -2
- package/dist/parser/network/host-rule-parser.js +15 -7
- package/dist/parser/network/network-rule-parser.js +11 -9
- package/dist/parser/options.js +1 -1
- package/dist/parser/rule-parser.js +11 -7
- package/dist/types/ast-utils/clone.d.ts +12 -8
- package/dist/types/ast-utils/filter-list.d.ts +5 -4
- package/dist/types/ast-utils/modifiers.d.ts +11 -9
- package/dist/types/ast-utils/network-rules.d.ts +8 -7
- package/dist/types/ast-utils/scriptlets.d.ts +19 -17
- package/dist/types/compatibility-tables/base.d.ts +6 -5
- package/dist/types/compatibility-tables/redirects.d.ts +1 -1
- package/dist/types/compatibility-tables/schemas/platform.d.ts +1 -0
- package/dist/types/compatibility-tables/utils/platform-helpers.d.ts +5 -3
- package/dist/types/compatibility-tables/utils/zod-camelcase.d.ts +3 -3
- package/dist/types/converter/base-interfaces/base-converter.d.ts +21 -15
- package/dist/types/converter/base-interfaces/conversion-result.d.ts +20 -16
- package/dist/types/converter/base-interfaces/rule-converter-base.d.ts +19 -13
- package/dist/types/converter/comment/index.d.ts +9 -7
- package/dist/types/converter/cosmetic/css.d.ts +9 -7
- package/dist/types/converter/cosmetic/element-hiding.d.ts +9 -7
- package/dist/types/converter/cosmetic/header-removal.d.ts +10 -7
- package/dist/types/converter/cosmetic/html.d.ts +9 -9
- package/dist/types/converter/cosmetic/index.d.ts +14 -10
- package/dist/types/converter/cosmetic/rule-modifiers/adg.d.ts +9 -6
- package/dist/types/converter/cosmetic/rule-modifiers/ubo.d.ts +9 -6
- package/dist/types/converter/cosmetic/scriptlet.d.ts +14 -10
- package/dist/types/converter/css/index.d.ts +9 -7
- package/dist/types/converter/data/css.d.ts +1 -1
- package/dist/types/converter/filter-list.d.ts +10 -8
- package/dist/types/converter/index.d.ts +1 -1
- package/dist/types/converter/misc/network-rule-modifier.d.ts +13 -9
- package/dist/types/converter/network/index.d.ts +15 -11
- package/dist/types/converter/raw-filter-list.d.ts +8 -6
- package/dist/types/converter/raw-rule.d.ts +8 -6
- package/dist/types/converter/rule.d.ts +14 -10
- package/dist/types/errors/not-implemented-error.d.ts +1 -1
- package/dist/types/errors/rule-conversion-error.d.ts +1 -1
- package/dist/types/generator/comment/agent-comment-generator.d.ts +3 -2
- package/dist/types/generator/comment/agent-generator.d.ts +4 -3
- package/dist/types/generator/comment/comment-rule-generator.d.ts +3 -2
- package/dist/types/generator/comment/config-comment-generator.d.ts +4 -3
- package/dist/types/generator/comment/hint-comment-generator.d.ts +4 -3
- package/dist/types/generator/comment/hint-generator.d.ts +3 -2
- package/dist/types/generator/comment/metadata-comment-generator.d.ts +1 -0
- package/dist/types/generator/comment/pre-processor-comment-generator.d.ts +3 -2
- package/dist/types/generator/comment/simple-comment-generator.d.ts +2 -1
- package/dist/types/generator/cosmetic/cosmetic-rule-body-generator.d.ts +7 -5
- package/dist/types/generator/cosmetic/cosmetic-rule-generator.d.ts +3 -2
- package/dist/types/generator/cosmetic/cosmetic-rule-pattern-generator.d.ts +4 -2
- package/dist/types/generator/cosmetic/html-filtering-body/adg-html-filtering-body-generator.d.ts +1 -1
- package/dist/types/generator/cosmetic/html-filtering-body/html-filtering-body-generator.d.ts +1 -1
- package/dist/types/generator/cosmetic/html-filtering-body/ubo-html-filtering-body-generator.d.ts +2 -2
- package/dist/types/generator/cosmetic/scriptlet-body/abp-snippet-injection-body-generator.d.ts +5 -3
- package/dist/types/generator/cosmetic/scriptlet-body/adg-scriptlet-injection-body-generator.d.ts +5 -3
- package/dist/types/generator/cosmetic/scriptlet-body/ubo-scriptlet-injection-body-generator.d.ts +7 -5
- package/dist/types/generator/css/adg-css-injection-generator.d.ts +4 -0
- package/dist/types/generator/css/ubo-selector-generator.d.ts +4 -3
- package/dist/types/generator/filterlist-generator.d.ts +3 -2
- package/dist/types/generator/misc/list-items-generator.d.ts +4 -2
- package/dist/types/generator/misc/logical-expression-generator.d.ts +4 -3
- package/dist/types/generator/misc/modifier-generator.d.ts +3 -2
- package/dist/types/generator/misc/modifier-list-generator.d.ts +4 -3
- package/dist/types/generator/misc/parameter-list-generator.d.ts +5 -4
- package/dist/types/generator/misc/value-generator.d.ts +1 -0
- package/dist/types/generator/network/host-rule-generator.d.ts +1 -0
- package/dist/types/generator/network/network-rule-generator.d.ts +1 -0
- package/dist/types/generator/rule-generator.d.ts +5 -3
- package/dist/types/index.d.ts +1 -2
- package/dist/types/nodes/index.d.ts +55 -54
- package/dist/types/parser/comment/agent-comment-parser.d.ts +5 -3
- package/dist/types/parser/comment/agent-parser.d.ts +7 -4
- package/dist/types/parser/comment/comment-parser.d.ts +5 -3
- package/dist/types/parser/comment/config-comment-parser.d.ts +5 -2
- package/dist/types/parser/comment/hint-comment-parser.d.ts +11 -6
- package/dist/types/parser/comment/hint-parser.d.ts +6 -3
- package/dist/types/parser/comment/metadata-comment-parser.d.ts +5 -3
- package/dist/types/parser/comment/preprocessor-parser.d.ts +9 -6
- package/dist/types/parser/comment/simple-comment-parser.d.ts +3 -0
- package/dist/types/parser/cosmetic/cosmetic-rule-parser.d.ts +9 -6
- package/dist/types/parser/cosmetic/html-filtering-body/adg-html-filtering-body-parser.d.ts +3 -3
- package/dist/types/parser/cosmetic/html-filtering-body/html-filtering-body-parser.d.ts +4 -4
- package/dist/types/parser/cosmetic/html-filtering-body/ubo-html-filtering-body-parser.d.ts +4 -4
- package/dist/types/parser/cosmetic/scriptlet-body/abp-snippet-injection-body-parser.d.ts +8 -5
- package/dist/types/parser/cosmetic/scriptlet-body/adg-scriptlet-injection-body-parser.d.ts +9 -6
- package/dist/types/parser/cosmetic/scriptlet-body/ubo-scriptlet-injection-body-parser.d.ts +8 -5
- package/dist/types/parser/cosmetic/selector/context.d.ts +2 -2
- package/dist/types/parser/cosmetic/selector/selector-list-parser.d.ts +2 -2
- package/dist/types/parser/css/adg-css-injection-parser.d.ts +1 -0
- package/dist/types/parser/css/balancing.d.ts +17 -12
- package/dist/types/parser/css/css-token-stream.d.ts +11 -0
- package/dist/types/parser/css/ubo-selector-parser.d.ts +3 -0
- package/dist/types/parser/filterlist-parser.d.ts +5 -2
- package/dist/types/parser/misc/app-list-parser.d.ts +1 -0
- package/dist/types/parser/misc/domain-list-parser.d.ts +5 -3
- package/dist/types/parser/misc/list-items-parser.d.ts +5 -3
- package/dist/types/parser/misc/logical-expression-parser.d.ts +9 -5
- package/dist/types/parser/misc/method-list-parser.d.ts +1 -0
- package/dist/types/parser/misc/modifier-list.d.ts +2 -1
- package/dist/types/parser/misc/modifier-parser.d.ts +2 -1
- package/dist/types/parser/misc/parameter-list-parser.d.ts +3 -2
- package/dist/types/parser/misc/stealth-option-list-parser.d.ts +1 -0
- package/dist/types/parser/misc/ubo-parameter-list-parser.d.ts +2 -1
- package/dist/types/parser/misc/value-parser.d.ts +1 -1
- package/dist/types/parser/network/host-rule-parser.d.ts +10 -2
- package/dist/types/parser/network/network-rule-parser.d.ts +5 -3
- package/dist/types/parser/options.d.ts +1 -1
- package/dist/types/parser/rule-parser.d.ts +6 -2
- package/dist/types/tokenizer/tokenizer.d.ts +2 -2
- package/dist/types/utils/adblockers.d.ts +9 -6
- package/dist/types/utils/clone.d.ts +4 -3
- package/dist/types/utils/constants.d.ts +1 -1
- package/dist/types/utils/cosmetic-rule-separator.d.ts +13 -10
- package/dist/types/utils/deep-freeze.d.ts +4 -4
- package/dist/types/utils/domain.d.ts +3 -2
- package/dist/types/utils/logical-expression.d.ts +9 -5
- package/dist/types/utils/multi-value-map.d.ts +3 -3
- package/dist/types/utils/position-provider.d.ts +3 -2
- package/dist/types/utils/quotes.d.ts +48 -42
- package/dist/types/utils/regexp.d.ts +24 -17
- package/dist/types/utils/string.d.ts +135 -103
- package/dist/types/utils/type-guards.d.ts +1 -0
- package/dist/types/validator/helpers.d.ts +1 -1
- package/dist/types/validator/index.d.ts +3 -3
- package/dist/types/version.d.ts +1 -1
- package/dist/utils/adblockers.js +10 -7
- package/dist/utils/bit-count.js +1 -1
- package/dist/utils/categorizer.js +2 -2
- package/dist/utils/clone.js +5 -4
- package/dist/utils/constants.js +2 -2
- package/dist/utils/cosmetic-rule-separator.js +15 -11
- package/dist/utils/deep-freeze.js +5 -5
- package/dist/utils/domain.js +4 -3
- package/dist/utils/error.js +3 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/logical-expression.js +10 -6
- package/dist/utils/multi-value-map.js +4 -4
- package/dist/utils/noop-modifier.js +1 -1
- package/dist/utils/position-provider.js +2 -1
- package/dist/utils/quotes.js +49 -43
- package/dist/utils/regexp.js +25 -18
- package/dist/utils/string.js +136 -104
- package/dist/utils/type-guards.js +2 -1
- package/dist/validator/constants.js +1 -1
- package/dist/validator/helpers.js +1 -1
- package/dist/validator/index.js +8 -8
- package/dist/validator/value.js +6 -6
- package/dist/version.js +2 -2
- package/package.json +3 -1
- package/dist/errors/binary-schema-mismatch-error.js +0 -37
- package/dist/types/errors/binary-schema-mismatch-error.d.ts +0 -23
|
@@ -7,29 +7,33 @@ import { type ConversionResult } from '../base-interfaces/conversion-result.js';
|
|
|
7
7
|
/**
|
|
8
8
|
* Helper class for converting network rule modifier lists.
|
|
9
9
|
*
|
|
10
|
-
* @todo Implement `convertToUbo` and `convertToAbp
|
|
10
|
+
* @todo Implement `convertToUbo` and `convertToAbp`.
|
|
11
11
|
*/
|
|
12
12
|
export declare class NetworkRuleModifierListConverter extends BaseConverter {
|
|
13
13
|
/**
|
|
14
14
|
* Converts a network rule modifier list to AdGuard format, if possible.
|
|
15
15
|
*
|
|
16
|
-
* @param modifierList Network rule modifier list node to convert
|
|
17
|
-
* @param isException If `true`, the rule is an exception rule
|
|
16
|
+
* @param modifierList Network rule modifier list node to convert.
|
|
17
|
+
* @param isException If `true`, the rule is an exception rule.
|
|
18
|
+
*
|
|
18
19
|
* @returns An object which follows the {@link ConversionResult} interface. Its `result` property contains
|
|
19
20
|
* the converted node, and its `isConverted` flag indicates whether the original node was converted.
|
|
20
|
-
* If the node was not converted, the result will contain the original node with the same object reference
|
|
21
|
-
*
|
|
21
|
+
* If the node was not converted, the result will contain the original node with the same object reference.
|
|
22
|
+
*
|
|
23
|
+
* @throws If the conversion is not possible.
|
|
22
24
|
*/
|
|
23
25
|
static convertToAdg(modifierList: ModifierList, isException?: boolean): ConversionResult<ModifierList>;
|
|
24
26
|
/**
|
|
25
27
|
* Converts a network rule modifier list to uBlock format, if possible.
|
|
26
28
|
*
|
|
27
|
-
* @param modifierList Network rule modifier list node to convert
|
|
28
|
-
* @param isException If `true`, the rule is an exception rule
|
|
29
|
+
* @param modifierList Network rule modifier list node to convert.
|
|
30
|
+
* @param isException If `true`, the rule is an exception rule.
|
|
31
|
+
*
|
|
29
32
|
* @returns An object which follows the {@link ConversionResult} interface. Its `result` property contains
|
|
30
33
|
* the converted node, and its `isConverted` flag indicates whether the original node was converted.
|
|
31
|
-
* If the node was not converted, the result will contain the original node with the same object reference
|
|
32
|
-
*
|
|
34
|
+
* If the node was not converted, the result will contain the original node with the same object reference.
|
|
35
|
+
*
|
|
36
|
+
* @throws If the conversion is not possible.
|
|
33
37
|
*/
|
|
34
38
|
static convertToUbo(modifierList: ModifierList, isException?: boolean): ConversionResult<ModifierList>;
|
|
35
39
|
}
|
|
@@ -1,33 +1,37 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @file Network rule converter
|
|
2
|
+
* @file Network rule converter.
|
|
3
3
|
*/
|
|
4
|
-
import { type
|
|
5
|
-
import { RuleConverterBase } from '../base-interfaces/rule-converter-base.js';
|
|
4
|
+
import { type AnyNetworkRule, type NetworkRule } from '../../nodes/index.js';
|
|
6
5
|
import { type NodeConversionResult } from '../base-interfaces/conversion-result.js';
|
|
6
|
+
import { RuleConverterBase } from '../base-interfaces/rule-converter-base.js';
|
|
7
7
|
/**
|
|
8
|
-
* Network rule converter class (also known as "basic rule converter")
|
|
8
|
+
* Network rule converter class (also known as "basic rule converter").
|
|
9
9
|
*
|
|
10
|
-
* @todo Implement `convertToUbo` and `convertToAbp
|
|
10
|
+
* @todo Implement `convertToUbo` and `convertToAbp`.
|
|
11
11
|
*/
|
|
12
12
|
export declare class NetworkRuleConverter extends RuleConverterBase {
|
|
13
13
|
/**
|
|
14
14
|
* Converts a network rule to AdGuard format, if possible.
|
|
15
15
|
*
|
|
16
|
-
* @param rule Rule node to convert
|
|
16
|
+
* @param rule Rule node to convert.
|
|
17
|
+
*
|
|
17
18
|
* @returns An object which follows the {@link NodeConversionResult} interface. Its `result` property contains
|
|
18
19
|
* the array of converted rule nodes, and its `isConverted` flag indicates whether the original rule was converted.
|
|
19
|
-
* If the rule was not converted, the result array will contain the original node with the same object reference
|
|
20
|
-
*
|
|
20
|
+
* If the rule was not converted, the result array will contain the original node with the same object reference.
|
|
21
|
+
*
|
|
22
|
+
* @throws If the rule is invalid or cannot be converted.
|
|
21
23
|
*/
|
|
22
24
|
static convertToAdg(rule: AnyNetworkRule): NodeConversionResult<NetworkRule>;
|
|
23
25
|
/**
|
|
24
26
|
* Converts a network rule to uBlock format, if possible.
|
|
25
27
|
*
|
|
26
|
-
* @param rule Rule node to convert
|
|
28
|
+
* @param rule Rule node to convert.
|
|
29
|
+
*
|
|
27
30
|
* @returns An object which follows the {@link NodeConversionResult} interface. Its `result` property contains
|
|
28
31
|
* the array of converted rule nodes, and its `isConverted` flag indicates whether the original rule was converted.
|
|
29
|
-
* If the rule was not converted, the result array will contain the original node with the same object reference
|
|
30
|
-
*
|
|
32
|
+
* If the rule was not converted, the result array will contain the original node with the same object reference.
|
|
33
|
+
*
|
|
34
|
+
* @throws If the rule is invalid or cannot be converted.
|
|
31
35
|
*/
|
|
32
36
|
static convertToUbo(rule: AnyNetworkRule): NodeConversionResult<NetworkRule>;
|
|
33
37
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @file Filter list converter for raw filter lists
|
|
2
|
+
* @file Filter list converter for raw filter lists.
|
|
3
3
|
*
|
|
4
4
|
* Technically, this is a wrapper around `FilterListConverter` that works with nodes instead of strings.
|
|
5
5
|
*/
|
|
6
|
-
import { type ConversionResult } from './base-interfaces/conversion-result.js';
|
|
7
6
|
import { BaseConverter } from './base-interfaces/base-converter.js';
|
|
7
|
+
import { type ConversionResult } from './base-interfaces/conversion-result.js';
|
|
8
8
|
/**
|
|
9
9
|
* Adblock filter list converter class.
|
|
10
10
|
*
|
|
@@ -12,20 +12,22 @@ import { BaseConverter } from './base-interfaces/base-converter.js';
|
|
|
12
12
|
* This class just provides an extra layer on top of the {@link FilterListConverter} and calls the parser/serializer
|
|
13
13
|
* before/after the conversion internally.
|
|
14
14
|
*
|
|
15
|
-
* @todo Implement `convertToUbo` and `convertToAbp
|
|
15
|
+
* @todo Implement `convertToUbo` and `convertToAbp`.
|
|
16
16
|
*/
|
|
17
17
|
export declare class RawFilterListConverter extends BaseConverter {
|
|
18
18
|
/**
|
|
19
19
|
* Converts an adblock filter list text to AdGuard format, if possible.
|
|
20
20
|
*
|
|
21
|
-
* @param rawFilterList Raw filter list text to convert
|
|
21
|
+
* @param rawFilterList Raw filter list text to convert.
|
|
22
22
|
* @param tolerant Indicates whether the converter should be tolerant to invalid rules. If enabled and a rule is
|
|
23
23
|
* invalid, it will be left as is. If disabled and a rule is invalid, the whole filter list will be failed.
|
|
24
24
|
* Defaults to `true`.
|
|
25
|
+
*
|
|
25
26
|
* @returns An object which follows the {@link ConversionResult} interface. Its `result` property contains
|
|
26
27
|
* the array of converted filter list text, and its `isConverted` flag indicates whether the original rule was
|
|
27
|
-
* converted. If the rule was not converted, the original filter list text will be returned
|
|
28
|
-
*
|
|
28
|
+
* converted. If the rule was not converted, the original filter list text will be returned.
|
|
29
|
+
*
|
|
30
|
+
* @throws If the filter list is invalid or cannot be converted (if the tolerant mode is disabled).
|
|
29
31
|
*/
|
|
30
32
|
static convertToAdg(rawFilterList: string, tolerant?: boolean): ConversionResult<string>;
|
|
31
33
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @file Rule converter for raw rules
|
|
2
|
+
* @file Rule converter for raw rules.
|
|
3
3
|
*
|
|
4
4
|
* Technically, this is a wrapper around `RuleConverter` that works with nodes instead of strings.
|
|
5
5
|
*/
|
|
6
|
-
import { type ConversionResult } from './base-interfaces/conversion-result.js';
|
|
7
6
|
import { BaseConverter } from './base-interfaces/base-converter.js';
|
|
7
|
+
import { type ConversionResult } from './base-interfaces/conversion-result.js';
|
|
8
8
|
/**
|
|
9
9
|
* Adblock filtering rule converter class.
|
|
10
10
|
*
|
|
@@ -12,17 +12,19 @@ import { BaseConverter } from './base-interfaces/base-converter.js';
|
|
|
12
12
|
* This class just provides an extra layer on top of the {@link RuleConverter} and calls the parser/serializer
|
|
13
13
|
* before/after the conversion internally.
|
|
14
14
|
*
|
|
15
|
-
* @todo Implement `convertToUbo` and `convertToAbp
|
|
15
|
+
* @todo Implement `convertToUbo` and `convertToAbp`.
|
|
16
16
|
*/
|
|
17
17
|
export declare class RawRuleConverter extends BaseConverter {
|
|
18
18
|
/**
|
|
19
19
|
* Converts an adblock filtering rule to AdGuard format, if possible.
|
|
20
20
|
*
|
|
21
|
-
* @param rawRule Raw rule text to convert
|
|
21
|
+
* @param rawRule Raw rule text to convert.
|
|
22
|
+
*
|
|
22
23
|
* @returns An object which follows the {@link ConversionResult} interface. Its `result` property contains
|
|
23
24
|
* the array of converted rule texts, and its `isConverted` flag indicates whether the original rule was converted.
|
|
24
|
-
* If the rule was not converted, the original rule text will be returned
|
|
25
|
-
*
|
|
25
|
+
* If the rule was not converted, the original rule text will be returned.
|
|
26
|
+
*
|
|
27
|
+
* @throws If the rule is invalid or cannot be converted.
|
|
26
28
|
*/
|
|
27
29
|
static convertToAdg(rawRule: string): ConversionResult<string, string[]>;
|
|
28
30
|
}
|
|
@@ -1,37 +1,41 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @file Adblock rule converter
|
|
2
|
+
* @file Adblock rule converter.
|
|
3
3
|
*
|
|
4
4
|
* This file is the entry point for all rule converters
|
|
5
5
|
* which automatically detects the rule type and calls
|
|
6
6
|
* the corresponding "sub-converter".
|
|
7
7
|
*/
|
|
8
8
|
import { type AnyRule } from '../nodes/index.js';
|
|
9
|
-
import { RuleConverterBase } from './base-interfaces/rule-converter-base.js';
|
|
10
9
|
import { type NodeConversionResult } from './base-interfaces/conversion-result.js';
|
|
10
|
+
import { RuleConverterBase } from './base-interfaces/rule-converter-base.js';
|
|
11
11
|
/**
|
|
12
|
-
* Adblock filtering rule converter class
|
|
12
|
+
* Adblock filtering rule converter class.
|
|
13
13
|
*
|
|
14
|
-
* @todo Implement `convertToUbo` and `convertToAbp
|
|
14
|
+
* @todo Implement `convertToUbo` and `convertToAbp`.
|
|
15
15
|
*/
|
|
16
16
|
export declare class RuleConverter extends RuleConverterBase {
|
|
17
17
|
/**
|
|
18
18
|
* Converts an adblock filtering rule to AdGuard format, if possible.
|
|
19
19
|
*
|
|
20
|
-
* @param rule Rule node to convert
|
|
20
|
+
* @param rule Rule node to convert.
|
|
21
|
+
*
|
|
21
22
|
* @returns An object which follows the {@link NodeConversionResult} interface. Its `result` property contains
|
|
22
23
|
* the array of converted rule nodes, and its `isConverted` flag indicates whether the original rule was converted.
|
|
23
|
-
* If the rule was not converted, the result array will contain the original node with the same object reference
|
|
24
|
-
*
|
|
24
|
+
* If the rule was not converted, the result array will contain the original node with the same object reference.
|
|
25
|
+
*
|
|
26
|
+
* @throws If the rule is invalid or cannot be converted.
|
|
25
27
|
*/
|
|
26
28
|
static convertToAdg(rule: AnyRule): NodeConversionResult<AnyRule>;
|
|
27
29
|
/**
|
|
28
30
|
* Converts an adblock filtering rule to uBlock Origin format, if possible.
|
|
29
31
|
*
|
|
30
|
-
* @param rule Rule node to convert
|
|
32
|
+
* @param rule Rule node to convert.
|
|
33
|
+
*
|
|
31
34
|
* @returns An object which follows the {@link NodeConversionResult} interface. Its `result` property contains
|
|
32
35
|
* the array of converted rule nodes, and its `isConverted` flag indicates whether the original rule was converted.
|
|
33
|
-
* If the rule was not converted, the result array will contain the original node with the same object reference
|
|
34
|
-
*
|
|
36
|
+
* If the rule was not converted, the result array will contain the original node with the same object reference.
|
|
37
|
+
*
|
|
38
|
+
* @throws If the rule is invalid or cannot be converted.
|
|
35
39
|
*/
|
|
36
40
|
static convertToUbo(rule: AnyRule): NodeConversionResult<AnyRule>;
|
|
37
41
|
}
|
|
@@ -8,7 +8,7 @@ export declare class NotImplementedError extends Error {
|
|
|
8
8
|
/**
|
|
9
9
|
* Constructs a new `NotImplementedError` instance.
|
|
10
10
|
*
|
|
11
|
-
* @param message Additional error message (optional)
|
|
11
|
+
* @param message Additional error message (optional).
|
|
12
12
|
*/
|
|
13
13
|
constructor(message?: string | undefined);
|
|
14
14
|
}
|
|
@@ -7,8 +7,9 @@ export declare class AgentCommentGenerator extends BaseGenerator {
|
|
|
7
7
|
/**
|
|
8
8
|
* Converts an adblock agent AST to a string.
|
|
9
9
|
*
|
|
10
|
-
* @param ast Agent rule AST
|
|
11
|
-
*
|
|
10
|
+
* @param ast Agent rule AST.
|
|
11
|
+
*
|
|
12
|
+
* @returns Raw string.
|
|
12
13
|
*/
|
|
13
14
|
static generate(ast: AgentCommentRule): string;
|
|
14
15
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BaseGenerator } from '../base-generator.js';
|
|
2
1
|
import type { Agent } from '../../nodes/index.js';
|
|
2
|
+
import { BaseGenerator } from '../base-generator.js';
|
|
3
3
|
/**
|
|
4
4
|
* Generator for adblock agent nodes.
|
|
5
5
|
* This class is responsible for converting adblock agent nodes into their string representation.
|
|
@@ -8,8 +8,9 @@ export declare class AgentGenerator extends BaseGenerator {
|
|
|
8
8
|
/**
|
|
9
9
|
* Converts an adblock agent node to a string.
|
|
10
10
|
*
|
|
11
|
-
* @param value Agent node
|
|
12
|
-
*
|
|
11
|
+
* @param value Agent node.
|
|
12
|
+
*
|
|
13
|
+
* @returns Raw string.
|
|
13
14
|
*/
|
|
14
15
|
static generate(value: Agent): string;
|
|
15
16
|
}
|
|
@@ -7,8 +7,9 @@ export declare class CommentRuleGenerator extends BaseGenerator {
|
|
|
7
7
|
/**
|
|
8
8
|
* Converts a comment rule node to a string.
|
|
9
9
|
*
|
|
10
|
-
* @param node Comment rule node
|
|
11
|
-
*
|
|
10
|
+
* @param node Comment rule node.
|
|
11
|
+
*
|
|
12
|
+
* @returns Raw string.
|
|
12
13
|
*/
|
|
13
14
|
static generate(node: AnyCommentRule): string;
|
|
14
15
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BaseGenerator } from '../base-generator.js';
|
|
2
1
|
import type { ConfigCommentRule } from '../../nodes/index.js';
|
|
2
|
+
import { BaseGenerator } from '../base-generator.js';
|
|
3
3
|
/**
|
|
4
4
|
* Converts inline configuration comment nodes to their string format.
|
|
5
5
|
*/
|
|
@@ -7,8 +7,9 @@ export declare class ConfigCommentGenerator extends BaseGenerator {
|
|
|
7
7
|
/**
|
|
8
8
|
* Converts an inline configuration comment node to a string.
|
|
9
9
|
*
|
|
10
|
-
* @param node Inline configuration comment node
|
|
11
|
-
*
|
|
10
|
+
* @param node Inline configuration comment node.
|
|
11
|
+
*
|
|
12
|
+
* @returns Raw string.
|
|
12
13
|
*/
|
|
13
14
|
static generate(node: ConfigCommentRule): string;
|
|
14
15
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BaseGenerator } from '../base-generator.js';
|
|
2
1
|
import type { HintCommentRule } from '../../nodes/index.js';
|
|
2
|
+
import { BaseGenerator } from '../base-generator.js';
|
|
3
3
|
/**
|
|
4
4
|
* Hint comment generator.
|
|
5
5
|
*/
|
|
@@ -7,8 +7,9 @@ export declare class HintCommentGenerator extends BaseGenerator {
|
|
|
7
7
|
/**
|
|
8
8
|
* Converts a hint rule node to a raw string.
|
|
9
9
|
*
|
|
10
|
-
* @param node Hint rule node
|
|
11
|
-
*
|
|
10
|
+
* @param node Hint rule node.
|
|
11
|
+
*
|
|
12
|
+
* @returns Raw string.
|
|
12
13
|
*/
|
|
13
14
|
static generate(node: HintCommentRule): string;
|
|
14
15
|
}
|
|
@@ -7,8 +7,9 @@ export declare class HintGenerator extends BaseGenerator {
|
|
|
7
7
|
/**
|
|
8
8
|
* Generates a string representation of a hint.
|
|
9
9
|
*
|
|
10
|
-
* @param hint Hint AST node
|
|
11
|
-
*
|
|
10
|
+
* @param hint Hint AST node.
|
|
11
|
+
*
|
|
12
|
+
* @returns String representation of the hint.
|
|
12
13
|
*/
|
|
13
14
|
static generate(hint: Hint): string;
|
|
14
15
|
}
|
|
@@ -7,8 +7,9 @@ export declare class PreProcessorCommentGenerator extends BaseGenerator {
|
|
|
7
7
|
/**
|
|
8
8
|
* Converts a pre-processor comment node to a string.
|
|
9
9
|
*
|
|
10
|
-
* @param node Pre-processor comment node
|
|
11
|
-
*
|
|
10
|
+
* @param node Pre-processor comment node.
|
|
11
|
+
*
|
|
12
|
+
* @returns Raw string.
|
|
12
13
|
*/
|
|
13
14
|
static generate(node: PreProcessorCommentRule): string;
|
|
14
15
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BaseGenerator } from '../base-generator.js';
|
|
2
1
|
import type { CommentRule } from '../../nodes/index.js';
|
|
2
|
+
import { BaseGenerator } from '../base-generator.js';
|
|
3
3
|
/**
|
|
4
4
|
* Simple comment generator.
|
|
5
5
|
*/
|
|
@@ -8,6 +8,7 @@ export declare class SimpleCommentGenerator extends BaseGenerator {
|
|
|
8
8
|
* Converts a comment rule node to a string.
|
|
9
9
|
*
|
|
10
10
|
* @param node Comment rule node.
|
|
11
|
+
*
|
|
11
12
|
* @returns Raw string.
|
|
12
13
|
*/
|
|
13
14
|
static generate(node: CommentRule): string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BaseGenerator } from '../base-generator.js';
|
|
2
1
|
import { type AnyCosmeticRule } from '../../nodes/index.js';
|
|
2
|
+
import { BaseGenerator } from '../base-generator.js';
|
|
3
3
|
/**
|
|
4
4
|
* Cosmetic rule body generator.
|
|
5
5
|
*/
|
|
@@ -7,14 +7,16 @@ export declare class CosmeticRuleBodyGenerator extends BaseGenerator {
|
|
|
7
7
|
/**
|
|
8
8
|
* Generates the rule body from the node.
|
|
9
9
|
*
|
|
10
|
-
* @param node Cosmetic rule node
|
|
11
|
-
*
|
|
10
|
+
* @param node Cosmetic rule node.
|
|
11
|
+
*
|
|
12
|
+
* @returns Raw rule body.
|
|
13
|
+
*
|
|
14
|
+
* @throws Error if the rule type is unknown.
|
|
15
|
+
*
|
|
12
16
|
* @example
|
|
13
17
|
* - '##.foo' → '.foo'
|
|
14
18
|
* - 'example.com,example.org##.foo' → '.foo'
|
|
15
19
|
* - 'example.com#%#//scriptlet('foo')' → '//scriptlet('foo')'
|
|
16
|
-
*
|
|
17
|
-
* @throws Error if the rule type is unknown
|
|
18
20
|
*/
|
|
19
21
|
static generate(node: AnyCosmeticRule): string;
|
|
20
22
|
}
|
|
@@ -21,8 +21,9 @@ export declare class CosmeticRuleGenerator extends BaseGenerator {
|
|
|
21
21
|
/**
|
|
22
22
|
* Converts a cosmetic rule AST into a string.
|
|
23
23
|
*
|
|
24
|
-
* @param node Cosmetic rule AST
|
|
25
|
-
*
|
|
24
|
+
* @param node Cosmetic rule AST.
|
|
25
|
+
*
|
|
26
|
+
* @returns Raw string.
|
|
26
27
|
*/
|
|
27
28
|
static generate(node: AnyCosmeticRule): string;
|
|
28
29
|
}
|
|
@@ -7,8 +7,10 @@ export declare class CosmeticRulePatternGenerator extends BaseGenerator {
|
|
|
7
7
|
/**
|
|
8
8
|
* Generates the rule pattern from the AST.
|
|
9
9
|
*
|
|
10
|
-
* @param node Cosmetic rule node
|
|
11
|
-
*
|
|
10
|
+
* @param node Cosmetic rule node.
|
|
11
|
+
*
|
|
12
|
+
* @returns Raw rule pattern.
|
|
13
|
+
*
|
|
12
14
|
* @example
|
|
13
15
|
* - '##.foo' → ''
|
|
14
16
|
* - 'example.com,example.org##.foo' → 'example.com,example.org'
|
package/dist/types/generator/cosmetic/html-filtering-body/adg-html-filtering-body-generator.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type HtmlFilteringRuleBody, type Value } from '../../../nodes/index.js';
|
|
2
2
|
import { BaseGenerator } from '../../base-generator.js';
|
|
3
3
|
/**
|
|
4
4
|
* AdGuard HTML Filtering body generator.
|
package/dist/types/generator/cosmetic/html-filtering-body/ubo-html-filtering-body-generator.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type HtmlFilteringRuleBody, type Value } from '../../../nodes/index.js';
|
|
2
2
|
import { BaseGenerator } from '../../base-generator.js';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* UBlock HTML Filtering body generator.
|
|
5
5
|
*/
|
|
6
6
|
export declare class UboHtmlFilteringBodyGenerator extends BaseGenerator {
|
|
7
7
|
/**
|
package/dist/types/generator/cosmetic/scriptlet-body/abp-snippet-injection-body-generator.d.ts
CHANGED
|
@@ -7,9 +7,11 @@ export declare class AbpSnippetInjectionBodyGenerator extends BaseGenerator {
|
|
|
7
7
|
/**
|
|
8
8
|
* Generates a string representation of the Adblock Plus-style snippet call body.
|
|
9
9
|
*
|
|
10
|
-
* @param node Scriptlet injection rule body
|
|
11
|
-
*
|
|
12
|
-
* @
|
|
10
|
+
* @param node Scriptlet injection rule body.
|
|
11
|
+
*
|
|
12
|
+
* @returns String representation of the rule body.
|
|
13
|
+
*
|
|
14
|
+
* @throws Error if the scriptlet call is empty.
|
|
13
15
|
*/
|
|
14
16
|
static generate(node: ScriptletInjectionRuleBody): string;
|
|
15
17
|
}
|
package/dist/types/generator/cosmetic/scriptlet-body/adg-scriptlet-injection-body-generator.d.ts
CHANGED
|
@@ -13,9 +13,11 @@ export declare class AdgScriptletInjectionBodyGenerator extends BaseGenerator {
|
|
|
13
13
|
/**
|
|
14
14
|
* Generates a string representation of the AdGuard scriptlet call body.
|
|
15
15
|
*
|
|
16
|
-
* @param node Scriptlet injection rule body
|
|
17
|
-
*
|
|
18
|
-
* @
|
|
16
|
+
* @param node Scriptlet injection rule body.
|
|
17
|
+
*
|
|
18
|
+
* @returns String representation of the rule body.
|
|
19
|
+
*
|
|
20
|
+
* @throws Error if the scriptlet call has multiple parameters.
|
|
19
21
|
*/
|
|
20
22
|
static generate(node: ScriptletInjectionRuleBody): string;
|
|
21
23
|
}
|
package/dist/types/generator/cosmetic/scriptlet-body/ubo-scriptlet-injection-body-generator.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { BaseGenerator } from '../../base-generator.js';
|
|
2
1
|
import type { ScriptletInjectionRuleBody } from '../../../nodes/index.js';
|
|
2
|
+
import { BaseGenerator } from '../../base-generator.js';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* UBlock scriptlet injection body generator.
|
|
5
5
|
*/
|
|
6
6
|
export declare class UboScriptletInjectionBodyGenerator extends BaseGenerator {
|
|
7
7
|
/**
|
|
@@ -13,9 +13,11 @@ export declare class UboScriptletInjectionBodyGenerator extends BaseGenerator {
|
|
|
13
13
|
/**
|
|
14
14
|
* Generates a string representation of the uBlock scriptlet call body.
|
|
15
15
|
*
|
|
16
|
-
* @param node Scriptlet injection rule body
|
|
17
|
-
*
|
|
18
|
-
* @
|
|
16
|
+
* @param node Scriptlet injection rule body.
|
|
17
|
+
*
|
|
18
|
+
* @returns String representation of the rule body.
|
|
19
|
+
*
|
|
20
|
+
* @throws Error if the scriptlet call has multiple parameters.
|
|
19
21
|
*/
|
|
20
22
|
static generate(node: ScriptletInjectionRuleBody): string;
|
|
21
23
|
}
|
|
@@ -4,11 +4,15 @@ import { BaseGenerator } from '../base-generator.js';
|
|
|
4
4
|
* AdGuard CSS injection generator.
|
|
5
5
|
*/
|
|
6
6
|
export declare class AdgCssInjectionGenerator extends BaseGenerator {
|
|
7
|
+
/**
|
|
8
|
+
* CSS declaration for removing elements.
|
|
9
|
+
*/
|
|
7
10
|
private static REMOVE_DECLARATION;
|
|
8
11
|
/**
|
|
9
12
|
* Serializes an AdGuard CSS injection node into a raw string.
|
|
10
13
|
*
|
|
11
14
|
* @param node Node to serialize.
|
|
15
|
+
*
|
|
12
16
|
* @returns Raw string.
|
|
13
17
|
*/
|
|
14
18
|
static generate(node: CssInjectionRuleBody): string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BaseGenerator } from '../base-generator.js';
|
|
2
1
|
import { type UboSelector } from '../../nodes/index.js';
|
|
2
|
+
import { BaseGenerator } from '../base-generator.js';
|
|
3
3
|
/**
|
|
4
4
|
* UBO selector generator.
|
|
5
5
|
*/
|
|
@@ -7,8 +7,9 @@ export declare class UboSelectorGenerator extends BaseGenerator {
|
|
|
7
7
|
/**
|
|
8
8
|
* Serializes a uBO selector node to a string.
|
|
9
9
|
*
|
|
10
|
-
* @param node UBO selector node
|
|
11
|
-
*
|
|
10
|
+
* @param node UBO selector node.
|
|
11
|
+
*
|
|
12
|
+
* @returns Raw string.
|
|
12
13
|
*/
|
|
13
14
|
static generate(node: UboSelector): string;
|
|
14
15
|
}
|
|
@@ -7,12 +7,13 @@ export declare class FilterListGenerator extends BaseGenerator {
|
|
|
7
7
|
/**
|
|
8
8
|
* Serializes a whole adblock filter list (list of rules).
|
|
9
9
|
*
|
|
10
|
-
* @param ast AST to generate
|
|
10
|
+
* @param ast AST to generate.
|
|
11
11
|
* @param preferRaw If `true`, then the parser will use `raws.text` property of each rule
|
|
12
12
|
* if it is available. Default is `false`.
|
|
13
13
|
* @param tolerant If `true`, errors during rule generation will be logged to the console and invalid rules
|
|
14
14
|
* will be skipped. If `false`, an error will be thrown on the first invalid rule. Default is `true`.
|
|
15
|
-
*
|
|
15
|
+
*
|
|
16
|
+
* @returns Serialized filter list.
|
|
16
17
|
*/
|
|
17
18
|
static generate(ast: FilterList, preferRaw?: boolean, tolerant?: boolean): string;
|
|
18
19
|
}
|
|
@@ -6,18 +6,20 @@ export declare class ListItemsGenerator {
|
|
|
6
6
|
/**
|
|
7
7
|
* Generates a string representation of a list item.
|
|
8
8
|
*
|
|
9
|
-
* @param item List item to generate.
|
|
10
9
|
* @template T Type of the list item.
|
|
11
10
|
*
|
|
11
|
+
* @param item List item to generate.
|
|
12
|
+
*
|
|
12
13
|
* @returns String representation of the list item.
|
|
13
14
|
*/
|
|
14
15
|
private static generateListItem;
|
|
15
16
|
/**
|
|
16
17
|
* Generates a string representation of a list of items.
|
|
17
18
|
*
|
|
19
|
+
* @template T Type of the list items.
|
|
20
|
+
*
|
|
18
21
|
* @param items List of items to generate.
|
|
19
22
|
* @param separator Separator character.
|
|
20
|
-
* @template T Type of the list items.
|
|
21
23
|
*
|
|
22
24
|
* @returns String representation of the list of items.
|
|
23
25
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BaseGenerator } from '../base-generator.js';
|
|
2
1
|
import { type AnyExpressionNode } from '../../nodes/index.js';
|
|
2
|
+
import { BaseGenerator } from '../base-generator.js';
|
|
3
3
|
/**
|
|
4
4
|
* Generator for logical expression nodes.
|
|
5
5
|
*/
|
|
@@ -7,8 +7,9 @@ export declare class LogicalExpressionGenerator extends BaseGenerator {
|
|
|
7
7
|
/**
|
|
8
8
|
* Generates a string representation of the logical expression (serialization).
|
|
9
9
|
*
|
|
10
|
-
* @param node Expression node
|
|
11
|
-
*
|
|
10
|
+
* @param node Expression node.
|
|
11
|
+
*
|
|
12
|
+
* @returns String representation of the logical expression.
|
|
12
13
|
*/
|
|
13
14
|
static generate(node: AnyExpressionNode): string;
|
|
14
15
|
}
|
|
@@ -7,8 +7,9 @@ export declare class ModifierGenerator extends BaseGenerator {
|
|
|
7
7
|
/**
|
|
8
8
|
* Converts a modifier AST node to a string.
|
|
9
9
|
*
|
|
10
|
-
* @param modifier Modifier AST node to convert
|
|
11
|
-
*
|
|
10
|
+
* @param modifier Modifier AST node to convert.
|
|
11
|
+
*
|
|
12
|
+
* @returns String representation of the modifier.
|
|
12
13
|
*/
|
|
13
14
|
static generate(modifier: Modifier): string;
|
|
14
15
|
}
|