html-validate 7.18.1 → 8.0.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.
@@ -176,6 +176,7 @@ export declare class CLI {
176
176
  */
177
177
  getValidator(): HtmlValidate;
178
178
  /* Excluded from this release type: getConfig */
179
+ private resolveConfig;
179
180
  }
180
181
 
181
182
  /**
@@ -193,6 +194,7 @@ export declare interface CLIOptions {
193
194
  * option is used a warning is displayed on the console.
194
195
  *
195
196
  * @public
197
+ * @since v5.0.0
196
198
  * @param name - Name of plugin
197
199
  * @param declared - What library versions the plugin support (e.g. declared peerDependencies)
198
200
  * @returns - `true` if version is compatible
@@ -239,10 +241,10 @@ export declare class Config {
239
241
  private config;
240
242
  private configurations;
241
243
  private initialized;
244
+ private resolvers;
242
245
  private metaTable;
243
246
  private plugins;
244
247
  private transformers;
245
- private rootDir;
246
248
  /**
247
249
  * Create a new blank configuration. See also `Config.defaultConfig()`.
248
250
  */
@@ -250,7 +252,7 @@ export declare class Config {
250
252
  /**
251
253
  * Create configuration from object.
252
254
  */
253
- static fromObject(options: ConfigData, filename?: string | null): Config;
255
+ static fromObject(resolvers: Resolver | Resolver[], options: ConfigData, filename?: string | null): Config;
254
256
  /* Excluded from this release type: fromFile */
255
257
  /* Excluded from this release type: validate */
256
258
  /**
@@ -278,10 +280,9 @@ export declare class Config {
278
280
  * @public
279
281
  * @param rhs - Configuration to merge with this one.
280
282
  */
281
- merge(rhs: Config): Config;
283
+ merge(resolvers: Resolver[], rhs: Config): Config;
282
284
  private extendConfig;
283
285
  /* Excluded from this release type: getMetaTable */
284
- /* Excluded from this release type: expandRelative */
285
286
  /* Excluded from this release type: get */
286
287
  /* Excluded from this release type: getRules */
287
288
  private static getRulesObject;
@@ -324,9 +325,6 @@ export declare class Config {
324
325
  */
325
326
  private getUnnamedTransformerFromPlugin;
326
327
  private getTransformerFromModule;
327
- /* Excluded from this release type: rootDirCache */
328
- /* Excluded from this release type: rootDirCache */
329
- /* Excluded from this release type: findRootDir */
330
328
  }
331
329
 
332
330
  /**
@@ -382,16 +380,6 @@ export declare class ConfigError extends UserError {
382
380
  constructor(message: string, nested?: Error);
383
381
  }
384
382
 
385
- /**
386
- * @public
387
- */
388
- export declare interface ConfigFactory {
389
- defaultConfig(): Config;
390
- empty(): Config;
391
- fromObject(options: ConfigData, filename?: string | null): Config;
392
- fromFile(filename: string): Config;
393
- }
394
-
395
383
  /**
396
384
  * Configuration loader interface.
397
385
  *
@@ -401,9 +389,9 @@ export declare interface ConfigFactory {
401
389
  * @public
402
390
  */
403
391
  export declare abstract class ConfigLoader {
404
- protected readonly configFactory: ConfigFactory;
392
+ protected readonly resolvers: Resolver[];
405
393
  protected readonly globalConfig: Config;
406
- constructor(config?: ConfigData, configFactory?: ConfigFactory);
394
+ constructor(resolvers: Resolver[], config?: ConfigData);
407
395
  /**
408
396
  * Get configuration for given handle.
409
397
  *
@@ -412,13 +400,10 @@ export declare abstract class ConfigLoader {
412
400
  *
413
401
  * If [[configOverride]] is set it is merged with the final result.
414
402
  *
415
- * Returning a [[Config]] instance is deprecated and support will be removed
416
- * in the next major release.
417
- *
418
403
  * @param handle - Unique handle to get configuration for.
419
404
  * @param configOverride - Optional configuration to merge final results with.
420
405
  */
421
- abstract getConfigFor(handle: string, configOverride?: ConfigData): Config | ResolvedConfig;
406
+ abstract getConfigFor(handle: string, configOverride?: ConfigData): ResolvedConfig;
422
407
  /**
423
408
  * Flush configuration cache.
424
409
  *
@@ -427,6 +412,7 @@ export declare abstract class ConfigLoader {
427
412
  * @param handle - If given only the cache for given handle will be flushed.
428
413
  */
429
414
  abstract flushCache(handle?: string): void;
415
+ /* Excluded from this release type: _getGlobalConfig */
430
416
  /**
431
417
  * Default configuration used when no explicit configuration is passed to constructor.
432
418
  */
@@ -832,11 +818,24 @@ export declare interface ExpandOptions {
832
818
  */
833
819
  export declare class FileSystemConfigLoader extends ConfigLoader {
834
820
  protected cache: Map<string, Config | null>;
821
+ private fs;
835
822
  /**
836
- * @param config - Global configuration
837
- * @param configFactory - Optional configuration factory
823
+ * Create a filesystem configuration loader with default resolvers.
824
+ *
825
+ * @param fs - `fs` implementation,
826
+ * @param config - Global configuration.
827
+ * @param configFactory - Optional configuration factory.
838
828
  */
839
- constructor(config?: ConfigData, configFactory?: ConfigFactory);
829
+ constructor(config?: ConfigData, options?: Partial<FileSystemConfigLoaderOptions>);
830
+ /**
831
+ * Create a filesystem configuration loader with custom resolvers.
832
+ *
833
+ * @param fs - `fs` implementation,
834
+ * @param resolvers - Resolvers to use.
835
+ * @param config - Global configuration.
836
+ * @param configFactory - Optional configuration factory.
837
+ */
838
+ constructor(resolvers: Resolver[], config?: ConfigData, options?: Partial<FileSystemConfigLoaderOptions>);
840
839
  /**
841
840
  * Get configuration for given filename.
842
841
  *
@@ -857,9 +856,20 @@ export declare class FileSystemConfigLoader extends ConfigLoader {
857
856
  * `null` if no configuration files are found.
858
857
  */
859
858
  fromFilename(filename: string): Config | null;
859
+ /* Excluded from this release type: _getInternalCache */
860
860
  protected defaultConfig(): Config;
861
861
  }
862
862
 
863
+ /**
864
+ * Options for [[FileSystemConfigLoader]].
865
+ *
866
+ * @public
867
+ */
868
+ export declare interface FileSystemConfigLoaderOptions {
869
+ /** An implementation of `fs` as needed by [[FileSystemConfigLoader]] */
870
+ fs: FSLike;
871
+ }
872
+
863
873
  /**
864
874
  * @public
865
875
  */
@@ -887,6 +897,13 @@ export declare function formatterFactory(name: keyof AvailableFormatters): Forma
887
897
  */
888
898
  export declare function formatterFactory(name: string): Formatter | null;
889
899
 
900
+ /**
901
+ * @public
902
+ */
903
+ export declare interface FSLike {
904
+ existsSync(path: string): boolean;
905
+ }
906
+
890
907
  /**
891
908
  * @public
892
909
  */
@@ -1094,13 +1111,29 @@ export declare class HtmlValidate {
1094
1111
  * @param hooks - Optional hooks (see [[Source]]) for definition.
1095
1112
  * @returns Report output.
1096
1113
  */
1097
- validateString(str: string): Report;
1098
- validateString(str: string, filename: string): Report;
1099
- validateString(str: string, hooks: SourceHooks): Report;
1100
- validateString(str: string, options: ConfigData): Report;
1101
- validateString(str: string, filename: string, hooks: SourceHooks): Report;
1102
- validateString(str: string, filename: string, options: ConfigData): Report;
1103
- validateString(str: string, filename: string, options: ConfigData, hooks: SourceHooks): Report;
1114
+ validateString(str: string): Promise<Report>;
1115
+ validateString(str: string, filename: string): Promise<Report>;
1116
+ validateString(str: string, hooks: SourceHooks): Promise<Report>;
1117
+ validateString(str: string, options: ConfigData): Promise<Report>;
1118
+ validateString(str: string, filename: string, hooks: SourceHooks): Promise<Report>;
1119
+ validateString(str: string, filename: string, options: ConfigData): Promise<Report>;
1120
+ validateString(str: string, filename: string, options: ConfigData, hooks: SourceHooks): Promise<Report>;
1121
+ /**
1122
+ * Parse and validate HTML from string.
1123
+ *
1124
+ * @public
1125
+ * @param str - Text to parse.
1126
+ * @param filename - If set configuration is loaded for given filename.
1127
+ * @param hooks - Optional hooks (see [[Source]]) for definition.
1128
+ * @returns Report output.
1129
+ */
1130
+ validateStringSync(str: string): Report;
1131
+ validateStringSync(str: string, filename: string): Report;
1132
+ validateStringSync(str: string, hooks: SourceHooks): Report;
1133
+ validateStringSync(str: string, options: ConfigData): Report;
1134
+ validateStringSync(str: string, filename: string, hooks: SourceHooks): Report;
1135
+ validateStringSync(str: string, filename: string, options: ConfigData): Report;
1136
+ validateStringSync(str: string, filename: string, options: ConfigData, hooks: SourceHooks): Report;
1104
1137
  /**
1105
1138
  * Parse and validate HTML from [[Source]].
1106
1139
  *
@@ -1108,7 +1141,23 @@ export declare class HtmlValidate {
1108
1141
  * @param input - Source to parse.
1109
1142
  * @returns Report output.
1110
1143
  */
1111
- validateSource(input: Source, configOverride?: ConfigData): Report;
1144
+ validateSource(input: Source, configOverride?: ConfigData): Promise<Report>;
1145
+ /**
1146
+ * Parse and validate HTML from [[Source]].
1147
+ *
1148
+ * @public
1149
+ * @param input - Source to parse.
1150
+ * @returns Report output.
1151
+ */
1152
+ validateSourceSync(input: Source, configOverride?: ConfigData): Report;
1153
+ /**
1154
+ * Parse and validate HTML from file.
1155
+ *
1156
+ * @public
1157
+ * @param filename - Filename to read and parse.
1158
+ * @returns Report output.
1159
+ */
1160
+ validateFile(filename: string): Promise<Report>;
1112
1161
  /**
1113
1162
  * Parse and validate HTML from file.
1114
1163
  *
@@ -1116,7 +1165,15 @@ export declare class HtmlValidate {
1116
1165
  * @param filename - Filename to read and parse.
1117
1166
  * @returns Report output.
1118
1167
  */
1119
- validateFile(filename: string): Report;
1168
+ validateFileSync(filename: string): Report;
1169
+ /**
1170
+ * Parse and validate HTML from multiple files. Result is merged together to a
1171
+ * single report.
1172
+ *
1173
+ * @param filenames - Filenames to read and parse.
1174
+ * @returns Report output.
1175
+ */
1176
+ validateMultipleFiles(filenames: string[]): Promise<Report>;
1120
1177
  /**
1121
1178
  * Parse and validate HTML from multiple files. Result is merged together to a
1122
1179
  * single report.
@@ -1124,7 +1181,17 @@ export declare class HtmlValidate {
1124
1181
  * @param filenames - Filenames to read and parse.
1125
1182
  * @returns Report output.
1126
1183
  */
1127
- validateMultipleFiles(filenames: string[]): Report;
1184
+ validateMultipleFilesSync(filenames: string[]): Report;
1185
+ /**
1186
+ * Returns true if the given filename can be validated.
1187
+ *
1188
+ * A file is considered to be validatable if the extension is `.html` or if a
1189
+ * transformer matches the filename.
1190
+ *
1191
+ * This is mostly useful for tooling to determine whenever to validate the
1192
+ * file or not. CLI tools will run on all the given files anyway.
1193
+ */
1194
+ canValidate(filename: string): Promise<boolean>;
1128
1195
  /**
1129
1196
  * Returns true if the given filename can be validated.
1130
1197
  *
@@ -1134,7 +1201,7 @@ export declare class HtmlValidate {
1134
1201
  * This is mostly useful for tooling to determine whenever to validate the
1135
1202
  * file or not. CLI tools will run on all the given files anyway.
1136
1203
  */
1137
- canValidate(filename: string): boolean;
1204
+ canValidateSync(filename: string): boolean;
1138
1205
  /* Excluded from this release type: dumpTokens */
1139
1206
  /* Excluded from this release type: dumpEvents */
1140
1207
  /* Excluded from this release type: dumpTree */
@@ -1151,30 +1218,202 @@ export declare class HtmlValidate {
1151
1218
  * handled by html-validate but the path will be used when resolving
1152
1219
  * configuration. As a rule-of-thumb, set it to the elements json file.
1153
1220
  */
1154
- getElementsSchema(filename?: string): SchemaObject;
1221
+ getElementsSchema(filename?: string): Promise<SchemaObject>;
1222
+ /**
1223
+ * Get effective metadata element schema.
1224
+ *
1225
+ * If a filename is given the configured plugins can extend the
1226
+ * schema. Filename must not be an existing file or a filetype normally
1227
+ * handled by html-validate but the path will be used when resolving
1228
+ * configuration. As a rule-of-thumb, set it to the elements json file.
1229
+ */
1230
+ getElementsSchemaSync(filename?: string): SchemaObject;
1231
+ /**
1232
+ * Get contextual documentation for the given rule. The default configuration
1233
+ * will be used.
1234
+ *
1235
+ * @example
1236
+ *
1237
+ * ```js
1238
+ * const report = await htmlvalidate.validateFile("my-file.html");
1239
+ * for (const result of report.results){
1240
+ * for (const message of result.messages){
1241
+ * const documentation = await htmlvalidate.getRuleDocumentation(message, result.filePath);
1242
+ * // do something with documentation
1243
+ * }
1244
+ * }
1245
+ * ```
1246
+ *
1247
+ * @public
1248
+ * @since 8.0.0
1249
+ * @param message - Message reported during validation
1250
+ * @returns Contextual documentation or `null` if the rule does not exist.
1251
+ */
1252
+ getContextualDocumentation(message: Pick<Message, "ruleId" | "context">): Promise<RuleDocumentation | null>;
1253
+ /**
1254
+ * Get contextual documentation for the given rule. Configuration will be
1255
+ * resolved for given filename.
1256
+ *
1257
+ * @example
1258
+ *
1259
+ * ```js
1260
+ * const report = await htmlvalidate.validateFile("my-file.html");
1261
+ * for (const result of report.results){
1262
+ * for (const message of result.messages){
1263
+ * const documentation = await htmlvalidate.getRuleDocumentation(message, result.filePath);
1264
+ * // do something with documentation
1265
+ * }
1266
+ * }
1267
+ * ```
1268
+ *
1269
+ * @public
1270
+ * @since 8.0.0
1271
+ * @param message - Message reported during validation
1272
+ * @param filename - Filename used to resolve configuration.
1273
+ * @returns Contextual documentation or `null` if the rule does not exist.
1274
+ */
1275
+ getContextualDocumentation(message: Pick<Message, "ruleId" | "context">, filename: string): Promise<RuleDocumentation | null>;
1276
+ /**
1277
+ * Get contextual documentation for the given rule using provided
1278
+ * configuration.
1279
+ *
1280
+ * @example
1281
+ *
1282
+ * ```js
1283
+ * const report = await htmlvalidate.validateFile("my-file.html");
1284
+ * for (const result of report.results){
1285
+ * for (const message of result.messages){
1286
+ * const documentation = await htmlvalidate.getRuleDocumentation(message, result.filePath);
1287
+ * // do something with documentation
1288
+ * }
1289
+ * }
1290
+ * ```
1291
+ *
1292
+ * @public
1293
+ * @since 8.0.0
1294
+ * @param message - Message reported during validation
1295
+ * @param config - Configuration to use.
1296
+ * @returns Contextual documentation or `null` if the rule does not exist.
1297
+ */
1298
+ getContextualDocumentation(message: Pick<Message, "ruleId" | "context">, config: ResolvedConfig | Promise<ResolvedConfig>): Promise<RuleDocumentation | null>;
1299
+ /**
1300
+ * Get contextual documentation for the given rule. The default configuration
1301
+ * will be used.
1302
+ *
1303
+ * @example
1304
+ *
1305
+ * ```js
1306
+ * const report = htmlvalidate.validateFileSync("my-file.html");
1307
+ * for (const result of report.results){
1308
+ * for (const message of result.messages){
1309
+ * const documentation = htmlvalidate.getRuleDocumentationSync(message, result.filePath);
1310
+ * // do something with documentation
1311
+ * }
1312
+ * }
1313
+ * ```
1314
+ *
1315
+ * @public
1316
+ * @since 8.0.0
1317
+ * @param message - Message reported during validation
1318
+ * @returns Contextual documentation or `null` if the rule does not exist.
1319
+ */
1320
+ getContextualDocumentationSync(message: Pick<Message, "ruleId" | "context">): RuleDocumentation | null;
1321
+ /**
1322
+ * Get contextual documentation for the given rule. Configuration will be
1323
+ * resolved for given filename.
1324
+ *
1325
+ * @example
1326
+ *
1327
+ * ```js
1328
+ * const report = htmlvalidate.validateFileSync("my-file.html");
1329
+ * for (const result of report.results){
1330
+ * for (const message of result.messages){
1331
+ * const documentation = htmlvalidate.getRuleDocumentationSync(message, result.filePath);
1332
+ * // do something with documentation
1333
+ * }
1334
+ * }
1335
+ * ```
1336
+ *
1337
+ * @public
1338
+ * @since 8.0.0
1339
+ * @param message - Message reported during validation
1340
+ * @param filename - Filename used to resolve configuration.
1341
+ * @returns Contextual documentation or `null` if the rule does not exist.
1342
+ */
1343
+ getContextualDocumentationSync(message: Pick<Message, "ruleId" | "context">, filename: string): RuleDocumentation | null;
1344
+ /**
1345
+ * Get contextual documentation for the given rule using provided
1346
+ * configuration.
1347
+ *
1348
+ * @example
1349
+ *
1350
+ * ```js
1351
+ * const report = htmlvalidate.validateFileSync("my-file.html");
1352
+ * for (const result of report.results){
1353
+ * for (const message of result.messages){
1354
+ * const documentation = htmlvalidate.getRuleDocumentationSync(message, result.filePath);
1355
+ * // do something with documentation
1356
+ * }
1357
+ * }
1358
+ * ```
1359
+ *
1360
+ * @public
1361
+ * @since 8.0.0
1362
+ * @param message - Message reported during validation
1363
+ * @param config - Configuration to use.
1364
+ * @returns Contextual documentation or `null` if the rule does not exist.
1365
+ */
1366
+ getContextualDocumentationSync(message: Pick<Message, "ruleId" | "context">, config: ResolvedConfig): RuleDocumentation | null;
1155
1367
  /**
1156
1368
  * Get contextual documentation for the given rule.
1157
1369
  *
1158
1370
  * Typical usage:
1159
1371
  *
1160
1372
  * ```js
1161
- * const report = htmlvalidate.validateFile("my-file.html");
1373
+ * const report = await htmlvalidate.validateFile("my-file.html");
1162
1374
  * for (const result of report.results){
1163
- * const config = htmlvalidate.getConfigFor(result.filePath);
1375
+ * const config = await htmlvalidate.getConfigFor(result.filePath);
1164
1376
  * for (const message of result.messages){
1165
- * const documentation = htmlvalidate.getRuleDocumentation(message.ruleId, config, message.context);
1377
+ * const documentation = await htmlvalidate.getRuleDocumentation(message.ruleId, config, message.context);
1166
1378
  * // do something with documentation
1167
1379
  * }
1168
1380
  * }
1169
1381
  * ```
1170
1382
  *
1383
+ * @public
1384
+ * @deprecated Deprecated since 8.0.0, use [[getContextualDocumentation]] instead.
1171
1385
  * @param ruleId - Rule to get documentation for.
1172
1386
  * @param config - If set it provides more accurate description by using the
1173
1387
  * correct configuration for the file.
1174
1388
  * @param context - If set to `Message.context` some rules can provide
1175
1389
  * contextual details and suggestions.
1176
1390
  */
1177
- getRuleDocumentation(ruleId: string, config?: ResolvedConfig | null, context?: any | null): RuleDocumentation | null;
1391
+ getRuleDocumentation(ruleId: string, config?: ResolvedConfig | Promise<ResolvedConfig> | null, context?: unknown | null): Promise<RuleDocumentation | null>;
1392
+ /**
1393
+ * Get contextual documentation for the given rule.
1394
+ *
1395
+ * Typical usage:
1396
+ *
1397
+ * ```js
1398
+ * const report = htmlvalidate.validateFileSync("my-file.html");
1399
+ * for (const result of report.results){
1400
+ * const config = htmlvalidate.getConfigForSync(result.filePath);
1401
+ * for (const message of result.messages){
1402
+ * const documentation = htmlvalidate.getRuleDocumentationSync(message.ruleId, config, message.context);
1403
+ * // do something with documentation
1404
+ * }
1405
+ * }
1406
+ * ```
1407
+ *
1408
+ * @public
1409
+ * @deprecated Deprecated since 8.0.0, use [[getContextualDocumentationSync]] instead.
1410
+ * @param ruleId - Rule to get documentation for.
1411
+ * @param config - If set it provides more accurate description by using the
1412
+ * correct configuration for the file.
1413
+ * @param context - If set to `Message.context` some rules can provide
1414
+ * contextual details and suggestions.
1415
+ */
1416
+ getRuleDocumentationSync(ruleId: string, config?: ResolvedConfig | null, context?: unknown | null): RuleDocumentation | null;
1178
1417
  /* Excluded from this release type: getParserFor */
1179
1418
  /**
1180
1419
  * Get configuration for given filename.
@@ -1185,7 +1424,17 @@ export declare class HtmlValidate {
1185
1424
  * @param filename - Filename to get configuration for.
1186
1425
  * @param configOverride - Configuration to apply last.
1187
1426
  */
1188
- getConfigFor(filename: string, configOverride?: ConfigData): ResolvedConfig;
1427
+ getConfigFor(filename: string, configOverride?: ConfigData): Promise<ResolvedConfig>;
1428
+ /**
1429
+ * Get configuration for given filename.
1430
+ *
1431
+ * See [[FileSystemConfigLoader]] for details.
1432
+ *
1433
+ * @public
1434
+ * @param filename - Filename to get configuration for.
1435
+ * @param configOverride - Configuration to apply last.
1436
+ */
1437
+ getConfigForSync(filename: string, configOverride?: ConfigData): ResolvedConfig;
1189
1438
  /**
1190
1439
  * Flush configuration cache. Clears full cache unless a filename is given.
1191
1440
  *
@@ -1493,6 +1742,29 @@ export declare enum NodeClosed {
1493
1742
  ImplicitClosed = 4
1494
1743
  }
1495
1744
 
1745
+ /**
1746
+ * NodeJS resolver.
1747
+ *
1748
+ * @public
1749
+ * @since 8.0.0
1750
+ */
1751
+ export declare type NodeJSResolver = Required<Resolver>;
1752
+
1753
+ /**
1754
+ * Create a new resolver for NodeJS packages using `require(..)`.
1755
+ *
1756
+ * If the module name contains `<rootDir>` (e.g. `<rootDir/foo`) it will be
1757
+ * expanded relative to the root directory either explicitly set by the
1758
+ * `rootDir` parameter or determined automatically by the closest `package.json`
1759
+ * file (starting at the current working directory).
1760
+ *
1761
+ * @public
1762
+ * @since 8.0.0
1763
+ */
1764
+ export declare function nodejsResolver(options?: {
1765
+ rootDir?: string;
1766
+ }): NodeJSResolver;
1767
+
1496
1768
  /**
1497
1769
  * @public
1498
1770
  */
@@ -1759,7 +2031,7 @@ export declare class Reporter {
1759
2031
  * Merge two or more reports into a single one.
1760
2032
  */
1761
2033
  static merge(reports: Report[]): Report;
1762
- add<ContextType, OptionsType>(rule: Rule<ContextType, OptionsType>, message: string, severity: number, node: DOMNode | null, location: Location_2, context?: ContextType): void;
2034
+ add<ContextType, OptionsType>(rule: Rule<ContextType, OptionsType>, message: string, severity: number, node: DOMNode | null, location: Location_2, context: ContextType): void;
1763
2035
  addManual(filename: string, message: DeferredMessage): void;
1764
2036
  save(sources?: Source[]): Report;
1765
2037
  protected isValid(): boolean;
@@ -1834,6 +2106,39 @@ export declare interface ResolvedConfigData {
1834
2106
  transformers: TransformerEntry[];
1835
2107
  }
1836
2108
 
2109
+ /**
2110
+ * @public
2111
+ * @since 8.0.0
2112
+ */
2113
+ export declare interface Resolver {
2114
+ /** Name of resolver, mostly for ease of debugging */
2115
+ name: string;
2116
+ /**
2117
+ * Resolve table of element metadata.
2118
+ */
2119
+ resolveElements?(id: string, options: ResolverOptions): unknown | null;
2120
+ /**
2121
+ * Resolve a configuration to extend.
2122
+ */
2123
+ resolveConfig?(id: string, options: ResolverOptions): ConfigData | null;
2124
+ /**
2125
+ * Resolve a plugin.
2126
+ */
2127
+ resolvePlugin?(id: string, options: ResolverOptions): Plugin_2 | null;
2128
+ /**
2129
+ * Resolve a transformer.
2130
+ */
2131
+ resolveTransformer?(id: string, options: ResolverOptions): Transformer_2 | null;
2132
+ }
2133
+
2134
+ /**
2135
+ * @public
2136
+ * @since 8.0.0
2137
+ */
2138
+ export declare interface ResolverOptions {
2139
+ cache: boolean;
2140
+ }
2141
+
1837
2142
  /**
1838
2143
  * @public
1839
2144
  */
@@ -1974,11 +2279,13 @@ export declare abstract class Rule<ContextType = void, OptionsType = void> {
1974
2279
  * Called when requesting additional documentation for a rule. Some rules
1975
2280
  * provide additional context to provide context-aware suggestions.
1976
2281
  *
2282
+ * @public
2283
+ * @virtual
1977
2284
  * @param context - Error context given by a reported error.
1978
2285
  * @returns Rule documentation and url with additional details or `null` if no
1979
2286
  * additional documentation is available.
1980
2287
  */
1981
- documentation(context?: ContextType): RuleDocumentation | null;
2288
+ documentation(context: ContextType): RuleDocumentation | null;
1982
2289
  }
1983
2290
 
1984
2291
  /* Excluded from this release type: RuleBlocker */
@@ -2182,11 +2489,61 @@ export declare interface SourceReadyEvent extends Event_2 {
2182
2489
  * @public
2183
2490
  */
2184
2491
  export declare class StaticConfigLoader extends ConfigLoader {
2492
+ /**
2493
+ * Create a static configuration loader with default resolvers.
2494
+ *
2495
+ * @param config - Global configuration
2496
+ * @param configFactory - Optional configuration factory
2497
+ */
2498
+ constructor(config?: ConfigData);
2499
+ /**
2500
+ * Create a static configuration loader with custom resolvers.
2501
+ *
2502
+ * @param resolvers - Resolvers to use
2503
+ * @param config - Global configuration
2504
+ * @param configFactory - Optional configuration factory
2505
+ */
2506
+ constructor(resolvers: Resolver[], config?: ConfigData);
2185
2507
  getConfigFor(_handle: string, configOverride?: ConfigData): ResolvedConfig;
2186
2508
  flushCache(): void;
2187
2509
  protected defaultConfig(): Config;
2188
2510
  }
2189
2511
 
2512
+ /**
2513
+ * Static resolver.
2514
+ *
2515
+ * @public
2516
+ * @since 8.0.0
2517
+ */
2518
+ export declare interface StaticResolver extends Required<Resolver> {
2519
+ addElements(id: string, elements: MetaDataTable): void;
2520
+ addConfig(id: string, config: ConfigData): void;
2521
+ addPlugin(id: string, plugin: Plugin_2): void;
2522
+ addTransformer(id: string, transformer: Transformer_2): void;
2523
+ }
2524
+
2525
+ /**
2526
+ * Create a new resolver for static content, i.e. plugins or transformers known
2527
+ * at compile time.
2528
+ *
2529
+ * @public
2530
+ * @since 8.0.0
2531
+ */
2532
+ export declare function staticResolver(map?: StaticResolverMap): StaticResolver;
2533
+
2534
+ /**
2535
+ * Entries for the static resolver.
2536
+ *
2537
+ * @public
2538
+ * @since 8.0.0
2539
+ */
2540
+ export declare interface StaticResolverMap {
2541
+ elements?: Record<string, MetaDataTable>;
2542
+ configs?: Record<string, ConfigData>;
2543
+ plugins?: Record<string, Plugin_2>;
2544
+ transformers?: Record<string, Transformer_2>;
2545
+ }
2546
+
2190
2547
  /* Excluded from this release type: StyleToken */
2191
2548
 
2192
2549
  /**
@@ -2249,55 +2606,6 @@ export declare interface TagStartEvent extends Event_2 {
2249
2606
  target: HtmlElement;
2250
2607
  }
2251
2608
 
2252
- /**
2253
- * @public
2254
- */
2255
- export declare class TemplateExtractor {
2256
- private ast;
2257
- private filename;
2258
- private data;
2259
- private constructor();
2260
- static fromFilename(filename: string): TemplateExtractor;
2261
- /**
2262
- * Create a new [[TemplateExtractor]] from javascript source code.
2263
- *
2264
- * `Source` offsets will be relative to the string, i.e. offset 0 is the first
2265
- * character of the string. If the string is only a subset of a larger string
2266
- * the offsets must be adjusted manually.
2267
- *
2268
- * @param source - Source code.
2269
- * @param filename - Optional filename to set in the resulting
2270
- * `Source`. Defauls to `"inline"`.
2271
- */
2272
- static fromString(source: string, filename?: string): TemplateExtractor;
2273
- /**
2274
- * Convenience function to create a [[Source]] instance from an existing file.
2275
- *
2276
- * @param filename - Filename with javascript source code. The file must exist
2277
- * and be readable by the user.
2278
- * @returns An array of Source's suitable for passing to [[Engine]] linting
2279
- * functions.
2280
- */
2281
- static createSource(filename: string): Source[];
2282
- /**
2283
- * Extract object properties.
2284
- *
2285
- * Given a key `"template"` this method finds all objects literals with a
2286
- * `"template"` property and creates a [[Source]] instance with proper offsets
2287
- * with the value of the property. For instance:
2288
- *
2289
- * ```
2290
- * const myObj = {
2291
- * foo: 'bar',
2292
- * };
2293
- * ```
2294
- *
2295
- * The above snippet would yield a `Source` with the content `bar`.
2296
- *
2297
- */
2298
- extractObjectProperty(key: string): Source[];
2299
- }
2300
-
2301
2609
  /* Excluded from this release type: TemplatingToken */
2302
2610
 
2303
2611
  /**