html-validate 11.4.0 → 11.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/dist/cjs/browser.js +1 -1
  2. package/dist/cjs/cli.js +7 -0
  3. package/dist/cjs/cli.js.map +1 -1
  4. package/dist/cjs/core-nodejs.js +212 -2
  5. package/dist/cjs/core-nodejs.js.map +1 -1
  6. package/dist/cjs/core.js +85 -30
  7. package/dist/cjs/core.js.map +1 -1
  8. package/dist/cjs/elements.js +429 -58
  9. package/dist/cjs/elements.js.map +1 -1
  10. package/dist/cjs/html-validate.js +1 -1
  11. package/dist/cjs/index.js +3 -1
  12. package/dist/cjs/index.js.map +1 -1
  13. package/dist/cjs/jest-worker.js +1 -1
  14. package/dist/cjs/jest.js +1 -1
  15. package/dist/cjs/presets.d.ts +1 -0
  16. package/dist/cjs/presets.js +22 -0
  17. package/dist/cjs/presets.js.map +1 -0
  18. package/dist/cjs/vitest-matchers.js +20 -4
  19. package/dist/cjs/vitest-matchers.js.map +1 -1
  20. package/dist/cjs/vitest-worker.js +1 -1
  21. package/dist/cjs/vitest.js +1 -1
  22. package/dist/esm/browser.js +2 -2
  23. package/dist/esm/cli.js +10 -3
  24. package/dist/esm/cli.js.map +1 -1
  25. package/dist/esm/core-browser.js +1 -1
  26. package/dist/esm/core-nodejs.js +212 -4
  27. package/dist/esm/core-nodejs.js.map +1 -1
  28. package/dist/esm/core.js +78 -30
  29. package/dist/esm/core.js.map +1 -1
  30. package/dist/esm/elements.js +429 -58
  31. package/dist/esm/elements.js.map +1 -1
  32. package/dist/esm/html-validate.js +3 -3
  33. package/dist/esm/index.js +3 -3
  34. package/dist/esm/jest-matchers.js +2 -2
  35. package/dist/esm/jest-utils.js +2 -2
  36. package/dist/esm/jest-worker.js +2 -2
  37. package/dist/esm/jest.js +1 -1
  38. package/dist/esm/presets.d.ts +1 -0
  39. package/dist/esm/presets.js +11 -0
  40. package/dist/esm/presets.js.map +1 -0
  41. package/dist/esm/vitest-matchers.js +23 -7
  42. package/dist/esm/vitest-matchers.js.map +1 -1
  43. package/dist/esm/vitest-utils.js +2 -2
  44. package/dist/esm/vitest-worker.js +2 -2
  45. package/dist/esm/vitest.js +1 -1
  46. package/dist/schema/elements.json +14 -1
  47. package/dist/types/browser.d.ts +88 -4
  48. package/dist/types/index.d.ts +154 -4
  49. package/dist/types/presets.d.ts +8 -0
  50. package/package.json +7 -2
@@ -2,16 +2,16 @@ import fs from 'node:fs';
2
2
  import path from 'node:path';
3
3
  import { parseArgs } from 'node:util';
4
4
  import kleur from 'kleur';
5
- import { Q as name, a3 as version, S as SchemaValidationError, K as isUserError, q as bugs } from './core.js';
6
- import { M as Mode, m as modeToFlag, C as CLI, a as haveImportMetaResolve, I as ImportResolveMissingError, d as dump, p as printConfig, i as init, l as lint, h as handleSchemaValidationError } from './cli.js';
5
+ import { ab as name, v as version, z as SchemaValidationError, Q as isUserError, ac as bugs } from './core.js';
6
+ import { M as Mode, m as modeToFlag, C as CLI, h as haveImportMetaResolve, I as ImportResolveMissingError, d as dump, p as printConfig, i as init, l as lint, a as handleSchemaValidationError } from './cli.js';
7
7
  import 'ajv';
8
8
  import './elements.js';
9
9
  import './meta-helper.js';
10
10
  import './utils/natural-join.js';
11
11
  import './utils/parse-image-candidate-string.js';
12
12
  import '@sidvind/better-ajv-errors';
13
- import '@html-validate/stylish';
14
13
  import 'semver';
14
+ import '@html-validate/stylish';
15
15
  import './core-nodejs.js';
16
16
  import 'node:fs/promises';
17
17
  import 'node:url';
package/dist/esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
- export { F as FileSystemConfigLoader, H as HtmlValidate, c as cjsResolver, a as compatibilityCheck, e as esmResolver } from './core-nodejs.js';
2
- export { A as Attribute, C as Config, a as ConfigError, b as ConfigLoader, D as DOMNode, c as DOMTokenList, d as DOMTree, e as DynamicValue, f as EventHandler, H as HtmlElement, M as MetaCopyableProperty, g as MetaTable, N as NestedError, h as Node, P as Parser, i as PerformanceTracker, R as Reporter, j as ResolvedConfig, k as Rule, S as SchemaValidationError, l as Severity, m as StaticConfigLoader, T as TextClassification, n as TextContent, o as TextNode, U as UserError, W as WrappedError, p as ariaNaming, r as classifyNodeText, X as configPresets, w as defineConfig, x as definePlugin, F as formatterFactory, K as isUserError, O as keywordPatternMatcher, Y as ruleExists, Z as sliceLocation, _ as staticResolver, a3 as version, a5 as walk } from './core.js';
1
+ export { a as FileSystemConfigLoader, F as FlatConfigLoader, H as HtmlValidate, c as cjsResolver, b as compatibilityCheck, d as defineFlatConfig, e as esmResolver } from './core-nodejs.js';
2
+ export { A as Attribute, h as Config, g as ConfigError, C as ConfigLoader, D as DOMNode, q as DOMTokenList, r as DOMTree, s as DynamicValue, u as EventHandler, H as HtmlElement, w as MetaCopyableProperty, M as MetaTable, N as NestedError, x as Node, a as Parser, P as PerformanceTracker, R as Reporter, j as ResolvedConfig, y as Rule, z as SchemaValidationError, B as Severity, S as StaticConfigLoader, T as TextClassification, F as TextContent, G as TextNode, U as UserError, W as WrappedError, I as ariaNaming, J as classifyNodeText, K as configPresets, L as defineConfig, O as definePlugin, l as formatterFactory, Q as isUserError, V as keywordPatternMatcher, X as ruleExists, Y as sliceLocation, Z as staticResolver, v as version, _ as walk } from './core.js';
3
3
  export { C as CLI } from './cli.js';
4
4
  export { d as defineMetadata, m as metadataHelper } from './meta-helper.js';
5
5
  import 'node:fs';
@@ -13,8 +13,8 @@ import './elements.js';
13
13
  import './utils/parse-image-candidate-string.js';
14
14
  import '@sidvind/better-ajv-errors';
15
15
  import './utils/natural-join.js';
16
- import '@html-validate/stylish';
17
16
  import 'semver';
17
+ import '@html-validate/stylish';
18
18
  import 'node:path/posix';
19
19
  import 'prompts';
20
20
  import 'node:util';
@@ -1,5 +1,5 @@
1
- import { d as diverge, a as createSyncFn, c as codeframe, i as isThenable } from './jest-utils.js';
2
- import { v as deepmerge, L as jestWorkerPath } from './core.js';
1
+ import { d as diverge, c as createSyncFn, a as codeframe, i as isThenable } from './jest-utils.js';
2
+ import { m as deepmerge, a3 as jestWorkerPath } from './core.js';
3
3
  import { toMatchSnapshot, toMatchInlineSnapshot } from 'jest-snapshot';
4
4
 
