html-validate 7.13.3 → 7.15.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/browser.d.ts +1 -0
- package/browser.js +1 -0
- package/dist/cjs/browser.d.ts +1 -4
- package/dist/cjs/browser.js +13 -1
- package/dist/cjs/browser.js.map +1 -1
- package/dist/cjs/cli.js +17 -9
- package/dist/cjs/cli.js.map +1 -1
- package/dist/cjs/core.js +160 -118
- package/dist/cjs/core.js.map +1 -1
- package/dist/cjs/elements.js +1 -1
- package/dist/cjs/html-validate.js +1 -1
- package/dist/cjs/index.d.ts +1 -89
- package/dist/cjs/index.js +13 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/jest-lib.js +17 -12
- package/dist/cjs/jest-lib.js.map +1 -1
- package/dist/cjs/jest.d.ts +1 -42
- package/dist/cjs/jest.js.map +1 -1
- package/dist/cjs/meta-helper.js +3 -0
- package/dist/cjs/meta-helper.js.map +1 -1
- package/dist/cjs/rules-helper.js +3 -3
- package/dist/cjs/rules-helper.js.map +1 -1
- package/dist/cjs/test-utils.d.ts +1 -30
- package/dist/cjs/test-utils.js +3 -0
- package/dist/cjs/test-utils.js.map +1 -1
- package/dist/cjs/tsdoc-metadata.json +11 -0
- package/dist/es/browser.d.ts +1 -4
- package/dist/es/browser.js +2 -2
- package/dist/es/cli.js +17 -8
- package/dist/es/cli.js.map +1 -1
- package/dist/es/core.js +139 -101
- package/dist/es/core.js.map +1 -1
- package/dist/es/elements.js +1 -1
- package/dist/es/html-validate.js +2 -2
- package/dist/es/index.d.ts +1 -89
- package/dist/es/index.js +2 -2
- package/dist/es/jest-lib.js +18 -13
- package/dist/es/jest-lib.js.map +1 -1
- package/dist/es/jest.d.ts +1 -42
- package/dist/es/jest.js.map +1 -1
- package/dist/es/meta-helper.js +3 -0
- package/dist/es/meta-helper.js.map +1 -1
- package/dist/es/rules-helper.js +4 -4
- package/dist/es/rules-helper.js.map +1 -1
- package/dist/es/test-utils.d.ts +1 -30
- package/dist/es/test-utils.js +3 -0
- package/dist/es/test-utils.js.map +1 -1
- package/dist/{es/core.d.ts → types/browser.d.ts} +2312 -2615
- package/dist/{cjs/core.d.ts → types/index.d.ts} +2505 -2615
- package/dist/types/jest.d.ts +44 -0
- package/dist/types/test-utils.d.ts +817 -0
- package/jest.d.ts +1 -2
- package/package.json +38 -32
- package/test-utils.d.ts +1 -2
- package/dist/cjs/meta-helper.d.ts +0 -28
- package/dist/cjs/rules-helper.d.ts +0 -54
- package/dist/es/meta-helper.d.ts +0 -28
- package/dist/es/rules-helper.d.ts +0 -54
|
@@ -1,2615 +1,2312 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { SchemaObject
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
*
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
interface
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
* -
|
|
166
|
-
*
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
*
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
*
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
*
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
/**
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
*
|
|
222
|
-
*/
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
/**
|
|
242
|
-
*
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
*
|
|
318
|
-
*
|
|
319
|
-
*
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
*
|
|
324
|
-
*
|
|
325
|
-
* @
|
|
326
|
-
*/
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
*
|
|
331
|
-
*
|
|
332
|
-
*
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
*
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
*
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
*
|
|
475
|
-
*
|
|
476
|
-
*
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
/**
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
/**
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
*/
|
|
541
|
-
type
|
|
542
|
-
/**
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
*
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
* @public
|
|
614
|
-
*/
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
/**
|
|
622
|
-
* Event emitted when
|
|
623
|
-
*
|
|
624
|
-
*
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
*/
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
*
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
}
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
*
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
*
|
|
779
|
-
*
|
|
780
|
-
*
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
*
|
|
785
|
-
*
|
|
786
|
-
*
|
|
787
|
-
*
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
*
|
|
792
|
-
*
|
|
793
|
-
*
|
|
794
|
-
*
|
|
795
|
-
*
|
|
796
|
-
*/
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
*
|
|
813
|
-
*
|
|
814
|
-
*
|
|
815
|
-
*
|
|
816
|
-
*
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
*
|
|
828
|
-
*
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
*
|
|
833
|
-
*
|
|
834
|
-
*
|
|
835
|
-
*
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
*
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
*
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
*
|
|
850
|
-
*
|
|
851
|
-
*
|
|
852
|
-
*
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
*
|
|
859
|
-
*
|
|
860
|
-
* @param
|
|
861
|
-
* @
|
|
862
|
-
*/
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
*
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
*
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
/**
|
|
915
|
-
*
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
*
|
|
940
|
-
*
|
|
941
|
-
*
|
|
942
|
-
*
|
|
943
|
-
* @returns
|
|
944
|
-
*/
|
|
945
|
-
|
|
946
|
-
/**
|
|
947
|
-
*
|
|
948
|
-
*
|
|
949
|
-
*
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
*
|
|
968
|
-
*
|
|
969
|
-
*
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
*
|
|
975
|
-
*
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
*
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
*
|
|
986
|
-
*
|
|
987
|
-
*
|
|
988
|
-
*
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
*
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
*
|
|
1002
|
-
*/
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
*
|
|
1016
|
-
*
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
*
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
*
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
*
|
|
1029
|
-
*
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
*
|
|
1119
|
-
*
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
*
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
/**
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
/**
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
/**
|
|
1302
|
-
*
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
*
|
|
1311
|
-
*
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
*
|
|
1404
|
-
*
|
|
1405
|
-
*
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
*
|
|
1416
|
-
*
|
|
1417
|
-
*
|
|
1418
|
-
*
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
*
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
*
|
|
1431
|
-
*
|
|
1432
|
-
*
|
|
1433
|
-
*
|
|
1434
|
-
*
|
|
1435
|
-
*
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
*
|
|
1441
|
-
*
|
|
1442
|
-
*
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
*
|
|
1448
|
-
*
|
|
1449
|
-
*
|
|
1450
|
-
*/
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
/**
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
private
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
*
|
|
1614
|
-
*
|
|
1615
|
-
*
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
*
|
|
1623
|
-
*
|
|
1624
|
-
*
|
|
1625
|
-
*
|
|
1626
|
-
*
|
|
1627
|
-
* -
|
|
1628
|
-
*
|
|
1629
|
-
*
|
|
1630
|
-
*
|
|
1631
|
-
*
|
|
1632
|
-
*
|
|
1633
|
-
*
|
|
1634
|
-
*
|
|
1635
|
-
*
|
|
1636
|
-
*
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
*
|
|
1641
|
-
*
|
|
1642
|
-
*
|
|
1643
|
-
*
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
*
|
|
1653
|
-
*
|
|
1654
|
-
* @
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
*
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
*
|
|
1669
|
-
*
|
|
1670
|
-
*
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
*
|
|
1675
|
-
*
|
|
1676
|
-
*
|
|
1677
|
-
*
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
*
|
|
1687
|
-
*
|
|
1688
|
-
*
|
|
1689
|
-
*
|
|
1690
|
-
*
|
|
1691
|
-
*
|
|
1692
|
-
*
|
|
1693
|
-
*
|
|
1694
|
-
* @param
|
|
1695
|
-
* @
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
*
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
*
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
*
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
declare
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
*
|
|
1828
|
-
*
|
|
1829
|
-
*
|
|
1830
|
-
*
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
* @public
|
|
1835
|
-
*/
|
|
1836
|
-
interface
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
/**
|
|
1901
|
-
*
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
interface
|
|
1910
|
-
|
|
1911
|
-
}
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
*
|
|
1918
|
-
*
|
|
1919
|
-
*
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
*
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
*
|
|
2033
|
-
*
|
|
2034
|
-
*
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
*
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
*
|
|
2129
|
-
*
|
|
2130
|
-
*
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
*
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
*
|
|
2142
|
-
*/
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
*
|
|
2238
|
-
*
|
|
2239
|
-
*
|
|
2240
|
-
*
|
|
2241
|
-
*
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
*
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
*
|
|
2253
|
-
*
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
*
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
*
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
*/
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
/**
|
|
2315
|
-
* Primary API for using HTML-validate.
|
|
2316
|
-
*
|
|
2317
|
-
* Provides high-level abstractions for common operations.
|
|
2318
|
-
*
|
|
2319
|
-
* @public
|
|
2320
|
-
*/
|
|
2321
|
-
declare class HtmlValidate {
|
|
2322
|
-
protected configLoader: ConfigLoader;
|
|
2323
|
-
/**
|
|
2324
|
-
* Create a new validator.
|
|
2325
|
-
*
|
|
2326
|
-
* @public
|
|
2327
|
-
* @param configLoader - Use a custom configuration loader.
|
|
2328
|
-
* @param config - If set it provides the global default configuration. By
|
|
2329
|
-
* default `Config.defaultConfig()` is used.
|
|
2330
|
-
*/
|
|
2331
|
-
constructor(config?: ConfigData);
|
|
2332
|
-
constructor(configLoader: ConfigLoader);
|
|
2333
|
-
/**
|
|
2334
|
-
* Parse and validate HTML from string.
|
|
2335
|
-
*
|
|
2336
|
-
* @public
|
|
2337
|
-
* @param str - Text to parse.
|
|
2338
|
-
* @param filename - If set configuration is loaded for given filename.
|
|
2339
|
-
* @param hooks - Optional hooks (see [[Source]]) for definition.
|
|
2340
|
-
* @returns Report output.
|
|
2341
|
-
*/
|
|
2342
|
-
validateString(str: string): Report;
|
|
2343
|
-
validateString(str: string, filename: string): Report;
|
|
2344
|
-
validateString(str: string, hooks: SourceHooks): Report;
|
|
2345
|
-
validateString(str: string, options: ConfigData): Report;
|
|
2346
|
-
validateString(str: string, filename: string, hooks: SourceHooks): Report;
|
|
2347
|
-
validateString(str: string, filename: string, options: ConfigData): Report;
|
|
2348
|
-
validateString(str: string, filename: string, options: ConfigData, hooks: SourceHooks): Report;
|
|
2349
|
-
/**
|
|
2350
|
-
* Parse and validate HTML from [[Source]].
|
|
2351
|
-
*
|
|
2352
|
-
* @public
|
|
2353
|
-
* @param input - Source to parse.
|
|
2354
|
-
* @returns Report output.
|
|
2355
|
-
*/
|
|
2356
|
-
validateSource(input: Source, configOverride?: ConfigData): Report;
|
|
2357
|
-
/**
|
|
2358
|
-
* Parse and validate HTML from file.
|
|
2359
|
-
*
|
|
2360
|
-
* @public
|
|
2361
|
-
* @param filename - Filename to read and parse.
|
|
2362
|
-
* @returns Report output.
|
|
2363
|
-
*/
|
|
2364
|
-
validateFile(filename: string): Report;
|
|
2365
|
-
/**
|
|
2366
|
-
* Parse and validate HTML from multiple files. Result is merged together to a
|
|
2367
|
-
* single report.
|
|
2368
|
-
*
|
|
2369
|
-
* @param filenames - Filenames to read and parse.
|
|
2370
|
-
* @returns Report output.
|
|
2371
|
-
*/
|
|
2372
|
-
validateMultipleFiles(filenames: string[]): Report;
|
|
2373
|
-
/**
|
|
2374
|
-
* Returns true if the given filename can be validated.
|
|
2375
|
-
*
|
|
2376
|
-
* A file is considered to be validatable if the extension is `.html` or if a
|
|
2377
|
-
* transformer matches the filename.
|
|
2378
|
-
*
|
|
2379
|
-
* This is mostly useful for tooling to determine whenever to validate the
|
|
2380
|
-
* file or not. CLI tools will run on all the given files anyway.
|
|
2381
|
-
*/
|
|
2382
|
-
canValidate(filename: string): boolean;
|
|
2383
|
-
/**
|
|
2384
|
-
* Tokenize filename and output all tokens.
|
|
2385
|
-
*
|
|
2386
|
-
* Using CLI this is enabled with `--dump-tokens`. Mostly useful for
|
|
2387
|
-
* debugging.
|
|
2388
|
-
*
|
|
2389
|
-
* @param filename - Filename to tokenize.
|
|
2390
|
-
*/
|
|
2391
|
-
dumpTokens(filename: string): TokenDump[];
|
|
2392
|
-
/**
|
|
2393
|
-
* Parse filename and output all events.
|
|
2394
|
-
*
|
|
2395
|
-
* Using CLI this is enabled with `--dump-events`. Mostly useful for
|
|
2396
|
-
* debugging.
|
|
2397
|
-
*
|
|
2398
|
-
* @param filename - Filename to dump events from.
|
|
2399
|
-
*/
|
|
2400
|
-
dumpEvents(filename: string): EventDump[];
|
|
2401
|
-
/**
|
|
2402
|
-
* Parse filename and output DOM tree.
|
|
2403
|
-
*
|
|
2404
|
-
* Using CLI this is enabled with `--dump-tree`. Mostly useful for
|
|
2405
|
-
* debugging.
|
|
2406
|
-
*
|
|
2407
|
-
* @param filename - Filename to dump DOM tree from.
|
|
2408
|
-
*/
|
|
2409
|
-
dumpTree(filename: string): string[];
|
|
2410
|
-
/**
|
|
2411
|
-
* Transform filename and output source data.
|
|
2412
|
-
*
|
|
2413
|
-
* Using CLI this is enabled with `--dump-source`. Mostly useful for
|
|
2414
|
-
* debugging.
|
|
2415
|
-
*
|
|
2416
|
-
* @param filename - Filename to dump source from.
|
|
2417
|
-
*/
|
|
2418
|
-
dumpSource(filename: string): string[];
|
|
2419
|
-
/**
|
|
2420
|
-
* Get effective configuration schema.
|
|
2421
|
-
*/
|
|
2422
|
-
getConfigurationSchema(): SchemaObject;
|
|
2423
|
-
/**
|
|
2424
|
-
* Get effective metadata element schema.
|
|
2425
|
-
*
|
|
2426
|
-
* If a filename is given the configured plugins can extend the
|
|
2427
|
-
* schema. Filename must not be an existing file or a filetype normally
|
|
2428
|
-
* handled by html-validate but the path will be used when resolving
|
|
2429
|
-
* configuration. As a rule-of-thumb, set it to the elements json file.
|
|
2430
|
-
*/
|
|
2431
|
-
getElementsSchema(filename?: string): SchemaObject;
|
|
2432
|
-
/**
|
|
2433
|
-
* Get contextual documentation for the given rule.
|
|
2434
|
-
*
|
|
2435
|
-
* Typical usage:
|
|
2436
|
-
*
|
|
2437
|
-
* ```js
|
|
2438
|
-
* const report = htmlvalidate.validateFile("my-file.html");
|
|
2439
|
-
* for (const result of report.results){
|
|
2440
|
-
* const config = htmlvalidate.getConfigFor(result.filePath);
|
|
2441
|
-
* for (const message of result.messages){
|
|
2442
|
-
* const documentation = htmlvalidate.getRuleDocumentation(message.ruleId, config, message.context);
|
|
2443
|
-
* // do something with documentation
|
|
2444
|
-
* }
|
|
2445
|
-
* }
|
|
2446
|
-
* ```
|
|
2447
|
-
*
|
|
2448
|
-
* @param ruleId - Rule to get documentation for.
|
|
2449
|
-
* @param config - If set it provides more accurate description by using the
|
|
2450
|
-
* correct configuration for the file.
|
|
2451
|
-
* @param context - If set to `Message.context` some rules can provide
|
|
2452
|
-
* contextual details and suggestions.
|
|
2453
|
-
*/
|
|
2454
|
-
getRuleDocumentation(ruleId: string, config?: Config | null, context?: any | null): RuleDocumentation | null;
|
|
2455
|
-
/**
|
|
2456
|
-
* Create a parser configured for given filename.
|
|
2457
|
-
*
|
|
2458
|
-
* @internal
|
|
2459
|
-
* @param source - Source to use.
|
|
2460
|
-
*/
|
|
2461
|
-
getParserFor(source: Source): Parser;
|
|
2462
|
-
/**
|
|
2463
|
-
* Get configuration for given filename.
|
|
2464
|
-
*
|
|
2465
|
-
* See [[FileSystemConfigLoader]] for details.
|
|
2466
|
-
*
|
|
2467
|
-
* @public
|
|
2468
|
-
* @param filename - Filename to get configuration for.
|
|
2469
|
-
* @param configOverride - Configuration to apply last.
|
|
2470
|
-
*/
|
|
2471
|
-
getConfigFor(filename: string, configOverride?: ConfigData): Config;
|
|
2472
|
-
/**
|
|
2473
|
-
* Flush configuration cache. Clears full cache unless a filename is given.
|
|
2474
|
-
*
|
|
2475
|
-
* See [[FileSystemConfigLoader]] for details.
|
|
2476
|
-
*
|
|
2477
|
-
* @public
|
|
2478
|
-
* @param filename - If set, only flush cache for given filename.
|
|
2479
|
-
*/
|
|
2480
|
-
flushConfigCache(filename?: string): void;
|
|
2481
|
-
}
|
|
2482
|
-
|
|
2483
|
-
/**
|
|
2484
|
-
* The static configuration loader does not do any per-handle lookup. Only the
|
|
2485
|
-
* global or per-call configuration is used.
|
|
2486
|
-
*
|
|
2487
|
-
* In practice this means no configuration is fetch by traversing the
|
|
2488
|
-
* filesystem.
|
|
2489
|
-
*
|
|
2490
|
-
* @public
|
|
2491
|
-
*/
|
|
2492
|
-
declare class StaticConfigLoader extends ConfigLoader {
|
|
2493
|
-
getConfigFor(handle: string, configOverride?: ConfigData): Config;
|
|
2494
|
-
flushCache(): void;
|
|
2495
|
-
protected defaultConfig(): Config;
|
|
2496
|
-
}
|
|
2497
|
-
|
|
2498
|
-
/** @public */
|
|
2499
|
-
declare const version: string;
|
|
2500
|
-
|
|
2501
|
-
/**
|
|
2502
|
-
* @public
|
|
2503
|
-
*/
|
|
2504
|
-
interface CompatibilityOptions {
|
|
2505
|
-
/** If `true` nothing no output will be generated on console. Default: `false` */
|
|
2506
|
-
silent: boolean;
|
|
2507
|
-
/** Use this version number instead of running version. Default: running version */
|
|
2508
|
-
version: string;
|
|
2509
|
-
/** Use custom logging callback. Default: `console.error` */
|
|
2510
|
-
logger(message: string): void;
|
|
2511
|
-
}
|
|
2512
|
-
/**
|
|
2513
|
-
* Tests if plugin is compatible with html-validate library. Unless the `silent`
|
|
2514
|
-
* option is used a warning is displayed on the console.
|
|
2515
|
-
*
|
|
2516
|
-
* @public
|
|
2517
|
-
* @param name - Name of plugin
|
|
2518
|
-
* @param declared - What library versions the plugin support (e.g. declared peerDependencies)
|
|
2519
|
-
* @returns - `true` if version is compatible
|
|
2520
|
-
*/
|
|
2521
|
-
declare function compatibilityCheck(name: string, declared: string, options?: Partial<CompatibilityOptions>): boolean;
|
|
2522
|
-
|
|
2523
|
-
/**
|
|
2524
|
-
* Returns true if given ruleId is an existing builtin rule. It does not handle
|
|
2525
|
-
* rules loaded via plugins.
|
|
2526
|
-
*
|
|
2527
|
-
* Can be used to create forward/backward compatibility by checking if a rule
|
|
2528
|
-
* exists to enable/disable it.
|
|
2529
|
-
*
|
|
2530
|
-
* @public
|
|
2531
|
-
* @param ruleId - Rule id to check
|
|
2532
|
-
* @returns `true` if rule exists
|
|
2533
|
-
*/
|
|
2534
|
-
declare function ruleExists(ruleId: string): boolean;
|
|
2535
|
-
|
|
2536
|
-
/**
|
|
2537
|
-
* Loads configuration by traversing filesystem.
|
|
2538
|
-
*
|
|
2539
|
-
* Configuration is read from three sources and in the following order:
|
|
2540
|
-
*
|
|
2541
|
-
* 1. Global configuration passed to constructor.
|
|
2542
|
-
* 2. Configuration files found when traversing the directory structure.
|
|
2543
|
-
* 3. Override passed to this function.
|
|
2544
|
-
*
|
|
2545
|
-
* The following configuration filenames are searched:
|
|
2546
|
-
*
|
|
2547
|
-
* - `.htmlvalidate.json`
|
|
2548
|
-
* - `.htmlvalidate.js`
|
|
2549
|
-
* - `.htmlvalidate.cjs`
|
|
2550
|
-
*
|
|
2551
|
-
* Global configuration is used when no configuration file is found. The
|
|
2552
|
-
* result is always merged with override if present.
|
|
2553
|
-
*
|
|
2554
|
-
* The `root` property set to `true` affects the configuration as following:
|
|
2555
|
-
*
|
|
2556
|
-
* 1. If set in override the override is returned as-is.
|
|
2557
|
-
* 2. If set in the global config the override is merged into global and
|
|
2558
|
-
* returned. No configuration files are searched.
|
|
2559
|
-
* 3. Setting `root` in configuration file only stops directory traversal.
|
|
2560
|
-
*
|
|
2561
|
-
* @public
|
|
2562
|
-
*/
|
|
2563
|
-
declare class FileSystemConfigLoader extends ConfigLoader {
|
|
2564
|
-
protected cache: Map<string, Config | null>;
|
|
2565
|
-
/**
|
|
2566
|
-
* @param config - Global configuration
|
|
2567
|
-
* @param configFactory - Optional configuration factory
|
|
2568
|
-
*/
|
|
2569
|
-
constructor(config?: ConfigData, configFactory?: ConfigFactory);
|
|
2570
|
-
/**
|
|
2571
|
-
* Get configuration for given filename.
|
|
2572
|
-
*
|
|
2573
|
-
* @param filename - Filename to get configuration for.
|
|
2574
|
-
* @param configOverride - Configuration to merge final result with.
|
|
2575
|
-
*/
|
|
2576
|
-
getConfigFor(filename: string, configOverride?: ConfigData): Config;
|
|
2577
|
-
/**
|
|
2578
|
-
* Flush configuration cache.
|
|
2579
|
-
*
|
|
2580
|
-
* @param filename - If given only the cache for that file is flushed.
|
|
2581
|
-
*/
|
|
2582
|
-
flushCache(filename?: string): void;
|
|
2583
|
-
/**
|
|
2584
|
-
* Load raw configuration from directory traversal.
|
|
2585
|
-
*
|
|
2586
|
-
* This configuration is not merged with global configuration and may return
|
|
2587
|
-
* `null` if no configuration files are found.
|
|
2588
|
-
*/
|
|
2589
|
-
fromFilename(filename: string): Config | null;
|
|
2590
|
-
protected defaultConfig(): Config;
|
|
2591
|
-
}
|
|
2592
|
-
|
|
2593
|
-
/**
|
|
2594
|
-
* @public
|
|
2595
|
-
*/
|
|
2596
|
-
type Formatter = (results: Result[]) => string;
|
|
2597
|
-
|
|
2598
|
-
interface AvailableFormatters {
|
|
2599
|
-
checkstyle: Formatter;
|
|
2600
|
-
codeframe: Formatter;
|
|
2601
|
-
json: Formatter;
|
|
2602
|
-
stylish: Formatter;
|
|
2603
|
-
text: Formatter;
|
|
2604
|
-
}
|
|
2605
|
-
/**
|
|
2606
|
-
* Get formatter function by name.
|
|
2607
|
-
*
|
|
2608
|
-
* @internal
|
|
2609
|
-
* @param name - Name of formatter.
|
|
2610
|
-
* @returns Formatter function or null if it doesn't exist.
|
|
2611
|
-
*/
|
|
2612
|
-
declare function getFormatter(name: keyof AvailableFormatters): Formatter;
|
|
2613
|
-
declare function getFormatter(name: string): Formatter | null;
|
|
2614
|
-
|
|
2615
|
-
export { EventHandler as $, AttributeData as A, Reporter as B, Config as C, DynamicValue as D, EventDump as E, Message as F, Result as G, HtmlValidate as H, DeferredMessage as I, TransformContext as J, Transformer as K, Location as L, MetaData as M, NodeClosed as N, TemplateExtractor as O, ProcessAttributeCallback as P, Plugin as Q, Rule as R, Severity as S, TextNode as T, UserError as U, Validator as V, WrappedError as W, SchemaValidationPatch as X, definePlugin as Y, Parser as Z, ruleExists as _, ConfigData as a, EventCallback as a0, Event as a1, ConfigReadyEvent as a2, SourceReadyEvent as a3, TokenEvent as a4, TagStartEvent as a5, TagOpenEvent as a6, TagEndEvent as a7, TagCloseEvent as a8, TagReadyEvent as a9, ElementReadyEvent as aa, AttributeEvent as ab, WhitespaceEvent as ac, ConditionalEvent as ad, DirectiveEvent as ae, DoctypeEvent as af, DOMLoadEvent as ag, DOMReadyEvent as ah, RuleErrorEvent as ai, ParseBeginEvent as aj, ParseEndEvent as ak, TriggerEventMap as al, ListenEventMap as am, FileSystemConfigLoader as an, Formatter as ao, getFormatter as ap, compatibilityCheck as aq, CompatibilityOptions as ar, ConfigError as b, ConfigLoader as c, StaticConfigLoader as d, Attribute as e, HtmlElement as f, CSSStyleDeclaration as g, TokenDump as h, SchemaValidationError as i, NestedError as j, MetaDataTable as k, MetaElement as l, MetaAttribute as m, MetaAttributeAllowedCallback as n, MetaTable as o, presets as p, MetaCopyableProperty as q, RuleConstructor as r, RuleDocumentation as s, Source as t, SourceHooks as u, version as v, ProcessElementCallback as w, ProcessElementContext as x, sliceLocation as y, Report as z };
|
|
1
|
+
import { ErrorObject } from 'ajv';
|
|
2
|
+
import { SchemaObject } from 'ajv';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* DOM Attribute.
|
|
6
|
+
*
|
|
7
|
+
* Represents a HTML attribute. Can contain either a fixed static value or a
|
|
8
|
+
* placeholder for dynamic values (e.g. interpolated).
|
|
9
|
+
*
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export declare class Attribute {
|
|
13
|
+
/** Attribute name */
|
|
14
|
+
readonly key: string;
|
|
15
|
+
readonly value: string | DynamicValue | null;
|
|
16
|
+
readonly keyLocation: Location_2;
|
|
17
|
+
readonly valueLocation: Location_2 | null;
|
|
18
|
+
readonly originalAttribute?: string;
|
|
19
|
+
/**
|
|
20
|
+
* @param key - Attribute name.
|
|
21
|
+
* @param value - Attribute value. Set to `null` for boolean attributes.
|
|
22
|
+
* @param keyLocation - Source location of attribute name.
|
|
23
|
+
* @param valueLocation - Source location of attribute value.
|
|
24
|
+
* @param originalAttribute - If this attribute was dynamically added via a
|
|
25
|
+
* transformation (e.g. vuejs `:id` generating the `id` attribute) this
|
|
26
|
+
* parameter should be set to the attribute name of the source attribute (`:id`).
|
|
27
|
+
*/
|
|
28
|
+
constructor(key: string, value: null | string | DynamicValue | null, keyLocation: Location_2, valueLocation: Location_2 | null, originalAttribute?: string);
|
|
29
|
+
/**
|
|
30
|
+
* Flag set to true if the attribute value is static.
|
|
31
|
+
*/
|
|
32
|
+
get isStatic(): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Flag set to true if the attribute value is dynamic.
|
|
35
|
+
*/
|
|
36
|
+
get isDynamic(): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Test attribute value.
|
|
39
|
+
*
|
|
40
|
+
* @param pattern - Pattern to match value against. Can be a RegExp, literal
|
|
41
|
+
* string or an array of strings (returns true if any value matches the
|
|
42
|
+
* array).
|
|
43
|
+
* @param dynamicMatches - If true `DynamicValue` will always match, if false
|
|
44
|
+
* it never matches.
|
|
45
|
+
* @returns `true` if attribute value matches pattern.
|
|
46
|
+
*/
|
|
47
|
+
valueMatches(pattern: RegExp, dynamicMatches?: boolean): boolean;
|
|
48
|
+
valueMatches(pattern: string, dynamicMatches?: boolean): boolean;
|
|
49
|
+
valueMatches(pattern: string[], dynamicMatches?: boolean): boolean;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Raw attribute data.
|
|
54
|
+
*
|
|
55
|
+
* @public
|
|
56
|
+
*/
|
|
57
|
+
export declare interface AttributeData {
|
|
58
|
+
/** Attribute name */
|
|
59
|
+
key: string;
|
|
60
|
+
/** Attribute value */
|
|
61
|
+
value: string | DynamicValue | null;
|
|
62
|
+
/** Quotation mark (if present) */
|
|
63
|
+
quote: '"' | "'" | null;
|
|
64
|
+
/** Original attribute name (when a dynamic attribute is used), e.g
|
|
65
|
+
* "ng-attr-foo" or "v-bind:foo" */
|
|
66
|
+
originalAttribute?: string;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Event emitted when attributes are encountered.
|
|
71
|
+
*
|
|
72
|
+
* @public
|
|
73
|
+
*/
|
|
74
|
+
export declare interface AttributeEvent extends Event_2 {
|
|
75
|
+
/** Location of the full attribute (key, quotes and value) */
|
|
76
|
+
location: Location_2;
|
|
77
|
+
/** Attribute name. */
|
|
78
|
+
key: string;
|
|
79
|
+
/** Attribute value. */
|
|
80
|
+
value: string | DynamicValue | null;
|
|
81
|
+
/** Quotemark used. */
|
|
82
|
+
quote: '"' | "'" | null;
|
|
83
|
+
/** Set to original attribute when a transformer dynamically added this
|
|
84
|
+
* attribute. */
|
|
85
|
+
originalAttribute?: string;
|
|
86
|
+
/** HTML element this attribute belongs to. */
|
|
87
|
+
target: HtmlElement;
|
|
88
|
+
/** Location of the attribute key */
|
|
89
|
+
keyLocation: Location_2;
|
|
90
|
+
/** Location of the attribute value */
|
|
91
|
+
valueLocation: Location_2 | null;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/* Excluded from this release type: AttrNameToken */
|
|
95
|
+
|
|
96
|
+
/* Excluded from this release type: AttrValueToken */
|
|
97
|
+
|
|
98
|
+
/* Excluded from this release type: BaseToken */
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* @public
|
|
102
|
+
*/
|
|
103
|
+
export declare type CategoryOrTag = string;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Checks text content of an element.
|
|
107
|
+
*
|
|
108
|
+
* Any text is considered including text from descendant elements. Whitespace is
|
|
109
|
+
* ignored.
|
|
110
|
+
*
|
|
111
|
+
* If any text is dynamic `TextClassification.DYNAMIC_TEXT` is returned.
|
|
112
|
+
*
|
|
113
|
+
* @public
|
|
114
|
+
*/
|
|
115
|
+
export declare function classifyNodeText(node: HtmlElement, options?: TextClassificationOptions): TextClassification;
|
|
116
|
+
|
|
117
|
+
/* Excluded from this release type: CommentToken */
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Event emitted when Internet Explorer conditionals `<![if ...]>` are
|
|
121
|
+
* encountered.
|
|
122
|
+
*
|
|
123
|
+
* @public
|
|
124
|
+
*/
|
|
125
|
+
export declare interface ConditionalEvent extends Event_2 {
|
|
126
|
+
/** Event location. */
|
|
127
|
+
location: Location_2;
|
|
128
|
+
/** Condition including markers. */
|
|
129
|
+
condition: string;
|
|
130
|
+
/** The element containing the conditional, if any. */
|
|
131
|
+
parent: HtmlElement | null;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/* Excluded from this release type: ConditionalToken */
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Configuration holder.
|
|
138
|
+
*
|
|
139
|
+
* Each file being validated will have a unique instance of this class.
|
|
140
|
+
*
|
|
141
|
+
* @public
|
|
142
|
+
*/
|
|
143
|
+
export declare class Config {
|
|
144
|
+
private config;
|
|
145
|
+
private configurations;
|
|
146
|
+
private initialized;
|
|
147
|
+
private metaTable;
|
|
148
|
+
private plugins;
|
|
149
|
+
private transformers;
|
|
150
|
+
private rootDir;
|
|
151
|
+
/**
|
|
152
|
+
* Create a new blank configuration. See also `Config.defaultConfig()`.
|
|
153
|
+
*/
|
|
154
|
+
static empty(): Config;
|
|
155
|
+
/**
|
|
156
|
+
* Create configuration from object.
|
|
157
|
+
*/
|
|
158
|
+
static fromObject(options: ConfigData, filename?: string | null): Config;
|
|
159
|
+
/**
|
|
160
|
+
* Read configuration from filename.
|
|
161
|
+
*
|
|
162
|
+
* Note: this reads configuration data from a file. If you intent to load
|
|
163
|
+
* configuration for a file to validate use `ConfigLoader.fromTarget()`.
|
|
164
|
+
*
|
|
165
|
+
* @param filename - The file to read from or one of the presets such as
|
|
166
|
+
* `html-validate:recommended`.
|
|
167
|
+
*/
|
|
168
|
+
static fromFile(filename: string): Config;
|
|
169
|
+
/* Excluded from this release type: validate */
|
|
170
|
+
/**
|
|
171
|
+
* Load a default configuration object.
|
|
172
|
+
*/
|
|
173
|
+
static defaultConfig(): Config;
|
|
174
|
+
/* Excluded from this release type: __constructor */
|
|
175
|
+
/**
|
|
176
|
+
* Initialize plugins, transforms etc.
|
|
177
|
+
*
|
|
178
|
+
* Must be called before trying to use config. Can safely be called multiple
|
|
179
|
+
* times.
|
|
180
|
+
*
|
|
181
|
+
* @public
|
|
182
|
+
*/
|
|
183
|
+
init(): void;
|
|
184
|
+
/**
|
|
185
|
+
* Returns true if this configuration is marked as "root".
|
|
186
|
+
*/
|
|
187
|
+
isRootFound(): boolean;
|
|
188
|
+
/**
|
|
189
|
+
* Returns a new configuration as a merge of the two. Entries from the passed
|
|
190
|
+
* object takes priority over this object.
|
|
191
|
+
*
|
|
192
|
+
* @public
|
|
193
|
+
* @param rhs - Configuration to merge with this one.
|
|
194
|
+
*/
|
|
195
|
+
merge(rhs: Config): Config;
|
|
196
|
+
private extendConfig;
|
|
197
|
+
/**
|
|
198
|
+
* Get element metadata.
|
|
199
|
+
*/
|
|
200
|
+
getMetaTable(): MetaTable;
|
|
201
|
+
/* Excluded from this release type: expandRelative */
|
|
202
|
+
/* Excluded from this release type: get */
|
|
203
|
+
/* Excluded from this release type: getRules */
|
|
204
|
+
private static getRulesObject;
|
|
205
|
+
/* Excluded from this release type: getPlugins */
|
|
206
|
+
private loadPlugins;
|
|
207
|
+
private loadConfigurations;
|
|
208
|
+
private extendMeta;
|
|
209
|
+
/* Excluded from this release type: resolve */
|
|
210
|
+
/* Excluded from this release type: resolveData */
|
|
211
|
+
private precompileTransformers;
|
|
212
|
+
/**
|
|
213
|
+
* Get transformation function requested by configuration.
|
|
214
|
+
*
|
|
215
|
+
* Searches:
|
|
216
|
+
*
|
|
217
|
+
* - Named transformers from plugins.
|
|
218
|
+
* - Unnamed transformer from plugin.
|
|
219
|
+
* - Standalone modules (local or node_modules)
|
|
220
|
+
*
|
|
221
|
+
* @param name - Key from configuration
|
|
222
|
+
*/
|
|
223
|
+
private getTransformFunction;
|
|
224
|
+
/**
|
|
225
|
+
* @param name - Original name from configuration
|
|
226
|
+
* @param pluginName - Name of plugin
|
|
227
|
+
* @param key - Name of transform (from plugin)
|
|
228
|
+
*/
|
|
229
|
+
private getNamedTransformerFromPlugin;
|
|
230
|
+
/**
|
|
231
|
+
* @param name - Original name from configuration
|
|
232
|
+
* @param plugin - Plugin instance
|
|
233
|
+
*/
|
|
234
|
+
private getUnnamedTransformerFromPlugin;
|
|
235
|
+
private getTransformerFromModule;
|
|
236
|
+
/* Excluded from this release type: rootDirCache */
|
|
237
|
+
/* Excluded from this release type: rootDirCache */
|
|
238
|
+
/* Excluded from this release type: findRootDir */
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* @public
|
|
243
|
+
*/
|
|
244
|
+
export declare interface ConfigData {
|
|
245
|
+
/**
|
|
246
|
+
* If set to true no new configurations will be searched.
|
|
247
|
+
*/
|
|
248
|
+
root?: boolean;
|
|
249
|
+
extends?: string[];
|
|
250
|
+
/**
|
|
251
|
+
* List of sources for element metadata.
|
|
252
|
+
*
|
|
253
|
+
* The following sources are allowed:
|
|
254
|
+
*
|
|
255
|
+
* - "html5" (default) for the builtin metadata.
|
|
256
|
+
* - node module which export metadata
|
|
257
|
+
* - local path to json or js file exporting metadata.
|
|
258
|
+
* - object with inline metadata
|
|
259
|
+
*
|
|
260
|
+
* If elements isn't specified it defaults to `["html5"]`
|
|
261
|
+
*/
|
|
262
|
+
elements?: Array<string | Record<string, unknown>>;
|
|
263
|
+
/**
|
|
264
|
+
* List of plugins.
|
|
265
|
+
*
|
|
266
|
+
* Each plugin must be resolvable be require and export the plugin interface.
|
|
267
|
+
*/
|
|
268
|
+
plugins?: string[];
|
|
269
|
+
/**
|
|
270
|
+
* List of source file transformations. A transformer takes a filename and
|
|
271
|
+
* returns Source instances with extracted HTML-templates.
|
|
272
|
+
*
|
|
273
|
+
* Example:
|
|
274
|
+
*
|
|
275
|
+
* ```js
|
|
276
|
+
* "transform": {
|
|
277
|
+
* "^.*\\.foo$": "my-transform"
|
|
278
|
+
* }
|
|
279
|
+
* ```
|
|
280
|
+
*
|
|
281
|
+
* To run the "my-transform" module on all .foo files.
|
|
282
|
+
*/
|
|
283
|
+
transform?: TransformMap;
|
|
284
|
+
rules?: RuleConfig;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* @public
|
|
289
|
+
*/
|
|
290
|
+
export declare class ConfigError extends UserError {
|
|
291
|
+
constructor(message: string, nested?: Error);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* @public
|
|
296
|
+
*/
|
|
297
|
+
export declare interface ConfigFactory {
|
|
298
|
+
defaultConfig(): Config;
|
|
299
|
+
empty(): Config;
|
|
300
|
+
fromObject(options: ConfigData, filename?: string | null): Config;
|
|
301
|
+
fromFile(filename: string): Config;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* Configuration loader interface.
|
|
306
|
+
*
|
|
307
|
+
* A configuration loader takes a handle (typically a filename) and returns a
|
|
308
|
+
* configuration for it.
|
|
309
|
+
*
|
|
310
|
+
* @public
|
|
311
|
+
*/
|
|
312
|
+
export declare abstract class ConfigLoader {
|
|
313
|
+
protected readonly configFactory: ConfigFactory;
|
|
314
|
+
protected readonly globalConfig: Config;
|
|
315
|
+
constructor(config?: ConfigData, configFactory?: ConfigFactory);
|
|
316
|
+
/**
|
|
317
|
+
* Get configuration for given handle.
|
|
318
|
+
*
|
|
319
|
+
* Handle is typically a filename but it is up to the loader to interpret the
|
|
320
|
+
* handle as something useful.
|
|
321
|
+
*
|
|
322
|
+
* If [[configOverride]] is set it is merged with the final result.
|
|
323
|
+
*
|
|
324
|
+
* @param handle - Unique handle to get configuration for.
|
|
325
|
+
* @param configOverride - Optional configuration to merge final results with.
|
|
326
|
+
*/
|
|
327
|
+
abstract getConfigFor(handle: string, configOverride?: ConfigData): Config;
|
|
328
|
+
/**
|
|
329
|
+
* Flush configuration cache.
|
|
330
|
+
*
|
|
331
|
+
* Flushes all cached entries unless a specific handle is given.
|
|
332
|
+
*
|
|
333
|
+
* @param handle - If given only the cache for given handle will be flushed.
|
|
334
|
+
*/
|
|
335
|
+
abstract flushCache(handle?: string): void;
|
|
336
|
+
/**
|
|
337
|
+
* Default configuration used when no explicit configuration is passed to constructor.
|
|
338
|
+
*/
|
|
339
|
+
protected abstract defaultConfig(): Config;
|
|
340
|
+
protected empty(): Config;
|
|
341
|
+
protected loadFromObject(options: ConfigData, filename?: string | null): Config;
|
|
342
|
+
protected loadFromFile(filename: string): Config;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/* Excluded from this release type: configPresets */
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* Configuration ready event.
|
|
349
|
+
*
|
|
350
|
+
* @public
|
|
351
|
+
*/
|
|
352
|
+
export declare interface ConfigReadyEvent extends Event_2 {
|
|
353
|
+
config: ResolvedConfig;
|
|
354
|
+
rules: Record<string, Rule<unknown, unknown>>;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* @public
|
|
359
|
+
*/
|
|
360
|
+
declare interface CSSStyleDeclaration_2 {
|
|
361
|
+
[key: string]: string;
|
|
362
|
+
}
|
|
363
|
+
export { CSSStyleDeclaration_2 as CSSStyleDeclaration }
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* @public
|
|
367
|
+
*/
|
|
368
|
+
export declare interface DeferredMessage extends Omit<Message, "selector"> {
|
|
369
|
+
selector: () => string | null;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* Helper function to assist IDE with completion and type-checking.
|
|
374
|
+
*
|
|
375
|
+
* @public
|
|
376
|
+
*/
|
|
377
|
+
export declare function defineMetadata(metatable: MetaDataTable): MetaDataTable;
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* Helper function to assist IDE with completion and type-checking.
|
|
381
|
+
*
|
|
382
|
+
* @public
|
|
383
|
+
*/
|
|
384
|
+
export declare function definePlugin(plugin: Plugin_2): Plugin_2;
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* @public
|
|
388
|
+
*/
|
|
389
|
+
export declare interface DeprecatedElement {
|
|
390
|
+
message?: string;
|
|
391
|
+
documentation?: string;
|
|
392
|
+
source?: string;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* Event emitted when html-validate directives `<!-- [html-validate-...] -->`
|
|
397
|
+
* are encountered.
|
|
398
|
+
*
|
|
399
|
+
* @public
|
|
400
|
+
*/
|
|
401
|
+
export declare interface DirectiveEvent extends Event_2 {
|
|
402
|
+
/** Event location. */
|
|
403
|
+
location: Location_2;
|
|
404
|
+
/** Action location */
|
|
405
|
+
actionLocation: Location_2;
|
|
406
|
+
/** Options location */
|
|
407
|
+
optionsLocation?: Location_2;
|
|
408
|
+
/** Comment location */
|
|
409
|
+
commentLocation?: Location_2;
|
|
410
|
+
/** Directive action. */
|
|
411
|
+
action: "enable" | "disable" | "disable-block" | "disable-next";
|
|
412
|
+
/** Directive options. */
|
|
413
|
+
data: string;
|
|
414
|
+
/** Directive comment. */
|
|
415
|
+
comment: string;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
/* Excluded from this release type: DirectiveToken */
|
|
419
|
+
|
|
420
|
+
/* Excluded from this release type: DoctypeCloseToken */
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* Event emitted when doctypes `<!DOCTYPE ..>` are encountered.
|
|
424
|
+
*
|
|
425
|
+
* @public
|
|
426
|
+
*/
|
|
427
|
+
export declare interface DoctypeEvent extends Event_2 {
|
|
428
|
+
/** Event location. */
|
|
429
|
+
location: Location_2;
|
|
430
|
+
/** Tag */
|
|
431
|
+
tag: string;
|
|
432
|
+
/** Selected doctype */
|
|
433
|
+
value: string;
|
|
434
|
+
/** Location of doctype value */
|
|
435
|
+
valueLocation: Location_2;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
/* Excluded from this release type: DoctypeOpenToken */
|
|
439
|
+
|
|
440
|
+
/* Excluded from this release type: DoctypeValueToken */
|
|
441
|
+
|
|
442
|
+
/**
|
|
443
|
+
* @public
|
|
444
|
+
*/
|
|
445
|
+
export declare type DOMInternalID = number;
|
|
446
|
+
|
|
447
|
+
/**
|
|
448
|
+
* Event emitted after initialization but before tokenization and parsing occurs.
|
|
449
|
+
* Can be used to initialize state in rules.
|
|
450
|
+
*
|
|
451
|
+
* @public
|
|
452
|
+
*/
|
|
453
|
+
export declare interface DOMLoadEvent extends Event_2 {
|
|
454
|
+
source: Source;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
/**
|
|
458
|
+
* @public
|
|
459
|
+
*/
|
|
460
|
+
export declare class DOMNode {
|
|
461
|
+
readonly nodeName: string;
|
|
462
|
+
readonly nodeType: NodeType;
|
|
463
|
+
readonly childNodes: DOMNode[];
|
|
464
|
+
readonly location: Location_2;
|
|
465
|
+
/* Excluded from this release type: unique */
|
|
466
|
+
private cache;
|
|
467
|
+
/**
|
|
468
|
+
* Set of disabled rules for this node.
|
|
469
|
+
*
|
|
470
|
+
* Rules disabled by using directives are added here.
|
|
471
|
+
*/
|
|
472
|
+
private disabledRules;
|
|
473
|
+
/**
|
|
474
|
+
* Set of blocked rules for this node.
|
|
475
|
+
*
|
|
476
|
+
* Rules blocked by using directives are added here.
|
|
477
|
+
*/
|
|
478
|
+
private blockedRules;
|
|
479
|
+
/**
|
|
480
|
+
* Create a new DOMNode.
|
|
481
|
+
*
|
|
482
|
+
* @param nodeType - What node type to create.
|
|
483
|
+
* @param nodeName - What node name to use. For `HtmlElement` this corresponds
|
|
484
|
+
* to the tagName but other node types have specific predefined values.
|
|
485
|
+
* @param location - Source code location of this node.
|
|
486
|
+
*/
|
|
487
|
+
constructor(nodeType: NodeType, nodeName: string | undefined, location: Location_2);
|
|
488
|
+
/* Excluded from this release type: cacheEnable */
|
|
489
|
+
/**
|
|
490
|
+
* Fetch cached value from this DOM node.
|
|
491
|
+
*
|
|
492
|
+
* Cache is not enabled until `cacheEnable()` is called by [[Parser]] (when
|
|
493
|
+
* the element is fully constructed).
|
|
494
|
+
*
|
|
495
|
+
* @returns value or `undefined` if the value doesn't exist.
|
|
496
|
+
*/
|
|
497
|
+
cacheGet<K extends keyof DOMNodeCache>(key: K): DOMNodeCache[K] | undefined;
|
|
498
|
+
cacheGet(key: string | number | symbol): any | undefined;
|
|
499
|
+
/**
|
|
500
|
+
* Store a value in cache.
|
|
501
|
+
*
|
|
502
|
+
* @returns the value itself is returned.
|
|
503
|
+
*/
|
|
504
|
+
cacheSet<K extends keyof DOMNodeCache>(key: K, value: DOMNodeCache[K]): DOMNodeCache[K];
|
|
505
|
+
cacheSet<T>(key: string | number | symbol, value: T): T;
|
|
506
|
+
/**
|
|
507
|
+
* Remove a value by key from cache.
|
|
508
|
+
*
|
|
509
|
+
* @returns `true` if the entry existed and has been removed.
|
|
510
|
+
*/
|
|
511
|
+
cacheRemove<K extends keyof DOMNodeCache>(key: K): boolean;
|
|
512
|
+
cacheRemove(key: string | number | symbol): boolean;
|
|
513
|
+
/**
|
|
514
|
+
* Check if key exists in cache.
|
|
515
|
+
*/
|
|
516
|
+
cacheExists<K extends keyof DOMNodeCache>(key: K): boolean;
|
|
517
|
+
cacheExists(key: string | number | symbol): boolean;
|
|
518
|
+
/**
|
|
519
|
+
* Get the text (recursive) from all child nodes.
|
|
520
|
+
*/
|
|
521
|
+
get textContent(): string;
|
|
522
|
+
append(node: DOMNode): void;
|
|
523
|
+
isRootElement(): boolean;
|
|
524
|
+
/**
|
|
525
|
+
* Tests if two nodes are the same (references the same object).
|
|
526
|
+
*/
|
|
527
|
+
isSameNode(otherNode: DOMNode): boolean;
|
|
528
|
+
/**
|
|
529
|
+
* Returns a DOMNode representing the first direct child node or `null` if the
|
|
530
|
+
* node has no children.
|
|
531
|
+
*/
|
|
532
|
+
get firstChild(): DOMNode;
|
|
533
|
+
/**
|
|
534
|
+
* Returns a DOMNode representing the last direct child node or `null` if the
|
|
535
|
+
* node has no children.
|
|
536
|
+
*/
|
|
537
|
+
get lastChild(): DOMNode;
|
|
538
|
+
/* Excluded from this release type: blockRule */
|
|
539
|
+
/* Excluded from this release type: blockRules */
|
|
540
|
+
/* Excluded from this release type: disableRule */
|
|
541
|
+
/* Excluded from this release type: disableRules */
|
|
542
|
+
/**
|
|
543
|
+
* Enable a previously disabled rule for this node.
|
|
544
|
+
*/
|
|
545
|
+
enableRule(ruleId: string): void;
|
|
546
|
+
/**
|
|
547
|
+
* Enables multiple rules.
|
|
548
|
+
*/
|
|
549
|
+
enableRules(rules: string[]): void;
|
|
550
|
+
/* Excluded from this release type: ruleEnabled */
|
|
551
|
+
/* Excluded from this release type: ruleBlockers */
|
|
552
|
+
generateSelector(): string | null;
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
/**
|
|
556
|
+
* @public
|
|
557
|
+
*/
|
|
558
|
+
export declare interface DOMNodeCache {
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
/**
|
|
562
|
+
* Event emitted when DOM tree is fully constructed.
|
|
563
|
+
*
|
|
564
|
+
* @public
|
|
565
|
+
*/
|
|
566
|
+
export declare interface DOMReadyEvent extends Event_2 {
|
|
567
|
+
/** DOM Tree */
|
|
568
|
+
document: DOMTree;
|
|
569
|
+
source: Source;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
/**
|
|
573
|
+
* @public
|
|
574
|
+
*/
|
|
575
|
+
declare class DOMTokenList_2 extends Array<string> {
|
|
576
|
+
readonly value: string;
|
|
577
|
+
private readonly locations;
|
|
578
|
+
constructor(value: string | DynamicValue | null, location: Location_2 | null);
|
|
579
|
+
item(n: number): string | undefined;
|
|
580
|
+
location(n: number): Location_2 | undefined;
|
|
581
|
+
contains(token: string): boolean;
|
|
582
|
+
iterator(): Generator<{
|
|
583
|
+
index: number;
|
|
584
|
+
item: string;
|
|
585
|
+
location: Location_2;
|
|
586
|
+
}>;
|
|
587
|
+
}
|
|
588
|
+
export { DOMTokenList_2 as DOMTokenList }
|
|
589
|
+
|
|
590
|
+
/**
|
|
591
|
+
* @public
|
|
592
|
+
*/
|
|
593
|
+
export declare class DOMTree {
|
|
594
|
+
readonly root: HtmlElement;
|
|
595
|
+
private active;
|
|
596
|
+
doctype: string | null;
|
|
597
|
+
constructor(location: Location_2);
|
|
598
|
+
pushActive(node: HtmlElement): void;
|
|
599
|
+
popActive(): void;
|
|
600
|
+
getActive(): HtmlElement;
|
|
601
|
+
/**
|
|
602
|
+
* Resolve dynamic meta expressions.
|
|
603
|
+
*/
|
|
604
|
+
resolveMeta(table: MetaTable): void;
|
|
605
|
+
getElementsByTagName(tagName: string): HtmlElement[];
|
|
606
|
+
visitDepthFirst(callback: (node: HtmlElement) => void): void;
|
|
607
|
+
find(callback: (node: HtmlElement) => boolean): HtmlElement | null;
|
|
608
|
+
querySelector(selector: string): HtmlElement | null;
|
|
609
|
+
querySelectorAll(selector: string): HtmlElement[];
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
/**
|
|
613
|
+
* @public
|
|
614
|
+
*/
|
|
615
|
+
export declare class DynamicValue {
|
|
616
|
+
readonly expr: string;
|
|
617
|
+
constructor(expr: string);
|
|
618
|
+
toString(): string;
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
/**
|
|
622
|
+
* Event emitted when an element is fully constructed (including its children).
|
|
623
|
+
*
|
|
624
|
+
* @public
|
|
625
|
+
*/
|
|
626
|
+
export declare interface ElementReadyEvent extends Event_2 {
|
|
627
|
+
/** Event location. */
|
|
628
|
+
location: Location_2;
|
|
629
|
+
/** HTML element */
|
|
630
|
+
target: HtmlElement;
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
/**
|
|
634
|
+
* @public
|
|
635
|
+
*/
|
|
636
|
+
export declare interface ElementTable {
|
|
637
|
+
[tagName: string]: MetaElement;
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
/* Excluded from this release type: EOFToken */
|
|
641
|
+
|
|
642
|
+
/**
|
|
643
|
+
* @public
|
|
644
|
+
*/
|
|
645
|
+
export declare interface ErrorDescriptor<ContextType> {
|
|
646
|
+
node: DOMNode | null;
|
|
647
|
+
message: string;
|
|
648
|
+
location?: Location_2 | null | undefined;
|
|
649
|
+
context?: ContextType;
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
/**
|
|
653
|
+
* @public
|
|
654
|
+
*/
|
|
655
|
+
declare interface Event_2 {
|
|
656
|
+
/** Event location. */
|
|
657
|
+
location: Location_2 | null;
|
|
658
|
+
}
|
|
659
|
+
export { Event_2 as Event }
|
|
660
|
+
|
|
661
|
+
/**
|
|
662
|
+
* @public
|
|
663
|
+
*/
|
|
664
|
+
export declare type EventCallback = (event: string, data: any) => void;
|
|
665
|
+
|
|
666
|
+
/**
|
|
667
|
+
* @public
|
|
668
|
+
*/
|
|
669
|
+
export declare interface EventDump {
|
|
670
|
+
event: string;
|
|
671
|
+
data: any;
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
/**
|
|
675
|
+
* @public
|
|
676
|
+
*/
|
|
677
|
+
export declare class EventHandler {
|
|
678
|
+
listeners: {
|
|
679
|
+
[event: string]: EventCallback[];
|
|
680
|
+
};
|
|
681
|
+
constructor();
|
|
682
|
+
/**
|
|
683
|
+
* Add an event listener.
|
|
684
|
+
*
|
|
685
|
+
* @param event - Event names (comma separated) or '*' for any event.
|
|
686
|
+
* @param callback - Called any time even triggers.
|
|
687
|
+
* @returns Unregistration function.
|
|
688
|
+
*/
|
|
689
|
+
on(event: string, callback: EventCallback): () => void;
|
|
690
|
+
/**
|
|
691
|
+
* Add a onetime event listener. The listener will automatically be removed
|
|
692
|
+
* after being triggered once.
|
|
693
|
+
*
|
|
694
|
+
* @param event - Event names (comma separated) or '*' for any event.
|
|
695
|
+
* @param callback - Called any time even triggers.
|
|
696
|
+
* @returns Unregistration function.
|
|
697
|
+
*/
|
|
698
|
+
once(event: string, callback: EventCallback): () => void;
|
|
699
|
+
/**
|
|
700
|
+
* Trigger event causing all listeners to be called.
|
|
701
|
+
*
|
|
702
|
+
* @param event - Event name.
|
|
703
|
+
* @param data - Event data.
|
|
704
|
+
*/
|
|
705
|
+
trigger(event: string, data: any): void;
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
/**
|
|
709
|
+
* @public
|
|
710
|
+
*/
|
|
711
|
+
export declare interface FormAssociated {
|
|
712
|
+
/** Listed elements have a name attribute and is listed in the form and fieldset elements property. */
|
|
713
|
+
listed: boolean;
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
/**
|
|
717
|
+
* @public
|
|
718
|
+
*/
|
|
719
|
+
export declare class HtmlElement extends DOMNode {
|
|
720
|
+
readonly tagName: string;
|
|
721
|
+
readonly parent: HtmlElement | null;
|
|
722
|
+
readonly voidElement: boolean;
|
|
723
|
+
readonly depth: number;
|
|
724
|
+
closed: NodeClosed;
|
|
725
|
+
protected readonly attr: {
|
|
726
|
+
[key: string]: Attribute[];
|
|
727
|
+
};
|
|
728
|
+
private metaElement;
|
|
729
|
+
private annotation;
|
|
730
|
+
constructor(tagName: string | undefined, parent: HtmlElement | null, closed: NodeClosed, meta: MetaElement | null, location: Location_2);
|
|
731
|
+
/* Excluded from this release type: rootNode */
|
|
732
|
+
/* Excluded from this release type: fromTokens */
|
|
733
|
+
/**
|
|
734
|
+
* Returns annotated name if set or defaults to `<tagName>`.
|
|
735
|
+
*
|
|
736
|
+
* E.g. `my-annotation` or `<div>`.
|
|
737
|
+
*/
|
|
738
|
+
get annotatedName(): string;
|
|
739
|
+
/**
|
|
740
|
+
* Get list of IDs referenced by `aria-labelledby`.
|
|
741
|
+
*
|
|
742
|
+
* If the attribute is unset or empty this getter returns null.
|
|
743
|
+
* If the attribute is dynamic the original {@link DynamicValue} is returned.
|
|
744
|
+
*
|
|
745
|
+
* @public
|
|
746
|
+
*/
|
|
747
|
+
get ariaLabelledby(): string[] | DynamicValue | null;
|
|
748
|
+
/**
|
|
749
|
+
* Similar to childNodes but only elements.
|
|
750
|
+
*/
|
|
751
|
+
get childElements(): HtmlElement[];
|
|
752
|
+
/**
|
|
753
|
+
* Find the first ancestor matching a selector.
|
|
754
|
+
*
|
|
755
|
+
* Implementation of DOM specification of Element.closest(selectors).
|
|
756
|
+
*/
|
|
757
|
+
closest(selectors: string): HtmlElement | null;
|
|
758
|
+
/**
|
|
759
|
+
* Generate a DOM selector for this element. The returned selector will be
|
|
760
|
+
* unique inside the current document.
|
|
761
|
+
*/
|
|
762
|
+
generateSelector(): string | null;
|
|
763
|
+
/**
|
|
764
|
+
* Tests if this element has given tagname.
|
|
765
|
+
*
|
|
766
|
+
* If passing "*" this test will pass if any tagname is set.
|
|
767
|
+
*/
|
|
768
|
+
is(tagName: string): boolean;
|
|
769
|
+
/**
|
|
770
|
+
* Load new element metadata onto this element.
|
|
771
|
+
*
|
|
772
|
+
* Do note that semantics such as `void` cannot be changed (as the element has
|
|
773
|
+
* already been created). In addition the element will still "be" the same
|
|
774
|
+
* element, i.e. even if loading meta for a `<p>` tag upon a `<div>` tag it
|
|
775
|
+
* will still be a `<div>` as far as the rest of the validator is concerned.
|
|
776
|
+
*
|
|
777
|
+
* In fact only certain properties will be copied onto the element:
|
|
778
|
+
*
|
|
779
|
+
* - content categories (flow, phrasing, etc)
|
|
780
|
+
* - required attributes
|
|
781
|
+
* - attribute allowed values
|
|
782
|
+
* - permitted/required elements
|
|
783
|
+
*
|
|
784
|
+
* Properties *not* loaded:
|
|
785
|
+
*
|
|
786
|
+
* - inherit
|
|
787
|
+
* - deprecated
|
|
788
|
+
* - foreign
|
|
789
|
+
* - void
|
|
790
|
+
* - implicitClosed
|
|
791
|
+
* - scriptSupporting
|
|
792
|
+
* - deprecatedAttributes
|
|
793
|
+
*
|
|
794
|
+
* Changes to element metadata will only be visible after `element:ready` (and
|
|
795
|
+
* the subsequent `dom:ready` event).
|
|
796
|
+
*/
|
|
797
|
+
loadMeta(meta: MetaElement): void;
|
|
798
|
+
/**
|
|
799
|
+
* Match this element against given selectors. Returns true if any selector
|
|
800
|
+
* matches.
|
|
801
|
+
*
|
|
802
|
+
* Implementation of DOM specification of Element.matches(selectors).
|
|
803
|
+
*/
|
|
804
|
+
matches(selector: string): boolean;
|
|
805
|
+
get meta(): MetaElement | null;
|
|
806
|
+
/**
|
|
807
|
+
* Set annotation for this element.
|
|
808
|
+
*/
|
|
809
|
+
setAnnotation(text: string): void;
|
|
810
|
+
/**
|
|
811
|
+
* Set attribute. Stores all attributes set even with the same name.
|
|
812
|
+
*
|
|
813
|
+
* @param key - Attribute name
|
|
814
|
+
* @param value - Attribute value. Use `null` if no value is present.
|
|
815
|
+
* @param keyLocation - Location of the attribute name.
|
|
816
|
+
* @param valueLocation - Location of the attribute value (excluding quotation)
|
|
817
|
+
* @param originalAttribute - If attribute is an alias for another attribute
|
|
818
|
+
* (dynamic attributes) set this to the original attribute name.
|
|
819
|
+
*/
|
|
820
|
+
setAttribute(key: string, value: string | DynamicValue | null, keyLocation: Location_2, valueLocation: Location_2 | null, originalAttribute?: string): void;
|
|
821
|
+
/**
|
|
822
|
+
* Get a list of all attributes on this node.
|
|
823
|
+
*/
|
|
824
|
+
get attributes(): Attribute[];
|
|
825
|
+
hasAttribute(key: string): boolean;
|
|
826
|
+
/**
|
|
827
|
+
* Get attribute.
|
|
828
|
+
*
|
|
829
|
+
* By default only the first attribute is returned but if the code needs to
|
|
830
|
+
* handle duplicate attributes the `all` parameter can be set to get all
|
|
831
|
+
* attributes with given key.
|
|
832
|
+
*
|
|
833
|
+
* This usually only happens when code contains duplicate attributes (which
|
|
834
|
+
* `no-dup-attr` will complain about) or when a static attribute is combined
|
|
835
|
+
* with a dynamic, consider:
|
|
836
|
+
*
|
|
837
|
+
* <p class="foo" dynamic-class="bar">
|
|
838
|
+
*
|
|
839
|
+
* @param key - Attribute name
|
|
840
|
+
* @param all - Return single or all attributes.
|
|
841
|
+
*/
|
|
842
|
+
getAttribute(key: string): Attribute | null;
|
|
843
|
+
getAttribute(key: string, all: true): Attribute[];
|
|
844
|
+
/**
|
|
845
|
+
* Get attribute value.
|
|
846
|
+
*
|
|
847
|
+
* Returns the attribute value if present.
|
|
848
|
+
*
|
|
849
|
+
* - Missing attributes return `null`.
|
|
850
|
+
* - Boolean attributes return `null`.
|
|
851
|
+
* - `DynamicValue` returns attribute expression.
|
|
852
|
+
*
|
|
853
|
+
* @param key - Attribute name
|
|
854
|
+
* @returns Attribute value or null.
|
|
855
|
+
*/
|
|
856
|
+
getAttributeValue(key: string): string | null;
|
|
857
|
+
/**
|
|
858
|
+
* Add text as a child node to this element.
|
|
859
|
+
*
|
|
860
|
+
* @param text - Text to add.
|
|
861
|
+
* @param location - Source code location of this text.
|
|
862
|
+
*/
|
|
863
|
+
appendText(text: string | DynamicValue, location: Location_2): void;
|
|
864
|
+
/**
|
|
865
|
+
* Return a list of all known classes on the element. Dynamic values are
|
|
866
|
+
* ignored.
|
|
867
|
+
*/
|
|
868
|
+
get classList(): DOMTokenList_2;
|
|
869
|
+
/**
|
|
870
|
+
* Get element ID if present.
|
|
871
|
+
*/
|
|
872
|
+
get id(): string | null;
|
|
873
|
+
get style(): CSSStyleDeclaration_2;
|
|
874
|
+
/**
|
|
875
|
+
* Returns the first child element or null if there are no child elements.
|
|
876
|
+
*/
|
|
877
|
+
get firstElementChild(): HtmlElement | null;
|
|
878
|
+
/**
|
|
879
|
+
* Returns the last child element or null if there are no child elements.
|
|
880
|
+
*/
|
|
881
|
+
get lastElementChild(): HtmlElement | null;
|
|
882
|
+
get siblings(): HtmlElement[];
|
|
883
|
+
get previousSibling(): HtmlElement | null;
|
|
884
|
+
get nextSibling(): HtmlElement | null;
|
|
885
|
+
getElementsByTagName(tagName: string): HtmlElement[];
|
|
886
|
+
querySelector(selector: string): HtmlElement | null;
|
|
887
|
+
querySelectorAll(selector: string): HtmlElement[];
|
|
888
|
+
private querySelectorImpl;
|
|
889
|
+
/* Excluded from this release type: visitDepthFirst */
|
|
890
|
+
/* Excluded from this release type: someChildren */
|
|
891
|
+
/* Excluded from this release type: everyChildren */
|
|
892
|
+
/* Excluded from this release type: find */
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
/**
|
|
896
|
+
* Primary API for using HTML-validate.
|
|
897
|
+
*
|
|
898
|
+
* Provides high-level abstractions for common operations.
|
|
899
|
+
*
|
|
900
|
+
* @public
|
|
901
|
+
*/
|
|
902
|
+
export declare class HtmlValidate {
|
|
903
|
+
protected configLoader: ConfigLoader;
|
|
904
|
+
/**
|
|
905
|
+
* Create a new validator.
|
|
906
|
+
*
|
|
907
|
+
* @public
|
|
908
|
+
* @param configLoader - Use a custom configuration loader.
|
|
909
|
+
* @param config - If set it provides the global default configuration. By
|
|
910
|
+
* default `Config.defaultConfig()` is used.
|
|
911
|
+
*/
|
|
912
|
+
constructor(config?: ConfigData);
|
|
913
|
+
constructor(configLoader: ConfigLoader);
|
|
914
|
+
/**
|
|
915
|
+
* Parse and validate HTML from string.
|
|
916
|
+
*
|
|
917
|
+
* @public
|
|
918
|
+
* @param str - Text to parse.
|
|
919
|
+
* @param filename - If set configuration is loaded for given filename.
|
|
920
|
+
* @param hooks - Optional hooks (see [[Source]]) for definition.
|
|
921
|
+
* @returns Report output.
|
|
922
|
+
*/
|
|
923
|
+
validateString(str: string): Report;
|
|
924
|
+
validateString(str: string, filename: string): Report;
|
|
925
|
+
validateString(str: string, hooks: SourceHooks): Report;
|
|
926
|
+
validateString(str: string, options: ConfigData): Report;
|
|
927
|
+
validateString(str: string, filename: string, hooks: SourceHooks): Report;
|
|
928
|
+
validateString(str: string, filename: string, options: ConfigData): Report;
|
|
929
|
+
validateString(str: string, filename: string, options: ConfigData, hooks: SourceHooks): Report;
|
|
930
|
+
/**
|
|
931
|
+
* Parse and validate HTML from [[Source]].
|
|
932
|
+
*
|
|
933
|
+
* @public
|
|
934
|
+
* @param input - Source to parse.
|
|
935
|
+
* @returns Report output.
|
|
936
|
+
*/
|
|
937
|
+
validateSource(input: Source, configOverride?: ConfigData): Report;
|
|
938
|
+
/**
|
|
939
|
+
* Parse and validate HTML from file.
|
|
940
|
+
*
|
|
941
|
+
* @public
|
|
942
|
+
* @param filename - Filename to read and parse.
|
|
943
|
+
* @returns Report output.
|
|
944
|
+
*/
|
|
945
|
+
validateFile(filename: string): Report;
|
|
946
|
+
/**
|
|
947
|
+
* Parse and validate HTML from multiple files. Result is merged together to a
|
|
948
|
+
* single report.
|
|
949
|
+
*
|
|
950
|
+
* @param filenames - Filenames to read and parse.
|
|
951
|
+
* @returns Report output.
|
|
952
|
+
*/
|
|
953
|
+
validateMultipleFiles(filenames: string[]): Report;
|
|
954
|
+
/**
|
|
955
|
+
* Returns true if the given filename can be validated.
|
|
956
|
+
*
|
|
957
|
+
* A file is considered to be validatable if the extension is `.html` or if a
|
|
958
|
+
* transformer matches the filename.
|
|
959
|
+
*
|
|
960
|
+
* This is mostly useful for tooling to determine whenever to validate the
|
|
961
|
+
* file or not. CLI tools will run on all the given files anyway.
|
|
962
|
+
*/
|
|
963
|
+
canValidate(filename: string): boolean;
|
|
964
|
+
/**
|
|
965
|
+
* Tokenize filename and output all tokens.
|
|
966
|
+
*
|
|
967
|
+
* Using CLI this is enabled with `--dump-tokens`. Mostly useful for
|
|
968
|
+
* debugging.
|
|
969
|
+
*
|
|
970
|
+
* @param filename - Filename to tokenize.
|
|
971
|
+
*/
|
|
972
|
+
dumpTokens(filename: string): TokenDump[];
|
|
973
|
+
/**
|
|
974
|
+
* Parse filename and output all events.
|
|
975
|
+
*
|
|
976
|
+
* Using CLI this is enabled with `--dump-events`. Mostly useful for
|
|
977
|
+
* debugging.
|
|
978
|
+
*
|
|
979
|
+
* @param filename - Filename to dump events from.
|
|
980
|
+
*/
|
|
981
|
+
dumpEvents(filename: string): EventDump[];
|
|
982
|
+
/**
|
|
983
|
+
* Parse filename and output DOM tree.
|
|
984
|
+
*
|
|
985
|
+
* Using CLI this is enabled with `--dump-tree`. Mostly useful for
|
|
986
|
+
* debugging.
|
|
987
|
+
*
|
|
988
|
+
* @param filename - Filename to dump DOM tree from.
|
|
989
|
+
*/
|
|
990
|
+
dumpTree(filename: string): string[];
|
|
991
|
+
/**
|
|
992
|
+
* Transform filename and output source data.
|
|
993
|
+
*
|
|
994
|
+
* Using CLI this is enabled with `--dump-source`. Mostly useful for
|
|
995
|
+
* debugging.
|
|
996
|
+
*
|
|
997
|
+
* @param filename - Filename to dump source from.
|
|
998
|
+
*/
|
|
999
|
+
dumpSource(filename: string): string[];
|
|
1000
|
+
/**
|
|
1001
|
+
* Get effective configuration schema.
|
|
1002
|
+
*/
|
|
1003
|
+
getConfigurationSchema(): SchemaObject;
|
|
1004
|
+
/**
|
|
1005
|
+
* Get effective metadata element schema.
|
|
1006
|
+
*
|
|
1007
|
+
* If a filename is given the configured plugins can extend the
|
|
1008
|
+
* schema. Filename must not be an existing file or a filetype normally
|
|
1009
|
+
* handled by html-validate but the path will be used when resolving
|
|
1010
|
+
* configuration. As a rule-of-thumb, set it to the elements json file.
|
|
1011
|
+
*/
|
|
1012
|
+
getElementsSchema(filename?: string): SchemaObject;
|
|
1013
|
+
/**
|
|
1014
|
+
* Get contextual documentation for the given rule.
|
|
1015
|
+
*
|
|
1016
|
+
* Typical usage:
|
|
1017
|
+
*
|
|
1018
|
+
* ```js
|
|
1019
|
+
* const report = htmlvalidate.validateFile("my-file.html");
|
|
1020
|
+
* for (const result of report.results){
|
|
1021
|
+
* const config = htmlvalidate.getConfigFor(result.filePath);
|
|
1022
|
+
* for (const message of result.messages){
|
|
1023
|
+
* const documentation = htmlvalidate.getRuleDocumentation(message.ruleId, config, message.context);
|
|
1024
|
+
* // do something with documentation
|
|
1025
|
+
* }
|
|
1026
|
+
* }
|
|
1027
|
+
* ```
|
|
1028
|
+
*
|
|
1029
|
+
* @param ruleId - Rule to get documentation for.
|
|
1030
|
+
* @param config - If set it provides more accurate description by using the
|
|
1031
|
+
* correct configuration for the file.
|
|
1032
|
+
* @param context - If set to `Message.context` some rules can provide
|
|
1033
|
+
* contextual details and suggestions.
|
|
1034
|
+
*/
|
|
1035
|
+
getRuleDocumentation(ruleId: string, config?: Config | null, context?: any | null): RuleDocumentation | null;
|
|
1036
|
+
/* Excluded from this release type: getParserFor */
|
|
1037
|
+
/**
|
|
1038
|
+
* Get configuration for given filename.
|
|
1039
|
+
*
|
|
1040
|
+
* See [[FileSystemConfigLoader]] for details.
|
|
1041
|
+
*
|
|
1042
|
+
* @public
|
|
1043
|
+
* @param filename - Filename to get configuration for.
|
|
1044
|
+
* @param configOverride - Configuration to apply last.
|
|
1045
|
+
*/
|
|
1046
|
+
getConfigFor(filename: string, configOverride?: ConfigData): Config;
|
|
1047
|
+
/**
|
|
1048
|
+
* Flush configuration cache. Clears full cache unless a filename is given.
|
|
1049
|
+
*
|
|
1050
|
+
* See [[FileSystemConfigLoader]] for details.
|
|
1051
|
+
*
|
|
1052
|
+
* @public
|
|
1053
|
+
* @param filename - If set, only flush cache for given filename.
|
|
1054
|
+
*/
|
|
1055
|
+
flushConfigCache(filename?: string): void;
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
/**
|
|
1059
|
+
* @public
|
|
1060
|
+
*/
|
|
1061
|
+
export declare interface IncludeExcludeOptions {
|
|
1062
|
+
include: string[] | null;
|
|
1063
|
+
exclude: string[] | null;
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
/* Excluded from this release type: keywordPatternMatcher */
|
|
1067
|
+
|
|
1068
|
+
/**
|
|
1069
|
+
* @public
|
|
1070
|
+
*/
|
|
1071
|
+
export declare interface ListenEventMap {
|
|
1072
|
+
"config:ready": ConfigReadyEvent;
|
|
1073
|
+
"source:ready": SourceReadyEvent;
|
|
1074
|
+
/* Excluded from this release type: token */
|
|
1075
|
+
"tag:open": TagOpenEvent;
|
|
1076
|
+
"tag:start": TagStartEvent;
|
|
1077
|
+
"tag:close": TagCloseEvent;
|
|
1078
|
+
"tag:end": TagEndEvent;
|
|
1079
|
+
"tag:ready": TagReadyEvent;
|
|
1080
|
+
"element:ready": ElementReadyEvent;
|
|
1081
|
+
"dom:load": DOMLoadEvent;
|
|
1082
|
+
"dom:ready": DOMReadyEvent;
|
|
1083
|
+
doctype: DoctypeEvent;
|
|
1084
|
+
attr: AttributeEvent;
|
|
1085
|
+
whitespace: WhitespaceEvent;
|
|
1086
|
+
conditional: ConditionalEvent;
|
|
1087
|
+
directive: DirectiveEvent;
|
|
1088
|
+
/* Excluded from this release type: "rule:error" */
|
|
1089
|
+
/* Excluded from this release type: "parse:begin" */
|
|
1090
|
+
/* Excluded from this release type: "parse:end" */
|
|
1091
|
+
"*": Event_2;
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1094
|
+
/* Excluded from this release type: LoadedPlugin */
|
|
1095
|
+
|
|
1096
|
+
/**
|
|
1097
|
+
* @public
|
|
1098
|
+
*/
|
|
1099
|
+
declare interface Location_2 {
|
|
1100
|
+
/**
|
|
1101
|
+
* The filemane this location refers to.
|
|
1102
|
+
*/
|
|
1103
|
+
readonly filename: string;
|
|
1104
|
+
/**
|
|
1105
|
+
* The string offset (number of characters into the string) this location
|
|
1106
|
+
* refers to.
|
|
1107
|
+
*/
|
|
1108
|
+
readonly offset: number;
|
|
1109
|
+
/**
|
|
1110
|
+
* The line number in the file.
|
|
1111
|
+
*/
|
|
1112
|
+
readonly line: number;
|
|
1113
|
+
/**
|
|
1114
|
+
* The column number in the file. Tabs counts as 1 (not expanded).
|
|
1115
|
+
*/
|
|
1116
|
+
readonly column: number;
|
|
1117
|
+
/**
|
|
1118
|
+
* The number of characters this location refers to. This includes any
|
|
1119
|
+
* whitespace characters such as newlines.
|
|
1120
|
+
*/
|
|
1121
|
+
readonly size: number;
|
|
1122
|
+
}
|
|
1123
|
+
export { Location_2 as Location }
|
|
1124
|
+
|
|
1125
|
+
/**
|
|
1126
|
+
* Reported error message.
|
|
1127
|
+
*
|
|
1128
|
+
* @public
|
|
1129
|
+
*/
|
|
1130
|
+
export declare interface Message {
|
|
1131
|
+
/** Rule that triggered this message */
|
|
1132
|
+
ruleId: string;
|
|
1133
|
+
/** URL to description of error */
|
|
1134
|
+
ruleUrl?: string;
|
|
1135
|
+
/** Severity of the message */
|
|
1136
|
+
severity: number;
|
|
1137
|
+
/** Message text */
|
|
1138
|
+
message: string;
|
|
1139
|
+
/** Offset (number of characters) into the source */
|
|
1140
|
+
offset: number;
|
|
1141
|
+
/** Line number */
|
|
1142
|
+
line: number;
|
|
1143
|
+
/** Column number */
|
|
1144
|
+
column: number;
|
|
1145
|
+
/** From start offset, how many characters is this message relevant for */
|
|
1146
|
+
size: number;
|
|
1147
|
+
/** DOM selector */
|
|
1148
|
+
selector: string | null;
|
|
1149
|
+
/**
|
|
1150
|
+
* Optional error context used to provide context-aware documentation.
|
|
1151
|
+
*
|
|
1152
|
+
* This context can be passed to [[HtmlValidate#getRuleDocumentation]].
|
|
1153
|
+
*/
|
|
1154
|
+
context?: any;
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1157
|
+
/**
|
|
1158
|
+
* @public
|
|
1159
|
+
*/
|
|
1160
|
+
export declare interface MetaAttribute {
|
|
1161
|
+
allowed?: MetaAttributeAllowedCallback;
|
|
1162
|
+
boolean?: boolean;
|
|
1163
|
+
deprecated?: boolean | string;
|
|
1164
|
+
enum?: Array<string | RegExp>;
|
|
1165
|
+
list?: boolean;
|
|
1166
|
+
omit?: boolean;
|
|
1167
|
+
required?: boolean;
|
|
1168
|
+
}
|
|
1169
|
+
|
|
1170
|
+
/**
|
|
1171
|
+
* Callback for the `allowed` property of `MetaAttribute`. It takes a node and
|
|
1172
|
+
* should return `null` if there is no errors and a string with an error
|
|
1173
|
+
* description if there is an error.
|
|
1174
|
+
*
|
|
1175
|
+
* @public
|
|
1176
|
+
* @param node - The node the attribute belongs to.
|
|
1177
|
+
* @param attr - The current attribute being validated.
|
|
1178
|
+
*/
|
|
1179
|
+
export declare type MetaAttributeAllowedCallback = (node: HtmlElement, attr: Attribute) => string | null | undefined;
|
|
1180
|
+
|
|
1181
|
+
/**
|
|
1182
|
+
* Properties listed here can be copied (loaded) onto another element using
|
|
1183
|
+
* [[HtmlElement.loadMeta]].
|
|
1184
|
+
*
|
|
1185
|
+
* @public
|
|
1186
|
+
*/
|
|
1187
|
+
export declare const MetaCopyableProperty: Array<keyof MetaElement>;
|
|
1188
|
+
|
|
1189
|
+
/**
|
|
1190
|
+
* @public
|
|
1191
|
+
*/
|
|
1192
|
+
export declare interface MetaData {
|
|
1193
|
+
inherit?: string;
|
|
1194
|
+
metadata?: boolean | PropertyExpression;
|
|
1195
|
+
flow?: boolean | PropertyExpression;
|
|
1196
|
+
sectioning?: boolean | PropertyExpression;
|
|
1197
|
+
heading?: boolean | PropertyExpression;
|
|
1198
|
+
phrasing?: boolean | PropertyExpression;
|
|
1199
|
+
embedded?: boolean | PropertyExpression;
|
|
1200
|
+
interactive?: boolean | PropertyExpression;
|
|
1201
|
+
deprecated?: boolean | string | DeprecatedElement;
|
|
1202
|
+
foreign?: boolean;
|
|
1203
|
+
void?: boolean;
|
|
1204
|
+
transparent?: boolean | string[];
|
|
1205
|
+
implicitClosed?: string[];
|
|
1206
|
+
scriptSupporting?: boolean;
|
|
1207
|
+
form?: boolean;
|
|
1208
|
+
/** Mark element as a form-associated element */
|
|
1209
|
+
formAssociated?: Partial<FormAssociated>;
|
|
1210
|
+
labelable?: boolean | PropertyExpression;
|
|
1211
|
+
deprecatedAttributes?: string[];
|
|
1212
|
+
requiredAttributes?: string[];
|
|
1213
|
+
attributes?: PermittedAttribute;
|
|
1214
|
+
permittedContent?: Permitted;
|
|
1215
|
+
permittedDescendants?: Permitted;
|
|
1216
|
+
permittedOrder?: PermittedOrder;
|
|
1217
|
+
permittedParent?: Permitted;
|
|
1218
|
+
requiredAncestors?: RequiredAncestors;
|
|
1219
|
+
requiredContent?: RequiredContent;
|
|
1220
|
+
textContent?: TextContent | `${TextContent}`;
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1223
|
+
/**
|
|
1224
|
+
* Helpers when writing element metadata.
|
|
1225
|
+
*
|
|
1226
|
+
* @public
|
|
1227
|
+
*/
|
|
1228
|
+
export declare interface MetadataHelper {
|
|
1229
|
+
/** Returns an error if another attribute is omitted, i.e. it requires another attribute to be present to pass. */
|
|
1230
|
+
allowedIfAttributeIsPresent(this: void, ...attr: string[]): MetaAttributeAllowedCallback;
|
|
1231
|
+
/** Returns an error if another attribute is present, i.e. it requires another attribute to be omitted to pass. */
|
|
1232
|
+
allowedIfAttributeIsAbsent(this: void, ...attr: string[]): MetaAttributeAllowedCallback;
|
|
1233
|
+
/** Returns an error if another attribute does not have one of the listed values */
|
|
1234
|
+
allowedIfAttributeHasValue(this: void, attr: string, value: string[], options?: {
|
|
1235
|
+
defaultValue?: string | null;
|
|
1236
|
+
}): MetaAttributeAllowedCallback;
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1239
|
+
/**
|
|
1240
|
+
* @public
|
|
1241
|
+
*/
|
|
1242
|
+
export declare const metadataHelper: MetadataHelper;
|
|
1243
|
+
|
|
1244
|
+
/**
|
|
1245
|
+
* @public
|
|
1246
|
+
*/
|
|
1247
|
+
export declare interface MetaDataTable {
|
|
1248
|
+
[tagName: string]: MetaData;
|
|
1249
|
+
}
|
|
1250
|
+
|
|
1251
|
+
/**
|
|
1252
|
+
* @public
|
|
1253
|
+
*/
|
|
1254
|
+
export declare interface MetaElement extends Omit<MetaData, "deprecatedAttributes" | "requiredAttributes"> {
|
|
1255
|
+
tagName: string;
|
|
1256
|
+
formAssociated?: FormAssociated;
|
|
1257
|
+
attributes: Record<string, MetaAttribute>;
|
|
1258
|
+
textContent?: TextContent;
|
|
1259
|
+
}
|
|
1260
|
+
|
|
1261
|
+
/**
|
|
1262
|
+
* Properties listed here can be used to reverse search elements with the given
|
|
1263
|
+
* property enabled. See [[MetaTable.getTagsWithProperty]].
|
|
1264
|
+
*
|
|
1265
|
+
* @public
|
|
1266
|
+
*/
|
|
1267
|
+
export declare type MetaLookupableProperty = "metadata" | "flow" | "sectioning" | "heading" | "phrasing" | "embedded" | "interactive" | "deprecated" | "foreign" | "void" | "transparent" | "scriptSupporting" | "form" | "formAssociated" | "labelable";
|
|
1268
|
+
|
|
1269
|
+
/**
|
|
1270
|
+
* @public
|
|
1271
|
+
*/
|
|
1272
|
+
export declare class MetaTable {
|
|
1273
|
+
readonly elements: ElementTable;
|
|
1274
|
+
private schema;
|
|
1275
|
+
/* Excluded from this release type: __constructor */
|
|
1276
|
+
/* Excluded from this release type: init */
|
|
1277
|
+
/* Excluded from this release type: extendValidationSchema */
|
|
1278
|
+
/* Excluded from this release type: loadFromObject */
|
|
1279
|
+
/* Excluded from this release type: loadFromFile */
|
|
1280
|
+
/**
|
|
1281
|
+
* Get [[MetaElement]] for the given tag. If no specific metadata is present
|
|
1282
|
+
* the global metadata is returned or null if no global is present.
|
|
1283
|
+
*
|
|
1284
|
+
* @public
|
|
1285
|
+
* @returns A shallow copy of metadata.
|
|
1286
|
+
*/
|
|
1287
|
+
getMetaFor(tagName: string): MetaElement | null;
|
|
1288
|
+
/**
|
|
1289
|
+
* Find all tags which has enabled given property.
|
|
1290
|
+
*
|
|
1291
|
+
* @public
|
|
1292
|
+
*/
|
|
1293
|
+
getTagsWithProperty(propName: MetaLookupableProperty): string[];
|
|
1294
|
+
/**
|
|
1295
|
+
* Find tag matching tagName or inheriting from it.
|
|
1296
|
+
*
|
|
1297
|
+
* @public
|
|
1298
|
+
*/
|
|
1299
|
+
getTagsDerivedFrom(tagName: string): string[];
|
|
1300
|
+
private addEntry;
|
|
1301
|
+
/**
|
|
1302
|
+
* Construct a new AJV schema validator.
|
|
1303
|
+
*/
|
|
1304
|
+
private getSchemaValidator;
|
|
1305
|
+
/**
|
|
1306
|
+
* @public
|
|
1307
|
+
*/
|
|
1308
|
+
getJSONSchema(): SchemaObject;
|
|
1309
|
+
/**
|
|
1310
|
+
* Finds the global element definition and merges each known element with the
|
|
1311
|
+
* global, e.g. to assign global attributes.
|
|
1312
|
+
*/
|
|
1313
|
+
private resolveGlobal;
|
|
1314
|
+
private mergeElement;
|
|
1315
|
+
/* Excluded from this release type: resolve */
|
|
1316
|
+
}
|
|
1317
|
+
|
|
1318
|
+
/**
|
|
1319
|
+
* @public
|
|
1320
|
+
*/
|
|
1321
|
+
export declare class NestedError extends Error {
|
|
1322
|
+
constructor(message: string, nested?: Error);
|
|
1323
|
+
}
|
|
1324
|
+
|
|
1325
|
+
/**
|
|
1326
|
+
* @public
|
|
1327
|
+
*/
|
|
1328
|
+
export declare enum NodeClosed {
|
|
1329
|
+
Open = 0,
|
|
1330
|
+
EndTag = 1,
|
|
1331
|
+
VoidOmitted = 2,
|
|
1332
|
+
VoidSelfClosed = 3,
|
|
1333
|
+
ImplicitClosed = 4
|
|
1334
|
+
}
|
|
1335
|
+
|
|
1336
|
+
/**
|
|
1337
|
+
* @public
|
|
1338
|
+
*/
|
|
1339
|
+
export declare enum NodeType {
|
|
1340
|
+
ELEMENT_NODE = 1,
|
|
1341
|
+
TEXT_NODE = 3,
|
|
1342
|
+
DOCUMENT_NODE = 9
|
|
1343
|
+
}
|
|
1344
|
+
|
|
1345
|
+
/* Excluded from this release type: ParseBeginEvent */
|
|
1346
|
+
|
|
1347
|
+
/* Excluded from this release type: ParseEndEvent */
|
|
1348
|
+
|
|
1349
|
+
/* Excluded from this release type: Parser */
|
|
1350
|
+
|
|
1351
|
+
/**
|
|
1352
|
+
* @public
|
|
1353
|
+
*/
|
|
1354
|
+
export declare type Permitted = PermittedEntry[];
|
|
1355
|
+
|
|
1356
|
+
/**
|
|
1357
|
+
* @public
|
|
1358
|
+
*/
|
|
1359
|
+
export declare type PermittedAttribute = Record<string, MetaAttribute | Array<string | RegExp> | null>;
|
|
1360
|
+
|
|
1361
|
+
/**
|
|
1362
|
+
* @public
|
|
1363
|
+
*/
|
|
1364
|
+
export declare type PermittedEntry = CategoryOrTag | PermittedGroup | Array<CategoryOrTag | PermittedGroup>;
|
|
1365
|
+
|
|
1366
|
+
/**
|
|
1367
|
+
* @public
|
|
1368
|
+
*/
|
|
1369
|
+
export declare interface PermittedGroup {
|
|
1370
|
+
exclude?: string | string[];
|
|
1371
|
+
}
|
|
1372
|
+
|
|
1373
|
+
/**
|
|
1374
|
+
* @public
|
|
1375
|
+
*/
|
|
1376
|
+
export declare type PermittedOrder = string[];
|
|
1377
|
+
|
|
1378
|
+
/**
|
|
1379
|
+
* @public
|
|
1380
|
+
*/
|
|
1381
|
+
declare interface Plugin_2 {
|
|
1382
|
+
/**
|
|
1383
|
+
* Name of the plugin.
|
|
1384
|
+
*
|
|
1385
|
+
* If specified this is the name used when referring to the plugin. Default is
|
|
1386
|
+
* to use the name/path the user used when loading the plugin. To be less
|
|
1387
|
+
* confusing for users you should use the same name as your package.
|
|
1388
|
+
*
|
|
1389
|
+
* The name must be a valid package name according to NPM (basically lowercase
|
|
1390
|
+
* characters, must not begin with dot, slash or non-url safe characters).
|
|
1391
|
+
*
|
|
1392
|
+
* Hint: import and use the name from `package.json`.
|
|
1393
|
+
*/
|
|
1394
|
+
name?: string | null;
|
|
1395
|
+
/**
|
|
1396
|
+
* Initialization callback.
|
|
1397
|
+
*
|
|
1398
|
+
* Called once per plugin during initialization.
|
|
1399
|
+
*/
|
|
1400
|
+
init?: () => void | null;
|
|
1401
|
+
/**
|
|
1402
|
+
* Setup callback.
|
|
1403
|
+
*
|
|
1404
|
+
* Called once per source after engine is initialized.
|
|
1405
|
+
*
|
|
1406
|
+
* @param source - The source about to be validated. Readonly.
|
|
1407
|
+
* @param eventhandler - Eventhandler from parser. Can be used to listen for
|
|
1408
|
+
* parser events.
|
|
1409
|
+
*/
|
|
1410
|
+
setup?: (source: Source, eventhandler: EventHandler) => void | null;
|
|
1411
|
+
/**
|
|
1412
|
+
* Configuration presets.
|
|
1413
|
+
*
|
|
1414
|
+
* Each key should be the unprefixed name which a configuration later can
|
|
1415
|
+
* access using `${plugin}:${key}`, e.g. if a plugin named "my-plugin" exposes
|
|
1416
|
+
* a preset named "foobar" it can be accessed using:
|
|
1417
|
+
*
|
|
1418
|
+
* "extends": ["my-plugin:foobar"]
|
|
1419
|
+
*/
|
|
1420
|
+
configs?: Record<string, ConfigData | null> | null;
|
|
1421
|
+
/**
|
|
1422
|
+
* List of new rules present.
|
|
1423
|
+
*/
|
|
1424
|
+
rules?: Record<string, RuleConstructor<any, any> | null> | null;
|
|
1425
|
+
/**
|
|
1426
|
+
* Transformer available in this plugin.
|
|
1427
|
+
*
|
|
1428
|
+
* Can be given either as a single unnamed transformer or an object with
|
|
1429
|
+
* multiple named.
|
|
1430
|
+
*
|
|
1431
|
+
* Unnamed transformers use the plugin name similar to how a standalone
|
|
1432
|
+
* transformer would work:
|
|
1433
|
+
*
|
|
1434
|
+
* ```
|
|
1435
|
+
* "transform": {
|
|
1436
|
+
* "^.*\\.foo$": "my-plugin"
|
|
1437
|
+
* }
|
|
1438
|
+
* ```
|
|
1439
|
+
*
|
|
1440
|
+
* For named transformers each key should be the unprefixed name which a
|
|
1441
|
+
* configuration later can access using `${plugin}:${key}`, e.g. if a plugin
|
|
1442
|
+
* named "my-plugin" exposes a transformer named "foobar" it can be accessed
|
|
1443
|
+
* using:
|
|
1444
|
+
*
|
|
1445
|
+
* ```
|
|
1446
|
+
* "transform": {
|
|
1447
|
+
* "^.*\\.foo$": "my-plugin:foobar"
|
|
1448
|
+
* }
|
|
1449
|
+
* ```
|
|
1450
|
+
*/
|
|
1451
|
+
transformer?: Transformer_2 | Record<string, Transformer_2 | null> | null;
|
|
1452
|
+
/**
|
|
1453
|
+
* Extend metadata validation schema.
|
|
1454
|
+
*/
|
|
1455
|
+
elementSchema?: SchemaValidationPatch | null;
|
|
1456
|
+
}
|
|
1457
|
+
export { Plugin_2 as Plugin }
|
|
1458
|
+
|
|
1459
|
+
/**
|
|
1460
|
+
* @public
|
|
1461
|
+
*/
|
|
1462
|
+
export declare type ProcessAttributeCallback = (this: unknown, attr: AttributeData) => Iterable<AttributeData>;
|
|
1463
|
+
|
|
1464
|
+
/**
|
|
1465
|
+
* @public
|
|
1466
|
+
*/
|
|
1467
|
+
export declare type ProcessElementCallback = (this: ProcessElementContext, node: HtmlElement) => void;
|
|
1468
|
+
|
|
1469
|
+
/**
|
|
1470
|
+
* @public
|
|
1471
|
+
*/
|
|
1472
|
+
export declare interface ProcessElementContext {
|
|
1473
|
+
getMetaFor(this: void, tagName: string): MetaElement | null;
|
|
1474
|
+
}
|
|
1475
|
+
|
|
1476
|
+
/**
|
|
1477
|
+
* @public
|
|
1478
|
+
*/
|
|
1479
|
+
export declare type PropertyExpression = string | [string, any];
|
|
1480
|
+
|
|
1481
|
+
/**
|
|
1482
|
+
* Report object returned by [[HtmlValidate]].
|
|
1483
|
+
*
|
|
1484
|
+
* @public
|
|
1485
|
+
*/
|
|
1486
|
+
export declare interface Report {
|
|
1487
|
+
/** `true` if validation was successful */
|
|
1488
|
+
valid: boolean;
|
|
1489
|
+
/** Detailed results per validated source */
|
|
1490
|
+
results: Result[];
|
|
1491
|
+
/** Total number of errors across all sources */
|
|
1492
|
+
errorCount: number;
|
|
1493
|
+
/** Total warnings of errors across all sources */
|
|
1494
|
+
warningCount: number;
|
|
1495
|
+
}
|
|
1496
|
+
|
|
1497
|
+
/**
|
|
1498
|
+
* @public
|
|
1499
|
+
*/
|
|
1500
|
+
export declare class Reporter {
|
|
1501
|
+
protected result: Record<string, DeferredMessage[]>;
|
|
1502
|
+
constructor();
|
|
1503
|
+
/**
|
|
1504
|
+
* Merge two or more reports into a single one.
|
|
1505
|
+
*/
|
|
1506
|
+
static merge(reports: Report[]): Report;
|
|
1507
|
+
add<ContextType, OptionsType>(rule: Rule<ContextType, OptionsType>, message: string, severity: number, node: DOMNode | null, location: Location_2, context?: ContextType): void;
|
|
1508
|
+
addManual(filename: string, message: DeferredMessage): void;
|
|
1509
|
+
save(sources?: Source[]): Report;
|
|
1510
|
+
protected isValid(): boolean;
|
|
1511
|
+
}
|
|
1512
|
+
|
|
1513
|
+
/**
|
|
1514
|
+
* @public
|
|
1515
|
+
*/
|
|
1516
|
+
export declare type RequiredAncestors = string[];
|
|
1517
|
+
|
|
1518
|
+
/**
|
|
1519
|
+
* @public
|
|
1520
|
+
*/
|
|
1521
|
+
export declare type RequiredContent = string[];
|
|
1522
|
+
|
|
1523
|
+
/**
|
|
1524
|
+
* A resolved configuration is a normalized configuration with all extends,
|
|
1525
|
+
* plugins etc resolved.
|
|
1526
|
+
*
|
|
1527
|
+
* @public
|
|
1528
|
+
*/
|
|
1529
|
+
export declare class ResolvedConfig {
|
|
1530
|
+
private metaTable;
|
|
1531
|
+
private plugins;
|
|
1532
|
+
private rules;
|
|
1533
|
+
private transformers;
|
|
1534
|
+
constructor({ metaTable, plugins, rules, transformers }: ResolvedConfigData);
|
|
1535
|
+
getMetaTable(): MetaTable;
|
|
1536
|
+
getPlugins(): Plugin_2[];
|
|
1537
|
+
getRules(): Map<string, [Severity, RuleOptions]>;
|
|
1538
|
+
/**
|
|
1539
|
+
* Transform a source.
|
|
1540
|
+
*
|
|
1541
|
+
* When transforming zero or more new sources will be generated.
|
|
1542
|
+
*
|
|
1543
|
+
* @param source - Current source to transform.
|
|
1544
|
+
* @param filename - If set it is the filename used to match
|
|
1545
|
+
* transformer. Default is to use filename from source.
|
|
1546
|
+
* @returns A list of transformed sources ready for validation.
|
|
1547
|
+
*/
|
|
1548
|
+
transformSource(source: Source, filename?: string): Source[];
|
|
1549
|
+
/**
|
|
1550
|
+
* Wrapper around [[transformSource]] which reads a file before passing it
|
|
1551
|
+
* as-is to transformSource.
|
|
1552
|
+
*
|
|
1553
|
+
* @param filename - Filename to transform (according to configured
|
|
1554
|
+
* transformations)
|
|
1555
|
+
* @returns A list of transformed sources ready for validation.
|
|
1556
|
+
*/
|
|
1557
|
+
transformFilename(filename: string): Source[];
|
|
1558
|
+
/**
|
|
1559
|
+
* Returns true if a transformer matches given filename.
|
|
1560
|
+
*/
|
|
1561
|
+
canTransform(filename: string): boolean;
|
|
1562
|
+
private findTransformer;
|
|
1563
|
+
}
|
|
1564
|
+
|
|
1565
|
+
/**
|
|
1566
|
+
* @public
|
|
1567
|
+
*/
|
|
1568
|
+
export declare interface ResolvedConfigData {
|
|
1569
|
+
metaTable: MetaTable;
|
|
1570
|
+
plugins: Plugin_2[];
|
|
1571
|
+
rules: Map<string, [Severity, RuleOptions]>;
|
|
1572
|
+
transformers: TransformerEntry[];
|
|
1573
|
+
}
|
|
1574
|
+
|
|
1575
|
+
/**
|
|
1576
|
+
* @public
|
|
1577
|
+
*/
|
|
1578
|
+
export declare interface Result {
|
|
1579
|
+
messages: Message[];
|
|
1580
|
+
filePath: string;
|
|
1581
|
+
errorCount: number;
|
|
1582
|
+
warningCount: number;
|
|
1583
|
+
source: string | null;
|
|
1584
|
+
}
|
|
1585
|
+
|
|
1586
|
+
/**
|
|
1587
|
+
* @public
|
|
1588
|
+
*/
|
|
1589
|
+
export declare abstract class Rule<ContextType = void, OptionsType = void> {
|
|
1590
|
+
private reporter;
|
|
1591
|
+
private parser;
|
|
1592
|
+
private meta;
|
|
1593
|
+
private enabled;
|
|
1594
|
+
private blockers;
|
|
1595
|
+
private severity;
|
|
1596
|
+
private event;
|
|
1597
|
+
/**
|
|
1598
|
+
* Rule name. Defaults to filename without extension but can be overwritten by
|
|
1599
|
+
* subclasses.
|
|
1600
|
+
*/
|
|
1601
|
+
name: string;
|
|
1602
|
+
/**
|
|
1603
|
+
* Rule options.
|
|
1604
|
+
*/
|
|
1605
|
+
readonly options: OptionsType;
|
|
1606
|
+
constructor(options: OptionsType);
|
|
1607
|
+
getSeverity(): number;
|
|
1608
|
+
setServerity(severity: number): void;
|
|
1609
|
+
/* Excluded from this release type: block */
|
|
1610
|
+
/* Excluded from this release type: unblock */
|
|
1611
|
+
setEnabled(enabled: boolean): void;
|
|
1612
|
+
/**
|
|
1613
|
+
* Returns `true` if rule is deprecated.
|
|
1614
|
+
*
|
|
1615
|
+
* Overridden by subclasses.
|
|
1616
|
+
*/
|
|
1617
|
+
get deprecated(): boolean;
|
|
1618
|
+
/* Excluded from this release type: isEnabled */
|
|
1619
|
+
/* Excluded from this release type: isBlocked */
|
|
1620
|
+
/* Excluded from this release type: getBlockers */
|
|
1621
|
+
/**
|
|
1622
|
+
* Check if keyword is being ignored by the current rule configuration.
|
|
1623
|
+
*
|
|
1624
|
+
* This method requires the [[RuleOption]] type to include two properties:
|
|
1625
|
+
*
|
|
1626
|
+
* - include: string[] | null
|
|
1627
|
+
* - exclude: string[] | null
|
|
1628
|
+
*
|
|
1629
|
+
* This methods checks if the given keyword is included by "include" but not
|
|
1630
|
+
* excluded by "exclude". If any property is unset it is skipped by the
|
|
1631
|
+
* condition. Usually the user would use either one but not both but there is
|
|
1632
|
+
* no limitation to use both but the keyword must satisfy both conditions. If
|
|
1633
|
+
* either condition fails `true` is returned.
|
|
1634
|
+
*
|
|
1635
|
+
* For instance, given `{ include: ["foo"] }` the keyword `"foo"` would match
|
|
1636
|
+
* but not `"bar"`.
|
|
1637
|
+
*
|
|
1638
|
+
* Similarly, given `{ exclude: ["foo"] }` the keyword `"bar"` would match but
|
|
1639
|
+
* not `"foo"`.
|
|
1640
|
+
*
|
|
1641
|
+
* @param keyword - Keyword to match against `include` and `exclude` options.
|
|
1642
|
+
* @param matcher - Optional function to compare items with.
|
|
1643
|
+
* @returns `true` if keyword is not present in `include` or is present in
|
|
1644
|
+
* `exclude`.
|
|
1645
|
+
*/
|
|
1646
|
+
isKeywordIgnored<T extends IncludeExcludeOptions>(this: {
|
|
1647
|
+
options: T;
|
|
1648
|
+
}, keyword: string, matcher?: (list: string[], it: string) => boolean): boolean;
|
|
1649
|
+
/**
|
|
1650
|
+
* Get [[MetaElement]] for the given tag. If no specific metadata is present
|
|
1651
|
+
* the global metadata is returned or null if no global is present.
|
|
1652
|
+
*
|
|
1653
|
+
* @public
|
|
1654
|
+
* @returns A shallow copy of metadata.
|
|
1655
|
+
*/
|
|
1656
|
+
getMetaFor(tagName: string): MetaElement | null;
|
|
1657
|
+
/**
|
|
1658
|
+
* Find all tags which has enabled given property.
|
|
1659
|
+
*/
|
|
1660
|
+
getTagsWithProperty(propName: MetaLookupableProperty): string[];
|
|
1661
|
+
/**
|
|
1662
|
+
* Find tag matching tagName or inheriting from it.
|
|
1663
|
+
*/
|
|
1664
|
+
getTagsDerivedFrom(tagName: string): string[];
|
|
1665
|
+
/**
|
|
1666
|
+
* JSON schema for rule options.
|
|
1667
|
+
*
|
|
1668
|
+
* Rules should override this to return an object with JSON schema to validate
|
|
1669
|
+
* rule options. If `null` or `undefined` is returned no validation is
|
|
1670
|
+
* performed.
|
|
1671
|
+
*/
|
|
1672
|
+
static schema(): SchemaObject | null | undefined;
|
|
1673
|
+
/**
|
|
1674
|
+
* Report a new error.
|
|
1675
|
+
*
|
|
1676
|
+
* Rule must be enabled both globally and on the specific node for this to
|
|
1677
|
+
* have any effect.
|
|
1678
|
+
*/
|
|
1679
|
+
report(error: ErrorDescriptor<ContextType>): void;
|
|
1680
|
+
report(node: DOMNode | null, message: string): void;
|
|
1681
|
+
report(node: DOMNode | null, message: string, location: Location_2 | null | undefined): void;
|
|
1682
|
+
report(node: DOMNode | null, message: string, location: Location_2 | null | undefined, context: ContextType): void;
|
|
1683
|
+
private findLocation;
|
|
1684
|
+
/**
|
|
1685
|
+
* Listen for events.
|
|
1686
|
+
*
|
|
1687
|
+
* Adding listeners can be done even if the rule is disabled but for the
|
|
1688
|
+
* events to be delivered the rule must be enabled.
|
|
1689
|
+
*
|
|
1690
|
+
* If the optional filter callback is used it must be a function taking an
|
|
1691
|
+
* event of the same type as the listener. The filter is called before the
|
|
1692
|
+
* listener and if the filter returns false the event is discarded.
|
|
1693
|
+
*
|
|
1694
|
+
* @param event - Event name
|
|
1695
|
+
* @param filter - Optional filter function. Callback is only called if filter functions return true.
|
|
1696
|
+
* @param callback - Callback to handle event.
|
|
1697
|
+
* @returns A function to unregister the listener
|
|
1698
|
+
*/
|
|
1699
|
+
on<K extends keyof ListenEventMap>(event: K, callback: (event: ListenEventMap[K]) => void): () => void;
|
|
1700
|
+
on<K extends keyof ListenEventMap>(event: K, filter: (event: ListenEventMap[K]) => boolean, callback: (event: ListenEventMap[K]) => void): () => void;
|
|
1701
|
+
/* Excluded from this release type: init */
|
|
1702
|
+
/* Excluded from this release type: validateOptions */
|
|
1703
|
+
/**
|
|
1704
|
+
* Rule setup callback.
|
|
1705
|
+
*
|
|
1706
|
+
* Override this to provide rule setup code.
|
|
1707
|
+
*/
|
|
1708
|
+
abstract setup(): void;
|
|
1709
|
+
/**
|
|
1710
|
+
* Rule documentation callback.
|
|
1711
|
+
*
|
|
1712
|
+
* Called when requesting additional documentation for a rule. Some rules
|
|
1713
|
+
* provide additional context to provide context-aware suggestions.
|
|
1714
|
+
*
|
|
1715
|
+
* @param context - Error context given by a reported error.
|
|
1716
|
+
* @returns Rule documentation and url with additional details or `null` if no
|
|
1717
|
+
* additional documentation is available.
|
|
1718
|
+
*/
|
|
1719
|
+
documentation(context?: ContextType): RuleDocumentation | null;
|
|
1720
|
+
}
|
|
1721
|
+
|
|
1722
|
+
/* Excluded from this release type: RuleBlocker */
|
|
1723
|
+
|
|
1724
|
+
/**
|
|
1725
|
+
* @public
|
|
1726
|
+
*/
|
|
1727
|
+
export declare type RuleConfig = Record<string, RuleSeverity | [RuleSeverity] | [RuleSeverity, RuleOptions]>;
|
|
1728
|
+
|
|
1729
|
+
/**
|
|
1730
|
+
* @public
|
|
1731
|
+
*/
|
|
1732
|
+
export declare interface RuleConstructor<T, U> {
|
|
1733
|
+
new (options?: any): Rule<T, U>;
|
|
1734
|
+
schema(): SchemaObject | null | undefined;
|
|
1735
|
+
}
|
|
1736
|
+
|
|
1737
|
+
/**
|
|
1738
|
+
* @public
|
|
1739
|
+
*/
|
|
1740
|
+
export declare interface RuleDocumentation {
|
|
1741
|
+
description: string;
|
|
1742
|
+
url?: string;
|
|
1743
|
+
}
|
|
1744
|
+
|
|
1745
|
+
/* Excluded from this release type: RuleErrorEvent */
|
|
1746
|
+
|
|
1747
|
+
/**
|
|
1748
|
+
* Returns true if given ruleId is an existing builtin rule. It does not handle
|
|
1749
|
+
* rules loaded via plugins.
|
|
1750
|
+
*
|
|
1751
|
+
* Can be used to create forward/backward compatibility by checking if a rule
|
|
1752
|
+
* exists to enable/disable it.
|
|
1753
|
+
*
|
|
1754
|
+
* @public
|
|
1755
|
+
* @param ruleId - Rule id to check
|
|
1756
|
+
* @returns `true` if rule exists
|
|
1757
|
+
*/
|
|
1758
|
+
export declare function ruleExists(ruleId: string): boolean;
|
|
1759
|
+
|
|
1760
|
+
/**
|
|
1761
|
+
* @public
|
|
1762
|
+
*/
|
|
1763
|
+
export declare type RuleOptions = string | number | Record<string, any>;
|
|
1764
|
+
|
|
1765
|
+
/**
|
|
1766
|
+
* @public
|
|
1767
|
+
*/
|
|
1768
|
+
export declare type RuleSeverity = "off" | "warn" | "error" | number;
|
|
1769
|
+
|
|
1770
|
+
export { SchemaObject }
|
|
1771
|
+
|
|
1772
|
+
/**
|
|
1773
|
+
* @public
|
|
1774
|
+
*/
|
|
1775
|
+
export declare class SchemaValidationError extends UserError {
|
|
1776
|
+
filename: string | null;
|
|
1777
|
+
private obj;
|
|
1778
|
+
private schema;
|
|
1779
|
+
private errors;
|
|
1780
|
+
constructor(filename: string | null, message: string, obj: unknown, schema: SchemaObject, errors: ErrorObject[]);
|
|
1781
|
+
prettyError(): string;
|
|
1782
|
+
private getRawJSON;
|
|
1783
|
+
}
|
|
1784
|
+
|
|
1785
|
+
/**
|
|
1786
|
+
* @public
|
|
1787
|
+
*/
|
|
1788
|
+
export declare interface SchemaValidationPatch {
|
|
1789
|
+
properties?: Record<string, unknown>;
|
|
1790
|
+
definitions?: Record<string, unknown>;
|
|
1791
|
+
}
|
|
1792
|
+
|
|
1793
|
+
/* Excluded from this release type: ScriptToken */
|
|
1794
|
+
|
|
1795
|
+
/**
|
|
1796
|
+
* @public
|
|
1797
|
+
*/
|
|
1798
|
+
export declare enum Severity {
|
|
1799
|
+
DISABLED = 0,
|
|
1800
|
+
WARN = 1,
|
|
1801
|
+
ERROR = 2
|
|
1802
|
+
}
|
|
1803
|
+
|
|
1804
|
+
/**
|
|
1805
|
+
* Calculate a new location by offsetting this location.
|
|
1806
|
+
*
|
|
1807
|
+
* If the references text with newlines the wrap parameter must be set to
|
|
1808
|
+
* properly calculate line and column information. If not given the text is
|
|
1809
|
+
* assumed to contain no newlines.
|
|
1810
|
+
*
|
|
1811
|
+
* @public
|
|
1812
|
+
* @param location - Source location
|
|
1813
|
+
* @param begin - Start location. Default is 0.
|
|
1814
|
+
* @param end - End location. Default is size of location. Negative values are
|
|
1815
|
+
* counted from end, e.g. `-2` means `size - 2`.
|
|
1816
|
+
* @param wrap - If given, line/column is wrapped for each newline occuring
|
|
1817
|
+
* before location end.
|
|
1818
|
+
*/
|
|
1819
|
+
export declare function sliceLocation(location: Location_2, begin: number, end?: number, wrap?: string): Location_2;
|
|
1820
|
+
|
|
1821
|
+
/**
|
|
1822
|
+
* @public
|
|
1823
|
+
*/
|
|
1824
|
+
export declare function sliceLocation(location: Location_2 | null | undefined, begin: number, end?: number, wrap?: string): Location_2 | null;
|
|
1825
|
+
|
|
1826
|
+
/**
|
|
1827
|
+
* Source interface.
|
|
1828
|
+
*
|
|
1829
|
+
* HTML source with file, line and column context.
|
|
1830
|
+
*
|
|
1831
|
+
* Optional hooks can be attached. This is usually added by transformers to
|
|
1832
|
+
* postprocess.
|
|
1833
|
+
*
|
|
1834
|
+
* @public
|
|
1835
|
+
*/
|
|
1836
|
+
export declare interface Source {
|
|
1837
|
+
data: string;
|
|
1838
|
+
filename: string;
|
|
1839
|
+
/**
|
|
1840
|
+
* Line in the original data.
|
|
1841
|
+
*
|
|
1842
|
+
* Starts at 1 (first line).
|
|
1843
|
+
*/
|
|
1844
|
+
line: number;
|
|
1845
|
+
/**
|
|
1846
|
+
* Column in the original data.
|
|
1847
|
+
*
|
|
1848
|
+
* Starts at 1 (first column).
|
|
1849
|
+
*/
|
|
1850
|
+
column: number;
|
|
1851
|
+
/**
|
|
1852
|
+
* Offset in the original data.
|
|
1853
|
+
*
|
|
1854
|
+
* Starts at 0 (first character).
|
|
1855
|
+
*/
|
|
1856
|
+
offset: number;
|
|
1857
|
+
/**
|
|
1858
|
+
* Original data. When a transformer extracts a portion of the original source
|
|
1859
|
+
* this must be set to the full original source.
|
|
1860
|
+
*
|
|
1861
|
+
* Since the transformer might be chained always test if the input source
|
|
1862
|
+
* itself has `originalData` set, e.g.:
|
|
1863
|
+
*
|
|
1864
|
+
* `originalData = input.originalData || input.data`.
|
|
1865
|
+
*/
|
|
1866
|
+
originalData?: string;
|
|
1867
|
+
/**
|
|
1868
|
+
* Hooks for processing the source as it is being parsed.
|
|
1869
|
+
*/
|
|
1870
|
+
hooks?: SourceHooks;
|
|
1871
|
+
/**
|
|
1872
|
+
* Internal property to keep track of what transformers has run on this
|
|
1873
|
+
* source. Entries are in reverse-order, e.g. the last applied transform is
|
|
1874
|
+
* first.
|
|
1875
|
+
*/
|
|
1876
|
+
transformedBy?: string[];
|
|
1877
|
+
}
|
|
1878
|
+
|
|
1879
|
+
/**
|
|
1880
|
+
* @public
|
|
1881
|
+
*/
|
|
1882
|
+
export declare interface SourceHooks {
|
|
1883
|
+
/**
|
|
1884
|
+
* Called for every attribute.
|
|
1885
|
+
*
|
|
1886
|
+
* The original attribute must be yielded as well or no attribute will be
|
|
1887
|
+
* added.
|
|
1888
|
+
*
|
|
1889
|
+
* @returns Attribute data for an attribute to be added to the element.
|
|
1890
|
+
*/
|
|
1891
|
+
processAttribute?: ProcessAttributeCallback | null;
|
|
1892
|
+
/**
|
|
1893
|
+
* Called for every element after element is created but before any children.
|
|
1894
|
+
*
|
|
1895
|
+
* May modify the element.
|
|
1896
|
+
*/
|
|
1897
|
+
processElement?: ProcessElementCallback | null;
|
|
1898
|
+
}
|
|
1899
|
+
|
|
1900
|
+
/**
|
|
1901
|
+
* Source ready event. Emitted after source has been transformed but before any
|
|
1902
|
+
* markup is processed.
|
|
1903
|
+
*
|
|
1904
|
+
* The source object must not be modified (use a transformer if modifications
|
|
1905
|
+
* are required)
|
|
1906
|
+
*
|
|
1907
|
+
* @public
|
|
1908
|
+
*/
|
|
1909
|
+
export declare interface SourceReadyEvent extends Event_2 {
|
|
1910
|
+
source: Source;
|
|
1911
|
+
}
|
|
1912
|
+
|
|
1913
|
+
/**
|
|
1914
|
+
* The static configuration loader does not do any per-handle lookup. Only the
|
|
1915
|
+
* global or per-call configuration is used.
|
|
1916
|
+
*
|
|
1917
|
+
* In practice this means no configuration is fetch by traversing the
|
|
1918
|
+
* filesystem.
|
|
1919
|
+
*
|
|
1920
|
+
* @public
|
|
1921
|
+
*/
|
|
1922
|
+
export declare class StaticConfigLoader extends ConfigLoader {
|
|
1923
|
+
getConfigFor(handle: string, configOverride?: ConfigData): Config;
|
|
1924
|
+
flushCache(): void;
|
|
1925
|
+
protected defaultConfig(): Config;
|
|
1926
|
+
}
|
|
1927
|
+
|
|
1928
|
+
/* Excluded from this release type: StyleToken */
|
|
1929
|
+
|
|
1930
|
+
/**
|
|
1931
|
+
* Deprecated alias for TagEndEvent
|
|
1932
|
+
*
|
|
1933
|
+
* @public
|
|
1934
|
+
* @deprecated Use TagEndEvent instead
|
|
1935
|
+
*/
|
|
1936
|
+
export declare type TagCloseEvent = TagEndEvent;
|
|
1937
|
+
|
|
1938
|
+
/* Excluded from this release type: TagCloseToken */
|
|
1939
|
+
|
|
1940
|
+
/**
|
|
1941
|
+
* Event emitted when end tags `</..>` are encountered.
|
|
1942
|
+
*
|
|
1943
|
+
* @public
|
|
1944
|
+
*/
|
|
1945
|
+
export declare interface TagEndEvent extends Event_2 {
|
|
1946
|
+
/** Event location. */
|
|
1947
|
+
location: Location_2;
|
|
1948
|
+
/** Temporary node for the end tag. Can be null for elements left unclosed
|
|
1949
|
+
* when document ends */
|
|
1950
|
+
target: HtmlElement | null;
|
|
1951
|
+
/** The node being closed. */
|
|
1952
|
+
previous: HtmlElement;
|
|
1953
|
+
}
|
|
1954
|
+
|
|
1955
|
+
/**
|
|
1956
|
+
* Deprecated alias for TagStartEvent
|
|
1957
|
+
*
|
|
1958
|
+
* @public
|
|
1959
|
+
* @deprecated Use TagStartEvent instead
|
|
1960
|
+
*/
|
|
1961
|
+
export declare type TagOpenEvent = TagStartEvent;
|
|
1962
|
+
|
|
1963
|
+
/* Excluded from this release type: TagOpenToken */
|
|
1964
|
+
|
|
1965
|
+
/**
|
|
1966
|
+
* Event emitted when a tag is ready (i.e. all the attributes has been
|
|
1967
|
+
* parsed). The children of the element will not yet be finished.
|
|
1968
|
+
*
|
|
1969
|
+
* @public
|
|
1970
|
+
*/
|
|
1971
|
+
export declare interface TagReadyEvent extends Event_2 {
|
|
1972
|
+
/** Event location. */
|
|
1973
|
+
location: Location_2;
|
|
1974
|
+
/** The node that is finished parsing. */
|
|
1975
|
+
target: HtmlElement;
|
|
1976
|
+
}
|
|
1977
|
+
|
|
1978
|
+
/**
|
|
1979
|
+
* Event emitted when starting tags are encountered.
|
|
1980
|
+
*
|
|
1981
|
+
* @public
|
|
1982
|
+
*/
|
|
1983
|
+
export declare interface TagStartEvent extends Event_2 {
|
|
1984
|
+
/** Event location. */
|
|
1985
|
+
location: Location_2;
|
|
1986
|
+
/** The node being started. */
|
|
1987
|
+
target: HtmlElement;
|
|
1988
|
+
}
|
|
1989
|
+
|
|
1990
|
+
/**
|
|
1991
|
+
* @public
|
|
1992
|
+
*/
|
|
1993
|
+
export declare class TemplateExtractor {
|
|
1994
|
+
private ast;
|
|
1995
|
+
private filename;
|
|
1996
|
+
private data;
|
|
1997
|
+
private constructor();
|
|
1998
|
+
static fromFilename(filename: string): TemplateExtractor;
|
|
1999
|
+
/**
|
|
2000
|
+
* Create a new [[TemplateExtractor]] from javascript source code.
|
|
2001
|
+
*
|
|
2002
|
+
* `Source` offsets will be relative to the string, i.e. offset 0 is the first
|
|
2003
|
+
* character of the string. If the string is only a subset of a larger string
|
|
2004
|
+
* the offsets must be adjusted manually.
|
|
2005
|
+
*
|
|
2006
|
+
* @param source - Source code.
|
|
2007
|
+
* @param filename - Optional filename to set in the resulting
|
|
2008
|
+
* `Source`. Defauls to `"inline"`.
|
|
2009
|
+
*/
|
|
2010
|
+
static fromString(source: string, filename?: string): TemplateExtractor;
|
|
2011
|
+
/**
|
|
2012
|
+
* Convenience function to create a [[Source]] instance from an existing file.
|
|
2013
|
+
*
|
|
2014
|
+
* @param filename - Filename with javascript source code. The file must exist
|
|
2015
|
+
* and be readable by the user.
|
|
2016
|
+
* @returns An array of Source's suitable for passing to [[Engine]] linting
|
|
2017
|
+
* functions.
|
|
2018
|
+
*/
|
|
2019
|
+
static createSource(filename: string): Source[];
|
|
2020
|
+
/**
|
|
2021
|
+
* Extract object properties.
|
|
2022
|
+
*
|
|
2023
|
+
* Given a key `"template"` this method finds all objects literals with a
|
|
2024
|
+
* `"template"` property and creates a [[Source]] instance with proper offsets
|
|
2025
|
+
* with the value of the property. For instance:
|
|
2026
|
+
*
|
|
2027
|
+
* ```
|
|
2028
|
+
* const myObj = {
|
|
2029
|
+
* foo: 'bar',
|
|
2030
|
+
* };
|
|
2031
|
+
* ```
|
|
2032
|
+
*
|
|
2033
|
+
* The above snippet would yield a `Source` with the content `bar`.
|
|
2034
|
+
*
|
|
2035
|
+
*/
|
|
2036
|
+
extractObjectProperty(key: string): Source[];
|
|
2037
|
+
}
|
|
2038
|
+
|
|
2039
|
+
/* Excluded from this release type: TemplatingToken */
|
|
2040
|
+
|
|
2041
|
+
/**
|
|
2042
|
+
* @public
|
|
2043
|
+
*/
|
|
2044
|
+
export declare enum TextClassification {
|
|
2045
|
+
EMPTY_TEXT = 0,
|
|
2046
|
+
DYNAMIC_TEXT = 1,
|
|
2047
|
+
STATIC_TEXT = 2
|
|
2048
|
+
}
|
|
2049
|
+
|
|
2050
|
+
/**
|
|
2051
|
+
* @public
|
|
2052
|
+
*/
|
|
2053
|
+
export declare interface TextClassificationOptions {
|
|
2054
|
+
/** If `true` only accessible text is considered (default false) */
|
|
2055
|
+
accessible?: boolean;
|
|
2056
|
+
/** If `true` the `hidden` and `aria-hidden` attribute is ignored on the root
|
|
2057
|
+
* (and parents) elements (default false) */
|
|
2058
|
+
ignoreHiddenRoot?: boolean;
|
|
2059
|
+
}
|
|
2060
|
+
|
|
2061
|
+
/**
|
|
2062
|
+
* @public
|
|
2063
|
+
*/
|
|
2064
|
+
export declare enum TextContent {
|
|
2065
|
+
NONE = "none",
|
|
2066
|
+
DEFAULT = "default",
|
|
2067
|
+
REQUIRED = "required",
|
|
2068
|
+
ACCESSIBLE = "accessible"
|
|
2069
|
+
}
|
|
2070
|
+
|
|
2071
|
+
/**
|
|
2072
|
+
* Represents a text in the HTML document.
|
|
2073
|
+
*
|
|
2074
|
+
* Text nodes are appended as children of `HtmlElement` and cannot have childen
|
|
2075
|
+
* of its own.
|
|
2076
|
+
*
|
|
2077
|
+
* @public
|
|
2078
|
+
*/
|
|
2079
|
+
export declare class TextNode extends DOMNode {
|
|
2080
|
+
private readonly text;
|
|
2081
|
+
/**
|
|
2082
|
+
* @param text - Text to add. When a `DynamicValue` is used the expression is
|
|
2083
|
+
* used as "text".
|
|
2084
|
+
* @param location - Source code location of this node.
|
|
2085
|
+
*/
|
|
2086
|
+
constructor(text: string | DynamicValue, location: Location_2);
|
|
2087
|
+
/**
|
|
2088
|
+
* Get the text from node.
|
|
2089
|
+
*/
|
|
2090
|
+
get textContent(): string;
|
|
2091
|
+
/**
|
|
2092
|
+
* Flag set to true if the attribute value is static.
|
|
2093
|
+
*/
|
|
2094
|
+
get isStatic(): boolean;
|
|
2095
|
+
/**
|
|
2096
|
+
* Flag set to true if the attribute value is dynamic.
|
|
2097
|
+
*/
|
|
2098
|
+
get isDynamic(): boolean;
|
|
2099
|
+
}
|
|
2100
|
+
|
|
2101
|
+
/* Excluded from this release type: TextToken */
|
|
2102
|
+
|
|
2103
|
+
/* Excluded from this release type: Token */
|
|
2104
|
+
|
|
2105
|
+
/**
|
|
2106
|
+
* @public
|
|
2107
|
+
*/
|
|
2108
|
+
export declare interface TokenDump {
|
|
2109
|
+
token: string;
|
|
2110
|
+
data: string;
|
|
2111
|
+
location: string;
|
|
2112
|
+
}
|
|
2113
|
+
|
|
2114
|
+
/* Excluded from this release type: TokenEvent */
|
|
2115
|
+
|
|
2116
|
+
/* Excluded from this release type: TokenStream */
|
|
2117
|
+
|
|
2118
|
+
/* Excluded from this release type: TokenType */
|
|
2119
|
+
|
|
2120
|
+
/**
|
|
2121
|
+
* @public
|
|
2122
|
+
*/
|
|
2123
|
+
export declare interface TransformContext {
|
|
2124
|
+
/**
|
|
2125
|
+
* Test if an additional chainable transformer is present.
|
|
2126
|
+
*
|
|
2127
|
+
* Returns true only if there is a transformer configured for the given
|
|
2128
|
+
* filename.
|
|
2129
|
+
*
|
|
2130
|
+
* @param filename - Filename to use to match next transformer.
|
|
2131
|
+
*/
|
|
2132
|
+
hasChain(filename: string): boolean;
|
|
2133
|
+
/**
|
|
2134
|
+
* Chain transformations.
|
|
2135
|
+
*
|
|
2136
|
+
* Sometimes multiple transformers must be applied. For instance, a Markdown
|
|
2137
|
+
* file with JSX in a code-block.
|
|
2138
|
+
*
|
|
2139
|
+
* @param source - Source to chain transformations on.
|
|
2140
|
+
* @param filename - Filename to use to match next transformer (unrelated to
|
|
2141
|
+
* filename set in source)
|
|
2142
|
+
*/
|
|
2143
|
+
chain(source: Source, filename: string): Iterable<Source>;
|
|
2144
|
+
}
|
|
2145
|
+
|
|
2146
|
+
/**
|
|
2147
|
+
* @public
|
|
2148
|
+
*/
|
|
2149
|
+
declare type Transformer_2 = (this: TransformContext, source: Source) => Iterable<Source>;
|
|
2150
|
+
export { Transformer_2 as Transformer }
|
|
2151
|
+
|
|
2152
|
+
/**
|
|
2153
|
+
* @public
|
|
2154
|
+
*/
|
|
2155
|
+
export declare interface TransformerEntry {
|
|
2156
|
+
pattern: RegExp;
|
|
2157
|
+
name: string;
|
|
2158
|
+
fn: Transformer_2;
|
|
2159
|
+
}
|
|
2160
|
+
|
|
2161
|
+
/**
|
|
2162
|
+
* @public
|
|
2163
|
+
*/
|
|
2164
|
+
export declare interface TransformMap {
|
|
2165
|
+
[key: string]: string;
|
|
2166
|
+
}
|
|
2167
|
+
|
|
2168
|
+
/**
|
|
2169
|
+
* @public
|
|
2170
|
+
*/
|
|
2171
|
+
export declare interface TriggerEventMap {
|
|
2172
|
+
"config:ready": ConfigReadyEvent;
|
|
2173
|
+
"source:ready": SourceReadyEvent;
|
|
2174
|
+
/* Excluded from this release type: token */
|
|
2175
|
+
"tag:start": TagStartEvent;
|
|
2176
|
+
"tag:end": TagEndEvent;
|
|
2177
|
+
"tag:ready": TagReadyEvent;
|
|
2178
|
+
"element:ready": ElementReadyEvent;
|
|
2179
|
+
"dom:load": DOMLoadEvent;
|
|
2180
|
+
"dom:ready": DOMReadyEvent;
|
|
2181
|
+
doctype: DoctypeEvent;
|
|
2182
|
+
attr: AttributeEvent;
|
|
2183
|
+
whitespace: WhitespaceEvent;
|
|
2184
|
+
conditional: ConditionalEvent;
|
|
2185
|
+
directive: DirectiveEvent;
|
|
2186
|
+
/* Excluded from this release type: "rule:error" */
|
|
2187
|
+
/* Excluded from this release type: "parse:begin" */
|
|
2188
|
+
/* Excluded from this release type: "parse:end" */
|
|
2189
|
+
}
|
|
2190
|
+
|
|
2191
|
+
/* Excluded from this release type: UnicodeBOMToken */
|
|
2192
|
+
|
|
2193
|
+
/**
|
|
2194
|
+
* @public
|
|
2195
|
+
*/
|
|
2196
|
+
export declare class UserError extends NestedError {
|
|
2197
|
+
constructor(message: string, nested?: Error);
|
|
2198
|
+
/**
|
|
2199
|
+
* @public
|
|
2200
|
+
*/
|
|
2201
|
+
prettyFormat(): string | undefined;
|
|
2202
|
+
}
|
|
2203
|
+
|
|
2204
|
+
/**
|
|
2205
|
+
* Helper class to validate elements against metadata rules.
|
|
2206
|
+
*
|
|
2207
|
+
* @public
|
|
2208
|
+
*/
|
|
2209
|
+
export declare class Validator {
|
|
2210
|
+
/**
|
|
2211
|
+
* Test if element is used in a proper context.
|
|
2212
|
+
*
|
|
2213
|
+
* @param node - Element to test.
|
|
2214
|
+
* @param rules - List of rules.
|
|
2215
|
+
* @returns `true` if element passes all tests.
|
|
2216
|
+
*/
|
|
2217
|
+
static validatePermitted(node: HtmlElement, rules: Permitted | null): boolean;
|
|
2218
|
+
/**
|
|
2219
|
+
* Test if an element is used the correct amount of times.
|
|
2220
|
+
*
|
|
2221
|
+
* For instance, a `<table>` element can only contain a single `<tbody>`
|
|
2222
|
+
* child. If multiple `<tbody>` exists this test will fail both nodes.
|
|
2223
|
+
* Note that this is called on the parent but will fail the children violating
|
|
2224
|
+
* the rule.
|
|
2225
|
+
*
|
|
2226
|
+
* @param children - Array of children to validate.
|
|
2227
|
+
* @param rules - List of rules of the parent element.
|
|
2228
|
+
* @returns `true` if the parent element of the children passes the test.
|
|
2229
|
+
*/
|
|
2230
|
+
static validateOccurrences(children: HtmlElement[], rules: Permitted | null, cb: (node: HtmlElement, category: string) => void): boolean;
|
|
2231
|
+
/**
|
|
2232
|
+
* Validate elements order.
|
|
2233
|
+
*
|
|
2234
|
+
* Given a parent element with children and metadata containing permitted
|
|
2235
|
+
* order it will validate each children and ensure each one exists in the
|
|
2236
|
+
* specified order.
|
|
2237
|
+
*
|
|
2238
|
+
* For instance, for a `<table>` element the `<caption>` element must come
|
|
2239
|
+
* before a `<thead>` which must come before `<tbody>`.
|
|
2240
|
+
*
|
|
2241
|
+
* @param children - Array of children to validate.
|
|
2242
|
+
*/
|
|
2243
|
+
static validateOrder(children: HtmlElement[], rules: PermittedOrder | null, cb: (node: HtmlElement, prev: HtmlElement) => void): boolean;
|
|
2244
|
+
/**
|
|
2245
|
+
* Validate element ancestors.
|
|
2246
|
+
*
|
|
2247
|
+
* Check if an element has the required set of elements. At least one of the
|
|
2248
|
+
* selectors must match.
|
|
2249
|
+
*/
|
|
2250
|
+
static validateAncestors(node: HtmlElement, rules: RequiredAncestors | null): boolean;
|
|
2251
|
+
/**
|
|
2252
|
+
* Validate element required content.
|
|
2253
|
+
*
|
|
2254
|
+
* Check if an element has the required set of elements. At least one of the
|
|
2255
|
+
* selectors must match.
|
|
2256
|
+
*
|
|
2257
|
+
* Returns `[]` when valid or a list of required but missing tagnames or
|
|
2258
|
+
* categories.
|
|
2259
|
+
*/
|
|
2260
|
+
static validateRequiredContent(node: HtmlElement, rules: RequiredContent | null): CategoryOrTag[];
|
|
2261
|
+
/**
|
|
2262
|
+
* Test if an attribute has an allowed value and/or format.
|
|
2263
|
+
*
|
|
2264
|
+
* @param attr - Attribute to test.
|
|
2265
|
+
* @param rules - Element attribute metadta.
|
|
2266
|
+
* @returns `true` if attribute passes all tests.
|
|
2267
|
+
*/
|
|
2268
|
+
static validateAttribute(attr: Attribute, rules: Record<string, MetaAttribute>): boolean;
|
|
2269
|
+
private static validateAttributeValue;
|
|
2270
|
+
private static validatePermittedRule;
|
|
2271
|
+
/**
|
|
2272
|
+
* Validate node against a content category.
|
|
2273
|
+
*
|
|
2274
|
+
* When matching parent nodes against permitted parents use the superset
|
|
2275
|
+
* parameter to also match for `@flow`. E.g. if a node expects a `@phrasing`
|
|
2276
|
+
* parent it should also allow `@flow` parent since `@phrasing` is a subset of
|
|
2277
|
+
* `@flow`.
|
|
2278
|
+
*
|
|
2279
|
+
* @param node - The node to test against
|
|
2280
|
+
* @param category - Name of category with `@` prefix or tag name.
|
|
2281
|
+
* @param defaultMatch - The default return value when node categories is not known.
|
|
2282
|
+
*/
|
|
2283
|
+
static validatePermittedCategory(node: HtmlElement, category: string, defaultMatch: boolean): boolean;
|
|
2284
|
+
}
|
|
2285
|
+
|
|
2286
|
+
/** @public */
|
|
2287
|
+
export declare const version: string;
|
|
2288
|
+
|
|
2289
|
+
/**
|
|
2290
|
+
* Event emitted when whitespace content is parsed.
|
|
2291
|
+
*
|
|
2292
|
+
* @public
|
|
2293
|
+
*/
|
|
2294
|
+
export declare interface WhitespaceEvent extends Event_2 {
|
|
2295
|
+
/** Event location. */
|
|
2296
|
+
location: Location_2;
|
|
2297
|
+
/** Text content. */
|
|
2298
|
+
text: string;
|
|
2299
|
+
}
|
|
2300
|
+
|
|
2301
|
+
/* Excluded from this release type: WhitespaceToken */
|
|
2302
|
+
|
|
2303
|
+
/**
|
|
2304
|
+
* Represents an `Error` created from arbitrary values.
|
|
2305
|
+
*
|
|
2306
|
+
* @public
|
|
2307
|
+
*/
|
|
2308
|
+
export declare class WrappedError<T> extends Error {
|
|
2309
|
+
constructor(message: T);
|
|
2310
|
+
}
|
|
2311
|
+
|
|
2312
|
+
export { }
|