Luigit
repositories / pi-ext

pi-ext

bugabingas pi extensions

owned by admin

extensions/devdocs/__serial__/crash-child.ts

Raw
import { fileAdapter } from "../src/adapters/local.ts";
import { Devdocs } from "../src/engine.ts";
import type { Options } from "../src/types.ts";

const options = JSON.parse(process.argv[2] ?? "null") as Options;
const source = options.sources[0];
if (!source) throw new Error("fixture source missing");
const adapter = fileAdapter(source);
const docs = new Devdocs(options, [
	{
		...adapter,
		async retrieve(candidate, request, validator) {
			const result = await adapter.retrieve(candidate, request, validator);
			process.send?.({ ready: true });
			await new Promise<never>(() => {});
			return result;
		},
	},
]);
await docs.search(
	{ target: source.target, query: "transactions", cwd: process.cwd() },
	true,
);