html-validate 9.5.1 → 9.5.3

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.
@@ -1 +1 @@
1
- {"version":3,"file":"jest-diff.js","sources":["../../src/jest/utils/diff.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/ban-ts-comment, @typescript-eslint/no-unnecessary-condition --\n * this code needs to work with multiple different versions of jest and it does\n * verification of which one is actually present but the other variants will\n * cause errors, as is expected */\n\nimport jestDiffDefault, * as jestDiff from \"jest-diff\";\n\n/**\n * @internal\n */\nexport interface DiffOptions {\n\taAnnotation?: string;\n\tbAnnotation?: string;\n\texpand?: boolean;\n}\n\n/**\n * @internal\n */\nexport type DiffFunction = (a: any, b: any, options?: DiffOptions) => string | null;\n\n/* ignore typing for compatibility so it will seem \"impossible\" but different\n * version will yield different source */\n/* istanbul ignore next: this is covered by integration tests */\nconst diffCandidates: Array<DiffFunction | undefined> = [\n\t// @ts-ignore\n\tjestDiffDefault?.diff,\n\t// @ts-ignore\n\tjestDiffDefault,\n\t// @ts-ignore\n\tjestDiff?.diff,\n\t// @ts-ignore\n\tjestDiff,\n];\n\nconst isFunction = (fn: unknown): boolean => typeof fn === \"function\";\n\n/* eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- assume\n * one of the candidate matches, there will be a reasonable error later on if\n * not */\nexport const diff: DiffFunction = diffCandidates.find(isFunction)!;\n"],"names":["jestDiffDefault","jestDiff"],"mappings":";;;AAwBA,MAAM,cAAkD,GAAA;AAAA;AAAA,EAEvDA,wBAAiB,EAAA,IAAA;AAAA;AAAA,EAEjBA,wBAAA;AAAA;AAAA,EAEAC,eAAU,EAAA,IAAA;AAAA;AAAA,EAEVA;AACD,CAAA;AAEA,MAAM,UAAa,GAAA,CAAC,EAAyB,KAAA,OAAO,EAAO,KAAA,UAAA;AAK9C,MAAA,IAAA,GAAqB,cAAe,CAAA,IAAA,CAAK,UAAU;;;;"}
1
+ {"version":3,"file":"jest-diff.js","sources":["../../src/jest/utils/diff.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/ban-ts-comment --\n * this code needs to work with multiple different versions of jest and it does\n * verification of which one is actually present but the other variants will\n * cause errors, as is expected */\n\nimport jestDiffDefault, * as jestDiff from \"jest-diff\";\n\n/**\n * @internal\n */\nexport interface DiffOptions {\n\taAnnotation?: string;\n\tbAnnotation?: string;\n\texpand?: boolean;\n}\n\n/**\n * @internal\n */\nexport type DiffFunction = (a: any, b: any, options?: DiffOptions) => string | null;\n\n/* ignore typing for compatibility so it will seem \"impossible\" but different\n * version will yield different source */\n/* istanbul ignore next: this is covered by integration tests */\nconst diffCandidates: Array<DiffFunction | undefined> = [\n\t// @ts-ignore\n\tjestDiffDefault?.diff,\n\t// @ts-ignore\n\tjestDiffDefault,\n\t// @ts-ignore\n\tjestDiff?.diff,\n\t// @ts-ignore\n\tjestDiff,\n];\n\nconst isFunction = (fn: unknown): boolean => typeof fn === \"function\";\n\n/* eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- assume\n * one of the candidate matches, there will be a reasonable error later on if\n * not */\nexport const diff: DiffFunction = diffCandidates.find(isFunction)!;\n"],"names":["jestDiffDefault","jestDiff"],"mappings":";;;AAwBA,MAAM,cAAkD,GAAA;AAAA;AAAA,EAEvDA,wBAAiB,EAAA,IAAA;AAAA;AAAA,EAEjBA,wBAAA;AAAA;AAAA,EAEAC,eAAU,EAAA,IAAA;AAAA;AAAA,EAEVA;AACD,CAAA;AAEA,MAAM,UAAa,GAAA,CAAC,EAAyB,KAAA,OAAO,EAAO,KAAA,UAAA;AAK9C,MAAA,IAAA,GAAqB,cAAe,CAAA,IAAA,CAAK,UAAU;;;;"}
@@ -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\t\t\t// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- modified by handleAbortMessage\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,UAAY,EAAA;AAChB,IAAA;AAAA;AAGD,EAAM,MAAA,EAAE,UAAY,EAAA,YAAA,EAAiB,GAAA,UAAA;AACrC,EAAA,MAAM,gBAAmB,GAAA,IAAI,UAAW,CAAA,YAAA,EAAc,GAAG,CAAC,CAAA;AAG1D,EAAA,UAAA,CAAY,GAAG,SAAW,EAAA,CAAC,EAAE,EAAA,EAAI,MAA+C,KAAA;AAC/E,IAAA,eAAe,KAAuB,GAAA;AACrC,MAAA,IAAI,SAAY,GAAA,KAAA;AAChB,MAAM,MAAA,kBAAA,GAAqB,CAACA,IAA0C,KAAA;AACrE,QAAA,IAAIA,IAAI,CAAA,EAAA,KAAO,EAAMA,IAAAA,IAAAA,CAAI,QAAQ,OAAS,EAAA;AACzC,UAAY,SAAA,GAAA,IAAA;AAAA;AACb,OACD;AACA,MAAW,UAAA,CAAA,EAAA,CAAG,WAAW,kBAAkB,CAAA;AAC3C,MAAI,IAAA,GAAA;AACJ,MAAI,IAAA;AACH,QAAA,GAAA,GAAM,EAAE,EAAI,EAAA,MAAA,EAAQ,MAAM,EAAG,CAAA,GAAG,IAAI,CAAE,EAAA;AAAA,eAC9B,KAAgB,EAAA;AACxB,QAAM,GAAA,GAAA;AAAA,UACL,EAAA;AAAA,UACA,OAAO,KAAiB,YAAA,KAAA,GAAQ,KAAM,CAAA,OAAA,GAAU,OAAO,KAAK;AAAA,SAC7D;AAAA;AAED,MAAW,UAAA,CAAA,GAAA,CAAI,WAAW,kBAAkB,CAAA;AAE5C,MAAA,IAAI,SAAW,EAAA;AACd,QAAA;AAAA;AAED,MAAA,UAAA,CAAW,YAAY,GAAG,CAAA;AAC1B,MAAQ,OAAA,CAAA,GAAA,CAAI,gBAAkB,EAAA,CAAA,EAAG,CAAC,CAAA;AAClC,MAAQ,OAAA,CAAA,MAAA,CAAO,kBAAkB,CAAC,CAAA;AAAA;AAGnC,IAAM,KAAA,EAAA;AAAA,GACN,CAAA;AACF;AAEA,SAAS,cAAA,CAAe,MAAgB,EAAA,QAAA,EAAkB,MAAqC,EAAA;AAC9F,EAAM,MAAA,MAAA,GAAS,IAAI,sBAAuB,CAAA;AAAA,IACzC,OAAA,EAAS,CAAC,2BAA2B;AAAA,GACrC,CAAA;AACD,EAAM,MAAA,YAAA,GAAe,IAAI,YAAA,CAAa,MAAM,CAAA;AAC5C,EAAA,OAAO,YAAa,CAAA,cAAA,CAAe,MAAQ,EAAA,QAAA,EAAU,MAAM,CAAA;AAC5D;AAIA,WAAA,CAAY,cAAc,CAAA"}
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,UAAY,EAAA;AAChB,IAAA;AAAA;AAGD,EA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F,EAAM,MAAA,MAAA,GAAS,IAAI,sBAAuB,CAAA;AAAA,IACzC,OAAA,EAAS,CAAC,2BAA2B;AAAA,GACrC,CAAA;AACD,EAAM,MAAA,YAAA,GAAe,IAAI,YAAA,CAAa,MAAM,CAAA;AAC5C,EAAA,OAAO,YAAa,CAAA,cAAA,CAAe,MAAQ,EAAA,QAAA,EAAU,MAAM,CAAA;AAC5D;AAIA,WAAA,CAAY,cAAc,CAAA"}
@@ -30,7 +30,7 @@ function isWorkerError(value) {
30
30
  return "error" in value;
31
31
  }
