es6-transpiler

raw JSON →
0.7.18 verified Fri May 01 auth: no javascript deprecated

An ES6 to ES5 transpiler that focuses on producing output without a runtime library, using only polyfills when necessary. It avoids try/catch for block binding, supports spread via .concat with iterator protocol, and strives for minimal temporary variables. The project is in beta and supports classes, destructuring, block binding (let/const), arrow functions, spread, for-of, comprehensions, template strings, object literals, binary/octal literals, unicode code point escapes, and RegExp flags. It does not support modules, generators, or symbols. Release cadence: dormant; latest version 0.7.18 from 2015. Key differentiator: no runtime library, line-to-line mapping, Closure Compiler support.

error Cannot find module 'es6-transpiler'
cause Package not installed or not found in node_modules.
fix
Run 'npm install es6-transpiler' in your project directory.
error TypeError: es6transpiler.transpile is not a function
cause Incorrect import: using import instead of require on a CommonJS module.
fix
Use 'var es6transpiler = require("es6-transpiler");' instead of ES module import.
error SyntaxError: Unexpected token import (or other ES6 syntax) in transpiled output
cause Transpiler does not support 'import' statements (modules).
fix
Remove modules from source or use another transpiler like Babel.
deprecated Project is no longer maintained; not compatible with modern Node.js versions (ES6 features in V8 have diverged).
fix Use Babel or Typescript for ES6 transpilation.
breaking Requires an Object.create polyfill for older browsers (e.g., IE8).
fix Include es5-shim or a polyfill before using the output.
gotcha The transpiler does not support modules, generators, or Symbol; if used on code with these, it may produce incorrect output or crash.
fix Avoid using unsupported ES6 features or switch to a more modern transpiler.
gotcha The package does not ship TypeScript definitions; types must be declared manually.
fix Define your own type declarations or use @ts-ignore.
gotcha The transpile function returns an object; it is not a streaming transform. For Gulp/Grunt, use wrapper plugins.
fix Use grunt-es6-transpiler or gulp-es6-transpiler for build tool integration.
npm install es6-transpiler
yarn add es6-transpiler
pnpm add es6-transpiler

Demonstrates programmatic usage: require, transpile a simple ES6 snippet, and log the output ES5 source.

var es6transpiler = require('es6-transpiler');
var result = es6transpiler.transpile('let x = 1; const y = 2;');
console.log(result.src);
// Optionally configure with options object:
var result2 = es6transpiler.transpile('() => 42', { environments: ['node'] });
console.log(result2.src);