mcp-web-validator 1.3.55 → 1.3.57
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/CHANGELOG.md +23 -0
- package/README.md +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/nu-ephemeral.d.ts +2 -0
- package/dist/nu-ephemeral.js +124 -0
- package/dist/nu-ephemeral.js.map +1 -0
- package/dist/presentation.d.ts +2 -2
- package/dist/presentation.js +19 -8
- package/dist/presentation.js.map +1 -1
- package/dist/w3c-validator.js +18 -5
- package/dist/w3c-validator.js.map +1 -1
- package/docs/reliability-engines-20261123.md +156 -0
- package/package.json +5 -2
- package/scripts/deep-audit-optional.mjs +191 -0
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { lstat, realpath } from "node:fs/promises";
|
|
3
|
+
import { createServer } from "node:net";
|
|
4
|
+
import * as path from "node:path";
|
|
5
|
+
import { setTimeout as delay } from "node:timers/promises";
|
|
6
|
+
/** One local Nu instance, on demand only. Never starts a background daemon. */
|
|
7
|
+
let busy = false;
|
|
8
|
+
// Java 25 cold startup on Windows with Defender/contended storage took >20s
|
|
9
|
+
// in a concurrent real-engine suite. This remains bounded, on-demand only.
|
|
10
|
+
const STARTUP_DEADLINE_MS = 40_000;
|
|
11
|
+
async function availableLoopbackPort() {
|
|
12
|
+
const server = createServer();
|
|
13
|
+
try {
|
|
14
|
+
await new Promise((resolve, reject) => {
|
|
15
|
+
server.once("error", reject);
|
|
16
|
+
server.listen(0, "127.0.0.1", () => resolve());
|
|
17
|
+
});
|
|
18
|
+
const address = server.address();
|
|
19
|
+
if (!address || typeof address === "string")
|
|
20
|
+
throw new Error("No loopback port");
|
|
21
|
+
return address.port;
|
|
22
|
+
}
|
|
23
|
+
finally {
|
|
24
|
+
if (server.listening) {
|
|
25
|
+
await new Promise((resolve) => server.close(() => resolve()));
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
async function trustedJavaExecutable(configured) {
|
|
30
|
+
if (!path.isAbsolute(configured)
|
|
31
|
+
|| !["java.exe", "java"].includes(path.basename(configured).toLowerCase())) {
|
|
32
|
+
throw new Error("Local Nu Java path must point to an absolute java executable");
|
|
33
|
+
}
|
|
34
|
+
const information = await lstat(configured);
|
|
35
|
+
if (!information.isFile() || information.isSymbolicLink()) {
|
|
36
|
+
throw new Error("Local Nu Java path must be a regular executable");
|
|
37
|
+
}
|
|
38
|
+
return realpath(configured);
|
|
39
|
+
}
|
|
40
|
+
/** Executes Java 17+ Nu in private ephemeral Jetty bound to literal loopback. */
|
|
41
|
+
export async function withEphemeralNuChecker(javaExecutable, action) {
|
|
42
|
+
if (busy)
|
|
43
|
+
throw new Error("Local Nu Checker is already running; retry checks serially");
|
|
44
|
+
busy = true;
|
|
45
|
+
let child;
|
|
46
|
+
try {
|
|
47
|
+
const javaPath = await trustedJavaExecutable(javaExecutable);
|
|
48
|
+
const port = await availableLoopbackPort();
|
|
49
|
+
// Do not forward credentials, proxies or user-controlled Java options.
|
|
50
|
+
const env = {};
|
|
51
|
+
for (const key of ["SystemRoot", "WINDIR", "PATH", "Path", "TEMP", "TMP"]) {
|
|
52
|
+
if (process.env[key])
|
|
53
|
+
env[key] = process.env[key];
|
|
54
|
+
}
|
|
55
|
+
child = spawn(javaPath, [
|
|
56
|
+
"-Xmx256m",
|
|
57
|
+
"-Djava.awt.headless=true",
|
|
58
|
+
"-Dnu.validator.servlet.bind-address=127.0.0.1",
|
|
59
|
+
"-Dnu.validator.servlet.allow-forbidden-hosts=false",
|
|
60
|
+
"-m", "vnu/nu.validator.servlet.Main", String(port),
|
|
61
|
+
], { shell: false, windowsHide: true, stdio: "ignore", env });
|
|
62
|
+
let spawnError;
|
|
63
|
+
child.once("error", (error) => { spawnError = error; });
|
|
64
|
+
const url = "http://127.0.0.1:" + port + "/?out=json";
|
|
65
|
+
const deadline = Date.now() + STARTUP_DEADLINE_MS;
|
|
66
|
+
let ready = false;
|
|
67
|
+
let lastStatus = "not-attempted";
|
|
68
|
+
while (Date.now() < deadline) {
|
|
69
|
+
if (spawnError)
|
|
70
|
+
throw new Error("Nu Java process did not start");
|
|
71
|
+
if (child.exitCode !== null)
|
|
72
|
+
throw new Error("Nu Java process exited before readiness");
|
|
73
|
+
try {
|
|
74
|
+
const response = await fetch(url, {
|
|
75
|
+
method: "POST",
|
|
76
|
+
headers: { "Content-Type": "text/html; charset=utf-8" },
|
|
77
|
+
body: "<!doctype html><html lang=\"en\"><title>Nu readiness</title></html>",
|
|
78
|
+
redirect: "error",
|
|
79
|
+
signal: AbortSignal.timeout(1_000),
|
|
80
|
+
});
|
|
81
|
+
await response.body?.cancel();
|
|
82
|
+
lastStatus = String(response.status);
|
|
83
|
+
if (response.ok) {
|
|
84
|
+
ready = true;
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
catch (cause) {
|
|
89
|
+
lastStatus = cause instanceof Error ? cause.name : "unknown";
|
|
90
|
+
}
|
|
91
|
+
await delay(250);
|
|
92
|
+
}
|
|
93
|
+
if (!ready) {
|
|
94
|
+
throw new Error("Nu Java process did not become ready within 40 seconds (HTTP " + lastStatus + ")");
|
|
95
|
+
}
|
|
96
|
+
return await action(url);
|
|
97
|
+
}
|
|
98
|
+
finally {
|
|
99
|
+
if (child) {
|
|
100
|
+
if (child.exitCode === null)
|
|
101
|
+
child.kill();
|
|
102
|
+
if (child.exitCode === null) {
|
|
103
|
+
await new Promise((resolve) => {
|
|
104
|
+
let finished = false;
|
|
105
|
+
const finish = () => {
|
|
106
|
+
if (finished)
|
|
107
|
+
return;
|
|
108
|
+
finished = true;
|
|
109
|
+
resolve();
|
|
110
|
+
};
|
|
111
|
+
child.once("exit", finish);
|
|
112
|
+
const timeout = setTimeout(() => {
|
|
113
|
+
if (child.exitCode === null)
|
|
114
|
+
child.kill("SIGKILL");
|
|
115
|
+
finish();
|
|
116
|
+
}, 1_500);
|
|
117
|
+
timeout.unref();
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
busy = false;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=nu-ephemeral.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nu-ephemeral.js","sourceRoot":"","sources":["../src/nu-ephemeral.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,UAAU,IAAI,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAE3D,+EAA+E;AAC/E,IAAI,IAAI,GAAG,KAAK,CAAC;AACjB,4EAA4E;AAC5E,2EAA2E;AAC3E,MAAM,mBAAmB,GAAG,MAAM,CAAC;AAEnC,KAAK,UAAU,qBAAqB;IAClC,MAAM,MAAM,GAAG,YAAY,EAAE,CAAC;IAC9B,IAAI,CAAC;QACH,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC1C,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;YAC7B,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;QACjD,CAAC,CAAC,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC;QACjC,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ;YAAE,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;QACjF,OAAO,OAAO,CAAC,IAAI,CAAC;IACtB,CAAC;YAAS,CAAC;QACT,IAAI,MAAM,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QAAQ,KAAK,IAAI;4BAAE,KAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;wBACrD,MAAM,EAAE,CAAC;oBACX,CAAC,EAAE,KAAK,CAAC,CAAC;oBACV,OAAO,CAAC,KAAK,EAAE,CAAC;gBAClB,CAAC,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QACD,IAAI,GAAG,KAAK,CAAC;IACf,CAAC;AACH,CAAC","sourcesContent":["import { spawn } from \"node:child_process\";\nimport { lstat, realpath } from \"node:fs/promises\";\nimport { createServer } from \"node:net\";\nimport * as path from \"node:path\";\nimport { setTimeout as delay } from \"node:timers/promises\";\n\n/** One local Nu instance, on demand only. Never starts a background daemon. */\nlet busy = false;\n// Java 25 cold startup on Windows with Defender/contended storage took >20s\n// in a concurrent real-engine suite. This remains bounded, on-demand only.\nconst STARTUP_DEADLINE_MS = 40_000;\n\nasync function availableLoopbackPort(): Promise<number> {\n const server = createServer();\n try {\n await new Promise<void>((resolve, reject) => {\n server.once(\"error\", reject);\n server.listen(0, \"127.0.0.1\", () => resolve());\n });\n const address = server.address();\n if (!address || typeof address === \"string\") throw new Error(\"No loopback port\");\n return address.port;\n } finally {\n if (server.listening) {\n await new Promise<void>((resolve) => server.close(() => resolve()));\n }\n }\n}\n\nasync function trustedJavaExecutable(configured: string): Promise<string> {\n if (!path.isAbsolute(configured)\n || ![\"java.exe\", \"java\"].includes(path.basename(configured).toLowerCase())) {\n throw new Error(\"Local Nu Java path must point to an absolute java executable\");\n }\n const information = await lstat(configured);\n if (!information.isFile() || information.isSymbolicLink()) {\n throw new Error(\"Local Nu Java path must be a regular executable\");\n }\n return realpath(configured);\n}\n\n/** Executes Java 17+ Nu in private ephemeral Jetty bound to literal loopback. */\nexport async function withEphemeralNuChecker<T>(\n javaExecutable: string,\n action: (localUrl: string) => Promise<T>,\n): Promise<T> {\n if (busy) throw new Error(\"Local Nu Checker is already running; retry checks serially\");\n busy = true;\n let child: ReturnType<typeof spawn> | undefined;\n try {\n const javaPath = await trustedJavaExecutable(javaExecutable);\n const port = await availableLoopbackPort();\n // Do not forward credentials, proxies or user-controlled Java options.\n const env: NodeJS.ProcessEnv = {};\n for (const key of [\"SystemRoot\", \"WINDIR\", \"PATH\", \"Path\", \"TEMP\", \"TMP\"]) {\n if (process.env[key]) env[key] = process.env[key];\n }\n child = spawn(javaPath, [\n \"-Xmx256m\",\n \"-Djava.awt.headless=true\",\n \"-Dnu.validator.servlet.bind-address=127.0.0.1\",\n \"-Dnu.validator.servlet.allow-forbidden-hosts=false\",\n \"-m\", \"vnu/nu.validator.servlet.Main\", String(port),\n ], { shell: false, windowsHide: true, stdio: \"ignore\", env });\n let spawnError: Error | undefined;\n child.once(\"error\", (error) => { spawnError = error; });\n const url = \"http://127.0.0.1:\" + port + \"/?out=json\";\n const deadline = Date.now() + STARTUP_DEADLINE_MS;\n let ready = false;\n let lastStatus = \"not-attempted\";\n while (Date.now() < deadline) {\n if (spawnError) throw new Error(\"Nu Java process did not start\");\n if (child.exitCode !== null) throw new Error(\"Nu Java process exited before readiness\");\n try {\n const response = await fetch(url, {\n method: \"POST\",\n headers: { \"Content-Type\": \"text/html; charset=utf-8\" },\n body: \"<!doctype html><html lang=\\\"en\\\"><title>Nu readiness</title></html>\",\n redirect: \"error\",\n signal: AbortSignal.timeout(1_000),\n });\n await response.body?.cancel();\n lastStatus = String(response.status);\n if (response.ok) { ready = true; break; }\n } catch (cause) {\n lastStatus = cause instanceof Error ? cause.name : \"unknown\";\n }\n await delay(250);\n }\n if (!ready) {\n throw new Error(\"Nu Java process did not become ready within 40 seconds (HTTP \" + lastStatus + \")\");\n }\n return await action(url);\n } finally {\n if (child) {\n if (child.exitCode === null) child.kill();\n if (child.exitCode === null) {\n await new Promise<void>((resolve) => {\n let finished = false;\n const finish = () => {\n if (finished) return;\n finished = true;\n resolve();\n };\n child!.once(\"exit\", finish);\n const timeout = setTimeout(() => {\n if (child!.exitCode === null) child!.kill(\"SIGKILL\");\n finish();\n }, 1_500);\n timeout.unref();\n });\n }\n }\n busy = false;\n }\n}\n"]}
|
package/dist/presentation.d.ts
CHANGED
|
@@ -41,12 +41,12 @@ export declare function htmlValidationContent(messages: W3CMessage[], source?: s
|
|
|
41
41
|
error: number;
|
|
42
42
|
warning: number;
|
|
43
43
|
info: number;
|
|
44
|
-
}): string;
|
|
44
|
+
}, checker?: "w3c_remote" | "nu_local"): string;
|
|
45
45
|
export declare function cssValidationContent(messages: CSSMessage[], totalMessages?: number, counts?: {
|
|
46
46
|
error: number;
|
|
47
47
|
warning?: number;
|
|
48
48
|
compatibilityLimitation: number;
|
|
49
|
-
}): string;
|
|
49
|
+
}, checker?: "w3c_remote" | "stylelint_local"): string;
|
|
50
50
|
export declare function seoAuditContent(issues: SEOIssue[], totalIssues: number, truncated: boolean, counts?: AuditCounts): string;
|
|
51
51
|
export declare function schemaValidationContent(issues: SEOIssue[], totalIssues: number, truncated: boolean, htmlContent: string): string;
|
|
52
52
|
export declare function linkCheckContent(links: LinkStatus[], baseUrl?: string): string;
|
package/dist/presentation.js
CHANGED
|
@@ -229,7 +229,8 @@ export function availabilityReviewContent(review) {
|
|
|
229
229
|
nextStep,
|
|
230
230
|
});
|
|
231
231
|
}
|
|
232
|
-
export function htmlValidationContent(messages, source, totalMessages = messages.length, counts) {
|
|
232
|
+
export function htmlValidationContent(messages, source, totalMessages = messages.length, counts, checker = "w3c_remote") {
|
|
233
|
+
const validatorLabel = checker === "nu_local" ? "The local Nu HTML Checker" : "The W3C validator";
|
|
233
234
|
const errorCount = counts?.error
|
|
234
235
|
?? messages.filter((message) => getW3CMessageSeverity(message) === "error").length;
|
|
235
236
|
const warningCount = counts?.warning
|
|
@@ -240,7 +241,7 @@ export function htmlValidationContent(messages, source, totalMessages = messages
|
|
|
240
241
|
return toolContent({
|
|
241
242
|
title: "HTML validation",
|
|
242
243
|
status: "clean",
|
|
243
|
-
outcome:
|
|
244
|
+
outcome: validatorLabel + " returned no HTML diagnostics" + sourceText + ".",
|
|
244
245
|
nextStep: "Keep this result as a baseline and validate again after the next markup change.",
|
|
245
246
|
});
|
|
246
247
|
}
|
|
@@ -248,7 +249,9 @@ export function htmlValidationContent(messages, source, totalMessages = messages
|
|
|
248
249
|
return toolContent({
|
|
249
250
|
title: "HTML validation",
|
|
250
251
|
status: hasActionableDiagnostics ? "attention needed" : "review suggested",
|
|
251
|
-
outcome:
|
|
252
|
+
outcome: validatorLabel + " returned " + countLabel(errorCount, "error") + ", "
|
|
253
|
+
+ countLabel(warningCount, "warning") + ", and "
|
|
254
|
+
+ countLabel(infoCount, "informational diagnostic") + sourceText + ".",
|
|
252
255
|
actions: messages.map((message) => ({
|
|
253
256
|
priority: priorityForSeverity(getW3CMessageSeverity(message)),
|
|
254
257
|
message: message.message,
|
|
@@ -262,12 +265,15 @@ export function htmlValidationContent(messages, source, totalMessages = messages
|
|
|
262
265
|
: undefined,
|
|
263
266
|
});
|
|
264
267
|
}
|
|
265
|
-
export function cssValidationContent(messages, totalMessages = messages.length, counts) {
|
|
268
|
+
export function cssValidationContent(messages, totalMessages = messages.length, counts, checker = "w3c_remote") {
|
|
269
|
+
const stylelint = checker === "stylelint_local";
|
|
266
270
|
if (totalMessages === 0) {
|
|
267
271
|
return toolContent({
|
|
268
272
|
title: "CSS validation",
|
|
269
|
-
status: "clean",
|
|
270
|
-
outcome:
|
|
273
|
+
status: stylelint ? "no lint findings" : "clean",
|
|
274
|
+
outcome: stylelint
|
|
275
|
+
? "Local Stylelint found no findings in the selected quality rules; W3C CSS conformance was not tested."
|
|
276
|
+
: "The W3C validator returned no CSS errors or warnings.",
|
|
271
277
|
nextStep: "Validate again after the next stylesheet change.",
|
|
272
278
|
});
|
|
273
279
|
}
|
|
@@ -281,7 +287,10 @@ export function cssValidationContent(messages, totalMessages = messages.length,
|
|
|
281
287
|
return toolContent({
|
|
282
288
|
title: "CSS validation",
|
|
283
289
|
status: actionableErrors > 0 ? "attention needed" : "review suggested",
|
|
284
|
-
outcome:
|
|
290
|
+
outcome: (stylelint ? "Local Stylelint found " : "The W3C validator returned ")
|
|
291
|
+
+ countLabel(actionableErrors, "CSS error") + ", "
|
|
292
|
+
+ countLabel(warningCount, "CSS warning") + ", and "
|
|
293
|
+
+ countLabel(compatibilityLimitationCount, "known validator limitation") + ".",
|
|
285
294
|
actions: messages.map((message) => ({
|
|
286
295
|
priority: message.compatibility === "known-validator-limitation"
|
|
287
296
|
? 2
|
|
@@ -299,7 +308,9 @@ export function cssValidationContent(messages, totalMessages = messages.length,
|
|
|
299
308
|
? "Jigsaw currently does not recognize the standards-defined @container rule. The upstream diagnostic is preserved and marked as a known validator limitation."
|
|
300
309
|
: undefined,
|
|
301
310
|
totalMessages > messages.length
|
|
302
|
-
?
|
|
311
|
+
? "Showing the first " + messages.length + " of " + totalMessages
|
|
312
|
+
+ " CSS diagnostics in structured output; summary counts include all returned "
|
|
313
|
+
+ (stylelint ? "Stylelint" : "Jigsaw") + " diagnostics."
|
|
303
314
|
: undefined,
|
|
304
315
|
].filter(Boolean).join(" ") || undefined,
|
|
305
316
|
});
|