Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/buxlabs/es6-to-amd
convert es6 to amd
https://github.com/buxlabs/es6-to-amd
amd converter es6 javascript
Last synced: about 1 month ago
JSON representation
convert es6 to amd
- Host: GitHub
- URL: https://github.com/buxlabs/es6-to-amd
- Owner: buxlabs
- License: mit
- Created: 2016-12-04T21:19:11.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2024-06-16T09:51:01.000Z (7 months ago)
- Last Synced: 2024-11-10T05:10:40.008Z (2 months ago)
- Topics: amd, converter, es6, javascript
- Language: JavaScript
- Homepage:
- Size: 823 KB
- Stars: 7
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# ES to AMD converter
![npm](https://img.shields.io/npm/v/@buxlabs/es6-to-amd.svg)
> ES (EcmaScript) Module to AMD (Asynchronous Module Definition) converter
## Table of Contents
- [Background](#background)
- [Install](#install)
- [Usage](#usage)
- [Examples](#examples)
- [Maintainers](#maintainers)
- [Contributing](#contributing)
- [License](#license)## 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:
```javascript
const es6toamd = require('@buxlabs/es6-to-amd');
const source = 'export default { hello: 'world' }';
const result = es6toamd(source); // define({ hello: 'world' });
```## Examples
**ES**
```javascript
import Backbone from 'backbone';export default Backbone.Model.extend({});
```**AMD**
```javascript
define(['backbone'], function (Backbone) {
'use strict';
return Backbone.Model.extend({});
});
```There are more examples in the test/fixture directory.
## Maintainers
[@emilos](https://github.com/emilos).
## Contributing
All contributions are highly appreciated! Open an issue or submit a PR.
## License
MIT © buxlabs