Registry / web-framework / ethical-utility-babel-directory-transpiler

ethical-utility-babel-directory-transpiler

JSON →
library0.0.0jsnpmunverified

A utility for transpiling entire directories with Babel, part of the Ethical web framework. Currently at version 0.0.0 and still in pre-release. It provides a simple API to transpile all files in a directory using Babel configuration, handling recursive directory traversal and output mirroring. Different from standalone Babel CLI in that it's designed as a programmatic utility within the Ethical ecosystem, with promise-based API and tight integration with Ethical's file system utilities.

npm install ethical-utility-babel-directory-transpiler
INSTALL
IMPORT
SIG · ETHICAL-UTILITY-BA
E
ethical-utility-babel-directory-transpiler
web-frameworkjavascriptv0.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

transpileDirectory
import { transpileDirectory } from 'ethical-utility-babel-directory-transpiler'
const transpileDirectory = require('ethical-utility-babel-directory-transpiler').transpileDirectory
The module exports a named function. No default export.
transpileDirectory
import transpileDirectory from 'ethical-utility-babel-directory-transpiler'
const transpileDirectory = require('ethical-utility-babel-directory-transpiler')
Default import is not supported; must use named import.
EthicalBabelDirectoryTranspiler
import { EthicalBabelDirectoryTranspiler } from 'ethical-utility-babel-directory-transpiler'
const EthicalBabelDirectoryTranspiler = require('ethical-utility-babel-directory-transpiler').EthicalBabelDirectoryTranspiler
This class is also exported.

Shows how to transpile all JavaScript files from a source directory to an output directory with Babel presets and plugins.

import { transpileDirectory } from 'ethical-utility-babel-directory-transpiler'; async function build() { try { const result = await transpileDirectory({ source: './src', output: './dist', babelOptions: { presets: ['@babel/preset-env'], plugins: ['@babel/plugin-transform-arrow-functions'] }, extensions: ['.js', '.jsx'], verbose: false }); console.log(`Transpiled ${result.count} files`); } catch (error) { console.error('Transpilation failed:', error); } } build();
Debug
Known issues
gotchaThe package is in pre-release (v0.0.0); API may change without notice.
fix
Pin to exact version and test upgrades carefully.
affects: >=0.0.0
breakingBabel 6 and 7 presets/plugins are incompatible; ensure you pass options compatible with your installed Babel version.
fix
Use @babel/preset-env for Babel 7, or babel-preset-env for Babel 6.
affects: >=0.0.0
gotchaThe 'extensions' option defaults to ['.js']; if you use TypeScript, you must explicitly include '.ts'.
fix
Set extensions: ['.js', '.ts'] when transpiling TypeScript files (but note Babel will strip types only if preset-typescript is used).
affects: >=0.0.0
deprecatedThe 'babelOptions' configuration may be renamed in future versions; currently undocumented.
fix
Monitor the repository for updates.
affects: >=0.0.0
gotchaOutput directory is not cleaned before transpilation; files from previous runs remain.
fix
Manually remove or clean the output directory before each build.
affects: >=0.0.0
Errors
Common errors & fixes
Error: Cannot find module '@babel/core'
Babel peer dependency not installed
fix
npm install @babel/core
TypeError: transpileDirectory is not a function
Default import used instead of named import
fix
Use import { transpileDirectory } from 'ethical-utility-babel-directory-transpiler'
Error: Unexpected token: punc (.)
Babel preset/plugin not compatible with source code
fix
Add required presets/plugins, e.g., @babel/preset-env for modern JS
Error: ENOENT: no such file or directory, scandir './src'
Source directory does not exist
fix
Ensure the source directory exists before calling transpileDirectory
Upgrade
Version history
0.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
ethical-utility-babel-directory-transpiler — npm install ethical-utility-babel-directory-transpiler · libregistry