@mostra/verify 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +5 -2
- package/dist/main.js.map +1 -1
- package/package.json +2 -2
- package/src/main.ts +10 -5
package/dist/main.js
CHANGED
|
@@ -13,9 +13,12 @@ if (!send) {
|
|
|
13
13
|
process.stderr.write("mostra-verify runs only as a child of a Mostra supervisor.\n");
|
|
14
14
|
process.exit(2);
|
|
15
15
|
}
|
|
16
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* Ends this child and its process group (the browser with it). On Windows there is no group to
|
|
18
|
+
* signal: its gate's Job Object ends the browser once this process exits (D150).
|
|
19
|
+
*/
|
|
17
20
|
function exitWithGroup(code) {
|
|
18
|
-
try {
|
|
21
|
+
if (process.platform !== "win32") try {
|
|
19
22
|
process.kill(-process.pid, "SIGTERM");
|
|
20
23
|
} catch {}
|
|
21
24
|
process.exit(code);
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","names":[],"sources":["../src/main.ts"],"sourcesContent":["#!/usr/bin/env node\n/**\n * The verify runner child's entry (`mostra-verify`, ARCHITECTURE §1): the supervisor's process\n * manager starts it, in its own process group, with a JSON-RPC channel over Node IPC. It serves\n * `verify/render` and `verify/compare`, keeps one warm Chromium for them, and exits after 10 idle\n * minutes or when its supervisor goes away, taking the browser with it (FAILURE_MODEL §2).\n */\nimport {\n type CompareRequest,\n createDiagnostic,\n type RenderRequest,\n RpcError,\n RpcPeer,\n VERIFY_RUNNER_METHODS,\n} from \"@mostra/protocol\";\nimport { createRunner } from \"./runner.ts\";\n\nconst send = process.send?.bind(process);\nif (!send) {\n process.stderr.write(\"mostra-verify runs only as a child of a Mostra supervisor.\\n\");\n process.exit(2);\n}\n\n
|
|
1
|
+
{"version":3,"file":"main.js","names":[],"sources":["../src/main.ts"],"sourcesContent":["#!/usr/bin/env node\n/**\n * The verify runner child's entry (`mostra-verify`, ARCHITECTURE §1): the supervisor's process\n * manager starts it, in its own process group, with a JSON-RPC channel over Node IPC. It serves\n * `verify/render` and `verify/compare`, keeps one warm Chromium for them, and exits after 10 idle\n * minutes or when its supervisor goes away, taking the browser with it (FAILURE_MODEL §2).\n */\nimport {\n type CompareRequest,\n createDiagnostic,\n type RenderRequest,\n RpcError,\n RpcPeer,\n VERIFY_RUNNER_METHODS,\n} from \"@mostra/protocol\";\nimport { createRunner } from \"./runner.ts\";\n\nconst send = process.send?.bind(process);\nif (!send) {\n process.stderr.write(\"mostra-verify runs only as a child of a Mostra supervisor.\\n\");\n process.exit(2);\n}\n\n/**\n * Ends this child and its process group (the browser with it). On Windows there is no group to\n * signal: its gate's Job Object ends the browser once this process exits (D150).\n */\nfunction exitWithGroup(code: number): never {\n if (process.platform !== \"win32\") {\n try {\n process.kill(-process.pid, \"SIGTERM\");\n } catch {\n // The group is already gone.\n }\n }\n process.exit(code);\n}\n\nconst idle = Number(process.env[\"MOSTRA_TEST_VERIFY_IDLE_MS\"]);\nconst runner = createRunner({\n ...(idle > 0 ? { idleMs: idle } : {}),\n onIdle: () => {\n void runner.close().finally(() => exitWithGroup(0));\n },\n});\n\nconst peer = new RpcPeer({\n send: (message) => {\n send(message);\n },\n onRequest: async (method, params) => {\n if (method === VERIFY_RUNNER_METHODS.render) {\n return runner.render(params as unknown as RenderRequest);\n }\n if (method === VERIFY_RUNNER_METHODS.compare) {\n return runner.compare(params as unknown as CompareRequest);\n }\n throw new RpcError(\n createDiagnostic(\"MOSTRA_HOST_METHOD_UNKNOWN\", {\n message: `The verify runner serves no method ${method}.`,\n }),\n );\n },\n});\nprocess.on(\"message\", (message) => peer.receive(message));\nprocess.on(\"disconnect\", () => {\n peer.close();\n void runner.close().finally(() => exitWithGroup(0));\n});\n"],"mappings":";;;;;;;;;;AAiBA,MAAM,OAAO,QAAQ,MAAM,KAAK,OAAO;AACvC,IAAI,CAAC,MAAM;CACT,QAAQ,OAAO,MAAM,8DAA8D;CACnF,QAAQ,KAAK,CAAC;AAChB;;;;;AAMA,SAAS,cAAc,MAAqB;CAC1C,IAAI,QAAQ,aAAa,SACvB,IAAI;EACF,QAAQ,KAAK,CAAC,QAAQ,KAAK,SAAS;CACtC,QAAQ,CAER;CAEF,QAAQ,KAAK,IAAI;AACnB;AAEA,MAAM,OAAO,OAAO,QAAQ,IAAI,6BAA6B;AAC7D,MAAM,SAAS,aAAa;CAC1B,GAAI,OAAO,IAAI,EAAE,QAAQ,KAAK,IAAI,CAAC;CACnC,cAAc;EACZ,OAAY,MAAM,CAAC,CAAC,cAAc,cAAc,CAAC,CAAC;CACpD;AACF,CAAC;AAED,MAAM,OAAO,IAAI,QAAQ;CACvB,OAAO,YAAY;EACjB,KAAK,OAAO;CACd;CACA,WAAW,OAAO,QAAQ,WAAW;EACnC,IAAI,WAAW,sBAAsB,QACnC,OAAO,OAAO,OAAO,MAAkC;EAEzD,IAAI,WAAW,sBAAsB,SACnC,OAAO,OAAO,QAAQ,MAAmC;EAE3D,MAAM,IAAI,SACR,iBAAiB,8BAA8B,EAC7C,SAAS,sCAAsC,OAAO,GACxD,CAAC,CACH;CACF;AACF,CAAC;AACD,QAAQ,GAAG,YAAY,YAAY,KAAK,QAAQ,OAAO,CAAC;AACxD,QAAQ,GAAG,oBAAoB;CAC7B,KAAK,MAAM;CACX,OAAY,MAAM,CAAC,CAAC,cAAc,cAAc,CAAC,CAAC;AACpD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mostra/verify",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "The verify runner: the child process that renders artifact pages in a warm headless Chromium for `mostra verify`.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "The Mostra Authors",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"provenance": true
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@mostra/protocol": "0.
|
|
37
|
+
"@mostra/protocol": "0.5.0",
|
|
38
38
|
"axe-core": "4.14.0",
|
|
39
39
|
"pixelmatch": "8.0.0",
|
|
40
40
|
"playwright-core": "1.64.0",
|
package/src/main.ts
CHANGED
|
@@ -21,12 +21,17 @@ if (!send) {
|
|
|
21
21
|
process.exit(2);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* Ends this child and its process group (the browser with it). On Windows there is no group to
|
|
26
|
+
* signal: its gate's Job Object ends the browser once this process exits (D150).
|
|
27
|
+
*/
|
|
25
28
|
function exitWithGroup(code: number): never {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
if (process.platform !== "win32") {
|
|
30
|
+
try {
|
|
31
|
+
process.kill(-process.pid, "SIGTERM");
|
|
32
|
+
} catch {
|
|
33
|
+
// The group is already gone.
|
|
34
|
+
}
|
|
30
35
|
}
|
|
31
36
|
process.exit(code);
|
|
32
37
|
}
|