{"id":13496108,"url":"https://github.com/coderhyh/unplugin-auto-export","last_synced_at":"2026-01-15T00:47:16.302Z","repository":{"id":196258162,"uuid":"695657186","full_name":"coderhyh/unplugin-auto-export","owner":"coderhyh","description":"Automates the maintenance of export statements in the index.ts file.","archived":false,"fork":false,"pushed_at":"2025-05-09T15:06:00.000Z","size":289,"stargazers_count":36,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-14T09:57:09.382Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/coderhyh.png","metadata":{"files":{"readme":"README-zh.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["antfu"]}},"created_at":"2023-09-23T20:34:41.000Z","updated_at":"2025-10-06T09:42:28.000Z","dependencies_parsed_at":"2024-01-05T10:30:42.370Z","dependency_job_id":"70f77ea2-b79c-431a-aa2b-cf090cb069ea","html_url":"https://github.com/coderhyh/unplugin-auto-export","commit_stats":null,"previous_names":["coderhyh/unplugin-auto-export"],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/coderhyh/unplugin-auto-export","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderhyh%2Funplugin-auto-export","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderhyh%2Funplugin-auto-export/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderhyh%2Funplugin-auto-export/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderhyh%2Funplugin-auto-export/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coderhyh","download_url":"https://codeload.github.com/coderhyh/unplugin-auto-export/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderhyh%2Funplugin-auto-export/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28440352,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-15T00:34:46.850Z","status":"ssl_error","status_checked_at":"2026-01-15T00:34:46.551Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T19:01:42.373Z","updated_at":"2026-01-15T00:47:16.288Z","avatar_url":"https://github.com/coderhyh.png","language":"TypeScript","funding_links":["https://github.com/sponsors/antfu"],"categories":["TypeScript","others","Plugins"],"sub_categories":["Framework-agnostic Plugins"],"readme":"# unplugin-auto-export\n\n`unplugin-auto-export` 是一个专为 Vite 和 Webpack 构建工具设计的插件，它可以自动化维护 `index.ts` 文件中的导出语句，减轻手动编写 `export` 语句的工作负担。在大型项目中，特别是在需要管理许多导出语句时，这个插件尤其有用。\n\n## 功能特点\n\n- 自动监听指定的文件夹以检测文件变化\n- 更新这些文件夹内的 `index.ts` 文件，写入正确的 `export` 语句\n- 可配置以忽略特定文件或文件夹\n- 支持 `ts | js` 的文件扩展名（默认为 `ts`）\n- 自定义导出格式\n\n## 安装\n\n您可以使用 npm 或 yarn 安装 `unplugin-auto-export` 插件：\n\n```bash\nnpm install unplugin-auto-export --save-dev\n# 或\nyarn add unplugin-auto-export --dev\n```\n\n## 使用方法\n\n要在您的 Vite 项目中使用 `unplugin-auto-export` 插件，请按照以下步骤操作：\n\n1. 配置插件\n\n**vite**: 在 `vite.config.js` 文件中导入插件并指定配置选项:\n\n```typescript\nimport { defineConfig } from 'vite';\nimport AutoExport from 'unplugin-auto-export/vite';\n\nexport default defineConfig({\n  // ... 其他 Vite 配置选项\n\n  plugins: [\n    AutoExport({\n      // 要监听的文件夹, 路径可以使用别名; 以 /* 结尾即可\n      path: ['~/views/**/{components,hooks}/*', './src/hooks/*'],\n      // 要忽略的文件夹或文件（可选）\n      ignore: ['**/node_modules/*'],\n      // 文件扩展名（默认为 'ts'）'ts' | 'js'\n      extname: 'ts',\n      // 自定义导出格式\n      formatter: (filename, extname) =\u003e `export * from './${filename}'`\n    }),\n  ],\n});\n```\n\n**webpack**: 在 `webpack.config.js` 文件中导入插件并指定配置选项:\n\n```javascript\nmodule.exports = {\n  /* ... */\n  plugins: [\n    require('unplugin-auto-export/webpack').default({ /* options */ }),\n  ],\n}\n```\n\n2. 运行你的项目，`unplugin-auto-export` 插件将自动维护指定文件夹中的 `index.ts` 文件。\n\n## 配置选项\n\n- `path`(`string` 或 `string[]`): 要监听变化的文件夹。可以是单个字符串或字符串数组\n  - 可以使用自己配置的路径别名\n  - **使用通配符匹配模式, 如: `~/views/**/{components,hooks}/*` 或者 `src/hooks/*.ts`**\n- `ignore`(`string[]`): 在监听时要忽略的文件夹或文件。**（可选）**\n  - 同 `path` 规则\n- `extname`(`string`): 用于 `index` 文件的文件扩展名（默认为 `ts`）\n  - 支持 `ts | js`\n- `formatter`(`(filename: string, extname: string) =\u003e string`): 自定义导出格式\n\n## 错误处理\n\n- `unplugin-auto-export` 插件强制执行特定的路径规则：`/\\/\\*(\\.[\\w\\d]+)?$/`\n  - **使用通配符模式, 只是需要结尾为 `/*` or `/*.ts`。通常结尾为 `/*` 即可**\n  - 因为只有这样才会表示监听某个文件夹内部文件\n- 如果路径不符合此规则，插件将抛出错误，并显示消息：`Path rule does not match. Please check the path format.`\n- 正确例子: `~/views/**/{components,hooks}/*` 或者 `src/hooks/*.ts`\n  - `~` 是配置的路径别名\n\n## 例子\n\n[Vite](/playground/vite)\n\n[Webpack](/playground/webpack)\n\n## 贡献\n\n如果您遇到任何问题或有改进建议，欢迎提交[问题](https://github.com/coderhyh/unplugin-auto-export/issues)或[贡献代码](https://github.com/coderhyh/unplugin-auto-export)。\n\n## 许可证\n\n该项目采用 MIT 许可证授权。有关详细信息，请参阅 [LICENSE](/LICENSE) 文件。\n\n## 作者\n\nGitHub：[coderhyh](https://github.com/coderhyh)\n\n## 附加信息\n\n有关更多信息和更新，请访问[`unplugin-auto-export` GitHub](https://github.com/coderhyh/unplugin-auto-export) 仓库。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoderhyh%2Funplugin-auto-export","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoderhyh%2Funplugin-auto-export","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoderhyh%2Funplugin-auto-export/lists"}