@adguard/agtree 3.4.3 → 4.0.0

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 (421) hide show
  1. package/dist/ast-utils/clone.js +2 -2
  2. package/dist/ast-utils/modifiers.js +2 -2
  3. package/dist/ast-utils/network-rules.js +2 -2
  4. package/dist/ast-utils/scriptlets.js +2 -2
  5. package/dist/common/abp-snippet-injection-body-common.js +2 -2
  6. package/dist/common/agent-common.js +2 -2
  7. package/dist/common/ubo-html-filtering-body-common.js +40 -0
  8. package/dist/common/ubo-selector-common.js +2 -2
  9. package/dist/compatibility-tables/base.js +2 -2
  10. package/dist/compatibility-tables/compatibility-table-data.js +2 -2
  11. package/dist/compatibility-tables/modifiers.js +2 -2
  12. package/dist/compatibility-tables/platforms.js +2 -2
  13. package/dist/compatibility-tables/redirects.js +2 -2
  14. package/dist/compatibility-tables/schemas/base.js +2 -2
  15. package/dist/compatibility-tables/schemas/modifier.js +2 -2
  16. package/dist/compatibility-tables/schemas/platform.js +2 -2
  17. package/dist/compatibility-tables/schemas/redirect.js +2 -2
  18. package/dist/compatibility-tables/schemas/resource-type.js +2 -2
  19. package/dist/compatibility-tables/schemas/scriptlet.js +2 -2
  20. package/dist/compatibility-tables/scriptlets.js +2 -2
  21. package/dist/compatibility-tables/utils/platform-helpers.js +2 -2
  22. package/dist/compatibility-tables/utils/resource-type-helpers.js +2 -2
  23. package/dist/compatibility-tables/utils/zod-camelcase.js +2 -2
  24. package/dist/converter/base-interfaces/base-converter.js +2 -2
  25. package/dist/converter/base-interfaces/conversion-result.js +2 -2
  26. package/dist/converter/base-interfaces/rule-converter-base.js +2 -2
  27. package/dist/converter/comment/index.js +2 -2
  28. package/dist/converter/cosmetic/css.js +2 -2
  29. package/dist/converter/cosmetic/element-hiding.js +2 -2
  30. package/dist/converter/cosmetic/header-removal.js +24 -42
  31. package/dist/converter/cosmetic/html.js +580 -438
  32. package/dist/converter/cosmetic/index.js +3 -2
  33. package/dist/converter/cosmetic/rule-modifiers/adg.js +2 -2
  34. package/dist/converter/cosmetic/rule-modifiers/ubo.js +2 -2
  35. package/dist/converter/cosmetic/scriptlet.js +2 -2
  36. package/dist/converter/css/index.js +3 -2
  37. package/dist/converter/data/css.js +32 -54
  38. package/dist/converter/filter-list.js +2 -2
  39. package/dist/converter/index.js +2 -2
  40. package/dist/converter/misc/network-rule-modifier.js +2 -2
  41. package/dist/converter/network/index.js +2 -2
  42. package/dist/converter/raw-filter-list.js +2 -2
  43. package/dist/converter/raw-rule.js +6 -3
  44. package/dist/converter/rule.js +2 -2
  45. package/dist/errors/adblock-syntax-error.js +2 -2
  46. package/dist/errors/binary-schema-mismatch-error.js +2 -2
  47. package/dist/errors/not-implemented-error.js +2 -2
  48. package/dist/errors/rule-conversion-error.js +2 -2
  49. package/dist/generator/base-generator.js +2 -2
  50. package/dist/generator/comment/agent-comment-generator.js +2 -2
  51. package/dist/generator/comment/agent-generator.js +2 -2
  52. package/dist/generator/comment/comment-rule-generator.js +2 -2
  53. package/dist/generator/comment/config-comment-generator.js +2 -2
  54. package/dist/generator/comment/hint-comment-generator.js +2 -2
  55. package/dist/generator/comment/hint-generator.js +2 -2
  56. package/dist/generator/comment/metadata-comment-generator.js +2 -2
  57. package/dist/generator/comment/pre-processor-comment-generator.js +2 -2
  58. package/dist/generator/comment/simple-comment-generator.js +2 -2
  59. package/dist/generator/cosmetic/cosmetic-rule-body-generator.js +21 -6
  60. package/dist/generator/cosmetic/cosmetic-rule-generator.js +2 -2
  61. package/dist/generator/cosmetic/cosmetic-rule-pattern-generator.js +2 -2
  62. package/dist/generator/cosmetic/html-filtering-body/adg-html-filtering-body-generator.js +38 -0
  63. package/dist/generator/cosmetic/html-filtering-body/html-filtering-body-generator.js +32 -0
  64. package/dist/generator/cosmetic/html-filtering-body/ubo-html-filtering-body-generator.js +65 -0
  65. package/dist/generator/cosmetic/{body → scriptlet-body}/abp-snippet-injection-body-generator.js +2 -2
  66. package/dist/generator/cosmetic/{body → scriptlet-body}/adg-scriptlet-injection-body-generator.js +2 -2
  67. package/dist/generator/cosmetic/{body → scriptlet-body}/ubo-scriptlet-injection-body-generator.js +2 -2
  68. package/dist/generator/cosmetic/selector/attribute-selector-generator.js +42 -0
  69. package/dist/generator/cosmetic/selector/class-selector-generator.js +26 -0
  70. package/dist/generator/cosmetic/selector/complex-selector-generator.js +71 -0
  71. package/dist/generator/cosmetic/selector/id-selector-generator.js +26 -0
  72. package/dist/generator/cosmetic/selector/pseudo-class-selector-generator.js +35 -0
  73. package/dist/generator/cosmetic/selector/selector-combinator-generator.js +30 -0
  74. package/dist/generator/cosmetic/selector/selector-list-generator.js +41 -0
  75. package/dist/generator/cosmetic/selector/type-selector-generator.js +25 -0
  76. package/dist/generator/css/adg-css-injection-generator.js +5 -6
  77. package/dist/generator/filterlist-generator.js +2 -2
  78. package/dist/generator/index.js +2 -2
  79. package/dist/generator/misc/domain-list-generator.js +2 -2
  80. package/dist/generator/misc/list-items-generator.js +2 -2
  81. package/dist/generator/misc/logical-expression-generator.js +2 -2
  82. package/dist/generator/misc/modifier-generator.js +2 -2
  83. package/dist/generator/misc/modifier-list-generator.js +2 -2
  84. package/dist/generator/misc/parameter-list-generator.js +2 -2
  85. package/dist/generator/misc/value-generator.js +2 -2
  86. package/dist/generator/network/host-rule-generator.js +2 -2
  87. package/dist/generator/network/network-rule-generator.js +2 -2
  88. package/dist/generator/rule-generator.js +2 -2
  89. package/dist/index.js +4 -14
  90. package/dist/nodes/index.js +2 -2
  91. package/dist/package.json.js +3 -3
  92. package/dist/parser/base-parser.js +2 -2
  93. package/dist/parser/comment/agent-comment-parser.js +2 -2
  94. package/dist/parser/comment/agent-parser.js +2 -2
  95. package/dist/parser/comment/comment-parser.js +2 -2
  96. package/dist/parser/comment/config-comment-parser.js +2 -2
  97. package/dist/parser/comment/hint-comment-parser.js +2 -2
  98. package/dist/parser/comment/hint-parser.js +2 -2
  99. package/dist/parser/comment/metadata-comment-parser.js +2 -2
  100. package/dist/parser/comment/preprocessor-parser.js +2 -2
  101. package/dist/parser/comment/simple-comment-parser.js +2 -2
  102. package/dist/parser/cosmetic/cosmetic-rule-parser.js +10 -21
  103. package/dist/parser/cosmetic/html-filtering-body/adg-html-filtering-body-parser.js +49 -0
  104. package/dist/parser/cosmetic/html-filtering-body/html-filtering-body-parser.js +70 -0
  105. package/dist/parser/cosmetic/html-filtering-body/ubo-html-filtering-body-parser.js +180 -0
  106. package/dist/parser/cosmetic/{body → scriptlet-body}/abp-snippet-injection-body-parser.js +2 -2
  107. package/dist/parser/cosmetic/{body → scriptlet-body}/adg-scriptlet-injection-body-parser.js +2 -2
  108. package/dist/parser/cosmetic/{body → scriptlet-body}/ubo-scriptlet-injection-body-parser.js +2 -2
  109. package/dist/parser/cosmetic/selector/handlers/attribute-selector-handler.js +206 -0
  110. package/dist/parser/cosmetic/selector/handlers/class-selector-handler.js +48 -0
  111. package/dist/parser/cosmetic/selector/handlers/complex-selector-handler.js +67 -0
  112. package/dist/parser/cosmetic/selector/handlers/compound-selector-handler.js +97 -0
  113. package/dist/parser/cosmetic/selector/handlers/id-selector-handler.js +42 -0
  114. package/dist/parser/cosmetic/selector/handlers/pseudo-class-selector-handler.js +128 -0
  115. package/dist/parser/cosmetic/selector/handlers/type-selector-handler.js +58 -0
  116. package/dist/parser/cosmetic/selector/selector-list-parser.js +164 -0
  117. package/dist/parser/css/adg-css-injection-parser.js +4 -5
  118. package/dist/parser/css/balancing.js +2 -2
  119. package/dist/parser/css/constants.js +2 -2
  120. package/dist/parser/css/css-token-stream.js +41 -4
  121. package/dist/parser/css/ubo-selector-parser.js +2 -2
  122. package/dist/parser/filterlist-parser.js +2 -2
  123. package/dist/parser/index.js +2 -2
  124. package/dist/parser/misc/app-list-parser.js +2 -2
  125. package/dist/parser/misc/domain-list-parser.js +2 -2
  126. package/dist/parser/misc/list-items-parser.js +2 -2
  127. package/dist/parser/misc/logical-expression-parser.js +2 -2
  128. package/dist/parser/misc/method-list-parser.js +2 -2
  129. package/dist/parser/misc/modifier-list.js +2 -2
  130. package/dist/parser/misc/modifier-parser.js +2 -2
  131. package/dist/parser/misc/parameter-list-parser.js +2 -2
  132. package/dist/parser/misc/stealth-option-list-parser.js +2 -2
  133. package/dist/parser/misc/ubo-parameter-list-parser.js +2 -2
  134. package/dist/parser/misc/value-parser.js +2 -2
  135. package/dist/parser/network/host-rule-parser.js +2 -2
  136. package/dist/parser/network/network-rule-parser.js +2 -2
  137. package/dist/parser/options.js +3 -2
  138. package/dist/parser/rule-parser.js +2 -2
  139. package/dist/types/common/ubo-html-filtering-body-common.d.ts +12 -0
  140. package/dist/types/compatibility-tables/compatibility-table-data.d.ts +3 -3
  141. package/dist/types/compatibility-tables/schemas/redirect.d.ts +1 -1
  142. package/dist/types/compatibility-tables/schemas/scriptlet.d.ts +2 -2
  143. package/dist/types/converter/cosmetic/html.d.ts +167 -42
  144. package/dist/types/converter/data/css.d.ts +18 -6
  145. package/dist/types/generator/cosmetic/html-filtering-body/adg-html-filtering-body-generator.d.ts +17 -0
  146. package/dist/types/generator/cosmetic/html-filtering-body/html-filtering-body-generator.d.ts +17 -0
  147. package/dist/types/generator/cosmetic/html-filtering-body/ubo-html-filtering-body-generator.d.ts +30 -0
  148. package/dist/types/generator/cosmetic/selector/attribute-selector-generator.d.ts +15 -0
  149. package/dist/types/generator/cosmetic/selector/class-selector-generator.d.ts +15 -0
  150. package/dist/types/generator/cosmetic/selector/complex-selector-generator.d.ts +17 -0
  151. package/dist/types/generator/cosmetic/selector/id-selector-generator.d.ts +15 -0
  152. package/dist/types/generator/cosmetic/selector/pseudo-class-selector-generator.d.ts +15 -0
  153. package/dist/types/generator/cosmetic/selector/selector-combinator-generator.d.ts +15 -0
  154. package/dist/types/generator/cosmetic/selector/selector-list-generator.d.ts +17 -0
  155. package/dist/types/generator/cosmetic/selector/type-selector-generator.d.ts +15 -0
  156. package/dist/types/generator/css/adg-css-injection-generator.d.ts +1 -1
  157. package/dist/types/index.d.ts +3 -13
  158. package/dist/types/nodes/index.d.ts +159 -3
  159. package/dist/types/parser/cosmetic/html-filtering-body/adg-html-filtering-body-parser.d.ts +35 -0
  160. package/dist/types/parser/cosmetic/html-filtering-body/html-filtering-body-parser.d.ts +39 -0
  161. package/dist/types/parser/cosmetic/html-filtering-body/ubo-html-filtering-body-parser.d.ts +63 -0
  162. package/dist/types/parser/cosmetic/selector/context.d.ts +42 -0
  163. package/dist/types/parser/cosmetic/selector/handlers/attribute-selector-handler.d.ts +35 -0
  164. package/dist/types/parser/cosmetic/selector/handlers/class-selector-handler.d.ts +15 -0
  165. package/dist/types/parser/cosmetic/selector/handlers/complex-selector-handler.d.ts +20 -0
  166. package/dist/types/parser/cosmetic/selector/handlers/compound-selector-handler.d.ts +25 -0
  167. package/dist/types/parser/cosmetic/selector/handlers/id-selector-handler.d.ts +15 -0
  168. package/dist/types/parser/cosmetic/selector/handlers/pseudo-class-selector-handler.d.ts +15 -0
  169. package/dist/types/parser/cosmetic/selector/handlers/type-selector-handler.d.ts +15 -0
  170. package/dist/types/parser/cosmetic/selector/selector-list-parser.d.ts +38 -0
  171. package/dist/types/parser/css/adg-css-injection-parser.d.ts +0 -2
  172. package/dist/types/parser/css/css-token-stream.d.ts +18 -0
  173. package/dist/types/parser/network/network-rule-parser.d.ts +1 -1
  174. package/dist/types/parser/options.d.ts +5 -0
  175. package/dist/types/utils/constants.d.ts +1 -0
  176. package/dist/types/utils/index.d.ts +0 -6
  177. package/dist/types/utils/quotes.d.ts +44 -0
  178. package/dist/types/utils/regexp.d.ts +24 -0
  179. package/dist/utils/adblockers.js +2 -2
  180. package/dist/utils/bit-count.js +2 -2
  181. package/dist/utils/categorizer.js +2 -2
  182. package/dist/utils/clone.js +2 -2
  183. package/dist/utils/constants.js +6 -9
  184. package/dist/utils/cosmetic-rule-separator.js +2 -2
  185. package/dist/utils/deep-freeze.js +2 -2
  186. package/dist/utils/domain.js +2 -2
  187. package/dist/utils/error.js +2 -2
  188. package/dist/utils/index.js +2 -8
  189. package/dist/utils/logical-expression.js +2 -2
  190. package/dist/utils/multi-value-map.js +2 -2
  191. package/dist/utils/noop-modifier.js +2 -2
  192. package/dist/utils/position-provider.js +2 -2
  193. package/dist/utils/quotes.js +163 -10
  194. package/dist/utils/regexp.js +31 -2
  195. package/dist/utils/string.js +2 -2
  196. package/dist/utils/type-guards.js +3 -13
  197. package/dist/validator/constants.js +2 -2
  198. package/dist/validator/helpers.js +2 -2
  199. package/dist/validator/index.js +2 -2
  200. package/dist/validator/value.js +2 -2
  201. package/dist/version.js +2 -2
  202. package/package.json +6 -14
  203. package/dist/deserializer/base-deserializer.js +0 -29
  204. package/dist/deserializer/comment/agent-comment-deserializer.js +0 -79
  205. package/dist/deserializer/comment/agent-deserializer.js +0 -65
  206. package/dist/deserializer/comment/comment-rule-deserializer.js +0 -54
  207. package/dist/deserializer/comment/config-comment-deserializer.js +0 -111
  208. package/dist/deserializer/comment/hint-comment-deserializer.js +0 -72
  209. package/dist/deserializer/comment/hint-deserializer.js +0 -85
  210. package/dist/deserializer/comment/metadata-comment-deserializer.js +0 -69
  211. package/dist/deserializer/comment/pre-processor-comment-deserializer.js +0 -112
  212. package/dist/deserializer/comment/simple-comment-deserializer.js +0 -65
  213. package/dist/deserializer/cosmetic/cosmetic-rule-deserializer.js +0 -131
  214. package/dist/deserializer/cosmetic/css-injection-body-deserializer.js +0 -56
  215. package/dist/deserializer/cosmetic/element-hiding-body-deserializer.js +0 -48
  216. package/dist/deserializer/cosmetic/scriptlet-body/abp-snippet-injection-body-deserializer.js +0 -39
  217. package/dist/deserializer/cosmetic/scriptlet-body/adg-scriptlet-injection-body-deserializer.js +0 -40
  218. package/dist/deserializer/cosmetic/scriptlet-body/scriptlet-body-deserializer.js +0 -54
  219. package/dist/deserializer/cosmetic/scriptlet-body/ubo-scriptlet-injection-body-deserializer.js +0 -38
  220. package/dist/deserializer/empty-rule-deserializer.js +0 -48
  221. package/dist/deserializer/filterlist-deserializer.js +0 -85
  222. package/dist/deserializer/index.js +0 -8
  223. package/dist/deserializer/invalid-rule-deserializer.js +0 -50
  224. package/dist/deserializer/invalid-rule-error-node-deserializer.js +0 -50
  225. package/dist/deserializer/misc/domain-list-deserializer.js +0 -64
  226. package/dist/deserializer/misc/list-item-deserializer.js +0 -69
  227. package/dist/deserializer/misc/list-items-deserializer.js +0 -30
  228. package/dist/deserializer/misc/logical-expression-deserializer.js +0 -196
  229. package/dist/deserializer/misc/modifier-deserializer.js +0 -87
  230. package/dist/deserializer/misc/modifier-list-deserializer.js +0 -61
  231. package/dist/deserializer/misc/parameter-list-deserializer.js +0 -64
  232. package/dist/deserializer/misc/value-deserializer.js +0 -50
  233. package/dist/deserializer/network/host-rule-deserializer.js +0 -67
  234. package/dist/deserializer/network/hostname-list-deserializer.js +0 -56
  235. package/dist/deserializer/network/network-rule-deserializer.js +0 -65
  236. package/dist/deserializer/rule-deserializer.js +0 -65
  237. package/dist/deserializer/syntax-deserialization-map.js +0 -21
  238. package/dist/marshalling-utils/comment/agent-comment-common.js +0 -21
  239. package/dist/marshalling-utils/comment/agent-common.js +0 -40
  240. package/dist/marshalling-utils/comment/config-comment-common.js +0 -54
  241. package/dist/marshalling-utils/comment/hint-comment-common.js +0 -22
  242. package/dist/marshalling-utils/comment/hint-common.js +0 -56
  243. package/dist/marshalling-utils/comment/metadata-comment-common.js +0 -41
  244. package/dist/marshalling-utils/comment/pre-processor-comment-common.js +0 -59
  245. package/dist/marshalling-utils/comment/simple-comment-common.js +0 -22
  246. package/dist/marshalling-utils/cosmetic/body/abp-snippet-injection-body-common.js +0 -61
  247. package/dist/marshalling-utils/cosmetic/body/adg-scriptlet-injection-body-common.js +0 -66
  248. package/dist/marshalling-utils/cosmetic/body/css-injection-body-common.js +0 -24
  249. package/dist/marshalling-utils/cosmetic/body/element-hiding-body-common.js +0 -21
  250. package/dist/marshalling-utils/cosmetic/body/ubo-scriptlet-injection-body-common.js +0 -114
  251. package/dist/marshalling-utils/cosmetic/cosmetic-rule-common.js +0 -46
  252. package/dist/marshalling-utils/empty-rule-common.js +0 -20
  253. package/dist/marshalling-utils/filter-list-common.js +0 -21
  254. package/dist/marshalling-utils/invalid-rule-common.js +0 -21
  255. package/dist/marshalling-utils/invalid-rule-error-node-common.js +0 -22
  256. package/dist/marshalling-utils/misc/binary-type-common.js +0 -54
  257. package/dist/marshalling-utils/misc/domain-list-common.js +0 -36
  258. package/dist/marshalling-utils/misc/host-rule-common.js +0 -24
  259. package/dist/marshalling-utils/misc/hostname-list-common.js +0 -21
  260. package/dist/marshalling-utils/misc/list-item-common.js +0 -22
  261. package/dist/marshalling-utils/misc/logical-expression-common.js +0 -83
  262. package/dist/marshalling-utils/misc/modifier-common.js +0 -231
  263. package/dist/marshalling-utils/misc/modifier-list-common.js +0 -21
  264. package/dist/marshalling-utils/misc/parameter-list-common.js +0 -21
  265. package/dist/marshalling-utils/misc/value-common.js +0 -22
  266. package/dist/marshalling-utils/network/network-rule-common.js +0 -24
  267. package/dist/marshalling-utils/syntax-serialization-map.js +0 -30
  268. package/dist/serializer/base-serializer.js +0 -29
  269. package/dist/serializer/comment/agent-comment-serializer.js +0 -74
  270. package/dist/serializer/comment/agent-serializer.js +0 -59
  271. package/dist/serializer/comment/comment-rule-serializer.js +0 -105
  272. package/dist/serializer/comment/config-comment-serializer.js +0 -82
  273. package/dist/serializer/comment/hint-comment-serializer.js +0 -65
  274. package/dist/serializer/comment/hint-serializer.js +0 -54
  275. package/dist/serializer/comment/metadata-comment-serializer.js +0 -73
  276. package/dist/serializer/comment/pre-processor-comment-serializer.js +0 -71
  277. package/dist/serializer/comment/simple-comment-serializer.js +0 -52
  278. package/dist/serializer/cosmetic/body/abp-snippet-injection-body-serializer.js +0 -36
  279. package/dist/serializer/cosmetic/body/adg-scriptlet-injection-body-serializer.js +0 -36
  280. package/dist/serializer/cosmetic/body/scriptlet-body-serializer.js +0 -50
  281. package/dist/serializer/cosmetic/body/ubo-scriptlet-injection-body-serializer.js +0 -36
  282. package/dist/serializer/cosmetic/cosmetic-rule-serializer.js +0 -120
  283. package/dist/serializer/cosmetic/css-injection-body-serializer.js +0 -51
  284. package/dist/serializer/cosmetic/element-hiding-body-serializer.js +0 -40
  285. package/dist/serializer/empty-rule-serializer.js +0 -37
  286. package/dist/serializer/filterlist-serializer.js +0 -45
  287. package/dist/serializer/index.js +0 -7
  288. package/dist/serializer/invalid-rule-error-node-serializer.js +0 -41
  289. package/dist/serializer/invalid-rule-serializer.js +0 -40
  290. package/dist/serializer/misc/domain-list-serializer.js +0 -64
  291. package/dist/serializer/misc/list-item-serializer.js +0 -58
  292. package/dist/serializer/misc/list-items-serializer.js +0 -29
  293. package/dist/serializer/misc/logical-expression-serializer.js +0 -136
  294. package/dist/serializer/misc/modifier-list-serializer.js +0 -58
  295. package/dist/serializer/misc/modifier-serializer.js +0 -49
  296. package/dist/serializer/misc/parameter-list-serializer.js +0 -52
  297. package/dist/serializer/misc/value-serializer.js +0 -50
  298. package/dist/serializer/network/host-rule-serializer.js +0 -70
  299. package/dist/serializer/network/hostname-list-serializer.js +0 -53
  300. package/dist/serializer/network/network-rule-serializer.js +0 -54
  301. package/dist/serializer/rule-serializer.js +0 -61
  302. package/dist/types/deserializer/base-deserializer.d.ts +0 -15
  303. package/dist/types/deserializer/comment/agent-comment-deserializer.d.ts +0 -34
  304. package/dist/types/deserializer/comment/agent-deserializer.d.ts +0 -25
  305. package/dist/types/deserializer/comment/comment-rule-deserializer.d.ts +0 -16
  306. package/dist/types/deserializer/comment/config-comment-deserializer.d.ts +0 -27
  307. package/dist/types/deserializer/comment/hint-comment-deserializer.d.ts +0 -24
  308. package/dist/types/deserializer/comment/hint-deserializer.d.ts +0 -26
  309. package/dist/types/deserializer/comment/metadata-comment-deserializer.d.ts +0 -26
  310. package/dist/types/deserializer/comment/pre-processor-comment-deserializer.d.ts +0 -29
  311. package/dist/types/deserializer/comment/simple-comment-deserializer.d.ts +0 -26
  312. package/dist/types/deserializer/cosmetic/cosmetic-rule-deserializer.d.ts +0 -18
  313. package/dist/types/deserializer/cosmetic/css-injection-body-deserializer.d.ts +0 -15
  314. package/dist/types/deserializer/cosmetic/element-hiding-body-deserializer.d.ts +0 -16
  315. package/dist/types/deserializer/cosmetic/scriptlet-body/abp-snippet-injection-body-deserializer.d.ts +0 -17
  316. package/dist/types/deserializer/cosmetic/scriptlet-body/adg-scriptlet-injection-body-deserializer.d.ts +0 -18
  317. package/dist/types/deserializer/cosmetic/scriptlet-body/scriptlet-body-deserializer.d.ts +0 -19
  318. package/dist/types/deserializer/cosmetic/scriptlet-body/ubo-scriptlet-injection-body-deserializer.d.ts +0 -17
  319. package/dist/types/deserializer/empty-rule-deserializer.d.ts +0 -16
  320. package/dist/types/deserializer/filterlist-deserializer.d.ts +0 -34
  321. package/dist/types/deserializer/index.d.ts +0 -2
  322. package/dist/types/deserializer/invalid-rule-deserializer.d.ts +0 -16
  323. package/dist/types/deserializer/invalid-rule-error-node-deserializer.d.ts +0 -16
  324. package/dist/types/deserializer/misc/domain-list-deserializer.d.ts +0 -15
  325. package/dist/types/deserializer/misc/list-item-deserializer.d.ts +0 -19
  326. package/dist/types/deserializer/misc/list-items-deserializer.d.ts +0 -16
  327. package/dist/types/deserializer/misc/logical-expression-deserializer.d.ts +0 -55
  328. package/dist/types/deserializer/misc/modifier-deserializer.d.ts +0 -18
  329. package/dist/types/deserializer/misc/modifier-list-deserializer.d.ts +0 -20
  330. package/dist/types/deserializer/misc/parameter-list-deserializer.d.ts +0 -18
  331. package/dist/types/deserializer/misc/value-deserializer.d.ts +0 -17
  332. package/dist/types/deserializer/network/host-rule-deserializer.d.ts +0 -18
  333. package/dist/types/deserializer/network/hostname-list-deserializer.d.ts +0 -15
  334. package/dist/types/deserializer/network/network-rule-deserializer.d.ts +0 -18
  335. package/dist/types/deserializer/rule-deserializer.d.ts +0 -17
  336. package/dist/types/deserializer/syntax-deserialization-map.d.ts +0 -2
  337. package/dist/types/marshalling-utils/comment/agent-comment-common.d.ts +0 -14
  338. package/dist/types/marshalling-utils/comment/agent-common.d.ts +0 -20
  339. package/dist/types/marshalling-utils/comment/config-comment-common.d.ts +0 -42
  340. package/dist/types/marshalling-utils/comment/hint-comment-common.d.ts +0 -15
  341. package/dist/types/marshalling-utils/comment/hint-common.d.ts +0 -33
  342. package/dist/types/marshalling-utils/comment/metadata-comment-common.d.ts +0 -21
  343. package/dist/types/marshalling-utils/comment/pre-processor-comment-common.d.ts +0 -37
  344. package/dist/types/marshalling-utils/comment/simple-comment-common.d.ts +0 -15
  345. package/dist/types/marshalling-utils/cosmetic/body/abp-snippet-injection-body-common.d.ts +0 -23
  346. package/dist/types/marshalling-utils/cosmetic/body/adg-scriptlet-injection-body-common.d.ts +0 -9
  347. package/dist/types/marshalling-utils/cosmetic/body/css-injection-body-common.d.ts +0 -17
  348. package/dist/types/marshalling-utils/cosmetic/body/element-hiding-body-common.d.ts +0 -14
  349. package/dist/types/marshalling-utils/cosmetic/body/ubo-scriptlet-injection-body-common.d.ts +0 -9
  350. package/dist/types/marshalling-utils/cosmetic/cosmetic-rule-common.d.ts +0 -28
  351. package/dist/types/marshalling-utils/empty-rule-common.d.ts +0 -13
  352. package/dist/types/marshalling-utils/filter-list-common.d.ts +0 -14
  353. package/dist/types/marshalling-utils/invalid-rule-common.d.ts +0 -14
  354. package/dist/types/marshalling-utils/invalid-rule-error-node-common.d.ts +0 -15
  355. package/dist/types/marshalling-utils/misc/binary-type-common.d.ts +0 -57
  356. package/dist/types/marshalling-utils/misc/domain-list-common.d.ts +0 -24
  357. package/dist/types/marshalling-utils/misc/host-rule-common.d.ts +0 -18
  358. package/dist/types/marshalling-utils/misc/hostname-list-common.d.ts +0 -14
  359. package/dist/types/marshalling-utils/misc/list-item-common.d.ts +0 -15
  360. package/dist/types/marshalling-utils/misc/logical-expression-common.d.ts +0 -47
  361. package/dist/types/marshalling-utils/misc/modifier-common.d.ts +0 -41
  362. package/dist/types/marshalling-utils/misc/modifier-list-common.d.ts +0 -14
  363. package/dist/types/marshalling-utils/misc/parameter-list-common.d.ts +0 -14
  364. package/dist/types/marshalling-utils/misc/value-common.d.ts +0 -15
  365. package/dist/types/marshalling-utils/network/network-rule-common.d.ts +0 -18
  366. package/dist/types/marshalling-utils/syntax-serialization-map.d.ts +0 -2
  367. package/dist/types/serializer/base-serializer.d.ts +0 -15
  368. package/dist/types/serializer/comment/agent-comment-serializer.d.ts +0 -34
  369. package/dist/types/serializer/comment/agent-serializer.d.ts +0 -15
  370. package/dist/types/serializer/comment/comment-rule-serializer.d.ts +0 -68
  371. package/dist/types/serializer/comment/config-comment-serializer.d.ts +0 -25
  372. package/dist/types/serializer/comment/hint-comment-serializer.d.ts +0 -23
  373. package/dist/types/serializer/comment/hint-serializer.d.ts +0 -24
  374. package/dist/types/serializer/comment/metadata-comment-serializer.d.ts +0 -25
  375. package/dist/types/serializer/comment/pre-processor-comment-serializer.d.ts +0 -28
  376. package/dist/types/serializer/comment/simple-comment-serializer.d.ts +0 -24
  377. package/dist/types/serializer/cosmetic/body/abp-snippet-injection-body-serializer.d.ts +0 -25
  378. package/dist/types/serializer/cosmetic/body/adg-scriptlet-injection-body-serializer.d.ts +0 -25
  379. package/dist/types/serializer/cosmetic/body/scriptlet-body-serializer.d.ts +0 -17
  380. package/dist/types/serializer/cosmetic/body/ubo-scriptlet-injection-body-serializer.d.ts +0 -25
  381. package/dist/types/serializer/cosmetic/cosmetic-rule-serializer.d.ts +0 -19
  382. package/dist/types/serializer/cosmetic/css-injection-body-serializer.d.ts +0 -15
  383. package/dist/types/serializer/cosmetic/element-hiding-body-serializer.d.ts +0 -15
  384. package/dist/types/serializer/empty-rule-serializer.d.ts +0 -15
  385. package/dist/types/serializer/filterlist-serializer.d.ts +0 -15
  386. package/dist/types/serializer/index.d.ts +0 -1
  387. package/dist/types/serializer/invalid-rule-error-node-serializer.d.ts +0 -15
  388. package/dist/types/serializer/invalid-rule-serializer.d.ts +0 -15
  389. package/dist/types/serializer/misc/domain-list-serializer.d.ts +0 -21
  390. package/dist/types/serializer/misc/list-item-serializer.d.ts +0 -16
  391. package/dist/types/serializer/misc/list-items-serializer.d.ts +0 -15
  392. package/dist/types/serializer/misc/logical-expression-serializer.d.ts +0 -52
  393. package/dist/types/serializer/misc/modifier-list-serializer.d.ts +0 -20
  394. package/dist/types/serializer/misc/modifier-serializer.d.ts +0 -18
  395. package/dist/types/serializer/misc/parameter-list-serializer.d.ts +0 -17
  396. package/dist/types/serializer/misc/value-serializer.d.ts +0 -17
  397. package/dist/types/serializer/network/host-rule-serializer.d.ts +0 -30
  398. package/dist/types/serializer/network/hostname-list-serializer.d.ts +0 -15
  399. package/dist/types/serializer/network/network-rule-serializer.d.ts +0 -18
  400. package/dist/types/serializer/rule-serializer.d.ts +0 -17
  401. package/dist/types/utils/binary-schema-version.d.ts +0 -9
  402. package/dist/types/utils/byte-buffer.d.ts +0 -54
  403. package/dist/types/utils/input-byte-buffer.d.ts +0 -146
  404. package/dist/types/utils/is-chromium.d.ts +0 -7
  405. package/dist/types/utils/output-byte-buffer.d.ts +0 -132
  406. package/dist/types/utils/storage-interface.d.ts +0 -23
  407. package/dist/types/utils/text-decoder-polyfill.d.ts +0 -14
  408. package/dist/types/utils/text-encoder-polyfill.d.ts +0 -18
  409. package/dist/utils/binary-schema-version.js +0 -17
  410. package/dist/utils/byte-buffer.js +0 -91
  411. package/dist/utils/input-byte-buffer.js +0 -266
  412. package/dist/utils/is-chromium.js +0 -20
  413. package/dist/utils/output-byte-buffer.js +0 -231
  414. package/dist/utils/text-decoder-polyfill.js +0 -107
  415. package/dist/utils/text-encoder-polyfill.js +0 -78
  416. /package/dist/types/generator/cosmetic/{body → scriptlet-body}/abp-snippet-injection-body-generator.d.ts +0 -0
  417. /package/dist/types/generator/cosmetic/{body → scriptlet-body}/adg-scriptlet-injection-body-generator.d.ts +0 -0
  418. /package/dist/types/generator/cosmetic/{body → scriptlet-body}/ubo-scriptlet-injection-body-generator.d.ts +0 -0
  419. /package/dist/types/parser/cosmetic/{body → scriptlet-body}/abp-snippet-injection-body-parser.d.ts +0 -0
  420. /package/dist/types/parser/cosmetic/{body → scriptlet-body}/adg-scriptlet-injection-body-parser.d.ts +0 -0
  421. /package/dist/types/parser/cosmetic/{body → scriptlet-body}/ubo-scriptlet-injection-body-parser.d.ts +0 -0
