babel-preset-env: Fixed links in readme and improved "Built-ins" example (#7271)

This commit is contained in:
Alexander Pepper 2018-01-24 17:02:03 +01:00 committed by Brian Ng
parent 88e550c733
commit 63d9998aa4

View File

@ -89,13 +89,13 @@ Use external data such as [`compat-table`](https://github.com/kangax/compat-tabl
![](https://cloud.githubusercontent.com/assets/588473/19214029/58deebce-8d48-11e6-9004-ee3fbcb75d8b.png)
We can periodically run [build-data.js](https://github.com/babel/packages/babel-preset-env/blob/master/scripts/build-data.js) which generates [plugins.json](https://github.com/babel/packages/babel-preset-env/blob/master/data/plugins.json).
We can periodically run [build-data.js](https://github.com/babel/babel/blob/master/packages/babel-preset-env/scripts/build-data.js) which generates [plugins.json](https://github.com/babel/babel/blob/master/packages/babel-preset-env/data/plugins.json).
Ref: [#7](https://github.com/babel/babel-preset-env/issues/7)
### Maintain a mapping between JavaScript features and Babel plugins
> Currently located at [plugin-features.js](https://github.com/babel/packages/babel-preset-env/blob/master/data/plugin-features.js).
> Currently located at [plugin-features.js](https://github.com/babel/babel/blob/master/packages/babel-preset-env/data/plugin-features.js).
This should be straightforward to do in most cases. There might be cases where plugins should be split up more or certain plugins aren't standalone enough (or impossible to do).
@ -201,7 +201,7 @@ Each target environment takes a number or a string (we recommend using a string
Example environments: `chrome`, `opera`, `edge`, `firefox`, `safari`, `ie`, `ios`, `android`, `node`, `electron`.
The [data](https://github.com/babel/packages/babel-preset-env/blob/master/data/plugins.json) for this is generated by running the [build-data script](https://github.com/babel/packages/babel-preset-env/blob/master/scripts/build-data.js) which pulls in data from [compat-table](https://kangax.github.io/compat-table).
The [data](https://github.com/babel/babel/blob/master/packages/babel-preset-env/data/plugins.json) for this is generated by running the [build-data script](https://github.com/babel/babel/blob/master/packages/babel-preset-env/scripts/build-data.js) which pulls in data from [compat-table](https://kangax.github.io/compat-table).
### `targets.node`
@ -241,7 +241,7 @@ Setting this to `false` will not transform modules.
`boolean`, defaults to `false`.
Outputs the targets/plugins used and the version specified in [plugin data version](https://github.com/babel/packages/babel-preset-env/blob/master/data/plugins.json) to `console.log`.
Outputs the targets/plugins used and the version specified in [plugin data version](https://github.com/babel/babel/blob/master/packages/babel-preset-env/data/plugins.json) to `console.log`.
### `include`
@ -251,15 +251,15 @@ An array of plugins to always include.
Valid options include any:
- [Babel plugins](https://github.com/babel/packages/babel-preset-env/blob/master/data/plugin-features.js) - both with (`@babel/plugin-transform-spread`) and without prefix (`plugin-transform-spread`) are supported.
- [Babel plugins](https://github.com/babel/babel/blob/master/packages/babel-preset-env/data/plugin-features.js) - both with (`@babel/plugin-transform-spread`) and without prefix (`plugin-transform-spread`) are supported.
- [Built-ins](https://github.com/babel/packages/babel-preset-env/blob/master/data/built-in-features.js), such as `map`, `set`, or `object.assign`.
- [Built-ins](https://github.com/babel/babel/blob/master/packages/babel-preset-env/data/built-in-features.js), such as `es6.map`, `es6.set`, or `es6.object.assign`.
This option is useful if there is a bug in a native implementation, or a combination of a non-supported feature + a supported one doesn't work.
For example, Node 4 supports native classes but not spread. If `super` is used with a spread argument, then the `@babel/plugin-transform-classes` transform needs to be `include`d, as it is not possible to transpile a spread with `super` otherwise.
> NOTE: The `include` and `exclude` options _only_ work with the [plugins included with this preset](https://github.com/babel/packages/babel-preset-env/blob/master/data/plugin-features.js); so, for example, including `@babel/plugin-proposal-do-expressions` or excluding `@babel/plugin-proposal-function-bind` will throw errors. To use a plugin _not_ included with this preset, add them to your [config](https://babeljs.io/docs/usage/babelrc/) directly.
> NOTE: The `include` and `exclude` options _only_ work with the [plugins included with this preset](https://github.com/babel/babel/blob/master/packages/babel-preset-env/data/plugin-features.js); so, for example, including `@babel/plugin-proposal-do-expressions` or excluding `@babel/plugin-proposal-function-bind` will throw errors. To use a plugin _not_ included with this preset, add them to your [config](https://babeljs.io/docs/usage/babelrc/) directly.
### `exclude`