npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

babel-plugin-fast-async

v6.1.2

Published

fast-async/await transformer Babel plugin

Readme

###声明

该库是fast-async的完全镜像。

fast-async

'fast-async' is a Babel v6.x.x plugin that implements the ES7 keywords async and await using syntax transformation at compile-time, rather than generators.

The main reason for using 'fast-async' as opposed to Babel's default implementation of async/await is performance (https://github.com/MatAtBread/nodent#performance) - it's 3-4 times faster in a browser/node, and as much as 10 times faster on a mobile browsers, mainly due to avoiding generators (and therefore regenerator).

There's a simple test (that just makes sure the plugin works and generates code that runs). More complete test coverage is included with nodent.

Because Babel parses the code, the ES7 extensions possible with nodent (await anywhere, async return and async throw) are not supported, however full implementation of async function containing await expressions is implemented.

For Babel v5.x.x install [email protected]

v6.1.x fast-async@>=6.1.0 can use nodent v2 or v3 (and acorn v3 or v4). Nodent v3 has the option of generating code with Promises which needs no runtime at all, at the cost of size and speed. v6.1.x can also reference the runtime via an import (useRuntimeModule option), rather than include the source inline.

Install

npm install fast-async --save

Usage

Just include the plugin to the babel options. Minimal .babelrc example:

{
  "plugins": ["fast-async"]
}

That's all. Neither babel-plugin-transform-runtime nor babel-polyfill required. Your application, once compiled, will probably needs nodent's runtime = see below.

With options:

{
  "plugins": [
    ["fast-async", {
      "env": {
        "augmentObject": false,
        "dontMapStackTraces": true,
        "dontInstallRequireHook": true
      },
      "compiler": {
        "promises": true,
        "generators": false
      },
      "runtimePattern":null,
      "useRuntimeModule":false
    }]
  ]
}

Test

From the installation directory (e.g. node_modules/fast-async):

npm test

Options

The plugin accepts the following options object, which itself is optional, as are all members. These are based on the options in nodent, but since much of the parsing is done by Babel some are unused.

env:{
  log:function(string),        // Supplied routine to emit transformation warnings. Default: console.log
  augmentObject:false,         // Add the nodent utilities asyncify() and isThenable() to Object.prototype
  dontMapStackTraces:true,     // Don't install the stack trace hook that maps line numbers (default: true)
  dontInstallRequireHook:false // Don't transform all JS files as they are loaded into node (default: true)
},
compiler:{
  promises:true,    // Use nodent's "Promises" mode. Set to false if your execution environment does not support Promises.
  generators:false  // Transform into 'Generators' (sub-optimal, but it works)
},
runtimePattern:null,     // See below
useRuntimeModule:false  // See below

For more information on the compiler options, see ES7 and Promises in the nodent documentation.

6.1.x The dontMapStackTraces now defaults to true as having both nodent and babel map stack traces doesn't work well

runtimePattern

By default, fast-async will put the nodent runtime into every file containing an async function or await expression. If your project is made up of more than one file, the constant redefinition of the runtime is a waste of time and space. You can specify that you want the runtime in particular file(s) by setting the 'runtimePattern' to a regular expression (in quotes). Only files that match the regular expression will have the runtime defined (which is global, so you only need it once).

Note: At least one of the file(s) matching the "runtimePattern" must use either await or async as the runtime function (or require('nodent-runtime') if you set "useRuntimeModule":true) is only included for files that reference it.

For example:

"babel": {
  "plugins": [
    "syntax-async-functions",
    ["fast-async",{
       "runtimePattern":"test-input\\.js"
    }]
  ]
}

Alternatively, if you set runtimePattern to "directive", the statement "use runtime-nodent"; will be replaced with the runtime during compilation.

v6.1.x If you specify the option "useRuntimeModule":true, the runtime is not included directly as source, but via an import of nodent-runtime, which is typically resolved to require() by babel. The nodent-runtime module must be added as a dependency in your target project. The runtime need only be included once in your entire project, and should precede any code that uses async or await.

Useful Links

Online performance checkers:

  • nodent 632ms (and shave off another 100ms by selecting 'Pure ES5' mode)
  • babel 1877ms - 3x slower
  • traceur 2488ms - 4x slower