Files
s41r4j-pixie/apps/desktop/vite.config.ts
T
s41r4jandClaude Opus 5.5 9aa655980a Pixie 0.7.7: Windows and Linux, auto-update, canvas, memory, personalities
- Windows parity through an in-process native layer (capture, OCR, UI
  Automation, input, speech in and out); Linux preview builds; CI checks
  for both; CHECKLIST.md of what works where.
- Updates itself from GitHub Releases (signed latest.json), installs when
  idle; Settings > About and tray controls.
- Excalidraw canvas replaces the old board: opens in front, hides on an
  outside click, open/list/read/clear/delete, exports, Show Canvas in the
  menu, draws on its own when a picture helps (Settings > General > Drawing).
- Memory: one chat per day with a running summary, long-term notes in
  memory.json (remember/forget, learned from quiet chats), Settings > Memory.
- Pixie knows and controls itself (pixie tool): settings by voice, quit,
  stop all jobs, new chat; instant commands for the short ones.
- Four personalities (Pix, Inos, Xtrem with Spicy, Eon) with their own faces.
- Connectors moved off retired packages (GitHub, Slack, Brave), new Sentry
  and Context7, clearer status and errors, add your own server.
- Lower idle RAM (voice loads on demand, Settings and canvas freed on close),
  click-before-typing, no em dashes, docs and website updated, repo tidy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 02:28:45 +05:30

56 lines
2.6 KiB
TypeScript

import { defineConfig, type Plugin } from "vite";
import react from "@vitejs/plugin-react";
import fs from "node:fs";
import path from "node:path";
// Browser preview only (src/preview.ts): serve resource slots at /__slot/<kind>/<slot>,
// mirroring the app's slot:// protocol, so images load outside Tauri.
function slots(): Plugin {
const root = path.resolve(__dirname, "../../resources");
const kinds: Record<string, string> = { icon: "icons", sound: "sounds", video: "videos", font: "fonts" };
const types: Record<string, string> = { ".png": "image/png", ".svg": "image/svg+xml", ".wav": "audio/wav", ".mp3": "audio/mpeg", ".ttf": "font/ttf", ".mp4": "video/mp4" };
return {
name: "openclicky-slots",
configureServer(server) {
server.middlewares.use("/__slot", (req, res) => {
const [kind, slot] = (req.url ?? "").replace(/^\//, "").split("/");
const manifest = JSON.parse(fs.readFileSync(path.join(root, "manifest.json"), "utf8"));
const file = manifest[kinds[kind]]?.[slot]?.files?.[0];
if (!file) {
res.statusCode = 404;
return res.end();
}
res.setHeader("Content-Type", types[path.extname(file)] ?? "application/octet-stream");
res.end(fs.readFileSync(path.join(root, file)));
});
},
};
}
// Excalidraw's fonts, served locally so the canvas works offline (public/excalidraw-assets/fonts,
// copied from the package; not committed). The 12 MB CJK font is left out: those characters
// fall back to the system font.
function excalidrawFonts(): Plugin {
const copy = () => {
const from = path.resolve(__dirname, "../../node_modules/@excalidraw/excalidraw/dist/prod/fonts");
const to = path.resolve(__dirname, "public/excalidraw-assets/fonts");
if (!fs.existsSync(from)) return;
for (const family of fs.readdirSync(from)) {
if (family === "Xiaolai") continue;
fs.cpSync(path.join(from, family), path.join(to, family), { recursive: true });
}
};
return { name: "excalidraw-fonts", buildStart: copy, configureServer: copy };
}
// Tauri expects a fixed port and no screen clearing.
export default defineConfig({
plugins: [react(), slots(), excalidrawFonts()],
clearScreen: false,
// Excalidraw must share the app's React (a second copy sits at the repo root).
resolve: { dedupe: ["react", "react-dom"] },
server: { port: 1420, strictPort: true, watch: { ignored: ["**/src-tauri/**"] } },
// The canvas window's Excalidraw + Mermaid chunks are big by nature; they load only there.
build: { target: "safari16", outDir: "dist", emptyOutDir: true, chunkSizeWarningLimit: 2500 },
});