5
5
  function createMatcher$6() {
@@ -1,4 +1,4 @@
1
- import { s as codeFrameColumns, B as getEndLocation, G as getStartLocation } from './core.js';
1
+ import { a0 as codeFrameColumns, a1 as getEndLocation, a2 as getStartLocation } from './core.js';
2
2
  import { MessageChannel, Worker, receiveMessageOnPort } from 'node:worker_threads';
3
3
  import { l as legacyRequire } from './core-nodejs.js';
4
4
 
@@ -112,5 +112,5 @@ function createSyncFn(workerPath) {
112
112
  return syncFn;
113
113
  }
114
114
 
115
- export { createSyncFn as a, codeframe as c, diverge as d, isThenable as i };
115
+ export { codeframe as a, createSyncFn as c, diverge as d, isThenable as i };
116
116
  //# sourceMappingURL=jest-utils.js.map
@@ -1,5 +1,5 @@
1
1
  import { workerData, parentPort } from 'node:worker_threads';
2
- import { F as FileSystemConfigLoader, H as HtmlValidate } from './core-nodejs.js';
2
+ import { a as FileSystemConfigLoader, H as HtmlValidate } from './core-nodejs.js';
3
3
  import 'node:fs';
4
4
  import './core.js';
5
5
  import 'ajv';
@@ -8,9 +8,9 @@ import './meta-helper.js';
8
8
  import './utils/natural-join.js';
9
9
  import './utils/parse-image-candidate-string.js';
10
10
  import '@sidvind/better-ajv-errors';
11
+ import 'semver';
11
12
  import 'kleur';
12
13
  import '@html-validate/stylish';
13
- import 'semver';
14
14
  import 'node:path';
15
15
  import 'node:fs/promises';
16
16
  import 'node:url';
package/dist/esm/jest.js CHANGED
@@ -8,9 +8,9 @@ import './meta-helper.js';
8
8
  import './utils/natural-join.js';
9
9
  import './utils/parse-image-candidate-string.js';
10
10
  import '@sidvind/better-ajv-errors';
11
+ import 'semver';
11
12
  import 'kleur';
12
13
  import '@html-validate/stylish';
13
- import 'semver';
14
14
  import 'node:worker_threads';
15
15
  import './core-nodejs.js';
16
16
  import 'node:fs';
@@ -0,0 +1 @@
1
+ export * from "../types/presets";
@@ -0,0 +1,11 @@
1
+ export { a5 as a11y, a6 as browser, a7 as document, a8 as prettier, a9 as recommended, aa as standard } from './core.js';
2
+ import 'ajv';
3
+ import './elements.js';
4
+ import './meta-helper.js';
5
+ import './utils/natural-join.js';
6
+ import './utils/parse-image-candidate-string.js';
7
+ import '@sidvind/better-ajv-errors';
8
+ import 'semver';
9
+ import 'kleur';
10
+ import '@html-validate/stylish';
11
+ //# sourceMappingURL=presets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"presets.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
@@ -1,7 +1,7 @@
1
- import { d as diverge, a as createSyncFn, c as codeframe } from './vitest-utils.js';
2
- import { v as deepmerge, a4 as vitestWorkerPath } from './core.js';
1
+ import { d as diverge, c as createSyncFn, a as codeframe } from './vitest-utils.js';
2
+ import { m as deepmerge, a4 as vitestWorkerPath } from './core.js';
3
3
  import * as vitest from 'vitest';
4
- import { H as HtmlValidate } from './core-nodejs.js';
4
+ import { a as FileSystemConfigLoader, H as HtmlValidate } from './core-nodejs.js';
5
5
 
6
6
  function createMatcher$6() {
7
7
  function toBeValid(report) {
@@ -209,7 +209,10 @@ ${diffString}` : "");
209
209
  }
210
210
 
211
211
  function createMatcher$1() {
212
- const htmlvalidate = new HtmlValidate();
212
+ const loader = new FileSystemConfigLoader({
213
+ extends: ["html-validate:recommended"]
214
+ });
215
+ const htmlvalidate = new HtmlValidate(loader);
213
216
  async function toMatchCodeframe(received, hint) {
214
217
  if (!vitest.Snapshots) {
215
218
  throw new Error("toMatchCodeframe() requires vitest 4.1.3 or later. Please upgrade vitest.");
@@ -217,7 +220,12 @@ function createMatcher$1() {
217
220
  const resolved = await received;
218
221
  let report;
219
222
  if (typeof resolved === "string") {
220
- report = await htmlvalidate.validateString(resolved);
223
+ const filename = this.testPath ?? "inline";
224
+ report = await htmlvalidate.validateString(resolved, filename, {
225
+ rules: {
226
+ "void-style": "off"
227
+ }
228
+ });
221
229
  } else {
222
230
  report = resolved;
223
231
  }
@@ -228,7 +236,10 @@ function createMatcher$1() {
228
236
  }
229
237
 
230
238
  function createMatcher() {
231
- const htmlvalidate = new HtmlValidate();
239
+ const loader = new FileSystemConfigLoader({
240
+ extends: ["html-validate:recommended"]
241
+ });
242
+ const htmlvalidate = new HtmlValidate(loader);
232
243
  async function toMatchInlineCodeframe(received, inlineSnapshot) {
233
244
  if (!vitest.Snapshots) {
234
245
  throw new Error(
@@ -239,7 +250,12 @@ function createMatcher() {
239
250
  const resolved = await received;
240
251
  let report;
241
252
  if (typeof resolved === "string") {
242
- report = await htmlvalidate.validateString(resolved);
253
+ const filename = this.testPath ?? "inline";
254
+ report = await htmlvalidate.validateString(resolved, filename, {
255
+ rules: {
256
+ "void-style": "off"
257
+ }
258
+ });
243
259
  } else {
244
260
  report = resolved;
245
261
  }
@@ -1 +1 @@
1
- {"version":3,"file":"vitest-matchers.js","sources":["../../src/vitest/matchers/to-be-valid.ts","../../src/vitest/matchers/to-be-invalid.ts","../../src/vitest/matchers/to-htmlvalidate.ts","../../src/vitest/matchers/to-have-error.ts","../../src/vitest/matchers/to-have-errors.ts","../../src/vitest/matchers/to-match-codeframe.ts","../../src/vitest/matchers/to-match-inline-codeframe.ts"],"sourcesContent":["import { type SyncExpectationResult } from \"@vitest/expect\";\nimport { type Report } from \"../../reporter\";\nimport { type MaybeAsyncCallback, diverge } from \"../utils\";\n\nfunction createMatcher(): MaybeAsyncCallback<Report, []> {\n\tfunction toBeValid(report: Report): SyncExpectationResult {\n\t\tif (report.valid) {\n\t\t\treturn {\n\t\t\t\tpass: true,\n\t\t\t\tmessage: /* istanbul ignore next */ () => \"Result should not contain error\",\n\t\t\t};\n\t\t} else {\n\t\t\tconst firstError = report.results[0].messages[0];\n\t\t\treturn {\n\t\t\t\tpass: false,\n\t\t\t\tmessage: () => `Result should be valid but had error \"${firstError.message}\"`,\n\t\t\t};\n\t\t}\n\t}\n\treturn diverge(toBeValid);\n}\n\nexport { createMatcher as toBeValid };\n","import { type SyncExpectationResult } from \"@vitest/expect\";\nimport { type Report } from \"../../reporter\";\nimport { type MaybeAsyncCallback, diverge } from \"../utils\";\n\nfunction createMatcher(): MaybeAsyncCallback<Report, []> {\n\tfunction toBeInvalid(report: Report): SyncExpectationResult {\n\t\tif (report.valid) {\n\t\t\treturn {\n\t\t\t\tpass: false,\n\t\t\t\tmessage: () => \"Result should be invalid but had no errors\",\n\t\t\t};\n\t\t} else {\n\t\t\treturn {\n\t\t\t\tpass: true,\n\t\t\t\tmessage: /* istanbul ignore next */ () => \"Result should not contain error\",\n\t\t\t};\n\t\t}\n\t}\n\treturn diverge(toBeInvalid);\n}\n\nexport { createMatcher as toBeInvalid };\n","import { type MatcherState, type SyncExpectationResult } from \"@vitest/expect\";\nimport deepmerge from \"deepmerge\";\nimport { type expect } from \"vitest\";\nimport { type ConfigData } from \"../../config\";\nimport { type Message } from \"../../message\";\nimport { type MaybeAsyncCallback, diverge } from \"../utils\";\nimport { type ValidateStringFn, createSyncFn, vitestWorkerPath } from \"../worker\";\n\ntype VitestExpect = typeof expect;\n\nfunction isMessage(arg: Arg1 | undefined): arg is Partial<Message> {\n\tif (!arg || typeof arg !== \"object\") {\n\t\treturn false;\n\t}\n\treturn [\n\t\t\"ruleId\",\n\t\t\"severity\",\n\t\t\"message\",\n\t\t\"offset\",\n\t\t\"line\",\n\t\t\"column\",\n\t\t\"size\",\n\t\t\"selector\",\n\t\t\"context\",\n\t].some((key) => key in arg);\n}\n\nfunction isConfig(arg: Arg1 | undefined): arg is ConfigData {\n\tif (!arg || typeof arg !== \"object\") {\n\t\treturn false;\n\t}\n\treturn [\"root\", \"extends\", \"elements\", \"plugin\", \"transform\", \"rules\"].some((key) => key in arg);\n}\n\nfunction isString(arg: Arg1 | undefined): arg is string {\n\treturn typeof arg === \"string\";\n}\n\nfunction getMarkup(src: unknown): string {\n\tif (typeof HTMLElement !== \"undefined\" && src instanceof HTMLElement) {\n\t\treturn (src as { outerHTML: string }).outerHTML;\n\t}\n\t/* istanbul ignore else: prototype only allows string or HTMLElement */\n\tif (typeof src === \"string\") {\n\t\treturn src;\n\t} else {\n\t\tthrow new TypeError(`Failed to get markup from \"${typeof src}\" argument`);\n\t}\n}\n\ntype Arg1 = Partial<Message> | ConfigData | string;\ntype Arg2 = ConfigData | string;\ntype Arg3 = string;\n\nfunction createMatcher(expect: VitestExpect): MaybeAsyncCallback<unknown, [Arg1?, Arg2?, Arg3?]> {\n\tfunction toHTMLValidate(\n\t\tthis: MatcherState,\n\t\tactual: unknown,\n\t\targ0?: Arg1,\n\t\targ1?: Arg2,\n\t\targ2?: Arg3,\n\t): SyncExpectationResult {\n\t\tconst markup = getMarkup(actual);\n\t\tconst message = isMessage(arg0) ? arg0 : undefined;\n\t\tconst config = isConfig(arg0) ? arg0 : isConfig(arg1) ? arg1 : undefined; // eslint-disable-line sonarjs/no-nested-conditional -- easier to read than the alternative */\n\t\tconst filename = isString(arg0) ? arg0 : isString(arg1) ? arg1 : arg2; // eslint-disable-line sonarjs/no-nested-conditional -- easier to read than the alternative */\n\t\treturn toHTMLValidateImpl.call(this, expect, markup, message, config, filename);\n\t}\n\treturn diverge(toHTMLValidate);\n}\n\n/* eslint-disable-next-line @typescript-eslint/max-params -- technical debt */\nfunction toHTMLValidateImpl(\n\tthis: MatcherState,\n\texpect: VitestExpect,\n\tactual: string,\n\texpectedError?: Partial<Message>,\n\tuserConfig?: ConfigData,\n\tfilename?: string,\n): SyncExpectationResult {\n\tconst defaultConfig = {\n\t\trules: {\n\t\t\t/* jsdom normalizes style so disabling rule when using this matcher or it\n\t\t\t * gets quite noisy when configured with self-closing */\n\t\t\t\"void-style\": \"off\",\n\t\t},\n\t};\n\tconst config = deepmerge(defaultConfig, userConfig ?? {});\n\t/* istanbul ignore next: cant figure out when this would be unset */\n\tconst actualFilename = filename ?? this.testPath ?? \"inline\";\n\n\tconst syncFn = createSyncFn<ValidateStringFn>(vitestWorkerPath);\n\tconst report = syncFn(actual, actualFilename, config);\n\tconst pass = report.valid;\n\tconst result = report.results[0];\n\tif (pass) {\n\t\treturn { pass, message: () => \"HTML is valid when an error was expected\" };\n\t} else {\n\t\tif (expectedError) {\n\t\t\tconst actual = result.messages;\n\t\t\t/* eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- upstream typing */\n\t\t\tconst expected = expect.arrayContaining([expect.objectContaining(expectedError)]);\n\t\t\tconst errorPass = this.equals(actual, expected);\n\t\t\tconst diffString = this.utils.diff(expected, actual, {\n\t\t\t\taAnnotation: \"Expected error\",\n\t\t\t\tbAnnotation: \"Actual error\",\n\t\t\t});\n\t\t\tconst hint = this.utils.matcherHint(\".not.toHTMLValidate\", undefined, undefined, {\n\t\t\t\tcomment: \"expected error\",\n\t\t\t});\n\t\t\tconst expectedErrorMessage = (): string =>\n\t\t\t\t[\n\t\t\t\t\thint,\n\t\t\t\t\t\"\",\n\t\t\t\t\t\"Expected error to be present:\",\n\t\t\t\t\tthis.utils.printExpected(expectedError),\n\t\t\t\t\t/* istanbul ignore next */ diffString ? `\\n${diffString}` : \"\",\n\t\t\t\t].join(\"\\n\");\n\t\t\t/* eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- upstream typing */\n\t\t\treturn { pass: !errorPass, message: expectedErrorMessage, actual, expected };\n\t\t}\n\n\t\tconst errors = result.messages.map((message) => ` ${message.message} [${message.ruleId}]`);\n\t\treturn {\n\t\t\tpass,\n\t\t\tmessage: () =>\n\t\t\t\t[\"Expected HTML to be valid but had the following errors:\", \"\"].concat(errors).join(\"\\n\"),\n\t\t};\n\t}\n}\n\nexport { createMatcher as toHTMLValidate };\n","import { type MatcherState, type SyncExpectationResult } from \"@vitest/expect\";\nimport { type expect } from \"vitest\";\nimport { type Message } from \"../../message\";\nimport { type Report } from \"../../reporter\";\nimport { type MaybeAsyncCallback, diverge } from \"../utils\";\n\ntype VitestExpect = typeof expect;\n\nfunction toHaveErrorImpl(\n\tcontext: MatcherState,\n\texpect: VitestExpect,\n\tactual: Report,\n\texpected: Partial<Message>,\n): SyncExpectationResult {\n\tconst flattened = actual.results.flatMap((result) => result.messages);\n\tconst matcher = [expect.objectContaining(expected)];\n\tconst pass = context.equals(flattened, matcher);\n\tconst diffString = context.utils.diff(matcher, flattened);\n\tconst hint = context.utils.matcherHint(\".toHaveError\");\n\tconst prettyExpected = context.utils.printExpected(matcher);\n\tconst prettyReceived = context.utils.printReceived(flattened);\n\tconst resultMessage = (): string => {\n\t\treturn [\n\t\t\thint,\n\t\t\t\"\",\n\t\t\t\"Expected error to equal:\",\n\t\t\t` ${prettyExpected}`,\n\t\t\t\"Received:\",\n\t\t\t` ${prettyReceived}`,\n\t\t\t/* istanbul ignore next */ diffString ? `\\nDifference:\\n\\n${diffString}` : \"\",\n\t\t].join(\"\\n\");\n\t};\n\treturn { pass, message: resultMessage, actual: flattened, expected: matcher };\n}\n\nfunction createMatcher(\n\texpect: VitestExpect,\n):\n\t| MaybeAsyncCallback<Report, [Partial<Message>]>\n\t| MaybeAsyncCallback<Report, [string, string, unknown?]> {\n\tfunction toHaveError(\n\t\tthis: MatcherState,\n\t\tactual: Report,\n\t\terror: Partial<Message>,\n\t): SyncExpectationResult;\n\tfunction toHaveError(\n\t\tthis: MatcherState,\n\t\tactual: Report,\n\t\truleId: string,\n\t\tmessage: string,\n\t\tcontext?: unknown,\n\t): SyncExpectationResult;\n\tfunction toHaveError(\n\t\tthis: MatcherState,\n\t\tactual: Report,\n\t\targ1: string | Partial<Message>,\n\t\targ2?: string,\n\t\targ3?: unknown,\n\t): SyncExpectationResult {\n\t\tif (typeof arg1 === \"string\") {\n\t\t\tconst expected: Partial<Message> = {\n\t\t\t\truleId: arg1,\n\t\t\t\tmessage: arg2,\n\t\t\t};\n\t\t\tif (arg3 !== undefined) {\n\t\t\t\texpected.context = arg3;\n\t\t\t}\n\t\t\treturn toHaveErrorImpl(this, expect, actual, expected);\n\t\t} else {\n\t\t\treturn toHaveErrorImpl(this, expect, actual, arg1);\n\t\t}\n\t}\n\treturn diverge(toHaveError);\n}\n\nexport { createMatcher as toHaveError };\n","/* eslint-disable prefer-template -- technical debt, should be refactored */\n\nimport { type MatcherState, type SyncExpectationResult } from \"@vitest/expect\";\nimport { type expect } from \"vitest\";\nimport { type Report } from \"../../reporter\";\nimport { type MaybeAsyncCallback, diverge } from \"../utils\";\n\ntype VitestExpect = typeof expect;\n\nfunction createMatcher(\n\texpect: VitestExpect,\n): MaybeAsyncCallback<Report, [Array<[string, string] | Record<string, unknown>>]> {\n\tfunction toHaveErrors(\n\t\tthis: MatcherState,\n\t\treport: Report,\n\t\terrors: Array<[string, string] | Record<string, unknown>>,\n\t): SyncExpectationResult {\n\t\tconst flattened = report.results.flatMap((result) => result.messages);\n\t\tconst matcher = errors.map((entry) => {\n\t\t\tif (Array.isArray(entry)) {\n\t\t\t\tconst [ruleId, message] = entry;\n\t\t\t\t/* eslint-disable-next-line @typescript-eslint/no-unsafe-return -- upstream typing */\n\t\t\t\treturn expect.objectContaining({ ruleId, message });\n\t\t\t} else {\n\t\t\t\t/* eslint-disable-next-line @typescript-eslint/no-unsafe-return -- upstream typing */\n\t\t\t\treturn expect.objectContaining(entry);\n\t\t\t}\n\t\t});\n\t\tconst pass = this.equals(flattened, matcher);\n\t\tconst diffString = this.utils.diff(matcher, flattened);\n\t\tconst resultMessage = (): string =>\n\t\t\tthis.utils.matcherHint(\".toHaveErrors\") +\n\t\t\t\"\\n\\n\" +\n\t\t\t\"Expected error to equal:\\n\" +\n\t\t\t` ${this.utils.printExpected(matcher)}\\n` +\n\t\t\t\"Received:\\n\" +\n\t\t\t` ${this.utils.printReceived(flattened)}` +\n\t\t\t/* istanbul ignore next */ (diffString ? `\\n\\nDifference:\\n\\n${diffString}` : \"\");\n\n\t\treturn { pass, message: resultMessage };\n\t}\n\treturn diverge(toHaveErrors);\n}\n\nexport { createMatcher as toHaveErrors };\n","import { type AsyncExpectationResult, type MatcherState } from \"@vitest/expect\";\nimport * as vitest from \"vitest\";\nimport { HtmlValidate } from \"../../htmlvalidate\";\nimport { type Report } from \"../../reporter\";\nimport { codeframe } from \"../utils\";\n\ntype ToMatchCodeframeMatcher = (\n\tthis: MatcherState,\n\treceived: Report | string | Promise<Report> | Promise<string>,\n\thint?: string,\n) => AsyncExpectationResult;\n\nfunction createMatcher(): ToMatchCodeframeMatcher {\n\tconst htmlvalidate = new HtmlValidate();\n\n\tasync function toMatchCodeframe(\n\t\tthis: MatcherState,\n\t\treceived: Report | string | Promise<Report> | Promise<string>,\n\t\thint?: string,\n\t): AsyncExpectationResult {\n\t\t/* eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- for backwards compatibility with older vitest versions */\n\t\tif (!vitest.Snapshots) {\n\t\t\tthrow new Error(\"toMatchCodeframe() requires vitest 4.1.3 or later. Please upgrade vitest.\");\n\t\t}\n\n\t\tconst resolved = await received;\n\n\t\tlet report: Report;\n\t\tif (typeof resolved === \"string\") {\n\t\t\treport = await htmlvalidate.validateString(resolved);\n\t\t} else {\n\t\t\treport = resolved;\n\t\t}\n\n\t\tconst snapshot = codeframe(report.results).replaceAll(/\\s+$/gm, \"\");\n\n\t\treturn vitest.Snapshots.toMatchSnapshot.call(this, snapshot, hint);\n\t}\n\n\treturn toMatchCodeframe;\n}\n\nexport { createMatcher as toMatchCodeframe };\n","import { type AsyncExpectationResult, type MatcherState } from \"@vitest/expect\";\nimport * as vitest from \"vitest\";\nimport { HtmlValidate } from \"../../htmlvalidate\";\nimport { type Report } from \"../../reporter\";\nimport { codeframe } from \"../utils\";\n\ntype ToMatchInlineCodeframeMatcher = (\n\tthis: MatcherState,\n\treceived: Report | string | Promise<Report> | Promise<string>,\n\tinlineSnapshot?: string,\n) => AsyncExpectationResult;\n\nfunction createMatcher(): ToMatchInlineCodeframeMatcher {\n\tconst htmlvalidate = new HtmlValidate();\n\n\tasync function toMatchInlineCodeframe(\n\t\tthis: MatcherState,\n\t\treceived: Report | string | Promise<Report> | Promise<string>,\n\t\tinlineSnapshot?: string,\n\t): AsyncExpectationResult {\n\t\t/* eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- for backwards compatibility with older vitest versions */\n\t\tif (!vitest.Snapshots) {\n\t\t\tthrow new Error(\n\t\t\t\t\"toMatchInlineCodeframe() requires vitest 4.1.3 or later. Please upgrade vitest.\",\n\t\t\t);\n\t\t}\n\n\t\t/* Capture the call site synchronously before any await — vitest needs this\n\t\t * to determine where to rewrite the inline snapshot in the source file. */\n\t\tvitest.chai.util.flag(this.assertion, \"error\", new Error(\"stacktrace\"));\n\n\t\tconst resolved = await received;\n\n\t\tlet report: Report;\n\t\tif (typeof resolved === \"string\") {\n\t\t\treport = await htmlvalidate.validateString(resolved);\n\t\t} else {\n\t\t\treport = resolved;\n\t\t}\n\n\t\tconst snapshot = codeframe(report.results).replaceAll(/\\s+$/gm, \"\");\n\n\t\treturn vitest.Snapshots.toMatchInlineSnapshot.call(this, snapshot, inlineSnapshot);\n\t}\n\n\treturn toMatchInlineCodeframe;\n}\n\nexport { createMatcher as toMatchInlineCodeframe };\n"],"names":["createMatcher","actual"],"mappings":";;;;;AAIA,SAASA,eAAA,GAAgD;AACxD,EAAA,SAAS,UAAU,MAAA,EAAuC;AACzD,IAAA,IAAI,OAAO,KAAA,EAAO;AACjB,MAAA,OAAO;AAAA,QACN,IAAA,EAAM,IAAA;AAAA,QACN,OAAA;AAAA;AAAA,UAAoC,MAAM;AAAA;AAAA,OAC3C;AAAA,IACD,CAAA,MAAO;AACN,MAAA,MAAM,aAAa,MAAA,CAAO,OAAA,CAAQ,CAAC,CAAA,CAAE,SAAS,CAAC,CAAA;AAC/C,MAAA,OAAO;AAAA,QACN,IAAA,EAAM,KAAA;AAAA,QACN,OAAA,EAAS,MAAM,CAAA,sCAAA,EAAyC,UAAA,CAAW,OAAO,CAAA,CAAA;AAAA,OAC3E;AAAA,IACD;AAAA,EACD;AACA,EAAA,OAAO,QAAQ,SAAS,CAAA;AACzB;;AChBA,SAASA,eAAA,GAAgD;AACxD,E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;AAElE,IAAA,OAAO,OAAO,SAAA,CAAU,eAAA,CAAgB,IAAA,CAAK,IAAA,EAAM,UAAU,IAAI,CAAA;AAAA,EAClE;AAEA,EAAA,OAAO,gBAAA;AACR;;AC5BA,SAAS,aAAA,GAA+C;AACvD,EAAA,MAAM,YAAA,GAAe,IAAI,YAAA,EAAa;AAEtC,EAAA,eAAe,sBAAA,CAEd,UACA,cAAA,EACyB;AAEzB,IAAA,IAAI,CAAC,OAAO,SAAA,EAAW;AACtB,MAAA,MAAM,IAAI,KAAA;AAAA,QACT;AAAA,OACD;AAAA,IACD;AAIA,IAAA,MAAA,CAAO,IAAA,CAAK,KAAK,IAAA,CAAK,IAAA,CAAK,WAAW,OAAA,EAAS,IAAI,KAAA,CAAM,YAAY,CAAC,CAAA;AAEtE,IAAA,MAAM,WAAW,MAAM,QAAA;AAEvB,IAAA,IAAI,MAAA;AACJ,IAAA,IAAI,OAAO,aAAa,QAAA,EAAU;AACjC,MAAA,MAAA,GAAS,MAAM,YAAA,CAAa,cAAA,CAAe,QAAQ,CAAA;AAAA,IACpD,CAAA,MAAO;AACN,MAAA,MAAA,GAAS,QAAA;AAAA,IACV;AAEA,IAAA,MAAM,WAAW,SAAA,CAAU,MAAA,CAAO,OAAO,CAAA,CAAE,UAAA,CAAW,UAAU,EAAE,CAAA;AAElE,IAAA,OAAO,OAAO,SAAA,CAAU,qBAAA,CAAsB,IAAA,CAAK,IAAA,EAAM,UAAU,cAAc,CAAA;AAAA,EAClF;AAEA,EAAA,OAAO,sBAAA;AACR;;;;"}
1
+ {"version":3,"file":"vitest-matchers.js","sources":["../../src/vitest/matchers/to-be-valid.ts","../../src/vitest/matchers/to-be-invalid.ts","../../src/vitest/matchers/to-htmlvalidate.ts","../../src/vitest/matchers/to-have-error.ts","../../src/vitest/matchers/to-have-errors.ts","../../src/vitest/matchers/to-match-codeframe.ts","../../src/vitest/matchers/to-match-inline-codeframe.ts"],"sourcesContent":["import { type SyncExpectationResult } from \"@vitest/expect\";\nimport { type Report } from \"../../reporter\";\nimport { type MaybeAsyncCallback, diverge } from \"../utils\";\n\nfunction createMatcher(): MaybeAsyncCallback<Report, []> {\n\tfunction toBeValid(report: Report): SyncExpectationResult {\n\t\tif (report.valid) {\n\t\t\treturn {\n\t\t\t\tpass: true,\n\t\t\t\tmessage: /* istanbul ignore next */ () => \"Result should not contain error\",\n\t\t\t};\n\t\t} else {\n\t\t\tconst firstError = report.results[0].messages[0];\n\t\t\treturn {\n\t\t\t\tpass: false,\n\t\t\t\tmessage: () => `Result should be valid but had error \"${firstError.message}\"`,\n\t\t\t};\n\t\t}\n\t}\n\treturn diverge(toBeValid);\n}\n\nexport { createMatcher as toBeValid };\n","import { type SyncExpectationResult } from \"@vitest/expect\";\nimport { type Report } from \"../../reporter\";\nimport { type MaybeAsyncCallback, diverge } from \"../utils\";\n\nfunction createMatcher(): MaybeAsyncCallback<Report, []> {\n\tfunction toBeInvalid(report: Report): SyncExpectationResult {\n\t\tif (report.valid) {\n\t\t\treturn {\n\t\t\t\tpass: false,\n\t\t\t\tmessage: () => \"Result should be invalid but had no errors\",\n\t\t\t};\n\t\t} else {\n\t\t\treturn {\n\t\t\t\tpass: true,\n\t\t\t\tmessage: /* istanbul ignore next */ () => \"Result should not contain error\",\n\t\t\t};\n\t\t}\n\t}\n\treturn diverge(toBeInvalid);\n}\n\nexport { createMatcher as toBeInvalid };\n","import { type MatcherState, type SyncExpectationResult } from \"@vitest/expect\";\nimport deepmerge from \"deepmerge\";\nimport { type expect } from \"vitest\";\nimport { type ConfigData } from \"../../config\";\nimport { type Message } from \"../../message\";\nimport { type MaybeAsyncCallback, diverge } from \"../utils\";\nimport { type ValidateStringFn, createSyncFn, vitestWorkerPath } from \"../worker\";\n\ntype VitestExpect = typeof expect;\n\nfunction isMessage(arg: Arg1 | undefined): arg is Partial<Message> {\n\tif (!arg || typeof arg !== \"object\") {\n\t\treturn false;\n\t}\n\treturn [\n\t\t\"ruleId\",\n\t\t\"severity\",\n\t\t\"message\",\n\t\t\"offset\",\n\t\t\"line\",\n\t\t\"column\",\n\t\t\"size\",\n\t\t\"selector\",\n\t\t\"context\",\n\t].some((key) => key in arg);\n}\n\nfunction isConfig(arg: Arg1 | undefined): arg is ConfigData {\n\tif (!arg || typeof arg !== \"object\") {\n\t\treturn false;\n\t}\n\treturn [\"root\", \"extends\", \"elements\", \"plugin\", \"transform\", \"rules\"].some((key) => key in arg);\n}\n\nfunction isString(arg: Arg1 | undefined): arg is string {\n\treturn typeof arg === \"string\";\n}\n\nfunction getMarkup(src: unknown): string {\n\tif (typeof HTMLElement !== \"undefined\" && src instanceof HTMLElement) {\n\t\treturn (src as { outerHTML: string }).outerHTML;\n\t}\n\t/* istanbul ignore else: prototype only allows string or HTMLElement */\n\tif (typeof src === \"string\") {\n\t\treturn src;\n\t} else {\n\t\tthrow new TypeError(`Failed to get markup from \"${typeof src}\" argument`);\n\t}\n}\n\ntype Arg1 = Partial<Message> | ConfigData | string;\ntype Arg2 = ConfigData | string;\ntype Arg3 = string;\n\nfunction createMatcher(expect: VitestExpect): MaybeAsyncCallback<unknown, [Arg1?, Arg2?, Arg3?]> {\n\tfunction toHTMLValidate(\n\t\tthis: MatcherState,\n\t\tactual: unknown,\n\t\targ0?: Arg1,\n\t\targ1?: Arg2,\n\t\targ2?: Arg3,\n\t): SyncExpectationResult {\n\t\tconst markup = getMarkup(actual);\n\t\tconst message = isMessage(arg0) ? arg0 : undefined;\n\t\tconst config = isConfig(arg0) ? arg0 : isConfig(arg1) ? arg1 : undefined; // eslint-disable-line sonarjs/no-nested-conditional -- easier to read than the alternative */\n\t\tconst filename = isString(arg0) ? arg0 : isString(arg1) ? arg1 : arg2; // eslint-disable-line sonarjs/no-nested-conditional -- easier to read than the alternative */\n\t\treturn toHTMLValidateImpl.call(this, expect, markup, message, config, filename);\n\t}\n\treturn diverge(toHTMLValidate);\n}\n\n/* eslint-disable-next-line @typescript-eslint/max-params -- technical debt */\nfunction toHTMLValidateImpl(\n\tthis: MatcherState,\n\texpect: VitestExpect,\n\tactual: string,\n\texpectedError?: Partial<Message>,\n\tuserConfig?: ConfigData,\n\tfilename?: string,\n): SyncExpectationResult {\n\tconst defaultConfig = {\n\t\trules: {\n\t\t\t/* jsdom normalizes style so disabling rule when using this matcher or it\n\t\t\t * gets quite noisy when configured with self-closing */\n\t\t\t\"void-style\": \"off\",\n\t\t},\n\t};\n\tconst config = deepmerge(defaultConfig, userConfig ?? {});\n\t/* istanbul ignore next: cant figure out when this would be unset */\n\tconst actualFilename = filename ?? this.testPath ?? \"inline\";\n\n\tconst syncFn = createSyncFn<ValidateStringFn>(vitestWorkerPath);\n\tconst report = syncFn(actual, actualFilename, config);\n\tconst pass = report.valid;\n\tconst result = report.results[0];\n\tif (pass) {\n\t\treturn { pass, message: () => \"HTML is valid when an error was expected\" };\n\t} else {\n\t\tif (expectedError) {\n\t\t\tconst actual = result.messages;\n\t\t\t/* eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- upstream typing */\n\t\t\tconst expected = expect.arrayContaining([expect.objectContaining(expectedError)]);\n\t\t\tconst errorPass = this.equals(actual, expected);\n\t\t\tconst diffString = this.utils.diff(expected, actual, {\n\t\t\t\taAnnotation: \"Expected error\",\n\t\t\t\tbAnnotation: \"Actual error\",\n\t\t\t});\n\t\t\tconst hint = this.utils.matcherHint(\".not.toHTMLValidate\", undefined, undefined, {\n\t\t\t\tcomment: \"expected error\",\n\t\t\t});\n\t\t\tconst expectedErrorMessage = (): string =>\n\t\t\t\t[\n\t\t\t\t\thint,\n\t\t\t\t\t\"\",\n\t\t\t\t\t\"Expected error to be present:\",\n\t\t\t\t\tthis.utils.printExpected(expectedError),\n\t\t\t\t\t/* istanbul ignore next */ diffString ? `\\n${diffString}` : \"\",\n\t\t\t\t].join(\"\\n\");\n\t\t\t/* eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- upstream typing */\n\t\t\treturn { pass: !errorPass, message: expectedErrorMessage, actual, expected };\n\t\t}\n\n\t\tconst errors = result.messages.map((message) => ` ${message.message} [${message.ruleId}]`);\n\t\treturn {\n\t\t\tpass,\n\t\t\tmessage: () =>\n\t\t\t\t[\"Expected HTML to be valid but had the following errors:\", \"\"].concat(errors).join(\"\\n\"),\n\t\t};\n\t}\n}\n\nexport { createMatcher as toHTMLValidate };\n","import { type MatcherState, type SyncExpectationResult } from \"@vitest/expect\";\nimport { type expect } from \"vitest\";\nimport { type Message } from \"../../message\";\nimport { type Report } from \"../../reporter\";\nimport { type MaybeAsyncCallback, diverge } from \"../utils\";\n\ntype VitestExpect = typeof expect;\n\nfunction toHaveErrorImpl(\n\tcontext: MatcherState,\n\texpect: VitestExpect,\n\tactual: Report,\n\texpected: Partial<Message>,\n): SyncExpectationResult {\n\tconst flattened = actual.results.flatMap((result) => result.messages);\n\tconst matcher = [expect.objectContaining(expected)];\n\tconst pass = context.equals(flattened, matcher);\n\tconst diffString = context.utils.diff(matcher, flattened);\n\tconst hint = context.utils.matcherHint(\".toHaveError\");\n\tconst prettyExpected = context.utils.printExpected(matcher);\n\tconst prettyReceived = context.utils.printReceived(flattened);\n\tconst resultMessage = (): string => {\n\t\treturn [\n\t\t\thint,\n\t\t\t\"\",\n\t\t\t\"Expected error to equal:\",\n\t\t\t` ${prettyExpected}`,\n\t\t\t\"Received:\",\n\t\t\t` ${prettyReceived}`,\n\t\t\t/* istanbul ignore next */ diffString ? `\\nDifference:\\n\\n${diffString}` : \"\",\n\t\t].join(\"\\n\");\n\t};\n\treturn { pass, message: resultMessage, actual: flattened, expected: matcher };\n}\n\nfunction createMatcher(\n\texpect: VitestExpect,\n):\n\t| MaybeAsyncCallback<Report, [Partial<Message>]>\n\t| MaybeAsyncCallback<Report, [string, string, unknown?]> {\n\tfunction toHaveError(\n\t\tthis: MatcherState,\n\t\tactual: Report,\n\t\terror: Partial<Message>,\n\t): SyncExpectationResult;\n\tfunction toHaveError(\n\t\tthis: MatcherState,\n\t\tactual: Report,\n\t\truleId: string,\n\t\tmessage: string,\n\t\tcontext?: unknown,\n\t): SyncExpectationResult;\n\tfunction toHaveError(\n\t\tthis: MatcherState,\n\t\tactual: Report,\n\t\targ1: string | Partial<Message>,\n\t\targ2?: string,\n\t\targ3?: unknown,\n\t): SyncExpectationResult {\n\t\tif (typeof arg1 === \"string\") {\n\t\t\tconst expected: Partial<Message> = {\n\t\t\t\truleId: arg1,\n\t\t\t\tmessage: arg2,\n\t\t\t};\n\t\t\tif (arg3 !== undefined) {\n\t\t\t\texpected.context = arg3;\n\t\t\t}\n\t\t\treturn toHaveErrorImpl(this, expect, actual, expected);\n\t\t} else {\n\t\t\treturn toHaveErrorImpl(this, expect, actual, arg1);\n\t\t}\n\t}\n\treturn diverge(toHaveError);\n}\n\nexport { createMatcher as toHaveError };\n","/* eslint-disable prefer-template -- technical debt, should be refactored */\n\nimport { type MatcherState, type SyncExpectationResult } from \"@vitest/expect\";\nimport { type expect } from \"vitest\";\nimport { type Report } from \"../../reporter\";\nimport { type MaybeAsyncCallback, diverge } from \"../utils\";\n\ntype VitestExpect = typeof expect;\n\nfunction createMatcher(\n\texpect: VitestExpect,\n): MaybeAsyncCallback<Report, [Array<[string, string] | Record<string, unknown>>]> {\n\tfunction toHaveErrors(\n\t\tthis: MatcherState,\n\t\treport: Report,\n\t\terrors: Array<[string, string] | Record<string, unknown>>,\n\t): SyncExpectationResult {\n\t\tconst flattened = report.results.flatMap((result) => result.messages);\n\t\tconst matcher = errors.map((entry) => {\n\t\t\tif (Array.isArray(entry)) {\n\t\t\t\tconst [ruleId, message] = entry;\n\t\t\t\t/* eslint-disable-next-line @typescript-eslint/no-unsafe-return -- upstream typing */\n\t\t\t\treturn expect.objectContaining({ ruleId, message });\n\t\t\t} else {\n\t\t\t\t/* eslint-disable-next-line @typescript-eslint/no-unsafe-return -- upstream typing */\n\t\t\t\treturn expect.objectContaining(entry);\n\t\t\t}\n\t\t});\n\t\tconst pass = this.equals(flattened, matcher);\n\t\tconst diffString = this.utils.diff(matcher, flattened);\n\t\tconst resultMessage = (): string =>\n\t\t\tthis.utils.matcherHint(\".toHaveErrors\") +\n\t\t\t\"\\n\\n\" +\n\t\t\t\"Expected error to equal:\\n\" +\n\t\t\t` ${this.utils.printExpected(matcher)}\\n` +\n\t\t\t\"Received:\\n\" +\n\t\t\t` ${this.utils.printReceived(flattened)}` +\n\t\t\t/* istanbul ignore next */ (diffString ? `\\n\\nDifference:\\n\\n${diffString}` : \"\");\n\n\t\treturn { pass, message: resultMessage };\n\t}\n\treturn diverge(toHaveErrors);\n}\n\nexport { createMatcher as toHaveErrors };\n","import { type AsyncExpectationResult, type MatcherState } from \"@vitest/expect\";\nimport * as vitest from \"vitest\";\nimport { FileSystemConfigLoader } from \"../../config/loaders/file-system\";\nimport { HtmlValidate } from \"../../htmlvalidate\";\nimport { type Report } from \"../../reporter\";\nimport { codeframe } from \"../utils\";\n\ntype ToMatchCodeframeMatcher = (\n\tthis: MatcherState,\n\treceived: Report | string | Promise<Report> | Promise<string>,\n\thint?: string,\n) => AsyncExpectationResult;\n\nfunction createMatcher(): ToMatchCodeframeMatcher {\n\tconst loader = new FileSystemConfigLoader({\n\t\textends: [\"html-validate:recommended\"],\n\t});\n\tconst htmlvalidate = new HtmlValidate(loader);\n\n\tasync function toMatchCodeframe(\n\t\tthis: MatcherState,\n\t\treceived: Report | string | Promise<Report> | Promise<string>,\n\t\thint?: string,\n\t): AsyncExpectationResult {\n\t\t/* eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- for backwards compatibility with older vitest versions */\n\t\tif (!vitest.Snapshots) {\n\t\t\tthrow new Error(\"toMatchCodeframe() requires vitest 4.1.3 or later. Please upgrade vitest.\");\n\t\t}\n\n\t\tconst resolved = await received;\n\n\t\tlet report: Report;\n\t\tif (typeof resolved === \"string\") {\n\t\t\tconst filename = this.testPath ?? \"inline\";\n\t\t\treport = await htmlvalidate.validateString(resolved, filename, {\n\t\t\t\trules: {\n\t\t\t\t\t\"void-style\": \"off\",\n\t\t\t\t},\n\t\t\t});\n\t\t} else {\n\t\t\treport = resolved;\n\t\t}\n\n\t\tconst snapshot = codeframe(report.results).replaceAll(/\\s+$/gm, \"\");\n\n\t\treturn vitest.Snapshots.toMatchSnapshot.call(this, snapshot, hint);\n\t}\n\n\treturn toMatchCodeframe;\n}\n\nexport { createMatcher as toMatchCodeframe };\n","import { type AsyncExpectationResult, type MatcherState } from \"@vitest/expect\";\nimport * as vitest from \"vitest\";\nimport { FileSystemConfigLoader } from \"../../config/loaders/file-system\";\nimport { HtmlValidate } from \"../../htmlvalidate\";\nimport { type Report } from \"../../reporter\";\nimport { codeframe } from \"../utils\";\n\ntype ToMatchInlineCodeframeMatcher = (\n\tthis: MatcherState,\n\treceived: Report | string | Promise<Report> | Promise<string>,\n\tinlineSnapshot?: string,\n) => AsyncExpectationResult;\n\nfunction createMatcher(): ToMatchInlineCodeframeMatcher {\n\tconst loader = new FileSystemConfigLoader({\n\t\textends: [\"html-validate:recommended\"],\n\t});\n\tconst htmlvalidate = new HtmlValidate(loader);\n\n\tasync function toMatchInlineCodeframe(\n\t\tthis: MatcherState,\n\t\treceived: Report | string | Promise<Report> | Promise<string>,\n\t\tinlineSnapshot?: string,\n\t): AsyncExpectationResult {\n\t\t/* eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- for backwards compatibility with older vitest versions */\n\t\tif (!vitest.Snapshots) {\n\t\t\tthrow new Error(\n\t\t\t\t\"toMatchInlineCodeframe() requires vitest 4.1.3 or later. Please upgrade vitest.\",\n\t\t\t);\n\t\t}\n\n\t\t/* Capture the call site synchronously before any await — vitest needs this\n\t\t * to determine where to rewrite the inline snapshot in the source file. */\n\t\tvitest.chai.util.flag(this.assertion, \"error\", new Error(\"stacktrace\"));\n\n\t\tconst resolved = await received;\n\n\t\tlet report: Report;\n\t\tif (typeof resolved === \"string\") {\n\t\t\tconst filename = this.testPath ?? \"inline\";\n\t\t\treport = await htmlvalidate.validateString(resolved, filename, {\n\t\t\t\trules: {\n\t\t\t\t\t\"void-style\": \"off\",\n\t\t\t\t},\n\t\t\t});\n\t\t} else {\n\t\t\treport = resolved;\n\t\t}\n\n\t\tconst snapshot = codeframe(report.results).replaceAll(/\\s+$/gm, \"\");\n\n\t\treturn vitest.Snapshots.toMatchInlineSnapshot.call(this, snapshot, inlineSnapshot);\n\t}\n\n\treturn toMatchInlineCodeframe;\n}\n\nexport { createMatcher as toMatchInlineCodeframe };\n"],"names":["createMatcher","actual"],"mappings":";;;;;AAIA,SAASA,eAAA,GAAgD;AACxD,EAAA,SAAS,UAAU,MAAA,EAAuC;AACzD,IAAA,IAAI,OAAO,KAAA,EAAO;AACjB,MAAA,OAAO;AAAA,QACN,IAAA,EAAM,IAAA;AAAA,QACN,OAAA;AAAA;AAAA,UAAoC,MAAM;AAAA;AAAA,OAC3C;AAAA,IACD,CAAA,MAAO;AACN,MAAA,MAAM,aAAa,MAAA,CAAO,OAAA,CAAQ,CAAC,CAAA,CAAE,SAAS,CAAC,CAAA;AAC/C,MAAA,OAAO;AAAA,QACN,IAAA,EAAM,KAAA;AAAA,QACN,OAAA,EAAS,MAAM,CAAA,sCAAA,EAAyC,UAAA,CAAW,OAAO,CAAA,CAAA;AAAA,OAC3E;AAAA,IACD;AAAA,EACD;AACA,EAAA,OAAO,QAAQ,SAAS,CAAA;AACzB;;AChBA,SAASA,eAAA,GAAgD;AACxD,EAAA,SAAS,YAAY,MAAA,EAAuC;AAC3D,IAAA,IAAI,OAAO,KAAA,EAAO;AACjB,MAAA,OAAO;AAAA,QACN,IAAA,EAAM,KAAA;AAAA,QACN,SAAS,MAAM;AAAA,OAChB;AAAA,IACD,CAAA,MAAO;AACN,MAAA,OAAO;AAAA,QACN,IAAA,EAAM,IAAA;AAAA,QACN,OAAA;AAAA;AAAA,UAAoC,MAAM;AAAA;AAAA,OAC3C;AAAA,IACD;AAAA,EACD;AACA,EAAA,OAAO,QAAQ,WAAW,CAAA;AAC3B;;ACTA,SAAS,UAAU,GAAA,EAAgD;AAClE,EAAA,IAAI,CAAC,GAAA,IAAO,OAA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vD,EAAA,MAAM,MAAA,GAAS,IAAI,sBAAA,CAAuB;AAAA,IACzC,OAAA,EAAS,CAAC,2BAA2B;AAAA,GACrC,CAAA;AACD,EAAA,MAAM,YAAA,GAAe,IAAI,YAAA,CAAa,MAAM,CAAA;AAE5C,EAAA,eAAe,sBAAA,CAEd,UACA,cAAA,EACyB;AAEzB,IAAA,IAAI,CAAC,OAAO,SAAA,EAAW;AACtB,MAAA,MAAM,IAAI,KAAA;AAAA,QACT;AAAA,OACD;AAAA,IACD;AAIA,IAAA,MAAA,CAAO,IAAA,CAAK,KAAK,IAAA,CAAK,IAAA,CAAK,WAAW,OAAA,EAAS,IAAI,KAAA,CAAM,YAAY,CAAC,CAAA;AAEtE,IAAA,MAAM,WAAW,MAAM,QAAA;AAEvB,IAAA,IAAI,MAAA;AACJ,IAAA,IAAI,OAAO,aAAa,QAAA,EAAU;AACjC,MAAA,MAAM,QAAA,GAAW,KAAK,QAAA,IAAY,QAAA;AAClC,MAAA,MAAA,GAAS,MAAM,YAAA,CAAa,cAAA,CAAe,QAAA,EAAU,QAAA,EAAU;AAAA,QAC9D,KAAA,EAAO;AAAA,UACN,YAAA,EAAc;AAAA;AACf,OACA,CAAA;AAAA,IACF,CAAA,MAAO;AACN,MAAA,MAAA,GAAS,QAAA;AAAA,IACV;AAEA,IAAA,MAAM,WAAW,SAAA,CAAU,MAAA,CAAO,OAAO,CAAA,CAAE,UAAA,CAAW,UAAU,EAAE,CAAA;AAElE,IAAA,OAAO,OAAO,SAAA,CAAU,qBAAA,CAAsB,IAAA,CAAK,IAAA,EAAM,UAAU,cAAc,CAAA;AAAA,EAClF;AAEA,EAAA,OAAO,sBAAA;AACR;;;;"}
@@ -1,4 +1,4 @@
1
- import { s as codeFrameColumns, B as getEndLocation, G as getStartLocation } from './core.js';
1
+ import { a0 as codeFrameColumns, a1 as getEndLocation, a2 as getStartLocation } from './core.js';
2
2
  import { MessageChannel, Worker, receiveMessageOnPort } from 'node:worker_threads';
3
3
  import { l as legacyRequire } from './core-nodejs.js';
4
4
 
@@ -112,5 +112,5 @@ function createSyncFn(workerPath) {
112
112
  return syncFn;
113
113
  }
114
114
 
115
- export { createSyncFn as a, codeframe as c, diverge as d };
115
+ export { codeframe as a, createSyncFn as c, diverge as d };
116
116
  //# sourceMappingURL=vitest-utils.js.map
@@ -1,5 +1,5 @@
1
1
  import { workerData, parentPort } from 'node:worker_threads';
2
- import { F as FileSystemConfigLoader, H as HtmlValidate } from './core-nodejs.js';
2
+ import { a as FileSystemConfigLoader, H as HtmlValidate } from './core-nodejs.js';
3
3
  import 'node:fs';
4
4
  import './core.js';
5
5
  import 'ajv';
@@ -8,9 +8,9 @@ import './meta-helper.js';
8
8
  import './utils/natural-join.js';
9
9
  import './utils/parse-image-candidate-string.js';
10
10
  import '@sidvind/better-ajv-errors';
11
+ import 'semver';
11
12
  import 'kleur';
12
13
  import '@html-validate/stylish';
13
- import 'semver';
14
14
  import 'node:path';
15
15
  import 'node:fs/promises';
16
16
  import 'node:url';
@@ -8,9 +8,9 @@ import './meta-helper.js';
8
8
  import './utils/natural-join.js';
9
9
  import './utils/parse-image-candidate-string.js';
10
10
  import '@sidvind/better-ajv-errors';
11
+ import 'semver';
11
12
  import 'kleur';
12
13
  import '@html-validate/stylish';
13
- import 'semver';
14
14
  import 'node:worker_threads';
15
15
  import './core-nodejs.js';
16
16
  import 'node:fs';
@@ -344,7 +344,20 @@
344
344
  "title": "Exhaustive list of values (string or regex) this attribute accepts",
345
345
  "uniqueItems": true,
346
346
  "items": {
347
- "anyOf": [{ "type": "string" }, { "regexp": true }]
347
+ "anyOf": [
348
+ { "type": "string" },
349
+ { "regexp": true },
350
+ {
351
+ "type": "object",
352
+ "title": "Named regular expression",
353
+ "required": ["name", "pattern"],
354
+ "additionalProperties": false,
355
+ "properties": {
356
+ "name": { "type": "string", "minLength": 1 },
357
+ "pattern": { "anyOf": [{ "type": "string" }, { "regexp": true }] }
358
+ }
359
+ }
360
+ ]
348
361
  }
349
362
  },
