跳轉到內容
supastack
瀏覽檔案

For AI agents: fetch the complete documentation index at /llms.txt, the full documentation corpus at /llms-full.txt, the agent skill at /skill.md, or this page as Markdown at /zh-tw/docs/desktop/tech-stack.md (or send Accept: text/markdown).

Desktop 技術棧

Tauri 外殼內部的技術以及各自的角色。

詢問本指南
開啟方式

開始之前

Desktop 應用刻意保持精簡:Rust 核心掌管原生視窗,webview 載入您的 web 應用。下面的一切都已在 checkout 中鎖定——本頁解釋每個部分的作用,便於理解後面的指南。

產品介面、認證、計費和 AI 都位於視窗所載入的 web 程式碼庫中。僅含 Desktop 的 checkout 只有外殼——這正是此技術棧刻意保持精簡的原因。

Tauri 2 + 系統 webview

Tauri 2 用作業系統自帶的 webview 渲染應用——Windows 上的 WebView2、macOS 上的 WebKit、Linux 上的 WebKitGTK——因此外殼保持精簡,不捆綁瀏覽器執行時。frontendDist 指向 apps/desktop/ui,即 web 應用載入期間顯示的啟動頁,冷啟動絕不會渲染空白視窗。

Rust + TypeScript

外殼的行為由 Rust 實現——src-tauri/src,edition 2021,最低 Rust 1.90——由 cargo 構建。用 TypeScript 編寫的小型 Node 指令碼負責釋出預檢和更新器清單。

通過外掛提供原生功能

視窗狀態、單例項、deep link、全域性快捷鍵、托盤、開機自啟、更新器、外部連結開啟、對話方塊和程式控制都來自 tauri-plugin-* crate——外殼沒有自定義 IPC 命令。新增原生能力意味著再註冊一個外掛或接線已有的外掛。

tauri.conf.json + capabilities

包識別符號 com.supastack.desktop、視窗列表、外掛選項和更新器端點位於 src-tauri/tauri.conf.json。Webview 許可權在 src-tauri/capabilities/default.json 中——目前是 core:default 加上用於系統瀏覽器連結的 opener:allow-open-url——只有在原生功能需要時才擴大。

驗證工具

cargo test 覆蓋 Rust 邏輯——URL 解析、導航門禁、deep-link 對映、更新器通道、縮放和視窗偏好——node --check 校驗啟動頁,check:release-config 守住釋出構建。CI 會構建全部三個作業系統。

corepack pnpm --filter @supastack/desktop test
corepack pnpm --filter @supastack/desktop typecheck
corepack pnpm --filter @supastack/desktop check:release-config