html-validate 9.3.0 → 9.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/browser.js +1 -2
- package/dist/cjs/browser.js.map +1 -1
- package/dist/cjs/cli.js +1 -1
- package/dist/cjs/cli.js.map +1 -1
- package/dist/cjs/core-browser.js +417 -0
- package/dist/cjs/core-browser.js.map +1 -1
- package/dist/cjs/core-nodejs.js +424 -4
- package/dist/cjs/core-nodejs.js.map +1 -1
- package/dist/cjs/core.js +248 -658
- package/dist/cjs/core.js.map +1 -1
- package/dist/cjs/html-validate.js +1 -1
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/jest-worker.js +6 -6
- package/dist/cjs/jest-worker.js.map +1 -1
- package/dist/cjs/jest.js +1 -1
- package/dist/cjs/vitest.js +2 -2
- package/dist/es/browser.js +2 -3
- package/dist/es/browser.js.map +1 -1
- package/dist/es/cli.js +2 -2
- package/dist/es/core-browser.js +418 -2
- package/dist/es/core-browser.js.map +1 -1
- package/dist/es/core-nodejs.js +424 -4
- package/dist/es/core-nodejs.js.map +1 -1
- package/dist/es/core.js +242 -657
- package/dist/es/core.js.map +1 -1
- package/dist/es/html-validate.js +3 -2
- package/dist/es/html-validate.js.map +1 -1
- package/dist/es/index.js +4 -3
- package/dist/es/index.js.map +1 -1
- package/dist/es/jest-worker.js +7 -6
- package/dist/es/jest-worker.js.map +1 -1
- package/dist/es/jest.js +2 -1
- package/dist/es/jest.js.map +1 -1
- package/dist/es/matchers-jestonly.js +1 -1
- package/dist/es/matchers.js +1 -1
- package/dist/es/vitest.js +3 -2
- package/dist/es/vitest.js.map +1 -1
- package/dist/types/browser.d.ts +25 -4
- package/dist/types/index.d.ts +25 -4
- package/package.json +1 -1
package/dist/es/core.js
CHANGED
|
@@ -2,7 +2,6 @@ import Ajv from 'ajv';
|
|
|
2
2
|
import { e as entities$1, h as html5, b as bundledElements } from './elements.js';
|
|
3
3
|
import betterAjvErrors from '@sidvind/better-ajv-errors';
|
|
4
4
|
import { n as naturalJoin } from './utils/natural-join.js';
|
|
5
|
-
import fs from 'node:fs';
|
|
6
5
|
import kleur from 'kleur';
|
|
7
6
|
import { stylish as stylish$1 } from '@html-validate/stylish';
|
|
8
7
|
import semver from 'semver';
|
|
@@ -11513,6 +11512,75 @@ function defineConfig(config) {
|
|
|
11513
11512
|
return config;
|
|
11514
11513
|
}
|
|
11515
11514
|
|
|
11515
|
+
const defaultResolvers = [];
|
|
11516
|
+
function hasResolver(value) {
|
|
11517
|
+
return Array.isArray(value[0]);
|
|
11518
|
+
}
|
|
11519
|
+
class StaticConfigLoader extends ConfigLoader {
|
|
11520
|
+
constructor(...args) {
|
|
11521
|
+
if (hasResolver(args)) {
|
|
11522
|
+
const [resolvers, config] = args;
|
|
11523
|
+
super(resolvers, config);
|
|
11524
|
+
} else {
|
|
11525
|
+
const [config] = args;
|
|
11526
|
+
super(defaultResolvers, config);
|
|
11527
|
+
}
|
|
11528
|
+
}
|
|
11529
|
+
/**
|
|
11530
|
+
* Set a new configuration for this loader.
|
|
11531
|
+
*
|
|
11532
|
+
* @public
|
|
11533
|
+
* @since 8.20.0
|
|
11534
|
+
* @param config - New configuration to use.
|
|
11535
|
+
*/
|
|
11536
|
+
setConfig(config) {
|
|
11537
|
+
this.setConfigData(config);
|
|
11538
|
+
}
|
|
11539
|
+
getConfigFor(_handle, configOverride) {
|
|
11540
|
+
const override = this.loadFromObject(configOverride ?? {});
|
|
11541
|
+
if (isThenable(override)) {
|
|
11542
|
+
return override.then((override2) => this._resolveConfig(override2));
|
|
11543
|
+
} else {
|
|
11544
|
+
return this._resolveConfig(override);
|
|
11545
|
+
}
|
|
11546
|
+
}
|
|
11547
|
+
flushCache() {
|
|
11548
|
+
}
|
|
11549
|
+
defaultConfig() {
|
|
11550
|
+
return this.loadFromObject({
|
|
11551
|
+
extends: ["html-validate:recommended"],
|
|
11552
|
+
elements: ["html5"]
|
|
11553
|
+
});
|
|
11554
|
+
}
|
|
11555
|
+
_resolveConfig(override) {
|
|
11556
|
+
if (override.isRootFound()) {
|
|
11557
|
+
return override.resolve();
|
|
11558
|
+
}
|
|
11559
|
+
const globalConfig = this.getGlobalConfig();
|
|
11560
|
+
if (isThenable(globalConfig)) {
|
|
11561
|
+
return globalConfig.then((globalConfig2) => {
|
|
11562
|
+
const merged = globalConfig2.merge(this.resolvers, override);
|
|
11563
|
+
if (isThenable(merged)) {
|
|
11564
|
+
return merged.then((merged2) => {
|
|
11565
|
+
return merged2.resolve();
|
|
11566
|
+
});
|
|
11567
|
+
} else {
|
|
11568
|
+
return merged.resolve();
|
|
11569
|
+
}
|
|
11570
|
+
});
|
|
11571
|
+
} else {
|
|
11572
|
+
const merged = globalConfig.merge(this.resolvers, override);
|
|
11573
|
+
if (isThenable(merged)) {
|
|
11574
|
+
return merged.then((merged2) => {
|
|
11575
|
+
return merged2.resolve();
|
|
11576
|
+
});
|
|
11577
|
+
} else {
|
|
11578
|
+
return merged.resolve();
|
|
11579
|
+
}
|
|
11580
|
+
}
|
|
11581
|
+
}
|
|
11582
|
+
}
|
|
11583
|
+
|
|
11516
11584
|
class EventHandler {
|
|
11517
11585
|
listeners;
|
|
11518
11586
|
constructor() {
|
|
@@ -11574,6 +11642,153 @@ class EventHandler {
|
|
|
11574
11642
|
}
|
|
11575
11643
|
}
|
|
11576
11644
|
|
|
11645
|
+
const name = "html-validate";
|
|
11646
|
+
const version = "9.4.1";
|
|
11647
|
+
const bugs = "https://gitlab.com/html-validate/html-validate/issues/new";
|
|
11648
|
+
|
|
11649
|
+
function freeze(src) {
|
|
11650
|
+
return {
|
|
11651
|
+
...src,
|
|
11652
|
+
selector: src.selector()
|
|
11653
|
+
};
|
|
11654
|
+
}
|
|
11655
|
+
function isThenableArray(value) {
|
|
11656
|
+
if (value.length === 0) {
|
|
11657
|
+
return false;
|
|
11658
|
+
}
|
|
11659
|
+
return isThenable(value[0]);
|
|
11660
|
+
}
|
|
11661
|
+
class Reporter {
|
|
11662
|
+
result;
|
|
11663
|
+
constructor() {
|
|
11664
|
+
this.result = {};
|
|
11665
|
+
}
|
|
11666
|
+
static merge(reports) {
|
|
11667
|
+
if (isThenable(reports)) {
|
|
11668
|
+
return reports.then((reports2) => this.merge(reports2));
|
|
11669
|
+
}
|
|
11670
|
+
if (isThenableArray(reports)) {
|
|
11671
|
+
return Promise.all(reports).then((reports2) => this.merge(reports2));
|
|
11672
|
+
}
|
|
11673
|
+
const valid = reports.every((report) => report.valid);
|
|
11674
|
+
const merged = {};
|
|
11675
|
+
reports.forEach((report) => {
|
|
11676
|
+
report.results.forEach((result) => {
|
|
11677
|
+
const key = result.filePath;
|
|
11678
|
+
if (key in merged) {
|
|
11679
|
+
merged[key].messages = [...merged[key].messages, ...result.messages];
|
|
11680
|
+
} else {
|
|
11681
|
+
merged[key] = { ...result };
|
|
11682
|
+
}
|
|
11683
|
+
});
|
|
11684
|
+
});
|
|
11685
|
+
const results = Object.values(merged).map((result) => {
|
|
11686
|
+
result.errorCount = countErrors(result.messages);
|
|
11687
|
+
result.warningCount = countWarnings(result.messages);
|
|
11688
|
+
return result;
|
|
11689
|
+
});
|
|
11690
|
+
return {
|
|
11691
|
+
valid,
|
|
11692
|
+
results,
|
|
11693
|
+
errorCount: sumErrors(results),
|
|
11694
|
+
warningCount: sumWarnings(results)
|
|
11695
|
+
};
|
|
11696
|
+
}
|
|
11697
|
+
add(rule, message, severity, node, location, context) {
|
|
11698
|
+
if (!(location.filename in this.result)) {
|
|
11699
|
+
this.result[location.filename] = [];
|
|
11700
|
+
}
|
|
11701
|
+
const ruleUrl = rule.documentation(context)?.url;
|
|
11702
|
+
const entry = {
|
|
11703
|
+
ruleId: rule.name,
|
|
11704
|
+
severity,
|
|
11705
|
+
message,
|
|
11706
|
+
offset: location.offset,
|
|
11707
|
+
line: location.line,
|
|
11708
|
+
column: location.column,
|
|
11709
|
+
size: location.size || 0,
|
|
11710
|
+
selector() {
|
|
11711
|
+
return node ? node.generateSelector() : null;
|
|
11712
|
+
}
|
|
11713
|
+
};
|
|
11714
|
+
if (ruleUrl) {
|
|
11715
|
+
entry.ruleUrl = ruleUrl;
|
|
11716
|
+
}
|
|
11717
|
+
if (context) {
|
|
11718
|
+
entry.context = context;
|
|
11719
|
+
}
|
|
11720
|
+
this.result[location.filename].push(entry);
|
|
11721
|
+
}
|
|
11722
|
+
addManual(filename, message) {
|
|
11723
|
+
if (!(filename in this.result)) {
|
|
11724
|
+
this.result[filename] = [];
|
|
11725
|
+
}
|
|
11726
|
+
this.result[filename].push(message);
|
|
11727
|
+
}
|
|
11728
|
+
save(sources) {
|
|
11729
|
+
const report = {
|
|
11730
|
+
valid: this.isValid(),
|
|
11731
|
+
results: Object.keys(this.result).map((filePath) => {
|
|
11732
|
+
const messages = Array.from(this.result[filePath], freeze).sort(messageSort);
|
|
11733
|
+
const source = (sources ?? []).find((source2) => filePath === source2.filename);
|
|
11734
|
+
return {
|
|
11735
|
+
filePath,
|
|
11736
|
+
messages,
|
|
11737
|
+
errorCount: countErrors(messages),
|
|
11738
|
+
warningCount: countWarnings(messages),
|
|
11739
|
+
source: source ? source.originalData ?? source.data : null
|
|
11740
|
+
};
|
|
11741
|
+
}),
|
|
11742
|
+
errorCount: 0,
|
|
11743
|
+
warningCount: 0
|
|
11744
|
+
};
|
|
11745
|
+
report.errorCount = sumErrors(report.results);
|
|
11746
|
+
report.warningCount = sumWarnings(report.results);
|
|
11747
|
+
return report;
|
|
11748
|
+
}
|
|
11749
|
+
isValid() {
|
|
11750
|
+
const numErrors = Object.values(this.result).reduce((sum, messages) => {
|
|
11751
|
+
return sum + countErrors(messages);
|
|
11752
|
+
}, 0);
|
|
11753
|
+
return numErrors === 0;
|
|
11754
|
+
}
|
|
11755
|
+
}
|
|
11756
|
+
function countErrors(messages) {
|
|
11757
|
+
return messages.filter((m) => m.severity === Number(Severity.ERROR)).length;
|
|
11758
|
+
}
|
|
11759
|
+
function countWarnings(messages) {
|
|
11760
|
+
return messages.filter((m) => m.severity === Number(Severity.WARN)).length;
|
|
11761
|
+
}
|
|
11762
|
+
function sumErrors(results) {
|
|
11763
|
+
return results.reduce((sum, result) => {
|
|
11764
|
+
return sum + result.errorCount;
|
|
11765
|
+
}, 0);
|
|
11766
|
+
}
|
|
11767
|
+
function sumWarnings(results) {
|
|
11768
|
+
return results.reduce((sum, result) => {
|
|
11769
|
+
return sum + result.warningCount;
|
|
11770
|
+
}, 0);
|
|
11771
|
+
}
|
|
11772
|
+
function messageSort(a, b) {
|
|
11773
|
+
if (a.line < b.line) {
|
|
11774
|
+
return -1;
|
|
11775
|
+
}
|
|
11776
|
+
if (a.line > b.line) {
|
|
11777
|
+
return 1;
|
|
11778
|
+
}
|
|
11779
|
+
if (a.column < b.column) {
|
|
11780
|
+
return -1;
|
|
11781
|
+
}
|
|
11782
|
+
if (a.column > b.column) {
|
|
11783
|
+
return 1;
|
|
11784
|
+
}
|
|
11785
|
+
return 0;
|
|
11786
|
+
}
|
|
11787
|
+
|
|
11788
|
+
function definePlugin(plugin) {
|
|
11789
|
+
return plugin;
|
|
11790
|
+
}
|
|
11791
|
+
|
|
11577
11792
|
const regexp = /<!(?:--)?\[(.*?)\](?:--)?>/g;
|
|
11578
11793
|
function* parseConditionalComment(comment, commentLocation) {
|
|
11579
11794
|
let match;
|
|
@@ -12173,165 +12388,26 @@ class Parser {
|
|
|
12173
12388
|
}
|
|
12174
12389
|
}
|
|
12175
12390
|
|
|
12176
|
-
|
|
12177
|
-
|
|
12178
|
-
|
|
12179
|
-
|
|
12180
|
-
};
|
|
12181
|
-
}
|
|
12182
|
-
function isThenableArray(value) {
|
|
12183
|
-
if (value.length === 0) {
|
|
12184
|
-
return false;
|
|
12185
|
-
}
|
|
12186
|
-
return isThenable(value[0]);
|
|
12391
|
+
let blockerCounter = 1;
|
|
12392
|
+
function createBlocker() {
|
|
12393
|
+
const id = blockerCounter++;
|
|
12394
|
+
return id;
|
|
12187
12395
|
}
|
|
12188
|
-
|
|
12189
|
-
|
|
12190
|
-
|
|
12191
|
-
|
|
12192
|
-
|
|
12193
|
-
|
|
12194
|
-
|
|
12195
|
-
|
|
12196
|
-
|
|
12197
|
-
|
|
12198
|
-
|
|
12199
|
-
|
|
12200
|
-
|
|
12201
|
-
|
|
12202
|
-
|
|
12203
|
-
report.results.forEach((result) => {
|
|
12204
|
-
const key = result.filePath;
|
|
12205
|
-
if (key in merged) {
|
|
12206
|
-
merged[key].messages = [...merged[key].messages, ...result.messages];
|
|
12207
|
-
} else {
|
|
12208
|
-
merged[key] = { ...result };
|
|
12209
|
-
}
|
|
12210
|
-
});
|
|
12211
|
-
});
|
|
12212
|
-
const results = Object.values(merged).map((result) => {
|
|
12213
|
-
result.errorCount = countErrors(result.messages);
|
|
12214
|
-
result.warningCount = countWarnings(result.messages);
|
|
12215
|
-
return result;
|
|
12216
|
-
});
|
|
12217
|
-
return {
|
|
12218
|
-
valid,
|
|
12219
|
-
results,
|
|
12220
|
-
errorCount: sumErrors(results),
|
|
12221
|
-
warningCount: sumWarnings(results)
|
|
12222
|
-
};
|
|
12223
|
-
}
|
|
12224
|
-
add(rule, message, severity, node, location, context) {
|
|
12225
|
-
if (!(location.filename in this.result)) {
|
|
12226
|
-
this.result[location.filename] = [];
|
|
12227
|
-
}
|
|
12228
|
-
const ruleUrl = rule.documentation(context)?.url;
|
|
12229
|
-
const entry = {
|
|
12230
|
-
ruleId: rule.name,
|
|
12231
|
-
severity,
|
|
12232
|
-
message,
|
|
12233
|
-
offset: location.offset,
|
|
12234
|
-
line: location.line,
|
|
12235
|
-
column: location.column,
|
|
12236
|
-
size: location.size || 0,
|
|
12237
|
-
selector() {
|
|
12238
|
-
return node ? node.generateSelector() : null;
|
|
12239
|
-
}
|
|
12240
|
-
};
|
|
12241
|
-
if (ruleUrl) {
|
|
12242
|
-
entry.ruleUrl = ruleUrl;
|
|
12243
|
-
}
|
|
12244
|
-
if (context) {
|
|
12245
|
-
entry.context = context;
|
|
12246
|
-
}
|
|
12247
|
-
this.result[location.filename].push(entry);
|
|
12248
|
-
}
|
|
12249
|
-
addManual(filename, message) {
|
|
12250
|
-
if (!(filename in this.result)) {
|
|
12251
|
-
this.result[filename] = [];
|
|
12252
|
-
}
|
|
12253
|
-
this.result[filename].push(message);
|
|
12254
|
-
}
|
|
12255
|
-
save(sources) {
|
|
12256
|
-
const report = {
|
|
12257
|
-
valid: this.isValid(),
|
|
12258
|
-
results: Object.keys(this.result).map((filePath) => {
|
|
12259
|
-
const messages = Array.from(this.result[filePath], freeze).sort(messageSort);
|
|
12260
|
-
const source = (sources ?? []).find((source2) => filePath === source2.filename);
|
|
12261
|
-
return {
|
|
12262
|
-
filePath,
|
|
12263
|
-
messages,
|
|
12264
|
-
errorCount: countErrors(messages),
|
|
12265
|
-
warningCount: countWarnings(messages),
|
|
12266
|
-
source: source ? source.originalData ?? source.data : null
|
|
12267
|
-
};
|
|
12268
|
-
}),
|
|
12269
|
-
errorCount: 0,
|
|
12270
|
-
warningCount: 0
|
|
12271
|
-
};
|
|
12272
|
-
report.errorCount = sumErrors(report.results);
|
|
12273
|
-
report.warningCount = sumWarnings(report.results);
|
|
12274
|
-
return report;
|
|
12275
|
-
}
|
|
12276
|
-
isValid() {
|
|
12277
|
-
const numErrors = Object.values(this.result).reduce((sum, messages) => {
|
|
12278
|
-
return sum + countErrors(messages);
|
|
12279
|
-
}, 0);
|
|
12280
|
-
return numErrors === 0;
|
|
12281
|
-
}
|
|
12282
|
-
}
|
|
12283
|
-
function countErrors(messages) {
|
|
12284
|
-
return messages.filter((m) => m.severity === Number(Severity.ERROR)).length;
|
|
12285
|
-
}
|
|
12286
|
-
function countWarnings(messages) {
|
|
12287
|
-
return messages.filter((m) => m.severity === Number(Severity.WARN)).length;
|
|
12288
|
-
}
|
|
12289
|
-
function sumErrors(results) {
|
|
12290
|
-
return results.reduce((sum, result) => {
|
|
12291
|
-
return sum + result.errorCount;
|
|
12292
|
-
}, 0);
|
|
12293
|
-
}
|
|
12294
|
-
function sumWarnings(results) {
|
|
12295
|
-
return results.reduce((sum, result) => {
|
|
12296
|
-
return sum + result.warningCount;
|
|
12297
|
-
}, 0);
|
|
12298
|
-
}
|
|
12299
|
-
function messageSort(a, b) {
|
|
12300
|
-
if (a.line < b.line) {
|
|
12301
|
-
return -1;
|
|
12302
|
-
}
|
|
12303
|
-
if (a.line > b.line) {
|
|
12304
|
-
return 1;
|
|
12305
|
-
}
|
|
12306
|
-
if (a.column < b.column) {
|
|
12307
|
-
return -1;
|
|
12308
|
-
}
|
|
12309
|
-
if (a.column > b.column) {
|
|
12310
|
-
return 1;
|
|
12311
|
-
}
|
|
12312
|
-
return 0;
|
|
12313
|
-
}
|
|
12314
|
-
|
|
12315
|
-
let blockerCounter = 1;
|
|
12316
|
-
function createBlocker() {
|
|
12317
|
-
const id = blockerCounter++;
|
|
12318
|
-
return id;
|
|
12319
|
-
}
|
|
12320
|
-
|
|
12321
|
-
class Engine {
|
|
12322
|
-
report;
|
|
12323
|
-
config;
|
|
12324
|
-
ParserClass;
|
|
12325
|
-
availableRules;
|
|
12326
|
-
constructor(config, ParserClass) {
|
|
12327
|
-
this.report = new Reporter();
|
|
12328
|
-
this.config = config;
|
|
12329
|
-
this.ParserClass = ParserClass;
|
|
12330
|
-
const result = this.initPlugins(this.config);
|
|
12331
|
-
this.availableRules = {
|
|
12332
|
-
...bundledRules,
|
|
12333
|
-
...result.availableRules
|
|
12334
|
-
};
|
|
12396
|
+
|
|
12397
|
+
class Engine {
|
|
12398
|
+
report;
|
|
12399
|
+
config;
|
|
12400
|
+
ParserClass;
|
|
12401
|
+
availableRules;
|
|
12402
|
+
constructor(config, ParserClass) {
|
|
12403
|
+
this.report = new Reporter();
|
|
12404
|
+
this.config = config;
|
|
12405
|
+
this.ParserClass = ParserClass;
|
|
12406
|
+
const result = this.initPlugins(this.config);
|
|
12407
|
+
this.availableRules = {
|
|
12408
|
+
...bundledRules,
|
|
12409
|
+
...result.availableRules
|
|
12410
|
+
};
|
|
12335
12411
|
}
|
|
12336
12412
|
/**
|
|
12337
12413
|
* Lint sources and return report
|
|
@@ -12647,75 +12723,6 @@ class Engine {
|
|
|
12647
12723
|
}
|
|
12648
12724
|
}
|
|
12649
12725
|
|
|
12650
|
-
const defaultResolvers = [];
|
|
12651
|
-
function hasResolver(value) {
|
|
12652
|
-
return Array.isArray(value[0]);
|
|
12653
|
-
}
|
|
12654
|
-
class StaticConfigLoader extends ConfigLoader {
|
|
12655
|
-
constructor(...args) {
|
|
12656
|
-
if (hasResolver(args)) {
|
|
12657
|
-
const [resolvers, config] = args;
|
|
12658
|
-
super(resolvers, config);
|
|
12659
|
-
} else {
|
|
12660
|
-
const [config] = args;
|
|
12661
|
-
super(defaultResolvers, config);
|
|
12662
|
-
}
|
|
12663
|
-
}
|
|
12664
|
-
/**
|
|
12665
|
-
* Set a new configuration for this loader.
|
|
12666
|
-
*
|
|
12667
|
-
* @public
|
|
12668
|
-
* @since 8.20.0
|
|
12669
|
-
* @param config - New configuration to use.
|
|
12670
|
-
*/
|
|
12671
|
-
setConfig(config) {
|
|
12672
|
-
this.setConfigData(config);
|
|
12673
|
-
}
|
|
12674
|
-
getConfigFor(_handle, configOverride) {
|
|
12675
|
-
const override = this.loadFromObject(configOverride ?? {});
|
|
12676
|
-
if (isThenable(override)) {
|
|
12677
|
-
return override.then((override2) => this._resolveConfig(override2));
|
|
12678
|
-
} else {
|
|
12679
|
-
return this._resolveConfig(override);
|
|
12680
|
-
}
|
|
12681
|
-
}
|
|
12682
|
-
flushCache() {
|
|
12683
|
-
}
|
|
12684
|
-
defaultConfig() {
|
|
12685
|
-
return this.loadFromObject({
|
|
12686
|
-
extends: ["html-validate:recommended"],
|
|
12687
|
-
elements: ["html5"]
|
|
12688
|
-
});
|
|
12689
|
-
}
|
|
12690
|
-
_resolveConfig(override) {
|
|
12691
|
-
if (override.isRootFound()) {
|
|
12692
|
-
return override.resolve();
|
|
12693
|
-
}
|
|
12694
|
-
const globalConfig = this.getGlobalConfig();
|
|
12695
|
-
if (isThenable(globalConfig)) {
|
|
12696
|
-
return globalConfig.then((globalConfig2) => {
|
|
12697
|
-
const merged = globalConfig2.merge(this.resolvers, override);
|
|
12698
|
-
if (isThenable(merged)) {
|
|
12699
|
-
return merged.then((merged2) => {
|
|
12700
|
-
return merged2.resolve();
|
|
12701
|
-
});
|
|
12702
|
-
} else {
|
|
12703
|
-
return merged.resolve();
|
|
12704
|
-
}
|
|
12705
|
-
});
|
|
12706
|
-
} else {
|
|
12707
|
-
const merged = globalConfig.merge(this.resolvers, override);
|
|
12708
|
-
if (isThenable(merged)) {
|
|
12709
|
-
return merged.then((merged2) => {
|
|
12710
|
-
return merged2.resolve();
|
|
12711
|
-
});
|
|
12712
|
-
} else {
|
|
12713
|
-
return merged.resolve();
|
|
12714
|
-
}
|
|
12715
|
-
}
|
|
12716
|
-
}
|
|
12717
|
-
}
|
|
12718
|
-
|
|
12719
12726
|
function getNamedTransformerFromPlugin(name, plugins, pluginName, key) {
|
|
12720
12727
|
const plugin = plugins.find((cur) => cur.name === pluginName);
|
|
12721
12728
|
if (!plugin) {
|
|
@@ -12895,10 +12902,11 @@ function transformSourceSync(resolvers, config, source, filename) {
|
|
|
12895
12902
|
}
|
|
12896
12903
|
}
|
|
12897
12904
|
|
|
12898
|
-
function transformFilename(resolvers, config, filename) {
|
|
12905
|
+
function transformFilename(resolvers, config, filename, fs) {
|
|
12899
12906
|
const stdin = 0;
|
|
12900
12907
|
const src = filename !== "/dev/stdin" ? filename : stdin;
|
|
12901
|
-
const
|
|
12908
|
+
const output = fs.readFileSync(src, { encoding: "utf8" });
|
|
12909
|
+
const data = typeof output === "string" ? output : output.toString("utf8");
|
|
12902
12910
|
const source = {
|
|
12903
12911
|
data,
|
|
12904
12912
|
filename,
|
|
@@ -12909,10 +12917,11 @@ function transformFilename(resolvers, config, filename) {
|
|
|
12909
12917
|
};
|
|
12910
12918
|
return transformSource(resolvers, config, source, filename);
|
|
12911
12919
|
}
|
|
12912
|
-
function transformFilenameSync(resolvers, config, filename) {
|
|
12920
|
+
function transformFilenameSync(resolvers, config, filename, fs) {
|
|
12913
12921
|
const stdin = 0;
|
|
12914
12922
|
const src = filename !== "/dev/stdin" ? filename : stdin;
|
|
12915
|
-
const
|
|
12923
|
+
const output = fs.readFileSync(src, { encoding: "utf8" });
|
|
12924
|
+
const data = typeof output === "string" ? output : output.toString("utf8");
|
|
12916
12925
|
const source = {
|
|
12917
12926
|
data,
|
|
12918
12927
|
filename,
|
|
@@ -12924,430 +12933,6 @@ function transformFilenameSync(resolvers, config, filename) {
|
|
|
12924
12933
|
return transformSourceSync(resolvers, config, source, filename);
|
|
12925
12934
|
}
|
|
12926
12935
|
|
|
12927
|
-
function isSourceHooks(value) {
|
|
12928
|
-
if (!value || typeof value === "string") {
|
|
12929
|
-
return false;
|
|
12930
|
-
}
|
|
12931
|
-
return Boolean(value.processAttribute || value.processElement);
|
|
12932
|
-
}
|
|
12933
|
-
function isConfigData(value) {
|
|
12934
|
-
if (!value || typeof value === "string") {
|
|
12935
|
-
return false;
|
|
12936
|
-
}
|
|
12937
|
-
return !(value.processAttribute || value.processElement);
|
|
12938
|
-
}
|
|
12939
|
-
class HtmlValidate {
|
|
12940
|
-
configLoader;
|
|
12941
|
-
constructor(arg) {
|
|
12942
|
-
const [loader, config] = arg instanceof ConfigLoader ? [arg, void 0] : [void 0, arg];
|
|
12943
|
-
this.configLoader = loader ?? new StaticConfigLoader(config);
|
|
12944
|
-
}
|
|
12945
|
-
/* eslint-enable @typescript-eslint/unified-signatures */
|
|
12946
|
-
validateString(str, arg1, arg2, arg3) {
|
|
12947
|
-
const filename = typeof arg1 === "string" ? arg1 : "inline";
|
|
12948
|
-
const options = isConfigData(arg1) ? arg1 : isConfigData(arg2) ? arg2 : void 0;
|
|
12949
|
-
const hooks = isSourceHooks(arg1) ? arg1 : isSourceHooks(arg2) ? arg2 : arg3;
|
|
12950
|
-
const source = {
|
|
12951
|
-
data: str,
|
|
12952
|
-
filename,
|
|
12953
|
-
line: 1,
|
|
12954
|
-
column: 1,
|
|
12955
|
-
offset: 0,
|
|
12956
|
-
hooks
|
|
12957
|
-
};
|
|
12958
|
-
return this.validateSource(source, options);
|
|
12959
|
-
}
|
|
12960
|
-
/* eslint-enable @typescript-eslint/unified-signatures */
|
|
12961
|
-
validateStringSync(str, arg1, arg2, arg3) {
|
|
12962
|
-
const filename = typeof arg1 === "string" ? arg1 : "inline";
|
|
12963
|
-
const options = isConfigData(arg1) ? arg1 : isConfigData(arg2) ? arg2 : void 0;
|
|
12964
|
-
const hooks = isSourceHooks(arg1) ? arg1 : isSourceHooks(arg2) ? arg2 : arg3;
|
|
12965
|
-
const source = {
|
|
12966
|
-
data: str,
|
|
12967
|
-
filename,
|
|
12968
|
-
line: 1,
|
|
12969
|
-
column: 1,
|
|
12970
|
-
offset: 0,
|
|
12971
|
-
hooks
|
|
12972
|
-
};
|
|
12973
|
-
return this.validateSourceSync(source, options);
|
|
12974
|
-
}
|
|
12975
|
-
/**
|
|
12976
|
-
* Parse and validate HTML from [[Source]].
|
|
12977
|
-
*
|
|
12978
|
-
* @public
|
|
12979
|
-
* @param input - Source to parse.
|
|
12980
|
-
* @returns Report output.
|
|
12981
|
-
*/
|
|
12982
|
-
async validateSource(input, configOverride) {
|
|
12983
|
-
const source = normalizeSource(input);
|
|
12984
|
-
const config = await this.getConfigFor(source.filename, configOverride);
|
|
12985
|
-
const resolvers = this.configLoader.getResolvers();
|
|
12986
|
-
const transformedSource = await transformSource(resolvers, config, source);
|
|
12987
|
-
const engine = new Engine(config, Parser);
|
|
12988
|
-
return engine.lint(transformedSource);
|
|
12989
|
-
}
|
|
12990
|
-
/**
|
|
12991
|
-
* Parse and validate HTML from [[Source]].
|
|
12992
|
-
*
|
|
12993
|
-
* @public
|
|
12994
|
-
* @param input - Source to parse.
|
|
12995
|
-
* @returns Report output.
|
|
12996
|
-
*/
|
|
12997
|
-
validateSourceSync(input, configOverride) {
|
|
12998
|
-
const source = normalizeSource(input);
|
|
12999
|
-
const config = this.getConfigForSync(source.filename, configOverride);
|
|
13000
|
-
const resolvers = this.configLoader.getResolvers();
|
|
13001
|
-
const transformedSource = transformSourceSync(resolvers, config, source);
|
|
13002
|
-
const engine = new Engine(config, Parser);
|
|
13003
|
-
return engine.lint(transformedSource);
|
|
13004
|
-
}
|
|
13005
|
-
/**
|
|
13006
|
-
* Parse and validate HTML from file.
|
|
13007
|
-
*
|
|
13008
|
-
* @public
|
|
13009
|
-
* @param filename - Filename to read and parse.
|
|
13010
|
-
* @returns Report output.
|
|
13011
|
-
*/
|
|
13012
|
-
async validateFile(filename) {
|
|
13013
|
-
const config = await this.getConfigFor(filename);
|
|
13014
|
-
const resolvers = this.configLoader.getResolvers();
|
|
13015
|
-
const source = await transformFilename(resolvers, config, filename);
|
|
13016
|
-
const engine = new Engine(config, Parser);
|
|
13017
|
-
return Promise.resolve(engine.lint(source));
|
|
13018
|
-
}
|
|
13019
|
-
/**
|
|
13020
|
-
* Parse and validate HTML from file.
|
|
13021
|
-
*
|
|
13022
|
-
* @public
|
|
13023
|
-
* @param filename - Filename to read and parse.
|
|
13024
|
-
* @returns Report output.
|
|
13025
|
-
*/
|
|
13026
|
-
validateFileSync(filename) {
|
|
13027
|
-
const config = this.getConfigForSync(filename);
|
|
13028
|
-
const resolvers = this.configLoader.getResolvers();
|
|
13029
|
-
const source = transformFilenameSync(resolvers, config, filename);
|
|
13030
|
-
const engine = new Engine(config, Parser);
|
|
13031
|
-
return engine.lint(source);
|
|
13032
|
-
}
|
|
13033
|
-
/**
|
|
13034
|
-
* Parse and validate HTML from multiple files. Result is merged together to a
|
|
13035
|
-
* single report.
|
|
13036
|
-
*
|
|
13037
|
-
* @param filenames - Filenames to read and parse.
|
|
13038
|
-
* @returns Report output.
|
|
13039
|
-
*/
|
|
13040
|
-
async validateMultipleFiles(filenames) {
|
|
13041
|
-
return Reporter.merge(filenames.map((filename) => this.validateFile(filename)));
|
|
13042
|
-
}
|
|
13043
|
-
/**
|
|
13044
|
-
* Parse and validate HTML from multiple files. Result is merged together to a
|
|
13045
|
-
* single report.
|
|
13046
|
-
*
|
|
13047
|
-
* @param filenames - Filenames to read and parse.
|
|
13048
|
-
* @returns Report output.
|
|
13049
|
-
*/
|
|
13050
|
-
validateMultipleFilesSync(filenames) {
|
|
13051
|
-
return Reporter.merge(filenames.map((filename) => this.validateFileSync(filename)));
|
|
13052
|
-
}
|
|
13053
|
-
/**
|
|
13054
|
-
* Returns true if the given filename can be validated.
|
|
13055
|
-
*
|
|
13056
|
-
* A file is considered to be validatable if the extension is `.html` or if a
|
|
13057
|
-
* transformer matches the filename.
|
|
13058
|
-
*
|
|
13059
|
-
* This is mostly useful for tooling to determine whenever to validate the
|
|
13060
|
-
* file or not. CLI tools will run on all the given files anyway.
|
|
13061
|
-
*/
|
|
13062
|
-
async canValidate(filename) {
|
|
13063
|
-
if (filename.toLowerCase().endsWith(".html")) {
|
|
13064
|
-
return true;
|
|
13065
|
-
}
|
|
13066
|
-
const config = await this.getConfigFor(filename);
|
|
13067
|
-
return config.canTransform(filename);
|
|
13068
|
-
}
|
|
13069
|
-
/**
|
|
13070
|
-
* Returns true if the given filename can be validated.
|
|
13071
|
-
*
|
|
13072
|
-
* A file is considered to be validatable if the extension is `.html` or if a
|
|
13073
|
-
* transformer matches the filename.
|
|
13074
|
-
*
|
|
13075
|
-
* This is mostly useful for tooling to determine whenever to validate the
|
|
13076
|
-
* file or not. CLI tools will run on all the given files anyway.
|
|
13077
|
-
*/
|
|
13078
|
-
canValidateSync(filename) {
|
|
13079
|
-
if (filename.toLowerCase().endsWith(".html")) {
|
|
13080
|
-
return true;
|
|
13081
|
-
}
|
|
13082
|
-
const config = this.getConfigForSync(filename);
|
|
13083
|
-
return config.canTransform(filename);
|
|
13084
|
-
}
|
|
13085
|
-
/**
|
|
13086
|
-
* Tokenize filename and output all tokens.
|
|
13087
|
-
*
|
|
13088
|
-
* Using CLI this is enabled with `--dump-tokens`. Mostly useful for
|
|
13089
|
-
* debugging.
|
|
13090
|
-
*
|
|
13091
|
-
* @internal
|
|
13092
|
-
* @param filename - Filename to tokenize.
|
|
13093
|
-
*/
|
|
13094
|
-
async dumpTokens(filename) {
|
|
13095
|
-
const config = await this.getConfigFor(filename);
|
|
13096
|
-
const resolvers = this.configLoader.getResolvers();
|
|
13097
|
-
const source = await transformFilename(resolvers, config, filename);
|
|
13098
|
-
const engine = new Engine(config, Parser);
|
|
13099
|
-
return engine.dumpTokens(source);
|
|
13100
|
-
}
|
|
13101
|
-
/**
|
|
13102
|
-
* Parse filename and output all events.
|
|
13103
|
-
*
|
|
13104
|
-
* Using CLI this is enabled with `--dump-events`. Mostly useful for
|
|
13105
|
-
* debugging.
|
|
13106
|
-
*
|
|
13107
|
-
* @internal
|
|
13108
|
-
* @param filename - Filename to dump events from.
|
|
13109
|
-
*/
|
|
13110
|
-
async dumpEvents(filename) {
|
|
13111
|
-
const config = await this.getConfigFor(filename);
|
|
13112
|
-
const resolvers = this.configLoader.getResolvers();
|
|
13113
|
-
const source = await transformFilename(resolvers, config, filename);
|
|
13114
|
-
const engine = new Engine(config, Parser);
|
|
13115
|
-
return engine.dumpEvents(source);
|
|
13116
|
-
}
|
|
13117
|
-
/**
|
|
13118
|
-
* Parse filename and output DOM tree.
|
|
13119
|
-
*
|
|
13120
|
-
* Using CLI this is enabled with `--dump-tree`. Mostly useful for
|
|
13121
|
-
* debugging.
|
|
13122
|
-
*
|
|
13123
|
-
* @internal
|
|
13124
|
-
* @param filename - Filename to dump DOM tree from.
|
|
13125
|
-
*/
|
|
13126
|
-
async dumpTree(filename) {
|
|
13127
|
-
const config = await this.getConfigFor(filename);
|
|
13128
|
-
const resolvers = this.configLoader.getResolvers();
|
|
13129
|
-
const source = await transformFilename(resolvers, config, filename);
|
|
13130
|
-
const engine = new Engine(config, Parser);
|
|
13131
|
-
return engine.dumpTree(source);
|
|
13132
|
-
}
|
|
13133
|
-
/**
|
|
13134
|
-
* Transform filename and output source data.
|
|
13135
|
-
*
|
|
13136
|
-
* Using CLI this is enabled with `--dump-source`. Mostly useful for
|
|
13137
|
-
* debugging.
|
|
13138
|
-
*
|
|
13139
|
-
* @internal
|
|
13140
|
-
* @param filename - Filename to dump source from.
|
|
13141
|
-
*/
|
|
13142
|
-
async dumpSource(filename) {
|
|
13143
|
-
const config = await this.getConfigFor(filename);
|
|
13144
|
-
const resolvers = this.configLoader.getResolvers();
|
|
13145
|
-
const sources = await transformFilename(resolvers, config, filename);
|
|
13146
|
-
return sources.reduce((result, source) => {
|
|
13147
|
-
const line = String(source.line);
|
|
13148
|
-
const column = String(source.column);
|
|
13149
|
-
const offset = String(source.offset);
|
|
13150
|
-
result.push(`Source ${source.filename}@${line}:${column} (offset: ${offset})`);
|
|
13151
|
-
if (source.transformedBy) {
|
|
13152
|
-
result.push("Transformed by:");
|
|
13153
|
-
result = result.concat(source.transformedBy.reverse().map((name) => ` - ${name}`));
|
|
13154
|
-
}
|
|
13155
|
-
if (source.hooks && Object.keys(source.hooks).length > 0) {
|
|
13156
|
-
result.push("Hooks");
|
|
13157
|
-
for (const [key, present] of Object.entries(source.hooks)) {
|
|
13158
|
-
if (present) {
|
|
13159
|
-
result.push(` - ${key}`);
|
|
13160
|
-
}
|
|
13161
|
-
}
|
|
13162
|
-
}
|
|
13163
|
-
result.push("---");
|
|
13164
|
-
result = result.concat(source.data.split("\n"));
|
|
13165
|
-
result.push("---");
|
|
13166
|
-
return result;
|
|
13167
|
-
}, []);
|
|
13168
|
-
}
|
|
13169
|
-
/**
|
|
13170
|
-
* Get effective configuration schema.
|
|
13171
|
-
*/
|
|
13172
|
-
getConfigurationSchema() {
|
|
13173
|
-
return Promise.resolve(configurationSchema);
|
|
13174
|
-
}
|
|
13175
|
-
/**
|
|
13176
|
-
* Get effective metadata element schema.
|
|
13177
|
-
*
|
|
13178
|
-
* If a filename is given the configured plugins can extend the
|
|
13179
|
-
* schema. Filename must not be an existing file or a filetype normally
|
|
13180
|
-
* handled by html-validate but the path will be used when resolving
|
|
13181
|
-
* configuration. As a rule-of-thumb, set it to the elements json file.
|
|
13182
|
-
*/
|
|
13183
|
-
async getElementsSchema(filename) {
|
|
13184
|
-
const config = await this.getConfigFor(filename ?? "inline");
|
|
13185
|
-
const metaTable = config.getMetaTable();
|
|
13186
|
-
return metaTable.getJSONSchema();
|
|
13187
|
-
}
|
|
13188
|
-
/**
|
|
13189
|
-
* Get effective metadata element schema.
|
|
13190
|
-
*
|
|
13191
|
-
* If a filename is given the configured plugins can extend the
|
|
13192
|
-
* schema. Filename must not be an existing file or a filetype normally
|
|
13193
|
-
* handled by html-validate but the path will be used when resolving
|
|
13194
|
-
* configuration. As a rule-of-thumb, set it to the elements json file.
|
|
13195
|
-
*/
|
|
13196
|
-
getElementsSchemaSync(filename) {
|
|
13197
|
-
const config = this.getConfigForSync(filename ?? "inline");
|
|
13198
|
-
const metaTable = config.getMetaTable();
|
|
13199
|
-
return metaTable.getJSONSchema();
|
|
13200
|
-
}
|
|
13201
|
-
async getContextualDocumentation(message, filenameOrConfig = "inline") {
|
|
13202
|
-
const config = typeof filenameOrConfig === "string" ? await this.getConfigFor(filenameOrConfig) : await filenameOrConfig;
|
|
13203
|
-
const engine = new Engine(config, Parser);
|
|
13204
|
-
return engine.getRuleDocumentation(message);
|
|
13205
|
-
}
|
|
13206
|
-
getContextualDocumentationSync(message, filenameOrConfig = "inline") {
|
|
13207
|
-
const config = typeof filenameOrConfig === "string" ? this.getConfigForSync(filenameOrConfig) : filenameOrConfig;
|
|
13208
|
-
const engine = new Engine(config, Parser);
|
|
13209
|
-
return engine.getRuleDocumentation(message);
|
|
13210
|
-
}
|
|
13211
|
-
/**
|
|
13212
|
-
* Get contextual documentation for the given rule.
|
|
13213
|
-
*
|
|
13214
|
-
* Typical usage:
|
|
13215
|
-
*
|
|
13216
|
-
* ```js
|
|
13217
|
-
* const report = await htmlvalidate.validateFile("my-file.html");
|
|
13218
|
-
* for (const result of report.results){
|
|
13219
|
-
* const config = await htmlvalidate.getConfigFor(result.filePath);
|
|
13220
|
-
* for (const message of result.messages){
|
|
13221
|
-
* const documentation = await htmlvalidate.getRuleDocumentation(message.ruleId, config, message.context);
|
|
13222
|
-
* // do something with documentation
|
|
13223
|
-
* }
|
|
13224
|
-
* }
|
|
13225
|
-
* ```
|
|
13226
|
-
*
|
|
13227
|
-
* @public
|
|
13228
|
-
* @deprecated Deprecated since 8.0.0, use [[getContextualDocumentation]] instead.
|
|
13229
|
-
* @param ruleId - Rule to get documentation for.
|
|
13230
|
-
* @param config - If set it provides more accurate description by using the
|
|
13231
|
-
* correct configuration for the file.
|
|
13232
|
-
* @param context - If set to `Message.context` some rules can provide
|
|
13233
|
-
* contextual details and suggestions.
|
|
13234
|
-
*/
|
|
13235
|
-
async getRuleDocumentation(ruleId, config = null, context = null) {
|
|
13236
|
-
const c = config ?? this.getConfigFor("inline");
|
|
13237
|
-
const engine = new Engine(await c, Parser);
|
|
13238
|
-
return engine.getRuleDocumentation({ ruleId, context });
|
|
13239
|
-
}
|
|
13240
|
-
/**
|
|
13241
|
-
* Get contextual documentation for the given rule.
|
|
13242
|
-
*
|
|
13243
|
-
* Typical usage:
|
|
13244
|
-
*
|
|
13245
|
-
* ```js
|
|
13246
|
-
* const report = htmlvalidate.validateFileSync("my-file.html");
|
|
13247
|
-
* for (const result of report.results){
|
|
13248
|
-
* const config = htmlvalidate.getConfigForSync(result.filePath);
|
|
13249
|
-
* for (const message of result.messages){
|
|
13250
|
-
* const documentation = htmlvalidate.getRuleDocumentationSync(message.ruleId, config, message.context);
|
|
13251
|
-
* // do something with documentation
|
|
13252
|
-
* }
|
|
13253
|
-
* }
|
|
13254
|
-
* ```
|
|
13255
|
-
*
|
|
13256
|
-
* @public
|
|
13257
|
-
* @deprecated Deprecated since 8.0.0, use [[getContextualDocumentationSync]] instead.
|
|
13258
|
-
* @param ruleId - Rule to get documentation for.
|
|
13259
|
-
* @param config - If set it provides more accurate description by using the
|
|
13260
|
-
* correct configuration for the file.
|
|
13261
|
-
* @param context - If set to `Message.context` some rules can provide
|
|
13262
|
-
* contextual details and suggestions.
|
|
13263
|
-
*/
|
|
13264
|
-
getRuleDocumentationSync(ruleId, config = null, context = null) {
|
|
13265
|
-
const c = config ?? this.getConfigForSync("inline");
|
|
13266
|
-
const engine = new Engine(c, Parser);
|
|
13267
|
-
return engine.getRuleDocumentation({ ruleId, context });
|
|
13268
|
-
}
|
|
13269
|
-
/**
|
|
13270
|
-
* Create a parser configured for given filename.
|
|
13271
|
-
*
|
|
13272
|
-
* @internal
|
|
13273
|
-
* @param source - Source to use.
|
|
13274
|
-
*/
|
|
13275
|
-
async getParserFor(source) {
|
|
13276
|
-
const config = await this.getConfigFor(source.filename);
|
|
13277
|
-
return new Parser(config);
|
|
13278
|
-
}
|
|
13279
|
-
/**
|
|
13280
|
-
* Get configuration for given filename.
|
|
13281
|
-
*
|
|
13282
|
-
* See [[FileSystemConfigLoader]] for details.
|
|
13283
|
-
*
|
|
13284
|
-
* @public
|
|
13285
|
-
* @param filename - Filename to get configuration for.
|
|
13286
|
-
* @param configOverride - Configuration to apply last.
|
|
13287
|
-
*/
|
|
13288
|
-
getConfigFor(filename, configOverride) {
|
|
13289
|
-
const config = this.configLoader.getConfigFor(filename, configOverride);
|
|
13290
|
-
return Promise.resolve(config);
|
|
13291
|
-
}
|
|
13292
|
-
/**
|
|
13293
|
-
* Get configuration for given filename.
|
|
13294
|
-
*
|
|
13295
|
-
* See [[FileSystemConfigLoader]] for details.
|
|
13296
|
-
*
|
|
13297
|
-
* @public
|
|
13298
|
-
* @param filename - Filename to get configuration for.
|
|
13299
|
-
* @param configOverride - Configuration to apply last.
|
|
13300
|
-
*/
|
|
13301
|
-
getConfigForSync(filename, configOverride) {
|
|
13302
|
-
const config = this.configLoader.getConfigFor(filename, configOverride);
|
|
13303
|
-
if (isThenable(config)) {
|
|
13304
|
-
throw new UserError("Cannot use asynchronous config loader with synchronous api");
|
|
13305
|
-
}
|
|
13306
|
-
return config;
|
|
13307
|
-
}
|
|
13308
|
-
/**
|
|
13309
|
-
* Get current configuration loader.
|
|
13310
|
-
*
|
|
13311
|
-
* @public
|
|
13312
|
-
* @since %version%
|
|
13313
|
-
* @returns Current configuration loader.
|
|
13314
|
-
*/
|
|
13315
|
-
/* istanbul ignore next -- not testing setters/getters */
|
|
13316
|
-
getConfigLoader() {
|
|
13317
|
-
return this.configLoader;
|
|
13318
|
-
}
|
|
13319
|
-
/**
|
|
13320
|
-
* Set configuration loader.
|
|
13321
|
-
*
|
|
13322
|
-
* @public
|
|
13323
|
-
* @since %version%
|
|
13324
|
-
* @param loader - New configuration loader to use.
|
|
13325
|
-
*/
|
|
13326
|
-
/* istanbul ignore next -- not testing setters/getters */
|
|
13327
|
-
setConfigLoader(loader) {
|
|
13328
|
-
this.configLoader = loader;
|
|
13329
|
-
}
|
|
13330
|
-
/**
|
|
13331
|
-
* Flush configuration cache. Clears full cache unless a filename is given.
|
|
13332
|
-
*
|
|
13333
|
-
* See [[FileSystemConfigLoader]] for details.
|
|
13334
|
-
*
|
|
13335
|
-
* @public
|
|
13336
|
-
* @param filename - If set, only flush cache for given filename.
|
|
13337
|
-
*/
|
|
13338
|
-
flushConfigCache(filename) {
|
|
13339
|
-
this.configLoader.flushCache(filename);
|
|
13340
|
-
}
|
|
13341
|
-
}
|
|
13342
|
-
|
|
13343
|
-
const name = "html-validate";
|
|
13344
|
-
const version = "9.3.0";
|
|
13345
|
-
const bugs = "https://gitlab.com/html-validate/html-validate/issues/new";
|
|
13346
|
-
|
|
13347
|
-
function definePlugin(plugin) {
|
|
13348
|
-
return plugin;
|
|
13349
|
-
}
|
|
13350
|
-
|
|
13351
12936
|
const entities = {
|
|
13352
12937
|
">": ">",
|
|
13353
12938
|
"<": "<",
|
|
@@ -14455,5 +14040,5 @@ const engines = {
|
|
|
14455
14040
|
|
|
14456
14041
|
var workerPath = "./jest-worker.js";
|
|
14457
14042
|
|
|
14458
|
-
export { Attribute as A,
|
|
14043
|
+
export { compatibilityCheckImpl as $, Attribute as A, Reporter as B, Config as C, DOMNode as D, definePlugin as E, ruleExists as F, walk as G, HtmlElement as H, EventHandler as I, engines as J, normalizeSource as K, transformSource as L, MetaCopyableProperty as M, NodeClosed as N, Engine as O, Parser as P, transformSourceSync as Q, ResolvedConfig as R, Severity as S, TextNode as T, UserError as U, Validator as V, WrappedError as W, transformFilename as X, transformFilenameSync as Y, configurationSchema as Z, isThenable as _, ConfigError as a, workerPath as a0, codeframe as a1, name as a2, bugs as a3, ConfigLoader as b, defineConfig as c, deepmerge as d, ensureError as e, StaticConfigLoader as f, getFormatter as g, DOMTokenList as h, ignore as i, DOMTree as j, DynamicValue as k, NodeType as l, NestedError as m, SchemaValidationError as n, isUserError as o, presets as p, MetaTable as q, TextContent$1 as r, staticResolver as s, Rule as t, ariaNaming as u, version as v, TextClassification as w, classifyNodeText as x, keywordPatternMatcher as y, sliceLocation as z };
|
|
14459
14044
|
//# sourceMappingURL=core.js.map
|