mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-19 06:30:10 +08:00
* feat(discover): implement Discover feature with routing and UI components - Added a new Discover page with sidebar and main content areas. - Integrated routing for Discover, including subcategories and tabs. - Created components for Discover sidebar and main content. - Updated localization files to include new Discover titles and labels. - Refactored existing components to accommodate the new Discover feature. - Enhanced sidebar icons and navigation for better user experience. * feat(discover): enhance Discover page with Tailwind CSS integration and routing improvements - Added Tailwind CSS import to the entry point for styling. - Updated the ThemeProvider to dynamically apply Tailwind themes based on user selection. - Refactored Discover page to utilize new ROUTERS structure for better routing management. - Simplified category handling in useDiscoverCategories hook by leveraging ROUTERS_ENTRIES. - Introduced InternalCategory interface for better type management in Discover components. - Cleaned up unused code and comments for improved readability. * fix: update import statement for linguist-languages in update-languages.ts * fix: standardize import quotes and improve localization files - Updated import statements in use-mobile.ts and motionVariants.ts to use single quotes for consistency. - Added new localization entries for the "discover" section in multiple language files, including English, Japanese, Russian, Traditional Chinese, Greek, Spanish, French, and Portuguese. * refactor(discover): simplify Discover page structure and improve routing logic - Refactored DiscoverPage component to streamline tab and sidebar handling. - Updated routing logic to utilize a new ROUTERS_MAP for better category management. - Removed unused props and simplified state management in useDiscoverCategories hook. - Enhanced DiscoverSidebar and DiscoverMain components for improved clarity and performance. - Adjusted CherryStoreType enum values for consistency in path definitions. * fix: update file upload body type in MineruPreprocessProvider - Changed the body of the fetch request from a Buffer to a Uint8Array to ensure proper handling of binary data during PDF uploads. * fix: ensure Blob creation uses a copy of byte arrays for image handling - Updated Blob creation in ImageGenerationMiddleware, ImageViewer, and MessageImage components to use `slice()` on byte arrays, preventing potential mutations of the original data. * chore: update Vite React SWC plugin and adjust Electron config for conditional styling - Upgraded `@vitejs/plugin-react-swc` from version 3.9.0 to 3.11.0 for improved performance and features. - Modified Electron Vite configuration to conditionally apply styled-components plugin based on the VITEST environment variable. - Updated snapshot tests for `InputEmbeddingDimension` and `Spinner` components to reflect style changes. * chore: upgrade @swc/plugin-styled-components to version 9.0.2 in package.json and yarn.lock * refactor: streamline styled-components plugin configuration in Electron Vite setup - Consolidated the styled-components plugin configuration in the Electron Vite config file for improved readability and maintainability. - Removed conditional application of the plugin based on the VITEST environment variable, ensuring consistent styling behavior across environments. * i18n: update translations for discover section across multiple languages - Replaced placeholder text with accurate translations for the "discover" section in English, Japanese, Russian, Traditional Chinese, Greek, Spanish, French, and Portuguese. - Ensured consistency in terminology and improved clarity in user-facing messages. * i18n: update "discover" title translations across multiple languages - Updated the "discover" title in English, Japanese, Russian, Traditional Chinese, Greek, Spanish, French, and Portuguese to ensure accurate and consistent terminology. - Adjusted related key mappings in the localization files for improved clarity in user-facing messages. * chore: update lucide-react to version 0.536.0 and clean up tsconfig paths * fix: update input style in snapshot tests and format message mentions in MessageContent component
112 lines
3.5 KiB
TypeScript
112 lines
3.5 KiB
TypeScript
import react from '@vitejs/plugin-react-swc'
|
|
import { CodeInspectorPlugin } from 'code-inspector-plugin'
|
|
import { defineConfig, externalizeDepsPlugin } from 'electron-vite'
|
|
import { resolve } from 'path'
|
|
import { visualizer } from 'rollup-plugin-visualizer'
|
|
|
|
const visualizerPlugin = (type: 'renderer' | 'main') => {
|
|
return process.env[`VISUALIZER_${type.toUpperCase()}`] ? [visualizer({ open: true })] : []
|
|
}
|
|
|
|
const isDev = process.env.NODE_ENV === 'development'
|
|
const isProd = process.env.NODE_ENV === 'production'
|
|
|
|
export default defineConfig({
|
|
main: {
|
|
plugins: [externalizeDepsPlugin(), ...visualizerPlugin('main')],
|
|
resolve: {
|
|
alias: {
|
|
'@main': resolve('src/main'),
|
|
'@types': resolve('src/renderer/src/types'),
|
|
'@shared': resolve('packages/shared'),
|
|
'@logger': resolve('src/main/services/LoggerService'),
|
|
'@mcp-trace/trace-core': resolve('packages/mcp-trace/trace-core'),
|
|
'@mcp-trace/trace-node': resolve('packages/mcp-trace/trace-node')
|
|
}
|
|
},
|
|
build: {
|
|
rollupOptions: {
|
|
external: ['@libsql/client', 'bufferutil', 'utf-8-validate'],
|
|
output: {
|
|
manualChunks: undefined, // 彻底禁用代码分割 - 返回 null 强制单文件打包
|
|
inlineDynamicImports: true // 内联所有动态导入,这是关键配置
|
|
}
|
|
},
|
|
sourcemap: isDev
|
|
},
|
|
esbuild: isProd ? { legalComments: 'none' } : {},
|
|
optimizeDeps: {
|
|
noDiscovery: isDev
|
|
}
|
|
},
|
|
preload: {
|
|
plugins: [
|
|
react({
|
|
tsDecorators: true
|
|
}),
|
|
externalizeDepsPlugin()
|
|
],
|
|
resolve: {
|
|
alias: {
|
|
'@shared': resolve('packages/shared'),
|
|
'@mcp-trace/trace-core': resolve('packages/mcp-trace/trace-core')
|
|
}
|
|
},
|
|
build: {
|
|
sourcemap: isDev
|
|
}
|
|
},
|
|
renderer: {
|
|
plugins: [
|
|
(async () => (await import('@tailwindcss/vite')).default())(),
|
|
react({
|
|
tsDecorators: true,
|
|
plugins: [
|
|
[
|
|
'@swc/plugin-styled-components',
|
|
{
|
|
displayName: true, // 开发环境下启用组件名称
|
|
fileName: false, // 不在类名中包含文件名
|
|
pure: true, // 优化性能
|
|
ssr: false // 不需要服务端渲染
|
|
}
|
|
]
|
|
]
|
|
}),
|
|
...(isDev ? [CodeInspectorPlugin({ bundler: 'vite' })] : []), // 只在开发环境下启用 CodeInspectorPlugin
|
|
...visualizerPlugin('renderer')
|
|
],
|
|
resolve: {
|
|
alias: {
|
|
'@renderer': resolve('src/renderer/src'),
|
|
'@shared': resolve('packages/shared'),
|
|
'@logger': resolve('src/renderer/src/services/LoggerService'),
|
|
'@mcp-trace/trace-core': resolve('packages/mcp-trace/trace-core'),
|
|
'@mcp-trace/trace-web': resolve('packages/mcp-trace/trace-web')
|
|
}
|
|
},
|
|
optimizeDeps: {
|
|
exclude: ['pyodide'],
|
|
esbuildOptions: {
|
|
target: 'esnext' // for dev
|
|
}
|
|
},
|
|
worker: {
|
|
format: 'es'
|
|
},
|
|
build: {
|
|
target: 'esnext', // for build
|
|
rollupOptions: {
|
|
input: {
|
|
index: resolve(__dirname, 'src/renderer/index.html'),
|
|
miniWindow: resolve(__dirname, 'src/renderer/miniWindow.html'),
|
|
selectionToolbar: resolve(__dirname, 'src/renderer/selectionToolbar.html'),
|
|
selectionAction: resolve(__dirname, 'src/renderer/selectionAction.html'),
|
|
traceWindow: resolve(__dirname, 'src/renderer/traceWindow.html')
|
|
}
|
|
}
|
|
},
|
|
esbuild: isProd ? { legalComments: 'none' } : {}
|
|
}
|
|
})
|