@adguard/agtree 3.3.0 → 3.4.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.
- 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 +11 -7
- 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 +290 -7
- 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 +2 -1
- package/dist/converter/cosmetic/scriptlet.js +1 -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 +28 -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 +28 -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
|
@@ -1,6 +1,30 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file Possible adblock syntaxes are listed here.
|
|
3
3
|
*/
|
|
4
|
+
/**
|
|
5
|
+
* Adblock products (specific adblockers, excludes 'Common').
|
|
6
|
+
*/
|
|
7
|
+
export declare const AdblockProduct: {
|
|
8
|
+
/**
|
|
9
|
+
* Adblock Plus.
|
|
10
|
+
*
|
|
11
|
+
* @see {@link https://adblockplus.org/}
|
|
12
|
+
*/
|
|
13
|
+
readonly Abp: "AdblockPlus";
|
|
14
|
+
/**
|
|
15
|
+
* uBlock Origin.
|
|
16
|
+
*
|
|
17
|
+
* @see {@link https://github.com/gorhill/uBlock}
|
|
18
|
+
*/
|
|
19
|
+
readonly Ubo: "UblockOrigin";
|
|
20
|
+
/**
|
|
21
|
+
* AdGuard.
|
|
22
|
+
*
|
|
23
|
+
* @see {@link https://adguard.com/}
|
|
24
|
+
*/
|
|
25
|
+
readonly Adg: "AdGuard";
|
|
26
|
+
};
|
|
27
|
+
export type AdblockProduct = typeof AdblockProduct[keyof typeof AdblockProduct];
|
|
4
28
|
/**
|
|
5
29
|
* Possible adblock syntaxes (supported by this library)
|
|
6
30
|
*/
|
|
@@ -47,3 +71,7 @@ export declare const AdblockSyntax: {
|
|
|
47
71
|
readonly Adg: "AdGuard";
|
|
48
72
|
};
|
|
49
73
|
export type AdblockSyntax = typeof AdblockSyntax[keyof typeof AdblockSyntax];
|
|
74
|
+
/**
|
|
75
|
+
* @deprecated Use AdblockProduct instead.
|
|
76
|
+
*/
|
|
77
|
+
export type StrictAdblockSyntax = AdblockProduct;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Utility for counting set bits in numbers.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Counts the number of set bits (1s) in a 32-bit number using Hamming Weight (SWAR) method.
|
|
6
|
+
*
|
|
7
|
+
* This is a fast bit counting algorithm that uses SWAR (SIMD Within A Register) technique.
|
|
8
|
+
* It's significantly faster than string conversion methods and works in O(1) time.
|
|
9
|
+
*
|
|
10
|
+
* @param a Number to count bits in.
|
|
11
|
+
*
|
|
12
|
+
* @returns The number of bits set to 1.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* getBitCount(0); // 0
|
|
17
|
+
* getBitCount(7); // 3 (0b111)
|
|
18
|
+
* getBitCount(0xFF); // 8 (0b11111111)
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare function getBitCount(a: number): number;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export { ADG_SCRIPTLET_MASK, AGLINT_COMMAND_PREFIX, COMMA_DOMAIN_LIST_SEPARATOR, NEGATION_MARKER, HINT_MARKER, IF, INCLUDE, MODIFIERS_SEPARATOR, MODIFIER_ASSIGN_OPERATOR, PIPE_MODIFIER_SEPARATOR, NETWORK_RULE_EXCEPTION_MARKER, NETWORK_RULE_SEPARATOR, PREPROCESSOR_MARKER, SAFARI_CB_AFFINITY, UBO_SCRIPTLET_MASK, COMMA, PIPE, } from './constants.js';
|
|
2
2
|
export { BINARY_SCHEMA_VERSION } from './binary-schema-version.js';
|
|
3
3
|
export { AdblockSyntax } from './adblockers.js';
|
|
4
|
+
export { getBitCount } from './bit-count.js';
|
|
5
|
+
export { type ReadonlyRecord } from './types.js';
|
|
4
6
|
export { type CosmeticRuleSeparatorFinderResult, CosmeticRuleSeparatorUtils } from './cosmetic-rule-separator.js';
|
|
5
7
|
export { DomainUtils } from './domain.js';
|
|
6
8
|
export { type VariableTable, LogicalExpressionUtils } from './logical-expression.js';
|
|
@@ -9,7 +9,7 @@ export interface Storage<K = string, V = unknown> {
|
|
|
9
9
|
* Writes the given data to the storage with the specified key.
|
|
10
10
|
*
|
|
11
11
|
* @param key The key to identify the data in the storage.
|
|
12
|
-
* @param
|
|
12
|
+
* @param data The data to write to the storage.
|
|
13
13
|
* @returns A promise that resolves when the write operation is complete.
|
|
14
14
|
*/
|
|
15
15
|
set(key: K, data: V): Promise<void>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Common utility types.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Readonly record type - makes all properties of a record readonly.
|
|
6
|
+
*
|
|
7
|
+
* @template K Key type (string, number, or symbol).
|
|
8
|
+
* @template V Value type.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* const config: ReadonlyRecord<string, number> = {
|
|
13
|
+
* timeout: 1000,
|
|
14
|
+
* retries: 3,
|
|
15
|
+
* };
|
|
16
|
+
* // config is readonly, cannot modify properties
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export type ReadonlyRecord<K extends string | number | symbol, V> = {
|
|
20
|
+
readonly [P in K]: V;
|
|
21
|
+
};
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Prefixes for different adblockers to describe the platform-specific modifiers data
|
|
3
|
-
* stored in the yaml files.
|
|
4
|
-
*/
|
|
5
|
-
export declare const BLOCKER_PREFIX: {
|
|
6
|
-
AdGuard: string;
|
|
7
|
-
UblockOrigin: string;
|
|
8
|
-
AdblockPlus: string;
|
|
9
|
-
};
|
|
10
1
|
/**
|
|
11
2
|
* Set of all allowed characters for app name except the dot `.`.
|
|
12
3
|
*/
|
|
@@ -10,14 +10,6 @@ export type ValidationResult = {
|
|
|
10
10
|
error?: string;
|
|
11
11
|
warn?: string;
|
|
12
12
|
};
|
|
13
|
-
/**
|
|
14
|
-
* Validates the noop modifier (i.e. only underscores).
|
|
15
|
-
*
|
|
16
|
-
* @param value Value of the modifier.
|
|
17
|
-
*
|
|
18
|
-
* @returns True if the modifier is valid, false otherwise.
|
|
19
|
-
*/
|
|
20
|
-
export declare const isValidNoopModifier: (value: string) => boolean;
|
|
21
13
|
/**
|
|
22
14
|
* Returns invalid validation result with given error message.
|
|
23
15
|
*
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* @file Validator for modifiers.
|
|
3
3
|
*/
|
|
4
4
|
import { type Modifier } from '../nodes/index.js';
|
|
5
|
-
import { AdblockSyntax } from '../utils/adblockers.js';
|
|
6
5
|
import { type ValidationResult } from './helpers.js';
|
|
6
|
+
import { type AnyPlatform } from '../compatibility-tables/index.js';
|
|
7
7
|
/**
|
|
8
8
|
* Modifier validator class.
|
|
9
9
|
*/
|
|
@@ -19,20 +19,21 @@ declare class ModifierValidator {
|
|
|
19
19
|
*/
|
|
20
20
|
exists: (modifier: Modifier) => boolean;
|
|
21
21
|
/**
|
|
22
|
-
* Checks whether the given `modifier` is valid for specified `
|
|
22
|
+
* Checks whether the given `modifier` is valid for specified `platforms`.
|
|
23
|
+
* It checks whether the modifier is supported by the product, deprecated, assignable, negatable, etc.
|
|
23
24
|
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* @param syntax Adblock syntax to check the modifier for.
|
|
29
|
-
* @param rawModifier Modifier AST node.
|
|
25
|
+
* @param platforms Platforms to check the modifier for. Can be a specific platform (e.g., AdgExtChrome)
|
|
26
|
+
* or a generic platform (e.g., AdgAny, UboExtChromium, or combination of multiple products).
|
|
27
|
+
* @param modifier Modifier AST node.
|
|
30
28
|
* @param isException Whether the modifier is used in exception rule, default to false.
|
|
31
29
|
* Needed to check whether the modifier is allowed only in blocking or exception rules.
|
|
32
30
|
*
|
|
31
|
+
* @note For single product: specific platforms use exact lookup, generic platforms use first match.
|
|
32
|
+
* If multiple products are specified (e.g., AdgAny | UboAny), validation is skipped and returns valid.
|
|
33
|
+
*
|
|
33
34
|
* @returns Result of modifier validation.
|
|
34
35
|
*/
|
|
35
|
-
validate: (
|
|
36
|
+
validate: (platforms: AnyPlatform, modifier: Modifier, isException?: boolean) => ValidationResult;
|
|
36
37
|
}
|
|
37
38
|
export declare const modifierValidator: ModifierValidator;
|
|
38
39
|
export {};
|
package/dist/utils/adblockers.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v3.
|
|
2
|
+
* AGTree v3.4.0 (build date: Fri, 28 Nov 2025 09:46:33 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
|
|
@@ -7,6 +7,29 @@
|
|
|
7
7
|
/**
|
|
8
8
|
* @file Possible adblock syntaxes are listed here.
|
|
9
9
|
*/
|
|
10
|
+
/**
|
|
11
|
+
* Adblock products (specific adblockers, excludes 'Common').
|
|
12
|
+
*/
|
|
13
|
+
const AdblockProduct = {
|
|
14
|
+
/**
|
|
15
|
+
* Adblock Plus.
|
|
16
|
+
*
|
|
17
|
+
* @see {@link https://adblockplus.org/}
|
|
18
|
+
*/
|
|
19
|
+
Abp: 'AdblockPlus',
|
|
20
|
+
/**
|
|
21
|
+
* uBlock Origin.
|
|
22
|
+
*
|
|
23
|
+
* @see {@link https://github.com/gorhill/uBlock}
|
|
24
|
+
*/
|
|
25
|
+
Ubo: 'UblockOrigin',
|
|
26
|
+
/**
|
|
27
|
+
* AdGuard.
|
|
28
|
+
*
|
|
29
|
+
* @see {@link https://adguard.com/}
|
|
30
|
+
*/
|
|
31
|
+
Adg: 'AdGuard',
|
|
32
|
+
};
|
|
10
33
|
/**
|
|
11
34
|
* Possible adblock syntaxes (supported by this library)
|
|
12
35
|
*/
|
|
@@ -31,7 +54,7 @@ const AdblockSyntax = {
|
|
|
31
54
|
* adblockers directly (probably supported by some on-the-fly conversion, but this is not the native syntax).
|
|
32
55
|
* @see {@link https://adblockplus.org/}
|
|
33
56
|
*/
|
|
34
|
-
Abp:
|
|
57
|
+
Abp: AdblockProduct.Abp,
|
|
35
58
|
/**
|
|
36
59
|
* uBlock Origin syntax.
|
|
37
60
|
*
|
|
@@ -40,7 +63,7 @@ const AdblockSyntax = {
|
|
|
40
63
|
* adblockers directly (probably supported by some on-the-fly conversion, but this is not the native syntax).
|
|
41
64
|
* @see {@link https://github.com/gorhill/uBlock}
|
|
42
65
|
*/
|
|
43
|
-
Ubo:
|
|
66
|
+
Ubo: AdblockProduct.Ubo,
|
|
44
67
|
/**
|
|
45
68
|
* AdGuard syntax.
|
|
46
69
|
*
|
|
@@ -50,7 +73,7 @@ const AdblockSyntax = {
|
|
|
50
73
|
* syntax).
|
|
51
74
|
* @see {@link https://adguard.com/}
|
|
52
75
|
*/
|
|
53
|
-
Adg:
|
|
76
|
+
Adg: AdblockProduct.Adg,
|
|
54
77
|
};
|
|
55
78
|
|
|
56
|
-
export { AdblockSyntax };
|
|
79
|
+
export { AdblockProduct, AdblockSyntax };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v3.
|
|
2
|
+
* AGTree v3.4.0 (build date: Fri, 28 Nov 2025 09:46:33 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
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* AGTree v3.4.0 (build date: Fri, 28 Nov 2025 09:46:33 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
|
+
/* eslint-disable no-param-reassign, no-bitwise */
|
|
8
|
+
/**
|
|
9
|
+
* @file Utility for counting set bits in numbers.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Counts the number of set bits (1s) in a 32-bit number using Hamming Weight (SWAR) method.
|
|
13
|
+
*
|
|
14
|
+
* This is a fast bit counting algorithm that uses SWAR (SIMD Within A Register) technique.
|
|
15
|
+
* It's significantly faster than string conversion methods and works in O(1) time.
|
|
16
|
+
*
|
|
17
|
+
* @param a Number to count bits in.
|
|
18
|
+
*
|
|
19
|
+
* @returns The number of bits set to 1.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* getBitCount(0); // 0
|
|
24
|
+
* getBitCount(7); // 3 (0b111)
|
|
25
|
+
* getBitCount(0xFF); // 8 (0b11111111)
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
function getBitCount(a) {
|
|
29
|
+
a -= ((a >>> 1) & 0x55555555);
|
|
30
|
+
a = (a & 0x33333333) + ((a >>> 2) & 0x33333333);
|
|
31
|
+
a = (a + (a >>> 4)) & 0x0F0F0F0F;
|
|
32
|
+
a += (a >>> 8);
|
|
33
|
+
a += (a >>> 16);
|
|
34
|
+
return a & 0x3F;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export { getBitCount };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v3.
|
|
2
|
+
* AGTree v3.4.0 (build date: Fri, 28 Nov 2025 09:46:33 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.0 (build date: Fri, 28 Nov 2025 09:46:33 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/clone.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v3.
|
|
2
|
+
* AGTree v3.4.0 (build date: Fri, 28 Nov 2025 09:46:33 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/constants.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v3.
|
|
2
|
+
* AGTree v3.4.0 (build date: Fri, 28 Nov 2025 09:46:33 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.0 (build date: Fri, 28 Nov 2025 09:46:33 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.0 (build date: Fri, 28 Nov 2025 09:46:33 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/domain.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v3.
|
|
2
|
+
* AGTree v3.4.0 (build date: Fri, 28 Nov 2025 09:46:33 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/error.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v3.
|
|
2
|
+
* AGTree v3.4.0 (build date: Fri, 28 Nov 2025 09:46:33 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/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v3.
|
|
2
|
+
* AGTree v3.4.0 (build date: Fri, 28 Nov 2025 09:46:33 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
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
export { ADG_SCRIPTLET_MASK, AGLINT_COMMAND_PREFIX, COMMA, COMMA_DOMAIN_LIST_SEPARATOR, HINT_MARKER, IF, INCLUDE, MODIFIERS_SEPARATOR, MODIFIER_ASSIGN_OPERATOR, NEGATION_MARKER, NETWORK_RULE_EXCEPTION_MARKER, NETWORK_RULE_SEPARATOR, PIPE, PIPE_MODIFIER_SEPARATOR, PREPROCESSOR_MARKER, SAFARI_CB_AFFINITY, UBO_SCRIPTLET_MASK } from './constants.js';
|
|
8
8
|
export { BINARY_SCHEMA_VERSION } from './binary-schema-version.js';
|
|
9
9
|
export { AdblockSyntax } from './adblockers.js';
|
|
10
|
+
export { getBitCount } from './bit-count.js';
|
|
10
11
|
export { CosmeticRuleSeparatorUtils } from './cosmetic-rule-separator.js';
|
|
11
12
|
export { DomainUtils } from './domain.js';
|
|
12
13
|
export { LogicalExpressionUtils } from './logical-expression.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v3.
|
|
2
|
+
* AGTree v3.4.0 (build date: Fri, 28 Nov 2025 09:46:33 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.0 (build date: Fri, 28 Nov 2025 09:46:33 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.0 (build date: Fri, 28 Nov 2025 09:46:33 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.0 (build date: Fri, 28 Nov 2025 09:46:33 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
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* AGTree v3.4.0 (build date: Fri, 28 Nov 2025 09:46:33 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.0 (build date: Fri, 28 Nov 2025 09:46:33 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.0 (build date: Fri, 28 Nov 2025 09:46:33 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.0 (build date: Fri, 28 Nov 2025 09:46:33 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.0 (build date: Fri, 28 Nov 2025 09:46:33 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.0 (build date: Fri, 28 Nov 2025 09:46:33 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.0 (build date: Fri, 28 Nov 2025 09:46:33 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.0 (build date: Fri, 28 Nov 2025 09:46:33 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.0 (build date: Fri, 28 Nov 2025 09:46:33 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.0 (build date: Fri, 28 Nov 2025 09:46:33 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.0 (build date: Fri, 28 Nov 2025 09:46:33 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 };
|