@adguard/agtree 4.0.1 → 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
package/README.md
CHANGED
|
@@ -45,9 +45,11 @@ You can install the library using
|
|
|
45
45
|
[npm-pkg-manager-url]: https://www.npmjs.com/get-npm
|
|
46
46
|
[pnpm-pkg-manager-url]: https://pnpm.io/
|
|
47
47
|
|
|
48
|
-
##
|
|
48
|
+
## Documentation
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
- [Changelog](CHANGELOG.md)
|
|
51
|
+
- [Development guide](../../DEVELOPMENT.md)
|
|
52
|
+
- [LLM agent rules](AGENTS.md)
|
|
51
53
|
|
|
52
54
|
## Ideas & Questions
|
|
53
55
|
|
|
@@ -88,7 +90,6 @@ resources, please let us know.
|
|
|
88
90
|
[adg-filters]: https://kb.adguard.com/en/general/how-to-create-your-own-ad-filters
|
|
89
91
|
[adg-scriptlets]: https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#scriptlets
|
|
90
92
|
[compatibility-tables-url]: https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree/src/compatibility-tables
|
|
91
|
-
[contributing-url]: https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree/CONTRIBUTING.md
|
|
92
93
|
[converter-url]: https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree/src/converter
|
|
93
94
|
[discussions-url]: https://github.com/AdguardTeam/tsurlfilter/discussions
|
|
94
95
|
[license-url]: https://github.com/AdguardTeam/tsurlfilter/blob/master/packages/agtree/LICENSE
|
package/dist/ast-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
|
|
@@ -8,13 +8,15 @@ import { isNull } from '../utils/type-guards.js';
|
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* @file Custom clone functions for AST nodes, this is probably the most efficient way to clone AST nodes.
|
|
11
|
-
*
|
|
11
|
+
*
|
|
12
|
+
* @todo Maybe move them to parser classes as 'clone' methods.
|
|
12
13
|
*/
|
|
13
14
|
/**
|
|
14
15
|
* Clones a scriptlet rule node.
|
|
15
16
|
*
|
|
16
|
-
* @param node Node to clone
|
|
17
|
-
*
|
|
17
|
+
* @param node Node to clone.
|
|
18
|
+
*
|
|
19
|
+
* @returns Cloned node.
|
|
18
20
|
*/
|
|
19
21
|
function cloneScriptletRuleNode(node) {
|
|
20
22
|
return {
|
|
@@ -25,8 +27,9 @@ function cloneScriptletRuleNode(node) {
|
|
|
25
27
|
/**
|
|
26
28
|
* Clones a domain list node.
|
|
27
29
|
*
|
|
28
|
-
* @param node Node to clone
|
|
29
|
-
*
|
|
30
|
+
* @param node Node to clone.
|
|
31
|
+
*
|
|
32
|
+
* @returns Cloned node.
|
|
30
33
|
*/
|
|
31
34
|
function cloneDomainListNode(node) {
|
|
32
35
|
return {
|
|
@@ -38,8 +41,9 @@ function cloneDomainListNode(node) {
|
|
|
38
41
|
/**
|
|
39
42
|
* Clones a modifier list node.
|
|
40
43
|
*
|
|
41
|
-
* @param node Node to clone
|
|
42
|
-
*
|
|
44
|
+
* @param node Node to clone.
|
|
45
|
+
*
|
|
46
|
+
* @returns Cloned node.
|
|
43
47
|
*/
|
|
44
48
|
function cloneModifierListNode(node) {
|
|
45
49
|
return {
|
|
@@ -1,22 +1,23 @@
|
|
|
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
|
-
import { isUndefined } from '../utils/type-guards.js';
|
|
8
7
|
import { clone } from '../utils/clone.js';
|
|
8
|
+
import { isUndefined } from '../utils/type-guards.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* @file Utility functions for working with modifier nodes
|
|
11
|
+
* @file Utility functions for working with modifier nodes.
|
|
12
12
|
*/
|
|
13
13
|
/**
|
|
14
|
-
* Creates a modifier node
|
|
14
|
+
* Creates a modifier node.
|
|
15
15
|
*
|
|
16
|
-
* @param name Name of the modifier
|
|
17
|
-
* @param value Value of the modifier
|
|
18
|
-
* @param exception Whether the modifier is an exception
|
|
19
|
-
*
|
|
16
|
+
* @param name Name of the modifier.
|
|
17
|
+
* @param value Value of the modifier.
|
|
18
|
+
* @param exception Whether the modifier is an exception.
|
|
19
|
+
*
|
|
20
|
+
* @returns Modifier node.
|
|
20
21
|
*/
|
|
21
22
|
function createModifierNode(name, value = undefined, exception = false) {
|
|
22
23
|
const result = {
|
|
@@ -36,10 +37,11 @@ function createModifierNode(name, value = undefined, exception = false) {
|
|
|
36
37
|
return result;
|
|
37
38
|
}
|
|
38
39
|
/**
|
|
39
|
-
* Creates a modifier list node
|
|
40
|
+
* Creates a modifier list node.
|
|
41
|
+
*
|
|
42
|
+
* @param modifiers Modifiers to put in the list (optional, defaults to an empty list).
|
|
40
43
|
*
|
|
41
|
-
* @
|
|
42
|
-
* @returns Modifier list node
|
|
44
|
+
* @returns Modifier list node.
|
|
43
45
|
*/
|
|
44
46
|
function createModifierListNode(modifiers = []) {
|
|
45
47
|
const result = {
|
|
@@ -1,25 +1,26 @@
|
|
|
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
|
-
import { isUndefined } from '../utils/type-guards.js';
|
|
8
7
|
import { NetworkRuleType, RuleCategory } from '../nodes/index.js';
|
|
9
8
|
import { AdblockSyntax } from '../utils/adblockers.js';
|
|
10
9
|
import { clone } from '../utils/clone.js';
|
|
10
|
+
import { isUndefined } from '../utils/type-guards.js';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
* @file Utility functions for working with network rule nodes
|
|
13
|
+
* @file Utility functions for working with network rule nodes.
|
|
14
14
|
*/
|
|
15
15
|
/**
|
|
16
|
-
* Creates a network rule node
|
|
16
|
+
* Creates a network rule node.
|
|
17
|
+
*
|
|
18
|
+
* @param pattern Rule pattern.
|
|
19
|
+
* @param modifiers Rule modifiers (optional, default: undefined).
|
|
20
|
+
* @param exception Exception rule flag (optional, default: false).
|
|
21
|
+
* @param syntax Adblock syntax (optional, default: Common).
|
|
17
22
|
*
|
|
18
|
-
* @
|
|
19
|
-
* @param modifiers Rule modifiers (optional, default: undefined)
|
|
20
|
-
* @param exception Exception rule flag (optional, default: false)
|
|
21
|
-
* @param syntax Adblock syntax (optional, default: Common)
|
|
22
|
-
* @returns Network rule node
|
|
23
|
+
* @returns Network rule node.
|
|
23
24
|
*/
|
|
24
25
|
function createNetworkRuleNode(pattern, modifiers = undefined, exception = false, syntax = AdblockSyntax.Common) {
|
|
25
26
|
const result = {
|
|
@@ -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
|
|
@@ -9,14 +9,16 @@ import { QuoteUtils } from '../utils/quotes.js';
|
|
|
9
9
|
import { isUndefined, isNull } from '../utils/type-guards.js';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
* @file Utility functions for working with scriptlet nodes
|
|
12
|
+
* @file Utility functions for working with scriptlet nodes.
|
|
13
13
|
*/
|
|
14
14
|
/**
|
|
15
|
-
* Get name of the scriptlet from the scriptlet node
|
|
15
|
+
* Get name of the scriptlet from the scriptlet node.
|
|
16
16
|
*
|
|
17
|
-
* @param scriptletNode Scriptlet node to get name of
|
|
18
|
-
*
|
|
19
|
-
* @
|
|
17
|
+
* @param scriptletNode Scriptlet node to get name of.
|
|
18
|
+
*
|
|
19
|
+
* @returns Name of the scriptlet.
|
|
20
|
+
*
|
|
21
|
+
* @throws If the scriptlet is empty.
|
|
20
22
|
*/
|
|
21
23
|
function getScriptletName(scriptletNode) {
|
|
22
24
|
if (scriptletNode.children.length === 0) {
|
|
@@ -25,11 +27,11 @@ function getScriptletName(scriptletNode) {
|
|
|
25
27
|
return scriptletNode.children[0]?.value ?? EMPTY;
|
|
26
28
|
}
|
|
27
29
|
/**
|
|
28
|
-
* Transform the nth argument of the scriptlet node
|
|
30
|
+
* Transform the nth argument of the scriptlet node.
|
|
29
31
|
*
|
|
30
|
-
* @param scriptletNode Scriptlet node to transform argument of
|
|
31
|
-
* @param index Index of the argument to transform (index 0 is the scriptlet name)
|
|
32
|
-
* @param transform Function to transform the argument
|
|
32
|
+
* @param scriptletNode Scriptlet node to transform argument of.
|
|
33
|
+
* @param index Index of the argument to transform (index 0 is the scriptlet name).
|
|
34
|
+
* @param transform Function to transform the argument.
|
|
33
35
|
*/
|
|
34
36
|
function transformNthScriptletArgument(scriptletNode, index, transform) {
|
|
35
37
|
const child = scriptletNode.children[index];
|
|
@@ -52,10 +54,10 @@ function transformNthScriptletArgument(scriptletNode, index, transform) {
|
|
|
52
54
|
}
|
|
53
55
|
}
|
|
54
56
|
/**
|
|
55
|
-
* Transform all arguments of the scriptlet node
|
|
57
|
+
* Transform all arguments of the scriptlet node.
|
|
56
58
|
*
|
|
57
|
-
* @param scriptletNode Scriptlet node to transform arguments of
|
|
58
|
-
* @param transform Function to transform the arguments
|
|
59
|
+
* @param scriptletNode Scriptlet node to transform arguments of.
|
|
60
|
+
* @param transform Function to transform the arguments.
|
|
59
61
|
*/
|
|
60
62
|
function transformAllScriptletArguments(scriptletNode, transform) {
|
|
61
63
|
for (let i = 0; i < scriptletNode.children.length; i += 1) {
|
|
@@ -66,17 +68,17 @@ function transformAllScriptletArguments(scriptletNode, transform) {
|
|
|
66
68
|
* Set name of the scriptlet.
|
|
67
69
|
* Modifies input `scriptletNode` if needed.
|
|
68
70
|
*
|
|
69
|
-
* @param scriptletNode Scriptlet node to set name of
|
|
70
|
-
* @param name Name to set
|
|
71
|
+
* @param scriptletNode Scriptlet node to set name of.
|
|
72
|
+
* @param name Name to set.
|
|
71
73
|
*/
|
|
72
74
|
function setScriptletName(scriptletNode, name) {
|
|
73
75
|
transformNthScriptletArgument(scriptletNode, 0, () => name);
|
|
74
76
|
}
|
|
75
77
|
/**
|
|
76
|
-
* Set quote type of the scriptlet parameters
|
|
78
|
+
* Set quote type of the scriptlet parameters.
|
|
77
79
|
*
|
|
78
|
-
* @param scriptletNode Scriptlet node to set quote type of
|
|
79
|
-
* @param quoteType Preferred quote type
|
|
80
|
+
* @param scriptletNode Scriptlet node to set quote type of.
|
|
81
|
+
* @param quoteType Preferred quote type.
|
|
80
82
|
*/
|
|
81
83
|
function setScriptletQuoteType(scriptletNode, quoteType) {
|
|
82
84
|
// null is a special value that means "no value", but we can't change its quote type,
|
|
@@ -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,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,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,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,13 +1,13 @@
|
|
|
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
|
-
import {
|
|
7
|
+
import { AdblockSyntax } from '../utils/adblockers.js';
|
|
8
8
|
import { isUndefined } from '../utils/type-guards.js';
|
|
9
|
+
import { GenericPlatform } from './platforms.js';
|
|
9
10
|
import { isGenericPlatform } from './utils/platform-helpers.js';
|
|
10
|
-
import { AdblockSyntax } from '../utils/adblockers.js';
|
|
11
11
|
|
|
12
12
|
/* eslint-disable no-bitwise */
|
|
13
13
|
/**
|
|
@@ -42,6 +42,7 @@ class CompatibilityTableBase {
|
|
|
42
42
|
* Helper method to get a 'row' from the compatibility table data by name.
|
|
43
43
|
*
|
|
44
44
|
* @param name Compatibility data name.
|
|
45
|
+
*
|
|
45
46
|
* @returns Compatibility table row storage or `null` if not found.
|
|
46
47
|
*/
|
|
47
48
|
getRowStorage(name) {
|
|
@@ -54,12 +55,12 @@ class CompatibilityTableBase {
|
|
|
54
55
|
/**
|
|
55
56
|
* Checks whether a compatibility data `name` exists for any platform.
|
|
56
57
|
*
|
|
57
|
-
* @note Technically, do the same as `exists()` method with generic platform _any_
|
|
58
|
-
* but it is faster because it does not apply complex logic.
|
|
59
|
-
*
|
|
60
58
|
* @param name Compatibility data name.
|
|
61
59
|
*
|
|
62
60
|
* @returns True if the compatibility data exists, false otherwise.
|
|
61
|
+
*
|
|
62
|
+
* @note Technically, do the same as `exists()` method with generic platform _any_
|
|
63
|
+
* but it is faster because it does not apply complex logic.
|
|
63
64
|
*/
|
|
64
65
|
existsAny(name) {
|
|
65
66
|
const normalizedName = this.nameTransformer ? this.nameTransformer(name) : name;
|
|
@@ -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,14 +1,14 @@
|
|
|
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
|
-
import { CompatibilityTableBase } from './base.js';
|
|
8
|
-
import { modifiersCompatibilityTableData } from './compatibility-table-data.js';
|
|
9
7
|
import { UNDERSCORE } from '../utils/constants.js';
|
|
10
8
|
import { deepFreeze } from '../utils/deep-freeze.js';
|
|
11
9
|
import { isValidNoopModifier } from '../utils/noop-modifier.js';
|
|
10
|
+
import { CompatibilityTableBase } from './base.js';
|
|
11
|
+
import { modifiersCompatibilityTableData } from './compatibility-table-data.js';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* @file Compatibility tables for modifiers.
|
|
@@ -19,6 +19,7 @@ import { isValidNoopModifier } from '../utils/noop-modifier.js';
|
|
|
19
19
|
* e.g. '____' is also valid. In this case, we need to normalize the name to '_'.
|
|
20
20
|
*
|
|
21
21
|
* @param name Modifier name to normalize.
|
|
22
|
+
*
|
|
22
23
|
* @returns Normalized modifier name.
|
|
23
24
|
*/
|
|
24
25
|
const noopModifierNameNormalizer = (name) => {
|
|
@@ -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,15 +1,15 @@
|
|
|
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
|
+
import { COLON } from '../utils/constants.js';
|
|
8
|
+
import { deepFreeze } from '../utils/deep-freeze.js';
|
|
9
|
+
import { isString, isNull, isUndefined } from '../utils/type-guards.js';
|
|
7
10
|
import { CompatibilityTableBase } from './base.js';
|
|
8
11
|
import { redirectsCompatibilityTableData } from './compatibility-table-data.js';
|
|
9
|
-
import { deepFreeze } from '../utils/deep-freeze.js';
|
|
10
|
-
import { COLON } from '../utils/constants.js';
|
|
11
12
|
import { getResourceTypeModifier } from './utils/resource-type-helpers.js';
|
|
12
|
-
import { isString, isNull, isUndefined } from '../utils/type-guards.js';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* @file Compatibility tables for redirects.
|
|
@@ -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 zod from 'zod';
|
|
8
|
-
import './platform.js';
|
|
9
8
|
import { zodToCamelCase } from '../utils/zod-camelcase.js';
|
|
9
|
+
import './platform.js';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* @file Base compatibility data schema, which is commonly used in compatibility tables.
|
|
@@ -1,14 +1,14 @@
|
|
|
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 zod from 'zod';
|
|
8
|
+
import { EMPTY } from '../../utils/constants.js';
|
|
9
|
+
import { getErrorMessage } from '../../utils/error.js';
|
|
8
10
|
import { zodToCamelCase } from '../utils/zod-camelcase.js';
|
|
9
11
|
import { baseCompatibilityDataSchema, nonEmptyStringSchema, booleanSchema, baseRefineLogic } from './base.js';
|
|
10
|
-
import { getErrorMessage } from '../../utils/error.js';
|
|
11
|
-
import { EMPTY } from '../../utils/constants.js';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* @file Schema for modifier data.
|
|
@@ -67,7 +67,7 @@ zodToCamelCase(baseCompatibilityDataSchema.extend({
|
|
|
67
67
|
* Describes whether the *assignable* modifier value is required.
|
|
68
68
|
* For example, `$cookie` is assignable but it can be used without a value in exception rules:
|
|
69
69
|
* `@@\|\|example.com^$cookie`.
|
|
70
|
-
* If `false`, the `value_format` is required, e.g. the value of `$app` should always be specified
|
|
70
|
+
* If `false`, the `value_format` is required, e.g. the value of `$app` should always be specified.
|
|
71
71
|
*/
|
|
72
72
|
value_optional: booleanSchema.default(false),
|
|
73
73
|
/**
|
|
@@ -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 zod from 'zod';
|
|
8
|
-
import { SPECIFIC_PLATFORM_MAP, GENERIC_PLATFORM_MAP, SPECIFIC_PLATFORM_MAP_REVERSE } from '../utils/platform-helpers.js';
|
|
9
8
|
import { isUndefined } from '../../utils/type-guards.js';
|
|
9
|
+
import { SPECIFIC_PLATFORM_MAP, GENERIC_PLATFORM_MAP, SPECIFIC_PLATFORM_MAP_REVERSE } from '../utils/platform-helpers.js';
|
|
10
10
|
|
|
11
11
|
/* eslint-disable no-bitwise */
|
|
12
12
|
/**
|
|
@@ -65,6 +65,7 @@ const parseRawPlatforms = (rawPlatforms) => {
|
|
|
65
65
|
* @param bitmask Platform bitmask (can be specific, generic, or combined platforms).
|
|
66
66
|
*
|
|
67
67
|
* @returns Platform string, e.g. 'adg_safari_any|adg_os_any' or 'adg_os_windows|adg_ext_chrome'.
|
|
68
|
+
*
|
|
68
69
|
* @throws Error if the bitmask is 0 or contains unknown platforms.
|
|
69
70
|
*/
|
|
70
71
|
const stringifyPlatforms = (bitmask) => {
|
|
@@ -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,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,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
|
+
import { deepFreeze } from '../utils/deep-freeze.js';
|
|
7
8
|
import { CompatibilityTableBase } from './base.js';
|
|
8
9
|
import { scriptletsCompatibilityTableData } from './compatibility-table-data.js';
|
|
9
|
-
import { deepFreeze } from '../utils/deep-freeze.js';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* @file Compatibility tables for scriptlets.
|
|
@@ -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
|
-
import { SpecificPlatform, GenericPlatform } from '../platforms.js';
|
|
8
7
|
import { AdblockProduct } from '../../utils/adblockers.js';
|
|
9
8
|
import { getBitCount } from '../../utils/bit-count.js';
|
|
9
|
+
import { SpecificPlatform, GenericPlatform } from '../platforms.js';
|
|
10
10
|
|
|
11
11
|
/* eslint-disable no-bitwise */
|
|
12
12
|
/**
|
|
@@ -191,7 +191,7 @@ const hasPlatformMultipleProducts = (platform) => {
|
|
|
191
191
|
* - Empty array `[]` if platform is 0 or no products are found
|
|
192
192
|
* - Array of specific products based on which products are present
|
|
193
193
|
* (e.g., `['AdGuard', 'UblockOrigin']` if both AdGuard and uBlock Origin are specified)
|
|
194
|
-
* - `['AdGuard', 'UblockOrigin', 'AdblockPlus']` for GenericPlatform.Any
|
|
194
|
+
* - `['AdGuard', 'UblockOrigin', 'AdblockPlus']` for GenericPlatform.Any.
|
|
195
195
|
*/
|
|
196
196
|
const platformToAdblockProduct = (platform) => {
|
|
197
197
|
const products = [];
|
|
@@ -262,7 +262,7 @@ const optimizePlatformRepresentation = (extractedPlatforms, productGenericPlatfo
|
|
|
262
262
|
* - Empty object `{}` if platform is 0 or no products are found
|
|
263
263
|
* - Object with single product key for single-product platforms
|
|
264
264
|
* - Object with multiple product keys for multi-product platforms
|
|
265
|
-
* - Each array contains the minimal representation using generic platforms where possible
|
|
265
|
+
* - Each array contains the minimal representation using generic platforms where possible.
|
|
266
266
|
*
|
|
267
267
|
* @example
|
|
268
268
|
* ```typescript
|
|
@@ -310,6 +310,7 @@ const getPlatformsByProduct = (platform) => {
|
|
|
310
310
|
* @param platform Platform string name, e.g., 'adg_os_windows'.
|
|
311
311
|
*
|
|
312
312
|
* @returns Specific or generic platform enum value.
|
|
313
|
+
*
|
|
313
314
|
* @throws Error if the platform is unknown.
|
|
314
315
|
*/
|
|
315
316
|
const getPlatformId = (platform) => {
|
|
@@ -329,6 +330,7 @@ const getPlatformId = (platform) => {
|
|
|
329
330
|
* @param platform Specific platform enum value.
|
|
330
331
|
*
|
|
331
332
|
* @returns Specific platform string name, e.g., 'adg_os_windows'.
|
|
333
|
+
*
|
|
332
334
|
* @throws Error if the platform is unknown.
|
|
333
335
|
*/
|
|
334
336
|
const getSpecificPlatformName = (platform) => {
|
|
@@ -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,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
|
|
@@ -12,11 +12,11 @@ import camelCaseKeys from 'camelcase-keys';
|
|
|
12
12
|
/**
|
|
13
13
|
* Transforms Zod schema to camelCase.
|
|
14
14
|
*
|
|
15
|
+
* @see {@link https://github.com/colinhacks/zod/issues/486#issuecomment-1501097361}
|
|
16
|
+
*
|
|
15
17
|
* @param zod Zod schema.
|
|
16
18
|
*
|
|
17
19
|
* @returns Zod schema with camelCase properties.
|
|
18
|
-
*
|
|
19
|
-
* @see {@link https://github.com/colinhacks/zod/issues/486#issuecomment-1501097361}
|
|
20
20
|
*/
|
|
21
21
|
const zodToCamelCase = (zod) => {
|
|
22
22
|
return zod.transform((val) => camelCaseKeys(val));
|
|
@@ -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,49 +7,55 @@
|
|
|
7
7
|
import { NotImplementedError } from '../../errors/not-implemented-error.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
* @file Base class for converters
|
|
10
|
+
* @file Base class for converters.
|
|
11
11
|
*
|
|
12
12
|
* TS doesn't support abstract static methods, so we should use
|
|
13
|
-
* a workaround and extend this class instead of implementing it
|
|
13
|
+
* a workaround and extend this class instead of implementing it.
|
|
14
14
|
*/
|
|
15
15
|
/* eslint-disable jsdoc/require-returns-check */
|
|
16
16
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
17
17
|
/**
|
|
18
|
-
* Basic class for rule converters
|
|
18
|
+
* Basic class for rule converters.
|
|
19
19
|
*/
|
|
20
20
|
class BaseConverter {
|
|
21
21
|
/**
|
|
22
|
-
* Converts some data to AdGuard format
|
|
22
|
+
* Converts some data to AdGuard format.
|
|
23
|
+
*
|
|
24
|
+
* @param data Data to convert.
|
|
23
25
|
*
|
|
24
|
-
* @param data Data to convert
|
|
25
26
|
* @returns An object which follows the {@link ConversionResult} interface. Its `result` property contains
|
|
26
27
|
* the converted node, and its `isConverted` flag indicates whether the original node was converted.
|
|
27
|
-
* If the node was not converted, the result will contain the original node with the same object reference
|
|
28
|
-
*
|
|
28
|
+
* If the node was not converted, the result will contain the original node with the same object reference.
|
|
29
|
+
*
|
|
30
|
+
* @throws If the data is invalid or incompatible.
|
|
29
31
|
*/
|
|
30
32
|
static convertToAdg(data) {
|
|
31
33
|
throw new NotImplementedError();
|
|
32
34
|
}
|
|
33
35
|
/**
|
|
34
|
-
* Converts some data to Adblock Plus format
|
|
36
|
+
* Converts some data to Adblock Plus format.
|
|
37
|
+
*
|
|
38
|
+
* @param data Data to convert.
|
|
35
39
|
*
|
|
36
|
-
* @param data Data to convert
|
|
37
40
|
* @returns An object which follows the {@link ConversionResult} interface. Its `result` property contains
|
|
38
41
|
* the converted node, and its `isConverted` flag indicates whether the original node was converted.
|
|
39
|
-
* If the node was not converted, the result will contain the original node with the same object reference
|
|
40
|
-
*
|
|
42
|
+
* If the node was not converted, the result will contain the original node with the same object reference.
|
|
43
|
+
*
|
|
44
|
+
* @throws If the data is invalid or incompatible.
|
|
41
45
|
*/
|
|
42
46
|
static convertToAbp(data) {
|
|
43
47
|
throw new NotImplementedError();
|
|
44
48
|
}
|
|
45
49
|
/**
|
|
46
|
-
* Converts some data to uBlock Origin format
|
|
50
|
+
* Converts some data to uBlock Origin format.
|
|
51
|
+
*
|
|
52
|
+
* @param data Data to convert.
|
|
47
53
|
*
|
|
48
|
-
* @param data Data to convert
|
|
49
54
|
* @returns An object which follows the {@link ConversionResult} interface. Its `result` property contains
|
|
50
55
|
* the converted node, and its `isConverted` flag indicates whether the original node was converted.
|
|
51
|
-
* If the node was not converted, the result will contain the original node with the same object reference
|
|
52
|
-
*
|
|
56
|
+
* If the node was not converted, the result will contain the original node with the same object reference.
|
|
57
|
+
*
|
|
58
|
+
* @throws If the data is invalid or incompatible.
|
|
53
59
|
*/
|
|
54
60
|
static convertToUbo(data) {
|
|
55
61
|
throw new NotImplementedError();
|