mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-08-28 17:21:05 +00:00
4fda63dedd
Extract shared helpers for home notices, timetable subtitles, and theme images; dedupe global search, Select, and build scripts while preserving behaviour. Add @huggingface/transformers as a direct dependency and resolve ORT WASM paths via require.resolve so pnpm postinstall and Vite can bundle vector search. Co-authored-by: Cursor <cursoragent@cursor.com>
29 lines
899 B
JavaScript
29 lines
899 B
JavaScript
import { copyFileSync, existsSync, mkdirSync } from "node:fs";
|
|
import { createRequire } from "node:module";
|
|
import { dirname, join } from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
|
|
const root = join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
const require = createRequire(import.meta.url);
|
|
|
|
const transformersDist = dirname(require.resolve("@huggingface/transformers"));
|
|
const outDir = join(root, "src", "public", "resources", "ort");
|
|
|
|
mkdirSync(outDir, { recursive: true });
|
|
|
|
const ortFiles = [
|
|
"ort-wasm-simd-threaded.jsep.mjs",
|
|
"ort-wasm-simd-threaded.jsep.wasm",
|
|
];
|
|
|
|
for (const file of ortFiles) {
|
|
const src = join(transformersDist, file);
|
|
if (!existsSync(src)) {
|
|
throw new Error(
|
|
`Missing ONNX Runtime WASM asset: ${src}\n` +
|
|
"Ensure @huggingface/transformers is installed (direct dependency).",
|
|
);
|
|
}
|
|
copyFileSync(src, join(outDir, file));
|
|
}
|