Collection of helper functions used by Babel transforms for generating runtime code.
npx @tessl/cli install tessl/npm-babel--helpers@7.28.0@babel/helpers is a comprehensive collection of helper functions used internally by Babel transforms to generate runtime code for various JavaScript features. It provides utilities for managing helper function dependencies, versioning, and APIs to retrieve, build, and inject helper code into transformed JavaScript output.
npm install @babel/helpersimport { get, minVersion, getDependencies, isInternal, list } from "@babel/helpers";For CommonJS:
const { get, minVersion, getDependencies, isInternal, list } = require("@babel/helpers");Default import (alias for get function):
import helpers from "@babel/helpers";import { get, list, getDependencies } from "@babel/helpers";
// Get list of all available helpers
const availableHelpers = list;
console.log(availableHelpers); // ['asyncToGenerator', 'classCallCheck', ...]
// Get helper AST for a specific helper
const helperAST = get("asyncToGenerator");
console.log(helperAST.nodes); // Array of AST nodes
console.log(helperAST.globals); // Array of global variables used
// Check helper dependencies
const deps = getDependencies("asyncToGenerator");
console.log(deps); // Array of dependency helper names
// Check minimum Babel version required
const minVer = minVersion("asyncToGenerator");
console.log(minVer); // "7.0.0-beta.0"@babel/helpers is built around several key components:
Primary API for retrieving and building helper ASTs with customization options. Essential for Babel plugins that need to inject runtime helpers.
function get(
name: string,
getDependency?: GetDependency,
bindingName?: string,
localBindings?: string[],
adjustAst?: AdjustAst
): { nodes: t.Program["body"]; globals: string[] };
function minVersion(name: string): string;
function getDependencies(name: string): ReadonlyArray<string>;
function isInternal(name: string): boolean;
function ensure(name: string): void; // CommonJS only
const list: string[];Comprehensive collection of helpers for array operations, destructuring, and iteration patterns including for-of loops, spread syntax, and rest parameters.
// Key helpers for array operations
const arrayHelpers = [
"arrayLikeToArray", "arrayWithHoles", "arrayWithoutHoles",
"createForOfIteratorHelper", "createForOfIteratorHelperLoose",
"iterableToArray", "iterableToArrayLimit", "maybeArrayLike",
"nonIterableRest", "nonIterableSpread", "slicedToArray",
"toArray", "toConsumableArray", "unsupportedIterableToArray"
];Extensive set of helpers for class syntax, inheritance, private fields, decorators, and object operations including property access and manipulation.
// Key helpers for class and object operations
const classObjectHelpers = [
"assertClassBrand", "assertThisInitialized", "classCallCheck",
"classPrivateFieldGet2", "classPrivateFieldSet2", "createClass",
"extends", "inherits", "construct", "defineProperty", "get", "set"
];Helper functions for async/await syntax, generator functions, and async iteration patterns including regenerator runtime integration.
// Key helpers for async and generator operations
const asyncGeneratorHelpers = [
"asyncToGenerator", "asyncGeneratorDelegate", "asyncIterator",
"awaitAsyncGenerator", "wrapAsyncGenerator", "regenerator",
"regeneratorAsync", "regeneratorAsyncGen", "skipFirstGeneratorNext"
];Utilities for handling module interoperability, import/export patterns, and CommonJS/ES Module compatibility.
// Key helpers for module operations
const moduleHelpers = [
"interopRequireDefault", "interopRequireWildcard",
"importDeferProxy", "tsRewriteRelativeImportExtensions"
];Collection of utility functions for type checking, error handling, JSX, template literals, and other runtime operations.
// Key utility helpers
const utilityHelpers = [
"typeof", "instanceof", "jsx", "taggedTemplateLiteral",
"nullishReceiverError", "readOnlyError", "writeOnlyError",
"temporalUndefined", "tdz", "identity", "usingCtx"
];type GetDependency = (name: string) => t.Expression;
type AdjustAst = (
ast: t.Program,
exportName: string,
mapExportBindingAssignments: (
map: (node: t.Expression) => t.Expression,
) => void,
) => void;
interface HelperMetadata {
globals: string[];
locals: { [name: string]: string[] };
dependencies: { [name: string]: string[] };
exportBindingAssignments: string[];
exportName: string;
internal: boolean;
}