@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
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BaseGenerator } from '../base-generator.js';
|
|
2
1
|
import type { ModifierList } from '../../nodes/index.js';
|
|
2
|
+
import { BaseGenerator } from '../base-generator.js';
|
|
3
3
|
/**
|
|
4
4
|
* Generator for modifier list nodes.
|
|
5
5
|
*/
|
|
@@ -7,8 +7,9 @@ export declare class ModifierListGenerator extends BaseGenerator {
|
|
|
7
7
|
/**
|
|
8
8
|
* Converts a modifier list AST to a string.
|
|
9
9
|
*
|
|
10
|
-
* @param ast Modifier list AST
|
|
11
|
-
*
|
|
10
|
+
* @param ast Modifier list AST.
|
|
11
|
+
*
|
|
12
|
+
* @returns Raw string.
|
|
12
13
|
*/
|
|
13
14
|
static generate(ast: ModifierList): string;
|
|
14
15
|
}
|
|
@@ -7,10 +7,11 @@ export declare class ParameterListGenerator extends BaseGenerator {
|
|
|
7
7
|
/**
|
|
8
8
|
* Converts a parameter list AST to a string.
|
|
9
9
|
*
|
|
10
|
-
* @param params Parameter list AST
|
|
11
|
-
* @param separator Separator character (default: comma)
|
|
12
|
-
* @param allowSpace Allow space between parameters (default: true)
|
|
13
|
-
*
|
|
10
|
+
* @param params Parameter list AST.
|
|
11
|
+
* @param separator Separator character (default: comma).
|
|
12
|
+
* @param allowSpace Allow space between parameters (default: true).
|
|
13
|
+
*
|
|
14
|
+
* @returns String representation of the parameter list.
|
|
14
15
|
*/
|
|
15
16
|
static generate(params: ParameterList, separator?: string, allowSpace?: boolean): string;
|
|
16
17
|
}
|
|
@@ -8,6 +8,7 @@ export declare class NetworkRuleGenerator extends BaseGenerator {
|
|
|
8
8
|
* Generates a string from a network rule AST node.
|
|
9
9
|
*
|
|
10
10
|
* @param node Network rule node to generate a string from.
|
|
11
|
+
*
|
|
11
12
|
* @returns Generated string representation of the network rule.
|
|
12
13
|
*/
|
|
13
14
|
static generate(node: NetworkRule): string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BaseGenerator } from './base-generator.js';
|
|
2
1
|
import { type AnyRule } from '../nodes/index.js';
|
|
2
|
+
import { BaseGenerator } from './base-generator.js';
|
|
3
3
|
/**
|
|
4
4
|
* RuleGenerator is responsible for converting adblock rule ASTs to their string representation.
|
|
5
5
|
*/
|
|
@@ -7,8 +7,10 @@ export declare class RuleGenerator extends BaseGenerator {
|
|
|
7
7
|
/**
|
|
8
8
|
* Converts a rule AST to a string.
|
|
9
9
|
*
|
|
10
|
-
* @param ast
|
|
11
|
-
*
|
|
10
|
+
* @param ast Adblock rule AST.
|
|
11
|
+
*
|
|
12
|
+
* @returns Raw string.
|
|
13
|
+
*
|
|
12
14
|
* @example
|
|
13
15
|
* Take a look at the following example:
|
|
14
16
|
* ```js
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @file AGTree entry point
|
|
2
|
+
* @file AGTree entry point.
|
|
3
3
|
*/
|
|
4
4
|
export { RuleParser } from './parser/rule-parser.js';
|
|
5
5
|
export { RuleGenerator } from './generator/rule-generator.js';
|
|
@@ -28,7 +28,6 @@ export { ParameterListParser } from './parser/misc/parameter-list-parser.js';
|
|
|
28
28
|
export { HostRuleParser } from './parser/network/host-rule-parser.js';
|
|
29
29
|
export { PreProcessorCommentParser } from './parser/comment/preprocessor-parser.js';
|
|
30
30
|
export { RuleConversionError } from './errors/rule-conversion-error.js';
|
|
31
|
-
export { BinarySchemaMismatchError } from './errors/binary-schema-mismatch-error.js';
|
|
32
31
|
export { modifierValidator } from './validator/index.js';
|
|
33
32
|
export * from './converter/index.js';
|
|
34
33
|
export { ADG_SCRIPTLET_MASK, AGLINT_COMMAND_PREFIX, COMMA_DOMAIN_LIST_SEPARATOR, NEGATION_MARKER, HINT_MARKER, IF, INCLUDE, MODIFIERS_SEPARATOR, MODIFIER_ASSIGN_OPERATOR, PIPE_MODIFIER_SEPARATOR, NETWORK_RULE_EXCEPTION_MARKER, NETWORK_RULE_SEPARATOR, PREPROCESSOR_MARKER, SAFARI_CB_AFFINITY, UBO_SCRIPTLET_MASK, } from './utils/constants.js';
|
|
@@ -266,7 +266,7 @@ export interface Raw extends Node {
|
|
|
266
266
|
export interface ParameterList extends Node {
|
|
267
267
|
type: 'ParameterList';
|
|
268
268
|
/**
|
|
269
|
-
* List of values
|
|
269
|
+
* List of values.
|
|
270
270
|
*
|
|
271
271
|
* @note `null` values are allowed in the list, they represent empty parameters.
|
|
272
272
|
*/
|
|
@@ -301,7 +301,7 @@ export interface ExpressionParenthesisNode extends Node {
|
|
|
301
301
|
export interface FilterList extends Node {
|
|
302
302
|
type: 'FilterList';
|
|
303
303
|
/**
|
|
304
|
-
* List of rules
|
|
304
|
+
* List of rules.
|
|
305
305
|
*/
|
|
306
306
|
children: AnyRule[];
|
|
307
307
|
}
|
|
@@ -316,19 +316,19 @@ export interface RuleBase extends Node {
|
|
|
316
316
|
*/
|
|
317
317
|
syntax: AdblockSyntax;
|
|
318
318
|
/**
|
|
319
|
-
* Category of the adblock rule
|
|
319
|
+
* Category of the adblock rule.
|
|
320
320
|
*/
|
|
321
321
|
category: RuleCategory;
|
|
322
322
|
/**
|
|
323
|
-
* Raw data of the rule
|
|
323
|
+
* Raw data of the rule.
|
|
324
324
|
*/
|
|
325
325
|
raws?: {
|
|
326
326
|
/**
|
|
327
|
-
* Original rule text
|
|
327
|
+
* Original rule text.
|
|
328
328
|
*/
|
|
329
329
|
text?: string;
|
|
330
330
|
/**
|
|
331
|
-
* Newline character used in the rule (if any)
|
|
331
|
+
* Newline character used in the rule (if any).
|
|
332
332
|
*/
|
|
333
333
|
nl?: NewLine;
|
|
334
334
|
};
|
|
@@ -336,11 +336,11 @@ export interface RuleBase extends Node {
|
|
|
336
336
|
export interface InvalidRuleError extends Node {
|
|
337
337
|
type: 'InvalidRuleError';
|
|
338
338
|
/**
|
|
339
|
-
* Error name
|
|
339
|
+
* Error name.
|
|
340
340
|
*/
|
|
341
341
|
name: string;
|
|
342
342
|
/**
|
|
343
|
-
* Error message
|
|
343
|
+
* Error message.
|
|
344
344
|
*/
|
|
345
345
|
message: string;
|
|
346
346
|
}
|
|
@@ -350,28 +350,28 @@ export interface InvalidRuleError extends Node {
|
|
|
350
350
|
export interface InvalidRule extends RuleBase {
|
|
351
351
|
type: 'InvalidRule';
|
|
352
352
|
/**
|
|
353
|
-
* Category of the adblock rule
|
|
353
|
+
* Category of the adblock rule.
|
|
354
354
|
*/
|
|
355
355
|
category: typeof RuleCategory.Invalid;
|
|
356
356
|
/**
|
|
357
|
-
* Raw rule text
|
|
357
|
+
* Raw rule text.
|
|
358
358
|
*/
|
|
359
359
|
raw: string;
|
|
360
360
|
/**
|
|
361
|
-
* Error details
|
|
361
|
+
* Error details.
|
|
362
362
|
*/
|
|
363
363
|
error: InvalidRuleError;
|
|
364
364
|
}
|
|
365
365
|
/**
|
|
366
|
-
* Represents an "empty rule" (practically an empty line)
|
|
366
|
+
* Represents an "empty rule" (practically an empty line).
|
|
367
367
|
*/
|
|
368
368
|
export interface EmptyRule extends RuleBase {
|
|
369
369
|
/**
|
|
370
|
-
* Type of the adblock rule (should be always present)
|
|
370
|
+
* Type of the adblock rule (should be always present).
|
|
371
371
|
*/
|
|
372
372
|
type: 'EmptyRule';
|
|
373
373
|
/**
|
|
374
|
-
* Category of the adblock rule
|
|
374
|
+
* Category of the adblock rule.
|
|
375
375
|
*/
|
|
376
376
|
category: typeof RuleCategory.Empty;
|
|
377
377
|
}
|
|
@@ -516,11 +516,11 @@ export interface PreProcessorCommentRule extends CommentBase {
|
|
|
516
516
|
category: typeof RuleCategory.Comment;
|
|
517
517
|
type: typeof CommentRuleType.PreProcessorCommentRule;
|
|
518
518
|
/**
|
|
519
|
-
* Name of the directive
|
|
519
|
+
* Name of the directive.
|
|
520
520
|
*/
|
|
521
521
|
name: Value;
|
|
522
522
|
/**
|
|
523
|
-
* Params (optional)
|
|
523
|
+
* Params (optional).
|
|
524
524
|
*/
|
|
525
525
|
params?: Value | ParameterList | AnyExpressionNode;
|
|
526
526
|
}
|
|
@@ -640,15 +640,15 @@ export interface ModifierList extends Node {
|
|
|
640
640
|
*/
|
|
641
641
|
export interface Modifier extends Node {
|
|
642
642
|
/**
|
|
643
|
-
* Modifier name
|
|
643
|
+
* Modifier name.
|
|
644
644
|
*/
|
|
645
645
|
name: Value;
|
|
646
646
|
/**
|
|
647
|
-
* Is this modifier an exception? For example, `~third-party` is an exception
|
|
647
|
+
* Is this modifier an exception? For example, `~third-party` is an exception.
|
|
648
648
|
*/
|
|
649
649
|
exception?: boolean;
|
|
650
650
|
/**
|
|
651
|
-
* Modifier value (optional)
|
|
651
|
+
* Modifier value (optional).
|
|
652
652
|
*/
|
|
653
653
|
value?: Value;
|
|
654
654
|
}
|
|
@@ -721,7 +721,7 @@ export type AnyListItem = App | Domain | Method | StealthOption;
|
|
|
721
721
|
*/
|
|
722
722
|
export interface DomainList extends Node {
|
|
723
723
|
/**
|
|
724
|
-
* Type of the node. Basically, the idea is that each main AST part should have a type
|
|
724
|
+
* Type of the node. Basically, the idea is that each main AST part should have a type.
|
|
725
725
|
*/
|
|
726
726
|
type: typeof ListNodeType.DomainList;
|
|
727
727
|
/**
|
|
@@ -729,7 +729,7 @@ export interface DomainList extends Node {
|
|
|
729
729
|
*/
|
|
730
730
|
separator: DomainListSeparator;
|
|
731
731
|
/**
|
|
732
|
-
* List of domains
|
|
732
|
+
* List of domains.
|
|
733
733
|
*/
|
|
734
734
|
children: Domain[];
|
|
735
735
|
}
|
|
@@ -742,7 +742,7 @@ export interface DomainList extends Node {
|
|
|
742
742
|
*/
|
|
743
743
|
export interface AppList extends Node {
|
|
744
744
|
/**
|
|
745
|
-
* Type of the node. Basically, the idea is that each main AST part should have a type
|
|
745
|
+
* Type of the node. Basically, the idea is that each main AST part should have a type.
|
|
746
746
|
*/
|
|
747
747
|
type: typeof ListNodeType.AppList;
|
|
748
748
|
/**
|
|
@@ -750,7 +750,7 @@ export interface AppList extends Node {
|
|
|
750
750
|
*/
|
|
751
751
|
separator: PipeSeparator;
|
|
752
752
|
/**
|
|
753
|
-
* List of apps
|
|
753
|
+
* List of apps.
|
|
754
754
|
*/
|
|
755
755
|
children: App[];
|
|
756
756
|
}
|
|
@@ -763,7 +763,7 @@ export interface AppList extends Node {
|
|
|
763
763
|
*/
|
|
764
764
|
export interface MethodList extends Node {
|
|
765
765
|
/**
|
|
766
|
-
* Type of the node. Basically, the idea is that each main AST part should have a type
|
|
766
|
+
* Type of the node. Basically, the idea is that each main AST part should have a type.
|
|
767
767
|
*/
|
|
768
768
|
type: typeof ListNodeType.MethodList;
|
|
769
769
|
/**
|
|
@@ -771,7 +771,7 @@ export interface MethodList extends Node {
|
|
|
771
771
|
*/
|
|
772
772
|
separator: PipeSeparator;
|
|
773
773
|
/**
|
|
774
|
-
* List of methods
|
|
774
|
+
* List of methods.
|
|
775
775
|
*/
|
|
776
776
|
children: Method[];
|
|
777
777
|
}
|
|
@@ -784,7 +784,7 @@ export interface MethodList extends Node {
|
|
|
784
784
|
*/
|
|
785
785
|
export interface StealthOptionList extends Node {
|
|
786
786
|
/**
|
|
787
|
-
* Type of the node. Basically, the idea is that each main AST part should have a type
|
|
787
|
+
* Type of the node. Basically, the idea is that each main AST part should have a type.
|
|
788
788
|
*/
|
|
789
789
|
type: typeof ListNodeType.StealthOptionList;
|
|
790
790
|
/**
|
|
@@ -792,7 +792,7 @@ export interface StealthOptionList extends Node {
|
|
|
792
792
|
*/
|
|
793
793
|
separator: PipeSeparator;
|
|
794
794
|
/**
|
|
795
|
-
* List of stealth options
|
|
795
|
+
* List of stealth options.
|
|
796
796
|
*/
|
|
797
797
|
children: StealthOption[];
|
|
798
798
|
}
|
|
@@ -835,7 +835,7 @@ export interface CssInjectionRuleBody extends Node {
|
|
|
835
835
|
*/
|
|
836
836
|
declarationList?: Value;
|
|
837
837
|
/**
|
|
838
|
-
* Remove flag
|
|
838
|
+
* Remove flag.
|
|
839
839
|
*/
|
|
840
840
|
remove?: boolean;
|
|
841
841
|
}
|
|
@@ -1036,7 +1036,7 @@ export interface CosmeticRule extends RuleBase {
|
|
|
1036
1036
|
category: typeof RuleCategory.Cosmetic;
|
|
1037
1037
|
type: CosmeticRuleType;
|
|
1038
1038
|
/**
|
|
1039
|
-
* List of modifiers (optional)
|
|
1039
|
+
* List of modifiers (optional).
|
|
1040
1040
|
*/
|
|
1041
1041
|
modifiers?: ModifierList;
|
|
1042
1042
|
/**
|
|
@@ -1070,16 +1070,16 @@ export interface CosmeticRule extends RuleBase {
|
|
|
1070
1070
|
* Example rules:
|
|
1071
1071
|
* - ```adblock
|
|
1072
1072
|
* example.com##.ads
|
|
1073
|
-
*
|
|
1073
|
+
* ```.
|
|
1074
1074
|
* - ```adblock
|
|
1075
1075
|
* example.com#@#.ads
|
|
1076
|
-
*
|
|
1076
|
+
* ```.
|
|
1077
1077
|
* - ```adblock
|
|
1078
1078
|
* example.com#?#.ads:has(> .something)
|
|
1079
|
-
*
|
|
1079
|
+
* ```.
|
|
1080
1080
|
* - ```adblock
|
|
1081
1081
|
* example.com#@?#.ads:has(> .something)
|
|
1082
|
-
*
|
|
1082
|
+
* ```.
|
|
1083
1083
|
*/
|
|
1084
1084
|
export interface ElementHidingRule extends CosmeticRule {
|
|
1085
1085
|
type: typeof CosmeticRuleType.ElementHidingRule;
|
|
@@ -1091,24 +1091,24 @@ export interface ElementHidingRule extends CosmeticRule {
|
|
|
1091
1091
|
* Example rules (AdGuard):
|
|
1092
1092
|
* - ```adblock
|
|
1093
1093
|
* example.com#$#body { padding-top: 0 !important; }
|
|
1094
|
-
*
|
|
1094
|
+
* ```.
|
|
1095
1095
|
* - ```adblock
|
|
1096
1096
|
* example.com#$#@media (min-width: 1024px) { body { padding-top: 0 !important; } }
|
|
1097
|
-
*
|
|
1097
|
+
* ```.
|
|
1098
1098
|
* - ```adblock
|
|
1099
1099
|
* example.com#$?#@media (min-width: 1024px) { .something:has(.ads) { padding-top: 0 !important; } }
|
|
1100
|
-
*
|
|
1100
|
+
* ```.
|
|
1101
1101
|
* - ```adblock
|
|
1102
1102
|
* example.com#$#.ads { remove: true; }
|
|
1103
|
-
*
|
|
1103
|
+
* ```.
|
|
1104
1104
|
*
|
|
1105
1105
|
* Example rules (uBlock Origin):
|
|
1106
1106
|
* - ```adblock
|
|
1107
1107
|
* example.com##body:style(padding-top: 0 !important;)
|
|
1108
|
-
*
|
|
1108
|
+
* ```.
|
|
1109
1109
|
* - ```adblock
|
|
1110
1110
|
* example.com##.ads:remove()
|
|
1111
|
-
*
|
|
1111
|
+
* ```.
|
|
1112
1112
|
*/
|
|
1113
1113
|
export interface CssInjectionRule extends CosmeticRule {
|
|
1114
1114
|
type: typeof CosmeticRuleType.CssInjectionRule;
|
|
@@ -1120,29 +1120,29 @@ export interface CssInjectionRule extends CosmeticRule {
|
|
|
1120
1120
|
* Example rules (AdGuard):
|
|
1121
1121
|
* - ```adblock
|
|
1122
1122
|
* example.com#%#//scriptlet('scriptlet-name', 'arg0', 'arg1')
|
|
1123
|
-
*
|
|
1123
|
+
* ```.
|
|
1124
1124
|
* - ```adblock
|
|
1125
1125
|
* example.com#@%#//scriptlet('scriptlet-name', 'arg0', 'arg1')
|
|
1126
|
-
*
|
|
1126
|
+
* ```.
|
|
1127
1127
|
*
|
|
1128
1128
|
* Example rules (uBlock Origin):
|
|
1129
1129
|
* - ```adblock
|
|
1130
1130
|
* example.com##+js(scriptlet-name, arg0, arg1)
|
|
1131
|
-
*
|
|
1131
|
+
* ```.
|
|
1132
1132
|
* - ```adblock
|
|
1133
1133
|
* example.com#@#+js(scriptlet-name, arg0, arg1)
|
|
1134
|
-
*
|
|
1134
|
+
* ```.
|
|
1135
1135
|
*
|
|
1136
1136
|
* Example rules (Adblock Plus):
|
|
1137
1137
|
* - ```adblock
|
|
1138
1138
|
* example.com#$#scriptlet-name arg0 arg1
|
|
1139
|
-
*
|
|
1139
|
+
* ```.
|
|
1140
1140
|
* - ```adblock
|
|
1141
1141
|
* example.com#@$#scriptlet-name arg0 arg1
|
|
1142
|
-
*
|
|
1142
|
+
* ```.
|
|
1143
1143
|
* - ```adblock
|
|
1144
1144
|
* example.com#$#scriptlet0 arg00 arg01; scriptlet1 arg10 arg11
|
|
1145
|
-
*
|
|
1145
|
+
* ```.
|
|
1146
1146
|
*/
|
|
1147
1147
|
export interface ScriptletInjectionRule extends CosmeticRule {
|
|
1148
1148
|
type: typeof CosmeticRuleType.ScriptletInjectionRule;
|
|
@@ -1154,18 +1154,18 @@ export interface ScriptletInjectionRule extends CosmeticRule {
|
|
|
1154
1154
|
* Example rules (AdGuard):
|
|
1155
1155
|
* - ```adblock
|
|
1156
1156
|
* example.com$$script[tag-content="detect"]
|
|
1157
|
-
*
|
|
1157
|
+
* ```.
|
|
1158
1158
|
* - ```adblock
|
|
1159
1159
|
* example.com$@$script[tag-content="detect"]
|
|
1160
|
-
*
|
|
1160
|
+
* ```.
|
|
1161
1161
|
*
|
|
1162
1162
|
* Example rules (uBlock Origin):
|
|
1163
1163
|
* - ```adblock
|
|
1164
1164
|
* example.com##^script:has-text(detect)
|
|
1165
|
-
*
|
|
1165
|
+
* ```.
|
|
1166
1166
|
* - ```adblock
|
|
1167
1167
|
* example.com#@#^script:has-text(detect)
|
|
1168
|
-
*
|
|
1168
|
+
* ```.
|
|
1169
1169
|
*/
|
|
1170
1170
|
export interface HtmlFilteringRule extends CosmeticRule {
|
|
1171
1171
|
type: typeof CosmeticRuleType.HtmlFilteringRule;
|
|
@@ -1177,10 +1177,10 @@ export interface HtmlFilteringRule extends CosmeticRule {
|
|
|
1177
1177
|
* Example rules (AdGuard):
|
|
1178
1178
|
* - ```adblock
|
|
1179
1179
|
* example.com#%#let a = 2;
|
|
1180
|
-
*
|
|
1180
|
+
* ```.
|
|
1181
1181
|
* - ```adblock
|
|
1182
1182
|
* example.com#@%#let a = 2;
|
|
1183
|
-
*
|
|
1183
|
+
* ```.
|
|
1184
1184
|
*/
|
|
1185
1185
|
export interface JsInjectionRule extends CosmeticRule {
|
|
1186
1186
|
type: typeof CosmeticRuleType.JsInjectionRule;
|
|
@@ -1195,7 +1195,7 @@ export declare const NetworkRuleType: {
|
|
|
1195
1195
|
};
|
|
1196
1196
|
export type NetworkRuleType = typeof NetworkRuleType[keyof typeof NetworkRuleType];
|
|
1197
1197
|
/**
|
|
1198
|
-
* Represents the common properties of network rules
|
|
1198
|
+
* Represents the common properties of network rules.
|
|
1199
1199
|
*/
|
|
1200
1200
|
export interface NetworkRuleBase extends RuleBase {
|
|
1201
1201
|
/**
|
|
@@ -1213,7 +1213,7 @@ export interface NetworkRuleBase extends RuleBase {
|
|
|
1213
1213
|
syntax: AdblockSyntax;
|
|
1214
1214
|
}
|
|
1215
1215
|
/**
|
|
1216
|
-
* Represents the common properties of network rules
|
|
1216
|
+
* Represents the common properties of network rules.
|
|
1217
1217
|
*/
|
|
1218
1218
|
export interface NetworkRule extends NetworkRuleBase {
|
|
1219
1219
|
/**
|
|
@@ -1296,6 +1296,7 @@ export interface HostRule extends NetworkRuleBase {
|
|
|
1296
1296
|
* 127.0.0.1 example.com example.org
|
|
1297
1297
|
* ↑↑↑↑↑↑↑↑↑
|
|
1298
1298
|
* ```
|
|
1299
|
+
*
|
|
1299
1300
|
* @note If IP is not specified in the rule, it parsed as null IP: `0.0.0.0`.
|
|
1300
1301
|
*/
|
|
1301
1302
|
ip: Value;
|
|
@@ -26,8 +26,9 @@ export declare class AgentCommentParser extends BaseParser {
|
|
|
26
26
|
/**
|
|
27
27
|
* Checks if the raw rule is an adblock agent comment.
|
|
28
28
|
*
|
|
29
|
-
* @param raw Raw rule
|
|
30
|
-
*
|
|
29
|
+
* @param raw Raw rule.
|
|
30
|
+
*
|
|
31
|
+
* @returns `true` if the rule is an adblock agent, `false` otherwise.
|
|
31
32
|
*/
|
|
32
33
|
static isAgentRule(raw: string): boolean;
|
|
33
34
|
/**
|
|
@@ -36,7 +37,8 @@ export declare class AgentCommentParser extends BaseParser {
|
|
|
36
37
|
* @param raw Raw input to parse.
|
|
37
38
|
* @param options Global parser options.
|
|
38
39
|
* @param baseOffset Starting offset of the input. Node locations are calculated relative to this offset.
|
|
39
|
-
*
|
|
40
|
+
*
|
|
41
|
+
* @returns Agent rule AST or null (if the raw rule cannot be parsed as an adblock agent comment).
|
|
40
42
|
*/
|
|
41
43
|
static parse(raw: string, options?: import("../index.js").ParserOptions, baseOffset?: number): AgentCommentRule | null;
|
|
42
44
|
}
|
|
@@ -23,8 +23,9 @@ export declare class AgentParser extends BaseParser {
|
|
|
23
23
|
* The string can have a version in formats like
|
|
24
24
|
* [Adblock Plus 2.0], or [Adblock Plus 3.1; AdGuard].
|
|
25
25
|
*
|
|
26
|
-
* @param str String to check
|
|
27
|
-
*
|
|
26
|
+
* @param str String to check.
|
|
27
|
+
*
|
|
28
|
+
* @returns `true` if the string is a valid version, `false` otherwise.
|
|
28
29
|
*/
|
|
29
30
|
private static isValidVersion;
|
|
30
31
|
/**
|
|
@@ -33,8 +34,10 @@ export declare class AgentParser extends BaseParser {
|
|
|
33
34
|
* @param raw Raw input to parse.
|
|
34
35
|
* @param options Global parser options.
|
|
35
36
|
* @param baseOffset Starting offset of the input. Node locations are calculated relative to this offset.
|
|
36
|
-
*
|
|
37
|
-
* @
|
|
37
|
+
*
|
|
38
|
+
* @returns Agent rule AST.
|
|
39
|
+
*
|
|
40
|
+
* @throws {AdblockSyntaxError} If the raw rule cannot be parsed as an adblock agent.
|
|
38
41
|
*/
|
|
39
42
|
static parse(raw: string, options?: import("../index.js").ParserOptions, baseOffset?: number): Agent;
|
|
40
43
|
}
|
|
@@ -60,8 +60,9 @@ export declare class CommentParser extends BaseParser {
|
|
|
60
60
|
/**
|
|
61
61
|
* Checks whether a rule is a comment.
|
|
62
62
|
*
|
|
63
|
-
* @param raw Raw rule
|
|
64
|
-
*
|
|
63
|
+
* @param raw Raw rule.
|
|
64
|
+
*
|
|
65
|
+
* @returns `true` if the rule is a comment, `false` otherwise.
|
|
65
66
|
*/
|
|
66
67
|
static isCommentRule(raw: string): boolean;
|
|
67
68
|
/**
|
|
@@ -70,7 +71,8 @@ export declare class CommentParser extends BaseParser {
|
|
|
70
71
|
* @param raw Raw input to parse.
|
|
71
72
|
* @param options Global parser options.
|
|
72
73
|
* @param baseOffset Starting offset of the input. Node locations are calculated relative to this offset.
|
|
73
|
-
*
|
|
74
|
+
*
|
|
75
|
+
* @returns Comment AST or null (if the raw rule cannot be parsed as comment).
|
|
74
76
|
*/
|
|
75
77
|
static parse(raw: string, options?: import("../index.js").ParserOptions, baseOffset?: number): AnyCommentRule | null;
|
|
76
78
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file AGLint configuration comments. Inspired by ESLint inline configuration comments.
|
|
3
|
+
*
|
|
3
4
|
* @see {@link https://eslint.org/docs/latest/user-guide/configuring/rules#using-configuration-comments}
|
|
4
5
|
*/
|
|
5
6
|
import { type ConfigCommentRule } from '../../nodes/index.js';
|
|
@@ -14,7 +15,8 @@ export declare class ConfigCommentParser extends BaseParser {
|
|
|
14
15
|
/**
|
|
15
16
|
* Checks if the raw rule is an inline configuration comment rule.
|
|
16
17
|
*
|
|
17
|
-
* @param raw Raw rule
|
|
18
|
+
* @param raw Raw rule.
|
|
19
|
+
*
|
|
18
20
|
* @returns `true` if the rule is an inline configuration comment rule, otherwise `false`.
|
|
19
21
|
*/
|
|
20
22
|
static isConfigComment(raw: string): boolean;
|
|
@@ -24,8 +26,9 @@ export declare class ConfigCommentParser extends BaseParser {
|
|
|
24
26
|
* @param raw Raw input to parse.
|
|
25
27
|
* @param options Global parser options.
|
|
26
28
|
* @param baseOffset Starting offset of the input. Node locations are calculated relative to this offset.
|
|
29
|
+
*
|
|
27
30
|
* @returns
|
|
28
|
-
* Inline configuration comment AST or null (if the raw rule cannot be parsed as configuration comment)
|
|
31
|
+
* Inline configuration comment AST or null (if the raw rule cannot be parsed as configuration comment).
|
|
29
32
|
*/
|
|
30
33
|
static parse(raw: string, options?: import("../index.js").ParserOptions, baseOffset?: number): ConfigCommentRule | null;
|
|
31
34
|
}
|
|
@@ -3,31 +3,36 @@ import { BaseParser } from '../base-parser.js';
|
|
|
3
3
|
/**
|
|
4
4
|
* `HintRuleParser` is responsible for parsing AdGuard hint rules.
|
|
5
5
|
*
|
|
6
|
+
* @see {@link https://kb.adguard.com/en/general/how-to-create-your-own-ad-filters#hints}
|
|
7
|
+
*
|
|
6
8
|
* @example
|
|
7
9
|
* The following hint rule
|
|
8
10
|
* ```adblock
|
|
9
11
|
* !+ NOT_OPTIMIZED PLATFORM(windows)
|
|
10
12
|
* ```
|
|
11
13
|
* contains two hints: `NOT_OPTIMIZED` and `PLATFORM`.
|
|
12
|
-
* @see {@link https://kb.adguard.com/en/general/how-to-create-your-own-ad-filters#hints}
|
|
13
14
|
*/
|
|
14
15
|
export declare class HintCommentParser extends BaseParser {
|
|
15
16
|
/**
|
|
16
17
|
* Checks if the raw rule is a hint rule.
|
|
17
18
|
*
|
|
18
|
-
* @param raw Raw rule
|
|
19
|
-
*
|
|
19
|
+
* @param raw Raw rule.
|
|
20
|
+
*
|
|
21
|
+
* @returns `true` if the rule is a hint rule, `false` otherwise.
|
|
20
22
|
*/
|
|
21
23
|
static isHintRule(raw: string): boolean;
|
|
22
24
|
/**
|
|
23
25
|
* Parses a raw rule as a hint comment.
|
|
24
26
|
*
|
|
27
|
+
* @see {@link https://kb.adguard.com/en/general/how-to-create-your-own-ad-filters#hints-1}
|
|
28
|
+
*
|
|
25
29
|
* @param raw Raw input to parse.
|
|
26
30
|
* @param options Global parser options.
|
|
27
31
|
* @param baseOffset Starting offset of the input. Node locations are calculated relative to this offset.
|
|
28
|
-
*
|
|
29
|
-
* @
|
|
30
|
-
*
|
|
32
|
+
*
|
|
33
|
+
* @returns Hint AST or null (if the raw rule cannot be parsed as a hint comment).
|
|
34
|
+
*
|
|
35
|
+
* @throws If the input matches the HINT pattern but syntactically invalid.
|
|
31
36
|
*/
|
|
32
37
|
static parse(raw: string, options?: import("../index.js").ParserOptions, baseOffset?: number): HintCommentRule | null;
|
|
33
38
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @file AdGuard Hints
|
|
2
|
+
* @file AdGuard Hints.
|
|
3
|
+
*
|
|
3
4
|
* @see {@link https://kb.adguard.com/en/general/how-to-create-your-own-ad-filters#hints}
|
|
4
5
|
*/
|
|
5
6
|
import { type Hint } from '../../nodes/index.js';
|
|
@@ -23,8 +24,10 @@ export declare class HintParser extends BaseParser {
|
|
|
23
24
|
* @param raw Raw input to parse.
|
|
24
25
|
* @param options Global parser options.
|
|
25
26
|
* @param baseOffset Starting offset of the input. Node locations are calculated relative to this offset.
|
|
26
|
-
*
|
|
27
|
-
* @
|
|
27
|
+
*
|
|
28
|
+
* @returns Hint rule AST or null.
|
|
29
|
+
*
|
|
30
|
+
* @throws If the syntax is invalid.
|
|
28
31
|
*/
|
|
29
32
|
static parse(raw: string, options?: import("../index.js").ParserOptions, baseOffset?: number): Hint;
|
|
30
33
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @file Metadata comments
|
|
2
|
+
* @file Metadata comments.
|
|
3
3
|
*/
|
|
4
4
|
import { type MetadataCommentRule } from '../../nodes/index.js';
|
|
5
5
|
import { BaseParser } from '../base-parser.js';
|
|
@@ -7,6 +7,8 @@ import { BaseParser } from '../base-parser.js';
|
|
|
7
7
|
* `MetadataParser` is responsible for parsing metadata comments.
|
|
8
8
|
* Metadata comments are special comments that specify some properties of the list.
|
|
9
9
|
*
|
|
10
|
+
* @see {@link https://help.eyeo.com/adblockplus/how-to-write-filters#special-comments}
|
|
11
|
+
*
|
|
10
12
|
* @example
|
|
11
13
|
* For example, in the case of
|
|
12
14
|
* ```adblock
|
|
@@ -14,7 +16,6 @@ import { BaseParser } from '../base-parser.js';
|
|
|
14
16
|
* ```
|
|
15
17
|
* the name of the header is `Title`, and the value is `My List`, which means that
|
|
16
18
|
* the list title is `My List`, and it can be used in the adblocker UI.
|
|
17
|
-
* @see {@link https://help.eyeo.com/adblockplus/how-to-write-filters#special-comments}
|
|
18
19
|
*/
|
|
19
20
|
export declare class MetadataCommentParser extends BaseParser {
|
|
20
21
|
/**
|
|
@@ -23,7 +24,8 @@ export declare class MetadataCommentParser extends BaseParser {
|
|
|
23
24
|
* @param raw Raw input to parse.
|
|
24
25
|
* @param options Global parser options.
|
|
25
26
|
* @param baseOffset Starting offset of the input. Node locations are calculated relative to this offset.
|
|
26
|
-
*
|
|
27
|
+
*
|
|
28
|
+
* @returns Metadata comment AST or null (if the raw rule cannot be parsed as a metadata comment).
|
|
27
29
|
*/
|
|
28
30
|
static parse(raw: string, options?: import("../index.js").ParserOptions, baseOffset?: number): MetadataCommentRule | null;
|
|
29
31
|
}
|