@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
|
@@ -11,71 +11,77 @@ export type NewLineSplit = [string, NewLineType | null][];
|
|
|
11
11
|
export declare class StringUtils {
|
|
12
12
|
/**
|
|
13
13
|
* Finds the first occurrence of a character that:
|
|
14
|
-
* - isn't preceded by an escape character
|
|
14
|
+
* - isn't preceded by an escape character.
|
|
15
|
+
*
|
|
16
|
+
* @param pattern Source pattern.
|
|
17
|
+
* @param searchedCharacter Searched character.
|
|
18
|
+
* @param start Start index.
|
|
19
|
+
* @param escapeCharacter Escape character, \ by default.
|
|
20
|
+
* @param end End index (excluded).
|
|
15
21
|
*
|
|
16
|
-
* @
|
|
17
|
-
* @param searchedCharacter - Searched character
|
|
18
|
-
* @param start - Start index
|
|
19
|
-
* @param escapeCharacter - Escape character, \ by default
|
|
20
|
-
* @param end - End index (excluded)
|
|
21
|
-
* @returns Index or -1 if the character not found
|
|
22
|
+
* @returns Index or -1 if the character not found.
|
|
22
23
|
*/
|
|
23
24
|
static findNextUnescapedCharacter(pattern: string, searchedCharacter: string, start?: number, escapeCharacter?: string, end?: number): number;
|
|
24
25
|
/**
|
|
25
26
|
* Finds the first occurrence in backward direction of a character that isn't preceded by an escape character.
|
|
26
27
|
*
|
|
27
|
-
* @param pattern
|
|
28
|
-
* @param searchedCharacter
|
|
29
|
-
* @param start
|
|
30
|
-
* @param escapeCharacter
|
|
31
|
-
* @param end
|
|
32
|
-
*
|
|
28
|
+
* @param pattern Source pattern.
|
|
29
|
+
* @param searchedCharacter Searched character.
|
|
30
|
+
* @param start Start index.
|
|
31
|
+
* @param escapeCharacter Escape character, \ by default.
|
|
32
|
+
* @param end End index (Included).
|
|
33
|
+
*
|
|
34
|
+
* @returns Index or -1 if the character not found.
|
|
33
35
|
*/
|
|
34
36
|
static findNextUnescapedCharacterBackwards(pattern: string, searchedCharacter: string, start?: number, escapeCharacter?: string, end?: number): number;
|
|
35
37
|
/**
|
|
36
38
|
* Finds the last occurrence of a character that:
|
|
37
|
-
* - isn't preceded by an escape character
|
|
39
|
+
* - isn't preceded by an escape character.
|
|
38
40
|
*
|
|
39
|
-
* @param pattern
|
|
40
|
-
* @param searchedCharacter
|
|
41
|
-
* @param escapeCharacter
|
|
42
|
-
*
|
|
41
|
+
* @param pattern Source pattern.
|
|
42
|
+
* @param searchedCharacter Searched character.
|
|
43
|
+
* @param escapeCharacter Escape character, \ by default.
|
|
44
|
+
*
|
|
45
|
+
* @returns Index or -1 if the character not found.
|
|
43
46
|
*/
|
|
44
47
|
static findLastUnescapedCharacter(pattern: string, searchedCharacter: string, escapeCharacter?: string): number;
|
|
45
48
|
/**
|
|
46
49
|
* Finds the next occurrence of a character that:
|
|
47
50
|
* - isn't preceded by an escape character
|
|
48
|
-
* - isn't followed by the specified character
|
|
49
|
-
*
|
|
50
|
-
* @param pattern
|
|
51
|
-
* @param start
|
|
52
|
-
* @param searchedCharacter
|
|
53
|
-
* @param notFollowedBy
|
|
54
|
-
* @param escapeCharacter
|
|
55
|
-
*
|
|
51
|
+
* - isn't followed by the specified character.
|
|
52
|
+
*
|
|
53
|
+
* @param pattern Source pattern.
|
|
54
|
+
* @param start Start index.
|
|
55
|
+
* @param searchedCharacter Searched character.
|
|
56
|
+
* @param notFollowedBy Searched character not followed by this character.
|
|
57
|
+
* @param escapeCharacter Escape character, \ by default.
|
|
58
|
+
*
|
|
59
|
+
* @returns Index or -1 if the character not found.
|
|
56
60
|
*/
|
|
57
61
|
static findNextUnescapedCharacterThatNotFollowedBy(pattern: string, start: number, searchedCharacter: string, notFollowedBy: string, escapeCharacter?: string): number;
|
|
58
62
|
/**
|
|
59
63
|
* Finds the last occurrence of a character that:
|
|
60
64
|
* - isn't preceded by an escape character
|
|
61
|
-
* - isn't followed by the specified character
|
|
65
|
+
* - isn't followed by the specified character.
|
|
66
|
+
*
|
|
67
|
+
* @param pattern Source pattern.
|
|
68
|
+
* @param searchedCharacter Searched character.
|
|
69
|
+
* @param notFollowedBy Searched character not followed by this character.
|
|
70
|
+
* @param escapeCharacter Escape character, \ by default.
|
|
62
71
|
*
|
|
63
|
-
* @
|
|
64
|
-
* @param searchedCharacter - Searched character
|
|
65
|
-
* @param notFollowedBy - Searched character not followed by this character
|
|
66
|
-
* @param escapeCharacter - Escape character, \ by default
|
|
67
|
-
* @returns Index or -1 if the character not found
|
|
72
|
+
* @returns Index or -1 if the character not found.
|
|
68
73
|
*/
|
|
69
74
|
static findLastUnescapedCharacterThatNotFollowedBy(pattern: string, searchedCharacter: string, notFollowedBy: string, escapeCharacter?: string): number;
|
|
70
75
|
/**
|
|
71
76
|
* Finds the next occurrence of a character that:
|
|
72
77
|
* - isn't part of any string literal ('literal' or "literal")
|
|
73
|
-
* - isn't part of any RegExp expression (/regexp/)
|
|
78
|
+
* - isn't part of any RegExp expression (/regexp/).
|
|
79
|
+
*
|
|
80
|
+
* @param pattern Source pattern.
|
|
81
|
+
* @param searchedCharacter Searched character.
|
|
82
|
+
* @param start Start index.
|
|
74
83
|
*
|
|
75
|
-
* @
|
|
76
|
-
* @param searchedCharacter - Searched character
|
|
77
|
-
* @param start - Start index
|
|
78
|
-
* @returns Index or -1 if the character not found
|
|
84
|
+
* @returns Index or -1 if the character not found.
|
|
79
85
|
*/
|
|
80
86
|
static findUnescapedNonStringNonRegexChar(pattern: string, searchedCharacter: string, start?: number): number;
|
|
81
87
|
/**
|
|
@@ -96,71 +102,79 @@ export declare class StringUtils {
|
|
|
96
102
|
/**
|
|
97
103
|
* Finds the next occurrence of a character that:
|
|
98
104
|
* - isn't part of any string literal ('literal' or "literal")
|
|
99
|
-
* - isn't preceded by an escape character
|
|
105
|
+
* - isn't preceded by an escape character.
|
|
106
|
+
*
|
|
107
|
+
* @param pattern Source pattern.
|
|
108
|
+
* @param searchedCharacter Searched character.
|
|
109
|
+
* @param start Start index.
|
|
110
|
+
* @param escapeCharacter Escape character, \ by default.
|
|
100
111
|
*
|
|
101
|
-
* @
|
|
102
|
-
* @param searchedCharacter - Searched character
|
|
103
|
-
* @param start - Start index
|
|
104
|
-
* @param escapeCharacter - Escape character, \ by default
|
|
105
|
-
* @returns Index or -1 if the character not found
|
|
112
|
+
* @returns Index or -1 if the character not found.
|
|
106
113
|
*/
|
|
107
114
|
static findNextUnquotedUnescapedCharacter(pattern: string, searchedCharacter: string, start?: number, escapeCharacter?: string): number;
|
|
108
115
|
/**
|
|
109
116
|
* Finds the next occurrence of a character that:
|
|
110
117
|
* - isn't "bracketed"
|
|
111
|
-
* - isn't preceded by an escape character
|
|
118
|
+
* - isn't preceded by an escape character.
|
|
119
|
+
*
|
|
120
|
+
* @param pattern Source pattern.
|
|
121
|
+
* @param searchedCharacter Searched character.
|
|
122
|
+
* @param start Start index.
|
|
123
|
+
* @param escapeCharacter Escape character, \ by default.
|
|
124
|
+
* @param openBracket Open bracket, ( by default.
|
|
125
|
+
* @param closeBracket Close bracket, ( by default.
|
|
112
126
|
*
|
|
113
|
-
* @
|
|
114
|
-
*
|
|
115
|
-
* @
|
|
116
|
-
* @param escapeCharacter - Escape character, \ by default
|
|
117
|
-
* @param openBracket - Open bracket, ( by default
|
|
118
|
-
* @param closeBracket - Close bracket, ( by default
|
|
119
|
-
* @throws If the opening and closing brackets are the same
|
|
120
|
-
* @returns Index or -1 if the character not found
|
|
127
|
+
* @returns Index or -1 if the character not found.
|
|
128
|
+
*
|
|
129
|
+
* @throws If the opening and closing brackets are the same.
|
|
121
130
|
*/
|
|
122
131
|
static findNextNotBracketedUnescapedCharacter(pattern: string, searchedCharacter: string, start?: number, escapeCharacter?: string, openBracket?: string, closeBracket?: string): number;
|
|
123
132
|
/**
|
|
124
133
|
* Splits the source pattern along characters that:
|
|
125
134
|
* - isn't part of any string literal ('literal' or "literal")
|
|
126
|
-
* - isn't preceded by an escape character
|
|
135
|
+
* - isn't preceded by an escape character.
|
|
127
136
|
*
|
|
128
|
-
* @param pattern
|
|
129
|
-
* @param delimeterCharacter
|
|
130
|
-
*
|
|
137
|
+
* @param pattern Source pattern.
|
|
138
|
+
* @param delimeterCharacter Delimeter character.
|
|
139
|
+
*
|
|
140
|
+
* @returns Splitted string.
|
|
131
141
|
*/
|
|
132
142
|
static splitStringByUnquotedUnescapedCharacter(pattern: string, delimeterCharacter: string): string[];
|
|
133
143
|
/**
|
|
134
144
|
* Splits the source pattern along characters that:
|
|
135
145
|
* - isn't part of any string literal ('literal' or "literal")
|
|
136
146
|
* - isn't part of any RegExp expression (/regexp/)
|
|
137
|
-
* - isn't preceded by an escape character
|
|
147
|
+
* - isn't preceded by an escape character.
|
|
148
|
+
*
|
|
149
|
+
* @param pattern Source pattern.
|
|
150
|
+
* @param delimeterCharacter Delimeter character.
|
|
138
151
|
*
|
|
139
|
-
* @
|
|
140
|
-
* @param delimeterCharacter - Delimeter character
|
|
141
|
-
* @returns Splitted string
|
|
152
|
+
* @returns Splitted string.
|
|
142
153
|
*/
|
|
143
154
|
static splitStringByUnescapedNonStringNonRegexChar(pattern: string, delimeterCharacter: string): string[];
|
|
144
155
|
/**
|
|
145
156
|
* Splits the source pattern along characters that:
|
|
146
|
-
* - isn't preceded by an escape character
|
|
157
|
+
* - isn't preceded by an escape character.
|
|
158
|
+
*
|
|
159
|
+
* @param pattern Source pattern.
|
|
160
|
+
* @param delimeterCharacter Delimeter character.
|
|
147
161
|
*
|
|
148
|
-
* @
|
|
149
|
-
* @param delimeterCharacter - Delimeter character
|
|
150
|
-
* @returns Splitted string
|
|
162
|
+
* @returns Splitted string.
|
|
151
163
|
*/
|
|
152
164
|
static splitStringByUnescapedCharacter(pattern: string, delimeterCharacter: string): string[];
|
|
153
165
|
/**
|
|
154
166
|
* Determines whether the given character is a space or tab character.
|
|
155
167
|
*
|
|
156
|
-
* @param char
|
|
157
|
-
*
|
|
168
|
+
* @param char The character to check.
|
|
169
|
+
*
|
|
170
|
+
* @returns True if the given character is a space or tab character, false otherwise.
|
|
158
171
|
*/
|
|
159
172
|
static isWhitespace(char: string): boolean;
|
|
160
173
|
/**
|
|
161
174
|
* Checks if the given character is a digit.
|
|
162
175
|
*
|
|
163
176
|
* @param char The character to check.
|
|
177
|
+
*
|
|
164
178
|
* @returns `true` if the given character is a digit, `false` otherwise.
|
|
165
179
|
*/
|
|
166
180
|
static isDigit(char: string): boolean;
|
|
@@ -168,6 +182,7 @@ export declare class StringUtils {
|
|
|
168
182
|
* Checks if the given character is a small letter.
|
|
169
183
|
*
|
|
170
184
|
* @param char The character to check.
|
|
185
|
+
*
|
|
171
186
|
* @returns `true` if the given character is a small letter, `false` otherwise.
|
|
172
187
|
*/
|
|
173
188
|
static isSmallLetter(char: string): boolean;
|
|
@@ -175,6 +190,7 @@ export declare class StringUtils {
|
|
|
175
190
|
* Checks if the given character is a capital letter.
|
|
176
191
|
*
|
|
177
192
|
* @param char The character to check.
|
|
193
|
+
*
|
|
178
194
|
* @returns `true` if the given character is a capital letter, `false` otherwise.
|
|
179
195
|
*/
|
|
180
196
|
static isCapitalLetter(char: string): boolean;
|
|
@@ -182,114 +198,130 @@ export declare class StringUtils {
|
|
|
182
198
|
* Checks if the given character is a letter (small or capital).
|
|
183
199
|
*
|
|
184
200
|
* @param char The character to check.
|
|
201
|
+
*
|
|
185
202
|
* @returns `true` if the given character is a letter, `false` otherwise.
|
|
186
203
|
*/
|
|
187
204
|
static isLetter(char: string): boolean;
|
|
188
205
|
/**
|
|
189
206
|
* Checks if the given character is a letter or a digit.
|
|
190
207
|
*
|
|
191
|
-
* @param char Character to check
|
|
208
|
+
* @param char Character to check.
|
|
209
|
+
*
|
|
192
210
|
* @returns `true` if the given character is a letter or a digit, `false` otherwise.
|
|
193
211
|
*/
|
|
194
212
|
static isAlphaNumeric(char: string): boolean;
|
|
195
213
|
/**
|
|
196
214
|
* Searches for the first non-whitespace character in the source pattern.
|
|
197
215
|
*
|
|
198
|
-
* @param pattern
|
|
199
|
-
* @param start
|
|
200
|
-
*
|
|
216
|
+
* @param pattern Source pattern.
|
|
217
|
+
* @param start Start index.
|
|
218
|
+
*
|
|
219
|
+
* @returns Index or -1 if the character not found.
|
|
201
220
|
*/
|
|
202
221
|
static findFirstNonWhitespaceCharacter(pattern: string, start?: number): number;
|
|
203
222
|
/**
|
|
204
223
|
* Searches for the last non-whitespace character in the source pattern.
|
|
205
224
|
*
|
|
206
|
-
* @param pattern
|
|
207
|
-
*
|
|
225
|
+
* @param pattern Source pattern.
|
|
226
|
+
*
|
|
227
|
+
* @returns Index or -1 if the character not found.
|
|
208
228
|
*/
|
|
209
229
|
static findLastNonWhitespaceCharacter(pattern: string): number;
|
|
210
230
|
/**
|
|
211
231
|
* Finds the next whitespace character in the pattern.
|
|
212
232
|
*
|
|
213
|
-
* @param pattern Pattern to search in
|
|
214
|
-
* @param start Start index
|
|
215
|
-
*
|
|
233
|
+
* @param pattern Pattern to search in.
|
|
234
|
+
* @param start Start index.
|
|
235
|
+
*
|
|
236
|
+
* @returns Index of the next whitespace character or the length of the pattern if not found.
|
|
216
237
|
*/
|
|
217
238
|
static findNextWhitespaceCharacter(pattern: string, start?: number): number;
|
|
218
239
|
/**
|
|
219
240
|
* Escapes a specified character in the string.
|
|
220
241
|
*
|
|
221
|
-
* @param pattern
|
|
222
|
-
* @param character
|
|
223
|
-
* @param escapeCharacter
|
|
224
|
-
*
|
|
242
|
+
* @param pattern Input string.
|
|
243
|
+
* @param character Character to escape.
|
|
244
|
+
* @param escapeCharacter Escape character (optional).
|
|
245
|
+
*
|
|
246
|
+
* @returns Escaped string.
|
|
225
247
|
*/
|
|
226
248
|
static escapeCharacter(pattern: string, character: string, escapeCharacter?: string): string;
|
|
227
249
|
/**
|
|
228
250
|
* Searches for the next non-whitespace character in the source pattern.
|
|
229
251
|
*
|
|
230
|
-
* @param pattern Pattern to search
|
|
231
|
-
* @param start Start index
|
|
232
|
-
*
|
|
252
|
+
* @param pattern Pattern to search.
|
|
253
|
+
* @param start Start index.
|
|
254
|
+
*
|
|
255
|
+
* @returns Index of the next non-whitespace character or the length of the pattern.
|
|
233
256
|
*/
|
|
234
257
|
static skipWS(pattern: string, start?: number): number;
|
|
235
258
|
/**
|
|
236
259
|
* Searches for the previous non-whitespace character in the source pattern.
|
|
237
260
|
*
|
|
238
|
-
* @param pattern Pattern to search
|
|
239
|
-
* @param start Start index
|
|
240
|
-
*
|
|
261
|
+
* @param pattern Pattern to search.
|
|
262
|
+
* @param start Start index.
|
|
263
|
+
*
|
|
264
|
+
* @returns Index of the previous non-whitespace character or -1.
|
|
241
265
|
*/
|
|
242
266
|
static skipWSBack(pattern: string, start?: number): number;
|
|
243
267
|
/**
|
|
244
268
|
* Checks if the given character is a new line character.
|
|
245
269
|
*
|
|
246
|
-
* @param char Character to check
|
|
270
|
+
* @param char Character to check.
|
|
271
|
+
*
|
|
247
272
|
* @returns `true` if the given character is a new line character, `false` otherwise.
|
|
248
273
|
*/
|
|
249
274
|
static isEOL(char: string): boolean;
|
|
250
275
|
/**
|
|
251
276
|
* Splits a string along newline characters.
|
|
252
277
|
*
|
|
253
|
-
* @param input
|
|
254
|
-
*
|
|
278
|
+
* @param input Input string.
|
|
279
|
+
*
|
|
280
|
+
* @returns Splitted string.
|
|
255
281
|
*/
|
|
256
282
|
static splitStringByNewLines(input: string): string[];
|
|
257
283
|
/**
|
|
258
|
-
* Splits a string by new lines and stores the new line type for each line
|
|
284
|
+
* Splits a string by new lines and stores the new line type for each line.
|
|
285
|
+
*
|
|
286
|
+
* @param input The input string to be split.
|
|
259
287
|
*
|
|
260
|
-
* @param input The input string to be split
|
|
261
288
|
* @returns An array of tuples, where each tuple contains a line of the input string and its
|
|
262
|
-
* corresponding new line type ("lf", "crlf", or "cr")
|
|
289
|
+
* corresponding new line type ("lf", "crlf", or "cr").
|
|
263
290
|
*/
|
|
264
291
|
static splitStringByNewLinesEx(input: string): NewLineSplit;
|
|
265
292
|
/**
|
|
266
|
-
* Merges an array of tuples (line, newLineType) into a single string
|
|
293
|
+
* Merges an array of tuples (line, newLineType) into a single string.
|
|
267
294
|
*
|
|
268
|
-
* @param input The array of tuples to be merged
|
|
269
|
-
*
|
|
295
|
+
* @param input The array of tuples to be merged.
|
|
296
|
+
*
|
|
297
|
+
* @returns A single string containing the lines and new line characters from the input array.
|
|
270
298
|
*/
|
|
271
299
|
static mergeStringByNewLines(input: NewLineSplit): string;
|
|
272
300
|
/**
|
|
273
|
-
* Helper method to parse a raw string as a number
|
|
301
|
+
* Helper method to parse a raw string as a number.
|
|
302
|
+
*
|
|
303
|
+
* @param raw Raw string to parse.
|
|
274
304
|
*
|
|
275
|
-
* @
|
|
276
|
-
*
|
|
277
|
-
* @throws If the raw string can't be parsed as a number
|
|
305
|
+
* @returns Parsed number.
|
|
306
|
+
*
|
|
307
|
+
* @throws If the raw string can't be parsed as a number.
|
|
278
308
|
*/
|
|
279
309
|
static parseNumber(raw: string): number;
|
|
280
310
|
/**
|
|
281
311
|
* Checks if the given value is a string.
|
|
282
312
|
*
|
|
283
|
-
* @param value Value to check
|
|
284
|
-
*
|
|
313
|
+
* @param value Value to check.
|
|
314
|
+
*
|
|
315
|
+
* @returns `true` if the value is a string, `false` otherwise.
|
|
285
316
|
*/
|
|
286
317
|
static isString(value: unknown): value is string;
|
|
287
318
|
/**
|
|
288
319
|
* Escapes the given characters in the input string.
|
|
289
320
|
*
|
|
290
|
-
* @param input Input string
|
|
291
|
-
* @param characters Characters to escape (by default, no characters are escaped)
|
|
292
|
-
*
|
|
321
|
+
* @param input Input string.
|
|
322
|
+
* @param characters Characters to escape (by default, no characters are escaped).
|
|
323
|
+
*
|
|
324
|
+
* @returns Escaped string.
|
|
293
325
|
*/
|
|
294
326
|
static escapeCharacters(input: string, characters?: Set<string>): string;
|
|
295
327
|
}
|
|
@@ -34,6 +34,7 @@ export declare const isInteger: (value: unknown) => value is number;
|
|
|
34
34
|
* Checks whether the given value is a string.
|
|
35
35
|
*
|
|
36
36
|
* @param value Value to check.
|
|
37
|
+
*
|
|
37
38
|
* @returns `true` if the value is a string, `false` otherwise.
|
|
38
39
|
*/
|
|
39
40
|
export declare const isString: (value: unknown) => value is string;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* - `{ valid: true }` for valid and _fully supported_ modifier;
|
|
4
4
|
* - `{ valid: true, warn: <deprecation notice> }` for valid
|
|
5
5
|
* and _still supported but deprecated_ modifier;
|
|
6
|
-
* - otherwise `{ valid: true, error: <invalidity reason> }
|
|
6
|
+
* - otherwise `{ valid: true, error: <invalidity reason> }`.
|
|
7
7
|
*/
|
|
8
8
|
export type ValidationResult = {
|
|
9
9
|
valid: boolean;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file Validator for modifiers.
|
|
3
3
|
*/
|
|
4
|
+
import { type AnyPlatform } from '../compatibility-tables/index.js';
|
|
4
5
|
import { type Modifier } from '../nodes/index.js';
|
|
5
6
|
import { type ValidationResult } from './helpers.js';
|
|
6
|
-
import { type AnyPlatform } from '../compatibility-tables/index.js';
|
|
7
7
|
/**
|
|
8
8
|
* Modifier validator class.
|
|
9
9
|
*/
|
|
@@ -28,10 +28,10 @@ declare class ModifierValidator {
|
|
|
28
28
|
* @param isException Whether the modifier is used in exception rule, default to false.
|
|
29
29
|
* Needed to check whether the modifier is allowed only in blocking or exception rules.
|
|
30
30
|
*
|
|
31
|
+
* @returns Result of modifier validation.
|
|
32
|
+
*
|
|
31
33
|
* @note For single product: specific platforms use exact lookup, generic platforms use first match.
|
|
32
34
|
* If multiple products are specified (e.g., AdgAny | UboAny), validation is skipped and returns valid.
|
|
33
|
-
*
|
|
34
|
-
* @returns Result of modifier validation.
|
|
35
35
|
*/
|
|
36
36
|
validate: (platforms: AnyPlatform, modifier: Modifier, isException?: boolean) => ValidationResult;
|
|
37
37
|
}
|
package/dist/types/version.d.ts
CHANGED
package/dist/utils/adblockers.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v4.0.
|
|
2
|
+
* AGTree v4.0.2 (build date: Tue, 17 Mar 2026 23:34:38 GMT)
|
|
3
3
|
* (c) 2026 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
|
@@ -18,7 +18,7 @@ const AdblockProduct = {
|
|
|
18
18
|
*/
|
|
19
19
|
Abp: 'AdblockPlus',
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* UBlock Origin..
|
|
22
22
|
*
|
|
23
23
|
* @see {@link https://github.com/gorhill/uBlock}
|
|
24
24
|
*/
|
|
@@ -31,7 +31,7 @@ const AdblockProduct = {
|
|
|
31
31
|
Adg: 'AdGuard',
|
|
32
32
|
};
|
|
33
33
|
/**
|
|
34
|
-
* Possible adblock syntaxes (supported by this library)
|
|
34
|
+
* Possible adblock syntaxes (supported by this library).
|
|
35
35
|
*/
|
|
36
36
|
const AdblockSyntax = {
|
|
37
37
|
/**
|
|
@@ -49,29 +49,32 @@ const AdblockSyntax = {
|
|
|
49
49
|
/**
|
|
50
50
|
* Adblock Plus syntax.
|
|
51
51
|
*
|
|
52
|
+
* @see {@link https://adblockplus.org/}
|
|
53
|
+
*
|
|
52
54
|
* @example
|
|
53
55
|
* - `example.org#$#abort-on-property-read alert` is an Adblock Plus syntax, since it is not used by any other
|
|
54
56
|
* adblockers directly (probably supported by some on-the-fly conversion, but this is not the native syntax).
|
|
55
|
-
* @see {@link https://adblockplus.org/}
|
|
56
57
|
*/
|
|
57
58
|
Abp: AdblockProduct.Abp,
|
|
58
59
|
/**
|
|
59
|
-
*
|
|
60
|
+
* UBlock Origin syntax..
|
|
61
|
+
*
|
|
62
|
+
* @see {@link https://github.com/gorhill/uBlock}
|
|
60
63
|
*
|
|
61
64
|
* @example
|
|
62
65
|
* - `example.com##+js(set, atob, noopFunc)` is an uBlock Origin syntax, since it is not used by any other
|
|
63
66
|
* adblockers directly (probably supported by some on-the-fly conversion, but this is not the native syntax).
|
|
64
|
-
* @see {@link https://github.com/gorhill/uBlock}
|
|
65
67
|
*/
|
|
66
68
|
Ubo: AdblockProduct.Ubo,
|
|
67
69
|
/**
|
|
68
70
|
* AdGuard syntax.
|
|
69
71
|
*
|
|
72
|
+
* @see {@link https://adguard.com/}
|
|
73
|
+
*
|
|
70
74
|
* @example
|
|
71
75
|
* - `example.org#%#//scriptlet("abort-on-property-read", "alert")` is an AdGuard syntax, since it is not used
|
|
72
76
|
* by any other adblockers directly (probably supported by some on-the-fly conversion, but this is not the native
|
|
73
77
|
* syntax).
|
|
74
|
-
* @see {@link https://adguard.com/}
|
|
75
78
|
*/
|
|
76
79
|
Adg: AdblockProduct.Adg,
|
|
77
80
|
};
|
package/dist/utils/bit-count.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v4.0.
|
|
2
|
+
* AGTree v4.0.2 (build date: Tue, 17 Mar 2026 23:34:38 GMT)
|
|
3
3
|
* (c) 2026 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v4.0.
|
|
2
|
+
* AGTree v4.0.2 (build date: Tue, 17 Mar 2026 23:34:38 GMT)
|
|
3
3
|
* (c) 2026 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
|
6
6
|
*/
|
|
7
7
|
import { CosmeticRuleParser } from '../parser/cosmetic/cosmetic-rule-parser.js';
|
|
8
|
-
import { isNull } from './type-guards.js';
|
|
9
8
|
import { defaultParserOptions } from '../parser/options.js';
|
|
9
|
+
import { isNull } from './type-guards.js';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Utility functions for categorizing rules.
|
package/dist/utils/clone.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v4.0.
|
|
2
|
+
* AGTree v4.0.2 (build date: Tue, 17 Mar 2026 23:34:38 GMT)
|
|
3
3
|
* (c) 2026 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import cloneDeep from 'clone-deep';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
* @file Clone related utilities
|
|
10
|
+
* @file Clone related utilities.
|
|
11
11
|
*
|
|
12
12
|
* We should keep clone related functions in this file. Thus, we just provide
|
|
13
13
|
* a simple interface for cloning values, we use it across the AGTree project,
|
|
@@ -17,8 +17,9 @@ import cloneDeep from 'clone-deep';
|
|
|
17
17
|
* Clones an input value to avoid side effects. Use it only in justified cases,
|
|
18
18
|
* because it can impact performance negatively.
|
|
19
19
|
*
|
|
20
|
-
* @param value Value to clone
|
|
21
|
-
*
|
|
20
|
+
* @param value Value to clone.
|
|
21
|
+
*
|
|
22
|
+
* @returns Cloned value.
|
|
22
23
|
*/
|
|
23
24
|
function clone(value) {
|
|
24
25
|
// TODO: Replace cloneDeep with a more efficient implementation
|
package/dist/utils/constants.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v4.0.
|
|
2
|
+
* AGTree v4.0.2 (build date: Tue, 17 Mar 2026 23:34:38 GMT)
|
|
3
3
|
* (c) 2026 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
|
6
6
|
*/
|
|
7
7
|
/**
|
|
8
|
-
* @file Constant values used by all parts of the library
|
|
8
|
+
* @file Constant values used by all parts of the library.
|
|
9
9
|
*/
|
|
10
10
|
// TODO: remove unused constants
|
|
11
11
|
// General
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v4.0.
|
|
2
|
+
* AGTree v4.0.2 (build date: Tue, 17 Mar 2026 23:34:38 GMT)
|
|
3
3
|
* (c) 2026 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
|
@@ -8,7 +8,7 @@ import { CosmeticRuleSeparator } from '../nodes/index.js';
|
|
|
8
8
|
import { AT_SIGN, SPACE } from './constants.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* @file Cosmetic rule separator finder and categorizer
|
|
11
|
+
* @file Cosmetic rule separator finder and categorizer.
|
|
12
12
|
*/
|
|
13
13
|
/**
|
|
14
14
|
* Utility class for cosmetic rule separators.
|
|
@@ -17,8 +17,9 @@ class CosmeticRuleSeparatorUtils {
|
|
|
17
17
|
/**
|
|
18
18
|
* Checks whether the specified separator is an exception.
|
|
19
19
|
*
|
|
20
|
-
* @param separator Separator to check
|
|
21
|
-
*
|
|
20
|
+
* @param separator Separator to check.
|
|
21
|
+
*
|
|
22
|
+
* @returns `true` if the separator is an exception, `false` otherwise.
|
|
22
23
|
*/
|
|
23
24
|
static isException(separator) {
|
|
24
25
|
// Simply check the second character
|
|
@@ -27,8 +28,9 @@ class CosmeticRuleSeparatorUtils {
|
|
|
27
28
|
/**
|
|
28
29
|
* Checks whether the specified separator is marks an Extended CSS cosmetic rule.
|
|
29
30
|
*
|
|
30
|
-
* @param separator Separator to check
|
|
31
|
-
*
|
|
31
|
+
* @param separator Separator to check.
|
|
32
|
+
*
|
|
33
|
+
* @returns `true` if the separator is marks an Extended CSS cosmetic rule, `false` otherwise.
|
|
32
34
|
*/
|
|
33
35
|
static isExtendedCssMarker(separator) {
|
|
34
36
|
return (separator === CosmeticRuleSeparator.ExtendedElementHiding
|
|
@@ -40,16 +42,18 @@ class CosmeticRuleSeparatorUtils {
|
|
|
40
42
|
* Looks for the cosmetic rule separator in the rule. This is a simplified version that
|
|
41
43
|
* masks the recursive function.
|
|
42
44
|
*
|
|
43
|
-
* @param rule Raw rule
|
|
44
|
-
*
|
|
45
|
+
* @param rule Raw rule.
|
|
46
|
+
*
|
|
47
|
+
* @returns Separator result or null if no separator was found.
|
|
45
48
|
*/
|
|
46
49
|
static find(rule) {
|
|
47
50
|
/**
|
|
48
51
|
* Helper function to create results of the `find` method.
|
|
49
52
|
*
|
|
50
|
-
* @param start Start position
|
|
51
|
-
* @param separator Separator type
|
|
52
|
-
*
|
|
53
|
+
* @param start Start position.
|
|
54
|
+
* @param separator Separator type.
|
|
55
|
+
*
|
|
56
|
+
* @returns Cosmetic rule separator node.
|
|
53
57
|
*/
|
|
54
58
|
// eslint-disable-next-line max-len
|
|
55
59
|
function createResult(start, separator) {
|