mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-06 16:08:05 +00:00
Plugins can now ship a web page as the UI of a view or custom editor (`web = "web/index.html"`), so editors built on web libraries are plugins rather than part of the core. - Web views: every file under the page's directory is part of the package (checked, copied on install, covered by the digest and signature) and served through the `openidea-plugin` URL scheme, under a per-revision path with a CSP of its own, into an `<iframe sandbox="allow-scripts">`. An update or reinstall reloads open pages. - Frame bridge (`window.openidea`), shared by html bodies and web pages: theme, messages to the plugin's code, `document.get/edit/replace/onChange` (versioned edits that join the text editor's undo history, Save and dirty state), `saveFile`/`openFile` through the IDE's dialogs, and IDE shortcuts the page leaves alone. - Custom editor layouts: tab, split (Editor and X) or preview over the text editor, switchable from the tab's actions. - New points `fileIcons` and `fileTemplates`; new optional capability `clipboard` for web views. - Excalidraw official plugin: `.excalidraw` / `.excalidraw.json` open as an interactive canvas kept in step with the file's text, with self-hosted fonts, PNG/SVG export, images, file icons, a New Drawing template and JSON highlighting. Closes #732. - Fixes: a lock-order deadlock between listing plugins and refreshing project pins; the dev server ignored edits under `src/features/plugins`. - `plugins/build.sh` builds and checks web pages; CI typechecks and tests them. Co-authored-by: Deng Liu <5108773+dengliu@users.noreply.github.com>
52 lines
1.6 KiB
TypeScript
52 lines
1.6 KiB
TypeScript
/// <reference types="vitest/config" />
|
|
import { defineConfig } from "vite";
|
|
import react from "@vitejs/plugin-react";
|
|
import { fileURLToPath } from "node:url";
|
|
import process from "node:process";
|
|
|
|
const host = process.env.TAURI_DEV_HOST;
|
|
|
|
export default defineConfig(() => ({
|
|
plugins: [react()],
|
|
resolve: {
|
|
alias: [
|
|
{ find: "@", replacement: fileURLToPath(new URL("./src", import.meta.url)) },
|
|
// `invoke` with remote-development routing (src/platform/tauriCore.ts).
|
|
{
|
|
find: /^@tauri-apps\/api\/core$/,
|
|
replacement: fileURLToPath(new URL("./src/platform/tauriCore.ts", import.meta.url)),
|
|
},
|
|
],
|
|
},
|
|
// Tauri: keep Rust errors visible, fixed port, don't watch the backend.
|
|
clearScreen: false,
|
|
server: {
|
|
port: 1420,
|
|
strictPort: true,
|
|
host: host || false,
|
|
hmr: host ? { protocol: "ws", host } : undefined,
|
|
watch: {
|
|
ignored: [
|
|
"**/src-tauri/**",
|
|
"**/crates/**",
|
|
"**/target/**",
|
|
// The packages' sources and builds (not `src/features/plugins`).
|
|
`${fileURLToPath(new URL("./plugins", import.meta.url))}/**`,
|
|
],
|
|
},
|
|
},
|
|
// The app's own entry only: plugins' web pages (`plugins/**/web-src`) are
|
|
// separate projects with their own dependencies, never part of this bundle.
|
|
optimizeDeps: { entries: ["index.html"] },
|
|
build: {
|
|
target: "safari16",
|
|
sourcemap: true,
|
|
},
|
|
test: {
|
|
environment: "jsdom",
|
|
globals: false,
|
|
setupFiles: ["./src/test/setup.ts"],
|
|
include: ["src/**/*.test.{ts,tsx}", "perf/**/*.test.ts", "scripts/**/*.test.ts"],
|
|
},
|
|
}));
|