Registry / serialization / es6-module-transpiler-rewrite

es6-module-transpiler-rewrite

JSON →
library0.3.1jsnpmunverified

es6-module-transpiler is an experimental compiler that allows writing JavaScript using a subset of the current ES6 module syntax, compiling it into AMD or CommonJS modules. Version 0.3.1 is the latest stable release. It provides a way to experiment with ES6 module syntax in real-world scenarios. Key differentiators: closely tracks TC39 module proposals, supports both AMD and CommonJS output, and provides a command-line interface. Note: This project is experimental and may not follow semver; syntax may change.

npm install es6-module-transpiler-rewrite
INSTALL
IMPORT
SIG · ES6-MODULE-TRANSPI
E
es6-module-transpiler-rewrite
serializationjavascriptv0.3.1
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.

Compiler
var Compiler = require('es6-module-transpiler').Compiler;
import { Compiler } from 'es6-module-transpiler';
Require pattern for CommonJS Node environment.
Container
var Container = require('es6-module-transpiler').Container;
Additionally exported; not commonly used.
Compiler class
var compiler = new Compiler(string, name, options);
var compiler = new Compiler(string);
Second argument (name) is optional but recommended; options is optional.

Shows both CLI usage and library usage to compile ES6 module syntax to AMD.

// Install globally (use git URL as npm package not published) // $ npm install -g https://git.squareup.com/javascript/es6-module-transpiler // Create an ES6 module file (example.js): // export var foo = 'bar'; // Compile to AMD: // $ compile-modules example.js --to dist --type amd // Or use as library: var Compiler = require('es6-module-transpiler').Compiler; var code = 'export var foo = "bar";'; var compiler = new Compiler(code, 'example'); var amdOutput = compiler.toAMD(); console.log(amdOutput); // Outputs: define('example', [], function() { ... });
es6-module-transpiler --version
Debug
Known issues
deprecatedThis package is not actively maintained and the ES6 module spec has changed significantly since its creation.
fix
Use a more up-to-date transpiler like Babel or TypeScript.
affects: >=0
breakingSyntax may not match finalized ES6 modules; expect incompatibilities.
fix
Refer to current ES module spec or use modern tools.
affects: >=0
gotchaWhen using 'globals' type, you must provide --imports mapping for all imported modules.
fix
Supply --imports like '--imports ember:Ember' or equivalent options hash.
affects: >=0
gotchaThe '--module-name' option cannot be used with multiple input files.
fix
Either use single file or omit --module-name.
affects: >=0
gotchaThe package is hosted on a private GitHub URL; not available via npm registry.
fix
Install directly from git: npm install -g <git-url>
affects: >=0
Errors
Common errors & fixes
Error: Cannot find module 'es6-module-transpiler'
Package not published to npm; must use git URL.
fix
Install from git: npm install -g https://git.squareup.com/javascript/es6-module-transpiler
compile-modules command not found
Global install failed or not in PATH.
fix
Ensure global npm modules path is in PATH, or use npx.
SyntaxError: Unexpected token 'export'
Using ES6 module syntax in a non-transpiled environment.
fix
Run the code through the transpiler first, or use a runtime that supports ES modules.
Upgrade
Version history
0.3.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
es6-module-transpiler-rewrite — npm install es6-module-transpiler-rewrite · libregistry