@adguard/hostlist-compiler 2.1.0 → 3.0.0-beta.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/.dockerignore +29 -0
- package/.github/workflows/ci.yml +22 -0
- package/.github/workflows/mirror.yml +24 -0
- package/.github/workflows/prepare-release.yml +26 -0
- package/.github/workflows/publish-release.yml +44 -0
- package/.markdownlint.json +29 -0
- package/.markdownlintignore +1 -0
- package/AGENTS.md +314 -103
- package/CHANGELOG.md +76 -7
- package/DEPLOYMENT.md +171 -0
- package/DEVELOPMENT.md +174 -76
- package/README.md +240 -140
- package/examples/china/README.md +2 -2
- package/examples/energized/README.md +4 -2
- package/examples/sdn/README.md +2 -2
- package/examples/whitelist/README.md +2 -2
- package/package.json +29 -24
- package/src/cli.js +59 -33
- package/src/compile-source.js +4 -3
- package/src/configuration.js +132 -2
- package/src/download.js +27 -0
- package/src/filter.js +2 -2
- package/src/index.d.ts +2 -0
- package/src/index.js +21 -51
- package/src/{transformations/ip-normalize.js → ip-normalize.js} +2 -2
- package/src/schemas/configuration.schema.js +137 -0
- package/src/source-types.js +17 -0
- package/src/transformations/enum.js +49 -0
- package/src/transformations/include.js +1 -1
- package/src/transformations/transform.js +40 -74
- package/src/transformations/validate-allow-ip-and-public-suffix.js +1 -1
- package/src/transformations/validate-allow-ip.js +1 -1
- package/src/utils.js +1284 -0
- package/src/validation-conflicts.js +106 -0
- package/test/cli-error-output.test.js +305 -0
- package/test/cli.test.js +47 -0
- package/test/compile-source.test.js +167 -7
- package/test/configuration.test.js +438 -0
- package/test/download.test.js +260 -0
- package/test/helpers/http-mock.js +94 -0
- package/test/index.test.js +497 -4
- package/test/{transformations/ip-normalize.test.js → ip-normalize.test.js} +1 -1
- package/test/resolve-include.test.js +8 -8
- package/test/transformations/covert-to-ascii.test.js +1 -1
- package/test/transformations/exclude.test.js +2 -2
- package/test/transformations/include.test.js +9 -3
- package/test/transformations/ip-alignment.test.js +1 -1
- package/test/transformations/transform.test.js +66 -1
- package/test/utils.test.js +1559 -0
- package/test/validation-conflicts.test.js +230 -0
- package/bamboo-specs/bamboo.yaml +0 -14
- package/bamboo-specs/build.yaml +0 -92
- package/bamboo-specs/deploy.yaml +0 -38
- package/bamboo-specs/increment.yaml +0 -54
- package/bamboo-specs/permissions.yaml +0 -16
- package/bamboo-specs/test.yaml +0 -56
- package/src/schemas/configuration.schema.json +0 -369
- package/tools/build-txt.js +0 -19
|
@@ -1,369 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$id": "https://adguarad.com/hostlist-compiler.configuration.schema.json",
|
|
3
|
-
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
|
-
"title": "Hostlist compiler configuration",
|
|
5
|
-
"description": "Configuration for the hostlist compiler",
|
|
6
|
-
"type": "object",
|
|
7
|
-
"properties": {
|
|
8
|
-
"name": {
|
|
9
|
-
"description": "Filter list name",
|
|
10
|
-
"type": "string",
|
|
11
|
-
"minLength": 1
|
|
12
|
-
},
|
|
13
|
-
"description": {
|
|
14
|
-
"description": "Filter list description",
|
|
15
|
-
"type": "string"
|
|
16
|
-
},
|
|
17
|
-
"homepage": {
|
|
18
|
-
"description": "Filter list homepage",
|
|
19
|
-
"type": "string"
|
|
20
|
-
},
|
|
21
|
-
"license": {
|
|
22
|
-
"description": "Filter list license",
|
|
23
|
-
"type": "string"
|
|
24
|
-
},
|
|
25
|
-
"version": {
|
|
26
|
-
"description": "Filter version",
|
|
27
|
-
"type": "string"
|
|
28
|
-
},
|
|
29
|
-
"sources": {
|
|
30
|
-
"description": "An array of the filter list sources",
|
|
31
|
-
"type": "array",
|
|
32
|
-
"minItems": 1,
|
|
33
|
-
"items": {
|
|
34
|
-
"$ref": "#/definitions/source"
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
"transformations": {
|
|
38
|
-
"description": "A list of the transformations that will be applied",
|
|
39
|
-
"type": "array",
|
|
40
|
-
"allOf": [
|
|
41
|
-
{
|
|
42
|
-
"not": {
|
|
43
|
-
"allOf": [
|
|
44
|
-
{
|
|
45
|
-
"contains": {
|
|
46
|
-
"const": "Validate"
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
"contains": {
|
|
51
|
-
"const": "ValidateAllowIp"
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
]
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
"not": {
|
|
59
|
-
"allOf": [
|
|
60
|
-
{
|
|
61
|
-
"contains": {
|
|
62
|
-
"const": "Validate"
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
"contains": {
|
|
67
|
-
"const": "ValidateAllowPublicSuffix"
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
]
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
"not": {
|
|
75
|
-
"allOf": [
|
|
76
|
-
{
|
|
77
|
-
"contains": {
|
|
78
|
-
"const": "ValidateAllowIp"
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
"contains": {
|
|
83
|
-
"const": "ValidateAllowPublicSuffix"
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
]
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
"not": {
|
|
91
|
-
"allOf": [
|
|
92
|
-
{
|
|
93
|
-
"contains": {
|
|
94
|
-
"const": "Validate"
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
"contains": {
|
|
99
|
-
"const": "ValidateAllowIpAndPublicSuffix"
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
]
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
"not": {
|
|
107
|
-
"allOf": [
|
|
108
|
-
{
|
|
109
|
-
"contains": {
|
|
110
|
-
"const": "ValidateAllowIp"
|
|
111
|
-
}
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
"contains": {
|
|
115
|
-
"const": "ValidateAllowIpAndPublicSuffix"
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
]
|
|
119
|
-
}
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
"not": {
|
|
123
|
-
"allOf": [
|
|
124
|
-
{
|
|
125
|
-
"contains": {
|
|
126
|
-
"const": "ValidateAllowPublicSuffix"
|
|
127
|
-
}
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
"contains": {
|
|
131
|
-
"const": "ValidateAllowIpAndPublicSuffix"
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
]
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
],
|
|
138
|
-
"items": {
|
|
139
|
-
"type": "string",
|
|
140
|
-
"enum": [
|
|
141
|
-
"RemoveComments",
|
|
142
|
-
"RemoveModifiers",
|
|
143
|
-
"Compress",
|
|
144
|
-
"Validate",
|
|
145
|
-
"ValidateAllowIp",
|
|
146
|
-
"ValidateAllowPublicSuffix",
|
|
147
|
-
"ValidateAllowIpAndPublicSuffix",
|
|
148
|
-
"Deduplicate",
|
|
149
|
-
"InvertAllow",
|
|
150
|
-
"RemoveEmptyLines",
|
|
151
|
-
"TrimLines",
|
|
152
|
-
"InsertFinalNewLine",
|
|
153
|
-
"ConvertToAscii"
|
|
154
|
-
]
|
|
155
|
-
}
|
|
156
|
-
},
|
|
157
|
-
"exclusions": {
|
|
158
|
-
"description": "A list of rules (or wildcards) to exclude from the source.",
|
|
159
|
-
"type": "array",
|
|
160
|
-
"items": {
|
|
161
|
-
"type": "string"
|
|
162
|
-
}
|
|
163
|
-
},
|
|
164
|
-
"exclusions_sources": {
|
|
165
|
-
"description": "An array of exclusions sources.",
|
|
166
|
-
"type": "array",
|
|
167
|
-
"items": {
|
|
168
|
-
"type": "string"
|
|
169
|
-
}
|
|
170
|
-
},
|
|
171
|
-
"inclusions": {
|
|
172
|
-
"description": "A list of wildcards to include from the source. All rules that don't match these wildcards won't be included.",
|
|
173
|
-
"type": "array",
|
|
174
|
-
"items": {
|
|
175
|
-
"type": "string"
|
|
176
|
-
}
|
|
177
|
-
},
|
|
178
|
-
"inclusions_sources": {
|
|
179
|
-
"description": "A list of files with inclusions.",
|
|
180
|
-
"type": "array",
|
|
181
|
-
"items": {
|
|
182
|
-
"type": "string"
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
},
|
|
186
|
-
"required": [
|
|
187
|
-
"name",
|
|
188
|
-
"sources"
|
|
189
|
-
],
|
|
190
|
-
"additionalProperties": false,
|
|
191
|
-
"definitions": {
|
|
192
|
-
"source": {
|
|
193
|
-
"description": "A source for the filter list",
|
|
194
|
-
"type": "object",
|
|
195
|
-
"properties": {
|
|
196
|
-
"name": {
|
|
197
|
-
"description": "Name of the source",
|
|
198
|
-
"type": "string",
|
|
199
|
-
"minLength": 1
|
|
200
|
-
},
|
|
201
|
-
"source": {
|
|
202
|
-
"description": "Path to a file or a URL",
|
|
203
|
-
"type": "string",
|
|
204
|
-
"minLength": 1
|
|
205
|
-
},
|
|
206
|
-
"type": {
|
|
207
|
-
"description": "Type of the source",
|
|
208
|
-
"type": "string",
|
|
209
|
-
"enum": [
|
|
210
|
-
"adblock",
|
|
211
|
-
"hosts"
|
|
212
|
-
]
|
|
213
|
-
},
|
|
214
|
-
"transformations": {
|
|
215
|
-
"description": "A list of the transformations that will be applied",
|
|
216
|
-
"type": "array",
|
|
217
|
-
"allOf": [
|
|
218
|
-
{
|
|
219
|
-
"not": {
|
|
220
|
-
"allOf": [
|
|
221
|
-
{
|
|
222
|
-
"contains": {
|
|
223
|
-
"const": "Validate"
|
|
224
|
-
}
|
|
225
|
-
},
|
|
226
|
-
{
|
|
227
|
-
"contains": {
|
|
228
|
-
"const": "ValidateAllowIp"
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
]
|
|
232
|
-
}
|
|
233
|
-
},
|
|
234
|
-
{
|
|
235
|
-
"not": {
|
|
236
|
-
"allOf": [
|
|
237
|
-
{
|
|
238
|
-
"contains": {
|
|
239
|
-
"const": "Validate"
|
|
240
|
-
}
|
|
241
|
-
},
|
|
242
|
-
{
|
|
243
|
-
"contains": {
|
|
244
|
-
"const": "ValidateAllowPublicSuffix"
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
]
|
|
248
|
-
}
|
|
249
|
-
},
|
|
250
|
-
{
|
|
251
|
-
"not": {
|
|
252
|
-
"allOf": [
|
|
253
|
-
{
|
|
254
|
-
"contains": {
|
|
255
|
-
"const": "ValidateAllowIp"
|
|
256
|
-
}
|
|
257
|
-
},
|
|
258
|
-
{
|
|
259
|
-
"contains": {
|
|
260
|
-
"const": "ValidateAllowPublicSuffix"
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
]
|
|
264
|
-
}
|
|
265
|
-
},
|
|
266
|
-
{
|
|
267
|
-
"not": {
|
|
268
|
-
"allOf": [
|
|
269
|
-
{
|
|
270
|
-
"contains": {
|
|
271
|
-
"const": "Validate"
|
|
272
|
-
}
|
|
273
|
-
},
|
|
274
|
-
{
|
|
275
|
-
"contains": {
|
|
276
|
-
"const": "ValidateAllowIpAndPublicSuffix"
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
]
|
|
280
|
-
}
|
|
281
|
-
},
|
|
282
|
-
{
|
|
283
|
-
"not": {
|
|
284
|
-
"allOf": [
|
|
285
|
-
{
|
|
286
|
-
"contains": {
|
|
287
|
-
"const": "ValidateAllowIp"
|
|
288
|
-
}
|
|
289
|
-
},
|
|
290
|
-
{
|
|
291
|
-
"contains": {
|
|
292
|
-
"const": "ValidateAllowIpAndPublicSuffix"
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
]
|
|
296
|
-
}
|
|
297
|
-
},
|
|
298
|
-
{
|
|
299
|
-
"not": {
|
|
300
|
-
"allOf": [
|
|
301
|
-
{
|
|
302
|
-
"contains": {
|
|
303
|
-
"const": "ValidateAllowPublicSuffix"
|
|
304
|
-
}
|
|
305
|
-
},
|
|
306
|
-
{
|
|
307
|
-
"contains": {
|
|
308
|
-
"const": "ValidateAllowIpAndPublicSuffix"
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
]
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
],
|
|
315
|
-
"items": {
|
|
316
|
-
"type": "string",
|
|
317
|
-
"enum": [
|
|
318
|
-
"RemoveComments",
|
|
319
|
-
"RemoveModifiers",
|
|
320
|
-
"Compress",
|
|
321
|
-
"Validate",
|
|
322
|
-
"ValidateAllowIp",
|
|
323
|
-
"ValidateAllowPublicSuffix",
|
|
324
|
-
"ValidateAllowIpAndPublicSuffix",
|
|
325
|
-
"Deduplicate",
|
|
326
|
-
"InvertAllow",
|
|
327
|
-
"RemoveEmptyLines",
|
|
328
|
-
"TrimLines",
|
|
329
|
-
"InsertFinalNewLine",
|
|
330
|
-
"ConvertToAscii"
|
|
331
|
-
]
|
|
332
|
-
}
|
|
333
|
-
},
|
|
334
|
-
"exclusions": {
|
|
335
|
-
"description": "A list of rules (or wildcards) to exclude from the source.",
|
|
336
|
-
"type": "array",
|
|
337
|
-
"items": {
|
|
338
|
-
"type": "string"
|
|
339
|
-
}
|
|
340
|
-
},
|
|
341
|
-
"exclusions_sources": {
|
|
342
|
-
"description": "An array of exclusions sources.",
|
|
343
|
-
"type": "array",
|
|
344
|
-
"items": {
|
|
345
|
-
"type": "string"
|
|
346
|
-
}
|
|
347
|
-
},
|
|
348
|
-
"inclusions": {
|
|
349
|
-
"description": "A list of wildcards to include from the source. All rules that don't match these wildcards won't be included.",
|
|
350
|
-
"type": "array",
|
|
351
|
-
"items": {
|
|
352
|
-
"type": "string"
|
|
353
|
-
}
|
|
354
|
-
},
|
|
355
|
-
"inclusions_sources": {
|
|
356
|
-
"description": "A list of files with inclusions.",
|
|
357
|
-
"type": "array",
|
|
358
|
-
"items": {
|
|
359
|
-
"type": "string"
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
},
|
|
363
|
-
"required": [
|
|
364
|
-
"source"
|
|
365
|
-
],
|
|
366
|
-
"additionalProperties": false
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
}
|
package/tools/build-txt.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const { version } = require('../package.json');
|
|
4
|
-
|
|
5
|
-
const PATH = '../dist';
|
|
6
|
-
const FILENAME = 'build.txt';
|
|
7
|
-
|
|
8
|
-
const buildTxt = () => {
|
|
9
|
-
const dir = path.resolve(__dirname, PATH);
|
|
10
|
-
|
|
11
|
-
if (!fs.existsSync(dir)) {
|
|
12
|
-
fs.mkdirSync(dir);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const content = `version=${version}`;
|
|
16
|
-
fs.writeFileSync(path.resolve(__dirname, PATH, FILENAME), content);
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
buildTxt();
|