html-validate 10.11.2 → 10.12.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/cli.js +1 -1
- package/dist/cjs/cli.js.map +1 -1
- package/dist/cjs/core-browser.js +4 -4
- package/dist/cjs/core-browser.js.map +1 -1
- package/dist/cjs/core-nodejs.js +19 -19
- package/dist/cjs/core-nodejs.js.map +1 -1
- package/dist/cjs/core.js +178 -178
- package/dist/cjs/core.js.map +1 -1
- package/dist/cjs/html-validate.js.map +1 -1
- package/dist/cjs/jest-diff.js.map +1 -1
- package/dist/cjs/jest.js +7 -6
- package/dist/cjs/jest.js.map +1 -1
- package/dist/cjs/matcher-utils.js +36 -0
- package/dist/cjs/matcher-utils.js.map +1 -1
- package/dist/cjs/matchers-jestonly.js +17 -39
- package/dist/cjs/matchers-jestonly.js.map +1 -1
- package/dist/cjs/matchers.js +14 -8
- package/dist/cjs/matchers.js.map +1 -1
- package/dist/cjs/tsdoc-metadata.json +1 -1
- package/dist/cjs/vitest.js +3 -3
- package/dist/esm/cli.js +1 -1
- package/dist/esm/cli.js.map +1 -1
- package/dist/esm/core-browser.js +4 -4
- package/dist/esm/core-browser.js.map +1 -1
- package/dist/esm/core-nodejs.js +19 -19
- package/dist/esm/core-nodejs.js.map +1 -1
- package/dist/esm/core.js +176 -178
- package/dist/esm/core.js.map +1 -1
- package/dist/esm/html-validate.js +1 -1
- package/dist/esm/html-validate.js.map +1 -1
- package/dist/esm/jest-diff.js.map +1 -1
- package/dist/esm/jest.js +3 -2
- package/dist/esm/jest.js.map +1 -1
- package/dist/esm/matcher-utils.js +36 -1
- package/dist/esm/matcher-utils.js.map +1 -1
- package/dist/esm/matchers-jestonly.js +18 -36
- package/dist/esm/matchers-jestonly.js.map +1 -1
- package/dist/esm/matchers.js +15 -9
- package/dist/esm/matchers.js.map +1 -1
- package/dist/esm/vitest.js +3 -3
- package/dist/tsdoc-metadata.json +1 -1
- package/dist/types/browser.d.ts +2 -2
- package/dist/types/index.d.ts +2 -2
- package/dist/types/jest.d.ts +34 -2
- package/dist/types/vitest.d.ts +1 -1
- package/package.json +23 -19
package/dist/esm/core.js
CHANGED
|
@@ -1155,9 +1155,6 @@ const dynamicKeys = [
|
|
|
1155
1155
|
"submitButton"
|
|
1156
1156
|
];
|
|
1157
1157
|
const schemaCache = /* @__PURE__ */ new Map();
|
|
1158
|
-
function clone(src) {
|
|
1159
|
-
return JSON.parse(JSON.stringify(src));
|
|
1160
|
-
}
|
|
1161
1158
|
function overwriteMerge$1(_a, b) {
|
|
1162
1159
|
return b;
|
|
1163
1160
|
}
|
|
@@ -1169,7 +1166,7 @@ class MetaTable {
|
|
|
1169
1166
|
*/
|
|
1170
1167
|
constructor() {
|
|
1171
1168
|
this.elements = {};
|
|
1172
|
-
this.schema =
|
|
1169
|
+
this.schema = structuredClone(schema);
|
|
1173
1170
|
}
|
|
1174
1171
|
/**
|
|
1175
1172
|
* @internal
|
|
@@ -1521,82 +1518,6 @@ function sliceLocation(location, begin, end, wrap) {
|
|
|
1521
1518
|
return sliced;
|
|
1522
1519
|
}
|
|
1523
1520
|
|
|
1524
|
-
var State = /* @__PURE__ */ ((State2) => {
|
|
1525
|
-
State2[State2["INITIAL"] = 1] = "INITIAL";
|
|
1526
|
-
State2[State2["DOCTYPE"] = 2] = "DOCTYPE";
|
|
1527
|
-
State2[State2["TEXT"] = 3] = "TEXT";
|
|
1528
|
-
State2[State2["TAG"] = 4] = "TAG";
|
|
1529
|
-
State2[State2["ATTR"] = 5] = "ATTR";
|
|
1530
|
-
State2[State2["CDATA"] = 6] = "CDATA";
|
|
1531
|
-
State2[State2["SCRIPT"] = 7] = "SCRIPT";
|
|
1532
|
-
State2[State2["STYLE"] = 8] = "STYLE";
|
|
1533
|
-
State2[State2["TEXTAREA"] = 9] = "TEXTAREA";
|
|
1534
|
-
State2[State2["TITLE"] = 10] = "TITLE";
|
|
1535
|
-
return State2;
|
|
1536
|
-
})(State || {});
|
|
1537
|
-
|
|
1538
|
-
var ContentModel = /* @__PURE__ */ ((ContentModel2) => {
|
|
1539
|
-
ContentModel2[ContentModel2["TEXT"] = 1] = "TEXT";
|
|
1540
|
-
ContentModel2[ContentModel2["SCRIPT"] = 2] = "SCRIPT";
|
|
1541
|
-
ContentModel2[ContentModel2["STYLE"] = 3] = "STYLE";
|
|
1542
|
-
ContentModel2[ContentModel2["TEXTAREA"] = 4] = "TEXTAREA";
|
|
1543
|
-
ContentModel2[ContentModel2["TITLE"] = 5] = "TITLE";
|
|
1544
|
-
return ContentModel2;
|
|
1545
|
-
})(ContentModel || {});
|
|
1546
|
-
class Context {
|
|
1547
|
-
contentModel;
|
|
1548
|
-
state;
|
|
1549
|
-
string;
|
|
1550
|
-
filename;
|
|
1551
|
-
offset;
|
|
1552
|
-
line;
|
|
1553
|
-
column;
|
|
1554
|
-
constructor(source) {
|
|
1555
|
-
this.state = State.INITIAL;
|
|
1556
|
-
this.string = source.data;
|
|
1557
|
-
this.filename = source.filename;
|
|
1558
|
-
this.offset = source.offset;
|
|
1559
|
-
this.line = source.line;
|
|
1560
|
-
this.column = source.column;
|
|
1561
|
-
this.contentModel = 1 /* TEXT */;
|
|
1562
|
-
}
|
|
1563
|
-
getTruncatedLine(n = 13) {
|
|
1564
|
-
return JSON.stringify(this.string.length > n ? `${this.string.slice(0, 10)}...` : this.string);
|
|
1565
|
-
}
|
|
1566
|
-
consume(n, state) {
|
|
1567
|
-
let consumed = this.string.slice(0, n);
|
|
1568
|
-
let offset;
|
|
1569
|
-
while ((offset = consumed.indexOf("\n")) >= 0) {
|
|
1570
|
-
this.line++;
|
|
1571
|
-
this.column = 1;
|
|
1572
|
-
consumed = consumed.slice(offset + 1);
|
|
1573
|
-
}
|
|
1574
|
-
this.column += consumed.length;
|
|
1575
|
-
this.offset += n;
|
|
1576
|
-
this.string = this.string.slice(n);
|
|
1577
|
-
this.state = state;
|
|
1578
|
-
}
|
|
1579
|
-
getLocation(size) {
|
|
1580
|
-
return {
|
|
1581
|
-
filename: this.filename,
|
|
1582
|
-
offset: this.offset,
|
|
1583
|
-
line: this.line,
|
|
1584
|
-
column: this.column,
|
|
1585
|
-
size
|
|
1586
|
-
};
|
|
1587
|
-
}
|
|
1588
|
-
}
|
|
1589
|
-
|
|
1590
|
-
function normalizeSource(source) {
|
|
1591
|
-
return {
|
|
1592
|
-
filename: "",
|
|
1593
|
-
offset: 0,
|
|
1594
|
-
line: 1,
|
|
1595
|
-
column: 1,
|
|
1596
|
-
...source
|
|
1597
|
-
};
|
|
1598
|
-
}
|
|
1599
|
-
|
|
1600
1521
|
var NodeType = /* @__PURE__ */ ((NodeType2) => {
|
|
1601
1522
|
NodeType2[NodeType2["ELEMENT_NODE"] = 1] = "ELEMENT_NODE";
|
|
1602
1523
|
NodeType2[NodeType2["TEXT_NODE"] = 3] = "TEXT_NODE";
|
|
@@ -1881,7 +1802,7 @@ class DOMTokenList extends Array {
|
|
|
1881
1802
|
locations;
|
|
1882
1803
|
constructor(value, location) {
|
|
1883
1804
|
if (value && typeof value === "string") {
|
|
1884
|
-
const normalized = value.replaceAll(/[\t\r
|
|
1805
|
+
const normalized = value.replaceAll(/[\t\n\r]/g, " ");
|
|
1885
1806
|
const { tokens, locations } = parse(normalized, location);
|
|
1886
1807
|
super(...tokens);
|
|
1887
1808
|
this.locations = locations;
|
|
@@ -2026,7 +1947,7 @@ class AttributeCondition extends Condition {
|
|
|
2026
1947
|
value;
|
|
2027
1948
|
constructor(attr) {
|
|
2028
1949
|
super();
|
|
2029
|
-
const [, key, op, value] = /^(.+?)(?:([
|
|
1950
|
+
const [, key, op, value] = /^(.+?)(?:([$*^|~]?=)"([^"]+?)")?$/.exec(attr);
|
|
2030
1951
|
this.key = key;
|
|
2031
1952
|
this.op = op;
|
|
2032
1953
|
this.value = typeof value === "string" ? stripslashes(value) : value;
|
|
@@ -2066,10 +1987,10 @@ class PseudoClassCondition extends Condition {
|
|
|
2066
1987
|
}
|
|
2067
1988
|
|
|
2068
1989
|
function isDelimiter(ch) {
|
|
2069
|
-
return /[
|
|
1990
|
+
return /[#.:[]/.test(ch);
|
|
2070
1991
|
}
|
|
2071
1992
|
function isQuotationMark(ch) {
|
|
2072
|
-
return /['
|
|
1993
|
+
return /["']/.test(ch);
|
|
2073
1994
|
}
|
|
2074
1995
|
function isPseudoElement(ch, buffer) {
|
|
2075
1996
|
return ch === ":" && buffer === ":";
|
|
@@ -2121,7 +2042,7 @@ class Compound {
|
|
|
2121
2042
|
selector;
|
|
2122
2043
|
conditions;
|
|
2123
2044
|
constructor(pattern) {
|
|
2124
|
-
const match = /^([
|
|
2045
|
+
const match = /^([+>~-]?)((?:\*|[^#.:[]+)?)([^]*)$/.exec(pattern);
|
|
2125
2046
|
if (!match) {
|
|
2126
2047
|
throw new Error(`Failed to create selector pattern from "${pattern}"`);
|
|
2127
2048
|
}
|
|
@@ -2268,7 +2189,7 @@ function unescapeCodepoint(value) {
|
|
|
2268
2189
|
"\\d ": "\r"
|
|
2269
2190
|
};
|
|
2270
2191
|
return value.replaceAll(
|
|
2271
|
-
/(\\[
|
|
2192
|
+
/(\\[9ad] )/g,
|
|
2272
2193
|
(_, codepoint) => replacement[codepoint]
|
|
2273
2194
|
);
|
|
2274
2195
|
}
|
|
@@ -2278,7 +2199,7 @@ function escapeSelectorComponent(text) {
|
|
|
2278
2199
|
"\n": "\\a ",
|
|
2279
2200
|
"\r": "\\d "
|
|
2280
2201
|
};
|
|
2281
|
-
return text.toString().replaceAll(/([\t\n\r]|[
|
|
2202
|
+
return text.toString().replaceAll(/([\t\n\r]|[^\w-])/gi, (_, ch) => {
|
|
2282
2203
|
if (codepoints[ch]) {
|
|
2283
2204
|
return codepoints[ch];
|
|
2284
2205
|
} else {
|
|
@@ -2327,7 +2248,7 @@ class Selector {
|
|
|
2327
2248
|
}
|
|
2328
2249
|
}
|
|
2329
2250
|
static parse(selector) {
|
|
2330
|
-
selector = selector.replaceAll(/([
|
|
2251
|
+
selector = selector.replaceAll(/([+>~]) /g, "$1");
|
|
2331
2252
|
return Array.from(splitSelectorElements(selector), (element) => {
|
|
2332
2253
|
return new Compound(unescapeCodepoint(element));
|
|
2333
2254
|
});
|
|
@@ -3129,7 +3050,7 @@ class Validator {
|
|
|
3129
3050
|
if (typeof rule !== "string") {
|
|
3130
3051
|
return false;
|
|
3131
3052
|
}
|
|
3132
|
-
const [, category, quantifier] = /^(@?.*?)([
|
|
3053
|
+
const [, category, quantifier] = /^(@?.*?)([*?]?)$/.exec(rule);
|
|
3133
3054
|
const limit = category && quantifier && parseQuantifier(quantifier);
|
|
3134
3055
|
if (limit) {
|
|
3135
3056
|
const siblings = children.filter(
|
|
@@ -3297,7 +3218,7 @@ class Validator {
|
|
|
3297
3218
|
*/
|
|
3298
3219
|
/* eslint-disable-next-line complexity -- rule does not like switch */
|
|
3299
3220
|
static validatePermittedCategory(node, category, defaultMatch) {
|
|
3300
|
-
const [, rawCategory] = /^(@?.*?)([
|
|
3221
|
+
const [, rawCategory] = /^(@?.*?)([*?]?)$/.exec(category);
|
|
3301
3222
|
if (!rawCategory.startsWith("@")) {
|
|
3302
3223
|
return node.matches(rawCategory);
|
|
3303
3224
|
}
|
|
@@ -3438,7 +3359,7 @@ function isInputDisabledImpl(node) {
|
|
|
3438
3359
|
|
|
3439
3360
|
const patternCache = /* @__PURE__ */ new Map();
|
|
3440
3361
|
function compileStringPattern(pattern) {
|
|
3441
|
-
const regexp = pattern.replaceAll(
|
|
3362
|
+
const regexp = pattern.replaceAll(/\*+/g, ".+");
|
|
3442
3363
|
return new RegExp(`^${regexp}$`);
|
|
3443
3364
|
}
|
|
3444
3365
|
function compileRegExpPattern(pattern) {
|
|
@@ -4625,6 +4546,82 @@ class AttrCase extends Rule {
|
|
|
4625
4546
|
}
|
|
4626
4547
|
}
|
|
4627
4548
|
|
|
4549
|
+
var State = /* @__PURE__ */ ((State2) => {
|
|
4550
|
+
State2[State2["INITIAL"] = 1] = "INITIAL";
|
|
4551
|
+
State2[State2["DOCTYPE"] = 2] = "DOCTYPE";
|
|
4552
|
+
State2[State2["TEXT"] = 3] = "TEXT";
|
|
4553
|
+
State2[State2["TAG"] = 4] = "TAG";
|
|
4554
|
+
State2[State2["ATTR"] = 5] = "ATTR";
|
|
4555
|
+
State2[State2["CDATA"] = 6] = "CDATA";
|
|
4556
|
+
State2[State2["SCRIPT"] = 7] = "SCRIPT";
|
|
4557
|
+
State2[State2["STYLE"] = 8] = "STYLE";
|
|
4558
|
+
State2[State2["TEXTAREA"] = 9] = "TEXTAREA";
|
|
4559
|
+
State2[State2["TITLE"] = 10] = "TITLE";
|
|
4560
|
+
return State2;
|
|
4561
|
+
})(State || {});
|
|
4562
|
+
|
|
4563
|
+
var ContentModel = /* @__PURE__ */ ((ContentModel2) => {
|
|
4564
|
+
ContentModel2[ContentModel2["TEXT"] = 1] = "TEXT";
|
|
4565
|
+
ContentModel2[ContentModel2["SCRIPT"] = 2] = "SCRIPT";
|
|
4566
|
+
ContentModel2[ContentModel2["STYLE"] = 3] = "STYLE";
|
|
4567
|
+
ContentModel2[ContentModel2["TEXTAREA"] = 4] = "TEXTAREA";
|
|
4568
|
+
ContentModel2[ContentModel2["TITLE"] = 5] = "TITLE";
|
|
4569
|
+
return ContentModel2;
|
|
4570
|
+
})(ContentModel || {});
|
|
4571
|
+
class Context {
|
|
4572
|
+
contentModel;
|
|
4573
|
+
state;
|
|
4574
|
+
string;
|
|
4575
|
+
filename;
|
|
4576
|
+
offset;
|
|
4577
|
+
line;
|
|
4578
|
+
column;
|
|
4579
|
+
constructor(source) {
|
|
4580
|
+
this.state = State.INITIAL;
|
|
4581
|
+
this.string = source.data;
|
|
4582
|
+
this.filename = source.filename;
|
|
4583
|
+
this.offset = source.offset;
|
|
4584
|
+
this.line = source.line;
|
|
4585
|
+
this.column = source.column;
|
|
4586
|
+
this.contentModel = 1 /* TEXT */;
|
|
4587
|
+
}
|
|
4588
|
+
getTruncatedLine(n = 13) {
|
|
4589
|
+
return JSON.stringify(this.string.length > n ? `${this.string.slice(0, 10)}...` : this.string);
|
|
4590
|
+
}
|
|
4591
|
+
consume(n, state) {
|
|
4592
|
+
let consumed = this.string.slice(0, n);
|
|
4593
|
+
let offset;
|
|
4594
|
+
while ((offset = consumed.indexOf("\n")) >= 0) {
|
|
4595
|
+
this.line++;
|
|
4596
|
+
this.column = 1;
|
|
4597
|
+
consumed = consumed.slice(offset + 1);
|
|
4598
|
+
}
|
|
4599
|
+
this.column += consumed.length;
|
|
4600
|
+
this.offset += n;
|
|
4601
|
+
this.string = this.string.slice(n);
|
|
4602
|
+
this.state = state;
|
|
4603
|
+
}
|
|
4604
|
+
getLocation(size) {
|
|
4605
|
+
return {
|
|
4606
|
+
filename: this.filename,
|
|
4607
|
+
offset: this.offset,
|
|
4608
|
+
line: this.line,
|
|
4609
|
+
column: this.column,
|
|
4610
|
+
size
|
|
4611
|
+
};
|
|
4612
|
+
}
|
|
4613
|
+
}
|
|
4614
|
+
|
|
4615
|
+
function normalizeSource(source) {
|
|
4616
|
+
return {
|
|
4617
|
+
filename: "",
|
|
4618
|
+
offset: 0,
|
|
4619
|
+
line: 1,
|
|
4620
|
+
column: 1,
|
|
4621
|
+
...source
|
|
4622
|
+
};
|
|
4623
|
+
}
|
|
4624
|
+
|
|
4628
4625
|
var TokenType = /* @__PURE__ */ ((TokenType2) => {
|
|
4629
4626
|
TokenType2[TokenType2["UNICODE_BOM"] = 1] = "UNICODE_BOM";
|
|
4630
4627
|
TokenType2[TokenType2["WHITESPACE"] = 2] = "WHITESPACE";
|
|
@@ -4647,20 +4644,20 @@ var TokenType = /* @__PURE__ */ ((TokenType2) => {
|
|
|
4647
4644
|
})(TokenType || {});
|
|
4648
4645
|
|
|
4649
4646
|
const MATCH_UNICODE_BOM = /^\uFEFF/;
|
|
4650
|
-
const MATCH_WHITESPACE = /^(?:\r\n|\r|\n|[
|
|
4651
|
-
const MATCH_DOCTYPE_OPEN = /^<!(
|
|
4647
|
+
const MATCH_WHITESPACE = /^(?:\r\n|\r|\n|[\t ]+(?:\r\n|\r|\n)?)/;
|
|
4648
|
+
const MATCH_DOCTYPE_OPEN = /^<!(doctype)\s/i;
|
|
4652
4649
|
const MATCH_DOCTYPE_VALUE = /^[^>]+/;
|
|
4653
4650
|
const MATCH_DOCTYPE_CLOSE = /^>/;
|
|
4654
4651
|
const MATCH_XML_TAG = /^<\?xml.*?\?>\s+/;
|
|
4655
|
-
const MATCH_TAG_OPEN = /^<(\/?)([
|
|
4652
|
+
const MATCH_TAG_OPEN = /^<(\/?)([\w:\-]+)/;
|
|
4656
4653
|
const MATCH_TAG_CLOSE = /^\/?>/;
|
|
4657
|
-
const MATCH_TEXT = /^[^]*?(?=(?:[
|
|
4654
|
+
const MATCH_TEXT = /^[^]*?(?=(?:[\t ]*(?:\r\n|\r|\n)|<[^ ]|$))/;
|
|
4658
4655
|
const MATCH_TEMPLATING = /^(?:<%.*?%>|<\?.*?\?>|<\$.*?\$>)/s;
|
|
4659
4656
|
const MATCH_TAG_LOOKAHEAD = /^[^]*?(?=<|$)/;
|
|
4660
|
-
const MATCH_ATTR_START = /^([^\t\
|
|
4657
|
+
const MATCH_ATTR_START = /^([^\t\n\f\r "'/<=>]+)/;
|
|
4661
4658
|
const MATCH_ATTR_SINGLE = /^(\s*=\s*)'([^']*?)(')/;
|
|
4662
4659
|
const MATCH_ATTR_DOUBLE = /^(\s*=\s*)"([^"]*?)(")/;
|
|
4663
|
-
const MATCH_ATTR_UNQUOTED = /^(\s*=\s*)([^\t\
|
|
4660
|
+
const MATCH_ATTR_UNQUOTED = /^(\s*=\s*)([^\t\n\f\r "'<>][^\t\n\f\r <>]*)/;
|
|
4664
4661
|
const MATCH_CDATA_BEGIN = /^<!\[CDATA\[/;
|
|
4665
4662
|
const MATCH_CDATA_END = /^[^]*?]]>/;
|
|
4666
4663
|
const MATCH_SCRIPT_DATA = /^[^]*?(?=<\/script)/;
|
|
@@ -4671,9 +4668,9 @@ const MATCH_TEXTAREA_DATA = /^[^]*?(?=<\/textarea)/;
|
|
|
4671
4668
|
const MATCH_TEXTAREA_END = /^<(\/)(textarea)/;
|
|
4672
4669
|
const MATCH_TITLE_DATA = /^[^]*?(?=<\/title)/;
|
|
4673
4670
|
const MATCH_TITLE_END = /^<(\/)(title)/;
|
|
4674
|
-
const MATCH_DIRECTIVE = /^(<!--\s*\[?)(html-validate-)([
|
|
4671
|
+
const MATCH_DIRECTIVE = /^(<!--\s*\[?)(html-validate-)([\da-z-]+)(\s*)(.*?)(]?\s*-->)/;
|
|
4675
4672
|
const MATCH_COMMENT = /^<!--([^]*?)-->/;
|
|
4676
|
-
const MATCH_CONDITIONAL = /^<!\[([^\]]*?)
|
|
4673
|
+
const MATCH_CONDITIONAL = /^<!\[([^\]]*?)]>/;
|
|
4677
4674
|
class InvalidTokenError extends Error {
|
|
4678
4675
|
location;
|
|
4679
4676
|
constructor(location, message) {
|
|
@@ -5613,12 +5610,12 @@ function parsePattern(pattern) {
|
|
|
5613
5610
|
}
|
|
5614
5611
|
switch (pattern) {
|
|
5615
5612
|
case "kebabcase":
|
|
5616
|
-
return { regexp: /^[a-z][
|
|
5613
|
+
return { regexp: /^[a-z][\da-z]*(?:-[\da-z]+)*$/, description: pattern };
|
|
5617
5614
|
case "camelcase":
|
|
5618
|
-
return { regexp: /^[a-z][
|
|
5615
|
+
return { regexp: /^[a-z][\dA-Za-z]*$/, description: pattern };
|
|
5619
5616
|
case "snakecase":
|
|
5620
5617
|
case "underscore":
|
|
5621
|
-
return { regexp: /^[a-z][
|
|
5618
|
+
return { regexp: /^[a-z][\da-z]*(?:_[\da-z]+)*$/, description: pattern };
|
|
5622
5619
|
case "bem": {
|
|
5623
5620
|
const block = "[a-z][a-z0-9]*(?:-[a-z0-9]+)*";
|
|
5624
5621
|
const element = "(?:__[a-z0-9]+(?:-[a-z0-9]+)*)?";
|
|
@@ -5630,7 +5627,7 @@ function parsePattern(pattern) {
|
|
|
5630
5627
|
}
|
|
5631
5628
|
case "tailwind": {
|
|
5632
5629
|
return {
|
|
5633
|
-
regexp: /^!?(?:[
|
|
5630
|
+
regexp: /^!?(?:[[a-z-]|\d+xl:)[\w!#%&'(),./:=>[\\\]-]*$/,
|
|
5634
5631
|
description: "tailwind"
|
|
5635
5632
|
};
|
|
5636
5633
|
}
|
|
@@ -6616,7 +6613,7 @@ class ElementPermittedParent extends Rule {
|
|
|
6616
6613
|
}
|
|
6617
6614
|
|
|
6618
6615
|
function isTagnameOnly(value) {
|
|
6619
|
-
return /^[
|
|
6616
|
+
return /^[\dA-Za-z-]+$/.test(value);
|
|
6620
6617
|
}
|
|
6621
6618
|
function getRuleDescription(context) {
|
|
6622
6619
|
const escaped = context.ancestor.map((it) => `\`${it}\``);
|
|
@@ -6823,14 +6820,14 @@ class EmptyTitle extends Rule {
|
|
|
6823
6820
|
}
|
|
6824
6821
|
switch (classifyNodeText(node)) {
|
|
6825
6822
|
case TextClassification.DYNAMIC_TEXT:
|
|
6826
|
-
case TextClassification.STATIC_TEXT:
|
|
6823
|
+
case TextClassification.STATIC_TEXT: {
|
|
6827
6824
|
break;
|
|
6828
|
-
|
|
6829
|
-
|
|
6830
|
-
|
|
6831
|
-
|
|
6832
|
-
}
|
|
6825
|
+
}
|
|
6826
|
+
case TextClassification.EMPTY_TEXT: {
|
|
6827
|
+
const message = `<${node.tagName}> cannot be empty, must have text content`;
|
|
6828
|
+
this.report(node, message, node.location);
|
|
6833
6829
|
break;
|
|
6830
|
+
}
|
|
6834
6831
|
}
|
|
6835
6832
|
});
|
|
6836
6833
|
}
|
|
@@ -7072,7 +7069,7 @@ function isRelevant$5(event) {
|
|
|
7072
7069
|
return Boolean(node.meta?.heading);
|
|
7073
7070
|
}
|
|
7074
7071
|
function extractLevel(node) {
|
|
7075
|
-
const match = /^[
|
|
7072
|
+
const match = /^[Hh](\d)$/.exec(node.tagName);
|
|
7076
7073
|
if (match) {
|
|
7077
7074
|
return Number.parseInt(match[1], 10);
|
|
7078
7075
|
} else {
|
|
@@ -8527,8 +8524,8 @@ class NoMultipleMain extends Rule {
|
|
|
8527
8524
|
const defaults$f = {
|
|
8528
8525
|
relaxed: false
|
|
8529
8526
|
};
|
|
8530
|
-
const textRegexp = /([<>]|&(?![
|
|
8531
|
-
const unquotedAttrRegexp = /([
|
|
8527
|
+
const textRegexp = /([<>]|&(?![\d#A-Za-z]+;))/g;
|
|
8528
|
+
const unquotedAttrRegexp = /(["'<=>`]|&(?![\d#A-Za-z]+;))/g;
|
|
8532
8529
|
const matchTemplate = /^(<%.*?%>|<\?.*?\?>|<\$.*?\$>)$/s;
|
|
8533
8530
|
const replacementTable = {
|
|
8534
8531
|
'"': """,
|
|
@@ -8861,7 +8858,7 @@ class NoTrailingWhitespace extends Rule {
|
|
|
8861
8858
|
}
|
|
8862
8859
|
setup() {
|
|
8863
8860
|
this.on("whitespace", (event) => {
|
|
8864
|
-
if (/^[
|
|
8861
|
+
if (/^[\t ]+\r?\n$/.test(event.text)) {
|
|
8865
8862
|
this.report(null, "Trailing whitespace", event.location);
|
|
8866
8863
|
}
|
|
8867
8864
|
});
|
|
@@ -9864,7 +9861,7 @@ const defaults$5 = {
|
|
|
9864
9861
|
ignoreCase: false,
|
|
9865
9862
|
requireSemicolon: true
|
|
9866
9863
|
};
|
|
9867
|
-
const regexp$1 = /&(?:[
|
|
9864
|
+
const regexp$1 = /&(?:[\da-z]+|#x?[\da-f]+)(;|[^\da-z]|$)/gi;
|
|
9868
9865
|
const lowercaseEntities = entities$1.map((it) => it.toLowerCase());
|
|
9869
9866
|
function isNumerical(entity) {
|
|
9870
9867
|
return entity.startsWith("&#");
|
|
@@ -9948,7 +9945,7 @@ class UnknownCharReference extends Rule {
|
|
|
9948
9945
|
}
|
|
9949
9946
|
}
|
|
9950
9947
|
findCharacterReferences(node, text, location, { isAttribute }) {
|
|
9951
|
-
const delimiter = text.search(/[
|
|
9948
|
+
const delimiter = text.search(/[#?]/);
|
|
9952
9949
|
for (const match of this.getMatches(text)) {
|
|
9953
9950
|
const allowUnterminated = isAttribute && isAfterQueryOrFragment(delimiter, match);
|
|
9954
9951
|
this.validateCharacterReference(node, location, match, {
|
|
@@ -10771,7 +10768,7 @@ class H30 extends Rule {
|
|
|
10771
10768
|
}
|
|
10772
10769
|
setup() {
|
|
10773
10770
|
this.on("dom:ready", (event) => {
|
|
10774
|
-
const links = event.document.
|
|
10771
|
+
const links = event.document.querySelectorAll("a");
|
|
10775
10772
|
for (const link of links) {
|
|
10776
10773
|
if (!link.hasAttribute("href")) {
|
|
10777
10774
|
continue;
|
|
@@ -11361,46 +11358,10 @@ var configurationSchema = {
|
|
|
11361
11358
|
properties: properties
|
|
11362
11359
|
};
|
|
11363
11360
|
|
|
11364
|
-
function dumpTree(root) {
|
|
11365
|
-
const lines = [];
|
|
11366
|
-
function decoration(node) {
|
|
11367
|
-
let output = "";
|
|
11368
|
-
if (node.id) {
|
|
11369
|
-
output += `#${node.id}`;
|
|
11370
|
-
}
|
|
11371
|
-
if (node.hasAttribute("class")) {
|
|
11372
|
-
output += `.${node.classList.join(".")}`;
|
|
11373
|
-
}
|
|
11374
|
-
return output;
|
|
11375
|
-
}
|
|
11376
|
-
function writeNode(node, level, indent, sibling) {
|
|
11377
|
-
const numSiblings = node.parent ? node.parent.childElements.length : 0;
|
|
11378
|
-
const lastSibling = sibling === numSiblings - 1;
|
|
11379
|
-
if (node.parent) {
|
|
11380
|
-
const b = lastSibling ? "\u2514" : "\u251C";
|
|
11381
|
-
lines.push(`${indent}${b}\u2500\u2500 ${node.tagName}${decoration(node)}`);
|
|
11382
|
-
} else {
|
|
11383
|
-
lines.push("(root)");
|
|
11384
|
-
}
|
|
11385
|
-
for (const [index, child] of node.childElements.entries()) {
|
|
11386
|
-
const s = lastSibling ? " " : "\u2502";
|
|
11387
|
-
const i = level > 0 ? `${indent}${s} ` : "";
|
|
11388
|
-
writeNode(child, level + 1, i, index);
|
|
11389
|
-
}
|
|
11390
|
-
}
|
|
11391
|
-
writeNode(root, 0, "", 0);
|
|
11392
|
-
return lines;
|
|
11393
|
-
}
|
|
11394
|
-
|
|
11395
11361
|
function isThenable(value) {
|
|
11396
11362
|
return value && typeof value === "object" && "then" in value && typeof value.then === "function";
|
|
11397
11363
|
}
|
|
11398
11364
|
|
|
11399
|
-
const ruleIds = new Set(Object.keys(bundledRules));
|
|
11400
|
-
function ruleExists(ruleId) {
|
|
11401
|
-
return ruleIds.has(ruleId);
|
|
11402
|
-
}
|
|
11403
|
-
|
|
11404
11365
|
var defaultConfig = {};
|
|
11405
11366
|
|
|
11406
11367
|
const config$5 = {
|
|
@@ -12487,6 +12448,7 @@ class EventHandler {
|
|
|
12487
12448
|
* @param event - Event name.
|
|
12488
12449
|
* @param data - Event data.
|
|
12489
12450
|
*/
|
|
12451
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any -- technical debt, should be made typesafe */
|
|
12490
12452
|
trigger(event, data) {
|
|
12491
12453
|
for (const listener of this.getCallbacks(event)) {
|
|
12492
12454
|
listener.call(null, event, data);
|
|
@@ -12501,7 +12463,7 @@ class EventHandler {
|
|
|
12501
12463
|
}
|
|
12502
12464
|
|
|
12503
12465
|
const name = "html-validate";
|
|
12504
|
-
const version = "10.
|
|
12466
|
+
const version = "10.12.0";
|
|
12505
12467
|
const bugs = "https://gitlab.com/html-validate/html-validate/issues/new";
|
|
12506
12468
|
|
|
12507
12469
|
function freeze(src) {
|
|
@@ -12666,7 +12628,7 @@ function definePlugin(plugin) {
|
|
|
12666
12628
|
return plugin;
|
|
12667
12629
|
}
|
|
12668
12630
|
|
|
12669
|
-
const regexp = /<!(?:--)?\[(.*?)
|
|
12631
|
+
const regexp = /<!(?:--)?\[(.*?)](?:--)?>/g;
|
|
12670
12632
|
function* parseConditionalComment(comment, commentLocation) {
|
|
12671
12633
|
let match;
|
|
12672
12634
|
while ((match = regexp.exec(comment)) !== null) {
|
|
@@ -13278,6 +13240,42 @@ class Parser {
|
|
|
13278
13240
|
}
|
|
13279
13241
|
}
|
|
13280
13242
|
|
|
13243
|
+
const ruleIds = new Set(Object.keys(bundledRules));
|
|
13244
|
+
function ruleExists(ruleId) {
|
|
13245
|
+
return ruleIds.has(ruleId);
|
|
13246
|
+
}
|
|
13247
|
+
|
|
13248
|
+
function dumpTree(root) {
|
|
13249
|
+
const lines = [];
|
|
13250
|
+
function decoration(node) {
|
|
13251
|
+
let output = "";
|
|
13252
|
+
if (node.id) {
|
|
13253
|
+
output += `#${node.id}`;
|
|
13254
|
+
}
|
|
13255
|
+
if (node.hasAttribute("class")) {
|
|
13256
|
+
output += `.${node.classList.join(".")}`;
|
|
13257
|
+
}
|
|
13258
|
+
return output;
|
|
13259
|
+
}
|
|
13260
|
+
function writeNode(node, level, indent, sibling) {
|
|
13261
|
+
const numSiblings = node.parent ? node.parent.childElements.length : 0;
|
|
13262
|
+
const lastSibling = sibling === numSiblings - 1;
|
|
13263
|
+
if (node.parent) {
|
|
13264
|
+
const b = lastSibling ? "\u2514" : "\u251C";
|
|
13265
|
+
lines.push(`${indent}${b}\u2500\u2500 ${node.tagName}${decoration(node)}`);
|
|
13266
|
+
} else {
|
|
13267
|
+
lines.push("(root)");
|
|
13268
|
+
}
|
|
13269
|
+
for (const [index, child] of node.childElements.entries()) {
|
|
13270
|
+
const s = lastSibling ? " " : "\u2502";
|
|
13271
|
+
const i = level > 0 ? `${indent}${s} ` : "";
|
|
13272
|
+
writeNode(child, level + 1, i, index);
|
|
13273
|
+
}
|
|
13274
|
+
}
|
|
13275
|
+
writeNode(root, 0, "", 0);
|
|
13276
|
+
return lines;
|
|
13277
|
+
}
|
|
13278
|
+
|
|
13281
13279
|
let blockerCounter = 1;
|
|
13282
13280
|
function createBlocker() {
|
|
13283
13281
|
const id = blockerCounter++;
|
|
@@ -13538,6 +13536,7 @@ class Engine {
|
|
|
13538
13536
|
* Initializes all rules from plugins and returns an object with a mapping
|
|
13539
13537
|
* between rule name and its constructor.
|
|
13540
13538
|
*/
|
|
13539
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any -- should explicitly accept anything */
|
|
13541
13540
|
initRules(config) {
|
|
13542
13541
|
const availableRules = {};
|
|
13543
13542
|
for (const plugin of config.getPlugins()) {
|
|
@@ -13837,7 +13836,7 @@ const entities = {
|
|
|
13837
13836
|
"&": "&"
|
|
13838
13837
|
};
|
|
13839
13838
|
function xmlescape(src) {
|
|
13840
|
-
return src.toString().replaceAll(/[
|
|
13839
|
+
return src.toString().replaceAll(/["&'<>]/g, (match) => {
|
|
13841
13840
|
return entities[match];
|
|
13842
13841
|
});
|
|
13843
13842
|
}
|
|
@@ -13880,11 +13879,6 @@ function checkstyleFormatter(results) {
|
|
|
13880
13879
|
}
|
|
13881
13880
|
const formatter$2 = checkstyleFormatter;
|
|
13882
13881
|
|
|
13883
|
-
const defaults = {
|
|
13884
|
-
showLink: true,
|
|
13885
|
-
showSummary: true,
|
|
13886
|
-
showSelector: false
|
|
13887
|
-
};
|
|
13888
13882
|
const NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
|
|
13889
13883
|
function getMarkerLines(loc, source) {
|
|
13890
13884
|
const startLoc = {
|
|
@@ -13960,15 +13954,7 @@ function codeFrameColumns(rawLines, loc) {
|
|
|
13960
13954
|
}
|
|
13961
13955
|
}).join("\n");
|
|
13962
13956
|
}
|
|
13963
|
-
|
|
13964
|
-
return count === 1 ? word : `${word}s`;
|
|
13965
|
-
}
|
|
13966
|
-
function formatFilePath(filePath, line, column) {
|
|
13967
|
-
if (line && column) {
|
|
13968
|
-
filePath += `:${String(line)}:${String(column)}`;
|
|
13969
|
-
}
|
|
13970
|
-
return kleur.green(filePath);
|
|
13971
|
-
}
|
|
13957
|
+
|
|
13972
13958
|
function getStartLocation(message) {
|
|
13973
13959
|
return {
|
|
13974
13960
|
line: message.line,
|
|
@@ -13988,18 +13974,30 @@ function getEndLocation(message, source) {
|
|
|
13988
13974
|
}
|
|
13989
13975
|
return { line, column };
|
|
13990
13976
|
}
|
|
13977
|
+
|
|
13978
|
+
const defaults = {
|
|
13979
|
+
showLink: true,
|
|
13980
|
+
showFilePath: true,
|
|
13981
|
+
showSummary: true,
|
|
13982
|
+
showSelector: false
|
|
13983
|
+
};
|
|
13984
|
+
function pluralize(word, count) {
|
|
13985
|
+
return count === 1 ? word : `${word}s`;
|
|
13986
|
+
}
|
|
13987
|
+
function formatFilePath(filePath, line, column) {
|
|
13988
|
+
if (line && column) {
|
|
13989
|
+
filePath += `:${String(line)}:${String(column)}`;
|
|
13990
|
+
}
|
|
13991
|
+
return kleur.green(filePath);
|
|
13992
|
+
}
|
|
13991
13993
|
function formatMessage(message, parentResult, options) {
|
|
13992
13994
|
const type = message.severity === 2 ? kleur.red("error") : kleur.yellow("warning");
|
|
13993
13995
|
const msg = kleur.bold(message.message.replace(/([^ ])\.$/, "$1"));
|
|
13994
13996
|
const ruleId = kleur.dim(`(${message.ruleId})`);
|
|
13995
13997
|
const filePath = formatFilePath(parentResult.filePath, message.line, message.column);
|
|
13996
13998
|
const sourceCode = parentResult.source;
|
|
13997
|
-
const
|
|
13998
|
-
|
|
13999
|
-
msg,
|
|
14000
|
-
ruleId ? ruleId : "",
|
|
14001
|
-
sourceCode ? `at ${filePath}:` : `at ${filePath}`
|
|
14002
|
-
].filter(String).join(" ");
|
|
13999
|
+
const filePathPart = options.showFilePath ? `at ${filePath}:` : null;
|
|
14000
|
+
const firstLine = [`${type}:`, msg, ruleId ? ruleId : "", filePathPart].filter(Boolean).join(" ");
|
|
14003
14001
|
const result = [firstLine];
|
|
14004
14002
|
if (sourceCode) {
|
|
14005
14003
|
const output = codeFrameColumns(sourceCode, {
|
|
@@ -14937,10 +14935,10 @@ var ignoreExports = /*@__PURE__*/ requireIgnore();
|
|
|
14937
14935
|
var ignore = /*@__PURE__*/getDefaultExportFromCjs(ignoreExports);
|
|
14938
14936
|
|
|
14939
14937
|
const engines = {
|
|
14940
|
-
node: "^20.19.0 ||
|
|
14938
|
+
node: "^20.19.0 || ^22.16.0 || >= 24.0.0"
|
|
14941
14939
|
};
|
|
14942
14940
|
|
|
14943
14941
|
var workerPath = "./jest-worker.js";
|
|
14944
14942
|
|
|
14945
|
-
export { engines as $, Attribute as A, TextContent$1 as B, ConfigLoader as C, DOMNode as D, Engine as E, TextNode as F, ariaNaming as G, HtmlElement as H, classifyNodeText as I, presets as J, defineConfig as K, definePlugin as L, MetaCopyableProperty as M, NestedError as N, isUserError as O, Parser as P, keywordPatternMatcher as Q, Reporter as R, StaticConfigLoader as S, TextClassification as T, UserError as U, Validator as V, WrappedError as W, ruleExists as X, sliceLocation as Y, staticResolver as Z, walk as _, transformSourceSync as a,
|
|
14943
|
+
export { engines as $, Attribute as A, TextContent$1 as B, ConfigLoader as C, DOMNode as D, Engine as E, TextNode as F, ariaNaming as G, HtmlElement as H, classifyNodeText as I, presets as J, defineConfig as K, definePlugin as L, MetaCopyableProperty as M, NestedError as N, isUserError as O, Parser as P, keywordPatternMatcher as Q, Reporter as R, StaticConfigLoader as S, TextClassification as T, UserError as U, Validator as V, WrappedError as W, ruleExists as X, sliceLocation as Y, staticResolver as Z, walk as _, transformSourceSync as a, codeFrameColumns as a0, getEndLocation as a1, getStartLocation as a2, workerPath as a3, name as a4, bugs as a5, transformFilename as b, transformFilenameSync as c, configurationSchema as d, ConfigError as e, Config as f, compatibilityCheckImpl as g, ensureError as h, isThenable as i, getFormatter as j, deepmerge as k, ignore as l, DOMTokenList as m, normalizeSource as n, DOMTree as o, DynamicValue as p, EventHandler as q, MetaTable as r, NodeClosed as s, transformSource as t, NodeType as u, version as v, ResolvedConfig as w, Rule as x, SchemaValidationError as y, Severity as z };
|
|
14946
14944
|
//# sourceMappingURL=core.js.map
|