html-validate 9.7.1 → 10.1.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/README.md +2 -2
- package/bin/html-validate.mjs +1 -1
- package/dist/cjs/cli.js +2 -2
- package/dist/cjs/cli.js.map +1 -1
- package/dist/cjs/core-browser.js.map +1 -1
- package/dist/cjs/core-nodejs.js.map +1 -1
- package/dist/cjs/core.js +40 -12
- package/dist/cjs/core.js.map +1 -1
- package/dist/cjs/elements.js.map +1 -1
- package/dist/cjs/html-validate.js +3 -3
- package/dist/cjs/html-validate.js.map +1 -1
- package/dist/cjs/jest-worker.js.map +1 -1
- package/dist/cjs/matcher-utils.js.map +1 -1
- package/dist/cjs/matchers-jestonly.js.map +1 -1
- package/dist/cjs/matchers.js.map +1 -1
- package/dist/cjs/meta-helper.js.map +1 -1
- package/dist/cjs/tsdoc-metadata.json +1 -1
- package/dist/{es → esm}/cli.js +2 -2
- package/dist/esm/cli.js.map +1 -0
- package/dist/{es → esm}/core-browser.js.map +1 -1
- package/dist/{es → esm}/core-nodejs.js.map +1 -1
- package/dist/{es → esm}/core.js +40 -12
- package/dist/esm/core.js.map +1 -0
- package/dist/{es → esm}/elements.js.map +1 -1
- package/dist/{es → esm}/html-validate.js +3 -3
- package/dist/esm/html-validate.js.map +1 -0
- package/dist/{es → esm}/jest-worker.js.map +1 -1
- package/dist/{es → esm}/matcher-utils.js.map +1 -1
- package/dist/{es → esm}/matchers-jestonly.js.map +1 -1
- package/dist/{es → esm}/matchers.js.map +1 -1
- package/dist/{es → esm}/meta-helper.js.map +1 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/package.json +20 -27
- package/browser.d.ts +0 -1
- package/browser.js +0 -1
- package/dist/es/cli.js.map +0 -1
- package/dist/es/core.js.map +0 -1
- package/dist/es/html-validate.js.map +0 -1
- package/elements/html5.js +0 -1
- package/jest.d.ts +0 -1
- package/jest.js +0 -1
- package/node.d.ts +0 -1
- package/node.js +0 -1
- package/test-utils.d.ts +0 -1
- package/test-utils.js +0 -1
- /package/dist/{es → esm}/browser.d.ts +0 -0
- /package/dist/{es → esm}/browser.js +0 -0
- /package/dist/{es → esm}/browser.js.map +0 -0
- /package/dist/{es → esm}/core-browser.js +0 -0
- /package/dist/{es → esm}/core-nodejs.js +0 -0
- /package/dist/{es → esm}/elements.js +0 -0
- /package/dist/{es → esm}/html-validate.d.ts +0 -0
- /package/dist/{es → esm}/html5.d.ts +0 -0
- /package/dist/{es → esm}/html5.js +0 -0
- /package/dist/{es → esm}/html5.js.map +0 -0
- /package/dist/{es → esm}/index.d.ts +0 -0
- /package/dist/{es → esm}/index.js +0 -0
- /package/dist/{es → esm}/index.js.map +0 -0
- /package/dist/{es → esm}/jest-diff.js +0 -0
- /package/dist/{es → esm}/jest-diff.js.map +0 -0
- /package/dist/{es → esm}/jest-worker.d.ts +0 -0
- /package/dist/{es → esm}/jest-worker.js +0 -0
- /package/dist/{es → esm}/jest.d.ts +0 -0
- /package/dist/{es → esm}/jest.js +0 -0
- /package/dist/{es → esm}/jest.js.map +0 -0
- /package/dist/{es → esm}/matcher-utils.js +0 -0
- /package/dist/{es → esm}/matchers-jestonly.js +0 -0
- /package/dist/{es → esm}/matchers.js +0 -0
- /package/dist/{es → esm}/meta-helper.js +0 -0
- /package/dist/{es → esm}/package.json +0 -0
- /package/dist/{es → esm}/test-utils.d.ts +0 -0
- /package/dist/{es → esm}/test-utils.js +0 -0
- /package/dist/{es → esm}/test-utils.js.map +0 -0
- /package/dist/{es → esm}/utils/natural-join.js +0 -0
- /package/dist/{es → esm}/utils/natural-join.js.map +0 -0
- /package/dist/{es → esm}/vitest.d.ts +0 -0
- /package/dist/{es → esm}/vitest.js +0 -0
- /package/dist/{es → esm}/vitest.js.map +0 -0
- /package/{elements → dist/types}/html5.d.ts +0 -0
|
@@ -199,8 +199,8 @@ if (argv._.length === 0) {
|
|
|
199
199
|
if (typeof argv.config !== "undefined") {
|
|
200
200
|
const checkPath = path.resolve(argv.config);
|
|
201
201
|
if (!fs.existsSync(checkPath)) {
|
|
202
|
-
console.
|
|
203
|
-
console.
|
|
202
|
+
console.error(`The file "${argv.config}" was not found.`);
|
|
203
|
+
console.error(`The location this file was checked for at was: "${checkPath}"`);
|
|
204
204
|
process.exit(1);
|
|
205
205
|
}
|
|
206
206
|
}
|
|
@@ -215,7 +215,7 @@ async function run() {
|
|
|
215
215
|
const maxWarnings = parseInt(argv["max-warnings"] ?? "-1", 10);
|
|
216
216
|
const htmlvalidate = await cli.getValidator();
|
|
217
217
|
if (isNaN(maxWarnings)) {
|
|
218
|
-
console.
|
|
218
|
+
console.error(`Invalid value "${String(argv["max-warnings"])}" given to --max-warnings`);
|
|
219
219
|
process.exit(1);
|
|
220
220
|
}
|
|
221
221
|
const extensions = argv.ext.split(",").map((cur) => {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html-validate.js","sources":["../../src/cli/html-validate.ts"],"sourcesContent":["/* eslint-disable no-console, n/no-process-exit -- as expected from a cli app */\nimport fs from \"fs\";\nimport path from \"node:path\";\nimport kleur from \"kleur\";\nimport minimist from \"minimist\";\nimport { type UserErrorData, SchemaValidationError, isUserError } from \"..\";\nimport { name, version, bugs as pkgBugs } from \"../generated/package\";\nimport { CLI } from \"./cli\";\nimport { handleSchemaValidationError, ImportResolveMissingError } from \"./errors\";\nimport { Mode, modeToFlag } from \"./mode\";\nimport { lint } from \"./actions/lint\";\nimport { init } from \"./actions/init\";\nimport { printConfig } from \"./actions/print-config\";\nimport { dump } from \"./actions/dump\";\nimport { haveImportMetaResolve } from \"./have-import-meta-resolve\";\n\ninterface ParsedArgs {\n\tconfig?: string;\n\t\"dump-events\": boolean;\n\t\"dump-source\": boolean;\n\t\"dump-tokens\": boolean;\n\t\"dump-tree\": boolean;\n\text: string;\n\tformatter: string;\n\thelp: boolean;\n\tinit: boolean;\n\t\"max-warnings\"?: string;\n\tpreset?: string;\n\t\"print-config\": boolean;\n\trule?: string;\n\tstdin: boolean;\n\t\"stdin-filename\"?: string;\n\tversion: boolean;\n}\n\nfunction getMode(argv: Record<string, any>): Mode {\n\tif (argv.init) {\n\t\treturn Mode.INIT;\n\t}\n\n\tif (argv[\"dump-events\"]) {\n\t\treturn Mode.DUMP_EVENTS;\n\t}\n\n\tif (argv[\"dump-source\"]) {\n\t\treturn Mode.DUMP_SOURCE;\n\t}\n\n\tif (argv[\"dump-tokens\"]) {\n\t\treturn Mode.DUMP_TOKENS;\n\t}\n\n\tif (argv[\"dump-tree\"]) {\n\t\treturn Mode.DUMP_TREE;\n\t}\n\n\tif (argv[\"print-config\"]) {\n\t\treturn Mode.PRINT_CONFIG;\n\t}\n\n\treturn Mode.LINT;\n}\n\nfunction requiresFilename(mode: Mode): boolean {\n\tswitch (mode) {\n\t\tcase Mode.LINT:\n\t\t\treturn true;\n\t\tcase Mode.INIT:\n\t\t\treturn false;\n\t\tcase Mode.DUMP_EVENTS:\n\t\tcase Mode.DUMP_TOKENS:\n\t\tcase Mode.DUMP_TREE:\n\t\tcase Mode.DUMP_SOURCE:\n\t\tcase Mode.PRINT_CONFIG:\n\t\t\treturn true;\n\t}\n}\n\nfunction handleUserError(err: UserErrorData): void {\n\tconst formatted = err.prettyFormat();\n\tif (formatted) {\n\t\tconsole.error(); /* blank line */\n\t\tconsole.error(formatted);\n\t\treturn;\n\t}\n\n\tconsole.error(kleur.red(\"Caught exception:\"));\n\tconsole.group();\n\t{\n\t\tconsole.error(err.prettyFormat() ?? err);\n\t}\n\tconsole.groupEnd();\n}\n\nfunction handleUnknownError(err: unknown): void {\n\tconsole.error(kleur.red(\"Caught exception:\"));\n\tconsole.group();\n\t{\n\t\tconsole.error(err);\n\t}\n\tconsole.groupEnd();\n\tconst bugUrl = `${pkgBugs}?issuable_template=Bug`;\n\tconsole.error(kleur.red(`This is a bug in ${name}-${version}.`));\n\tconsole.error(\n\t\tkleur.red(\n\t\t\t[\n\t\t\t\t`Please file a bug at ${bugUrl}`,\n\t\t\t\t`and include this message in full and if possible the content of the`,\n\t\t\t\t`file being parsed (or a reduced testcase).`,\n\t\t\t].join(\"\\n\"),\n\t\t),\n\t);\n}\n\nconst argv = minimist<ParsedArgs>(process.argv.slice(2), {\n\tstring: [\n\t\t\"c\",\n\t\t\"config\",\n\t\t\"ext\",\n\t\t\"f\",\n\t\t\"formatter\",\n\t\t\"max-warnings\",\n\t\t\"p\",\n\t\t\"preset\",\n\t\t\"rule\",\n\t\t\"stdin-filename\",\n\t],\n\tboolean: [\n\t\t\"init\",\n\t\t\"dump-events\",\n\t\t\"dump-source\",\n\t\t\"dump-tokens\",\n\t\t\"dump-tree\",\n\t\t\"h\",\n\t\t\"help\",\n\t\t\"print-config\",\n\t\t\"stdin\",\n\t\t\"version\",\n\t],\n\talias: {\n\t\tc: \"config\",\n\t\tf: \"formatter\",\n\t\tp: \"preset\",\n\t\th: \"help\",\n\t},\n\tdefault: {\n\t\text: \"html\",\n\t\tformatter: \"stylish\",\n\t},\n\tunknown: (opt: string) => {\n\t\tif (opt.startsWith(\"-\")) {\n\t\t\tprocess.stderr.write(`unknown option ${opt}\\n`);\n\t\t\tprocess.exit(1);\n\t\t}\n\t\treturn true;\n\t},\n});\n\nfunction showUsage(): void {\n\tprocess.stdout.write(`${name}-${version}\nUsage: html-validate [OPTIONS] [FILENAME..] [DIR..]\n\nCommon options:\n --ext=STRING specify file extensions (commaseparated).\n -f, --formatter=FORMATTER specify the formatter to use.\n --max-warnings=INT number of warnings to trigger nonzero exit code\n -p, --preset=STRING configuration preset to use, use\n comma-separator for multiple presets. (default:\n \"recommended\")\n --rule=RULE:SEVERITY set additional rule, use comma separator for\n multiple.\n --stdin process markup from stdin.\n --stdin-filename=STRING specify filename to report when using stdin\n\nMiscellaneous:\n -c, --config=STRING use custom configuration file.\n --init initialize project with a new configuration\n --print-config output configuration for given file.\n -h, --help show help.\n --version show version.\n\nDebugging options:\n --dump-events output events during parsing.\n --dump-source output post-transformed source data.\n --dump-tokens output tokens from lexing stage.\n --dump-tree output nodes from the dom tree.\n\nFormatters:\n\nMultiple formatters can be specified with a comma-separated list,\ne.g. \"json,checkstyle\" to enable both.\n\nTo capture output to a file use \"formatter=/path/to/file\",\ne.g. \"checkstyle=dist/html-validate.xml\"\n`);\n}\n\nfunction showVersion(): void {\n\tprocess.stdout.write(`${name}-${version}\\n`);\n}\n\nif (argv.stdin) {\n\targv._.push(\"-\");\n}\n\nif (argv.version) {\n\tshowVersion();\n\tprocess.exit();\n}\n\nif (argv.help) {\n\tshowUsage();\n\tprocess.exit();\n}\n\nif (argv._.length === 0) {\n\tconst mode = getMode(argv);\n\tif (mode === Mode.LINT) {\n\t\tshowUsage();\n\t\tprocess.exit(0);\n\t} else if (requiresFilename(mode)) {\n\t\tconst flag = modeToFlag(mode);\n\t\tconsole.error(`\\`${flag}\\` requires a filename.`);\n\t\tprocess.exit(1);\n\t}\n}\n\n/* check that supplied config file exists before creating CLI */\nif (typeof argv.config !== \"undefined\") {\n\tconst checkPath = path.resolve(argv.config);\n\tif (!fs.existsSync(checkPath)) {\n\t\tconsole.error(`The file \"${argv.config}\" was not found.`);\n\t\tconsole.error(`The location this file was checked for at was: \"${checkPath}\"`);\n\t\tprocess.exit(1);\n\t}\n}\n\n/* eslint-disable-next-line complexity -- for now */\nasync function run(): Promise<void> {\n\tconst cli = new CLI({\n\t\tconfigFile: argv.config,\n\t\tpreset: argv.preset,\n\t\trules: argv.rule,\n\t});\n\tconst mode = getMode(argv);\n\tconst formatter = await cli.getFormatter(argv.formatter);\n\tconst maxWarnings = parseInt(argv[\"max-warnings\"] ?? \"-1\", 10);\n\tconst htmlvalidate = await cli.getValidator();\n\n\t/* sanity check: ensure maxWarnings has a valid value */\n\tif (isNaN(maxWarnings)) {\n\t\tconsole.error(`Invalid value \"${String(argv[\"max-warnings\"])}\" given to --max-warnings`);\n\t\tprocess.exit(1);\n\t}\n\n\t/* parse extensions (used when expanding directories) */\n\tconst extensions = argv.ext.split(\",\").map((cur: string) => {\n\t\treturn cur.startsWith(\".\") ? cur.slice(1) : cur;\n\t});\n\n\tconst files = await cli.expandFiles(argv._, { extensions });\n\tif (files.length === 0 && mode !== Mode.INIT) {\n\t\tconsole.error(\"No files matching patterns\", argv._);\n\t\tprocess.exit(1);\n\t}\n\n\ttry {\n\t\t/* istanbul ignore next -- not tested with unittests */\n\t\tif (!haveImportMetaResolve()) {\n\t\t\tthrow new ImportResolveMissingError();\n\t\t}\n\n\t\tlet success: boolean;\n\t\tif (mode === Mode.LINT) {\n\t\t\tsuccess = await lint(htmlvalidate, process.stdout, files, {\n\t\t\t\tformatter,\n\t\t\t\tmaxWarnings,\n\t\t\t\tstdinFilename: argv[\"stdin-filename\"] ?? false,\n\t\t\t});\n\t\t} else if (mode === Mode.INIT) {\n\t\t\tsuccess = await init(cli, process.stdout, { cwd: process.cwd() });\n\t\t} else if (mode === Mode.PRINT_CONFIG) {\n\t\t\tsuccess = await printConfig(htmlvalidate, process.stdout, files);\n\t\t} else {\n\t\t\tsuccess = await dump(htmlvalidate, process.stdout, files, mode);\n\t\t}\n\t\tprocess.exit(success ? 0 : 1);\n\t} catch (err) {\n\t\tif (err instanceof SchemaValidationError) {\n\t\t\thandleSchemaValidationError(console, err);\n\t\t} else if (isUserError(err)) {\n\t\t\thandleUserError(err);\n\t\t} else {\n\t\t\thandleUnknownError(err);\n\t\t}\n\t\tprocess.exit(1);\n\t}\n}\n\nrun().catch((err: unknown) => {\n\tconsole.error(err);\n\tprocess.exit(1);\n});\n"],"names":["argv","pkgBugs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAmCA,SAAS,QAAQA,KAAAA,EAAiC;AACjD,EAAA,IAAIA,MAAK,IAAA,EAAM;AACd,IAAA,OAAO,IAAA,CAAK,IAAA;AAAA,EACb;AAEA,EAAA,IAAIA,KAAAA,CAAK,aAAa,CAAA,EAAG;AACxB,IAAA,OAAO,IAAA,CAAK,WAAA;AAAA,EACb;AAEA,EAAA,IAAIA,KAAAA,CAAK,aAAa,CAAA,EA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,CAAA;AAAA,IACF,CAAA,MAAA,IAAW,IAAA,KAAS,IAAA,CAAK,IAAA,EAAM;AAC9B,MAAA,OAAA,GAAU,MAAM,IAAA,CAAK,GAAA,EAAK,OAAA,CAAQ,MAAA,EAAQ,EAAE,GAAA,EAAK,OAAA,CAAQ,GAAA,EAAI,EAAG,CAAA;AAAA,IACjE,CAAA,MAAA,IAAW,IAAA,KAAS,IAAA,CAAK,YAAA,EAAc;AACtC,MAAA,OAAA,GAAU,MAAM,WAAA,CAAY,YAAA,EAAc,OAAA,CAAQ,QAAQ,KAAK,CAAA;AAAA,IAChE,CAAA,MAAO;AACN,MAAA,OAAA,GAAU,MAAM,IAAA,CAAK,YAAA,EAAc,OAAA,CAAQ,MAAA,EAAQ,OAAO,IAAI,CAAA;AAAA,IAC/D;AACA,IAAA,OAAA,CAAQ,IAAA,CAAK,OAAA,GAAU,CAAA,GAAI,CAAC,CAAA;AAAA,EAC7B,SAAS,GAAA,EAAK;AACb,IAAA,IAAI,eAAe,qBAAA,EAAuB;AACzC,MAAA,2BAAA,CAA4B,SAAS,GAAG,CAAA;AAAA,IACzC,CAAA,MAAA,IAAW,WAAA,CAAY,GAAG,CAAA,EAAG;AAC5B,MAAA,eAAA,CAAgB,GAAG,CAAA;AAAA,IACpB,CAAA,MAAO;AACN,MAAA,kBAAA,CAAmB,GAAG,CAAA;AAAA,IACvB;AACA,IAAA,OAAA,CAAQ,KAAK,CAAC,CAAA;AAAA,EACf;AACD;AAEA,GAAA,EAAI,CAAE,KAAA,CAAM,CAAC,GAAA,KAAiB;AAC7B,EAAA,OAAA,CAAQ,MAAM,GAAG,CAAA;AACjB,EAAA,OAAA,CAAQ,KAAK,CAAC,CAAA;AACf,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jest-worker.js","sources":["../../src/jest/worker/worker.ts"],"sourcesContent":["import { type MessagePort, parentPort, workerData } from \"node:worker_threads\";\nimport { type ConfigData } from \"../../config\";\nimport { FileSystemConfigLoader } from \"../../config/loaders/file-system\";\nimport { HtmlValidate } from \"../../htmlvalidate\";\nimport { type Report } from \"../../reporter\";\nimport {\n\ttype AnyAsyncFn,\n\ttype MainToWorkerCommandMessage,\n\ttype MainToWorkerMessage,\n\ttype WorkerToMainMessage,\n} from \"./types\";\n\ninterface WorkerData {\n\tsharedBuffer: SharedArrayBuffer;\n\tworkerPort: MessagePort;\n}\n\n/* eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters -- false positive, it is used in nested functions */\nfunction runAsWorker<R = unknown, T extends AnyAsyncFn<R> = AnyAsyncFn<R>>(fn: T): void {\n\tif (!workerData) {\n\t\treturn;\n\t}\n\n\tconst { workerPort, sharedBuffer } = workerData as WorkerData;\n\tconst sharedBufferView = new Int32Array(sharedBuffer, 0, 1);\n\n\t/* eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- better crash at runtime if not set */\n\tparentPort!.on(\"message\", ({ id, args }: MainToWorkerMessage<Parameters<T>>) => {\n\t\tasync function inner(): Promise<void> {\n\t\t\tlet isAborted = false;\n\t\t\tconst handleAbortMessage = (msg: MainToWorkerCommandMessage): void => {\n\t\t\t\tif (msg.id === id && msg.cmd === \"abort\") {\n\t\t\t\t\tisAborted = true;\n\t\t\t\t}\n\t\t\t};\n\t\t\tworkerPort.on(\"message\", handleAbortMessage);\n\t\t\tlet msg: WorkerToMainMessage<R>;\n\t\t\ttry {\n\t\t\t\tmsg = { id, result: await fn(...args) };\n\t\t\t} catch (error: unknown) {\n\t\t\t\tmsg = {\n\t\t\t\t\tid,\n\t\t\t\t\terror: error instanceof Error ? error.message : String(error),\n\t\t\t\t};\n\t\t\t}\n\t\t\tworkerPort.off(\"message\", handleAbortMessage);\n\n\t\t\tif (isAborted) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tworkerPort.postMessage(msg);\n\t\t\tAtomics.add(sharedBufferView, 0, 1);\n\t\t\tAtomics.notify(sharedBufferView, 0);\n\t\t}\n\t\t// eslint-disable-next-line @typescript-eslint/no-floating-promises -- should not happen\n\t\tinner();\n\t});\n}\n\nfunction validateString(markup: string, filename: string, config: ConfigData): Promise<Report> {\n\tconst loader = new FileSystemConfigLoader({\n\t\textends: [\"html-validate:recommended\"],\n\t});\n\tconst htmlvalidate = new HtmlValidate(loader);\n\treturn htmlvalidate.validateString(markup, filename, config);\n}\n\nexport type ValidateStringFn = typeof validateString;\n\nrunAsWorker(validateString);\n"],"names":["msg"],"mappings":";;;;;;;;;;;;;;;;;AAkBA,SAAS,YAAkE,EAAA,EAAa;AACvF,EAAA,IAAI,CAAC,UAAA,EAAY;AAChB,IAAA;AAAA;
|
|
1
|
+
{"version":3,"file":"jest-worker.js","sources":["../../src/jest/worker/worker.ts"],"sourcesContent":["import { type MessagePort, parentPort, workerData } from \"node:worker_threads\";\nimport { type ConfigData } from \"../../config\";\nimport { FileSystemConfigLoader } from \"../../config/loaders/file-system\";\nimport { HtmlValidate } from \"../../htmlvalidate\";\nimport { type Report } from \"../../reporter\";\nimport {\n\ttype AnyAsyncFn,\n\ttype MainToWorkerCommandMessage,\n\ttype MainToWorkerMessage,\n\ttype WorkerToMainMessage,\n} from \"./types\";\n\ninterface WorkerData {\n\tsharedBuffer: SharedArrayBuffer;\n\tworkerPort: MessagePort;\n}\n\n/* eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters -- false positive, it is used in nested functions */\nfunction runAsWorker<R = unknown, T extends AnyAsyncFn<R> = AnyAsyncFn<R>>(fn: T): void {\n\tif (!workerData) {\n\t\treturn;\n\t}\n\n\tconst { workerPort, sharedBuffer } = workerData as WorkerData;\n\tconst sharedBufferView = new Int32Array(sharedBuffer, 0, 1);\n\n\t/* eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- better crash at runtime if not set */\n\tparentPort!.on(\"message\", ({ id, args }: MainToWorkerMessage<Parameters<T>>) => {\n\t\tasync function inner(): Promise<void> {\n\t\t\tlet isAborted = false;\n\t\t\tconst handleAbortMessage = (msg: MainToWorkerCommandMessage): void => {\n\t\t\t\tif (msg.id === id && msg.cmd === \"abort\") {\n\t\t\t\t\tisAborted = true;\n\t\t\t\t}\n\t\t\t};\n\t\t\tworkerPort.on(\"message\", handleAbortMessage);\n\t\t\tlet msg: WorkerToMainMessage<R>;\n\t\t\ttry {\n\t\t\t\tmsg = { id, result: await fn(...args) };\n\t\t\t} catch (error: unknown) {\n\t\t\t\tmsg = {\n\t\t\t\t\tid,\n\t\t\t\t\terror: error instanceof Error ? error.message : String(error),\n\t\t\t\t};\n\t\t\t}\n\t\t\tworkerPort.off(\"message\", handleAbortMessage);\n\n\t\t\tif (isAborted) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tworkerPort.postMessage(msg);\n\t\t\tAtomics.add(sharedBufferView, 0, 1);\n\t\t\tAtomics.notify(sharedBufferView, 0);\n\t\t}\n\t\t// eslint-disable-next-line @typescript-eslint/no-floating-promises -- should not happen\n\t\tinner();\n\t});\n}\n\nfunction validateString(markup: string, filename: string, config: ConfigData): Promise<Report> {\n\tconst loader = new FileSystemConfigLoader({\n\t\textends: [\"html-validate:recommended\"],\n\t});\n\tconst htmlvalidate = new HtmlValidate(loader);\n\treturn htmlvalidate.validateString(markup, filename, config);\n}\n\nexport type ValidateStringFn = typeof validateString;\n\nrunAsWorker(validateString);\n"],"names":["msg"],"mappings":";;;;;;;;;;;;;;;;;AAkBA,SAAS,YAAkE,EAAA,EAAa;AACvF,EAAA,IAAI,CAAC,UAAA,EAAY;AAChB,IAAA;AAAA,EACD;AAEA,EAAA,MAAM,EAAE,UAAA,EAAY,YAAA,EAAa,GAAI,UAAA;AACrC,EAAA,MAAM,gBAAA,GAAmB,IAAI,UAAA,CAAW,YAAA,EAAc,GAAG,CAAC,CAAA;AAG1D,EAAA,UAAA,CAAY,GAAG,SAAA,EAAW,CAAC,EAAE,EAAA,EAAI,MAAK,KAA0C;AAC/E,IAAA,eAAe,KAAA,GAAuB;AACrC,MAAA,IAAI,SAAA,GAAY,KAAA;AAChB,MAAA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,WAAA,CAAY,cAAc,CAAA"}
|
|
@@ -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","../../src/jest/worker/create-sync-fn.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","import {\n\ttype MessagePort,\n\tMessageChannel,\n\tWorker,\n\treceiveMessageOnPort,\n} from \"node:worker_threads\";\nimport { legacyRequire } from \"../../resolve\";\nimport {\n\ttype AnyAsyncFn,\n\ttype AnyFn,\n\ttype MainToWorkerCommandMessage,\n\ttype MainToWorkerMessage,\n\ttype Syncify,\n\ttype WorkerToMainError,\n\ttype WorkerToMainMessage,\n} from \"./types\";\n\n/**\n * This is all based on the synckit library but without all the extra stuff such\n * as typescript, esbuld, pnp etc.\n */\n\nconst INT32_BYTES = 4;\nconst syncFnCache = new Map<string, AnyFn>();\nconst sharedBuffer = new SharedArrayBuffer(INT32_BYTES);\nconst sharedBufferView = new Int32Array(sharedBuffer, 0, 1);\n\nfunction isWorkerError<T>(value: WorkerToMainMessage<T>): value is WorkerToMainError {\n\treturn \"error\" in value;\n}\n\nfunction receiveMessageWithId<R>(port: MessagePort, expectedId: number): WorkerToMainMessage<R> {\n\tconst timeout = 30000;\n\tconst status = Atomics.wait(sharedBufferView, 0, 0, timeout);\n\tAtomics.store(sharedBufferView, 0, 0);\n\n\tif (![\"ok\", \"not-equal\"].includes(status)) {\n\t\tconst abortMsg: MainToWorkerCommandMessage = {\n\t\t\tid: expectedId,\n\t\t\tcmd: \"abort\",\n\t\t};\n\t\tport.postMessage(abortMsg);\n\t\tthrow new Error(`Internal error: Atomics.wait() failed: ${status}`);\n\t}\n\n\tconst reply = receiveMessageOnPort(port) as { message: WorkerToMainMessage<R> };\n\tconst { id, ...message } = reply.message;\n\n\tif (id < expectedId) {\n\t\treturn receiveMessageWithId(port, expectedId);\n\t}\n\n\tif (expectedId !== id) {\n\t\tthrow new Error(`Internal error: Expected id ${String(expectedId)} but got id ${String(id)}`);\n\t}\n\n\treturn { id, ...message };\n}\n\nfunction startWorkerThread<R, T extends AnyAsyncFn<R>>(\n\tworkerPath: string,\n): (...args: Parameters<T>) => R {\n\tconst { port1: mainPort, port2: workerPort } = new MessageChannel();\n\tconst workerPathUrl = legacyRequire.resolve(workerPath);\n\tconst worker = new Worker(workerPathUrl, {\n\t\teval: false,\n\t\tworkerData: { sharedBuffer, workerPort },\n\t\ttransferList: [workerPort],\n\t});\n\n\tlet nextID = 0;\n\n\tconst syncFn = (...args: Parameters<T>): R => {\n\t\tconst id = nextID++;\n\t\tconst msg: MainToWorkerMessage<Parameters<T>> = { id, args };\n\n\t\tworker.postMessage(msg);\n\n\t\tconst reply = receiveMessageWithId<R>(mainPort, id);\n\n\t\tif (isWorkerError(reply)) {\n\t\t\tthrow new Error(reply.error);\n\t\t}\n\n\t\treturn reply.result;\n\t};\n\n\tworker.unref();\n\n\treturn syncFn;\n}\n\nexport function createSyncFn<T extends AnyAsyncFn<R>, R = unknown>(workerPath: string): Syncify<T> {\n\tconst cachedSyncFn = syncFnCache.get(workerPath);\n\tif (cachedSyncFn) {\n\t\treturn cachedSyncFn as Syncify<T>;\n\t}\n\n\tconst syncFn = startWorkerThread<R, T>(workerPath);\n\tsyncFnCache.set(workerPath, syncFn);\n\treturn syncFn as Syncify<T>;\n}\n"],"names":[],"mappings":";;;AAGO,SAAS,WAAc,KAAA,EAA4C;AACzE,EAAA,OAAO,KAAA,IAAS,OAAO,KAAA,KAAU,QAAA,IAAY,UAAU,KAAA,IAAS,OAAO,MAAM,IAAA,KAAS,UAAA;AACvF;;ACyBO,SAAS,QACf,EAAA,EAC+B;AAO/B,EAAA,SAAS,QAAA,CAER,WACG,IAAA,EACsC;AACzC,IAAA,IAAI,UAAA,CAAW,MAAM,CAAA,EAAG;AACvB,MAAA,OAAO,MAAA,CAAO,IAAA,CAAK,CAAC,QAAA,KAAa,EAAA,CAAG,KAAK,IAAA,EAAM,QAAA,EAAU,GAAG,IAAI,CAAC,CAAA;AAAA,
|
|
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","../../src/jest/worker/create-sync-fn.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","import {\n\ttype MessagePort,\n\tMessageChannel,\n\tWorker,\n\treceiveMessageOnPort,\n} from \"node:worker_threads\";\nimport { legacyRequire } from \"../../resolve\";\nimport {\n\ttype AnyAsyncFn,\n\ttype AnyFn,\n\ttype MainToWorkerCommandMessage,\n\ttype MainToWorkerMessage,\n\ttype Syncify,\n\ttype WorkerToMainError,\n\ttype WorkerToMainMessage,\n} from \"./types\";\n\n/**\n * This is all based on the synckit library but without all the extra stuff such\n * as typescript, esbuld, pnp etc.\n */\n\nconst INT32_BYTES = 4;\nconst syncFnCache = new Map<string, AnyFn>();\nconst sharedBuffer = new SharedArrayBuffer(INT32_BYTES);\nconst sharedBufferView = new Int32Array(sharedBuffer, 0, 1);\n\nfunction isWorkerError<T>(value: WorkerToMainMessage<T>): value is WorkerToMainError {\n\treturn \"error\" in value;\n}\n\nfunction receiveMessageWithId<R>(port: MessagePort, expectedId: number): WorkerToMainMessage<R> {\n\tconst timeout = 30000;\n\tconst status = Atomics.wait(sharedBufferView, 0, 0, timeout);\n\tAtomics.store(sharedBufferView, 0, 0);\n\n\tif (![\"ok\", \"not-equal\"].includes(status)) {\n\t\tconst abortMsg: MainToWorkerCommandMessage = {\n\t\t\tid: expectedId,\n\t\t\tcmd: \"abort\",\n\t\t};\n\t\tport.postMessage(abortMsg);\n\t\tthrow new Error(`Internal error: Atomics.wait() failed: ${status}`);\n\t}\n\n\tconst reply = receiveMessageOnPort(port) as { message: WorkerToMainMessage<R> };\n\tconst { id, ...message } = reply.message;\n\n\tif (id < expectedId) {\n\t\treturn receiveMessageWithId(port, expectedId);\n\t}\n\n\tif (expectedId !== id) {\n\t\tthrow new Error(`Internal error: Expected id ${String(expectedId)} but got id ${String(id)}`);\n\t}\n\n\treturn { id, ...message };\n}\n\nfunction startWorkerThread<R, T extends AnyAsyncFn<R>>(\n\tworkerPath: string,\n): (...args: Parameters<T>) => R {\n\tconst { port1: mainPort, port2: workerPort } = new MessageChannel();\n\tconst workerPathUrl = legacyRequire.resolve(workerPath);\n\tconst worker = new Worker(workerPathUrl, {\n\t\teval: false,\n\t\tworkerData: { sharedBuffer, workerPort },\n\t\ttransferList: [workerPort],\n\t});\n\n\tlet nextID = 0;\n\n\tconst syncFn = (...args: Parameters<T>): R => {\n\t\tconst id = nextID++;\n\t\tconst msg: MainToWorkerMessage<Parameters<T>> = { id, args };\n\n\t\tworker.postMessage(msg);\n\n\t\tconst reply = receiveMessageWithId<R>(mainPort, id);\n\n\t\tif (isWorkerError(reply)) {\n\t\t\tthrow new Error(reply.error);\n\t\t}\n\n\t\treturn reply.result;\n\t};\n\n\tworker.unref();\n\n\treturn syncFn;\n}\n\nexport function createSyncFn<T extends AnyAsyncFn<R>, R = unknown>(workerPath: string): Syncify<T> {\n\tconst cachedSyncFn = syncFnCache.get(workerPath);\n\tif (cachedSyncFn) {\n\t\treturn cachedSyncFn as Syncify<T>;\n\t}\n\n\tconst syncFn = startWorkerThread<R, T>(workerPath);\n\tsyncFnCache.set(workerPath, syncFn);\n\treturn syncFn as Syncify<T>;\n}\n"],"names":[],"mappings":";;;AAGO,SAAS,WAAc,KAAA,EAA4C;AACzE,EAAA,OAAO,KAAA,IAAS,OAAO,KAAA,KAAU,QAAA,IAAY,UAAU,KAAA,IAAS,OAAO,MAAM,IAAA,KAAS,UAAA;AACvF;;ACyBO,SAAS,QACf,EAAA,EAC+B;AAO/B,EAAA,SAAS,QAAA,CAER,WACG,IAAA,EACsC;AACzC,IAAA,IAAI,UAAA,CAAW,MAAM,CAAA,EAAG;AACvB,MAAA,OAAO,MAAA,CAAO,IAAA,CAAK,CAAC,QAAA,KAAa,EAAA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,CAAA;AAElD,IAAA,IAAI,aAAA,CAAc,KAAK,CAAA,EAAG;AACzB,MAAA,MAAM,IAAI,KAAA,CAAM,KAAA,CAAM,KAAK,CAAA;AAAA,IAC5B;AAEA,IAAA,OAAO,KAAA,CAAM,MAAA;AAAA,EACd,CAAA;AAEA,EAAA,MAAA,CAAO,KAAA,EAAM;AAEb,EAAA,OAAO,MAAA;AACR;AAEO,SAAS,aAAmD,UAAA,EAAgC;AAClG,EAAA,MAAM,YAAA,GAAe,WAAA,CAAY,GAAA,CAAI,UAAU,CAAA;AAC/C,EAAA,IAAI,YAAA,EAAc;AACjB,IAAA,OAAO,YAAA;AAAA,EACR;AAEA,EAAA,MAAM,MAAA,GAAS,kBAAwB,UAAU,CAAA;AACjD,EAAA,WAAA,CAAY,GAAA,CAAI,YAAY,MAAM,CAAA;AAClC,EAAA,OAAO,MAAA;AACR;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"matchers-jestonly.js","sources":["../../src/jest/matchers/to-match-codeframe.ts","../../src/jest/matchers/to-match-inline-codeframe.ts"],"sourcesContent":["import kleur from \"kleur\";\nimport { toMatchSnapshot } from \"jest-snapshot\";\nimport { codeframe, type CodeframeOptions } from \"../../formatters/codeframe\";\nimport { type Report } from \"../../reporter\";\nimport {\n\ttype MatcherContext,\n\ttype MatcherResult,\n\ttype MaybeAsyncCallback,\n\tdiverge,\n} from \"../utils\";\nimport { getResults } from \"./get-results\";\n\nconst options: CodeframeOptions = {\n\tshowLink: false,\n\tshowSummary: false,\n\tshowSelector: true,\n};\n\nfunction createMatcher(): MaybeAsyncCallback<Report | string, [Array<string | object>]> {\n\tfunction toMatchCodeframe(\n\t\tthis: MatcherContext,\n\t\tactual: Report | string,\n\t\t...rest: Array<string | object>\n\t): MatcherResult {\n\t\t/* istanbul ignore next: cant figure out when this would be unset */\n\t\tconst filename = this.testPath ?? \"inline\";\n\t\tconst results = getResults(filename, actual);\n\t\tconst enabled = kleur.enabled;\n\t\tkleur.enabled = false;\n\t\tconst snapshot = codeframe(results, options).replace(/\\s+$/gm, \"\");\n\t\tkleur.enabled = enabled;\n\n\t\t/* eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call --\n\t\t * the implementation works but the declarations doesn't allow it */\n\t\treturn (toMatchSnapshot as any).call(this, snapshot, ...rest);\n\t}\n\treturn diverge(toMatchCodeframe);\n}\n\nexport { createMatcher as toMatchCodeframe };\n","import kleur from \"kleur\";\nimport { toMatchInlineSnapshot } from \"jest-snapshot\";\nimport { codeframe, type CodeframeOptions } from \"../../formatters/codeframe\";\nimport { type Report } from \"../../reporter\";\nimport { type MatcherContext, type MatcherResult, isThenable } from \"../utils\";\nimport { getResults } from \"./get-results\";\n\nconst options: CodeframeOptions = {\n\tshowLink: false,\n\tshowSummary: false,\n\tshowSelector: true,\n};\n\nfunction toMatchInlineCodeframeImpl(\n\tcontext: MatcherContext,\n\tactual: Report | string,\n\t...rest: Array<string | object>\n): MatcherResult {\n\t/* istanbul ignore next: cant figure out when this would be unset */\n\tconst filename = context.testPath ?? \"inline\";\n\tconst results = getResults(filename, actual);\n\tconst enabled = kleur.enabled;\n\tkleur.enabled = false;\n\tconst snapshot = codeframe(results, options).replace(/\\s+$/gm, \"\");\n\tkleur.enabled = enabled;\n\n\t/* eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call --\n\t * the implementation works but the declarations doesn't allow it */\n\treturn (toMatchInlineSnapshot as any).call(context, snapshot, ...rest);\n}\n\ntype ToMatchInlineCodeframeMatcher = (\n\tthis: MatcherContext,\n\tactual: Report | Promise<Report> | string,\n\t...rest: Array<string | object>\n) => MatcherResult | Promise<MatcherResult>;\n\nfunction createMatcher(): ToMatchInlineCodeframeMatcher {\n\tfunction toMatchInlineCodeframe(\n\t\tthis: MatcherContext,\n\t\tactual: Report | Promise<Report> | string,\n\t\t...rest: Array<string | object>\n\t): MatcherResult | Promise<MatcherResult> {\n\t\tconst context = {\n\t\t\t...this,\n\n\t\t\t/* Capture the original stack frames as they are needed by \"jest-snapshot\"\n\t\t\t * to determine where to write the inline snapshots. When resolving the\n\t\t\t * promise the original stack frames are lost and the snapshot will be\n\t\t\t * written in this files instaed. */\n\t\t\terror: new Error(),\n\t\t};\n\n\t\tif (isThenable(actual)) {\n\t\t\treturn actual.then((resolved) => toMatchInlineCodeframeImpl(context, resolved, ...rest));\n\t\t} else {\n\t\t\treturn toMatchInlineCodeframeImpl(context, actual, ...rest);\n\t\t}\n\t}\n\n\treturn toMatchInlineCodeframe;\n}\n\nexport { createMatcher as toMatchInlineCodeframe };\n"],"names":["options","createMatcher"],"mappings":";;;;;;AAYA,MAAMA,SAAA,GAA4B;AAAA,EACjC,QAAA,EAAU,KAAA;AAAA,EACV,WAAA,EAAa,KAAA;AAAA,EACb,YAAA,EAAc;AACf,CAAA;AAEA,SAASC,eAAA,GAA+E;AACvF,EAAA,SAAS,gBAAA,CAER,WACG,IAAA,EACa;AAEhB,IAAA,MAAM,QAAA,GAAW,KAAK,QAAA,IAAY,QAAA;AAClC,IAAA,MAAM,OAAA,GAAU,UAAA,CAAW,QAAA,EAAU,MAAM,CAAA;AAC3C,IAAA,MAAM,UAAU,KAAA,CAAM,OAAA;AACtB,IAAA,KAAA,CAAM,OAAA,GAAU,KAAA;AAChB,IAAA,MAAM,WAAW,SAAA,CAAU,OAAA,EAASD,SAAO,CAAA,CAAE,OAAA,CAAQ,UAAU,EAAE,CAAA;AACjE,IAAA,KAAA,CAAM,OAAA,GAAU,OAAA;AAIhB,IAAA,OAAQ,eAAA,CAAwB,IAAA,CAAK,IAAA,EAAM,QAAA,EAAU,GAAG,IAAI,CAAA;AAAA;
|
|
1
|
+
{"version":3,"file":"matchers-jestonly.js","sources":["../../src/jest/matchers/to-match-codeframe.ts","../../src/jest/matchers/to-match-inline-codeframe.ts"],"sourcesContent":["import kleur from \"kleur\";\nimport { toMatchSnapshot } from \"jest-snapshot\";\nimport { codeframe, type CodeframeOptions } from \"../../formatters/codeframe\";\nimport { type Report } from \"../../reporter\";\nimport {\n\ttype MatcherContext,\n\ttype MatcherResult,\n\ttype MaybeAsyncCallback,\n\tdiverge,\n} from \"../utils\";\nimport { getResults } from \"./get-results\";\n\nconst options: CodeframeOptions = {\n\tshowLink: false,\n\tshowSummary: false,\n\tshowSelector: true,\n};\n\nfunction createMatcher(): MaybeAsyncCallback<Report | string, [Array<string | object>]> {\n\tfunction toMatchCodeframe(\n\t\tthis: MatcherContext,\n\t\tactual: Report | string,\n\t\t...rest: Array<string | object>\n\t): MatcherResult {\n\t\t/* istanbul ignore next: cant figure out when this would be unset */\n\t\tconst filename = this.testPath ?? \"inline\";\n\t\tconst results = getResults(filename, actual);\n\t\tconst enabled = kleur.enabled;\n\t\tkleur.enabled = false;\n\t\tconst snapshot = codeframe(results, options).replace(/\\s+$/gm, \"\");\n\t\tkleur.enabled = enabled;\n\n\t\t/* eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call --\n\t\t * the implementation works but the declarations doesn't allow it */\n\t\treturn (toMatchSnapshot as any).call(this, snapshot, ...rest);\n\t}\n\treturn diverge(toMatchCodeframe);\n}\n\nexport { createMatcher as toMatchCodeframe };\n","import kleur from \"kleur\";\nimport { toMatchInlineSnapshot } from \"jest-snapshot\";\nimport { codeframe, type CodeframeOptions } from \"../../formatters/codeframe\";\nimport { type Report } from \"../../reporter\";\nimport { type MatcherContext, type MatcherResult, isThenable } from \"../utils\";\nimport { getResults } from \"./get-results\";\n\nconst options: CodeframeOptions = {\n\tshowLink: false,\n\tshowSummary: false,\n\tshowSelector: true,\n};\n\nfunction toMatchInlineCodeframeImpl(\n\tcontext: MatcherContext,\n\tactual: Report | string,\n\t...rest: Array<string | object>\n): MatcherResult {\n\t/* istanbul ignore next: cant figure out when this would be unset */\n\tconst filename = context.testPath ?? \"inline\";\n\tconst results = getResults(filename, actual);\n\tconst enabled = kleur.enabled;\n\tkleur.enabled = false;\n\tconst snapshot = codeframe(results, options).replace(/\\s+$/gm, \"\");\n\tkleur.enabled = enabled;\n\n\t/* eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call --\n\t * the implementation works but the declarations doesn't allow it */\n\treturn (toMatchInlineSnapshot as any).call(context, snapshot, ...rest);\n}\n\ntype ToMatchInlineCodeframeMatcher = (\n\tthis: MatcherContext,\n\tactual: Report | Promise<Report> | string,\n\t...rest: Array<string | object>\n) => MatcherResult | Promise<MatcherResult>;\n\nfunction createMatcher(): ToMatchInlineCodeframeMatcher {\n\tfunction toMatchInlineCodeframe(\n\t\tthis: MatcherContext,\n\t\tactual: Report | Promise<Report> | string,\n\t\t...rest: Array<string | object>\n\t): MatcherResult | Promise<MatcherResult> {\n\t\tconst context = {\n\t\t\t...this,\n\n\t\t\t/* Capture the original stack frames as they are needed by \"jest-snapshot\"\n\t\t\t * to determine where to write the inline snapshots. When resolving the\n\t\t\t * promise the original stack frames are lost and the snapshot will be\n\t\t\t * written in this files instaed. */\n\t\t\terror: new Error(),\n\t\t};\n\n\t\tif (isThenable(actual)) {\n\t\t\treturn actual.then((resolved) => toMatchInlineCodeframeImpl(context, resolved, ...rest));\n\t\t} else {\n\t\t\treturn toMatchInlineCodeframeImpl(context, actual, ...rest);\n\t\t}\n\t}\n\n\treturn toMatchInlineCodeframe;\n}\n\nexport { createMatcher as toMatchInlineCodeframe };\n"],"names":["options","createMatcher"],"mappings":";;;;;;AAYA,MAAMA,SAAA,GAA4B;AAAA,EACjC,QAAA,EAAU,KAAA;AAAA,EACV,WAAA,EAAa,KAAA;AAAA,EACb,YAAA,EAAc;AACf,CAAA;AAEA,SAASC,eAAA,GAA+E;AACvF,EAAA,SAAS,gBAAA,CAER,WACG,IAAA,EACa;AAEhB,IAAA,MAAM,QAAA,GAAW,KAAK,QAAA,IAAY,QAAA;AAClC,IAAA,MAAM,OAAA,GAAU,UAAA,CAAW,QAAA,EAAU,MAAM,CAAA;AAC3C,IAAA,MAAM,UAAU,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O,MAAA,CAAO,KAAK,CAAC,QAAA,KAAa,2BAA2B,OAAA,EAAS,QAAA,EAAU,GAAG,IAAI,CAAC,CAAA;AAAA,IACxF,CAAA,MAAO;AACN,MAAA,OAAO,0BAAA,CAA2B,OAAA,EAAS,MAAA,EAAQ,GAAG,IAAI,CAAA;AAAA,IAC3D;AAAA,EACD;AAEA,EAAA,OAAO,sBAAA;AACR;;;;"}
|
|
@@ -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 { 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\";\nimport { type ValidateStringFn, createSyncFn, workerPath } from \"../worker\";\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; /* eslint-disable-line sonarjs/redundant-type-aliases -- for consistency */\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; // 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, 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\n\tconst syncFn = createSyncFn<ValidateStringFn>(workerPath);\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\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 { type Report, type Result } from \"../../reporter\";\nimport { type ValidateStringFn, createSyncFn, workerPath } from \"../worker\";\n\n/**\n * @internal\n */\nexport function getResults(filename: string, value: Report | string): Result[] {\n\tif (typeof value === \"string\") {\n\t\tconst syncFn = createSyncFn<ValidateStringFn>(workerPath);\n\t\tconst report = syncFn(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"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,SAAS,UAAA,CAAW,UAAkB,KAAA,EAAkC;AAC9E,EAAA,IAAI,OAAO,UAAU,QAAA,EAAU;AAC9B,IAAA,MAAM,MAAA,GAAS,aAA+B,UAAU,CAAA;AACxD,IAAA,MAAM,MAAA,GAAS,MAAA,CAAO,KAAA,EAAO,QAAA,EAAU;AAAA,MACtC,KAAA,EAAO;AAAA,QACN,YAAA,EAAc;AAAA;AACf,KACA,CAAA;AACD,IAAA,OAAO,MAAA,CAAO,OAAA,CAAQ,GAAA,CAAI,CAAC,EAAA,KAAO;AACjC,MAAA,OAAO,EAAE,GAAG,EAAA,EAAI,QAAA,EAAU,QAAA,EAAS;AAAA,KACnC,CAAA;AAAA,GACF,MAAO;AACN,IAAA,OAAO,KAAA,CAAM,OAAA;AAAA;AAEf;;;;"}
|
|
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 { 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\";\nimport { type ValidateStringFn, createSyncFn, workerPath } from \"../worker\";\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; /* eslint-disable-line sonarjs/redundant-type-aliases -- for consistency */\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; // 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, 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\n\tconst syncFn = createSyncFn<ValidateStringFn>(workerPath);\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\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 { type Report, type Result } from \"../../reporter\";\nimport { type ValidateStringFn, createSyncFn, workerPath } from \"../worker\";\n\n/**\n * @internal\n */\nexport function getResults(filename: string, value: Report | string): Result[] {\n\tif (typeof value === \"string\") {\n\t\tconst syncFn = createSyncFn<ValidateStringFn>(workerPath);\n\t\tconst report = syncFn(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,eAAA,GAAgD;AACxD,EAAA,SAAS,UAAU,MAAA,EAA+B;AACjD,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,EAA+B;AACnD,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;;ACLA,SAAS,UAAU,GAAA,EAAmC;AACrD,EAAA,IAAI,CAAC,GAAA,EAAK;AACT,IAAA,OAAO,KAAA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EAEK,IAAA,CAAK,KAAA,CAAM,aAAA,CAAc,OAAO,CAAC;AAAA;AAAA,EAAA,EAEjC,IAAA,CAAK,KAAA,CAAM,aAAA,CAAc,SAAS,CAAC,CAAA,CAAA;AAAA,KACZ,UAAA,GAAa;;AAAA;;AAAA,EAAsB,UAAU,CAAA,CAAA,GAAK,EAAA,CAAA;AAE/E,IAAA,OAAO,EAAE,IAAA,EAAM,OAAA,EAAS,aAAA,EAAc;AAAA,EACvC;AACA,EAAA,OAAO,QAAQ,YAAY,CAAA;AAC5B;;ACzCO,SAAS,UAAA,CAAW,UAAkB,KAAA,EAAkC;AAC9E,EAAA,IAAI,OAAO,UAAU,QAAA,EAAU;AAC9B,IAAA,MAAM,MAAA,GAAS,aAA+B,UAAU,CAAA;AACxD,IAAA,MAAM,MAAA,GAAS,MAAA,CAAO,KAAA,EAAO,QAAA,EAAU;AAAA,MACtC,KAAA,EAAO;AAAA,QACN,YAAA,EAAc;AAAA;AACf,KACA,CAAA;AACD,IAAA,OAAO,MAAA,CAAO,OAAA,CAAQ,GAAA,CAAI,CAAC,EAAA,KAAO;AACjC,MAAA,OAAO,EAAE,GAAG,EAAA,EAAI,QAAA,EAAU,QAAA,EAAS;AAAA,IACpC,CAAC,CAAA;AAAA,EACF,CAAA,MAAO;AACN,IAAA,OAAO,KAAA,CAAM,OAAA;AAAA,EACd;AACD;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meta-helper.js","sources":["../../src/meta/define-metadata.ts","../../src/meta/helper.ts"],"sourcesContent":["import { type MetaDataTable } from \"./element\";\n\n/**\n * Helper function to assist IDE with completion and type-checking.\n *\n * @public\n */\nexport function defineMetadata(metatable: MetaDataTable): MetaDataTable {\n\treturn metatable;\n}\n","import { naturalJoin } from \"../utils/natural-join\";\nimport { type MetaAttributeAllowedCallback } from \"./element\";\nimport { type HtmlElementLike } from \"./html-element-like\";\n\n/**\n * Helpers when writing element metadata.\n *\n * @public\n */\nexport interface MetadataHelper {\n\t/** Returns an error if another attribute is omitted, i.e. it requires another attribute to be present to pass. */\n\tallowedIfAttributeIsPresent(this: void, ...attr: string[]): MetaAttributeAllowedCallback;\n\n\t/** Returns an error if another attribute is present, i.e. it requires another attribute to be omitted to pass. */\n\tallowedIfAttributeIsAbsent(this: void, ...attr: string[]): MetaAttributeAllowedCallback;\n\n\t/** Returns an error if another attribute does not have one of the listed values */\n\tallowedIfAttributeHasValue(\n\t\tthis: void,\n\t\tattr: string,\n\t\tvalue: string[],\n\t\toptions?: { defaultValue?: string | null },\n\t): MetaAttributeAllowedCallback;\n\n\t/**\n\t * Returns an error if the node doesn't have any of the given elements as parent\n\t *\n\t * @since 8.2.0\n\t **/\n\tallowedIfParentIsPresent(this: void, ...tags: string[]): MetaAttributeAllowedCallback;\n}\n\n/**\n * @internal\n */\nexport function allowedIfAttributeIsPresent(...attr: string[]) {\n\treturn (node: HtmlElementLike) => {\n\t\tif (attr.some((it) => node.hasAttribute(it))) {\n\t\t\treturn null;\n\t\t}\n\t\tconst expected = naturalJoin(attr.map((it) => `\"${it}\"`));\n\t\treturn `requires ${expected} attribute to be present`;\n\t};\n}\n\n/**\n * @internal\n */\nexport function allowedIfAttributeIsAbsent(...attr: string[]): MetaAttributeAllowedCallback {\n\treturn (node: HtmlElementLike) => {\n\t\tconst present = attr.filter((it) => node.hasAttribute(it));\n\t\tif (present.length === 0) {\n\t\t\treturn null;\n\t\t}\n\t\tconst expected = naturalJoin(present.map((it) => `\"${it}\"`));\n\t\treturn `cannot be used at the same time as ${expected}`;\n\t};\n}\n\n/**\n * @internal\n */\nexport function allowedIfAttributeHasValue(\n\tkey: string,\n\texpectedValue: string[],\n\t{ defaultValue }: { defaultValue?: string | null } = {},\n): MetaAttributeAllowedCallback {\n\treturn (node: HtmlElementLike) => {\n\t\tconst attr = node.getAttribute(key);\n\t\tif (attr && typeof attr !== \"string\") {\n\t\t\treturn null;\n\t\t}\n\t\tconst actualValue = attr ?? defaultValue;\n\t\tif (actualValue && expectedValue.includes(actualValue.toLocaleLowerCase())) {\n\t\t\treturn null;\n\t\t}\n\t\tconst expected = naturalJoin(expectedValue.map((it) => `\"${it}\"`));\n\t\treturn `\"${key}\" attribute must be ${expected}`;\n\t};\n}\n\n/**\n * @internal\n */\nexport function allowedIfParentIsPresent(\n\tthis: void,\n\t...tags: string[]\n): MetaAttributeAllowedCallback {\n\treturn (node: HtmlElementLike) => {\n\t\tconst match = tags.some((it) => node.closest(it));\n\t\tif (match) {\n\t\t\treturn null;\n\t\t}\n\t\tconst expected = naturalJoin(tags.map((it) => `<${it}>`));\n\t\treturn `requires ${expected} as parent`;\n\t};\n}\n\n/**\n * @public\n */\nexport const metadataHelper: MetadataHelper = {\n\tallowedIfAttributeIsPresent,\n\tallowedIfAttributeIsAbsent,\n\tallowedIfAttributeHasValue,\n\tallowedIfParentIsPresent,\n};\n"],"names":[],"mappings":";;AAOO,SAAS,eAAe,SAAA,EAAyC;AACvE,EAAA,OAAO,SAAA;AACR;;AC0BO,SAAS,+BAA+B,IAAA,EAAgB;AAC9D,EAAA,OAAO,CAAC,IAAA,KAA0B;AACjC,IAAA,IAAI,IAAA,CAAK,KAAK,CAAC,EAAA,KAAO,KAAK,YAAA,CAAa,EAAE,CAAC,CAAA,EAAG;AAC7C,MAAA,OAAO,IAAA;AAAA;
|
|
1
|
+
{"version":3,"file":"meta-helper.js","sources":["../../src/meta/define-metadata.ts","../../src/meta/helper.ts"],"sourcesContent":["import { type MetaDataTable } from \"./element\";\n\n/**\n * Helper function to assist IDE with completion and type-checking.\n *\n * @public\n */\nexport function defineMetadata(metatable: MetaDataTable): MetaDataTable {\n\treturn metatable;\n}\n","import { naturalJoin } from \"../utils/natural-join\";\nimport { type MetaAttributeAllowedCallback } from \"./element\";\nimport { type HtmlElementLike } from \"./html-element-like\";\n\n/**\n * Helpers when writing element metadata.\n *\n * @public\n */\nexport interface MetadataHelper {\n\t/** Returns an error if another attribute is omitted, i.e. it requires another attribute to be present to pass. */\n\tallowedIfAttributeIsPresent(this: void, ...attr: string[]): MetaAttributeAllowedCallback;\n\n\t/** Returns an error if another attribute is present, i.e. it requires another attribute to be omitted to pass. */\n\tallowedIfAttributeIsAbsent(this: void, ...attr: string[]): MetaAttributeAllowedCallback;\n\n\t/** Returns an error if another attribute does not have one of the listed values */\n\tallowedIfAttributeHasValue(\n\t\tthis: void,\n\t\tattr: string,\n\t\tvalue: string[],\n\t\toptions?: { defaultValue?: string | null },\n\t): MetaAttributeAllowedCallback;\n\n\t/**\n\t * Returns an error if the node doesn't have any of the given elements as parent\n\t *\n\t * @since 8.2.0\n\t **/\n\tallowedIfParentIsPresent(this: void, ...tags: string[]): MetaAttributeAllowedCallback;\n}\n\n/**\n * @internal\n */\nexport function allowedIfAttributeIsPresent(...attr: string[]) {\n\treturn (node: HtmlElementLike) => {\n\t\tif (attr.some((it) => node.hasAttribute(it))) {\n\t\t\treturn null;\n\t\t}\n\t\tconst expected = naturalJoin(attr.map((it) => `\"${it}\"`));\n\t\treturn `requires ${expected} attribute to be present`;\n\t};\n}\n\n/**\n * @internal\n */\nexport function allowedIfAttributeIsAbsent(...attr: string[]): MetaAttributeAllowedCallback {\n\treturn (node: HtmlElementLike) => {\n\t\tconst present = attr.filter((it) => node.hasAttribute(it));\n\t\tif (present.length === 0) {\n\t\t\treturn null;\n\t\t}\n\t\tconst expected = naturalJoin(present.map((it) => `\"${it}\"`));\n\t\treturn `cannot be used at the same time as ${expected}`;\n\t};\n}\n\n/**\n * @internal\n */\nexport function allowedIfAttributeHasValue(\n\tkey: string,\n\texpectedValue: string[],\n\t{ defaultValue }: { defaultValue?: string | null } = {},\n): MetaAttributeAllowedCallback {\n\treturn (node: HtmlElementLike) => {\n\t\tconst attr = node.getAttribute(key);\n\t\tif (attr && typeof attr !== \"string\") {\n\t\t\treturn null;\n\t\t}\n\t\tconst actualValue = attr ?? defaultValue;\n\t\tif (actualValue && expectedValue.includes(actualValue.toLocaleLowerCase())) {\n\t\t\treturn null;\n\t\t}\n\t\tconst expected = naturalJoin(expectedValue.map((it) => `\"${it}\"`));\n\t\treturn `\"${key}\" attribute must be ${expected}`;\n\t};\n}\n\n/**\n * @internal\n */\nexport function allowedIfParentIsPresent(\n\tthis: void,\n\t...tags: string[]\n): MetaAttributeAllowedCallback {\n\treturn (node: HtmlElementLike) => {\n\t\tconst match = tags.some((it) => node.closest(it));\n\t\tif (match) {\n\t\t\treturn null;\n\t\t}\n\t\tconst expected = naturalJoin(tags.map((it) => `<${it}>`));\n\t\treturn `requires ${expected} as parent`;\n\t};\n}\n\n/**\n * @public\n */\nexport const metadataHelper: MetadataHelper = {\n\tallowedIfAttributeIsPresent,\n\tallowedIfAttributeIsAbsent,\n\tallowedIfAttributeHasValue,\n\tallowedIfParentIsPresent,\n};\n"],"names":[],"mappings":";;AAOO,SAAS,eAAe,SAAA,EAAyC;AACvE,EAAA,OAAO,SAAA;AACR;;AC0BO,SAAS,+BAA+B,IAAA,EAAgB;AAC9D,EAAA,OAAO,CAAC,IAAA,KAA0B;AACjC,IAAA,IAAI,IAAA,CAAK,KAAK,CAAC,EAAA,KAAO,KAAK,YAAA,CAAa,EAAE,CAAC,CAAA,EAAG;AAC7C,MAAA,OAAO,IAAA;AAAA,IACR;AACA,IAAA,MAAM,QAAA,GAAW,YAAY,IAAA,CAAK,GAAA,CAAI,CAAC,EAAA,KAAO,CAAA,CAAA,EAAI,EAAE,CAAA,CAAA,CAAG,CAAC,CAAA;AACxD,IAAA,OAAO,YAAY,QAAQ,CAAA,wBAAA,CAAA;AAAA,EAC5B,CAAA;AACD;AAKO,SAAS,8BAA8B,IAAA,EAA8C;AAC3F,EAAA,OAAO,CAAC,IAAA,KAA0B;AACjC,IAAA,MAAM,OAAA,GAAU,KAAK,MAAA,CAAO,CAAC,OAAO,IAAA,CAAK,YAAA,CAAa,EAAE,CAAC,CAAA;AACzD,IAAA,IAAI,OAAA,CAAQ,WAAW,CAAA,EAAG;AACzB,MAAA,OAAO,IAAA;AAAA,IACR;AACA,I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AAG,CAAC,CAAA;AACxD,IAAA,OAAO,YAAY,QAAQ,CAAA,UAAA,CAAA;AAAA,EAC5B,CAAA;AACD;AAKO,MAAM,cAAA,GAAiC;AAAA,EAC7C,2BAAA;AAAA,EACA,0BAAA;AAAA,EACA,0BAAA;AAAA,EACA;AACD;;;;"}
|
package/dist/tsdoc-metadata.json
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "html-validate",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Offline
|
|
3
|
+
"version": "10.1.0",
|
|
4
|
+
"description": "Offline HTML5 validator and linter",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"html",
|
|
7
7
|
"lint",
|
|
@@ -33,83 +33,76 @@
|
|
|
33
33
|
"browser": {
|
|
34
34
|
"types": "./dist/types/browser.d.ts",
|
|
35
35
|
"require": "./dist/cjs/browser.js",
|
|
36
|
-
"import": "./dist/
|
|
36
|
+
"import": "./dist/esm/browser.js"
|
|
37
37
|
},
|
|
38
38
|
"node": {
|
|
39
39
|
"types": "./dist/types/index.d.ts",
|
|
40
40
|
"require": "./dist/cjs/index.js",
|
|
41
|
-
"import": "./dist/
|
|
41
|
+
"import": "./dist/esm/index.js"
|
|
42
42
|
},
|
|
43
43
|
"default": {
|
|
44
44
|
"types": "./dist/types/index.d.ts",
|
|
45
45
|
"require": "./dist/cjs/index.js",
|
|
46
|
-
"import": "./dist/
|
|
46
|
+
"import": "./dist/esm/index.js"
|
|
47
47
|
}
|
|
48
48
|
},
|
|
49
49
|
"./browser": {
|
|
50
50
|
"types": "./dist/types/browser.d.ts",
|
|
51
51
|
"require": "./dist/cjs/browser.js",
|
|
52
|
-
"import": "./dist/
|
|
52
|
+
"import": "./dist/esm/browser.js"
|
|
53
53
|
},
|
|
54
54
|
"./node": {
|
|
55
55
|
"types": "./dist/types/index.d.ts",
|
|
56
56
|
"require": "./dist/cjs/index.js",
|
|
57
|
-
"import": "./dist/
|
|
57
|
+
"import": "./dist/esm/index.js"
|
|
58
58
|
},
|
|
59
|
-
"./dist/cjs/*": "./dist/cjs/*",
|
|
60
|
-
"./dist/es/*": "./dist/es/*",
|
|
61
59
|
"./dist/schema/*": "./dist/schema/*",
|
|
62
60
|
"./elements/html5": {
|
|
63
|
-
"types": "./
|
|
61
|
+
"types": "./dist/types/html5.d.ts",
|
|
64
62
|
"require": "./dist/cjs/html5.js",
|
|
65
|
-
"import": "./dist/
|
|
63
|
+
"import": "./dist/esm/html5.js"
|
|
66
64
|
},
|
|
67
65
|
"./jest": {
|
|
68
66
|
"types": "./dist/types/jest.d.ts",
|
|
69
67
|
"require": "./dist/cjs/jest.js",
|
|
70
|
-
"import": "./dist/
|
|
68
|
+
"import": "./dist/esm/jest.js"
|
|
71
69
|
},
|
|
72
70
|
"./package.json": "./package.json",
|
|
73
71
|
"./test-utils": {
|
|
74
72
|
"types": "./dist/types/test-utils.d.ts",
|
|
75
73
|
"require": "./dist/cjs/test-utils.js",
|
|
76
|
-
"import": "./dist/
|
|
74
|
+
"import": "./dist/esm/test-utils.js"
|
|
77
75
|
},
|
|
78
76
|
"./vitest": {
|
|
79
77
|
"types": "./dist/types/vitest.d.ts",
|
|
80
|
-
"import": "./dist/
|
|
78
|
+
"import": "./dist/esm/vitest.js"
|
|
81
79
|
}
|
|
82
80
|
},
|
|
83
81
|
"main": "dist/cjs/index.js",
|
|
84
|
-
"module": "dist/
|
|
82
|
+
"module": "dist/esm/index.js",
|
|
85
83
|
"browser": "dist/cjs/browser.js",
|
|
86
84
|
"bin": {
|
|
87
85
|
"html-validate": "bin/html-validate.mjs"
|
|
88
86
|
},
|
|
89
87
|
"files": [
|
|
90
88
|
"bin",
|
|
91
|
-
"dist"
|
|
92
|
-
"elements",
|
|
93
|
-
"browser.{js,d.ts}",
|
|
94
|
-
"node.{js,d.ts}",
|
|
95
|
-
"jest.{js,d.ts}",
|
|
96
|
-
"test-utils.{js,d.ts}"
|
|
89
|
+
"dist"
|
|
97
90
|
],
|
|
98
91
|
"dependencies": {
|
|
99
92
|
"@html-validate/stylish": "^4.1.0",
|
|
100
93
|
"@sidvind/better-ajv-errors": "4.0.0",
|
|
101
94
|
"ajv": "^8.0.0",
|
|
102
|
-
"glob": "^
|
|
95
|
+
"glob": "^11.0.0",
|
|
103
96
|
"kleur": "^4.1.0",
|
|
104
97
|
"minimist": "^1.2.0",
|
|
105
98
|
"prompts": "^2.0.0",
|
|
106
99
|
"semver": "^7.0.0"
|
|
107
100
|
},
|
|
108
101
|
"peerDependencies": {
|
|
109
|
-
"jest": "^
|
|
110
|
-
"jest-diff": "^
|
|
111
|
-
"jest-snapshot": "^
|
|
112
|
-
"vitest": "^
|
|
102
|
+
"jest": "^28.1.3 || ^29.0.3 || ^30.0.0",
|
|
103
|
+
"jest-diff": "^28.1.3 || ^29.0.3 || ^30.0.0",
|
|
104
|
+
"jest-snapshot": "^28.1.3 || ^29.0.3 || ^30.0.0",
|
|
105
|
+
"vitest": "^1.0.0 || ^2.0.0 || ^3.0.0"
|
|
113
106
|
},
|
|
114
107
|
"peerDependenciesMeta": {
|
|
115
108
|
"jest": {
|
|
@@ -126,6 +119,6 @@
|
|
|
126
119
|
}
|
|
127
120
|
},
|
|
128
121
|
"engines": {
|
|
129
|
-
"node": "^
|
|
122
|
+
"node": "^20.19.0 || >= 22.12.0"
|
|
130
123
|
}
|
|
131
124
|
}
|
package/browser.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./dist/types/browser";
|
package/browser.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require("./dist/cjs/browser");
|
package/dist/es/cli.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sources":["../../src/cli/expand-files.ts","../../src/cli/formatter.ts","../../src/cli/is-ignored.ts","../../src/cli/init.ts","../../src/cli/parse-severity.ts","../../src/cli/get-rule-config.ts","../../src/cli/cli.ts","../../src/cli/errors/handle-schema-validation-error.ts","../../src/cli/errors/import-resolve-missing-error.ts","../../src/cli/mode.ts","../../src/cli/actions/lint.ts","../../src/cli/actions/init.ts","../../src/cli/actions/print-config.ts","../../src/cli/json.ts","../../src/cli/actions/dump.ts","../../src/cli/have-import-meta-resolve.ts"],"sourcesContent":["import fs from \"fs\";\nimport path from \"node:path\";\nimport { globSync } from \"glob\";\n\nconst DEFAULT_EXTENSIONS = [\"html\"];\n\n/**\n * @public\n */\nexport interface ExpandOptions {\n\t/**\n\t * Working directory. Defaults to `process.cwd()`.\n\t */\n\tcwd?: string;\n\n\t/**\n\t * List of extensions to search for when expanding directories. Extensions\n\t * should be passed without leading dot, e.g. \"html\" instead of \".html\".\n\t */\n\textensions?: string[];\n}\n\nfunction isDirectory(filename: string): boolean {\n\tconst st = fs.statSync(filename);\n\treturn st.isDirectory();\n}\n\nfunction join(stem: string, filename: string): string {\n\tif (path.isAbsolute(filename)) {\n\t\treturn path.normalize(filename);\n\t} else {\n\t\treturn path.normalize(path.join(stem, filename));\n\t}\n}\n\nfunction directoryPattern(extensions: string[]): string {\n\tswitch (extensions.length) {\n\t\tcase 0:\n\t\t\treturn \"**/*\";\n\t\tcase 1:\n\t\t\treturn `**/*.${extensions[0]}`;\n\t\tdefault:\n\t\t\treturn `**/*.{${extensions.join(\",\")}}`;\n\t}\n}\n\n/**\n * Takes a number of file patterns (globs) and returns array of expanded\n * filenames.\n */\nexport function expandFiles(patterns: string[], options: ExpandOptions): string[] {\n\tconst cwd = options.cwd ?? process.cwd();\n\tconst extensions = options.extensions ?? DEFAULT_EXTENSIONS;\n\n\tconst files = patterns.reduce((result: string[], pattern: string) => {\n\t\t/* process - as standard input */\n\t\tif (pattern === \"-\") {\n\t\t\tresult.push(\"/dev/stdin\");\n\t\t\treturn result;\n\t\t}\n\n\t\tfor (const filename of globSync(pattern, { cwd })) {\n\t\t\t/* if file is a directory recursively expand files from it */\n\t\t\tconst fullpath = join(cwd, filename);\n\t\t\tif (isDirectory(fullpath)) {\n\t\t\t\tconst dir = expandFiles([directoryPattern(extensions)], { ...options, cwd: fullpath });\n\t\t\t\tresult = result.concat(dir.map((cur) => join(filename, cur)));\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tresult.push(fullpath);\n\t\t}\n\n\t\treturn result.sort((a, b) => {\n\t\t\tconst pa = a.split(\"/\").length;\n\t\t\tconst pb = b.split(\"/\").length;\n\t\t\tif (pa !== pb) {\n\t\t\t\treturn pa - pb;\n\t\t\t} else {\n\t\t\t\treturn a > b ? 1 : -1;\n\t\t\t}\n\t\t});\n\t}, []);\n\n\t/* only return unique matches */\n\treturn Array.from(new Set(files));\n}\n","import fs from \"fs\";\nimport path from \"node:path\";\nimport { type Formatter, type Report, type Result, UserError, formatterFactory } from \"..\";\nimport { ensureError } from \"../error\";\nimport { legacyRequire } from \"../resolve\";\n\ntype WrappedFormatter = (results: Result[]) => string;\n\nfunction wrap(formatter: Formatter, dst: string): (results: Result[]) => string {\n\treturn (results: Result[]) => {\n\t\tconst output = formatter(results);\n\t\tif (dst) {\n\t\t\tconst dir = path.dirname(dst);\n\t\t\tif (!fs.existsSync(dir)) {\n\t\t\t\tfs.mkdirSync(dir, { recursive: true });\n\t\t\t}\n\t\t\tfs.writeFileSync(dst, output, \"utf-8\");\n\t\t\treturn \"\";\n\t\t} else {\n\t\t\treturn output;\n\t\t}\n\t};\n}\n\nfunction loadFormatter(name: string): Formatter {\n\tconst fn = formatterFactory(name);\n\tif (fn) {\n\t\treturn fn;\n\t}\n\n\ttry {\n\t\treturn legacyRequire(name) as Formatter;\n\t} catch (error: unknown) {\n\t\tthrow new UserError(`No formatter named \"${name}\"`, ensureError(error));\n\t}\n}\n\nexport function getFormatter(formatters: string): (report: Report) => string {\n\tconst fn: WrappedFormatter[] = formatters.split(\",\").map((cur) => {\n\t\tconst [name, dst] = cur.split(\"=\", 2);\n\t\tconst fn = loadFormatter(name);\n\t\treturn wrap(fn, dst);\n\t});\n\treturn (report: Report) => {\n\t\treturn fn\n\t\t\t.map((formatter: WrappedFormatter) => formatter(report.results))\n\t\t\t.filter(Boolean)\n\t\t\t.join(\"\\n\");\n\t};\n}\n","import fs from \"fs\";\nimport path from \"node:path\";\nimport ignore, { type Ignore } from \"ignore\";\n\nexport class IsIgnored {\n\t/** Cache for parsed .htmlvalidateignore files */\n\tprivate cacheIgnore: Map<string, Ignore | undefined>;\n\n\tpublic constructor() {\n\t\tthis.cacheIgnore = new Map();\n\t}\n\n\t/**\n\t * Searches \".htmlvalidateignore\" files from filesystem and returns `true` if\n\t * one of them contains a pattern matching given filename.\n\t */\n\tpublic isIgnored(filename: string): boolean {\n\t\treturn this.match(filename);\n\t}\n\n\t/**\n\t * Clear cache\n\t */\n\tpublic clearCache(): void {\n\t\tthis.cacheIgnore.clear();\n\t}\n\n\tprivate match(target: string): boolean {\n\t\tlet current = path.dirname(target);\n\n\t\twhile (true) {\n\t\t\tconst relative = path.relative(current, target);\n\t\t\tconst filename = path.join(current, \".htmlvalidateignore\");\n\n\t\t\t/* test filename (relative to the ignore file) against the patterns */\n\t\t\tconst ig = this.parseFile(filename);\n\t\t\tif (ig?.ignores(relative)) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\t/* get the parent directory */\n\t\t\tconst child = current;\n\t\t\tcurrent = path.dirname(current);\n\n\t\t\t/* stop if this is the root directory */\n\t\t\tif (current === child) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tprivate parseFile(filename: string): Ignore | undefined {\n\t\tif (this.cacheIgnore.has(filename)) {\n\t\t\treturn this.cacheIgnore.get(filename);\n\t\t}\n\n\t\tif (!fs.existsSync(filename)) {\n\t\t\tthis.cacheIgnore.set(filename, undefined);\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst content = fs.readFileSync(filename, \"utf-8\");\n\t\tconst ig = ignore().add(content);\n\t\tthis.cacheIgnore.set(filename, ig);\n\t\treturn ig;\n\t}\n}\n","import fs from \"fs\";\nimport deepmerge from \"deepmerge\";\nimport prompts from \"prompts\";\nimport { type ConfigData } from \"..\";\n\n/**\n * @public\n */\nexport interface InitResult {\n\tfilename: string;\n}\n\nexport enum Frameworks {\n\tangularjs = \"AngularJS\",\n\tvuejs = \"Vue.js\",\n\tmarkdown = \"Markdown\",\n}\n\nconst frameworkConfig: Record<string, ConfigData> = {\n\t[Frameworks.angularjs]: {\n\t\ttransform: {\n\t\t\t\"^.*\\\\.js$\": \"html-validate-angular/js\",\n\t\t\t\"^.*\\\\.html$\": \"html-validate-angular/html\",\n\t\t},\n\t},\n\t[Frameworks.vuejs]: {\n\t\tplugins: [\"html-validate-vue\"],\n\t\textends: [\"html-validate-vue:recommended\"],\n\t\ttransform: {\n\t\t\t\"^.*\\\\.vue$\": \"html-validate-vue\",\n\t\t},\n\t},\n\t[Frameworks.markdown]: {\n\t\ttransform: {\n\t\t\t\"^.*\\\\.md$\": \"html-validate-markdown\",\n\t\t},\n\t},\n};\n\nfunction addFrameworks(src: ConfigData, frameworks: string[]): ConfigData {\n\tlet config = src;\n\tfor (const framework of frameworks) {\n\t\tconfig = deepmerge(config, frameworkConfig[framework]);\n\t}\n\treturn config;\n}\n\nfunction writeConfig(dst: string, config: ConfigData): Promise<void> {\n\treturn new Promise((resolve, reject) => {\n\t\tfs.writeFile(dst, JSON.stringify(config, null, 2), (err) => {\n\t\t\tif (err) reject(err);\n\t\t\tresolve();\n\t\t});\n\t});\n}\n\nexport async function init(cwd: string): Promise<InitResult> {\n\tconst filename = `${cwd}/.htmlvalidate.json`;\n\tconst exists = fs.existsSync(filename);\n\tconst initialConfig: ConfigData = {\n\t\telements: [\"html5\"],\n\t\textends: [\"html-validate:recommended\"],\n\t};\n\n\t/* confirm overwrite */\n\tif (exists) {\n\t\tconst result = await prompts({\n\t\t\tname: \"overwrite\",\n\t\t\ttype: \"confirm\",\n\t\t\tmessage: \"A .htmlvalidate.json file already exists, do you want to overwrite it?\",\n\t\t});\n\t\tif (!result.overwrite) {\n\t\t\t/* eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors -- technical debt, should not result in failure at all */\n\t\t\treturn Promise.reject();\n\t\t}\n\t}\n\n\tconst questions: prompts.PromptObject[] = [\n\t\t{\n\t\t\tname: \"frameworks\",\n\t\t\ttype: \"multiselect\",\n\t\t\tchoices: [\n\t\t\t\t{ title: Frameworks.angularjs, value: Frameworks.angularjs },\n\t\t\t\t{ title: Frameworks.vuejs, value: Frameworks.vuejs },\n\t\t\t\t{ title: Frameworks.markdown, value: Frameworks.markdown },\n\t\t\t],\n\t\t\tmessage: \"Support additional frameworks?\",\n\t\t},\n\t];\n\n\t/* prompt user for questions */\n\tconst answers = await prompts(questions);\n\n\t/* write configuration to file */\n\tlet config = initialConfig;\n\tconfig = addFrameworks(config, answers.frameworks as string[]);\n\tawait writeConfig(filename, config);\n\n\treturn {\n\t\tfilename,\n\t};\n}\n","import { type RuleSeverity } from \"../config\";\n\n/**\n * @internal\n */\nexport function parseSeverity(ruleId: string, severity: string): RuleSeverity {\n\tswitch (severity) {\n\t\tcase \"off\":\n\t\tcase \"0\":\n\t\t\treturn \"off\";\n\t\tcase \"warn\":\n\t\tcase \"1\":\n\t\t\treturn \"warn\";\n\t\tcase \"error\":\n\t\tcase \"2\":\n\t\t\treturn \"error\";\n\t\tdefault:\n\t\t\tthrow new Error(`Invalid severity \"${severity}\" for rule \"${ruleId}\"`);\n\t}\n}\n","import { type RuleConfig, type RuleSeverity } from \"../config\";\nimport { parseSeverity } from \"./parse-severity\";\n\nfunction parseItem(value: string): { ruleId: string; severity: RuleSeverity } {\n\tconst [ruleId, severity = \"error\"] = value.split(\":\", 2);\n\treturn { ruleId, severity: parseSeverity(ruleId, severity) };\n}\n\n/**\n * @internal\n */\nexport function getRuleConfig(values: string | string[]): RuleConfig {\n\tif (typeof values === \"string\") {\n\t\treturn getRuleConfig([values]);\n\t}\n\n\treturn values.reduce<RuleConfig>((parsedRules, value) => {\n\t\tconst { ruleId, severity } = parseItem(value.trim());\n\t\treturn { [ruleId]: severity, ...parsedRules };\n\t}, {});\n}\n","import path from \"node:path/posix\";\nimport {\n\ttype ConfigData,\n\ttype ConfigLoader,\n\ttype Report,\n\tFileSystemConfigLoader,\n\tUserError,\n\tHtmlValidate,\n\tesmResolver,\n} from \"..\";\nimport { type ExpandOptions, expandFiles } from \"./expand-files\";\nimport { getFormatter } from \"./formatter\";\nimport { IsIgnored } from \"./is-ignored\";\nimport { type InitResult, init } from \"./init\";\nimport { getRuleConfig } from \"./get-rule-config\";\n\nconst resolver = esmResolver();\n\nfunction defaultConfig(preset: string): ConfigData {\n\tconst presets = preset.split(\",\").map((it) => `html-validate:${it}`);\n\treturn {\n\t\textends: presets,\n\t};\n}\n\n/**\n * @public\n */\nexport interface CLIOptions {\n\tconfigFile?: string;\n\t/** Comma-separated list of presets to use */\n\tpreset?: string;\n\trules?: string | string[];\n}\n\nasync function getBaseConfig(preset?: string, filename?: string): Promise<ConfigData> {\n\tif (filename) {\n\t\tconst configData = await resolver.resolveConfig(path.resolve(filename), { cache: false });\n\t\tif (!configData) {\n\t\t\tthrow new UserError(`Failed to read configuration from \"${filename}\"`);\n\t\t}\n\t\treturn configData;\n\t} else {\n\t\treturn defaultConfig(preset ?? \"recommended\");\n\t}\n}\n\n/**\n * @public\n */\nexport class CLI {\n\tprivate options: CLIOptions;\n\tprivate config: ConfigData | null;\n\tprivate loader: ConfigLoader | null;\n\tprivate ignored: IsIgnored;\n\n\t/**\n\t * Create new CLI helper.\n\t *\n\t * Can be used to create tooling with similar properties to bundled CLI\n\t * script.\n\t */\n\tpublic constructor(options?: CLIOptions) {\n\t\tthis.options = options ?? {};\n\t\tthis.config = null;\n\t\tthis.loader = null;\n\t\tthis.ignored = new IsIgnored();\n\t}\n\n\t/**\n\t * Returns list of files matching patterns and are not ignored. Filenames will\n\t * have absolute paths.\n\t *\n\t * @public\n\t */\n\tpublic async expandFiles(patterns: string[], options: ExpandOptions = {}): Promise<string[]> {\n\t\t/* technical debt: expandFiles(..) should actually be async as well */\n\t\tconst files = expandFiles(patterns, options).filter((filename) => !this.isIgnored(filename));\n\t\treturn Promise.resolve(files);\n\t}\n\n\tpublic getFormatter(formatters: string): Promise<(report: Report) => string> {\n\t\t/* while not actually async the API boundary returns a Promise in case it needs to in the future, i.e a ESM-based formatter */\n\t\treturn Promise.resolve(getFormatter(formatters));\n\t}\n\n\t/**\n\t * Initialize project with a new configuration.\n\t *\n\t * A new `.htmlvalidate.json` file will be placed in the path provided by\n\t * `cwd`.\n\t */\n\tpublic init(cwd: string): Promise<InitResult> {\n\t\treturn init(cwd);\n\t}\n\n\t/**\n\t * Clear cache.\n\t *\n\t * Previously fetched [[HtmlValidate]] instances must either be fetched again\n\t * or call [[HtmlValidate.flushConfigCache]].\n\t */\n\t/* istanbul ignore next: each method is tested separately */\n\tpublic clearCache(): Promise<void> {\n\t\tif (this.loader) {\n\t\t\tthis.loader.flushCache();\n\t\t}\n\t\tthis.ignored.clearCache();\n\t\treturn Promise.resolve();\n\t}\n\n\t/**\n\t * Get HtmlValidate instance with configuration based on options passed to the\n\t * constructor.\n\t *\n\t * @internal\n\t */\n\tpublic async getLoader(): Promise<ConfigLoader> {\n\t\tif (!this.loader) {\n\t\t\tconst config = await this.getConfig();\n\t\t\tthis.loader = new FileSystemConfigLoader([resolver], config);\n\t\t}\n\t\treturn this.loader;\n\t}\n\n\t/**\n\t * Get HtmlValidate instance with configuration based on options passed to the\n\t * constructor.\n\t *\n\t * @public\n\t */\n\tpublic async getValidator(): Promise<HtmlValidate> {\n\t\tconst loader = await this.getLoader();\n\t\treturn new HtmlValidate(loader);\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tpublic async getConfig(): Promise<ConfigData> {\n\t\tthis.config ??= await this.resolveConfig();\n\t\treturn this.config;\n\t}\n\n\t/**\n\t * Searches \".htmlvalidateignore\" files from filesystem and returns `true` if\n\t * one of them contains a pattern matching given filename.\n\t */\n\tprivate isIgnored(filename: string): boolean {\n\t\treturn this.ignored.isIgnored(filename);\n\t}\n\n\tprivate async resolveConfig(): Promise<ConfigData> {\n\t\tconst { options } = this;\n\t\tconst havePreset = Boolean(options.preset);\n\t\tconst haveConfig = Boolean(options.configFile);\n\t\tconst config = await getBaseConfig(options.preset, options.configFile);\n\t\tif (options.rules) {\n\t\t\tif (havePreset || haveConfig) {\n\t\t\t\t/* when rules are explicitly specified and combined with an explicit\n\t\t\t\t * preset or configuration file we merge the result as the user would\n\t\t\t\texpect rules from the preset or configuration files to be used */\n\t\t\t\tconfig.rules = { ...config.rules, ...getRuleConfig(options.rules) };\n\t\t\t} else {\n\t\t\t\t/* if neither an explicit configuration file or preset is passed as a\n\t\t\t\t * CLI argument a default configuration is loaded but since the user has\n\t\t\t\t * specified one or more rules explicitly we overwrite both the default\n\t\t\t\t * preset and the default rules with the explicit rules */\n\t\t\t\tconfig.extends = [];\n\t\t\t\tconfig.rules = getRuleConfig(options.rules);\n\t\t\t}\n\t\t}\n\t\treturn config;\n\t}\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport betterAjvErrors from \"@sidvind/better-ajv-errors\";\nimport kleur from \"kleur\";\nimport { type SchemaValidationError } from \"../../error\";\n\nfunction prettyError(err: SchemaValidationError): string {\n\tlet json: string | undefined;\n\tif (err.filename && fs.existsSync(err.filename)) {\n\t\tjson = fs.readFileSync(err.filename, \"utf-8\");\n\t}\n\treturn betterAjvErrors(err.schema, err.obj, err.errors, {\n\t\tformat: \"cli\",\n\t\tindent: 2,\n\t\tjson,\n\t});\n}\n\n/**\n * @internal\n */\nexport function handleSchemaValidationError(console: Console, err: SchemaValidationError): void {\n\tif (err.filename) {\n\t\tconst filename = path.relative(process.cwd(), err.filename);\n\t\tconsole.error(kleur.red(`A configuration error was found in \"${filename}\":`));\n\t} else {\n\t\tconsole.error(kleur.red(`A configuration error was found:`));\n\t}\n\tconsole.group();\n\t{\n\t\tconsole.error(prettyError(err));\n\t}\n\tconsole.groupEnd();\n}\n","import kleur from \"kleur\";\nimport { UserError } from \"../../error\";\nimport { engines } from \"../../../package.json\";\n\n/**\n * @internal\n */\nexport class ImportResolveMissingError extends UserError {\n\tpublic constructor() {\n\t\tconst message = `import.meta.resolve(..) is not available on this system`;\n\t\tsuper(message);\n\t\tError.captureStackTrace(this, ImportResolveMissingError);\n\t\tthis.name = ImportResolveMissingError.name;\n\t}\n\n\tpublic prettyFormat(): string {\n\t\tconst { message } = this;\n\t\tconst currentVersion = process.version;\n\t\tconst requiredVersion = engines.node\n\t\t\t.split(\"||\")\n\t\t\t.map((it) => `v${it.replace(/^[^\\d]+/, \"\").trim()}`);\n\t\treturn [\n\t\t\tkleur.red(`Error: ${message}.`),\n\t\t\t\"\",\n\t\t\t`Either ensure you are running a supported NodeJS version:`,\n\t\t\t` Current: ${currentVersion}`,\n\t\t\t` Required: ${requiredVersion.join(\", \")}, or later`,\n\t\t\t`Or set NODE_OPTIONS=\"--experimental-import-meta-resolve\"`,\n\t\t].join(\"\\n\");\n\t}\n}\n","/**\n * @internal\n */\nexport enum Mode {\n\tLINT,\n\tINIT,\n\tDUMP_EVENTS,\n\tDUMP_TOKENS,\n\tDUMP_TREE,\n\tDUMP_SOURCE,\n\tPRINT_CONFIG,\n}\n\n/**\n * @internal\n */\nexport function modeToFlag(mode: Mode.LINT): null;\nexport function modeToFlag(mode: Exclude<Mode, Mode.LINT>): string;\nexport function modeToFlag(mode: Mode): string | null {\n\tswitch (mode) {\n\t\tcase Mode.LINT:\n\t\t\treturn null;\n\t\tcase Mode.INIT:\n\t\t\treturn \"--init\";\n\t\tcase Mode.DUMP_EVENTS:\n\t\t\treturn \"--dump-events\";\n\t\tcase Mode.DUMP_TOKENS:\n\t\t\treturn \"--dump-tokens\";\n\t\tcase Mode.DUMP_TREE:\n\t\t\treturn \"--dump-tree\";\n\t\tcase Mode.DUMP_SOURCE:\n\t\t\treturn \"--dump-source\";\n\t\tcase Mode.PRINT_CONFIG:\n\t\t\treturn \"--print-config\";\n\t}\n}\n","import kleur from \"kleur\";\nimport { type HtmlValidate, type Report, type Result, Reporter } from \"../..\";\nimport { type WritableStreamLike } from \"../writable-stream-like\";\n\nexport interface LintOptions {\n\tformatter: (report: Report) => string;\n\tmaxWarnings: number;\n\tstdinFilename: false | string;\n}\n\nfunction renameStdin(report: Report, filename: string): void {\n\tconst stdin = report.results.find((cur: Result) => cur.filePath === \"/dev/stdin\");\n\tif (stdin) {\n\t\tstdin.filePath = filename;\n\t}\n}\n\nexport async function lint(\n\thtmlvalidate: HtmlValidate,\n\toutput: WritableStreamLike,\n\tfiles: string[],\n\toptions: LintOptions,\n): Promise<boolean> {\n\tconst reports: Report[] = [];\n\tfor (const filename of files) {\n\t\ttry {\n\t\t\treports.push(await htmlvalidate.validateFile(filename));\n\t\t} catch (err) {\n\t\t\tconst message = kleur.red(`Validator crashed when parsing \"${filename}\"`);\n\t\t\toutput.write(`${message}\\n`);\n\t\t\tthrow err;\n\t\t}\n\t}\n\n\tconst merged = Reporter.merge(reports);\n\n\t/* rename stdin if an explicit filename was passed */\n\tif (options.stdinFilename) {\n\t\trenameStdin(merged, options.stdinFilename);\n\t}\n\n\toutput.write(options.formatter(merged));\n\n\tif (options.maxWarnings >= 0 && merged.warningCount > options.maxWarnings) {\n\t\toutput.write(\n\t\t\t`\\nhtml-validate found too many warnings (maximum: ${String(options.maxWarnings)}).\\n`,\n\t\t);\n\t\treturn false;\n\t}\n\n\treturn merged.valid;\n}\n","import { type CLI } from \"../cli\";\nimport { type WritableStreamLike } from \"../writable-stream-like\";\n\nexport interface InitOptions {\n\tcwd: string;\n}\n\nexport async function init(\n\tcli: CLI,\n\toutput: WritableStreamLike,\n\toptions: InitOptions,\n): Promise<boolean> {\n\tconst result = await cli.init(options.cwd);\n\toutput.write(`Configuration written to \"${result.filename}\"\\n`);\n\treturn true;\n}\n","import { type HtmlValidate } from \"../..\";\nimport { type WritableStreamLike } from \"../writable-stream-like\";\n\nexport async function printConfig(\n\thtmlvalidate: HtmlValidate,\n\toutput: WritableStreamLike,\n\tfiles: string[],\n): Promise<boolean> {\n\tif (files.length > 1) {\n\t\toutput.write(`\\`--print-config\\` expected a single filename but got multiple:\\n\\n`);\n\t\tfor (const filename of files) {\n\t\t\toutput.write(` - ${filename}\\n`);\n\t\t}\n\t\toutput.write(\"\\n\");\n\t\treturn false;\n\t}\n\tconst config = await htmlvalidate.getConfigFor(files[0]);\n\tconst json = JSON.stringify(config.getConfigData(), null, 2);\n\toutput.write(`${json}\\n`);\n\treturn true;\n}\n","import { type EventDump, type Location } from \"..\";\n\nconst jsonIgnored = [\n\t\"annotation\",\n\t\"blockedRules\",\n\t\"cache\",\n\t\"closed\",\n\t\"depth\",\n\t\"disabledRules\",\n\t\"nodeType\",\n\t\"unique\",\n\t\"voidElement\",\n];\nconst jsonFiltered = [\n\t\"childNodes\",\n\t\"children\",\n\t\"data\",\n\t\"meta\",\n\t\"metaElement\",\n\t\"originalData\",\n\t\"parent\",\n];\n\nfunction isLocation(key: string, value: unknown): value is Location {\n\treturn Boolean(value && (key === \"location\" || key.endsWith(\"Location\")));\n}\n\nfunction isIgnored(key: string): boolean {\n\treturn Boolean(key.startsWith(\"_\") || jsonIgnored.includes(key));\n}\n\nfunction isFiltered(key: string, value: unknown): boolean {\n\treturn Boolean(value && jsonFiltered.includes(key));\n}\n\nexport function eventReplacer<T>(this: void, key: string, value: T): T | string | undefined {\n\tif (isLocation(key, value)) {\n\t\tconst filename = value.filename;\n\t\tconst line = String(value.line);\n\t\tconst column = String(value.column);\n\t\treturn `${filename}:${line}:${column}`;\n\t}\n\tif (isIgnored(key)) {\n\t\treturn undefined;\n\t}\n\tif (isFiltered(key, value)) {\n\t\treturn \"[truncated]\";\n\t}\n\treturn value;\n}\n\nexport function eventFormatter(entry: EventDump): string {\n\tconst strdata = JSON.stringify(entry.data, eventReplacer, 2);\n\treturn `${entry.event}: ${strdata}`;\n}\n","import { type HtmlValidate, type TokenDump } from \"../..\";\nimport { eventFormatter } from \"../json\";\nimport { Mode } from \"../mode\";\nimport { type WritableStreamLike } from \"../writable-stream-like\";\n\nexport async function dump(\n\thtmlvalidate: HtmlValidate,\n\toutput: WritableStreamLike,\n\tfiles: string[],\n\tmode: Mode,\n): Promise<boolean> {\n\tlet lines: Array<Promise<string[]>>;\n\tswitch (mode) {\n\t\tcase Mode.DUMP_EVENTS:\n\t\t\tlines = files.map(async (filename: string) => {\n\t\t\t\tconst lines = await htmlvalidate.dumpEvents(filename);\n\t\t\t\treturn lines.map(eventFormatter);\n\t\t\t});\n\t\t\tbreak;\n\t\tcase Mode.DUMP_TOKENS:\n\t\t\tlines = files.map(async (filename: string) => {\n\t\t\t\tconst lines = await htmlvalidate.dumpTokens(filename);\n\t\t\t\treturn lines.map((entry: TokenDump) => {\n\t\t\t\t\tconst data = JSON.stringify(entry.data);\n\t\t\t\t\treturn `TOKEN: ${entry.token}\\n Data: ${data}\\n Location: ${entry.location}`;\n\t\t\t\t});\n\t\t\t});\n\t\t\tbreak;\n\t\tcase Mode.DUMP_TREE:\n\t\t\tlines = files.map((filename: string) => htmlvalidate.dumpTree(filename));\n\t\t\tbreak;\n\t\tcase Mode.DUMP_SOURCE:\n\t\t\tlines = files.map((filename: string) => htmlvalidate.dumpSource(filename));\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tthrow new Error(`Unknown mode \"${String(mode)}\"`);\n\t}\n\tconst flat = (await Promise.all(lines)).reduce((s: string[], c: string[]) => s.concat(c), []);\n\toutput.write(flat.join(\"\\n\"));\n\toutput.write(\"\\n\");\n\treturn Promise.resolve(true);\n}\n","/**\n * @internal\n */\nexport function haveImportMetaResolve(): boolean {\n\treturn \"resolve\" in import.meta;\n}\n"],"names":["formatterFactory","fn","init","path","fs","Mode","lines"],"mappings":";;;;;;;;;;;;AAIA,MAAM,kBAAA,GAAqB,CAAC,MAAM,CAAA;AAkBlC,SAAS,YAAY,QAAA,EAA2B;AAC/C,EAAA,MAAM,EAAA,GAAK,EAAA,CAAG,QAAA,CAAS,QAAQ,CAAA;AAC/B,EAAA,OAAO,GAAG,WAAA,EA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