mirror of
https://github.com/MoonshotAI/kimi-code.git
synced 2026-07-09 17:29:12 +00:00
* feat(web): use sidebar fold/unfold icons for sidebar toggle * feat(web): move settings entry to a sidebar footer row * feat(web): fully collapse sidebar with animated width transition * feat(web): redesign sidebar colors, spacing and macos desktop chrome * feat(desktop): center traffic lights on the 48px header row * fix(web): restore webkit thin scrollbars and unify sidebar icon sizes * feat(web): add Kbd keycap component and justify sidebar search shortcut * style(web): rework sidebar palette and pin a resident sidebar toggle * fix(desktop): sync window appearance with web UI theme so dimmed traffic lights stay visible * feat(web): adopt Kimi design icons in the sidebar via a local icon collection * style(web): mute workspace group title color in the sidebar * style(web): refine sidebar typography, unify shortcut keycaps, float workspace row actions * style(web): cap sidebar draggable width at 480px * style(web): derive sidebar row height from type and padding, float the kebab * chore: add changeset for sidebar UI polish * fix(nix): update pnpmDeps hash * style(web): put the sidebar collapse button inside the header on non-mac * fix(nix): update pnpmDeps hash
70 lines
2.9 KiB
TypeScript
70 lines
2.9 KiB
TypeScript
import { defineConfig } from 'vite';
|
||
import vue from '@vitejs/plugin-vue';
|
||
import Icons from 'unplugin-icons/vite';
|
||
import { FileSystemIconLoader } from 'unplugin-icons/loaders';
|
||
import { readFileSync } from 'node:fs';
|
||
import { fileURLToPath } from 'node:url';
|
||
|
||
const webPort = Number(process.env.WEB_PORT) || 5175;
|
||
// Where the dev proxy forwards server traffic. Defaults to the local server
|
||
// (or `pnpm dev:stub`). Override to point dev at another server instance.
|
||
const serverTarget = process.env.KIMI_SERVER_URL || 'http://127.0.0.1:58627';
|
||
const pkg = JSON.parse(readFileSync(new URL('./package.json', import.meta.url), 'utf-8')) as {
|
||
version: string;
|
||
};
|
||
|
||
export default defineConfig({
|
||
plugins: [
|
||
vue(),
|
||
Icons({
|
||
compiler: 'vue3',
|
||
// Local Kimi Design System icons (24×24 outlined, fill="currentColor"),
|
||
// copied from the design-system icon pack into src/icons/kimi/ and
|
||
// imported as `~icons/kimi/<file-name>` (plus `?raw`), same as the ri
|
||
// collection. Registered in src/lib/icons.ts only.
|
||
customCollections: {
|
||
kimi: FileSystemIconLoader(fileURLToPath(new URL('./src/icons/kimi', import.meta.url))),
|
||
},
|
||
}),
|
||
],
|
||
// Expose the dev proxy's upstream server target to the client so the UI can
|
||
// show which server it is connected to (the browser otherwise only sees its
|
||
// own same-origin URL). Unused by the same-origin production build.
|
||
define: {
|
||
__KIMI_DEV_PROXY_TARGET__: JSON.stringify(serverTarget),
|
||
__KIMI_WEB_VERSION__: JSON.stringify(pkg.version),
|
||
// True only for the web bundle embedded in the Kimi Desktop app (set by the
|
||
// desktop-build workflow). Gates an "internal testing build" banner. When
|
||
// false (default) the banner is tree-shaken out of the production bundle.
|
||
__KIMI_WEB_DESKTOP__: JSON.stringify(process.env.KIMI_WEB_DESKTOP === '1'),
|
||
},
|
||
server: {
|
||
port: webPort,
|
||
strictPort: false,
|
||
// Same-origin dev: the browser calls Vite, Vite forwards to the server.
|
||
// No CORS anywhere. The real server serves REST + WS all under /api/v1.
|
||
proxy: {
|
||
'/api/v1': { target: serverTarget, changeOrigin: true, ws: true },
|
||
},
|
||
},
|
||
// `vite preview` (the production build served locally) needs the same proxy —
|
||
// bugs that only exist in production chunking (e.g. optional-peer-dep stubs)
|
||
// can't be reproduced without running the built app against a server.
|
||
preview: {
|
||
port: Number(process.env.WEB_PREVIEW_PORT) || 4175,
|
||
proxy: {
|
||
'/api/v1': { target: serverTarget, changeOrigin: true, ws: true },
|
||
},
|
||
},
|
||
build: {
|
||
outDir: 'dist',
|
||
emptyOutDir: true,
|
||
target: 'es2022',
|
||
},
|
||
// Workers that import modules with code-splitting (e.g. mermaid's dynamic
|
||
// diagram imports) need ES format — IIFE cannot split chunks. The app
|
||
// already targets ES2022 so all supported browsers handle module workers.
|
||
worker: {
|
||
format: 'es',
|
||
},
|
||
});
|