feat: 动态插件系统 M0-M3(两层能力模型 + pi 原生契约 + Obsidian 式 SDK)
This commit is contained in:
@@ -1,7 +1,27 @@
|
||||
import { copyFileSync, mkdirSync } from 'node:fs'
|
||||
import { resolve } from 'node:path'
|
||||
import { defineConfig, externalizeDepsPlugin } from 'electron-vite'
|
||||
import react from '@vitejs/plugin-react'
|
||||
import tailwindcss from '@tailwindcss/vite'
|
||||
import type { Plugin } from 'vite'
|
||||
|
||||
/** 构建期把主题 token 样式表拷到 out/renderer/tokens.css:
|
||||
* 生产环境 src/ 不进包,插件页经 peer://assets/tokens.css 引用它保证深浅色/accent 连续 */
|
||||
function copyTokensCss(): Plugin {
|
||||
return {
|
||||
name: 'aso-copy-tokens-css',
|
||||
closeBundle() {
|
||||
const src = resolve(__dirname, 'src/renderer/src/styles/beautifului.css')
|
||||
const outDir = resolve(__dirname, 'out/renderer')
|
||||
try {
|
||||
mkdirSync(outDir, { recursive: true })
|
||||
copyFileSync(src, resolve(outDir, 'tokens.css'))
|
||||
} catch (err) {
|
||||
this.warn(`tokens.css 拷贝失败: ${err instanceof Error ? err.message : String(err)}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default defineConfig({
|
||||
main: {
|
||||
@@ -49,8 +69,12 @@ export default defineConfig({
|
||||
// 默认 5173 常被圈进保留段导致 EACCES;固定用 5323 避开(若日后再撞,
|
||||
// 可换端口,或管理员执行 net stop winnat && net start winnat 后
|
||||
// netsh int ipv4 add excludedportrange protocol=tcp startport=<端口> numberofports=1 永久占用)
|
||||
server: { port: 5323 },
|
||||
plugins: [react(), tailwindcss()],
|
||||
server: {
|
||||
port: 5323,
|
||||
// 允许 dev server 读取工作区源码包(@aso/plugin-sdk 从 packages/ 链接进来)
|
||||
fs: { allow: [resolve(__dirname, '../..')] }
|
||||
},
|
||||
plugins: [react(), tailwindcss(), copyTokensCss()],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': resolve(__dirname, 'src/renderer/src'),
|
||||
|
||||
Reference in New Issue
Block a user