html-validate 9.0.0-rc.2 → 9.0.0-rc.3
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/README.md +2 -0
- package/dist/cjs/browser.js +2 -2
- package/dist/cjs/cli.js +58 -46
- package/dist/cjs/cli.js.map +1 -1
- package/dist/cjs/core-browser.js.map +1 -1
- package/dist/cjs/core-nodejs.js +114 -25
- package/dist/cjs/core-nodejs.js.map +1 -1
- package/dist/cjs/core.js +7869 -7394
- package/dist/cjs/core.js.map +1 -1
- package/dist/cjs/elements.js +2 -2
- package/dist/cjs/elements.js.map +1 -1
- package/dist/cjs/html-validate.js +68 -51
- package/dist/cjs/html-validate.js.map +1 -1
- package/dist/cjs/index.js +5 -3
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/jest-diff.js +6 -7
- package/dist/cjs/jest-diff.js.map +1 -1
- package/dist/cjs/jest.js +2 -2
- package/dist/cjs/jest.js.map +1 -1
- package/dist/cjs/matcher-utils.js.map +1 -1
- package/dist/cjs/matchers-jestonly.js.map +1 -1
- package/dist/cjs/matchers.js.map +1 -1
- package/dist/cjs/meta-helper.js.map +1 -1
- package/dist/cjs/test-utils.js +3 -2
- package/dist/cjs/test-utils.js.map +1 -1
- package/dist/cjs/tsdoc-metadata.json +1 -1
- package/dist/cjs/utils/natural-join.js.map +1 -1
- package/dist/cjs/vitest.js +2 -2
- package/dist/cjs/vitest.js.map +1 -1
- package/dist/es/browser.js +2 -2
- package/dist/es/cli.js +60 -48
- package/dist/es/cli.js.map +1 -1
- package/dist/es/core-browser.js.map +1 -1
- package/dist/es/core-nodejs.js +113 -26
- package/dist/es/core-nodejs.js.map +1 -1
- package/dist/es/core.js +7867 -7392
- package/dist/es/core.js.map +1 -1
- package/dist/es/elements.js +2 -2
- package/dist/es/elements.js.map +1 -1
- package/dist/es/html-validate.js +46 -29
- package/dist/es/html-validate.js.map +1 -1
- package/dist/es/index.js +5 -4
- package/dist/es/index.js.map +1 -1
- package/dist/es/jest-diff.js +6 -7
- package/dist/es/jest-diff.js.map +1 -1
- package/dist/es/jest.js +2 -2
- package/dist/es/jest.js.map +1 -1
- package/dist/es/matcher-utils.js.map +1 -1
- package/dist/es/matchers-jestonly.js.map +1 -1
- package/dist/es/matchers.js.map +1 -1
- package/dist/es/meta-helper.js.map +1 -1
- package/dist/es/test-utils.js +3 -2
- package/dist/es/test-utils.js.map +1 -1
- package/dist/es/utils/natural-join.js.map +1 -1
- package/dist/es/vitest.js +2 -2
- package/dist/es/vitest.js.map +1 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/dist/types/browser.d.ts +26 -84
- package/dist/types/index.d.ts +64 -95
- package/dist/types/test-utils.d.ts +4 -4
- package/package.json +9 -162
package/dist/types/browser.d.ts
CHANGED
|
@@ -184,7 +184,6 @@ export declare interface ConditionalEvent extends Event_2 {
|
|
|
184
184
|
export declare class Config {
|
|
185
185
|
private config;
|
|
186
186
|
private configurations;
|
|
187
|
-
private initialized;
|
|
188
187
|
private resolvers;
|
|
189
188
|
private metaTable;
|
|
190
189
|
private plugins;
|
|
@@ -205,15 +204,6 @@ export declare class Config {
|
|
|
205
204
|
static defaultConfig(): Config;
|
|
206
205
|
/* Excluded from this release type: create */
|
|
207
206
|
/* Excluded from this release type: __constructor */
|
|
208
|
-
/**
|
|
209
|
-
* Initialize plugins, transforms etc.
|
|
210
|
-
*
|
|
211
|
-
* Must be called before trying to use config. Can safely be called multiple
|
|
212
|
-
* times.
|
|
213
|
-
*
|
|
214
|
-
* @public
|
|
215
|
-
*/
|
|
216
|
-
init(): void;
|
|
217
207
|
/**
|
|
218
208
|
* Returns true if this configuration is marked as "root".
|
|
219
209
|
*/
|
|
@@ -229,10 +219,12 @@ export declare class Config {
|
|
|
229
219
|
private extendConfig;
|
|
230
220
|
private extendConfigAsync;
|
|
231
221
|
/* Excluded from this release type: getMetaTable */
|
|
222
|
+
private getElementsFromEntry;
|
|
232
223
|
/* Excluded from this release type: get */
|
|
233
224
|
/* Excluded from this release type: getRules */
|
|
234
225
|
private static getRulesObject;
|
|
235
226
|
/* Excluded from this release type: getPlugins */
|
|
227
|
+
/* Excluded from this release type: getTransformers */
|
|
236
228
|
private loadPlugins;
|
|
237
229
|
private loadConfigurations;
|
|
238
230
|
private extendMeta;
|
|
@@ -244,33 +236,8 @@ export declare class Config {
|
|
|
244
236
|
*
|
|
245
237
|
* @public
|
|
246
238
|
*/
|
|
247
|
-
resolve(): ResolvedConfig
|
|
239
|
+
resolve(): ResolvedConfig | Promise<ResolvedConfig>;
|
|
248
240
|
/* Excluded from this release type: resolveData */
|
|
249
|
-
private precompileTransformers;
|
|
250
|
-
/**
|
|
251
|
-
* Get transformation function requested by configuration.
|
|
252
|
-
*
|
|
253
|
-
* Searches:
|
|
254
|
-
*
|
|
255
|
-
* - Named transformers from plugins.
|
|
256
|
-
* - Unnamed transformer from plugin.
|
|
257
|
-
* - Standalone modules (local or node_modules)
|
|
258
|
-
*
|
|
259
|
-
* @param name - Key from configuration
|
|
260
|
-
*/
|
|
261
|
-
private getTransformFunction;
|
|
262
|
-
/**
|
|
263
|
-
* @param name - Original name from configuration
|
|
264
|
-
* @param pluginName - Name of plugin
|
|
265
|
-
* @param key - Name of transform (from plugin)
|
|
266
|
-
*/
|
|
267
|
-
private getNamedTransformerFromPlugin;
|
|
268
|
-
/**
|
|
269
|
-
* @param name - Original name from configuration
|
|
270
|
-
* @param plugin - Plugin instance
|
|
271
|
-
*/
|
|
272
|
-
private getUnnamedTransformerFromPlugin;
|
|
273
|
-
private getTransformerFromModule;
|
|
274
241
|
}
|
|
275
242
|
|
|
276
243
|
/**
|
|
@@ -382,6 +349,7 @@ export declare abstract class ConfigLoader {
|
|
|
382
349
|
* @param configOverride - Optional configuration to merge final results with.
|
|
383
350
|
*/
|
|
384
351
|
abstract getConfigFor(handle: string, configOverride?: ConfigData): ResolvedConfig | Promise<ResolvedConfig>;
|
|
352
|
+
/* Excluded from this release type: getResolvers */
|
|
385
353
|
/**
|
|
386
354
|
* Flush configuration cache.
|
|
387
355
|
*
|
|
@@ -582,6 +550,7 @@ export declare class DOMNode {
|
|
|
582
550
|
*/
|
|
583
551
|
get textContent(): string;
|
|
584
552
|
append(node: DOMNode): void;
|
|
553
|
+
/* Excluded from this release type: insertBefore */
|
|
585
554
|
isRootElement(): boolean;
|
|
586
555
|
/**
|
|
587
556
|
* Tests if two nodes are the same (references the same object).
|
|
@@ -599,6 +568,7 @@ export declare class DOMNode {
|
|
|
599
568
|
* node has no children.
|
|
600
569
|
*/
|
|
601
570
|
get lastChild(): DOMNode;
|
|
571
|
+
/* Excluded from this release type: removeChild */
|
|
602
572
|
/* Excluded from this release type: blockRule */
|
|
603
573
|
/* Excluded from this release type: blockRules */
|
|
604
574
|
/* Excluded from this release type: disableRule */
|
|
@@ -614,6 +584,8 @@ export declare class DOMNode {
|
|
|
614
584
|
/* Excluded from this release type: ruleEnabled */
|
|
615
585
|
/* Excluded from this release type: ruleBlockers */
|
|
616
586
|
generateSelector(): string | null;
|
|
587
|
+
/* Excluded from this release type: _setParent */
|
|
588
|
+
private _removeChild;
|
|
617
589
|
}
|
|
618
590
|
|
|
619
591
|
/**
|
|
@@ -781,13 +753,13 @@ export declare interface FormAssociated {
|
|
|
781
753
|
*/
|
|
782
754
|
export declare class HtmlElement extends DOMNode {
|
|
783
755
|
readonly tagName: string;
|
|
784
|
-
readonly parent: HtmlElement | null;
|
|
785
756
|
readonly voidElement: boolean;
|
|
786
757
|
readonly depth: number;
|
|
787
758
|
closed: NodeClosed;
|
|
788
759
|
protected readonly attr: Record<string, Attribute[]>;
|
|
789
760
|
private metaElement;
|
|
790
761
|
private annotation;
|
|
762
|
+
private _parent;
|
|
791
763
|
/* Excluded from this release type: _adapter */
|
|
792
764
|
private constructor();
|
|
793
765
|
/**
|
|
@@ -884,6 +856,7 @@ export declare class HtmlElement extends DOMNode {
|
|
|
884
856
|
*/
|
|
885
857
|
matches(selector: string): boolean;
|
|
886
858
|
get meta(): MetaElement | null;
|
|
859
|
+
get parent(): HtmlElement | null;
|
|
887
860
|
/**
|
|
888
861
|
* Get current role for this element (explicit with `role` attribute or mapped
|
|
889
862
|
* with implicit role).
|
|
@@ -994,6 +967,7 @@ export declare class HtmlElement extends DOMNode {
|
|
|
994
967
|
/* Excluded from this release type: someChildren */
|
|
995
968
|
/* Excluded from this release type: everyChildren */
|
|
996
969
|
/* Excluded from this release type: find */
|
|
970
|
+
/* Excluded from this release type: _setParent */
|
|
997
971
|
}
|
|
998
972
|
|
|
999
973
|
/**
|
|
@@ -1139,7 +1113,7 @@ export declare class HtmlValidate {
|
|
|
1139
1113
|
/**
|
|
1140
1114
|
* Get effective configuration schema.
|
|
1141
1115
|
*/
|
|
1142
|
-
getConfigurationSchema(): SchemaObject
|
|
1116
|
+
getConfigurationSchema(): Promise<SchemaObject>;
|
|
1143
1117
|
/**
|
|
1144
1118
|
* Get effective metadata element schema.
|
|
1145
1119
|
*
|
|
@@ -1365,9 +1339,7 @@ export declare interface ListenEventMap {
|
|
|
1365
1339
|
"config:ready": ConfigReadyEvent;
|
|
1366
1340
|
"source:ready": SourceReadyEvent;
|
|
1367
1341
|
/* Excluded from this release type: token */
|
|
1368
|
-
"tag:open": TagOpenEvent;
|
|
1369
1342
|
"tag:start": TagStartEvent;
|
|
1370
|
-
"tag:close": TagCloseEvent;
|
|
1371
1343
|
"tag:end": TagEndEvent;
|
|
1372
1344
|
"tag:ready": TagReadyEvent;
|
|
1373
1345
|
"element:ready": ElementReadyEvent;
|
|
@@ -2072,6 +2044,7 @@ export declare class ResolvedConfig {
|
|
|
2072
2044
|
private plugins;
|
|
2073
2045
|
private rules;
|
|
2074
2046
|
private transformers;
|
|
2047
|
+
private cache;
|
|
2075
2048
|
/** The original data this resolved configuration was created from */
|
|
2076
2049
|
private original;
|
|
2077
2050
|
/* Excluded from this release type: __constructor */
|
|
@@ -2083,28 +2056,14 @@ export declare class ResolvedConfig {
|
|
|
2083
2056
|
getMetaTable(): MetaTable;
|
|
2084
2057
|
getPlugins(): Plugin_2[];
|
|
2085
2058
|
getRules(): Map<string, [Severity, RuleOptions]>;
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
*
|
|
2091
|
-
* @param source - Current source to transform.
|
|
2092
|
-
* @param filename - If set it is the filename used to match
|
|
2093
|
-
* transformer. Default is to use filename from source.
|
|
2094
|
-
* @returns A list of transformed sources ready for validation.
|
|
2095
|
-
*/
|
|
2096
|
-
transformSource(source: Source, filename?: string): Source[];
|
|
2097
|
-
/**
|
|
2098
|
-
* Wrapper around [[transformSource]] which reads a file before passing it
|
|
2099
|
-
* as-is to transformSource.
|
|
2100
|
-
*
|
|
2101
|
-
* @param filename - Filename to transform (according to configured
|
|
2102
|
-
* transformations)
|
|
2103
|
-
* @returns A list of transformed sources ready for validation.
|
|
2104
|
-
*/
|
|
2105
|
-
transformFilename(filename: string): Source[];
|
|
2059
|
+
/* Excluded from this release type: transformSource */
|
|
2060
|
+
/* Excluded from this release type: transformSourceSync */
|
|
2061
|
+
/* Excluded from this release type: transformFilename */
|
|
2062
|
+
/* Excluded from this release type: transformFilenameSync */
|
|
2106
2063
|
/**
|
|
2107
2064
|
* Returns true if a transformer matches given filename.
|
|
2065
|
+
*
|
|
2066
|
+
* @public
|
|
2108
2067
|
*/
|
|
2109
2068
|
canTransform(filename: string): boolean;
|
|
2110
2069
|
private findTransformer;
|
|
@@ -2130,19 +2089,19 @@ export declare interface Resolver {
|
|
|
2130
2089
|
/**
|
|
2131
2090
|
* Resolve table of element metadata.
|
|
2132
2091
|
*/
|
|
2133
|
-
resolveElements?(id: string, options: ResolverOptions): MetaDataTable | null;
|
|
2092
|
+
resolveElements?(id: string, options: ResolverOptions): MetaDataTable | Promise<MetaDataTable | null> | null;
|
|
2134
2093
|
/**
|
|
2135
2094
|
* Resolve a configuration to extend.
|
|
2136
2095
|
*/
|
|
2137
|
-
resolveConfig?(id: string, options: ResolverOptions): ConfigData | null;
|
|
2096
|
+
resolveConfig?(id: string, options: ResolverOptions): ConfigData | Promise<ConfigData | null> | null;
|
|
2138
2097
|
/**
|
|
2139
2098
|
* Resolve a plugin.
|
|
2140
2099
|
*/
|
|
2141
|
-
resolvePlugin?(id: string, options: ResolverOptions): Plugin_2 | null;
|
|
2100
|
+
resolvePlugin?(id: string, options: ResolverOptions): Plugin_2 | Promise<Plugin_2 | null> | null;
|
|
2142
2101
|
/**
|
|
2143
2102
|
* Resolve a transformer.
|
|
2144
2103
|
*/
|
|
2145
|
-
resolveTransformer?(id: string, options: ResolverOptions): Transformer_2 | null;
|
|
2104
|
+
resolveTransformer?(id: string, options: ResolverOptions): Transformer_2 | Promise<Transformer_2 | null> | null;
|
|
2146
2105
|
}
|
|
2147
2106
|
|
|
2148
2107
|
/**
|
|
@@ -2347,7 +2306,7 @@ export declare type RuleOptions = string | number | Record<string, any>;
|
|
|
2347
2306
|
/**
|
|
2348
2307
|
* @public
|
|
2349
2308
|
*/
|
|
2350
|
-
export declare type RuleSeverity = "off" | "warn" | "error" |
|
|
2309
|
+
export declare type RuleSeverity = "off" | "warn" | "error" | 0 | 1 | 2;
|
|
2351
2310
|
|
|
2352
2311
|
export { SchemaObject }
|
|
2353
2312
|
|
|
@@ -2570,14 +2529,6 @@ export declare interface StaticResolverMap {
|
|
|
2570
2529
|
|
|
2571
2530
|
/* Excluded from this release type: StyleToken */
|
|
2572
2531
|
|
|
2573
|
-
/**
|
|
2574
|
-
* Deprecated alias for TagEndEvent
|
|
2575
|
-
*
|
|
2576
|
-
* @public
|
|
2577
|
-
* @deprecated Use TagEndEvent instead
|
|
2578
|
-
*/
|
|
2579
|
-
export declare type TagCloseEvent = TagEndEvent;
|
|
2580
|
-
|
|
2581
2532
|
/* Excluded from this release type: TagCloseToken */
|
|
2582
2533
|
|
|
2583
2534
|
/**
|
|
@@ -2595,14 +2546,6 @@ export declare interface TagEndEvent extends Event_2 {
|
|
|
2595
2546
|
previous: HtmlElement;
|
|
2596
2547
|
}
|
|
2597
2548
|
|
|
2598
|
-
/**
|
|
2599
|
-
* Deprecated alias for TagStartEvent
|
|
2600
|
-
*
|
|
2601
|
-
* @public
|
|
2602
|
-
* @deprecated Use TagStartEvent instead
|
|
2603
|
-
*/
|
|
2604
|
-
export declare type TagOpenEvent = TagStartEvent;
|
|
2605
|
-
|
|
2606
2549
|
/* Excluded from this release type: TagOpenToken */
|
|
2607
2550
|
|
|
2608
2551
|
/**
|
|
@@ -2727,7 +2670,7 @@ export declare interface TransformContext {
|
|
|
2727
2670
|
* @param filename - Filename to use to match next transformer (unrelated to
|
|
2728
2671
|
* filename set in source)
|
|
2729
2672
|
*/
|
|
2730
|
-
chain(source: Source, filename: string): Iterable<Source
|
|
2673
|
+
chain(source: Source, filename: string): Iterable<Source> | Promise<Iterable<Source>>;
|
|
2731
2674
|
}
|
|
2732
2675
|
|
|
2733
2676
|
/**
|
|
@@ -2739,7 +2682,7 @@ declare interface Transformer_2 {
|
|
|
2739
2682
|
/**
|
|
2740
2683
|
* Callback function to transform a source to plain HTML sources.
|
|
2741
2684
|
*/
|
|
2742
|
-
(this: TransformContext, source: Source): Iterable<Source
|
|
2685
|
+
(this: TransformContext, source: Source): Iterable<Source> | Promise<Iterable<Source>>;
|
|
2743
2686
|
/**
|
|
2744
2687
|
* API version. Must be specified, it is deprecated to leave it out as it
|
|
2745
2688
|
* assumes version 0 (deprecated version).
|
|
@@ -2754,7 +2697,6 @@ export { Transformer_2 as Transformer }
|
|
|
2754
2697
|
export declare interface TransformerEntry {
|
|
2755
2698
|
pattern: RegExp;
|
|
2756
2699
|
name: string;
|
|
2757
|
-
fn: Transformer_2;
|
|
2758
2700
|
}
|
|
2759
2701
|
|
|
2760
2702
|
/**
|
package/dist/types/index.d.ts
CHANGED
|
@@ -177,8 +177,8 @@ export declare class CLI {
|
|
|
177
177
|
*
|
|
178
178
|
* @public
|
|
179
179
|
*/
|
|
180
|
-
expandFiles(patterns: string[], options?: ExpandOptions): string[]
|
|
181
|
-
getFormatter(formatters: string): (report: Report_2) => string
|
|
180
|
+
expandFiles(patterns: string[], options?: ExpandOptions): Promise<string[]>;
|
|
181
|
+
getFormatter(formatters: string): Promise<(report: Report_2) => string>;
|
|
182
182
|
/**
|
|
183
183
|
* Initialize project with a new configuration.
|
|
184
184
|
*
|
|
@@ -186,18 +186,13 @@ export declare class CLI {
|
|
|
186
186
|
* `cwd`.
|
|
187
187
|
*/
|
|
188
188
|
init(cwd: string): Promise<InitResult>;
|
|
189
|
-
/**
|
|
190
|
-
* Searches ".htmlvalidateignore" files from filesystem and returns `true` if
|
|
191
|
-
* one of them contains a pattern matching given filename.
|
|
192
|
-
*/
|
|
193
|
-
isIgnored(filename: string): boolean;
|
|
194
189
|
/**
|
|
195
190
|
* Clear cache.
|
|
196
191
|
*
|
|
197
192
|
* Previously fetched [[HtmlValidate]] instances must either be fetched again
|
|
198
193
|
* or call [[HtmlValidate.flushConfigCache]].
|
|
199
194
|
*/
|
|
200
|
-
clearCache(): void
|
|
195
|
+
clearCache(): Promise<void>;
|
|
201
196
|
/* Excluded from this release type: getLoader */
|
|
202
197
|
/**
|
|
203
198
|
* Get HtmlValidate instance with configuration based on options passed to the
|
|
@@ -205,8 +200,13 @@ export declare class CLI {
|
|
|
205
200
|
*
|
|
206
201
|
* @public
|
|
207
202
|
*/
|
|
208
|
-
getValidator(): HtmlValidate
|
|
203
|
+
getValidator(): Promise<HtmlValidate>;
|
|
209
204
|
/* Excluded from this release type: getConfig */
|
|
205
|
+
/**
|
|
206
|
+
* Searches ".htmlvalidateignore" files from filesystem and returns `true` if
|
|
207
|
+
* one of them contains a pattern matching given filename.
|
|
208
|
+
*/
|
|
209
|
+
private isIgnored;
|
|
210
210
|
private resolveConfig;
|
|
211
211
|
}
|
|
212
212
|
|
|
@@ -215,6 +215,8 @@ export declare class CLI {
|
|
|
215
215
|
*/
|
|
216
216
|
export declare interface CLIOptions {
|
|
217
217
|
configFile?: string;
|
|
218
|
+
/** Comma-separated list of presets to use */
|
|
219
|
+
preset?: string;
|
|
218
220
|
rules?: string | string[];
|
|
219
221
|
}
|
|
220
222
|
|
|
@@ -280,7 +282,6 @@ export declare interface ConditionalEvent extends Event_2 {
|
|
|
280
282
|
export declare class Config {
|
|
281
283
|
private config;
|
|
282
284
|
private configurations;
|
|
283
|
-
private initialized;
|
|
284
285
|
private resolvers;
|
|
285
286
|
private metaTable;
|
|
286
287
|
private plugins;
|
|
@@ -301,15 +302,6 @@ export declare class Config {
|
|
|
301
302
|
static defaultConfig(): Config;
|
|
302
303
|
/* Excluded from this release type: create */
|
|
303
304
|
/* Excluded from this release type: __constructor */
|
|
304
|
-
/**
|
|
305
|
-
* Initialize plugins, transforms etc.
|
|
306
|
-
*
|
|
307
|
-
* Must be called before trying to use config. Can safely be called multiple
|
|
308
|
-
* times.
|
|
309
|
-
*
|
|
310
|
-
* @public
|
|
311
|
-
*/
|
|
312
|
-
init(): void;
|
|
313
305
|
/**
|
|
314
306
|
* Returns true if this configuration is marked as "root".
|
|
315
307
|
*/
|
|
@@ -325,10 +317,12 @@ export declare class Config {
|
|
|
325
317
|
private extendConfig;
|
|
326
318
|
private extendConfigAsync;
|
|
327
319
|
/* Excluded from this release type: getMetaTable */
|
|
320
|
+
private getElementsFromEntry;
|
|
328
321
|
/* Excluded from this release type: get */
|
|
329
322
|
/* Excluded from this release type: getRules */
|
|
330
323
|
private static getRulesObject;
|
|
331
324
|
/* Excluded from this release type: getPlugins */
|
|
325
|
+
/* Excluded from this release type: getTransformers */
|
|
332
326
|
private loadPlugins;
|
|
333
327
|
private loadConfigurations;
|
|
334
328
|
private extendMeta;
|
|
@@ -340,33 +334,8 @@ export declare class Config {
|
|
|
340
334
|
*
|
|
341
335
|
* @public
|
|
342
336
|
*/
|
|
343
|
-
resolve(): ResolvedConfig
|
|
337
|
+
resolve(): ResolvedConfig | Promise<ResolvedConfig>;
|
|
344
338
|
/* Excluded from this release type: resolveData */
|
|
345
|
-
private precompileTransformers;
|
|
346
|
-
/**
|
|
347
|
-
* Get transformation function requested by configuration.
|
|
348
|
-
*
|
|
349
|
-
* Searches:
|
|
350
|
-
*
|
|
351
|
-
* - Named transformers from plugins.
|
|
352
|
-
* - Unnamed transformer from plugin.
|
|
353
|
-
* - Standalone modules (local or node_modules)
|
|
354
|
-
*
|
|
355
|
-
* @param name - Key from configuration
|
|
356
|
-
*/
|
|
357
|
-
private getTransformFunction;
|
|
358
|
-
/**
|
|
359
|
-
* @param name - Original name from configuration
|
|
360
|
-
* @param pluginName - Name of plugin
|
|
361
|
-
* @param key - Name of transform (from plugin)
|
|
362
|
-
*/
|
|
363
|
-
private getNamedTransformerFromPlugin;
|
|
364
|
-
/**
|
|
365
|
-
* @param name - Original name from configuration
|
|
366
|
-
* @param plugin - Plugin instance
|
|
367
|
-
*/
|
|
368
|
-
private getUnnamedTransformerFromPlugin;
|
|
369
|
-
private getTransformerFromModule;
|
|
370
339
|
}
|
|
371
340
|
|
|
372
341
|
/**
|
|
@@ -478,6 +447,7 @@ export declare abstract class ConfigLoader {
|
|
|
478
447
|
* @param configOverride - Optional configuration to merge final results with.
|
|
479
448
|
*/
|
|
480
449
|
abstract getConfigFor(handle: string, configOverride?: ConfigData): ResolvedConfig | Promise<ResolvedConfig>;
|
|
450
|
+
/* Excluded from this release type: getResolvers */
|
|
481
451
|
/**
|
|
482
452
|
* Flush configuration cache.
|
|
483
453
|
*
|
|
@@ -678,6 +648,7 @@ export declare class DOMNode {
|
|
|
678
648
|
*/
|
|
679
649
|
get textContent(): string;
|
|
680
650
|
append(node: DOMNode): void;
|
|
651
|
+
/* Excluded from this release type: insertBefore */
|
|
681
652
|
isRootElement(): boolean;
|
|
682
653
|
/**
|
|
683
654
|
* Tests if two nodes are the same (references the same object).
|
|
@@ -695,6 +666,7 @@ export declare class DOMNode {
|
|
|
695
666
|
* node has no children.
|
|
696
667
|
*/
|
|
697
668
|
get lastChild(): DOMNode;
|
|
669
|
+
/* Excluded from this release type: removeChild */
|
|
698
670
|
/* Excluded from this release type: blockRule */
|
|
699
671
|
/* Excluded from this release type: blockRules */
|
|
700
672
|
/* Excluded from this release type: disableRule */
|
|
@@ -710,6 +682,8 @@ export declare class DOMNode {
|
|
|
710
682
|
/* Excluded from this release type: ruleEnabled */
|
|
711
683
|
/* Excluded from this release type: ruleBlockers */
|
|
712
684
|
generateSelector(): string | null;
|
|
685
|
+
/* Excluded from this release type: _setParent */
|
|
686
|
+
private _removeChild;
|
|
713
687
|
}
|
|
714
688
|
|
|
715
689
|
/**
|
|
@@ -813,6 +787,29 @@ export declare interface ErrorDescriptor<ContextType> {
|
|
|
813
787
|
context?: ContextType;
|
|
814
788
|
}
|
|
815
789
|
|
|
790
|
+
/**
|
|
791
|
+
* ESM resolver.
|
|
792
|
+
*
|
|
793
|
+
* @public
|
|
794
|
+
* @since %version%
|
|
795
|
+
*/
|
|
796
|
+
export declare type ESMResolver = Required<Resolver>;
|
|
797
|
+
|
|
798
|
+
/**
|
|
799
|
+
* Create a new resolver for NodeJS packages using `require(..)`.
|
|
800
|
+
*
|
|
801
|
+
* If the module name contains `<rootDir>` (e.g. `<rootDir/foo`) it will be
|
|
802
|
+
* expanded relative to the root directory either explicitly set by the
|
|
803
|
+
* `rootDir` parameter or determined automatically by the closest `package.json`
|
|
804
|
+
* file (starting at the current working directory).
|
|
805
|
+
*
|
|
806
|
+
* @public
|
|
807
|
+
* @since %version%
|
|
808
|
+
*/
|
|
809
|
+
export declare function esmResolver(options?: {
|
|
810
|
+
rootDir?: string;
|
|
811
|
+
}): ESMResolver;
|
|
812
|
+
|
|
816
813
|
/**
|
|
817
814
|
* @public
|
|
818
815
|
*/
|
|
@@ -891,6 +888,7 @@ export declare interface ExpandOptions {
|
|
|
891
888
|
* - `.htmlvalidate.json`
|
|
892
889
|
* - `.htmlvalidate.js`
|
|
893
890
|
* - `.htmlvalidate.cjs`
|
|
891
|
+
* - `.htmlvalidate.mjs`
|
|
894
892
|
*
|
|
895
893
|
* Global configuration is used when no configuration file is found. The
|
|
896
894
|
* result is always merged with override if present.
|
|
@@ -945,8 +943,9 @@ export declare class FileSystemConfigLoader extends ConfigLoader {
|
|
|
945
943
|
*/
|
|
946
944
|
fromFilename(filename: string): Config | Promise<Config | null> | null;
|
|
947
945
|
/* Excluded from this release type: fromFilenameAsync */
|
|
948
|
-
private
|
|
949
|
-
private
|
|
946
|
+
private _merge;
|
|
947
|
+
private _resolveSync1;
|
|
948
|
+
private _resolveSync2;
|
|
950
949
|
private _resolveAsync;
|
|
951
950
|
/* Excluded from this release type: _getInternalCache */
|
|
952
951
|
protected defaultConfig(): Config | Promise<Config>;
|
|
@@ -1003,13 +1002,13 @@ export declare interface FSLike {
|
|
|
1003
1002
|
*/
|
|
1004
1003
|
export declare class HtmlElement extends DOMNode {
|
|
1005
1004
|
readonly tagName: string;
|
|
1006
|
-
readonly parent: HtmlElement | null;
|
|
1007
1005
|
readonly voidElement: boolean;
|
|
1008
1006
|
readonly depth: number;
|
|
1009
1007
|
closed: NodeClosed;
|
|
1010
1008
|
protected readonly attr: Record<string, Attribute[]>;
|
|
1011
1009
|
private metaElement;
|
|
1012
1010
|
private annotation;
|
|
1011
|
+
private _parent;
|
|
1013
1012
|
/* Excluded from this release type: _adapter */
|
|
1014
1013
|
private constructor();
|
|
1015
1014
|
/**
|
|
@@ -1106,6 +1105,7 @@ export declare class HtmlElement extends DOMNode {
|
|
|
1106
1105
|
*/
|
|
1107
1106
|
matches(selector: string): boolean;
|
|
1108
1107
|
get meta(): MetaElement | null;
|
|
1108
|
+
get parent(): HtmlElement | null;
|
|
1109
1109
|
/**
|
|
1110
1110
|
* Get current role for this element (explicit with `role` attribute or mapped
|
|
1111
1111
|
* with implicit role).
|
|
@@ -1216,6 +1216,7 @@ export declare class HtmlElement extends DOMNode {
|
|
|
1216
1216
|
/* Excluded from this release type: someChildren */
|
|
1217
1217
|
/* Excluded from this release type: everyChildren */
|
|
1218
1218
|
/* Excluded from this release type: find */
|
|
1219
|
+
/* Excluded from this release type: _setParent */
|
|
1219
1220
|
}
|
|
1220
1221
|
|
|
1221
1222
|
/**
|
|
@@ -1361,7 +1362,7 @@ export declare class HtmlValidate {
|
|
|
1361
1362
|
/**
|
|
1362
1363
|
* Get effective configuration schema.
|
|
1363
1364
|
*/
|
|
1364
|
-
getConfigurationSchema(): SchemaObject
|
|
1365
|
+
getConfigurationSchema(): Promise<SchemaObject>;
|
|
1365
1366
|
/**
|
|
1366
1367
|
* Get effective metadata element schema.
|
|
1367
1368
|
*
|
|
@@ -1594,9 +1595,7 @@ export declare interface ListenEventMap {
|
|
|
1594
1595
|
"config:ready": ConfigReadyEvent;
|
|
1595
1596
|
"source:ready": SourceReadyEvent;
|
|
1596
1597
|
/* Excluded from this release type: token */
|
|
1597
|
-
"tag:open": TagOpenEvent;
|
|
1598
1598
|
"tag:start": TagStartEvent;
|
|
1599
|
-
"tag:close": TagCloseEvent;
|
|
1600
1599
|
"tag:end": TagEndEvent;
|
|
1601
1600
|
"tag:ready": TagReadyEvent;
|
|
1602
1601
|
"element:ready": ElementReadyEvent;
|
|
@@ -2326,6 +2325,7 @@ export declare class ResolvedConfig {
|
|
|
2326
2325
|
private plugins;
|
|
2327
2326
|
private rules;
|
|
2328
2327
|
private transformers;
|
|
2328
|
+
private cache;
|
|
2329
2329
|
/** The original data this resolved configuration was created from */
|
|
2330
2330
|
private original;
|
|
2331
2331
|
/* Excluded from this release type: __constructor */
|
|
@@ -2337,28 +2337,14 @@ export declare class ResolvedConfig {
|
|
|
2337
2337
|
getMetaTable(): MetaTable;
|
|
2338
2338
|
getPlugins(): Plugin_2[];
|
|
2339
2339
|
getRules(): Map<string, [Severity, RuleOptions]>;
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
*
|
|
2345
|
-
* @param source - Current source to transform.
|
|
2346
|
-
* @param filename - If set it is the filename used to match
|
|
2347
|
-
* transformer. Default is to use filename from source.
|
|
2348
|
-
* @returns A list of transformed sources ready for validation.
|
|
2349
|
-
*/
|
|
2350
|
-
transformSource(source: Source, filename?: string): Source[];
|
|
2351
|
-
/**
|
|
2352
|
-
* Wrapper around [[transformSource]] which reads a file before passing it
|
|
2353
|
-
* as-is to transformSource.
|
|
2354
|
-
*
|
|
2355
|
-
* @param filename - Filename to transform (according to configured
|
|
2356
|
-
* transformations)
|
|
2357
|
-
* @returns A list of transformed sources ready for validation.
|
|
2358
|
-
*/
|
|
2359
|
-
transformFilename(filename: string): Source[];
|
|
2340
|
+
/* Excluded from this release type: transformSource */
|
|
2341
|
+
/* Excluded from this release type: transformSourceSync */
|
|
2342
|
+
/* Excluded from this release type: transformFilename */
|
|
2343
|
+
/* Excluded from this release type: transformFilenameSync */
|
|
2360
2344
|
/**
|
|
2361
2345
|
* Returns true if a transformer matches given filename.
|
|
2346
|
+
*
|
|
2347
|
+
* @public
|
|
2362
2348
|
*/
|
|
2363
2349
|
canTransform(filename: string): boolean;
|
|
2364
2350
|
private findTransformer;
|
|
@@ -2384,19 +2370,19 @@ export declare interface Resolver {
|
|
|
2384
2370
|
/**
|
|
2385
2371
|
* Resolve table of element metadata.
|
|
2386
2372
|
*/
|
|
2387
|
-
resolveElements?(id: string, options: ResolverOptions): MetaDataTable | null;
|
|
2373
|
+
resolveElements?(id: string, options: ResolverOptions): MetaDataTable | Promise<MetaDataTable | null> | null;
|
|
2388
2374
|
/**
|
|
2389
2375
|
* Resolve a configuration to extend.
|
|
2390
2376
|
*/
|
|
2391
|
-
resolveConfig?(id: string, options: ResolverOptions): ConfigData | null;
|
|
2377
|
+
resolveConfig?(id: string, options: ResolverOptions): ConfigData | Promise<ConfigData | null> | null;
|
|
2392
2378
|
/**
|
|
2393
2379
|
* Resolve a plugin.
|
|
2394
2380
|
*/
|
|
2395
|
-
resolvePlugin?(id: string, options: ResolverOptions): Plugin_2 | null;
|
|
2381
|
+
resolvePlugin?(id: string, options: ResolverOptions): Plugin_2 | Promise<Plugin_2 | null> | null;
|
|
2396
2382
|
/**
|
|
2397
2383
|
* Resolve a transformer.
|
|
2398
2384
|
*/
|
|
2399
|
-
resolveTransformer?(id: string, options: ResolverOptions): Transformer_2 | null;
|
|
2385
|
+
resolveTransformer?(id: string, options: ResolverOptions): Transformer_2 | Promise<Transformer_2 | null> | null;
|
|
2400
2386
|
}
|
|
2401
2387
|
|
|
2402
2388
|
/**
|
|
@@ -2601,7 +2587,7 @@ export declare type RuleOptions = string | number | Record<string, any>;
|
|
|
2601
2587
|
/**
|
|
2602
2588
|
* @public
|
|
2603
2589
|
*/
|
|
2604
|
-
export declare type RuleSeverity = "off" | "warn" | "error" |
|
|
2590
|
+
export declare type RuleSeverity = "off" | "warn" | "error" | 0 | 1 | 2;
|
|
2605
2591
|
|
|
2606
2592
|
export { SchemaObject }
|
|
2607
2593
|
|
|
@@ -2824,14 +2810,6 @@ export declare interface StaticResolverMap {
|
|
|
2824
2810
|
|
|
2825
2811
|
/* Excluded from this release type: StyleToken */
|
|
2826
2812
|
|
|
2827
|
-
/**
|
|
2828
|
-
* Deprecated alias for TagEndEvent
|
|
2829
|
-
*
|
|
2830
|
-
* @public
|
|
2831
|
-
* @deprecated Use TagEndEvent instead
|
|
2832
|
-
*/
|
|
2833
|
-
export declare type TagCloseEvent = TagEndEvent;
|
|
2834
|
-
|
|
2835
2813
|
/* Excluded from this release type: TagCloseToken */
|
|
2836
2814
|
|
|
2837
2815
|
/**
|
|
@@ -2849,14 +2827,6 @@ export declare interface TagEndEvent extends Event_2 {
|
|
|
2849
2827
|
previous: HtmlElement;
|
|
2850
2828
|
}
|
|
2851
2829
|
|
|
2852
|
-
/**
|
|
2853
|
-
* Deprecated alias for TagStartEvent
|
|
2854
|
-
*
|
|
2855
|
-
* @public
|
|
2856
|
-
* @deprecated Use TagStartEvent instead
|
|
2857
|
-
*/
|
|
2858
|
-
export declare type TagOpenEvent = TagStartEvent;
|
|
2859
|
-
|
|
2860
2830
|
/* Excluded from this release type: TagOpenToken */
|
|
2861
2831
|
|
|
2862
2832
|
/**
|
|
@@ -2981,7 +2951,7 @@ export declare interface TransformContext {
|
|
|
2981
2951
|
* @param filename - Filename to use to match next transformer (unrelated to
|
|
2982
2952
|
* filename set in source)
|
|
2983
2953
|
*/
|
|
2984
|
-
chain(source: Source, filename: string): Iterable<Source
|
|
2954
|
+
chain(source: Source, filename: string): Iterable<Source> | Promise<Iterable<Source>>;
|
|
2985
2955
|
}
|
|
2986
2956
|
|
|
2987
2957
|
/**
|
|
@@ -2993,7 +2963,7 @@ declare interface Transformer_2 {
|
|
|
2993
2963
|
/**
|
|
2994
2964
|
* Callback function to transform a source to plain HTML sources.
|
|
2995
2965
|
*/
|
|
2996
|
-
(this: TransformContext, source: Source): Iterable<Source
|
|
2966
|
+
(this: TransformContext, source: Source): Iterable<Source> | Promise<Iterable<Source>>;
|
|
2997
2967
|
/**
|
|
2998
2968
|
* API version. Must be specified, it is deprecated to leave it out as it
|
|
2999
2969
|
* assumes version 0 (deprecated version).
|
|
@@ -3008,7 +2978,6 @@ export { Transformer_2 as Transformer }
|
|
|
3008
2978
|
export declare interface TransformerEntry {
|
|
3009
2979
|
pattern: RegExp;
|
|
3010
2980
|
name: string;
|
|
3011
|
-
fn: Transformer_2;
|
|
3012
2981
|
}
|
|
3013
2982
|
|
|
3014
2983
|
/**
|
|
@@ -4,7 +4,7 @@ import { TransformContext } from 'html-validate';
|
|
|
4
4
|
/**
|
|
5
5
|
* @public
|
|
6
6
|
*/
|
|
7
|
-
declare type Transformer_2 = (this: TransformContext, source: Source) => Iterable<Source
|
|
7
|
+
declare type Transformer_2 = (this: TransformContext, source: Source) => Iterable<Source> | Promise<Iterable<Source>>;
|
|
8
8
|
export { Transformer_2 as Transformer }
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -15,7 +15,7 @@ export { Transformer_2 as Transformer }
|
|
|
15
15
|
* @param filename - Filename to read data from. Must be readable.
|
|
16
16
|
* @param chain - If set this function is called when chaining transformers. Default is pass-thru.
|
|
17
17
|
*/
|
|
18
|
-
export declare function transformFile(fn: Transformer_2, filename: string, chain?: (source: Source, filename: string) => Iterable<Source>): Source[]
|
|
18
|
+
export declare function transformFile(fn: Transformer_2, filename: string, chain?: (source: Source, filename: string) => Iterable<Source> | Promise<Iterable<Source>>): Promise<Source[]>;
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* Helper function to call a transformer function in test-cases.
|
|
@@ -25,7 +25,7 @@ export declare function transformFile(fn: Transformer_2, filename: string, chain
|
|
|
25
25
|
* @param data - Source to transform.
|
|
26
26
|
* @param chain - If set this function is called when chaining transformers. Default is pass-thru.
|
|
27
27
|
*/
|
|
28
|
-
export declare function transformSource(fn: Transformer_2, source: Source, chain?: (source: Source, filename: string) => Iterable<Source>): Source[]
|
|
28
|
+
export declare function transformSource(fn: Transformer_2, source: Source, chain?: (source: Source, filename: string) => Iterable<Source> | Promise<Iterable<Source>>): Promise<Source[]>;
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
31
|
* Helper function to call a transformer function in test-cases.
|
|
@@ -35,6 +35,6 @@ export declare function transformSource(fn: Transformer_2, source: Source, chain
|
|
|
35
35
|
* @param data - String to transform.
|
|
36
36
|
* @param chain - If set this function is called when chaining transformers. Default is pass-thru.
|
|
37
37
|
*/
|
|
38
|
-
export declare function transformString(fn: Transformer_2, data: string, chain?: (source: Source, filename: string) => Iterable<Source>): Source[]
|
|
38
|
+
export declare function transformString(fn: Transformer_2, data: string, chain?: (source: Source, filename: string) => Iterable<Source> | Promise<Iterable<Source>>): Promise<Source[]>;
|
|
39
39
|
|
|
40
40
|
export { }
|