Registry / devops / babel-deps

babel-deps

JSON →
library2.1.0jsnpmunverified

Compiles JavaScript files along with all their imported dependencies using Babel, automatically resolving and compiling transitive dependencies that are not explicitly listed. Version 2.1.0 (latest) with no recent updates. Key differentiators: unlike direct Babel usage, babel-deps discovers and compiles the entire dependency graph, caches results for performance, and allows custom module resolution. Supports Node >=0.12.0 (legacy).

npm install babel-deps
INSTALL
IMPORT
SIG · BABEL-DEPS
B
babel-deps
devopsjavascriptv2.1.0
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.

babelDeps
import babelDeps from 'babel-deps'
const babelDeps = require('babel-deps')
Package ships as CommonJS; require is also correct, but import is the modern ES module syntax.

Demonstrates compiling a file and its dependencies with Babel, using cache and custom Babel options.

import babelDeps from 'babel-deps'; import fs from 'fs'; const files = [ { contents: fs.readFileSync('src/index.js', 'utf8'), options: { filename: 'src/index.js' } } ]; const results = babelDeps(files, { babel: { presets: ['@babel/preset-env'] }, cache: true }); for (const result of results) { console.log(result.filename, result.code); }
babel-deps --version
Debug
Known issues
deprecatedPackage is no longer maintained. Last release 2.1.0 on 2016-06-13. Babel versions have changed drastically since.
fix
Consider using a modern tool like Webpack, Babel CLI alone, or Rollup for dependency compilation.
affects: >=2.0.0
gotchaEach file object must have a `filename` in `options`. If missing, compilation will fail silently or throw.
fix
Always provide `options.filename` for every file in the array.
affects: >=1.0.0
gotchaDefault module resolution assumes module sources are already absolute or relative paths. For non-path sources, provide `resolveModuleToPath`.
fix
Implement `resolveModuleToPath` function for packages that are not paths.
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: Cannot read property 'filename' of undefined
Missing `options` or `filename` in a file entry.
fix
Ensure each file object has `contents` and `options: { filename: 'path/to/file.js' }`.
Error: Module 'some-package' not found
Module source is not a valid file path and no `resolveModuleToPath` provided.
fix
Provide a `resolveModuleToPath` function that converts module names to file paths.
Upgrade
Version history
2.1.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
babel-deps — npm install babel-deps · libregistry