Registry / devops / babel-helper-simplify-module

babel-helper-simplify-module

JSON →
library2.2.1jsnpmunverified

This package provides Babel utilities to transform and simplify module structures by exploding imports and exports into a normalized form. Current stable version is 2.2.1, with low release cadence. It is intended for internal use in Babel tooling, not for direct consumption in most projects. It differs from alternatives like babel-plugin-transform-modules-commonjs by focusing on structure normalization rather than module system conversion. Typically used in conjunction with babel-explode-module.

npm install babel-helper-simplify-module
INSTALL
IMPORT
SIG · BABEL-HELPER-SIMPL
B
babel-helper-simplify-module
devopsjavascriptv2.2.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

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

simplifyModule
import { simplifyModule } from 'babel-helper-simplify-module'
import simplifyModule from 'babel-helper-simplify-module'
This package only exports named exports; no default export is available.
explodedToStatements
import { explodedToStatements } from 'babel-helper-simplify-module'
const { explodedToStatements } = require('babel-helper-simplify-module')
CommonJS require is valid as the package supports both ESM and CJS.

Demonstrates importing simplifyModule and using it on a Babel AST program path to normalize module structure.

import { simplifyModule } from 'babel-helper-simplify-module'; import { parse, traverse } from '@babel/core'; const code = ` import foo from 'mod'; import { bar } from 'mod'; export default function() {} export const baz = 42; export * from 'bam'; `; const ast = parse(code, { sourceType: 'module' }); traverse(ast, { Program(path) { simplifyModule(path); path.stop(); } }); // simplified AST is now in ast console.log(JSON.stringify(ast, null, 2));
Debug
Known issues
gotchasimplifyModule mutates the program path in place; always call it within a Babel traversal
fix
Ensure you pass a valid Babel NodePath to simplifyModule.
affects: >=2.0
deprecatedThis package is no longer actively maintained; consider using @babel/helper-module-transforms for similar functionality
fix
Switch to @babel/helper-module-transforms if possible.
affects: >=2.0
Errors
Common errors & fixes
TypeError: Cannot read properties of undefined (reading 'node')
Passing a path that is not a Program node to simplifyModule
fix
Ensure you call simplifyModule on a Program path, e.g., traverse with Program enter.
Module not found: Can't resolve 'babel-helper-simplify-module'
Package not installed
fix
Run 'npm install babel-helper-simplify-module'
Upgrade
Version history
2.2.1latest on npm
Audit
Dependencies
babel-explode-modulerequiredCore dependency for exploding module AST nodes into structured data
Agent activity
9 hits · last 30 days
node
8
Amazon
1
Resources
babel-helper-simplify-module — npm install babel-helper-simplify-module · libregistry