https://github.com/adriancmiranda/unkn
ES6 to CommonJS
https://github.com/adriancmiranda/unkn
cjs commonjs es6 es6tocjs transform
Last synced: 9 months ago
JSON representation
ES6 to CommonJS
- Host: GitHub
- URL: https://github.com/adriancmiranda/unkn
- Owner: adriancmiranda
- License: mit
- Created: 2018-05-04T10:36:39.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2020-05-26T12:04:58.000Z (about 6 years ago)
- Last Synced: 2025-07-18T11:47:08.235Z (12 months ago)
- Topics: cjs, commonjs, es6, es6tocjs, transform
- Language: JavaScript
- Homepage: http://npmjs.com/package/unkn
- Size: 454 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Unkn
> ES6 to Commonjs
[![stability]][stability-url]
## Usage:
One of the ways you can use Unkn is through the require hook. The require hook will bind itself to node's require and automatically compile files on the fly.
```javascript
require('unkn/register')();
```
You can also use the command line:
```bash
unkn script.next.js --replace='/.next(.js)?/i,$1'
```
or node:
> [_play with runkit_](https://npm.runkit.com/unkn)
```javascript
const unkn = require('unkn');
const source = `
/* eslint-disable no-unused-vars */
import * as internal from './internal/index.js';
import * as has from './has/index.js';
import * as is from './is/index.js';
export * from './internal/index.js';
export { has, is };
export { default as as } from './as/index.js';
export { default as schema } from './schema/index.js';
`;
unkn(source);
```
[stability]: http://badges.github.io/stability-badges/dist/experimental.svg
[stability-url]: http://learnhtmlwithsong.com/blog/wp-content/uploads/2014/12/errors-everywhere-meme.png
[Bayfront Technologies - mc tutorial]: http://www.bayfronttechnologies.com/mc_tutorial.html