Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/karimsa/babel-preset-mjs
Babel preset to transpile JS to restricted mjs JS.
https://github.com/karimsa/babel-preset-mjs
Last synced: about 2 months ago
JSON representation
Babel preset to transpile JS to restricted mjs JS.
- Host: GitHub
- URL: https://github.com/karimsa/babel-preset-mjs
- Owner: karimsa
- License: mit
- Created: 2017-05-16T16:16:07.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-06-14T04:41:26.000Z (over 7 years ago)
- Last Synced: 2024-10-03T02:17:35.763Z (3 months ago)
- Language: JavaScript
- Homepage:
- Size: 22.5 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
- awesome-mongoose-os - babel-preset-mjs - Babel preset to transpile JS to restricted mjs JS (Awesome Mongoose OS [![Awesome](https://awesome.re/badge.svg)](https://awesome.re) / Community Tutorials)
README
# babel-preset-mjs
Babel preset to transpile JS to restricted
[mjs](https://github.com/cesanta/mjs) JS.## Features
| Restriction | Solution |
| ----------- | -------- |
| No String, Number, RegExp, Date, Function, etc. | **Not solved** |
| No try/catch/finally. | Transpiled to functions that make try/catch/finally work. |
| No error classes. | **Not solved** |
| No `new` or prototypes. In order to create an object with a custom prototype, use **`Object.create()`**, which is available. | `new` is handled by `Object.create()`, and the constructor is called on the resultant object |
| Strict mode only. No `for..of`, `=>`, destructors, generators, proxies, promises, classes, template strings. | Handled by `babel-preset-es2015` (included by default). |
| No `var`, only `let`. | All uses of `var` are changed to `let`. |
| No getters, setters, `valueOf`. | **Not solved** |
| No `==` or `!=`, only `===` and `!==`. | All uses of `==` are transpiled to a manually evaluated loose equals. |
| `load()` is used to load external JS, not very standardized and pollutes the global scope. | **Not solved** |
| No `setTimeout()` and `setInterval()` API. | Polyfilled using `api_timer.js`. |## Usage
`.babelrc`:
```json
{
"presets": [
"mjs"
]
}
```## License
Licensed under [MIT](LICENSED.md) license.
Copyright (C) 2017 Karim Alibhai.