{"id":21058289,"url":"https://github.com/bluefrog130/vite-plugin-barrels","last_synced_at":"2025-07-28T19:07:07.339Z","repository":{"id":57393068,"uuid":"440998215","full_name":"BlueFrog130/vite-plugin-barrels","owner":"BlueFrog130","description":null,"archived":false,"fork":false,"pushed_at":"2023-03-06T14:20:32.000Z","size":12,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-20T23:19:15.977Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/BlueFrog130.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-12-22T22:22:22.000Z","updated_at":"2023-02-05T16:46:55.000Z","dependencies_parsed_at":"2023-02-18T21:15:36.995Z","dependency_job_id":null,"html_url":"https://github.com/BlueFrog130/vite-plugin-barrels","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlueFrog130%2Fvite-plugin-barrels","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlueFrog130%2Fvite-plugin-barrels/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlueFrog130%2Fvite-plugin-barrels/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlueFrog130%2Fvite-plugin-barrels/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BlueFrog130","download_url":"https://codeload.github.com/BlueFrog130/vite-plugin-barrels/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254447795,"owners_count":22072754,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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-11-19T17:07:24.481Z","updated_at":"2025-07-28T19:07:07.319Z","avatar_url":"https://github.com/BlueFrog130.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# vite-plugin-barrels\n\nAutomatically generate barrels for your folders! This plugin taps into the Vite plugin system to automatically recreate barrels on build and whenever a file gets updated or created.\n\n|:warning: Warning|\n|:----------------|\n|This will remove all content existing in the `index` of the `entry` directory and all subdirectories. Only point the `entry` at a folder with no `index` files!|\n\n## Installation\n\n```console\nnpm install -D vite-plugin-barrels\n```\n\n## Usage\n\nAdd the following to your Vite configuration:\n\n```js\n// vite.config.js\nimport barrels from 'vite-plugin-barrels';\n\nexport default {\n    // ...\n    plugins: [\n        barrels({\n            entry: '\u003cyour entry folder\u003e',\n            extension: '\u003cwhatever extension\u003e'\n        })\n    ]\n}\n```\n\n## Example\n\nThis is an example for [Svelte](https://svelte.dev). The extension to barrel is `.svelte` with the entry being `src/lib`.\n\n```js\n// vite.config.js\nimport barrels from 'vite-plugin-barrels';\n\nexport default {\n    // ...\n    plugins: [\n        barrels({\n            entry: 'src/lib',\n            extension: '.svelte'\n        })\n    ]\n}\n```\n\nBefore the build, the directory structure looks like this:\n\n```bash\nsrc\n└───lib\n    │   Another.svelte\n    │   Component.svelte\n    │\n    └───layout\n            Container.svelte\n```\n\nAfter the build, the barrels get generated:\n\n```bash\nsrc\n└───lib\n    │   Another.svelte\n    │   Component.svelte\n    │   index.ts\n    │\n    └───layout\n            Container.svelte\n            index.ts\n```\n\nBarrel content:\n\n```ts\n// src/lib/index.ts\n// Generated by vite-plugin-barrels\n\nexport * from \"./layout\";\nexport { default as Another } from \"./Another.svelte\";\nexport { default as Test } from \"./Test.svelte\";\n\n```\n\n```ts\n// src/lib/layout/index.ts\n// Generated by vite-plugin-barrels\n\nexport { default as Container } from \"./Container.svelte\";\n\n```\n\n## Configuration\n\n```ts\ninterface Options {\n    /**\n     * Starting directory\n     */\n    entry: string;\n\n    /**\n     * File extension to search for\n     */\n    extension: string | string[] | RegExp;\n\n    /**\n     * Weather or not to use typescript\n     * @default true When tsconfig.json is found\n     */\n    ts?: boolean;\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbluefrog130%2Fvite-plugin-barrels","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbluefrog130%2Fvite-plugin-barrels","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbluefrog130%2Fvite-plugin-barrels/lists"}