{"id":17777176,"url":"https://github.com/stacksjs/bun-plugin-auto-imports","last_synced_at":"2025-03-15T18:33:39.950Z","repository":{"id":259462999,"uuid":"877929767","full_name":"stacksjs/bun-plugin-auto-imports","owner":"stacksjs","description":"Auto Imports support for Bun.","archived":false,"fork":false,"pushed_at":"2025-03-01T11:38:11.000Z","size":419,"stargazers_count":4,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-07T17:26:12.399Z","etag":null,"topics":["auto-imports","bun","bun-plugin"],"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/stacksjs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["stacksjs","chrisbbreuer"],"open_collective":"stacksjs"}},"created_at":"2024-10-24T13:39:48.000Z","updated_at":"2025-03-07T09:55:37.000Z","dependencies_parsed_at":"2024-12-02T16:43:03.453Z","dependency_job_id":"0229ed93-1193-4efe-a520-a2e56e29e499","html_url":"https://github.com/stacksjs/bun-plugin-auto-imports","commit_stats":{"total_commits":4,"total_committers":2,"mean_commits":2.0,"dds":0.25,"last_synced_commit":"35cb56ca3e129fae6453d947cf3f840898c61db8"},"previous_names":["stacksjs/bun-plugin-auto-imports"],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stacksjs%2Fbun-plugin-auto-imports","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stacksjs%2Fbun-plugin-auto-imports/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stacksjs%2Fbun-plugin-auto-imports/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stacksjs%2Fbun-plugin-auto-imports/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stacksjs","download_url":"https://codeload.github.com/stacksjs/bun-plugin-auto-imports/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243126810,"owners_count":20240493,"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":["auto-imports","bun","bun-plugin"],"created_at":"2024-10-26T23:05:25.266Z","updated_at":"2025-03-15T18:33:39.942Z","avatar_url":"https://github.com/stacksjs.png","language":"TypeScript","funding_links":["https://github.com/sponsors/stacksjs","https://github.com/sponsors/chrisbbreuer","https://opencollective.com/stacksjs"],"categories":[],"sub_categories":[],"readme":"![Social Card of Bun Plugin Auto Imports](https://github.com/stacksjs/bun-plugin-auto-imports/blob/main/.github/art/cover.png)\n\n[![npm version][npm-version-src]][npm-version-href]\n[![GitHub Actions][github-actions-src]][github-actions-href]\n[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)\n[![npm downloads][npm-downloads-src]][npm-downloads-href]\n\u003c!-- [![Codecov][codecov-src]][codecov-href] --\u003e\n\nThis Bun plugin allows for support of auto-imports in your server-side code.\n\n## Features\n\n- Auto-imports support for Bun\n\n## Usage\n\n```bash\nbun install -d bun-plugin-auto-imports\n```\n\nYou may now use the plugin:\n\n```ts\n// index.ts\nimport type { AutoImportsOptions } from 'bun-plugin-auto-imports'\nimport { plugin } from 'bun'\nimport { autoImports } from 'bun-plugin-auto-imports'\n\nconst options: AutoImportsOptions = {\n  presets: ['solid-js'], // any unimport presets are valid\n  imports: [{ name: 'z', from: 'zod' }],\n  dirs: ['./src'],\n  dts: `./src/auto-import.d.ts`, // default is `./auto-import.d.ts`\n}\n\nplugin(autoImports(options))\n\nBun.serve({\n  fetch: handler,\n  port: 3000,\n})\n```\n\nIn your \"server file,\" you may now use the auto-imported modules:\n\n```ts\n// server.ts\n// `z` is auto imported from zod\nconst Body = z.object({\n  msg: z.string(),\n})\n\nexport async function handler(req: Request) {\n  try {\n    const body = await req.json()\n    const data = Body.parse(body)\n\n    return new Response(`Received: ${data.msg}`)\n  }\n  catch (e) {\n    return new Response('Invalid body', { status: 400 })\n  }\n}\n```\n\n\u003e [!NOTE]\n\u003e If you are familiar with `unimport`, `AutoImportsOptions` proxies `UnimportOptions`.\n\n## Testing\n\n```bash\nbun test\n```\n\n## Changelog\n\nPlease see our [releases](https://github.com/stacksjs/bun-plugin-auto-imports/releases) page for more information on what has changed recently.\n\n## Contributing\n\nPlease review the [Contributing Guide](https://github.com/stacksjs/contributing) for details.\n\n## Community\n\nFor help, discussion about best practices, or any other conversation that would benefit from being searchable:\n\n[Discussions on GitHub](https://github.com/stacksjs/stacks/discussions)\n\nFor casual chit-chat with others using this package:\n\n[Join the Stacks Discord Server](https://discord.gg/stacksjs)\n\n## Postcardware\n\n“Software that is free, but hopes for a postcard.” We love receiving postcards from around the world showing where `bun-plugin-auto-imports` is being used! We showcase them on our website too.\n\nOur address: Stacks.js, 12665 Village Ln #2306, Playa Vista, CA 90094, United States 🌎\n\n## Sponsors\n\nWe would like to extend our thanks to the following sponsors for funding Stacks development. If you are interested in becoming a sponsor, please reach out to us.\n\n- [JetBrains](https://www.jetbrains.com/)\n- [The Solana Foundation](https://solana.com/)\n\n## Credits\n\nMany thanks to the following core technologies \u0026 people who have contributed to this package:\n\n- [unplugin-auto-import](https://github.com/unplugin/unplugin-auto-import)\n- [unimport](https://github.com/unjs/unimport)\n- [Chris Breuer](https://github.com/chrisbbreuer)\n- [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [LICENSE](https://github.com/stacksjs/bun-plugin-auto-imports/tree/main/LICENSE.md) for more information.\n\nMade with 💙\n\n\u003c!-- Badges --\u003e\n[npm-version-src]: \u003chttps://img.shields.io/npm/v/bun-plugin-auto-imports?style=flat-square\u003e\n[npm-version-href]: \u003chttps://npmjs.com/package/bun-plugin-auto-imports\u003e\n[npm-downloads-src]: \u003chttps://img.shields.io/npm/dm/bun-plugin-auto-imports?style=flat-square\u003e\n[npm-downloads-href]: \u003chttps://npmjs.com/package/bun-plugin-auto-imports\u003e\n[github-actions-src]: \u003chttps://img.shields.io/github/actions/workflow/status/stacksjs/bun-plugin-auto-imports/ci.yml?style=flat-square\u0026branch=main\u003e\n[github-actions-href]: \u003chttps://github.com/stacksjs/bun-plugin-auto-imports/actions?query=workflow%3Aci\u003e\n\n\u003c!-- [codecov-src]: https://img.shields.io/codecov/c/gh/stacksjs/bun-plugin-auto-imports/main?style=flat-square\n[codecov-href]: https://codecov.io/gh/stacksjs/bun-plugin-auto-imports --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstacksjs%2Fbun-plugin-auto-imports","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstacksjs%2Fbun-plugin-auto-imports","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstacksjs%2Fbun-plugin-auto-imports/lists"}