refactor: trim PR debloat and fix transformers build

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>
This commit is contained in:
2026-06-28 10:30:25 +09:30
parent dcb4dd2f5e
commit 4fda63dedd
76 changed files with 2003 additions and 4149 deletions
+4 -15
View File
@@ -1,12 +1,6 @@
import type { Plugin } from "vite";
/**
* Vite's default base (`/`) emits absolute chunk paths like `/assets/chunk.js`.
* In content scripts those resolve against the SEQTA page origin on Firefox,
* not the extension — causing MIME type / NS_ERROR_CORRUPTED_CONTENT failures.
*
* Use relative base plus `chrome.runtime.getURL` for dynamic import targets.
*/
/** Relative chunk/CSS URLs via chrome.runtime.getURL for content-script dynamic imports. */
export function extensionChunkUrls(): Plugin {
return {
name: "extension-chunk-urls",
@@ -17,16 +11,11 @@ export function extensionChunkUrls(): Plugin {
renderBuiltUrl(filename, { hostType, type }) {
const path = filename.replace(/^\//, "");
if (type === "chunk" && hostType === "js") {
return {
runtime: `chrome.runtime.getURL(${JSON.stringify(path)})`,
};
return { runtime: `chrome.runtime.getURL(${JSON.stringify(path)})` };
}
// Rewrite CSS preloads from JS dynamic imports (content scripts).
// Do not rewrite hostType "css" — extension HTML pages need static hrefs.
// JS-triggered CSS preloads only — extension HTML pages need static hrefs.
if (type === "asset" && hostType === "js" && path.endsWith(".css")) {
return {
runtime: `chrome.runtime.getURL(${JSON.stringify(path)})`,
};
return { runtime: `chrome.runtime.getURL(${JSON.stringify(path)})` };
}
},
},