Runtime helper functions for JavaScript and TypeScript transformations performed by the SWC compiler.
—
Implementation of async/await syntax and generator functions for older JavaScript environments that don't support these features natively.
Converts async functions to generator-based implementations for older environments.
/**
* Converts async functions to generator-based implementations
* @param {Function} fn - The async function to convert
* @returns {Function} Function that returns a Promise
*/
function _async_to_generator(fn): Function;Usage Example:
const asyncFn = _async_to_generator(function* () {
const result = yield fetch('/api/data');
return result.json();
});
// Usage
asyncFn().then(data => console.log(data));Handles await expressions in transformed async functions.
/**
* Handles await expressions in transformed async functions
* @param {any} value - Value to await
* @returns {any} The awaited value
*/
function _await_value(value): any;Creates async generator implementations.
/**
* Creates async generator implementations
* @param {Function} fn - Generator function
* @returns {Object} Async generator object
*/
function _async_generator(fn): Object;Handles yield* delegation in async generators.
/**
* Handles yield* delegation in async generators
* @param {Object} inner - Inner iterator
* @param {Function} awaitWrap - Await wrapper function
* @returns {Object} Delegated async generator
*/
function _async_generator_delegate(inner, awaitWrap): Object;Handles await operations in async generators.
/**
* Handles await operations in async generators
* @param {any} value - Value to await
* @returns {Object} Awaited async generator value
*/
function _await_async_generator(value): Object;Wraps async generator functions.
/**
* Wraps async generator functions
* @param {Function} fn - Async generator function
* @returns {Function} Wrapped async generator
*/
function _wrap_async_generator(fn): Function;Creates async iterators from iterables.
/**
* Creates async iterators from iterables
* @param {Iterable} iterable - Iterable to convert
* @returns {AsyncIterator} Async iterator
*/
function _async_iterator(iterable): AsyncIterator;Creates loose mode for-of iterator helpers.
/**
* Creates loose mode for-of iterator helpers
* @param {Iterable} o - Iterable object
* @param {boolean} allowArrayLike - Allow array-like objects
* @returns {Object} Iterator helper
*/
function _create_for_of_iterator_helper_loose(o, allowArrayLike): Object;Skips the first next() call on generators.
/**
* Skips the first next() call on generators
* @param {Iterator} it - Generator iterator
* @returns {any} Generator result
*/
function _skip_first_generator_next(it): any;Handles yield expression overloading.
/**
* Handles yield expression overloading
* @param {any} value - Value to yield
* @returns {any} Yielded value
*/
function _overload_yield(value): any;TypeScript-specific generator implementation (re-exported from tslib).
/**
* TypeScript-specific generator implementation (re-exported from tslib.__generator)
* @param {Object} thisArg - This context
* @param {Function} body - Generator body function
* @returns {Object} TypeScript generator
*/
function _ts_generator(thisArg, body): Object;TypeScript values iterator helper (re-exported from tslib).
/**
* TypeScript values iterator helper (re-exported from tslib.__values)
* @param {any} o - Object to iterate
* @returns {Iterator} Values iterator
*/
function _ts_values(o): Iterator;Install with Tessl CLI
npx tessl i tessl/npm-swc--helpers