@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.
Files changed (164) hide show
  1. package/dist/ast-utils/clone.js +1 -1
  2. package/dist/ast-utils/modifiers.js +1 -1
  3. package/dist/ast-utils/network-rules.js +1 -1
  4. package/dist/ast-utils/scriptlets.js +1 -1
  5. package/dist/common/abp-snippet-injection-body-common.js +1 -1
  6. package/dist/common/agent-common.js +1 -1
  7. package/dist/common/ubo-html-filtering-body-common.js +1 -1
  8. package/dist/common/ubo-selector-common.js +1 -1
  9. package/dist/compatibility-tables/base.js +1 -1
  10. package/dist/compatibility-tables/compatibility-table-data.js +1 -1
  11. package/dist/compatibility-tables/modifiers.js +1 -1
  12. package/dist/compatibility-tables/platforms.js +1 -1
  13. package/dist/compatibility-tables/redirects.js +1 -1
  14. package/dist/compatibility-tables/schemas/base.js +1 -1
  15. package/dist/compatibility-tables/schemas/modifier.js +1 -1
  16. package/dist/compatibility-tables/schemas/platform.js +1 -1
  17. package/dist/compatibility-tables/schemas/redirect.js +1 -1
  18. package/dist/compatibility-tables/schemas/resource-type.js +1 -1
  19. package/dist/compatibility-tables/schemas/scriptlet.js +1 -1
  20. package/dist/compatibility-tables/scriptlets.js +1 -1
  21. package/dist/compatibility-tables/utils/platform-helpers.js +1 -1
  22. package/dist/compatibility-tables/utils/resource-type-helpers.js +1 -1
  23. package/dist/compatibility-tables/utils/zod-camelcase.js +1 -1
  24. package/dist/converter/base-interfaces/base-converter.js +1 -1
  25. package/dist/converter/base-interfaces/conversion-result.js +1 -1
  26. package/dist/converter/base-interfaces/rule-converter-base.js +1 -1
  27. package/dist/converter/comment/index.js +1 -1
  28. package/dist/converter/cosmetic/css.js +1 -1
  29. package/dist/converter/cosmetic/element-hiding.js +1 -1
  30. package/dist/converter/cosmetic/header-removal.js +1 -1
  31. package/dist/converter/cosmetic/html.js +1 -1
  32. package/dist/converter/cosmetic/index.js +31 -12
  33. package/dist/converter/cosmetic/path-converter.js +246 -0
  34. package/dist/converter/cosmetic/rule-modifiers/adg.js +1 -1
  35. package/dist/converter/cosmetic/rule-modifiers/ubo.js +4 -12
  36. package/dist/converter/cosmetic/scriptlet.js +3 -10
  37. package/dist/converter/css/index.js +4 -9
  38. package/dist/converter/data/css.js +1 -1
  39. package/dist/converter/filter-list.js +1 -1
  40. package/dist/converter/index.js +1 -1
  41. package/dist/converter/misc/network-rule-modifier.js +1 -1
  42. package/dist/converter/network/index.js +1 -1
  43. package/dist/converter/raw-filter-list.js +1 -1
  44. package/dist/converter/raw-rule.js +2 -10
  45. package/dist/converter/rule.js +1 -1
  46. package/dist/errors/adblock-syntax-error.js +1 -1
  47. package/dist/errors/not-implemented-error.js +1 -1
  48. package/dist/errors/rule-conversion-error.js +1 -1
  49. package/dist/generator/base-generator.js +1 -1
  50. package/dist/generator/comment/agent-comment-generator.js +1 -1
  51. package/dist/generator/comment/agent-generator.js +1 -1
  52. package/dist/generator/comment/comment-rule-generator.js +1 -1
  53. package/dist/generator/comment/config-comment-generator.js +1 -1
  54. package/dist/generator/comment/hint-comment-generator.js +1 -1
  55. package/dist/generator/comment/hint-generator.js +1 -1
  56. package/dist/generator/comment/metadata-comment-generator.js +1 -1
  57. package/dist/generator/comment/pre-processor-comment-generator.js +1 -1
  58. package/dist/generator/comment/simple-comment-generator.js +1 -1
  59. package/dist/generator/cosmetic/cosmetic-rule-body-generator.js +1 -1
  60. package/dist/generator/cosmetic/cosmetic-rule-generator.js +1 -1
  61. package/dist/generator/cosmetic/cosmetic-rule-pattern-generator.js +1 -1
  62. package/dist/generator/cosmetic/html-filtering-body/adg-html-filtering-body-generator.js +2 -10
  63. package/dist/generator/cosmetic/html-filtering-body/html-filtering-body-generator.js +1 -1
  64. package/dist/generator/cosmetic/html-filtering-body/ubo-html-filtering-body-generator.js +1 -1
  65. package/dist/generator/cosmetic/scriptlet-body/abp-snippet-injection-body-generator.js +1 -1
  66. package/dist/generator/cosmetic/scriptlet-body/adg-scriptlet-injection-body-generator.js +1 -1
  67. package/dist/generator/cosmetic/scriptlet-body/ubo-scriptlet-injection-body-generator.js +1 -1
  68. package/dist/generator/cosmetic/selector/attribute-selector-generator.js +1 -1
  69. package/dist/generator/cosmetic/selector/class-selector-generator.js +1 -1
  70. package/dist/generator/cosmetic/selector/complex-selector-generator.js +1 -1
  71. package/dist/generator/cosmetic/selector/id-selector-generator.js +1 -1
  72. package/dist/generator/cosmetic/selector/pseudo-class-selector-generator.js +1 -1
  73. package/dist/generator/cosmetic/selector/selector-combinator-generator.js +1 -1
  74. package/dist/generator/cosmetic/selector/selector-list-generator.js +1 -1
  75. package/dist/generator/cosmetic/selector/type-selector-generator.js +1 -1
  76. package/dist/generator/css/adg-css-injection-generator.js +1 -1
  77. package/dist/generator/filterlist-generator.js +1 -1
  78. package/dist/generator/index.js +1 -1
  79. package/dist/generator/misc/domain-list-generator.js +1 -1
  80. package/dist/generator/misc/list-items-generator.js +1 -1
  81. package/dist/generator/misc/logical-expression-generator.js +1 -1
  82. package/dist/generator/misc/modifier-generator.js +1 -1
  83. package/dist/generator/misc/modifier-list-generator.js +1 -1
  84. package/dist/generator/misc/parameter-list-generator.js +1 -1
  85. package/dist/generator/misc/value-generator.js +1 -1
  86. package/dist/generator/network/host-rule-generator.js +1 -1
  87. package/dist/generator/network/network-rule-generator.js +1 -1
  88. package/dist/generator/rule-generator.js +1 -1
  89. package/dist/index.js +1 -1
  90. package/dist/nodes/index.js +1 -1
  91. package/dist/package.json.js +2 -2
  92. package/dist/parser/base-parser.js +1 -1
  93. package/dist/parser/comment/agent-comment-parser.js +1 -1
  94. package/dist/parser/comment/agent-parser.js +1 -1
  95. package/dist/parser/comment/comment-parser.js +1 -1
  96. package/dist/parser/comment/config-comment-parser.js +1 -1
  97. package/dist/parser/comment/hint-comment-parser.js +1 -1
  98. package/dist/parser/comment/hint-parser.js +1 -1
  99. package/dist/parser/comment/metadata-comment-parser.js +1 -1
  100. package/dist/parser/comment/preprocessor-parser.js +1 -1
  101. package/dist/parser/comment/simple-comment-parser.js +1 -1
  102. package/dist/parser/cosmetic/cosmetic-rule-parser.js +2 -2
  103. package/dist/parser/cosmetic/html-filtering-body/adg-html-filtering-body-parser.js +13 -3
  104. package/dist/parser/cosmetic/html-filtering-body/html-filtering-body-parser.js +1 -1
  105. package/dist/parser/cosmetic/html-filtering-body/ubo-html-filtering-body-parser.js +2 -2
  106. package/dist/parser/cosmetic/scriptlet-body/abp-snippet-injection-body-parser.js +1 -1
  107. package/dist/parser/cosmetic/scriptlet-body/adg-scriptlet-injection-body-parser.js +1 -1
  108. package/dist/parser/cosmetic/scriptlet-body/ubo-scriptlet-injection-body-parser.js +1 -1
  109. package/dist/parser/cosmetic/selector/handlers/attribute-selector-handler.js +2 -2
  110. package/dist/parser/cosmetic/selector/handlers/class-selector-handler.js +1 -1
  111. package/dist/parser/cosmetic/selector/handlers/complex-selector-handler.js +2 -2
  112. package/dist/parser/cosmetic/selector/handlers/compound-selector-handler.js +2 -2
  113. package/dist/parser/cosmetic/selector/handlers/id-selector-handler.js +1 -1
  114. package/dist/parser/cosmetic/selector/handlers/pseudo-class-selector-handler.js +2 -2
  115. package/dist/parser/cosmetic/selector/handlers/type-selector-handler.js +1 -1
  116. package/dist/parser/cosmetic/selector/selector-list-parser.js +2 -2
  117. package/dist/parser/css/adg-css-injection-parser.js +1 -1
  118. package/dist/parser/css/balancing.js +2 -2
  119. package/dist/parser/css/constants.js +1 -1
  120. package/dist/parser/css/css-token-stream.js +2 -2
  121. package/dist/parser/css/ubo-selector-parser.js +2 -2
  122. package/dist/parser/filterlist-parser.js +1 -1
  123. package/dist/parser/index.js +1 -1
  124. package/dist/parser/misc/app-list-parser.js +1 -1
  125. package/dist/parser/misc/domain-list-parser.js +1 -1
  126. package/dist/parser/misc/list-items-parser.js +44 -9
  127. package/dist/parser/misc/logical-expression-parser.js +1 -1
  128. package/dist/parser/misc/method-list-parser.js +1 -1
  129. package/dist/parser/misc/modifier-list.js +1 -1
  130. package/dist/parser/misc/modifier-parser.js +1 -1
  131. package/dist/parser/misc/parameter-list-parser.js +1 -1
  132. package/dist/parser/misc/stealth-option-list-parser.js +1 -1
  133. package/dist/parser/misc/ubo-parameter-list-parser.js +1 -1
  134. package/dist/parser/misc/value-parser.js +1 -1
  135. package/dist/parser/network/host-rule-parser.js +1 -1
  136. package/dist/parser/network/network-rule-parser.js +1 -1
  137. package/dist/parser/options.js +1 -1
  138. package/dist/parser/rule-parser.js +1 -1
  139. package/dist/types/converter/cosmetic/path-converter.d.ts +17 -0
  140. package/dist/types/utils/index.d.ts +1 -1
  141. package/dist/utils/adblockers.js +1 -1
  142. package/dist/utils/bit-count.js +1 -1
  143. package/dist/utils/categorizer.js +1 -1
  144. package/dist/utils/clone.js +1 -1
  145. package/dist/utils/constants.js +1 -1
  146. package/dist/utils/cosmetic-rule-separator.js +1 -1
  147. package/dist/utils/deep-freeze.js +1 -1
  148. package/dist/utils/domain.js +1 -1
  149. package/dist/utils/error.js +1 -1
  150. package/dist/utils/index.js +2 -2
  151. package/dist/utils/logical-expression.js +1 -1
  152. package/dist/utils/multi-value-map.js +1 -1
  153. package/dist/utils/noop-modifier.js +1 -1
  154. package/dist/utils/position-provider.js +1 -1
  155. package/dist/utils/quotes.js +1 -1
  156. package/dist/utils/regexp.js +1 -1
  157. package/dist/utils/string.js +5 -3
  158. package/dist/utils/type-guards.js +1 -1
  159. package/dist/validator/constants.js +1 -1
  160. package/dist/validator/helpers.js +1 -1
  161. package/dist/validator/index.js +1 -1
  162. package/dist/validator/value.js +1 -1
  163. package/dist/version.js +1 -1
  164. package/package.json +3 -1
