html-validate 8.7.3 → 8.8.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 (73) 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 +468 -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 +9511 -10450
  10. package/dist/cjs/core.js.map +1 -1
  11. package/dist/cjs/elements.js +2293 -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 +467 -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 +9506 -10451
  45. package/dist/es/core.js.map +1 -1
  46. package/dist/es/elements.js +2293 -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/tsdoc-metadata.json +1 -1
  71. package/dist/types/browser.d.ts +62 -30
  72. package/dist/types/index.d.ts +89 -32
  73. package/package.json +22 -18
@@ -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.
@@ -260,6 +283,7 @@ export declare class Config {
260
283
  * Load a default configuration object.
261
284
  */
262
285
  static defaultConfig(): Config;
286
+ /* Excluded from this release type: create */
263
287
  /* Excluded from this release type: __constructor */
264
288
  /**
265
289
  * Initialize plugins, transforms etc.
@@ -336,6 +360,16 @@ export declare interface ConfigData {
336
360
  * If set to true no new configurations will be searched.
337
361
  */
338
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
+ */
339
373
  extends?: string[];
340
374
  /**
341
375
  * List of sources for element metadata.
@@ -448,6 +482,14 @@ export declare interface DeferredMessage extends Omit<Message, "selector"> {
448
482
  selector: () => string | null;
449
483
  }
450
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
+
451
493
  /**
452
494
  * Helper function to assist IDE with completion and type-checking.
453
495
  *
@@ -1124,13 +1166,13 @@ export declare class HtmlValidate {
1124
1166
  * @param hooks - Optional hooks (see [[Source]]) for definition.
1125
1167
  * @returns Report output.
1126
1168
  */
1127
- validateString(str: string): Promise<Report>;
1128
- validateString(str: string, filename: string): Promise<Report>;
1129
- validateString(str: string, hooks: SourceHooks): Promise<Report>;
1130
- validateString(str: string, options: ConfigData): Promise<Report>;
1131
- validateString(str: string, filename: string, hooks: SourceHooks): Promise<Report>;
1132
- validateString(str: string, filename: string, options: ConfigData): Promise<Report>;
1133
- validateString(str: string, filename: string, options: ConfigData, hooks: SourceHooks): Promise<Report>;
1169
+ validateString(str: string): Promise<Report_2>;
1170
+ validateString(str: string, filename: string): Promise<Report_2>;
1171
+ validateString(str: string, hooks: SourceHooks): Promise<Report_2>;
1172
+ validateString(str: string, options: ConfigData): Promise<Report_2>;
1173
+ validateString(str: string, filename: string, hooks: SourceHooks): Promise<Report_2>;
1174
+ validateString(str: string, filename: string, options: ConfigData): Promise<Report_2>;
1175
+ validateString(str: string, filename: string, options: ConfigData, hooks: SourceHooks): Promise<Report_2>;
1134
1176
  /**
1135
1177
  * Parse and validate HTML from string.
1136
1178
  *
@@ -1140,13 +1182,13 @@ export declare class HtmlValidate {
1140
1182
  * @param hooks - Optional hooks (see [[Source]]) for definition.
1141
1183
  * @returns Report output.
1142
1184
  */
1143
- validateStringSync(str: string): Report;
1144
- validateStringSync(str: string, filename: string): Report;
1145
- validateStringSync(str: string, hooks: SourceHooks): Report;
1146
- validateStringSync(str: string, options: ConfigData): Report;
1147
- validateStringSync(str: string, filename: string, hooks: SourceHooks): Report;
1148
- validateStringSync(str: string, filename: string, options: ConfigData): Report;
1149
- validateStringSync(str: string, filename: string, options: ConfigData, hooks: SourceHooks): Report;
1185
+ validateStringSync(str: string): Report_2;
1186
+ validateStringSync(str: string, filename: string): Report_2;
1187
+ validateStringSync(str: string, hooks: SourceHooks): Report_2;
1188
+ validateStringSync(str: string, options: ConfigData): Report_2;
1189
+ validateStringSync(str: string, filename: string, hooks: SourceHooks): Report_2;
1190
+ validateStringSync(str: string, filename: string, options: ConfigData): Report_2;
1191
+ validateStringSync(str: string, filename: string, options: ConfigData, hooks: SourceHooks): Report_2;
1150
1192
  /**
1151
1193
  * Parse and validate HTML from [[Source]].
1152
1194
  *
@@ -1154,7 +1196,7 @@ export declare class HtmlValidate {
1154
1196
  * @param input - Source to parse.
1155
1197
  * @returns Report output.
1156
1198
  */
1157
- validateSource(input: Source, configOverride?: ConfigData): Promise<Report>;
1199
+ validateSource(input: Source, configOverride?: ConfigData): Promise<Report_2>;
1158
1200
  /**
1159
1201
  * Parse and validate HTML from [[Source]].
1160
1202
  *
@@ -1162,7 +1204,7 @@ export declare class HtmlValidate {
1162
1204
  * @param input - Source to parse.
1163
1205
  * @returns Report output.
1164
1206
  */
1165
- validateSourceSync(input: Source, configOverride?: ConfigData): Report;
1207
+ validateSourceSync(input: Source, configOverride?: ConfigData): Report_2;
1166
1208
  /**
1167
1209
  * Parse and validate HTML from file.
1168
1210
  *
@@ -1170,7 +1212,7 @@ export declare class HtmlValidate {
1170
1212
  * @param filename - Filename to read and parse.
1171
1213
  * @returns Report output.
1172
1214
  */
1173
- validateFile(filename: string): Promise<Report>;
1215
+ validateFile(filename: string): Promise<Report_2>;
1174
1216
  /**
1175
1217
  * Parse and validate HTML from file.
1176
1218
  *
@@ -1178,7 +1220,7 @@ export declare class HtmlValidate {
1178
1220
  * @param filename - Filename to read and parse.
1179
1221
  * @returns Report output.
1180
1222
  */
1181
- validateFileSync(filename: string): Report;
1223
+ validateFileSync(filename: string): Report_2;
1182
1224
  /**
1183
1225
  * Parse and validate HTML from multiple files. Result is merged together to a
1184
1226
  * single report.
@@ -1186,7 +1228,7 @@ export declare class HtmlValidate {
1186
1228
  * @param filenames - Filenames to read and parse.
1187
1229
  * @returns Report output.
1188
1230
  */
1189
- validateMultipleFiles(filenames: string[]): Promise<Report>;
1231
+ validateMultipleFiles(filenames: string[]): Promise<Report_2>;
1190
1232
  /**
1191
1233
  * Parse and validate HTML from multiple files. Result is merged together to a
1192
1234
  * single report.
@@ -1194,7 +1236,7 @@ export declare class HtmlValidate {
1194
1236
  * @param filenames - Filenames to read and parse.
1195
1237
  * @returns Report output.
1196
1238
  */
1197
- validateMultipleFilesSync(filenames: string[]): Report;
1239
+ validateMultipleFilesSync(filenames: string[]): Report_2;
1198
1240
  /**
1199
1241
  * Returns true if the given filename can be validated.
1200
1242
  *
@@ -1755,9 +1797,10 @@ export declare enum NodeClosed {
1755
1797
  }
1756
1798
 
1757
1799
  /**
1758
- * NodeJS resolver.
1800
+ * CommonJS resolver.
1759
1801
  *
1760
1802
  * @public
1803
+ * @deprecated Deprecated alias for [[CommonJSResolver]].
1761
1804
  * @since 8.0.0
1762
1805
  */
1763
1806
  export declare type NodeJSResolver = Required<Resolver>;
@@ -1771,6 +1814,7 @@ export declare type NodeJSResolver = Required<Resolver>;
1771
1814
  * file (starting at the current working directory).
1772
1815
  *
1773
1816
  * @public
1817
+ * @deprecated Deprecated alias for [[commonjsResolver]].
1774
1818
  * @since 8.0.0
1775
1819
  */
1776
1820
  export declare function nodejsResolver(options?: {
@@ -2022,7 +2066,7 @@ export declare type PropertyExpression = string | [string, any];
2022
2066
  *
2023
2067
  * @public
2024
2068
  */
2025
- export declare interface Report {
2069
+ declare interface Report_2 {
2026
2070
  /** `true` if validation was successful */
2027
2071
  valid: boolean;
2028
2072
  /** Detailed results per validated source */
@@ -2032,6 +2076,7 @@ export declare interface Report {
2032
2076
  /** Total warnings of errors across all sources */
2033
2077
  warningCount: number;
2034
2078
  }
2079
+ export { Report_2 as Report }
2035
2080
 
2036
2081
  /**
2037
2082
  * @public
@@ -2041,11 +2086,21 @@ export declare class Reporter {
2041
2086
  constructor();
2042
2087
  /**
2043
2088
  * Merge two or more reports into a single one.
2089
+ *
2090
+ * @param reports- Reports to merge.
2091
+ * @returns A merged report.
2092
+ */
2093
+ static merge(reports: Report_2[]): Report_2;
2094
+ /**
2095
+ * Merge two or more reports into a single one.
2096
+ *
2097
+ * @param reports- Reports to merge.
2098
+ * @returns A promise resolved with the merged report.
2044
2099
  */
2045
- static merge(reports: Report[]): Report;
2100
+ static merge(reports: Promise<Report_2[]> | Array<Promise<Report_2>>): Promise<Report_2>;
2046
2101
  add<ContextType, OptionsType>(rule: Rule<ContextType, OptionsType>, message: string, severity: number, node: DOMNode | null, location: Location_2, context: ContextType): void;
2047
2102
  addManual(filename: string, message: DeferredMessage): void;
2048
- save(sources?: Source[]): Report;
2103
+ save(sources?: Source[]): Report_2;
2049
2104
  protected isValid(): boolean;
2050
2105
  }
2051
2106
 
@@ -2128,7 +2183,7 @@ export declare interface Resolver {
2128
2183
  /**
2129
2184
  * Resolve table of element metadata.
2130
2185
  */
2131
- resolveElements?(id: string, options: ResolverOptions): unknown | null;
2186
+ resolveElements?(id: string, options: ResolverOptions): MetaDataTable | null;
2132
2187
  /**
2133
2188
  * Resolve a configuration to extend.
2134
2189
  */
@@ -2353,13 +2408,15 @@ export { SchemaObject }
2353
2408
  * @public
2354
2409
  */
2355
2410
  export declare class SchemaValidationError extends UserError {
2356
- filename: string | null;
2357
- private obj;
2358
- private schema;
2359
- private errors;
2411
+ /** Configuration filename the error originates from */
2412
+ readonly filename: string | null;
2413
+ /** Configuration object the error originates from */
2414
+ readonly obj: unknown;
2415
+ /** JSON schema used when validating the configuration */
2416
+ readonly schema: SchemaObject;
2417
+ /** List of schema validation errors */
2418
+ readonly errors: ErrorObject[];
2360
2419
  constructor(filename: string | null, message: string, obj: unknown, schema: SchemaObject, errors: ErrorObject[]);
2361
- prettyError(): string;
2362
- private getRawJSON;
2363
2420
  }
2364
2421
 
2365
2422
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "html-validate",
3
- "version": "8.7.3",
3
+ "version": "8.8.0",
4
4
  "description": "Offline html5 validator",
5
5
  "keywords": [
6
6
  "html",
@@ -190,7 +190,7 @@
190
190
  "dependencies": {
191
191
  "@babel/code-frame": "^7.10.0",
192
192
  "@html-validate/stylish": "^4.1.0",
193
- "@sidvind/better-ajv-errors": "^2.0.0",
193
+ "@sidvind/better-ajv-errors": "2.1.3",
194
194
  "ajv": "^8.0.0",
195
195
  "deepmerge": "4.3.1",
196
196
  "glob": "^10.0.0",
@@ -201,26 +201,25 @@
201
201
  "semver": "^7.0.0"
202
202
  },
203
203
  "devDependencies": {
204
- "@html-validate/commitlint-config": "3.0.26",
205
- "@html-validate/eslint-config": "5.11.12",
206
- "@html-validate/eslint-config-jest": "5.11.12",
207
- "@html-validate/eslint-config-typescript": "5.11.12",
208
- "@html-validate/eslint-config-typescript-typeinfo": "5.11.12",
204
+ "@html-validate/commitlint-config": "3.0.27",
205
+ "@html-validate/eslint-config": "5.12.4",
206
+ "@html-validate/eslint-config-jest": "5.12.0",
207
+ "@html-validate/eslint-config-typescript": "5.12.4",
208
+ "@html-validate/eslint-config-typescript-typeinfo": "5.12.4",
209
209
  "@html-validate/jest-config": "3.7.7",
210
- "@html-validate/prettier-config": "2.4.9",
211
- "@html-validate/release-scripts": "5.0.2",
212
- "@microsoft/api-extractor": "7.38.3",
210
+ "@html-validate/prettier-config": "2.4.10",
211
+ "@html-validate/release-scripts": "5.0.4",
212
+ "@microsoft/api-extractor": "7.39.0",
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
- "@types/jest": "29.5.10",
220
+ "@types/jest": "29.5.11",
222
221
  "@types/minimist": "1.2.5",
223
- "@types/node": "16.18.64",
222
+ "@types/node": "16.18.68",
224
223
  "@types/prompts": "2.4.9",
225
224
  "@types/semver": "7.5.6",
226
225
  "@types/stream-buffers": "3.0.7",
@@ -231,19 +230,21 @@
231
230
  "jest-diff": "29.7.0",
232
231
  "jest-environment-jsdom": "29.7.0",
233
232
  "jest-snapshot": "29.7.0",
233
+ "marked": "11.1.0",
234
234
  "memfs": "4.6.0",
235
235
  "npm-pkg-lint": "2.1.0",
236
236
  "npm-run-all": "4.1.5",
237
- "rollup": "4.5.1",
237
+ "rollup": "4.9.1",
238
+ "rollup-plugin-esbuild": "6.1.0",
238
239
  "stream-buffers": "3.0.2",
239
240
  "ts-jest": "29.1.1",
240
- "typescript": "5.3.2"
241
+ "typescript": "5.3.3"
241
242
  },
242
243
  "peerDependencies": {
243
244
  "jest": "^27.1 || ^28.1.3 || ^29.0.3",
244
245
  "jest-diff": "^27.1 || ^28.1.3 || ^29.0.3",
245
246
  "jest-snapshot": "^27.1 || ^28.1.3 || ^29.0.3",
246
- "vitest": "^0.34"
247
+ "vitest": "^0.34 || ^1"
247
248
  },
248
249
  "peerDependenciesMeta": {
249
250
  "jest": {
@@ -260,7 +261,7 @@
260
261
  }
261
262
  },
262
263
  "engines": {
263
- "node": ">= 16.0"
264
+ "node": ">= 16.14"
264
265
  },
265
266
  "externalDependencies": [
266
267
  "@babel/code-frame",
@@ -273,6 +274,9 @@
273
274
  "prompts",
274
275
  "semver"
275
276
  ],
277
+ "overrides": {
278
+ "marked": "11.1.0"
279
+ },
276
280
  "renovate": {
277
281
  "extends": [
278
282
  "gitlab>html-validate/renovate-config"