32
32
  function receiveMessageWithId(port, expectedId) {
33
- const timeout = 1e4;
33
+ const timeout = 3e4;
34
34
  const status = Atomics.wait(sharedBufferView, 0, 0, timeout);
35
35
  Atomics.store(sharedBufferView, 0, 0);
36
36
  if (!["ok", "not-equal"].includes(status)) {
@@ -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 = 10000;\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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,IAAM,EAAA,KAAA;AAAA,IACN,UAAA,EAAY,EAAE,YAAA,EAAc,UAAW,EAAA;AAAA,IACvC,YAAA,EAAc,CAAC,UAAU;AAAA,GACzB,CAAA;AAED,EAAA,IAAI,MAAS,GAAA,CAAA;AAEb,EAAM,MAAA,MAAA,GAAS,IAAI,IAA2B,KAAA;AAC7C,IAAA,MAAM,EAAK,GAAA,MAAA,EAAA;AACX,IAAM,MAAA,GAAA,GAA0C,EAAE,EAAA,EAAI,IAAK,EAAA;AAE3D,IAAA,MAAA,CAAO,YAAY,GAAG,CAAA;AAEtB,IAAM,MAAA,KAAA,GAAQ,oBAAwB,CAAA,QAAA,EAAU,EAAE,CAAA;AAElD,IAAI,IAAA,aAAA,CAAc,KAAK,CAAG,EAAA;AACzB,MAAM,MAAA,IAAI,KAAM,CAAA,KAAA,CAAM,KAAK,CAAA;AAAA;AAG5B,IAAA,OAAO,KAAM,CAAA,MAAA;AAAA,GACd;AAEA,EAAA,MAAA,CAAO,KAAM,EAAA;AAEb,EAAO,OAAA,MAAA;AACR;AAEO,SAAS,aAAmD,UAAgC,EAAA;AAClG,EAAM,MAAA,YAAA,GAAe,WAAY,CAAA,GAAA,CAAI,UAAU,CAAA;AAC/C,EAAA,IAAI,YAAc,EAAA;AACjB,IAAO,OAAA,YAAA;AAAA;AAGR,EAAM,MAAA,MAAA,GAAS,kBAAwB,UAAU,CAAA;AACjD,EAAY,WAAA,CAAA,GAAA,CAAI,YAAY,MAAM,CAAA;AAClC,EAAO,OAAA,MAAA;AACR;;;;"}
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,KAA4C,EAAA;AACzE,EAAO,OAAA,KAAA,IAAS,OAAO,KAAU,KAAA,QAAA,IAAY,UAAU,KAAS,IAAA,OAAO,MAAM,IAAS,KAAA,UAAA;AACvF;;ACyBO,SAAS,QACf,EAC+B,EAAA;AAO/B,EAAS,SAAA,QAAA,CAER,WACG,IACsC,EAAA;AACzC,IAAI,IAAA,UAAA,CAAW,MAAM,CAAG,EAAA;AACvB,MAAO,OAAA,MAAA,CAAO,IAAK,CAAA,CAAC,QAAa,KAAA,EAAA,CAAG,KAAK,IAAM,EAAA,QAAA,EAAU,GAAG,IAAI,CAAC,CAAA;AAAA,KAC3D,MAAA;AACN,MAAA,OAAO,EAAG,CAAA,IAAA,CAAK,IAAM,EAAA,MAAA,EAAQ,GAAG,IAAI,CAAA;AAAA;AACrC;AAED,EAAO,OAAA,QAAA;AACR;;AC7CO,SAAS,gBAAgB,MAA2B,EAAA;AAC1D,EAAA,OAAO,MAAO,CAAA,OAAA,CAAQ,MAAO,CAAA,CAAC,YAAuB,MAAmB,KAAA;AACvE,IAAO,OAAA,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A,YAAA;AAAA;AAGR,EAAM,MAAA,MAAA,GAAS,kBAAwB,UAAU,CAAA;AACjD,EAAY,WAAA,CAAA,GAAA,CAAI,YAAY,MAAM,CAAA;AAClC,EAAO,OAAA,MAAA;AACR;;;;"}
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.52.1"
8
+ "packageVersion": "7.52.3"
9
9
  }
10
10
  ]
11
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "html-validate",
3
- "version": "9.5.1",
3
+ "version": "9.5.3",
4
4
  "description": "Offline html5 validator",
5
5
  "keywords": [
6
6
  "html",