mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-05 12:29:44 +08:00
feat(constants): expand supported file extensions and categorize text… (#6815)
* feat(constants): expand supported file extensions and categorize text file types * refactor(constants): remove binary file extensions * refactor(constants): remove Xcode project
This commit is contained in:
parent
31479ea2aa
commit
ca60cec30d
@ -4,135 +4,368 @@ export const audioExts = ['.mp3', '.wav', '.ogg', '.flac', '.aac']
|
|||||||
export const documentExts = ['.pdf', '.docx', '.pptx', '.xlsx', '.odt', '.odp', '.ods']
|
export const documentExts = ['.pdf', '.docx', '.pptx', '.xlsx', '.odt', '.odp', '.ods']
|
||||||
export const thirdPartyApplicationExts = ['.draftsExport']
|
export const thirdPartyApplicationExts = ['.draftsExport']
|
||||||
export const bookExts = ['.epub']
|
export const bookExts = ['.epub']
|
||||||
export const textExts = [
|
const textExtsByCategory = new Map([
|
||||||
'.txt', // 普通文本文件
|
[
|
||||||
'.md', // Markdown 文件
|
'language',
|
||||||
'.mdx', // Markdown 文件
|
[
|
||||||
'.html', // HTML 文件
|
'.js',
|
||||||
'.htm', // HTML 文件的另一种扩展名
|
'.mjs',
|
||||||
'.xml', // XML 文件
|
'.cjs',
|
||||||
'.json', // JSON 文件
|
'.ts',
|
||||||
'.yaml', // YAML 文件
|
'.jsx',
|
||||||
'.yml', // YAML 文件的另一种扩展名
|
'.tsx', // JavaScript/TypeScript
|
||||||
'.csv', // 逗号分隔值文件
|
'.py', // Python
|
||||||
'.tsv', // 制表符分隔值文件
|
'.java', // Java
|
||||||
'.ini', // 配置文件
|
'.cs', // C#
|
||||||
'.log', // 日志文件
|
'.cpp',
|
||||||
'.rtf', // 富文本格式文件
|
'.c',
|
||||||
'.org', // org-mode 文件
|
'.h',
|
||||||
'.wiki', // VimWiki 文件
|
'.hpp',
|
||||||
'.tex', // LaTeX 文件
|
'.cc',
|
||||||
'.bib', // BibTeX 文件
|
'.cxx',
|
||||||
'.srt', // 字幕文件
|
'.cppm',
|
||||||
'.xhtml', // XHTML 文件
|
'.ipp',
|
||||||
'.nfo', // 信息文件(主要用于场景发布)
|
'.ixx', // C/C++
|
||||||
'.conf', // 配置文件
|
'.php', // PHP
|
||||||
'.config', // 配置文件
|
'.rb', // Ruby
|
||||||
'.env', // 环境变量文件
|
'.pl', // Perl
|
||||||
'.rst', // reStructuredText 文件
|
'.go', // Go
|
||||||
'.php', // PHP 脚本文件,包含嵌入的 HTML
|
'.rs', // Rust
|
||||||
'.js', // JavaScript 文件(部分是文本,部分可能包含代码)
|
'.swift', // Swift
|
||||||
'.ts', // TypeScript 文件
|
'.kt',
|
||||||
'.jsp', // JavaServer Pages 文件
|
'.kts', // Kotlin
|
||||||
'.aspx', // ASP.NET 文件
|
'.scala', // Scala
|
||||||
'.bat', // Windows 批处理文件
|
'.lua', // Lua
|
||||||
'.sh', // Unix/Linux Shell 脚本文件
|
'.groovy', // Groovy
|
||||||
'.py', // Python 脚本文件
|
'.dart', // Dart
|
||||||
'.ipynb', // Jupyter 笔记本格式
|
'.hs', // Haskell
|
||||||
'.rb', // Ruby 脚本文件
|
'.clj',
|
||||||
'.pl', // Perl 脚本文件
|
'.cljs', // Clojure
|
||||||
'.sql', // SQL 脚本文件
|
'.elm', // Elm
|
||||||
'.css', // Cascading Style Sheets 文件
|
'.erl', // Erlang
|
||||||
'.less', // Less CSS 预处理器文件
|
'.ex',
|
||||||
'.scss', // Sass CSS 预处理器文件
|
'.exs', // Elixir
|
||||||
'.sass', // Sass 文件
|
'.ml',
|
||||||
'.styl', // Stylus CSS 预处理器文件
|
'.mli', // OCaml
|
||||||
'.coffee', // CoffeeScript 文件
|
'.fs', // F#
|
||||||
'.ino', // Arduino 代码文件
|
'.r',
|
||||||
'.asm', // Assembly 语言文件
|
'.R', // R
|
||||||
'.go', // Go 语言文件
|
'.sol', // Solidity
|
||||||
'.scala', // Scala 语言文件
|
'.awk', // AWK
|
||||||
'.swift', // Swift 语言文件
|
'.cob', // COBOL
|
||||||
'.kt', // Kotlin 语言文件
|
'.asm',
|
||||||
'.rs', // Rust 语言文件
|
'.s', // Assembly
|
||||||
'.lua', // Lua 语言文件
|
'.lisp',
|
||||||
'.groovy', // Groovy 语言文件
|
'.lsp', // Lisp
|
||||||
'.dart', // Dart 语言文件
|
'.coffee', // CoffeeScript
|
||||||
'.hs', // Haskell 语言文件
|
'.ino', // Arduino
|
||||||
'.clj', // Clojure 语言文件
|
'.jl', // Julia
|
||||||
'.cljs', // ClojureScript 语言文件
|
'.nim', // Nim
|
||||||
'.elm', // Elm 语言文件
|
'.zig', // Zig
|
||||||
'.erl', // Erlang 语言文件
|
'.d', // D语言
|
||||||
'.ex', // Elixir 语言文件
|
'.pas', // Pascal
|
||||||
'.exs', // Elixir 脚本文件
|
'.vb', // Visual Basic
|
||||||
'.pug', // Pug (formerly Jade) 模板文件
|
'.rkt', // Racket
|
||||||
'.haml', // Haml 模板文件
|
'.scm', // Scheme
|
||||||
'.slim', // Slim 模板文件
|
'.hx', // Haxe
|
||||||
'.tpl', // 模板文件(通用)
|
'.as', // ActionScript
|
||||||
'.ejs', // Embedded JavaScript 模板文件
|
'.pde', // Processing
|
||||||
'.hbs', // Handlebars 模板文件
|
'.f90',
|
||||||
'.mustache', // Mustache 模板文件
|
'.f',
|
||||||
'.jade', // Jade 模板文件 (已重命名为 Pug)
|
'.f03',
|
||||||
'.twig', // Twig 模板文件
|
'.for',
|
||||||
'.blade', // Blade 模板文件 (Laravel)
|
'.f95', // Fortran
|
||||||
'.vue', // Vue.js 单文件组件
|
'.adb',
|
||||||
'.jsx', // React JSX 文件
|
'.ads', // Ada
|
||||||
'.tsx', // React TSX 文件
|
'.pro', // Prolog
|
||||||
'.graphql', // GraphQL 查询语言文件
|
'.m',
|
||||||
'.gql', // GraphQL 查询语言文件
|
'.mm', // Objective-C/MATLAB
|
||||||
'.proto', // Protocol Buffers 文件
|
'.rpy', // Ren'Py
|
||||||
'.thrift', // Thrift 文件
|
'.ets', // OpenHarmony,
|
||||||
'.toml', // TOML 配置文件
|
'.uniswap', // DeFi
|
||||||
'.edn', // Clojure 数据表示文件
|
'.vy', // Vyper
|
||||||
'.cake', // CakePHP 配置文件
|
'.shader',
|
||||||
'.ctp', // CakePHP 视图文件
|
'.glsl',
|
||||||
'.cfm', // ColdFusion 标记语言文件
|
'.frag',
|
||||||
'.cfc', // ColdFusion 组件文件
|
'.vert',
|
||||||
'.m', // Objective-C 或 MATLAB 源文件
|
'.gd' // Godot
|
||||||
'.mm', // Objective-C++ 源文件
|
]
|
||||||
'.gradle', // Gradle 构建文件
|
],
|
||||||
'.groovy', // Gradle 构建文件
|
[
|
||||||
'.kts', // Kotlin Script 文件
|
'script',
|
||||||
'.java', // Java 代码文件
|
[
|
||||||
'.cs', // C# 代码文件
|
'.sh', // Shell
|
||||||
'.cpp', // C++ 代码文件
|
'.bat',
|
||||||
'.c', // C++ 代码文件
|
'.cmd', // Windows批处理
|
||||||
'.h', // C++ 头文件
|
'.ps1', // PowerShell
|
||||||
'.hpp', // C++ 头文件
|
'.tcl',
|
||||||
'.cc', // C++ 源文件
|
'.do', // Tcl
|
||||||
'.cxx', // C++ 源文件
|
'.ahk', // AutoHotkey
|
||||||
'.cppm', // C++20 模块接口文件
|
'.zsh', // Zsh
|
||||||
'.ipp', // 模板实现文件
|
'.fish', // Fish shell
|
||||||
'.ixx', // C++20 模块实现文件
|
'.csh', // C shell
|
||||||
'.f90', // Fortran 90 源文件
|
'.vbs', // VBScript
|
||||||
'.f', // Fortran 固定格式源代码文件
|
'.applescript', // AppleScript
|
||||||
'.f03', // Fortran 2003+ 源代码文件
|
'.au3', // AutoIt
|
||||||
'.ahk', // AutoHotKey 语言文件
|
'.bash',
|
||||||
'.tcl', // Tcl 脚本
|
'.nu'
|
||||||
'.do', // Questa 或 Modelsim Tcl 脚本
|
]
|
||||||
'.v', // Verilog 源文件
|
],
|
||||||
'.sv', // SystemVerilog 源文件
|
[
|
||||||
'.svh', // SystemVerilog 头文件
|
'style',
|
||||||
'.vhd', // VHDL 源文件
|
[
|
||||||
'.vhdl', // VHDL 源文件
|
'.css', // CSS
|
||||||
'.lef', // Library Exchange Format
|
'.less', // Less
|
||||||
'.def', // Design Exchange Format
|
'.scss',
|
||||||
'.edif', // Electronic Design Interchange Format
|
'.sass', // Sass
|
||||||
'.sdf', // Standard Delay Format
|
'.styl', // Stylus
|
||||||
'.sdc', // Synopsys Design Constraints
|
'.pcss', // PostCSS
|
||||||
'.xdc', // Xilinx Design Constraints
|
'.postcss' // PostCSS
|
||||||
'.rpt', // 报告文件
|
]
|
||||||
'.lisp', // Lisp 脚本
|
],
|
||||||
'.il', // Cadence SKILL 脚本
|
[
|
||||||
'.ils', // Cadence SKILL++ 脚本
|
'template',
|
||||||
'.sp', // SPICE netlist 文件
|
[
|
||||||
'.spi', // SPICE netlist 文件
|
'.vue', // Vue.js
|
||||||
'.cir', // SPICE netlist 文件
|
'.pug',
|
||||||
'.net', // SPICE netlist 文件
|
'.jade', // Pug/Jade
|
||||||
'.scs', // Spectre netlist 文件
|
'.haml', // Haml
|
||||||
'.asc', // LTspice netlist schematic 文件
|
'.slim', // Slim
|
||||||
'.tf' // Technology File
|
'.tpl', // 通用模板
|
||||||
]
|
'.ejs', // EJS
|
||||||
|
'.hbs', // Handlebars
|
||||||
|
'.mustache', // Mustache
|
||||||
|
'.twig', // Twig
|
||||||
|
'.blade', // Blade (Laravel)
|
||||||
|
'.liquid', // Liquid
|
||||||
|
'.jinja',
|
||||||
|
'.jinja2',
|
||||||
|
'.j2', // Jinja
|
||||||
|
'.erb', // ERB
|
||||||
|
'.vm', // Velocity
|
||||||
|
'.ftl', // FreeMarker
|
||||||
|
'.svelte', // Svelte
|
||||||
|
'.astro' // Astro
|
||||||
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'config',
|
||||||
|
[
|
||||||
|
'.ini', // INI配置
|
||||||
|
'.conf',
|
||||||
|
'.config', // 通用配置
|
||||||
|
'.env', // 环境变量
|
||||||
|
'.toml', // TOML
|
||||||
|
'.cfg', // 通用配置
|
||||||
|
'.properties', // Java属性
|
||||||
|
'.desktop', // Linux桌面文件
|
||||||
|
'.service', // systemd服务
|
||||||
|
'.rc',
|
||||||
|
'.bashrc',
|
||||||
|
'.zshrc', // Shell配置
|
||||||
|
'.fishrc', // Fish shell配置
|
||||||
|
'.vimrc', // Vim配置
|
||||||
|
'.htaccess', // Apache配置
|
||||||
|
'.robots', // robots.txt
|
||||||
|
'.editorconfig', // EditorConfig
|
||||||
|
'.eslintrc', // ESLint
|
||||||
|
'.prettierrc', // Prettier
|
||||||
|
'.babelrc', // Babel
|
||||||
|
'.npmrc', // npm
|
||||||
|
'.dockerignore', // Docker ignore
|
||||||
|
'.npmignore',
|
||||||
|
'.yarnrc',
|
||||||
|
'.prettierignore',
|
||||||
|
'.eslintignore',
|
||||||
|
'.browserslistrc',
|
||||||
|
'.json5',
|
||||||
|
'.tfvars'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'document',
|
||||||
|
[
|
||||||
|
'.txt',
|
||||||
|
'.text', // 纯文本
|
||||||
|
'.md',
|
||||||
|
'.mdx', // Markdown
|
||||||
|
'.html',
|
||||||
|
'.htm',
|
||||||
|
'.xhtml', // HTML
|
||||||
|
'.xml', // XML
|
||||||
|
'.org', // Org-mode
|
||||||
|
'.wiki', // Wiki
|
||||||
|
'.tex',
|
||||||
|
'.bib', // LaTeX
|
||||||
|
'.rst', // reStructuredText
|
||||||
|
'.rtf', // 富文本
|
||||||
|
'.nfo', // 信息文件
|
||||||
|
'.adoc',
|
||||||
|
'.asciidoc', // AsciiDoc
|
||||||
|
'.pod', // Perl文档
|
||||||
|
'.1',
|
||||||
|
'.2',
|
||||||
|
'.3',
|
||||||
|
'.4',
|
||||||
|
'.5',
|
||||||
|
'.6',
|
||||||
|
'.7',
|
||||||
|
'.8',
|
||||||
|
'.9', // man页面
|
||||||
|
'.man', // man页面
|
||||||
|
'.texi',
|
||||||
|
'.texinfo', // Texinfo
|
||||||
|
'.readme',
|
||||||
|
'.me', // README
|
||||||
|
'.changelog', // 变更日志
|
||||||
|
'.license', // 许可证
|
||||||
|
'.authors', // 作者文件
|
||||||
|
'.po',
|
||||||
|
'.pot'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'data',
|
||||||
|
[
|
||||||
|
'.json', // JSON
|
||||||
|
'.jsonc', // JSON with comments
|
||||||
|
'.yaml',
|
||||||
|
'.yml', // YAML
|
||||||
|
'.csv',
|
||||||
|
'.tsv', // 分隔值文件
|
||||||
|
'.edn', // Clojure数据
|
||||||
|
'.jsonl',
|
||||||
|
'.ndjson', // 换行分隔JSON
|
||||||
|
'.geojson', // GeoJSON
|
||||||
|
'.gpx', // GPS Exchange
|
||||||
|
'.kml', // Keyhole Markup
|
||||||
|
'.rss',
|
||||||
|
'.atom', // Feed格式
|
||||||
|
'.vcf', // vCard
|
||||||
|
'.ics', // iCalendar
|
||||||
|
'.ldif', // LDAP数据交换
|
||||||
|
'.pbtxt',
|
||||||
|
'.map'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'build',
|
||||||
|
[
|
||||||
|
'.gradle', // Gradle
|
||||||
|
'.make',
|
||||||
|
'.mk', // Make
|
||||||
|
'.cmake', // CMake
|
||||||
|
'.sbt', // SBT
|
||||||
|
'.rake', // Rake
|
||||||
|
'.spec', // RPM spec
|
||||||
|
'.pom',
|
||||||
|
'.build', // Meson
|
||||||
|
'.bazel' // Bazel
|
||||||
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'database',
|
||||||
|
[
|
||||||
|
'.sql', // SQL
|
||||||
|
'.ddl',
|
||||||
|
'.dml', // DDL/DML
|
||||||
|
'.plsql', // PL/SQL
|
||||||
|
'.psql', // PostgreSQL
|
||||||
|
'.cypher', // Cypher
|
||||||
|
'.sparql' // SPARQL
|
||||||
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'web',
|
||||||
|
[
|
||||||
|
'.graphql',
|
||||||
|
'.gql', // GraphQL
|
||||||
|
'.proto', // Protocol Buffers
|
||||||
|
'.thrift', // Thrift
|
||||||
|
'.wsdl', // WSDL
|
||||||
|
'.raml', // RAML
|
||||||
|
'.swagger',
|
||||||
|
'.openapi' // API文档
|
||||||
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'version',
|
||||||
|
[
|
||||||
|
'.gitignore', // Git ignore
|
||||||
|
'.gitattributes', // Git attributes
|
||||||
|
'.gitconfig', // Git config
|
||||||
|
'.hgignore', // Mercurial ignore
|
||||||
|
'.bzrignore', // Bazaar ignore
|
||||||
|
'.svnignore', // SVN ignore
|
||||||
|
'.githistory' // Git history
|
||||||
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'subtitle',
|
||||||
|
[
|
||||||
|
'.srt',
|
||||||
|
'.sub',
|
||||||
|
'.ass' // 字幕格式
|
||||||
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'log',
|
||||||
|
[
|
||||||
|
'.log',
|
||||||
|
'.rpt' // 日志和报告 (移除了.out,因为通常是二进制可执行文件)
|
||||||
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'eda',
|
||||||
|
[
|
||||||
|
'.v',
|
||||||
|
'.sv',
|
||||||
|
'.svh', // Verilog/SystemVerilog
|
||||||
|
'.vhd',
|
||||||
|
'.vhdl', // VHDL
|
||||||
|
'.lef',
|
||||||
|
'.def', // LEF/DEF
|
||||||
|
'.edif', // EDIF
|
||||||
|
'.sdf', // SDF
|
||||||
|
'.sdc',
|
||||||
|
'.xdc', // 约束文件
|
||||||
|
'.sp',
|
||||||
|
'.spi',
|
||||||
|
'.cir',
|
||||||
|
'.net', // SPICE
|
||||||
|
'.scs', // Spectre
|
||||||
|
'.asc', // LTspice
|
||||||
|
'.tf', // Technology File
|
||||||
|
'.il',
|
||||||
|
'.ils' // SKILL
|
||||||
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'game',
|
||||||
|
[
|
||||||
|
'.mtl', // Material Template Library
|
||||||
|
'.x3d', // X3D文件
|
||||||
|
'.gltf', // glTF JSON
|
||||||
|
'.prefab', // Unity预制体 (YAML格式)
|
||||||
|
'.meta' // Unity元数据文件 (YAML格式)
|
||||||
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'other',
|
||||||
|
[
|
||||||
|
'.mcfunction', // Minecraft函数
|
||||||
|
'.jsp', // JSP
|
||||||
|
'.aspx', // ASP.NET
|
||||||
|
'.ipynb', // Jupyter Notebook
|
||||||
|
'.cake',
|
||||||
|
'.ctp', // CakePHP
|
||||||
|
'.cfm',
|
||||||
|
'.cfc' // ColdFusion
|
||||||
|
]
|
||||||
|
]
|
||||||
|
])
|
||||||
|
|
||||||
|
export const textExts = Array.from(textExtsByCategory.values()).flat()
|
||||||
|
|
||||||
export const ZOOM_LEVELS = [0.25, 0.33, 0.5, 0.67, 0.75, 0.8, 0.9, 1, 1.1, 1.25, 1.5, 1.75, 2, 2.5, 3, 4, 5]
|
export const ZOOM_LEVELS = [0.25, 0.33, 0.5, 0.67, 0.75, 0.8, 0.9, 1, 1.1, 1.25, 1.5, 1.75, 2, 2.5, 3, 4, 5]
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user