@@ -1,5 +1,5 @@
1
1
  /*
2
- * AGTree v4.0.3 (build date: Tue, 24 Mar 2026 15:29:20 GMT)
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.3 (build date: Tue, 24 Mar 2026 15:29:20 GMT)
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.3 (build date: Tue, 24 Mar 2026 15:29:20 GMT)
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.3 (build date: Tue, 24 Mar 2026 15:29:20 GMT)
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,11 +1,11 @@
1
1
  /*
2
- * AGTree v4.0.3 (build date: Tue, 24 Mar 2026 15:29:20 GMT)
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
- import { hasToken, TokenType } from '@adguard/css-tokenizer';
8
7
  import { sprintf } from 'sprintf-js';
8
+ import { hasToken, TokenType } from '@adguard/css-tokenizer';
9
9
  import { UboPseudoName } from '../../common/ubo-selector-common.js';
10
10
  import { AdblockSyntaxError } from '../../errors/adblock-syntax-error.js';
11
11
  import { RuleCategory, CosmeticRuleType } from '../../nodes/index.js';
@@ -1,5 +1,5 @@
1
1
  /*
2
- * AGTree v4.0.3 (build date: Tue, 24 Mar 2026 15:29:20 GMT)
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
@@ -41,8 +41,18 @@ class AdgHtmlFilteringBodyParser extends BaseParser {
41
41
  * ```
42
42
  */
