html-validate 8.7.4 → 8.9.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.
Files changed (74) hide show
  1. package/dist/cjs/browser.js +7 -21
  2. package/dist/cjs/browser.js.map +1 -1
  3. package/dist/cjs/cli.js +483 -451
  4. package/dist/cjs/cli.js.map +1 -1
  5. package/dist/cjs/core-browser.js +9 -20
  6. package/dist/cjs/core-browser.js.map +1 -1
  7. package/dist/cjs/core-nodejs.js +203 -297
  8. package/dist/cjs/core-nodejs.js.map +1 -1
  9. package/dist/cjs/core.js +9735 -10454
  10. package/dist/cjs/core.js.map +1 -1
  11. package/dist/cjs/elements.js +2311 -2296
  12. package/dist/cjs/elements.js.map +1 -1
  13. package/dist/cjs/html-validate.js +148 -169
  14. package/dist/cjs/html-validate.js.map +1 -1
  15. package/dist/cjs/html5.js.map +1 -1
  16. package/dist/cjs/index.js +8 -21
  17. package/dist/cjs/index.js.map +1 -1
  18. package/dist/cjs/jest-diff.js +26 -36
  19. package/dist/cjs/jest-diff.js.map +1 -1
  20. package/dist/cjs/jest.js +8 -8
  21. package/dist/cjs/jest.js.map +1 -1
  22. package/dist/cjs/matcher-utils.js +12 -28
  23. package/dist/cjs/matcher-utils.js.map +1 -1
  24. package/dist/cjs/matchers-jestonly.js +38 -47
  25. package/dist/cjs/matchers-jestonly.js.map +1 -1
  26. package/dist/cjs/matchers.js +196 -196
  27. package/dist/cjs/matchers.js.map +1 -1
  28. package/dist/cjs/meta-helper.js +40 -60
  29. package/dist/cjs/meta-helper.js.map +1 -1
  30. package/dist/cjs/test-utils.js +26 -47
  31. package/dist/cjs/test-utils.js.map +1 -1
  32. package/dist/cjs/tsdoc-metadata.json +1 -1
  33. package/dist/cjs/utils/natural-join.js +10 -23
  34. package/dist/cjs/utils/natural-join.js.map +1 -1
  35. package/dist/cjs/vitest.js +6 -6
  36. package/dist/cjs/vitest.js.map +1 -1
  37. package/dist/es/browser.js +2 -2
  38. package/dist/es/cli.js +482 -454
  39. package/dist/es/cli.js.map +1 -1
  40. package/dist/es/core-browser.js +10 -21
  41. package/dist/es/core-browser.js.map +1 -1
  42. package/dist/es/core-nodejs.js +204 -299
  43. package/dist/es/core-nodejs.js.map +1 -1
  44. package/dist/es/core.js +9730 -10455
  45. package/dist/es/core.js.map +1 -1
  46. package/dist/es/elements.js +2311 -2296
  47. package/dist/es/elements.js.map +1 -1
  48. package/dist/es/html-validate.js +150 -171
  49. package/dist/es/html-validate.js.map +1 -1
  50. package/dist/es/html5.js.map +1 -1
  51. package/dist/es/index.js +3 -3
  52. package/dist/es/jest-diff.js +11 -21
  53. package/dist/es/jest-diff.js.map +1 -1
  54. package/dist/es/jest.js +8 -8
  55. package/dist/es/jest.js.map +1 -1
  56. package/dist/es/matcher-utils.js +12 -28
  57. package/dist/es/matcher-utils.js.map +1 -1
  58. package/dist/es/matchers-jestonly.js +39 -48
  59. package/dist/es/matchers-jestonly.js.map +1 -1
  60. package/dist/es/matchers.js +196 -196
  61. package/dist/es/matchers.js.map +1 -1
  62. package/dist/es/meta-helper.js +40 -60
  63. package/dist/es/meta-helper.js.map +1 -1
  64. package/dist/es/test-utils.js +26 -47
  65. package/dist/es/test-utils.js.map +1 -1
  66. package/dist/es/utils/natural-join.js +10 -23
  67. package/dist/es/utils/natural-join.js.map +1 -1
  68. package/dist/es/vitest.js +6 -6
  69. package/dist/es/vitest.js.map +1 -1
  70. package/dist/schema/elements.json +6 -0
  71. package/dist/tsdoc-metadata.json +1 -1
  72. package/dist/types/browser.d.ts +78 -32
  73. package/dist/types/index.d.ts +105 -34
  74. package/package.json +15 -15
