esmc

0.8.25 • Public • Published

esmc npm version github release License

🔥 Modern JavaScript, today. ✨ Blazingly fast zero-config compiler, built on @Babel and @ESLint (and @FlowType).


Code style CircleCI linux build CodeCov coverage status DavidDM dependency status Renovate App Status Make A Pull Request Semantically Released

If you have any how-to kind of questions, please read the Contributing Guide and Code of Conduct documents.
For bugs reports and feature requests, please create an issue or ping @tunnckoCore at Twitter.

Conventional Commits Become a Patron Share Love Tweet NPM Downloads Weekly NPM Downloads Monthly NPM Downloads Total

Project is semantically & automatically released on CircleCI with new-release and its New Release GitHub App.

Table of Contents

Install

This project requires Node.js ^8.9.0 || ^10.6.0. Install it using yarn or npm.
We highly recommend to use Yarn when you think to contribute to this project.

$ yarn add esmc
 
# or globally 
$ yarn global add esmc

Usage

  1. Put your files in src/
  2. Run it easily with esmc
  3. Done.

Basically it creates:

  • dist/nodejs folder for Node.js 8.9
    • or any passed version to ESMC_NODE_VERSION environment variable
    • pass dist/nodejs/index.js to your pkg.module field, if you are not using --no-esm flag
  • dist/browsers folder for >= 1%, not dead, not IE <= 11, last 1 Opera versions browsers
    • or anything passed to ESMC_BROWSERSLIST environment variable
    • pass dist/browsers/index.js to your favorite bundler
  • dist/nodejs/__index.js using esm, so you can just use it in CJS
    • pass it to your pkg.main field if you are not using --no-esm flag,
    • otherwise just pass dist/nodejs/index.js there
  • generates .js.flow files only on dist/nodejs folder, if --flow is passed

Notes

By default does not compiles to CommonJS. That's intentional, because bundlers handles ES Modules great. If you want pure CommonJS pass --no-esm flag.

  • It's mostly instantaneous, because it compiles only files that are changed
  • Babel config is basically externalized as babel-preset-esmc
    • pass --no-build to disable Babel transpilation
    • note that you cannot use --no-build and --no-esm together
  • Linting is done, based on eslint-config-esmc
  • If you love static typing, just pass --flow flag and it will run type checking before any compilation phase
    • note that you may want to further configure .flowconfig file
  • All errors, of any phase, are styled similar to ESLint's codeframe reporter, so everything is just freaking awesome
  • It does not compiles common tests file patterns (if they are in your source directory)
  • To run your files using the same config, you can pass esmc/register as --require hook
  • You can use esmc lint to only lint your files, using ESLint
  • You can use esmc build to only compile your source files, using Babel
  • Use --force flag to start fresh (it deletes dist and cleans up the caches)

To try it out, clone the repo, yarn install and run yarn cli - this will compile everything from example-src/ folder as was described above.

  • Make some lint error and run it yarn cli
  • Make some type error there and run yarn cli --flow
  • Make some build error and run yarn cli

You will see that style of all errors are similar to ESLint's codeframe reporter.

back to top

See Also

Some of these projects are used here or were inspiration for this one, others are just related. So, thanks for your existance!

back to top

Contributing

Please read the Contributing Guide and Code of Conduct documents for advices.
For bugs reports and feature requests, please create an issue or ping @tunnckoCore at Twitter.

Contributors

Thanks to the hard work of these wonderful people this project is alive and it also follows the all-contributors specification.
Pull requests, stars and all kind of contributions are always welcome. 🌠

Users

You can see who uses esmc in the USERS.md file. Please feel free adding this file if it not exists.
If you or your organization are using this project, consider adding yourself to the list of users.
Thank You! ❤️

License

Copyright (c) 2018-present, Charlike Mike Reagent <olsten.larck@gmail.com>.
Released under the Apache-2.0 License.


This file was generated by verb-generate-readme, v0.7.0, on August 07, 2018.

Readme

Keywords

none

Package Sidebar

Install

npm i esmc

Weekly Downloads

17

Version

0.8.25

License

Apache-2.0

Unpacked Size

39.4 kB

Total Files

16

Last publish

Collaborators

  • tunnckocore
  • vanchoy