{"id":14981903,"url":"https://github.com/shellscape/babel-plugin-async-to-plain-generator","last_synced_at":"2026-02-08T19:07:24.983Z","repository":{"id":66017618,"uuid":"60968239","full_name":"shellscape/babel-plugin-async-to-plain-generator","owner":"shellscape","description":"Transform async functions into non-wrapped ES2015 generators","archived":false,"fork":false,"pushed_at":"2020-05-04T00:43:08.000Z","size":11,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-16T22:13:07.981Z","etag":null,"topics":["async","babel","babel-plugin","babeljs","generator","module","nodejs","npm","transformations"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/shellscape.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-06-12T13:21:09.000Z","updated_at":"2023-09-14T16:58:17.000Z","dependencies_parsed_at":"2023-03-10T23:28:52.767Z","dependency_job_id":null,"html_url":"https://github.com/shellscape/babel-plugin-async-to-plain-generator","commit_stats":{"total_commits":10,"total_committers":3,"mean_commits":"3.3333333333333335","dds":0.5,"last_synced_commit":"c1045bccc53ad550ff6dede37f4f338ca518c069"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shellscape%2Fbabel-plugin-async-to-plain-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shellscape%2Fbabel-plugin-async-to-plain-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shellscape%2Fbabel-plugin-async-to-plain-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shellscape%2Fbabel-plugin-async-to-plain-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shellscape","download_url":"https://codeload.github.com/shellscape/babel-plugin-async-to-plain-generator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242198364,"owners_count":20088013,"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":["async","babel","babel-plugin","babeljs","generator","module","nodejs","npm","transformations"],"created_at":"2024-09-24T14:04:27.701Z","updated_at":"2026-02-08T19:07:24.950Z","avatar_url":"https://github.com/shellscape.png","language":"JavaScript","readme":"# babel-plugin-async-to-plain-generator\n\nBabel plugin to transform async functions into plain, unwrapped generator functions.\n\n## \u0026nbsp;\n\u003cp align=\"center\"\u003e\n  \u003cb\u003e:rocket: \u0026nbsp; Are you ready to tackle ES6 and hone your JavaScript Skills?\u003c/b\u003e \u0026nbsp; :rocket:\u003cbr/\u003e\n  Check out these outstanding \u003ca href=\"https://es6.io/friend/POWELL\"\u003eES6 courses\u003c/a\u003e by \u003ca href=\"https://github.com/wesbos\"\u003e@wesbos\u003c/a\u003e\n\u003c/p\u003e\n---\n\nWhile working with [KoaJS v1](https://github.com/koajs/koa) we found that the resulting output from [transform-async-to-generator](https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-async-to-generator) was incompatible with Koa's requirements - that `app.use` must be passed a generator function. \n\nThis plugin was created by modifying the transform-async-to-generator plugin. While that plugin works well in most situations, it curiously (and extraneously?) wraps async functions and results in a generator function wrapped in a regular function of the same name. This plugin was created so that babel would produce plain old vanilla generator functions from async function declarations.\n\n## Transformations:\n\n```js\n// in\n\n[].forEach(async (a) =\u003e {\n  await a;\n});\n\nasync function foo (bar) {\n  await bar;\n};\n\n// out\n\n[].forEach(function* (a) {\n  yield a;\n});\n\nfunction* foo (bar) {\n  yield bar;\n}\n```\n\n## Installation\n\n```sh\n$ npm install babel-plugin-async-to-plain-generator\n```\n\n## Usage\n\n### Via `.babelrc` (Recommended)\n\n**.babelrc**\n\n```json\n{\n  \"plugins\": [\"async-to-plain-generator\"]\n}\n```\n\n### Via CLI\n\n```sh\n$ babel --plugins async-to-plain-generator script.js\n```\n\n### Via Node API\n\n```javascript\nrequire(\"babel-core\").transform(\"code\", {\n  plugins: [\"async-to-plain-generator\"]\n});\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshellscape%2Fbabel-plugin-async-to-plain-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshellscape%2Fbabel-plugin-async-to-plain-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshellscape%2Fbabel-plugin-async-to-plain-generator/lists"}