HoneyBadger CLI
raw JSON → 1.0.1 verified Fri May 01 auth: no javascript
HoneyBadger CLI is a command-line interface and programmatic API for HoneyBadger, a Rust-based ES2015+ to ES5 transpiler, bundler, and minifier. Version 1.0.1 provides both a CLI with version, help, file/string input, output, minification toggle, and AST printing options, as well as a JavaScript API via the default export Badger class with methods like getVersion(), getUsage(), process(options), and access to a native rust module with transform() and parse(). This package is experimental and not suitable for production; it uses native Rust bindings and has infrequent updates (last release 1.0.1, previous 0.0.3). Key differentiator: Rust performance for transpilation vs Babel or esbuild, but very early stage and limited features.
Common errors
error Cannot find module 'honey-badger-cli' ↓
cause The package may not be installed or the module resolution path is incorrect.
fix
Run 'npm install honey-badger-cli' and ensure you are using the correct import path.
error TypeError: (0 , _honeyBadgerCli.default) is not a constructor ↓
cause Using a named import instead of default import.
fix
Change to: import Badger from 'honey-badger-cli'
error Error: No input provided. ↓
cause The process() method requires either 'file' or 'string' option.
fix
Pass either { file: 'path' } or { string: 'code' } to process().
Warnings
breaking Importing the package as a named import yields undefined. ↓
fix Use default import: import Badger from 'honey-badger-cli'
gotcha The badger property is only available after instantiation and requires native Rust bindings to compile. ↓
fix Ensure the native module is built properly; if not, instance.badger may be undefined.
gotcha The package is experimental and relies on the HoneyBadger Rust project, which may not be actively maintained. ↓
fix Consider using Babel, swc, or esbuild for production use.
deprecated The --ast output format and process options are not guaranteed to be stable across versions. ↓
fix Do not rely on AST output for production code.
Install
npm install ratel yarn add ratel pnpm add ratel Imports
- Badger wrong
import { Badger } from 'honey-badger-cli'correctimport Badger from 'honey-badger-cli' - instance.badger.transform wrong
import { transform } from 'honey-badger-cli'correctimport Badger from 'honey-badger-cli'; const instance = new Badger(); instance.badger.transform(string, minify) - instance.process wrong
const result = process({ file: './input.js' })correctimport Badger from 'honey-badger-cli'; const instance = new Badger(); instance.process({ file: './input.js' })
Quickstart
import Badger from 'honey-badger-cli';
const instance = new Badger();
console.log(instance.getVersion());
const result = instance.process({
string: 'const x = () => 1;',
pretty: true
});
console.log(result);
const minified = instance.badger.transform('const x = () => 1;', true);
console.log(minified);