Registry / serialization / amd-to-es6-other

amd-to-es6-other

JSON →
library0.2.5jsnpmunverified

A CLI and programmatic tool to convert AMD modules (RequireJS style) into ES6 module syntax. Version 0.2.5 is the latest, released mid-2015, with no recent updates. It handles dependencies, default exports, and side-effect imports, but does not support named define, multiple defines per file, or UMD patterns. It offers options for directory conversion, file ignore patterns, and beautification via jsbeautify. Key differentiator: simple, focused conversion without bundling or transpilation of other ES6 features. Compared to alternatives like lebab or jscodeshift, this is minimal and specific.

npm install amd-to-es6-other
INSTALL
IMPORT
SIG · AMD-TO-ES6-OTHER
A
amd-to-es6-other
serializationjavascriptv0.2.5
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.

convert
import { convert } from 'amd-to-es6'
const convert = require('amd-to-es6').convert;
The package exports a single function `convert` via named export. CommonJS require must use `.convert` property.
default
import amdToEs6 from 'amd-to-es6'
import * as amdToEs6 from 'amd-to-es6'
There is no default export; only named exports exist. Using default import will result in undefined.
convertFile
import { convertFileSync } from 'amd-to-es6'
import { convertFile } from 'amd-to-es6'
The package provides `convertFileSync` for synchronous file conversion, but no `convertFile` asynchronous variant. Check version docs.

Shows how to use the programmatic API to convert a single AMD module string to ES6 syntax.

const { convert } = require('amd-to-es6'); const amdCode = `define(['path/to/a'], function (a) { return function (x) { return a(x); }; });`; const es6Code = convert(amdCode); console.log(es6Code); // Output: // import a from 'path/to/a'; // export default function (x) { return a(x); };
amd-to-es6 --version
Debug
Known issues
gotchaNamed define modules are not supported (e.g., define('my-module', ...)). Attempting to convert such files will result in a skip or error.
fix
Remove the module name from the define call before conversion.
affects: >=0.0.0
gotchaFiles with multiple module definitions are not supported. Only one define per file is converted; others are ignored.
fix
Split files so each contains a single define.
affects: >=0.0.0
gotchaUMD style modules where the callback is not a function literal (e.g., define(factoryFn)) are not supported.
fix
Rewrite UMD modules to use a literal function in the define callback.
affects: >=0.0.0
deprecatedThe package has not been updated since 2015. It may not work with modern Node.js versions or newer JavaScript syntax.
fix
Consider using alternative tools like lebab or manual conversion.
affects: >=0.0.0
Errors
Common errors & fixes
Error: Unsupported define pattern
The file contains a named define, multiple defines, or a non-literal callback function.
fix
Ensure the define call has no name, only one define per file, and the callback is a function literal.
TypeError: convert is not a function
Incorrect import: using default import instead of named import.
fix
Use `const { convert } = require('amd-to-es6');` or `import { convert } from 'amd-to-es6';`
Cannot find module 'js-beautify'
The --beautify option requires js-beautify, which is an optional dependency not installed by default in some environments.
fix
Install js-beautify globally or locally: `npm install js-beautify`
Upgrade
Version history
0.2.5latest on npm
Audit
Dependencies
js-beautifyoptionalOptional dependency for beautifying output when --beautify flag is used
Agent activity
39 hits · last 30 days
node
32
OpenAI (training)
2
Amazon
1
Resources
amd-to-es6-other — npm install amd-to-es6-other · libregistry