Lines 167-207javascript
168 server.close(() => resolveClose());
174import { existsSync as existsSync2, mkdirSync, readFileSync, writeFileSync } from "fs";
175import { basename, dirname as dirname2, join as join2, resolve as resolve2 } from "path";
176import { Cause as Cause2, Effect as Effect2, Exit as Exit2 } from "effect";
177import { compileFile as compileFile2 } from "@grayhaven/nerve-compiler";
178import { boardSvg, connectorFacesSvg, pinoutSvg, schematicSvg } from "@grayhaven/nerve-exporters";
180 ["schematic", schematicSvg],
182 ["faces", connectorFacesSvg],
183 ["pinout", pinoutSvg]
185var snapName = (file) => basename(file).replace(/\.harness\.(ts|tsx|js)$/, "").replace(/\.(ts|tsx
186var writePngDiff = async (expectedSvg, actualSvg, outPath) => {
188 const { Resvg } = await import("@resvg/resvg-js");
189 const { PNG } = await import("pngjs");
MediumDynamic Require
Package source references dynamic require/import behavior.
dist/index.jsView on unpkg · L187 190 const pixelmatch = (await import("pixelmatch")).default;
191 const render = (svg) => PNG.sync.read(
194 font: { loadSystemFonts: false },
195 fitTo: { mode: "width", value: 1200 }
199 const a = render(expectedSvg);
200 const b = render(actualSvg);
201 if (a.width !== b.width || a.height !== b.height) return void 0;
202 const diff = new PNG({ width: a.width, height: a.height });
203 const n = pixelmatch(a.data, b.data, diff.data, a.width, a.height, { threshold: 0.05 });
204 writeFileSync(outPath, PNG.sync.write(diff));