@buxlabs/es6-to-amd

1.2.0 • Public • Published

ES to AMD converter

npm

ES (EcmaScript) Module to AMD (Asynchronous Module Definition) converter

Table of Contents

Background

The import/export syntax is becoming more and more popular. Given a huge, legacy AMD application it's not trivial to migrate it all at once. The converter can help you transpile the modules into the AMD syntax temporarily for backwards compatibility.

Install

npm install @buxlabs/es6-to-amd

Usage

node

Convert a single file with:

const es6toamd = require('@buxlabs/es6-to-amd');
const source = 'export default { hello: 'world' }';
const result = es6toamd(source); // define({ hello: 'world' });

Examples

ES

import Backbone from 'backbone';

export default Backbone.Model.extend({});

AMD

define(['backbone'], function (Backbone) {
    'use strict';
    return Backbone.Model.extend({});
});

There are more examples in the test/fixture directory.

Maintainers

@emilos.

Contributing

All contributions are highly appreciated! Open an issue or submit a PR.

License

MIT © buxlabs

/@buxlabs/es6-to-amd/

    Package Sidebar

    Install

    npm i @buxlabs/es6-to-amd

    Weekly Downloads

    18

    Version

    1.2.0

    License

    MIT

    Unpacked Size

    15 kB

    Total Files

    6

    Last publish

    Collaborators

    • buxlabs-dev
    • emilos