andre482_O-tie/scripts/engine.mjs
Andre482 8a376a87a8 Release 1.0.8: Pan from anywhere on touch, keyboard selection, and quality audit.
- Single-finger touch panning now works even when starting on a node; a tap still selects.

- Add keyboard node selection (Tab/Enter/Space/Escape) and validated settings input.

- Guard against overwriting malformed .bowtie files; show a notice and keep original data.

- Add Vitest tests (model/layout/panZoom) and a GitHub Actions CI workflow.

- Split bowtieView into history/panZoom/stackRows/externalSync modules; refresh README, examples, and contributor docs.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-27 19:26:42 +03:00

34 lines
980 B
JavaScript

// Bundles the plugin's pure layout/model TypeScript so Node scripts can use it.
import { build } from "esbuild";
import { rmSync, writeFileSync } from "node:fs";
import { dirname, join } from "node:path";
import { fileURLToPath, pathToFileURL } from "node:url";
const scriptsDir = dirname(fileURLToPath(import.meta.url));
const root = join(scriptsDir, "..");
export async function loadEngine() {
const result = await build({
stdin: {
contents: `
export { layoutBowtie, DEFAULT_LAYOUT, barrierHeaderHeightFor } from "./src/layout";
export * as model from "./src/model";
`,
resolveDir: root,
loader: "ts",
sourcefile: "engine-entry.ts",
},
bundle: true,
format: "esm",
platform: "node",
write: false,
logLevel: "silent",
});
const tmp = join(scriptsDir, `_engine-${process.pid}.mjs`);
writeFileSync(tmp, result.outputFiles[0].text);
try {
return await import(pathToFileURL(tmp).href);
} finally {
rmSync(tmp, { force: true });
}
}