html-validate 6.7.1 → 6.8.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.d.ts +1 -1
- package/dist/cjs/core.d.ts +14 -5
- package/dist/cjs/core.js +125 -79
- package/dist/cjs/core.js.map +1 -1
- package/dist/cjs/index.d.ts +2 -2
- package/dist/cjs/jest-lib.js +31 -38
- package/dist/cjs/jest-lib.js.map +1 -1
- package/dist/cjs/jest.d.ts +35 -2
- package/dist/cjs/jest.js +12 -3
- package/dist/cjs/jest.js.map +1 -1
- package/dist/cjs/test-utils.d.ts +1 -1
- package/dist/es/browser.d.ts +1 -1
- package/dist/es/core.d.ts +14 -5
- package/dist/es/core.js +70 -25
- package/dist/es/core.js.map +1 -1
- package/dist/es/index.d.ts +2 -2
- package/dist/es/jest-lib.js +24 -37
- package/dist/es/jest-lib.js.map +1 -1
- package/dist/es/jest.d.ts +35 -2
- package/dist/es/jest.js +13 -3
- package/dist/es/jest.js.map +1 -1
- package/dist/es/test-utils.d.ts +1 -1
- package/elements/html5.js +1881 -0
- package/package.json +165 -4
- package/dist/cjs/jest-lib.d.ts +0 -36
- package/dist/es/jest-lib.d.ts +0 -36
- package/elements/html5.json +0 -1876
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { A as AttributeData,
|
|
1
|
+
import { n as Report, c as ConfigLoader, H as HtmlValidate, a as ConfigData } from './core.js';
|
|
2
|
+
export { A as AttributeData, Z as AttributeEvent, f as CSSStyleDeclaration, aa as CompatibilityOptions, $ as ConditionalEvent, C as Config, a as ConfigData, b as ConfigError, c as ConfigLoader, I as ConfigReadyEvent, a2 as DOMLoadEvent, a3 as DOMReadyEvent, s as DeferredMessage, a0 as DirectiveEvent, a1 as DoctypeEvent, D as DynamicValue, Y as ElementReadyEvent, G as Event, F as EventCallback, E as EventDump, B as EventHandler, a6 as FileSystemConfigLoader, a7 as Formatter, e as HtmlElement, H as HtmlValidate, a5 as ListenEventMap, L as Location, q as Message, k as MetaCopyableProperty, M as MetaData, i as MetaElement, j as MetaTable, N as NodeClosed, y as Parser, x as Plugin, P as ProcessElementContext, n as Report, o as Reporter, r as Result, R as Rule, l as RuleDocumentation, h as SchemaValidationError, S as Severity, m as Source, J as SourceReadyEvent, d as StaticConfigLoader, W as TagCloseEvent, V as TagEndEvent, Q as TagOpenEvent, X as TagReadyEvent, O as TagStartEvent, w as TemplateExtractor, T as TextNode, g as TokenDump, K as TokenEvent, t as TransformContext, u as Transformer, a4 as TriggerEventMap, U as UserError, _ as WhitespaceEvent, a9 as compatibilityCheck, p as configPresets, a8 as formatterFactory, z as ruleExists, v as version } from './core.js';
|
|
3
3
|
import 'ajv';
|
|
4
4
|
import 'ajv/dist/types';
|
|
5
5
|
|
package/dist/cjs/jest-lib.js
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var jestDiffDefault = require('jest-diff');
|
|
4
|
-
var core = require('./core.js');
|
|
5
3
|
var deepmerge = require('deepmerge');
|
|
4
|
+
var core = require('./core.js');
|
|
5
|
+
var kleur = require('kleur');
|
|
6
|
+
var jestSnapshot = require('jest-snapshot');
|
|
7
|
+
var jestDiffDefault = require('jest-diff');
|
|
8
|
+
require('fs');
|
|
9
|
+
require('path');
|
|
10
|
+
require('@sidvind/better-ajv-errors');
|
|
11
|
+
require('ajv');
|
|
12
|
+
require('@babel/code-frame');
|
|
6
13
|
|
|
7
14
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
15
|
|
|
@@ -24,9 +31,10 @@ function _interopNamespace(e) {
|
|
|
24
31
|
return Object.freeze(n);
|
|
25
32
|
}
|
|
26
33
|
|
|
34
|
+
var deepmerge__default = /*#__PURE__*/_interopDefaultLegacy(deepmerge);
|
|
35
|
+
var kleur__default = /*#__PURE__*/_interopDefaultLegacy(kleur);
|
|
27
36
|
var jestDiffDefault__default = /*#__PURE__*/_interopDefaultLegacy(jestDiffDefault);
|
|
28
37
|
var jestDiffDefault__namespace = /*#__PURE__*/_interopNamespace(jestDiffDefault);
|
|
29
|
-
var deepmerge__default = /*#__PURE__*/_interopDefaultLegacy(deepmerge);
|
|
30
38
|
|
|
31
39
|
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
32
40
|
/* ignore typing for compatibility so it will seem "impossible" but different version will yield different source */
|
|
@@ -41,8 +49,7 @@ const diffCandidates = [
|
|
|
41
49
|
jestDiffDefault__namespace,
|
|
42
50
|
];
|
|
43
51
|
const isFunction = (fn) => typeof fn === "function";
|
|
44
|
-
/*
|
|
45
|
-
/* @ts-ignore assume one of the candidate matches, there will be a reasonable error later on if not */
|
|
52
|
+
/* eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- assume one of the candidate matches, there will be a reasonable error later on if not */
|
|
46
53
|
const diff = diffCandidates.find(isFunction);
|
|
47
54
|
|
|
48
55
|
function isThenable(src) {
|
|
@@ -113,31 +120,6 @@ function toBeInvalid(report) {
|
|
|
113
120
|
}
|
|
114
121
|
var toBeInvalid$1 = diverge(toBeInvalid);
|
|
115
122
|
|
|
116
|
-
/* eslint-disable @typescript-eslint/explicit-module-boundary-types, prefer-template */
|
|
117
|
-
function toBeToken(actual, expected) {
|
|
118
|
-
const token = actual.value;
|
|
119
|
-
// istanbul ignore next: TokenMatcher requires "type" property to be set, this is just a failsafe
|
|
120
|
-
if (token.type) {
|
|
121
|
-
token.type = core.TokenType[token.type];
|
|
122
|
-
}
|
|
123
|
-
// istanbul ignore next: TokenMatcher requires "type" property to be set, this is just a failsafe
|
|
124
|
-
if (expected.type) {
|
|
125
|
-
expected.type = core.TokenType[expected.type];
|
|
126
|
-
}
|
|
127
|
-
const matcher = expect.objectContaining(expected);
|
|
128
|
-
const pass = this.equals(token, matcher);
|
|
129
|
-
const diffString = diff(matcher, token, { expand: this.expand });
|
|
130
|
-
const message = () => this.utils.matcherHint(".toBeToken") +
|
|
131
|
-
"\n\n" +
|
|
132
|
-
"Expected token to equal:\n" +
|
|
133
|
-
` ${this.utils.printExpected(matcher)}\n` +
|
|
134
|
-
"Received:\n" +
|
|
135
|
-
` ${this.utils.printReceived(token)}` +
|
|
136
|
-
/* istanbul ignore next */ (diffString ? `\n\nDifference:\n\n${diffString}` : "");
|
|
137
|
-
return { pass, message };
|
|
138
|
-
}
|
|
139
|
-
var toBeToken$1 = diverge(toBeToken);
|
|
140
|
-
|
|
141
123
|
/* eslint-disable @typescript-eslint/ban-ts-comment, prefer-template */
|
|
142
124
|
function isMessage(arg) {
|
|
143
125
|
if (!arg) {
|
|
@@ -296,12 +278,23 @@ function toHaveErrors(report, errors) {
|
|
|
296
278
|
}
|
|
297
279
|
var toHaveErrors$1 = diverge(toHaveErrors);
|
|
298
280
|
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
281
|
+
const options = {
|
|
282
|
+
showLink: false,
|
|
283
|
+
showSummary: false,
|
|
284
|
+
showSelector: true,
|
|
285
|
+
};
|
|
286
|
+
function toMatchInlineCodeframe(report, ...rest) {
|
|
287
|
+
const enabled = kleur__default["default"].enabled;
|
|
288
|
+
kleur__default["default"].enabled = false;
|
|
289
|
+
const snapshot = core.codeframe(report.results, options).replace(/\s+$/gm, "");
|
|
290
|
+
kleur__default["default"].enabled = enabled;
|
|
291
|
+
return jestSnapshot.toMatchInlineSnapshot.call(this, snapshot, ...rest);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
exports.toBeInvalid = toBeInvalid$1;
|
|
295
|
+
exports.toBeValid = toBeValid$1;
|
|
296
|
+
exports.toHTMLValidate = toHTMLValidate$1;
|
|
297
|
+
exports.toHaveError = toHaveError$1;
|
|
298
|
+
exports.toHaveErrors = toHaveErrors$1;
|
|
299
|
+
exports.toMatchInlineCodeframe = toMatchInlineCodeframe;
|
|
307
300
|
//# sourceMappingURL=jest-lib.js.map
|
package/dist/cjs/jest-lib.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jest-lib.js","sources":["../../../src/jest/utils/diff.ts","../../../src/jest/utils/is-thenable.ts","../../../src/jest/utils/diverge.ts","../../../src/jest/utils/flatten-messages.ts","../../../src/jest/matchers/to-be-valid.ts","../../../src/jest/matchers/to-be-invalid.ts","../../../src/jest/matchers/to-
|
|
1
|
+
{"version":3,"file":"jest-lib.js","sources":["../../../src/jest/utils/diff.ts","../../../src/jest/utils/is-thenable.ts","../../../src/jest/utils/diverge.ts","../../../src/jest/utils/flatten-messages.ts","../../../src/jest/matchers/to-be-valid.ts","../../../src/jest/matchers/to-be-invalid.ts","../../../src/jest/matchers/to-htmlvalidate.ts","../../../src/jest/matchers/to-have-error.ts","../../../src/jest/matchers/to-have-errors.ts","../../../src/jest/matchers/to-match-inline-codeframe.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null],"names":["jestDiffDefault","jestDiff","deepmerge","FileSystemConfigLoader","HtmlValidate","kleur","codeframe","toMatchInlineSnapshot"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAYA;AACA,MAAM,cAAc,GAAoC;;AAEvD,IAAAA,mCAAe,KAAf,IAAA,IAAAA,mCAAe,KAAf,KAAA,CAAA,GAAA,KAAA,CAAA,GAAAA,mCAAe,CAAE,IAAI;;IAErBA,mCAAe;;AAEf,IAAAC,0BAAQ,KAAR,IAAA,IAAAA,0BAAQ,KAAR,KAAA,CAAA,GAAA,KAAA,CAAA,GAAAA,0BAAQ,CAAE,IAAI;;IAEdA,0BAAQ;CACR,CAAC;AAEF,MAAM,UAAU,GAAG,CAAC,EAAW,KAAc,OAAO,EAAE,KAAK,UAAU,CAAC;AAEtE;AACO,MAAM,IAAI,GAAiB,cAAc,CAAC,IAAI,CAAC,UAAU,CAAE;;AC3B5D,SAAU,UAAU,C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C,yBAAK,CAAC,OAAO,CAAC;AAC9B,IAAAA,yBAAK,CAAC,OAAO,GAAG,KAAK,CAAC;AACtB,IAAA,MAAM,QAAQ,GAAGC,cAAS,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;AAC1E,IAAAD,yBAAK,CAAC,OAAO,GAAG,OAAO,CAAC;IACxB,OAAOE,kCAAqB,CAAC,IAAI,CAAC,IAAW,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC,CAAC;AACnE;;;;;;;;;"}
|
package/dist/cjs/jest.d.ts
CHANGED
|
@@ -1,4 +1,37 @@
|
|
|
1
|
-
import './
|
|
2
|
-
import './core.js';
|
|
1
|
+
import { q as Message, a as ConfigData } from './core.js';
|
|
3
2
|
import 'ajv';
|
|
4
3
|
import 'ajv/dist/types';
|
|
4
|
+
|
|
5
|
+
declare global {
|
|
6
|
+
namespace jest {
|
|
7
|
+
interface Matchers<R, T = {}> {
|
|
8
|
+
toBeValid(): R;
|
|
9
|
+
toBeInvalid(): R;
|
|
10
|
+
toHaveError(error: Partial<Message>): R;
|
|
11
|
+
toHaveError(ruleId: string, message: string, context?: any): R;
|
|
12
|
+
toHaveErrors(errors: Array<[string, string] | Record<string, unknown>>): R;
|
|
13
|
+
/**
|
|
14
|
+
* Validate string or HTMLElement.
|
|
15
|
+
*
|
|
16
|
+
* Test passes if result is valid.
|
|
17
|
+
*
|
|
18
|
+
* @param config - Optional HTML-Validate configuration object.
|
|
19
|
+
* @param filename - Optional filename used when matching transformer and
|
|
20
|
+
* loading configuration.
|
|
21
|
+
*/
|
|
22
|
+
toHTMLValidate(): R;
|
|
23
|
+
toHTMLValidate(filename: string): R;
|
|
24
|
+
toHTMLValidate(config: ConfigData): R;
|
|
25
|
+
toHTMLValidate(config: ConfigData, filename: string): R;
|
|
26
|
+
toHTMLValidate(error: Partial<Message>): R;
|
|
27
|
+
toHTMLValidate(error: Partial<Message>, filename: string): R;
|
|
28
|
+
toHTMLValidate(error: Partial<Message>, config: ConfigData): R;
|
|
29
|
+
toHTMLValidate(error: Partial<Message>, config: ConfigData, filename: string): R;
|
|
30
|
+
/**
|
|
31
|
+
* Writes out the given [[Report]] using codeframe formatter and compares
|
|
32
|
+
* with inline snapshot.
|
|
33
|
+
*/
|
|
34
|
+
toMatchInlineCodeframe(snapshot?: string): R;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
package/dist/cjs/jest.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
require('./jest-lib.js');
|
|
4
|
-
require('
|
|
3
|
+
var jestLib = require('./jest-lib.js');
|
|
4
|
+
require('deepmerge');
|
|
5
5
|
require('./core.js');
|
|
6
6
|
require('fs');
|
|
7
7
|
require('@sidvind/better-ajv-errors');
|
|
8
8
|
require('ajv');
|
|
9
|
-
require('deepmerge');
|
|
10
9
|
require('espree');
|
|
11
10
|
require('acorn-walk');
|
|
12
11
|
require('path');
|
|
@@ -14,5 +13,15 @@ require('semver');
|
|
|
14
13
|
require('kleur');
|
|
15
14
|
require('@babel/code-frame');
|
|
16
15
|
require('@html-validate/stylish');
|
|
16
|
+
require('jest-snapshot');
|
|
17
|
+
require('jest-diff');
|
|
17
18
|
|
|
19
|
+
expect.extend({
|
|
20
|
+
toBeValid: jestLib.toBeValid,
|
|
21
|
+
toBeInvalid: jestLib.toBeInvalid,
|
|
22
|
+
toHaveError: jestLib.toHaveError,
|
|
23
|
+
toHaveErrors: jestLib.toHaveErrors,
|
|
24
|
+
toHTMLValidate: jestLib.toHTMLValidate,
|
|
25
|
+
toMatchInlineCodeframe: jestLib.toMatchInlineCodeframe,
|
|
26
|
+
});
|
|
18
27
|
//# sourceMappingURL=jest.js.map
|
package/dist/cjs/jest.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jest.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"jest.js","sources":["../../../src/jest/jest.ts"],"sourcesContent":[null],"names":["toBeValid","toBeInvalid","toHaveError","toHaveErrors","toHTMLValidate","toMatchInlineCodeframe"],"mappings":";;;;;;;;;;;;;;;;;;AAiDA,MAAM,CAAC,MAAM,CAAC;eACbA,iBAAS;iBACTC,mBAAW;iBACXC,mBAAW;kBACXC,oBAAY;oBACZC,sBAAc;4BACdC,8BAAsB;AACtB,CAAA,CAAC;;"}
|
package/dist/cjs/test-utils.d.ts
CHANGED
package/dist/es/browser.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { A as AttributeData,
|
|
1
|
+
export { A as AttributeData, Z as AttributeEvent, f as CSSStyleDeclaration, $ as ConditionalEvent, C as Config, a as ConfigData, b as ConfigError, c as ConfigLoader, I as ConfigReadyEvent, a2 as DOMLoadEvent, a3 as DOMReadyEvent, s as DeferredMessage, a0 as DirectiveEvent, a1 as DoctypeEvent, D as DynamicValue, Y as ElementReadyEvent, G as Event, F as EventCallback, E as EventDump, B as EventHandler, e as HtmlElement, H as HtmlValidate, a5 as ListenEventMap, L as Location, q as Message, k as MetaCopyableProperty, M as MetaData, i as MetaElement, j as MetaTable, N as NodeClosed, y as Parser, x as Plugin, P as ProcessElementContext, n as Report, o as Reporter, r as Result, R as Rule, l as RuleDocumentation, h as SchemaValidationError, S as Severity, m as Source, J as SourceReadyEvent, d as StaticConfigLoader, W as TagCloseEvent, V as TagEndEvent, Q as TagOpenEvent, X as TagReadyEvent, O as TagStartEvent, w as TemplateExtractor, T as TextNode, g as TokenDump, K as TokenEvent, t as TransformContext, u as Transformer, a4 as TriggerEventMap, U as UserError, _ as WhitespaceEvent, p as configPresets, z as ruleExists, v as version } from './core.js';
|
|
2
2
|
import 'ajv';
|
|
3
3
|
import 'ajv/dist/types';
|
package/dist/es/core.d.ts
CHANGED
|
@@ -215,6 +215,12 @@ interface Message {
|
|
|
215
215
|
*/
|
|
216
216
|
context?: any;
|
|
217
217
|
}
|
|
218
|
+
/**
|
|
219
|
+
* @internal
|
|
220
|
+
*/
|
|
221
|
+
interface DeferredMessage extends Omit<Message, "selector"> {
|
|
222
|
+
selector: () => string | null;
|
|
223
|
+
}
|
|
218
224
|
/**
|
|
219
225
|
* @public
|
|
220
226
|
*/
|
|
@@ -244,16 +250,14 @@ interface Report {
|
|
|
244
250
|
* @internal
|
|
245
251
|
*/
|
|
246
252
|
declare class Reporter {
|
|
247
|
-
protected result:
|
|
248
|
-
[filename: string]: Message[];
|
|
249
|
-
};
|
|
253
|
+
protected result: Record<string, DeferredMessage[]>;
|
|
250
254
|
constructor();
|
|
251
255
|
/**
|
|
252
256
|
* Merge two or more reports into a single one.
|
|
253
257
|
*/
|
|
254
258
|
static merge(reports: Report[]): Report;
|
|
255
259
|
add<ContextType, OptionsType>(rule: Rule<ContextType, OptionsType>, message: string, severity: number, node: DOMNode | null, location: Location, context?: ContextType): void;
|
|
256
|
-
addManual(filename: string, message:
|
|
260
|
+
addManual(filename: string, message: DeferredMessage): void;
|
|
257
261
|
save(sources?: Source[]): Report;
|
|
258
262
|
protected isValid(): boolean;
|
|
259
263
|
}
|
|
@@ -981,6 +985,10 @@ declare class Attribute {
|
|
|
981
985
|
valueMatches(pattern: string, dynamicMatches?: boolean): boolean;
|
|
982
986
|
}
|
|
983
987
|
|
|
988
|
+
interface CSSStyleDeclaration {
|
|
989
|
+
[key: string]: string;
|
|
990
|
+
}
|
|
991
|
+
|
|
984
992
|
interface PermittedGroup {
|
|
985
993
|
exclude?: string | string[];
|
|
986
994
|
}
|
|
@@ -1362,6 +1370,7 @@ declare class HtmlElement extends DOMNode {
|
|
|
1362
1370
|
* Get element ID if present.
|
|
1363
1371
|
*/
|
|
1364
1372
|
get id(): string | null;
|
|
1373
|
+
get style(): CSSStyleDeclaration;
|
|
1365
1374
|
/**
|
|
1366
1375
|
* Returns the first child element or null if there are no child elements.
|
|
1367
1376
|
*/
|
|
@@ -2310,4 +2319,4 @@ declare type Formatter = (results: Result[]) => string;
|
|
|
2310
2319
|
*/
|
|
2311
2320
|
declare function getFormatter(name: string): Formatter | null;
|
|
2312
2321
|
|
|
2313
|
-
export {
|
|
2322
|
+
export { ConditionalEvent as $, AttributeData as A, EventHandler as B, Config as C, DynamicValue as D, EventDump as E, EventCallback as F, Event as G, HtmlValidate as H, ConfigReadyEvent as I, SourceReadyEvent as J, TokenEvent as K, Location as L, MetaData as M, NodeClosed as N, TagStartEvent as O, ProcessElementContext as P, TagOpenEvent as Q, Rule as R, Severity as S, TextNode as T, UserError as U, TagEndEvent as V, TagCloseEvent as W, TagReadyEvent as X, ElementReadyEvent as Y, AttributeEvent as Z, WhitespaceEvent as _, ConfigData as a, DirectiveEvent as a0, DoctypeEvent as a1, DOMLoadEvent as a2, DOMReadyEvent as a3, TriggerEventMap as a4, ListenEventMap as a5, FileSystemConfigLoader as a6, Formatter as a7, getFormatter as a8, compatibilityCheck as a9, CompatibilityOptions as aa, ConfigError as b, ConfigLoader as c, StaticConfigLoader as d, HtmlElement as e, CSSStyleDeclaration as f, TokenDump as g, SchemaValidationError as h, MetaElement as i, MetaTable as j, MetaCopyableProperty as k, RuleDocumentation as l, Source as m, Report as n, Reporter as o, presets as p, Message as q, Result as r, DeferredMessage as s, TransformContext as t, Transformer as u, version as v, TemplateExtractor as w, Plugin as x, Parser as y, ruleExists as z };
|
package/dist/es/core.js
CHANGED
|
@@ -1202,6 +1202,27 @@ class Attribute {
|
|
|
1202
1202
|
}
|
|
1203
1203
|
}
|
|
1204
1204
|
|
|
1205
|
+
function getCSSDeclarations(value) {
|
|
1206
|
+
return value
|
|
1207
|
+
.trim()
|
|
1208
|
+
.split(";")
|
|
1209
|
+
.filter(Boolean)
|
|
1210
|
+
.map((it) => {
|
|
1211
|
+
const [property, value] = it.split(":", 2);
|
|
1212
|
+
return [property.trim(), value ? value.trim() : ""];
|
|
1213
|
+
});
|
|
1214
|
+
}
|
|
1215
|
+
/**
|
|
1216
|
+
* @internal
|
|
1217
|
+
*/
|
|
1218
|
+
function parseCssDeclaration(value) {
|
|
1219
|
+
if (!value || value instanceof DynamicValue) {
|
|
1220
|
+
return {};
|
|
1221
|
+
}
|
|
1222
|
+
const pairs = getCSSDeclarations(value);
|
|
1223
|
+
return Object.fromEntries(pairs);
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1205
1226
|
function sliceSize(size, begin, end) {
|
|
1206
1227
|
if (typeof size !== "number") {
|
|
1207
1228
|
return size;
|
|
@@ -2150,6 +2171,10 @@ class HtmlElement extends DOMNode {
|
|
|
2150
2171
|
get id() {
|
|
2151
2172
|
return this.getAttributeValue("id");
|
|
2152
2173
|
}
|
|
2174
|
+
get style() {
|
|
2175
|
+
const attr = this.getAttribute("style");
|
|
2176
|
+
return parseCssDeclaration(attr === null || attr === void 0 ? void 0 : attr.value);
|
|
2177
|
+
}
|
|
2153
2178
|
/**
|
|
2154
2179
|
* Returns the first child element or null if there are no child elements.
|
|
2155
2180
|
*/
|
|
@@ -2955,7 +2980,7 @@ var TRANSFORMER_API;
|
|
|
2955
2980
|
/** @public */
|
|
2956
2981
|
const name = "html-validate";
|
|
2957
2982
|
/** @public */
|
|
2958
|
-
const version = "6.
|
|
2983
|
+
const version = "6.8.0";
|
|
2959
2984
|
/** @public */
|
|
2960
2985
|
const homepage = "https://html-validate.org";
|
|
2961
2986
|
/** @public */
|
|
@@ -6218,16 +6243,6 @@ const defaults$b = {
|
|
|
6218
6243
|
exclude: null,
|
|
6219
6244
|
allowedProperties: ["display"],
|
|
6220
6245
|
};
|
|
6221
|
-
function getCSSDeclarations(value) {
|
|
6222
|
-
return value
|
|
6223
|
-
.trim()
|
|
6224
|
-
.split(";")
|
|
6225
|
-
.filter(Boolean)
|
|
6226
|
-
.map((it) => {
|
|
6227
|
-
const [property, value] = it.split(":", 2);
|
|
6228
|
-
return { property: property.trim(), value: value ? value.trim() : undefined };
|
|
6229
|
-
});
|
|
6230
|
-
}
|
|
6231
6246
|
class NoInlineStyle extends Rule {
|
|
6232
6247
|
constructor(options) {
|
|
6233
6248
|
super({ ...defaults$b, ...options });
|
|
@@ -6308,18 +6323,15 @@ class NoInlineStyle extends Rule {
|
|
|
6308
6323
|
return true;
|
|
6309
6324
|
}
|
|
6310
6325
|
allPropertiesAllowed(value) {
|
|
6311
|
-
if (typeof value !== "string") {
|
|
6312
|
-
return false;
|
|
6313
|
-
}
|
|
6314
6326
|
const allowProperties = this.options.allowedProperties;
|
|
6315
6327
|
/* quick path: no properties are allowed, no need to check each one individually */
|
|
6316
6328
|
if (allowProperties.length === 0) {
|
|
6317
6329
|
return false;
|
|
6318
6330
|
}
|
|
6319
|
-
const declarations =
|
|
6331
|
+
const declarations = Object.keys(parseCssDeclaration(value));
|
|
6320
6332
|
return (declarations.length > 0 &&
|
|
6321
6333
|
declarations.every((it) => {
|
|
6322
|
-
return allowProperties.includes(it
|
|
6334
|
+
return allowProperties.includes(it);
|
|
6323
6335
|
}));
|
|
6324
6336
|
}
|
|
6325
6337
|
}
|
|
@@ -7144,6 +7156,7 @@ const defaults$5 = {
|
|
|
7144
7156
|
{ pattern: "-", replacement: "‑", description: "non-breaking hyphen" },
|
|
7145
7157
|
],
|
|
7146
7158
|
ignoreClasses: [],
|
|
7159
|
+
ignoreStyle: true,
|
|
7147
7160
|
};
|
|
7148
7161
|
function constructRegex(characters) {
|
|
7149
7162
|
const disallowed = characters
|
|
@@ -7209,6 +7222,9 @@ class TelNonBreaking extends Rule {
|
|
|
7209
7222
|
type: "string",
|
|
7210
7223
|
},
|
|
7211
7224
|
},
|
|
7225
|
+
ignoreStyle: {
|
|
7226
|
+
type: "boolean",
|
|
7227
|
+
},
|
|
7212
7228
|
};
|
|
7213
7229
|
}
|
|
7214
7230
|
documentation(context) {
|
|
@@ -7235,10 +7251,7 @@ class TelNonBreaking extends Rule {
|
|
|
7235
7251
|
setup() {
|
|
7236
7252
|
this.on("element:ready", this.isRelevant, (event) => {
|
|
7237
7253
|
const { target } = event;
|
|
7238
|
-
|
|
7239
|
-
/* skip if element has a class in the ignore list */
|
|
7240
|
-
const isIgnored = ignoreClasses.some((it) => target.classList.contains(it));
|
|
7241
|
-
if (isIgnored) {
|
|
7254
|
+
if (this.isIgnored(target)) {
|
|
7242
7255
|
return;
|
|
7243
7256
|
}
|
|
7244
7257
|
this.walk(target, target);
|
|
@@ -7257,6 +7270,25 @@ class TelNonBreaking extends Rule {
|
|
|
7257
7270
|
}
|
|
7258
7271
|
return true;
|
|
7259
7272
|
}
|
|
7273
|
+
isIgnoredClass(node) {
|
|
7274
|
+
const { ignoreClasses } = this.options;
|
|
7275
|
+
const { classList } = node;
|
|
7276
|
+
return ignoreClasses.some((it) => classList.contains(it));
|
|
7277
|
+
}
|
|
7278
|
+
isIgnoredStyle(node) {
|
|
7279
|
+
const { ignoreStyle } = this.options;
|
|
7280
|
+
const { style } = node;
|
|
7281
|
+
if (!ignoreStyle) {
|
|
7282
|
+
return false;
|
|
7283
|
+
}
|
|
7284
|
+
if (style["white-space"] === "nowrap" || style["white-space"] === "pre") {
|
|
7285
|
+
return true;
|
|
7286
|
+
}
|
|
7287
|
+
return false;
|
|
7288
|
+
}
|
|
7289
|
+
isIgnored(node) {
|
|
7290
|
+
return this.isIgnoredClass(node) || this.isIgnoredStyle(node);
|
|
7291
|
+
}
|
|
7260
7292
|
walk(anchor, node) {
|
|
7261
7293
|
for (const child of node.childNodes) {
|
|
7262
7294
|
if (isTextNode(child)) {
|
|
@@ -10212,7 +10244,7 @@ class Config {
|
|
|
10212
10244
|
}
|
|
10213
10245
|
let filename;
|
|
10214
10246
|
/* try searching builtin metadata */
|
|
10215
|
-
filename = path.join(projectRoot, "elements", `${entry}.
|
|
10247
|
+
filename = path.join(projectRoot, "elements", `${entry}.js`);
|
|
10216
10248
|
if (fs.existsSync(filename)) {
|
|
10217
10249
|
metaTable.loadFromFile(filename);
|
|
10218
10250
|
continue;
|
|
@@ -11171,6 +11203,12 @@ class Parser {
|
|
|
11171
11203
|
}
|
|
11172
11204
|
}
|
|
11173
11205
|
|
|
11206
|
+
function freeze(src) {
|
|
11207
|
+
return {
|
|
11208
|
+
...src,
|
|
11209
|
+
selector: src.selector(),
|
|
11210
|
+
};
|
|
11211
|
+
}
|
|
11174
11212
|
/**
|
|
11175
11213
|
* @internal
|
|
11176
11214
|
*/
|
|
@@ -11222,7 +11260,9 @@ class Reporter {
|
|
|
11222
11260
|
line: location.line,
|
|
11223
11261
|
column: location.column,
|
|
11224
11262
|
size: location.size || 0,
|
|
11225
|
-
selector
|
|
11263
|
+
selector() {
|
|
11264
|
+
return node ? node.generateSelector() : null;
|
|
11265
|
+
},
|
|
11226
11266
|
context,
|
|
11227
11267
|
});
|
|
11228
11268
|
}
|
|
@@ -11236,7 +11276,7 @@ class Reporter {
|
|
|
11236
11276
|
const report = {
|
|
11237
11277
|
valid: this.isValid(),
|
|
11238
11278
|
results: Object.keys(this.result).map((filePath) => {
|
|
11239
|
-
const messages = Array.from(this.result[filePath]).sort(messageSort);
|
|
11279
|
+
const messages = Array.from(this.result[filePath], freeze).sort(messageSort);
|
|
11240
11280
|
const source = (sources || []).find((source) => { var _a; return filePath === ((_a = source.filename) !== null && _a !== void 0 ? _a : ""); });
|
|
11241
11281
|
return {
|
|
11242
11282
|
filePath,
|
|
@@ -11638,7 +11678,7 @@ class Engine {
|
|
|
11638
11678
|
line: location.line,
|
|
11639
11679
|
column: location.column,
|
|
11640
11680
|
size: location.size || 0,
|
|
11641
|
-
selector: null,
|
|
11681
|
+
selector: () => null,
|
|
11642
11682
|
});
|
|
11643
11683
|
}
|
|
11644
11684
|
}
|
|
@@ -12161,6 +12201,7 @@ const formatter$4 = checkstyleFormatter;
|
|
|
12161
12201
|
const defaults = {
|
|
12162
12202
|
showLink: true,
|
|
12163
12203
|
showSummary: true,
|
|
12204
|
+
showSelector: false,
|
|
12164
12205
|
};
|
|
12165
12206
|
/**
|
|
12166
12207
|
* Codeframe formatter based on ESLint codeframe.
|
|
@@ -12216,6 +12257,7 @@ function getEndLocation(message, source) {
|
|
|
12216
12257
|
* @returns The formatted output.
|
|
12217
12258
|
*/
|
|
12218
12259
|
function formatMessage(message, parentResult, options) {
|
|
12260
|
+
var _a;
|
|
12219
12261
|
const type = message.severity === 2 ? kleur.red("error") : kleur.yellow("warning");
|
|
12220
12262
|
const msg = `${kleur.bold(message.message.replace(/([^ ])\.$/, "$1"))}`;
|
|
12221
12263
|
const ruleId = kleur.dim(`(${message.ruleId})`);
|
|
@@ -12238,6 +12280,9 @@ function formatMessage(message, parentResult, options) {
|
|
|
12238
12280
|
end: getEndLocation(message, sourceCode),
|
|
12239
12281
|
}, { highlightCode: false }));
|
|
12240
12282
|
}
|
|
12283
|
+
if (options.showSelector) {
|
|
12284
|
+
result.push(`${kleur.bold("Selector:")} ${(_a = message.selector) !== null && _a !== void 0 ? _a : "-"}`);
|
|
12285
|
+
}
|
|
12241
12286
|
if (options.showLink && message.ruleUrl) {
|
|
12242
12287
|
result.push(`${kleur.bold("Details:")} ${message.ruleUrl}`);
|
|
12243
12288
|
}
|
|
@@ -12360,5 +12405,5 @@ function getFormatter(name) {
|
|
|
12360
12405
|
return (_a = availableFormatters[name]) !== null && _a !== void 0 ? _a : null;
|
|
12361
12406
|
}
|
|
12362
12407
|
|
|
12363
|
-
export { Config as C, DynamicValue as D, EventHandler as E, FileSystemConfigLoader as F, HtmlValidate as H, MetaTable as M, NodeClosed as N, Parser as P, Rule as R, Severity as S, TextNode as T, UserError as U, ConfigError as a, ConfigLoader as b, StaticConfigLoader as c, HtmlElement as d, SchemaValidationError as e, MetaCopyableProperty as f, Reporter as g, TemplateExtractor as h, getFormatter as i, compatibilityCheck as j,
|
|
12408
|
+
export { Config as C, DynamicValue as D, EventHandler as E, FileSystemConfigLoader as F, HtmlValidate as H, MetaTable as M, NodeClosed as N, Parser as P, Rule as R, Severity as S, TextNode as T, UserError as U, ConfigError as a, ConfigLoader as b, StaticConfigLoader as c, HtmlElement as d, SchemaValidationError as e, MetaCopyableProperty as f, Reporter as g, TemplateExtractor as h, getFormatter as i, compatibilityCheck as j, codeframe as k, legacyRequire as l, bugs as m, name as n, presets as p, ruleExists as r, version as v };
|
|
12364
12409
|
//# sourceMappingURL=core.js.map
|