Registry / serialization / es6-module-transpiler-amd-formatter

es6-module-transpiler-amd-formatter

JSON →
library0.3.0jsnpmunverified

An output formatter plugin for es6-module-transpiler that compiles ES6 module syntax into AMD define() format supported by RequireJS. Version 0.3.0 is the latest stable release; the project is in maintenance mode with no active development. It converts subsets of ES6 module syntax (import/export) into AMD-compatible code, supporting default exports, named exports, and re-exports. Unlike other transpilers like Babel, this plugin is tightly coupled to the now-deprecated es6-module-transpiler ecosystem and requires esprima for parsing. It compromises on ES6 features like live bindings and sealed objects to enable AMD compatibility. Requires Node.js and the es6-module-transpiler package at version 0.10.x.

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

AMDFormatter
var AMDFormatter = require('es6-module-transpiler-amd-formatter');
import AMDFormatter from 'es6-module-transpiler-amd-formatter';
ES6 import syntax may not work if the package is not set up for ESM; use CommonJS require.
Formatter as plugin for CLI
compile-modules convert -f es6-module-transpiler-amd-formatter input.js -o output.js
compile-modules convert -f AMD input.js -o output.js
The -f flag expects the module name, not a format name. Must install both packages globally or locally.
Container usage
var Container = require('es6-module-transpiler').Container; var formatter = new (require('es6-module-transpiler-amd-formatter'))();
var formatter = require('es6-module-transpiler-amd-formatter').default;
No default export; use new on the required constructor directly.

Shows how to use the AMD formatter with the es6-module-transpiler Container API to compile ES6 modules from 'lib/' into an AMD define() output file.

// Install dependencies // npm install es6-module-transpiler es6-module-transpiler-amd-formatter var transpiler = require('es6-module-transpiler'); var AMDFormatter = require('es6-module-transpiler-amd-formatter'); var Container = transpiler.Container; var FileResolver = transpiler.FileResolver; var container = new Container({ resolvers: [new FileResolver(['lib/'])], formatter: new AMDFormatter() }); container.getModule('index'); container.write('out/mylib.js');
Debug
Known issues
deprecatedes6-module-transpiler is no longer maintained. The AMD formatter only works with es6-module-transpiler and will not receive updates.
fix
Migrate to a modern transpiler like Babel with @babel/plugin-transform-modules-amd.
affects: >=0.0.1
breakingVersion 0.3.0 requires es6-module-transpiler 0.10.x. Using an older version of the transpiler will cause errors.
fix
Ensure es6-module-transpiler is at version ^0.10.0.
affects: >=0.3.0
gotchaThe AMD formatter does not support live bindings or sealed objects as per ES6 specification. Exports are snapshots.
fix
Avoid relying on live bindings; treat exports as static values.
affects: >=0.0.1
gotchaThe formatter cannot be used standalone; it must be passed as an option to es6-module-transpiler Container or CLI.
fix
Always install and import es6-module-transpiler along with this formatter.
affects: >=0.0.1
Errors
Common errors & fixes
Error: Cannot find module 'es6-module-transpiler-amd-formatter'
The package is not installed or not in the Node module resolution path.
fix
Run `npm install es6-module-transpiler-amd-formatter` in your project directory.
TypeError: formatter is not a constructor
Using the formatter module incorrectly (e.g., calling it as a function instead of using `new`).
fix
Use `new (require('es6-module-transpiler-amd-formatter'))()` to instantiate the formatter.
Error: Unknown formatter 'es6-module-transpiler-amd-formatter'
The CLI -f flag expects the formatter module name, but the module cannot be loaded (likely not installed).
fix
Install the package globally or locally, and ensure the module name is correct.
Upgrade
Version history
0.3.0latest on npm
Audit
Dependencies
es6-module-transpilerrequiredCore transpiler library required; this plugin provides a formatter for it.
Agent activity
2 hits · last 30 days
node
2
Resources
es6-module-transpiler-amd-formatter — npm install es6-module-transpiler-amd-formatter · libregistry