tsdmarc 0.0.0-stage → 1.0.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/CHANGELOG.md +12 -0
- package/LICENSE +201 -0
- package/NOTICE +61 -0
- package/README.md +137 -2
- package/dist/index.d.ts +2700 -0
- package/dist/index.js +3146 -0
- package/dist/index.js.map +1 -0
- package/dist/parallel-worker.d.ts +1 -0
- package/dist/parallel-worker.js +42 -0
- package/dist/parallel-worker.js.map +1 -0
- package/dist/report-file-C6u0I5I1.js +27271 -0
- package/dist/report-file-C6u0I5I1.js.map +1 -0
- package/package.json +92 -3
- package/resources/base_reverse_dns_map.csv +38629 -0
- package/resources/known_unknown_base_reverse_dns.txt +31882 -0
- package/resources/psl_overrides.txt +298 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { C as encodeValue, O as runWireTask, Or as REVERSE_DNS_MAP, S as encodeError, r as parseReportFileJob, u as parseReportEmailJob, w as initWorker } from "./report-file-C6u0I5I1.js";
|
|
2
|
+
import { parentPort, workerData } from "node:worker_threads";
|
|
3
|
+
// src/parallel-worker.ts
|
|
4
|
+
/** The jobs a task can name without a module. */
|
|
5
|
+
const BUILTIN_JOBS = Object.freeze({
|
|
6
|
+
parseReportEmailJob,
|
|
7
|
+
parseReportFileJob
|
|
8
|
+
});
|
|
9
|
+
const init = workerData;
|
|
10
|
+
const port = parentPort;
|
|
11
|
+
if (port !== null) {
|
|
12
|
+
initWorker(init.logLevel, init.logFiles, init.shared, REVERSE_DNS_MAP);
|
|
13
|
+
port.on("message", async (message) => {
|
|
14
|
+
if (message.type === "close") {
|
|
15
|
+
if (typeof port.close === "function") port.close();
|
|
16
|
+
else process.exit(0);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
let reply;
|
|
20
|
+
try {
|
|
21
|
+
const value = await runWireTask(init.task, message.job, BUILTIN_JOBS);
|
|
22
|
+
reply = {
|
|
23
|
+
type: "result",
|
|
24
|
+
id: message.id,
|
|
25
|
+
ok: true,
|
|
26
|
+
value: encodeValue(value)
|
|
27
|
+
};
|
|
28
|
+
} catch (error) {
|
|
29
|
+
reply = {
|
|
30
|
+
type: "result",
|
|
31
|
+
id: message.id,
|
|
32
|
+
ok: false,
|
|
33
|
+
error: encodeError(error)
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
port.postMessage(reply);
|
|
37
|
+
});
|
|
38
|
+
port.postMessage({ type: "ready" });
|
|
39
|
+
}
|
|
40
|
+
export {};
|
|
41
|
+
|
|
42
|
+
//# sourceMappingURL=parallel-worker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parallel-worker.js","names":[],"sources":["../src/parallel-worker.ts"],"sourcesContent":["// Worker thread entry of `parallelMap()` (see parallel.ts): restore the\n// parent's lookup state and logging, then run one job per message and post\n// back its result.\n\nimport { parentPort, workerData } from 'node:worker_threads';\n\nimport { REVERSE_DNS_MAP } from './config';\nimport {\n encodeError,\n encodeValue,\n type FromWorkerMessage,\n initWorker,\n type JobRegistry,\n runWireTask,\n type ToWorkerMessage,\n type WorkerInit,\n} from './parallel';\nimport { parseReportEmailJob } from './report-email';\nimport { parseReportFileJob } from './report-file';\n\n/** The jobs a task can name without a module. */\nconst BUILTIN_JOBS: JobRegistry = Object.freeze({\n parseReportEmailJob,\n parseReportFileJob,\n});\n\nconst init = workerData as WorkerInit;\nconst port = parentPort;\n\nif (port !== null) {\n initWorker(init.logLevel, init.logFiles, init.shared, REVERSE_DNS_MAP);\n port.on('message', async (message: ToWorkerMessage) => {\n if (message.type === 'close') {\n // Closing the port lets the thread end once its output is flushed.\n // Deno's port has no close(), so the thread exits instead.\n if (typeof port.close === 'function') {\n port.close();\n } else {\n process.exit(0);\n }\n return;\n }\n let reply: FromWorkerMessage;\n try {\n const value = await runWireTask(init.task, message.job, BUILTIN_JOBS);\n reply = {\n type: 'result',\n id: message.id,\n ok: true,\n value: encodeValue(value),\n };\n } catch (error) {\n reply = {\n type: 'result',\n id: message.id,\n ok: false,\n error: encodeError(error),\n };\n }\n port.postMessage(reply);\n });\n const ready: FromWorkerMessage = { type: 'ready' };\n port.postMessage(ready);\n}\n"],"mappings":";;;;AAqBA,MAAM,eAA4B,OAAO,OAAO;CAC9C;CACA;AACF,CAAC;AAED,MAAM,OAAO;AACb,MAAM,OAAO;AAEb,IAAI,SAAS,MAAM;CACjB,WAAW,KAAK,UAAU,KAAK,UAAU,KAAK,QAAQ,eAAe;CACrE,KAAK,GAAG,WAAW,OAAO,YAA6B;EACrD,IAAI,QAAQ,SAAS,SAAS;GAG5B,IAAI,OAAO,KAAK,UAAU,YACxB,KAAK,MAAM;QAEX,QAAQ,KAAK,CAAC;GAEhB;EACF;EACA,IAAI;EACJ,IAAI;GACF,MAAM,QAAQ,MAAM,YAAY,KAAK,MAAM,QAAQ,KAAK,YAAY;GACpE,QAAQ;IACN,MAAM;IACN,IAAI,QAAQ;IACZ,IAAI;IACJ,OAAO,YAAY,KAAK;GAC1B;EACF,SAAS,OAAO;GACd,QAAQ;IACN,MAAM;IACN,IAAI,QAAQ;IACZ,IAAI;IACJ,OAAO,YAAY,KAAK;GAC1B;EACF;EACA,KAAK,YAAY,KAAK;CACxB,CAAC;CAED,KAAK,YAAY,EADkB,MAAM,QACpB,CAAC;AACxB"}
|