0.0.2 • Published 7 years ago

@effectful/babel-preset-env v0.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
7 years ago

@effectful/babel-preset-env

Babel preset augmenting babel-preset-env to enable Effectful.js translations.

Install

$ npm install --save-dev babel-preset-env @effectful/babel-preset-env

Usage

Via .babelrc

.babelrc

{
  "presets": ["@effectful/env"]
}

It supports the same arguments as babel-preset-env, e.g.

{
  "presets": [
    ["env", {
      "targets": {
        "chrome": 52
      }
    }]
  ]
}

To specify effectful options use "effectful" field in the arguments object:

{
  "presets": [
    ["env", {
      "effectful": {
        "require": "@effectful/generators"
      }
    }]
  ]
}

Via CLI

$ babel script.js --presets @effectful/env 

Via Node API

require("babel-core").transform("code", {
  presets: ["@effectful/env"]
});

Rationale

Why not separate preset without env.

The current version of Effectful.js transpiler supports only full ES5 syntax with a few ES6 extensions. Making separate preset and running it after env will not work well too, because Effectful.js wants to recognize the ES6 extensions it supports to generate better code. For example for for-of and ES6 imports. This preset also automatically enables env extensions Effectful.js doesn't support even if they are excluded in env.

After Effectful.js implements the whole latest JS extensions it will be a separate preset or plugin.

LICENSE

Copyright © 2017 Vitaliy Akimov

Distributed under the terms of The MIT License (MIT).