43
43
  static parse(raw, options = defaultParserOptions, baseOffset = 0) {
44
- const escapedRaw = QuoteUtils.escapeAttributeDoubleQuotes(raw);
45
- return HtmlFilteringBodyParser.parse(escapedRaw, options, baseOffset);
44
+ // Only escape AdGuard's `""` → `\"` when the body will actually be
45
+ // CSS-parsed. When `parseHtmlFilteringRuleBodies` is false the raw
46
+ // string is stored as-is in a Value node; escaping here would cause
47
+ // double-escaping when the converter later re-parses it.
48
+ //
49
+ // Needed for proper `[tag-content]` conversion (to `:contains()`)
50
+ // where `""` must be used to escape `"`:
51
+ // https://adguard.com/kb/general/ad-filtering/create-own-filters/#tag-content
52
+ const input = options.parseHtmlFilteringRuleBodies
53
+ ? QuoteUtils.escapeAttributeDoubleQuotes(raw)
54
+ : raw;
55
+ return HtmlFilteringBodyParser.parse(input, options, baseOffset);
46
56
  }
47
57
  }
48
58
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * AGTree v4.0.3 (build date: Tue, 24 Mar 2026 15:29:20 GMT)
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,11 +1,11 @@
1
1
  /*
2
- * AGTree v4.0.3 (build date: Tue, 24 Mar 2026 15:29:20 GMT)
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
- import { TokenType, getFormattedTokenName } from '@adguard/css-tokenizer';
8
7
  import { sprintf } from 'sprintf-js';
8
+ import { TokenType, getFormattedTokenName } from '@adguard/css-tokenizer';
9
9
  import { AdblockSyntaxError } from '../../../errors/adblock-syntax-error.js';
10
10
  import { UBO_RESPONSEHEADER_FN } from '../../../utils/constants.js';
11
11
  import { BaseParser } from '../../base-parser.js';
@@ -1,5 +1,5 @@
1
1
  /*
2
- * AGTree v4.0.3 (build date: Tue, 24 Mar 2026 15:29:20 GMT)
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.3 (build date: Tue, 24 Mar 2026 15:29:20 GMT)
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.3 (build date: Tue, 24 Mar 2026 15:29:20 GMT)
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,11 +1,11 @@
1
1
  /*
2
- * AGTree v4.0.3 (build date: Tue, 24 Mar 2026 15:29:20 GMT)
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
- import { TokenType, getFormattedTokenName } from '@adguard/css-tokenizer';
8
7
  import { sprintf } from 'sprintf-js';
8
+ import { TokenType, getFormattedTokenName } from '@adguard/css-tokenizer';
9
9
  import { AdblockSyntaxError } from '../../../../errors/adblock-syntax-error.js';
10
10
  import { TILDE, CARET, DOLLAR_SIGN, ASTERISK, PIPE, EQUALS } from '../../../../utils/constants.js';
11
11
  import { QuoteUtils } from '../../../../utils/quotes.js';
@@ -1,5 +1,5 @@
1
1
  /*
2
- * AGTree v4.0.3 (build date: Tue, 24 Mar 2026 15:29:20 GMT)
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,11 +1,11 @@
1
1
  /*
2
- * AGTree v4.0.3 (build date: Tue, 24 Mar 2026 15:29:20 GMT)
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
- import { getFormattedTokenName } from '@adguard/css-tokenizer';
8
7
  import { sprintf } from 'sprintf-js';
8
+ import { getFormattedTokenName } from '@adguard/css-tokenizer';
9
9
  import { AdblockSyntaxError } from '../../../../errors/adblock-syntax-error.js';
10
10
  import { CompoundSelectorHandler } from './compound-selector-handler.js';
11
11
 
@@ -1,11 +1,11 @@
1
1
  /*
2
- * AGTree v4.0.3 (build date: Tue, 24 Mar 2026 15:29:20 GMT)
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
- import { getFormattedTokenName } from '@adguard/css-tokenizer';
8
7
  import { sprintf } from 'sprintf-js';
8
+ import { getFormattedTokenName } from '@adguard/css-tokenizer';
9
9
  import { AdblockSyntaxError } from '../../../../errors/adblock-syntax-error.js';
10
10
  import { GREATER_THAN, PLUS, TILDE, COMMA, SPACE } from '../../../../utils/constants.js';
11
11
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * AGTree v4.0.3 (build date: Tue, 24 Mar 2026 15:29:20 GMT)
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,11 +1,11 @@
1
1
  /*
2
- * AGTree v4.0.3 (build date: Tue, 24 Mar 2026 15:29:20 GMT)
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
- import { TokenType, getFormattedTokenName } from '@adguard/css-tokenizer';
8
7
  import { sprintf } from 'sprintf-js';
8
+ import { TokenType, getFormattedTokenName } from '@adguard/css-tokenizer';
9
9
  import { AdblockSyntaxError } from '../../../../errors/adblock-syntax-error.js';
10
10
  import { EMPTY } from '../../../../utils/constants.js';
11
11
  import { ValueParser } from '../../../misc/value-parser.js';
@@ -1,5 +1,5 @@
1
1
  /*
2
- * AGTree v4.0.3 (build date: Tue, 24 Mar 2026 15:29:20 GMT)
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,11 +1,11 @@
1
1
  /*
2
- * AGTree v4.0.3 (build date: Tue, 24 Mar 2026 15:29:20 GMT)
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
- import { getFormattedTokenName, TokenType } from '@adguard/css-tokenizer';
8
7
  import { sprintf } from 'sprintf-js';
8
+ import { getFormattedTokenName, TokenType } from '@adguard/css-tokenizer';
9
9
  import { AdblockSyntaxError } from '../../../errors/adblock-syntax-error.js';
10
10
  import { SPACE, TILDE, PLUS, GREATER_THAN, DOT, ASTERISK } from '../../../utils/constants.js';
11
11
  import { BaseParser } from '../../base-parser.js';
@@ -1,5 +1,5 @@
1
1
  /*
2
- * AGTree v4.0.3 (build date: Tue, 24 Mar 2026 15:29:20 GMT)
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,11 +1,11 @@
1
1
  /*
2
- * AGTree v4.0.3 (build date: Tue, 24 Mar 2026 15:29:20 GMT)
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
- import { TokenType, tokenizeExtended, getFormattedTokenName } from '@adguard/css-tokenizer';
8
7
  import { sprintf } from 'sprintf-js';
8
+ import { TokenType, tokenizeExtended, getFormattedTokenName } from '@adguard/css-tokenizer';
9
9
  import { AdblockSyntaxError } from '../../errors/adblock-syntax-error.js';
10
10
  import { ERROR_MESSAGES, END_OF_INPUT } from './constants.js';
11
11
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * AGTree v4.0.3 (build date: Tue, 24 Mar 2026 15:29:20 GMT)
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,11 +1,11 @@
1
1
  /*
2
- * AGTree v4.0.3 (build date: Tue, 24 Mar 2026 15:29:20 GMT)
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
- import { TokenType, getFormattedTokenName, tokenizeExtended } from '@adguard/css-tokenizer';
8
7
  import { sprintf } from 'sprintf-js';
8
+ import { TokenType, getFormattedTokenName, tokenizeExtended } from '@adguard/css-tokenizer';
9
9
  import { EXT_CSS_PSEUDO_CLASSES, EXT_CSS_PSEUDO_CLASSES_STRICT, NATIVE_CSS_PSEUDO_CLASSES, LEGACY_EXT_CSS_ATTRIBUTE_PREFIX, ABP_EXT_CSS_PREFIX } from '../../converter/data/css.js';
10
10
  import { AdblockSyntaxError } from '../../errors/adblock-syntax-error.js';
11
11
  import { EMPTY } from '../../utils/constants.js';
@@ -1,11 +1,11 @@
1
1
  /*
2
- * AGTree v4.0.3 (build date: Tue, 24 Mar 2026 15:29:20 GMT)
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
- import { TokenType, getFormattedTokenName } from '@adguard/css-tokenizer';
8
7
  import { sprintf } from 'sprintf-js';
8
+ import { TokenType, getFormattedTokenName } from '@adguard/css-tokenizer';
9
9
  import { UboPseudoName } from '../../common/ubo-selector-common.js';
10
10
  import { AdblockSyntaxError } from '../../errors/adblock-syntax-error.js';
11
11
  import { EMPTY, COLON, OPEN_PARENTHESIS, CSS_NOT_PSEUDO, CLOSE_PARENTHESIS } from '../../utils/constants.js';
@@ -1,5 +1,5 @@
1
1
  /*
2
- * AGTree v4.0.3 (build date: Tue, 24 Mar 2026 15:29:20 GMT)
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.3 (build date: Tue, 24 Mar 2026 15:29:20 GMT)
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.3 (build date: Tue, 24 Mar 2026 15:29:20 GMT)
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.3 (build date: Tue, 24 Mar 2026 15:29:20 GMT)
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,12 +1,12 @@
1
1
  /*
2
- * AGTree v4.0.3 (build date: Tue, 24 Mar 2026 15:29:20 GMT)
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 { AdblockSyntaxError } from '../../errors/adblock-syntax-error.js';
8
8
  import { ListItemNodeType } from '../../nodes/index.js';
9
- import { COMMA, NEGATION_MARKER } from '../../utils/constants.js';
9
+ import { COMMA, NEGATION_MARKER, REGEX_MARKER, ESCAPE_CHARACTER, OPEN_SQUARE_BRACKET, CLOSE_SQUARE_BRACKET } from '../../utils/constants.js';
10
10
  import { StringUtils } from '../../utils/string.js';
11
11
  import { defaultParserOptions } from '../options.js';
12
12
 
@@ -67,18 +67,53 @@ class ListItemsParser {
67
67
  while (offset < raw.length) {
68
68
  // Skip whitespace before the list item
69
69
  offset = StringUtils.skipWS(raw, offset);
70
- let itemStart = offset;
71
- // Find the index of the first unescaped separator character
72
- // Use findUnescapedNonStringNonRegexChar
73
- // to properly handle separators inside regex patterns
74
- const separatorStartIndex = StringUtils.findUnescapedNonStringNonRegexChar(raw, separator, offset);
70
+ const exception = raw[offset] === NEGATION_MARKER;
71
+ const itemStart = exception
72
+ ? offset + 1
73
+ : offset;
74
+ let separatorStartIndex = -1;
75
+ // item possibly a regex
76
+ if (raw[itemStart] === REGEX_MARKER) {
77
+ // try to find the next slash
78
+ let i = itemStart + 1;
79
+ let insideCharacterClass = false;
80
+ let escaped = false;
81
+ while (i < raw.length) {
82
+ if (escaped) {
83
+ escaped = false;
84
+ }
85
+ else if (raw[i] === ESCAPE_CHARACTER) {
86
+ escaped = true;
87
+ }
88
+ else if (raw[i] === OPEN_SQUARE_BRACKET) {
89
+ insideCharacterClass = true;
90
+ }
91
+ else if (raw[i] === CLOSE_SQUARE_BRACKET) {
92
+ insideCharacterClass = false;
93
+ }
94
+ else if (!insideCharacterClass
95
+ && raw[i] === REGEX_MARKER) {
96
+ // check if slash followed by optional space followed by the separator
97
+ const j = StringUtils.skipWS(raw, i + 1);
98
+ if (raw[j] === separator) {
99
+ separatorStartIndex = j;
100
+ break;
101
+ }
102
+ }
103
+ i += 1;
104
+ }
105
+ if (separatorStartIndex === -1) {
106
+ separatorStartIndex = raw.length;
107
+ }
108
+ }
109
+ else {
110
+ separatorStartIndex = StringUtils.findNextUnescapedCharacter(raw, separator, itemStart);
111
+ }
75
112
  const itemEnd = separatorStartIndex === -1
76
113
  ? StringUtils.skipWSBack(raw) + 1
77
114
  : StringUtils.skipWSBack(raw, separatorStartIndex - 1) + 1;
78
- const exception = raw[itemStart] === NEGATION_MARKER;
79
115
  // Skip the exception marker
80
116
  if (exception) {
81
- itemStart += 1;
82
117
  const item = raw[itemStart];
83
118
  // Exception marker cannot be followed by another exception marker
84
119
  if (item === NEGATION_MARKER) {
@@ -1,5 +1,5 @@
1
1
  /*
2
- * AGTree v4.0.3 (build date: Tue, 24 Mar 2026 15:29:20 GMT)
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.3 (build date: Tue, 24 Mar 2026 15:29:20 GMT)
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.3 (build date: Tue, 24 Mar 2026 15:29:20 GMT)
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.3 (build date: Tue, 24 Mar 2026 15:29:20 GMT)
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.3 (build date: Tue, 24 Mar 2026 15:29:20 GMT)
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.3 (build date: Tue, 24 Mar 2026 15:29:20 GMT)
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.3 (build date: Tue, 24 Mar 2026 15:29:20 GMT)
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.3 (build date: Tue, 24 Mar 2026 15:29:20 GMT)
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.3 (build date: Tue, 24 Mar 2026 15:29:20 GMT)
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.3 (build date: Tue, 24 Mar 2026 15:29:20 GMT)
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.3 (build date: Tue, 24 Mar 2026 15:29:20 GMT)
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.3 (build date: Tue, 24 Mar 2026 15:29:20 GMT)
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
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @file Path-in-domain converter helper.
3
+ */
4
+ import { type AnyCosmeticRule, type AnyRule } from '../../nodes/index.js';
5
+ import { type NodeConversionResult } from '../base-interfaces/conversion-result.js';
6
+ /**
7
+ * Converts path-in-domain syntax to $path modifier.
8
+ *
9
+ * Example: `example.org/path##.ad` → `[$path=/path]example.org##.ad`.
10
+ *
11
+ * @param rule Rule to check and convert.
12
+ *
13
+ * @returns Conversion result if path-in-domain syntax found, undefined otherwise.
14
+ *
15
+ * @throws RuleConversionError if conflicting $path modifier exists.
16
+ */
17
+ export declare function convertPathInDomainToModifier(rule: AnyCosmeticRule): NodeConversionResult<AnyRule> | undefined;
@@ -1,4 +1,4 @@
1
- export { ADG_SCRIPTLET_MASK, AGLINT_COMMAND_PREFIX, COMMA_DOMAIN_LIST_SEPARATOR, NEGATION_MARKER, HINT_MARKER, IF, INCLUDE, MODIFIERS_SEPARATOR, MODIFIER_ASSIGN_OPERATOR, PIPE_MODIFIER_SEPARATOR, NETWORK_RULE_EXCEPTION_MARKER, NETWORK_RULE_SEPARATOR, PREPROCESSOR_MARKER, SAFARI_CB_AFFINITY, UBO_SCRIPTLET_MASK, COMMA, PIPE, } from './constants.js';
1
+ export { ADG_SCRIPTLET_MASK, AGLINT_COMMAND_PREFIX, COMMA_DOMAIN_LIST_SEPARATOR, NEGATION_MARKER, HINT_MARKER, IF, INCLUDE, MODIFIERS_SEPARATOR, MODIFIER_ASSIGN_OPERATOR, PIPE_MODIFIER_SEPARATOR, NETWORK_RULE_EXCEPTION_MARKER, NETWORK_RULE_SEPARATOR, PREPROCESSOR_MARKER, SAFARI_CB_AFFINITY, UBO_SCRIPTLET_MASK, COMMA, SLASH, PIPE, } from './constants.js';
2
2
  export { AdblockSyntax } from './adblockers.js';
3
3
  export { getBitCount } from './bit-count.js';
4
4
  export { type ReadonlyRecord } from './types.js';
@@ -1,5 +1,5 @@
1
1
  /*
2
- * AGTree v4.0.3 (build date: Tue, 24 Mar 2026 15:29:20 GMT)
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.3 (build date: Tue, 24 Mar 2026 15:29:20 GMT)
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.3 (build date: Tue, 24 Mar 2026 15:29:20 GMT)
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.3 (build date: Tue, 24 Mar 2026 15:29:20 GMT)
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.3 (build date: Tue, 24 Mar 2026 15:29:20 GMT)
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.3 (build date: Tue, 24 Mar 2026 15:29:20 GMT)
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.3 (build date: Tue, 24 Mar 2026 15:29:20 GMT)
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.3 (build date: Tue, 24 Mar 2026 15:29:20 GMT)
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.3 (build date: Tue, 24 Mar 2026 15:29:20 GMT)
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