Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

@make-mjs/code

0.2.8 • Public • Published

@make-mjs/code

Turn a Babel JavaScript code into a MJS code

APIs Documentation

Go to the GitHub page

Example

Let's say you have ./lib/foo.js and ./lib/bar.js and this file (named index.js):

export * from './lib/foo'
export * from './lib/bar'

You run this command:

import fs from 'fs'
import transformCode from '@make-mjs/code'
const input = fs.readFileSync('index.js', 'utf8')
const output = transformCode(code, { moduleContainer: ['node_modules'] }).code
fs.writeFileSync('index.mjs', output)

You should get this file (named index.mjs):

export * from './lib/foo.mjs'
export * from './lib/bar.mjs'

License

MIT © Hoàng Văn Khải

Install

npm i @make-mjs/code

DownloadsWeekly Downloads

18

Version

0.2.8

License

MIT

Unpacked Size

17.4 kB

Total Files

34

Last publish

Collaborators

  • avatar