@adguard/agtree 4.0.0 → 4.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -3
- package/dist/ast-utils/clone.js +12 -8
- package/dist/ast-utils/modifiers.js +13 -11
- package/dist/ast-utils/network-rules.js +10 -9
- package/dist/ast-utils/scriptlets.js +20 -18
- package/dist/common/abp-snippet-injection-body-common.js +1 -1
- package/dist/common/agent-common.js +1 -1
- package/dist/common/ubo-html-filtering-body-common.js +1 -1
- package/dist/common/ubo-selector-common.js +1 -1
- package/dist/compatibility-tables/base.js +7 -6
- package/dist/compatibility-tables/compatibility-table-data.js +1 -1
- package/dist/compatibility-tables/modifiers.js +4 -3
- package/dist/compatibility-tables/platforms.js +1 -1
- package/dist/compatibility-tables/redirects.js +4 -4
- package/dist/compatibility-tables/schemas/base.js +2 -2
- package/dist/compatibility-tables/schemas/modifier.js +4 -4
- package/dist/compatibility-tables/schemas/platform.js +3 -2
- package/dist/compatibility-tables/schemas/redirect.js +1 -1
- package/dist/compatibility-tables/schemas/resource-type.js +1 -1
- package/dist/compatibility-tables/schemas/scriptlet.js +1 -1
- package/dist/compatibility-tables/scriptlets.js +2 -2
- package/dist/compatibility-tables/utils/platform-helpers.js +6 -4
- package/dist/compatibility-tables/utils/resource-type-helpers.js +1 -1
- package/dist/compatibility-tables/utils/zod-camelcase.js +3 -3
- package/dist/converter/base-interfaces/base-converter.js +22 -16
- package/dist/converter/base-interfaces/conversion-result.js +15 -11
- package/dist/converter/base-interfaces/rule-converter-base.js +19 -13
- package/dist/converter/comment/index.js +11 -9
- package/dist/converter/cosmetic/css.js +12 -10
- package/dist/converter/cosmetic/element-hiding.js +12 -10
- package/dist/converter/cosmetic/header-removal.js +16 -13
- package/dist/converter/cosmetic/html.js +18 -18
- package/dist/converter/cosmetic/index.js +28 -24
- package/dist/converter/cosmetic/rule-modifiers/adg.js +15 -12
- package/dist/converter/cosmetic/rule-modifiers/ubo.js +22 -19
- package/dist/converter/cosmetic/scriptlet.js +26 -22
- package/dist/converter/css/index.js +13 -11
- package/dist/converter/data/css.js +8 -8
- package/dist/converter/filter-list.js +12 -10
- package/dist/converter/index.js +1 -1
- package/dist/converter/misc/network-rule-modifier.js +20 -16
- package/dist/converter/network/index.js +16 -12
- package/dist/converter/raw-filter-list.js +12 -10
- package/dist/converter/raw-rule.js +14 -12
- package/dist/converter/rule.js +17 -13
- package/dist/errors/adblock-syntax-error.js +1 -1
- package/dist/errors/not-implemented-error.js +2 -2
- package/dist/errors/rule-conversion-error.js +2 -2
- package/dist/generator/base-generator.js +1 -1
- package/dist/generator/comment/agent-comment-generator.js +4 -3
- package/dist/generator/comment/agent-generator.js +5 -4
- package/dist/generator/comment/comment-rule-generator.js +6 -5
- package/dist/generator/comment/config-comment-generator.js +5 -4
- package/dist/generator/comment/hint-comment-generator.js +5 -4
- package/dist/generator/comment/hint-generator.js +4 -3
- package/dist/generator/comment/metadata-comment-generator.js +3 -2
- package/dist/generator/comment/pre-processor-comment-generator.js +6 -5
- package/dist/generator/comment/simple-comment-generator.js +3 -2
- package/dist/generator/cosmetic/cosmetic-rule-body-generator.js +13 -11
- package/dist/generator/cosmetic/cosmetic-rule-generator.js +5 -4
- package/dist/generator/cosmetic/cosmetic-rule-pattern-generator.js +7 -5
- package/dist/generator/cosmetic/html-filtering-body/adg-html-filtering-body-generator.js +3 -3
- package/dist/generator/cosmetic/html-filtering-body/html-filtering-body-generator.js +1 -1
- package/dist/generator/cosmetic/html-filtering-body/ubo-html-filtering-body-generator.js +2 -2
- package/dist/generator/cosmetic/scriptlet-body/abp-snippet-injection-body-generator.js +7 -5
- package/dist/generator/cosmetic/scriptlet-body/adg-scriptlet-injection-body-generator.js +7 -5
- package/dist/generator/cosmetic/scriptlet-body/ubo-scriptlet-injection-body-generator.js +8 -6
- package/dist/generator/cosmetic/selector/attribute-selector-generator.js +2 -2
- package/dist/generator/cosmetic/selector/class-selector-generator.js +1 -1
- package/dist/generator/cosmetic/selector/complex-selector-generator.js +4 -4
- package/dist/generator/cosmetic/selector/id-selector-generator.js +1 -1
- package/dist/generator/cosmetic/selector/pseudo-class-selector-generator.js +1 -1
- package/dist/generator/cosmetic/selector/selector-combinator-generator.js +1 -1
- package/dist/generator/cosmetic/selector/selector-list-generator.js +1 -1
- package/dist/generator/cosmetic/selector/type-selector-generator.js +1 -1
- package/dist/generator/css/adg-css-injection-generator.js +5 -1
- package/dist/generator/filterlist-generator.js +5 -4
- package/dist/generator/index.js +1 -1
- package/dist/generator/misc/domain-list-generator.js +1 -1
- package/dist/generator/misc/list-items-generator.js +5 -3
- package/dist/generator/misc/logical-expression-generator.js +5 -4
- package/dist/generator/misc/modifier-generator.js +4 -3
- package/dist/generator/misc/modifier-list-generator.js +5 -4
- package/dist/generator/misc/parameter-list-generator.js +6 -5
- package/dist/generator/misc/value-generator.js +2 -1
- package/dist/generator/network/host-rule-generator.js +2 -1
- package/dist/generator/network/network-rule-generator.js +2 -1
- package/dist/generator/rule-generator.js +6 -4
- package/dist/index.js +1 -2
- package/dist/nodes/index.js +1 -1
- package/dist/package.json.js +2 -2
- package/dist/parser/base-parser.js +1 -1
- package/dist/parser/comment/agent-comment-parser.js +11 -9
- package/dist/parser/comment/agent-parser.js +12 -9
- package/dist/parser/comment/comment-parser.js +8 -7
- package/dist/parser/comment/config-comment-parser.js +9 -6
- package/dist/parser/comment/hint-comment-parser.js +17 -12
- package/dist/parser/comment/hint-parser.js +10 -7
- package/dist/parser/comment/metadata-comment-parser.js +9 -7
- package/dist/parser/comment/preprocessor-parser.js +14 -11
- package/dist/parser/comment/simple-comment-parser.js +5 -2
- package/dist/parser/cosmetic/cosmetic-rule-parser.js +29 -25
- package/dist/parser/cosmetic/html-filtering-body/adg-html-filtering-body-parser.js +3 -3
- package/dist/parser/cosmetic/html-filtering-body/html-filtering-body-parser.js +4 -4
- package/dist/parser/cosmetic/html-filtering-body/ubo-html-filtering-body-parser.js +7 -7
- package/dist/parser/cosmetic/scriptlet-body/abp-snippet-injection-body-parser.js +12 -9
- package/dist/parser/cosmetic/scriptlet-body/adg-scriptlet-injection-body-parser.js +12 -9
- package/dist/parser/cosmetic/scriptlet-body/ubo-scriptlet-injection-body-parser.js +11 -8
- package/dist/parser/cosmetic/selector/handlers/attribute-selector-handler.js +1 -1
- package/dist/parser/cosmetic/selector/handlers/class-selector-handler.js +1 -1
- package/dist/parser/cosmetic/selector/handlers/complex-selector-handler.js +1 -1
- package/dist/parser/cosmetic/selector/handlers/compound-selector-handler.js +2 -2
- package/dist/parser/cosmetic/selector/handlers/id-selector-handler.js +1 -1
- package/dist/parser/cosmetic/selector/handlers/pseudo-class-selector-handler.js +5 -3
- package/dist/parser/cosmetic/selector/handlers/type-selector-handler.js +1 -1
- package/dist/parser/cosmetic/selector/selector-list-parser.js +7 -7
- package/dist/parser/css/adg-css-injection-parser.js +4 -3
- package/dist/parser/css/balancing.js +22 -18
- package/dist/parser/css/constants.js +1 -1
- package/dist/parser/css/css-token-stream.js +15 -4
- package/dist/parser/css/ubo-selector-parser.js +8 -4
- package/dist/parser/filterlist-parser.js +8 -5
- package/dist/parser/index.js +1 -1
- package/dist/parser/misc/app-list-parser.js +4 -3
- package/dist/parser/misc/domain-list-parser.js +8 -6
- package/dist/parser/misc/list-items-parser.js +8 -6
- package/dist/parser/misc/logical-expression-parser.js +25 -18
- package/dist/parser/misc/method-list-parser.js +4 -3
- package/dist/parser/misc/modifier-list.js +3 -3
- package/dist/parser/misc/modifier-parser.js +5 -4
- package/dist/parser/misc/parameter-list-parser.js +6 -5
- package/dist/parser/misc/stealth-option-list-parser.js +4 -3
- package/dist/parser/misc/ubo-parameter-list-parser.js +10 -9
- package/dist/parser/misc/value-parser.js +2 -2
- package/dist/parser/network/host-rule-parser.js +15 -7
- package/dist/parser/network/network-rule-parser.js +11 -9
- package/dist/parser/options.js +1 -1
- package/dist/parser/rule-parser.js +11 -7
- package/dist/types/ast-utils/clone.d.ts +12 -8
- package/dist/types/ast-utils/filter-list.d.ts +5 -4
- package/dist/types/ast-utils/modifiers.d.ts +11 -9
- package/dist/types/ast-utils/network-rules.d.ts +8 -7
- package/dist/types/ast-utils/scriptlets.d.ts +19 -17
- package/dist/types/compatibility-tables/base.d.ts +6 -5
- package/dist/types/compatibility-tables/redirects.d.ts +1 -1
- package/dist/types/compatibility-tables/schemas/platform.d.ts +1 -0
- package/dist/types/compatibility-tables/utils/platform-helpers.d.ts +5 -3
- package/dist/types/compatibility-tables/utils/zod-camelcase.d.ts +3 -3
- package/dist/types/converter/base-interfaces/base-converter.d.ts +21 -15
- package/dist/types/converter/base-interfaces/conversion-result.d.ts +20 -16
- package/dist/types/converter/base-interfaces/rule-converter-base.d.ts +19 -13
- package/dist/types/converter/comment/index.d.ts +9 -7
- package/dist/types/converter/cosmetic/css.d.ts +9 -7
- package/dist/types/converter/cosmetic/element-hiding.d.ts +9 -7
- package/dist/types/converter/cosmetic/header-removal.d.ts +10 -7
- package/dist/types/converter/cosmetic/html.d.ts +9 -9
- package/dist/types/converter/cosmetic/index.d.ts +14 -10
- package/dist/types/converter/cosmetic/rule-modifiers/adg.d.ts +9 -6
- package/dist/types/converter/cosmetic/rule-modifiers/ubo.d.ts +9 -6
- package/dist/types/converter/cosmetic/scriptlet.d.ts +14 -10
- package/dist/types/converter/css/index.d.ts +9 -7
- package/dist/types/converter/data/css.d.ts +1 -1
- package/dist/types/converter/filter-list.d.ts +10 -8
- package/dist/types/converter/index.d.ts +1 -1
- package/dist/types/converter/misc/network-rule-modifier.d.ts +13 -9
- package/dist/types/converter/network/index.d.ts +15 -11
- package/dist/types/converter/raw-filter-list.d.ts +8 -6
- package/dist/types/converter/raw-rule.d.ts +8 -6
- package/dist/types/converter/rule.d.ts +14 -10
- package/dist/types/errors/not-implemented-error.d.ts +1 -1
- package/dist/types/errors/rule-conversion-error.d.ts +1 -1
- package/dist/types/generator/comment/agent-comment-generator.d.ts +3 -2
- package/dist/types/generator/comment/agent-generator.d.ts +4 -3
- package/dist/types/generator/comment/comment-rule-generator.d.ts +3 -2
- package/dist/types/generator/comment/config-comment-generator.d.ts +4 -3
- package/dist/types/generator/comment/hint-comment-generator.d.ts +4 -3
- package/dist/types/generator/comment/hint-generator.d.ts +3 -2
- package/dist/types/generator/comment/metadata-comment-generator.d.ts +1 -0
- package/dist/types/generator/comment/pre-processor-comment-generator.d.ts +3 -2
- package/dist/types/generator/comment/simple-comment-generator.d.ts +2 -1
- package/dist/types/generator/cosmetic/cosmetic-rule-body-generator.d.ts +7 -5
- package/dist/types/generator/cosmetic/cosmetic-rule-generator.d.ts +3 -2
- package/dist/types/generator/cosmetic/cosmetic-rule-pattern-generator.d.ts +4 -2
- package/dist/types/generator/cosmetic/html-filtering-body/adg-html-filtering-body-generator.d.ts +1 -1
- package/dist/types/generator/cosmetic/html-filtering-body/html-filtering-body-generator.d.ts +1 -1
- package/dist/types/generator/cosmetic/html-filtering-body/ubo-html-filtering-body-generator.d.ts +2 -2
- package/dist/types/generator/cosmetic/scriptlet-body/abp-snippet-injection-body-generator.d.ts +5 -3
- package/dist/types/generator/cosmetic/scriptlet-body/adg-scriptlet-injection-body-generator.d.ts +5 -3
- package/dist/types/generator/cosmetic/scriptlet-body/ubo-scriptlet-injection-body-generator.d.ts +7 -5
- package/dist/types/generator/css/adg-css-injection-generator.d.ts +4 -0
- package/dist/types/generator/css/ubo-selector-generator.d.ts +4 -3
- package/dist/types/generator/filterlist-generator.d.ts +3 -2
- package/dist/types/generator/misc/list-items-generator.d.ts +4 -2
- package/dist/types/generator/misc/logical-expression-generator.d.ts +4 -3
- package/dist/types/generator/misc/modifier-generator.d.ts +3 -2
- package/dist/types/generator/misc/modifier-list-generator.d.ts +4 -3
- package/dist/types/generator/misc/parameter-list-generator.d.ts +5 -4
- package/dist/types/generator/misc/value-generator.d.ts +1 -0
- package/dist/types/generator/network/host-rule-generator.d.ts +1 -0
- package/dist/types/generator/network/network-rule-generator.d.ts +1 -0
- package/dist/types/generator/rule-generator.d.ts +5 -3
- package/dist/types/index.d.ts +1 -2
- package/dist/types/nodes/index.d.ts +55 -54
- package/dist/types/parser/comment/agent-comment-parser.d.ts +5 -3
- package/dist/types/parser/comment/agent-parser.d.ts +7 -4
- package/dist/types/parser/comment/comment-parser.d.ts +5 -3
- package/dist/types/parser/comment/config-comment-parser.d.ts +5 -2
- package/dist/types/parser/comment/hint-comment-parser.d.ts +11 -6
- package/dist/types/parser/comment/hint-parser.d.ts +6 -3
- package/dist/types/parser/comment/metadata-comment-parser.d.ts +5 -3
- package/dist/types/parser/comment/preprocessor-parser.d.ts +9 -6
- package/dist/types/parser/comment/simple-comment-parser.d.ts +3 -0
- package/dist/types/parser/cosmetic/cosmetic-rule-parser.d.ts +9 -6
- package/dist/types/parser/cosmetic/html-filtering-body/adg-html-filtering-body-parser.d.ts +3 -3
- package/dist/types/parser/cosmetic/html-filtering-body/html-filtering-body-parser.d.ts +4 -4
- package/dist/types/parser/cosmetic/html-filtering-body/ubo-html-filtering-body-parser.d.ts +4 -4
- package/dist/types/parser/cosmetic/scriptlet-body/abp-snippet-injection-body-parser.d.ts +8 -5
- package/dist/types/parser/cosmetic/scriptlet-body/adg-scriptlet-injection-body-parser.d.ts +9 -6
- package/dist/types/parser/cosmetic/scriptlet-body/ubo-scriptlet-injection-body-parser.d.ts +8 -5
- package/dist/types/parser/cosmetic/selector/context.d.ts +2 -2
- package/dist/types/parser/cosmetic/selector/selector-list-parser.d.ts +2 -2
- package/dist/types/parser/css/adg-css-injection-parser.d.ts +1 -0
- package/dist/types/parser/css/balancing.d.ts +17 -12
- package/dist/types/parser/css/css-token-stream.d.ts +11 -0
- package/dist/types/parser/css/ubo-selector-parser.d.ts +3 -0
- package/dist/types/parser/filterlist-parser.d.ts +5 -2
- package/dist/types/parser/misc/app-list-parser.d.ts +1 -0
- package/dist/types/parser/misc/domain-list-parser.d.ts +5 -3
- package/dist/types/parser/misc/list-items-parser.d.ts +5 -3
- package/dist/types/parser/misc/logical-expression-parser.d.ts +9 -5
- package/dist/types/parser/misc/method-list-parser.d.ts +1 -0
- package/dist/types/parser/misc/modifier-list.d.ts +2 -1
- package/dist/types/parser/misc/modifier-parser.d.ts +2 -1
- package/dist/types/parser/misc/parameter-list-parser.d.ts +3 -2
- package/dist/types/parser/misc/stealth-option-list-parser.d.ts +1 -0
- package/dist/types/parser/misc/ubo-parameter-list-parser.d.ts +2 -1
- package/dist/types/parser/misc/value-parser.d.ts +1 -1
- package/dist/types/parser/network/host-rule-parser.d.ts +10 -2
- package/dist/types/parser/network/network-rule-parser.d.ts +5 -3
- package/dist/types/parser/options.d.ts +1 -1
- package/dist/types/parser/rule-parser.d.ts +6 -2
- package/dist/types/tokenizer/tokenizer.d.ts +2 -2
- package/dist/types/utils/adblockers.d.ts +9 -6
- package/dist/types/utils/clone.d.ts +4 -3
- package/dist/types/utils/constants.d.ts +1 -1
- package/dist/types/utils/cosmetic-rule-separator.d.ts +13 -10
- package/dist/types/utils/deep-freeze.d.ts +4 -4
- package/dist/types/utils/domain.d.ts +3 -2
- package/dist/types/utils/logical-expression.d.ts +9 -5
- package/dist/types/utils/multi-value-map.d.ts +3 -3
- package/dist/types/utils/position-provider.d.ts +3 -2
- package/dist/types/utils/quotes.d.ts +48 -42
- package/dist/types/utils/regexp.d.ts +24 -17
- package/dist/types/utils/string.d.ts +135 -103
- package/dist/types/utils/type-guards.d.ts +1 -0
- package/dist/types/validator/helpers.d.ts +1 -1
- package/dist/types/validator/index.d.ts +3 -3
- package/dist/types/version.d.ts +1 -1
- package/dist/utils/adblockers.js +10 -7
- package/dist/utils/bit-count.js +1 -1
- package/dist/utils/categorizer.js +2 -2
- package/dist/utils/clone.js +5 -4
- package/dist/utils/constants.js +2 -2
- package/dist/utils/cosmetic-rule-separator.js +15 -11
- package/dist/utils/deep-freeze.js +5 -5
- package/dist/utils/domain.js +4 -3
- package/dist/utils/error.js +3 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/logical-expression.js +10 -6
- package/dist/utils/multi-value-map.js +4 -4
- package/dist/utils/noop-modifier.js +1 -1
- package/dist/utils/position-provider.js +2 -1
- package/dist/utils/quotes.js +49 -43
- package/dist/utils/regexp.js +25 -18
- package/dist/utils/string.js +136 -104
- package/dist/utils/type-guards.js +2 -1
- package/dist/validator/constants.js +1 -1
- package/dist/validator/helpers.js +1 -1
- package/dist/validator/index.js +8 -8
- package/dist/validator/value.js +6 -6
- package/dist/version.js +2 -2
- package/package.json +3 -1
- package/dist/errors/binary-schema-mismatch-error.js +0 -37
- package/dist/types/errors/binary-schema-mismatch-error.d.ts +0 -23
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v4.0.
|
|
2
|
+
* AGTree v4.0.2 (build date: Tue, 17 Mar 2026 23:34:38 GMT)
|
|
3
3
|
* (c) 2026 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
|
6
6
|
*/
|
|
7
7
|
import { EMPTY } from '../../../utils/constants.js';
|
|
8
8
|
import { BaseGenerator } from '../../base-generator.js';
|
|
9
|
-
import { TypeSelectorGenerator } from './type-selector-generator.js';
|
|
10
|
-
import { IdSelectorGenerator } from './id-selector-generator.js';
|
|
11
|
-
import { ClassSelectorGenerator } from './class-selector-generator.js';
|
|
12
9
|
import { AttributeSelectorGenerator } from './attribute-selector-generator.js';
|
|
10
|
+
import { ClassSelectorGenerator } from './class-selector-generator.js';
|
|
11
|
+
import { IdSelectorGenerator } from './id-selector-generator.js';
|
|
13
12
|
import { PseudoClassSelectorGenerator } from './pseudo-class-selector-generator.js';
|
|
14
13
|
import { SelectorCombinatorGenerator } from './selector-combinator-generator.js';
|
|
14
|
+
import { TypeSelectorGenerator } from './type-selector-generator.js';
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Complex selector generator.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v4.0.
|
|
2
|
+
* AGTree v4.0.2 (build date: Tue, 17 Mar 2026 23:34:38 GMT)
|
|
3
3
|
* (c) 2026 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v4.0.
|
|
2
|
+
* AGTree v4.0.2 (build date: Tue, 17 Mar 2026 23:34:38 GMT)
|
|
3
3
|
* (c) 2026 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v4.0.
|
|
2
|
+
* AGTree v4.0.2 (build date: Tue, 17 Mar 2026 23:34:38 GMT)
|
|
3
3
|
* (c) 2026 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v4.0.
|
|
2
|
+
* AGTree v4.0.2 (build date: Tue, 17 Mar 2026 23:34:38 GMT)
|
|
3
3
|
* (c) 2026 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v4.0.
|
|
2
|
+
* AGTree v4.0.2 (build date: Tue, 17 Mar 2026 23:34:38 GMT)
|
|
3
3
|
* (c) 2026 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v4.0.
|
|
2
|
+
* AGTree v4.0.2 (build date: Tue, 17 Mar 2026 23:34:38 GMT)
|
|
3
3
|
* (c) 2026 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
|
@@ -11,11 +11,15 @@ import { BaseGenerator } from '../base-generator.js';
|
|
|
11
11
|
* AdGuard CSS injection generator.
|
|
12
12
|
*/
|
|
13
13
|
class AdgCssInjectionGenerator extends BaseGenerator {
|
|
14
|
+
/**
|
|
15
|
+
* CSS declaration for removing elements.
|
|
16
|
+
*/
|
|
14
17
|
static REMOVE_DECLARATION = 'remove: true;';
|
|
15
18
|
/**
|
|
16
19
|
* Serializes an AdGuard CSS injection node into a raw string.
|
|
17
20
|
*
|
|
18
21
|
* @param node Node to serialize.
|
|
22
|
+
*
|
|
19
23
|
* @returns Raw string.
|
|
20
24
|
*/
|
|
21
25
|
static generate(node) {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v4.0.
|
|
2
|
+
* AGTree v4.0.2 (build date: Tue, 17 Mar 2026 23:34:38 GMT)
|
|
3
3
|
* (c) 2026 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
|
6
6
|
*/
|
|
7
7
|
import { EMPTY, LF, CR, CRLF } from '../utils/constants.js';
|
|
8
|
-
import { RuleGenerator } from './rule-generator.js';
|
|
9
8
|
import { BaseGenerator } from './base-generator.js';
|
|
9
|
+
import { RuleGenerator } from './rule-generator.js';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Generates a serialized filter list.
|
|
@@ -15,12 +15,13 @@ class FilterListGenerator extends BaseGenerator {
|
|
|
15
15
|
/**
|
|
16
16
|
* Serializes a whole adblock filter list (list of rules).
|
|
17
17
|
*
|
|
18
|
-
* @param ast AST to generate
|
|
18
|
+
* @param ast AST to generate.
|
|
19
19
|
* @param preferRaw If `true`, then the parser will use `raws.text` property of each rule
|
|
20
20
|
* if it is available. Default is `false`.
|
|
21
21
|
* @param tolerant If `true`, errors during rule generation will be logged to the console and invalid rules
|
|
22
22
|
* will be skipped. If `false`, an error will be thrown on the first invalid rule. Default is `true`.
|
|
23
|
-
*
|
|
23
|
+
*
|
|
24
|
+
* @returns Serialized filter list.
|
|
24
25
|
*/
|
|
25
26
|
static generate(ast, preferRaw = false, tolerant = true) {
|
|
26
27
|
let result = EMPTY;
|
package/dist/generator/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v4.0.
|
|
2
|
+
* AGTree v4.0.2 (build date: Tue, 17 Mar 2026 23:34:38 GMT)
|
|
3
3
|
* (c) 2026 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v4.0.
|
|
2
|
+
* AGTree v4.0.2 (build date: Tue, 17 Mar 2026 23:34:38 GMT)
|
|
3
3
|
* (c) 2026 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v4.0.
|
|
2
|
+
* AGTree v4.0.2 (build date: Tue, 17 Mar 2026 23:34:38 GMT)
|
|
3
3
|
* (c) 2026 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
|
@@ -13,9 +13,10 @@ class ListItemsGenerator {
|
|
|
13
13
|
/**
|
|
14
14
|
* Generates a string representation of a list item.
|
|
15
15
|
*
|
|
16
|
-
* @param item List item to generate.
|
|
17
16
|
* @template T Type of the list item.
|
|
18
17
|
*
|
|
18
|
+
* @param item List item to generate.
|
|
19
|
+
*
|
|
19
20
|
* @returns String representation of the list item.
|
|
20
21
|
*/
|
|
21
22
|
static generateListItem = (item) => {
|
|
@@ -24,9 +25,10 @@ class ListItemsGenerator {
|
|
|
24
25
|
/**
|
|
25
26
|
* Generates a string representation of a list of items.
|
|
26
27
|
*
|
|
28
|
+
* @template T Type of the list items.
|
|
29
|
+
*
|
|
27
30
|
* @param items List of items to generate.
|
|
28
31
|
* @param separator Separator character.
|
|
29
|
-
* @template T Type of the list items.
|
|
30
32
|
*
|
|
31
33
|
* @returns String representation of the list of items.
|
|
32
34
|
*/
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v4.0.
|
|
2
|
+
* AGTree v4.0.2 (build date: Tue, 17 Mar 2026 23:34:38 GMT)
|
|
3
3
|
* (c) 2026 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
|
6
6
|
*/
|
|
7
|
-
import { BaseGenerator } from '../base-generator.js';
|
|
8
7
|
import { OperatorValue } from '../../nodes/index.js';
|
|
9
8
|
import { NodeType } from '../../parser/misc/logical-expression-parser.js';
|
|
9
|
+
import { BaseGenerator } from '../base-generator.js';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Generator for logical expression nodes.
|
|
@@ -15,8 +15,9 @@ class LogicalExpressionGenerator extends BaseGenerator {
|
|
|
15
15
|
/**
|
|
16
16
|
* Generates a string representation of the logical expression (serialization).
|
|
17
17
|
*
|
|
18
|
-
* @param node Expression node
|
|
19
|
-
*
|
|
18
|
+
* @param node Expression node.
|
|
19
|
+
*
|
|
20
|
+
* @returns String representation of the logical expression.
|
|
20
21
|
*/
|
|
21
22
|
static generate(node) {
|
|
22
23
|
if (node.type === NodeType.Variable) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v4.0.
|
|
2
|
+
* AGTree v4.0.2 (build date: Tue, 17 Mar 2026 23:34:38 GMT)
|
|
3
3
|
* (c) 2026 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
|
@@ -14,8 +14,9 @@ class ModifierGenerator extends BaseGenerator {
|
|
|
14
14
|
/**
|
|
15
15
|
* Converts a modifier AST node to a string.
|
|
16
16
|
*
|
|
17
|
-
* @param modifier Modifier AST node to convert
|
|
18
|
-
*
|
|
17
|
+
* @param modifier Modifier AST node to convert.
|
|
18
|
+
*
|
|
19
|
+
* @returns String representation of the modifier.
|
|
19
20
|
*/
|
|
20
21
|
static generate(modifier) {
|
|
21
22
|
let result = EMPTY;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v4.0.
|
|
2
|
+
* AGTree v4.0.2 (build date: Tue, 17 Mar 2026 23:34:38 GMT)
|
|
3
3
|
* (c) 2026 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
|
6
6
|
*/
|
|
7
|
-
import { BaseGenerator } from '../base-generator.js';
|
|
8
7
|
import { MODIFIERS_SEPARATOR } from '../../utils/constants.js';
|
|
8
|
+
import { BaseGenerator } from '../base-generator.js';
|
|
9
9
|
import { ModifierGenerator } from './modifier-generator.js';
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -15,8 +15,9 @@ class ModifierListGenerator extends BaseGenerator {
|
|
|
15
15
|
/**
|
|
16
16
|
* Converts a modifier list AST to a string.
|
|
17
17
|
*
|
|
18
|
-
* @param ast Modifier list AST
|
|
19
|
-
*
|
|
18
|
+
* @param ast Modifier list AST.
|
|
19
|
+
*
|
|
20
|
+
* @returns Raw string.
|
|
20
21
|
*/
|
|
21
22
|
static generate(ast) {
|
|
22
23
|
const result = ast.children
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v4.0.
|
|
2
|
+
* AGTree v4.0.2 (build date: Tue, 17 Mar 2026 23:34:38 GMT)
|
|
3
3
|
* (c) 2026 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
|
@@ -15,10 +15,11 @@ class ParameterListGenerator extends BaseGenerator {
|
|
|
15
15
|
/**
|
|
16
16
|
* Converts a parameter list AST to a string.
|
|
17
17
|
*
|
|
18
|
-
* @param params Parameter list AST
|
|
19
|
-
* @param separator Separator character (default: comma)
|
|
20
|
-
* @param allowSpace Allow space between parameters (default: true)
|
|
21
|
-
*
|
|
18
|
+
* @param params Parameter list AST.
|
|
19
|
+
* @param separator Separator character (default: comma).
|
|
20
|
+
* @param allowSpace Allow space between parameters (default: true).
|
|
21
|
+
*
|
|
22
|
+
* @returns String representation of the parameter list.
|
|
22
23
|
*/
|
|
23
24
|
static generate(params, separator = COMMA, allowSpace = true) {
|
|
24
25
|
const collection = [];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v4.0.
|
|
2
|
+
* AGTree v4.0.2 (build date: Tue, 17 Mar 2026 23:34:38 GMT)
|
|
3
3
|
* (c) 2026 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
|
@@ -14,6 +14,7 @@ class ValueGenerator extends BaseGenerator {
|
|
|
14
14
|
* Converts a value node to a string.
|
|
15
15
|
*
|
|
16
16
|
* @param node Value node.
|
|
17
|
+
*
|
|
17
18
|
* @returns Raw string.
|
|
18
19
|
*/
|
|
19
20
|
static generate(node) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v4.0.
|
|
2
|
+
* AGTree v4.0.2 (build date: Tue, 17 Mar 2026 23:34:38 GMT)
|
|
3
3
|
* (c) 2026 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
|
@@ -15,6 +15,7 @@ class HostRuleGenerator extends BaseGenerator {
|
|
|
15
15
|
* Converts a host rule node to a raw string.
|
|
16
16
|
*
|
|
17
17
|
* @param node Host rule node.
|
|
18
|
+
*
|
|
18
19
|
* @returns Raw string.
|
|
19
20
|
*/
|
|
20
21
|
static generate(node) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v4.0.
|
|
2
|
+
* AGTree v4.0.2 (build date: Tue, 17 Mar 2026 23:34:38 GMT)
|
|
3
3
|
* (c) 2026 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
|
@@ -16,6 +16,7 @@ class NetworkRuleGenerator extends BaseGenerator {
|
|
|
16
16
|
* Generates a string from a network rule AST node.
|
|
17
17
|
*
|
|
18
18
|
* @param node Network rule node to generate a string from.
|
|
19
|
+
*
|
|
19
20
|
* @returns Generated string representation of the network rule.
|
|
20
21
|
*/
|
|
21
22
|
static generate(node) {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v4.0.
|
|
2
|
+
* AGTree v4.0.2 (build date: Tue, 17 Mar 2026 23:34:38 GMT)
|
|
3
3
|
* (c) 2026 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
|
6
6
|
*/
|
|
7
|
-
import { BaseGenerator } from './base-generator.js';
|
|
8
7
|
import { RuleCategory, NetworkRuleType } from '../nodes/index.js';
|
|
9
8
|
import { EMPTY } from '../utils/constants.js';
|
|
9
|
+
import { BaseGenerator } from './base-generator.js';
|
|
10
10
|
import { CommentRuleGenerator } from './comment/comment-rule-generator.js';
|
|
11
11
|
import { CosmeticRuleGenerator } from './cosmetic/cosmetic-rule-generator.js';
|
|
12
12
|
import { HostRuleGenerator } from './network/host-rule-generator.js';
|
|
@@ -19,8 +19,10 @@ class RuleGenerator extends BaseGenerator {
|
|
|
19
19
|
/**
|
|
20
20
|
* Converts a rule AST to a string.
|
|
21
21
|
*
|
|
22
|
-
* @param ast
|
|
23
|
-
*
|
|
22
|
+
* @param ast Adblock rule AST.
|
|
23
|
+
*
|
|
24
|
+
* @returns Raw string.
|
|
25
|
+
*
|
|
24
26
|
* @example
|
|
25
27
|
* Take a look at the following example:
|
|
26
28
|
* ```js
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v4.0.
|
|
2
|
+
* AGTree v4.0.2 (build date: Tue, 17 Mar 2026 23:34:38 GMT)
|
|
3
3
|
* (c) 2026 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
|
@@ -31,7 +31,6 @@ export { ParameterListParser } from './parser/misc/parameter-list-parser.js';
|
|
|
31
31
|
export { HostRuleParser } from './parser/network/host-rule-parser.js';
|
|
32
32
|
export { PreProcessorCommentParser } from './parser/comment/preprocessor-parser.js';
|
|
33
33
|
export { RuleConversionError } from './errors/rule-conversion-error.js';
|
|
34
|
-
export { BinarySchemaMismatchError } from './errors/binary-schema-mismatch-error.js';
|
|
35
34
|
export { modifierValidator } from './validator/index.js';
|
|
36
35
|
export { FilterListConverter } from './converter/filter-list.js';
|
|
37
36
|
export { RawFilterListConverter } from './converter/raw-filter-list.js';
|
package/dist/nodes/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v4.0.
|
|
2
|
+
* AGTree v4.0.2 (build date: Tue, 17 Mar 2026 23:34:38 GMT)
|
|
3
3
|
* (c) 2026 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
package/dist/package.json.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v4.0.
|
|
2
|
+
* AGTree v4.0.2 (build date: Tue, 17 Mar 2026 23:34:38 GMT)
|
|
3
3
|
* (c) 2026 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
|
6
6
|
*/
|
|
7
|
-
const version = "4.0.
|
|
7
|
+
const version = "4.0.2";
|
|
8
8
|
|
|
9
9
|
export { version };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v4.0.
|
|
2
|
+
* AGTree v4.0.2 (build date: Tue, 17 Mar 2026 23:34:38 GMT)
|
|
3
3
|
* (c) 2026 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v4.0.
|
|
2
|
+
* AGTree v4.0.2 (build date: Tue, 17 Mar 2026 23:34:38 GMT)
|
|
3
3
|
* (c) 2026 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
|
6
6
|
*/
|
|
7
|
-
import { OPEN_SQUARE_BRACKET, CLOSE_SQUARE_BRACKET, SEMICOLON } from '../../utils/constants.js';
|
|
8
|
-
import { StringUtils } from '../../utils/string.js';
|
|
9
|
-
import { RuleCategory, CommentRuleType } from '../../nodes/index.js';
|
|
10
|
-
import { AgentParser } from './agent-parser.js';
|
|
11
7
|
import { AdblockSyntaxError } from '../../errors/adblock-syntax-error.js';
|
|
8
|
+
import { RuleCategory, CommentRuleType } from '../../nodes/index.js';
|
|
12
9
|
import { AdblockSyntax } from '../../utils/adblockers.js';
|
|
10
|
+
import { OPEN_SQUARE_BRACKET, CLOSE_SQUARE_BRACKET, SEMICOLON } from '../../utils/constants.js';
|
|
13
11
|
import { CosmeticRuleSeparatorUtils } from '../../utils/cosmetic-rule-separator.js';
|
|
12
|
+
import { StringUtils } from '../../utils/string.js';
|
|
13
|
+
import { isNull } from '../../utils/type-guards.js';
|
|
14
14
|
import { BaseParser } from '../base-parser.js';
|
|
15
15
|
import { defaultParserOptions } from '../options.js';
|
|
16
|
-
import {
|
|
16
|
+
import { AgentParser } from './agent-parser.js';
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* `AgentParser` is responsible for parsing an Adblock agent rules.
|
|
@@ -41,8 +41,9 @@ class AgentCommentParser extends BaseParser {
|
|
|
41
41
|
/**
|
|
42
42
|
* Checks if the raw rule is an adblock agent comment.
|
|
43
43
|
*
|
|
44
|
-
* @param raw Raw rule
|
|
45
|
-
*
|
|
44
|
+
* @param raw Raw rule.
|
|
45
|
+
*
|
|
46
|
+
* @returns `true` if the rule is an adblock agent, `false` otherwise.
|
|
46
47
|
*/
|
|
47
48
|
static isAgentRule(raw) {
|
|
48
49
|
const rawTrimmed = raw.trim();
|
|
@@ -58,7 +59,8 @@ class AgentCommentParser extends BaseParser {
|
|
|
58
59
|
* @param raw Raw input to parse.
|
|
59
60
|
* @param options Global parser options.
|
|
60
61
|
* @param baseOffset Starting offset of the input. Node locations are calculated relative to this offset.
|
|
61
|
-
*
|
|
62
|
+
*
|
|
63
|
+
* @returns Agent rule AST or null (if the raw rule cannot be parsed as an adblock agent comment).
|
|
62
64
|
*/
|
|
63
65
|
static parse(raw, options = defaultParserOptions, baseOffset = 0) {
|
|
64
66
|
// Ignore non-agent rules
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v4.0.
|
|
2
|
+
* AGTree v4.0.2 (build date: Tue, 17 Mar 2026 23:34:38 GMT)
|
|
3
3
|
* (c) 2026 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
|
6
6
|
*/
|
|
7
|
-
import {
|
|
7
|
+
import { getAdblockSyntax } from '../../common/agent-common.js';
|
|
8
8
|
import { AdblockSyntaxError } from '../../errors/adblock-syntax-error.js';
|
|
9
9
|
import { AdblockSyntax } from '../../utils/adblockers.js';
|
|
10
|
+
import { StringUtils } from '../../utils/string.js';
|
|
11
|
+
import { isUndefined } from '../../utils/type-guards.js';
|
|
10
12
|
import { BaseParser } from '../base-parser.js';
|
|
11
|
-
import { defaultParserOptions } from '../options.js';
|
|
12
13
|
import { ValueParser } from '../misc/value-parser.js';
|
|
13
|
-
import {
|
|
14
|
-
import { getAdblockSyntax } from '../../common/agent-common.js';
|
|
14
|
+
import { defaultParserOptions } from '../options.js';
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* `AgentParser` is responsible for parsing single adblock agent elements.
|
|
@@ -36,8 +36,9 @@ class AgentParser extends BaseParser {
|
|
|
36
36
|
* The string can have a version in formats like
|
|
37
37
|
* [Adblock Plus 2.0], or [Adblock Plus 3.1; AdGuard].
|
|
38
38
|
*
|
|
39
|
-
* @param str String to check
|
|
40
|
-
*
|
|
39
|
+
* @param str String to check.
|
|
40
|
+
*
|
|
41
|
+
* @returns `true` if the string is a valid version, `false` otherwise.
|
|
41
42
|
*/
|
|
42
43
|
static isValidVersion(str) {
|
|
43
44
|
// Check if the string contains a valid version pattern
|
|
@@ -49,8 +50,10 @@ class AgentParser extends BaseParser {
|
|
|
49
50
|
* @param raw Raw input to parse.
|
|
50
51
|
* @param options Global parser options.
|
|
51
52
|
* @param baseOffset Starting offset of the input. Node locations are calculated relative to this offset.
|
|
52
|
-
*
|
|
53
|
-
* @
|
|
53
|
+
*
|
|
54
|
+
* @returns Agent rule AST.
|
|
55
|
+
*
|
|
56
|
+
* @throws {AdblockSyntaxError} If the raw rule cannot be parsed as an adblock agent.
|
|
54
57
|
*/
|
|
55
58
|
static parse(raw, options = defaultParserOptions, baseOffset = 0) {
|
|
56
59
|
let offset = 0;
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v4.0.
|
|
2
|
+
* AGTree v4.0.2 (build date: Tue, 17 Mar 2026 23:34:38 GMT)
|
|
3
3
|
* (c) 2026 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
|
6
6
|
*/
|
|
7
|
+
import { BaseParser } from '../base-parser.js';
|
|
8
|
+
import { defaultParserOptions } from '../options.js';
|
|
7
9
|
import { AgentCommentParser } from './agent-comment-parser.js';
|
|
8
10
|
import { ConfigCommentParser } from './config-comment-parser.js';
|
|
9
11
|
import { HintCommentParser } from './hint-comment-parser.js';
|
|
10
12
|
import { MetadataCommentParser } from './metadata-comment-parser.js';
|
|
11
13
|
import { PreProcessorCommentParser } from './preprocessor-parser.js';
|
|
12
|
-
import { defaultParserOptions } from '../options.js';
|
|
13
|
-
import { BaseParser } from '../base-parser.js';
|
|
14
14
|
import { SimpleCommentParser } from './simple-comment-parser.js';
|
|
15
15
|
|
|
16
|
-
/* eslint-disable no-param-reassign */
|
|
17
16
|
/**
|
|
18
17
|
* `CommentParser` is responsible for parsing any comment-like adblock rules.
|
|
19
18
|
*
|
|
@@ -74,8 +73,9 @@ class CommentParser extends BaseParser {
|
|
|
74
73
|
/**
|
|
75
74
|
* Checks whether a rule is a comment.
|
|
76
75
|
*
|
|
77
|
-
* @param raw Raw rule
|
|
78
|
-
*
|
|
76
|
+
* @param raw Raw rule.
|
|
77
|
+
*
|
|
78
|
+
* @returns `true` if the rule is a comment, `false` otherwise.
|
|
79
79
|
*/
|
|
80
80
|
static isCommentRule(raw) {
|
|
81
81
|
const trimmed = raw.trim();
|
|
@@ -87,7 +87,8 @@ class CommentParser extends BaseParser {
|
|
|
87
87
|
* @param raw Raw input to parse.
|
|
88
88
|
* @param options Global parser options.
|
|
89
89
|
* @param baseOffset Starting offset of the input. Node locations are calculated relative to this offset.
|
|
90
|
-
*
|
|
90
|
+
*
|
|
91
|
+
* @returns Comment AST or null (if the raw rule cannot be parsed as comment).
|
|
91
92
|
*/
|
|
92
93
|
static parse(raw, options = defaultParserOptions, baseOffset = 0) {
|
|
93
94
|
// Ignore non-comment rules
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v4.0.
|
|
2
|
+
* AGTree v4.0.2 (build date: Tue, 17 Mar 2026 23:34:38 GMT)
|
|
3
3
|
* (c) 2026 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
|
6
6
|
*/
|
|
7
7
|
import JSON5 from 'json5';
|
|
8
|
+
import { CommentMarker, RuleCategory, CommentRuleType } from '../../nodes/index.js';
|
|
8
9
|
import { AdblockSyntax } from '../../utils/adblockers.js';
|
|
9
10
|
import { AGLINT_CONFIG_COMMENT_MARKER, AGLINT_COMMAND_PREFIX, COMMA } from '../../utils/constants.js';
|
|
10
|
-
import { CommentMarker, RuleCategory, CommentRuleType } from '../../nodes/index.js';
|
|
11
11
|
import { StringUtils } from '../../utils/string.js';
|
|
12
|
-
import { ParameterListParser } from '../misc/parameter-list-parser.js';
|
|
13
|
-
import { defaultParserOptions } from '../options.js';
|
|
14
12
|
import { BaseParser } from '../base-parser.js';
|
|
13
|
+
import { ParameterListParser } from '../misc/parameter-list-parser.js';
|
|
15
14
|
import { ValueParser } from '../misc/value-parser.js';
|
|
15
|
+
import { defaultParserOptions } from '../options.js';
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* @file AGLint configuration comments. Inspired by ESLint inline configuration comments.
|
|
19
|
+
*
|
|
19
20
|
* @see {@link https://eslint.org/docs/latest/user-guide/configuring/rules#using-configuration-comments}
|
|
20
21
|
*/
|
|
21
22
|
/**
|
|
@@ -28,7 +29,8 @@ class ConfigCommentParser extends BaseParser {
|
|
|
28
29
|
/**
|
|
29
30
|
* Checks if the raw rule is an inline configuration comment rule.
|
|
30
31
|
*
|
|
31
|
-
* @param raw Raw rule
|
|
32
|
+
* @param raw Raw rule.
|
|
33
|
+
*
|
|
32
34
|
* @returns `true` if the rule is an inline configuration comment rule, otherwise `false`.
|
|
33
35
|
*/
|
|
34
36
|
static isConfigComment(raw) {
|
|
@@ -53,8 +55,9 @@ class ConfigCommentParser extends BaseParser {
|
|
|
53
55
|
* @param raw Raw input to parse.
|
|
54
56
|
* @param options Global parser options.
|
|
55
57
|
* @param baseOffset Starting offset of the input. Node locations are calculated relative to this offset.
|
|
58
|
+
*
|
|
56
59
|
* @returns
|
|
57
|
-
* Inline configuration comment AST or null (if the raw rule cannot be parsed as configuration comment)
|
|
60
|
+
* Inline configuration comment AST or null (if the raw rule cannot be parsed as configuration comment).
|
|
58
61
|
*/
|
|
59
62
|
static parse(raw, options = defaultParserOptions, baseOffset = 0) {
|
|
60
63
|
if (!ConfigCommentParser.isConfigComment(raw)) {
|