@adguard/agtree 4.0.3 → 4.1.0-beta
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/dist/ast-utils/clone.js +1 -1
- package/dist/ast-utils/modifiers.js +1 -1
- package/dist/ast-utils/network-rules.js +1 -1
- package/dist/ast-utils/scriptlets.js +1 -1
- 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 +1 -1
- package/dist/compatibility-tables/compatibility-table-data.js +1 -1
- package/dist/compatibility-tables/modifiers.js +1 -1
- package/dist/compatibility-tables/platforms.js +1 -1
- package/dist/compatibility-tables/redirects.js +1 -1
- package/dist/compatibility-tables/schemas/base.js +1 -1
- package/dist/compatibility-tables/schemas/modifier.js +1 -1
- package/dist/compatibility-tables/schemas/platform.js +1 -1
- 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 +1 -1
- package/dist/compatibility-tables/utils/platform-helpers.js +1 -1
- package/dist/compatibility-tables/utils/resource-type-helpers.js +1 -1
- package/dist/compatibility-tables/utils/zod-camelcase.js +1 -1
- package/dist/converter/base-interfaces/base-converter.js +1 -1
- package/dist/converter/base-interfaces/conversion-result.js +1 -1
- package/dist/converter/base-interfaces/rule-converter-base.js +1 -1
- package/dist/converter/comment/index.js +1 -1
- package/dist/converter/cosmetic/css.js +1 -1
- package/dist/converter/cosmetic/element-hiding.js +1 -1
- package/dist/converter/cosmetic/header-removal.js +1 -1
- package/dist/converter/cosmetic/html.js +1 -1
- package/dist/converter/cosmetic/index.js +31 -12
- package/dist/converter/cosmetic/path-converter.js +246 -0
- package/dist/converter/cosmetic/rule-modifiers/adg.js +1 -1
- package/dist/converter/cosmetic/rule-modifiers/ubo.js +4 -12
- package/dist/converter/cosmetic/scriptlet.js +3 -10
- package/dist/converter/css/index.js +4 -9
- package/dist/converter/data/css.js +1 -1
- package/dist/converter/filter-list.js +1 -1
- package/dist/converter/index.js +1 -1
- package/dist/converter/misc/network-rule-modifier.js +1 -1
- package/dist/converter/network/index.js +1 -1
- package/dist/converter/raw-filter-list.js +1 -1
- package/dist/converter/raw-rule.js +2 -10
- package/dist/converter/rule.js +1 -1
- package/dist/errors/adblock-syntax-error.js +1 -1
- package/dist/errors/not-implemented-error.js +1 -1
- package/dist/errors/rule-conversion-error.js +1 -1
- package/dist/generator/base-generator.js +1 -1
- package/dist/generator/comment/agent-comment-generator.js +1 -1
- package/dist/generator/comment/agent-generator.js +1 -1
- package/dist/generator/comment/comment-rule-generator.js +1 -1
- package/dist/generator/comment/config-comment-generator.js +1 -1
- package/dist/generator/comment/hint-comment-generator.js +1 -1
- package/dist/generator/comment/hint-generator.js +1 -1
- package/dist/generator/comment/metadata-comment-generator.js +1 -1
- package/dist/generator/comment/pre-processor-comment-generator.js +1 -1
- package/dist/generator/comment/simple-comment-generator.js +1 -1
- package/dist/generator/cosmetic/cosmetic-rule-body-generator.js +1 -1
- package/dist/generator/cosmetic/cosmetic-rule-generator.js +1 -1
- package/dist/generator/cosmetic/cosmetic-rule-pattern-generator.js +1 -1
- package/dist/generator/cosmetic/html-filtering-body/adg-html-filtering-body-generator.js +2 -10
- 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 +1 -1
- package/dist/generator/cosmetic/scriptlet-body/abp-snippet-injection-body-generator.js +1 -1
- package/dist/generator/cosmetic/scriptlet-body/adg-scriptlet-injection-body-generator.js +1 -1
- package/dist/generator/cosmetic/scriptlet-body/ubo-scriptlet-injection-body-generator.js +1 -1
- package/dist/generator/cosmetic/selector/attribute-selector-generator.js +1 -1
- package/dist/generator/cosmetic/selector/class-selector-generator.js +1 -1
- package/dist/generator/cosmetic/selector/complex-selector-generator.js +1 -1
- 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 +1 -1
- package/dist/generator/filterlist-generator.js +1 -1
- 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 +1 -1
- package/dist/generator/misc/logical-expression-generator.js +1 -1
- package/dist/generator/misc/modifier-generator.js +1 -1
- package/dist/generator/misc/modifier-list-generator.js +1 -1
- package/dist/generator/misc/parameter-list-generator.js +1 -1
- package/dist/generator/misc/value-generator.js +1 -1
- package/dist/generator/network/host-rule-generator.js +1 -1
- package/dist/generator/network/network-rule-generator.js +1 -1
- package/dist/generator/rule-generator.js +1 -1
- package/dist/index.js +1 -1
- 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 +1 -1
- package/dist/parser/comment/agent-parser.js +1 -1
- package/dist/parser/comment/comment-parser.js +1 -1
- package/dist/parser/comment/config-comment-parser.js +1 -1
- package/dist/parser/comment/hint-comment-parser.js +1 -1
- package/dist/parser/comment/hint-parser.js +1 -1
- package/dist/parser/comment/metadata-comment-parser.js +1 -1
- package/dist/parser/comment/preprocessor-parser.js +1 -1
- package/dist/parser/comment/simple-comment-parser.js +1 -1
- package/dist/parser/cosmetic/cosmetic-rule-parser.js +2 -2
- package/dist/parser/cosmetic/html-filtering-body/adg-html-filtering-body-parser.js +13 -3
- package/dist/parser/cosmetic/html-filtering-body/html-filtering-body-parser.js +1 -1
- package/dist/parser/cosmetic/html-filtering-body/ubo-html-filtering-body-parser.js +2 -2
- package/dist/parser/cosmetic/scriptlet-body/abp-snippet-injection-body-parser.js +1 -1
- package/dist/parser/cosmetic/scriptlet-body/adg-scriptlet-injection-body-parser.js +1 -1
- package/dist/parser/cosmetic/scriptlet-body/ubo-scriptlet-injection-body-parser.js +1 -1
- package/dist/parser/cosmetic/selector/handlers/attribute-selector-handler.js +2 -2
- package/dist/parser/cosmetic/selector/handlers/class-selector-handler.js +1 -1
- package/dist/parser/cosmetic/selector/handlers/complex-selector-handler.js +2 -2
- 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 +2 -2
- package/dist/parser/cosmetic/selector/handlers/type-selector-handler.js +1 -1
- package/dist/parser/cosmetic/selector/selector-list-parser.js +2 -2
- package/dist/parser/css/adg-css-injection-parser.js +1 -1
- package/dist/parser/css/balancing.js +2 -2
- package/dist/parser/css/constants.js +1 -1
- package/dist/parser/css/css-token-stream.js +2 -2
- package/dist/parser/css/ubo-selector-parser.js +2 -2
- package/dist/parser/filterlist-parser.js +1 -1
- package/dist/parser/index.js +1 -1
- package/dist/parser/misc/app-list-parser.js +1 -1
- package/dist/parser/misc/domain-list-parser.js +1 -1
- package/dist/parser/misc/list-items-parser.js +44 -9
- package/dist/parser/misc/logical-expression-parser.js +1 -1
- package/dist/parser/misc/method-list-parser.js +1 -1
- package/dist/parser/misc/modifier-list.js +1 -1
- package/dist/parser/misc/modifier-parser.js +1 -1
- package/dist/parser/misc/parameter-list-parser.js +1 -1
- package/dist/parser/misc/stealth-option-list-parser.js +1 -1
- package/dist/parser/misc/ubo-parameter-list-parser.js +1 -1
- package/dist/parser/misc/value-parser.js +1 -1
- package/dist/parser/network/host-rule-parser.js +1 -1
- package/dist/parser/network/network-rule-parser.js +1 -1
- package/dist/parser/options.js +1 -1
- package/dist/parser/rule-parser.js +1 -1
- package/dist/types/converter/cosmetic/path-converter.d.ts +17 -0
- package/dist/types/utils/index.d.ts +1 -1
- package/dist/utils/adblockers.js +1 -1
- package/dist/utils/bit-count.js +1 -1
- package/dist/utils/categorizer.js +1 -1
- package/dist/utils/clone.js +1 -1
- package/dist/utils/constants.js +1 -1
- package/dist/utils/cosmetic-rule-separator.js +1 -1
- package/dist/utils/deep-freeze.js +1 -1
- package/dist/utils/domain.js +1 -1
- package/dist/utils/error.js +1 -1
- package/dist/utils/index.js +2 -2
- package/dist/utils/logical-expression.js +1 -1
- package/dist/utils/multi-value-map.js +1 -1
- package/dist/utils/noop-modifier.js +1 -1
- package/dist/utils/position-provider.js +1 -1
- package/dist/utils/quotes.js +1 -1
- package/dist/utils/regexp.js +1 -1
- package/dist/utils/string.js +5 -3
- package/dist/utils/type-guards.js +1 -1
- package/dist/validator/constants.js +1 -1
- package/dist/validator/helpers.js +1 -1
- package/dist/validator/index.js +1 -1
- package/dist/validator/value.js +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -1
package/dist/ast-utils/clone.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v4.0
|
|
2
|
+
* AGTree v4.1.0-beta (build date: Thu, 16 Apr 2026 12:57:59 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.1.0-beta (build date: Thu, 16 Apr 2026 12:57:59 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.1.0-beta (build date: Thu, 16 Apr 2026 12:57:59 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.1.0-beta (build date: Thu, 16 Apr 2026 12:57:59 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.1.0-beta (build date: Thu, 16 Apr 2026 12:57:59 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.1.0-beta (build date: Thu, 16 Apr 2026 12:57:59 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.1.0-beta (build date: Thu, 16 Apr 2026 12:57:59 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.1.0-beta (build date: Thu, 16 Apr 2026 12:57:59 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.1.0-beta (build date: Thu, 16 Apr 2026 12:57:59 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.1.0-beta (build date: Thu, 16 Apr 2026 12:57:59 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.1.0-beta (build date: Thu, 16 Apr 2026 12:57:59 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.1.0-beta (build date: Thu, 16 Apr 2026 12:57:59 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.1.0-beta (build date: Thu, 16 Apr 2026 12:57:59 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.1.0-beta (build date: Thu, 16 Apr 2026 12:57:59 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.1.0-beta (build date: Thu, 16 Apr 2026 12:57:59 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.1.0-beta (build date: Thu, 16 Apr 2026 12:57:59 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.1.0-beta (build date: Thu, 16 Apr 2026 12:57:59 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.1.0-beta (build date: Thu, 16 Apr 2026 12:57:59 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.1.0-beta (build date: Thu, 16 Apr 2026 12:57:59 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.1.0-beta (build date: Thu, 16 Apr 2026 12:57:59 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.1.0-beta (build date: Thu, 16 Apr 2026 12:57:59 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.1.0-beta (build date: Thu, 16 Apr 2026 12:57:59 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.1.0-beta (build date: Thu, 16 Apr 2026 12:57:59 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.1.0-beta (build date: Thu, 16 Apr 2026 12:57:59 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.1.0-beta (build date: Thu, 16 Apr 2026 12:57:59 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.1.0-beta (build date: Thu, 16 Apr 2026 12:57:59 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.1.0-beta (build date: Thu, 16 Apr 2026 12:57:59 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.1.0-beta (build date: Thu, 16 Apr 2026 12:57:59 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.1.0-beta (build date: Thu, 16 Apr 2026 12:57:59 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.1.0-beta (build date: Thu, 16 Apr 2026 12:57:59 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.1.0-beta (build date: Thu, 16 Apr 2026 12:57:59 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,20 +1,12 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v4.0
|
|
2
|
+
* AGTree v4.1.0-beta (build date: Thu, 16 Apr 2026 12:57:59 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 { RuleConversionError } from '../../errors/rule-conversion-error.js';
|
|
8
8
|
import { CosmeticRuleType, RuleCategory, CosmeticRuleSeparator } from '../../nodes/index.js';
|
|
9
|
-
import { COMMA } from '../../utils/constants.js';
|
|
10
9
|
import { AdblockSyntax } from '../../utils/adblockers.js';
|
|
11
|
-
import 'tldts';
|
|
12
|
-
import 'glob-to-regexp';
|
|
13
|
-
import '@adguard/css-tokenizer';
|
|
14
|
-
import 'sprintf-js';
|
|
15
|
-
import 'json5';
|
|
16
|
-
import '../data/css.js';
|
|
17
|
-
import '../../parser/css/balancing.js';
|
|
18
10
|
import { clone } from '../../utils/clone.js';
|
|
19
11
|
import { createNodeConversionResult } from '../base-interfaces/conversion-result.js';
|
|
20
12
|
import { RuleConverterBase } from '../base-interfaces/rule-converter-base.js';
|
|
@@ -22,9 +14,11 @@ import { CssInjectionRuleConverter } from './css.js';
|
|
|
22
14
|
import { ElementHidingRuleConverter } from './element-hiding.js';
|
|
23
15
|
import { HeaderRemovalRuleConverter } from './header-removal.js';
|
|
24
16
|
import { HtmlRuleConverter } from './html.js';
|
|
17
|
+
import { convertPathInDomainToModifier } from './path-converter.js';
|
|
25
18
|
import { AdgCosmeticRuleModifierConverter } from './rule-modifiers/adg.js';
|
|
26
19
|
import { UboCosmeticRuleModifierConverter } from './rule-modifiers/ubo.js';
|
|
27
20
|
import { ScriptletRuleConverter } from './scriptlet.js';
|
|
21
|
+
import { COMMA } from '../../utils/constants.js';
|
|
28
22
|
|
|
29
23
|
/**
|
|
30
24
|
* @file Cosmetic rule converter.
|
|
@@ -91,8 +85,11 @@ class CosmeticRuleConverter extends RuleConverterBase {
|
|
|
91
85
|
throw new RuleConversionError('ABP don\'t support cosmetic rule modifiers');
|
|
92
86
|
}
|
|
93
87
|
}
|
|
94
|
-
|
|
95
|
-
|
|
88
|
+
// Track if any conversion happened
|
|
89
|
+
const wasConverted = subconverterResult.result.length > 1
|
|
90
|
+
|| subconverterResult.isConverted
|
|
91
|
+
|| (convertedModifiers && convertedModifiers.isConverted);
|
|
92
|
+
if (wasConverted) {
|
|
96
93
|
// Add modifier list to the subconverter result rules
|
|
97
94
|
subconverterResult.result.forEach((subconverterRule) => {
|
|
98
95
|
if (convertedModifiers && subconverterRule.category === RuleCategory.Cosmetic) {
|
|
@@ -100,7 +97,29 @@ class CosmeticRuleConverter extends RuleConverterBase {
|
|
|
100
97
|
subconverterRule.modifiers = convertedModifiers.result;
|
|
101
98
|
}
|
|
102
99
|
});
|
|
103
|
-
|
|
100
|
+
}
|
|
101
|
+
// Apply path-in-domain conversion to all rules
|
|
102
|
+
const rulesToProcess = wasConverted ? subconverterResult.result : [rule];
|
|
103
|
+
const finalRules = [];
|
|
104
|
+
let pathConversionHappened = false;
|
|
105
|
+
for (const ruleToProcess of rulesToProcess) {
|
|
106
|
+
if (ruleToProcess.category === RuleCategory.Cosmetic) {
|
|
107
|
+
const pathConversionResult = convertPathInDomainToModifier(ruleToProcess);
|
|
108
|
+
if (pathConversionResult) {
|
|
109
|
+
finalRules.push(...pathConversionResult.result);
|
|
110
|
+
pathConversionHappened = true;
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
finalRules.push(ruleToProcess);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
finalRules.push(ruleToProcess);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
// Return result with combined conversion status
|
|
121
|
+
if (wasConverted || pathConversionHappened) {
|
|
122
|
+
return createNodeConversionResult(finalRules, true);
|
|
104
123
|
}
|
|
105
124
|
return createNodeConversionResult([rule], false);
|
|
106
125
|
}
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* AGTree v4.1.0-beta (build date: Thu, 16 Apr 2026 12:57:59 GMT)
|
|
3
|
+
* (c) 2026 Adguard Software Ltd.
|
|
4
|
+
* Released under the MIT license
|
|
5
|
+
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
|
6
|
+
*/
|
|
7
|
+
import { createModifierNode } from '../../ast-utils/modifiers.js';
|
|
8
|
+
import { RuleConversionError } from '../../errors/rule-conversion-error.js';
|
|
9
|
+
import { ListNodeType, ListItemNodeType } from '../../nodes/index.js';
|
|
10
|
+
import { AdblockSyntax } from '../../utils/adblockers.js';
|
|
11
|
+
import { clone } from '../../utils/clone.js';
|
|
12
|
+
import { REGEX_MARKER, ESCAPE_CHARACTER, SLASH, ADG_PATH_MODIFIER, OPEN_SQUARE_BRACKET, CLOSE_SQUARE_BRACKET } from '../../utils/constants.js';
|
|
13
|
+
import { createNodeConversionResult } from '../base-interfaces/conversion-result.js';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @file Path-in-domain converter helper.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Finds the index of the first escaped forward slash (`\/`) in a regex string,
|
|
20
|
+
* skipping character classes (`[...]`).
|
|
21
|
+
*
|
|
22
|
+
* @param str Regex content without outer `/` delimiters.
|
|
23
|
+
*
|
|
24
|
+
* @returns Index of the backslash in the first `\/` sequence, or -1 if not found.
|
|
25
|
+
*/
|
|
26
|
+
function findFirstEscapedSlash(str) {
|
|
27
|
+
let insideCharacterClass = false;
|
|
28
|
+
for (let i = 0; i < str.length; i += 1) {
|
|
29
|
+
if (str[i] === OPEN_SQUARE_BRACKET && !insideCharacterClass) {
|
|
30
|
+
insideCharacterClass = true;
|
|
31
|
+
}
|
|
32
|
+
else if (str[i] === CLOSE_SQUARE_BRACKET && insideCharacterClass) {
|
|
33
|
+
insideCharacterClass = false;
|
|
34
|
+
}
|
|
35
|
+
else if (!insideCharacterClass
|
|
36
|
+
&& str[i] === ESCAPE_CHARACTER
|
|
37
|
+
&& i + 1 < str.length
|
|
38
|
+
&& str[i + 1] === SLASH) {
|
|
39
|
+
return i;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return -1;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Converts path-in-domain syntax to $path modifier.
|
|
46
|
+
*
|
|
47
|
+
* Example: `example.org/path##.ad` → `[$path=/path]example.org##.ad`.
|
|
48
|
+
*
|
|
49
|
+
* @param rule Rule to check and convert.
|
|
50
|
+
*
|
|
51
|
+
* @returns Conversion result if path-in-domain syntax found, undefined otherwise.
|
|
52
|
+
*
|
|
53
|
+
* @throws RuleConversionError if conflicting $path modifier exists.
|
|
54
|
+
*/
|
|
55
|
+
function convertPathInDomainToModifier(rule) {
|
|
56
|
+
// Only process rules with domains
|
|
57
|
+
if (!rule.domains || rule.domains.children.length === 0) {
|
|
58
|
+
return undefined;
|
|
59
|
+
}
|
|
60
|
+
// Quick check: return early if no domain contains a path indicator.
|
|
61
|
+
// For non-regex domains, a path requires '/'.
|
|
62
|
+
// For regex domains, a path requires '\/' (escaped slash).
|
|
63
|
+
const hasAnyPath = rule.domains.children.some((domainItem) => {
|
|
64
|
+
const { value } = domainItem;
|
|
65
|
+
if (value.startsWith(REGEX_MARKER) && value.endsWith(REGEX_MARKER) && value.length > 1) {
|
|
66
|
+
return value.includes(ESCAPE_CHARACTER + SLASH);
|
|
67
|
+
}
|
|
68
|
+
return value.includes(SLASH);
|
|
69
|
+
});
|
|
70
|
+
if (!hasAnyPath) {
|
|
71
|
+
return undefined;
|
|
72
|
+
}
|
|
73
|
+
const domainsWithPaths = [];
|
|
74
|
+
const domainsWithoutPaths = [];
|
|
75
|
+
rule.domains.children.forEach((domainItem) => {
|
|
76
|
+
const domainValue = domainItem.value;
|
|
77
|
+
// Check if domain is a regex pattern (starts and ends with /)
|
|
78
|
+
if (domainValue.startsWith(REGEX_MARKER) && domainValue.endsWith(REGEX_MARKER) && domainValue.length > 1) {
|
|
79
|
+
const inner = domainValue.slice(1, -1);
|
|
80
|
+
const splitIndex = findFirstEscapedSlash(inner);
|
|
81
|
+
if (splitIndex !== -1) {
|
|
82
|
+
// splitIndex points to the backslash in `\/`
|
|
83
|
+
// Domain part: everything before the backslash, wrapped in /
|
|
84
|
+
// Path part: from the slash onward (keeping the slash), wrapped in /
|
|
85
|
+
const domain = `${REGEX_MARKER}${inner.substring(0, splitIndex)}${REGEX_MARKER}`;
|
|
86
|
+
const path = `${REGEX_MARKER}${inner.substring(splitIndex)}${REGEX_MARKER}`;
|
|
87
|
+
domainsWithPaths.push({
|
|
88
|
+
domain,
|
|
89
|
+
path,
|
|
90
|
+
exception: domainItem.exception,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
domainsWithoutPaths.push({
|
|
95
|
+
domain: domainValue,
|
|
96
|
+
exception: domainItem.exception,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
// Non-regex domain
|
|
102
|
+
const slashIndex = domainValue.indexOf(SLASH);
|
|
103
|
+
if (slashIndex !== -1) {
|
|
104
|
+
const domain = domainValue.substring(0, slashIndex);
|
|
105
|
+
const path = domainValue.substring(slashIndex); // includes leading /
|
|
106
|
+
// Skip empty paths
|
|
107
|
+
if (path === '/') {
|
|
108
|
+
domainsWithoutPaths.push({
|
|
109
|
+
domain,
|
|
110
|
+
exception: domainItem.exception,
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
domainsWithPaths.push({
|
|
115
|
+
domain,
|
|
116
|
+
path,
|
|
117
|
+
exception: domainItem.exception,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
domainsWithoutPaths.push({
|
|
123
|
+
domain: domainValue,
|
|
124
|
+
exception: domainItem.exception,
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
if (domainsWithPaths.length === 0) {
|
|
130
|
+
return undefined;
|
|
131
|
+
}
|
|
132
|
+
/*
|
|
133
|
+
* Exception domains cannot be combined with path-in-domain syntax.
|
|
134
|
+
*
|
|
135
|
+
* For example example.org/foo1/bar2,~example.org/${WILDCARD}/bar2##h1
|
|
136
|
+
* This can’t be converted because [$path=/${WILDCARD}/bar2]example.org##h1
|
|
137
|
+
* may unblock unrelated rules like: "example.org/baz1/bar2##h1".
|
|
138
|
+
*/
|
|
139
|
+
const hasException = rule.domains.children.some((d) => d.exception);
|
|
140
|
+
if (hasException) {
|
|
141
|
+
// Single exception domain with path — just skip conversion
|
|
142
|
+
if (rule.domains.children.length === 1) {
|
|
143
|
+
return undefined;
|
|
144
|
+
}
|
|
145
|
+
// Domain list with both exception and path-in-domain — error
|
|
146
|
+
throw new RuleConversionError('Path-in-domain syntax cannot be used with exception domains');
|
|
147
|
+
}
|
|
148
|
+
// Check for conflicting $path modifier
|
|
149
|
+
if (rule.modifiers) {
|
|
150
|
+
const hasPathModifier = rule.modifiers.children.some((mod) => mod.name.value === ADG_PATH_MODIFIER);
|
|
151
|
+
if (hasPathModifier) {
|
|
152
|
+
throw new RuleConversionError('Path specified both in domain and $path modifier');
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
// Group domains by path
|
|
156
|
+
const pathGroups = new Map();
|
|
157
|
+
domainsWithPaths.forEach(({ domain, path, exception }) => {
|
|
158
|
+
if (!pathGroups.has(path)) {
|
|
159
|
+
pathGroups.set(path, []);
|
|
160
|
+
}
|
|
161
|
+
pathGroups.get(path).push({ domain, exception });
|
|
162
|
+
});
|
|
163
|
+
// If all domains have the same path and there are no domains without paths,
|
|
164
|
+
// create a single rule with $path modifier
|
|
165
|
+
if (pathGroups.size === 1 && domainsWithoutPaths.length === 0) {
|
|
166
|
+
const [path, domains] = Array.from(pathGroups.entries())[0];
|
|
167
|
+
const convertedRule = clone(rule);
|
|
168
|
+
// Set syntax to Adg since we're adding AdGuard modifiers
|
|
169
|
+
convertedRule.syntax = AdblockSyntax.Adg;
|
|
170
|
+
// Update domains to remove paths
|
|
171
|
+
convertedRule.domains = {
|
|
172
|
+
type: ListNodeType.DomainList,
|
|
173
|
+
separator: rule.domains.separator,
|
|
174
|
+
children: domains.map((d) => ({
|
|
175
|
+
type: ListItemNodeType.Domain,
|
|
176
|
+
value: d.domain,
|
|
177
|
+
exception: d.exception,
|
|
178
|
+
})),
|
|
179
|
+
};
|
|
180
|
+
// Add $path modifier
|
|
181
|
+
const pathModifier = createModifierNode(ADG_PATH_MODIFIER, path);
|
|
182
|
+
if (convertedRule.modifiers) {
|
|
183
|
+
convertedRule.modifiers = {
|
|
184
|
+
...convertedRule.modifiers,
|
|
185
|
+
children: [...convertedRule.modifiers.children, pathModifier],
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
convertedRule.modifiers = {
|
|
190
|
+
type: 'ModifierList',
|
|
191
|
+
children: [pathModifier],
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
return createNodeConversionResult([convertedRule], true);
|
|
195
|
+
}
|
|
196
|
+
// Multiple paths or mixed (with/without paths) - split into multiple rules
|
|
197
|
+
const convertedRules = [];
|
|
198
|
+
// Create rules for domains with paths
|
|
199
|
+
pathGroups.forEach((domains, path) => {
|
|
200
|
+
const convertedRule = clone(rule);
|
|
201
|
+
// Set syntax to Adg since we're adding AdGuard modifiers
|
|
202
|
+
convertedRule.syntax = AdblockSyntax.Adg;
|
|
203
|
+
// Set domains for this path
|
|
204
|
+
convertedRule.domains = {
|
|
205
|
+
type: 'DomainList',
|
|
206
|
+
separator: rule.domains.separator,
|
|
207
|
+
children: domains.map((d) => ({
|
|
208
|
+
type: 'Domain',
|
|
209
|
+
value: d.domain,
|
|
210
|
+
exception: d.exception,
|
|
211
|
+
})),
|
|
212
|
+
};
|
|
213
|
+
// Add $path modifier
|
|
214
|
+
const pathModifier = createModifierNode(ADG_PATH_MODIFIER, path);
|
|
215
|
+
if (convertedRule.modifiers) {
|
|
216
|
+
convertedRule.modifiers = {
|
|
217
|
+
...convertedRule.modifiers,
|
|
218
|
+
children: [...convertedRule.modifiers.children, pathModifier],
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
convertedRule.modifiers = {
|
|
223
|
+
type: 'ModifierList',
|
|
224
|
+
children: [pathModifier],
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
convertedRules.push(convertedRule);
|
|
228
|
+
});
|
|
229
|
+
// Create rule for domains without paths (if any)
|
|
230
|
+
if (domainsWithoutPaths.length > 0) {
|
|
231
|
+
const convertedRule = clone(rule);
|
|
232
|
+
convertedRule.domains = {
|
|
233
|
+
type: 'DomainList',
|
|
234
|
+
separator: rule.domains.separator,
|
|
235
|
+
children: domainsWithoutPaths.map((d) => ({
|
|
236
|
+
type: 'Domain',
|
|
237
|
+
value: d.domain,
|
|
238
|
+
exception: d.exception,
|
|
239
|
+
})),
|
|
240
|
+
};
|
|
241
|
+
convertedRules.push(convertedRule);
|
|
242
|
+
}
|
|
243
|
+
return createNodeConversionResult(convertedRules, true);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
export { convertPathInDomainToModifier };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v4.0
|
|
2
|
+
* AGTree v4.1.0-beta (build date: Thu, 16 Apr 2026 12:57:59 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,26 +1,18 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v4.0
|
|
2
|
+
* AGTree v4.1.0-beta (build date: Thu, 16 Apr 2026 12:57:59 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 { createModifierNode } from '../../../ast-utils/modifiers.js';
|
|
8
8
|
import { ListNodeType, ListItemNodeType } from '../../../nodes/index.js';
|
|
9
|
-
import '../../../utils/adblockers.js';
|
|
10
|
-
import { ADG_PATH_MODIFIER, ADG_URL_MODIFIER, COMMA_DOMAIN_LIST_SEPARATOR, ADG_DOMAINS_MODIFIER, PIPE_MODIFIER_SEPARATOR, ADG_APP_MODIFIER, UBO_MATCHES_PATH_OPERATOR, OPEN_SQUARE_BRACKET, CLOSE_SQUARE_BRACKET, ESCAPE_CHARACTER } from '../../../utils/constants.js';
|
|
11
|
-
import { StringUtils } from '../../../utils/string.js';
|
|
12
|
-
import 'json5';
|
|
13
|
-
import '@adguard/css-tokenizer';
|
|
14
|
-
import 'sprintf-js';
|
|
15
|
-
import '../../data/css.js';
|
|
16
|
-
import '../../../parser/css/balancing.js';
|
|
17
|
-
import { DomainListParser } from '../../../parser/misc/domain-list-parser.js';
|
|
18
|
-
import 'is-ip';
|
|
19
|
-
import 'tldts';
|
|
20
9
|
import { clone } from '../../../utils/clone.js';
|
|
10
|
+
import { ADG_PATH_MODIFIER, ADG_URL_MODIFIER, COMMA_DOMAIN_LIST_SEPARATOR, ADG_DOMAINS_MODIFIER, PIPE_MODIFIER_SEPARATOR, ADG_APP_MODIFIER, UBO_MATCHES_PATH_OPERATOR, OPEN_SQUARE_BRACKET, CLOSE_SQUARE_BRACKET, ESCAPE_CHARACTER } from '../../../utils/constants.js';
|
|
21
11
|
import { MultiValueMap } from '../../../utils/multi-value-map.js';
|
|
22
12
|
import { RegExpUtils } from '../../../utils/regexp.js';
|
|
13
|
+
import { StringUtils } from '../../../utils/string.js';
|
|
23
14
|
import { createConversionResult } from '../../base-interfaces/conversion-result.js';
|
|
15
|
+
import { DomainListParser } from '../../../parser/misc/domain-list-parser.js';
|
|
24
16
|
|
|
25
17
|
/**
|
|
26
18
|
* @file Cosmetic rule modifier converter from ADG to uBO.
|