html-validate 6.0.0 → 6.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -1
- package/README.md +10 -2
- package/dist/cjs/cli.js +3 -0
- package/dist/cjs/cli.js.map +1 -1
- package/dist/cjs/core.d.ts +215 -3
- package/dist/cjs/core.js +210 -35
- package/dist/cjs/core.js.map +1 -1
- package/dist/cjs/dist/types/browser.d.ts +3 -0
- package/dist/{es → cjs/dist/types}/index.d.ts +6 -5
- package/dist/cjs/dist/types/jest/jest.d.ts +4 -0
- package/dist/{es → cjs/dist/types/transform}/test-utils.d.ts +1 -1
- package/dist/cjs/html-validate.js +1 -1
- package/dist/cjs/html-validate.js.map +1 -1
- package/dist/cjs/jest-lib.d.ts +1 -1
- package/dist/cjs/jest-lib.js +2 -1
- package/dist/cjs/jest-lib.js.map +1 -1
- package/dist/es/cli.js +3 -0
- package/dist/es/cli.js.map +1 -1
- package/dist/es/core.d.ts +215 -3
- package/dist/es/core.js +210 -35
- package/dist/es/core.js.map +1 -1
- package/dist/es/dist/types/browser.d.ts +3 -0
- package/dist/{cjs → es/dist/types}/index.d.ts +6 -5
- package/dist/es/dist/types/jest/jest.d.ts +4 -0
- package/dist/{cjs → es/dist/types/transform}/test-utils.d.ts +1 -1
- package/dist/es/html-validate.js +1 -1
- package/dist/es/html-validate.js.map +1 -1
- package/dist/es/jest-lib.d.ts +1 -1
- package/dist/es/jest-lib.js +3 -2
- package/dist/es/jest-lib.js.map +1 -1
- package/package.json +39 -36
- package/dist/cjs/browser.d.ts +0 -4
- package/dist/cjs/jest.d.ts +0 -4
- package/dist/es/browser.d.ts +0 -4
- package/dist/es/jest.d.ts +0 -4
package/dist/es/core.d.ts
CHANGED
|
@@ -3,6 +3,9 @@ import { SchemaObject as SchemaObject$1 } from 'ajv/dist/types';
|
|
|
3
3
|
|
|
4
4
|
/** @internal */
|
|
5
5
|
declare type EventCallback = (event: string, data: any) => void;
|
|
6
|
+
/**
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
6
9
|
declare class EventHandler {
|
|
7
10
|
listeners: {
|
|
8
11
|
[event: string]: EventCallback[];
|
|
@@ -67,6 +70,9 @@ declare type RuleConfig = Record<string, RuleSeverity | [RuleSeverity] | [RuleSe
|
|
|
67
70
|
interface TransformMap {
|
|
68
71
|
[key: string]: string;
|
|
69
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* @public
|
|
75
|
+
*/
|
|
70
76
|
interface ConfigData {
|
|
71
77
|
/**
|
|
72
78
|
* If set to true no new configurations will be searched.
|
|
@@ -112,6 +118,8 @@ interface ConfigData {
|
|
|
112
118
|
|
|
113
119
|
/**
|
|
114
120
|
* Reported error message.
|
|
121
|
+
*
|
|
122
|
+
* @public
|
|
115
123
|
*/
|
|
116
124
|
interface Message {
|
|
117
125
|
/** Rule that triggered this message */
|
|
@@ -139,6 +147,9 @@ interface Message {
|
|
|
139
147
|
*/
|
|
140
148
|
context?: any;
|
|
141
149
|
}
|
|
150
|
+
/**
|
|
151
|
+
* @public
|
|
152
|
+
*/
|
|
142
153
|
interface Result {
|
|
143
154
|
messages: Message[];
|
|
144
155
|
filePath: string;
|
|
@@ -148,6 +159,8 @@ interface Result {
|
|
|
148
159
|
}
|
|
149
160
|
/**
|
|
150
161
|
* Report object returned by [[HtmlValidate]].
|
|
162
|
+
*
|
|
163
|
+
* @public
|
|
151
164
|
*/
|
|
152
165
|
interface Report {
|
|
153
166
|
/** `true` if validation was successful */
|
|
@@ -159,6 +172,9 @@ interface Report {
|
|
|
159
172
|
/** Total warnings of errors across all sources */
|
|
160
173
|
warningCount: number;
|
|
161
174
|
}
|
|
175
|
+
/**
|
|
176
|
+
* @internal
|
|
177
|
+
*/
|
|
162
178
|
declare class Reporter {
|
|
163
179
|
protected result: {
|
|
164
180
|
[filename: string]: Message[];
|
|
@@ -174,6 +190,9 @@ declare class Reporter {
|
|
|
174
190
|
protected isValid(): boolean;
|
|
175
191
|
}
|
|
176
192
|
|
|
193
|
+
/**
|
|
194
|
+
* @public
|
|
195
|
+
*/
|
|
177
196
|
interface RuleDocumentation {
|
|
178
197
|
description: string;
|
|
179
198
|
url?: string;
|
|
@@ -186,6 +205,9 @@ interface IncludeExcludeOptions {
|
|
|
186
205
|
include: string[] | null;
|
|
187
206
|
exclude: string[] | null;
|
|
188
207
|
}
|
|
208
|
+
/**
|
|
209
|
+
* @public
|
|
210
|
+
*/
|
|
189
211
|
declare abstract class Rule<ContextType = void, OptionsType = void> {
|
|
190
212
|
private reporter;
|
|
191
213
|
private parser;
|
|
@@ -341,6 +363,8 @@ interface Event {
|
|
|
341
363
|
}
|
|
342
364
|
/**
|
|
343
365
|
* Configuration ready event.
|
|
366
|
+
*
|
|
367
|
+
* @public
|
|
344
368
|
*/
|
|
345
369
|
interface ConfigReadyEvent extends Event {
|
|
346
370
|
config: ResolvedConfig;
|
|
@@ -354,12 +378,16 @@ interface ConfigReadyEvent extends Event {
|
|
|
354
378
|
*
|
|
355
379
|
* The source object must not be modified (use a transformer if modifications
|
|
356
380
|
* are required)
|
|
381
|
+
*
|
|
382
|
+
* @public
|
|
357
383
|
*/
|
|
358
384
|
interface SourceReadyEvent extends Event {
|
|
359
385
|
source: Source;
|
|
360
386
|
}
|
|
361
387
|
/**
|
|
362
388
|
* Token event.
|
|
389
|
+
*
|
|
390
|
+
* @public
|
|
363
391
|
*/
|
|
364
392
|
interface TokenEvent extends Event {
|
|
365
393
|
type: TokenType;
|
|
@@ -367,6 +395,8 @@ interface TokenEvent extends Event {
|
|
|
367
395
|
}
|
|
368
396
|
/**
|
|
369
397
|
* Event emitted when starting tags are encountered.
|
|
398
|
+
*
|
|
399
|
+
* @public
|
|
370
400
|
*/
|
|
371
401
|
interface TagStartEvent extends Event {
|
|
372
402
|
/** Event location. */
|
|
@@ -374,10 +404,17 @@ interface TagStartEvent extends Event {
|
|
|
374
404
|
/** The node being started. */
|
|
375
405
|
target: HtmlElement;
|
|
376
406
|
}
|
|
377
|
-
/**
|
|
407
|
+
/**
|
|
408
|
+
* Deprecated alias for TagStartEvent
|
|
409
|
+
*
|
|
410
|
+
* @public
|
|
411
|
+
* @deprecated Use TagStartEvent instead
|
|
412
|
+
*/
|
|
378
413
|
declare type TagOpenEvent = TagStartEvent;
|
|
379
414
|
/**
|
|
380
415
|
* Event emitted when end tags `</..>` are encountered.
|
|
416
|
+
*
|
|
417
|
+
* @public
|
|
381
418
|
*/
|
|
382
419
|
interface TagEndEvent extends Event {
|
|
383
420
|
/** Event location. */
|
|
@@ -388,11 +425,18 @@ interface TagEndEvent extends Event {
|
|
|
388
425
|
/** The node being closed. */
|
|
389
426
|
previous: HtmlElement;
|
|
390
427
|
}
|
|
391
|
-
/**
|
|
428
|
+
/**
|
|
429
|
+
* Deprecated alias for TagEndEvent
|
|
430
|
+
*
|
|
431
|
+
* @public
|
|
432
|
+
* @deprecated Use TagEndEvent instead
|
|
433
|
+
*/
|
|
392
434
|
declare type TagCloseEvent = TagEndEvent;
|
|
393
435
|
/**
|
|
394
436
|
* Event emitted when a tag is ready (i.e. all the attributes has been
|
|
395
437
|
* parsed). The children of the element will not yet be finished.
|
|
438
|
+
*
|
|
439
|
+
* @public
|
|
396
440
|
*/
|
|
397
441
|
interface TagReadyEvent extends Event {
|
|
398
442
|
/** Event location. */
|
|
@@ -402,6 +446,8 @@ interface TagReadyEvent extends Event {
|
|
|
402
446
|
}
|
|
403
447
|
/**
|
|
404
448
|
* Event emitted when an element is fully constructed (including its children).
|
|
449
|
+
*
|
|
450
|
+
* @public
|
|
405
451
|
*/
|
|
406
452
|
interface ElementReadyEvent extends Event {
|
|
407
453
|
/** Event location. */
|
|
@@ -411,6 +457,8 @@ interface ElementReadyEvent extends Event {
|
|
|
411
457
|
}
|
|
412
458
|
/**
|
|
413
459
|
* Event emitted when attributes are encountered.
|
|
460
|
+
*
|
|
461
|
+
* @public
|
|
414
462
|
*/
|
|
415
463
|
interface AttributeEvent extends Event {
|
|
416
464
|
/** Location of the full attribute (key, quotes and value) */
|
|
@@ -433,6 +481,8 @@ interface AttributeEvent extends Event {
|
|
|
433
481
|
}
|
|
434
482
|
/**
|
|
435
483
|
* Event emitted when whitespace content is parsed.
|
|
484
|
+
*
|
|
485
|
+
* @public
|
|
436
486
|
*/
|
|
437
487
|
interface WhitespaceEvent extends Event {
|
|
438
488
|
/** Event location. */
|
|
@@ -443,6 +493,8 @@ interface WhitespaceEvent extends Event {
|
|
|
443
493
|
/**
|
|
444
494
|
* Event emitted when Internet Explorer conditionals `<![if ...]>` are
|
|
445
495
|
* encountered.
|
|
496
|
+
*
|
|
497
|
+
* @public
|
|
446
498
|
*/
|
|
447
499
|
interface ConditionalEvent extends Event {
|
|
448
500
|
/** Event location. */
|
|
@@ -453,6 +505,8 @@ interface ConditionalEvent extends Event {
|
|
|
453
505
|
/**
|
|
454
506
|
* Event emitted when html-validate directives `<!-- [html-validate-...] -->`
|
|
455
507
|
* are encountered.
|
|
508
|
+
*
|
|
509
|
+
* @public
|
|
456
510
|
*/
|
|
457
511
|
interface DirectiveEvent extends Event {
|
|
458
512
|
/** Event location. */
|
|
@@ -466,6 +520,8 @@ interface DirectiveEvent extends Event {
|
|
|
466
520
|
}
|
|
467
521
|
/**
|
|
468
522
|
* Event emitted when doctypes `<!DOCTYPE ..>` are encountered.
|
|
523
|
+
*
|
|
524
|
+
* @public
|
|
469
525
|
*/
|
|
470
526
|
interface DoctypeEvent extends Event {
|
|
471
527
|
/** Event location. */
|
|
@@ -480,18 +536,25 @@ interface DoctypeEvent extends Event {
|
|
|
480
536
|
/**
|
|
481
537
|
* Event emitted after initialization but before tokenization and parsing occurs.
|
|
482
538
|
* Can be used to initialize state in rules.
|
|
539
|
+
*
|
|
540
|
+
* @public
|
|
483
541
|
*/
|
|
484
542
|
interface DOMLoadEvent extends Event {
|
|
485
543
|
source: Source;
|
|
486
544
|
}
|
|
487
545
|
/**
|
|
488
546
|
* Event emitted when DOM tree is fully constructed.
|
|
547
|
+
*
|
|
548
|
+
* @public
|
|
489
549
|
*/
|
|
490
550
|
interface DOMReadyEvent extends Event {
|
|
491
551
|
/** DOM Tree */
|
|
492
552
|
document: DOMTree;
|
|
493
553
|
source: Source;
|
|
494
554
|
}
|
|
555
|
+
/**
|
|
556
|
+
* @public
|
|
557
|
+
*/
|
|
495
558
|
interface TriggerEventMap {
|
|
496
559
|
"config:ready": ConfigReadyEvent;
|
|
497
560
|
"source:ready": SourceReadyEvent;
|
|
@@ -508,6 +571,9 @@ interface TriggerEventMap {
|
|
|
508
571
|
conditional: ConditionalEvent;
|
|
509
572
|
directive: DirectiveEvent;
|
|
510
573
|
}
|
|
574
|
+
/**
|
|
575
|
+
* @public
|
|
576
|
+
*/
|
|
511
577
|
interface ListenEventMap {
|
|
512
578
|
"config:ready": ConfigReadyEvent;
|
|
513
579
|
"source:ready": SourceReadyEvent;
|
|
@@ -530,6 +596,8 @@ interface ListenEventMap {
|
|
|
530
596
|
|
|
531
597
|
/**
|
|
532
598
|
* Parse HTML document into a DOM tree.
|
|
599
|
+
*
|
|
600
|
+
* @internal
|
|
533
601
|
*/
|
|
534
602
|
declare class Parser {
|
|
535
603
|
private readonly event;
|
|
@@ -647,6 +715,8 @@ declare class Parser {
|
|
|
647
715
|
|
|
648
716
|
/**
|
|
649
717
|
* Raw attribute data.
|
|
718
|
+
*
|
|
719
|
+
* @public
|
|
650
720
|
*/
|
|
651
721
|
interface AttributeData {
|
|
652
722
|
/** Attribute name */
|
|
@@ -660,11 +730,23 @@ interface AttributeData {
|
|
|
660
730
|
originalAttribute?: string;
|
|
661
731
|
}
|
|
662
732
|
|
|
733
|
+
/**
|
|
734
|
+
* @public
|
|
735
|
+
*/
|
|
663
736
|
declare type ProcessAttributeCallback = (this: unknown, attr: AttributeData) => Iterable<AttributeData>;
|
|
737
|
+
/**
|
|
738
|
+
* @public
|
|
739
|
+
*/
|
|
664
740
|
interface ProcessElementContext {
|
|
665
741
|
getMetaFor(tagName: string): MetaElement | null;
|
|
666
742
|
}
|
|
743
|
+
/**
|
|
744
|
+
* @public
|
|
745
|
+
*/
|
|
667
746
|
declare type ProcessElementCallback = (this: ProcessElementContext, node: HtmlElement) => void;
|
|
747
|
+
/**
|
|
748
|
+
* @public
|
|
749
|
+
*/
|
|
668
750
|
interface SourceHooks {
|
|
669
751
|
/**
|
|
670
752
|
* Called for every attribute.
|
|
@@ -689,6 +771,8 @@ interface SourceHooks {
|
|
|
689
771
|
*
|
|
690
772
|
* Optional hooks can be attached. This is usually added by transformers to
|
|
691
773
|
* postprocess.
|
|
774
|
+
*
|
|
775
|
+
* @public
|
|
692
776
|
*/
|
|
693
777
|
interface Source {
|
|
694
778
|
data: string;
|
|
@@ -733,6 +817,9 @@ interface Source {
|
|
|
733
817
|
transformedBy?: string[];
|
|
734
818
|
}
|
|
735
819
|
|
|
820
|
+
/**
|
|
821
|
+
* @public
|
|
822
|
+
*/
|
|
736
823
|
interface Location {
|
|
737
824
|
/**
|
|
738
825
|
* The filemane this location refers to.
|
|
@@ -758,6 +845,9 @@ interface Location {
|
|
|
758
845
|
readonly size: number;
|
|
759
846
|
}
|
|
760
847
|
|
|
848
|
+
/**
|
|
849
|
+
* @public
|
|
850
|
+
*/
|
|
761
851
|
declare class DynamicValue {
|
|
762
852
|
readonly expr: string;
|
|
763
853
|
constructor(expr: string);
|
|
@@ -839,6 +929,9 @@ interface DeprecatedElement {
|
|
|
839
929
|
documentation?: string;
|
|
840
930
|
source?: string;
|
|
841
931
|
}
|
|
932
|
+
/**
|
|
933
|
+
* @public
|
|
934
|
+
*/
|
|
842
935
|
interface MetaData {
|
|
843
936
|
inherit?: string;
|
|
844
937
|
metadata?: boolean | PropertyExpression;
|
|
@@ -874,8 +967,13 @@ declare type MetaLookupableProperty = "metadata" | "flow" | "sectioning" | "head
|
|
|
874
967
|
/**
|
|
875
968
|
* Properties listed here can be copied (loaded) onto another element using
|
|
876
969
|
* [[HtmlElement.loadMeta]].
|
|
970
|
+
*
|
|
971
|
+
* @public
|
|
877
972
|
*/
|
|
878
973
|
declare const MetaCopyableProperty: Array<keyof MetaElement>;
|
|
974
|
+
/**
|
|
975
|
+
* @public
|
|
976
|
+
*/
|
|
879
977
|
interface MetaElement extends Omit<MetaData, "deprecatedAttributes" | "requiredAttributes"> {
|
|
880
978
|
tagName: string;
|
|
881
979
|
attributes: Record<string, MetaAttribute>;
|
|
@@ -1014,6 +1112,9 @@ declare class DOMTokenList extends Array<string> {
|
|
|
1014
1112
|
}>;
|
|
1015
1113
|
}
|
|
1016
1114
|
|
|
1115
|
+
/**
|
|
1116
|
+
* @public
|
|
1117
|
+
*/
|
|
1017
1118
|
declare enum NodeClosed {
|
|
1018
1119
|
Open = 0,
|
|
1019
1120
|
EndTag = 1,
|
|
@@ -1021,6 +1122,9 @@ declare enum NodeClosed {
|
|
|
1021
1122
|
VoidSelfClosed = 3,
|
|
1022
1123
|
ImplicitClosed = 4
|
|
1023
1124
|
}
|
|
1125
|
+
/**
|
|
1126
|
+
* @public
|
|
1127
|
+
*/
|
|
1024
1128
|
declare class HtmlElement extends DOMNode {
|
|
1025
1129
|
readonly tagName: string;
|
|
1026
1130
|
readonly parent: HtmlElement | null;
|
|
@@ -1033,7 +1137,13 @@ declare class HtmlElement extends DOMNode {
|
|
|
1033
1137
|
private metaElement;
|
|
1034
1138
|
private annotation;
|
|
1035
1139
|
constructor(tagName: string | undefined, parent: HtmlElement | null, closed: NodeClosed, meta: MetaElement | null, location: Location);
|
|
1140
|
+
/**
|
|
1141
|
+
* @internal
|
|
1142
|
+
*/
|
|
1036
1143
|
static rootNode(location: Location): HtmlElement;
|
|
1144
|
+
/**
|
|
1145
|
+
* @internal
|
|
1146
|
+
*/
|
|
1037
1147
|
static fromTokens(startToken: Token, endToken: Token, parent: HtmlElement | null, metaTable: MetaTable | null): HtmlElement;
|
|
1038
1148
|
/**
|
|
1039
1149
|
* Returns annotated name if set or defaults to `<tagName>`.
|
|
@@ -1183,20 +1293,28 @@ declare class HtmlElement extends DOMNode {
|
|
|
1183
1293
|
private querySelectorImpl;
|
|
1184
1294
|
/**
|
|
1185
1295
|
* Visit all nodes from this node and down. Depth first.
|
|
1296
|
+
*
|
|
1297
|
+
* @internal
|
|
1186
1298
|
*/
|
|
1187
1299
|
visitDepthFirst(callback: (node: HtmlElement) => void): void;
|
|
1188
1300
|
/**
|
|
1189
1301
|
* Evaluates callbackk on all descendants, returning true if any are true.
|
|
1302
|
+
*
|
|
1303
|
+
* @internal
|
|
1190
1304
|
*/
|
|
1191
1305
|
someChildren(callback: (node: HtmlElement) => boolean): boolean;
|
|
1192
1306
|
/**
|
|
1193
1307
|
* Evaluates callbackk on all descendants, returning true if all are true.
|
|
1308
|
+
*
|
|
1309
|
+
* @internal
|
|
1194
1310
|
*/
|
|
1195
1311
|
everyChildren(callback: (node: HtmlElement) => boolean): boolean;
|
|
1196
1312
|
/**
|
|
1197
1313
|
* Visit all nodes from this node and down. Breadth first.
|
|
1198
1314
|
*
|
|
1199
1315
|
* The first node for which the callback evaluates to true is returned.
|
|
1316
|
+
*
|
|
1317
|
+
* @internal
|
|
1200
1318
|
*/
|
|
1201
1319
|
find(callback: (node: HtmlElement) => boolean): HtmlElement | null;
|
|
1202
1320
|
}
|
|
@@ -1225,6 +1343,8 @@ declare class DOMTree {
|
|
|
1225
1343
|
*
|
|
1226
1344
|
* Text nodes are appended as children of `HtmlElement` and cannot have childen
|
|
1227
1345
|
* of its own.
|
|
1346
|
+
*
|
|
1347
|
+
* @public
|
|
1228
1348
|
*/
|
|
1229
1349
|
declare class TextNode extends DOMNode {
|
|
1230
1350
|
private readonly text;
|
|
@@ -1248,6 +1368,9 @@ declare class TextNode extends DOMNode {
|
|
|
1248
1368
|
get isDynamic(): boolean;
|
|
1249
1369
|
}
|
|
1250
1370
|
|
|
1371
|
+
/**
|
|
1372
|
+
* @public
|
|
1373
|
+
*/
|
|
1251
1374
|
interface TransformContext {
|
|
1252
1375
|
/**
|
|
1253
1376
|
* Test if an additional chainable transformer is present.
|
|
@@ -1277,6 +1400,9 @@ declare module "estree" {
|
|
|
1277
1400
|
end: number;
|
|
1278
1401
|
}
|
|
1279
1402
|
}
|
|
1403
|
+
/**
|
|
1404
|
+
* @public
|
|
1405
|
+
*/
|
|
1280
1406
|
declare class TemplateExtractor {
|
|
1281
1407
|
private ast;
|
|
1282
1408
|
private filename;
|
|
@@ -1323,12 +1449,18 @@ declare class TemplateExtractor {
|
|
|
1323
1449
|
extractObjectProperty(key: string): Source[];
|
|
1324
1450
|
}
|
|
1325
1451
|
|
|
1452
|
+
/**
|
|
1453
|
+
* @public
|
|
1454
|
+
*/
|
|
1326
1455
|
declare type Transformer = (this: TransformContext, source: Source) => Iterable<Source>;
|
|
1327
1456
|
|
|
1328
1457
|
interface SchemaValidationPatch {
|
|
1329
1458
|
properties?: Record<string, unknown>;
|
|
1330
1459
|
definitions?: Record<string, unknown>;
|
|
1331
1460
|
}
|
|
1461
|
+
/**
|
|
1462
|
+
* @public
|
|
1463
|
+
*/
|
|
1332
1464
|
interface Plugin {
|
|
1333
1465
|
/**
|
|
1334
1466
|
* Name of the plugin.
|
|
@@ -1406,18 +1538,30 @@ interface Plugin {
|
|
|
1406
1538
|
elementSchema?: SchemaValidationPatch | null;
|
|
1407
1539
|
}
|
|
1408
1540
|
|
|
1541
|
+
/**
|
|
1542
|
+
* @public
|
|
1543
|
+
*/
|
|
1409
1544
|
declare class MetaTable {
|
|
1410
1545
|
readonly elements: ElementTable;
|
|
1411
1546
|
private schema;
|
|
1547
|
+
/**
|
|
1548
|
+
* @internal
|
|
1549
|
+
*/
|
|
1412
1550
|
constructor();
|
|
1551
|
+
/**
|
|
1552
|
+
* @internal
|
|
1553
|
+
*/
|
|
1413
1554
|
init(): void;
|
|
1414
1555
|
/**
|
|
1415
1556
|
* Extend validation schema.
|
|
1557
|
+
*
|
|
1558
|
+
* @internal
|
|
1416
1559
|
*/
|
|
1417
1560
|
extendValidationSchema(patch: SchemaValidationPatch): void;
|
|
1418
1561
|
/**
|
|
1419
1562
|
* Load metadata table from object.
|
|
1420
1563
|
*
|
|
1564
|
+
* @internal
|
|
1421
1565
|
* @param obj - Object with metadata to load
|
|
1422
1566
|
* @param filename - Optional filename used when presenting validation error
|
|
1423
1567
|
*/
|
|
@@ -1425,21 +1569,27 @@ declare class MetaTable {
|
|
|
1425
1569
|
/**
|
|
1426
1570
|
* Load metadata table from filename
|
|
1427
1571
|
*
|
|
1572
|
+
* @internal
|
|
1428
1573
|
* @param filename - Filename to load
|
|
1429
1574
|
*/
|
|
1430
1575
|
loadFromFile(filename: string): void;
|
|
1431
1576
|
/**
|
|
1432
1577
|
* Get [[MetaElement]] for the given tag or null if the element doesn't exist.
|
|
1433
1578
|
*
|
|
1579
|
+
* @public
|
|
1434
1580
|
* @returns A shallow copy of metadata.
|
|
1435
1581
|
*/
|
|
1436
1582
|
getMetaFor(tagName: string): MetaElement | null;
|
|
1437
1583
|
/**
|
|
1438
1584
|
* Find all tags which has enabled given property.
|
|
1585
|
+
*
|
|
1586
|
+
* @public
|
|
1439
1587
|
*/
|
|
1440
1588
|
getTagsWithProperty(propName: MetaLookupableProperty): string[];
|
|
1441
1589
|
/**
|
|
1442
1590
|
* Find tag matching tagName or inheriting from it.
|
|
1591
|
+
*
|
|
1592
|
+
* @public
|
|
1443
1593
|
*/
|
|
1444
1594
|
getTagsDerivedFrom(tagName: string): string[];
|
|
1445
1595
|
private addEntry;
|
|
@@ -1447,6 +1597,9 @@ declare class MetaTable {
|
|
|
1447
1597
|
* Construct a new AJV schema validator.
|
|
1448
1598
|
*/
|
|
1449
1599
|
private getSchemaValidator;
|
|
1600
|
+
/**
|
|
1601
|
+
* @public
|
|
1602
|
+
*/
|
|
1450
1603
|
getJSONSchema(): SchemaObject$1;
|
|
1451
1604
|
/**
|
|
1452
1605
|
* Finds the global element definition and merges each known element with the
|
|
@@ -1454,9 +1607,15 @@ declare class MetaTable {
|
|
|
1454
1607
|
*/
|
|
1455
1608
|
private resolveGlobal;
|
|
1456
1609
|
private mergeElement;
|
|
1610
|
+
/**
|
|
1611
|
+
* @internal
|
|
1612
|
+
*/
|
|
1457
1613
|
resolve(node: HtmlElement): void;
|
|
1458
1614
|
}
|
|
1459
1615
|
|
|
1616
|
+
/**
|
|
1617
|
+
* @public
|
|
1618
|
+
*/
|
|
1460
1619
|
declare enum Severity {
|
|
1461
1620
|
DISABLED = 0,
|
|
1462
1621
|
WARN = 1,
|
|
@@ -1525,6 +1684,8 @@ interface LoadedPlugin extends Plugin {
|
|
|
1525
1684
|
* Configuration holder.
|
|
1526
1685
|
*
|
|
1527
1686
|
* Each file being validated will have a unique instance of this class.
|
|
1687
|
+
*
|
|
1688
|
+
* @public
|
|
1528
1689
|
*/
|
|
1529
1690
|
declare class Config {
|
|
1530
1691
|
private config;
|
|
@@ -1556,18 +1717,25 @@ declare class Config {
|
|
|
1556
1717
|
* Validate configuration data.
|
|
1557
1718
|
*
|
|
1558
1719
|
* Throws SchemaValidationError if invalid.
|
|
1720
|
+
*
|
|
1721
|
+
* @internal
|
|
1559
1722
|
*/
|
|
1560
1723
|
static validate(configData: ConfigData, filename?: string | null): void;
|
|
1561
1724
|
/**
|
|
1562
1725
|
* Load a default configuration object.
|
|
1563
1726
|
*/
|
|
1564
1727
|
static defaultConfig(): Config;
|
|
1728
|
+
/**
|
|
1729
|
+
* @internal
|
|
1730
|
+
*/
|
|
1565
1731
|
constructor(options?: ConfigData);
|
|
1566
1732
|
/**
|
|
1567
1733
|
* Initialize plugins, transforms etc.
|
|
1568
1734
|
*
|
|
1569
1735
|
* Must be called before trying to use config. Can safely be called multiple
|
|
1570
1736
|
* times.
|
|
1737
|
+
*
|
|
1738
|
+
* @internal
|
|
1571
1739
|
*/
|
|
1572
1740
|
init(): void;
|
|
1573
1741
|
/**
|
|
@@ -1578,6 +1746,7 @@ declare class Config {
|
|
|
1578
1746
|
* Returns a new configuration as a merge of the two. Entries from the passed
|
|
1579
1747
|
* object takes priority over this object.
|
|
1580
1748
|
*
|
|
1749
|
+
* @internal
|
|
1581
1750
|
* @param rhs - Configuration to merge with this one.
|
|
1582
1751
|
*/
|
|
1583
1752
|
merge(rhs: Config): Config;
|
|
@@ -1598,11 +1767,15 @@ declare class Config {
|
|
|
1598
1767
|
get(): ConfigData;
|
|
1599
1768
|
/**
|
|
1600
1769
|
* Get all configured rules, their severity and options.
|
|
1770
|
+
*
|
|
1771
|
+
* @internal
|
|
1601
1772
|
*/
|
|
1602
1773
|
getRules(): Map<string, [Severity, RuleOptions]>;
|
|
1603
1774
|
private static getRulesObject;
|
|
1604
1775
|
/**
|
|
1605
1776
|
* Get all configured plugins.
|
|
1777
|
+
*
|
|
1778
|
+
* @internal
|
|
1606
1779
|
*/
|
|
1607
1780
|
getPlugins(): Plugin[];
|
|
1608
1781
|
private loadPlugins;
|
|
@@ -1613,6 +1786,8 @@ declare class Config {
|
|
|
1613
1786
|
*
|
|
1614
1787
|
* A resolved configuration will merge all extended configs and load all
|
|
1615
1788
|
* plugins and transformers, and normalize the rest of the configuration.
|
|
1789
|
+
*
|
|
1790
|
+
* @internal
|
|
1616
1791
|
*/
|
|
1617
1792
|
resolve(): ResolvedConfig;
|
|
1618
1793
|
/**
|
|
@@ -1709,9 +1884,15 @@ declare class NestedError extends Error {
|
|
|
1709
1884
|
constructor(message: string, nested?: Error);
|
|
1710
1885
|
}
|
|
1711
1886
|
|
|
1887
|
+
/**
|
|
1888
|
+
* @public
|
|
1889
|
+
*/
|
|
1712
1890
|
declare class UserError extends NestedError {
|
|
1713
1891
|
}
|
|
1714
1892
|
|
|
1893
|
+
/**
|
|
1894
|
+
* @public
|
|
1895
|
+
*/
|
|
1715
1896
|
declare class SchemaValidationError extends UserError {
|
|
1716
1897
|
filename: string | null;
|
|
1717
1898
|
private obj;
|
|
@@ -1722,15 +1903,27 @@ declare class SchemaValidationError extends UserError {
|
|
|
1722
1903
|
private getRawJSON;
|
|
1723
1904
|
}
|
|
1724
1905
|
|
|
1906
|
+
/**
|
|
1907
|
+
* @public
|
|
1908
|
+
*/
|
|
1725
1909
|
declare class ConfigError extends UserError {
|
|
1726
1910
|
}
|
|
1727
1911
|
|
|
1912
|
+
/**
|
|
1913
|
+
* @internal
|
|
1914
|
+
*/
|
|
1728
1915
|
declare const presets: Record<string, ConfigData>;
|
|
1729
1916
|
|
|
1917
|
+
/**
|
|
1918
|
+
* @internal
|
|
1919
|
+
*/
|
|
1730
1920
|
interface EventDump {
|
|
1731
1921
|
event: string;
|
|
1732
1922
|
data: any;
|
|
1733
1923
|
}
|
|
1924
|
+
/**
|
|
1925
|
+
* @internal
|
|
1926
|
+
*/
|
|
1734
1927
|
interface TokenDump {
|
|
1735
1928
|
token: string;
|
|
1736
1929
|
data: string;
|
|
@@ -1741,6 +1934,8 @@ interface TokenDump {
|
|
|
1741
1934
|
* Primary API for using HTML-validate.
|
|
1742
1935
|
*
|
|
1743
1936
|
* Provides high-level abstractions for common operations.
|
|
1937
|
+
*
|
|
1938
|
+
* @public
|
|
1744
1939
|
*/
|
|
1745
1940
|
declare class HtmlValidate {
|
|
1746
1941
|
protected configLoader: ConfigLoader;
|
|
@@ -1879,6 +2074,7 @@ declare class HtmlValidate {
|
|
|
1879
2074
|
/**
|
|
1880
2075
|
* Create a parser configured for given filename.
|
|
1881
2076
|
*
|
|
2077
|
+
* @internal
|
|
1882
2078
|
* @param source - Source to use.
|
|
1883
2079
|
*/
|
|
1884
2080
|
getParserFor(source: Source): Parser;
|
|
@@ -1909,6 +2105,8 @@ declare class HtmlValidate {
|
|
|
1909
2105
|
*
|
|
1910
2106
|
* In practice this means no configuration is fetch by traversing the
|
|
1911
2107
|
* filesystem.
|
|
2108
|
+
*
|
|
2109
|
+
* @public
|
|
1912
2110
|
*/
|
|
1913
2111
|
declare class StaticConfigLoader extends ConfigLoader {
|
|
1914
2112
|
getConfigFor(handle: string, configOverride?: ConfigData): Config;
|
|
@@ -1916,6 +2114,12 @@ declare class StaticConfigLoader extends ConfigLoader {
|
|
|
1916
2114
|
protected defaultConfig(): Config;
|
|
1917
2115
|
}
|
|
1918
2116
|
|
|
2117
|
+
/** @public */
|
|
2118
|
+
declare const version: string;
|
|
2119
|
+
|
|
2120
|
+
/**
|
|
2121
|
+
* @public
|
|
2122
|
+
*/
|
|
1919
2123
|
interface CompatibilityOptions {
|
|
1920
2124
|
/** If `true` nothing no output will be generated on console. Default: `false` */
|
|
1921
2125
|
silent: boolean;
|
|
@@ -1928,6 +2132,7 @@ interface CompatibilityOptions {
|
|
|
1928
2132
|
* Tests if plugin is compatible with html-validate library. Unless the `silent`
|
|
1929
2133
|
* option is used a warning is displayed on the console.
|
|
1930
2134
|
*
|
|
2135
|
+
* @public
|
|
1931
2136
|
* @param name - Name of plugin
|
|
1932
2137
|
* @param declared - What library versions the plugin support (e.g. declared peerDependencies)
|
|
1933
2138
|
* @returns - `true` if version is compatible
|
|
@@ -1941,6 +2146,7 @@ declare function compatibilityCheck(name: string, declared: string, options?: Pa
|
|
|
1941
2146
|
* Can be used to create forward/backward compatibility by checking if a rule
|
|
1942
2147
|
* exists to enable/disable it.
|
|
1943
2148
|
*
|
|
2149
|
+
* @public
|
|
1944
2150
|
* @param ruleId - Rule id to check
|
|
1945
2151
|
* @returns `true` if rule exists
|
|
1946
2152
|
*/
|
|
@@ -1970,6 +2176,8 @@ declare function ruleExists(ruleId: string): boolean;
|
|
|
1970
2176
|
* 2. If set in the global config the override is merged into global and
|
|
1971
2177
|
* returned. No configuration files are searched.
|
|
1972
2178
|
* 3. Setting `root` in configuration file only stops directory traversal.
|
|
2179
|
+
*
|
|
2180
|
+
* @public
|
|
1973
2181
|
*/
|
|
1974
2182
|
declare class FileSystemConfigLoader extends ConfigLoader {
|
|
1975
2183
|
protected cache: Map<string, Config | null>;
|
|
@@ -2001,14 +2209,18 @@ declare class FileSystemConfigLoader extends ConfigLoader {
|
|
|
2001
2209
|
protected defaultConfig(): Config;
|
|
2002
2210
|
}
|
|
2003
2211
|
|
|
2212
|
+
/**
|
|
2213
|
+
* @public
|
|
2214
|
+
*/
|
|
2004
2215
|
declare type Formatter = (results: Result[]) => string;
|
|
2005
2216
|
|
|
2006
2217
|
/**
|
|
2007
2218
|
* Get formatter function by name.
|
|
2008
2219
|
*
|
|
2220
|
+
* @internal
|
|
2009
2221
|
* @param name - Name of formatter.
|
|
2010
2222
|
* @returns Formatter function or null if it doesn't exist.
|
|
2011
2223
|
*/
|
|
2012
2224
|
declare function getFormatter(name: string): Formatter | null;
|
|
2013
2225
|
|
|
2014
|
-
export {
|
|
2226
|
+
export { DoctypeEvent as $, AttributeData as A, Event as B, Config as C, DynamicValue as D, EventDump as E, ConfigReadyEvent as F, SourceReadyEvent as G, HtmlValidate as H, TokenEvent as I, TagStartEvent as J, TagOpenEvent as K, Location as L, MetaData as M, NodeClosed as N, TagEndEvent as O, ProcessElementContext as P, TagCloseEvent as Q, Rule as R, Severity as S, TextNode as T, UserError as U, TagReadyEvent as V, ElementReadyEvent as W, AttributeEvent as X, WhitespaceEvent as Y, ConditionalEvent as Z, DirectiveEvent as _, ConfigData as a, DOMLoadEvent as a0, DOMReadyEvent as a1, TriggerEventMap as a2, ListenEventMap as a3, FileSystemConfigLoader as a4, Formatter as a5, getFormatter as a6, compatibilityCheck as a7, CompatibilityOptions as a8, TokenType as a9, ConfigError as b, ConfigLoader as c, StaticConfigLoader as d, HtmlElement as e, TokenDump as f, SchemaValidationError as g, MetaElement as h, MetaTable as i, MetaCopyableProperty as j, RuleDocumentation as k, Source as l, Report as m, Reporter as n, Message as o, presets as p, Result as q, TransformContext as r, Transformer as s, TemplateExtractor as t, Plugin as u, version as v, Parser as w, ruleExists as x, EventHandler as y, EventCallback as z };
|