@adguard/agtree 1.1.0 → 1.1.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/CHANGELOG.md +18 -6
- package/README.md +24 -54
- package/dist/agtree.cjs +47 -21
- package/dist/agtree.d.ts +1 -1
- package/dist/agtree.esm.js +47 -21
- package/dist/agtree.iife.min.js +3 -3
- package/dist/agtree.umd.min.js +3 -3
- package/dist/build.txt +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,13 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
-
The format is based on [Keep a Changelog][keepachangelog], and this project
|
|
6
|
-
adheres to [Semantic Versioning][semver].
|
|
5
|
+
The format is based on [Keep a Changelog][keepachangelog], and this project adheres to [Semantic Versioning][semver].
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
## 1.1.2 - 2023-08-14
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- Compatibility tables validation of ABP syntax `$rewrite`
|
|
12
|
+
- Detecting closing parenthesis in ADG/uBO scriptlets while parsing
|
|
13
|
+
|
|
14
|
+
## 1.1.1 - 2023-08-11
|
|
10
15
|
|
|
11
|
-
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
- Validation of assignable modifiers which may be used without a value
|
|
19
|
+
|
|
20
|
+
## 1.1.0 - 2023-08-10
|
|
12
21
|
|
|
13
22
|
### Added
|
|
14
23
|
|
|
@@ -34,8 +43,11 @@ adheres to [Semantic Versioning][semver].
|
|
|
34
43
|
- Scriptlet parsing
|
|
35
44
|
- Metadata parsing
|
|
36
45
|
|
|
37
|
-
##
|
|
46
|
+
## 1.0.1 - 2023-05-24
|
|
38
47
|
|
|
39
48
|
### Added
|
|
40
49
|
|
|
41
50
|
- Migrated parser from AGLint to a separate package.
|
|
51
|
+
|
|
52
|
+
[keepachangelog]: https://keepachangelog.com/en/1.0.0/
|
|
53
|
+
[semver]: https://semver.org/spec/v2.0.0.html
|
package/README.md
CHANGED
|
@@ -1,56 +1,34 @@
|
|
|
1
1
|
<!-- markdownlint-disable -->
|
|
2
|
-
|
|
3
2
|
|
|
4
|
-
|
|
5
3
|
<p align="center">
|
|
6
4
|
<picture>
|
|
7
|
-
<source
|
|
8
|
-
|
|
9
|
-
srcset="https://cdn.adtidy.org/website/github.com/AGTree/agtree_darkmode.svg"
|
|
10
|
-
/>
|
|
11
|
-
<img
|
|
12
|
-
alt="AGTree"
|
|
13
|
-
src="https://cdn.adtidy.org/website/github.com/AGTree/agtree_lightmode.svg"
|
|
14
|
-
width="350px"
|
|
15
|
-
/>
|
|
5
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://cdn.adtidy.org/website/github.com/AGTree/agtree_darkmode.svg" />
|
|
6
|
+
<img alt="AGTree" src="https://cdn.adtidy.org/website/github.com/AGTree/agtree_lightmode.svg" width="350px" />
|
|
16
7
|
</picture>
|
|
17
8
|
</p>
|
|
18
9
|
<h3 align="center">Universal adblock filter list parser</h3>
|
|
19
10
|
<p align="center">Supported syntaxes:</p>
|
|
20
11
|
<p align="center">
|
|
21
12
|
<a href="https://adguard.com">
|
|
22
|
-
<img
|
|
23
|
-
src="https://cdn.adguard.com/website/github.com/AGLint/adg_logo.svg"
|
|
24
|
-
width="14px"
|
|
25
|
-
/>
|
|
13
|
+
<img src="https://cdn.adguard.com/website/github.com/AGLint/adg_logo.svg" width="14px" />
|
|
26
14
|
AdGuard
|
|
27
15
|
</a>
|
|
28
16
|
|
|
|
29
17
|
<a href="https://github.com/gorhill/uBlock">
|
|
30
|
-
<img
|
|
31
|
-
src="https://cdn.adguard.com/website/github.com/AGLint/ubo_logo.svg"
|
|
32
|
-
width="14px"
|
|
33
|
-
/>
|
|
18
|
+
<img src="https://cdn.adguard.com/website/github.com/AGLint/ubo_logo.svg" width="14px" />
|
|
34
19
|
uBlock Origin
|
|
35
20
|
</a>
|
|
36
21
|
|
|
|
37
22
|
<a href="https://getadblock.com">
|
|
38
|
-
<img
|
|
39
|
-
src="https://cdn.adguard.com/website/github.com/AGLint/ab_logo.svg"
|
|
40
|
-
width="14px"
|
|
41
|
-
/>
|
|
23
|
+
<img src="https://cdn.adguard.com/website/github.com/AGLint/ab_logo.svg" width="14px" />
|
|
42
24
|
AdBlock
|
|
43
25
|
</a>
|
|
44
26
|
|
|
|
45
27
|
<a href="https://adblockplus.org">
|
|
46
|
-
<img
|
|
47
|
-
src="https://cdn.adguard.com/website/github.com/AGLint/abp_logo.svg"
|
|
48
|
-
width="14px"
|
|
49
|
-
/>
|
|
28
|
+
<img src="https://cdn.adguard.com/website/github.com/AGLint/abp_logo.svg" width="14px" />
|
|
50
29
|
Adblock Plus
|
|
51
30
|
</a>
|
|
52
31
|
</p>
|
|
53
|
-
|
|
54
32
|
<p align="center">
|
|
55
33
|
<a href="https://www.npmjs.com/package/@adguard/agtree">
|
|
56
34
|
<img src="https://img.shields.io/npm/v/@adguard/agtree" alt="NPM version" />
|
|
@@ -74,8 +52,7 @@ Table of Contents:
|
|
|
74
52
|
|
|
75
53
|
## Introduction
|
|
76
54
|
|
|
77
|
-
AGTree is a universal tool for working with adblock filter lists. It contains
|
|
78
|
-
the following modules:
|
|
55
|
+
AGTree is a universal tool for working with adblock filter lists. It contains the following modules:
|
|
79
56
|
|
|
80
57
|
- [Adblock rule converter][converter-url]
|
|
81
58
|
- [Adblock rule parser][parser-url]
|
|
@@ -88,41 +65,23 @@ AGTree supports all syntaxes currently in use:
|
|
|
88
65
|
- <img src="https://cdn.adguard.com/website/github.com/AGLint/abp_logo.svg" width="14px"> [Adblock Plus][abp-url]
|
|
89
66
|
- <img src="https://cdn.adguard.com/website/github.com/AGLint/ab_logo.svg" width="14px"> [AdBlock][ab-url]
|
|
90
67
|
|
|
91
|
-
[ab-url]: https://getadblock.com
|
|
92
|
-
[abp-url]: https://adblockplus.org
|
|
93
|
-
[adg-url]: https://adguard.com
|
|
94
|
-
[compatibility-tables-url]: https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree/src/compatibility-tables
|
|
95
|
-
[converter-url]: https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree/src/converter
|
|
96
|
-
[parser-url]: https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree/src/parser
|
|
97
|
-
[ubo-url]: https://github.com/gorhill/uBlock
|
|
98
|
-
|
|
99
68
|
## Development & Contribution
|
|
100
69
|
|
|
101
|
-
Please read the [CONTRIBUTING.md][contributing-url] file for details on how to
|
|
102
|
-
contribute to this project.
|
|
103
|
-
|
|
104
|
-
[contributing-url]: https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree/CONTRIBUTING.md
|
|
70
|
+
Please read the [CONTRIBUTING.md][contributing-url] file for details on how to contribute to this project.
|
|
105
71
|
|
|
106
72
|
## Ideas & Questions
|
|
107
73
|
|
|
108
|
-
If you have any questions or ideas for new features, please
|
|
109
|
-
[
|
|
110
|
-
happy to discuss it with you.
|
|
111
|
-
|
|
112
|
-
[discussions-url]: https://github.com/AdguardTeam/tsurlfilter/discussions
|
|
113
|
-
[new-issue-url]: https://github.com/AdguardTeam/tsurlfilter/issues/new
|
|
74
|
+
If you have any questions or ideas for new features, please [open an issue][new-issue-url] or a
|
|
75
|
+
[discussion][discussions-url]. We will be happy to discuss it with you.
|
|
114
76
|
|
|
115
77
|
## License
|
|
116
78
|
|
|
117
|
-
AGTree is licensed under the MIT License. See the [LICENSE][license-url] file
|
|
118
|
-
for details.
|
|
119
|
-
|
|
120
|
-
[license-url]: https://github.com/AdguardTeam/tsurlfilter/blob/master/packages/agtree/LICENSE
|
|
79
|
+
AGTree is licensed under the MIT License. See the [LICENSE][license-url] file for details.
|
|
121
80
|
|
|
122
81
|
## References
|
|
123
82
|
|
|
124
|
-
Here are some useful links to help you write adblock rules. This list is not
|
|
125
|
-
|
|
83
|
+
Here are some useful links to help you write adblock rules. This list is not exhaustive, so if you know any other useful
|
|
84
|
+
resources, please let us know.
|
|
126
85
|
|
|
127
86
|
<!--markdownlint-disable MD013-->
|
|
128
87
|
- Syntax documentation:
|
|
@@ -143,15 +102,26 @@ exhaustive, so if you know any other useful resources, please let us know.
|
|
|
143
102
|
- <img src="https://cdn.adguard.com/website/github.com/AGLint/adg_logo.svg" width="14px"> [AdGuard's compatibility table][adg-compatibility-table]
|
|
144
103
|
<!--markdownlint-enable MD013-->
|
|
145
104
|
|
|
105
|
+
[ab-url]: https://getadblock.com
|
|
146
106
|
[abp-ext-css]: https://help.eyeo.com/adblockplus/how-to-write-filters#elemhide-emulation
|
|
147
107
|
[abp-filters]: https://help.eyeo.com/adblockplus/how-to-write-filters
|
|
148
108
|
[abp-snippets]: https://help.eyeo.com/adblockplus/snippet-filters-tutorial#snippets-ref
|
|
109
|
+
[abp-url]: https://adblockplus.org
|
|
149
110
|
[adg-compatibility-table]: https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/compatibility-table.md
|
|
150
111
|
[adg-ext-css]: https://github.com/AdguardTeam/ExtendedCss/blob/master/README.md
|
|
151
112
|
[adg-filters]: https://kb.adguard.com/en/general/how-to-create-your-own-ad-filters
|
|
152
113
|
[adg-scriptlets]: https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#scriptlets
|
|
114
|
+
[adg-url]: https://adguard.com
|
|
115
|
+
[compatibility-tables-url]: https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree/src/compatibility-tables
|
|
116
|
+
[contributing-url]: https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree/CONTRIBUTING.md
|
|
117
|
+
[converter-url]: https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree/src/converter
|
|
153
118
|
[css-tree-docs]: https://github.com/csstree/csstree/tree/master/docs
|
|
119
|
+
[discussions-url]: https://github.com/AdguardTeam/tsurlfilter/discussions
|
|
120
|
+
[license-url]: https://github.com/AdguardTeam/tsurlfilter/blob/master/packages/agtree/LICENSE
|
|
154
121
|
[mdn-css-selectors]: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors
|
|
122
|
+
[new-issue-url]: https://github.com/AdguardTeam/tsurlfilter/issues/new
|
|
123
|
+
[parser-url]: https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree/src/parser
|
|
155
124
|
[ubo-filters]: https://github.com/gorhill/uBlock/wiki/Static-filter-syntax
|
|
156
125
|
[ubo-procedural]: https://github.com/gorhill/uBlock/wiki/Procedural-cosmetic-filters
|
|
157
126
|
[ubo-scriptlets]: https://github.com/gorhill/uBlock/wiki/Resources-Library#available-general-purpose-scriptlets
|
|
127
|
+
[ubo-url]: https://github.com/gorhill/uBlock
|
package/dist/agtree.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v1.1.
|
|
2
|
+
* AGTree v1.1.2 (build date: Mon, 14 Aug 2023 13:52:06 GMT)
|
|
3
3
|
* (c) 2023 AdGuard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
|
@@ -4327,21 +4327,15 @@ class ScriptletInjectionBodyParser {
|
|
|
4327
4327
|
}
|
|
4328
4328
|
// Save the offset of the opening parentheses
|
|
4329
4329
|
const openingParenthesesIndex = offset;
|
|
4330
|
-
//
|
|
4331
|
-
|
|
4332
|
-
const closingParenthesesIndex = StringUtils.findUnescapedNonStringNonRegexChar(raw, CLOSE_PARENTHESIS, openingParenthesesIndex + 1);
|
|
4330
|
+
// Skip whitespace from the end
|
|
4331
|
+
const closingParenthesesIndex = StringUtils.skipWSBack(raw, raw.length - 1);
|
|
4333
4332
|
// Closing parentheses should be present
|
|
4334
|
-
if (closingParenthesesIndex
|
|
4333
|
+
if (raw[closingParenthesesIndex] !== CLOSE_PARENTHESIS
|
|
4334
|
+
|| raw[closingParenthesesIndex - 1] === ESCAPE_CHARACTER) {
|
|
4335
4335
|
throw new AdblockSyntaxError(
|
|
4336
4336
|
// eslint-disable-next-line max-len
|
|
4337
4337
|
`Invalid AdGuard/uBlock scriptlet call, no closing parentheses '${CLOSE_PARENTHESIS}' found`, locRange(loc, offset, raw.length));
|
|
4338
4338
|
}
|
|
4339
|
-
// Shouldn't have any characters after the closing parentheses
|
|
4340
|
-
if (StringUtils.skipWSBack(raw) !== closingParenthesesIndex) {
|
|
4341
|
-
throw new AdblockSyntaxError(
|
|
4342
|
-
// eslint-disable-next-line max-len
|
|
4343
|
-
`Invalid AdGuard/uBlock scriptlet call, unexpected characters after the closing parentheses '${CLOSE_PARENTHESIS}'`, locRange(loc, closingParenthesesIndex + 1, raw.length));
|
|
4344
|
-
}
|
|
4345
4339
|
// Parse parameter list
|
|
4346
4340
|
const params = ParameterListParser.parse(raw.substring(openingParenthesesIndex + 1, closingParenthesesIndex), COMMA, shiftLoc(loc, openingParenthesesIndex + 1));
|
|
4347
4341
|
// Allow empty scritptlet call: js() or //scriptlet(), but not allow parameters
|
|
@@ -5837,12 +5831,14 @@ var data$O = { adg_os_any:{ name:"cookie",
|
|
|
5837
5831
|
docs:"https://adguard.app/kb/general/ad-filtering/create-own-filters/#cookie-modifier",
|
|
5838
5832
|
assignable:true,
|
|
5839
5833
|
negatable:false,
|
|
5834
|
+
value_optional:true,
|
|
5840
5835
|
value_format:"^([^;=\\s]*?)((?:;(maxAge=\\d+;?)?|(sameSite=(lax|none|strict);?)?){1,3})(?<!;)$" },
|
|
5841
5836
|
adg_ext_any:{ name:"cookie",
|
|
5842
5837
|
description:"The `$cookie` modifier completely changes rule behavior.\nInstead of blocking a request, this modifier makes us suppress or modify the Cookie and Set-Cookie headers.",
|
|
5843
5838
|
docs:"https://adguard.app/kb/general/ad-filtering/create-own-filters/#cookie-modifier",
|
|
5844
5839
|
assignable:true,
|
|
5845
5840
|
negatable:false,
|
|
5841
|
+
value_optional:true,
|
|
5846
5842
|
value_format:"^([^;=\\s]*?)((?:;(maxAge=\\d+;?)?|(sameSite=(lax|none|strict);?)?){1,3})(?<!;)$" } };
|
|
5847
5843
|
|
|
5848
5844
|
var data$N = { adg_os_any:{ name:"csp",
|
|
@@ -5855,6 +5851,7 @@ var data$N = { adg_os_any:{ name:"csp",
|
|
|
5855
5851
|
inverse_conflicts:true,
|
|
5856
5852
|
assignable:true,
|
|
5857
5853
|
negatable:false,
|
|
5854
|
+
value_optional:true,
|
|
5858
5855
|
value_format:"/[^,$]+/" },
|
|
5859
5856
|
adg_ext_any:{ name:"csp",
|
|
5860
5857
|
description:"This modifier completely changes the rule behavior.\nIf it is applied to a rule, it will not block the matching request.\nThe response headers are going to be modified instead.",
|
|
@@ -5866,6 +5863,7 @@ var data$N = { adg_os_any:{ name:"csp",
|
|
|
5866
5863
|
inverse_conflicts:true,
|
|
5867
5864
|
assignable:true,
|
|
5868
5865
|
negatable:false,
|
|
5866
|
+
value_optional:true,
|
|
5869
5867
|
value_format:"/[^,$]+/" },
|
|
5870
5868
|
abp_ext_any:{ name:"csp",
|
|
5871
5869
|
description:"This modifier completely changes the rule behavior.\nIf it is applied to a rule, it will not block the matching request.\nThe response headers are going to be modified instead.",
|
|
@@ -5875,6 +5873,7 @@ var data$N = { adg_os_any:{ name:"csp",
|
|
|
5875
5873
|
inverse_conflicts:true,
|
|
5876
5874
|
assignable:true,
|
|
5877
5875
|
negatable:false,
|
|
5876
|
+
value_optional:true,
|
|
5878
5877
|
value_format:"/[^,$]+/" },
|
|
5879
5878
|
ubo_ext_any:{ name:"csp",
|
|
5880
5879
|
description:"This modifier completely changes the rule behavior.\nIf it is applied to a rule, it will not block the matching request.\nThe response headers are going to be modified instead.",
|
|
@@ -5886,6 +5885,7 @@ var data$N = { adg_os_any:{ name:"csp",
|
|
|
5886
5885
|
inverse_conflicts:true,
|
|
5887
5886
|
assignable:true,
|
|
5888
5887
|
negatable:false,
|
|
5888
|
+
value_optional:true,
|
|
5889
5889
|
value_format:"/[^,$]+/" } };
|
|
5890
5890
|
|
|
5891
5891
|
var data$M = { adg_os_any:{ name:"denyallow",
|
|
@@ -6451,6 +6451,7 @@ var data$h = { adg_os_any:{ name:"redirect-rule",
|
|
|
6451
6451
|
inverse_conflicts:true,
|
|
6452
6452
|
assignable:true,
|
|
6453
6453
|
negatable:false,
|
|
6454
|
+
value_optional:true,
|
|
6454
6455
|
value_format:"(?x)\n ^(\n 1x1-transparent\\.gif|\n 2x2-transparent\\.png|\n 3x2-transparent\\.png|\n 32x32-transparent\\.png|\n noopframe|\n noopcss|\n noopjs|\n noopjson|\n nooptext|\n empty|\n noopvmap-1\\.0|\n noopvast-2\\.0|\n noopvast-3\\.0|\n noopvast-4\\.0|\n noopmp3-0\\.1s|\n noopmp4-1s|\n amazon-apstag|\n ati-smarttag|\n didomi-loader|\n fingerprintjs2|\n fingerprintjs3|\n gemius|\n google-analytics-ga|\n google-analytics|\n google-ima3|\n googlesyndication-adsbygoogle|\n googletagservices-gpt|\n matomo|\n metrika-yandex-tag|\n metrika-yandex-watch|\n naver-wcslog|\n noeval|\n pardot-1\\.0|\n prebid-ads|\n prebid|\n prevent-bab|\n prevent-bab2|\n prevent-fab-3\\.2\\.0|\n prevent-popads-net|\n scorecardresearch-beacon|\n set-popads-dummy|\n click2load\\.html|\n )?$" },
|
|
6455
6456
|
adg_ext_any:{ name:"redirect-rule",
|
|
6456
6457
|
description:"This is basically an alias to `$redirect`\nsince it has the same \"redirection\" values and the logic is almost similar.\nThe difference is that `$redirect-rule` is applied only in the case\nwhen the target request is blocked by a different basic rule.",
|
|
@@ -6480,6 +6481,7 @@ var data$h = { adg_os_any:{ name:"redirect-rule",
|
|
|
6480
6481
|
inverse_conflicts:true,
|
|
6481
6482
|
assignable:true,
|
|
6482
6483
|
negatable:false,
|
|
6484
|
+
value_optional:true,
|
|
6483
6485
|
value_format:"(?x)\n ^(\n 1x1-transparent\\.gif|\n 2x2-transparent\\.png|\n 3x2-transparent\\.png|\n 32x32-transparent\\.png|\n noopframe|\n noopcss|\n noopjs|\n noopjson|\n nooptext|\n empty|\n noopvmap-1\\.0|\n noopvast-2\\.0|\n noopvast-3\\.0|\n noopvast-4\\.0|\n noopmp3-0\\.1s|\n noopmp4-1s|\n amazon-apstag|\n ati-smarttag|\n didomi-loader|\n fingerprintjs2|\n fingerprintjs3|\n gemius|\n google-analytics-ga|\n google-analytics|\n google-ima3|\n googlesyndication-adsbygoogle|\n googletagservices-gpt|\n matomo|\n metrika-yandex-tag|\n metrika-yandex-watch|\n naver-wcslog|\n noeval|\n pardot-1\\.0|\n prebid-ads|\n prebid|\n prevent-bab|\n prevent-bab2|\n prevent-fab-3\\.2\\.0|\n prevent-popads-net|\n scorecardresearch-beacon|\n set-popads-dummy|\n click2load\\.html|\n )?$" },
|
|
6484
6486
|
ubo_ext_any:{ name:"redirect-rule",
|
|
6485
6487
|
description:"This is basically an alias to `$redirect`\nsince it has the same \"redirection\" values and the logic is almost similar.\nThe difference is that `$redirect-rule` is applied only in the case\nwhen the target request is blocked by a different basic rule.",
|
|
@@ -6516,19 +6518,28 @@ var data$g = { adg_os_any:{ name:"redirect",
|
|
|
6516
6518
|
docs:"https://adguard.app/kb/general/ad-filtering/create-own-filters/#redirect-modifier",
|
|
6517
6519
|
assignable:true,
|
|
6518
6520
|
negatable:false,
|
|
6521
|
+
value_optional:true,
|
|
6519
6522
|
value_format:"(?x)\n ^(\n 1x1-transparent\\.gif|\n 2x2-transparent\\.png|\n 3x2-transparent\\.png|\n 32x32-transparent\\.png|\n noopframe|\n noopcss|\n noopjs|\n noopjson|\n nooptext|\n empty|\n noopvmap-1\\.0|\n noopvast-2\\.0|\n noopvast-3\\.0|\n noopvast-4\\.0|\n noopmp3-0\\.1s|\n noopmp4-1s|\n amazon-apstag|\n ati-smarttag|\n didomi-loader|\n fingerprintjs2|\n fingerprintjs3|\n gemius|\n google-analytics-ga|\n google-analytics|\n google-ima3|\n googlesyndication-adsbygoogle|\n googletagservices-gpt|\n matomo|\n metrika-yandex-tag|\n metrika-yandex-watch|\n naver-wcslog|\n noeval|\n pardot-1\\.0|\n prebid-ads|\n prebid|\n prevent-bab|\n prevent-bab2|\n prevent-fab-3\\.2\\.0|\n prevent-popads-net|\n scorecardresearch-beacon|\n set-popads-dummy|\n click2load\\.html\n )?$" },
|
|
6520
6523
|
adg_ext_any:{ name:"redirect",
|
|
6521
6524
|
description:"Used to redirect web requests to a local \"resource\".",
|
|
6522
6525
|
docs:"https://adguard.app/kb/general/ad-filtering/create-own-filters/#redirect-modifier",
|
|
6523
6526
|
assignable:true,
|
|
6524
6527
|
negatable:false,
|
|
6528
|
+
value_optional:true,
|
|
6525
6529
|
value_format:"(?x)\n ^(\n 1x1-transparent\\.gif|\n 2x2-transparent\\.png|\n 3x2-transparent\\.png|\n 32x32-transparent\\.png|\n noopframe|\n noopcss|\n noopjs|\n noopjson|\n nooptext|\n empty|\n noopvmap-1\\.0|\n noopvast-2\\.0|\n noopvast-3\\.0|\n noopvast-4\\.0|\n noopmp3-0\\.1s|\n noopmp4-1s|\n amazon-apstag|\n ati-smarttag|\n didomi-loader|\n fingerprintjs2|\n fingerprintjs3|\n gemius|\n google-analytics-ga|\n google-analytics|\n google-ima3|\n googlesyndication-adsbygoogle|\n googletagservices-gpt|\n matomo|\n metrika-yandex-tag|\n metrika-yandex-watch|\n naver-wcslog|\n noeval|\n pardot-1\\.0|\n prebid-ads|\n prebid|\n prevent-bab|\n prevent-bab2|\n prevent-fab-3\\.2\\.0|\n prevent-popads-net|\n scorecardresearch-beacon|\n set-popads-dummy|\n click2load\\.html\n )?$" },
|
|
6526
6530
|
ubo_ext_any:{ name:"redirect",
|
|
6527
6531
|
description:"Used to redirect web requests to a local \"resource\".",
|
|
6528
6532
|
docs:"https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#redirect",
|
|
6529
6533
|
assignable:true,
|
|
6530
6534
|
negatable:false,
|
|
6531
|
-
|
|
6535
|
+
value_optional:true,
|
|
6536
|
+
value_format:"(?x)\n ^(\n 1x1\\.gif|\n 2x2\\.png|\n 3x2\\.png|\n 32x32\\.png|\n noop\\.css|\n noop\\.html|\n noopframe|\n noop\\.js|\n noop\\.txt|\n noop-0\\.1s\\.mp3|\n noop-0\\.5s\\.mp3|\n noop-1s\\.mp4|\n none|\n click2load\\.html|\n addthis_widget\\.js|\n amazon_ads\\.js|\n amazon_apstag\\.js|\n monkeybroker\\.js|\n doubleclick_instream_ad_status|\n google-analytics_ga\\.js|\n google-analytics_analytics\\.js|\n google-analytics_inpage_linkid\\.js|\n google-analytics_cx_api\\.js|\n google-ima\\.js|\n googletagservices_gpt\\.js|\n googletagmanager_gtm\\.js|\n googlesyndication_adsbygoogle\\.js|\n scorecardresearch_beacon\\.js|\n outbrain-widget\\.js|\n hd-main\\.js\n )\n (:[0-9]+)?$" },
|
|
6537
|
+
abp_ext_any:{ name:"rewrite",
|
|
6538
|
+
description:"The `rewrite=` option allows the rewriting of URLs (or redirecting requests) to an internal\nresource in order to deactivate it without causing an error. Indicate the internal resource\nby name and prefix `abp-resource:` in order to be recognized. For example\n`$rewrite=abp-resource:blank-js` sends an empty JavaScript.",
|
|
6539
|
+
docs:"https://help.adblockplus.org/hc/en-us/articles/360062733293#rewrite",
|
|
6540
|
+
assignable:true,
|
|
6541
|
+
negatable:false,
|
|
6542
|
+
value_format:"(?x)\n # ABP resources always starts with the `abp-resource:` prefix\n ^abp-resource:\n # Possible resource names\n (\n blank-text|\n blank-css|\n blank-js|\n blank-html|\n blank-mp3|\n 1x1-transparent-gif|\n 2x2-transparent-png|\n 3x2-transparent-png|\n 32x32-transparent-png\n )$" } };
|
|
6532
6543
|
|
|
6533
6544
|
var data$f = { adg_os_any:{ name:"removeheader",
|
|
6534
6545
|
description:"Rules with the `$removeheader` modifier are intended to remove headers from HTTP requests and responses.",
|
|
@@ -6555,6 +6566,7 @@ var data$f = { adg_os_any:{ name:"removeheader",
|
|
|
6555
6566
|
inverse_conflicts:true,
|
|
6556
6567
|
assignable:true,
|
|
6557
6568
|
negatable:false,
|
|
6569
|
+
value_optional:true,
|
|
6558
6570
|
value_format:"(?xi)\n ^\n # Value may start with \"request:\"\n (request:)?\n\n # Forbidden header names\n (?!\n (\n access-control-allow-origin|\n access-control-allow-credentials|\n access-control-allow-headers|\n access-control-allow-methods|\n access-control-expose-headers|\n access-control-max-age|\n access-control-request-headers|\n access-control-request-method|\n origin|\n timing-allow-origin|\n allow|\n cross-origin-embedder-policy|\n cross-origin-opener-policy|\n cross-origin-resource-policy|\n content-security-policy|\n content-security-policy-report-only|\n expect-ct|\n feature-policy|\n origin-isolation|\n strict-transport-security|\n upgrade-insecure-requests|\n x-content-type-options|\n x-download-options|\n x-frame-options|\n x-permitted-cross-domain-policies|\n x-powered-by|\n x-xss-protection|\n public-key-pins|\n public-key-pins-report-only|\n sec-websocket-key|\n sec-websocket-extensions|\n sec-websocket-accept|\n sec-websocket-protocol|\n sec-websocket-version|\n p3p|\n sec-fetch-mode|\n sec-fetch-dest|\n sec-fetch-site|\n sec-fetch-user|\n referrer-policy|\n content-type|\n content-length|\n accept|\n accept-encoding|\n host|\n connection|\n transfer-encoding|\n upgrade\n )\n $)\n\n # Any other header name is allowed, if it matches the following regex\n [A-z0-9-]+\n $" },
|
|
6559
6571
|
adg_ext_any:{ name:"removeheader",
|
|
6560
6572
|
description:"Rules with the `$removeheader` modifier are intended to remove headers from HTTP requests and responses.",
|
|
@@ -6581,6 +6593,7 @@ var data$f = { adg_os_any:{ name:"removeheader",
|
|
|
6581
6593
|
inverse_conflicts:true,
|
|
6582
6594
|
assignable:true,
|
|
6583
6595
|
negatable:false,
|
|
6596
|
+
value_optional:true,
|
|
6584
6597
|
value_format:"(?xi)\n ^\n # Value may start with \"request:\"\n (request:)?\n\n # Forbidden header names\n (?!\n (\n access-control-allow-origin|\n access-control-allow-credentials|\n access-control-allow-headers|\n access-control-allow-methods|\n access-control-expose-headers|\n access-control-max-age|\n access-control-request-headers|\n access-control-request-method|\n origin|\n timing-allow-origin|\n allow|\n cross-origin-embedder-policy|\n cross-origin-opener-policy|\n cross-origin-resource-policy|\n content-security-policy|\n content-security-policy-report-only|\n expect-ct|\n feature-policy|\n origin-isolation|\n strict-transport-security|\n upgrade-insecure-requests|\n x-content-type-options|\n x-download-options|\n x-frame-options|\n x-permitted-cross-domain-policies|\n x-powered-by|\n x-xss-protection|\n public-key-pins|\n public-key-pins-report-only|\n sec-websocket-key|\n sec-websocket-extensions|\n sec-websocket-accept|\n sec-websocket-protocol|\n sec-websocket-version|\n p3p|\n sec-fetch-mode|\n sec-fetch-dest|\n sec-fetch-site|\n sec-fetch-user|\n referrer-policy|\n content-type|\n content-length|\n accept|\n accept-encoding|\n host|\n connection|\n transfer-encoding|\n upgrade\n )\n $)\n\n # Any other header name is allowed, if it matches the following regex\n [A-z0-9-]+\n $" } };
|
|
6585
6598
|
|
|
6586
6599
|
var data$e = { adg_os_any:{ name:"removeparam",
|
|
@@ -6588,12 +6601,14 @@ var data$e = { adg_os_any:{ name:"removeparam",
|
|
|
6588
6601
|
docs:"https://adguard.app/kb/general/ad-filtering/create-own-filters/#removeparam-modifier",
|
|
6589
6602
|
assignable:true,
|
|
6590
6603
|
negatable:false,
|
|
6604
|
+
value_optional:true,
|
|
6591
6605
|
value_format:"/^(?!.*([^\\\\](,|\\$|\\/))).*$/" },
|
|
6592
6606
|
adg_ext_any:{ name:"removeparam",
|
|
6593
6607
|
description:"Rules with the `$removeparam` modifier are intended to strip query parameters from requests' URLs.",
|
|
6594
6608
|
docs:"https://adguard.app/kb/general/ad-filtering/create-own-filters/#removeparam-modifier",
|
|
6595
6609
|
assignable:true,
|
|
6596
6610
|
negatable:false,
|
|
6611
|
+
value_optional:true,
|
|
6597
6612
|
value_format:"/^(?!.*([^\\\\](,|\\$|\\/))).*$/" },
|
|
6598
6613
|
ubo_ext_any:{ name:"removeparam",
|
|
6599
6614
|
description:"Rules with the `$removeparam` modifier are intended to strip query parameters from requests' URLs.",
|
|
@@ -6681,6 +6696,7 @@ var data$a = { adg_os_any:{ name:"stealth",
|
|
|
6681
6696
|
assignable:true,
|
|
6682
6697
|
negatable:false,
|
|
6683
6698
|
exception_only:true,
|
|
6699
|
+
value_optional:true,
|
|
6684
6700
|
value_format:"(?x)\n ^(?!\\|)\\b(?:(\n searchqueries|\n donottrack|\n 3p-cookie|\n 1p-cookie|\n 3p-cache|\n 3p-auth|\n webrtc|\n push|\n location|\n flash|\n java|\n referrer|\n useragent|\n ip|\n xclientdata|\n dpi|\n \\|?\n )\\b)+(?<!\\|)$" },
|
|
6685
6701
|
adg_ext_chrome:{ name:"stealth",
|
|
6686
6702
|
description:"Disables the Stealth Mode module for all corresponding pages and requests.",
|
|
@@ -6688,6 +6704,7 @@ var data$a = { adg_os_any:{ name:"stealth",
|
|
|
6688
6704
|
assignable:true,
|
|
6689
6705
|
negatable:false,
|
|
6690
6706
|
exception_only:true,
|
|
6707
|
+
value_optional:true,
|
|
6691
6708
|
value_format:"(?x)\n ^(?!\\|)\\b(?:(\n searchqueries|\n donottrack|\n 3p-cookie|\n 1p-cookie|\n webrtc|\n referrer|\n xclientdata\n |\\|?\n )\\b)+(?<!\\|)$" },
|
|
6692
6709
|
adg_ext_firefox:{ name:"stealth",
|
|
6693
6710
|
description:"Disables the Stealth Mode module for all corresponding pages and requests.",
|
|
@@ -6695,6 +6712,7 @@ var data$a = { adg_os_any:{ name:"stealth",
|
|
|
6695
6712
|
assignable:true,
|
|
6696
6713
|
negatable:false,
|
|
6697
6714
|
exception_only:true,
|
|
6715
|
+
value_optional:true,
|
|
6698
6716
|
value_format:"(?x)\n ^(?!\\|)\\b(?:(\n searchqueries|\n donottrack|\n 3p-cookie|\n 1p-cookie|\n webrtc|\n referrer|\n |\\|?\n )\\b)+(?<!\\|)$" },
|
|
6699
6717
|
adg_ext_opera:{ name:"stealth",
|
|
6700
6718
|
description:"Disables the Stealth Mode module for all corresponding pages and requests.",
|
|
@@ -6702,6 +6720,7 @@ var data$a = { adg_os_any:{ name:"stealth",
|
|
|
6702
6720
|
assignable:true,
|
|
6703
6721
|
negatable:false,
|
|
6704
6722
|
exception_only:true,
|
|
6723
|
+
value_optional:true,
|
|
6705
6724
|
value_format:"(?x)\n ^(?!\\|)\\b(?:(\n searchqueries|\n donottrack|\n 3p-cookie|\n 1p-cookie|\n webrtc|\n referrer|\n |\\|?\n )\\b)+(?<!\\|)$" },
|
|
6706
6725
|
adg_ext_edge:{ name:"stealth",
|
|
6707
6726
|
description:"Disables the Stealth Mode module for all corresponding pages and requests.",
|
|
@@ -6709,6 +6728,7 @@ var data$a = { adg_os_any:{ name:"stealth",
|
|
|
6709
6728
|
assignable:true,
|
|
6710
6729
|
negatable:false,
|
|
6711
6730
|
exception_only:true,
|
|
6731
|
+
value_optional:true,
|
|
6712
6732
|
value_format:"(?x)\n ^(?!\\|)\\b(?:(\n searchqueries|\n donottrack|\n 3p-cookie|\n 1p-cookie|\n webrtc|\n referrer|\n |\\|?\n )\\b)+(?<!\\|)$" } };
|
|
6713
6733
|
|
|
6714
6734
|
var data$9 = { ubo_any:{ name:"strict1p",
|
|
@@ -6912,6 +6932,9 @@ var SpecificKey;
|
|
|
6912
6932
|
SpecificKey["Negatable"] = "negatable";
|
|
6913
6933
|
SpecificKey["BlockOnly"] = "block_only";
|
|
6914
6934
|
SpecificKey["ExceptionOnly"] = "exception_only";
|
|
6935
|
+
// TODO: consider removing this field
|
|
6936
|
+
// and handle whether the value is optional by `value_format`. AG-24028
|
|
6937
|
+
SpecificKey["ValueOptional"] = "value_optional";
|
|
6915
6938
|
SpecificKey["ValueFormat"] = "value_format";
|
|
6916
6939
|
// TODO: following fields should be handled later
|
|
6917
6940
|
// VersionAdded = 'version_added',
|
|
@@ -6950,6 +6973,7 @@ const prepareBlockerData = (blockerId, rawModifierData) => {
|
|
|
6950
6973
|
: rawData[SpecificKey.Negatable],
|
|
6951
6974
|
[SpecificKey.BlockOnly]: rawData[SpecificKey.BlockOnly] || false,
|
|
6952
6975
|
[SpecificKey.ExceptionOnly]: rawData[SpecificKey.ExceptionOnly] || false,
|
|
6976
|
+
[SpecificKey.ValueOptional]: rawData[SpecificKey.ValueOptional] || false,
|
|
6953
6977
|
[SpecificKey.ValueFormat]: rawData[SpecificKey.ValueFormat] || null,
|
|
6954
6978
|
};
|
|
6955
6979
|
return blockerData;
|
|
@@ -7110,18 +7134,20 @@ const validateForSpecificSyntax = (modifiersData, syntax, modifier, isException)
|
|
|
7110
7134
|
// e.g. 'domain'
|
|
7111
7135
|
if (specificBlockerData.assignable) {
|
|
7112
7136
|
/**
|
|
7113
|
-
*
|
|
7114
|
-
*
|
|
7137
|
+
* Some assignable modifiers can be used without a value,
|
|
7138
|
+
* e.g. '@@||example.com^$cookie'.
|
|
7115
7139
|
*/
|
|
7116
7140
|
if (!modifier.value
|
|
7117
|
-
|
|
7118
|
-
|
|
7119
|
-
* after the extension will support stealth mode with value
|
|
7120
|
-
* https://github.com/AdguardTeam/AdguardBrowserExtension/issues/2107
|
|
7121
|
-
*/
|
|
7122
|
-
&& !specificBlockerData.exception_only) {
|
|
7141
|
+
// value should be specified if it is not optional
|
|
7142
|
+
&& !specificBlockerData.value_optional) {
|
|
7123
7143
|
return getInvalidValidationResult(`${INVALID_ERROR_PREFIX.VALUE_REQUIRED}: '${modifierName}'`);
|
|
7124
7144
|
}
|
|
7145
|
+
/**
|
|
7146
|
+
* TODO: consider to return `{ ok: true, warn: 'Modifier value may be specified' }` (???)
|
|
7147
|
+
* for $stealth modifier without a value
|
|
7148
|
+
* but only after the extension will support value for $stealth:
|
|
7149
|
+
* https://github.com/AdguardTeam/AdguardBrowserExtension/issues/2107
|
|
7150
|
+
*/
|
|
7125
7151
|
}
|
|
7126
7152
|
else if (modifier?.value) {
|
|
7127
7153
|
return getInvalidValidationResult(`${INVALID_ERROR_PREFIX.VALUE_FORBIDDEN}: '${modifierName}'`);
|
|
@@ -8868,7 +8894,7 @@ class LogicalExpressionUtils {
|
|
|
8868
8894
|
}
|
|
8869
8895
|
}
|
|
8870
8896
|
|
|
8871
|
-
const version$1 = "1.1.
|
|
8897
|
+
const version$1 = "1.1.2";
|
|
8872
8898
|
|
|
8873
8899
|
/**
|
|
8874
8900
|
* @file AGTree version
|
package/dist/agtree.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree v1.1.
|
|
2
|
+
* AGTree v1.1.2 (build date: Mon, 14 Aug 2023 13:52:06 GMT)
|
|
3
3
|
* (c) 2023 AdGuard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|