-
Notifications
You must be signed in to change notification settings - Fork 590
Expand file tree
/
Copy pathprobeDarwin.mjs
More file actions
24 lines (24 loc) · 1.05 KB
/
Copy pathprobeDarwin.mjs
File metadata and controls
24 lines (24 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Probe the @metaharness/darwin surface so we wire to the real exports.
// Mirrors examples/sonic-ct/probeDarwin.mjs. Exits 0 (skip) when the optional
// package is absent — the example must run without it (ADR-150).
try {
const mod = await import("@metaharness/darwin");
const names = Object.keys(mod).sort();
console.log("exports", names);
for (const required of ["mapLimit", "paretoFront"]) {
if (typeof mod[required] !== "function") {
throw new Error(`Missing required export: ${required}`);
}
}
const paretoNames = names.filter((n) => /pareto/i.test(n));
console.log("pareto exports", paretoNames);
const fnNames = names.filter((n) => typeof mod[n] === "function");
console.log("function exports:", fnNames);
if (typeof mod.evolve === "function") console.log("evolve.length (arity):", mod.evolve.length);
} catch (e) {
if (e.code === "ERR_MODULE_NOT_FOUND" || e.code === "MODULE_NOT_FOUND") {
console.warn("[probe] @metaharness/darwin not installed — skipping (optional dependency).");
process.exit(0);
}
throw e;
}