html-validate 8.20.1 → 8.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/browser.js +1 -0
- package/dist/cjs/browser.js.map +1 -1
- package/dist/cjs/cli.js.map +1 -1
- package/dist/cjs/core-nodejs.js.map +1 -1
- package/dist/cjs/core.js +2185 -2143
- package/dist/cjs/core.js.map +1 -1
- package/dist/cjs/elements.js +4 -6
- package/dist/cjs/elements.js.map +1 -1
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/jest-diff.js.map +1 -1
- package/dist/cjs/matcher-utils.js.map +1 -1
- package/dist/cjs/matchers.js.map +1 -1
- package/dist/cjs/tsdoc-metadata.json +1 -1
- package/dist/es/browser.js +1 -1
- package/dist/es/cli.js.map +1 -1
- package/dist/es/core-browser.js +1 -1
- package/dist/es/core-nodejs.js +1 -1
- package/dist/es/core-nodejs.js.map +1 -1
- package/dist/es/core.js +2185 -2144
- package/dist/es/core.js.map +1 -1
- package/dist/es/elements.js +4 -6
- package/dist/es/elements.js.map +1 -1
- package/dist/es/html-validate.js +1 -1
- package/dist/es/index.js +1 -1
- package/dist/es/jest-diff.js.map +1 -1
- package/dist/es/matcher-utils.js.map +1 -1
- package/dist/es/matchers-jestonly.js +1 -1
- package/dist/es/matchers.js.map +1 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/dist/types/browser.d.ts +44 -8
- package/dist/types/index.d.ts +44 -8
- package/package.json +20 -20
package/dist/es/html-validate.js
CHANGED
|
@@ -2,7 +2,7 @@ import fs from 'fs';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import kleur from 'kleur';
|
|
4
4
|
import minimist from 'minimist';
|
|
5
|
-
import {
|
|
5
|
+
import { L as name, v as version, o as SchemaValidationError, U as UserError, O as bugs } from './core.js';
|
|
6
6
|
import { M as Mode, m as modeToFlag, C as CLI, l as lint, i as init, p as printConfig, d as dump, h as handleSchemaValidationError } from './cli.js';
|
|
7
7
|
import 'ajv';
|
|
8
8
|
import './elements.js';
|
package/dist/es/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { F as FileSystemConfigLoader, c as cjsResolver, a as compatibilityCheck, n as nodejsResolver } from './core-nodejs.js';
|
|
2
|
-
export { A as Attribute, C as Config, a as ConfigError, b as ConfigLoader, D as DOMNode, h as DOMTokenList, j as DOMTree, k as DynamicValue,
|
|
2
|
+
export { A as Attribute, C as Config, a as ConfigError, b as ConfigLoader, D as DOMNode, h as DOMTokenList, j as DOMTree, k as DynamicValue, I as EventHandler, l as HtmlElement, H as HtmlValidate, M as MetaCopyableProperty, p as MetaTable, n as NestedError, N as NodeClosed, m as NodeType, E as Parser, z as Reporter, R as ResolvedConfig, r as Rule, o as SchemaValidationError, S as Severity, f as StaticConfigLoader, u as TextClassification, q as TextContent, T as TextNode, U as UserError, V as Validator, W as WrappedError, t as ariaNaming, w as classifyNodeText, P as configPresets, c as defineConfig, B as definePlugin, g as formatterFactory, x as keywordPatternMatcher, F as ruleExists, y as sliceLocation, s as staticResolver, v as version, G 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';
|
package/dist/es/jest-diff.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jest-diff.js","sources":["../../src/jest/utils/diff.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/ban-ts-comment
|
|
1
|
+
{"version":3,"file":"jest-diff.js","sources":["../../src/jest/utils/diff.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/ban-ts-comment, @typescript-eslint/no-unnecessary-condition --\n * this code needs to work with multiple different versions of jest and it does\n * verification of which one is actually present but the other variants will\n * cause errors, as is expected */\n\nimport jestDiffDefault, * as jestDiff from \"jest-diff\";\n\n/**\n * @internal\n */\nexport interface DiffOptions {\n\taAnnotation?: string;\n\tbAnnotation?: string;\n\texpand?: boolean;\n}\n\n/**\n * @internal\n */\nexport type DiffFunction = (a: any, b: any, options?: DiffOptions) => string | null;\n\n/* ignore typing for compatibility so it will seem \"impossible\" but different\n * version will yield different source */\n/* istanbul ignore next: this is covered by integration tests */\nconst diffCandidates: Array<DiffFunction | undefined> = [\n\t// @ts-ignore\n\tjestDiffDefault?.diff,\n\t// @ts-ignore\n\tjestDiffDefault,\n\t// @ts-ignore\n\tjestDiff?.diff,\n\t// @ts-ignore\n\tjestDiff,\n];\n\nconst isFunction = (fn: unknown): boolean => typeof fn === \"function\";\n\n/* eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- assume\n * one of the candidate matches, there will be a reasonable error later on if\n * not */\nexport const diff: DiffFunction = diffCandidates.find(isFunction)!;\n"],"names":["jestDiffDefault"],"mappings":";;;AAAA,IAAA,EAAA,CAAA;AAwBA,MAAM,cAAkD,GAAA;AAAA;AAAA,EAAA,CAEvD,EAAiB,GAAAA,iBAAA,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,IAAA;AAAA;AAAA,EAEjBA,iBAAA;AAAA;AAAA,EAEA,QAAU,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,QAAA,CAAA,IAAA;AAAA;AAAA,EAEV,QAAA;AACD,CAAA,CAAA;AAEA,MAAM,UAAa,GAAA,CAAC,EAAyB,KAAA,OAAO,EAAO,KAAA,UAAA,CAAA;AAK9C,MAAA,IAAA,GAAqB,cAAe,CAAA,IAAA,CAAK,UAAU;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"matcher-utils.js","sources":["../../src/jest/utils/is-thenable.ts","../../src/jest/utils/diverge.ts","../../src/jest/utils/flatten-messages.ts"],"sourcesContent":["/**\n * @internal\n */\nexport function isThenable<T>(value: T | Promise<T>): value is Promise<T> {\n\treturn value && typeof value === \"object\" && \"then\" in value && typeof value.then === \"function\";\n}\n","import { isThenable } from \"./is-thenable\";\nimport { type MatcherContext } from \"./matcher-context\";\nimport { type MatcherResult } from \"./matcher-result\";\n\ntype SyncCallback<T, TArgs extends any[]> = (\n\tthis: MatcherContext,\n\tactual: T,\n\t...args: TArgs\n) => MatcherResult;\n\n/**\n * @internal\n */\nexport interface MaybeAsyncCallback<TActual, TArgs extends any[]> {\n\t(this: MatcherContext, actual: TActual, ...args: TArgs): MatcherResult;\n\t(this: MatcherContext, actual: Promise<TActual>, ...args: TArgs): Promise<MatcherResult>;\n}\n\n/**\n * Creates a wrapped function based on the passed function.\n *\n * The returned function takes either a `T` or `Promise<T>`. If `T` the result\n * will be synchronous or if `Promise<T>` the result will be asynchronous.\n *\n * In practice this means that if you pass a synchronous object into it you will\n * maintain synchronous code but if you pass an asynchronous object you must\n * await the result.\n *\n * @internal\n */\nexport function diverge<T, TArgs extends any[]>(\n\tfn: SyncCallback<T, TArgs>,\n): MaybeAsyncCallback<T, TArgs> {\n\tfunction diverged(this: MatcherContext, actual: T, ...args: TArgs): MatcherResult;\n\tfunction diverged(\n\t\tthis: MatcherContext,\n\t\tactual: Promise<T>,\n\t\t...args: TArgs\n\t): Promise<MatcherResult>;\n\tfunction diverged(\n\t\tthis: MatcherContext,\n\t\tactual: T | Promise<T>,\n\t\t...args: TArgs\n\t): MatcherResult | Promise<MatcherResult> {\n\t\tif (isThenable(actual)) {\n\t\t\treturn actual.then((resolved) => fn.call(this, resolved, ...args));\n\t\t} else {\n\t\t\treturn fn.call(this, actual, ...args);\n\t\t}\n\t}\n\treturn diverged;\n}\n","import { type Message
|
|
1
|
+
{"version":3,"file":"matcher-utils.js","sources":["../../src/jest/utils/is-thenable.ts","../../src/jest/utils/diverge.ts","../../src/jest/utils/flatten-messages.ts"],"sourcesContent":["/**\n * @internal\n */\nexport function isThenable<T>(value: T | Promise<T>): value is Promise<T> {\n\treturn value && typeof value === \"object\" && \"then\" in value && typeof value.then === \"function\";\n}\n","import { isThenable } from \"./is-thenable\";\nimport { type MatcherContext } from \"./matcher-context\";\nimport { type MatcherResult } from \"./matcher-result\";\n\ntype SyncCallback<T, TArgs extends any[]> = (\n\tthis: MatcherContext,\n\tactual: T,\n\t...args: TArgs\n) => MatcherResult;\n\n/**\n * @internal\n */\nexport interface MaybeAsyncCallback<TActual, TArgs extends any[]> {\n\t(this: MatcherContext, actual: TActual, ...args: TArgs): MatcherResult;\n\t(this: MatcherContext, actual: Promise<TActual>, ...args: TArgs): Promise<MatcherResult>;\n}\n\n/**\n * Creates a wrapped function based on the passed function.\n *\n * The returned function takes either a `T` or `Promise<T>`. If `T` the result\n * will be synchronous or if `Promise<T>` the result will be asynchronous.\n *\n * In practice this means that if you pass a synchronous object into it you will\n * maintain synchronous code but if you pass an asynchronous object you must\n * await the result.\n *\n * @internal\n */\nexport function diverge<T, TArgs extends any[]>(\n\tfn: SyncCallback<T, TArgs>,\n): MaybeAsyncCallback<T, TArgs> {\n\tfunction diverged(this: MatcherContext, actual: T, ...args: TArgs): MatcherResult;\n\tfunction diverged(\n\t\tthis: MatcherContext,\n\t\tactual: Promise<T>,\n\t\t...args: TArgs\n\t): Promise<MatcherResult>;\n\tfunction diverged(\n\t\tthis: MatcherContext,\n\t\tactual: T | Promise<T>,\n\t\t...args: TArgs\n\t): MatcherResult | Promise<MatcherResult> {\n\t\tif (isThenable(actual)) {\n\t\t\treturn actual.then((resolved) => fn.call(this, resolved, ...args));\n\t\t} else {\n\t\t\treturn fn.call(this, actual, ...args);\n\t\t}\n\t}\n\treturn diverged;\n}\n","import { type Message } from \"../../message\";\nimport { type Report, type Result } from \"../../reporter\";\n\n/**\n * Takes all messages from all files and flattens to a single array.\n */\nexport function flattenMessages(report: Report): Message[] {\n\treturn report.results.reduce((aggregated: Message[], result: Result) => {\n\t\treturn aggregated.concat(result.messages);\n\t}, []);\n}\n"],"names":[],"mappings":"AAGO,SAAS,WAAc,KAA4C,EAAA;AACzE,EAAO,OAAA,KAAA,IAAS,OAAO,KAAU,KAAA,QAAA,IAAY,UAAU,KAAS,IAAA,OAAO,MAAM,IAAS,KAAA,UAAA,CAAA;AACvF;;ACyBO,SAAS,QACf,EAC+B,EAAA;AAO/B,EAAS,SAAA,QAAA,CAER,WACG,IACsC,EAAA;AACzC,IAAI,IAAA,UAAA,CAAW,MAAM,CAAG,EAAA;AACvB,MAAO,OAAA,MAAA,CAAO,IAAK,CAAA,CAAC,QAAa,KAAA,EAAA,CAAG,KAAK,IAAM,EAAA,QAAA,EAAU,GAAG,IAAI,CAAC,CAAA,CAAA;AAAA,KAC3D,MAAA;AACN,MAAA,OAAO,EAAG,CAAA,IAAA,CAAK,IAAM,EAAA,MAAA,EAAQ,GAAG,IAAI,CAAA,CAAA;AAAA,KACrC;AAAA,GACD;AACA,EAAO,OAAA,QAAA,CAAA;AACR;;AC7CO,SAAS,gBAAgB,MAA2B,EAAA;AAC1D,EAAA,OAAO,MAAO,CAAA,OAAA,CAAQ,MAAO,CAAA,CAAC,YAAuB,MAAmB,KAAA;AACvE,IAAO,OAAA,UAAA,CAAW,MAAO,CAAA,MAAA,CAAO,QAAQ,CAAA,CAAA;AAAA,GACzC,EAAG,EAAE,CAAA,CAAA;AACN;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import kleur from 'kleur';
|
|
2
2
|
import { toMatchSnapshot, toMatchInlineSnapshot } from 'jest-snapshot';
|
|
3
|
-
import {
|
|
3
|
+
import { K as codeframe } from './core.js';
|
|
4
4
|
import { g as getResults } from './matchers.js';
|
|
5
5
|
import { d as diverge, i as isThenable } from './matcher-utils.js';
|
|
6
6
|
|
package/dist/es/matchers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"matchers.js","sources":["../../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/get-results.ts"],"sourcesContent":["import { type Report } from \"../../reporter\";\nimport { type MatcherResult, type MaybeAsyncCallback, diverge } from \"../utils\";\n\nfunction createMatcher(): MaybeAsyncCallback<Report, []> {\n\tfunction toBeValid(report: Report): MatcherResult {\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 Report } from \"../../reporter\";\nimport { type MatcherResult, type MaybeAsyncCallback, diverge } from \"../utils\";\n\nfunction createMatcher(): MaybeAsyncCallback<Report, []> {\n\tfunction toBeInvalid(report: Report): MatcherResult {\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 deepmerge from \"deepmerge\";\nimport { type ConfigData } from \"../../config\";\nimport { FileSystemConfigLoader } from \"../../config/loaders/file-system\";\nimport { HtmlValidate } from \"../../htmlvalidate\";\nimport { type Message } from \"../../reporter\";\nimport {\n\ttype DiffFunction,\n\ttype MatcherContext,\n\ttype MatcherExpect,\n\ttype MatcherResult,\n\ttype MaybeAsyncCallback,\n\tdiverge,\n} from \"../utils\";\n\nfunction isMessage(arg: any): arg is Partial<Message> {\n\tif (!arg) {\n\t\treturn false;\n\t}\n\treturn Boolean(\n\t\targ.ruleId ||\n\t\t\targ.severity ||\n\t\t\targ.message ||\n\t\t\targ.offset ||\n\t\t\targ.line ||\n\t\t\targ.column ||\n\t\t\targ.size ||\n\t\t\targ.selector ||\n\t\t\targ.context,\n\t);\n}\n\nfunction isConfig(arg: any): arg is ConfigData {\n\tif (!arg) {\n\t\treturn false;\n\t}\n\treturn Boolean(\n\t\targ.root || arg.extends || arg.elements || arg.plugin || arg.transform || arg.rules,\n\t);\n}\n\nfunction isString(arg: any): 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 Error(`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(\n\texpect: MatcherExpect,\n\tdiff: DiffFunction | undefined,\n): MaybeAsyncCallback<unknown, [Arg1?, Arg2?, Arg3?]> {\n\tfunction toHTMLValidate(\n\t\tthis: MatcherContext,\n\t\tactual: unknown,\n\t\targ0?: Arg1,\n\t\targ1?: Arg2,\n\t\targ2?: Arg3,\n\t): MatcherResult {\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;\n\t\tconst filename = isString(arg0) ? arg0 : isString(arg1) ? arg1 : arg2;\n\t\treturn toHTMLValidateImpl.call(this, expect, diff, markup, message, config, filename);\n\t}\n\treturn diverge(toHTMLValidate);\n}\n\nfunction toHTMLValidateImpl(\n\tthis: MatcherContext,\n\texpect: MatcherExpect,\n\tdiff: DiffFunction | undefined,\n\tactual: string,\n\texpectedError?: Partial<Message>,\n\tuserConfig?: ConfigData,\n\tfilename?: string,\n): MatcherResult {\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\tconst loader = new FileSystemConfigLoader({\n\t\textends: [\"html-validate:recommended\"],\n\t});\n\tconst htmlvalidate = new HtmlValidate(loader);\n\tconst report = htmlvalidate.validateStringSync(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\tconst expected = expect.arrayContaining([expect.objectContaining(expectedError)]);\n\t\t\tconst errorPass = this.equals(actual, expected);\n\t\t\tconst diffString = diff\n\t\t\t\t? diff(expected, actual, {\n\t\t\t\t\t\texpand: this.expand,\n\t\t\t\t\t\taAnnotation: \"Expected error\",\n\t\t\t\t\t\tbAnnotation: \"Actual error\",\n\t\t\t\t\t})\n\t\t\t\t: /* istanbul ignore next */ undefined;\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\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 Message, type Report } from \"../../reporter\";\nimport {\n\ttype DiffFunction,\n\ttype MatcherContext,\n\ttype MatcherExpect,\n\ttype MatcherResult,\n\ttype MaybeAsyncCallback,\n\tdiverge,\n} from \"../utils\";\nimport { flattenMessages } from \"../utils/flatten-messages\";\n\nfunction toHaveErrorImpl(\n\tcontext: MatcherContext,\n\texpect: MatcherExpect,\n\tdiff: DiffFunction | undefined,\n\tactual: Report,\n\texpected: Partial<Message>,\n): MatcherResult {\n\tconst flattened = flattenMessages(actual);\n\tconst matcher = [expect.objectContaining(expected)];\n\tconst pass = context.equals(flattened, matcher);\n\tconst diffString = diff\n\t\t? diff(matcher, flattened, { expand: context.expand })\n\t\t: /* istanbul ignore next */ undefined;\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: MatcherExpect,\n\tdiff: DiffFunction | undefined,\n):\n\t| MaybeAsyncCallback<Report, [Partial<Message>]>\n\t| MaybeAsyncCallback<Report, [string, string, any?]> {\n\tfunction toHaveError(\n\t\tthis: MatcherContext,\n\t\tactual: Report,\n\t\terror: Partial<Message>,\n\t): MatcherResult;\n\tfunction toHaveError(\n\t\tthis: MatcherContext,\n\t\tactual: Report,\n\t\truleId: string,\n\t\tmessage: string,\n\t\tcontext?: any,\n\t): MatcherResult;\n\tfunction toHaveError(\n\t\tthis: MatcherContext,\n\t\tactual: Report,\n\t\targ1: string | Partial<Message>,\n\t\targ2?: string,\n\t\targ3?: any,\n\t): MatcherResult {\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) {\n\t\t\t\t/* eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- this is supposed to accept anything */\n\t\t\t\texpected.context = arg3;\n\t\t\t}\n\t\t\treturn toHaveErrorImpl(this, expect, diff, actual, expected);\n\t\t} else {\n\t\t\treturn toHaveErrorImpl(this, expect, diff, 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 Report } from \"../../reporter\";\nimport {\n\ttype DiffFunction,\n\ttype MatcherContext,\n\ttype MatcherExpect,\n\ttype MatcherResult,\n\ttype MaybeAsyncCallback,\n\tdiverge,\n\tflattenMessages,\n} from \"../utils\";\n\nfunction createMatcher(\n\texpect: MatcherExpect,\n\tdiff: DiffFunction | undefined,\n): MaybeAsyncCallback<Report, [Array<[string, string] | Record<string, unknown>>]> {\n\tfunction toHaveErrors(\n\t\tthis: MatcherContext,\n\t\treport: Report,\n\t\terrors: Array<[string, string] | Record<string, unknown>>,\n\t): MatcherResult {\n\t\tconst flattened = flattenMessages(report);\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\treturn expect.objectContaining({ ruleId, message });\n\t\t\t} else {\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 = diff\n\t\t\t? diff(matcher, flattened, { expand: this.expand })\n\t\t\t: /* istanbul ignore next */ undefined;\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 { FileSystemConfigLoader } from \"../../config/loaders/file-system\";\nimport { type Report, type Result } from \"../../reporter\";\nimport { HtmlValidate } from \"../../htmlvalidate\";\n\n/**\n * @internal\n */\nexport function getResults(filename: string, value: Report | string): Result[] {\n\tif (typeof value === \"string\") {\n\t\tconst loader = new FileSystemConfigLoader({\n\t\t\textends: [\"html-validate:recommended\"],\n\t\t});\n\t\tconst htmlvalidate = new HtmlValidate(loader);\n\t\tconst report = htmlvalidate.validateStringSync(value, filename, {\n\t\t\trules: {\n\t\t\t\t\"void-style\": \"off\",\n\t\t\t},\n\t\t});\n\t\treturn report.results.map((it) => {\n\t\t\treturn { ...it, filePath: \"inline\" };\n\t\t});\n\t} else {\n\t\treturn value.results;\n\t}\n}\n"],"names":["createMatcher","actual"],"mappings":";;;;AAGA,SAASA,eAAgD,GAAA;AACxD,EAAA,SAAS,UAAU,MAA+B,EAAA;AACjD,IAAA,IAAI,OAAO,KAAO,EAAA;AACjB,MAAO,OAAA;AAAA,QACN,IAAM,EAAA,IAAA;AAAA,QACN,OAAA;AAAA;AAAA,UAAoC,MAAM,iCAAA;AAAA,SAAA;AAAA,OAC3C,CAAA;AAAA,KACM,MAAA;AACN,MAAA,MAAM,aAAa,MAAO,CAAA,OAAA,CAAQ,CAAC,CAAA,CAAE,SAAS,CAAC,CAAA,CAAA;AAC/C,MAAO,OAAA;AAAA,QACN,IAAM,EAAA,KAAA;AAAA,QACN,OAAS,EAAA,MAAM,CAAyC,sCAAA,EAAA,UAA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CAAA,KAAA,CAAM,aAAc,CAAA,OAAO,CAAC,CAAA;AAAA;AAAA,EAAA,EAEjC,IAAK,CAAA,KAAA,CAAM,aAAc,CAAA,SAAS,CAAC,CAAA,CAAA;AAAA,KACZ,UAAa,GAAA,CAAA;AAAA;AAAA;AAAA;AAAA,EAAsB,UAAU,CAAK,CAAA,GAAA,EAAA,CAAA,CAAA;AAE/E,IAAO,OAAA,EAAE,IAAM,EAAA,OAAA,EAAS,aAAc,EAAA,CAAA;AAAA,GACvC;AACA,EAAA,OAAO,QAAQ,YAAY,CAAA,CAAA;AAC5B;;ACxCgB,SAAA,UAAA,CAAW,UAAkB,KAAkC,EAAA;AAC9E,EAAI,IAAA,OAAO,UAAU,QAAU,EAAA;AAC9B,IAAM,MAAA,MAAA,GAAS,IAAI,sBAAuB,CAAA;AAAA,MACzC,OAAA,EAAS,CAAC,2BAA2B,CAAA;AAAA,KACrC,CAAA,CAAA;AACD,IAAM,MAAA,YAAA,GAAe,IAAI,YAAA,CAAa,MAAM,CAAA,CAAA;AAC5C,IAAA,MAAM,MAAS,GAAA,YAAA,CAAa,kBAAmB,CAAA,KAAA,EAAO,QAAU,EAAA;AAAA,MAC/D,KAAO,EAAA;AAAA,QACN,YAAc,EAAA,KAAA;AAAA,OACf;AAAA,KACA,CAAA,CAAA;AACD,IAAA,OAAO,MAAO,CAAA,OAAA,CAAQ,GAAI,CAAA,CAAC,EAAO,KAAA;AACjC,MAAA,OAAO,EAAE,GAAG,EAAI,EAAA,QAAA,EAAU,QAAS,EAAA,CAAA;AAAA,KACnC,CAAA,CAAA;AAAA,GACK,MAAA;AACN,IAAA,OAAO,KAAM,CAAA,OAAA,CAAA;AAAA,GACd;AACD;;;;"}
|
|
1
|
+
{"version":3,"file":"matchers.js","sources":["../../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/get-results.ts"],"sourcesContent":["import { type Report } from \"../../reporter\";\nimport { type MatcherResult, type MaybeAsyncCallback, diverge } from \"../utils\";\n\nfunction createMatcher(): MaybeAsyncCallback<Report, []> {\n\tfunction toBeValid(report: Report): MatcherResult {\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 Report } from \"../../reporter\";\nimport { type MatcherResult, type MaybeAsyncCallback, diverge } from \"../utils\";\n\nfunction createMatcher(): MaybeAsyncCallback<Report, []> {\n\tfunction toBeInvalid(report: Report): MatcherResult {\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 deepmerge from \"deepmerge\";\nimport { type ConfigData } from \"../../config\";\nimport { FileSystemConfigLoader } from \"../../config/loaders/file-system\";\nimport { HtmlValidate } from \"../../htmlvalidate\";\nimport { type Message } from \"../../message\";\nimport {\n\ttype DiffFunction,\n\ttype MatcherContext,\n\ttype MatcherExpect,\n\ttype MatcherResult,\n\ttype MaybeAsyncCallback,\n\tdiverge,\n} from \"../utils\";\n\nfunction isMessage(arg: any): arg is Partial<Message> {\n\tif (!arg) {\n\t\treturn false;\n\t}\n\treturn Boolean(\n\t\targ.ruleId ||\n\t\t\targ.severity ||\n\t\t\targ.message ||\n\t\t\targ.offset ||\n\t\t\targ.line ||\n\t\t\targ.column ||\n\t\t\targ.size ||\n\t\t\targ.selector ||\n\t\t\targ.context,\n\t);\n}\n\nfunction isConfig(arg: any): arg is ConfigData {\n\tif (!arg) {\n\t\treturn false;\n\t}\n\treturn Boolean(\n\t\targ.root || arg.extends || arg.elements || arg.plugin || arg.transform || arg.rules,\n\t);\n}\n\nfunction isString(arg: any): 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 Error(`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(\n\texpect: MatcherExpect,\n\tdiff: DiffFunction | undefined,\n): MaybeAsyncCallback<unknown, [Arg1?, Arg2?, Arg3?]> {\n\tfunction toHTMLValidate(\n\t\tthis: MatcherContext,\n\t\tactual: unknown,\n\t\targ0?: Arg1,\n\t\targ1?: Arg2,\n\t\targ2?: Arg3,\n\t): MatcherResult {\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;\n\t\tconst filename = isString(arg0) ? arg0 : isString(arg1) ? arg1 : arg2;\n\t\treturn toHTMLValidateImpl.call(this, expect, diff, markup, message, config, filename);\n\t}\n\treturn diverge(toHTMLValidate);\n}\n\nfunction toHTMLValidateImpl(\n\tthis: MatcherContext,\n\texpect: MatcherExpect,\n\tdiff: DiffFunction | undefined,\n\tactual: string,\n\texpectedError?: Partial<Message>,\n\tuserConfig?: ConfigData,\n\tfilename?: string,\n): MatcherResult {\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\tconst loader = new FileSystemConfigLoader({\n\t\textends: [\"html-validate:recommended\"],\n\t});\n\tconst htmlvalidate = new HtmlValidate(loader);\n\tconst report = htmlvalidate.validateStringSync(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\tconst expected = expect.arrayContaining([expect.objectContaining(expectedError)]);\n\t\t\tconst errorPass = this.equals(actual, expected);\n\t\t\tconst diffString = diff\n\t\t\t\t? diff(expected, actual, {\n\t\t\t\t\t\texpand: this.expand,\n\t\t\t\t\t\taAnnotation: \"Expected error\",\n\t\t\t\t\t\tbAnnotation: \"Actual error\",\n\t\t\t\t\t})\n\t\t\t\t: /* istanbul ignore next */ undefined;\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\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 Message } from \"../../message\";\nimport { type Report } from \"../../reporter\";\nimport {\n\ttype DiffFunction,\n\ttype MatcherContext,\n\ttype MatcherExpect,\n\ttype MatcherResult,\n\ttype MaybeAsyncCallback,\n\tdiverge,\n} from \"../utils\";\nimport { flattenMessages } from \"../utils/flatten-messages\";\n\nfunction toHaveErrorImpl(\n\tcontext: MatcherContext,\n\texpect: MatcherExpect,\n\tdiff: DiffFunction | undefined,\n\tactual: Report,\n\texpected: Partial<Message>,\n): MatcherResult {\n\tconst flattened = flattenMessages(actual);\n\tconst matcher = [expect.objectContaining(expected)];\n\tconst pass = context.equals(flattened, matcher);\n\tconst diffString = diff\n\t\t? diff(matcher, flattened, { expand: context.expand })\n\t\t: /* istanbul ignore next */ undefined;\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: MatcherExpect,\n\tdiff: DiffFunction | undefined,\n):\n\t| MaybeAsyncCallback<Report, [Partial<Message>]>\n\t| MaybeAsyncCallback<Report, [string, string, any?]> {\n\tfunction toHaveError(\n\t\tthis: MatcherContext,\n\t\tactual: Report,\n\t\terror: Partial<Message>,\n\t): MatcherResult;\n\tfunction toHaveError(\n\t\tthis: MatcherContext,\n\t\tactual: Report,\n\t\truleId: string,\n\t\tmessage: string,\n\t\tcontext?: any,\n\t): MatcherResult;\n\tfunction toHaveError(\n\t\tthis: MatcherContext,\n\t\tactual: Report,\n\t\targ1: string | Partial<Message>,\n\t\targ2?: string,\n\t\targ3?: any,\n\t): MatcherResult {\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) {\n\t\t\t\t/* eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- this is supposed to accept anything */\n\t\t\t\texpected.context = arg3;\n\t\t\t}\n\t\t\treturn toHaveErrorImpl(this, expect, diff, actual, expected);\n\t\t} else {\n\t\t\treturn toHaveErrorImpl(this, expect, diff, 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 Report } from \"../../reporter\";\nimport {\n\ttype DiffFunction,\n\ttype MatcherContext,\n\ttype MatcherExpect,\n\ttype MatcherResult,\n\ttype MaybeAsyncCallback,\n\tdiverge,\n\tflattenMessages,\n} from \"../utils\";\n\nfunction createMatcher(\n\texpect: MatcherExpect,\n\tdiff: DiffFunction | undefined,\n): MaybeAsyncCallback<Report, [Array<[string, string] | Record<string, unknown>>]> {\n\tfunction toHaveErrors(\n\t\tthis: MatcherContext,\n\t\treport: Report,\n\t\terrors: Array<[string, string] | Record<string, unknown>>,\n\t): MatcherResult {\n\t\tconst flattened = flattenMessages(report);\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\treturn expect.objectContaining({ ruleId, message });\n\t\t\t} else {\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 = diff\n\t\t\t? diff(matcher, flattened, { expand: this.expand })\n\t\t\t: /* istanbul ignore next */ undefined;\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 { FileSystemConfigLoader } from \"../../config/loaders/file-system\";\nimport { type Report, type Result } from \"../../reporter\";\nimport { HtmlValidate } from \"../../htmlvalidate\";\n\n/**\n * @internal\n */\nexport function getResults(filename: string, value: Report | string): Result[] {\n\tif (typeof value === \"string\") {\n\t\tconst loader = new FileSystemConfigLoader({\n\t\t\textends: [\"html-validate:recommended\"],\n\t\t});\n\t\tconst htmlvalidate = new HtmlValidate(loader);\n\t\tconst report = htmlvalidate.validateStringSync(value, filename, {\n\t\t\trules: {\n\t\t\t\t\"void-style\": \"off\",\n\t\t\t},\n\t\t});\n\t\treturn report.results.map((it) => {\n\t\t\treturn { ...it, filePath: \"inline\" };\n\t\t});\n\t} else {\n\t\treturn value.results;\n\t}\n}\n"],"names":["createMatcher","actual"],"mappings":";;;;AAGA,SAASA,eAAgD,GAAA;AACxD,EAAA,SAAS,UAAU,MAA+B,EAAA;AACjD,IAAA,IAAI,OAAO,KAAO,EAAA;AACjB,MAAO,OAAA;AAAA,QACN,IAAM,EAAA,IAAA;AAAA,QACN,OAAA;AAAA;AAAA,UAAoC,MAAM,iCAAA;AAAA,SAAA;AAAA,OAC3C,CAAA;AAAA,KACM,MAAA;AACN,MAAA,MAAM,aAAa,MAAO,CAAA,OAAA,CAAQ,CAAC,CAAA,CAAE,SAAS,CAAC,CAAA,CAAA;AAC/C,MAAO,OAAA;AAAA,QACN,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enList }
|
|
|
636
636
|
export declare class DOMTree {
|
|
637
637
|
readonly root: HtmlElement;
|
|
638
638
|
private active;
|
|
639
|
+
private _readyState;
|
|
639
640
|
doctype: string | null;
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
641
|
+
/* Excluded from this release type: __constructor */
|
|
642
|
+
/* Excluded from this release type: pushActive */
|
|
643
|
+
/* Excluded from this release type: popActive */
|
|
644
|
+
/* Excluded from this release type: getActive */
|
|
644
645
|
/**
|
|
645
|
-
*
|
|
646
|
+
* Describes the loading state of the document.
|
|
647
|
+
*
|
|
648
|
+
* When `"loading"` it is still not safe to use functions such as
|
|
649
|
+
* `querySelector` or presence of attributes, child nodes, etc.
|
|
646
650
|
*/
|
|
647
|
-
|
|
651
|
+
get readyState(): "loading" | "complete";
|
|
652
|
+
/* Excluded from this release type: resolveMeta */
|
|
648
653
|
getElementsByTagName(tagName: string): HtmlElement[];
|
|
654
|
+
/**
|
|
655
|
+
* @deprecated use utility function `walk.depthFirst(..)` instead (since 8.21.0).
|
|
656
|
+
*/
|
|
649
657
|
visitDepthFirst(callback: (node: HtmlElement) => void): void;
|
|
658
|
+
/**
|
|
659
|
+
* @deprecated use `querySelector(..)` instead (since 8.21.0)
|
|
660
|
+
*/
|
|
650
661
|
find(callback: (node: HtmlElement) => boolean): HtmlElement | null;
|
|
651
662
|
querySelector(selector: string): HtmlElement | null;
|
|
652
663
|
querySelectorAll(selector: string): HtmlElement[];
|
|
@@ -940,7 +951,6 @@ export declare class HtmlElement extends DOMNode {
|
|
|
940
951
|
querySelector(selector: string): HtmlElement | null;
|
|
941
952
|
querySelectorAll(selector: string): HtmlElement[];
|
|
942
953
|
private querySelectorImpl;
|
|
943
|
-
/* Excluded from this release type: visitDepthFirst */
|
|
944
954
|
/* Excluded from this release type: someChildren */
|
|
945
955
|
/* Excluded from this release type: everyChildren */
|
|
946
956
|
/* Excluded from this release type: find */
|
|
@@ -1663,6 +1673,7 @@ export declare class MetaTable {
|
|
|
1663
1673
|
* @public
|
|
1664
1674
|
*/
|
|
1665
1675
|
getJSONSchema(): SchemaObject;
|
|
1676
|
+
/* Excluded from this release type: entries */
|
|
1666
1677
|
/**
|
|
1667
1678
|
* Finds the global element definition and merges each known element with the
|
|
1668
1679
|
* global, e.g. to assign global attributes.
|
|
@@ -2810,7 +2821,7 @@ export declare class Validator {
|
|
|
2810
2821
|
* @param rules - Element attribute metadta.
|
|
2811
2822
|
* @returns `true` if attribute passes all tests.
|
|
2812
2823
|
*/
|
|
2813
|
-
static validateAttribute(attr: Attribute, rules: Record<string, MetaAttribute>): boolean;
|
|
2824
|
+
static validateAttribute(attr: Attribute, rules: Record<string, MetaAttribute | undefined>): boolean;
|
|
2814
2825
|
private static validateAttributeValue;
|
|
2815
2826
|
private static validatePermittedRule;
|
|
2816
2827
|
/**
|
|
@@ -2831,6 +2842,31 @@ export declare class Validator {
|
|
|
2831
2842
|
/** @public */
|
|
2832
2843
|
export declare const version: string;
|
|
2833
2844
|
|
|
2845
|
+
/**
|
|
2846
|
+
* @public
|
|
2847
|
+
* @since 8.21.0
|
|
2848
|
+
*/
|
|
2849
|
+
export declare interface Walk {
|
|
2850
|
+
/**
|
|
2851
|
+
* Visits all nodes in the tree starting at node or document in a depth-first
|
|
2852
|
+
* (in-order) manner, i.e. any children will be visited before its parent.
|
|
2853
|
+
*
|
|
2854
|
+
* @public
|
|
2855
|
+
* @since 8.21.0
|
|
2856
|
+
* @param root - Element or document to visit nodes from.
|
|
2857
|
+
* @param callback - Callback executed for each node.
|
|
2858
|
+
*/
|
|
2859
|
+
depthFirst(this: void, root: HtmlElement | DOMTree, callback: (node: HtmlElement) => void): void;
|
|
2860
|
+
}
|
|
2861
|
+
|
|
2862
|
+
/**
|
|
2863
|
+
* Helper functions to walk the DOM tree.
|
|
2864
|
+
*
|
|
2865
|
+
* @public
|
|
2866
|
+
* @since 8.21.0
|
|
2867
|
+
*/
|
|
2868
|
+
export declare const walk: Walk;
|
|
2869
|
+
|
|
2834
2870
|
/**
|
|
2835
2871
|
* Event emitted when whitespace content is parsed.
|
|
2836
2872
|
*
|
package/dist/types/index.d.ts
CHANGED
|
@@ -732,17 +732,28 @@ export { DOMTokenList_2 as DOMTokenList }
|
|
|
732
732
|
export declare class DOMTree {
|
|
733
733
|
readonly root: HtmlElement;
|
|
734
734
|
private active;
|
|
735
|
+
private _readyState;
|
|
735
736
|
doctype: string | null;
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
737
|
+
/* Excluded from this release type: __constructor */
|
|
738
|
+
/* Excluded from this release type: pushActive */
|
|
739
|
+
/* Excluded from this release type: popActive */
|
|
740
|
+
/* Excluded from this release type: getActive */
|
|
740
741
|
/**
|
|
741
|
-
*
|
|
742
|
+
* Describes the loading state of the document.
|
|
743
|
+
*
|
|
744
|
+
* When `"loading"` it is still not safe to use functions such as
|
|
745
|
+
* `querySelector` or presence of attributes, child nodes, etc.
|
|
742
746
|
*/
|
|
743
|
-
|
|
747
|
+
get readyState(): "loading" | "complete";
|
|
748
|
+
/* Excluded from this release type: resolveMeta */
|
|
744
749
|
getElementsByTagName(tagName: string): HtmlElement[];
|
|
750
|
+
/**
|
|
751
|
+
* @deprecated use utility function `walk.depthFirst(..)` instead (since 8.21.0).
|
|
752
|
+
*/
|
|
745
753
|
visitDepthFirst(callback: (node: HtmlElement) => void): void;
|
|
754
|
+
/**
|
|
755
|
+
* @deprecated use `querySelector(..)` instead (since 8.21.0)
|
|
756
|
+
*/
|
|
746
757
|
find(callback: (node: HtmlElement) => boolean): HtmlElement | null;
|
|
747
758
|
querySelector(selector: string): HtmlElement | null;
|
|
748
759
|
querySelectorAll(selector: string): HtmlElement[];
|
|
@@ -1158,7 +1169,6 @@ export declare class HtmlElement extends DOMNode {
|
|
|
1158
1169
|
querySelector(selector: string): HtmlElement | null;
|
|
1159
1170
|
querySelectorAll(selector: string): HtmlElement[];
|
|
1160
1171
|
private querySelectorImpl;
|
|
1161
|
-
/* Excluded from this release type: visitDepthFirst */
|
|
1162
1172
|
/* Excluded from this release type: someChildren */
|
|
1163
1173
|
/* Excluded from this release type: everyChildren */
|
|
1164
1174
|
/* Excluded from this release type: find */
|
|
@@ -1888,6 +1898,7 @@ export declare class MetaTable {
|
|
|
1888
1898
|
* @public
|
|
1889
1899
|
*/
|
|
1890
1900
|
getJSONSchema(): SchemaObject;
|
|
1901
|
+
/* Excluded from this release type: entries */
|
|
1891
1902
|
/**
|
|
1892
1903
|
* Finds the global element definition and merges each known element with the
|
|
1893
1904
|
* global, e.g. to assign global attributes.
|
|
@@ -3060,7 +3071,7 @@ export declare class Validator {
|
|
|
3060
3071
|
* @param rules - Element attribute metadta.
|
|
3061
3072
|
* @returns `true` if attribute passes all tests.
|
|
3062
3073
|
*/
|
|
3063
|
-
static validateAttribute(attr: Attribute, rules: Record<string, MetaAttribute>): boolean;
|
|
3074
|
+
static validateAttribute(attr: Attribute, rules: Record<string, MetaAttribute | undefined>): boolean;
|
|
3064
3075
|
private static validateAttributeValue;
|
|
3065
3076
|
private static validatePermittedRule;
|
|
3066
3077
|
/**
|
|
@@ -3081,6 +3092,31 @@ export declare class Validator {
|
|
|
3081
3092
|
/** @public */
|
|
3082
3093
|
export declare const version: string;
|
|
3083
3094
|
|
|
3095
|
+
/**
|
|
3096
|
+
* @public
|
|
3097
|
+
* @since 8.21.0
|
|
3098
|
+
*/
|
|
3099
|
+
export declare interface Walk {
|
|
3100
|
+
/**
|
|
3101
|
+
* Visits all nodes in the tree starting at node or document in a depth-first
|
|
3102
|
+
* (in-order) manner, i.e. any children will be visited before its parent.
|
|
3103
|
+
*
|
|
3104
|
+
* @public
|
|
3105
|
+
* @since 8.21.0
|
|
3106
|
+
* @param root - Element or document to visit nodes from.
|
|
3107
|
+
* @param callback - Callback executed for each node.
|
|
3108
|
+
*/
|
|
3109
|
+
depthFirst(this: void, root: HtmlElement | DOMTree, callback: (node: HtmlElement) => void): void;
|
|
3110
|
+
}
|
|
3111
|
+
|
|
3112
|
+
/**
|
|
3113
|
+
* Helper functions to walk the DOM tree.
|
|
3114
|
+
*
|
|
3115
|
+
* @public
|
|
3116
|
+
* @since 8.21.0
|
|
3117
|
+
*/
|
|
3118
|
+
export declare const walk: Walk;
|
|
3119
|
+
|
|
3084
3120
|
/**
|
|
3085
3121
|
* Event emitted when whitespace content is parsed.
|
|
3086
3122
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "html-validate",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.21.0",
|
|
4
4
|
"description": "Offline html5 validator",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"html",
|
|
@@ -208,15 +208,15 @@
|
|
|
208
208
|
},
|
|
209
209
|
"devDependencies": {
|
|
210
210
|
"@html-validate/commitlint-config": "3.2.5",
|
|
211
|
-
"@html-validate/eslint-config": "5.
|
|
212
|
-
"@html-validate/eslint-config-jest": "5.
|
|
213
|
-
"@html-validate/eslint-config-typescript": "5.
|
|
214
|
-
"@html-validate/eslint-config-typescript-typeinfo": "5.
|
|
211
|
+
"@html-validate/eslint-config": "5.21.2",
|
|
212
|
+
"@html-validate/eslint-config-jest": "5.21.0",
|
|
213
|
+
"@html-validate/eslint-config-typescript": "5.21.3",
|
|
214
|
+
"@html-validate/eslint-config-typescript-typeinfo": "5.21.3",
|
|
215
215
|
"@html-validate/jest-config": "3.10.0",
|
|
216
|
-
"@html-validate/prettier-config": "2.
|
|
217
|
-
"@html-validate/release-scripts": "6.
|
|
218
|
-
"@microsoft/api-extractor": "7.47.
|
|
219
|
-
"@rollup/plugin-commonjs": "
|
|
216
|
+
"@html-validate/prettier-config": "2.5.0",
|
|
217
|
+
"@html-validate/release-scripts": "6.5.3",
|
|
218
|
+
"@microsoft/api-extractor": "7.47.2",
|
|
219
|
+
"@rollup/plugin-commonjs": "26.0.1",
|
|
220
220
|
"@rollup/plugin-json": "6.1.0",
|
|
221
221
|
"@rollup/plugin-node-resolve": "15.2.3",
|
|
222
222
|
"@rollup/plugin-replace": "5.0.7",
|
|
@@ -225,27 +225,27 @@
|
|
|
225
225
|
"@types/babel__code-frame": "7.0.6",
|
|
226
226
|
"@types/jest": "29.5.12",
|
|
227
227
|
"@types/minimist": "1.2.5",
|
|
228
|
-
"@types/node": "16.18.
|
|
228
|
+
"@types/node": "16.18.103",
|
|
229
229
|
"@types/prompts": "2.4.9",
|
|
230
230
|
"@types/semver": "7.5.8",
|
|
231
231
|
"@types/stream-buffers": "3.0.7",
|
|
232
232
|
"babar": "0.2.3",
|
|
233
|
-
"husky": "9.
|
|
233
|
+
"husky": "9.1.1",
|
|
234
234
|
"is-ci": "3.0.1",
|
|
235
235
|
"jest": "29.7.0",
|
|
236
236
|
"jest-diff": "29.7.0",
|
|
237
237
|
"jest-environment-jsdom": "29.7.0",
|
|
238
238
|
"jest-snapshot": "29.7.0",
|
|
239
239
|
"jsdom": "20.0.3",
|
|
240
|
-
"marked": "
|
|
241
|
-
"memfs": "4.9.
|
|
242
|
-
"npm-pkg-lint": "3.6.
|
|
243
|
-
"npm-run-all2": "6.2.
|
|
244
|
-
"rollup": "4.18.
|
|
240
|
+
"marked": "13.0.2",
|
|
241
|
+
"memfs": "4.9.3",
|
|
242
|
+
"npm-pkg-lint": "3.6.5",
|
|
243
|
+
"npm-run-all2": "6.2.2",
|
|
244
|
+
"rollup": "4.18.1",
|
|
245
245
|
"rollup-plugin-esbuild": "6.1.1",
|
|
246
|
-
"stream-buffers": "3.0.
|
|
247
|
-
"ts-jest": "29.
|
|
248
|
-
"typescript": "5.
|
|
246
|
+
"stream-buffers": "3.0.3",
|
|
247
|
+
"ts-jest": "29.2.3",
|
|
248
|
+
"typescript": "5.5.3",
|
|
249
249
|
"vite": "4.5.3"
|
|
250
250
|
},
|
|
251
251
|
"peerDependencies": {
|
|
@@ -283,6 +283,6 @@
|
|
|
283
283
|
"semver"
|
|
284
284
|
],
|
|
285
285
|
"overrides": {
|
|
286
|
-
"marked": "
|
|
286
|
+
"marked": "13.0.2"
|
|
287
287
|
}
|
|
288
288
|
}
|