@adguard/agtree 2.0.0 → 2.0.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/agtree.cjs +600 -114
- package/dist/agtree.d.ts +53 -3
- package/dist/agtree.esm.js +599 -115
- package/dist/agtree.iife.min.js +5 -5
- package/dist/agtree.umd.min.js +5 -5
- package/dist/build.txt +1 -1
- package/dist/compatibility-tables.json +286 -98
- package/package.json +1 -1
package/dist/agtree.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v2.0.
|
|
2
|
+
* AGTree v2.0.1 (build date: Fri, 06 Sep 2024 12:11:38 GMT)
|
|
3
3
|
* (c) 2024 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
|
@@ -3700,9 +3700,29 @@ declare const modifierDataSchema: zod.ZodEffects<zod.ZodTypeAny, {
|
|
|
3700
3700
|
type ModifierDataSchema = zod.infer<typeof modifierDataSchema>;
|
|
3701
3701
|
|
|
3702
3702
|
/**
|
|
3703
|
-
* @file
|
|
3703
|
+
* @file Resource type schema.
|
|
3704
3704
|
*/
|
|
3705
3705
|
|
|
3706
|
+
/**
|
|
3707
|
+
* Resource type.
|
|
3708
|
+
*
|
|
3709
|
+
* @see {@link https://developer.chrome.com/docs/extensions/reference/declarativeNetRequest/#type-ResourceType}
|
|
3710
|
+
*/
|
|
3711
|
+
declare enum ResourceType {
|
|
3712
|
+
MainFrame = "main_frame",
|
|
3713
|
+
SubFrame = "sub_frame",
|
|
3714
|
+
Stylesheet = "stylesheet",
|
|
3715
|
+
Script = "script",
|
|
3716
|
+
Image = "image",
|
|
3717
|
+
Font = "font",
|
|
3718
|
+
Object = "object",
|
|
3719
|
+
XmlHttpRequest = "xmlhttprequest",
|
|
3720
|
+
Ping = "ping",
|
|
3721
|
+
Media = "media",
|
|
3722
|
+
WebSocket = "websocket",
|
|
3723
|
+
Other = "other"
|
|
3724
|
+
}
|
|
3725
|
+
|
|
3706
3726
|
/**
|
|
3707
3727
|
* Zod schema for redirect data.
|
|
3708
3728
|
*/
|
|
@@ -3718,6 +3738,7 @@ declare const redirectDataSchema: zod.ZodEffects<zod.ZodTypeAny, {
|
|
|
3718
3738
|
removed: boolean;
|
|
3719
3739
|
removalMessage: string | null;
|
|
3720
3740
|
isBlocking: boolean;
|
|
3741
|
+
resourceTypes: ResourceType[];
|
|
3721
3742
|
}, any>;
|
|
3722
3743
|
/**
|
|
3723
3744
|
* Type of the redirect data schema.
|
|
@@ -4039,6 +4060,16 @@ declare class RedirectsCompatibilityTable extends CompatibilityTableBase<Redirec
|
|
|
4039
4060
|
* @param data Compatibility table data.
|
|
4040
4061
|
*/
|
|
4041
4062
|
constructor(data: CompatibilityTable<RedirectDataSchema>);
|
|
4063
|
+
/**
|
|
4064
|
+
* Gets the resource type adblock modifiers for the redirect for the given platform
|
|
4065
|
+
* based on the `resourceTypes` field.
|
|
4066
|
+
*
|
|
4067
|
+
* @param redirect Redirect name or redirect data.
|
|
4068
|
+
* @param platform Platform to get the modifiers for.
|
|
4069
|
+
*
|
|
4070
|
+
* @returns Set of resource type modifiers or an empty set if the redirect is not found or has no resource types.
|
|
4071
|
+
*/
|
|
4072
|
+
getResourceTypeModifiers(redirect: string | RedirectDataSchema, platform: SpecificPlatform | GenericPlatform): Set<string>;
|
|
4042
4073
|
}
|
|
4043
4074
|
/**
|
|
4044
4075
|
* Compatibility table instance for redirects.
|
|
@@ -4090,9 +4121,28 @@ declare const getPlatformId: (platform: string) => SpecificPlatform | GenericPla
|
|
|
4090
4121
|
*/
|
|
4091
4122
|
declare const getSpecificPlatformName: (platform: SpecificPlatform) => string;
|
|
4092
4123
|
|
|
4124
|
+
/**
|
|
4125
|
+
* Gets the adblock modifier name for the given resource type.
|
|
4126
|
+
*
|
|
4127
|
+
* @param resourceType Resource type to get the modifier name for.
|
|
4128
|
+
* @param platform Platform to get the modifier for.
|
|
4129
|
+
*
|
|
4130
|
+
* @returns A string containing the adblock modifier name for the given resource type
|
|
4131
|
+
* or `null` if the modifier could not be found.
|
|
4132
|
+
*/
|
|
4133
|
+
declare const getResourceTypeModifier: (resourceType: ResourceType, platform: SpecificPlatform | GenericPlatform) => string | null;
|
|
4134
|
+
/**
|
|
4135
|
+
* Checks if the given resource type is valid.
|
|
4136
|
+
*
|
|
4137
|
+
* @param resourceType Resource type to check.
|
|
4138
|
+
*
|
|
4139
|
+
* @returns `true` if the resource type is valid, `false` otherwise.
|
|
4140
|
+
*/
|
|
4141
|
+
declare const isValidResourceType: (resourceType: string) => boolean;
|
|
4142
|
+
|
|
4093
4143
|
/**
|
|
4094
4144
|
* @file AGTree version
|
|
4095
4145
|
*/
|
|
4096
4146
|
declare const AGTREE_VERSION: string;
|
|
4097
4147
|
|
|
4098
|
-
export { ADBLOCK_URL_SEPARATOR, ADBLOCK_URL_SEPARATOR_REGEX, ADBLOCK_URL_START, ADBLOCK_URL_START_REGEX, ADBLOCK_WILDCARD, ADBLOCK_WILDCARD_REGEX, ADG_SCRIPTLET_MASK, AGLINT_COMMAND_PREFIX, AGTREE_VERSION, AdblockSyntax, AdblockSyntaxError, Agent, AgentCommentRule, AgentCommentRuleParser, AgentParser, AnyCommentRule, AnyCosmeticRule, AnyExpressionNode, AnyNetworkRule, AnyRule, AppListParser, BINARY_SCHEMA_VERSION, BinarySchemaMismatchError, ByteBuffer, COMMA_DOMAIN_LIST_SEPARATOR, CommentBase, CommentMarker, CommentRule, CommentRuleParser, CommentRuleType, CompatibilityTable, CompatibilityTableRow, ConfigCommentRule, ConfigCommentRuleParser, CosmeticRule, CosmeticRuleParser, CosmeticRuleSeparator, CosmeticRuleSeparatorFinderResult, CosmeticRuleSeparatorUtils, CosmeticRuleType, CssInjectionRule, CssInjectionRuleBody, Domain, DomainList, DomainListParser, DomainListSeparator, DomainUtils, EXT_CSS_LEGACY_ATTRIBUTES, EXT_CSS_PSEUDO_CLASSES, ElementHidingRule, ElementHidingRuleBody, EmptyRule, ExpressionOperatorNode, ExpressionParenthesisNode, ExpressionVariableNode, FORBIDDEN_CSS_FUNCTIONS, FilterList, FilterListConverter, FilterListParser, GenericPlatform, HINT_MARKER, Hint, HintCommentRule, HintCommentRuleParser, HintParser, HostRule, HostRuleParser, HostnameList, HtmlFilteringRule, HtmlFilteringRuleBody, IF, INCLUDE, InputByteBuffer, JsInjectionRule, KNOWN_METADATA_HEADERS, Location, LocationRange, LogicalExpressionParser, LogicalExpressionUtils, MODIFIERS_SEPARATOR, MODIFIER_ASSIGN_OPERATOR, MetadataCommentRule, MetadataCommentRuleParser, MethodListParser, Modifier, ModifierList, ModifierListParser, ModifierParser, NEGATION_MARKER, NETWORK_RULE_EXCEPTION_MARKER, NETWORK_RULE_SEPARATOR, NetworkRule, NetworkRuleParser, NetworkRuleType, Node, NotImplementedError, OutputByteBuffer, PIPE_MODIFIER_SEPARATOR, PREPROCESSOR_MARKER, ParameterList, ParameterListParser, ParserOptions, Position, PositionProvider, PreProcessorCommentRule, PreProcessorCommentRuleParser, ProductRecords, QuoteType, QuoteUtils, RawFilterListConverter, RawRuleConverter, RegExpUtils, RowByProduct, RowsByProduct, RuleBase, RuleCategorizer, RuleCategory, RuleConversionError, RuleConverter, RuleParser, SAFARI_CB_AFFINITY, SPECIAL_REGEX_SYMBOLS, ScriptletInjectionRule, ScriptletInjectionRuleBody, SpecificPlatform, StealthOptionListParser, TextEncoderPolyfillResult, UBO_SCRIPTLET_MASK, Value, VariableTable, decodeTextPolyfill, defaultParserOptions, encodeIntoPolyfill, getPlatformId, getSpecificPlatformName, isGenericPlatform, modifierValidator, modifiersCompatibilityTable, parseRawPlatforms, redirectsCompatibilityTable, scriptletsCompatibilityTable };
|
|
4148
|
+
export { ADBLOCK_URL_SEPARATOR, ADBLOCK_URL_SEPARATOR_REGEX, ADBLOCK_URL_START, ADBLOCK_URL_START_REGEX, ADBLOCK_WILDCARD, ADBLOCK_WILDCARD_REGEX, ADG_SCRIPTLET_MASK, AGLINT_COMMAND_PREFIX, AGTREE_VERSION, AdblockSyntax, AdblockSyntaxError, Agent, AgentCommentRule, AgentCommentRuleParser, AgentParser, AnyCommentRule, AnyCosmeticRule, AnyExpressionNode, AnyNetworkRule, AnyRule, AppListParser, BINARY_SCHEMA_VERSION, BinarySchemaMismatchError, ByteBuffer, COMMA_DOMAIN_LIST_SEPARATOR, CommentBase, CommentMarker, CommentRule, CommentRuleParser, CommentRuleType, CompatibilityTable, CompatibilityTableRow, ConfigCommentRule, ConfigCommentRuleParser, CosmeticRule, CosmeticRuleParser, CosmeticRuleSeparator, CosmeticRuleSeparatorFinderResult, CosmeticRuleSeparatorUtils, CosmeticRuleType, CssInjectionRule, CssInjectionRuleBody, Domain, DomainList, DomainListParser, DomainListSeparator, DomainUtils, EXT_CSS_LEGACY_ATTRIBUTES, EXT_CSS_PSEUDO_CLASSES, ElementHidingRule, ElementHidingRuleBody, EmptyRule, ExpressionOperatorNode, ExpressionParenthesisNode, ExpressionVariableNode, FORBIDDEN_CSS_FUNCTIONS, FilterList, FilterListConverter, FilterListParser, GenericPlatform, HINT_MARKER, Hint, HintCommentRule, HintCommentRuleParser, HintParser, HostRule, HostRuleParser, HostnameList, HtmlFilteringRule, HtmlFilteringRuleBody, IF, INCLUDE, InputByteBuffer, JsInjectionRule, KNOWN_METADATA_HEADERS, Location, LocationRange, LogicalExpressionParser, LogicalExpressionUtils, MODIFIERS_SEPARATOR, MODIFIER_ASSIGN_OPERATOR, MetadataCommentRule, MetadataCommentRuleParser, MethodListParser, Modifier, ModifierList, ModifierListParser, ModifierParser, NEGATION_MARKER, NETWORK_RULE_EXCEPTION_MARKER, NETWORK_RULE_SEPARATOR, NetworkRule, NetworkRuleParser, NetworkRuleType, Node, NotImplementedError, OutputByteBuffer, PIPE_MODIFIER_SEPARATOR, PREPROCESSOR_MARKER, ParameterList, ParameterListParser, ParserOptions, Position, PositionProvider, PreProcessorCommentRule, PreProcessorCommentRuleParser, ProductRecords, QuoteType, QuoteUtils, RawFilterListConverter, RawRuleConverter, RegExpUtils, ResourceType, RowByProduct, RowsByProduct, RuleBase, RuleCategorizer, RuleCategory, RuleConversionError, RuleConverter, RuleParser, SAFARI_CB_AFFINITY, SPECIAL_REGEX_SYMBOLS, ScriptletInjectionRule, ScriptletInjectionRuleBody, SpecificPlatform, StealthOptionListParser, TextEncoderPolyfillResult, UBO_SCRIPTLET_MASK, Value, VariableTable, decodeTextPolyfill, defaultParserOptions, encodeIntoPolyfill, getPlatformId, getResourceTypeModifier, getSpecificPlatformName, isGenericPlatform, isValidResourceType, modifierValidator, modifiersCompatibilityTable, parseRawPlatforms, redirectsCompatibilityTable, scriptletsCompatibilityTable };
|