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