@@ -264,6 +264,16 @@ export declare interface ConfigData {
264
264
  * If set to true no new configurations will be searched.
265
265
  */
266
266
  root?: boolean;
267
+ /**
268
+ * List of configuration presets to extend.
269
+ *
270
+ * The following sources are allowed:
271
+ *
272
+ * - One of the [predefined presets](http://html-validate.org/rules/presets.html).
273
+ * - Node module exporting a preset.
274
+ * - Plugin exporting a named preset.
275
+ * - Local path to a json or js file exporting a preset.
276
+ */
267
277
  extends?: string[];
268
278
  /**
269
279
  * List of sources for element metadata.
@@ -376,6 +386,14 @@ export declare interface DeferredMessage extends Omit<Message, "selector"> {
376
386
  selector: () => string | null;
377
387
  }
378
388
 
389
+ /**
390
+ * Helper function to assist IDE with completion and type-checking.
391
+ *
392
+ * @public
393
+ * @since
394
+ */
395
+ export declare function defineConfig(config: ConfigData): ConfigData;
396
+
379
397
  /**
380
398
  * Helper function to assist IDE with completion and type-checking.
381
399
  *
@@ -671,7 +689,7 @@ export declare type EventCallback = (event: string, data: any) => void;
671
689
  * @public
672
690
  */
673
691
  export declare class EventHandler {
674
- listeners: Record<string, EventCallback[]>;
692
+ private listeners;
675
693
  constructor();
676
694
  /**
677
695
  * Add an event listener.
@@ -697,6 +715,7 @@ export declare class EventHandler {
697
715
  * @param data - Event data.
698
716
  */
699
717
  trigger(event: string, data: any): void;
718
+ private getCallbacks;
700
719
  }
701
720
 
702
721
  /**
@@ -930,13 +949,13 @@ export declare class HtmlValidate {
930
949
  * @param hooks - Optional hooks (see [[Source]]) for definition.
931
950
  * @returns Report output.
932
951
  */
933
- validateString(str: string): Promise<Report>;
934
- validateString(str: string, filename: string): Promise<Report>;
935
- validateString(str: string, hooks: SourceHooks): Promise<Report>;
936
- validateString(str: string, options: ConfigData): Promise<Report>;
937
- validateString(str: string, filename: string, hooks: SourceHooks): Promise<Report>;
938
- validateString(str: string, filename: string, options: ConfigData): Promise<Report>;
939
- validateString(str: string, filename: string, options: ConfigData, hooks: SourceHooks): Promise<Report>;
952
+ validateString(str: string): Promise<Report_2>;
953
+ validateString(str: string, filename: string): Promise<Report_2>;
954
+ validateString(str: string, hooks: SourceHooks): Promise<Report_2>;
955
+ validateString(str: string, options: ConfigData): Promise<Report_2>;
956
+ validateString(str: string, filename: string, hooks: SourceHooks): Promise<Report_2>;
957
+ validateString(str: string, filename: string, options: ConfigData): Promise<Report_2>;
958
+ validateString(str: string, filename: string, options: ConfigData, hooks: SourceHooks): Promise<Report_2>;
940
959
  /**
941
960
  * Parse and validate HTML from string.
942
961
  *
@@ -946,13 +965,13 @@ export declare class HtmlValidate {
946
965
  * @param hooks - Optional hooks (see [[Source]]) for definition.
947
966
  * @returns Report output.
948
967
  */
949
- validateStringSync(str: string): Report;
950
- validateStringSync(str: string, filename: string): Report;
951
- validateStringSync(str: string, hooks: SourceHooks): Report;
952
- validateStringSync(str: string, options: ConfigData): Report;
953
- validateStringSync(str: string, filename: string, hooks: SourceHooks): Report;
954
- validateStringSync(str: string, filename: string, options: ConfigData): Report;
955
- validateStringSync(str: string, filename: string, options: ConfigData, hooks: SourceHooks): Report;
968
+ validateStringSync(str: string): Report_2;
969
+ validateStringSync(str: string, filename: string): Report_2;
970
+ validateStringSync(str: string, hooks: SourceHooks): Report_2;
971
+ validateStringSync(str: string, options: ConfigData): Report_2;
972
+ validateStringSync(str: string, filename: string, hooks: SourceHooks): Report_2;
973
+ validateStringSync(str: string, filename: string, options: ConfigData): Report_2;
974
+ validateStringSync(str: string, filename: string, options: ConfigData, hooks: SourceHooks): Report_2;
956
975
  /**
957
976
  * Parse and validate HTML from [[Source]].
958
977
  *
@@ -960,7 +979,7 @@ export declare class HtmlValidate {
960
979
  * @param input - Source to parse.
961
980
  * @returns Report output.
962
981
  */
963
- validateSource(input: Source, configOverride?: ConfigData): Promise<Report>;
982
+ validateSource(input: Source, configOverride?: ConfigData): Promise<Report_2>;
964
983
  /**
965
984
  * Parse and validate HTML from [[Source]].
966
985
  *
@@ -968,7 +987,7 @@ export declare class HtmlValidate {
968
987
  * @param input - Source to parse.
969
988
  * @returns Report output.
970
989
  */
971
- validateSourceSync(input: Source, configOverride?: ConfigData): Report;
990
+ validateSourceSync(input: Source, configOverride?: ConfigData): Report_2;
972
991
  /**
973
992
  * Parse and validate HTML from file.
974
993
  *
@@ -976,7 +995,7 @@ export declare class HtmlValidate {
976
995
  * @param filename - Filename to read and parse.
977
996
  * @returns Report output.
978
997
  */
979
- validateFile(filename: string): Promise<Report>;
998
+ validateFile(filename: string): Promise<Report_2>;
980
999
  /**
981
1000
  * Parse and validate HTML from file.
982
1001
  *
@@ -984,7 +1003,7 @@ export declare class HtmlValidate {
984
1003
  * @param filename - Filename to read and parse.
985
1004
  * @returns Report output.
986
1005
  */
987
- validateFileSync(filename: string): Report;
1006
+ validateFileSync(filename: string): Report_2;
988
1007
  /**
989
1008
  * Parse and validate HTML from multiple files. Result is merged together to a
990
1009
  * single report.
@@ -992,7 +1011,7 @@ export declare class HtmlValidate {
992
1011
  * @param filenames - Filenames to read and parse.
993
1012
  * @returns Report output.
994
1013
  */
995
- validateMultipleFiles(filenames: string[]): Promise<Report>;
1014
+ validateMultipleFiles(filenames: string[]): Promise<Report_2>;
996
1015
  /**
997
1016
  * Parse and validate HTML from multiple files. Result is merged together to a
998
1017
  * single report.
@@ -1000,7 +1019,7 @@ export declare class HtmlValidate {
1000
1019
  * @param filenames - Filenames to read and parse.
1001
1020
  * @returns Report output.
1002
1021
  */
1003
- validateMultipleFilesSync(filenames: string[]): Report;
1022
+ validateMultipleFilesSync(filenames: string[]): Report_2;
1004
1023
  /**
1005
1024
  * Returns true if the given filename can be validated.
1006
1025
  *
@@ -1396,6 +1415,8 @@ export declare interface MetaData {
1396
1415
  transparent?: boolean | string[];
1397
1416
  implicitClosed?: string[];
1398
1417
  scriptSupporting?: boolean;
1418
+ /** Mark element as able to receive focus (without explicit `tabindex`) */
1419
+ focusable?: boolean | MetaFocusableCallback;
1399
1420
  form?: boolean;
1400
1421
  /** Mark element as a form-associated element */
1401
1422
  formAssociated?: Partial<FormAssociated>;
@@ -1450,12 +1471,24 @@ export declare type MetaDataTable = Record<string, MetaData>;
1450
1471
  */
1451
1472
  export declare interface MetaElement extends Omit<MetaData, "deprecatedAttributes" | "requiredAttributes"> {
1452
1473
  tagName: string;
1474
+ focusable: boolean | MetaFocusableCallback;
1453
1475
  formAssociated?: FormAssociated;
1454
1476
  implicitRole: MetaImplicitRoleCallback;
1455
1477
  attributes: Record<string, MetaAttribute>;
1456
1478
  textContent?: TextContent;
1457
1479
  }
1458
1480
 
1481
+ /**
1482
+ * Callback for the `focusable` property of `MetaData`. It takes a node and
1483
+ * returns whenever the element is focusable or not.
1484
+ *
1485
+ * @public
1486
+ * @since 8.9.0
1487
+ * @param node - The node to determine if it is focusable.
1488
+ * @returns `true` if the node is focusable.
1489
+ */
1490
+ export declare type MetaFocusableCallback = (node: HtmlElementLike) => boolean;
1491
+
1459
1492
  /**
1460
1493
  * Callback for the `implicitRole` property of `MetaData`. It takes a node and
1461
1494
  * returns the implicit ARIA role, if any.
@@ -1473,7 +1506,7 @@ export declare type MetaImplicitRoleCallback = (node: HtmlElementLike) => string
1473
1506
  *
1474
1507
  * @public
1475
1508
  */
1476
- export declare type MetaLookupableProperty = "metadata" | "flow" | "sectioning" | "heading" | "phrasing" | "embedded" | "interactive" | "deprecated" | "foreign" | "void" | "transparent" | "scriptSupporting" | "form" | "formAssociated" | "labelable";
1509
+ export declare type MetaLookupableProperty = "metadata" | "flow" | "sectioning" | "heading" | "phrasing" | "embedded" | "interactive" | "deprecated" | "foreign" | "void" | "transparent" | "scriptSupporting" | "focusable" | "form" | "formAssociated" | "labelable";
1477
1510
 
1478
1511
  /**
1479
1512
  * @public
@@ -1798,7 +1831,7 @@ export declare type PropertyExpression = string | [string, any];
1798
1831
  *
1799
1832
  * @public
1800
1833
  */
1801
- export declare interface Report {
1834
+ declare interface Report_2 {
1802
1835
  /** `true` if validation was successful */
1803
1836
  valid: boolean;
1804
1837
  /** Detailed results per validated source */
@@ -1808,6 +1841,7 @@ export declare interface Report {
1808
1841
  /** Total warnings of errors across all sources */
1809
1842
  warningCount: number;
1810
1843
  }
1844
+ export { Report_2 as Report }
1811
1845
 
1812
1846
  /**
1813
1847
  * @public
@@ -1817,11 +1851,21 @@ export declare class Reporter {
1817
1851
  constructor();
1818
1852
  /**
1819
1853
  * Merge two or more reports into a single one.
1854
+ *
1855
+ * @param reports- Reports to merge.
1856
+ * @returns A merged report.
1820
1857
  */
1821
- static merge(reports: Report[]): Report;
1858
+ static merge(reports: Report_2[]): Report_2;
1859
+ /**
1860
+ * Merge two or more reports into a single one.
1861
+ *
1862
+ * @param reports- Reports to merge.
1863
+ * @returns A promise resolved with the merged report.
1864
+ */
1865
+ static merge(reports: Promise<Report_2[]> | Array<Promise<Report_2>>): Promise<Report_2>;
1822
1866
  add<ContextType, OptionsType>(rule: Rule<ContextType, OptionsType>, message: string, severity: number, node: DOMNode | null, location: Location_2, context: ContextType): void;
1823
1867
  addManual(filename: string, message: DeferredMessage): void;
1824
- save(sources?: Source[]): Report;
1868
+ save(sources?: Source[]): Report_2;
1825
1869
  protected isValid(): boolean;
1826
1870
  }
1827
1871
 
@@ -1904,7 +1948,7 @@ export declare interface Resolver {
1904
1948
  /**
1905
1949
  * Resolve table of element metadata.
1906
1950
  */
1907
- resolveElements?(id: string, options: ResolverOptions): unknown | null;
1951
+ resolveElements?(id: string, options: ResolverOptions): MetaDataTable | null;
1908
1952
  /**
1909
1953
  * Resolve a configuration to extend.
1910
1954
  */
@@ -2129,13 +2173,15 @@ export { SchemaObject }
2129
2173
  * @public
2130
2174
  */
2131
2175
  export declare class SchemaValidationError extends UserError {
2132
- filename: string | null;
2133
- private obj;
2134
- private schema;
2135
- private errors;
2176
+ /** Configuration filename the error originates from */
2177
+ readonly filename: string | null;
2178
+ /** Configuration object the error originates from */
2179
+ readonly obj: unknown;
2180
+ /** JSON schema used when validating the configuration */
2181
+ readonly schema: SchemaObject;
2182
+ /** List of schema validation errors */
2183
+ readonly errors: ErrorObject[];
2136
2184
  constructor(filename: string | null, message: string, obj: unknown, schema: SchemaObject, errors: ErrorObject[]);
2137
- prettyError(): string;
2138
- private getRawJSON;
2139
2185
  }
2140
2186
 
2141
2187
  /**
@@ -113,6 +113,21 @@ export declare interface AvailableFormatters {
113
113
  */
114
114
  export declare type CategoryOrTag = string;
115
115
 
116
+ /**
117
+ * Create a new resolver for NodeJS packages using `require(..)`.
118
+ *
119
+ * If the module name contains `<rootDir>` (e.g. `<rootDir/foo`) it will be
120
+ * expanded relative to the root directory either explicitly set by the
121
+ * `rootDir` parameter or determined automatically by the closest `package.json`
122
+ * file (starting at the current working directory).
123
+ *
124
+ * @public
125
+ * @since 8.8.0
126
+ */
127
+ export declare function cjsResolver(options?: {
128
+ rootDir?: string;
129
+ }): CommonJSResolver;
130
+
116
131
  /**
117
132
  * Checks text content of an element.
118
133
  *
@@ -147,7 +162,7 @@ export declare class CLI {
147
162
  * @public
148
163
  */
149
164
  expandFiles(patterns: string[], options?: ExpandOptions): string[];
150
- getFormatter(formatters: string): (report: Report) => string;
165
+ getFormatter(formatters: string): (report: Report_2) => string;
151
166
  /**
152
167
  * Initialize project with a new configuration.
153
168
  *
@@ -189,6 +204,14 @@ export declare interface CLIOptions {
189
204
 
190
205
  /* Excluded from this release type: CommentToken */
191
206
 
207
+ /**
208
+ * CommonJS resolver.
209
+ *
210
+ * @public
211
+ * @since 8.8.0
212
+ */
213
+ export declare type CommonJSResolver = Required<Resolver>;
214
+
192
215
  /**
193
216
  * Tests if plugin is compatible with html-validate library. Unless the `silent`
194
217
  * option is used a warning is displayed on the console.
@@ -337,6 +360,16 @@ export declare interface ConfigData {
337
360
  * If set to true no new configurations will be searched.
338
361
  */
339
362
  root?: boolean;
363
+ /**
364
+ * List of configuration presets to extend.
365
+ *
366
+ * The following sources are allowed:
367
+ *
368
+ * - One of the [predefined presets](http://html-validate.org/rules/presets.html).
369
+ * - Node module exporting a preset.
370
+ * - Plugin exporting a named preset.
371
+ * - Local path to a json or js file exporting a preset.
372
+ */
340
373
  extends?: string[];
341
374
  /**
342
375
  * List of sources for element metadata.
@@ -449,6 +482,14 @@ export declare interface DeferredMessage extends Omit<Message, "selector"> {
449
482
  selector: () => string | null;
450
483
  }
451
484
 
485
+ /**
486
+ * Helper function to assist IDE with completion and type-checking.
487
+ *
488
+ * @public
489
+ * @since
490
+ */
491
+ export declare function defineConfig(config: ConfigData): ConfigData;
492
+
452
493
  /**
453
494
  * Helper function to assist IDE with completion and type-checking.
454
495
  *
@@ -744,7 +785,7 @@ export declare type EventCallback = (event: string, data: any) => void;
744
785
  * @public
745
786
  */
746
787
  export declare class EventHandler {
747
- listeners: Record<string, EventCallback[]>;
788
+ private listeners;
748
789
  constructor();
749
790
  /**
750
791
  * Add an event listener.
@@ -770,6 +811,7 @@ export declare class EventHandler {
770
811
  * @param data - Event data.
771
812
  */
772
813
  trigger(event: string, data: any): void;
814
+ private getCallbacks;
773
815
  }
774
816
 
775
817
  /**
@@ -1125,13 +1167,13 @@ export declare class HtmlValidate {
1125
1167
  * @param hooks - Optional hooks (see [[Source]]) for definition.
1126
1168
  * @returns Report output.
1127
1169
  */
1128
- validateString(str: string): Promise<Report>;
1129
- validateString(str: string, filename: string): Promise<Report>;
1130
- validateString(str: string, hooks: SourceHooks): Promise<Report>;
1131
- validateString(str: string, options: ConfigData): Promise<Report>;
1132
- validateString(str: string, filename: string, hooks: SourceHooks): Promise<Report>;
1133
- validateString(str: string, filename: string, options: ConfigData): Promise<Report>;
1134
- validateString(str: string, filename: string, options: ConfigData, hooks: SourceHooks): Promise<Report>;
1170
+ validateString(str: string): Promise<Report_2>;
1171
+ validateString(str: string, filename: string): Promise<Report_2>;
1172
+ validateString(str: string, hooks: SourceHooks): Promise<Report_2>;
1173
+ validateString(str: string, options: ConfigData): Promise<Report_2>;
1174
+ validateString(str: string, filename: string, hooks: SourceHooks): Promise<Report_2>;
1175
+ validateString(str: string, filename: string, options: ConfigData): Promise<Report_2>;
1176
+ validateString(str: string, filename: string, options: ConfigData, hooks: SourceHooks): Promise<Report_2>;
1135
1177
  /**
1136
1178
  * Parse and validate HTML from string.
1137
1179
  *
@@ -1141,13 +1183,13 @@ export declare class HtmlValidate {
1141
1183
  * @param hooks - Optional hooks (see [[Source]]) for definition.
1142
1184
  * @returns Report output.
1143
1185
  */
1144
- validateStringSync(str: string): Report;
1145
- validateStringSync(str: string, filename: string): Report;
1146
- validateStringSync(str: string, hooks: SourceHooks): Report;
1147
- validateStringSync(str: string, options: ConfigData): Report;
1148
- validateStringSync(str: string, filename: string, hooks: SourceHooks): Report;
1149
- validateStringSync(str: string, filename: string, options: ConfigData): Report;
1150
- validateStringSync(str: string, filename: string, options: ConfigData, hooks: SourceHooks): Report;
1186
+ validateStringSync(str: string): Report_2;
1187
+ validateStringSync(str: string, filename: string): Report_2;
1188
+ validateStringSync(str: string, hooks: SourceHooks): Report_2;
1189
+ validateStringSync(str: string, options: ConfigData): Report_2;
1190
+ validateStringSync(str: string, filename: string, hooks: SourceHooks): Report_2;
1191
+ validateStringSync(str: string, filename: string, options: ConfigData): Report_2;
1192
+ validateStringSync(str: string, filename: string, options: ConfigData, hooks: SourceHooks): Report_2;
1151
1193
  /**
1152
1194
  * Parse and validate HTML from [[Source]].
1153
1195
  *
@@ -1155,7 +1197,7 @@ export declare class HtmlValidate {
1155
1197
  * @param input - Source to parse.
1156
1198
  * @returns Report output.
1157
1199
  */
1158
- validateSource(input: Source, configOverride?: ConfigData): Promise<Report>;
1200
+ validateSource(input: Source, configOverride?: ConfigData): Promise<Report_2>;
1159
1201
  /**
1160
1202
  * Parse and validate HTML from [[Source]].
1161
1203
  *
@@ -1163,7 +1205,7 @@ export declare class HtmlValidate {
1163
1205
  * @param input - Source to parse.
1164
1206
  * @returns Report output.
1165
1207
  */
1166
- validateSourceSync(input: Source, configOverride?: ConfigData): Report;
1208
+ validateSourceSync(input: Source, configOverride?: ConfigData): Report_2;
1167
1209
  /**
1168
1210
  * Parse and validate HTML from file.
1169
1211
  *
@@ -1171,7 +1213,7 @@ export declare class HtmlValidate {
1171
1213
  * @param filename - Filename to read and parse.
1172
1214
  * @returns Report output.
1173
1215
  */
1174
- validateFile(filename: string): Promise<Report>;
1216
+ validateFile(filename: string): Promise<Report_2>;
1175
1217
  /**
1176
1218
  * Parse and validate HTML from file.
1177
1219
  *
@@ -1179,7 +1221,7 @@ export declare class HtmlValidate {
1179
1221
  * @param filename - Filename to read and parse.
1180
1222
  * @returns Report output.
1181
1223
  */
1182
- validateFileSync(filename: string): Report;
1224
+ validateFileSync(filename: string): Report_2;
1183
1225
  /**
1184
1226
  * Parse and validate HTML from multiple files. Result is merged together to a
1185
1227
  * single report.
@@ -1187,7 +1229,7 @@ export declare class HtmlValidate {
1187
1229
  * @param filenames - Filenames to read and parse.
1188
1230
  * @returns Report output.
1189
1231
  */
1190
- validateMultipleFiles(filenames: string[]): Promise<Report>;
1232
+ validateMultipleFiles(filenames: string[]): Promise<Report_2>;
1191
1233
  /**
1192
1234
  * Parse and validate HTML from multiple files. Result is merged together to a
1193
1235
  * single report.
@@ -1195,7 +1237,7 @@ export declare class HtmlValidate {
1195
1237
  * @param filenames - Filenames to read and parse.
1196
1238
  * @returns Report output.
1197
1239
  */
1198
- validateMultipleFilesSync(filenames: string[]): Report;
1240
+ validateMultipleFilesSync(filenames: string[]): Report_2;
1199
1241
  /**
1200
1242
  * Returns true if the given filename can be validated.
1201
1243
  *
@@ -1598,6 +1640,8 @@ export declare interface MetaData {
1598
1640
  transparent?: boolean | string[];
1599
1641
  implicitClosed?: string[];
1600
1642
  scriptSupporting?: boolean;
1643
+ /** Mark element as able to receive focus (without explicit `tabindex`) */
1644
+ focusable?: boolean | MetaFocusableCallback;
1601
1645
  form?: boolean;
1602
1646
  /** Mark element as a form-associated element */
1603
1647
  formAssociated?: Partial<FormAssociated>;
@@ -1652,12 +1696,24 @@ export declare type MetaDataTable = Record<string, MetaData>;
1652
1696
  */
1653
1697
  export declare interface MetaElement extends Omit<MetaData, "deprecatedAttributes" | "requiredAttributes"> {
1654
1698
  tagName: string;
1699
+ focusable: boolean | MetaFocusableCallback;
1655
1700
  formAssociated?: FormAssociated;
1656
1701
  implicitRole: MetaImplicitRoleCallback;
1657
1702
  attributes: Record<string, MetaAttribute>;
1658
1703
  textContent?: TextContent;
1659
1704
  }
1660
1705
 
1706
+ /**
1707
+ * Callback for the `focusable` property of `MetaData`. It takes a node and
1708
+ * returns whenever the element is focusable or not.
1709
+ *
1710
+ * @public
1711
+ * @since 8.9.0
1712
+ * @param node - The node to determine if it is focusable.
1713
+ * @returns `true` if the node is focusable.
1714
+ */
1715
+ export declare type MetaFocusableCallback = (node: HtmlElementLike) => boolean;
1716
+
1661
1717
  /**
1662
1718
  * Callback for the `implicitRole` property of `MetaData`. It takes a node and
1663
1719
  * returns the implicit ARIA role, if any.
@@ -1675,7 +1731,7 @@ export declare type MetaImplicitRoleCallback = (node: HtmlElementLike) => string
1675
1731
  *
1676
1732
  * @public
1677
1733
  */
1678
- export declare type MetaLookupableProperty = "metadata" | "flow" | "sectioning" | "heading" | "phrasing" | "embedded" | "interactive" | "deprecated" | "foreign" | "void" | "transparent" | "scriptSupporting" | "form" | "formAssociated" | "labelable";
1734
+ export declare type MetaLookupableProperty = "metadata" | "flow" | "sectioning" | "heading" | "phrasing" | "embedded" | "interactive" | "deprecated" | "foreign" | "void" | "transparent" | "scriptSupporting" | "focusable" | "form" | "formAssociated" | "labelable";
1679
1735
 
1680
1736
  /**
1681
1737
  * @public
@@ -1756,9 +1812,10 @@ export declare enum NodeClosed {
1756
1812
  }
1757
1813
 
1758
1814
  /**
1759
- * NodeJS resolver.
1815
+ * CommonJS resolver.
1760
1816
  *
1761
1817
  * @public
1818
+ * @deprecated Deprecated alias for [[CommonJSResolver]].
1762
1819
  * @since 8.0.0
1763
1820
  */
1764
1821
  export declare type NodeJSResolver = Required<Resolver>;
@@ -1772,6 +1829,7 @@ export declare type NodeJSResolver = Required<Resolver>;
1772
1829
  * file (starting at the current working directory).
1773
1830
  *
1774
1831
  * @public
1832
+ * @deprecated Deprecated alias for [[commonjsResolver]].
1775
1833
  * @since 8.0.0
1776
1834
  */
1777
1835
  export declare function nodejsResolver(options?: {
@@ -2023,7 +2081,7 @@ export declare type PropertyExpression = string | [string, any];
2023
2081
  *
2024
2082
  * @public
2025
2083
  */
2026
- export declare interface Report {
2084
+ declare interface Report_2 {
2027
2085
  /** `true` if validation was successful */
2028
2086
  valid: boolean;
2029
2087
  /** Detailed results per validated source */
@@ -2033,6 +2091,7 @@ export declare interface Report {
2033
2091
  /** Total warnings of errors across all sources */
2034
2092
  warningCount: number;
2035
2093
  }
2094
+ export { Report_2 as Report }
2036
2095
 
2037
2096
  /**
2038
2097
  * @public
@@ -2042,11 +2101,21 @@ export declare class Reporter {
2042
2101
  constructor();
2043
2102
  /**
2044
2103
  * Merge two or more reports into a single one.
2104
+ *
2105
+ * @param reports- Reports to merge.
2106
+ * @returns A merged report.
2045
2107
  */
2046
- static merge(reports: Report[]): Report;
2108
+ static merge(reports: Report_2[]): Report_2;
2109
+ /**
2110
+ * Merge two or more reports into a single one.
2111
+ *
2112
+ * @param reports- Reports to merge.
2113
+ * @returns A promise resolved with the merged report.
2114
+ */
2115
+ static merge(reports: Promise<Report_2[]> | Array<Promise<Report_2>>): Promise<Report_2>;
2047
2116
  add<ContextType, OptionsType>(rule: Rule<ContextType, OptionsType>, message: string, severity: number, node: DOMNode | null, location: Location_2, context: ContextType): void;
2048
2117
  addManual(filename: string, message: DeferredMessage): void;
2049
- save(sources?: Source[]): Report;
2118
+ save(sources?: Source[]): Report_2;
2050
2119
  protected isValid(): boolean;
2051
2120
  }
2052
2121
 
@@ -2129,7 +2198,7 @@ export declare interface Resolver {
2129
2198
  /**
2130
2199
  * Resolve table of element metadata.
2131
2200
  */
2132
- resolveElements?(id: string, options: ResolverOptions): unknown | null;
2201
+ resolveElements?(id: string, options: ResolverOptions): MetaDataTable | null;
2133
2202
  /**
2134
2203
  * Resolve a configuration to extend.
2135
2204
  */
@@ -2354,13 +2423,15 @@ export { SchemaObject }
2354
2423
  * @public
2355
2424
  */
2356
2425
  export declare class SchemaValidationError extends UserError {
2357
- filename: string | null;
2358
- private obj;
2359
- private schema;
2360
- private errors;
2426
+ /** Configuration filename the error originates from */
2427
+ readonly filename: string | null;
2428
+ /** Configuration object the error originates from */
2429
+ readonly obj: unknown;
2430
+ /** JSON schema used when validating the configuration */
2431
+ readonly schema: SchemaObject;
2432
+ /** List of schema validation errors */
2433
+ readonly errors: ErrorObject[];
2361
2434
  constructor(filename: string | null, message: string, obj: unknown, schema: SchemaObject, errors: ErrorObject[]);
2362
- prettyError(): string;
2363
- private getRawJSON;
2364
2435
  }
2365
2436
 
2366
2437
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "html-validate",
3
- "version": "8.7.4",
3
+ "version": "8.9.0",
4
4
  "description": "Offline html5 validator",
5
5
  "keywords": [
6
6
  "html",
@@ -201,26 +201,25 @@
201
201
  "semver": "^7.0.0"
202
202
  },
203
203
  "devDependencies": {
204
- "@html-validate/commitlint-config": "3.0.27",
205
- "@html-validate/eslint-config": "5.12.1",
206
- "@html-validate/eslint-config-jest": "5.12.0",
207
- "@html-validate/eslint-config-typescript": "5.12.1",
208
- "@html-validate/eslint-config-typescript-typeinfo": "5.12.1",
204
+ "@html-validate/commitlint-config": "3.0.28",
205
+ "@html-validate/eslint-config": "5.12.6",
206
+ "@html-validate/eslint-config-jest": "5.12.6",
207
+ "@html-validate/eslint-config-typescript": "5.12.6",
208
+ "@html-validate/eslint-config-typescript-typeinfo": "5.12.6",
209
209
  "@html-validate/jest-config": "3.7.7",
210
- "@html-validate/prettier-config": "2.4.9",
211
- "@html-validate/release-scripts": "5.0.3",
212
- "@microsoft/api-extractor": "7.38.5",
210
+ "@html-validate/prettier-config": "2.4.10",
211
+ "@html-validate/release-scripts": "6.1.0",
212
+ "@microsoft/api-extractor": "7.39.1",
213
213
  "@rollup/plugin-commonjs": "25.0.7",
214
- "@rollup/plugin-json": "6.0.1",
214
+ "@rollup/plugin-json": "6.1.0",
215
215
  "@rollup/plugin-node-resolve": "15.2.3",
216
216
  "@rollup/plugin-replace": "5.0.5",
217
- "@rollup/plugin-typescript": "11.1.5",
218
217
  "@rollup/plugin-virtual": "3.0.2",
219
218
  "@types/babar": "0.2.4",
220
219
  "@types/babel__code-frame": "7.0.6",
221
220
  "@types/jest": "29.5.11",
222
221
  "@types/minimist": "1.2.5",
223
- "@types/node": "16.18.68",
222
+ "@types/node": "16.18.69",
224
223
  "@types/prompts": "2.4.9",
225
224
  "@types/semver": "7.5.6",
226
225
  "@types/stream-buffers": "3.0.7",
@@ -231,11 +230,12 @@
231
230
  "jest-diff": "29.7.0",
232
231
  "jest-environment-jsdom": "29.7.0",
233
232
  "jest-snapshot": "29.7.0",
234
- "marked": "11.0.1",
233
+ "marked": "11.1.1",
235
234
  "memfs": "4.6.0",
236
235
  "npm-pkg-lint": "2.1.0",
237
236
  "npm-run-all": "4.1.5",
238
- "rollup": "4.7.0",
237
+ "rollup": "4.9.4",
238
+ "rollup-plugin-esbuild": "6.1.0",
239
239
  "stream-buffers": "3.0.2",
240
240
  "ts-jest": "29.1.1",
241
241
  "typescript": "5.3.3"
@@ -275,7 +275,7 @@
275
275
  "semver"
276
276
  ],
277
277
  "overrides": {
278
- "marked": "11.0.1"
278
+ "marked": "11.1.1"
279
279
  },
280
280
  "renovate": {
281
281
  "extends": [