@adguard/agtree 3.3.1 → 3.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ast-utils/clone.js +1 -1
- package/dist/ast-utils/modifiers.js +1 -1
- package/dist/ast-utils/network-rules.js +1 -1
- package/dist/ast-utils/scriptlets.js +1 -1
- package/dist/common/abp-snippet-injection-body-common.js +1 -1
- package/dist/common/agent-common.js +1 -1
- package/dist/common/ubo-selector-common.js +1 -1
- package/dist/compatibility-tables/base.js +2 -2
- package/dist/compatibility-tables/compatibility-table-data.js +1 -1
- package/dist/compatibility-tables/modifiers.js +4 -3
- package/dist/compatibility-tables/platforms.js +32 -30
- package/dist/compatibility-tables/redirects.js +2 -2
- package/dist/compatibility-tables/schemas/base.js +1 -1
- package/dist/compatibility-tables/schemas/modifier.js +1 -1
- package/dist/compatibility-tables/schemas/platform.js +57 -4
- package/dist/compatibility-tables/schemas/redirect.js +1 -1
- package/dist/compatibility-tables/schemas/resource-type.js +1 -1
- package/dist/compatibility-tables/schemas/scriptlet.js +1 -1
- package/dist/compatibility-tables/scriptlets.js +1 -1
- package/dist/compatibility-tables/utils/platform-helpers.js +317 -34
- package/dist/compatibility-tables/utils/resource-type-helpers.js +2 -2
- package/dist/compatibility-tables/utils/zod-camelcase.js +1 -1
- package/dist/converter/base-interfaces/base-converter.js +1 -1
- package/dist/converter/base-interfaces/conversion-result.js +1 -1
- package/dist/converter/base-interfaces/rule-converter-base.js +1 -1
- package/dist/converter/comment/index.js +1 -1
- package/dist/converter/cosmetic/css.js +1 -1
- package/dist/converter/cosmetic/element-hiding.js +1 -1
- package/dist/converter/cosmetic/header-removal.js +1 -1
- package/dist/converter/cosmetic/html.js +1 -1
- package/dist/converter/cosmetic/index.js +1 -1
- package/dist/converter/cosmetic/rule-modifiers/adg.js +1 -1
- package/dist/converter/cosmetic/rule-modifiers/ubo.js +9 -1
- package/dist/converter/cosmetic/scriptlet.js +8 -1
- package/dist/converter/css/index.js +2 -1
- package/dist/converter/data/css.js +1 -1
- package/dist/converter/filter-list.js +1 -1
- package/dist/converter/index.js +1 -1
- package/dist/converter/misc/network-rule-modifier.js +1 -1
- package/dist/converter/network/index.js +1 -1
- package/dist/converter/raw-filter-list.js +1 -1
- package/dist/converter/raw-rule.js +2 -1
- package/dist/converter/rule.js +1 -1
- package/dist/deserializer/base-deserializer.js +1 -1
- package/dist/deserializer/comment/agent-comment-deserializer.js +1 -1
- package/dist/deserializer/comment/agent-deserializer.js +1 -1
- package/dist/deserializer/comment/comment-rule-deserializer.js +1 -1
- package/dist/deserializer/comment/config-comment-deserializer.js +1 -1
- package/dist/deserializer/comment/hint-comment-deserializer.js +1 -1
- package/dist/deserializer/comment/hint-deserializer.js +1 -1
- package/dist/deserializer/comment/metadata-comment-deserializer.js +1 -1
- package/dist/deserializer/comment/pre-processor-comment-deserializer.js +1 -1
- package/dist/deserializer/comment/simple-comment-deserializer.js +1 -1
- package/dist/deserializer/cosmetic/cosmetic-rule-deserializer.js +1 -1
- package/dist/deserializer/cosmetic/css-injection-body-deserializer.js +1 -1
- package/dist/deserializer/cosmetic/element-hiding-body-deserializer.js +1 -1
- package/dist/deserializer/cosmetic/scriptlet-body/abp-snippet-injection-body-deserializer.js +1 -1
- package/dist/deserializer/cosmetic/scriptlet-body/adg-scriptlet-injection-body-deserializer.js +1 -1
- package/dist/deserializer/cosmetic/scriptlet-body/scriptlet-body-deserializer.js +1 -1
- package/dist/deserializer/cosmetic/scriptlet-body/ubo-scriptlet-injection-body-deserializer.js +1 -1
- package/dist/deserializer/empty-rule-deserializer.js +1 -1
- package/dist/deserializer/filterlist-deserializer.js +1 -1
- package/dist/deserializer/index.js +1 -1
- package/dist/deserializer/invalid-rule-deserializer.js +1 -1
- package/dist/deserializer/invalid-rule-error-node-deserializer.js +1 -1
- package/dist/deserializer/misc/domain-list-deserializer.js +1 -1
- package/dist/deserializer/misc/list-item-deserializer.js +1 -1
- package/dist/deserializer/misc/list-items-deserializer.js +1 -1
- package/dist/deserializer/misc/logical-expression-deserializer.js +1 -1
- package/dist/deserializer/misc/modifier-deserializer.js +1 -1
- package/dist/deserializer/misc/modifier-list-deserializer.js +1 -1
- package/dist/deserializer/misc/parameter-list-deserializer.js +1 -1
- package/dist/deserializer/misc/value-deserializer.js +1 -1
- package/dist/deserializer/network/host-rule-deserializer.js +1 -1
- package/dist/deserializer/network/hostname-list-deserializer.js +1 -1
- package/dist/deserializer/network/network-rule-deserializer.js +1 -1
- package/dist/deserializer/rule-deserializer.js +1 -1
- package/dist/deserializer/syntax-deserialization-map.js +1 -1
- package/dist/errors/adblock-syntax-error.js +1 -1
- package/dist/errors/binary-schema-mismatch-error.js +1 -1
- package/dist/errors/not-implemented-error.js +1 -1
- package/dist/errors/rule-conversion-error.js +1 -1
- package/dist/generator/base-generator.js +1 -1
- package/dist/generator/comment/agent-comment-generator.js +1 -1
- package/dist/generator/comment/agent-generator.js +1 -1
- package/dist/generator/comment/comment-rule-generator.js +1 -1
- package/dist/generator/comment/config-comment-generator.js +1 -1
- package/dist/generator/comment/hint-comment-generator.js +1 -1
- package/dist/generator/comment/hint-generator.js +1 -1
- package/dist/generator/comment/metadata-comment-generator.js +1 -1
- package/dist/generator/comment/pre-processor-comment-generator.js +1 -1
- package/dist/generator/comment/simple-comment-generator.js +1 -1
- package/dist/generator/cosmetic/body/abp-snippet-injection-body-generator.js +1 -1
- package/dist/generator/cosmetic/body/adg-scriptlet-injection-body-generator.js +1 -1
- package/dist/generator/cosmetic/body/ubo-scriptlet-injection-body-generator.js +1 -1
- package/dist/generator/cosmetic/cosmetic-rule-body-generator.js +1 -1
- package/dist/generator/cosmetic/cosmetic-rule-generator.js +1 -1
- package/dist/generator/cosmetic/cosmetic-rule-pattern-generator.js +1 -1
- package/dist/generator/css/adg-css-injection-generator.js +1 -1
- package/dist/generator/filterlist-generator.js +1 -1
- package/dist/generator/index.js +1 -1
- package/dist/generator/misc/domain-list-generator.js +1 -1
- package/dist/generator/misc/list-items-generator.js +1 -1
- package/dist/generator/misc/logical-expression-generator.js +1 -1
- package/dist/generator/misc/modifier-generator.js +1 -1
- package/dist/generator/misc/modifier-list-generator.js +1 -1
- package/dist/generator/misc/parameter-list-generator.js +1 -1
- package/dist/generator/misc/value-generator.js +1 -1
- package/dist/generator/network/host-rule-generator.js +1 -1
- package/dist/generator/network/network-rule-generator.js +1 -1
- package/dist/generator/rule-generator.js +1 -1
- package/dist/index.js +4 -4
- package/dist/marshalling-utils/comment/agent-comment-common.js +1 -1
- package/dist/marshalling-utils/comment/agent-common.js +1 -1
- package/dist/marshalling-utils/comment/config-comment-common.js +1 -1
- package/dist/marshalling-utils/comment/hint-comment-common.js +1 -1
- package/dist/marshalling-utils/comment/hint-common.js +1 -1
- package/dist/marshalling-utils/comment/metadata-comment-common.js +1 -1
- package/dist/marshalling-utils/comment/pre-processor-comment-common.js +1 -1
- package/dist/marshalling-utils/comment/simple-comment-common.js +1 -1
- package/dist/marshalling-utils/cosmetic/body/abp-snippet-injection-body-common.js +1 -1
- package/dist/marshalling-utils/cosmetic/body/adg-scriptlet-injection-body-common.js +1 -1
- package/dist/marshalling-utils/cosmetic/body/css-injection-body-common.js +1 -1
- package/dist/marshalling-utils/cosmetic/body/element-hiding-body-common.js +1 -1
- package/dist/marshalling-utils/cosmetic/body/ubo-scriptlet-injection-body-common.js +1 -1
- package/dist/marshalling-utils/cosmetic/cosmetic-rule-common.js +1 -1
- package/dist/marshalling-utils/empty-rule-common.js +1 -1
- package/dist/marshalling-utils/filter-list-common.js +1 -1
- package/dist/marshalling-utils/invalid-rule-common.js +1 -1
- package/dist/marshalling-utils/invalid-rule-error-node-common.js +1 -1
- package/dist/marshalling-utils/misc/binary-type-common.js +1 -1
- package/dist/marshalling-utils/misc/domain-list-common.js +1 -1
- package/dist/marshalling-utils/misc/host-rule-common.js +1 -1
- package/dist/marshalling-utils/misc/hostname-list-common.js +1 -1
- package/dist/marshalling-utils/misc/list-item-common.js +1 -1
- package/dist/marshalling-utils/misc/logical-expression-common.js +1 -1
- package/dist/marshalling-utils/misc/modifier-common.js +1 -1
- package/dist/marshalling-utils/misc/modifier-list-common.js +1 -1
- package/dist/marshalling-utils/misc/parameter-list-common.js +1 -1
- package/dist/marshalling-utils/misc/value-common.js +1 -1
- package/dist/marshalling-utils/network/network-rule-common.js +1 -1
- package/dist/marshalling-utils/syntax-serialization-map.js +1 -1
- package/dist/nodes/index.js +1 -1
- package/dist/package.json.js +2 -2
- package/dist/parser/base-parser.js +1 -1
- package/dist/parser/comment/agent-comment-parser.js +1 -1
- package/dist/parser/comment/agent-parser.js +1 -1
- package/dist/parser/comment/comment-parser.js +1 -1
- package/dist/parser/comment/config-comment-parser.js +1 -1
- package/dist/parser/comment/hint-comment-parser.js +1 -1
- package/dist/parser/comment/hint-parser.js +1 -1
- package/dist/parser/comment/metadata-comment-parser.js +1 -1
- package/dist/parser/comment/preprocessor-parser.js +1 -1
- package/dist/parser/comment/simple-comment-parser.js +1 -1
- package/dist/parser/cosmetic/body/abp-snippet-injection-body-parser.js +1 -1
- package/dist/parser/cosmetic/body/adg-scriptlet-injection-body-parser.js +1 -1
- package/dist/parser/cosmetic/body/ubo-scriptlet-injection-body-parser.js +1 -1
- package/dist/parser/cosmetic/cosmetic-rule-parser.js +1 -1
- package/dist/parser/css/adg-css-injection-parser.js +1 -1
- package/dist/parser/css/balancing.js +1 -1
- package/dist/parser/css/constants.js +1 -1
- package/dist/parser/css/css-token-stream.js +1 -1
- package/dist/parser/css/ubo-selector-parser.js +1 -1
- package/dist/parser/filterlist-parser.js +1 -1
- package/dist/parser/index.js +1 -1
- package/dist/parser/misc/app-list-parser.js +1 -1
- package/dist/parser/misc/domain-list-parser.js +1 -1
- package/dist/parser/misc/list-items-parser.js +1 -1
- package/dist/parser/misc/logical-expression-parser.js +1 -1
- package/dist/parser/misc/method-list-parser.js +1 -1
- package/dist/parser/misc/modifier-list.js +1 -1
- package/dist/parser/misc/modifier-parser.js +1 -1
- package/dist/parser/misc/parameter-list-parser.js +1 -1
- package/dist/parser/misc/stealth-option-list-parser.js +1 -1
- package/dist/parser/misc/ubo-parameter-list-parser.js +1 -1
- package/dist/parser/misc/value-parser.js +1 -1
- package/dist/parser/network/host-rule-parser.js +1 -1
- package/dist/parser/network/network-rule-parser.js +1 -1
- package/dist/parser/options.js +1 -1
- package/dist/parser/rule-parser.js +1 -1
- package/dist/serializer/base-serializer.js +1 -1
- package/dist/serializer/comment/agent-comment-serializer.js +1 -1
- package/dist/serializer/comment/agent-serializer.js +1 -1
- package/dist/serializer/comment/comment-rule-serializer.js +1 -1
- package/dist/serializer/comment/config-comment-serializer.js +1 -1
- package/dist/serializer/comment/hint-comment-serializer.js +1 -1
- package/dist/serializer/comment/hint-serializer.js +1 -1
- package/dist/serializer/comment/metadata-comment-serializer.js +1 -1
- package/dist/serializer/comment/pre-processor-comment-serializer.js +1 -1
- package/dist/serializer/comment/simple-comment-serializer.js +1 -1
- package/dist/serializer/cosmetic/body/abp-snippet-injection-body-serializer.js +1 -1
- package/dist/serializer/cosmetic/body/adg-scriptlet-injection-body-serializer.js +1 -1
- package/dist/serializer/cosmetic/body/scriptlet-body-serializer.js +1 -1
- package/dist/serializer/cosmetic/body/ubo-scriptlet-injection-body-serializer.js +1 -1
- package/dist/serializer/cosmetic/cosmetic-rule-serializer.js +1 -1
- package/dist/serializer/cosmetic/css-injection-body-serializer.js +1 -1
- package/dist/serializer/cosmetic/element-hiding-body-serializer.js +1 -1
- package/dist/serializer/empty-rule-serializer.js +1 -1
- package/dist/serializer/filterlist-serializer.js +1 -1
- package/dist/serializer/index.js +1 -1
- package/dist/serializer/invalid-rule-error-node-serializer.js +1 -1
- package/dist/serializer/invalid-rule-serializer.js +1 -1
- package/dist/serializer/misc/domain-list-serializer.js +1 -1
- package/dist/serializer/misc/list-item-serializer.js +1 -1
- package/dist/serializer/misc/list-items-serializer.js +1 -1
- package/dist/serializer/misc/logical-expression-serializer.js +1 -1
- package/dist/serializer/misc/modifier-list-serializer.js +1 -1
- package/dist/serializer/misc/modifier-serializer.js +1 -1
- package/dist/serializer/misc/parameter-list-serializer.js +1 -1
- package/dist/serializer/misc/value-serializer.js +1 -1
- package/dist/serializer/network/host-rule-serializer.js +1 -1
- package/dist/serializer/network/hostname-list-serializer.js +1 -1
- package/dist/serializer/network/network-rule-serializer.js +1 -1
- package/dist/serializer/rule-serializer.js +1 -1
- package/dist/types/compatibility-tables/base.d.ts +11 -11
- package/dist/types/compatibility-tables/index.d.ts +3 -2
- package/dist/types/compatibility-tables/platforms.d.ts +67 -33
- package/dist/types/compatibility-tables/redirects.d.ts +3 -3
- package/dist/types/compatibility-tables/schemas/base.d.ts +1 -1
- package/dist/types/compatibility-tables/schemas/platform.d.ts +16 -5
- package/dist/types/compatibility-tables/utils/platform-helpers.d.ts +112 -3
- package/dist/types/compatibility-tables/utils/resource-type-helpers.d.ts +3 -3
- package/dist/types/index.d.ts +2 -2
- package/dist/types/utils/adblockers.d.ts +45 -0
- package/dist/types/utils/bit-count.d.ts +21 -0
- package/dist/types/utils/index.d.ts +2 -0
- package/dist/types/utils/noop-modifier.d.ts +8 -0
- package/dist/types/utils/storage-interface.d.ts +1 -1
- package/dist/types/utils/types.d.ts +21 -0
- package/dist/types/validator/constants.d.ts +0 -9
- package/dist/types/validator/helpers.d.ts +0 -8
- package/dist/types/validator/index.d.ts +10 -9
- package/dist/utils/adblockers.js +59 -5
- package/dist/utils/binary-schema-version.js +1 -1
- package/dist/utils/bit-count.js +37 -0
- package/dist/utils/byte-buffer.js +1 -1
- package/dist/utils/categorizer.js +1 -1
- package/dist/utils/clone.js +1 -1
- package/dist/utils/constants.js +1 -1
- package/dist/utils/cosmetic-rule-separator.js +1 -1
- package/dist/utils/deep-freeze.js +1 -1
- package/dist/utils/domain.js +1 -1
- package/dist/utils/error.js +1 -1
- package/dist/utils/index.js +2 -1
- package/dist/utils/input-byte-buffer.js +1 -1
- package/dist/utils/is-chromium.js +1 -1
- package/dist/utils/logical-expression.js +1 -1
- package/dist/utils/multi-value-map.js +1 -1
- package/dist/utils/noop-modifier.js +29 -0
- package/dist/utils/output-byte-buffer.js +1 -1
- package/dist/utils/position-provider.js +1 -1
- package/dist/utils/quotes.js +1 -1
- package/dist/utils/regexp.js +1 -1
- package/dist/utils/string.js +1 -1
- package/dist/utils/text-decoder-polyfill.js +1 -1
- package/dist/utils/text-encoder-polyfill.js +1 -1
- package/dist/utils/type-guards.js +1 -1
- package/dist/validator/constants.js +3 -13
- package/dist/validator/helpers.js +2 -13
- package/dist/validator/index.js +44 -48
- package/dist/validator/value.js +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* AGTree v3.4.1 (build date: Fri, 28 Nov 2025 11:48:53 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 { UNDERSCORE } from './constants.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Validates the noop modifier (i.e. only underscores).
|
|
11
|
+
*
|
|
12
|
+
* @param value Value of the modifier.
|
|
13
|
+
*
|
|
14
|
+
* @returns True if the modifier is valid, false otherwise.
|
|
15
|
+
*/
|
|
16
|
+
const isValidNoopModifier = (value) => {
|
|
17
|
+
const { length } = value;
|
|
18
|
+
if (length === 0) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
for (let i = 0; i < length; i += 1) {
|
|
22
|
+
if (value[i] !== UNDERSCORE) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return true;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export { isValidNoopModifier };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v3.
|
|
2
|
+
* AGTree v3.4.1 (build date: Fri, 28 Nov 2025 11:48:53 GMT)
|
|
3
3
|
* (c) 2025 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 v3.
|
|
2
|
+
* AGTree v3.4.1 (build date: Fri, 28 Nov 2025 11:48:53 GMT)
|
|
3
3
|
* (c) 2025 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
package/dist/utils/quotes.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v3.
|
|
2
|
+
* AGTree v3.4.1 (build date: Fri, 28 Nov 2025 11:48:53 GMT)
|
|
3
3
|
* (c) 2025 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
package/dist/utils/regexp.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v3.
|
|
2
|
+
* AGTree v3.4.1 (build date: Fri, 28 Nov 2025 11:48:53 GMT)
|
|
3
3
|
* (c) 2025 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
package/dist/utils/string.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v3.
|
|
2
|
+
* AGTree v3.4.1 (build date: Fri, 28 Nov 2025 11:48:53 GMT)
|
|
3
3
|
* (c) 2025 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 v3.
|
|
2
|
+
* AGTree v3.4.1 (build date: Fri, 28 Nov 2025 11:48:53 GMT)
|
|
3
3
|
* (c) 2025 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 v3.
|
|
2
|
+
* AGTree v3.4.1 (build date: Fri, 28 Nov 2025 11:48:53 GMT)
|
|
3
3
|
* (c) 2025 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 v3.
|
|
2
|
+
* AGTree v3.4.1 (build date: Fri, 28 Nov 2025 11:48:53 GMT)
|
|
3
3
|
* (c) 2025 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
|
@@ -1,21 +1,11 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v3.
|
|
2
|
+
* AGTree v3.4.1 (build date: Fri, 28 Nov 2025 11:48:53 GMT)
|
|
3
3
|
* (c) 2025 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 { AdblockSyntax } from '../utils/adblockers.js';
|
|
8
7
|
import { CAPITAL_LETTERS, SMALL_LETTERS, NUMBERS, UNDERSCORE, OPEN_PARENTHESIS, CLOSE_PARENTHESIS } from '../utils/constants.js';
|
|
9
8
|
|
|
10
|
-
/**
|
|
11
|
-
* Prefixes for different adblockers to describe the platform-specific modifiers data
|
|
12
|
-
* stored in the yaml files.
|
|
13
|
-
*/
|
|
14
|
-
const BLOCKER_PREFIX = {
|
|
15
|
-
[AdblockSyntax.Adg]: 'adg_',
|
|
16
|
-
[AdblockSyntax.Ubo]: 'ubo_',
|
|
17
|
-
[AdblockSyntax.Abp]: 'abp_',
|
|
18
|
-
};
|
|
19
9
|
/**
|
|
20
10
|
* Set of all allowed characters for app name except the dot `.`.
|
|
21
11
|
*/
|
|
@@ -192,7 +182,7 @@ const VALIDATION_ERROR_PREFIX = {
|
|
|
192
182
|
NOT_EXISTENT: 'Non-existent modifier',
|
|
193
183
|
NOT_NEGATABLE_MODIFIER: 'Non-negatable modifier',
|
|
194
184
|
NOT_NEGATABLE_VALUE: 'Values cannot be negated for the modifier',
|
|
195
|
-
NOT_SUPPORTED: '
|
|
185
|
+
NOT_SUPPORTED: '%s does not support the modifier',
|
|
196
186
|
REMOVED: 'Removed and no longer supported modifier',
|
|
197
187
|
VALUE_FORBIDDEN: 'Value is not allowed for the modifier',
|
|
198
188
|
VALUE_INVALID: 'Value is invalid for the modifier',
|
|
@@ -207,4 +197,4 @@ const SOURCE_DATA_ERROR_PREFIX = {
|
|
|
207
197
|
NO_VALUE_FORMAT_FOR_ASSIGNABLE: "Property 'value_format' should be specified for the assignable modifier",
|
|
208
198
|
};
|
|
209
199
|
|
|
210
|
-
export { ALLOWED_CSP_DIRECTIVES, ALLOWED_METHODS, ALLOWED_PERMISSION_DIRECTIVES, ALLOWED_STEALTH_OPTIONS, APP_NAME_ALLOWED_CHARS,
|
|
200
|
+
export { ALLOWED_CSP_DIRECTIVES, ALLOWED_METHODS, ALLOWED_PERMISSION_DIRECTIVES, ALLOWED_STEALTH_OPTIONS, APP_NAME_ALLOWED_CHARS, EMPTY_PERMISSIONS_ALLOWLIST, PERMISSIONS_TOKEN_SELF, REFERRER_POLICY_DIRECTIVES, SOURCE_DATA_ERROR_PREFIX, VALIDATION_ERROR_PREFIX };
|
|
@@ -1,22 +1,11 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v3.
|
|
2
|
+
* AGTree v3.4.1 (build date: Fri, 28 Nov 2025 11:48:53 GMT)
|
|
3
3
|
* (c) 2025 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 { UNDERSCORE } from '../utils/constants.js';
|
|
8
7
|
import { VALIDATION_ERROR_PREFIX } from './constants.js';
|
|
9
8
|
|
|
10
|
-
/**
|
|
11
|
-
* Validates the noop modifier (i.e. only underscores).
|
|
12
|
-
*
|
|
13
|
-
* @param value Value of the modifier.
|
|
14
|
-
*
|
|
15
|
-
* @returns True if the modifier is valid, false otherwise.
|
|
16
|
-
*/
|
|
17
|
-
const isValidNoopModifier = (value) => {
|
|
18
|
-
return value.split('').every((char) => char === UNDERSCORE);
|
|
19
|
-
};
|
|
20
9
|
/**
|
|
21
10
|
* Returns invalid validation result with given error message.
|
|
22
11
|
*
|
|
@@ -42,4 +31,4 @@ const getValueRequiredValidationResult = (modifierName) => {
|
|
|
42
31
|
return getInvalidValidationResult(`${VALIDATION_ERROR_PREFIX.VALUE_REQUIRED}: '${modifierName}'`);
|
|
43
32
|
};
|
|
44
33
|
|
|
45
|
-
export { getInvalidValidationResult, getValueRequiredValidationResult
|
|
34
|
+
export { getInvalidValidationResult, getValueRequiredValidationResult };
|
package/dist/validator/index.js
CHANGED
|
@@ -1,59 +1,62 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v3.
|
|
2
|
+
* AGTree v3.4.1 (build date: Fri, 28 Nov 2025 11:48:53 GMT)
|
|
3
3
|
* (c) 2025 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 { sprintf } from 'sprintf-js';
|
|
8
8
|
import { UNDERSCORE, NEWLINE, SPACE } from '../utils/constants.js';
|
|
9
|
-
import { VALIDATION_ERROR_PREFIX, SOURCE_DATA_ERROR_PREFIX
|
|
10
|
-
import {
|
|
9
|
+
import { VALIDATION_ERROR_PREFIX, SOURCE_DATA_ERROR_PREFIX } from './constants.js';
|
|
10
|
+
import { getInvalidValidationResult, getValueRequiredValidationResult } from './helpers.js';
|
|
11
11
|
import { validateValue } from './value.js';
|
|
12
|
-
import { clone } from '../utils/clone.js';
|
|
13
12
|
import { modifiersCompatibilityTable } from '../compatibility-tables/modifiers.js';
|
|
14
|
-
import
|
|
13
|
+
import '../compatibility-tables/redirects.js';
|
|
14
|
+
import '../compatibility-tables/scriptlets.js';
|
|
15
|
+
import '../compatibility-tables/platforms.js';
|
|
16
|
+
import '../compatibility-tables/schemas/base.js';
|
|
17
|
+
import '../compatibility-tables/schemas/modifier.js';
|
|
18
|
+
import '../compatibility-tables/schemas/redirect.js';
|
|
19
|
+
import '../compatibility-tables/schemas/scriptlet.js';
|
|
20
|
+
import '../compatibility-tables/schemas/platform.js';
|
|
21
|
+
import { hasPlatformMultipleProducts, getHumanReadablePlatformName, isGenericPlatform } from '../compatibility-tables/utils/platform-helpers.js';
|
|
22
|
+
import '../compatibility-tables/schemas/resource-type.js';
|
|
23
|
+
import '../compatibility-tables/utils/resource-type-helpers.js';
|
|
24
|
+
import { isValidNoopModifier } from '../utils/noop-modifier.js';
|
|
15
25
|
|
|
16
26
|
/**
|
|
17
27
|
* @file Validator for modifiers.
|
|
18
28
|
*/
|
|
19
|
-
const convertSyntaxToGenericPlatform = (syntax) => {
|
|
20
|
-
switch (syntax) {
|
|
21
|
-
case AdblockSyntax.Adg:
|
|
22
|
-
return GenericPlatform.AdgAny;
|
|
23
|
-
case AdblockSyntax.Ubo:
|
|
24
|
-
return GenericPlatform.UboAny;
|
|
25
|
-
case AdblockSyntax.Abp:
|
|
26
|
-
return GenericPlatform.AbpAny;
|
|
27
|
-
default:
|
|
28
|
-
throw new Error(`Unknown syntax: ${syntax}`);
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
29
|
/**
|
|
32
|
-
* Fully checks whether the given `modifier` valid for
|
|
33
|
-
* is it supported by the
|
|
30
|
+
* Fully checks whether the given `modifier` is valid for a specific product platform:
|
|
31
|
+
* is it supported by the product, deprecated, assignable, negatable, etc.
|
|
34
32
|
*
|
|
35
|
-
* @param
|
|
36
|
-
*
|
|
33
|
+
* @param platform Platform to check the modifier for. Must be a specific platform (e.g., AdgExtChrome)
|
|
34
|
+
* or a generic platform for a single product (e.g., AdgAny, UboExtChromium).
|
|
35
|
+
* If multiple products are specified, validation is skipped and returns valid.
|
|
37
36
|
* @param modifier Parsed modifier AST node.
|
|
38
37
|
* @param isException Whether the modifier is used in exception rule.
|
|
39
38
|
* Needed to check whether the modifier is allowed only in blocking or exception rules.
|
|
40
39
|
*
|
|
41
40
|
* @returns Result of modifier validation.
|
|
42
41
|
*/
|
|
43
|
-
const
|
|
44
|
-
if (
|
|
45
|
-
throw new Error(
|
|
42
|
+
const validateForSpecificProduct = (platform, modifier, isException) => {
|
|
43
|
+
if (platform === 0) {
|
|
44
|
+
throw new Error('No platforms specified');
|
|
46
45
|
}
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
if (
|
|
50
|
-
|
|
46
|
+
const isGeneric = isGenericPlatform(platform);
|
|
47
|
+
// Skip validation if multiple products are specified
|
|
48
|
+
if (isGeneric && hasPlatformMultipleProducts(platform)) {
|
|
49
|
+
return { valid: true };
|
|
51
50
|
}
|
|
51
|
+
const modifierName = modifier.name.value;
|
|
52
52
|
// needed for validation of negation, assignment, etc.
|
|
53
|
-
|
|
53
|
+
// Use getSingle for specific platforms, getFirst for generic platforms
|
|
54
|
+
const specificBlockerData = isGeneric
|
|
55
|
+
? modifiersCompatibilityTable.getFirst(modifierName, platform)
|
|
56
|
+
: modifiersCompatibilityTable.getSingle(modifierName, platform);
|
|
54
57
|
// if no specific blocker data is found
|
|
55
58
|
if (!specificBlockerData) {
|
|
56
|
-
return getInvalidValidationResult(
|
|
59
|
+
return getInvalidValidationResult(sprintf(VALIDATION_ERROR_PREFIX.NOT_SUPPORTED, getHumanReadablePlatformName(platform)));
|
|
57
60
|
}
|
|
58
61
|
// e.g. 'object-subrequest'
|
|
59
62
|
if (specificBlockerData.removed) {
|
|
@@ -133,21 +136,21 @@ class ModifierValidator {
|
|
|
133
136
|
return modifiersCompatibilityTable.existsAny(modifier.name.value);
|
|
134
137
|
};
|
|
135
138
|
/**
|
|
136
|
-
* Checks whether the given `modifier` is valid for specified `
|
|
139
|
+
* Checks whether the given `modifier` is valid for specified `platforms`.
|
|
140
|
+
* It checks whether the modifier is supported by the product, deprecated, assignable, negatable, etc.
|
|
137
141
|
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
* @param syntax Adblock syntax to check the modifier for.
|
|
143
|
-
* @param rawModifier Modifier AST node.
|
|
142
|
+
* @param platforms Platforms to check the modifier for. Can be a specific platform (e.g., AdgExtChrome)
|
|
143
|
+
* or a generic platform (e.g., AdgAny, UboExtChromium, or combination of multiple products).
|
|
144
|
+
* @param modifier Modifier AST node.
|
|
144
145
|
* @param isException Whether the modifier is used in exception rule, default to false.
|
|
145
146
|
* Needed to check whether the modifier is allowed only in blocking or exception rules.
|
|
146
147
|
*
|
|
148
|
+
* @note For single product: specific platforms use exact lookup, generic platforms use first match.
|
|
149
|
+
* If multiple products are specified (e.g., AdgAny | UboAny), validation is skipped and returns valid.
|
|
150
|
+
*
|
|
147
151
|
* @returns Result of modifier validation.
|
|
148
152
|
*/
|
|
149
|
-
validate = (
|
|
150
|
-
const modifier = clone(rawModifier);
|
|
153
|
+
validate = (platforms, modifier, isException = false) => {
|
|
151
154
|
// special case: handle noop modifier which may be used as multiple underscores (not just one)
|
|
152
155
|
// https://adguard.com/kb/general/ad-filtering/create-own-filters/#noop-modifier
|
|
153
156
|
if (modifier.name.value.startsWith(UNDERSCORE)) {
|
|
@@ -155,18 +158,11 @@ class ModifierValidator {
|
|
|
155
158
|
if (!isValidNoopModifier(modifier.name.value)) {
|
|
156
159
|
return getInvalidValidationResult(`${VALIDATION_ERROR_PREFIX.INVALID_NOOP}: '${modifier.name.value}'`);
|
|
157
160
|
}
|
|
158
|
-
// otherwise, replace the modifier value with single underscore.
|
|
159
|
-
// it is needed to check whether the modifier is supported by specific adblocker due to the syntax
|
|
160
|
-
modifier.name.value = UNDERSCORE;
|
|
161
161
|
}
|
|
162
162
|
if (!this.exists(modifier)) {
|
|
163
163
|
return getInvalidValidationResult(`${VALIDATION_ERROR_PREFIX.NOT_EXISTENT}: '${modifier.name.value}'`);
|
|
164
164
|
}
|
|
165
|
-
|
|
166
|
-
if (syntax === AdblockSyntax.Common) {
|
|
167
|
-
return { valid: true };
|
|
168
|
-
}
|
|
169
|
-
return validateForSpecificSyntax(syntax, modifier, isException);
|
|
165
|
+
return validateForSpecificProduct(platforms, modifier, isException);
|
|
170
166
|
};
|
|
171
167
|
}
|
|
172
168
|
const modifierValidator = new ModifierValidator();
|
package/dist/validator/value.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v3.
|
|
2
|
+
* AGTree v3.4.1 (build date: Fri, 28 Nov 2025 11:48:53 GMT)
|
|
3
3
|
* (c) 2025 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
package/dist/version.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v3.
|
|
2
|
+
* AGTree v3.4.1 (build date: Fri, 28 Nov 2025 11:48:53 GMT)
|
|
3
3
|
* (c) 2025 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|