New pnpm workspace package @yggdrasil/xterm-terminal, output to public/xterm/. Output-only terminal (disableStdin) for streaming container stdout/stderr via SSE. - @xterm/xterm@^6.0.0 + @xterm/addon-fit@^0.11.0 (released same day, 2025-12-22; 0.10.0's peerDependency is ^5.0.0 and incompatible) - convertEol: containers emit \n, xterm needs \r\n - stderr wrapped in ANSI red for visual distinction - Catppuccin Latte/Mocha themes matching project highlight.css - Mirrors codemirror-editor IIFE pattern: object literal default export, XtermOptions as class (survives TS erasure for wasm-bindgen) - css.d.ts declares *.css module for tsc side-effect import
28 lines
803 B
TypeScript
28 lines
803 B
TypeScript
import { resolve } from 'node:path';
|
||
import { defineConfig } from 'vite';
|
||
|
||
export default defineConfig({
|
||
build: {
|
||
// 输出直写 public/xterm/,Dioxus 直接托管,无需拷贝步骤。
|
||
outDir: resolve(__dirname, '../../public/xterm'),
|
||
emptyOutDir: true,
|
||
lib: {
|
||
entry: resolve(__dirname, 'src/index.ts'),
|
||
// IIFE 产物挂在 window.XtermTerminal 上,Rust 侧用 Reflect::get 取。
|
||
name: 'XtermTerminal',
|
||
fileName: () => 'terminal.js',
|
||
formats: ['iife'],
|
||
},
|
||
rolldownOptions: {
|
||
output: {
|
||
// 默认导出(对象字面量 { create() })成为 window.XtermTerminal。
|
||
exports: 'default',
|
||
assetFileNames: 'terminal.[ext]',
|
||
},
|
||
},
|
||
cssCodeSplit: false,
|
||
minify: true,
|
||
sourcemap: true,
|
||
},
|
||
});
|