{"id":15207057,"url":"https://github.com/babel/kneden","last_synced_at":"2025-10-02T23:35:39.560Z","repository":{"id":65336303,"uuid":"50246549","full_name":"babel/kneden","owner":"babel","description":"Transpile ES2017 async/await to vanilla ES6 Promise chains: a Babel plugin","archived":true,"fork":false,"pushed_at":"2018-11-14T16:45:04.000Z","size":140,"stargazers_count":515,"open_issues_count":13,"forks_count":41,"subscribers_count":24,"default_branch":"master","last_synced_at":"2025-01-20T16:24:13.580Z","etag":null,"topics":["async","babel-plugin","promise"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/babel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["babel"],"open_collective":"babel","custom":"https://gitcoin.co/grants/2906/babel-compiler-for-next-generation-javascript"}},"created_at":"2016-01-23T16:22:11.000Z","updated_at":"2024-11-14T03:10:12.000Z","dependencies_parsed_at":"2023-01-17T19:00:37.925Z","dependency_job_id":null,"html_url":"https://github.com/babel/kneden","commit_stats":null,"previous_names":["marten-de-vries/kneden"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/babel%2Fkneden","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/babel%2Fkneden/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/babel%2Fkneden/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/babel%2Fkneden/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/babel","download_url":"https://codeload.github.com/babel/kneden/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235051547,"owners_count":18928183,"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-plugin","promise"],"created_at":"2024-09-28T06:20:48.010Z","updated_at":"2025-10-02T23:35:34.227Z","avatar_url":"https://github.com/babel.png","language":"JavaScript","funding_links":["https://github.com/sponsors/babel","https://opencollective.com/babel","https://gitcoin.co/grants/2906/babel-compiler-for-next-generation-javascript"],"categories":[],"sub_categories":[],"readme":"Kneden (babel-plugin-async-to-promises)\n=======================================\n\n**This project is currently unmaintained. If you want to take over, feel free to fork the repo. If such a fork gets maintained or contains useful improvements, I'd be willing to merge back and give repo+npm access.**\n\n[![Build Status](https://travis-ci.org/marten-de-vries/kneden.svg?branch=master)](https://travis-ci.org/marten-de-vries/kneden)\n[![Dependency Status](https://david-dm.org/marten-de-vries/kneden.svg)](https://david-dm.org/marten-de-vries/kneden)\n[![devDependency Status](https://david-dm.org/marten-de-vries/kneden/dev-status.svg)](https://david-dm.org/marten-de-vries/kneden#info=devDependencies)\n\n\u003e Transpile ES7 async/await to vanilla ES6 Promise chains\n\n**WARNING: Kneden\n[is usable](https://github.com/pouchdb/pouchdb-plugin-helper/pull/9), but it's\nalso [not complete yet](https://github.com/marten-de-vries/kneden/issues/13).**\n\nDo you want an ES7 async/await transpiling [Babel](https://babeljs.io/) plugin,\nthat:\n\n- produces readable code - even when generator functions are not available?\n- doesn't come with a runtime your users have to download?\n\nThen look no further! **Kneden (babel-plugin-async-to-promises)** can help you.\n\n## Example\n\n**In**\n\n```js\nasync function test() {\n  await db.destroy();\n}\n```\n\n**Out**\n\n```js\nfunction test() {\n  return Promise.resolve().then(function () {\n    return db.destroy();\n  }).then(function () {});\n}\n```\n\n(The last .then() might seem superfluous at first, but the first function\ndoesn't actually resolve to anything so it's necessary to make a valid\ntranslation.)\n\n**Kneden** tries to translate ES7 async/await to promises in a manner similar to\nhow a human would do so. Loops are converted to recursive functions, and your\ncode is modified in such a way that a return won't just drop you in the next\npart of the promise chain, but actually does what you expect it to do.\n\nFor more examples, see the\n[test/fixtures directory](https://github.com/marten-de-vries/kneden/tree/master/test/fixtures)\nfor both the input and output **Kneden** takes/produces.\n\n## Installation\n\n```sh\n$ npm install babel-plugin-async-to-promises\n```\n\n## Usage\n\nNote: Kneden only supports transpiling ES5 with the addition of async/await. If\nyou're using other ES6 features (like arrow functions, let/const, classes,\netc.), make sure you transpile them down to valid ES5 code first using the\n[babel es2015 preset](https://www.npmjs.com/package/babel-preset-es2015). See\n[#19](https://github.com/marten-de-vries/kneden/issues/19) for more information.\n\n### Via `.babelrc` (Recommended)\n\n**.babelrc**\n\n```json\n{\n  \"plugins\": [\"async-to-promises\"]\n}\n```\n\n### Via CLI\n\n```sh\n$ babel --plugins async-to-promises script.js\n```\n\n### Via Node API\n\n```javascript\nrequire(\"babel-core\").transform(\"code\", {\n  plugins: [\"async-to-promises\"]\n});\n```\n\nYou can also use the plug-in in [Browserify](http://browserify.org/) using\n[babelify](https://github.com/babel/babelify), in [Rollup](http://rollupjs.org/)\nby using it in conjunction with\n[rollup-plugin-babel](https://github.com/rollup/rollup-plugin-babel), and in\n[Webpack](https://webpack.github.io/) using\n[babel-loader](https://github.com/babel/babel-loader).\n\nUnsupported\n-----------\n\n- Return statements aren't properly supported in switch and try/catch/finally\n  statements yet ([#13](https://github.com/marten-de-vries/kneden/issues/13))\n- No ``eval()``; but that's true for other Babel plugins/presets as well.\n\nContributing\n------------\n\nThere are a couple of ways to contribute, for example by:\n\n- Reporting test results with your code base\n- Fixing bugs, for a nice starting task see the ones labeled '[good first bug](https://github.com/marten-de-vries/kneden/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+bug%22)'.\n\nContributions are very welcome! Just open an issue or PR.\n\nWhat's up with the name?\n------------------------\n\nIt's Dutch for 'to knead'/'to mold' - the program molds ES7 async/await\nconstructs into promises. It seemed applicable. [Pronounciation](https://upload.wikimedia.org/wikipedia/commons/0/0e/Nl-kneden.ogg).\n\nThe npm package name is a more descriptive one as explained in\n[issue #22](https://github.com/marten-de-vries/kneden/issues/22).\n\nLicense\n-------\n\nISC\n\n---\n\n**Kneden** is a project by [Marten de Vries](https://ma.rtendevri.es/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbabel%2Fkneden","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbabel%2Fkneden","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbabel%2Fkneden/lists"}