All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
2.3.0 - 2024-12-19
- Support for ABP-syntax CSS injection rules tsurlfilter#143.
2.2.0 - 2024-11-27
xregexp
library as a runtime dependency. It remains a development dependency for processing YAML files, enabling enhanced readability and maintainability of regex patterns through free-spacing mode and inline comments. However, xregexp is no longer bundled with the library to significantly reduce memory usage and bundle size, improving overall performance. The library now uses native ECMAScript regex patterns at runtime, ensuring compatibility without the additional overhead of xregexp. Related to AdguardBrowserExtension#3037.
2.1.4 - 2024-11-25
- Error messages for rules parsing errors.
- Missing children data in the deserializer for certain nodes.
2.1.3 - 2024-10-21
- Optimized performance of parsing uBlock filter parameters AdguardBrowserExtension#2962.
2.1.2 - 2024-09-19
RegExpUtils.isRegexPattern()
if a regexp contains a slash inside the pattern.
2.1.1 - 2024-09-19
- Optimized build size.
2.1.0 - 2024-09-18
UboParameterListParser
to parse uBO parameter lists, like scriptlet parameters.
- Scriptlet injection parser now requires quotes for AdGuard scriptlets and uses
UboParameterListParser
for uBO scriptlets to provide more consistent parsing.
2.0.2 - 2024-09-10
- Handling last position in
PositionProvider
.
- Browser-specific builds. If you need to use AGTree in browser environment, you can use jsDelivr's automatic builds or bundlers like Webpack / Rollup / ESBuild without any issues, AGTree does not have any non-browser-compatible code.
2.0.1 - 2024-09-06
- Support for uBO's legacy
script:inject
mask. - Support for uBO's redirect priority in the compatibility table name normalization.
resource_types
field to the redirects compatibility table.- Support for converting network rules to uBO syntax.
- Conversion for uBO's
rc
andra
scriptlets. - Converter now unescape scriptlet separators from the previous rule, if needed (e.g. it unescape commas when converting from uBO to AG syntax).
2.0.0 - 2024-08-15
- Integrated
@adguard/css-tokenizer
package. - Adjustable syntax parsing. This makes possible to disable parsing of uBO and ABP syntaxes, which can be useful when parsing known-syntax filters.
PositionProvider
to convert offsets to line/column pairs.OutputByteBuffer
andInputByteBuffer
utility classes.- Binary serialization / deserialization for AST nodes. Practically, this means adding
serialize
anddeserialize
methods to AGTree classes. decodeTextPolyfill
andencodeIntoPolyfill
utility functions.includeRaws
parser option.HostRuleParser
parser class to make it possible to parse host-like rules toHostRule
node.- Compatibility table API.
- Compatibility table wiki, which is generated via the compatibility table API.
- Protected Audience API directives to
$permissions
modifier validator. - Possibility to convert scriptlet rules to uBO syntax.
- Performance benchmarking.
- Reworked CSS parsing. Now it is based on
@adguard/css-tokenizer
package, and only necessary parts of CSS are parsed. - Consistent signature for all parser classes:
ParserClass.parse(source, options)
. - Location parsing now optional. It can be disabled by passing
isLocIncluded: false
option to the parsers. This reduces memory consumption and improves performance if location is not needed. - Modifier node's
modifier
property renamed toname
. ScriptletInjectionBodyParser
divided intoAdgScriptletInjectionBodyParser
,UboScriptletInjectionBodyParser
andAbpSnippetInjectionBodyParser
.- Locations (
offset
,line
,column
) are changed to only oneoffset
value. If you need to get line/column, you should usePositionProvider
class. - Parser functions signature to
parse(source, options, baseOffset, ...additionalArgs)
. - Removed
Parameter
node from the AST and replaced it withValue
node. - If a parameter is empty, it parsed as
null
instead of empty string. SimpleCommentParser
now has a separate class.- Logical operator types are now consistent, we only use the
OperatorValue
enum. - Reworked the compatibility table structure.
- Library now use CJS.
version
export renamed toAGTREE_VERSION
.
- HTML rule converter now correctly handles the new
:contains()
syntax. - Location handling for
FilterListParser
. - Performance issues.
@adguard/scriptlets
library. It is not needed anymore, because AGTree now has its own compatibility tables.css-tree
library. It is not needed anymore, because AGTree now uses@adguard/css-tokenizer
package.##^
/#@#^
and##+
/#@#+
from the cosmetic rule separator finder. Instead,##
/#@#
is used, and the^
/+
is checked in the body parser.
- Export path for type declarations.
- Support for
fenced-frame-src
,referrer
,require-trusted-types-for
,script-src-attr
,script-src-elem
,style-src-attr
,style-src-elem
,trusted-types
CSP directives for$csp
modifier validation: #126.
- Support of
referrerpolicy
modifier #98.
- Converter now returns an object with
result
andisConverted
properties instead of justresult
- Filter list converter now accepts a second argument
tolerant
which allows to convert filter lists with invalid rules
RawRuleConverter
class for converting raw rulesRawFilterListConverter
class for converting raw filter lists
- Improved converter's performance
- Validation of
$csp
and$permissions
modifiers value by custom pre-defined validator instead of regular expression
- Exports to
package.json
- Validation of
$redirect
and$replace
modifiers byModifierValidator.validate()
- Validation of modifier values due to
value_format
ModifierValidator.validate()
result typeValidationResult
—valid
property instead ofok
- Compatibility tables validation of ABP syntax
$rewrite
- Detecting closing parenthesis in ADG/uBO scriptlets while parsing
- Validation of assignable modifiers which may be used without a value
- Compatibility tables for modifiers
- Validator for modifiers
- Basic rule converter
- New utils (regex, quotes)
- Updated dependencies
- Improved library build
- Improved CSSTree utils
- Export CSSTree utils
- Store raw data while parsing
- General code improvements
- Package metadata
- Type import/export
- Modifier list parsing
- Scriptlet parsing
- Metadata parsing
- Migrated parser from AGLint to a separate package.