Registry / serialization / es-async

es-async

JSON →
library1.1.0jsnpmunverified

ES2017 async/await transpiler backed by nodent-compiler. Stable v1.1.0, low release cadence. Compiles async functions into ES2016-compatible Promise chains. Differentiates from Babel by targeting strict native Promise behavior with minimal runtime overhead. CLI and programmatic APIs available.

npm install es-async
INSTALL
IMPORT
SIG · ES-ASYNC
E
es-async
serializationjavascriptv1.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

compileAsync
import compileAsync from 'es-async'
const compileAsync = require('es-async')
Default export via ESM. CJS also works in Node.
compileAsyncFromFile
import compileAsyncFromFile from 'es-async/from-file'
const compileAsyncFromFile = require('es-async/from-file')
Submodule for file-based compilation.
from-file
import compileFromFile from 'es-async/from-file'
Direct import from subpath. Returns Promise.

Compile ES2017 async/await code to ES2016 using default import and String input.

const compileAsync = require('es-async'); const es2017Code = `async function foo() { return await bar; }`; const es2016Code = compileAsync(es2017Code); console.log(es2016Code);
esasync --version
Debug
Known issues
gotchacompiled output uses native Promises; ensure runtime supports Promise
fix
Polyfill Promise if targeting older environments.
affects: >=1.0.0
deprecatedrequire('es-async/from-file') returns a function, but future versions may change export shape
fix
Check documentation for new submodule exports.
affects: >=1.0.0
gotchaCode compiled by es-async may be larger than alternatives like Babel due to verbose Promise wrapping
fix
Consider minification after compilation.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: compileAsync is not a function
Importing incorrectly using named import instead of default
fix
Use: const compileAsync = require('es-async');
Cannot find module 'es-async/from-file'
Running in environment where subpath exports are not supported
fix
Use direct path: require('es-async/from-file') (Node >=12) or copy file.
Upgrade
Version history
1.1.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
es-async — npm install es-async · libregistry