Registry / testing / babel-log

babel-log

JSON →
library2.0.0jsnpmunverified

babel-log is a lightweight utility for logging Babel AST paths and nodes with clean, colored formatting in the console. As of version 2.0.0, it provides a single default-exported function that accepts any object, making it ideal for debugging Babel plugins. It is in active development with a low release cadence. Unlike manual console.log, babel-log formats complex AST structures for readability.

npm install babel-log
INSTALL
IMPORT
SIG · BABEL-LOG
B
babel-log
testingjavascriptv2.0.0
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
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 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

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

default
✓ import log from 'babel-log'
✗ import { log } from 'babel-log'
The package exports a single default function; named import will result in undefined.
default
✓ const log = require('babel-log')
✗ const { log } = require('babel-log')
CommonJS usage: the module.exports is the function itself.
log (type)
✓ import type log from 'babel-log'
TypeScript users may import the type for type annotations, though the default export is untyped.

This shows how to import and use babel-log inside a Babel plugin to log AST nodes during traversal.

import log from 'babel-log'; export default function myBabelPlugin() { return { visitor: { Identifier(path) { log(path.node); // logs the node with pretty formatting } } }; }
Debug
Known issues
gotchaThe function only logs to console and returns undefined; it is not for serialization.
fix
Use it only for debugging; do not rely on return value.
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: log is not a function
Importing with named import instead of default import.
fix
Use import log from 'babel-log' (without curly braces).
Cannot find module 'babel-log'
Package not installed in project dependencies.
fix
Run npm install babel-log --save-dev
Upgrade
Version history
2.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
26 hits · last 30 days
node
24
OpenAI (training)
1
Resources
babel-log — npm install babel-log · libregistry