@adguard/hostlist-compiler 1.0.23 → 1.0.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -2
- package/package.json +1 -1
- package/src/index.d.ts +2 -0
- package/src/index.js +3 -0
- package/src/schemas/configuration.schema.json +4 -0
- package/src/transformations/validate.js +5 -0
- package/test/index.test.js +2 -0
package/README.md
CHANGED
|
@@ -81,6 +81,7 @@ Here is an example of this configuration:
|
|
|
81
81
|
"description": "List description",
|
|
82
82
|
"homepage": "https://example.org/",
|
|
83
83
|
"license": "GPLv3",
|
|
84
|
+
"version": "1.0.0.0",
|
|
84
85
|
"sources": [
|
|
85
86
|
{
|
|
86
87
|
"name": "Local rules",
|
|
@@ -111,6 +112,7 @@ Here is an example of this configuration:
|
|
|
111
112
|
- `description` - (optional) the list description.
|
|
112
113
|
- `homepage` - (optional) URL to the list homepage.
|
|
113
114
|
- `license` - (optional) Filter list license.
|
|
115
|
+
- `version` - (optional) Filter list version.
|
|
114
116
|
- `sources` - (mandatory) array of the list sources.
|
|
115
117
|
- `.source` - (mandatory) path or URL of the source. It can be a traditional filter list or a hosts file.
|
|
116
118
|
- `.name` - (optional) name of the source.
|
|
@@ -270,7 +272,8 @@ This is a very simple transformation that simply removes comments (e.g. all rule
|
|
|
270
272
|
|
|
271
273
|
### <a name="compress"></a> Compress
|
|
272
274
|
|
|
273
|
-
>
|
|
275
|
+
> [!IMPORTANT]
|
|
276
|
+
> This transformation converts `hosts` lists into `adblock` lists.
|
|
274
277
|
|
|
275
278
|
Here's what it does:
|
|
276
279
|
|
|
@@ -288,7 +291,9 @@ Here is the list of modifiers that will be removed:
|
|
|
288
291
|
- `$all` modifier
|
|
289
292
|
- `$popup` modifier
|
|
290
293
|
|
|
291
|
-
|
|
294
|
+
> [!CAUTION]
|
|
295
|
+
> Blindly removing `$third-party` from traditional ad blocking rules leads to lots of false-positives.
|
|
296
|
+
>> This is exactly why there is an option to exclude rules - you may need to use it.
|
|
292
297
|
|
|
293
298
|
### <a name="validate"></a> Validate
|
|
294
299
|
|
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -42,6 +42,8 @@ declare module '@adguard/hostlist-compiler' {
|
|
|
42
42
|
homepage?: string;
|
|
43
43
|
/** Filter list license */
|
|
44
44
|
license?: string;
|
|
45
|
+
/** Filter list version */
|
|
46
|
+
version?: string;
|
|
45
47
|
/** An array of the filter list sources */
|
|
46
48
|
sources: ISource[];
|
|
47
49
|
/** A list of the transformations that will be applied */
|
package/src/index.js
CHANGED
|
@@ -21,6 +21,9 @@ function prepareHeader(configuration) {
|
|
|
21
21
|
if (!_.isEmpty(configuration.description)) {
|
|
22
22
|
lines.push(`! Description: ${configuration.description}`);
|
|
23
23
|
}
|
|
24
|
+
if (!_.isEmpty(configuration.version)) {
|
|
25
|
+
lines.push(`! Version: ${configuration.version}`);
|
|
26
|
+
}
|
|
24
27
|
if (!_.isEmpty(configuration.homepage)) {
|
|
25
28
|
lines.push(`! Homepage: ${configuration.homepage}`);
|
|
26
29
|
}
|
package/test/index.test.js
CHANGED
|
@@ -15,6 +15,7 @@ describe('Hostlist compiler', () => {
|
|
|
15
15
|
const configuration = {
|
|
16
16
|
name: 'Test filter',
|
|
17
17
|
description: 'Our test filter',
|
|
18
|
+
version: '1.0.0.9',
|
|
18
19
|
sources: [
|
|
19
20
|
{
|
|
20
21
|
name: 'source 1',
|
|
@@ -33,6 +34,7 @@ describe('Hostlist compiler', () => {
|
|
|
33
34
|
// assert
|
|
34
35
|
expect(list).toContain('||example.org');
|
|
35
36
|
expect(list).toContain('||example.com');
|
|
37
|
+
expect(list).toContain('! Version: 1.0.0.9');
|
|
36
38
|
|
|
37
39
|
const str = list.join('\n');
|
|
38
40
|
consola.info(str);
|