Kaleido-Desktop/vite.config.ts
Elijah 8ed44c2fe4
All checks were successful
Validate Kaleido Desktop / validate (push) Successful in 1m22s
Release Kaleido Desktop 0.1.0-beta.12
On Windows the miniplayer is now a window of its own (mini.rs, mini.html):
a borderless window owned by the main one that the video moves into
(VideoSurface::set_host swaps composition targets in one commit). Dragging
moves the whole window, so video and controls move together with no edge
flicker; release glides it to the nearest corner or the one it's flicked
towards, remembered, and it follows the main window. Its page mirrors the
player over events (mini:state / mini:action). Shown and hidden natively
without activation, so the main window keeps focus. macOS keeps the
in-page miniplayer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 17:35:08 -07:00

43 lines
1.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';
/**
* Development only: lets the browser preview start signed in using the
* repository's ignored `.env`. Never part of a build.
*/
function devSession(): Plugin {
return {
name: 'kaleido-dev-session',
apply: 'serve',
configureServer(server) {
server.middlewares.use('/__dev/session', (_req, res) => {
const file = [process.env.KALEIDO_DEV_ENV, path.resolve(import.meta.dirname, '.env'), path.resolve(import.meta.dirname, '../Custom plex client/.env')].find(
(f) => f && fs.existsSync(f),
);
try {
const text = fs.readFileSync(file!, 'utf8');
const get = (k: string) => text.match(new RegExp(`^${k}=(.*)$`, 'm'))?.[1]?.trim().replace(/^"|"$/g, '');
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify({ server: get('PLEX_SERVER_URL'), token: get('PLEX_TOKEN') }));
} catch {
res.statusCode = 404;
res.end('{}');
}
});
},
};
}
export default defineConfig({
plugins: [react(), devSession()],
clearScreen: false,
server: { port: 1420, strictPort: true, watch: { ignored: ['**/src-tauri/**'] } },
build: {
target: 'es2022',
chunkSizeWarningLimit: 1500,
// The miniplayer window has a page of its own (src/mini/).
rollupOptions: { input: { main: path.resolve(import.meta.dirname, 'index.html'), mini: path.resolve(import.meta.dirname, 'mini.html') } },
},
});