@@ -1,231 +0,0 @@
1
- /*
2
- * AGTree v3.4.3 (build date: Thu, 11 Dec 2025 13:43:19 GMT)
3
- * (c) 2025 Adguard Software Ltd.
4
- * Released under the MIT license
5
- * https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
6
- */
7
- /**
8
- * Property map for binary serialization. This helps to reduce the size of the serialized data,
9
- * as it allows us to use a single byte to represent a property.
10
- *
11
- * ! IMPORTANT: If you change values here, please update the {@link BINARY_SCHEMA_VERSION}!
12
- *
13
- * @note Only 256 values can be represented this way.
14
- */
15
- const ModifierNodeMarshallingMap = {
16
- Name: 1,
17
- Value: 2,
18
- Exception: 3,
19
- Start: 4,
20
- End: 5,
21
- };
22
- /**
23
- * Value map for binary serialization. This helps to reduce the size of the serialized data,
24
- * as it allows us to use a single byte to represent frequently used values.
25
- *
26
- * ! IMPORTANT: If you change values here, please update the {@link BINARY_SCHEMA_VERSION}!
27
- *
28
- * @note Only 256 values can be represented this way.
29
- */
30
- const FREQUENT_MODIFIERS_SERIALIZATION_MAP = new Map([
31
- ['_', 0],
32
- ['all', 1],
33
- ['app', 2],
34
- ['badfilter', 3],
35
- ['cname', 4],
36
- ['content', 5],
37
- ['cookie', 6],
38
- ['csp', 7],
39
- ['denyallow', 8],
40
- ['document', 9],
41
- ['doc', 10],
42
- ['domain', 11],
43
- ['from', 12],
44
- ['elemhide', 13],
45
- ['ehide', 14],
46
- ['empty', 15],
47
- ['first-party', 16],
48
- ['1p', 17],
49
- ['extension', 18],
50
- ['font', 19],
51
- ['genericblock', 20],
52
- ['generichide', 21],
53
- ['ghide', 22],
54
- ['header', 23],
55
- ['hls', 24],
56
- ['image', 25],
57
- ['important', 26],
58
- ['inline-font', 27],
59
- ['inline-script', 28],
60
- ['jsinject', 29],
61
- ['jsonprune', 30],
62
- ['match-case', 31],
63
- ['media', 32],
64
- ['method', 33],
65
- ['mp4', 34],
66
- ['network', 35],
67
- ['object-subrequest', 36],
68
- ['object', 37],
69
- ['other', 38],
70
- ['permissions', 39],
71
- ['ping', 40],
72
- ['popunder', 41],
73
- ['popup', 42],
74
- ['redirect-rule', 43],
75
- ['redirect', 44],
76
- ['rewrite', 45],
77
- ['referrerpolicy', 46],
78
- ['removeheader', 47],
79
- ['removeparam', 48],
80
- ['replace', 49],
81
- ['script', 50],
82
- ['specifichide', 51],
83
- ['shide', 52],
84
- ['stealth', 53],
85
- ['strict1p', 54],
86
- ['strict3p', 55],
87
- ['stylesheet', 56],
88
- ['css', 57],
89
- ['subdocument', 58],
90
- ['frame', 59],
91
- ['third-party', 60],
92
- ['3p', 61],
93
- ['to', 62],
94
- ['urlblock', 63],
95
- ['webrtc', 64],
96
- ['websocket', 65],
97
- ['xmlhttprequest', 66],
98
- ['xhr', 67],
99
- // TODO: add new modifiers here
100
- ]);
101
- /**
102
- * Value map for binary serialization. This helps to reduce the size of the serialized data,
103
- * as it allows us to use a single byte to represent frequently used values.
104
- *
105
- * ! IMPORTANT: If you change values here, please update the binary schema version
106
- *
107
- * @note Only 256 values can be represented this way.
108
- */
109
- const FREQUENT_REDIRECT_VALUES_SERIALIZATION_MAP = new Map([
110
- // AdGuard
111
- ['1x1-transparent.gif', 0],
112
- ['2x2-transparent.png', 1],
113
- ['3x2-transparent.png', 2],
114
- ['32x32-transparent.png', 3],
115
- ['amazon-apstag', 4],
116
- ['ati-smarttag', 5],
117
- ['didomi-loader', 6],
118
- ['click2load.html', 7],
119
- ['fingerprintjs2', 8],
120
- ['fingerprintjs3', 9],
121
- ['google-analytics', 10],
122
- ['google-analytics-ga', 11],
123
- ['googlesyndication-adsbygoogle', 12],
124
- ['googlesyndication-adsbygoogle', 13],
125
- ['googletagmanager-gtm', 14],
126
- ['googletagmanager-gtm', 15],
127
- ['googletagservices-gpt', 16],
128
- ['google-ima3', 17],
129
- ['gemius', 18],
130
- ['matomo', 19],
131
- ['metrika-yandex-watch', 20],
132
- ['metrika-yandex-tag', 21],
133
- ['naver-wcslog', 22],
134
- ['noeval', 23],
135
- ['noopcss', 24],
136
- ['noopframe', 25],
137
- ['noopjs', 26],
138
- ['noopjson', 27],
139
- ['nooptext', 28],
140
- ['noopmp3-0.1s', 29],
141
- ['noopmp4-1s', 30],
142
- ['noopvmap-1.0', 31],
143
- ['noopvast-2.0', 32],
144
- ['noopvast-3.0', 33],
145
- ['noopvast-4.0', 34],
146
- ['prebid', 35],
147
- ['pardot-1.0', 36],
148
- ['prevent-bab', 37],
149
- ['prevent-bab2', 38],
150
- ['prevent-fab-3.2.0', 39],
151
- ['prevent-fab-3.2.0', 40],
152
- ['prevent-popads-net', 41],
153
- ['scorecardresearch-beacon', 42],
154
- ['set-popads-dummy', 43],
155
- ['empty', 44],
156
- ['prebid-ads', 45],
157
- // empty slots for future use
158
- // uBlock Origin
159
- ['1x1.gif', 60],
160
- ['2x2.png', 61],
161
- ['3x2.png', 62],
162
- ['32x32.png', 63],
163
- ['amazon_apstag.js', 64],
164
- ['click2load.html', 65],
165
- ['fingerprint2.js', 66],
166
- ['fingerprint3.js', 67],
167
- ['google-analytics_analytics.js', 68],
168
- ['google-analytics_ga.js', 69],
169
- ['googlesyndication_adsbygoogle.js', 70],
170
- ['googlesyndication.com/adsbygoogle.js', 71],
171
- ['google-analytics_ga.js', 72],
172
- ['googletagmanager_gtm.js', 73],
173
- ['googletagservices_gpt.js', 74],
174
- ['google-ima.js', 75],
175
- ['noeval-silent.js', 76],
176
- ['noop.css', 77],
177
- ['noop.html', 78],
178
- ['noop.js', 79],
179
- ['noop.json', 80],
180
- ['noop.txt', 81],
181
- ['noop-0.1s.mp3', 82],
182
- ['noop-1s.mp4', 83],
183
- ['noop-vmap1.0.xml', 84],
184
- ['nobab.js', 85],
185
- ['nobab2.js', 86],
186
- ['nofab.js', 87],
187
- ['fuckadblock.js-3.2.0', 88],
188
- ['popads.js', 89],
189
- ['scorecardresearch_beacon.js', 90],
190
- ['popads-dummy.js', 91],
191
- ['empty', 92],
192
- ['prebid-ads.js', 93],
193
- // empty slots for future use
194
- // Adblock Plus
195
- ['1x1-transparent-gif', 105],
196
- ['2x2-transparent-png', 106],
197
- ['3x2-transparent-png', 107],
198
- ['32x32-transparent-png', 108],
199
- ['blank-css', 109],
200
- ['blank-html', 110],
201
- ['blank-js', 111],
202
- ['blank-text', 112],
203
- ['blank-mp3', 113],
204
- ['blank-mp4', 114],
205
- // empty slots for future use
206
- ['abp-resource:1x1-transparent-gif', 120],
207
- ['abp-resource:2x2-transparent-png', 121],
208
- ['abp-resource:3x2-transparent-png', 122],
209
- ['abp-resource:32x32-transparent-png', 123],
210
- ['abp-resource:blank-css', 124],
211
- ['abp-resource:blank-html', 125],
212
- ['abp-resource:blank-js', 126],
213
- ['abp-resource:blank-text', 127],
214
- ['abp-resource:blank-mp3', 128],
215
- ['abp-resource:blank-mp4', 129],
216
- // TODO: add other common values
217
- ]);
218
- /**
219
- * Value map for binary serialization. This helps to reduce the size of the serialized data,
220
- * as it allows us to use a single byte to represent frequently used values.
221
- *
222
- * @note This is a special map which allows us to use different value maps for different modifiers.
223
- */
224
- const FREQUENT_REDIRECT_MODIFIERS_SERIALIZATION_MAP = new Map([
225
- ['redirect', FREQUENT_REDIRECT_VALUES_SERIALIZATION_MAP],
226
- ['redirect-rule', FREQUENT_REDIRECT_VALUES_SERIALIZATION_MAP],
227
- ['rewrite', FREQUENT_REDIRECT_VALUES_SERIALIZATION_MAP],
228
- // TODO: Add other modifiers here
229
- ]);
230
-
231
- export { FREQUENT_MODIFIERS_SERIALIZATION_MAP, FREQUENT_REDIRECT_MODIFIERS_SERIALIZATION_MAP, FREQUENT_REDIRECT_VALUES_SERIALIZATION_MAP, ModifierNodeMarshallingMap };
@@ -1,21 +0,0 @@
1
- /*
2
- * AGTree v3.4.3 (build date: Thu, 11 Dec 2025 13:43:19 GMT)
3
- * (c) 2025 Adguard Software Ltd.
4
- * Released under the MIT license
5
- * https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
6
- */
7
- /**
8
- * Property map for binary serialization. This helps to reduce the size of the serialized data,
9
- * as it allows us to use a single byte to represent a property.
10
- *
11
- * ! IMPORTANT: If you change values here, please update the {@link BINARY_SCHEMA_VERSION}!
12
- *
13
- * @note Only 256 values can be represented this way.
14
- */
15
- const ModifierListNodeMarshallingMap = {
16
- Children: 1,
17
- Start: 2,
18
- End: 3,
19
- };
20
-
21
- export { ModifierListNodeMarshallingMap };
@@ -1,21 +0,0 @@
1
- /*
2
- * AGTree v3.4.3 (build date: Thu, 11 Dec 2025 13:43:19 GMT)
3
- * (c) 2025 Adguard Software Ltd.
4
- * Released under the MIT license
5
- * https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
6
- */
7
- /**
8
- * Property map for binary serialization. This helps to reduce the size of the serialized data,
9
- * as it allows us to use a single byte to represent a property.
10
- *
11
- * ! IMPORTANT: If you change values here, please update the {@link BINARY_SCHEMA_VERSION}!
12
- *
13
- * @note Only 256 values can be represented this way.
14
- */
15
- const ParameterListNodeMarshallingMap = {
16
- Children: 1,
17
- Start: 2,
18
- End: 3,
19
- };
20
-
21
- export { ParameterListNodeMarshallingMap };
@@ -1,22 +0,0 @@
1
- /*
2
- * AGTree v3.4.3 (build date: Thu, 11 Dec 2025 13:43:19 GMT)
3
- * (c) 2025 Adguard Software Ltd.
4
- * Released under the MIT license
5
- * https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
6
- */
7
- /**
8
- * Property map for binary serialization. This helps to reduce the size of the serialized data,
9
- * as it allows us to use a single byte to represent a property.
10
- *
11
- * ! IMPORTANT: If you change values here, please update the {@link BINARY_SCHEMA_VERSION}!
12
- *
13
- * @note Only 256 values can be represented this way.
14
- */
15
- const ValueNodeMarshallingMap = {
16
- Value: 1,
17
- FrequentValue: 2,
18
- Start: 3,
19
- End: 4,
20
- };
21
-
22
- export { ValueNodeMarshallingMap };
@@ -1,24 +0,0 @@
1
- /*
2
- * AGTree v3.4.3 (build date: Thu, 11 Dec 2025 13:43:19 GMT)
3
- * (c) 2025 Adguard Software Ltd.
4
- * Released under the MIT license
5
- * https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
6
- */
7
- /**
8
- * Property map for binary serialization. This helps to reduce the size of the serialized data,
9
- * as it allows us to use a single byte to represent a property.
10
- *
11
- * ! IMPORTANT: If you change values here, please update the {@link BINARY_SCHEMA_VERSION}!
12
- *
13
- * @note Only 256 values can be represented this way.
14
- */
15
- const NetworkRuleMarshallingMap = {
16
- Syntax: 1,
17
- Exception: 3,
18
- Pattern: 4,
19
- ModifierList: 5,
20
- Start: 6,
21
- End: 7,
22
- };
23
-
24
- export { NetworkRuleMarshallingMap };
@@ -1,30 +0,0 @@
1
- /*
2
- * AGTree v3.4.3 (build date: Thu, 11 Dec 2025 13:43:19 GMT)
3
- * (c) 2025 Adguard Software Ltd.
4
- * Released under the MIT license
5
- * https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
6
- */
7
- import { AdblockSyntax } from '../utils/adblockers.js';
8
-
9
- /**
10
- * Value map for binary serialization. This helps to reduce the size of the serialized data,
11
- * as it allows us to use a single byte to represent frequently used values.
12
- *
13
- * ! IMPORTANT: If you change values here, please update the {@link BINARY_SCHEMA_VERSION}!
14
- *
15
- * @note Only 256 values can be represented this way.
16
- */
17
- let syntaxSerializationMap;
18
- const getSyntaxSerializationMap = () => {
19
- if (!syntaxSerializationMap) {
20
- syntaxSerializationMap = new Map([
21
- [AdblockSyntax.Common, 0],
22
- [AdblockSyntax.Abp, 1],
23
- [AdblockSyntax.Adg, 2],
24
- [AdblockSyntax.Ubo, 3],
25
- ]);
26
- }
27
- return syntaxSerializationMap;
28
- };
29
-
30
- export { getSyntaxSerializationMap };
@@ -1,29 +0,0 @@
1
- /*
2
- * AGTree v3.4.3 (build date: Thu, 11 Dec 2025 13:43:19 GMT)
3
- * (c) 2025 Adguard Software Ltd.
4
- * Released under the MIT license
5
- * https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
6
- */
7
- import { NotImplementedError } from '../errors/not-implemented-error.js';
8
-
9
- /**
10
- * @file Base serializer class.
11
- */
12
- /**
13
- * Base class for serializers. Each serializer should extend this class.
14
- */
15
- class BaseSerializer {
16
- /**
17
- * Serializes the AST node to a byte buffer.
18
- *
19
- * @param node AST node to serialize.
20
- * @param buffer Output byte buffer to write to.
21
- * @param args Additional, parser-specific arguments, if needed.
22
- */
23
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
24
- static serialize(node, buffer, ...args) {
25
- throw new NotImplementedError();
26
- }
27
- }
28
-
29
- export { BaseSerializer };
@@ -1,74 +0,0 @@
1
- /*
2
- * AGTree v3.4.3 (build date: Thu, 11 Dec 2025 13:43:19 GMT)
3
- * (c) 2025 Adguard Software Ltd.
4
- * Released under the MIT license
5
- * https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
6
- */
7
- import { UINT8_MAX, NULL } from '../../utils/constants.js';
8
- import { AgentSerializer } from './agent-serializer.js';
9
- import { isUndefined } from '../../utils/type-guards.js';
10
- import { BaseSerializer } from '../base-serializer.js';
11
- import { AgentCommentMarshallingMap } from '../../marshalling-utils/comment/agent-comment-common.js';
12
- import { BinaryTypeMarshallingMap } from '../../marshalling-utils/misc/binary-type-common.js';
13
-
14
- /**
15
- * `AgentCommentSerializer` is responsible for serializing an Adblock agent comments.
16
- * Adblock agent comment marks that the filter list is supposed to
17
- * be used by the specified ad blockers.
18
- *
19
- * @example
20
- * - ```adblock
21
- * [AdGuard]
22
- * ```
23
- * - ```adblock
24
- * [Adblock Plus 2.0]
25
- * ```
26
- * - ```adblock
27
- * [uBlock Origin]
28
- * ```
29
- * - ```adblock
30
- * [uBlock Origin 1.45.3]
31
- * ```
32
- * - ```adblock
33
- * [Adblock Plus 2.0; AdGuard]
34
- * ```
35
- */
36
- class AgentCommentSerializer extends BaseSerializer {
37
- /**
38
- * Serializes an adblock agent list node to binary format.
39
- *
40
- * @param node Node to serialize.
41
- * @param buffer ByteBuffer for writing binary data.
42
- */
43
- // TODO: add support for raws, if ever needed
44
- static serialize(node, buffer) {
45
- buffer.writeUint8(BinaryTypeMarshallingMap.AgentRuleNode);
46
- const count = node.children.length;
47
- // If there are no children, we do not write any data related to them, to avoid using unnecessary storage,
48
- // but children is a required field, so during deserialization we should initialize it as an empty array,
49
- // if there are no children in the binary data.
50
- if (count) {
51
- buffer.writeUint8(AgentCommentMarshallingMap.Children);
52
- // note: we store the count, because re-construction of the array is faster if we know the length
53
- // 8 bits is more than enough here
54
- if (count > UINT8_MAX) {
55
- throw new Error(`Too many children: ${count}, the limit is ${UINT8_MAX}`);
56
- }
57
- buffer.writeUint8(count);
58
- for (let i = 0; i < count; i += 1) {
59
- AgentSerializer.serialize(node.children[i], buffer);
60
- }
61
- }
62
- if (!isUndefined(node.start)) {
63
- buffer.writeUint8(AgentCommentMarshallingMap.Start);
64
- buffer.writeUint32(node.start);
65
- }
66
- if (!isUndefined(node.end)) {
67
- buffer.writeUint8(AgentCommentMarshallingMap.End);
68
- buffer.writeUint32(node.end);
69
- }
70
- buffer.writeUint8(NULL);
71
- }
72
- }
73
-
74
- export { AgentCommentSerializer };
@@ -1,59 +0,0 @@
1
- /*
2
- * AGTree v3.4.3 (build date: Thu, 11 Dec 2025 13:43:19 GMT)
3
- * (c) 2025 Adguard Software Ltd.
4
- * Released under the MIT license
5
- * https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
6
- */
7
- import { NULL } from '../../utils/constants.js';
8
- import { ValueSerializer } from '../misc/value-serializer.js';
9
- import { isUndefined } from '../../utils/type-guards.js';
10
- import { BaseSerializer } from '../base-serializer.js';
11
- import { AgentNodeMarshallingMap, FREQUENT_AGENTS_DESERIALIZATION_MAP } from '../../marshalling-utils/comment/agent-common.js';
12
- import { BinaryTypeMarshallingMap } from '../../marshalling-utils/misc/binary-type-common.js';
13
-
14
- /**
15
- * Value map for binary serialization. This helps to reduce the size of the serialized data,
16
- * as it allows us to use a single byte to represent frequently used values.
17
- *
18
- * ! IMPORTANT: If you change values here, please update the {@link BINARY_SCHEMA_VERSION}!
19
- *
20
- * @note Only 256 values can be represented this way.
21
- */
22
- let frequentAgentsSerializationMap;
23
- const getFrequentAgentsSerializationMap = () => {
24
- if (!frequentAgentsSerializationMap) {
25
- frequentAgentsSerializationMap = new Map(Array.from(FREQUENT_AGENTS_DESERIALIZATION_MAP).map(([key, value]) => [value.toLowerCase(), key]));
26
- }
27
- return frequentAgentsSerializationMap;
28
- };
29
- /**
30
- * `AgentSerializer` is responsible for serializing single adblock agent elements into a binary format.
31
- */
32
- class AgentSerializer extends BaseSerializer {
33
- /**
34
- * Serializes an agent node to binary format.
35
- *
36
- * @param node Node to serialize.
37
- * @param buffer ByteBuffer for writing binary data.
38
- */
39
- static serialize(node, buffer) {
40
- buffer.writeUint8(BinaryTypeMarshallingMap.AgentNode);
41
- buffer.writeUint8(AgentNodeMarshallingMap.Adblock);
42
- ValueSerializer.serialize(node.adblock, buffer, getFrequentAgentsSerializationMap(), true);
43
- if (!isUndefined(node.version)) {
44
- buffer.writeUint8(AgentNodeMarshallingMap.Version);
45
- ValueSerializer.serialize(node.version, buffer);
46
- }
47
- if (!isUndefined(node.start)) {
48
- buffer.writeUint8(AgentNodeMarshallingMap.Start);
49
- buffer.writeUint32(node.start);
50
- }
51
- if (!isUndefined(node.end)) {
52
- buffer.writeUint8(AgentNodeMarshallingMap.End);
53
- buffer.writeUint32(node.end);
54
- }
55
- buffer.writeUint8(NULL);
56
- }
57
- }
58
-
59
- export { AgentSerializer };
@@ -1,105 +0,0 @@
1
- /*
2
- * AGTree v3.4.3 (build date: Thu, 11 Dec 2025 13:43:19 GMT)
3
- * (c) 2025 Adguard Software Ltd.
4
- * Released under the MIT license
5
- * https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
6
- */
7
- import { AgentCommentSerializer } from './agent-comment-serializer.js';
8
- import { CommentRuleType } from '../../nodes/index.js';
9
- import { ConfigCommentSerializer } from './config-comment-serializer.js';
10
- import { HintCommentSerializer } from './hint-comment-serializer.js';
11
- import { MetadataCommentSerializer } from './metadata-comment-serializer.js';
12
- import { PreProcessorCommentSerializer } from './pre-processor-comment-serializer.js';
13
- import { SimpleCommentSerializer } from './simple-comment-serializer.js';
14
- import { BaseSerializer } from '../base-serializer.js';
15
-
16
- /**
17
- * `CommentRuleSerializer` is responsible for serializing any comment-like adblock rules.
18
- *
19
- * @example
20
- * Example rules:
21
- * - Adblock agent rules:
22
- * - ```adblock
23
- * [AdGuard]
24
- * ```
25
- * - ```adblock
26
- * [Adblock Plus 2.0]
27
- * ```
28
- * - etc.
29
- * - AdGuard hint rules:
30
- * - ```adblock
31
- * !+ NOT_OPTIMIZED
32
- * ```
33
- * - ```adblock
34
- * !+ NOT_OPTIMIZED PLATFORM(windows)
35
- * ```
36
- * - etc.
37
- * - Pre-processor rules:
38
- * - ```adblock
39
- * !#if (adguard)
40
- * ```
41
- * - ```adblock
42
- * !#endif
43
- * ```
44
- * - etc.
45
- * - Metadata rules:
46
- * - ```adblock
47
- * ! Title: My List
48
- * ```
49
- * - ```adblock
50
- * ! Version: 2.0.150
51
- * ```
52
- * - etc.
53
- * - AGLint inline config rules:
54
- * - ```adblock
55
- * ! aglint-enable some-rule
56
- * ```
57
- * - ```adblock
58
- * ! aglint-disable some-rule
59
- * ```
60
- * - etc.
61
- * - Simple comments:
62
- * - Regular version:
63
- * ```adblock
64
- * ! This is just a comment
65
- * ```
66
- * - uBlock Origin / "hostlist" version:
67
- * ```adblock
68
- * # This is just a comment
69
- * ```
70
- * - etc.
71
- */
72
- class CommentRuleSerializer extends BaseSerializer {
73
- /**
74
- * Serializes a comment rule node to binary format.
75
- *
76
- * @param node Node to serialize.
77
- * @param buffer ByteBuffer for writing binary data.
78
- */
79
- static serialize(node, buffer) {
80
- switch (node.type) {
81
- case CommentRuleType.AgentCommentRule:
82
- AgentCommentSerializer.serialize(node, buffer);
83
- return;
84
- case CommentRuleType.HintCommentRule:
85
- HintCommentSerializer.serialize(node, buffer);
86
- return;
87
- case CommentRuleType.PreProcessorCommentRule:
88
- PreProcessorCommentSerializer.serialize(node, buffer);
89
- return;
90
- case CommentRuleType.MetadataCommentRule:
91
- MetadataCommentSerializer.serialize(node, buffer);
92
- return;
93
- case CommentRuleType.ConfigCommentRule:
94
- ConfigCommentSerializer.serialize(node, buffer);
95
- return;
96
- case CommentRuleType.CommentRule:
97
- SimpleCommentSerializer.serialize(node, buffer);
98
- break;
99
- default:
100
- throw new Error('Unknown comment rule type');
101
- }
102
- }
103
- }
104
-
105
- export { CommentRuleSerializer };