350
363
  "omit": {
@@ -341,6 +341,10 @@ export declare abstract class ConfigLoader {
341
341
  *
342
342
  * If [[configOverride]] is set it is merged with the final result.
343
343
  *
344
+ * Do note that if `configOverride` is changed between calls the cache must be
345
+ * flushed in-between or the final results may vary. Loaders may cache the
346
+ * merged result.
347
+ *
344
348
  * @param handle - Unique handle to get configuration for.
345
349
  * @param configOverride - Optional configuration to merge final results with.
346
350
  */
@@ -744,6 +748,64 @@ export declare class EventHandler {
744
748
 
745
749
  /* Excluded from this release type: EventPerformanceEntry */
746
750
 
751
+ /**
752
+ * @public
753
+ * @since 11.5.0
754
+ */
755
+ export declare type FlatConfig = FlatConfigObject[];
756
+
757
+ /**
758
+ * A single object in a flat configuration file.
759
+ *
760
+ * @public
761
+ * @since 11.5.0
762
+ */
763
+ export declare interface FlatConfigObject {
764
+ /**
765
+ * Optional name of this configuration object.
766
+ *
767
+ * Used for troubleshooting and error messages.
768
+ */
769
+ name?: string;
770
+ /**
771
+ * An array of glob patterns indicating the files that the configuration
772
+ * object should apply to.
773
+ *
774
+ * If not specified, the configuration object applies to all files matched by
775
+ * any other configuration object.
776
+ */
777
+ files?: string[];
778
+ /**
779
+ * An array of glob patterns indicating the files that the configuration object should not apply to.
780
+ *
781
+ * If not specified, the configuration object applies to all files matches by `files`.
782
+ *
783
+ * If `ignores` is used without any other keys in the configuration object,
784
+ * then the patterns act as a global ignores and gets applied to every
785
+ * configuration object.
786
+ */
787
+ ignores?: string[];
788
+ /**
789
+ * Element metadata sources.
790
+ */
791
+ elements?: MetaDataTable[];
792
+ /**
793
+ * Plugins
794
+ */
795
+ plugins?: Plugin_2[];
796
+ /**
797
+ * Source file transformations.
798
+ *
799
+ * Maps a regular-expression pattern (matched against the filename) to a
800
+ * transformer function.
801
+ */
802
+ transform?: Record<string, Transformer_2>;
803
+ /**
804
+ * Rule configuration.
805
+ */
806
+ rules?: RuleConfig;
807
+ }
808
+
747
809
  /**
748
810
  * @public
749
811
  */
@@ -1462,10 +1524,19 @@ export declare interface MetaAttribute {
1462
1524
  */
1463
1525
  deprecated?: boolean | string;
1464
1526
  /**
1465
- * If set it is an exhaustive list of all possible values (as `string` or
1466
- * `RegExp`) this attribute can have (each token if list is set)
1527
+ * If set it is an exhaustive list of all possible values this attribute can
1528
+ * have (each token if list is set).
1529
+ *
1530
+ * Each entry can either be:
1531
+ *
1532
+ * - A keyword (as string).
1533
+ * - A regular expression.
1534
+ * - An object with `name` and `pattern` (regular expression).
1535
+ *
1536
+ * When using an object the name is presented in error messages and contextual
1537
+ * documentation.
1467
1538
  */
1468
- enum?: Array<string | RegExp>;
1539
+ enum?: Array<string | RegExp | MetaAttributeNamedRegex>;
1469
1540
  /**
1470
1541
  * If `true` this attribute contains space-separated tokens and each token must
1471
1542
  * be valid by itself.
@@ -1502,6 +1573,19 @@ export declare interface MetaAttribute {
1502
1573
  */
1503
1574
  export declare type MetaAttributeAllowedCallback = (node: HtmlElementLike, attr: string | DynamicValue | null | undefined) => string | null | undefined;
1504
1575
 
1576
+ /**
1577
+ * A named regular expression for use in attribute value validation.
1578
+ *
1579
+ * @public
1580
+ * @since 11.5.0
1581
+ */
1582
+ export declare interface MetaAttributeNamedRegex {
1583
+ /** Human-readable label shown in error documentation. */
1584
+ name: string;
1585
+ /** Regular expression used for validation. */
1586
+ pattern: RegExp | string;
1587
+ }
1588
+
1505
1589
  /**
1506
1590
  * Callback for the `required` property of `MetaAttribute`.
1507
1591
  *
@@ -2221,7 +2305,7 @@ export declare class ResolvedConfig {
2221
2305
  * Returns the (merged) configuration data used to create this resolved
2222
2306
  * configuration.
2223
2307
  */
2224
- getConfigData(): ConfigData;
2308
+ getConfigData(): ConfigData | FlatConfig;
2225
2309
  getMetaTable(): MetaTable;
2226
2310
  getPlugins(): Plugin_2[];
2227
2311
  getRules(): Map<string, [Severity, RuleOptions]>;