regenerator-runtime
The runtime library that powers Babel-compiled ES6 generator and async/await functions in ES5 environments
Repository Health
Technical Analysis
regenerator-runtime is the small (under 1KB compressed) support library required by code that the Regenerator source transform (used internally by Babel) produces when compiling ES2015 generator functions and async/await syntax down to plain ES5. Any transpiled function using yield or async/await calls into this runtime’s wrapGenerator machinery at execution time, so it must be present wherever that compiled output runs.
What You Get
- The
regeneratorRuntimeglobal (or importable module) that implements generator/iterator state-machine semantics in plain ES5 - Support for
yield,yield*delegation, andasync/await(desugared to generators) in environments without native support - A tiny (<1KB compressed) footprint since it only implements the runtime state machine, not the transform itself
- Battle-tested compatibility, since it’s the de facto runtime shipped by Babel’s own generator/async transforms across virtually the entire JS build ecosystem
Common Use Cases
- Automatically pulled in as a dependency when Babel or another compiler transpiles generator/async functions for older browser or JS engine targets
- Polyfilling generator/async support in legacy environments (old browsers, certain embedded JS engines) that lack native support
- Powering libraries and frameworks that ship pre-compiled ES5 bundles but use
async/awaitor generators internally in their source - Ensuring consistent generator/async behavior across a build’s transpiled output regardless of the target runtime’s native support level
Under The Hood
Architecture The published package’s implementation lives at packages/runtime/runtime.js (761 lines) inside the larger facebook/regenerator monorepo, which also contains the actual source-to-source regenerator transform (lib/, main.js) that rewrites function*/yield/async syntax into calls against this runtime. The runtime implements a GeneratorFunctionPrototype-like object plus a wrap() function that turns a specially-shaped compiled function body into a proper iterator object with .next()/.throw()/.return(), replicating native generator semantics entirely in ES5 JavaScript. Tech Stack Plain, dependency-free JavaScript with no build step of its own for the runtime file — it’s published essentially as-authored — while the sibling regenerator transform package (which produces code that calls into this runtime) uses Babel/AST tooling internally. Code Quality The monorepo’s test/ directory includes dedicated runtime tests (test/runtime.js) alongside broader transform conformance tests (tests.es6.js, class.js, async.js, regression.js) that exercise edge cases like frozen intrinsics and non-native environments — reflecting the runtime’s role as foundational, widely-depended-upon infrastructure where regressions have outsized blast radius. API Design Consumers essentially never call this package’s API directly by hand — it’s an implicit dependency injected by a compiler (Babel) into transpiled output, so its ‘API’ is really the internal contract between the regenerator transform and this runtime, not a public surface meant for direct human use.
Used by 15 apps in this directory
Mattermost
Collaboration · Devops · Team Chat
Open core, self-hosted team collaboration with chat, AI agents, voice calling, and deep DevOps integrations — all under your control.
n8n
Automation · No Code Platforms
Code when you need it, UI when you don't — the workflow automation platform built for technical teams who refuse to choose.
Standard Notes
Note Taking
End-to-end encrypted notes and files — private by design, built to last, and fully self-hostable.
Unleash
Ab Testing Experimentation · Developer Tools · Devops
The open-source feature management platform that lets you ship code to production and control who sees it — without redeploying.
wallabag
Bookmarks Archiving
Self-hosted read-it-later app that saves clean, ad-free articles from any webpage for distraction-free reading across all your devices.
Zulip
Team Chat
Topic-based team chat that brings the structure of email threads to real-time messaging, so distributed teams never lose context across hundreds of concurrent conversations.