Compare commits

..

945 Commits

Author SHA1 Message Date
Henry Zhu
690d6465d8 v7.0.0-beta.5 2017-10-30 16:55:46 -04:00
Henry Zhu
bede73122d fixup places that aren not scoped [skip ci] (#6646) 2017-10-30 16:47:13 -04:00
Mateusz Burzyński
a1c7449a92 Fixed incorrect static class field initialization order (#6530) 2017-10-30 16:32:45 -04:00
Henry Zhu
624f00f23c Fix peerDep to ^ for beta only (#6644) 2017-10-30 16:24:42 -04:00
Henry Zhu
38f984f956 v7.0.0-beta.4 2017-10-30 14:33:56 -04:00
Henry Zhu
acfe99a4bc remove deprecated lerna command [skip ci] 2017-10-30 14:27:41 -04:00
Henry Zhu
96c380899b update types [skip ci] 2017-10-30 12:35:08 -04:00
Henry Zhu
397953c32d update lock [skip ci] 2017-10-30 12:21:20 -04:00
Benedikt Meurer
00342452e2 Fix OOB string character access in Printer#_maybeAddParen. (#6589)
* Fix OOB string character access in Printer#_maybeAddParen.

The `_maybeAddParen` method of the `Printer` class does

```js
const chaPost = str[i + 1]
```

without checking that `i + 1` is still within the bounds of `str`. It
seems like this triggers fairly often that the `str[i + 1]` access is
out of bounds. The first out of bounds access will turn the KeyedLoadIC
(in case of V8) into *MEGAMORPHIC* state, which is significantly slower
for strings (there's a fix in flight for V8 to mitigate the cost a bit
in that case). Even worse than that, the out of bounds access also
pollutes the later comparisons, namely

```js
chaPost === "/"
```

and

```js
chaPost === "*"
```

which are now no longer monomorphic on strings, since `chaPost` was
sometimes `undefined`.

This is a non-breaking performance fix, which improves babel execution
on the [web-tooling-benchmark](github.com/v8/web-tooling-benchmark)
workload by around 6-9%.

* Restructure and optimize the code a bit.
2017-10-30 09:16:44 -04:00
Jakub Beneš
04d2c030be Add a 'throwIfNamespace' option for JSX transform (#6563)
* Added tests for ifThrowNamespace flag

* JSX transformator could work with XMLNamespaces (ifThrowNamespace flag)

* Use template literal instead

* Attempt to reword the message

* Added docs

* Reworded docs

* Reworded docs

* Fixed missing space in error message
2017-10-28 20:44:15 -04:00
Henry Zhu
9ac326b075 remove es20xx prefixes from plugins and rename folders (#6575) 2017-10-28 20:43:15 -04:00
Henry Zhu
92a3caeb9c remove warning (still applies but don't need it there) [skip ci] (#6579) 2017-10-28 20:17:16 -04:00
Benedikt Meurer
ffe4301fe2 Fix property lookup on booleans in needsWhitespace. (#6584)
The code

```js
linesInfo && linesInfo[type]
```

performs a lot of dynamic lookups on the `Boolean.prototype`, as the
*ToBoolean* operation let's `true` pass for `linesInfo` (which might
itself be concerning that this can be a boolean). Instead of the
coercion, the code should properly check for valid objects via `typeof`
and strict equality with `null` comparison.

This is a non-breaking performance fix.
2017-10-28 20:16:48 -04:00
Benedikt Meurer
5baa36109e Fix access to "-1" property on nodesOut array. (#6582)
Similar to the fixes in https://github.com/babel/babel/pull/6580 and
https://github.com/babel/babel/pull/6581, accesses of the form

```js
nodesOut[nodesOut.length - 1]
```

where `nodesOut` can be an empty array, are bad for performance in Node.
In this particular case it's easy to restructure the code a bit to not
require the array access at all, but just track the current `tail` as we
go.

This is a non-breaking performance fix.
2017-10-28 20:16:04 -04:00
Henry Zhu
962128c0f0 Update to babylon v7 beta.30 (#6587) 2017-10-28 20:01:52 -04:00
Benedikt Meurer
f9e0643460 Fix path.popContext() to not try to load "-1" from contexts array. (#6580)
* Fix path.popContext() to not try to load "-1" from contexts array.

The current implement of popContext does

```js
this.setContext(this.contexts[this.contexts.length - 1]);
```

even if `this.contexts` can be empty, which causes it to lookup the
property `"-1"`, which is not found on the array itself and obviously
also not in the `Object.prototype` and the `Array.prototype`. However
since `"-1"` is not a valid array index, but has a valid integer
representation, this is a very expensive lookup in V8 (and probably
other engines too, but that is probably less relevant, since Babel
most often runs on Node nowadays).

* Make zero check explicit (for readability).
2017-10-28 16:17:05 -04:00
Benedikt Meurer
df0d9d05a3 Fix hasRest to not try to load "-1" from params array. (#6581)
Similar in spirit to https://github.com/babel/babel/pull/6580, the
current implementation did

```js
node.params[node.params.length - 1]
```

where `node.params` can also be empty, which causes it to lookup the
property `"-1"`, which is not found on the array itself and obviously
also not in the `Object.prototype` and the `Array.prototype`. However
since `"-1"` is not a valid array index, but has a valid integer
representation, this is a very expensive lookup in V8 (and probably
other engines too, but that is probably less relevant, since Babel
most often runs on Node nowadays). In V8 this causes a call to
the `%SetProperty` runtime function for each of these `"-1"`
property lookups, and in addition sends the whole `KeyedLoadIC`
to `MEGAMORPHIC` state, which also penalizes other accesses
on this line.

This is a small non-breaking performance fix.
2017-10-28 16:16:05 -04:00
Henry Zhu
5b47e4a6cb Merge transform-async-to-module-method into transform-async-to-generator (#6573) 2017-10-27 17:14:40 -04:00
Henry Zhu
f5ec9251c9 updated readme organization [skip ci] 2017-10-27 17:12:45 -04:00
Henry Zhu
c41abd79a1 Rename all proposal plugins to -proposal- from -transform- (#6570) 2017-10-27 15:26:38 -04:00
Brian Ng
a94aa54230 Re-add electron-to-chromium as preset-env devdep (#6551) 2017-10-27 11:51:46 -04:00
Henry Zhu
476ec5ed8f Fix readmes to use @babel/ [skip ci] (#6569) 2017-10-27 11:50:59 -04:00
Henry Zhu
e5e7f5bf79 Lerna: Add publishConfig access public [skip ci] (#6557) 2017-10-26 19:22:13 -04:00
Henry Zhu
0a823fbe8d add another team link [skip ci] 2017-10-25 17:51:47 -04:00
Henry Zhu
e3cebbf6bc Add peerDep on specific babel-core version in transform plugins, presets, and cli (#6549) 2017-10-25 08:36:00 -07:00
Simon Lydell
d2b3138bdd Make syntax highlighting for @ and # nicer (#6550) 2017-10-25 03:10:32 -04:00
Sylvain Delabye
eb19ea18cc Remove stale emoji tests in plugin-transform-unicode-property-regex (#6548) 2017-10-24 13:17:05 -05:00
Raja Sekar
7f5a216e2d Changed Team link to babel website 2017-10-24 08:56:16 -05:00
Logan Smyth
11d8e0555f Avoid mutating the passed-in options for babel-register (#6542) 2017-10-23 15:49:10 -07:00
Ruslan Gunawardana
70818c3db8 UepdateEADME: useBuiltins: true is changed to "entry" [skip ci] (#6527)
babel-preset-env@next founds "useBuiltins": true is illegal. README is updated accordingly.
2017-10-23 17:08:00 -05:00
Sven SAULEAU
101529ffe0 Merge pull request #6529 from Borales/core-transformation-file-has
Providing File.has method for core/transformation package
2017-10-23 15:37:00 +02:00
Adam
3214c5004e docs - Add helper-get-function-arity readme [skip ci] (#6532)
* Add README to babel-helper-get-function-arity

* Use javascript template

* Address code review

* Comment out ellipsis
2017-10-23 10:30:36 +02:00
Sven SAULEAU
7185bd25e8 Merge pull request #6533 from athomann/add-helper-bindify-decorators-docs
Add API to helper-bindify-decorators README [skip ci]
2017-10-23 10:28:52 +02:00
Sven SAULEAU
546a844e32 Merge pull request #6534 from athomann/add-helper-hoist-variables-api
Add API to babel-helper-hoist-vars README [skip ci]
2017-10-23 10:23:32 +02:00
Adam Thomann
aeedabfa4f Add installation 2017-10-22 21:42:27 -04:00
Adam Thomann
9cebe88a9c Add API to babel-helper-hoist-vars README 2017-10-22 21:31:07 -04:00
Adam Thomann
a94b0d2e54 Add API to helper-bindify-decorators 2017-10-22 21:14:48 -04:00
Lucas Azzola
cd4f0ae393 Add loose mode for nullish coalescing operator (#6531)
* Add loose mode for nullish-coalescing

* Remove unneeded SequenceExpression
2017-10-22 13:25:29 +02:00
Borales
416e9aba39 Providing File.has method for core/transformation package 2017-10-22 00:45:40 +02:00
Lucas Azzola
9e0f5235b1 Optional Chaining: Account for document.all (#6525) 2017-10-21 15:55:39 -04:00
Mateusz Burzyński
4684edaec7 Adhering to async generator yield behavior change (#6452) 2017-10-21 21:48:27 +02:00
Alex Jover
39d05da3ed fix(babel-core): add missing extension to package.json dependency (#6524) 2017-10-21 11:46:10 +02:00
Mateusz Burzyński
54aa4cb3f9 Fixed async generator named declarations with inline helpers 2017-10-20 14:23:27 +02:00
Logan Smyth
765e920e48 Fix regression that leaks JSX pragma config between files. (#6519) 2017-10-19 16:09:56 -07:00
Mateusz Burzyński
fc75198fb4 Cloning reused node in class properties transform (#6517) 2017-10-19 18:12:57 -04:00
Justin Ridgewell
8d4674ca5a Fix destructuring in pipeline operator (#6515)
* Fix destructuring in pipeline operator

Fixes #6514.

* Run exec only on node 6
2017-10-19 15:59:36 -04:00
Brian Ng
923fd4705e Remove syntax-trailing-function-commas from Babel presets (#6513) 2017-10-19 15:50:48 -04:00
Jen Luker
c2c72c4224 Update reference from babel- to @babel/ in README.md (#6508) 2017-10-19 11:23:58 -05:00
Jen Luker
b6ae9e2db2 Updating references to @babel/ and adding dependencies to package.json (#6509)
* Updating references to @babel/ and adding dependencies to package.json all in babel-runtime.

* Removing extra ../../ from the require calls.
2017-10-19 08:23:27 -04:00
Will
752a16d44c Remove babel-plugin-transform-async-functions (#6510) [skip ci]
This is leftover from #6495

Closes #6504

Signed-off-by: Will Soto <will.soto9@gmail.com>
2017-10-19 08:05:52 -04:00
Logan Smyth
c87cc18586 Merge pull request #6379 from nicolo-ribaudo/helper-runtime-dependencies
Fix helper dependencies in babel runtime
2017-10-18 18:11:44 -07:00
Nicolò Ribaudo
a740b28a9e Commit the temporalRef runtime helper 2017-10-19 00:37:09 +02:00
Nicolò Ribaudo
d2af56bcae Fix helpers dependencies loading 2017-10-19 00:37:09 +02:00
Nicolò Ribaudo
e0a6e1e864 Import temporalUndefined inside temporalRef helper 2017-10-19 00:32:43 +02:00
Mauro Bringolf
2311ddbe67 Add transform to rename variables that are ES3 reserved words (#6479)
* Initial version

* Replace .includes with .indexOf and better node set to visit

* Alphabetically sort es3 reserved words and make difference helper for readability

* Fix second Array.include error that was not polyfilled

* Move es3 keywords into separate babel-types helper and use in all es3 transforms

* Reference local plugin build directly for tests

* Try relative import for babel-types

* Update to scoped package name and beta 3

* Fix unscoped package import

* Replace local plugin reference with proper plugin name
2017-10-18 15:00:58 -07:00
Robert Rossmann
e6d44fd68e babel-core: Pass the right err to callback in transformFile() (#6503) 2017-10-18 14:14:35 -07:00
Logan Smyth
97a217db30 Merge pull request #6492 from loganfsmyth/better-template
Make babel-template nicer in a bunch of ways
2017-10-18 14:14:14 -07:00
Logan Smyth
f230497d08 Use literal-based templates for more stuff. 2017-10-18 13:58:48 -07:00
Logan Smyth
673eaf839a Simplfy assertion generation. 2017-10-18 13:58:48 -07:00
Logan Smyth
107c37715e Use .program template for helpers. 2017-10-18 13:58:47 -07:00
Logan Smyth
cc802c1e00 Reimplement 'babel-template' with better caching and tagged literal utilities. 2017-10-18 13:58:47 -07:00
Logan Smyth
191624d800 Add a new utility for traversing the AST. 2017-10-18 13:55:14 -07:00
Logan Smyth
ef185feb35 Split template module into multiple files. 2017-10-18 13:55:14 -07:00
Logan Smyth
fc3433c5cf Default templates to sourceType:module. 2017-10-18 13:55:14 -07:00
Logan Smyth
afc3963848 Clean up template calls. 2017-10-18 13:55:14 -07:00
Logan Smyth
cc22ea04bb Add type declaration for t.validate. 2017-10-18 13:55:13 -07:00
Logan Smyth
ad05c9935e Generate types with %checks annotations. 2017-10-18 13:55:13 -07:00
Logan Smyth
e6beb7cb61 Regenerate flow types and add more types. 2017-10-18 13:55:13 -07:00
Mathias Bynens
5d4c736413 Import babel-plugin-transform-unicode-property-regex (#6499)
* Import babel-plugin-transform-unicode-property-regex

Original: https://github.com/mathiasbynens/babel-plugin-transform-unicode-property-regex

Moving it into the official Babel repository makes it easier to maintain the transform.

* Update package.json

* Update README.md

* fixup

* fixup 2
2017-10-18 13:58:44 -04:00
Logan Smyth
1b4307205e Limit file-based plugins/presets to only exporting functions. (#6494) 2017-10-18 10:17:45 -07:00
Logan Smyth
445b252bc4 Simplify dirname option in plugins/presets? (#6436) 2017-10-18 08:59:32 -07:00
Brian Ng
85d82152c6 Update scope pkg ref in nullish syntax README [skip ci] 2017-10-18 09:54:51 -05:00
Brian Ng
d7af472dc0 Update scope pkg ref in nullish README [skip ci] 2017-10-18 09:53:16 -05:00
Brian Ng
c23281dc54 Update more scope package refs in preset-env docs [skip ci] 2017-10-18 09:51:35 -05:00
Brian Ng
72d1a72122 Update babel-types docs and lib/types [skip ci] 2017-10-18 09:43:54 -05:00
Lucas Azzola
99be60b53d Implement transform for nullish-coalescing operator (#6483)
* Implement transform for nullish-coalescing operator

* Update example output

* Switch from BinaryExpression to LogicalExpression

* Address review comments

- Use generateUidIdentifierBasedOnNode
- Inline "??"
- Clone ref node
- Move "??" to LogicalExpression in babel-types

* Fix reference to @babel/helper-plugin-test-runner

* Fix reference to @babel/plugin-syntax-nullish-coalescing-operator

* Don't use parent scope

* Remove .vscode from .gitignore, change 'lib/index.js' to 'lib'

* Ensure `document.all ?? 0 === document.all`

* Fix note and copy to an inline comment
2017-10-18 03:10:05 -04:00
James Kyle
5c47929983 Export File from babel-core again 2017-10-18 12:28:56 +11:00
Logan Smyth
a75e69ecec Regenerate incorrectly-updated helpers from @babel scope PR. 2017-10-17 10:47:15 -07:00
Daniel Tschinder
c16986b0c7 [preset-env] Add 1.6.1 to Changelog [skip ci] 2017-10-17 14:40:16 +02:00
Henry Zhu
830c527bb7 Merge pull request #6495 from babel/scoped-packages
Rename everything: use scoped packages
2017-10-17 08:29:18 -04:00
Henry Zhu
20729b2625 Scoped: fix flow module resolution thanks to James 2017-10-16 23:35:50 -04:00
Henry Zhu
5eea11f1f9 Scoped: misc fixes 2017-10-16 23:00:48 -04:00
Henry Zhu
f30924e655 Scoped: fix tests [skip ci] 2017-10-16 22:49:57 -04:00
Henry Zhu
33af5f745a Scoped: fix more tests in preset-env [skip ci] 2017-10-16 22:49:57 -04:00
Henry Zhu
3400b3644b Scoped: fix bugs in tests [skip ci] 2017-10-16 22:49:57 -04:00
Mateusz Burzyński
6d2f4a6955 Scoped: updated more docs with scoped packages change [skip ci] 2017-10-16 22:49:57 -04:00
Mateusz Burzyński
859ea4b175 Scoped: updated numerous docs with scoped packages change [skip ci] 2017-10-16 22:49:57 -04:00
Henry Zhu
919bdf5e79 Scoped: remove unncessary deps from standalone [skip ci] 2017-10-16 22:49:57 -04:00
Henry Zhu
eab0a1fadb Scoped: remove old references to default enabled syntax plugins, fix bootstrap [skip ci] 2017-10-16 22:49:57 -04:00
Henry Zhu
d19a0e8635 Scoped: fix dep [skip ci] 2017-10-16 22:49:57 -04:00
Henry Zhu
425c2090c1 Scoped: update standalone [skip ci] 2017-10-16 22:49:57 -04:00
Henry Zhu
c0a958098f Scoped: update readme headers to @babel/ [skip ci] 2017-10-16 22:49:57 -04:00
Mateusz Burzyński
adfacbb270 Removed deprecated babel-core/register [skip ci] 2017-10-16 22:49:57 -04:00
Mateusz Burzyński
df721f067e reverted change to keywords in package.jsons [skip ci] 2017-10-16 22:49:57 -04:00
Mateusz Burzyński
47fa189053 Scoped: update more babel- to @babel/ [skip ci] 2017-10-16 22:49:56 -04:00
Henry Zhu
696df10f51 Scoped: update more babel- to @babel/ [skip ci] 2017-10-16 22:49:56 -04:00
Brian Ng
65495105e9 Scoped: rename installation instructions for transforms [skip ci] 2017-10-16 22:49:56 -04:00
Brian Ng
645bf56838 Scoped: rename installation instructions for presets [skip ci] 2017-10-16 22:49:56 -04:00
Brian Ng
4739677965 Scoped: rename installation instructions for syntax plugins [skip ci] 2017-10-16 22:49:56 -04:00
Henry Zhu
79ddf12d9d Scoped: rename to @babel/ in readme [skip ci] 2017-10-16 22:49:56 -04:00
Henry Zhu
dfbbe82598 Scoped: rename npm pkg keyword [skip ci] 2017-10-16 22:49:56 -04:00
Henry Zhu
70080063a4 Scoped: update experimental/codemods to @babel/ [skip ci] 2017-10-16 22:49:56 -04:00
Henry Zhu
691f90a774 Scoped: change test imports to @babel/ [skip ci] 2017-10-16 22:49:56 -04:00
Henry Zhu
cde0054227 Scoped: change src imports to @babel/ [skip ci] 2017-10-16 22:49:56 -04:00
Henry Zhu
8e5e27577a Scoped: update package.json dependencies to @babel/ [skip ci] 2017-10-16 22:49:56 -04:00
Henry Zhu
1cd564bd16 Scoped: rename package names to @babel/ [skip ci] 2017-10-16 22:49:01 -04:00
Henry Zhu
279f55cd9b update to babylon beta.29 2017-10-16 20:10:55 -05:00
Zachary Sang
98621a6901 Removed index.js stub from packages/babel-core (#6474)
* Removed index.js stub from packages/babel-core

Added "main":"./lib/index.js" entry to package.json to replace index.js in packages/babel-core

* Fix indentation of new main.
2017-10-16 08:52:56 -07:00
Henry Zhu
58da50aace simplify register test (#6391) 2017-10-16 11:09:11 -04:00
Daniel Tschinder
9d00dac416 Update compat-data in babel-preset-env (#6489) 2017-10-16 11:07:41 -04:00
Henry Zhu
3659652fae update to beta.3 (#6488) 2017-10-16 10:51:56 -04:00
Sven SAULEAU
12c389b718 Merge pull request #6490 from Andarist/deps-fix
Fixed es2015-template-literals dependencies
2017-10-15 20:33:56 +02:00
Mateusz Burzyński
1215db2dd3 Fixed es2015-template-literals dependencies 2017-10-15 18:05:05 +02:00
Daniel Tschinder
d80fea47af Add polyfills for ES6 static Object methods
These functions do exist in ES5, but we still need to
load the polyfills, as they differ in ES6 sligthly
2017-10-15 09:27:27 -05:00
Henry Zhu
94da889ab7 v7.0.0-beta.3 2017-10-15 09:12:00 -04:00
Sven SAULEAU
0951720a81 Merge pull request #6481 from nicolo-ribaudo/fn-bind-dupl-nodes-6458
Don't insert duplicated nodes when transforming function bind
2017-10-14 15:49:55 +02:00
Nicolò Ribaudo
4a4c2f37bd Don't insert duplicated nodes when transforming function bind
Fixes #6458
2017-10-13 22:49:13 +02:00
Qantas94Heavy
5f285c1034 Evaluate computed class props only once (#6240) (#6466)
Previously, computed class properties would be evaluated every time a
new instance of the class was created. This means the property name
may have changed between different instances, as well as potential side
effects.

This commit fixes this by storing the computed value in a separate
variable.
2017-10-13 12:19:48 +02:00
aardito2
bfa167cc21 Add additional tests for ignore/only (#5647) 2017-10-12 20:20:07 -05:00
Clark Sandholtz
613b1bc192 Changed beginner-friendly to good first issue as requested in issue (#6471) [skip ci] 2017-10-12 20:21:42 -04:00
Leyth
35b111325e Changed 'beginner-friendly' to 'good first issue' (#6473) [skip ci] 2017-10-12 20:03:10 -04:00
Brian Ng
d7fd8888fa Bump compat-table for Chrome 63 (#6462) 2017-10-11 13:22:32 -04:00
Brian Ng
be58de2b62 Use no-undefined-identifier eslint rule in packages (#6457) 2017-10-11 01:11:48 -04:00
Anton Rusinov
fcdfc61bdb Move plugin processing to top of plugins (#6381)
* centralize plugin options

* Centralize plugins options

- move more options to the top
- move validations that depend on options to the top

* use isLoose option

* Move more validations to the top

* Move ref parameter for rewriteModuleStatementsAndPrepareHeader() to the top

* fix eslint errors

* remove unused parameter

* set default systemGlobal value

* Revert "Move ref parameter for rewriteModuleStatementsAndPrepareHeader() to the top"

This reverts commit b3855302d17fa19d8acb4c8accab3680c8d2710e.

* Revert "Move more validations to the top"

This reverts commit e5861d8a034ff8f553391f55654f753bcf428a5d.

* fix allowMutablePropsOnTags option usage

* improve naming

* change Contructor definition for sake of consistency

* move allowMutablePropsOnTags validation to the top

* add missing !
2017-10-10 00:51:34 -04:00
Logan Smyth
d89063bb32 Ensure that tests run with the monorepo's version of babel-core (#6454) 2017-10-10 00:29:23 -04:00
Mateusz Burzyński
e52f6caa18 Drop old compatibility if statement targeting babel@6.15 and earlier (#6451) 2017-10-09 13:49:06 -04:00
Logan Smyth
7d6b15bba9 Regenerate types with scripts. 2017-10-08 22:31:31 -04:00
Henry Zhu
a69d75bdcb Merge pull request #6440 from babel/misc
Misc
2017-10-07 10:28:07 -04:00
Henry Zhu
b4ba3cf2fa use yarn for external bootstrap 2017-10-07 09:17:50 -04:00
Henry Zhu
e522dd8a3c use latest yarn 2017-10-07 08:58:03 -04:00
Henry Zhu
ef467a3887 move eslint_rules to scripts/eslint_rules [skip ci] 2017-10-07 08:54:54 -04:00
Henry Zhu
35646f15a4 reomve unused packages, unused file 2017-10-07 08:51:38 -04:00
gberaudo
6298bcde03 Fix typo in README.md (#6439) 2017-10-07 12:17:55 +02:00
Logan Smyth
d511cfc0e2 Bit more refactoring from last PR. 2017-10-05 22:33:10 -04:00
Henry Zhu
586a738053 update template [skip ci] 2017-10-05 22:26:22 -04:00
Logan Smyth
841e8e9c80 Merge pull request #6435 from loganfsmyth/always-options
Always pass an options object to presets and plugins.
2017-10-05 22:26:01 -04:00
Logan Smyth
b3331c0217 Ensure that the options object always exists. 2017-10-05 22:04:09 -04:00
Logan Smyth
ca4460c0b8 Standardize on {}|void instead of ?{} options. 2017-10-05 22:04:08 -04:00
Logan Smyth
597f1a12cf Refactor loaded descriptors to allow mutation of options. 2017-10-05 21:58:36 -04:00
Logan Smyth
e01ac56b1c Simplify descriptor loading. 2017-10-05 21:52:05 -04:00
Logan Smyth
1e12bb6a23 Add more types around descriptor processing. 2017-10-05 21:52:05 -04:00
Brian Ng
2ee45bd04d Fix package repo url for babel-preset-env [skip ci] 2017-10-05 17:59:51 -05:00
Brian Ng
38355d9230 Tweak babel-preset-env for monorepo 2017-10-05 17:35:16 -05:00
Brian Ng
2d6606fd5a Merge branch 'env' 2017-10-05 13:46:43 -05:00
Henry Zhu
714456f191 update regenerator to latest [skip ci] 2017-10-05 10:57:36 -04:00
Logan Smyth
70a5b77943 Move babel-standalone's build scripts to the repo root. (#6383) 2017-10-05 10:44:56 -04:00
William
36d8a13f4d Fix catch error on do expression and add tests (#6372)
Fixes #6331
2017-10-04 18:19:54 +02:00
Diogo Franco
02d0b74d37 Extend babel-template to work as a template tag (#5001)
Supports:

```js
// these all should produce "code;" when generated
template`code;`();
template`${0}`(t.identifier('code'));
template`${'code'}`({ code: t.identifier('code') });
template`${t.identifier('code')}`()
template({})`code`();
```
2017-10-04 13:07:02 +09:00
Logan Smyth
93c3c147d6 Upgrade selfhosted compilation to beta.2 (Take 2) (#6382)
* Avoid bug in current version of typeof-symbol transform.

* Selfhost Babel on most recent beta release.
2017-10-03 17:04:30 -07:00
Logan Smyth
5ea54f6cac Fix "module" external helpers output (#6377)
* Move namespace init.

* Move call to helper generation.

* Generate named module exports properly.

* Ensure that helper names are valid identifiers.
2017-10-03 13:58:47 -07:00
Mateusz Burzyński
68182bd69f Fixed reusing node in destructuring plugin, which caused caching issue in helper-module-transforms (#6374) 2017-10-03 15:25:41 -04:00
Brian Ng
4f3e633fd0 Build with latest Babel 2017-10-03 09:51:02 -05:00
Henry Zhu
91cde0148d note about .ts extension in the preset [skip ci] (#6365) 2017-10-02 17:42:56 -04:00
Nicolò Ribaudo
18dcdc958b export foo -> module.exports = foo in runtime helers (#6366) 2017-10-02 17:40:55 -04:00
Logan Smyth
3d43a6edb4 Merge pull request #6350 from loganfsmyth/plugin-preset-caching-updated
Cache plugins and presets based on their identity
2017-10-02 14:40:06 -07:00
Logan Smyth
35312dc3d2 Track options on the plugin instance to avoid array pair usage. 2017-10-02 14:15:40 -07:00
Logan Smyth
f9bac2a358 Implement caching of plugins/presets/options 2017-10-02 14:09:59 -07:00
Logan Smyth
cc8109cdc3 Merge pull request #6359 from loganfsmyth/file-simplification
Split up babel-core's File class and add Flowtype annotations
2017-10-02 14:08:56 -07:00
Logan Smyth
f02e6847cf Add browser versions of the transform files. 2017-10-02 13:55:37 -07:00
Logan Smyth
eae76e5b89 Break apart the File class into multiple files and add type definitions. 2017-10-02 13:55:37 -07:00
Logan Smyth
c1df126b83 Remove wrap function and calculate code frames earlier. 2017-10-02 13:48:02 -07:00
Henry Zhu
4a8137c6b4 Merge pull request #6335 from jridgewell/pipeline
Pipeline operator
2017-10-02 16:32:15 -04:00
error
9f90b6f140 add con to monorepo.md (#6362) [skip ci] 2017-10-02 16:30:48 -04:00
Nicolò Ribaudo
db6626718f Document babel helpers (#6364) [skip ci] 2017-10-02 16:29:49 -04:00
Justin Ridgewell
73fba55c9f Requeueing sometimes has wrong scope (#6351)
This prevents a requeued path from inheriting a totally wrong scope later on. I can't find exactly where this is happening, but either way a path should only inherit scope from it's ancestors.
2017-10-02 15:26:10 -04:00
Nicolò Ribaudo
977c72250a Add support for helper dependencies (#6254)
* Add support for helpers dependencies.

They are used like this:

    helpers.main = defineHelper(`
        import dep from "dependency";
        export default function main() { return dependency; }
    `);

    helpers.dependency = defineHelper(`ì
        export default function dep() { return 0; }
    `);

* Clone import references

* Don't make test helpers name depend on the order the tests are run
2017-10-02 10:10:52 -07:00
Brian Ng
9cd4716cb4 Add --include-dotfiles option to babel-cli (#6232) 2017-10-02 08:55:53 -05:00
Henry Zhu
6816b26994 Merge pull request #6356 from JeromeFitz/babel-messages-inline
Remove babel-messages and inline the usages
2017-09-30 23:25:06 -04:00
Henry Zhu
b492f452ce don't run CI for tags [skip ci] 2017-09-30 23:23:25 -04:00
Mateusz Burzyński
d8d35ac0c4 Annotating taggedTemplateLiteral calls as #__PURE__ (#6327) 2017-09-30 17:30:44 -04:00
Brian Ng
789ce386ed Bump prettier (#6355) 2017-09-30 09:53:52 -04:00
JeromeFitz
ae168edcfa Remove babel-messages (#6347), continuation of #6352
package.json "babel-messages" removed:
- babel-core
- babel-helper-replace-supers
- babel-plugin-transform-es2015-classes
- babel-traverse

"messages" remove from:
- babel-plugin-check-es2015-constants/src/index.js
- babel-plugin-transform-es2015-for-of/src/index.js

export "babel-messages" removed from:
- babel-core/src/index.js

import "babel-messages" removed from:
- babel-generator/src/index.js
- babel-helper-replace-supers/src/index.js
- babel-traverse/src/index.js
- babel-traverse/src/scope/index.js
- babel-traverse/src/visitors.js

package "babel-messages" removed completely.

💯️ All tests pass.
2017-09-30 09:31:53 -04:00
Abhilash Singh
6230855b71 unshiftContainer seems to incorrectly handle function params #6150 (#6354) 2017-09-30 09:14:51 -04:00
rouzbeh84
aaeebfaf00 inlines babel-messages on the following files:
option-manager.js... /babel-core/src/config/
 build-external-helpers.js... /packages/babel-core/src/tools/
 index.js... /packages/babel-generator/src
2017-09-30 02:19:32 -07:00
Joe Lim
7c8a6cb461 remove inline plugin from Babel's .babelrc (#6348) 2017-09-30 00:15:35 -04:00
Justin Ridgewell
0e432f0e0d Remove debug closures (#6349)
God, can you imagine how many useless closures this was creating?
2017-09-29 21:31:43 -04:00
Justin Ridgewell
e58409b144 Indirect eval 2017-09-29 19:01:18 -04:00
Justin Ridgewell
4b440110a1 Optimize 0 param arrow 2017-09-29 19:01:18 -04:00
Justin Ridgewell
60335ce1ad Ensure left is evaluated before right 2017-09-29 19:01:18 -04:00
Gilbert
81496ab7b1 Pipeline operator 2017-09-29 19:01:18 -04:00
Justin Ridgewell
3746273eda Path#ensureBlock keeps path context (#6337)
* Path#ensureBlock keeps path context

This ensures that if you're inside an ArrowFunction with an expression body (say, you're on the BooleanLiteral in `() => true`), you don't suddenly lose your path context after inserting a variable.

This is because of 82d8aded8e (diff-9e0668ad44535be897b934e7077ecea5R14). Basically, an innocent `Scope#push` caused my visitor to suddenly stop working. Now, we mutate the Path so it's still in the tree.

* Tests
2017-09-29 19:00:10 -04:00
Logan Smyth
828aec757a Merge pull request #6326 from loganfsmyth/preserve-config-identity
Preserve object identity when loading config, for improved future caching.
2017-09-29 15:36:03 -07:00
Logan Smyth
a85a404175 Merge pull request #6343 from loganfsmyth/metadata-cleanup
Remove core .metadata properties and resolveModuleSource
2017-09-29 15:25:08 -07:00
Logan Smyth
a390a92d6a Remove unused helpers prop. 2017-09-29 15:17:12 -07:00
Logan Smyth
f20f8b164f Remove unused module metadata collection. 2017-09-29 15:17:11 -07:00
Logan Smyth
3bac67b4b9 Remove the resolveModuleSource options. 2017-09-29 15:17:11 -07:00
Logan Smyth
8339e036bf Remove babel.analyse and surrounding helpers. 2017-09-29 15:17:11 -07:00
Logan Smyth
655d1cc91b Remove unused 'usedHelpers' property. 2017-09-29 15:17:10 -07:00
Brian Ng
258e3383bd Add Number.parseFloat/Number.parseInt mappings 2017-09-29 18:12:37 -04:00
Henry Zhu
9418945a1f updated readme [skip ci] 2017-09-29 15:25:06 -04:00
Artem Yavorsky
f48e32bab7 Add transform-new-target and missed stage-3 plugins to babel-standalone. (#6322)
* Add transform-new-target to standalone.

* Add missed stage-3 plugins for babel-standalone.
2017-09-29 14:45:33 -04:00
Brian Ng
832408e85d Fix generator missing parens on Flow union types (#6334) 2017-09-29 14:43:38 -04:00
Logan Smyth
455cb5b8d8 Remove unused file properties. 2017-09-29 11:43:23 -07:00
Logan Smyth
c8835cbbee Remove unnecessary Store subclass. 2017-09-29 11:05:57 -07:00
Logan Smyth
1938f490b3 Move pipeline file to index. 2017-09-29 11:02:23 -07:00
Mateusz Burzyński
f0ab0f81d3 transform-es2015-template-literals doesn't have spec mode anymore, change test to use loose mode (#6338) 2017-09-29 08:00:06 -04:00
Logan Smyth
048a5b8021 Reenable Flow in option-manager 2017-09-27 16:37:45 -07:00
Justin Ridgewell
23f98a753a Add throw expressions (#6325)
* Add throw expressions

Stage 2 proposal: https://github.com/tc39/proposal-throw-expressions

* Update babylon

* Add to stage 2
2017-09-27 16:15:44 -04:00
Logan Smyth
fc448ca8f2 Flatten, process, and cache incoming options by key. 2017-09-27 11:20:27 -07:00
Henry Zhu
c4696a5bd2 add docs for other import syntax [skip ci] (#6323) 2017-09-27 10:29:51 -04:00
Logan Smyth
a599c49436 Centralize call to getEnv(). 2017-09-26 22:29:48 -07:00
Logan Smyth
7455e58270 Reuse config file merge. 2017-09-26 22:29:34 -07:00
Logan Smyth
9a4b764bde Centralize config processing in class. 2017-09-26 22:29:32 -07:00
Logan Smyth
2d7cda4d28 Remove unnecessary function. 2017-09-26 22:28:56 -07:00
Logan Smyth
073a0dc823 Split the ignore logic into its own helper class. 2017-09-26 22:28:56 -07:00
Logan Smyth
508597aadc Merge pull request #6309 from loganfsmyth/assert-module-exports-usage
Support opt-in restrictions on 'module' and 'exports' usage alongside ES6 import/export.
2017-09-26 16:42:31 -07:00
Logan Smyth
0368d41441 Fix some README issues. 2017-09-26 16:22:47 -07:00
Logan Smyth
e65994e43d Add tests for locally-declared 'exports' and 'module'. 2017-09-26 15:46:26 -07:00
Logan Smyth
b79df60fe6 Disallow usage of module/exports in ES6 modules. 2017-09-26 15:43:51 -07:00
Logan Smyth
9dfcf0f116 Split the simple-access transforms out of the module transform into a general helper. 2017-09-26 15:43:51 -07:00
Logan Smyth
0125c03303 Merge pull request #6304 from loganfsmyth/import-helper
Rewrite import insertion to insert import..from/require() based on module type
2017-09-26 15:39:42 -07:00
Logan Smyth
14ace422c3 Fix two small typoes. 2017-09-26 15:38:55 -07:00
Logan Smyth
f11cce1d7c Avoid exception when instanceof is in anonymous function declaration. 2017-09-26 15:30:50 -07:00
Logan Smyth
9b0f509433 Avoid exception when typeof is in anonymous function declaration. 2017-09-26 15:30:50 -07:00
Logan Smyth
8bea5f4f16 Fix bail-out for standalone build. 2017-09-26 15:21:56 -07:00
Logan Smyth
ed6e6fd7dd Export babel-runtime helpers as standard CommonJS. 2017-09-26 11:28:57 -07:00
Logan Smyth
5eda451fb8 Remove the unused '.addImports' API from 'babel-core'. 2017-09-26 11:28:57 -07:00
Logan Smyth
ed3603ef44 Use the imports helper in transform-runtime. 2017-09-26 11:28:57 -07:00
Logan Smyth
11715cb7af Use the imports helper in async-to-module-method. 2017-09-26 11:28:57 -07:00
Logan Smyth
ec9754bc40 Implement a new utility module for injecting module imports. 2017-09-26 11:28:56 -07:00
Logan Smyth
84184e2ddd Add failing test for babel-runtime import issue. 2017-09-26 11:02:36 -07:00
Logan Smyth
a1c268667a Fix bug in helper processing. 2017-09-26 11:02:36 -07:00
Logan Smyth
d159c468b2 Factor transform-runtime import insertion. 2017-09-26 11:02:36 -07:00
Henry Zhu
a9dd7d970f 2.0.0-beta.2 2017-09-26 12:08:50 -04:00
Henry Zhu
e7aaf1f361 update to beta.2 (#427) 2017-09-26 12:05:13 -04:00
Henry Zhu
70547efcc1 v7.0.0-beta.2 2017-09-26 11:14:41 -04:00
Henry Zhu
195745f25f update types readme [skip ci] 2017-09-26 11:06:03 -04:00
Brian Ng
c821d3a591 Updates for handling codemods folder (#6279)
* add codemod folder to gitignore, update build/test scripts to handle codemods, lerna config
2017-09-26 10:38:18 -04:00
Logan Smyth
5a2a5fb411 Move template object creation from core into the template transform. (#6307)
* Move template object creation into the template transform.

* use shorthand [skip ci]
2017-09-26 10:33:18 -04:00
Logan Smyth
0379060f8a addMapping method call missing name parameter (#6310)
in mergeSourceMap, addMapping method call missing name parameter
2017-09-26 10:24:19 -04:00
Nicolò Ribaudo
8aabbbc822 Use helper-builder-react-jsx inside plugin-transform-react-inline-elements (#6294)
* Use helper-builder-react-jsx inside plugin-transform-react-inline-elements.

This avoids duplicating the logic for converting jsx elements to plain JavaScript.

* Add a comment which explains the _jsx signature, [skip ci]
so it is a little bit easier to understand what all those .splice() calls do
2017-09-26 10:15:27 -04:00
Henry Zhu
314bd31b85 update generator/babel-types printing, babylon (#6306)
* update generator printing, babylon [skip ci]

* Update babel-types for TS node types
2017-09-26 10:01:55 -04:00
Henry Zhu
4c517a8912 update readme [skip ci] (#6305) 2017-09-25 16:08:39 -04:00
Brian Ng
4bd9d751f4 Add minor edits to babel-helper-annotate-as-pure README [skip ci] 2017-09-25 11:00:38 -05:00
Mateusz Burzyński
413ffe6639 Extracted babel-helper-annotate-as-pure (#6267) 2017-09-25 17:40:51 +02:00
Brian Ng
6012c5bedb Fix targets.browsers anchor links [skip ci] 2017-09-25 10:22:59 -05:00
Pranav Prakash
2374062bbd Remove babel-node from babel-cli (#6251)
* Remove babel-node from babel-cli

* Use new Array instead of Array for V8 optimization

* Remove extraneous use strict clauses

* Require babel-node in babel-cli

* Remove babel-node from babel-cli

* Require babel-node in babel-cli

* Remove babel-node executable from babel-cli

* Clean up babel-node from package.json
2017-09-23 11:25:27 -07:00
Logan Smyth
b115ea5da7 Merge pull request #6280 from loganfsmyth/only-transform-modules
Only transform 'this'->'undefined' and inject 'use strict' if module statements are present
2017-09-23 11:24:52 -07:00
Mateusz Burzyński
d8b7bc39af Fixed loose option of transform-es2015-parameters handling only Assig… (#6274) 2017-09-22 19:39:39 -04:00
Mateusz Burzyński
0f8c4dc5a1 Fixed transform-fixture-test-runner API docs [skip ci] (#6293) 2017-09-22 18:44:44 -04:00
Sean Zellmer
69f237b743 Fix table of contents in README (#423)
Caveat was renamed to Issues. 'Other Cool Projects' was removed.
Both happened in e4b89a1.
2017-09-22 12:50:29 -05:00
Logan Smyth
72da5e1d02 Quick fix for default import that also uses names. (#6282) 2017-09-21 22:26:42 -07:00
Mateusz Burzyński
9159323b1e Skip adding explicit undefined for let declarations when it is not ne… (#6288) 2017-09-21 22:26:08 -07:00
Mateusz Burzyński
88b7983e4f Fixed asyncToGenerator helper using arrow function (#6289) 2017-09-21 17:09:43 -07:00
Logan Smyth
2b88e079ef Only transform this/use strict if a module. 2017-09-20 10:19:35 -07:00
Logan Smyth
8e6b5de042 Allow tests to be .mjs files. 2017-09-19 14:50:43 -07:00
Logan Smyth
aebebd3dde Remove unused expected.json parsing. 2017-09-19 14:50:42 -07:00
Logan Smyth
f23dd3a04c Move 'this' tests to the correct place. 2017-09-19 14:50:42 -07:00
Logan Smyth
fec79e358c Ensure that Program nodes have a sourceType. 2017-09-19 14:50:42 -07:00
Henry Zhu
7c971f3d4d 2.0.0-beta.1 2017-09-19 16:34:39 -04:00
Brian Ng
03d7089b43 Rename stage3 (#421) 2017-09-19 15:33:58 -05:00
Henry Zhu
b83fa26937 release as 0.0.1 [skip ci] 2017-09-19 16:27:26 -04:00
Henry Zhu
23121d2bd3 v7.0.0-beta.1 2017-09-19 16:24:07 -04:00
Henry Zhu
5b9112c794 babel-helper-modules -> babel-helper-module-transforms since package taken [skip ci] 2017-09-19 16:20:03 -04:00
Henry Zhu
8597219ce5 move to codemods folder [skip ci] 2017-09-19 16:04:11 -04:00
Henry Zhu
5c824273bc update to beta.0 [skip ci] 2017-09-19 16:00:18 -04:00
MarckK
8dffbf19d0 Codemod: remove unused catch binding (#6048)
* outline of plugin to remove unused catch binding, test not passing

* plugin to remove unused catch binding

* Edit README.md and package.json

* tests for try catch finally

* Add test to handle case when binding is referenced and given new TypeError (not passing)

* Fix visitor to not remove catch clause param when binding being assigned a new value

* Improve naming of tests and explanations

* add test case for catch param not present and fix test for duplicate variable declaration

* Remove binding.constantViolations filter in visitor as superfluous

* Remove duplicate check that catch clause param present

* Alter visitor so returns out when catch binding is not an Identifier

* Created failing tests for ObjectPattern params and rewrote visitor so now passing
Took out the pass in visitor when param not an Identifier, wrote case to handle when param isObjectPattern, and wrote failing tests for when param isArrayPattern

* Handle case when param isArrayPattern, tests passing

* Update package.json to  v7.0.0-alpha.20

* Revert visitor to only consider transform if param is Identifier
2017-09-19 15:38:17 -04:00
Brian Ng
27b155aa71 Add stage-3 plugin option (#384) 2017-09-19 15:24:15 -04:00
Henry Zhu
57584268cd move out syntax plugins to babel/babel-archive, they don't need to be updated (#6229) 2017-09-19 15:19:13 -04:00
Henry Zhu
174eaa058a just inline the type (#6271) [skip ci] 2017-09-19 15:14:12 -04:00
Mateusz Burzyński
4519f95a29 Fixed buildExternalHelpers tool for var and module output types (#6260) 2017-09-19 14:44:40 -04:00
Logan Smyth
fc1e1c5668 Preserve _blockHoist values for injected binding references. (#6269) 2017-09-19 09:53:18 -07:00
Logan Smyth
bd734f03fb Make babel-register 7.x backward-compatible with 6.x. (#6268) 2017-09-19 09:52:57 -07:00
Brian Ng
9f0f8d99d5 Merge branch 'master' into 2.0 2017-09-18 20:15:30 -05:00
James Hegedus
8b97a8acf9 Clarify purpose of the tool in README (#419) 2017-09-18 18:32:18 -05:00
Pranav Prakash
e98bb3dc60 Use new Array instead of Array for V8 optimization (#6250)
* Use new Array instead of Array for V8 optimization

* fix spacing [skip ci]

* Remove extraneous use strict clauses
2017-09-18 14:14:46 -04:00
Mathias Bynens
24713e5040 transform-es2015-unicode-regex: Add tests for U+002F (#6265) 2017-09-18 13:36:39 -04:00
Mathias Bynens
51b0b06a25 Update regexpu-core to v4.1.3 (#6263)
Fixes #6246.
2017-09-18 11:48:01 -04:00
Ajay Narain Mathur
3cdb7d7f0f added instanceOf plugin to preset es2015 (#6257)
* added instanceOf plugin to preset es2015

* fixed test cases
2017-09-17 17:33:42 -04:00
Ethan Han
f5ad86c5c6 Fix newlines before the update suffix operator in babel-generator (#6259) 2017-09-17 11:22:05 -07:00
Henry Zhu
c815cf554f stopped working at some point so let's remove [skip ci] 2017-09-16 19:14:29 -04:00
Henry Zhu
745c4740af remove ref to phabricator now that we've been on gissues for a while [skip ci] 2017-09-16 19:10:29 -04:00
Henry Zhu
5fae81f43f move out old changelog, remove npm owners unused file [skip ci] 2017-09-16 19:00:36 -04:00
Henry Zhu
efe5c7928a readme: move partially into packages/ [skip ci] 2017-09-16 18:56:51 -04:00
Henry Zhu
1c14fb1227 readme: move out packages [skip ci] 2017-09-16 18:56:29 -04:00
Artem Yavorsky
41f419a2fc Merge pull request #416 from babel/fix-docs
Docs: fix claim about node versions in readme
2017-09-16 12:21:15 +03:00
Kevin Gibbons
4df876b4b5 Docs: fix claim about node versions in readme 2017-09-16 00:29:58 -07:00
Daniel Tschinder
9a0dd4e001 Fix jsx-source to not fail without filename (#6239) 2017-09-16 02:44:48 -04:00
Brian Ng
583a875d22 Add core-js stubs for parseFloat and parseInt to babel-polyfill (#6256) 2017-09-16 02:43:35 -04:00
Brian Ng
5f5ad940ed Bump regenerator-runtime version in babel-polyfill (#6255) 2017-09-16 02:42:46 -04:00
Logan Smyth
f35cf8185b Change usage of flag that was renamed. 2017-09-15 11:43:08 -07:00
Brian Ng
7f390b0282 Make terminator paren comment check more strict (#5651) 2017-09-15 11:06:24 -07:00
Henry Zhu
bf93be47c2 Merge pull request #6244 from loganfsmyth/remove-strict-toggling-wildcard-interop
Remove strict toggling wildcard interop
2017-09-14 11:19:46 -04:00
Brian Ng
cdb34c3aa2 Add support for new.target transform (#414) 2017-09-14 11:06:53 -04:00
Logan Smyth
3c93189fce Remove useless stict toggle from strict transform. 2017-09-13 23:30:41 -07:00
Logan Smyth
b6ae55153c Misc documentation fix. 2017-09-13 23:30:41 -07:00
Logan Smyth
2801bfe35c Remove 'strict:false' directive behavior. Use 'strictMode:false'. 2017-09-13 23:30:41 -07:00
Logan Smyth
637bba542a Remove interop toggling behavior of 'strict'. 2017-09-13 23:30:40 -07:00
Logan Smyth
c65742602b Add some docs for why template literals use a chain of .concat() calls. 2017-09-13 13:42:20 -07:00
Logan Smyth
18f77b3aa9 Merge pull request #6238 from loganfsmyth/reexport-name-priority
Named exports should always take priority over star exports
2017-09-13 13:33:50 -07:00
Stephen Scott
f3fe5001e6 Flesh out readme (#410) 2017-09-13 12:29:30 -05:00
Maël Nison
0ea295e83b Make sure that export * from does not overwrite named exports. 2017-09-12 22:32:09 -07:00
Logan Smyth
634c750558 Ensure helpers that reference globals continue to reference the globals properly. 2017-09-12 22:15:16 -07:00
Logan Smyth
158e9fbfd7 Represent helpers as simple modules. 2017-09-12 22:15:16 -07:00
Sven SAULEAU
0c5fae2faa Make sure source type is module when parsing .mjs (#5700)
* feat: force source type module for mjs extension

* style: fix lint
2017-09-12 20:59:00 -07:00
Logan Smyth
7179136401 Ensure the AMD/UMD loaders all have params for each import to avoid lazy-loading (#6237) 2017-09-12 20:13:16 -07:00
Maël Nison
5bb6a83fa8 Add new tests for export * from with other names. 2017-09-12 19:51:48 -07:00
Logan Smyth
5006c81b77 Apply the new module transform the the babel-runtime helper files. 2017-09-12 17:51:52 -07:00
Logan Smyth
1e750a945c Convert CommonJS to use new shared implementation. 2017-09-12 17:17:41 -07:00
Logan Smyth
f17d30692c Convert AMD to use new shared implementation. 2017-09-12 17:17:41 -07:00
Logan Smyth
95e08b6d2a Convert UMD to use new implementation of module logic. 2017-09-12 17:17:41 -07:00
Logan Smyth
47a254025a Return a unique identifier node for each use. 2017-09-12 17:17:41 -07:00
Logan Smyth
20679979fc Remove the unused 'scope' param from 'traverse.hasType'. 2017-09-12 16:48:05 -07:00
Henry Zhu
feed22c822 2.0.0-beta.0 2017-09-12 09:40:53 -04:00
Henry Zhu
a381f9b5f0 update to beta.0 (#413) 2017-09-12 09:40:35 -04:00
Henry Zhu
1cdacf85ae update types readme [skip ci] 2017-09-11 23:04:12 -04:00
Henry Zhu
1c13250807 v7.0.0-beta.0 2017-09-11 23:01:41 -04:00
Laurin Quast
8742012b5e Add --keep-file-extension option to babel-cli (#6221)
* Add --keep-module-extension option to babel-cli

* Rename keep-module-extension option to keep-file-extension; Change option to preserve all file extensions
2017-09-11 18:06:44 -04:00
Justin Ridgewell
4daf11528c Return inserted/replaced paths (#5710)
* Return inserted/replaced paths

This gives `Path`’s replacement and insertion methods a consistent
return value: the inserted/replaced paths.

Before, they could return `undefined`, a `node`, or a the current path
inside an array. It was kinda pointless.  But now they always return an
array of paths, which is useful for solving
https://github.com/babel/babel/pull/4935#discussion_r96151368.

* Return inserted nodes and not BlockStatement

Addded test for bug #4363

* Cleanups

- `#replaceWith` will now return the current path if it's the same node
- `#insertAfter` and `#insertBefore` use public Path APIs now
- Makes container insertion faster (single splice call)
- Use public APIs in container insertion
- Replacing a statement with an expression returns the expression's path
- Replacing an expression with multiple statements returns the inserted
  closure's body's paths.
2017-09-11 16:07:04 -04:00
Mateusz Burzyński
c47258d68c Annotating transformed classes with #__PURE__ comment (#6209) 2017-09-11 11:18:37 -04:00
Ben Newman
c4f6a7a06f Add failing test case for object rest after array rest, and fix it. (#6213)
* Add failing test case for object rest after array rest.

Discovered while upgrading https://github.com/meteor/babel to Babel 7.

The error is:

  1) babel-plugin-transform-object-rest-spread/object rest with array rest:
     TypeError: /Users/ben/dev/babel/packages/babel-plugin-transform-object-rest-spread/test/fixtures/object-rest/with-array-rest/actual.js: Property id of VariableDeclarator expected node to be of a type ["LVal"] but instead got null
      at Object.validate (packages/babel-types/lib/definitions/index.js:73:13)
      at validate (packages/babel-types/lib/index.js:460:9)
      at Object.builder (packages/babel-types/lib/index.js:428:7)
      at Object.RestElement (packages/babel-plugin-transform-object-rest-spread/lib/index.js:157:41)
      at NodePath._call (packages/babel-traverse/lib/path/context.js:53:20)
      at NodePath.call (packages/babel-traverse/lib/path/context.js:40:17)
      at NodePath.visit (packages/babel-traverse/lib/path/context.js:84:12)
      ...

* Fix object rest following array rest. (#6213)

* Avoid treating array ...rest elements as object ...rest properties.

* Also avoid treating ...rest parameters as object ...rest properties.

Returning early if the parent was an ArrayPattern was not quite enough,
since a RestElement can appear as a parameter in a Function as well.

* Move RestElement parent check earlier in visitor method.
2017-09-11 11:16:14 -04:00
Sven SAULEAU
1341e4163b fix(preset-es2015): pass loose option (#6224) 2017-09-11 10:37:18 -04:00
Lukas Geiger
b6467a68ca Add option to define output directory relative to the input (#5421)
* Fix output directory if filename is given

* Add test for relative output path

* Add option to define output dir relative to input

* Add tests for --copy-files

* Test error handling for wrong arguments
2017-09-09 20:38:06 -04:00
Daniel Tschinder
5565e1b406 Correctly requeue CallExpression in AMD transform (#5497)
* Correctly requeue the define()-CallExpression

* Use pushContainer
2017-09-09 20:33:35 -04:00
Ruben Verborgh
6560a29c36 Redeclaring a variable counts as a modification (#6219)
* Redeclaring a variable counts as a modification.

Fixes #6217.

* Remove "existing" logic from Binding.

Was added in #5745, but no longer triggered since 6536e605a.
2017-09-08 23:02:26 -04:00
Justin Ridgewell
4e612058c0 Do not fix linting errors in precommit hooks (#6218)
It's just damn annoying. Supersedes #5908.
2017-09-08 19:52:49 -04:00
Nicolò Ribaudo
4e7961dcf8 Use /bin/bash instead of /bin/sh in scripts
`/bin/sh` isn't always an alias of `/bin/bash`, so bash-specific syntax broke the scripts.
(like 777a9ae6e4/scripts/_get-test-directories.sh (L7))
2017-09-07 17:19:40 -07:00
Henry Zhu
bbac1ebe45 2.0.0-alpha.20 2017-09-06 11:36:30 -04:00
Henry Zhu
7c70b27b53 add basic example [skip ci] (#409) 2017-09-06 00:03:06 -04:00
Noah Lemen
777a9ae6e4 warn about class properties support in decorators readme and error messaging (#6196) 2017-09-05 14:24:21 -04:00
Astha Sharma
3a2b7fe3cd JSX pragma revert (#6195)
* Removed the deprecated jsx pragma detection code and the concerned tests that included jsx-pragma

* Removed extra tests

* Restored packages/babel-plugin-transform-react-jsx/test/fixtures/react/honor-custom-jsx-pragma-option/

* Added JSX_ANNOTATION_REGEX

* Reverted the tests for jsx-pragma-options and removed those which throw deprecated message
2017-09-04 00:25:56 -04:00
Logan Smyth
d6ba4d0a24 Only compile files inside the cwd in babel-register. (#5590) 2017-09-02 01:07:26 -04:00
Justin Ridgewell
5df70e6a94 Fix bad Scope#parent caching (#6155)
* Fix bad Scope#parent caching

Now, we traverse the path until we find a parent scope.

Fixes #6057.

* Fix bad merge

* Remove cached data

* I need to stop using Github editor

* Fix infinite loops due to scopable paths being moved up
2017-09-02 01:03:10 -04:00
Daniel Tschinder
ca117e08cb fix(requeue): Always requeue implicitely created BlockStatements (#6193)
This reverts the former fix done in #5743 and always requeues
BlockStatements when they get created.

This also fixes a bug in babel-generator which would indent code
even though no comments are present.
2017-09-02 01:02:21 -04:00
Zev Isert
2dd03e3ee9 Allow NodeJS v8.4 experimental HTTP2 (#6175)
* Allow NodeJS v8.4 experimental HTTP2

Native NodeJS HTTP/2 support experimental though, so might not be worth merging this

* Linter picked up on a line with only spaces

Removed the spaces
2017-09-02 00:42:45 +02:00
Logan Smyth
4f441ff27e Ignore the standalone output bundle so it will require() faster. 2017-09-01 15:31:29 -07:00
Justin Ridgewell
f7109658f9 Added --delete-dir-on-start option for babel (#6187)
* added --delete-dir-on-start option 

added --delete-dir-on-start-option to delete dir on start of compilation to remove deleted files from the orignial files from the --out-dir

* added option --delete-dir-on-start

added --delete-dir-on-start that option will delete the --out-dir before the compilation of code to remove the deleted files from the source from the out directory

* added --delete-dir-on-start option

added --delete-dir-on-start-option to delete dir on start of compilation to remove deleted files from the orignial files from the --out-dir

* bug removed deleting the correct dir

in the previous code, the source dir was deleted each time rather than deleting the out dir

* Remove shorthand

* Prevent babel-cli option from reaching babel-core

* Lint
2017-09-01 17:45:13 -04:00
Justin Ridgewell
f39811d271 Derived constructors don't always need a super (#6189) 2017-09-01 17:14:25 -04:00
Logan Smyth
fad9345c85 Revert Yarn workspace changes from #6056 for now.
Yarn currently fails to add the correct symlinks in some cases. See https://github.com/yarnpkg/yarn/issues/4289
2017-09-01 13:17:25 -07:00
Justin Ridgewell
1797ac5015 Update babylon and remove bad label tests (#6188) 2017-09-01 12:29:48 -04:00
Mateusz Burzyński
76161e0a73 Added new outputType - module - for build-external-helpers tool. Should help with tree-shaking story. It's strongly influenced by how the helpers are transformed by rollup-plugin-babel. (#5916) 2017-08-31 23:44:24 -04:00
Daniel Tschinder
ab30fa54cb Update debug to 3.0 (#6184) 2017-08-31 23:30:04 -04:00
Daniel Tschinder
44f6ff5e85 Update prettier, eslint + plugins, flow, husky and lint-staged (#6183) 2017-08-31 22:56:29 +02:00
Henry Zhu
6108bee4f9 update changelog labels [skip ci] 2017-08-31 15:59:05 -04:00
Daniel Tschinder
0189b38702 Merge branch '6.x' into 7.0
# Conflicts:
#	CONTRIBUTING.md
#	Makefile
#	README.md
#	lerna.json
#	lib/types.js
#	package.json
#	packages/babel-cli/package.json
#	packages/babel-code-frame/package.json
#	packages/babel-core/package.json
#	packages/babel-core/test/fixtures/transformation/misc/regression-2892/expected.js
#	packages/babel-generator/package.json
#	packages/babel-generator/src/generators/flow.js
#	packages/babel-generator/src/index.js
#	packages/babel-generator/test/fixtures/flow/declare-statements/expected.js
#	packages/babel-generator/test/fixtures/flow/object-literal-types/expected.js
#	packages/babel-generator/test/fixtures/flow/opaque-type-alias/expected.js
#	packages/babel-helper-bindify-decorators/package.json
#	packages/babel-helper-builder-binary-assignment-operator-visitor/package.json
#	packages/babel-helper-builder-conditional-assignment-operator-visitor/package.json
#	packages/babel-helper-builder-react-jsx/package.json
#	packages/babel-helper-call-delegate/package.json
#	packages/babel-helper-define-map/package.json
#	packages/babel-helper-explode-assignable-expression/package.json
#	packages/babel-helper-explode-class/package.json
#	packages/babel-helper-fixtures/package.json
#	packages/babel-helper-function-name/package.json
#	packages/babel-helper-get-function-arity/package.json
#	packages/babel-helper-hoist-variables/package.json
#	packages/babel-helper-optimise-call-expression/package.json
#	packages/babel-helper-plugin-test-runner/package.json
#	packages/babel-helper-regex/package.json
#	packages/babel-helper-remap-async-to-generator/package.json
#	packages/babel-helper-replace-supers/package.json
#	packages/babel-helper-transform-fixture-test-runner/package.json
#	packages/babel-helpers/package.json
#	packages/babel-plugin-transform-async-generator-functions/package.json
#	packages/babel-plugin-transform-async-to-generator/package.json
#	packages/babel-plugin-transform-async-to-module-method/package.json
#	packages/babel-plugin-transform-class-constructor-call/package.json
#	packages/babel-plugin-transform-class-properties/package.json
#	packages/babel-plugin-transform-decorators/package.json
#	packages/babel-plugin-transform-es2015-block-scoping/package.json
#	packages/babel-plugin-transform-es2015-classes/package.json
#	packages/babel-plugin-transform-es2015-classes/test/fixtures/regression/T6755/expected.js
#	packages/babel-plugin-transform-es2015-computed-properties/package.json
#	packages/babel-plugin-transform-es2015-duplicate-keys/package.json
#	packages/babel-plugin-transform-es2015-function-name/package.json
#	packages/babel-plugin-transform-es2015-modules-amd/package.json
#	packages/babel-plugin-transform-es2015-modules-commonjs/package.json
#	packages/babel-plugin-transform-es2015-modules-commonjs/src/index.js
#	packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/interop/export-destructured/expected.js
#	packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/strict/export-const-destructuring-object-default-params/expected.js
#	packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/strict/export-const-destructuring-object-rest/expected.js
#	packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/strict/export-const-destructuring-object/expected.js
#	packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/strict/options.json
#	packages/babel-plugin-transform-es2015-modules-systemjs/package.json
#	packages/babel-plugin-transform-es2015-modules-umd/package.json
#	packages/babel-plugin-transform-es2015-object-super/package.json
#	packages/babel-plugin-transform-es2015-parameters/package.json
#	packages/babel-plugin-transform-es2015-shorthand-properties/package.json
#	packages/babel-plugin-transform-es2015-sticky-regex/package.json
#	packages/babel-plugin-transform-es2015-unicode-regex/package.json
#	packages/babel-plugin-transform-es5-property-mutators/package.json
#	packages/babel-plugin-transform-exponentiation-operator/package.json
#	packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/opaque-type-alias/expected.js
#	packages/babel-plugin-transform-object-rest-spread/package.json
#	packages/babel-plugin-transform-object-rest-spread/src/index.js
#	packages/babel-plugin-transform-object-rest-spread/test/fixtures/object-rest/nested-2/expected.js
#	packages/babel-plugin-transform-object-rest-spread/test/fixtures/object-rest/nested/expected.js
#	packages/babel-plugin-transform-proto-to-assign/package.json
#	packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/regression-node-type-export-default/expected.js
#	packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/regression-node-type-export/expected.js
#	packages/babel-plugin-transform-react-display-name/package.json
#	packages/babel-plugin-transform-react-display-name/src/index.js
#	packages/babel-plugin-transform-react-display-name/test/fixtures/display-name/assignment-expression/expected.js
#	packages/babel-plugin-transform-react-display-name/test/fixtures/display-name/nested/expected.js
#	packages/babel-plugin-transform-react-display-name/test/fixtures/display-name/object-property/expected.js
#	packages/babel-plugin-transform-react-display-name/test/fixtures/display-name/variable-declarator/expected.js
#	packages/babel-plugin-transform-react-jsx-compat/package.json
#	packages/babel-plugin-transform-react-jsx/package.json
#	packages/babel-plugin-transform-regenerator/package.json
#	packages/babel-plugin-transform-regenerator/test/fixtures/regression/6733/expected.js
#	packages/babel-plugin-transform-regenerator/test/fixtures/regression/T7041/expected.js
#	packages/babel-plugin-transform-regenerator/test/fixtures/variable-renaming/retain-lines/expected.js
#	packages/babel-plugin-transform-runtime/README.md
#	packages/babel-plugin-transform-runtime/test/fixtures/runtime/custom-runtime/expected.js
#	packages/babel-plugin-transform-runtime/test/fixtures/runtime/full/expected.js
#	packages/babel-plugin-transform-runtime/test/fixtures/runtime/regenerator-runtime/expected.js
#	packages/babel-plugin-transform-strict-mode/package.json
#	packages/babel-polyfill/package.json
#	packages/babel-preset-es2015/package.json
#	packages/babel-preset-es2016/package.json
#	packages/babel-preset-es2017/package.json
#	packages/babel-preset-latest/package.json
#	packages/babel-preset-react/package.json
#	packages/babel-preset-stage-0/package.json
#	packages/babel-preset-stage-1/package.json
#	packages/babel-preset-stage-2/package.json
#	packages/babel-preset-stage-3/package.json
#	packages/babel-register/README.md
#	packages/babel-register/package.json
#	packages/babel-runtime/package.json
#	packages/babel-template/package.json
#	packages/babel-traverse/package.json
#	packages/babel-traverse/src/scope/lib/renamer.js
#	packages/babel-traverse/test/evaluation.js
#	packages/babel-traverse/test/replacement.js
#	packages/babel-types/README.md
#	packages/babel-types/package.json
#	packages/babel-types/src/converters.js
#	packages/babel-types/src/definitions/core.js
#	packages/babel-types/src/definitions/es2015.js
#	packages/babel-types/src/definitions/flow.js
#	packages/babel-types/test/converters.js
#	packages/babel-types/test/validators.js
#	scripts/generate-interfaces.js
#	yarn.lock
2017-08-31 17:44:17 +02:00
Artem Yavorsky
22ff8be4a7 Bump browserslist to 2.4. (#406) 2017-08-31 07:57:31 -05:00
Henry Zhu
39bd9b58e1 update to alpha.20 (#405) 2017-08-30 16:04:33 -04:00
Henry Zhu
b82b65a31e v7.0.0-alpha.20 2017-08-30 15:02:49 -04:00
Cory Simmons
5196b94fa5 Add Node usage (#398) [skip ci]
I can never remember the syntax and end up coming here to copy/paste this snippet all the time.

I assume other people want to as well, or at least make it clear for newbs that this can be used with Node without them having to scroll.
2017-08-30 00:25:10 -04:00
Justin Ridgewell
5e7fce3fe0 Update babylon (#6172) 2017-08-30 00:19:36 -04:00
Brandon Max
84580cc2d1 Refactor es2015-loose and es2015-no-commonjs presets to use preset op… (#6168) 2017-08-30 00:02:54 -04:00
Noah Lemen
d70603ffa9 re-add template literals tests, add ones that were missing (#6169) 2017-08-29 21:06:05 -04:00
Logan Smyth
d79a7920a1 Merge pull request #5586 from loganfsmyth/config-dependency-cycles
Handle cycles of plugins compiling themselves and .babelrc.js files loading themselves
2017-08-29 15:11:51 -07:00
Logan Smyth
2846e06db1 Add dependency cycle handing for plugins and config files. 2017-08-29 14:57:34 -07:00
Logan Smyth
beff7809ea Add debug() calls for config loading. 2017-08-29 14:57:33 -07:00
Henry Zhu
0a4f1b0a6e update babylon beta.22 (#6167) 2017-08-29 17:53:29 -04:00
Buu Nguyen
75861fac87 Fix bug replacement nodes not requeued (#5743) 2017-08-28 15:10:00 -06:00
Artem Yavorsky
b2b3d7944a Spec compatibility for iteratorClose condition. (#6094)
* for-of: IteratorClose spec compatibility.

See #3:
https://tc39.github.io/ecma262/#sec-iteratorclose

* Update spec fixtures for for-of.

* Fix IteratorClose case for remap-async-to-generator.

* Fix IteratorClose case for async-generator-function test output.

* Modify few tests according to iteratorClose fix.

* Fix iteratorClose for helpers.slicedToArray also.

* Update iteratorClose fixture for commonjs.
2017-08-28 13:39:02 -06:00
Henry Zhu
827d84536a Merge pull request #6156 from jridgewell/pr/5502
Fix overshadowing local binding
2017-08-28 13:38:21 -06:00
Justin Ridgewell
3e487f89ab Don't merge test options. (#6157)
* Don't merge test options.

Particularly, I don't want `lodash/merge` to merge my specific plugins
with the general test plugins. It led to odd behavior where I could
enable a loose transform in my specific test, just to have it overridden
by the test fixture's general options.

* Need options
2017-08-28 13:36:03 -06:00
Noah Lemen
40805894c5 default to spec mode for template literal transform (#6098)
* spec/loose/default switch for template literal transform, update/re-org tests

* update readme

* flip if statements

* consolidate else/if

* readme wording modification, updates to examples
2017-08-28 12:57:09 -06:00
Henry Zhu
95dd16aeeb Merge pull request #6159 from jridgewell/pr/3701
Allow native Symbols as computed property names
2017-08-28 12:50:10 -06:00
Justin Ridgewell
ac6eda2709 Class instance properties define their own context (#6158) 2017-08-28 12:47:17 -06:00
Artem Yavorsky
7af44fce75 Merge pull request #401 from yuzhakovvv/feature/add-types-to-npmignore
Add `lib/types.js` to .npmignore
2017-08-27 15:14:19 +03:00
Oliver Don
960151c876 Fix #4840: Alias class prototype for methods in loose mode (#5560)
* Fix #4840: Alias class prototype for methods in loose mode

* Cleanup
2017-08-26 21:15:45 -04:00
Justin Ridgewell
7795750862 Tests 2017-08-25 22:52:17 -04:00
Adam Miller
2d8fdf3045 Allow native Symbols as computed property names (#6705)
The for-in loop in helpers.defineEnumerableProperties doesn't iterate over Symbols.
If Object.getOwnPropertySymbols exists, include the discovered values when defining properties.
2017-08-25 22:33:51 -04:00
Justin Ridgewell
a70cda812c Remove old test 2017-08-25 19:52:15 -04:00
Justin Ridgewell
4b297907d1 Move fix into #checkBlockScopedCollisions 2017-08-25 19:23:11 -04:00
Moti Zilberman
48c114169f Move up check for binding kind "local"
This puts the check before the call to `checkBlockScopedCollisions`.
Fixes #4946.
2017-08-25 19:21:38 -04:00
Moti Zilberman
68786c4f0f Add test for issue #4946 2017-08-25 19:21:38 -04:00
Moti Zilberman
1ef5871300 Add tests for #5491 and related cases
The two function expression tests would fail before 6705de7. The
function declaration test was not a failing case but is added here for
completeness.
2017-08-25 19:21:38 -04:00
Moti Zilberman
c3e8715010 Mask existing "local" bindings when registering new binding
Fixes #5491.
2017-08-25 19:21:38 -04:00
Mauro Bringolf
d8b4073536 Consistent const violations (#6100)
* Changed updateExpression to report itself as violation instead of its argument

* Update getBindingIdentifiers to work with forXStatement and return proper node as violation

* Updated unaryExpression violation to be consistent with changes.
2017-08-24 21:19:02 -04:00
Mateusz Burzyński
3c4f19a28d Adjusted Object Rest/Spread tests to use only allowed syntax from the latest spec (#6102) 2017-08-24 15:50:43 -04:00
Noah Lemen
2db0c3ad1d linting: disallow t.identifier("undefined") in plugins (#6096)
* add new custom eslint rule, replace remaining t.identifier("undefined") with buildUndefinedNode(), update tests

* change no-undefined-identifier reporting descriptor
2017-08-24 15:43:01 -04:00
Sven SAULEAU
f0e49dceb5 Merge pull request #400 from devdevil666/feature/license
Change license year
2017-08-24 09:20:18 +02:00
Nikita Yuzhakov
93ebb58e28 Add 'lib/types.js' to .npmignore 2017-08-23 19:08:23 +03:00
Evgeniy
0507c067f4 Change license 2017-08-23 18:48:21 +03:00
Nicolò Ribaudo
4577bd1b7c TypeParameterInstantiation params can be "Flow" nodes, not "FlowType" (#6140) 2017-08-22 23:11:02 -04:00
Daniel Lo Nigro
93cf26abca Fix babel-standalone for realz (#6137)
* Fix babel-standalone

* Fix infinite loop in Makefile (oops)

* Override Node.js module resolution to handle babel-core
2017-08-22 13:46:30 -07:00
Astha Sharma
62c22c7b5d Removed the deprecated jsx pragma detection code (#6145)
* Removed the deprecated jsx pragma detection code and the concerned tests that included jsx-pragma

* Removed extra tests

* Restored packages/babel-plugin-transform-react-jsx/test/fixtures/react/honor-custom-jsx-pragma-option/
2017-08-22 15:29:06 -04:00
Bryan Wain
63baaa7148 add --config-file option to CLI to pass in .babelrc location (#6133) 2017-08-22 13:58:24 -04:00
Justin Ridgewell
7e726a81e6 Complete export transform split (#6139)
They were each transforming the other's syntax (including namespace
transform would transform default, too, and vice-versa).
2017-08-21 14:15:40 -04:00
Ramiro Silveyra d'Avila
9e4e64dac9 Remove Flow support in React preset (#6118) 2017-08-21 10:48:18 -04:00
Daniel Lo Nigro
3569cb9922 Allow nightly Yarn builds to be used (#6138)
* Allow nightly Yarn builds to be used

Fixes:
```
C:\src\babel (fix-it-fix-it-fix-it-fix-it) (babel)
λ yarn
yarn install v1.0.0-20170811.1240
[1/5] Validating package.json...
error babel@: The engine "yarn" is incompatible with this module. Expected version ">=0.27.5".
error Found incompatible module
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
```

* Use Yarn 0.28.4 to fix build
2017-08-20 16:19:17 -07:00
Sangboak Lee
c6a094a9d2 Split export extensions into 2 different plugins, update stage presets (#6080) 2017-08-19 09:35:40 -04:00
[mediba] Satoshi Takeda
879bd8f850 Fix README. rename Babili to babel-minify [skip ci] (#397) 2017-08-17 21:02:56 -05:00
Henry Zhu
cee4cde53e v6.26.0 2017-08-16 11:54:08 -04:00
Henry Zhu
aa330999d0 update changelog 2017-08-16 11:39:05 -04:00
Henry Zhu
5749276d7e update deps 2017-08-16 10:21:19 -04:00
Henry Zhu
7b30f77954 Merge pull request #6111 from modosc/update-regenerator
Update regenerator
2017-08-16 10:17:59 -04:00
Anup
6ab3b4c0e3 Add 'configurable' property to class fields (#6123) 2017-08-16 10:12:38 -04:00
Henry Zhu
70ab2e0620 Merge pull request #6113 from Andarist/fix/regenerator-fixtures
Fix/regenerator fixtures
2017-08-16 10:11:24 -04:00
Sven SAULEAU
0d16499fc0 Merge pull request #6124 from uxter/patch-1
Update README.md
2017-08-16 15:30:51 +02:00
Sven SAULEAU
77bbe20352 fix: [skip ci] split babel config 2017-08-16 15:30:16 +02:00
Vasiliy Shilov
bd569433c4 Update README.md: A semicolon is required after a class property. 2017-08-16 16:18:39 +03:00
Mateusz Burzyński
fffa604023 Fixed regenerator related fixtures 2017-08-16 10:02:33 +02:00
Ben Newman
e08ff8e650 Update regenerator-runtime to version 0.11.0. 2017-08-16 10:02:33 +02:00
Ben Newman
b660f61b92 Update regenerator-transform to version 0.10.0. 2017-08-16 10:02:33 +02:00
Sven SAULEAU
5fb282f73f Merge pull request #6121 from maurobringolf/babel-website-link
Update babel/website link
2017-08-16 08:56:09 +02:00
Mauro Bringolf
7cc5580c71 Update babel/website link 2017-08-16 08:41:48 +02:00
Brian Ng
2eaff3d01c Fix rest-member-expression-optimisation fixture (#6116) 2017-08-15 21:34:09 -04:00
Piotr Kowalski
b684699f79 Typo in name of most famous language [skip ci] 2017-08-15 19:35:41 -05:00
jbrown215
f4716dc816 Backport #6031 (#6112)
* Backport #6031

* Backport #6031

* Rebase on master, rerun scripts

* Update flowconfig
2017-08-15 17:42:01 -04:00
Henry Zhu
d375d80001 6.26.0 changelog [skip ci] 2017-08-15 17:06:16 -04:00
Henry Zhu
98824e7cb7 backport the fix #6052 [skip ci] 2017-08-15 17:01:25 -04:00
jbrown215
c28465e03e Flow opaque type 6.x backport (#6081)
* Flow opaque type backport

* Add tests for strip types, comments, and babel-generator

* Fix failing tests, run scripts

* Bump babylon to 6.18.0
2017-08-15 16:44:15 -04:00
Justin Ridgewell
4ca686b7be Fix relative execution location introspection (#5741)
So, I was reading the new Flow type strictness and noticed
https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/
Specifically, I wondered whether the `sum_all` example would copy the
arguments into an array, then loop over. Sadly, it does.

```js
function sum_all(...rest) {
  let ret = 0;
  for (let i = 0; i < rest.length; i++) { ret += rest[i]; }
  return ret;
}

// output
function sum_all() {
  var ret = 0;
  for (var _len = arguments.length, rest = Array(_len), _key = 0; _key < _len; _key++) {
    rest[_key] = arguments[_key];
  }
  for (var i = 0; i < rest.length; i++) { ret += rest[i]; }
  return ret;
}
```

But then I noticed if I changed `let i = 0` to `let i: number = 0`, it
worked directly on `arguments`. That lead me down a rabbit hole to
`Path#_guessExecutionStatusRelativeTo`. When tracing through, the last
comparison made no sense to me. It was trying to find the index of
`"init"` in a list of `["declarations"]` and `"body"` in `["directives",
"body"]`. Red flags and such.

But it makes sense when you're trying to compare the visitor order of
the common ancestor path. Then we're trying to find `"init"` in a list
of `["init", "test", "update", "body"]`. Oh, and there's `"body"` in
there too! And now we know the `ForStatement`'s `init` is executed
before the `body`.
2017-08-14 22:22:18 -04:00
Nicolò Ribaudo
b84f8e9234 Don't use _possibleConstructorReturn inside arrow functions (#6103)
Arrow functions can't be entrly skipped while traversing because this
references inside of them needs to be transformed, so I added a check
which prevents return statements inside arrow functions from being
saved for the transformation.

Fixes #5817 (regression)
2017-08-14 11:11:05 -04:00
Brian Ng
9e51038ad9 Fix class prop test fixture (#6090) 2017-08-14 09:20:36 -05:00
Henry Zhu
777a8e2bb4 add more links [skip ci] 2017-08-12 22:04:55 -04:00
Henry Zhu
ad1f87cf07 add new yarn version requirement [skip ci] 2017-08-12 22:00:25 -04:00
Matthias Kern
bd915ad8dc Rename Babili to Babel-Minify (#392) 2017-08-12 12:55:37 -05:00
Daniel Lo Nigro
a04c18af71 Move babel-standalone into main Babel repo (#6029)
* Move babel-standalone into main Babel repo

* Don't try to gather coverage data for babel-standalone test

* Fix JSX test

* Always use npm v4 on Travis

* Include pull request number as part of version number

* Cherry-picking 5721b2e43e

Remove deprecated packages to prevent Babel v6 files from being pulled in

* Use RootMostResolvePlugin to dedupe packages

* Avoid destructuring so the build works on archaic Node.js versions

* - Fix version number
- Remove Babili packages (they should be in separate babili-standalone)
- Remove deprecated  syntax-class-constructor-call

* - Remove more Babili packages
- Remove `babel-plugin-inline-replace-variables` for now as it pulls in Babel 6 stuff

* Actually remove reference to babel-plugin-undeclared-variables-check

* Add Babylon to root package.json so we hoist the right version. This fixes the tests.
2017-08-11 23:36:19 -07:00
Diogo Franco
0538c3cd8c Add another test for runtime order of template literals (#6092)
More proof that it really is unsafe to merge the .concat calls if the
value is an expression that has any chance of executing impure code 😢
2017-08-12 14:11:27 +09:00
Diogo Franco (Kovensky)
cd66657f34 Update outdated test fixture 2017-08-12 14:10:19 +09:00
Andy
9243c78ea2 babel-plugin-transform-class-properties: Ignore type annotations when looking for name collisions (#6082) 2017-08-11 10:27:48 -05:00
Sangboak Lee
218f191a59 remove left transform-class-properties from stage (#6088) 2017-08-10 22:30:45 -04:00
Henry Zhu
3154c2c114 pr template [skip ci] (#6086) 2017-08-10 16:35:32 -04:00
Noah Lemen
4fdd75695b Update Class Fields to Stage 3 and change default behavior (#6076)
* add transform-class-properties to stage 3, set spec mode to default

* update readme with examples; use `buildUndefinedNode()`; change behavior to always define both static and nonstatic class properties regardless of spec/loose mode; update tests
2017-08-10 11:19:49 -04:00
Rick Waldron
9c91e35ce4 Add numeric separator to stage 2 preset (#6071) 2017-08-10 11:05:35 -04:00
Karl Cheng
3a55e1326c Allow substrings for TEST_ONLY in make (#6079)
This allows TEST_ONLY to match substrings of the package directory name
instead of having to use the full package directory name.
2017-08-10 10:55:46 -04:00
Brian Ng
370559c62f Replace decache with direct removal in babel-register tests (#6085) 2017-08-10 10:52:27 -04:00
Andy
a74b307752 babel-types: Add missing field, fix incorrect definitions (#6083)
* babel-types: Add missing field, fix incorrect definitions

* Regenerate babel-types readme
2017-08-09 16:56:19 -04:00
Mateusz Burzyński
b41fe4efb1 [docs] Added clarification note about transform-react-inline-elements usage … (#6078)
* Added clarification note about transform-react-inline-elements usage with transform-runtime [skip ci]

* small tweaks [skip ci]
2017-08-09 08:45:02 -05:00
Andy
68d2f8d161 Add "classProperties" plugin to babel-generator typescript tests (#6074) 2017-08-08 17:38:39 -04:00
Andy
1c1ce5a9e4 Move parser plugin from babel-preset-typescript to babel-plugin-syntax-typescript (#6070) 2017-08-08 16:01:14 -05:00
Boopathi Rajaa
ab76cb6b53 Fix scope of catch block (#5980)
* Fix scope of catch block

* Throw error on Duplicate variable declaration

* Update test
2017-08-08 16:26:29 -04:00
Henry Zhu
009d7f0b76 Yarn engines (#6064) 2017-08-07 21:54:33 -05:00
Brian Ng
48a4675fed Merge branch 'master' into 2.0 2017-08-07 20:15:57 -05:00
Henry Zhu
f667f07d82 update to alpha.18 (#6062) 2017-08-07 21:15:20 -04:00
Henry Zhu
dbd65d93bb 2.0.0-alpha.19 2017-08-07 20:54:44 -04:00
Henry Zhu
75f11cfec9 alpha.19 (#389) 2017-08-07 20:54:23 -04:00
Henry Zhu
94f54da30b lockfile [skip ci] 2017-08-07 20:01:33 -04:00
Henry Zhu
d85c642617 revert lerna-changelog change [skip ci] 2017-08-07 19:42:12 -04:00
Henry Zhu
79f4956948 v7.0.0-alpha.19 2017-08-07 18:21:08 -04:00
Henry Zhu
7f92e1d9dd Update gulp, fix build (#6061)
* gulp-babel 7.0
2017-08-07 17:09:22 -04:00
Andy
e37a5eb5eb Add babel-plugin-syntax-typescript, babel-plugin-transform-typescript, and babel-preset-typescript (#5899)
* Add babel-plugin-syntax-typescript and babel-plugin-transform-typescript

* Add babel-preset-typescript

* Remove unnecessary handler for JSXOpeningElement

* Use `t.isFoo(node)` instead of `node.type === "Foo"`

* Clean up parameter property assignment generation

* Don't use function for `isSuperCall`

* slice -> shift

* Calculate sourceFileHasJsx only if necessary

* Remove `export =` support

* remove some syntax readme newlines [skip ci]
2017-08-07 11:45:52 -04:00
Henry Zhu
66ec5263a4 Use Yarn Workspaces (#6056)
* update lerna and lerna-changelog

* Lerna: enable yarn, yarn workspaces [skip ci]

* use older version of Babel since it matches on semver (cannot be the same version)

* install yarn version

* revert node engine change

* update flow

* circle ci on 8

* update lock
2017-08-05 14:48:15 -04:00
Teddy Katz
13d931c417 Don't insert the same node into the AST multiple times (fixes babel/babili#556) (#6054) 2017-08-04 19:00:29 -04:00
Henry Zhu
47a9ba3440 Merge pull request #6051 from babel/5709-2
Rewrite parameter transform and drop _blockHoist reliance
2017-08-04 18:55:23 -04:00
Henry Zhu
a1debae8f0 babylon beta.19 (#6053) 2017-08-04 14:46:12 -04:00
Henry Zhu
30c4d6b456 Merge pull request #6052 from babel/array-destructuring-hole
Array destructuring hole
2017-08-04 12:20:50 -04:00
Henry Zhu
0e58007264 add test for spread with hole 2017-08-04 12:06:26 -04:00
Henry Zhu
577173cc02 fix export when array destructuring exported value with hole 2017-08-04 11:53:49 -04:00
Henry Zhu
8c457e9283 Merge pull request #5468 from babel/react-preset
Add requireDirective to strip-flow-types for use in React preset
2017-08-04 11:31:12 -04:00
Brian Ng
2a83867436 Fixes from review 2017-08-04 10:16:45 -05:00
Brian Ng
9dd65c809f fixes 2017-08-03 22:27:30 -05:00
Brian Ng
af5f34ace5 Throw if annotation found without directive 2017-08-03 21:54:36 -05:00
Brian Ng
57da9bdbed Add requireDirective to strip-flow-types for use in React preset 2017-08-03 21:13:45 -05:00
Logan Smyth
d86ae2fb84 Remove _blockHoist usage from param processing. 2017-08-03 20:56:50 -05:00
Logan Smyth
18084db7cf Fix an ordering bug in object-rest-spread. 2017-08-03 20:56:24 -05:00
Logan Smyth
8e19a5b057 Update param scope values when expanding parameters. 2017-08-03 20:56:24 -05:00
Logan Smyth
95882d4e5a Rewrite param processing to be more clearly defined. 2017-08-03 20:56:08 -05:00
Henry Zhu
99ab2b206c update to alpha.18 (#6050) 2017-08-03 20:40:53 -04:00
Henry Zhu
77cfa94682 yarn: fix ci? 2017-08-03 20:02:31 -04:00
Henry Zhu
78157ebabd 2.0.0-alpha.18 2017-08-03 18:30:13 -04:00
Henry Zhu
e5fd7407c9 update to alpha.18 (#386) 2017-08-03 18:28:47 -04:00
Henry Zhu
79c6814d65 v7.0.0-alpha.18 2017-08-03 18:20:36 -04:00
Henry Zhu
d479673074 prepublish [skip ci] 2017-08-03 18:18:36 -04:00
Henry Zhu
6630ae9794 Merge pull request #6046 from jridgewell/pr/6038
Fix invalid block-scoped loop
2017-08-03 08:51:25 -04:00
Justin Ridgewell
6bb1486405 Fix 2017-08-02 19:47:14 -04:00
Sarup Banskota
75808a2d14 Prevent getFunctionParent from returning Program (#5923) 2017-08-02 16:30:33 -05:00
jbrown215
4e9a25e34a Flow opaque type aliases (#5990) 2017-08-02 16:30:19 -05:00
Henry Zhu
0f823beeb1 Newlines in fixtures (#6044)
* write newlines for fixtures

* rerun fixtures
2017-08-02 15:35:29 -04:00
Sergey Rubanov
829c75a866 Development Only: drop Node 4-5 and npm 2 (#6037) [skip ci]
Node versions 4 and 5 are obsolete. Version of npm bundled in Node 6 is 3 so npm 2 could be dropped as well.
2017-08-02 14:30:13 -04:00
Henry Zhu
9d7c82d869 Adding failing test for 6025 2017-08-01 16:16:47 -04:00
Brian Ng
21eeed8a8c Fix generate interfaces script (#6031)
* Fix typo in TSPropertySignature type definition

* Sort fields in generate-interfaces script
2017-08-01 14:38:46 -04:00
Brian Ng
889f4e7791 Fix refs in transform-optional-chaining docs [skip ci] (#6035) 2017-08-01 14:30:16 -04:00
Artem Yavorsky
f7a096b08e Add browserslist config/package.json section support. (#161) 2017-08-01 10:50:44 -05:00
Artem Yavorsky
1dd3d14a2f Export default for available plugins 2017-08-01 09:38:48 -05:00
Artem Yavorsky
bba7be20d2 Add available plugins into separate module 2017-08-01 09:38:48 -05:00
Brian Ng
c5e81516dd Add optional catch binding to stage 3 preset (#6032) 2017-07-31 16:00:43 -04:00
Brian Ng
6d965c0926 Make babel-node a standalone package (#6023)
* Make babel-node a standalone package

* New package `babel-node` previously `babel-cli/bin/babel-node`

* updates
2017-07-29 22:26:28 -04:00
Jimmy Jia
2dba910b9e Merge branch '6.x' 2017-07-29 12:20:18 -04:00
Andy
e32042f353 babel-generator: Comment TypeScript-specific code (#6026) 2017-07-28 18:03:38 -04:00
Andy
c1d07fd6db babel-generator: Add TypeScript support (#5896)
* babel-generator: Add TypeScript support

* Remove type declarations; not published from babylon

* Remove TODOs

* Consistently use `this.word` for tokens that are words
2017-07-28 16:07:05 -04:00
Henry Zhu
f83c83d49c add proposals repo [skip ci] (#6024) 2017-07-28 15:31:47 -04:00
chocolateboy
605adc922d allow PluginPass.file.addImport to create empty import statements (#6022)
* allow PluginPass.file.addImport to create empty import statements; fixes #6021

omitting addImport's second argument creates an import statement with an
empty `specifiers` array i.e. an empty import statement:

plugin:

    Program (path, { file }) {
        file.addImport('foo-bar/register')
    }

output:

    import "foo-bar/register";
2017-07-28 12:37:00 -04:00
Henry Zhu
593cbc1d53 Function sent (#6020)
* change back to function-sent

* update stage 2
2017-07-26 18:01:40 -04:00
Noah Lemen
5c45753cd6 add TEST_GREP example clarification [skip ci] (#6013) 2017-07-26 17:53:46 -04:00
Andy
1563221171 babel-types: Have NewExpression inherit from CallExpression (#6019) 2017-07-26 17:53:23 -04:00
Henry Zhu
c8d2361897 2.0.0-alpha.17 2017-07-26 16:24:59 -04:00
Henry Zhu
c92846d623 alpha.17 2017-07-26 16:24:36 -04:00
Andy
b242e0d946 babel-generator: Make plugins list explicit for test cases (#6018) 2017-07-26 15:46:47 -04:00
Henry Zhu
9322fd0458 v7.0.0-alpha.17 2017-07-26 08:38:44 -04:00
Henry Zhu
f01438e9b1 update devdeps to latest, update babylon (#6012)
* temporary flow strip measure
2017-07-26 07:57:49 -04:00
Henry Zhu
9f8de8f542 2.0.0-alpha.16 2017-07-25 18:04:18 -04:00
Henry Zhu
18afff2f85 update (#383) 2017-07-25 18:03:45 -04:00
Henry Zhu
ce5d1d0f59 why 2017-07-25 17:47:59 -04:00
Shuaibird Hwang
4d51052037 FIX access to the prototype of an instance (#6005)
The right way access to the prototype of an instance is using the `__proto__` rather than the `prototype`.
2017-07-24 21:46:38 -04:00
Artem Yavorsky
5fa460ff2a Merge pull request #380 from leggiero/patch-1
Fixed "node: current" example
2017-07-25 03:38:03 +03:00
Eduardo Leggiero
d156afff2e Fixed "node: current" example
`parseFloat` is not applied anymore to "node: current" logic:
The parseFloat was wrong, as `parseFloat('6.3.2')` will parse as 6.3, but `parseFloat('6.10.2')` will output 6.1 that is not correct.

Ref: https://github.com/babel/babel-preset-env/blob/master/src/targets-parser.js#L73
2017-07-22 18:19:54 +01:00
Marcus Cavanaugh
fe13ba8fc2 Remove unused functions from renamer.js. (#5965) 2017-07-20 11:19:10 -04:00
Henry Zhu
36dc6ee5dc 2.0.0-alpha.15 2017-07-19 10:52:23 -04:00
Henry Zhu
fa0b73ba33 Bump babel to alpha 15 (#372) 2017-07-18 09:55:30 -05:00
Ryan Tsao
6ae350773e Normalize module format of plugins/built-ins data (#376)
* Reference plugins json instead of module in normalize-options.js

* Make plugins module format match built-ins module
2017-07-17 16:08:15 -04:00
Robin
8e8ddc3ccb Fix typo on JavaScript (#375) 2017-07-15 11:08:42 -05:00
Brian Ng
81e87b0838 Remove codecov node package and use bash uploader (#5938)
* Remove codecov node package and use bash uploader

* test
2017-07-11 21:32:48 -04:00
Jeffrey Wear
72183ff2e9 Clarify use of bind operator in "prefix position" (#5917)
The REPL [shows](https://babeljs.io/repl/#?babili=false&evaluate=false&lineWrap=true&presets=es2015%2Creact%2Cstage-0&targets=&browsers=&builtIns=false&debug=false&code_lz=PYIwVgXBBmCuB2BjA3AKAPToAQEsDOWApgI6w4BuAhgDaHwAuW9wEqcSAdCDvACYAUoMAEo0qKEI7sUGbPiKkKNOo2atJ0rjwFDRqVEKjT-Vansy4CJMqZVMWbBIg6Ia1QeAA0WU3vEQNJxMaczkrRVsGe1ZNV2p3IW9fZCA)
that when the bind operator prefixes `obj.func` (as opposed to being used
between `obj` and `func`), rather than binding a free function `func` to `obj`,
it binds `obj.func` to `obj`.

[skip ci]
2017-07-04 16:21:39 -07:00
Brian Ng
f70c9f11fc 1.6.0 2017-07-04 09:59:31 -05:00
Brian Ng
a99f77a211 Update changelog 2017-07-04 09:58:08 -05:00
Brian Ng
9f8a44ab7a Update yarn.lock 2017-07-04 09:58:01 -05:00
Brian Ng
65fa461a59 Tweak uglify option docs (#368) 2017-07-03 13:07:39 -05:00
Artem Yavorsky
eff645a900 Merge pull request #367 from babel/chromeandroid
Handle `chromeandroid` browserslist value. Fixes #366.
2017-07-03 17:32:42 +03:00
Brian Ng
b73dac4f63 add test 2017-07-03 09:07:48 -05:00
Artem Yavorsky
7e718e1e46 Handle chromeandroid browserslist value. 2017-07-03 01:22:54 +03:00
Artem Yavorsky
51ace73e7c Use nyc 10.1.2. 2017-07-01 18:42:37 +03:00
Artem Yavorsky
47cec5439a Bump chai to 4.0.2. 2017-07-01 18:12:30 +03:00
Artem Yavorsky
ca37d4919d Explicit targets always override browsers targets. 2017-07-01 18:06:34 +03:00
Artem Yavorsky
5152b370e7 Bump some stuff. 2017-07-01 17:57:56 +03:00
Artem Yavorsky
899c57b960 Merge branch 'master' into 2.0
# Conflicts:
#	.travis.yml
#	package.json
#	src/targets-parser.js
#	yarn.lock
2017-07-01 17:50:54 +03:00
Brian Ng
0c847c4571 Bump compat-table for node8 support (#363) 2017-07-01 09:43:00 -05:00
Jim Nielsen
9ad660bbe1 Swap github/twitter links (#5895) [skip ci] 2017-06-28 14:51:23 -04:00
Henry Zhu
48c770e4bb Force color output in test runs to ensure consistent behavior in Travis 2017-06-27 17:48:56 -04:00
Josh Johnston
3cf4cee40a Fix 5768 (#5811)
* Fix destructured exports

- adds a failing test based on description in #5768
- handles ObjectPattern and ArrayPattern

* use export assignment template
2017-06-27 17:31:47 -04:00
Justin Ridgewell
64eafad472 Merge pull request #5469 from yavorsky/fix-commonjs-destructuring
Fix commonjs exports with destructuring.
2017-06-21 16:41:55 -04:00
Danny Andrews
3b28bd2cb1 [skip ci] Fix typos in README.md (#5857) 2017-06-14 09:49:41 -05:00
Konstantin Pschera
fea3a72838 Fix babel-plugin-transform-regenerator README (#5852) 2017-06-13 09:19:36 -05:00
Henry Zhu
ac99d73e88 add probot-stale [skip ci] (#353) 2017-06-12 11:10:58 -04:00
Hasan Bayat
1b29ab1289 Adding documentation and information (#5717) [skip ci] 2017-06-09 11:24:20 -04:00
Alex Rattray
dd82d7a653 Document babel-helper-plugin-test-runner usage (#5843) [skip ci]
* Document `babel-helper-plugin-test-runner` usage

* [skip ci]
2017-06-09 10:35:53 -04:00
Henry Zhu
ccd314cba7 6.25.0 changelog [skip ci] (#5844) 2017-06-08 17:30:39 -04:00
Henry Zhu
82f37841f5 v6.25.0 2017-06-08 17:29:04 -04:00
Henry Zhu
bc013e6d34 just make sure babylon is up to date [skip ci] 2017-06-08 17:10:51 -04:00
Bo Lingen
0c8fdc381d Backport array & object pattern fixes to 6.x (#5770)
* Backport array & object pattern fixes to 6.x

Original PRs merged to 7.0 as #5722 and #5762

* fix lint error
2017-06-08 16:58:37 -04:00
Brian Ng
97f4d31192 Update changelog for v1.5.2 [skip ci] 2017-06-07 09:44:22 -05:00
Brian Ng
9850f82351 1.5.2 2017-06-07 09:38:08 -05:00
Justin Ridgewell
783d85ee4b Merge pull request #5780 from kentor/react-display-name-to-support-createReactClass
Backport support for createReactClass with transform-react-display-name
2017-06-05 16:13:16 -04:00
Brian Ng
c568150759 Merge pull request #346 from babel/issue345
Ensure explicit targets always override browsers key targets
2017-06-02 13:54:12 -05:00
Henry Zhu
794a522fb6 2.0.0-alpha.12 2017-06-01 14:35:03 -04:00
Brian Ng
ed80a4e84d Add node 8 to travis (#347) 2017-06-01 14:21:54 -04:00
Henry Zhu
d6245af802 fix readme [skip ci] 2017-06-01 10:35:28 -04:00
Henry Zhu
b2102baaae target node 8 2017-06-01 10:33:49 -04:00
Henry Zhu
41b0a79837 update packages to alpha.12 (#343)
* update packages to alpha.12

* fix tests

* Read babel-cli from package.json in smoke test
2017-06-01 10:32:28 -04:00
Brian Ng
36e017b427 Ensure explicit targets always override browsers key targets 2017-06-01 08:38:55 -05:00
Brian Ng
432495752d Merge branch 'master' into 2.0 2017-05-31 18:58:01 -05:00
Justin Ridgewell
489cf90d23 Merge pull request #5796 from noinkling/add-inspect-brk-option
Allow --inspect-brk option to be used with babel-node [6.x backport]
2017-05-31 03:20:41 -04:00
noinkling
0230dc5067 Allow --inspect-brk option to be used with babel-node 2017-05-31 14:14:58 +12:00
Peeyush Kushwaha
dcbb6c5ce5 Add a section on troubleshooting [skip ci] (#5788)
* Add a section on troubleshooting [skip ci]

* Move troubleshooting section to be under the running tests section

* [skip ci]
2017-05-29 11:20:13 -04:00
Brian Vaughn
b296759852 Updated transform-react-display-name for createReactClass addon (#5554)
* Updated transform-react-display-name for ReactCreateClass addon

* Tweaked description for transform-react-display-name plugin

* Changed ReactCreateClass to createReactClass
2017-05-26 10:04:34 -07:00
Henry Zhu
51f3ab45c4 [skip ci] 2017-05-25 12:54:06 -04:00
Brian Ng
7945c53389 Merge pull request #327 from yavorsky/2.0-stderr
Consider stderr for debug fixtures.
2017-05-25 08:49:46 -05:00
Artem Yavorsky
9062995324 README: Add string type as valid node target value (#337) [skip ci] 2017-05-24 07:48:53 -04:00
Brian Ng
eaf8d4589a 1.5.1 2017-05-22 09:30:25 -05:00
Brian Ng
6ad103b756 Update changelog for v1.5.1 [skip ci] 2017-05-22 09:29:08 -05:00
Brian Ng
fa69bfc755 Compile with loose mode (#332) 2017-05-22 10:19:55 -04:00
Justin Ridgewell
5b261849e0 Merge pull request #5755 from u9lyfish/patch-1
Fix broken tables in README.md
2017-05-20 16:57:53 -04:00
Brian Ng
0fcfcc5bf2 1.5.0 2017-05-20 14:19:39 -05:00
Brian Ng
3b4c36f9e4 Update changelog for v1.5 [skip ci] 2017-05-20 14:07:32 -05:00
Brian Ng
08d397af14 Merge pull request #321 from babel/backport-string-versions
Backport support for target versions as strings
2017-05-20 14:05:24 -05:00
Artem Yavorsky
842d0540a4 Backport: use preset-env and remove flow-strip-types (#324)
* es2015 -> env.

* Remove transform-flow-strip-types plugin.
2017-05-20 14:04:48 -05:00
u9lyfish@gmail.com
58c686378d Fix broken tables in README.md 2017-05-20 23:44:51 +08:00
Brian Ng
9a92933589 Fix incorrect property ordering with obj rest spread on nested (#5750) 2017-05-20 09:08:23 -04:00
Artem Yavorsky
9b9318493e Merge branch 'master' into backport-string-versions 2017-05-20 13:04:01 +03:00
Artem Yavorsky
a3654478df Merge pull request #329 from babel/bump-electron
Bump electron-to-chromium to 1.3.11
2017-05-20 12:59:33 +03:00
Brian Ng
a4e6f90d06 Use ensureDirSync in smoke test 2017-05-19 16:28:30 -05:00
Brian Ng
0781f711d0 Support target versions as strings (#231) 2017-05-19 16:28:30 -05:00
Brian Ng
72591a0ebd Bump electron-to-chromium 2017-05-19 16:26:47 -05:00
Justin Ridgewell
5f866f2d92 Hoist toSequenceExpression's convert helper (#5693)
* Hoist toSequenceExpression's convert helper

* Adds tests

* lint

* dev-depend on babel-generator
2017-05-19 17:03:33 -04:00
Brian Ng
37c8da674a Bump prettier (#289) 2017-05-19 15:40:19 -05:00
Artem Yavorsky
ddd6d66bc6 Remove old comments. 2017-05-18 16:45:33 +03:00
Artem Yavorsky
d320d0c587 Fix stderr file reading. 2017-05-18 16:43:37 +03:00
Artem Yavorsky
4d96adaf3c Update stderr for usage with import. 2017-05-18 16:43:09 +03:00
Artem Yavorsky
b0ff26985f Add test for stderr. 2017-05-18 16:20:25 +03:00
Artem Yavorsky
84c38182ad Add usage with import ‘babel-polyfill’ fixture. 2017-05-18 16:20:17 +03:00
Brian Ng
14e9fbf345 Tweak version mappings to match compat-table updates (#323) 2017-05-17 10:26:23 -05:00
Artem Yavorsky
e1cb75989f Add flow (#269) 2017-05-15 08:59:48 -05:00
Brian Ng
ea22361673 Bump browserslist. (#319) 2017-05-10 13:59:05 -05:00
Brian Ng
d6202dc741 Merge branch 'master' into 2.0 2017-05-02 09:13:18 -05:00
Artem Yavorsky
782d933d5f Debug enhancements (#310) 2017-05-02 08:35:37 -05:00
Samuel Reed
3570ba7c28 Fix PathHoister error attaching after export declarations.
Fixes #5369.

See also 4ee385e96c/packages/babel-plugin-transform-class-properties/src/index.js (L167)
2017-05-01 14:22:38 -07:00
Sebastian McKenzie
60adcd68a0 Port flow object spread from #418 to 6.x (#5653)
* Add support for object type spread

* Type spread: remove variance and add stripping test

* Fix tests
2017-04-26 17:16:38 -04:00
Brian Ng
e54c30c285 Bump babel to alpha.9 (#309) 2017-04-26 17:03:53 -04:00
Brian Ng
aad13388c7 Add forceAllTransforms option and deprecate Uglify target (#264) 2017-04-26 14:11:53 -05:00
Brian Ng
285b35e8b3 Bump compat-table (#307) 2017-04-25 17:14:19 -05:00
Artem Yavorsky
7624648623 Add debug-fixtures and test/tmp to .eslintignore (#305) 2017-04-25 09:36:51 -05:00
Artem Yavorsky
ccc31f7878 Update useBuiltIns : true warning. (#300) 2017-04-20 09:18:19 -05:00
Brian Ng
2b9b69dc32 Merge branch 'master' into 2.0 2017-04-20 08:20:31 -05:00
Henry Zhu
50539f86c0 2.0.0-alpha.7 2017-04-18 10:58:41 -04:00
Brian Ng
79a0f8c458 Add debug messaging to usage plugin (#291) 2017-04-18 10:58:05 -04:00
Henry Zhu
ba6fa252c0 2.0.0-alpha.6 2017-04-17 16:55:05 -04:00
Henry Zhu
a35684988b update to alpha.8 (#293) 2017-04-17 15:45:35 -04:00
Artem Yavorsky
e54cef60a5 Remove hidden files from debug fixtures targets. (#287) 2017-04-17 12:07:29 -04:00
Brian Ng
2c5ff923d1 Use Sets for polyfills and transformations (#274) 2017-04-14 13:07:05 -05:00
Brian Ng
c478c429ea 1.4.0 2017-04-14 10:43:19 -05:00
Brian Ng
88856fc1f2 Update changelog [skip ci] 2017-04-14 10:37:22 -05:00
Diogo Franco
75db91940e Support spec option (#98) 2017-04-14 10:11:36 -05:00
Artem Yavorsky
64cfc43883 Update README according to new useBuiltIns values. (#288) [skip ci] 2017-04-14 08:43:30 -04:00
Brian Ng
1e11a32c44 Run smoke test for both entry and usage options (#286) 2017-04-13 22:04:08 -05:00
Henry Zhu
7acf4a46f0 make useBuiltIns: false default, rename true to 'usage' (#285) 2017-04-13 21:45:25 -05:00
Brian Ng
1fca73a1b7 Move polyfill debug into useBuiltInsEntry plugin (#280) 2017-04-13 17:42:02 -04:00
Henry Zhu
e4d2c4e346 account for web.iterable (#283)
* account for web.iterable

* extra test, remove unncessary warning
2017-04-13 17:39:34 -04:00
Dara Hak
4648bb6022 Clarify note about loading polyfills only once (#282) 2017-04-13 11:00:00 -05:00
Brian Ng
a139b12a86 Add a reminder about include/exclude options (#275)
* Add a reminder about include/exclude options [skip ci]

* include note about adding plugin [skip ci]
2017-04-13 11:08:44 -04:00
Evilebot Tnawi
f9517db461 Chore: reduce package size. (#281) [skip ci] 2017-04-13 11:05:59 -04:00
Artem Yavorsky
f51e082687 Merge pull request #273 from babel/compat-table
Bump compat-table for Edge 15 support
2017-04-12 12:57:23 +03:00
Brian Ng
9abd056ccd Bump compat-table for Edge 15 support 2017-04-11 16:40:36 -05:00
Artem Yavorsky
d60cd65213 Remove deprecated comment (#271) 2017-04-11 20:53:33 +03:00
Brian Ng
3dee64d1e1 Merge pull request #270 from babel/issue268
Add Android browser to name map
2017-04-11 12:40:36 -05:00
Brian Ng
2f28de5d70 Add Android browser to name map 2017-04-11 11:45:16 -05:00
Artem Yavorsky
de29bb374f Merge pull request #266 from babel/2.0-flow
Add initial flow setup
2017-04-11 12:32:51 +03:00
Brian Ng
1d8b6b043f Add initial flow setup 2017-04-10 21:13:04 -05:00
Brian Ng
243d5d1a02 Merge branch 'master' into 2.0 2017-04-10 15:23:20 -05:00
Henry Zhu
9732524aaf 2.0.0-alpha.5 2017-04-10 10:39:49 -04:00
Henry Zhu
444025a764 Merge pull request #263 from babel/coverage
Coverage + fixes
2017-04-10 10:39:01 -04:00
Henry Zhu
5d8a091336 fix code output 2017-04-10 10:10:21 -04:00
ssuman
412180e203 Increase the code coverage for traverse evaluation (#5363)
* When applied this commit will increase the code coverage for evaluation.js

* Fixing linting issues
2017-04-09 16:49:37 -07:00
Jan Kassens
a1a795321a Update deprecation warning on flow bindings (#5615)
Babel 6 is at 6.24, doesn't seem like this is getting removed in version 6 anymore.
2017-04-09 16:11:06 -07:00
Brian Ng
11b7db05fb Merge pull request #5613 from babel/backport-doc-changes
Backport doc changes
2017-04-08 09:08:47 -05:00
Henry Zhu
2e231bb976 Add changelog tags [skip ci] (#258) 2017-04-08 07:52:28 -04:00
Sven SAULEAU
ca435b6d48 Improve options documentation for babel-plugin-transform-runtime #5401 2017-04-08 10:18:44 +02:00
Sven SAULEAU
982aba38e4 [doc] Fix: comments in usage w/ options #5400 2017-04-08 10:18:01 +02:00
Sven SAULEAU
c1b3740707 document cache option for babel-register #5440 2017-04-08 10:16:55 +02:00
Sven SAULEAU
e9bc213b14 Update coffescript/register reference link address #5475 2017-04-08 10:15:43 +02:00
Sven SAULEAU
e2c2d7d742 Update babel-generator's README #5517 2017-04-08 10:14:56 +02:00
Sven SAULEAU
2cb4d08d19 Improve example of babel-plugin-transform-es2015-arrow-functions #5573 2017-04-08 10:14:19 +02:00
Sven SAULEAU
149acc40bd Remove incorrect docs. #5580 2017-04-08 10:13:47 +02:00
Sven SAULEAU
d40cb31685 Update transform-es2015-modules-commonjs doc #5588 2017-04-08 10:13:20 +02:00
Henry Zhu
5248f499b3 check if import/required babel-polyfill are removed 2017-04-07 17:47:43 -04:00
Brian Ng
3f5b1490c2 1.3.3 2017-04-07 16:38:16 -05:00
Brian Ng
d7c18cf9fa Fix and update changelog for v1.3.3 [skip ci] 2017-04-07 16:32:38 -05:00
Brian Ng
3c8eeec515 Ensure const-check plugin order (#257) 2017-04-07 16:25:34 -05:00
Brian Ng
5b64743864 Update changelog (#253) 2017-04-07 17:23:27 -04:00
Henry Zhu
88f18f5482 Merge pull request #255 from babel/2.0-update-smoke
Update smoke-test
2017-04-07 17:22:56 -04:00
Brian Ng
adf5045e66 Fix coverage 2017-04-07 16:15:00 -05:00
Brian Ng
4ed8904205 Use ensureDirSync in smoke test 2017-04-07 16:14:50 -05:00
Brian Ng
f2de82a368 Drop extends helper (#254) 2017-04-07 14:39:12 -05:00
Brian Ng
b2524770f9 Update smoke-test 2017-04-07 14:36:19 -05:00
Brian Ng
3c1836ab43 Support target versions as strings (#231) 2017-04-07 14:24:42 -05:00
Artem Yavorsky
bfe22a945a Merge pull request #252 from yavorsky/electron-string
Support electron version in a string format.
2017-04-07 19:43:07 +03:00
Henry Zhu
79573baa16 2.0.0-alpha.4 2017-04-07 12:42:43 -04:00
Artem Yavorsky
1e4e071c25 Support electron version in a string format. 2017-04-07 19:29:49 +03:00
Henry Zhu
556b3743f6 fix lint [skip ci] 2017-04-07 12:01:11 -04:00
Henry Zhu
d71169f3b0 Merge pull request #241 from babel/add-used-built-ins
Breaking: make current "useBuiltIns" auto import only used + necessary polyfills per file
2017-04-07 11:23:59 -04:00
Henry Zhu
f8da5e3457 v6.24.1 2017-04-07 11:19:02 -04:00
Henry Zhu
c63c2fc49b fix warning, readme [skip ci] 2017-04-07 10:25:32 -04:00
Henry Zhu
afa3ad97d1 update plugins to latest alpha 2017-04-06 14:36:01 -04:00
Henry Zhu
5cbe963dde account for computed variables in properties 2017-04-06 14:32:12 -04:00
Henry Zhu
200edc8e8c move debug check 2017-04-06 12:02:21 -04:00
Henry Zhu
88d4df437e use a Set 2017-04-06 12:01:18 -04:00
MrSpider
fd3a2c285a Fix replacing function declaration in export default (fixes #4468) (#5456) 2017-04-06 11:40:31 -04:00
Henry Zhu
a48cf8b53f fix warning + readme [skip ci] 2017-04-06 11:38:29 -04:00
Henry Zhu
cb1c5eaf97 validate useBuiltIns against true,false,entry and test 2017-04-06 11:21:06 -04:00
Henry Zhu
3534bc872d Merge pull request #5567 from aickin/update-regenerator-transform
Update regenerator-transform to new version
2017-04-06 11:18:03 -04:00
Daniel Tschinder
66f8546107 Add test for regression 4219 2017-04-06 15:51:17 +02:00
Henry Zhu
bf31fff83e add imports as built-ins are found instead of at program exit 2017-04-05 19:35:02 -04:00
Henry Zhu
38fa457a88 use error messages, only log instance methods in debug 2017-04-05 17:58:54 -04:00
Henry Zhu
f1bf68364c useBuiltIns: true is now useBuiltIns: entry, and turn on useBuiltIns: true on default 2017-04-04 18:17:07 -04:00
Henry Zhu
016c9ad94c Breaking: account for https://github.com/babel/babel/pull/5584, only run on babel-polyfill not core-js
return babel-polyfill require instead of core-js
2017-04-04 17:42:16 -04:00
Henry Zhu
f33bea1363 remove unncessary check 2017-04-04 14:17:34 -04:00
Henry Zhu
7df557a269 add instance method tests 2017-04-04 14:16:29 -04:00
Henry Zhu
c10528254b create add-used-built-ins option 2017-04-04 14:16:28 -04:00
Artem Yavorsky
cf5ea69073 Merge pull request #245 from babel/existentialism-patch-1
Note babel plugin prefix handling in include/exclude [skip ci]
2017-04-04 17:32:41 +03:00
Brian Ng
804329e221 Note babel plugin prefix handling in include/exclude [skip ci] 2017-04-04 09:31:01 -05:00
Artem Yavorsky
624c2868c0 Allow use babel-plugin- prefix for include and exclude. (#242) 2017-04-04 09:24:25 -05:00
Felix Yan
9b4c33d44e Fix a typo: occurences -> occurrences (#5575) 2017-04-03 22:38:12 -07:00
Brian Ng
83b85a3609 Merge branch 'master' into 2.0 2017-03-31 12:15:06 -05:00
Brian Ng
af2b162175 Add simple smoke-test (#240) 2017-03-31 12:11:26 -05:00
Sasha Aickin
60df9f3cad Updating regenerator-transform and adding a test for the issue in facebook/regenerator#267 2017-03-30 22:10:02 -07:00
George Chung
db1fd15616 Fix README: debug option shows info in stdout. (#236) 2017-03-30 20:25:32 -05:00
Brian Ng
9733e89cd8 Add prepublish script 2017-03-30 17:30:06 -05:00
Brian Ng
234568cd51 1.3.2 2017-03-30 17:24:58 -05:00
Brian Ng
8663c37888 1.3.1 2017-03-30 16:08:06 -05:00
Brian Ng
4ffe1f2e52 Revert npmignoring data 2017-03-30 16:06:57 -05:00
Brian Ng
da97567ee9 1.3.0 2017-03-30 15:41:24 -05:00
Brian Ng
bd944ccf56 Update changelog 2017-03-30 15:41:16 -05:00
Brian Ng
ae3e7cb4a9 Add check for ArrayBuffer[Symbol.species] (#233) 2017-03-30 16:18:28 -04:00
Brian Ng
0052e16853 Merge branch 'master' into 2.0 2017-03-30 13:26:41 -05:00
Artem Yavorsky
c4c9a7fc88 Fill data with electron as a target. (#229) 2017-03-28 23:07:17 -05:00
Brian Ng
9a5ab8cfea Merge branch 'master' into 2.0 2017-03-28 10:37:47 -05:00
Artem Yavorsky
0443dcd7cd Merge pull request #228 from babel/b7-a6
Bump babel to b7.alpha6
2017-03-28 15:59:20 +03:00
Mikhail Shustov
ae3dfda1d6 separate default builtins for platforms (#226) 2017-03-27 17:43:18 -05:00
Brian Ng
fc03259a2b Bump babel to b7.alpha6 2017-03-27 17:18:41 -05:00
Steve Mao
a9f7c7db4c remove deprecated projects (#223) [skip ci] 2017-03-25 22:06:09 -04:00
Artem Yavorsky
b3bfd40195 Run yarn as pre-commit hook if package.json was changed (#225) 2017-03-24 10:35:26 -05:00
Henry Zhu
03de20f043 2.0.0-alpha.3 2017-03-23 17:03:11 -04:00
Henry Zhu
8e528fdacf update to b7-alpha.3 (#224) 2017-03-23 17:01:52 -04:00
Artem Yavorsky
f2f226b4f2 Add syntax-object-rest-spread as devDep for tests. 2017-03-23 00:52:10 +02:00
Artem Yavorsky
ddfb6f2c44 Remove object-rest-spread syntax. 2017-03-23 00:33:03 +02:00
Artem Yavorsky
70354013f1 Fix visitor inheritance. 2017-03-19 14:46:59 +02:00
Artem Yavorsky
c42e027602 Add object rest spread syntax using plugin. 2017-03-19 14:02:01 +02:00
Artem Yavorsky
18d6ba9947 Fix export array rest expected output. 2017-03-19 01:18:22 +02:00
Artem Yavorsky
c82b084927 Fix object rest params for exports. 2017-03-19 00:32:27 +02:00
Artem Yavorsky
45b41740d8 Consider default params for object pattern. 2017-03-18 16:26:22 +02:00
Artem Yavorsky
b608e28aa7 Consider rest params for array pattern in exports. 2017-03-18 16:02:06 +02:00
Artem Yavorsky
06f67e1ad3 Consider default parameters for array pattern. 2017-03-18 15:42:39 +02:00
Artem Yavorsky
b5bb89b30a Add array pattern to exports destructuring. 2017-03-18 15:12:46 +02:00
Brian Ng
cd3dbe700c Re-enable yarn/node 4 on travis 2017-03-17 12:47:30 -05:00
Brian Ng
b7c04d43ca Merge pull request #216 from babel/update-npmignore
npmignore: Add related to build data and codecov.
2017-03-15 22:23:43 -05:00
Artem Yavorsky
040404085b npmignore: Add related to build data and codecov. 2017-03-16 04:06:50 +02:00
Brian Ng
f77b875875 Merge pull request #215 from babel/2.0-yarn
Update yarn.lock
2017-03-15 20:58:15 -05:00
Artem Yavorsky
d309b25b19 Update yarn.lock 2017-03-16 03:47:23 +02:00
Artem Yavorsky
9237206337 Merge pull request #214 from babel/2.0-istanbul
Bump babel-plugin-istanbul
2017-03-16 03:43:34 +02:00
Brian Ng
9565dfed54 Bump babel-plugin-istanbul 2017-03-15 18:45:00 -05:00
Brian Ng
35068a6626 Merge branch 'master' into 2.0 2017-03-15 18:24:57 -05:00
Artem Yavorsky
41ddbc03c9 Merge pull request #212 from babel/existentialism-patch-2
Bump codecov
2017-03-16 01:18:02 +02:00
Brian Ng
1fe146f274 Bump codecov 2017-03-15 18:04:41 -05:00
Brian Ng
6babbd981a v1.2.2 changelog [skip ci] 2017-03-15 11:50:32 -05:00
Brian Ng
d71cee8fa1 1.2.2 2017-03-15 11:44:23 -05:00
Brian Ng
8b99386491 Change how yarn is installed on travis 2017-03-15 11:12:59 -05:00
Artem Yavorsky
0c2e3b1045 Remove exports definition. 2017-03-15 16:02:21 +02:00
Artem Yavorsky
9b410be61c Add test for exports destructuring. 2017-03-15 15:37:17 +02:00
Artem Yavorsky
f81d7496b1 Fix exports while destructuring. 2017-03-15 15:35:45 +02:00
Brian Ng
1b5df314d9 Merge pull request #198 from yavorsky/typed-ie
Change built-in-targets according to Typed Array methods
2017-03-14 11:09:34 -05:00
Artem Yavorsky
dde487a0c6 Add typed array methods to built-ins features. 2017-03-14 10:28:25 -05:00
Brian Ng
9f74e10959 Merge pull request #208 from babel/issue207
Refactor browser data parsing to handle families
2017-03-14 09:49:00 -05:00
Brian Ng
8b19c74606 address review comments 2017-03-14 09:16:06 -05:00
Artem Yavorsky
f9f31c2120 Merge pull request #206 from babel/trailing-commas-scripts
Add --check to build-data and skip trailing-commas on scripts/*.js
2017-03-14 11:49:57 +02:00
Brian Ng
9d890f57bb Refactor browser data parsing to handle families 2017-03-14 00:05:17 -05:00
Brian Ng
72b1f38f91 Change trailing commas option on scripts 2017-03-12 12:29:48 -05:00
Brian Ng
22dab1fa95 Check plugin/built-in data on travis 2017-03-12 12:28:25 -05:00
Brian Ng
32ebccd050 Merge pull request #183 from yavorsky/2.0-prettify-long
Prettify.
2017-03-12 11:22:18 -05:00
Artem Yavorsky
f81aef3c22 Add prettier 2017-03-12 11:15:42 -05:00
Brian Ng
ce78265443 Merge pull request #205 from babel/merge-master-2
Merge branch 'master' into 2.0
2017-03-12 10:56:29 -05:00
Brian Ng
1e9cf572a8 Merge branch 'master' into 2.0 2017-03-12 10:48:54 -05:00
Brian Ng
337da3c641 Merge pull request #201 from yavorsky/bump-plugins
Bump plugins
2017-03-10 12:48:25 -06:00
Artem Yavorsky
88cfe1b635 Merge branch 'master' into bump-plugins
# Conflicts:
#	package.json
#	yarn.lock
2017-03-10 20:41:11 +02:00
Brian Ng
f521884d01 Merge branch 'master' into 2.0 2017-03-10 11:35:58 -06:00
Brian Ng
4312ad922b Merge pull request #200 from alxpy/alxpy-patch-1
Enable code coverage
2017-03-10 11:28:04 -06:00
Brian Ng
07e18669af Tweak package scripts and travis config for code coverage 2017-03-10 11:22:03 -06:00
Alex Kuzmenko
1738cb6690 Add babel-plugin-istanbul 2017-03-10 10:43:54 -06:00
Alex Kuzmenko
7d7f06c10e Add codecov badge 2017-03-10 10:43:53 -06:00
Alex Kuzmenko
4cf4ac6cbb Enable code coverage 2017-03-10 10:43:53 -06:00
Artem Yavorsky
ded253f1ad Increase mocha timout to 10s. 2017-03-10 07:08:53 -06:00
Artem Yavorsky
3a9f6e93c4 Update yarn.lock 2017-03-10 14:00:41 +02:00
Artem Yavorsky
5537635175 Fix object-curly-spacing rule. 2017-03-10 14:00:28 +02:00
Artem Yavorsky
37bd909e15 Put duplicate-keys in alphabetical order. 2017-03-10 13:59:56 +02:00
Artem Yavorsky
1584fbe176 Bump packages. 2017-03-10 13:58:56 +02:00
Artem Yavorsky
d6a6ee4045 Merge pull request #199 from bl4ckdu5t/typo-fix
Fixed minor typo in README.
2017-03-10 13:15:14 +02:00
Joseph Rex
fe6a606c58 Changed word were to where in README 2017-03-10 03:44:50 -06:00
Artem Yavorsky
ba2b58e57f Replace preset-es2015 with env (#184) 2017-03-08 11:01:35 -06:00
Artem Yavorsky
84d4b9de5d Add built-ins, better links, compat-table url, etc (#195) [skip ci] 2017-03-08 10:54:16 -05:00
Artem Yavorsky
7dfcba6f16 Merge pull request #194 from babel/doc-relative-path
Change CONTRIBUTING.md to use absolute paths
2017-03-08 12:23:28 +02:00
Aaron Ang
8f0e70bad4 Change CONTRIBUTING.md to use absolute paths
[skip ci]
2017-03-07 20:18:14 -08:00
Artem Yavorsky
970f8ebaf8 Drop whitelist option (#181) 2017-03-06 20:41:55 -06:00
Brian Ng
7348637a1e Fix running tests (#182) 2017-03-06 20:26:42 -06:00
Brian Ng
6c20876fd2 v1.2.1 changelog [skip ci] 2017-03-06 15:00:53 -06:00
Brian Ng
0ede95a640 1.2.1 2017-03-06 14:56:23 -06:00
Brian Ng
cd0c019b24 Add transform-duplicate-keys mapping (#192) 2017-03-06 14:55:34 -06:00
Mike Greiling
6ee5b0c5ac Clarify reasons for the uglify option in README.md (#188) 2017-03-06 14:37:51 -06:00
Artem Yavorsky
349e31b665 Travis: Drop 0.12, 0.10 node. (#185) 2017-03-04 23:10:46 -05:00
Brian Ng
4966544002 v1.2.0 changelog [skip ci] 2017-03-03 17:03:58 -06:00
Brian Ng
a68d98d1a5 1.2.0 2017-03-03 16:50:57 -06:00
Artem Yavorsky
6a2b6fc0e0 Add uglify as a target (#178) 2017-03-03 15:36:54 -06:00
Henry Zhu
7e622940a4 Merge pull request #180 from babel/fix-compat-import
Respect older versions in invert equals map
2017-03-03 15:43:27 -05:00
Daniel Tschinder
7d00281b2b Don’t add duplicate entries to map 2017-03-03 20:48:35 +01:00
Daniel Tschinder
6edae49d4d Version can be float and correctly lookup envMap 2017-03-03 17:27:24 +01:00
Daniel Tschinder
b5af93f348 Update compat-table to include ndoe4 and ios8 fixes 2017-03-03 17:15:26 +01:00
Henry Zhu
ed14b86fe3 2.0.0-alpha.1 2017-03-02 17:10:44 -05:00
Henry Zhu
71e4767014 updates 2017-03-02 17:10:31 -05:00
Daniel Tschinder
c2c96995a1 Add comments 2017-03-02 22:33:03 +01:00
Daniel Tschinder
8d96bd2378 Secure script 2017-03-02 22:29:49 +01:00
Daniel Tschinder
09c84a379f Fix tests 2017-03-02 22:24:46 +01:00
Daniel Tschinder
984df9c96a Fix node 4 2017-03-02 21:58:09 +01:00
Daniel Tschinder
c468d68cb8 Remove console.log 2017-03-02 16:31:39 +01:00
Daniel Tschinder
55ccfbf6a0 Respect older versions in invert map 2017-03-02 16:29:11 +01:00
Brian Ng
540c382637 Add additional note about async support on changelog [skip ci] 2017-03-01 14:39:03 -06:00
Brian Ng
5233afabd9 v1.1.11 changelog [skip ci] 2017-03-01 14:28:51 -06:00
Brian Ng
f6db04d8db 1.1.11 2017-03-01 14:20:44 -06:00
Brian Ng
ecfcb31bf6 Bump compat-table (#177) 2017-03-01 15:10:04 -05:00
Henry Zhu
393746d781 Merge pull request #176 from babel/add-electron-fail
Add test for invalid electron version
2017-02-28 14:27:26 -05:00
Brian Ng
68c2a725c6 add electron version util to normalize-options 2017-02-28 11:38:55 -06:00
Brian Ng
2e0f64256f Use invariant for invalid electron version 2017-02-28 11:38:27 -06:00
Brian Ng
93b8b0735b Add electron version exception test 2017-02-28 11:38:27 -06:00
Artem Yavorsky
1bc8325679 Fix hasBeenWarned condition. (#175) 2017-02-27 10:12:02 -05:00
Artem Yavorsky
2d1768209d Add yarn example. (#174) 2017-02-27 08:46:05 -06:00
Henry Zhu
8e05140280 1.1.10 2017-02-24 15:48:23 -05:00
Brian Ng
1bb8f30b24 Drop use of lodash/intersection from checkDuplicateIncludeExcludes (#173) 2017-02-24 15:47:18 -05:00
Henry Zhu
ab87ff071c Merge pull request #170 from babel/hzoo-patch-1 [skip ci] 2017-02-24 11:53:51 -05:00
Brian Ng
70817b1fe4 add descriptions [skip ci] 2017-02-24 09:12:07 -06:00
Brian Ng
3384e36671 add links 2017-02-24 09:01:56 -06:00
Brian Ng
ea417727dc Merge pull request #171 from babel/travis-shrug
Pin yarn version on travis
2017-02-24 08:52:25 -06:00
Brian Ng
058c86715d Pin yarn version on travis 2017-02-24 08:39:03 -06:00
Henry Zhu
a9c31797dc v1.1.9 changelog [skip ci] 2017-02-24 08:46:51 -05:00
Henry Zhu
fcf1d7a33a 1.1.9 2017-02-24 08:34:59 -05:00
Henry Zhu
4367fba31e update compat (#169) 2017-02-24 08:34:06 -05:00
Brian Ng
1092dde11c Add tests for debug output (#156) 2017-02-24 08:27:43 -05:00
Artem Yavorsky
bc02c95ef0 Fixes #143. Log correct targets. (#155) 2017-01-26 19:53:52 -05:00
Brian Ng
963249fc4b Fix compat-table link in contributing.md 2017-01-26 09:54:48 -06:00
Brian Ng
33b8cc5cbb Update yarn lockfile (#152) 2017-01-23 18:23:04 -05:00
Brian Ng
3e41a2dacb Update README examples to fix website [skip ci] (#151) 2017-01-23 18:22:52 -05:00
Kilian Valkhof
4cefa5bcc0 Use external Electron to Chromium library (#144)
* Replace manual electron-to-chromium list and function with external library

* test fixtures for electron: Switch to electron 1.4, with known chrome version and update expected output

* update tests: electron 1.0 used chrome 49, not 50

* import only the relevant function from electron-to-chromium

* electron fixtures: Use number instead of string

* If both chrome and electron are defined, choose the lower version to preserve

* Add to test cases to verify correct handling of chrome number
2017-01-19 17:41:02 -05:00
Brian Ng
235b1ba264 Merge pull request #146 from babel/typos
Fix few typos
2017-01-18 19:20:40 -06:00
Brian Ng
69870774e7 Fix few typos 2017-01-18 19:12:13 -06:00
Eric Baer
80f93f3d87 Merge pull request #125 from babel/feature/extract-option-validation
Extract option normalization into independant file
2017-01-18 09:18:27 -08:00
Eric Baer
05353d5392 Extract option normalization into independant file 2017-01-18 09:01:06 -08:00
Eric Baer
960ca93b7f Update yarnfile 2017-01-17 09:29:36 -08:00
Kai Cataldo
ad5698ed19 devDeps: eslint-config-babel v5.0.0 (#139) 2017-01-15 22:34:53 -05:00
Brian Ng
da75840794 Merge pull request #138 from yavorsky/debug-example
README: Update `debug: true` example.
2017-01-15 11:46:22 -06:00
Artem Yavorsky
2450f7a5ae Add configuration example to clarify debug: true 2017-01-14 02:57:29 +02:00
Artem Yavorsky
5fe1ee3a6a README: Update debug: true example. 2017-01-13 12:18:24 +02:00
Henry Zhu
28e54d4d5f Update compat-table, build data (#135) 2017-01-11 15:03:10 -05:00
Brian Ng
cb260bff06 Merge pull request #136 from yavorsky/changelog-typo
Fix CHANGELOG’s v1.1.8 updates typo.
2017-01-11 08:01:13 -06:00
Artem Yavorsky
7552cb5b0a Fix CHANGELOG’s v1.1.8 updates typo. 2017-01-11 12:46:35 +02:00
Henry Zhu
6edb5a46a1 1.1.8 2017-01-10 14:34:05 -05:00
Henry Zhu
70bebfae93 update changelog [skip ci] 2017-01-10 14:33:55 -05:00
Brian Ng
fa8f09bc6e Include yarn.lock and update CI (#124) 2017-01-10 12:05:35 -05:00
Artem Yavorsky
74f2fb17a1 Transformations before logs (#128) 2017-01-10 12:03:07 -05:00
Roman Yakobnyuk
e56c318eed remove unnecessary extension (#131) 2017-01-09 17:47:31 -05:00
Henry Zhu
db7e87b219 1.1.7 2017-01-09 11:05:45 -05:00
Henry Zhu
9031ea073c 1.1.6 2017-01-06 17:34:29 -05:00
Henry Zhu
7ef4313141 v1.1.6 changelog [skip ci] 2017-01-06 17:34:23 -05:00
Marco Massarotto
1815ffab14 Explicitly resolve lowest browser version (#121)
stop relying on browserlist returning a list sorted by browser version
fix #119
2017-01-06 17:18:43 -05:00
Henry Zhu
dc46adf519 test actual requires from useBuiltIns (#95)
* test actual requires from useBuiltIns

* only run on npm 3 for now
2017-01-05 10:21:56 -05:00
Henry Zhu
0ac127ce60 v1.1.5 changelog [skip ci] (#118) 2017-01-04 13:00:30 -05:00
Henry Zhu
a9181a218c 1.1.5 2017-01-04 12:44:18 -05:00
Brian Ng
76e12a3cae Show error if target version is not a number (#107) 2017-01-02 23:55:32 -05:00
Henry Zhu
ec99493e53 Merge pull request #109 from yavorsky/debug-targets
Fix targets for debug.
2017-01-02 23:55:05 -05:00
Brian Ng
ad23d2ee39 Drop unneeded eslint-plugin-flow-vars dep (#115) 2017-01-01 22:25:50 -05:00
Artem Yavorsky
1fa3916f75 Use parsed targets for Using targets log. 2016-12-23 13:28:33 +02:00
Artem Yavorsky
63c0931340 Make plugin output single-lined. 2016-12-23 13:22:45 +02:00
Artem Yavorsky
c0b8f5b604 Fix targets for debug. 2016-12-23 01:42:30 +02:00
Henry Zhu
6cb4e8ddcc changelog [skip ci] 2016-12-16 18:07:31 -05:00
Henry Zhu
783a0bdc9c 1.1.4 2016-12-16 18:05:23 -05:00
Henry Zhu
44b140af23 1.1.3 2016-12-16 18:03:33 -05:00
Henry Zhu
da8ed9643b fix debug 2016-12-16 18:03:29 -05:00
Henry Zhu
e3abd80927 1.1.2 2016-12-16 17:27:00 -05:00
Henry Zhu
c6afaa74d4 fix include/exclude for built-ins (#102) 2016-12-16 17:26:15 -05:00
Sven SAULEAU
dabac6ed5f [skip ci] update README (#100) 2016-12-15 13:30:28 -05:00
Henry Zhu
a6cbb76a0b Merge pull request #96 from babel/readme-tweaks
Tweak README
2016-12-14 23:00:26 -05:00
Brian Ng
72f2cc59ed edits 2016-12-14 21:14:19 -06:00
Brian Ng
4760d2ed09 Merge pull request #97 from babel/readme-improvements
Improve README
2016-12-14 20:48:11 -06:00
Diogo Franco
88227f0677 Merge branch 'readme-tweaks' into readme-improvements 2016-12-15 11:39:23 +09:00
Diogo Franco
bf9ff5c4e6 Improve README 2016-12-15 11:17:41 +09:00
Brian Ng
f4788264c5 Tweak README 2016-12-14 19:57:10 -06:00
Henry Zhu
dbcd9f4ad6 v1.1.1 changelog [skip ci] 2016-12-13 18:27:40 -05:00
Henry Zhu
01415d3fd8 1.1.1 2016-12-13 18:11:53 -05:00
Henry Zhu
7e8fbd5177 fix issue with using Object.values 2016-12-13 18:11:45 -05:00
Henry Zhu
c9ff11ccb8 1.1.0 2016-12-13 18:00:47 -05:00
Henry Zhu
206f60767b fixes [skip ci] 2016-12-13 18:00:11 -05:00
Henry Zhu
b5e00eeb5b changelog 1.1.0 [skip ci] (#93) 2016-12-13 17:59:23 -05:00
Henry Zhu
45370e3553 add exclude option, rename whitelist to include (#89) 2016-12-13 16:16:54 -05:00
Brian Ng
0ad9b7a177 Merge pull request #88 from babel/feature/move-erroneous-dependency-to-dev
Move linting dependency to be dev only
2016-12-12 12:03:58 -06:00
Eric Baer
81c157b285 Cleanup lib before rebuilding (#87) 2016-12-12 12:34:27 -05:00
Eric Baer
3ef4001521 Move linting dependency to be dev only 2016-12-12 09:31:45 -08:00
Eric Baer
e379681b58 Update pathnames to aviod uppercase + consistent with other babel projects 2016-12-12 08:59:52 -05:00
Henry Zhu
8622d0af39 lint [skip ci] 2016-12-12 08:57:51 -05:00
Artem Yavorsky
635e76c85a Optimize result filtration. (#77) 2016-12-12 08:48:18 -05:00
Henry Zhu
823facba3f call out useBuiltIns [skip ci] 2016-12-12 08:47:06 -05:00
Eric Baer
9439b7fe1a Refactor build data for clarity/consistency (#81) 2016-12-12 08:11:19 -05:00
Eric Baer
4a27c280ba Update linting rules to cover all js (#82) 2016-12-12 08:02:44 -05:00
Eric Baer
a9d99fd135 Update eslint config to align with other babel projects (#79) 2016-12-12 00:33:18 -05:00
Henry Zhu
51fd3dafd1 add electron, opera to examples [skip ci] 2016-12-11 21:30:27 -05:00
Henry Zhu
69161decd3 add some other projects! [skip ci] 2016-12-11 21:27:49 -05:00
Muhammad Habib Rohman
8346c0db41 Fix typo (#78) [skip ci] 2016-12-11 19:18:07 -05:00
Nazim Hajidin
a98e1a0604 Fix PR link in changelog. (#75) [skip ci] 2016-12-10 16:21:17 -05:00
Henry Zhu
37c1e40e5c update example [skip ci] (#74) 2016-12-10 12:07:07 -05:00
Henry Zhu
b78eb34fa6 v1.0.2 changelog [skip ci] (#73) 2016-12-10 11:40:35 -05:00
Henry Zhu
21dfdd8bbb 1.0.2 2016-12-10 11:34:07 -05:00
Brian Ng
3b60dc5444 Fix issue with Object.getOwnPropertySymbols (#71) 2016-12-10 11:33:22 -05:00
Henry Zhu
9a69fff935 1.0.1 2016-12-10 10:20:22 -05:00
Henry Zhu
f1619e9b16 v1.0.1 changelog (#69) [skip ci] 2016-12-10 10:15:59 -05:00
Henry Zhu
44c40cf7ab fix regenerator import (#68) 2016-12-10 10:11:15 -05:00
Henry Zhu
b8f03ee09d 1.0.0 2016-12-09 15:51:53 -05:00
Henry Zhu
552f587082 changelog (#65) 2016-12-09 15:49:04 -05:00
Henry Zhu
64ed1ba167 add tests for electron option
Closes gh-55
2016-12-09 14:42:26 -05:00
Paul Betts
a38f07181d Map Electron versions to Chromium ones 2016-12-09 14:42:11 -05:00
Henry Zhu
b44949025a Merge pull request #56 from babel/builtins-option
add useBuiltIns option
2016-12-09 11:57:46 -05:00
Henry Zhu
08cd975eb4 always include web polyfills for now 2016-12-09 11:23:46 -05:00
Henry Zhu
d2976bed13 remove console.log, fix tests 2016-12-09 11:23:46 -05:00
Brian Ng
66ab523dd6 Use array features for symbol and array.iterator (#64) 2016-12-09 11:23:46 -05:00
Henry Zhu
d318916416 do not count against if core-js does not implement 2016-12-09 11:23:46 -05:00
Henry Zhu
541ebb5e5f also import regenerator when the transform is required 2016-12-09 11:23:46 -05:00
Henry Zhu
8e2aa82991 also transform 'core-js' 2016-12-09 11:23:46 -05:00
Henry Zhu
5d32ca6bb3 prevent duplicate imports 2016-12-09 11:23:46 -05:00
Henry Zhu
69e9138637 extra tests 2016-12-09 11:23:46 -05:00
Henry Zhu
771e5d2cd6 account for multiple features (#62) 2016-12-09 11:23:46 -05:00
Henry Zhu
bd1ed28242 separate years, add es2016, es2017 2016-12-09 11:23:46 -05:00
Brian Ng
4d40b6ab5b Add builtins for object and es7 string 2016-12-09 11:23:46 -05:00
Artem Yavorsky
99c078e92a Add logs for polyfills. (#59) 2016-12-09 11:23:46 -05:00
Henry Zhu
6ffd13af85 fixes 2016-12-09 11:23:46 -05:00
Henry Zhu
a238bf368a update readme 2016-12-09 11:23:46 -05:00
wtgtybhertgeghgtwtg
7a18a01411 Add .eslintignore and .travis.yml to .npmignore. (#63) [skip ci] 2016-12-08 11:49:29 -05:00
Henry Zhu
066445ca30 add downloads badge [skip ci] 2016-12-05 22:28:28 -05:00
Henry Zhu
d06270498b add some tests 2016-12-02 17:58:31 -05:00
Henry Zhu
3a7a1b9221 add more features 2016-12-02 16:47:38 -05:00
Brian Ng
36c6fcaf23 Add math builtins 2016-12-02 16:04:07 -05:00
Henry Zhu
7afe25bda1 change format 2016-12-02 16:04:02 -05:00
Henry Zhu
c09532f035 plugin transforms the imports/requires 2016-12-02 15:33:27 -05:00
Henry Zhu
6c58d93602 setup the babel plugin to transform the babel-polyfill calls + pass the data option to the plugin from the preset 2016-12-02 13:04:21 -05:00
Henry Zhu
60efc0dd10 add useBuiltIns option 2016-12-02 11:43:36 -05:00
Henry Zhu
457131f219 v0.0.9 changelog [skip ci] 2016-11-24 15:58:09 -05:00
Henry Zhu
bcc2ddbf4e 0.0.9 2016-11-24 15:55:12 -05:00
Henry Zhu
b03180a26c add opera at the end 2016-11-24 15:54:54 -05:00
Sergey Rubanov
56817f8e7c Update data generation for latest compat-table (#50)
* Update data generation for latest compat-table. See https://github.com/kangax/compat-table/pull/964

* fix compat-table version
2016-11-23 23:20:52 -05:00
Henry Zhu
54ce049760 fix headings [skip ci] 2016-11-23 08:09:47 -05:00
Henry Zhu
5739755a48 Add opera (#48) 2016-11-23 07:57:24 -05:00
Henry Zhu
7f93092bdc update description [skip ci] 2016-11-23 07:52:47 -05:00
Vesa Laakso
cf8591543d 💅 Fix CHANGELOG.md nail polish emoji (#47) [skip-ci] 2016-11-17 07:56:57 -05:00
Henry Zhu
38340777d6 0.0.8 changelog [skip ci] 2016-11-16 12:30:44 -05:00
Henry Zhu
713ef4427d 0.0.8 2016-11-16 12:28:14 -05:00
Henry Zhu
1115bec3c3 Only console.log the debug info once (#46) 2016-11-16 12:27:39 -05:00
Henry Zhu
d42c6ea3d2 update rest-spread [skip-ci] 2016-11-16 11:30:05 -05:00
Sergey Rubanov
9ca27436a9 Update data generation for latest compat-table. See https://github.com/kangax/compat-table/pull/960 (#44) 2016-11-14 17:42:44 -05:00
Henry Zhu
ac26f3cdfb Rename ios_saf in browserslist data to ios, ignore unknown browsers (#43)
* Rename ios_saf in browserslist data to ios, ignore unknown browsers

browserslist queries, especially ones with percentages, often bring in mobile browsers that _probably_ have the similar support level as desktop ones, but since there's no support for them in the data, including them here would just lead to all plugins being enabled always.

It's also easy to get crazy things like `op_mini` or `and_uc` in the results.

Browserslist also reports iOS Safari as `ios_saf`, while the data uses `ios`, so it needs to be renamed.

* Fix lint
2016-11-14 15:19:47 -05:00
Diogo Franco
d407ddc00c Fix lint 2016-11-11 01:43:21 +09:00
Diogo Franco
cbd827b9db Rename ios_saf in browserslist data to ios, ignore unknown browsers
browserslist queries, especially ones with percentages, often bring in mobile browsers that _probably_ have the similar support level as desktop ones, but since there's no support for them in the data, including them here would just lead to all plugins being enabled always.

It's also easy to get crazy things like `op_mini` or `and_uc` in the results.

Browserslist also reports iOS Safari as `ios_saf`, while the data uses `ios`, so it needs to be renamed.
2016-11-11 01:32:17 +09:00
Henry Zhu
f8a02a8a9f 0.0.7 2016-11-02 19:00:46 -04:00
Henry Zhu
4019d20945 fixes [skip ci] 2016-11-02 18:21:14 -04:00
Henry Zhu
d8b3447766 add changelog [skip ci] 2016-11-02 18:18:55 -04:00
Henry Zhu
bbeb311aa0 intro example [skip ci] 2016-11-02 18:09:15 -04:00
Henry Zhu
4b08a02b22 fix link [skip ci] 2016-11-02 18:07:53 -04:00
Henry Zhu
fd0821563e toc [skip ci] 2016-11-02 18:04:40 -04:00
Henry Zhu
f6a8d5eff2 doc fixes [skip ci] 2016-11-02 17:44:31 -04:00
Henry Zhu
a5daad4d32 Use compat-table equals option (#36)
* Use compat-table equals option

* fixes
2016-11-02 17:09:32 -04:00
Henry Zhu
d40c684723 hardcode a current node version option (#35) 2016-11-02 16:17:42 -04:00
Henry Zhu
9e97b59a2f fixes [skip ci] 2016-11-02 12:02:23 -04:00
Henry Zhu
414acf5fda Change default behavior to act the same as babel-preset-latest (#33)
* Do not throw on empty options, and default to latest preset

* fix lint
2016-11-02 11:57:26 -04:00
Henry Zhu
aa61aabb82 run lint separately (#32) 2016-11-02 11:09:51 -04:00
Henry Zhu
69e93fdb89 add 'whitelist' option (#31)
Ref https://github.com/babel/babel-preset-env/issues/16
2016-11-02 10:55:45 -04:00
Henry Zhu
85b5141cee add more aliases 2016-11-02 10:16:30 -04:00
Henry Zhu
8356dd18a2 Simple changelog [skip ci] 2016-11-01 19:53:57 -04:00
Henry Zhu
a47341930a Update plugin data: firefox 52 supports async/await! (#29) 2016-11-01 17:57:45 -04:00
Henry Zhu
dcb9e9dd66 Add fixture helper for tests (#28) 2016-11-01 17:46:49 -04:00
Henry Zhu
8af614022c readme on ie [skip ci] 2016-10-20 20:09:56 -04:00
Henry Zhu
520d69b125 contributing a new plugin [skip ci] 2016-10-15 10:12:23 -04:00
Henry Zhu
5ab09c9617 0.0.6 2016-10-12 22:21:26 -04:00
Henry Zhu
d84ea7f478 ignore scripts 2016-10-12 22:21:23 -04:00
Henry Zhu
3604ff24c3 0.0.5 2016-10-12 22:18:02 -04:00
Henry Zhu
63d4aecf89 android/ios 2016-10-12 22:14:13 -04:00
Henry Zhu
a082a73869 add ie 2016-10-12 22:09:53 -04:00
Henry Zhu
3df730b490 cleanup 2016-10-12 22:08:22 -04:00
Henry Zhu
208e0ed4a4 error when no targets option is passed 2016-10-12 22:07:14 -04:00
Henry Zhu
15f05c0e9e back to upstream, update data for new ff 2016-10-12 21:46:43 -04:00
Henry Zhu
da318cd209 fix browserslist docs [skip ci] 2016-10-12 21:41:27 -04:00
Artem Yavorsky
03f6cae25f Adds browsers property to use browserslist's queries (#19)
* Use browserslist to parse browsers from query.

* Update README.

* Use int values.

* Allow `isPluginRequired` use browserslist queries.

* Fix conflicts during different versions merging.

* Add tests for browserslist queries.

* Early return for getTargets.

* Update README: Describe `browsers` option.

* fix doc [skip ci]

* Move to dependencies [skip ci]

* Remove unused const.

* Use doublequotes for strings.
2016-10-12 21:37:50 -04:00
Paul Sanchez
4a3893a49e Add Caveat section to Readme.md (#24) [skip ci]
* Add Caveat section to Readme.md

The Caveat section details some known issues and workaround when targeting specific environments and using specific plugins.

* fixes [skip ci]
2016-10-12 13:33:38 -04:00
Henry Zhu
417a9c8dc3 mention process.versions.node [skip ci] 2016-10-11 09:10:11 -04:00
Henry Zhu
efbeb06c63 explain how it works [skip ci] 2016-10-08 11:20:03 -04:00
Henry Zhu
d11eace18c 0.0.4 2016-10-06 23:55:53 -04:00
Henry Zhu
4903395cbf remove integer error for node, add debug option (#18) 2016-10-06 23:55:37 -04:00
Henry Zhu
d11c2af388 0.0.3 2016-10-06 23:09:57 -04:00
Henry Zhu
d221bfba91 Temp rm experimental (#17)
* Temporarily remove experimental plugins since not used

* readme
2016-10-06 23:05:34 -04:00
Henry Zhu
a665d4a5ae update node data, fix version issues (#13) 2016-10-06 22:33:03 -04:00
Henry Zhu
46a4d9c22d readme [skip ci] 2016-10-06 18:11:18 -04:00
Henry Zhu
fb60b88601 update readme [skip ci] 2016-10-06 18:10:46 -04:00
Henry Zhu
6b9404ab52 fixes, run build script in node 0.10 with babel-node (#12)
* fixes, run build script in node 0.10 with babel-node

* try node
2016-10-06 17:08:13 -04:00
Ville Immonen
77a6d686ba Build the browser data from ES compatibility table (#8)
Use the data from https://github.com/kangax/compat-table to build the
browser data.

Each Babel plugin is mapped to a list of features in the compatibility
table (in `data/pluginFeatures.js`), and the minimum supporting
version looked up from the compatibility test data. The script builds
the final browser data file in `data/plugins.json`.
2016-10-06 14:23:01 -04:00
Rubens Mariuzzo
655ae2cada Syntax highlighting added (where missing) (#11) [skip ci] 2016-10-06 10:35:12 -04:00
Henry Zhu
1bf315d388 0.0.2 2016-09-30 17:41:26 -04:00
Henry Zhu
b4acfc31d9 Fix: export default 2016-09-30 17:41:22 -04:00
Henry Zhu
7f24f0966b 0.0.1 2016-09-13 17:06:51 -04:00
Henry Zhu
e2a4738020 add badges [skip ci] 2016-09-06 09:10:38 -04:00
Henry Zhu
989211b914 add example [skip ci] 2016-09-06 00:11:46 -04:00
Henry Zhu
143e2d3cbf update [skip ci] 2016-09-05 23:52:15 -04:00
Henry Zhu
1d1efe3205 typo [skip ci] 2016-09-05 23:45:44 -04:00
Henry Zhu
4997e184d5 fixes [skip ci] 2016-09-05 23:45:21 -04:00
Henry Zhu
ba5aa48b0c update readme [skip ci] 2016-09-05 23:43:23 -04:00
Henry Zhu
2c97212fd4 modules/loose opts from es2015 preset, add travis (#6)
* modules/loose opts from es2015 preset, add travis

* Update .travis.yml

* fix plugin function [skip ci]
2016-09-05 23:39:50 -04:00
Eric Baer
78c21a282a Implement very basic (but working) functionality (#3)
* Implement very basic (but working) functionality

* Correct PR based on feedback
2016-09-01 11:55:50 -04:00
Eric Baer
d32e7413ab Warm people in the README that this is a wip project (#2) 2016-08-31 14:13:00 -04:00
Henry Zhu
dbe48b5157 init data (#1) 2016-08-30 17:56:04 -04:00
Henry Zhu
d034c24b8e Initial commit 2016-08-13 23:48:33 -04:00
4545 changed files with 48850 additions and 24767 deletions

View File

@@ -1,3 +1,4 @@
# Ensure babel-register won't compile fixtures, or try to recompile compiled code.
packages/*/test/fixtures
packages/*/lib
packages/babel-standalone/babel.js

View File

@@ -1,5 +1,35 @@
"use strict";
// Blame Logan for this.
// This works around https://github.com/istanbuljs/istanbuljs/issues/92 until
// we have a version of Istanbul that actually works with 7.x.
function istanbulHacks() {
return {
inherits: require("babel-plugin-istanbul").default,
visitor: {
Program: {
exit: function(path) {
if (!this.__dv__) return
const node = path.node.body[0];
if (
node.type !== "VariableDeclaration" ||
node.declarations[0].id.type !== "Identifier" ||
!node.declarations[0].id.name.match(/cov_/) ||
node._blockHoist !== 3
) {
throw new Error("Something has gone wrong in Logan's hacks.");
}
// Gross hacks to put the code coverage block above all compiled
// import statement output.
node._blockHoist = 5;
},
},
},
};
}
let envOpts = {
loose: true
};
@@ -7,23 +37,21 @@ let envOpts = {
module.exports = {
comments: false,
presets: [
[
"env", envOpts
],
["env", envOpts],
"stage-0",
"flow",
"flow"
],
env: {
cov: {
auxiliaryCommentBefore: "istanbul ignore next",
plugins: ["istanbul"]
plugins: [istanbulHacks]
}
}
};
if (process.env.BABEL_ENV === 'development') {
if (process.env.BABEL_ENV === "development") {
envOpts.targets = {
node: "current"
};
envOpts.debug = true;
};
}

View File

@@ -7,3 +7,20 @@ packages/*/lib
packages/*/dist
packages/*/test/fixtures
packages/*/test/tmp
codemods/*/node_modules
codemods/*/lib
codemods/*/dist
codemods/*/test/fixtures
codemods/*/test/tmp
experimental/*/lib
experimental/*/node_modules
experimental/*/test/fixtures
experimental/*/test/tmp
experimental/babel-preset-env/data
experimental/babel-preset-env/test/debug-fixtures
packages/babel-standalone/babel.js
packages/babel-standalone/babel.min.js
# Prettier tries to insert trailing commas in function calls, which Node.js
# doesn't natively support. This causes an error when loading the Gulp tasks.
packages/babel-standalone/src/gulpTasks.js

View File

@@ -1,10 +1,16 @@
[ignore]
.*/packages/.*/lib
.*/packages/.*/test
.*/codemods/.*/lib
.*/codemods/.*/test
.*/experimental/.*/lib
.*/experimental/.*/test
.*/node_modules/conventional-changelog-core/
[include]
packages/*/src
codemods/*/src
experimental/*/src
[libs]
lib/file.js
@@ -13,6 +19,7 @@ lib/types.js
lib/third-party-libs.js.flow
[options]
strip_root=true
suppress_comment= \\(.\\|\n\\)*\\$FlowFixMe
suppress_comment= \\(.\\|\n\\)*\\$FlowIssue
esproposal.export_star_as=enable
module.name_mapper='^@babel\/\([a-zA-Z0-9_\-]+\)$' -> '<PROJECT_ROOT>/packages/babel-\1/src/index'

View File

@@ -2,20 +2,17 @@
Before making a PR please make sure to read our contributing guidelines
https://github.com/babel/babel/blob/master/CONTRIBUTING.md
For any issue references: Add a comma-separated list of a [closing word](https://help.github.com/articles/closing-issues-via-commit-messages/) followed by the ticket number fixed by the PR
For issue references: Add a comma-separated list of a [closing word](https://help.github.com/articles/closing-issues-via-commit-messages/) followed by the ticket number fixed by the PR. It should be underlined in the preview if done correctly.
-->
| Q | A <!--(yes/no) -->
| Q                       | A <!--(Can use an emoji 👍) -->
| ------------------------ | ---
| Fixed Issues? | `Fixes #1, Fixes #2` <!-- remove the (`) quotes to link the issues -->
| Patch: Bug Fix? |
| Major: Breaking Change? |
| Minor: New Feature? |
| Deprecations? |
| Spec Compliancy? |
| Tests Added/Pass? |
| Fixed Tickets | `Fixes #1, Fixes #2` <!-- rm the quotes to link the issues -->
| License | MIT
| Doc PR | <!-- if yes, add `[skip ci]` to your commit message to skip CI builds -->
| Dependency Changes |
| Tests Added + Pass? | Yes
| Documentation PR | <!-- If so, add `[skip ci]` to your commit message to skip CI -->
| Any Dependency Changes? |
<!-- Describe your changes below in as much detail as possible -->

9
.gitignore vendored
View File

@@ -15,14 +15,23 @@ package-lock.json
!/packages/babel-runtime/core-js/map.js
/packages/babel-runtime/helpers/*.js
!/packages/babel-runtime/helpers/toArray.js
!/packages/babel-runtime/helpers/temporalRef.js
/packages/babel-runtime/helpers/builtin/*.js
!/packages/babel-runtime/helpers/builtin/toArray.js
!/packages/babel-runtime/helpers/builtin/temporalRef.js
/packages/babel-runtime/helpers/builtin/es6/*.js
!/packages/babel-runtime/helpers/builtin/es6/toArray.js
!/packages/babel-runtime/helpers/builtin/es6/temporalRef.js
/packages/babel-runtime/helpers/es6/*.js
!/packages/babel-runtime/helpers/es6/toArray.js
!/packages/babel-runtime/helpers/es6/temporalRef.js
/packages/babel-register/test/.babel
/packages/babel-cli/test/tmp
/packages/babel-node/test/tmp
/packages/*/lib
.nyc_output
/babel.sublime-workspace
packages/babel-standalone/babel.js
packages/babel-standalone/babel.min.js
/codemods/*/lib
/codemods/*/node_modules

View File

@@ -1,12 +0,0 @@
{
"userBlacklist": [
"amasad",
"greenkeeperio-bot",
"jmm",
"kittens",
"thejameskyle"
],
"fileBlacklist": ["*.md"],
"skipAlreadyAssignedPR": true,
"createReviewRequest": true
}

View File

@@ -12,7 +12,12 @@ node_js:
- '4'
env:
- JOB=test
global:
- PATH=$HOME/.yarn/bin:$PATH
- JOB=test
before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash
script:
- 'if [ "$JOB" = "test" ]; then make test-ci; fi'
@@ -33,3 +38,7 @@ notifications:
# travis encrypt "babeljs:<token>#activity" --add notifications.slack.rooms
# where <token> is from the Slack integration settings.
secure: SrwPKRe2AiNAKRo/+2yW/x4zxbWf2FBXuBuuPkdTJVTpWe++Jin1lXYJWTKP1a1i/IbmhffBO9YZcUFbeuXJpRM083vO8VYpyuBMQRqWD+Z3o+ttPlHGOJgnj0nkIcGRk6k7PpyHNnIkixfEJDvbbg9lN1Jswb3xkL8iYIHpuFE=
branches:
except:
- /^v\d+\.\d+\.\d+$/

View File

@@ -11,7 +11,94 @@
_Note: Gaps between patch versions are faulty, broken or test releases._
See [CHANGELOG - 6to5](CHANGELOG-6to5.md) for the pre-4.0.0 version changelog.
See [CHANGELOG - 6to5](/.github/CHANGELOG-6to5.md) for the pre-4.0.0 version changelog.
## 6.26.0 (2017-08-16)
> Backports for some folks (also other's when we accidently merged PRs from both 6.x/master)
> Lesson learned: just use `master` and backport on another branch.
#### :eyeglasses: Spec Compliancy
* `babel-core`, `babel-generator`, `babel-plugin-transform-flow-comments`, `babel-plugin-transform-flow-strip-types`, `babel-traverse`, `babel-types`
* [#6081](https://github.com/babel/babel/pull/6081) Flow opaque type 6.x backport. ([@jbrown215](https://github.com/jbrown215))
#### :rocket: New Feature
* `babel-cli`
* [#5796](https://github.com/babel/babel/pull/5796) Allow --inspect-brk option to be used with babel-node [6.x backport]. ([@noinkling](https://github.com/noinkling))
#### :bug: Bug Fix
* `babel-plugin-transform-es2015-modules-commonjs`
* [#5811](https://github.com/babel/babel/pull/5811) Fix 5768. ([@joshwnj](https://github.com/joshwnj))
* [#5469](https://github.com/babel/babel/pull/5469) Fix commonjs exports with destructuring.. ([@yavorsky](https://github.com/yavorsky))
* `babel-types`
* [#5693](https://github.com/babel/babel/pull/5693) Hoist toSequenceExpression's convert helper. ([@jridgewell](https://github.com/jridgewell))
#### :memo: Documentation
* `babel-plugin-transform-class-properties`
* [#6005](https://github.com/babel/babel/pull/6005) FIX access to the prototype of an instance. ([@shuaibird](https://github.com/shuaibird))
* `babel-plugin-transform-runtime`
* [#5857](https://github.com/babel/babel/pull/5857) Fix typos in README.md. ([@danny-andrews](https://github.com/danny-andrews))
* `babel-plugin-transform-regenerator`
* [#5852](https://github.com/babel/babel/pull/5852) Fix babel-plugin-transform-regenerator README. ([@k15a](https://github.com/k15a))
* Other
* [#5788](https://github.com/babel/babel/pull/5788) Add a section on troubleshooting [skip ci]. ([@peey](https://github.com/peey))
* [#5755](https://github.com/babel/babel/pull/5755) Fix broken tables in README.md. ([@u9lyfish](https://github.com/u9lyfish))
* `babel-generator`, `babel-plugin-transform-es2015-arrow-functions`, `babel-plugin-transform-es2015-modules-commonjs`, `babel-plugin-transform-es2015-spread`, `babel-plugin-transform-runtime`, `babel-register`
* [#5613](https://github.com/babel/babel/pull/5613) Backport doc changes. ([@xtuc](https://github.com/xtuc))
#### :house: Internal
* `babel-traverse`
* [#5965](https://github.com/babel/babel/pull/5965) Remove unused functions from renamer.js.. ([@mcav](https://github.com/mcav))
* [#5363](https://github.com/babel/babel/pull/5363) Increase the code coverage for traverse evaluation. ([@ssuman](https://github.com/ssuman))
* Other
* [#5938](https://github.com/babel/babel/pull/5938) Remove codecov node package and use bash uploader. ([@existentialism](https://github.com/existentialism))
#### Committers: 19
- Artem Yavorsky ([yavorsky](https://github.com/yavorsky))
- Brian Ng ([existentialism](https://github.com/existentialism))
- Danny Andrews ([danny-andrews](https://github.com/danny-andrews))
- Henry Zhu ([hzoo](https://github.com/hzoo))
- Jeffrey Wear ([wearhere](https://github.com/wearhere))
- Jordan Brown ([jbrown215](https://github.com/jbrown215))
- Josh Johnston ([joshwnj](https://github.com/joshwnj))
- Justin Ridgewell ([jridgewell](https://github.com/jridgewell))
- Konstantin Pschera ([k15a](https://github.com/k15a))
- Malcolm ([noinkling](https://github.com/noinkling))
- Marcus Cavanaugh ([mcav](https://github.com/mcav))
- Peeyush Kushwaha ([peey](https://github.com/peey))
- Philipp Friedenberger ([MrSpider](https://github.com/MrSpider))
- Samuel Reed ([STRML](https://github.com/STRML))
- Shuaibird Hwang ([shuaibird](https://github.com/shuaibird))
- Suman ([ssuman](https://github.com/ssuman))
- Sven SAULEAU ([xtuc](https://github.com/xtuc))
- jonathan schatz ([modosc](https://github.com/modosc))
- u9lyfish@gmail.com ([u9lyfish](https://github.com/u9lyfish))
## 6.25.0 (2017-06-08)
Just backporting a few things.
#### :rocket: New Feature
* `babel-plugin-transform-react-display-name`
* [#5780](https://github.com/babel/babel/pull/5780) Backport support for createReactClass with transform-react-display-name. ([@kentor](https://github.com/kentor))
* [#5554](https://github.com/babel/babel/pull/5554) Updated transform-react-display-name for createReactClass addon. ([@bvaughn](https://github.com/bvaughn))
* `babel-generator`, `babel-plugin-transform-flow-strip-types`, `babel-types`
* [#5653](https://github.com/babel/babel/pull/5653) Port flow object spread from #418 to 6.x. ([@kittens](https://github.com/kittens))
#### :bug: Bug Fix
* `babel-types`
* [#5770](https://github.com/babel/babel/pull/5770) Backport array & object pattern fixes to 6.x. ([@citycide](https://github.com/citycide))
#### :nail_care: Polish
* `babel-traverse`
* [#5615](https://github.com/babel/babel/pull/5615) Update deprecation warning on flow bindings. ([@kassens](https://github.com/kassens))
#### Committers: 5
- Bo Lingen ([citycide](https://github.com/citycide))
- Brian Vaughn ([bvaughn](https://github.com/bvaughn))
- Jan Kassens ([kassens](https://github.com/kassens))
- Kenneth Chung ([kentor](https://github.com/kentor))
- Sebastian McKenzie ([kittens](https://github.com/kittens))
## 6.24.0 (2017-03-13)
@@ -263,7 +350,7 @@ New/Expected Behavior
```js
const _ref = foo(); // should only be called once
const { x } = _ref;
const { x } = _ref;
const y = _objectWithoutProperties(_ref, ["x"]);
```
@@ -279,7 +366,7 @@ function fn({a = 1, ...b} = {}) {
return {a, b};
}
```
* `babel-plugin-transform-es2015-destructuring`
* [#5093](https://github.com/babel/babel/pull/5093) Ensure array is always copied during destructure. ([@existentialism](https://github.com/existentialism))
@@ -293,7 +380,7 @@ const arr = [1, 2, 3]
assign(arr, 1, 42)
console.log(arr) // [1, 2, 3]
```
* `babel-plugin-transform-es2015-function-name`
* [#5008](https://github.com/babel/babel/pull/5008) Don't try to visit ArrowFunctionExpression, they cannot be named. ([@Kovensky](https://github.com/Kovensky))
@@ -308,9 +395,9 @@ Output
```js
export const x = ({ x }) => x;
export const y = function y() {};
export const y = function y() {};
```
* `babel-types`
* [#5068](https://github.com/babel/babel/pull/5068) Fix getBindingIdentifiers in babel-types. ([@rtsao](https://github.com/rtsao))
* `babel-cli`
@@ -460,7 +547,7 @@ Will still error with `Spread children are not supported.`
```js
<div>{...this.props.children}</div>;
```
* `babel-plugin-transform-es2015-block-scoping`, `babel-plugin-transform-react-constant-elements`, `babel-traverse`
* [#4940](https://github.com/babel/babel/pull/4940) Fix React constant element bugs. ([@appden](https://github.com/appden))
@@ -469,7 +556,7 @@ When multiple declarators are present in a declaration, we want to insert the co
```js
function render() {
const bar = "bar", renderFoo = () => <foo bar={bar} baz={baz} />, baz = "baz";
return renderFoo();
}
```
@@ -480,12 +567,12 @@ When block scoped variables caused the block to be wrapped in a closure, the var
function render(flag) {
if (flag) {
let bar = "bar";
[].map(() => bar);
return <foo bar={bar} />;
}
return null;
}
```
@@ -526,7 +613,7 @@ for (let a of b) {
* [#4999](https://github.com/babel/babel/pull/4999) babel-helper-transform-fixture-test-runner: pass require as a global. ([@hzoo](https://github.com/hzoo))
Allows running `require()` in exec.js tests like for [babel/babel-preset-env#95](https://github.com/babel/babel-preset-env/pull/95)
* Other
* [#5005](https://github.com/babel/babel/pull/5005) internal: don't run watch with the test env (skip building with code …. ([@hzoo](https://github.com/hzoo))
@@ -648,8 +735,8 @@ try {
return x;
};
}
```
```
* `babel-helper-remap-async-to-generator`, `babel-plugin-transform-async-generator-functions`, `babel-plugin-transform-async-to-generator`
* [#4901](https://github.com/babel/babel/pull/4901) Only base async fn arity on non-default/non-rest params - Closes [#4891](https://github.com/babel/babel/issues/4891). ([@loganfsmyth](https://github.com/loganfsmyth))
@@ -660,7 +747,7 @@ console.log(foo.length) // 0
const asyncFoo = async (...args) => { }
console.log(asyncFoo.length) // 0
```
* `babel-generator`, `babel-types`
* [#4945](https://github.com/babel/babel/pull/4945) Add `babel-generator` support for `Import`. ([@TheLarkInn](https://github.com/TheLarkInn))
@@ -669,14 +756,14 @@ console.log(asyncFoo.length) // 0
```js
import("module.js");
```
* `babel-plugin-transform-object-rest-spread`
* [#4883](https://github.com/babel/babel/pull/4883) Fix for object-rest with parameters destructuring nested rest. ([@christophehurpeau](https://github.com/christophehurpeau))
```js
function a5({a3, b2: { ba1, ...ba2 }, ...c3}) {}
```
```
* `babel-traverse`
* [#4875](https://github.com/babel/babel/pull/4875) Fix `path.evaluate` for references before declarations. ([@boopathi](https://github.com/boopathi))
@@ -981,7 +1068,7 @@ function render(_ref) {
- Scott Stern ([sstern6](https://github.com/sstern6))
- Shine Wang ([shinew](https://github.com/shinew))
- lion ([lion-man44](https://github.com/lion-man44))
## v6.18.2 (2016-11-01)
Weird publishing issue with v6.18.1, same release.
@@ -1666,7 +1753,7 @@ export default {
#### :bug: Bug Fix
* `babel-helpers`, `babel-plugin-transform-es2015-typeof-symbol`
* [#3686](https://github.com/babel/babel/pull/3686) Fix `typeof Symbol.prototype`. ([@brainlock](https://github.com/brainlock))
```js
// `typeof Symbol.prototype` should be 'object'
typeof Symbol.prototype === 'object'
@@ -1675,7 +1762,7 @@ typeof Symbol.prototype === 'object'
* `babel-cli`
* [#3456](https://github.com/babel/babel/pull/3456) Use the real sourcemap API and handle input sourcemaps - Fixes [#7259](https://github.com/babel/babel/issues/7259). ([@loganfsmyth](https://github.com/loganfsmyth))
* [#4507](https://github.com/babel/babel/pull/4507) Only set options in cli if different from default. ([@danez](https://github.com/danez))
Fix an issue with defaults not being overidden. This was causing options like `comments: false` not to work correctly.
* [#4508](https://github.com/babel/babel/pull/4508) Support custom ports for V8 --inspect. ([@andykant](https://github.com/andykant))
@@ -1730,7 +1817,7 @@ We noticed that we can not make this optimizations if there are function calls o
// was tranforming to
x = a();
y = obj.x;
// now transforms to
// now transforms to
var _ref = [a(), obj.x];
x = _ref[0];
y = _ref[1];
@@ -1796,7 +1883,7 @@ Cleanup tests, remove various unused dependencies, do not run CI with only readm
#### Commiters: 20
First PRs!
- Alberto Piai ([brainlock](https://github.com/brainlock))
- Alberto Piai ([brainlock](https://github.com/brainlock))
- Andy Kant ([andykant](https://github.com/andykant))
- Basil Hosmer ([bhosmer](https://github.com/bhosmer))
- Bo Borgerson ([gigabo](https://github.com/gigabo))
@@ -1879,7 +1966,7 @@ npm install babel-preset-latest --save-dev
{ "presets": [
["latest", {
"es2015": {
"modules": false
"modules": false
}
}]
] }
@@ -2117,7 +2204,7 @@ Can be `false` to not transform modules, or one of `["amd", "umd", "systemjs", "
## v6.11.5 (2016-07-23)
Thanks to Rob Eisenberg ([EisenbergEffect](https://github.com/EisenbergEffect)), Keyan Zhang ([keyanzhang](https://github.com/keyanzhang)), Rolf Timmermans ([rolftimmermans](https://github.com/rolftimmermans)), Thomas Grainger ([graingert](https://github.com/graingert)),
Thanks to Rob Eisenberg ([EisenbergEffect](https://github.com/EisenbergEffect)), Keyan Zhang ([keyanzhang](https://github.com/keyanzhang)), Rolf Timmermans ([rolftimmermans](https://github.com/rolftimmermans)), Thomas Grainger ([graingert](https://github.com/graingert)),
we have few fixes: fix `babel-register` file paths on error, infer class name for classes with class properties, fix `export *` to account for previously compiled modules.
@@ -2165,7 +2252,7 @@ In this release among other things are some more optimizations for babel-generat
## v6.11.3 (2016-07-13)
The main fix is @loganfsmyth's changes of some parts in babel-generator in [#3565](https://github.com/babel/babel/pull/3565) to fix issues with exponential code generation times in certain cases.
The main fix is @loganfsmyth's changes of some parts in babel-generator in [#3565](https://github.com/babel/babel/pull/3565) to fix issues with exponential code generation times in certain cases.
Items: the size of the array being generated
Time: The time in ms to generate the code

View File

@@ -1,5 +1,3 @@
# NOTE: DO NOT OPEN ISSUES FOR QUESTIONS AND SUPPORT. SEE THE README FOR MORE INFO.
----
<p align="center" class="toc">
@@ -30,7 +28,9 @@ Contributions are always welcome, no matter how large or small.
- Check out [`/doc`](https://github.com/babel/babel/tree/master/doc) for information about Babel's internals
- Check out [the Babel Plugin Handbook](https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#babel-plugin-handbook) - core plugins are written the same way as any other plugin!
- Check out [AST Explorer](http://astexplorer.net/#/scUfOmVOG5) to learn more about ASTs or make your own plugin in the browser
- When you feel ready to jump into the Babel source code, a good place to start is to look for issues tagged with [help-wanted](https://github.com/babel/babel/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) and/or [beginner-friendly](https://github.com/babel/babel/issues?q=is%3Aissue+is%3Aopen+label%3A%22beginner-friendly%22).
- When you feel ready to jump into the Babel source code, a good place to start is to look for issues tagged with [help wanted](https://github.com/babel/babel/labels/help%20wanted) and/or [good first issue](https://github.com/babel/babel/labels/good%20first%20issue).
- Follow along with what we are working on by joining our Slack, following our announcements on [Twitter](https://twitter.com/babeljs), and reading (or participating!) in our [meeting notes](https://github.com/babel/notes).
- Check out our [website](http://babeljs.io/) and the [repo](https://github.com/babel/website)
## Chat
@@ -40,11 +40,9 @@ Feel free to check out the `#discussion`/`#development` channels on our [Slack](
**Note:** Versions `< 5.1.10` can't be built.
Babel is built for Node.js 4 and up but we develop using Node.js 6. Make sure you are on npm 3.
Babel is built for Node 4 and up but we develop using Node 8 and yarn. You can check this with `node -v`.
You can check this with `node -v` and `npm -v`.
In addition, make sure that Yarn is installed.
Make sure that Yarn is installed with version >= `0.28.0`.
Installation instructions can be found here: https://yarnpkg.com/en/docs/install.
### Setup
@@ -114,12 +112,25 @@ To run tests for a specific package in [packages](https://github.com/babel/babel
$ TEST_ONLY=babel-cli make test
```
`TEST_ONLY` will also match substrings of the package name:
```sh
# Run tests for the babel-plugin-transform-classes package.
$ TEST_ONLY=es2015-class make test
```
Use the `TEST_GREP` variable to run a subset of tests by name:
```sh
$ TEST_GREP=transformation make test
```
Substitute spaces for hyphens and forward slashes when targeting specific test names:
```sh
$ TEST_GREP="arrow functions destructuring parameters" make test
```
To enable the Node.js debugger added in v6.3.0, set the `TEST_DEBUG` environment variable:
```sh
@@ -138,15 +149,15 @@ $ ./scripts/test-cov.sh
#### Troubleshooting Tests
In case you're not able to reproduce an error on CI locally, it may be due to
In case you're not able to reproduce an error on CI locally, it may be due to
- Node Version: Travis CI runs the tests against all major node versions. If your tests use JavaScript features unsupported by lower versions of node, then use [minNodeVersion option](#writing-tests) in options.json.
- Timeout: Check the CI log and if the only errors are timeout errors and you are sure that it's not related to the changes you made, ask someone in the slack channel to trigger rebuild on the CI build and it might be resolved
In case you're locally getting errors which are not on the CI, it may be due to
- Updates in Dependencies: Make sure you run `make bootstrap` before you run `make build` or `make watch` before you run the tests.
### Writing tests
Most packages in [`/packages`](https://github.com/babel/babel/tree/master/packages) have a `test` folder, however some tests might be in other packages or in [`/packages/babel-core`](https://github.com/babel/babel/tree/master/packages/babel-core/test/fixtures).
@@ -160,7 +171,7 @@ For example, in [`babel-plugin-transform-exponentiation-operator/test`](https://
- There is an `index.js` file. It imports our [test helper](https://github.com/babel/babel/tree/master/packages/babel-helper-plugin-test-runner). (You don't have to worry about this).
- There can be multiple folders under [`/fixtures`](https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-exponentiation-operator/test/fixtures)
- There is an [`options.json`](https://github.com/babel/babel/blob/master/packages/babel-plugin-transform-exponentiation-operator/test/fixtures/exponentian-operator/options.json) file whose function is similar to a `.babelrc` file, allowing you to pass in the plugins and settings you need for your tests.
- For this test, we only need the relevant plugin, so it's just `{ "plugins": ["transform-exponentiation-operator"] }`.
- For this test, we only need the relevant plugin, so it's just `{ "plugins": ["@babel/transform-exponentiation-operator"] }`.
- If necessary, you can have an `options.json` with different options in each subfolder.
- In each subfolder, you can organize your directory structure by categories of tests. (Example: these folders can be named after the feature you are testing or can reference the issue number they fix)
@@ -195,8 +206,8 @@ If you need to check for an error that is thrown you can add to the `options.jso
```js
// options.json example
{
"plugins": [["transform-object-rest-spread", { "useBuiltIns": "invalidOption" }]],
"throws": "transform-object-rest-spread currently only accepts a boolean option for useBuiltIns (defaults to false)"
"plugins": [["@babel/proposal-object-rest-spread", { "useBuiltIns": "invalidOption" }]],
"throws": "@babel/proposal-object-rest-spread currently only accepts a boolean option for useBuiltIns (defaults to false)"
}
```
@@ -261,7 +272,7 @@ To start the debugging in Chrome DevTools, open the given URL.
The debugger starts at the first executed line of code, which is Mocha's first line by default.
Click _Resume script execution_ <img src="https://i.imgur.com/TmYBn9d.png" alt="Resume script execution button." width="16"> to jump to the set breakpoint.
Note that the code shown in Chrome DevTools is compiled code and therefore differs.
## Internals
- AST spec ([babylon/ast/spec.md](https://github.com/babel/babylon/blob/master/ast/spec.md))
- Versioning ([doc/design/versioning.md](https://github.com/babel/babel/blob/master/doc/design/versioning.md)

View File

@@ -3,15 +3,22 @@
const plumber = require("gulp-plumber");
const through = require("through2");
const chalk = require("chalk");
const pump = require("pump");
const uglify = require("gulp-uglify");
const rename = require("gulp-rename");
const newer = require("gulp-newer");
const babel = require("gulp-babel");
const watch = require("gulp-watch");
const gutil = require("gulp-util");
const gulp = require("gulp");
const path = require("path");
const merge = require("merge-stream");
const RootMostResolvePlugin = require("webpack-dependency-suite")
.RootMostResolvePlugin;
const webpack = require("webpack");
const webpackStream = require("webpack-stream");
const base = path.join(__dirname, "packages");
const scripts = "./packages/*/src/**/*.js";
const sources = ["codemods", "packages", "experimental"];
function swapSrcWithLib(srcPath) {
const parts = srcPath.split(path.sep);
@@ -19,43 +26,147 @@ function swapSrcWithLib(srcPath) {
return parts.join(path.sep);
}
function getGlobFromSource(source) {
return `./${source}/*/src/**/*.js`;
}
gulp.task("default", ["build"]);
gulp.task("build", function() {
return gulp
.src(scripts, { base: base })
.pipe(
plumber({
errorHandler: function(err) {
gutil.log(err.stack);
},
})
)
.pipe(
newer({
dest: base,
map: swapSrcWithLib,
})
)
.pipe(
through.obj(function(file, enc, callback) {
gutil.log("Compiling", "'" + chalk.cyan(file.relative) + "'...");
callback(null, file);
})
)
.pipe(babel())
.pipe(
through.obj(function(file, enc, callback) {
// Passing 'file.relative' because newer() above uses a relative path and this keeps it consistent.
file.path = path.resolve(file.base, swapSrcWithLib(file.relative));
callback(null, file);
})
)
.pipe(gulp.dest(base));
return merge(
sources.map(source => {
const base = path.join(__dirname, source);
return gulp
.src(getGlobFromSource(source), { base: base })
.pipe(
plumber({
errorHandler: function(err) {
gutil.log(err.stack);
},
})
)
.pipe(
newer({
dest: base,
map: swapSrcWithLib,
})
)
.pipe(
through.obj(function(file, enc, callback) {
gutil.log("Compiling", "'" + chalk.cyan(file.relative) + "'...");
callback(null, file);
})
)
.pipe(babel())
.pipe(
through.obj(function(file, enc, callback) {
// Passing 'file.relative' because newer() above uses a relative
// path and this keeps it consistent.
file.path = path.resolve(file.base, swapSrcWithLib(file.relative));
callback(null, file);
})
)
.pipe(gulp.dest(base));
})
);
});
gulp.task("watch", ["build"], function() {
watch(scripts, { debounceDelay: 200 }, function() {
watch(sources.map(getGlobFromSource), { debounceDelay: 200 }, function() {
gulp.start("build");
});
});
gulp.task("build-babel-standalone", cb => {
pump(
[
gulp.src(__dirname + "/packages/babel-standalone/src/index.js"),
webpackBuild(),
gulp.dest(__dirname + "/packages/babel-standalone"),
uglify(),
rename({ extname: ".min.js" }),
gulp.dest(__dirname + "/packages/babel-standalone"),
],
cb
);
});
function webpackBuild() {
let version = require("./packages/babel-core/package.json").version;
// If this build is part of a pull request, include the pull request number in
// the version number.
if (process.env.CIRCLE_PR_NUMBER) {
version += "+pr." + process.env.CIRCLE_PR_NUMBER;
}
const config = {
module: {
rules: [
{
test: /\.js$/,
include: /node_modules/,
loader: "babel-loader",
options: {
// Some of the node_modules may have their own "babel" section in
// their project.json (or a ".babelrc" file). We need to ignore
// those as we're using our own Babel options.
babelrc: false,
presets: ["env"],
},
},
{
test: /\.js$/,
exclude: /node_modules/,
loader: "babel-loader",
options: {
// Some of the node_modules may have their own "babel" section in
// their project.json (or a ".babelrc" file). We need to ignore
// those as we're using our own Babel options.
babelrc: false,
presets: ["env", "stage-0"],
},
},
],
},
node: {
// Mock Node.js modules that Babel require()s but that we don't
// particularly care about.
fs: "empty",
module: "empty",
net: "empty",
},
output: {
filename: "babel.js",
library: "Babel",
libraryTarget: "umd",
},
plugins: [
new webpack.DefinePlugin({
"process.env.NODE_ENV": '"production"',
BABEL_VERSION: JSON.stringify(version),
VERSION: JSON.stringify(version),
}),
/*new webpack.NormalModuleReplacementPlugin(
/..\/..\/package/,
"../../../../src/babel-package-shim"
),*/
new webpack.optimize.ModuleConcatenationPlugin(),
],
resolve: {
plugins: [
// Dedupe packages that are used across multiple plugins.
// This replaces DedupePlugin from Webpack 1.x
new RootMostResolvePlugin(__dirname, true),
],
},
};
return webpackStream(config, webpack);
// To write JSON for debugging:
/*return webpackStream(config, webpack, (err, stats) => {
require('gulp-util').log(stats.toString({colors: true}));
require('fs').writeFileSync('webpack-debug.json', JSON.stringify(stats.toJson()));
});*/
}

View File

@@ -5,10 +5,19 @@ export NODE_ENV = test
# Fix color output until TravisCI fixes https://github.com/travis-ci/travis-ci/issues/7967
export FORCE_COLOR = true
SOURCES = packages codemods experimental
.PHONY: build build-dist watch lint fix clean test-clean test-only test test-ci publish bootstrap
build: clean
make clean-lib
./node_modules/.bin/gulp build
ifneq ("$(BABEL_ENV)", "cov")
make build-standalone
endif
build-standalone:
./node_modules/.bin/gulp build-babel-standalone
build-dist: build
cd packages/babel-polyfill; \
@@ -18,17 +27,17 @@ build-dist: build
node scripts/generate-babel-types-docs.js
watch: clean
rm -rf packages/*/lib
make clean-lib
BABEL_ENV=development ./node_modules/.bin/gulp watch
lint:
./node_modules/.bin/eslint scripts packages *.js --format=codeframe
flow:
./node_modules/.bin/flow check
./node_modules/.bin/flow check --strip-root
lint:
./node_modules/.bin/eslint scripts $(SOURCES) *.js --format=codeframe --rulesdir="./scripts/eslint_rules"
fix:
./node_modules/.bin/eslint scripts packages *.js --format=codeframe --fix
./node_modules/.bin/eslint scripts $(SOURCES) *.js --format=codeframe --fix --rulesdir="./scripts/eslint_rules"
clean: test-clean
rm -rf packages/babel-polyfill/browser*
@@ -39,16 +48,8 @@ clean: test-clean
rm -rf packages/*/npm-debug*
test-clean:
rm -rf packages/*/test/tmp
rm -rf packages/*/test-fixtures.json
clean-all:
rm -rf packages/*/lib
rm -rf node_modules
rm -rf packages/*/node_modules
rm -rf package-lock.json
rm -rf packages/*/package-lock.json
make clean
$(foreach source, $(SOURCES), \
$(call clean-source-test, $(source)))
test-only:
./scripts/test.sh
@@ -68,7 +69,7 @@ test-ci-coverage:
publish:
git pull --rebase
rm -rf packages/*/lib
make clean-lib
BABEL_ENV=production make build-dist
make test
# not using lerna independent mode atm, so only update packages that have changed since we use ^
@@ -83,3 +84,34 @@ bootstrap:
make build
cd packages/babel-runtime; \
node scripts/build-dist.js
clean-lib:
$(foreach source, $(SOURCES), \
$(call clean-source-lib, $(source)))
clean-all:
rm -rf node_modules
rm -rf package-lock.json
$(foreach source, $(SOURCES), \
$(call clean-source-all, $(source)))
make clean
define clean-source-lib
rm -rf $(1)/*/lib
endef
define clean-source-test
rm -rf $(1)/*/test/tmp
rm -rf $(1)/*/test-fixtures.json
endef
define clean-source-all
rm -rf $(1)/*/lib
rm -rf $(1)/*/node_modules
rm -rf $(1)/*/package-lock.json
endef

View File

@@ -1,6 +0,0 @@
sebmck
thejameskyle
amasad
hzoo
loganfsmyth
jmm

185
README.md
View File

@@ -16,15 +16,22 @@
<a href="https://www.npmjs.com/package/babel-core"><img alt="npm Downloads" src="https://img.shields.io/npm/dm/babel-core.svg?maxAge=43200"></a>
</p>
<h2 align="center">Supporting Babel</h2>
<p align="center">
<a href="#backers"><img alt="Backers on Open Collective" src="https://opencollective.com/babel/backers/badge.svg" /></a>
<a href="#sponsors"><img alt="Sponsors on Open Collective" src="https://opencollective.com/babel/sponsors/badge.svg" /></a>
<a href="https://medium.com/friendship-dot-js/i-peeked-into-my-node-modules-directory-and-you-wont-believe-what-happened-next-b89f63d21558"><img alt="Business Strategy Status" src="https://img.shields.io/badge/business%20model-flavortown-green.svg"></a>
<a href="https://medium.com/friendship-dot-js/i-peeked-into-my-node-modules-directory-and-you-wont-believe-what-happened-next-b89f63d21558"><img alt="Business Strategy Status" src="https://img.shields.io/badge/business%20model-flavortown-green.svg"></a>
</p>
Babel is a community-driven tool that helps you write code in the latest version of JavaScript.
Babel is community-driven and thus mostly maintained by a group of [volunteers](https://babeljs.io/team). It has a lot of [companies and projects](http://babeljs.io/users) using it but almost no sponsors/people funded to work on it. If you'd like to help maintain the future of the project, please consider:
When your supported environments don't support certain features natively, Babel will help you compile those features down to a supported version.
- Giving developer time on the project. (Message us on [Twitter](https://twitter.com/babeljs) or [Slack](slack.babeljs.io))
- [Giving funds by becoming a backer/sponsor on OpenCollective](https://opencollective.com/babel)
## Intro
Babel is a tool that helps you write code in the latest version of JavaScript. When your supported environments don't support certain features natively, Babel will help you compile those features down to a supported version.
**In**
@@ -41,173 +48,45 @@ When your supported environments don't support certain features natively, Babel
});
```
Try it out at our [REPL](https://babeljs.io/repl/#?babili=false&evaluate=true&lineWrap=false&presets=latest&code=%5B1%2C2%2C3%5D.map(n%20%3D%3E%20n%20%2B%201)%3B&experimental=true&loose=true&spec=false&playground=false&stage=0) and follow us at [@babeljs](https://twitter.com/babeljs).
Try it out at our [REPL](https://babeljs.io/repl/build/master#?code_lz=NoRgNATGDMC6B0BbAhgBwBQDsAEBeAfNjgNTYgCUA3EA&lineWrap=true&presets=es2015%2Ces2016%2Ces2017&version=7.0.0-beta.2).
- [FAQ](#faq)
- [Packages](#packages)
- [Core Packages](#core-packages)
- [Other](#other)
- [Presets](#presets)
- [Plugins](#plugins)
- [Transform Plugins](#transform-plugins)
- [Syntax Plugins](#syntax-plugins)
- [Misc Packages](#misc-packages)
- [Team](#team)
- [Backers](#backers)
- [Sponsors](#sponsors)
- [License](#license)
# FAQ
## FAQ
## Docs?
### Who maintains Babel?
Check out our website: [babeljs.io](http://babeljs.io/)
Mostly a handful of volunteers! Please check out our [team page](https://babeljs.io/team)!
## Looking for support?
### Looking for support?
For questions and support please visit our [discussion forum](https://discuss.babeljs.io/), sign up for our [Slack community](https://slack.babeljs.io/), or [StackOverflow](http://stackoverflow.com/questions/tagged/babeljs).
For questions and support please visit join our [Slack Community](https://slack.babeljs.io/), ask a question on [Stack Overflow](http://stackoverflow.com/questions/tagged/babeljs), or ping us on [Twitter](https://twitter.com/babeljs/).
## Want to report a bug or request a feature?
### Where are the docs?
Bugs and feature requests can be posted at https://github.com/babel/babel/issues.
Check out our website: [babeljs.io](http://babeljs.io/), and report issues/features at [babel/website](https://github.com/babel/website/issues).
> We've moved our issues from phabricator back to github issues!
### Want to report a bug or request a feature?
Former phabricator issue URLs now automatically redirect to their corresponding Github issue:
Please read through our [CONTRIBUTING.md](https://github.com/babel/babel/blob/master/CONTRIBUTING.md) and fill out the issue template at [babel/issues](https://github.com/babel/babel/issues)!
https://phabricator.babeljs.io/T2168 mostly corresponds to https://github.com/babel/babel/issues/2168.
### Want to contribute to Babel?
## Want to report an issue with [babeljs.io](https://babeljs.io) (the website)?
Check out our [CONTRIBUTING.md](https://github.com/babel/babel/blob/master/CONTRIBUTING.md) to get started with setting up the repo.
For documentation and website issues please visit the [babel/babel.github.io](https://github.com/babel/babel.github.io) repo.
- If you have already joined Slack, join our [#development](https://babeljs.slack.com/messages/development) channel and say hi!
- Check out the issues with the [good first issue](https://github.com/babel/babel/labels/good%20first%20issue) and [help wanted](https://github.com/babel/babel/labels/help%20wanted) label. We suggest also looking at the closed ones to get a sense of the kinds of issues you can tackle.
- Our discussions/notes/roadmap: [babel/notes](https://github.com/babel/notes)
- Our progress on TC39 proposals: [babel/proposals](https://github.com/babel/proposals)
## Want to contribute to Babel?
### How is the repo structured?
Check out our [CONTRIBUTING.md](https://github.com/babel/babel/blob/master/CONTRIBUTING.md). If you have already joined Slack, join our [#development](https://babeljs.slack.com/messages/development) channel!
The Babel repo is managed as a [monorepo](https://github.com/babel/babel/blob/master/doc/design/monorepo.md) that is composed of many [npm packages](/packages#readme).
You can also start by checking out the issues with the [help-wanted](https://github.com/babel/babel/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) label.
Our discussions/notes/roadmap: [babel/notes](https://github.com/babel/notes)
## Packages
The Babel repo is managed as a [monorepo](https://github.com/babel/babel/blob/master/doc/design/monorepo.md) that is composed of many npm packages.
### Core Packages
| Package | Version | Dependencies |
|--------|-------|------------|
| [`babel-core`](/packages/babel-core) | [![npm](https://img.shields.io/npm/v/babel-core.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-core) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-core)](https://david-dm.org/babel/babel?path=packages/babel-core) |
| [`babylon`](https://github.com/babel/babylon) | [![npm](https://img.shields.io/npm/v/babylon.svg?maxAge=2592000)](https://www.npmjs.com/package/babylon) | [![Dependency Status](https://david-dm.org/babel/babylon.svg)](https://david-dm.org/babel/babylon) |
| [`babel-traverse`](/packages/babel-traverse) | [![npm](https://img.shields.io/npm/v/babel-traverse.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-traverse) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-traverse)](https://david-dm.org/babel/babel?path=packages/babel-traverse) |
| [`babel-generator`](/packages/babel-generator) | [![npm](https://img.shields.io/npm/v/babel-generator.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-generator) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-generator)](https://david-dm.org/babel/babel?path=packages/babel-generator) |
[`babel-core`](/packages/babel-core) is the Babel compiler itself; it exposes the `babel.transform` method, where `transformedCode = transform(src).code`.
The compiler can be broken down into 3 parts:
- The parser: [`babylon`](https://github.com/babel/babylon) (moved to a separate repo and versioned independently)
- The transformer[s]: All the plugins/presets
- These all use [`babel-traverse`](/packages/babel-traverse) to traverse through the AST
- The generator: [`babel-generator`](/packages/babel-generator)
The flow goes like this:
input string -> `babylon` parser -> `AST` -> transformer[s] -> `AST` -> `babel-generator` -> output string
Check out the [`babel-handbook`](https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#introduction) for more information on this.
#### Other
| Package | Version | Dependencies |
|--------|-------|------------|
| [`babel-cli`](/packages/babel-cli) | [![npm](https://img.shields.io/npm/v/babel-cli.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-cli) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-cli)](https://david-dm.org/babel/babel?path=packages/babel-cli) |
| [`babel-types`](/packages/babel-types) | [![npm](https://img.shields.io/npm/v/babel-types.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-types) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-types)](https://david-dm.org/babel/babel?path=packages/babel-types) |
| [`babel-polyfill`](/packages/babel-polyfill) | [![npm](https://img.shields.io/npm/v/babel-polyfill.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-polyfill) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-polyfill)](https://david-dm.org/babel/babel?path=packages/babel-polyfill) |
| [`babel-runtime`](/packages/babel-runtime) | [![npm](https://img.shields.io/npm/v/babel-runtime.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-runtime) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-runtime)](https://david-dm.org/babel/babel?path=packages/babel-runtime) |
| [`babel-register`](/packages/babel-register) | [![npm](https://img.shields.io/npm/v/babel-register.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-register) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-register)](https://david-dm.org/babel/babel?path=packages/babel-register) |
| [`babel-template`](/packages/babel-template) | [![npm](https://img.shields.io/npm/v/babel-template.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-template) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-template)](https://david-dm.org/babel/babel?path=packages/babel-template) |
| [`babel-helpers`](/packages/babel-helpers) | [![npm](https://img.shields.io/npm/v/babel-helpers.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-helpers) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-helpers)](https://david-dm.org/babel/babel?path=packages/babel-helpers) |
| [`babel-code-frame`](/packages/babel-code-frame) | [![npm](https://img.shields.io/npm/v/babel-code-frame.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-code-frame) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-code-frame)](https://david-dm.org/babel/babel?path=packages/babel-code-frame) |
- [`babel-cli`](/packages/babel-cli) is the CLI tool that runs `babel-core` and helps with outputting to a directory, a file, stdout and more (also includes `babel-node`). Check out the [docs](https://babeljs.io/docs/usage/cli/).
- [`babel-types`](/packages/babel-types) is used to validate, build and change AST nodes.
- [`babel-polyfill`](/packages/babel-polyfill) is [literally a wrapper](https://github.com/babel/babel/blob/master/packages/babel-polyfill/src/index.js) around [`core-js`](https://github.com/zloirock/core-js) and [regenerator-runtime](https://github.com/facebook/regenerator/tree/master/packages/regenerator-runtime). Check out the [docs](https://babeljs.io/docs/usage/polyfill/).
- [`babel-runtime`](/packages/babel-runtime) is similar to the polyfill except that it doesn't modify the global scope and is to be used with [`babel-plugin-transform-runtime`](/packages/babel-plugin-transform-runtime) (usually in library/plugin code). Check out the [docs](https://babeljs.io/docs/plugins/transform-runtime/).
- [`babel-register`](/packages/babel-register) is a way to automatically compile files with Babel on the fly by binding to Node.js `require`. Check out the [docs](http://babeljs.io/docs/usage/require/).
- [`babel-template`](/packages/babel-template) is a helper function that allows constructing AST nodes from a string presentation of the code; this eliminates the tedium of using `babel-types` for building AST nodes.
- [`babel-helpers`](/packages/babel-helpers) is a set of pre-made `babel-template` functions that are used in some Babel plugins.
- [`babel-code-frame`](/packages/babel-code-frame) is a standalone package used to generate errors that print the source code and point to error locations.
### [Presets](http://babeljs.io/docs/plugins/#presets)
After Babel 6, the default transforms were removed; if you don't specify any plugins/presets, Babel will just return the original source code.
The transformer[s] used in Babel are the independent pieces of code that transform specific things. For example: the [`es2015-arrow-functions`](/packages/babel-plugin-transform-es2015-arrow-functions) transform specifically changes arrow functions into regular functions. A preset is simply an array of plugins that make it easier to run a whole a set of transforms without specifying each one manually.
| Package | Version | Dependencies | Description |
|--------|-------|------------|---|
| [`babel-preset-env`](https://github.com/babel/babel-preset-env) | [![npm](https://img.shields.io/npm/v/babel-preset-env.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-preset-env) | [![Dependency Status](https://david-dm.org/babel/babel-preset-env.svg)](https://david-dm.org/babel/babel-preset-env) | automatically determines plugins and polyfills you need based on your supported environments |
> You can find community maintained presets on [npm](https://www.npmjs.com/search?q=babel-preset)
### [Plugins](http://babeljs.io/docs/plugins)
Plugins are the heart of Babel and what make it work.
> You can find community plugins on [npm](https://www.npmjs.com/search?q=babel-plugin).
#### Transform Plugins
There are many kinds of plugins: ones that convert ES6/ES2015 to ES5, transform to ES3, minification, JSX, flow, experimental features, and more. Check out our [website for more](http://babeljs.io/docs/plugins/#transform-plugins).
#### Syntax Plugins
These just enable the transform plugins to be able to parse certain features (the transform plugins already include the syntax plugins so you don't need both): `babel-plugin-syntax-x`. Check out our [website for more](http://babeljs.io/docs/plugins/#syntax-plugins).
### Helpers
These are mostly for internal use in various plugins: `babel-helper-x`.
## Team
### Core members
[![Babel](https://avatars.githubusercontent.com/u/9637642?s=64)](https://github.com/babel) | [![Daniel Tschinder](https://avatars.githubusercontent.com/u/231804?s=64)](https://github.com/danez) | [![Logan Smyth](https://avatars.githubusercontent.com/u/132260?s=64)](https://github.com/loganfsmyth) | [![Henry Zhu](https://avatars.githubusercontent.com/u/588473?s=64)](https://github.com/hzoo) |
|---|---|---|---|
Babel | Daniel Tschinder | Logan Smyth | Henry Zhu |
:octocat: [@babel](https://github.com/babel) | [@danez](https://github.com/danez) | [@loganfsmyth](https://github.com/loganfsmyth) | [@hzoo](https://github.com/hzoo) |
:bird: [@babeljs](https://twitter.com/babeljs) | [@TschinderDaniel](https://twitter.com/TschinderDaniel) | [@loganfsmyth](https://twitter.com/loganfsmyth) | [@left_pad](https://twitter.com/left_pad) |
### Members
[![Andrew Levine](https://avatars.githubusercontent.com/u/5233399?s=64)](https://github.com/drewml) | [![Boopathi Rajaa](https://avatars.githubusercontent.com/u/294474?s=64)](https://github.com/boopathi) | [![Brian Ng](https://avatars.githubusercontent.com/u/56288?s=64)](https://github.com/existentialism) | [![Dan Harper](https://avatars.githubusercontent.com/u/510740?s=64)](https://github.com/danharper) | [![diogo franco](https://avatars.githubusercontent.com/u/73085?s=64)](https://github.com/kovensky) | [![Aaron Ang](https://avatars1.githubusercontent.com/u/7579804?s=64)](https://github.com/aaronang) | [![Artem Yavorsky](https://avatars2.githubusercontent.com/u/1521229?s=64)](https://github.com/yavorsky) |
|---|---|---|---|---|---|---|
| Andrew Levine | Boopathi Rajaa | Brian Ng | Dan Harper | Diogo Franco | Aaron Ang | Artem Yavorsky |
| [@drewml](https://github.com/drewml) | [@boopathi](https://github.com/boopathi) | [@existentialism](https://github.com/existentialism) | [@danharper](https://github.com/danharper) | [@kovensky](https://github.com/kovensky) | [@aaronang](https://github.com/aaronang) | [@yavorsky](https://github.com/yavorsky) |
| [@drewml](https://twitter.com/drewml) | [@heisenbugger](https://twitter.com/heisenbugger) | [@existentialism](https://twitter.com/existentialism) | [@DanHarper7](https://twitter.com/DanHarper7) | [@kovnsk](https://twitter.com/kovnsk) | [@_aaronang](https://twitter.com/_aaronang) | [@yavorsky_](https://twitter.com/yavorsky_) |
[![Juriy Zaytsev](https://avatars.githubusercontent.com/u/383?s=64)](https://github.com/kangax) | [![Kai Cataldo](https://avatars.githubusercontent.com/u/7041728?s=64)](https://github.com/kaicataldo) | [![Moti Zilberman](https://avatars.githubusercontent.com/u/2246565?s=64)](https://github.com/motiz88) | [![Sven Sauleau](https://avatars3.githubusercontent.com/u/1493671?s=64)](https://github.com/xtuc) | [![Samuel Reed](https://avatars3.githubusercontent.com/u/1197375?s=64)](https://github.com/STRML) | [![Sergey Rubanov](https://avatars1.githubusercontent.com/u/1507086?s=64)](https://github.com/chicoxyzzy) |
|---|---|---|---|---|---|
| Juriy Zaytsev | Kai Cataldo | Moti Zilberman | Sven Sauleau | Samuel Reed | Sergey Rubanov |
| [@kangax](https://github.com/kangax) | [@kaicataldo](https://github.com/kaicataldo) | [@motiz88](https://github.com/motiz88) | [@xtuc](https://github.com/xtuc) | [@STRML](https://github.com/STRML) | [@chicoxyzzy](https://github.com/chicoxyzzy) |
| [@kangax](https://twitter.com/kangax) | [@kai_cataldo](https://twitter.com/kai_cataldo) | [@motiz88](https://twitter.com/motiz88) | [@svensauleau](https://twitter.com/svensauleau) | [@STRML_](https://twitter.com/STRML_) | [@chicoxyzzy](https://twitter.com/chicoxyzzy) |
### Non-Human Members
[<img src="https://github.com/babel/babel-bot/raw/master/babel-bot.png" height="64">](https://github.com/babel-bot) |
|---|
| Babel Bot |
| [@babel-bot](https://github.com/babel-bot) |
| [@babeljs](https://twitter.com/babeljs) |
### Inactive members
[![Amjad Masad](https://avatars.githubusercontent.com/u/587518?s=64)](https://github.com/amasad) | [![James Kyle](https://avatars.githubusercontent.com/u/952783?s=64)](https://github.com/thejameskyle) | [![Jesse McCarthy](https://avatars.githubusercontent.com/u/129203?s=64)](https://github.com/jmm) | [![Sebastian McKenzie](https://avatars.githubusercontent.com/u/853712?s=64)](https://github.com/kittens) (Creator) |
|---|---|---|---|
Amjad Masad | James Kyle | Jesse McCarthy | Sebastian McKenzie |
[@amasad](https://github.com/amasad) | [@thejameskyle](https://github.com/thejameskyle) | [@jmm](https://github.com/jmm) | [@sebmck](https://twitter.com/sebmck) |
| [@amasad](https://twitter.com/amasad) | [@thejameskyle](https://twitter.com/thejameskyle) | [@mccjm](https://twitter.com/mccjm) | [@kittens](https://github.com/kittens)
# Backers
## Backers
Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/babel#backer)]
@@ -242,7 +121,7 @@ Support us with a monthly donation and help us continue our activities. [[Become
<a href="https://opencollective.com/babel/backer/28/website" target="_blank"><img src="https://opencollective.com/babel/backer/28/avatar.svg"></a>
<a href="https://opencollective.com/babel/backer/29/website" target="_blank"><img src="https://opencollective.com/babel/backer/29/avatar.svg"></a>
# Sponsors
## Sponsors
Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/babel#sponsor)]

View File

@@ -1,7 +1,7 @@
{
"settings": {
"rulers": [
110
80
],
// Set to false to disable detection of tabs vs. spaces on load

View File

@@ -1,7 +1,12 @@
general:
artifacts:
- "packages/babel-standalone/babel.js"
- "packages/babel-standalone/babel.min.js"
machine:
node:
version:
6
8
dependencies:
pre:
@@ -14,3 +19,9 @@ dependencies:
test:
override:
- make test-ci-coverage
# Builds babel-standalone with the regular Babel config
- make build
# test-ci-coverage doesn't test babel-standalone, as trying to gather coverage
# data for a JS file that's several megabytes large is bound to fail. Here,
# we just run the babel-standalone test separately.
- ./node_modules/mocha/bin/_mocha packages/babel-standalone/test/ --opts test/mocha.opts

6
codemods/.eslintrc Normal file
View File

@@ -0,0 +1,6 @@
{
"rules": {
"prettier/prettier": ["error", { "trailingComma": "all" }],
"no-undefined-identifier": 2
}
}

View File

@@ -0,0 +1,59 @@
# @babel/plugin-codemod-optional-catch-binding
> If the argument bound to the catch block is not referenced in the catch block, that argument and the catch binding is removed.
## Examples
```js
try {
throw 0;
} catch (err) {
console.log("it failed, but this code executes");
}
```
Is transformed to:
```js
try {
throw 0;
} catch {
console.log("it failed, but this code executes");
}
```
## Installation
```sh
npm install --save-dev @babel/plugin-codemod-optional-catch-binding
```
## Usage
### Via `.babelrc` (Recommended)
**.babelrc**
```json
{
"plugins": ["@babel/codemod-optional-catch-binding"]
}
```
### Via CLI
```sh
babel --plugins @babel/codemod-optional-catch-binding script.js
```
### Via Node API
```javascript
require("@babel/core").transform("code", {
plugins: ["@babel/codemod-optional-catch-binding"]
});
```
## References
This codemod updates your source code in line with the following proposal:
- [Proposal: Optional Catch Binding for ECMAScript](https://github.com/babel/proposals/issues/7)

View File

@@ -0,0 +1,20 @@
{
"name": "@babel/plugin-codemod-optional-catch-binding",
"version": "7.0.0-beta.5",
"description": "Remove unused catch bindings",
"repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-remove-unused-catch-binding",
"license": "MIT",
"main": "lib/index.js",
"keywords": [
"@babel/plugin"
],
"dependencies": {
"@babel/plugin-syntax-optional-catch-binding": "7.0.0-beta.5"
},
"peerDependencies": {
"@babel/core": ">=7.0.0-beta.4 <7.0.0-rc.0"
},
"devDependencies": {
"@babel/helper-plugin-test-runner": "7.0.0-beta.5"
}
}

View File

@@ -0,0 +1,24 @@
import syntaxOptionalCatchBinding from "@babel/plugin-syntax-optional-catch-binding";
export default function(babel) {
const { types: t } = babel;
return {
inherits: syntaxOptionalCatchBinding,
visitor: {
CatchClause(path) {
if (path.node.param === null || !t.isIdentifier(path.node.param)) {
return;
}
const binding = path.scope.getOwnBinding(path.node.param.name);
if (binding.constantViolations.length > 0) {
return;
}
if (!binding.referenced) {
const paramPath = path.get("param");
paramPath.remove();
}
},
},
};
}

View File

@@ -0,0 +1,5 @@
try {
throw 0;
} catch (e) {
let e = new TypeError('Duplicate variable declaration; will throw an error.');
}

View File

@@ -0,0 +1,4 @@
{
"plugins": ["../../../../lib"],
"throws": "Duplicate declaration \"e\""
}

View File

@@ -0,0 +1,5 @@
try {
throw 0;
} catch {
console.log("it failed, but this code executes");
}

View File

@@ -0,0 +1,5 @@
try {
throw 0;
} catch ([message]) {
console.log("it failed, but this code executes");
}

View File

@@ -0,0 +1,5 @@
try {
throw 0;
} catch ([message]) {
console.log("it failed, but this code executes");
}

View File

@@ -0,0 +1,5 @@
try {
throw 0;
} catch {
console.log("it failed, but this code executes");
}

View File

@@ -0,0 +1,7 @@
try {
throw 0;
} catch ({
message
}) {
console.log("it failed, but this code executes");
}

View File

@@ -0,0 +1,7 @@
try {
throw 0;
} catch ({
message
}) {
console.log("it failed, but this code executes");
}

View File

@@ -0,0 +1,5 @@
try {
throw 0;
} catch ([message]) {
console.log(message);
}

View File

@@ -0,0 +1,5 @@
try {
throw 0;
} catch ([message]) {
console.log(message);
}

View File

@@ -0,0 +1,5 @@
try {
throw 0;
} catch (e) {
e = new TypeError('A new variable is not being declared or initialized; the catch binding is being referenced and cannot be removed.');
}

View File

@@ -0,0 +1,5 @@
try {
throw 0;
} catch (e) {
e = new TypeError('A new variable is not being declared or initialized; the catch binding is being referenced and cannot be removed.');
}

View File

@@ -0,0 +1,5 @@
try {
throw 0;
} catch (err) {
console.log(err, "it failed, but this code executes");
}

View File

@@ -0,0 +1,5 @@
try {
throw 0;
} catch (err) {
console.log(err, "it failed, but this code executes");
}

View File

@@ -0,0 +1,7 @@
try {
throw 0;
} catch ({
message
}) {
console.log(message);
}

View File

@@ -0,0 +1,7 @@
try {
throw 0;
} catch ({
message
}) {
console.log(message);
}

View File

@@ -0,0 +1,7 @@
try {
throw 0;
} catch (err) {
console.log(err, "it failed, but this code executes");
} finally {
console.log("this code also executes");
}

View File

@@ -0,0 +1,7 @@
try {
throw 0;
} catch (err) {
console.log(err, "it failed, but this code executes");
} finally {
console.log("this code also executes");
}

View File

@@ -0,0 +1,3 @@
import runner from "@babel/helper-plugin-test-runner";
runner(__dirname);

View File

@@ -21,6 +21,7 @@ This is quite taboo but let's look at the pros and cons:
* Codebase looks more intimidating.
* Repo is bigger in size.
* [Can't `npm install` modules directly from GitHub](https://github.com/npm/npm/issues/2974)
* ???
## This is dumb! Nobody in open source does this!

6
experimental/.eslintrc Normal file
View File

@@ -0,0 +1,6 @@
{
"rules": {
"prettier/prettier": ["error", { "trailingComma": "all" }],
"no-undefined-identifier": 2
}
}

View File

@@ -0,0 +1,6 @@
/lib
debug-fixtures
fixtures
/data
/flow-typed
test/tmp

View File

@@ -0,0 +1,10 @@
node_modules
coverage
lib
test/tmp
.DS_Store
*.log
.vscode
.nyc_output
tmp
babel-preset-env-*.tgz

View File

@@ -0,0 +1,15 @@
coverage
src
test
lib/types.js
node_modules
scripts
.eslintignore
.travis.yml
codecov.yml
yarn.lock
.nyc_output
.vscode
.eslintrc
babel-preset-env-*.tgz
flow-typed

View File

@@ -0,0 +1,668 @@
# Changelog
## v1.6.1 (2017-10-17)
### :bug: Bug Fix
- Update compat table to fix two small issues ([#445](https://github.com/babel/babel-preset-env/pull/445)) (@danez)
ES2015 destructuring is not fully supported in Edge 15 and the polyfill required again. `es6.math.imul` is supported on Android as of version 4.4
- Add polyfills for ES6 static Object methods ([#441](https://github.com/babel/babel-preset-env/pull/441)) (@danez)
Functions such as `Object.keys`, `Object.freeze`, ... do already exist in ES5, but their behaviour changed in ES2015. `babel-preset-env` with `builtIns: true` now adds the core-js polyfills for this methods if the browser only supports the ES5 variant of the method (like IE11 for example)
- Normalize module format of plugins/built-ins data ([#376](https://github.com/babel/babel-preset-env/pull/376)) (@rtsao)
## v1.6.0 (2017-07-04)
### :rocket: New Feature
- Bump compat-table for node8 support ([#363](https://github.com/babel/babel-preset-env/pull/363)) (@existentialism)
We updated our mappings to support native trailing function commas and string paddings in Node.js 8+.
### :bug: Bug Fix
- Handle `chromeandroid` browserslist value ([#367](https://github.com/babel/babel-preset-env/pull/367)) (@yavorsky)
We added support for using browserslist's `chromeandroid` in `targets`.
### :memo: Documentation
- Tweak uglify option docs ([#368](https://github.com/babel/babel-preset-env/pull/368)) (@existentialism)
Thanks to @graingert and @pfiaux for pointing out some needed updates to the `uglify-js`-related docs.
## v1.5.2 (2017-06-07)
### :bug: Bug Fix
- Ensure explicit targets always override browsers key targets ([#346](https://github.com/babel/babel-preset-env/pull/346)) (@existentialism)
`browser` targets should be overridden by explicit targets, and we inadvertently broke this when we landed string version support.
## v1.5.1 (2017-05-22)
### :bug: Bug Fix
- Compile with loose mode ([#322](https://github.com/babel/babel-preset-env/pull/332)) (@existentialism)
## v1.5.0 (2017-05-19)
### :rocket: New Feature
- Support target versions as strings ([#321](https://github.com/babel/babel-preset-env/pull/321)) (@existentialism)
We were originally waiting on 2.x for a breaking change, but since node v7.10
and other targets are causing some pain, we decided to land a backwards
compatible version.
### :house: Internal
- Backport: use preset-env and remove flow-strip-types ([#324](https://github.com/babel/babel-preset-env/pull/324)) (@yavorsky)
- Bump electron-to-chromium ([#329](https://github.com/babel/babel-preset-env/pull/329)) (@existentialism)
- Tweak version mappings to match compat-table updates ([#323](https://github.com/babel/babel-preset-env/pull/323)) (@existentialism)
- Bump browserslist ([#319](https://github.com/babel/babel-preset-env/pull/319)) (@existentialism)
- Bump compat-table ([#307](https://github.com/babel/babel-preset-env/pull/307)) (@existentialism)
- Add debug-fixtures and test/tmp to .eslintignore ([#305](https://github.com/babel/babel-preset-env/pull/305)) (@yavorsky)
## v1.4.0 (2017-04-14)
### :rocket: New Feature
- Support `spec` option ([#98](https://github.com/babel/babel-preset-env/pull/98)) (@Kovensky)
Added an option to enable more spec compliant, but potentially slower, transformations for any plugins in this preset that support them.
- Bump compat-table for Edge 15 support ([#273](https://github.com/babel/babel-preset-env/pull/273)) (@existentialism)
We updated our mappings so that you can get native support for async/await and other goodies when targeting Edge 15!
### :bug: Bug Fix
- Add Android browser to name map ([#270](https://github.com/babel/babel-preset-env/pull/270)) (@existentialism)
Fixed a bug that was ignoring Android targets in browserslist queries (for example: "Android >= 4").
### :memo: Documentation
- Clarify note about loading polyfills only once ([#282](https://github.com/babel/babel-preset-env/pull/282)) (@darahak)
- Add a reminder about include/exclude options ([#275](https://github.com/babel/babel-preset-env/pull/275)) (@existentialism)
### :house: Internal
- Chore: reduce package size. ([#281](https://github.com/babel/babel-preset-env/pull/281)) (@evilebottnawi)
- Remove deprecated comment ([#271](https://github.com/babel/babel-preset-env/pull/271)) (@yavorsky)
## v1.3.3 (2017-04-07)
### :bug: Bug Fix
- Support electron version in a string format ([#252](https://github.com/babel/babel-preset-env/pull/252)) (@yavorsky)
Adding electron as a target was an inadvertent breaking change as it no longer
allowed string versions. We added an exception for now, even though it is
inconsistent with other versions. Just as a note, the upcoming version 2.x will
allow _both_ number and string versions.
- Ensure const-check plugin order ([#257](https://github.com/babel/babel-preset-env/pull/257)) (@existentialism)
We now force the `const-es2015-check` plugin to run first (so that it can
correctly report issues before they get transpiled away).
### :rocket: New Feature
- Allow use `babel-plugin-` prefix for include and exclude ([#242](https://github.com/babel/babel-preset-env/pull/242)) (@yavorsky)
The `include` and `exclude` options now allow both prefixed (`babel-plugin-transform-es2015-spread`)
and prefix-less (`transform-es2015-spread`) plugin names.
### :memo: Documentation
- Note babel plugin prefix handling in include/exclude ([#245](https://github.com/babel/babel-preset-env/pull/245)) (@existentialism)
- Fix README: debug option shows info in stdout. ([#236](https://github.com/babel/babel-preset-env/pull/236)) (@Gerhut)
### :house: Internal
- Add simple smoke-test ([#240](https://github.com/babel/babel-preset-env/pull/240)) (@existentialism)
- Add prepublish script (@existentialism)
## v1.3.2 (2017-03-30)
- Fixed an issue with a broken publish
## v1.3.1 (2017-03-30)
- Fixed a regression with missing files due to `.npmignore`.
## v1.3.0 (2017-03-30)
### :bug: Bug Fix
- Add check for ArrayBuffer[Symbol.species] ([#233](https://github.com/babel/babel-preset-env/pull/233)) (@existentialism)
We now properly check for `Symbol.species` support in ArrayBuffer and include the
polyfill if necessary. This should, as a side effect, fix ArrayBuffer-related
errors on IE9.
### :nail_care: Polish
- Fill data with electron as a target. ([#229](https://github.com/babel/babel-preset-env/pull/229)) (@yavorsky)
We've simplified things by adding `electron` as a target instead of doing a bunch of
things at runtime. Electron targets should now also be displayed in the debug output.
- separate default builtins for platforms ([#226](https://github.com/babel/babel-preset-env/pull/226)) (@restrry)
If you are targeting the `node` environment exclusively, the always-included web polyfills
(like `dom.iterable`, and a few others) will now no longer be included.
### :memo: Documentation
* remove deprecated projects ([#223](https://github.com/babel/babel-preset-env/pull/223)) [skip ci] (@stevemao)
### :house: Internal
* npmignore: Add related to build data and codecov. ([#216](https://github.com/babel/babel-preset-env/pull/216)) (@yavorsky)
## v1.2.2 (2017-03-14)
### :bug: Bug Fix
- Refactor browser data parsing to handle families ([#208](https://github.com/babel/babel-preset-env/pull/208)) (@existentialism)
When parsing plugin data, we weren't properly handling browser families. This caused
`transform-es2015-block-scoping` and other plugins to be incorrectly added for Edge >= 12.
(s/o to @mgol for the the report and review!)
- Add typed array methods to built-ins features. ([#198](https://github.com/babel/babel-preset-env/pull/198)) (@yavorsky)
Fixes an issue where some TypedArray features were not being polyfilled properly. (s/o to @alippai for the report!)
### :memo: Documentation
- Fixed minor typo in readme ([#199](https://github.com/babel/babel-preset-env/pull/199)) (@bl4ckdu5t)
- Add built-ins, better links, compat-table url, etc ([#195](https://github.com/babel/babel-preset-env/pull/195)) (@yavorsky)
- Change CONTRIBUTING.md to use absolute paths ([#194](https://github.com/babel/babel-preset-env/pull/194)) (@aaronang)
### :house: Internal
- Bump plugins ([#201](https://github.com/babel/babel-preset-env/pull/201)) (@yavorsky)
- Enable code coverage ([#200](https://github.com/babel/babel-preset-env/pull/200)) (@alxpy)
- Increase mocha timeout to 10s ([#202](https://github.com/babel/babel-preset-env/pull/202)) (@yavorsky)
## v1.2.1 (2017-03-06)
### :bug: Bug Fix
- Add transform-duplicate-keys mapping ([#192](https://github.com/babel/babel-preset-env/pull/192)) (@existentialism)
Our plugin data was missing a mapping for the `transform-duplicate-keys` plugin which caused it to never be included. (s/o to @Timer for the report!)
### :memo: Documentation
- Clarify reasons for the uglify option in README.md ([#188](https://github.com/babel/babel-preset-env/pull/188)) (@mikegreiling)
## v1.2.0 (2017-03-03)
### :rocket: New Feature
- Add uglify as a target ([#178](https://github.com/babel/babel-preset-env/pull/178)) (@yavorsky)
Support for `uglify` as a target is now available! This will enable all plugins and, as a result, fully compiles your code to ES5. Note, that useBuiltIns will work as before, and only the polyfills that your other target(s) need will be included.
```json
{
"presets": [
["env", {
"targets": {
"chrome": 55,
"uglify": true
},
"useBuiltIns": true,
"modules": false
}]
]
}
```
### :bug: Bug Fix
- Respect older versions in invert equals map ([#180](https://github.com/babel/babel-preset-env/pull/180)) (@danez)
Fixes a number of bugs that caused some incorrect and/or missing environment data when parsing `compat-table`.
## v1.1.11 (2017-03-01)
This release primarily upgrades `compat-table`, which adds support for async on Node 7.6!
### :bug: Bug Fix
- Fix hasBeenWarned condition. ([#175](https://github.com/babel/babel-preset-env/pull/175)) (@yavorsky)
### :memo: Documentation
- Add yarn example. ([#174](https://github.com/babel/babel-preset-env/pull/174)) (@yavorsky)
### :house: Internal
- Bump compat-table ([#177](https://github.com/babel/babel-preset-env/pull/177)) (@existentialism)
- Add electron version exception test ([#176](https://github.com/babel/babel-preset-env/pull/176)) (@existentialism)
## v1.1.10 (2017-02-24)
### :bug: Bug Fix
- Drop use of lodash/intersection from checkDuplicateIncludeExcludes ([#173](https://github.com/babel/babel-preset-env/pull/173)) (@existentialism)
## v1.1.9 (2017-02-24)
### :bug: Bug Fix
- Add tests for debug output ([#156](https://github.com/babel/babel-preset-env/pull/156)) (@existentialism)
Since we've (mostly @yavorsky) have fixed a number of bugs recently with the `debug` option output, we added the ability to assert stdout matches what we expect. Read the updated [CONTRIBUTING.md](https://github.com/babel/babel-preset-env/blob/master/CONTRIBUTING.md#testing-the-debug-option) for more info.
- Fixes #143. Log correct targets. ([#155](https://github.com/babel/babel-preset-env/pull/155)) (@yavorsky)
This fixes a bug in the `debug` output where incorrect target(s) were being displayed for why a particular plugin/preset was being included.
Given targets:
```txt
{
"firefox": 52,
"node": 7.4
}
```
Before:
```txt
Using plugins:
transform-es2015-destructuring {"node":6.5}
transform-es2015-for-of {"node":6.5}
transform-es2015-function-name {"node":6.5}
transform-es2015-literals {"node":4}
transform-exponentiation-operator {"firefox":52}
syntax-trailing-function-commas {"firefox":52}
```
After:
```txt
Using plugins:
transform-es2015-destructuring {"firefox":52}
transform-es2015-for-of {"firefox":52}
transform-es2015-function-name {"firefox":52}
transform-es2015-literals {"firefox":52}
transform-exponentiation-operator {"node":7.4}
syntax-trailing-function-commas {"node":7.4}
```
### :memo: Documentation
- Fix compat-table link in contributing.md (@existentialism)
- Update README examples to fix website ([#151](https://github.com/babel/babel-preset-env/pull/)) (@existentialism)
- Fix few typos ([#146](https://github.com/babel/babel-preset-env/pull/146)) (@existentialism)
- Add configuration example to clarify `debug: true` ([#138](https://github.com/babel/babel-preset-env/pull/138)) (@yavorsky)
- Fix CHANGELOGs v1.1.8 updates typo. ([#136](https://github.com/babel/babel-preset-env/pull/136)) (@yavorsky)
- README: Update `debug: true` example. ([#138](https://github.com/babel/babel-preset-env/pull/138)) (@yavorsky)
### :house: Internal
- update compat ([#169](https://github.com/babel/babel-preset-env/pull/169)) (@hzoo)
- Use external Electron to Chromium library ([#144](https://github.com/babel/babel-preset-env/pull/144)) (@Kilian)
- Update yarn lockfile ([#152](https://github.com/babel/babel-preset-env/pull/152)) (@existentialism)
- Extract option normalization into independant file ([#125](https://github.com/babel/babel-preset-env/pull/125)) (@baer)
- Update yarnfile ([#145](https://github.com/babel/babel-preset-env/pull/145)) (@baer)
- devDeps: eslint-config-babel v5.0.0 ([#139](https://github.com/babel/babel-preset-env/pull/139)) (@kaicataldo)
- Update compat-table, build data ([#135](https://github.com/babel/babel-preset-env/pull/135)) (@hzoo)
## v1.1.8 (2017-01-10)
### :bug: Bug Fix
- Debug: Transformations before logs. ([#128](https://github.com/babel/babel-preset-env/pull/128)) (@yavorsky)
Makes sure that all transformations on `targets` (such as `exclude`/`include`) are run before logging out with the `debug` option. Fixes ([#127](https://github.com/babel/babel-preset-env/issues/127)).
### :house: Internal
- Remove unnecessary extension. ([#131](https://github.com/babel/babel-preset-env/pull/131)) (@roman-yakobnyuk)
- Include yarn.lock and update CI. ([#124](https://github.com/babel/babel-preset-env/pull/124)) (@existentialism)
## v1.1.7 (2017-01-09)
Had a publishing issue in the previous release.
## v1.1.6 (2017-01-06)
### :bug: Bug Fix
- Explicitly resolve lowest browser version. ([#121](https://github.com/babel/babel-preset-env/pull/121)) (@brokenmass)
```js
{
"targets": {
"browsers": ["ios >= 6"] // was resolving to {ios: 10} rather than {ios: 6}
}
}
```
## v1.1.5 (2017-01-04)
### :bug: Bug Fix
- Show error if target version is not a number. ([#107](https://github.com/babel/babel-preset-env/pull/107)) (@existentialism)
```js
{
"presets": [
["env", {
"targets": {
"chrome": "52", // will error since it's not a number,
"chrome": 52 // correct!
}
}]
]
}
```
- Fix targets for the `debug` option. ([#109](https://github.com/babel/babel-preset-env/pull/109)) (@yavorsky)
Now it prints the transformed targets/environments rather than the browsers query.
```txt
Using targets:
{
"chrome": 53,
"ie": 10,
"node": 6
}
Modules transform: false
Using plugins:
transform-es2015-arrow-functions {"chrome":47,"node":6}
transform-es2015-block-scoped-functions {"chrome":41,"ie":11,"node":4}
Using polyfills:
es6.typed.uint8-clamped-array {"chrome":5,"node":0.12}
es6.map {"chrome":51,"node":6.5}
```
## v1.1.4 (2016-12-16)
v1.1.2-v1.1.4
### :bug: Bug Fix
The new `exclude`/`include` options weren't working correctly for built-ins. ([#102](https://github.com/babel/babel-preset-env/pull/102)).
Also fixes an issue with debug option.
## v1.1.1 (2016-12-13)
### :bug: Bug Fix
Regression with the previous release due to using `Object.values` (ES2017). This wasn't caught because we are using babel-register to run tests and includes polyfills so it didn't fail on CI even though we have Node 0.10 as an env. Looking into fixing this to prevent future issues.
## v1.1.0 (2016-12-13)
### :rocket: New Feature
- Add `exclude` option, rename `whitelist` to `include` ([#89](https://github.com/babel/babel-preset-env/pull/89)) (@hzoo)
Example:
```js
{
"presets": [
["env", {
"targets": {
"browsers": ["last 2 versions", "safari >= 7"]
},
"include": ["transform-es2015-arrow-functions"],
"exclude": [
"transform-regenerator",
"transform-async-to-generator",
"map"
],
"useBuiltIns": true
}]
]
}
```
`"exclude": ["transform-regenerator"]` doesn't transform generators and removes `regeneratorRuntime` from being imported.
`"exclude": ["transform-async-to-generator"]` doesn't use the built-in async-to-gen transform so you can use something like [fast-async](https://github.com/MatAtBread/fast-async).
`"exclude": ["map"]` doesn't include the `Map` polyfill if you know you aren't using it in your code (w/ `useBuiltIns`). (We will figure out a way to automatically do this [#84](https://github.com/babel/babel-preset-env/issues/84)).
If you pass a wrong plugin it will error: valid options for `include/exclude` are in [/data/plugin-features.js](https://github.com/babel/babel-preset-env/blob/master/data/plugin-features.js) and [/data/built-in-features.js](https://github.com/babel/babel-preset-env/blob/master/data/built-in-features.js) (without the `es6.`)
### :house: Internal
- Optimize result filtration. ([#77](https://github.com/babel/babel-preset-env/pull/77)) (@yavorsky)
- Update eslint config to align with other babel projects ([#79](https://github.com/babel/babel-preset-env/pull/79)) (@baer)
- Update pathnames to avoid uppercase ([#80](https://github.com/babel/babel-preset-env/pull/80)) (@baer)
- Refactor build data for clarity/consistency ([#81](https://github.com/babel/babel-preset-env/pull/81)) (@baer)
- Update linting rules to cover all js ([#82](https://github.com/babel/babel-preset-env/pull/82)) (@baer)
- Cleanup lib before rebuilding ([#87](https://github.com/babel/babel-preset-env/pull/87)) (@baer)
- Move linting dependency to be dev only ([#88](https://github.com/babel/babel-preset-env/pull/88)) (@baer)
### :memo: Documentation
- Fix typo ([#78](https://github.com/babel/babel-preset-env/pull/78)) (@rohmanhm)
- Fix PR link in changelog. ([#75](https://github.com/babel/babel-preset-env/pull/75)) (@nhajidin)
## v1.0.2 (2016-12-10)
### :bug: Bug Fix
* Fix issue with Object.getOwnPropertySymbols ([#71](https://github.com/babel/babel-preset-env/pull/71)) ([@existentialism](https://github.com/existentialism))
Was requiring the wrong module kinda of like in v1.0.1:
https://github.com/zloirock/core-js#ecmascript-6-symbol
```diff
-import "core-js/modules/es6.object.get-own-property-symbols";
```
The test is just a part of `Symbol`.
## v1.0.1 (2016-12-10)
### :bug: Bug Fix
* Fix regenerator import ([#68](https://github.com/babel/babel-preset-env/pull/68)) ([@hzoo](https://github.com/hzoo))
We were outputting an invalid path for `regenerator`!
```diff
+import "regenerator-runtime/runtime";
-import "core-js/modules/regenerator-runtime/runtime"-
```
## v1.0.0 (2016-12-09)
### :rocket: New Feature
* Add `useBuiltIns` option ([#56](https://github.com/babel/babel-preset-env/pull/56)) ([@hzoo](https://github.com/hzoo)), ([@yavorsky](https://github.com/yavorsky)), ([@existentialism](https://github.com/existentialism))
A way to apply `babel-preset-env` for polyfills (via `"babel-polyfill"``).
> This option will apply a new Babel plugin that replaces `require("babel-polyfill")` with the individual requires for `babel-polyfill` based on the target environments.
Install
```
npm install babel-polyfill --save
```
In
```js
import "babel-polyfill"; // create an entry js file that contains this
// or
import "core-js";
```
Out (different based on environment)
```js
// chrome 55
import "core-js/modules/es7.string.pad-start"; // haha left_pad
import "core-js/modules/es7.string.pad-end";
import "core-js/modules/web.timers";
import "core-js/modules/web.immediate";
import "core-js/modules/web.dom.iterable";
```
`.babelrc` Usage
```js
{
"presets": [
["env", {
"targets": {
"electron": 1.4
},
"modules": false, // webpack 2
"useBuiltIns": true // new option
}]
]
}
```
> Also looking to make an easier integration point via Webpack with this method. Please reach out if you have ideas!
---
* Support [Electron](http://electron.atom.io/) ([#55](https://github.com/babel/babel-preset-env/pull/55)) ([@paulcbetts](https://github.com/paulcbetts))
Electron is also an environment, so [Paul went ahead](https://twitter.com/paulcbetts/status/804507070103851008) and added support for this!
`.babelrc` Usage
```js
{
"presets": [ ["env", {"targets": { "electron": 1.4 }}]]
}
```
> Currently we are manually updating the data in [/data/electron-to-chromium.js](https://github.com/babel/babel-preset-env/blob/master/data/electron-to-chromium.js), but [@kevinsawicki](https://github.com/kevinsawicki) says we could generate the data from [atom-shell/dist/index.json](https://gh-contractor-zcbenz.s3.amazonaws.com/atom-shell/dist/index.json) as well! (Someone should make a PR :smile:)
## v0.0.9 (2016-11-24)
### :rocket: New Feature
* Support Opera ([#48](https://github.com/babel/babel-preset-env/pull/48)) (Henry Zhu)
Was as simple as modifying the chrome version and subtracting 13! (so chrome 54 = opera 41)
```js
{
"presets": [
["env", {
"targets": {
"opera": 41
}
}]
]
}
```
## v0.0.8 (2016-11-16)
### :nail_care: Polish
* Only print the debug info once ([#46](https://github.com/babel/babel-preset-env/pull/46) (Henry Zhu)
When using the `debug` option it was printing the data for each file processed rather than once.
```js
{
"presets": [
["env", {
"debug": true
}]
]
}
```
## v0.0.7 (2016-11-02)
### :rocket: New Feature
* hardcode a current node version option ([#35](https://github.com/babel/babel-preset-env/pull/35)) (Henry Zhu)
```js
{
"presets": [
["env", {
"targets": {
"node": "current" // parseFloat(process.versions.node)
}
}]
]
}
```
* add 'whitelist' option ([#31](https://github.com/babel/babel-preset-env/pull/31)) (Henry Zhu)
```js
{
"presets": [
["env", {
"targets": {
"chrome": 52
},
"whitelist": ["transform-es2015-arrow-functions"]
}]
]
}
```
* Add more aliases (Henry Zhu)
* Update plugin data: firefox 52 supports async/await! ([#29](https://github.com/babel/babel-preset-env/pull/29)) (Henry Zhu)
### :bug: Bug Fixes
* Use compat-table equals option ([#36](https://github.com/babel/babel-preset-env/pull/36)) (Henry Zhu)
Compute and use `compat-table` equivalents
```js
{
"safari6": "phantom",
"chrome44": "iojs",
"chrome50": "node64",
"chrome51": "node65",
"chrome54": "node7",
"chrome30": "android44",
"chrome37": "android50",
"chrome39": "android51",
"safari7": "ios7",
"safari71_8": "ios8",
"safari9": "ios9",
"safari10": "ios10",
"chrome50": "node6"
}
```
* Change default behavior to act the same as babel-preset-latest ([#33](https://github.com/babel/babel-preset-env/pull/33)) (Henry Zhu)
```js
{ "presets": ["env"] } // should act the same as babel-preset-latest
```
## Internal
* Add fixture helper for tests ([#28](https://github.com/babel/babel-preset-env/pull/28)) (Henry Zhu)

View File

@@ -0,0 +1,93 @@
# Contributing
## Adding a new plugin to support (when approved in the next ECMAScript version)
### Update [`plugin-features.js`](https://github.com/babel/babel-preset-env/blob/master/data/plugin-features.js)
*Example:*
If you were going to add `**` which is in ES2016:
Find the relevant entries on [compat-table](https://kangax.github.io/compat-table/es2016plus/#test-exponentiation_(**)_operator):
`exponentiation (**) operator`
Find the corresponding babel plugin:
`transform-exponentiation-operator`
And add them in this structure:
```js
// es2016
"@babel/transform-exponentiation-operator": {
features: [
"exponentiation (**) operator",
],
},
```
### Update [`built-in-features.js`](https://github.com/babel/babel-preset-env/blob/master/data/built-in-features.js)
*Example:*
In case you want to add `Object.values` which is in ES2017:
Find the relevant feature and subfeature on [compat-table](https://kangax.github.io/compat-table/es2016plus/#test-Object_static_methods_Object.values)
and split it with `/`:
`Object static methods / Object.values`
Find the corresponding module on [core-js](https://github.com/zloirock/core-js/tree/master/modules):
`es7.object.values.js`
Find required ES version in [`built-in-features.js`](https://github.com/babel/babel-preset-env/blob/master/data/built-in-features.js) and add the new feature:
```js
const es2017 = {
//...
"es7.object.values": "Object static methods / Object.values"
}
```
### Update [`plugins.json`](https://github.com/babel/babel-preset-env/blob/master/data/plugins.json)
Until `compat-table` is a standalone npm module for data we are using the git url
`"compat-table": "kangax/compat-table#[latest-commit-hash]"`,
So we update and then run `npm run build-data`. If there are no changes, then `plugins.json` will be the same.
## Tests
### Running tests locally
```bash
npm test
```
### Checking code coverage locally
```bash
npm run coverage
```
### Writing tests
#### General
All the tests for `babel-preset-env` exist in the `test/fixtures` folder. The
test setup and conventions are exactly the same as testing a Babel plugin, so
please read our [documentation on writing tests](https://github.com/babel/babel/blob/master/CONTRIBUTING.md#babel-plugin-x).
#### Testing the `debug` option
Testing debug output to `stdout` is similar. Under the `test/debug-fixtures`,
create a folder with a descriptive name of your test, and add the following:
* Add a `options.json` file (just as the other tests, this is essentially a
`.babelrc`) with the desired test configuration (required)
* Add a `stdout.txt` file with the expected debug output. For added
convenience, if there is no `stdout.txt` present, the test runner will
generate one for you.

View File

@@ -0,0 +1,572 @@
# @babel/preset-env [![npm](https://img.shields.io/npm/v/babel-preset-env.svg)](https://www.npmjs.com/package/babel-preset-env) [![travis](https://img.shields.io/travis/babel/babel-preset-env/master.svg)](https://travis-ci.org/babel/babel-preset-env) [![npm-downloads](https://img.shields.io/npm/dm/babel-preset-env.svg)](https://www.npmjs.com/package/babel-preset-env) [![codecov](https://img.shields.io/codecov/c/github/babel/babel-preset-env/master.svg?maxAge=43200)](https://codecov.io/github/babel/babel-preset-env)
> A Babel preset that compiles [ES2015+](https://github.com/tc39/proposals/blob/master/finished-proposals.md) down to ES5 by automatically determining the Babel plugins and polyfills you need based on your targeted browser or runtime environments.
```sh
npm install @babel/preset-env --save-dev
```
Without any configuration options, @babel/preset-env behaves exactly the same as @babel/preset-latest (or @babel/preset-es2015, @babel/preset-es2016, and @babel/preset-es2017 together).
```json
{
"presets": ["@babel/env"]
}
```
You can also configure it to only include the polyfills and transforms needed for the browsers you support. Compiling only what's needed can make your bundles smaller and your life easier.
This example only includes the polyfills and code transforms needed for the last two versions of each browser, and versions of Safari greater than or equal to 7. We use [browserslist](https://github.com/ai/browserslist) to parse this information, so you can use [any valid query format supported by browserslist](https://github.com/ai/browserslist#queries).
```json
{
"presets": [
["@babel/env", {
"targets": {
"browsers": ["last 2 versions", "safari >= 7"]
}
}]
]
}
```
Similarly, if you're targeting Node.js instead of the browser, you can configure babel-preset-env to only include the polyfills and transforms necessary for a particular version:
```json
{
"presets": [
["@babel/env", {
"targets": {
"node": "6.10"
}
}]
]
}
```
For convenience, you can use `"node": "current"` to only include the necessary polyfills and transforms for the Node.js version that you use to run Babel:
```json
{
"presets": [
["@babel/env", {
"targets": {
"node": "current"
}
}]
]
}
```
- [How it Works](#how-it-works)
- [Install](#install)
- [Usage](#usage)
- [Options](#options)
- [Examples](#examples)
- [Issues](#issues)
## How it Works
### Determine environment support for ECMAScript features
Use external data such as [`compat-table`](https://github.com/kangax/compat-table) to determine browser support. (We should create PRs there when necessary)
![](https://cloud.githubusercontent.com/assets/588473/19214029/58deebce-8d48-11e6-9004-ee3fbcb75d8b.png)
We can periodically run [build-data.js](https://github.com/babel/babel-preset-env/blob/master/scripts/build-data.js) which generates [plugins.json](https://github.com/babel/babel-preset-env/blob/master/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/babel-preset-env/blob/master/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).
### Support all plugins in Babel that are considered `latest`
> Default behavior without options is the same as `@babel/preset-latest`.
It won't include `stage-x` plugins. env will support all plugins in what we consider the latest version of JavaScript (by matching what we do in [`@babel/preset-latest`](http://babeljs.io/docs/plugins/preset-latest/)).
Ref: [#14](https://github.com/babel/babel-preset-env/issues/14)
### Determine the lowest common denominator of plugins to be included in the preset
If you are targeting IE 8 and Chrome 55 it will include all plugins required by IE 8 since you would need to support both still.
### Support a target option `"node": "current"` to compile for the currently running node version.
For example, if you are building on Node 6, arrow functions won't be converted, but they will if you build on Node 0.12.
### Support a `browsers` option like autoprefixer.
Use [browserslist](https://github.com/ai/browserslist) to declare supported environments by performing queries like `> 1%, last 2 versions`.
Ref: [#19](https://github.com/babel/babel-preset-env/pull/19)
### Browserslist support.
[Browserslist](https://github.com/ai/browserslist) is a library used to share a supported list of browsers between different front-end tools like [autoprefixer](https://github.com/postcss/autoprefixer), [stylelint](https://stylelint.io/), [eslint-plugin-compat](https://github.com/amilajack/eslint-plugin-compat) and many others.
By default, @babel/preset-env will use [browserslist config sources](https://github.com/ai/browserslist#queries).
For example, to enable only the polyfills and plugins needed for a project targeting *last 2 versions* and *IE10*:
**.babelrc**
```json
{
"presets": [
["@babel/env", {
"useBuiltIns": "entry"
}]
]
}
```
**browserslist**
```
Last 2 versions
IE 10
```
or
**package.json**
```
"browserslist": "last 2 versions, ie 10"
```
Browserslist config will be ignored if: 1) `targets.browsers` was specified 2) or with `ignoreBrowserslistConfig: true` option ([see more](#ignoreBrowserslistConfig)):
#### Targets merging.
1. If [targets.browsers](#targetsbrowsers) is defined - the browserslist config will be ignored. The browsers specified in `targets` will be merged with [any other explicitly defined targets](#targets). If merged, targets defined explicitly will override the same targets received from `targets.browsers`.
2. If [targets.browsers](#targetsbrowsers) is _not_ defined - the program will search browserslist file or `package.json` with `browserslist` field. The search will start from the working directory of the process or from the path specified by the `configPath` option, and go up to the system root. If both a browserslist file and configuration inside a `package.json` are found, an exception will be thrown.
3. If a browserslist config was found and other targets are defined (but not [targets.browsers](#targetsbrowsers)), the targets will be merged in the same way as `targets` defined explicitly with `targets.browsers`.
## Install
With [npm](https://www.npmjs.com):
```sh
npm install --save-dev @babel/preset-env
```
Or [yarn](https://yarnpkg.com):
```sh
yarn add @babel/preset-env --dev
```
## Usage
The default behavior without options runs all transforms (behaves the same as [@babel/preset-latest](https://babeljs.io/docs/plugins/preset-latest/)).
```json
{
"presets": ["@babel/env"]
}
```
## Options
For more information on setting options for a preset, refer to the [plugin/preset options](http://babeljs.io/docs/plugins/#plugin-preset-options) documentation.
### `targets`
`{ [string]: number | string }`, defaults to `{}`.
Takes an object of environment versions to support.
Each target environment takes a number or a string (we recommend using a string when specifying minor versions like `node: "6.10"`).
Example environments: `chrome`, `opera`, `edge`, `firefox`, `safari`, `ie`, `ios`, `android`, `node`, `electron`.
The [data](https://github.com/babel/babel-preset-env/blob/master/data/plugins.json) for this is generated by running the [build-data script](https://github.com/babel/babel-preset-env/blob/master/scripts/build-data.js) which pulls in data from [compat-table](https://kangax.github.io/compat-table).
### `targets.node`
`number | string | "current" | true`
If you want to compile against the current node version, you can specify `"node": true` or `"node": "current"`, which would be the same as `"node": process.versions.node`.
### `targets.browsers`
`Array<string> | string`
A query to select browsers (ex: last 2 versions, > 5%) using [browserslist](https://github.com/ai/browserslist).
Note, browsers' results are overridden by explicit items from `targets`.
### `spec`
`boolean`, defaults to `false`.
Enable more spec compliant, but potentially slower, transformations for any plugins in this preset that support them.
### `loose`
`boolean`, defaults to `false`.
Enable "loose" transformations for any plugins in this preset that allow them.
### `modules`
`"amd" | "umd" | "systemjs" | "commonjs" | false`, defaults to `"commonjs"`.
Enable transformation of ES6 module syntax to another module type.
Setting this to `false` will not transform modules.
### `debug`
`boolean`, defaults to `false`.
Outputs the targets/plugins used and the version specified in [plugin data version](https://github.com/babel/babel-preset-env/blob/master/data/plugins.json) to `console.log`.
### `include`
`Array<string>`, defaults to `[]`.
An array of plugins to always include.
Valid options include any:
- [Babel plugins](https://github.com/babel/babel-preset-env/blob/master/data/plugin-features.js) - both with (`@babel/plugin-transform-spread`) and without prefix (`transform-spread`) are supported.
- [Built-ins](https://github.com/babel/babel-preset-env/blob/master/data/built-in-features.js), such as `map`, `set`, or `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 `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/babel-preset-env/blob/master/data/plugin-features.js); so, for example, including `proposal-do-expressions` or excluding `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`
`Array<string>`, defaults to `[]`.
An array of plugins to always exclude/remove.
The possible options are the same as the `include` option.
This option is useful for "blacklisting" a transform like `transform-regenerator` if you don't use generators and don't want to include `regeneratorRuntime` (when using `useBuiltIns`) or for using another plugin like [fast-async](https://github.com/MatAtBread/fast-async) instead of [Babel's async-to-gen](http://babeljs.io/docs/plugins/proposal-async-generator-functions/).
### `useBuiltIns`
`"usage"` | `"entry"` | `false`, defaults to `false`.
A way to apply `@babel/preset-env` for polyfills (via `@babel/polyfill`).
```sh
npm install @babel/polyfill --save
```
#### `useBuiltIns: 'usage'`
Adds specific imports for polyfills when they are used in each file. We take advantage of the fact that a bundler will load the same polyfill only once.
**In**
a.js
```js
var a = new Promise();
```
b.js
```js
var b = new Map();
```
**Out (if environment doesn't support it)**
```js
import "@babel/polyfill/core-js/modules/es6.promise";
var a = new Promise();
```
```js
import "@babel/polyfill/core-js/modules/es6.map";
var b = new Map();
```
**Out (if environment supports it)**
```js
var a = new Promise();
```
```js
var b = new Map();
```
#### `useBuiltIns: 'entry'`
> NOTE: Only use `require("@babel/polyfill");` once in your whole app.
> Multiple imports or requires of `@babel/polyfill` will throw an error since it can cause global collisions and other issues that are hard to trace.
> We recommend creating a single entry file that only contains the `require` statement.
This option enables a new plugin that replaces the statement `import "@babel/polyfill"` or `require("@babel/polyfill")` with individual requires for `@babel/polyfill` based on environment.
**In**
```js
import "@babel/polyfill";
```
**Out (different based on environment)**
```js
import "@babel/polyfill/core-js/modules/es7.string.pad-start";
import "@babel/polyfill/core-js/modules/es7.string.pad-end";
```
#### `useBuiltIns: false`
Don't add polyfills automatically per file, or transform `import "@babel/polyfill"` to individual polyfills.
### `forceAllTransforms`
`boolean`, defaults to `false`.
<p><details>
<summary><b>Example</b></summary>
With Babel 7's .babelrc.js support, you can force all transforms to be run if env is set to `production`.
```js
module.exports = {
presets: [
["@babel/env", {
targets: {
chrome: 59,
edge: 13,
firefox: 50,
},
// for uglifyjs...
forceAllTransforms: process.env === "production"
}],
],
};
```
</details></p>
> NOTE: `targets.uglify` is deprecated and will be removed in the next major in
favor of this.
By default, this preset will run all the transforms needed for the targeted
environment(s). Enable this option if you want to force running _all_
transforms, which is useful if the output will be run through UglifyJS or an
environment that only supports ES5.
> NOTE: Uglify has a work-in-progress "Harmony" branch to address the lack of
ES6 support, but it is not yet stable. You can follow its progress in
[UglifyJS2 issue #448](https://github.com/mishoo/UglifyJS2/issues/448). If you
require an alternative minifier which _does_ support ES6 syntax, we recommend
using [babel-minify](https://github.com/babel/minify).
### `configPath`
`string`, defaults to `process.cwd()`
The starting point where the config search for browserslist will start, and ascend to the system root until found.
### `ignoreBrowserslistConfig`
`boolean`, defaults to `false`
Toggles whether or not [browserslist config sources](https://github.com/ai/browserslist#queries) are used, which includes searching for any browserslist files or referencing the browserslist key inside package.json. This is useful for projects that use a browserslist config for files that won't be compiled with Babel.
### `shippedProposals`
`boolean`, defaults to `false`
Toggles enabling support for builtin/feature proposals that have shipped in browsers. If your target environments have native support for a feature proposal, its matching parser syntax plugin is enabled instead of performing any transform. Note that this _does not_ enable the same transformations as [`@babel/preset-stage3`](https://babeljs.io/docs/plugins/preset-stage-3/), since proposals can continue to change before landing in browsers.
The following are currently supported:
**Builtins**
- [Promise.prototype.finally](https://github.com/tc39/proposal-promise-finally)
**Features**
- [Asynchronous Iterators](https://github.com/tc39/proposal-async-iteration)
- [Object rest/spread properties](https://github.com/tc39/proposal-object-rest-spread)
- [Optional catch binding](https://github.com/tc39/proposal-optional-catch-binding)
- [Unicode property escapes in regular expressions](https://github.com/tc39/proposal-regexp-unicode-property-escapes)
---
## Examples
### Export with various targets
```js
export class A {}
```
#### Target only Chrome 52
**.babelrc**
```json
{
"presets": [
["@babel/env", {
"targets": {
"chrome": 52
}
}]
]
}
```
**Out**
```js
class A {}
exports.A = A;
```
#### Target Chrome 52 with webpack 2/rollup and loose mode
**.babelrc**
```json
{
"presets": [
["@babel/env", {
"targets": {
"chrome": 52
},
"modules": false,
"loose": true
}]
]
}
```
**Out**
```js
export class A {}
```
#### Target specific browsers via browserslist
**.babelrc**
```json
{
"presets": [
["@babel/env", {
"targets": {
"chrome": 52,
"browsers": ["last 2 versions", "safari 7"]
}
}]
]
}
```
**Out**
```js
export var A = function A() {
_classCallCheck(this, A);
};
```
#### Target latest node via `node: true` or `node: "current"`
**.babelrc**
```json
{
"presets": [
["@babel/env", {
"targets": {
"node": "current"
}
}]
]
}
```
**Out**
```js
class A {}
exports.A = A;
```
### Show debug output
**.babelrc**
```json
{
"presets": [
["@babel/env", {
"targets": {
"safari": 10
},
"modules": false,
"useBuiltIns": "entry",
"debug": true
}]
]
}
```
**stdout**
```sh
Using targets:
{
"safari": 10
}
Modules transform: false
Using plugins:
transform-exponentiation-operator {}
transform-async-to-generator {}
Using polyfills:
es7.object.values {}
es7.object.entries {}
es7.object.get-own-property-descriptors {}
web.timers {}
web.immediate {}
web.dom.iterable {}
```
### Include and exclude specific plugins/built-ins
> always include arrow functions, explicitly exclude generators
```json
{
"presets": [
["@babel/env", {
"targets": {
"browsers": ["last 2 versions", "safari >= 7"]
},
"include": ["@babel/transform-arrow-functions", "es6.map"],
"exclude": ["@babel/transform-regenerator", "es6.set"]
}]
]
}
```
## Issues
If you get a `SyntaxError: Unexpected token ...` error when using the [object-rest-spread](https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-object-rest-spread) transform then make sure the plugin has been updated to, at least, `v6.19.0`.

View File

@@ -0,0 +1,206 @@
const typedArrayMethods = [
"typed arrays / %TypedArray%.from",
"typed arrays / %TypedArray%.of",
"typed arrays / %TypedArray%.prototype.subarray",
"typed arrays / %TypedArray%.prototype.join",
"typed arrays / %TypedArray%.prototype.indexOf",
"typed arrays / %TypedArray%.prototype.lastIndexOf",
"typed arrays / %TypedArray%.prototype.slice",
"typed arrays / %TypedArray%.prototype.every",
"typed arrays / %TypedArray%.prototype.filter",
"typed arrays / %TypedArray%.prototype.forEach",
"typed arrays / %TypedArray%.prototype.map",
"typed arrays / %TypedArray%.prototype.reduce",
"typed arrays / %TypedArray%.prototype.reduceRight",
"typed arrays / %TypedArray%.prototype.reverse",
"typed arrays / %TypedArray%.prototype.some",
"typed arrays / %TypedArray%.prototype.sort",
"typed arrays / %TypedArray%.prototype.copyWithin",
"typed arrays / %TypedArray%.prototype.find",
"typed arrays / %TypedArray%.prototype.findIndex",
"typed arrays / %TypedArray%.prototype.fill",
"typed arrays / %TypedArray%.prototype.keys",
"typed arrays / %TypedArray%.prototype.values",
"typed arrays / %TypedArray%.prototype.entries",
"typed arrays / %TypedArray%.prototype[Symbol.iterator]",
"typed arrays / %TypedArray%[Symbol.species]",
];
const es2015 = {
"es6.typed.array-buffer": "typed arrays / ArrayBuffer[Symbol.species]",
"es6.typed.data-view": "typed arrays / DataView",
"es6.typed.int8-array": {
features: ["typed arrays / Int8Array"].concat(typedArrayMethods)
},
"es6.typed.uint8-array": {
features: ["typed arrays / Uint8Array"].concat(typedArrayMethods)
},
"es6.typed.uint8-clamped-array": {
features: ["typed arrays / Uint8ClampedArray"].concat(typedArrayMethods)
},
"es6.typed.int16-array": {
features: ["typed arrays / Int16Array"].concat(typedArrayMethods)
},
"es6.typed.uint16-array": {
features: ["typed arrays / Uint16Array"].concat(typedArrayMethods)
},
"es6.typed.int32-array": {
features: ["typed arrays / Int32Array"].concat(typedArrayMethods)
},
"es6.typed.uint32-array": {
features: ["typed arrays / Uint32Array"].concat(typedArrayMethods)
},
"es6.typed.float32-array": {
features: ["typed arrays / Float32Array"].concat(typedArrayMethods)
},
"es6.typed.float64-array": {
features: ["typed arrays / Float64Array"].concat(typedArrayMethods)
},
"es6.map": "Map",
"es6.set": "Set",
"es6.weak-map": "WeakMap",
"es6.weak-set": "WeakSet",
// Proxy not implementable
"es6.reflect.apply": "Reflect / Reflect.apply",
"es6.reflect.construct": "Reflect / Reflect.construct",
"es6.reflect.define-property": "Reflect / Reflect.defineProperty",
"es6.reflect.delete-property": "Reflect / Reflect.deleteProperty",
"es6.reflect.get": "Reflect / Reflect.get",
"es6.reflect.get-own-property-descriptor": "Reflect / Reflect.getOwnPropertyDescriptor",
"es6.reflect.get-prototype-of": "Reflect / Reflect.getPrototypeOf",
"es6.reflect.has": "Reflect / Reflect.has",
"es6.reflect.is-extensible": "Reflect / Reflect.isExtensible",
"es6.reflect.own-keys": "Reflect / Reflect.ownKeys",
"es6.reflect.prevent-extensions": "Reflect / Reflect.preventExtensions",
"es6.reflect.set": "Reflect / Reflect.set",
"es6.reflect.set-prototype-of": "Reflect / Reflect.setPrototypeOf",
"es6.promise": {
features: [
"Promise / basic functionality",
"Promise / constructor requires new",
"Promise / Promise.prototype isn\'t an instance",
"Promise / Promise.all",
"Promise / Promise.all, generic iterables",
"Promise / Promise.race",
"Promise / Promise.race, generic iterables",
"Promise / Promise[Symbol.species]"
]
},
"es6.symbol": {
features: [
"Symbol",
"Object static methods / Object.getOwnPropertySymbols",
"well-known symbols / Symbol.hasInstance",
"well-known symbols / Symbol.isConcatSpreadable",
"well-known symbols / Symbol.iterator",
"well-known symbols / Symbol.match",
"well-known symbols / Symbol.replace",
"well-known symbols / Symbol.search",
"well-known symbols / Symbol.species",
"well-known symbols / Symbol.split",
"well-known symbols / Symbol.toPrimitive",
"well-known symbols / Symbol.toStringTag",
"well-known symbols / Symbol.unscopables",
]
},
"es6.object.freeze": "Object static methods accept primitives / Object.freeze",
"es6.object.seal": "Object static methods accept primitives / Object.seal",
"es6.object.prevent-extensions": "Object static methods accept primitives / Object.preventExtensions",
"es6.object.is-frozen": "Object static methods accept primitives / Object.isFrozen",
"es6.object.is-sealed": "Object static methods accept primitives / Object.isSealed",
"es6.object.is-extensible": "Object static methods accept primitives / Object.isExtensible",
"es6.object.get-own-property-descriptor":
"Object static methods accept primitives / Object.getOwnPropertyDescriptor",
"es6.object.get-prototype-of": "Object static methods accept primitives / Object.getPrototypeOf",
"es6.object.keys": "Object static methods accept primitives / Object.keys",
"es6.object.get-own-property-names": "Object static methods accept primitives / Object.getOwnPropertyNames",
"es6.object.assign": "Object static methods / Object.assign",
"es6.object.is": "Object static methods / Object.is",
"es6.object.set-prototype-of": "Object static methods / Object.setPrototypeOf",
"es6.function.name": "function \"name\" property",
"es6.string.raw": "String static methods / String.raw",
"es6.string.from-code-point": "String static methods / String.fromCodePoint",
"es6.string.code-point-at": "String.prototype methods / String.prototype.codePointAt",
// "String.prototype methods / String.prototype.normalize" not implemented
"es6.string.repeat": "String.prototype methods / String.prototype.repeat",
"es6.string.starts-with": "String.prototype methods / String.prototype.startsWith",
"es6.string.ends-with": "String.prototype methods / String.prototype.endsWith",
"es6.string.includes": "String.prototype methods / String.prototype.includes",
"es6.regexp.flags": "RegExp.prototype properties / RegExp.prototype.flags",
"es6.regexp.match": "RegExp.prototype properties / RegExp.prototype[Symbol.match]",
"es6.regexp.replace": "RegExp.prototype properties / RegExp.prototype[Symbol.replace]",
"es6.regexp.split": "RegExp.prototype properties / RegExp.prototype[Symbol.split]",
"es6.regexp.search": "RegExp.prototype properties / RegExp.prototype[Symbol.search]",
"es6.array.from": "Array static methods / Array.from",
"es6.array.of": "Array static methods / Array.of",
"es6.array.copy-within": "Array.prototype methods / Array.prototype.copyWithin",
"es6.array.find": "Array.prototype methods / Array.prototype.find",
"es6.array.find-index": "Array.prototype methods / Array.prototype.findIndex",
"es6.array.fill": "Array.prototype methods / Array.prototype.fill",
"es6.array.iterator": {
features: [
"Array.prototype methods / Array.prototype.keys",
// can use Symbol.iterator, not implemented in many environments
// "Array.prototype methods / Array.prototype.values",
"Array.prototype methods / Array.prototype.entries",
]
},
"es6.number.is-finite": "Number properties / Number.isFinite",
"es6.number.is-integer": "Number properties / Number.isInteger",
"es6.number.is-safe-integer": "Number properties / Number.isSafeInteger",
"es6.number.is-nan": "Number properties / Number.isNaN",
"es6.number.epsilon": "Number properties / Number.EPSILON",
"es6.number.min-safe-integer": "Number properties / Number.MIN_SAFE_INTEGER",
"es6.number.max-safe-integer": "Number properties / Number.MAX_SAFE_INTEGER",
"es6.number.parse-float": "Number properties / Number.parseFloat",
"es6.number.parse-int": "Number properties / Number.parseInt",
"es6.math.acosh": "Math methods / Math.acosh",
"es6.math.asinh": "Math methods / Math.asinh",
"es6.math.atanh": "Math methods / Math.atanh",
"es6.math.cbrt": "Math methods / Math.cbrt",
"es6.math.clz32": "Math methods / Math.clz32",
"es6.math.cosh": "Math methods / Math.cosh",
"es6.math.expm1": "Math methods / Math.expm1",
"es6.math.fround": "Math methods / Math.fround",
"es6.math.hypot": "Math methods / Math.hypot",
"es6.math.imul": "Math methods / Math.imul",
"es6.math.log1p": "Math methods / Math.log1p",
"es6.math.log10": "Math methods / Math.log10",
"es6.math.log2": "Math methods / Math.log2",
"es6.math.sign": "Math methods / Math.sign",
"es6.math.sinh": "Math methods / Math.sinh",
"es6.math.tanh": "Math methods / Math.tanh",
"es6.math.trunc": "Math methods / Math.trunc",
};
const es2016 = {
"es7.array.includes": "Array.prototype.includes",
};
const es2017 = {
"es7.object.values": "Object static methods / Object.values",
"es7.object.entries": "Object static methods / Object.entries",
"es7.object.get-own-property-descriptors": "Object static methods / Object.getOwnPropertyDescriptors",
"es7.string.pad-start": "String padding / String.prototype.padStart",
"es7.string.pad-end": "String padding / String.prototype.padEnd",
};
const proposals = require("./shipped-proposals").builtIns;
module.exports = Object.assign({}, es2015, es2016, es2017, proposals);

View File

@@ -0,0 +1,953 @@
{
"es6.typed.array-buffer": {
"chrome": "51",
"edge": "13",
"firefox": "48",
"safari": "10",
"node": "6.5",
"ios": "10",
"opera": "38",
"electron": "1.2"
},
"es6.typed.data-view": {
"chrome": "5",
"opera": "12",
"edge": "12",
"firefox": "15",
"safari": "5.1",
"node": "0.12",
"ie": "10",
"android": "4",
"ios": "6",
"electron": "1.1"
},
"es6.typed.int8-array": {
"chrome": "51",
"edge": "13",
"firefox": "48",
"safari": "10",
"node": "6.5",
"ios": "10",
"opera": "38",
"electron": "1.2"
},
"es6.typed.uint8-array": {
"chrome": "51",
"edge": "13",
"firefox": "48",
"safari": "10",
"node": "6.5",
"ios": "10",
"opera": "38",
"electron": "1.2"
},
"es6.typed.uint8-clamped-array": {
"chrome": "51",
"edge": "13",
"firefox": "48",
"safari": "10",
"node": "6.5",
"ios": "10",
"opera": "38",
"electron": "1.2"
},
"es6.typed.int16-array": {
"chrome": "51",
"edge": "13",
"firefox": "48",
"safari": "10",
"node": "6.5",
"ios": "10",
"opera": "38",
"electron": "1.2"
},
"es6.typed.uint16-array": {
"chrome": "51",
"edge": "13",
"firefox": "48",
"safari": "10",
"node": "6.5",
"ios": "10",
"opera": "38",
"electron": "1.2"
},
"es6.typed.int32-array": {
"chrome": "51",
"edge": "13",
"firefox": "48",
"safari": "10",
"node": "6.5",
"ios": "10",
"opera": "38",
"electron": "1.2"
},
"es6.typed.uint32-array": {
"chrome": "51",
"edge": "13",
"firefox": "48",
"safari": "10",
"node": "6.5",
"ios": "10",
"opera": "38",
"electron": "1.2"
},
"es6.typed.float32-array": {
"chrome": "51",
"edge": "13",
"firefox": "48",
"safari": "10",
"node": "6.5",
"ios": "10",
"opera": "38",
"electron": "1.2"
},
"es6.typed.float64-array": {
"chrome": "51",
"edge": "13",
"firefox": "48",
"safari": "10",
"node": "6.5",
"ios": "10",
"opera": "38",
"electron": "1.2"
},
"es6.map": {
"chrome": "51",
"edge": "15",
"firefox": "53",
"safari": "10",
"node": "6.5",
"ios": "10",
"opera": "38",
"electron": "1.2"
},
"es6.set": {
"chrome": "51",
"edge": "15",
"firefox": "53",
"safari": "10",
"node": "6.5",
"ios": "10",
"opera": "38",
"electron": "1.2"
},
"es6.weak-map": {
"chrome": "51",
"edge": "15",
"firefox": "53",
"safari": "9",
"node": "6.5",
"ios": "9",
"opera": "38",
"electron": "1.2"
},
"es6.weak-set": {
"chrome": "51",
"edge": "15",
"firefox": "53",
"safari": "9",
"node": "6.5",
"ios": "9",
"opera": "38",
"electron": "1.2"
},
"es6.reflect.apply": {
"chrome": "49",
"edge": "12",
"firefox": "42",
"safari": "10",
"node": "6",
"ios": "10",
"opera": "36",
"electron": "1"
},
"es6.reflect.construct": {
"chrome": "49",
"edge": "13",
"firefox": "44",
"safari": "10",
"node": "6",
"ios": "10",
"opera": "36",
"electron": "1"
},
"es6.reflect.define-property": {
"chrome": "49",
"edge": "13",
"firefox": "42",
"safari": "10",
"node": "6",
"ios": "10",
"opera": "36",
"electron": "1"
},
"es6.reflect.delete-property": {
"chrome": "49",
"edge": "12",
"firefox": "42",
"safari": "10",
"node": "6",
"ios": "10",
"opera": "36",
"electron": "1"
},
"es6.reflect.get": {
"chrome": "49",
"edge": "12",
"firefox": "42",
"safari": "10",
"node": "6",
"ios": "10",
"opera": "36",
"electron": "1"
},
"es6.reflect.get-own-property-descriptor": {
"chrome": "49",
"edge": "12",
"firefox": "42",
"safari": "10",
"node": "6",
"ios": "10",
"opera": "36",
"electron": "1"
},
"es6.reflect.get-prototype-of": {
"chrome": "49",
"edge": "12",
"firefox": "42",
"safari": "10",
"node": "6",
"ios": "10",
"opera": "36",
"electron": "1"
},
"es6.reflect.has": {
"chrome": "49",
"edge": "12",
"firefox": "42",
"safari": "10",
"node": "6",
"ios": "10",
"opera": "36",
"electron": "1"
},
"es6.reflect.is-extensible": {
"chrome": "49",
"edge": "12",
"firefox": "42",
"safari": "10",
"node": "6",
"ios": "10",
"opera": "36",
"electron": "1"
},
"es6.reflect.own-keys": {
"chrome": "49",
"edge": "12",
"firefox": "42",
"safari": "10",
"node": "6",
"ios": "10",
"opera": "36",
"electron": "1"
},
"es6.reflect.prevent-extensions": {
"chrome": "49",
"edge": "12",
"firefox": "42",
"safari": "10",
"node": "6",
"ios": "10",
"opera": "36",
"electron": "1"
},
"es6.reflect.set": {
"chrome": "49",
"edge": "12",
"firefox": "42",
"safari": "10",
"node": "6",
"ios": "10",
"opera": "36",
"electron": "1"
},
"es6.reflect.set-prototype-of": {
"chrome": "49",
"edge": "12",
"firefox": "42",
"safari": "10",
"node": "6",
"ios": "10",
"opera": "36",
"electron": "1"
},
"es6.promise": {
"chrome": "51",
"edge": "13",
"firefox": "45",
"safari": "10",
"node": "6.5",
"ios": "10",
"opera": "38",
"electron": "1.2"
},
"es6.symbol": {
"chrome": "51",
"firefox": "51",
"safari": "10",
"node": "6.5",
"ios": "10",
"opera": "38",
"electron": "1.2"
},
"es6.object.freeze": {
"chrome": "44",
"edge": "12",
"firefox": "35",
"safari": "9",
"node": "4",
"ios": "9",
"opera": "31",
"electron": "0.31"
},
"es6.object.seal": {
"chrome": "44",
"edge": "12",
"firefox": "35",
"safari": "9",
"node": "4",
"ios": "9",
"opera": "31",
"electron": "0.31"
},
"es6.object.prevent-extensions": {
"chrome": "44",
"edge": "12",
"firefox": "35",
"safari": "9",
"node": "4",
"ios": "9",
"opera": "31",
"electron": "0.31"
},
"es6.object.is-frozen": {
"chrome": "44",
"edge": "12",
"firefox": "35",
"safari": "9",
"node": "4",
"ios": "9",
"opera": "31",
"electron": "0.31"
},
"es6.object.is-sealed": {
"chrome": "44",
"edge": "12",
"firefox": "35",
"safari": "9",
"node": "4",
"ios": "9",
"opera": "31",
"electron": "0.31"
},
"es6.object.is-extensible": {
"chrome": "44",
"edge": "12",
"firefox": "35",
"safari": "9",
"node": "4",
"ios": "9",
"opera": "31",
"electron": "0.31"
},
"es6.object.get-own-property-descriptor": {
"chrome": "44",
"edge": "12",
"firefox": "35",
"safari": "9",
"node": "4",
"ios": "9",
"opera": "31",
"electron": "0.31"
},
"es6.object.get-prototype-of": {
"chrome": "44",
"edge": "12",
"firefox": "3.5",
"safari": "9",
"node": "4",
"ios": "9",
"opera": "31",
"electron": "0.31"
},
"es6.object.keys": {
"chrome": "40",
"edge": "12",
"firefox": "35",
"safari": "9",
"node": "4",
"ios": "9",
"opera": "27",
"electron": "0.21"
},
"es6.object.get-own-property-names": {
"chrome": "40",
"edge": "12",
"firefox": "33",
"safari": "9",
"node": "4",
"ios": "9",
"opera": "27",
"electron": "0.21"
},
"es6.object.assign": {
"chrome": "45",
"edge": "12",
"firefox": "34",
"safari": "9",
"node": "4",
"ios": "9",
"opera": "32",
"electron": "0.35"
},
"es6.object.is": {
"chrome": "19",
"edge": "12",
"firefox": "22",
"safari": "9",
"node": "0.12",
"android": "4.1",
"ios": "9",
"electron": "0.2"
},
"es6.object.set-prototype-of": {
"chrome": "34",
"edge": "12",
"firefox": "31",
"safari": "9",
"node": "0.12",
"ie": "11",
"ios": "9",
"opera": "21",
"electron": "0.2"
},
"es6.function.name": {
"chrome": "51",
"firefox": "53",
"safari": "10",
"node": "6.5",
"ios": "10",
"opera": "38",
"electron": "1.2"
},
"es6.string.raw": {
"chrome": "41",
"edge": "12",
"firefox": "34",
"safari": "9",
"node": "4",
"ios": "9",
"opera": "28",
"electron": "0.24"
},
"es6.string.from-code-point": {
"chrome": "41",
"edge": "12",
"firefox": "29",
"safari": "9",
"node": "4",
"ios": "9",
"opera": "28",
"electron": "0.24"
},
"es6.string.code-point-at": {
"chrome": "41",
"edge": "12",
"firefox": "29",
"safari": "9",
"node": "4",
"ios": "9",
"opera": "28",
"electron": "0.24"
},
"es6.string.repeat": {
"chrome": "41",
"edge": "12",
"firefox": "24",
"safari": "9",
"node": "4",
"ios": "9",
"opera": "28",
"electron": "0.24"
},
"es6.string.starts-with": {
"chrome": "41",
"edge": "12",
"firefox": "29",
"safari": "9",
"node": "4",
"ios": "9",
"opera": "28",
"electron": "0.24"
},
"es6.string.ends-with": {
"chrome": "41",
"edge": "12",
"firefox": "29",
"safari": "9",
"node": "4",
"ios": "9",
"opera": "28",
"electron": "0.24"
},
"es6.string.includes": {
"chrome": "41",
"edge": "12",
"firefox": "40",
"safari": "9",
"node": "4",
"ios": "9",
"opera": "28",
"electron": "0.24"
},
"es6.regexp.flags": {
"chrome": "49",
"firefox": "37",
"safari": "9",
"node": "6",
"ios": "9",
"opera": "36",
"electron": "1"
},
"es6.regexp.match": {
"chrome": "50",
"firefox": "49",
"safari": "10",
"node": "6",
"ios": "10",
"opera": "37",
"electron": "1.1"
},
"es6.regexp.replace": {
"chrome": "50",
"firefox": "49",
"safari": "10",
"node": "6",
"ios": "10",
"opera": "37",
"electron": "1.1"
},
"es6.regexp.split": {
"chrome": "50",
"firefox": "49",
"safari": "10",
"node": "6",
"ios": "10",
"opera": "37",
"electron": "1.1"
},
"es6.regexp.search": {
"chrome": "50",
"firefox": "49",
"safari": "10",
"node": "6",
"ios": "10",
"opera": "37",
"electron": "1.1"
},
"es6.array.from": {
"chrome": "51",
"edge": "15",
"firefox": "36",
"safari": "10",
"node": "6.5",
"ios": "10",
"opera": "38",
"electron": "1.2"
},
"es6.array.of": {
"chrome": "45",
"edge": "12",
"firefox": "25",
"safari": "9",
"node": "4",
"ios": "9",
"opera": "32",
"electron": "0.35"
},
"es6.array.copy-within": {
"chrome": "45",
"edge": "12",
"firefox": "32",
"safari": "9",
"node": "4",
"ios": "9",
"opera": "32",
"electron": "0.35"
},
"es6.array.find": {
"chrome": "45",
"edge": "12",
"firefox": "25",
"safari": "7.1",
"node": "4",
"ios": "8",
"opera": "32",
"electron": "0.35"
},
"es6.array.find-index": {
"chrome": "45",
"edge": "12",
"firefox": "25",
"safari": "7.1",
"node": "4",
"ios": "8",
"opera": "32",
"electron": "0.35"
},
"es6.array.fill": {
"chrome": "45",
"edge": "12",
"firefox": "31",
"safari": "7.1",
"node": "4",
"ios": "8",
"opera": "32",
"electron": "0.35"
},
"es6.array.iterator": {
"chrome": "38",
"edge": "12",
"firefox": "28",
"safari": "7.1",
"node": "0.12",
"ios": "8",
"opera": "25",
"electron": "0.2"
},
"es6.number.is-finite": {
"chrome": "19",
"edge": "12",
"firefox": "16",
"safari": "9",
"node": "0.12",
"android": "4.1",
"ios": "9",
"electron": "0.2"
},
"es6.number.is-integer": {
"chrome": "34",
"edge": "12",
"firefox": "16",
"safari": "9",
"node": "0.12",
"ios": "9",
"opera": "21",
"electron": "0.2"
},
"es6.number.is-safe-integer": {
"chrome": "34",
"edge": "12",
"firefox": "32",
"safari": "9",
"node": "0.12",
"ios": "9",
"opera": "21",
"electron": "0.2"
},
"es6.number.is-nan": {
"chrome": "19",
"edge": "12",
"firefox": "15",
"safari": "9",
"node": "0.12",
"android": "4.1",
"ios": "9",
"electron": "0.2"
},
"es6.number.epsilon": {
"chrome": "34",
"edge": "12",
"firefox": "25",
"safari": "9",
"node": "0.12",
"ios": "9",
"opera": "21",
"electron": "0.2"
},
"es6.number.min-safe-integer": {
"chrome": "34",
"edge": "12",
"firefox": "31",
"safari": "9",
"node": "0.12",
"ios": "9",
"opera": "21",
"electron": "0.2"
},
"es6.number.max-safe-integer": {
"chrome": "34",
"edge": "12",
"firefox": "31",
"safari": "9",
"node": "0.12",
"ios": "9",
"opera": "21",
"electron": "0.2"
},
"es6.number.parse-float": {
"chrome": "34",
"edge": "12",
"firefox": "25",
"safari": "9",
"node": "0.12",
"ios": "9",
"opera": "21",
"electron": "0.2"
},
"es6.number.parse-int": {
"chrome": "34",
"edge": "12",
"firefox": "25",
"safari": "9",
"node": "0.12",
"ios": "9",
"opera": "21",
"electron": "0.2"
},
"es6.math.acosh": {
"chrome": "38",
"edge": "12",
"firefox": "25",
"safari": "7.1",
"node": "0.12",
"ios": "8",
"opera": "25",
"electron": "0.2"
},
"es6.math.asinh": {
"chrome": "38",
"edge": "12",
"firefox": "25",
"safari": "7.1",
"node": "0.12",
"ios": "8",
"opera": "25",
"electron": "0.2"
},
"es6.math.atanh": {
"chrome": "38",
"edge": "12",
"firefox": "25",
"safari": "7.1",
"node": "0.12",
"ios": "8",
"opera": "25",
"electron": "0.2"
},
"es6.math.cbrt": {
"chrome": "38",
"edge": "12",
"firefox": "25",
"safari": "7.1",
"node": "0.12",
"ios": "8",
"opera": "25",
"electron": "0.2"
},
"es6.math.clz32": {
"chrome": "38",
"edge": "12",
"firefox": "31",
"safari": "9",
"node": "0.12",
"ios": "9",
"opera": "25",
"electron": "0.2"
},
"es6.math.cosh": {
"chrome": "38",
"edge": "12",
"firefox": "25",
"safari": "7.1",
"node": "0.12",
"ios": "8",
"opera": "25",
"electron": "0.2"
},
"es6.math.expm1": {
"chrome": "38",
"edge": "12",
"firefox": "25",
"safari": "7.1",
"node": "0.12",
"ios": "8",
"opera": "25",
"electron": "0.2"
},
"es6.math.fround": {
"chrome": "38",
"edge": "12",
"firefox": "26",
"safari": "7.1",
"node": "0.12",
"ios": "8",
"opera": "25",
"electron": "0.2"
},
"es6.math.hypot": {
"chrome": "38",
"edge": "12",
"firefox": "27",
"safari": "7.1",
"node": "0.12",
"ios": "8",
"opera": "25",
"electron": "0.2"
},
"es6.math.imul": {
"chrome": "30",
"edge": "12",
"firefox": "23",
"safari": "7",
"node": "0.12",
"android": "4.4",
"ios": "7",
"opera": "17",
"electron": "0.2"
},
"es6.math.log1p": {
"chrome": "38",
"edge": "12",
"firefox": "25",
"safari": "7.1",
"node": "0.12",
"ios": "8",
"opera": "25",
"electron": "0.2"
},
"es6.math.log10": {
"chrome": "38",
"edge": "12",
"firefox": "25",
"safari": "7.1",
"node": "0.12",
"ios": "8",
"opera": "25",
"electron": "0.2"
},
"es6.math.log2": {
"chrome": "38",
"edge": "12",
"firefox": "25",
"safari": "7.1",
"node": "0.12",
"ios": "8",
"opera": "25",
"electron": "0.2"
},
"es6.math.sign": {
"chrome": "38",
"edge": "12",
"firefox": "25",
"safari": "9",
"node": "0.12",
"ios": "9",
"opera": "25",
"electron": "0.2"
},
"es6.math.sinh": {
"chrome": "38",
"edge": "12",
"firefox": "25",
"safari": "7.1",
"node": "0.12",
"ios": "8",
"opera": "25",
"electron": "0.2"
},
"es6.math.tanh": {
"chrome": "38",
"edge": "12",
"firefox": "25",
"safari": "7.1",
"node": "0.12",
"ios": "8",
"opera": "25",
"electron": "0.2"
},
"es6.math.trunc": {
"chrome": "38",
"edge": "12",
"firefox": "25",
"safari": "7.1",
"node": "0.12",
"ios": "8",
"opera": "25",
"electron": "0.2"
},
"es7.array.includes": {
"chrome": "47",
"edge": "14",
"firefox": "43",
"safari": "10",
"node": "6",
"ios": "10",
"opera": "34",
"electron": "0.36"
},
"es7.object.values": {
"chrome": "54",
"edge": "14",
"firefox": "47",
"safari": "10.1",
"node": "7",
"ios": "10.3",
"opera": "41",
"electron": "1.5"
},
"es7.object.entries": {
"chrome": "54",
"edge": "14",
"firefox": "47",
"safari": "10.1",
"node": "7",
"ios": "10.3",
"opera": "41",
"electron": "1.5"
},
"es7.object.get-own-property-descriptors": {
"chrome": "54",
"edge": "15",
"firefox": "50",
"safari": "10.1",
"node": "7",
"ios": "10.3",
"opera": "41",
"electron": "1.5"
},
"es7.string.pad-start": {
"chrome": "57",
"edge": "15",
"firefox": "48",
"safari": "10",
"node": "8",
"ios": "10",
"opera": "44",
"electron": "1.7"
},
"es7.string.pad-end": {
"chrome": "57",
"edge": "15",
"firefox": "48",
"safari": "10",
"node": "8",
"ios": "10",
"opera": "44",
"electron": "1.7"
},
"es7.promise.finally": {
"chrome": "63",
"opera": "50"
}
}

View File

@@ -0,0 +1,135 @@
const es2015 = {
"check-constants": {
features: [
"const",
],
},
"transform-arrow-functions": {
features: [
"arrow functions",
],
},
"transform-block-scoped-functions": {
features: [
"block-level function declaration"
],
},
"transform-block-scoping": {
features: [
"const",
"let",
],
},
"transform-classes": {
features: [
"class",
"super",
],
},
"transform-computed-properties": {
features: [
"object literal extensions / computed properties",
],
},
"transform-destructuring": {
features: [
"destructuring, assignment",
"destructuring, declarations",
"destructuring, parameters",
],
},
"transform-duplicate-keys": {
features: [
"miscellaneous / duplicate property names in strict mode",
],
},
"transform-for-of": {
features: [
"for..of loops",
],
},
"transform-function-name": {
features: [
"function \"name\" property",
]
},
"transform-literals": {
features: [
"Unicode code point escapes",
],
},
"transform-object-super": {
features: [
"super",
],
},
"transform-parameters": {
features: [
"default function parameters",
"rest parameters",
],
},
"transform-shorthand-properties": {
features: [
"object literal extensions / shorthand properties",
],
},
"transform-spread": {
features: [
"spread (...) operator",
],
},
"transform-sticky-regex": {
features: [
"RegExp \"y\" and \"u\" flags / \"y\" flag, lastIndex",
"RegExp \"y\" and \"u\" flags / \"y\" flag",
],
},
"transform-template-literals": {
features: [
"template literals",
],
},
"transform-typeof-symbol": {
features: [
"Symbol / typeof support"
],
},
"transform-unicode-regex": {
features: [
"RegExp \"y\" and \"u\" flags / \"u\" flag, case folding",
"RegExp \"y\" and \"u\" flags / \"u\" flag, Unicode code point escapes",
"RegExp \"y\" and \"u\" flags / \"u\" flag",
],
},
"transform-new-target": {
features: [
"new.target",
],
},
"transform-regenerator": {
features: [
"generators",
],
}
};
const es2016 = {
"transform-exponentiation-operator": {
features: [
"exponentiation (**) operator",
],
}
};
const es2017 = {
"transform-async-to-generator": {
features: [
"async functions",
],
},
};
const proposals = require("./shipped-proposals").features;
module.exports = Object.assign({}, es2015, es2016, es2017, proposals);

View File

@@ -0,0 +1,244 @@
{
"check-constants": {
"chrome": "49",
"edge": "14",
"firefox": "51",
"safari": "10",
"node": "6",
"ios": "10",
"opera": "36",
"electron": "1"
},
"transform-arrow-functions": {
"chrome": "47",
"edge": "13",
"firefox": "45",
"safari": "10",
"node": "6",
"ios": "10",
"opera": "34",
"electron": "0.36"
},
"transform-block-scoped-functions": {
"chrome": "41",
"edge": "12",
"firefox": "46",
"safari": "10",
"node": "4",
"ie": "11",
"ios": "10",
"opera": "28",
"electron": "0.24"
},
"transform-block-scoping": {
"chrome": "49",
"edge": "14",
"firefox": "51",
"safari": "10",
"node": "6",
"ios": "10",
"opera": "36",
"electron": "1"
},
"transform-classes": {
"chrome": "46",
"edge": "13",
"firefox": "45",
"safari": "10",
"node": "5",
"ios": "10",
"opera": "33",
"electron": "0.36"
},
"transform-computed-properties": {
"chrome": "44",
"edge": "12",
"firefox": "34",
"safari": "7.1",
"node": "4",
"ios": "8",
"opera": "31",
"electron": "0.31"
},
"transform-destructuring": {
"chrome": "51",
"firefox": "53",
"safari": "10",
"node": "6.5",
"ios": "10",
"opera": "38",
"electron": "1.2"
},
"transform-duplicate-keys": {
"chrome": "42",
"edge": "12",
"firefox": "34",
"safari": "9",
"node": "4",
"ios": "9",
"opera": "29",
"electron": "0.27"
},
"transform-for-of": {
"chrome": "51",
"edge": "15",
"firefox": "53",
"safari": "10",
"node": "6.5",
"ios": "10",
"opera": "38",
"electron": "1.2"
},
"transform-function-name": {
"chrome": "51",
"firefox": "53",
"safari": "10",
"node": "6.5",
"ios": "10",
"opera": "38",
"electron": "1.2"
},
"transform-literals": {
"chrome": "44",
"edge": "12",
"firefox": "53",
"safari": "9",
"node": "4",
"ios": "9",
"opera": "31",
"electron": "0.31"
},
"transform-object-super": {
"chrome": "46",
"edge": "13",
"firefox": "45",
"safari": "10",
"node": "5",
"ios": "10",
"opera": "33",
"electron": "0.36"
},
"transform-parameters": {
"chrome": "49",
"edge": "14",
"firefox": "53",
"safari": "10",
"node": "6",
"ios": "10",
"opera": "36",
"electron": "1"
},
"transform-shorthand-properties": {
"chrome": "43",
"edge": "12",
"firefox": "33",
"safari": "9",
"node": "4",
"ios": "9",
"opera": "30",
"electron": "0.29"
},
"transform-spread": {
"chrome": "46",
"edge": "13",
"firefox": "36",
"safari": "10",
"node": "5",
"ios": "10",
"opera": "33",
"electron": "0.36"
},
"transform-sticky-regex": {
"chrome": "49",
"edge": "13",
"firefox": "3",
"safari": "10",
"node": "6",
"ios": "10",
"opera": "36",
"electron": "1"
},
"transform-template-literals": {
"chrome": "41",
"edge": "13",
"firefox": "34",
"safari": "9",
"node": "4",
"ios": "9",
"opera": "28",
"electron": "0.24"
},
"transform-typeof-symbol": {
"chrome": "38",
"edge": "12",
"firefox": "36",
"safari": "9",
"node": "0.12",
"ios": "9",
"opera": "25",
"electron": "0.2"
},
"transform-unicode-regex": {
"chrome": "50",
"edge": "13",
"firefox": "46",
"safari": "10",
"node": "6",
"ios": "10",
"opera": "37",
"electron": "1.1"
},
"transform-new-target": {
"chrome": "46",
"edge": "14",
"firefox": "41",
"safari": "10",
"node": "5",
"ios": "10",
"opera": "33",
"electron": "0.36"
},
"transform-regenerator": {
"chrome": "50",
"edge": "13",
"firefox": "53",
"safari": "10",
"node": "6",
"ios": "10",
"opera": "37",
"electron": "1.1"
},
"transform-exponentiation-operator": {
"chrome": "52",
"edge": "14",
"firefox": "52",
"safari": "10.1",
"node": "7",
"ios": "10.3",
"opera": "39",
"electron": "1.3"
},
"transform-async-to-generator": {
"chrome": "55",
"edge": "15",
"firefox": "52",
"safari": "10.1",
"node": "7.6",
"ios": "10.3",
"opera": "42",
"electron": "1.6"
},
"proposal-async-generator-functions": {
"chrome": "63",
"firefox": "57",
"opera": "50"
},
"proposal-object-rest-spread": {
"chrome": "60",
"firefox": "55",
"node": "8.3",
"opera": "47"
},
"proposal-optional-catch-binding": {},
"proposal-unicode-property-regex": {}
}

View File

@@ -0,0 +1,22 @@
// These mappings represent the builtin/feature proposals that have been
// shipped by browsers, and are enabled by the `shippedProposals` option.
const builtIns = {
"es7.promise.finally": "Promise.prototype.finally"
};
const features = {
"proposal-async-generator-functions": "Asynchronous Iterators",
"proposal-object-rest-spread": "object rest/spread properties",
"proposal-optional-catch-binding": "optional catch binding",
"proposal-unicode-property-regex": "RegExp Unicode Property Escapes",
};
const pluginSyntaxMap = new Map([
["proposal-async-generator-functions", "syntax-async-generators"],
["proposal-object-rest-spread", "syntax-object-rest-spread"],
["proposal-optional-catch-binding", "syntax-optional-catch-binding"],
["proposal-unicode-property-regex", null],
]);
module.exports = { builtIns, features, pluginSyntaxMap };

View File

@@ -0,0 +1,62 @@
{
"name": "@babel/preset-env",
"version": "7.0.0-beta.5",
"description": "A Babel preset for each environment.",
"author": "Henry Zhu <hi@henryzoo.com>",
"homepage": "https://babeljs.io/",
"license": "MIT",
"repository": "https://github.com/babel/babel/tree/master/experimental/babel-preset-env",
"main": "lib/index.js",
"scripts": {
"build-data": "node ./scripts/build-data.js"
},
"dependencies": {
"@babel/plugin-check-constants": "7.0.0-beta.5",
"@babel/plugin-proposal-async-generator-functions": "7.0.0-beta.5",
"@babel/plugin-proposal-object-rest-spread": "7.0.0-beta.5",
"@babel/plugin-proposal-optional-catch-binding": "7.0.0-beta.5",
"@babel/plugin-proposal-unicode-property-regex": "7.0.0-beta.5",
"@babel/plugin-syntax-async-generators": "7.0.0-beta.5",
"@babel/plugin-syntax-object-rest-spread": "7.0.0-beta.5",
"@babel/plugin-syntax-optional-catch-binding": "7.0.0-beta.5",
"@babel/plugin-transform-arrow-functions": "7.0.0-beta.5",
"@babel/plugin-transform-async-to-generator": "7.0.0-beta.5",
"@babel/plugin-transform-block-scoped-functions": "7.0.0-beta.5",
"@babel/plugin-transform-block-scoping": "7.0.0-beta.5",
"@babel/plugin-transform-classes": "7.0.0-beta.5",
"@babel/plugin-transform-computed-properties": "7.0.0-beta.5",
"@babel/plugin-transform-destructuring": "7.0.0-beta.5",
"@babel/plugin-transform-duplicate-keys": "7.0.0-beta.5",
"@babel/plugin-transform-exponentiation-operator": "7.0.0-beta.5",
"@babel/plugin-transform-for-of": "7.0.0-beta.5",
"@babel/plugin-transform-function-name": "7.0.0-beta.5",
"@babel/plugin-transform-literals": "7.0.0-beta.5",
"@babel/plugin-transform-modules-amd": "7.0.0-beta.5",
"@babel/plugin-transform-modules-commonjs": "7.0.0-beta.5",
"@babel/plugin-transform-modules-systemjs": "7.0.0-beta.5",
"@babel/plugin-transform-modules-umd": "7.0.0-beta.5",
"@babel/plugin-transform-new-target": "7.0.0-beta.5",
"@babel/plugin-transform-object-super": "7.0.0-beta.5",
"@babel/plugin-transform-parameters": "7.0.0-beta.5",
"@babel/plugin-transform-regenerator": "7.0.0-beta.5",
"@babel/plugin-transform-shorthand-properties": "7.0.0-beta.5",
"@babel/plugin-transform-spread": "7.0.0-beta.5",
"@babel/plugin-transform-sticky-regex": "7.0.0-beta.5",
"@babel/plugin-transform-template-literals": "7.0.0-beta.5",
"@babel/plugin-transform-typeof-symbol": "7.0.0-beta.5",
"@babel/plugin-transform-unicode-regex": "7.0.0-beta.5",
"browserslist": "^2.4.0",
"invariant": "^2.2.2",
"semver": "^5.3.0"
},
"peerDependencies": {
"@babel/core": ">=7.0.0-beta.4 <7.0.0-rc.0"
},
"devDependencies": {
"@babel/cli": "7.0.0-beta.5",
"@babel/helper-fixtures": "7.0.0-beta.5",
"@babel/helper-plugin-test-runner": "7.0.0-beta.5",
"compat-table": "kangax/compat-table#957f1ff15972e8fb2892a172f985e9af27bf1c75",
"electron-to-chromium": "^1.3.27"
}
}

View File

@@ -0,0 +1,5 @@
{
"rules": {
"prettier/prettier": ["error", { "trailingComma": "es5" }]
}
}

View File

@@ -0,0 +1,287 @@
"use strict";
const fs = require("fs");
const path = require("path");
const flattenDeep = require("lodash/flattenDeep");
const isEqual = require("lodash/isEqual");
const mapValues = require("lodash/mapValues");
const pickBy = require("lodash/pickBy");
const electronToChromiumVersions = require("electron-to-chromium").versions;
const electronToChromiumKeys = Object.keys(
electronToChromiumVersions
).reverse();
const chromiumToElectronMap = electronToChromiumKeys.reduce((all, electron) => {
all[electronToChromiumVersions[electron]] = +electron;
return all;
}, {});
const chromiumToElectronVersions = Object.keys(chromiumToElectronMap);
const findClosestElectronVersion = targetVersion => {
const chromiumVersionsLength = chromiumToElectronVersions.length;
const maxChromium = +chromiumToElectronVersions[chromiumVersionsLength - 1];
if (targetVersion > maxChromium) return null;
const closestChrome = chromiumToElectronVersions.find(
version => targetVersion <= version
);
return chromiumToElectronMap[closestChrome];
};
const chromiumToElectron = chromium =>
chromiumToElectronMap[chromium] || findClosestElectronVersion(chromium);
const renameTests = (tests, getName, category) =>
tests.map(test =>
Object.assign({}, test, { name: getName(test.name), category })
);
// The following is adapted from compat-table:
// https://github.com/kangax/compat-table/blob/gh-pages/build.js
//
// It parses and interpolates data so environments that "equal" other
// environments (node4 and chrome45), as well as familial relationships (edge
// and ie11) can be handled properly.
const envs = require("compat-table/environments");
const byTestSuite = suite => browser => {
return Array.isArray(browser.test_suites)
? browser.test_suites.indexOf(suite) > -1
: true;
};
const compatSources = [
"es6",
"es2016plus",
"esnext",
].reduce((result, source) => {
const data = require(`compat-table/data-${source}`);
data.browsers = pickBy(envs, byTestSuite(source));
result.push(data);
return result;
}, []);
const interpolateAllResults = (rawBrowsers, tests) => {
const interpolateResults = res => {
let browser;
let prevBrowser;
let result;
let prevResult;
let prevBid;
for (const bid in rawBrowsers) {
// For browsers that are essentially equal to other browsers,
// copy over the results.
browser = rawBrowsers[bid];
if (browser.equals && res[bid] === undefined) {
result = res[browser.equals];
res[bid] =
browser.ignore_flagged && result === "flagged" ? false : result;
// For each browser, check if the previous browser has the same
// browser full name (e.g. Firefox) or family name (e.g. Chakra) as this one.
} else if (
prevBrowser &&
(prevBrowser.full.replace(/,.+$/, "") ===
browser.full.replace(/,.+$/, "") ||
(browser.family !== undefined &&
prevBrowser.family === browser.family))
) {
// For each test, check if the previous browser has a result
// that this browser lacks.
result = res[bid];
prevResult = res[prevBid];
if (prevResult !== undefined && result === undefined) {
res[bid] = prevResult;
}
}
prevBrowser = browser;
prevBid = bid;
}
};
// Now print the results.
tests.forEach(function(t) {
// Calculate the result totals for tests which consist solely of subtests.
if ("subtests" in t) {
t.subtests.forEach(function(e) {
interpolateResults(e.res);
});
} else {
interpolateResults(t.res);
}
});
};
compatSources.forEach(({ browsers, tests }) =>
interpolateAllResults(browsers, tests)
);
// End of compat-table code adaptation
const environments = [
"chrome",
"opera",
"edge",
"firefox",
"safari",
"node",
"ie",
"android",
"ios",
"phantom",
];
const compatibilityTests = flattenDeep(
compatSources.map(data =>
data.tests.map(test => {
return test.subtests
? [
test,
renameTests(
test.subtests,
name => test.name + " / " + name,
test.category
),
]
: test;
})
)
);
const getLowestImplementedVersion = ({ features }, env) => {
const tests = compatibilityTests
.filter(test => {
return (
features.indexOf(test.name) >= 0 ||
// for features === ["DataView"]
// it covers "DataView (Int8)" and "DataView (UInt8)"
(features.length === 1 && test.name.indexOf(features[0]) === 0)
);
})
.reduce((result, test) => {
const isBuiltIn =
test.category === "built-ins" ||
test.category === "built-in extensions";
if (!test.subtests) {
result.push({
name: test.name,
res: test.res,
isBuiltIn,
});
} else {
test.subtests.forEach(subtest =>
result.push({
name: `${test.name}/${subtest.name}`,
res: subtest.res,
isBuiltIn,
})
);
}
return result;
}, []);
const envTests = tests.map(({ res: test, isBuiltIn }, i) => {
// Babel itself doesn't implement the feature correctly,
// don't count against it
// only doing this for built-ins atm
if (!test.babel && isBuiltIn) {
return "-1";
}
return (
Object.keys(test)
.filter(t => t.startsWith(env))
// Babel assumes strict mode
.filter(
test => tests[i].res[test] === true || tests[i].res[test] === "strict"
)
// normalize some keys
.map(test => test.replace("_", "."))
.filter(test => !isNaN(parseFloat(test.replace(env, ""))))
.shift()
);
});
const envFiltered = envTests.filter(t => t);
if (envTests.length > envFiltered.length || envTests.length === 0) {
// envTests.forEach((test, i) => {
// if (!test) {
// // print unsupported features
// if (env === 'node') {
// console.log(`ENV(${env}): ${tests[i].name}`);
// }
// }
// });
return null;
}
return envTests.map(str => Number(str.replace(env, ""))).reduce((a, b) => {
return a < b ? b : a;
});
};
const generateData = (environments, features) => {
return mapValues(features, options => {
if (!options.features) {
options = {
features: [options],
};
}
const plugin = {};
environments.forEach(env => {
const version = getLowestImplementedVersion(options, env);
if (version !== null) {
plugin[env] = version.toString();
}
});
if (plugin.chrome) {
// add opera
if (plugin.chrome >= 28) {
plugin.opera = (plugin.chrome - 13).toString();
} else if (plugin.chrome === 5) {
plugin.opera = "12";
}
// add electron
const electronVersion = chromiumToElectron(plugin.chrome);
if (electronVersion) {
plugin.electron = electronVersion.toString();
}
}
return plugin;
});
};
["plugin", "built-in"].forEach(target => {
const newData = generateData(
environments,
require(`../data/${target}-features`)
);
const dataPath = path.join(__dirname, `../data/${target}s.json`);
if (process.argv[2] === "--check") {
const currentData = require(dataPath);
if (!isEqual(currentData, newData)) {
console.error(
"The newly generated plugin/built-in data does not match the current " +
"files. Re-run `npm run build-data`."
);
process.exit(1);
}
process.exit(0);
}
fs.writeFileSync(dataPath, `${JSON.stringify(newData, null, 2)}\n`);
});

View File

@@ -0,0 +1,111 @@
const fs = require("fs-extra");
const execSync = require("child_process").execSync;
const path = require("path");
const pkg = require("../package.json");
let errorOccurred = false;
const tempFolderPath = path.join(__dirname, "../tmp");
const packPath = path.join(__dirname, `../babel-preset-env-${pkg.version}.tgz`);
try {
console.log("Creating package");
execSync("npm pack");
console.log("Setting up smoke test dependencies");
fs.ensureDirSync(tempFolderPath);
process.chdir(tempFolderPath);
const babelCliVersion = pkg.devDependencies["babel-cli"];
if (!babelCliVersion) {
throw new Error("Could not read version of babel-cli from package.json");
}
fs.writeFileSync(
path.join(tempFolderPath, "package.json"),
`
{
"name": "babel-preset-env-smoke-test",
"private": true,
"version": "1.0.0",
"scripts": {
"build": "babel index.js --out-file index.es6"
},
"dependencies": {
"babel-cli": "${babelCliVersion}",
"babel-preset-env": "${packPath}"
}
}
`
);
execSync("npm install");
console.log("Setting up 'usage' smoke test");
fs.writeFileSync(
path.join(tempFolderPath, ".babelrc"),
`
{
"presets": [
["env", {
modules: false,
useBuiltIns: "usage"
}]
]
}
`
);
fs.writeFileSync(
path.join(tempFolderPath, "index.js"),
`
const foo = new Promise((resolve) => {
resolve(new Map());
});
`
);
console.log("Running 'usage' smoke test");
execSync("npm run build");
console.log("Setting up 'entry' smoke test");
fs.writeFileSync(
path.join(tempFolderPath, ".babelrc"),
`
{
"presets": [
["env", {
modules: false,
useBuiltIns: "entry"
}]
]
}
`
);
fs.writeFileSync(
path.join(tempFolderPath, "index.js"),
`
import "@babel/polyfill";
1 ** 2;
`
);
console.log("Running 'entry' smoke test");
execSync("npm run build");
} catch (e) {
console.log(e);
errorOccurred = true;
}
console.log("Cleaning up");
fs.removeSync(tempFolderPath);
fs.removeSync(packPath);
process.exit(errorOccurred ? 1 : 0);

View File

@@ -0,0 +1,36 @@
export default {
"check-constants": require("@babel/plugin-check-constants"),
"syntax-async-generators": require("@babel/plugin-syntax-async-generators"),
"syntax-object-rest-spread": require("@babel/plugin-syntax-object-rest-spread"),
"syntax-optional-catch-binding": require("@babel/plugin-syntax-optional-catch-binding"),
"transform-async-to-generator": require("@babel/plugin-transform-async-to-generator"),
"proposal-async-generator-functions": require("@babel/plugin-proposal-async-generator-functions"),
"transform-arrow-functions": require("@babel/plugin-transform-arrow-functions"),
"transform-block-scoped-functions": require("@babel/plugin-transform-block-scoped-functions"),
"transform-block-scoping": require("@babel/plugin-transform-block-scoping"),
"transform-classes": require("@babel/plugin-transform-classes"),
"transform-computed-properties": require("@babel/plugin-transform-computed-properties"),
"transform-destructuring": require("@babel/plugin-transform-destructuring"),
"transform-duplicate-keys": require("@babel/plugin-transform-duplicate-keys"),
"transform-for-of": require("@babel/plugin-transform-for-of"),
"transform-function-name": require("@babel/plugin-transform-function-name"),
"transform-literals": require("@babel/plugin-transform-literals"),
"transform-modules-amd": require("@babel/plugin-transform-modules-amd"),
"transform-modules-commonjs": require("@babel/plugin-transform-modules-commonjs"),
"transform-modules-systemjs": require("@babel/plugin-transform-modules-systemjs"),
"transform-modules-umd": require("@babel/plugin-transform-modules-umd"),
"transform-object-super": require("@babel/plugin-transform-object-super"),
"transform-parameters": require("@babel/plugin-transform-parameters"),
"transform-shorthand-properties": require("@babel/plugin-transform-shorthand-properties"),
"transform-spread": require("@babel/plugin-transform-spread"),
"transform-sticky-regex": require("@babel/plugin-transform-sticky-regex"),
"transform-template-literals": require("@babel/plugin-transform-template-literals"),
"transform-typeof-symbol": require("@babel/plugin-transform-typeof-symbol"),
"transform-unicode-regex": require("@babel/plugin-transform-unicode-regex"),
"transform-exponentiation-operator": require("@babel/plugin-transform-exponentiation-operator"),
"transform-new-target": require("@babel/plugin-transform-new-target"),
"proposal-object-rest-spread": require("@babel/plugin-proposal-object-rest-spread"),
"proposal-optional-catch-binding": require("@babel/plugin-proposal-optional-catch-binding"),
"transform-regenerator": require("@babel/plugin-transform-regenerator"),
"proposal-unicode-property-regex": require("@babel/plugin-proposal-unicode-property-regex"),
};

View File

@@ -0,0 +1,109 @@
// TODO: this is the opposite of built-in-features so maybe generate one from the other?
export const definitions = {
builtins: {
DataView: "es6.typed.data-view",
Int8Array: "es6.typed.int8-array",
Uint8Array: "es6.typed.uint8-array",
Uint8ClampedArray: "es6.typed.uint8-clamped-array",
Int16Array: "es6.typed.int16-array",
Uint16Array: "es6.typed.uint16-array",
Int32Array: "es6.typed.int32-array",
Uint32Array: "es6.typed.uint32-array",
Float32Array: "es6.typed.float32-array",
Float64Array: "es6.typed.float64-array",
Map: "es6.map",
Set: "es6.set",
WeakMap: "es6.weak-map",
WeakSet: "es6.weak-set",
Promise: "es6.promise",
Symbol: "es6.symbol",
},
instanceMethods: {
name: ["es6.function.name"],
fromCodePoint: ["es6.string.from-code-point"],
codePointAt: ["es6.string.code-point-at"],
repeat: ["es6.string.repeat"],
startsWith: ["es6.string.starts-with"],
endsWith: ["es6.string.ends-with"],
includes: ["es6.string.includes", "es7.array.includes"],
flags: ["es6.regexp.flags"],
match: ["es6.regexp.match"],
replace: ["es6.regexp.replace"],
split: ["es6.regexp.split"],
search: ["es6.regexp.search"],
copyWithin: ["es6.array.copy-within"],
find: ["es6.array.find"],
findIndex: ["es6.array.find-index"],
fill: ["es6.array.fill"],
padStart: ["es7.string.pad-start"],
padEnd: ["es7.string.pad-end"],
},
staticMethods: {
Array: {
from: "es6.array.from",
of: "es6.array.of",
},
Object: {
assign: "es6.object.assign",
is: "es6.object.is",
getOwnPropertySymbols: "es6.object.get-own-property-symbols",
setPrototypeOf: "es6.object.set-prototype-of",
values: "es7.object.values",
entries: "es7.object.entries",
getOwnPropertyDescriptors: "es7.object.get-own-property-descriptors",
},
Math: {
acosh: "es6.math.acosh",
asinh: "es6.math.asinh",
atanh: "es6.math.atanh",
cbrt: "es6.math.cbrt",
clz32: "es6.math.clz32",
cosh: "es6.math.cosh",
expm1: "es6.math.expm1",
fround: "es6.math.fround",
hypot: "es6.math.hypot",
imul: "es6.math.imul",
log1p: "es6.math.log1p",
log10: "es6.math.log10",
log2: "es6.math.log2",
sign: "es6.math.sign",
sinh: "es6.math.sinh",
tanh: "es6.math.tanh",
trunc: "es6.math.trunc",
},
String: {
raw: "es6.string.raw",
},
Number: {
isFinite: "es6.number.is-finite",
isInteger: "es6.number.is-integer",
isSafeInteger: "es6.number.is-safe-integer",
isNaN: "es6.number.is-nan",
EPSILON: "es6.number.epsilon",
MIN_SAFE_INTEGER: "es6.number.min-safe-integer",
MAX_SAFE_INTEGER: "es6.number.max-safe-integer",
},
Reflect: {
apply: "es6.reflect.apply",
construct: "es6.reflect.construct",
defineProperty: "es6.reflect.define-property",
deleteProperty: "es6.reflect.delete-property",
get: "es6.reflect.get",
getOwnPropertyDescriptor: "es6.reflect.get-own-property-descriptor",
getPrototypeOf: "es6.reflect.get-prototype-of",
has: "es6.reflect.has",
isExtensible: "es6.reflect.is-extensible",
ownKeys: "es6.reflect.own-keys",
preventExtensions: "es6.reflect.prevent-extensions",
set: "es6.reflect.set",
setPrototypeOf: "es6.reflect.set-prototype-of",
},
},
};

View File

@@ -0,0 +1,75 @@
/*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
import semver from "semver";
import { prettifyVersion, semverify } from "./utils";
const wordEnds = size => {
return size > 1 ? "s" : "";
};
export const logMessage = (message, context) => {
const pre = context ? `[${context}] ` : "";
const logStr = ` ${pre}${message}`;
console.log(logStr);
};
export const logPlugin = (plugin, targets, list, context) => {
const envList = list[plugin] || {};
const filteredList = Object.keys(targets).reduce((a, b) => {
if (!envList[b] || semver.lt(targets[b], semverify(envList[b]))) {
a[b] = prettifyVersion(targets[b]);
}
return a;
}, {});
const formattedTargets = JSON.stringify(filteredList)
.replace(/,/g, ", ")
.replace(/^\{"/, '{ "')
.replace(/"\}$/, '" }');
logMessage(`${plugin} ${formattedTargets}`, context);
};
export const logEntryPolyfills = (
importPolyfillIncluded,
polyfills,
filename,
onDebug,
) => {
if (!importPolyfillIncluded) {
console.log(
`
[${filename}] \`import '@babel/polyfill'\` was not found.`,
);
return;
}
if (!polyfills.size) {
console.log(
`
[${filename}] Based on your targets, none were added.`,
);
return;
}
console.log(
`
[${filename}] Replaced \`@babel/polyfill\` with the following polyfill${wordEnds(
polyfills.size,
)}:`,
);
onDebug(polyfills);
};
export const logUsagePolyfills = (polyfills, filename, onDebug) => {
if (!polyfills.size) {
console.log(
`
[${filename}] Based on your code and targets, none were added.`,
);
return;
}
console.log(
`
[${filename}] Added following polyfill${wordEnds(polyfills.size)}:`,
);
onDebug(polyfills);
};

View File

@@ -0,0 +1,5 @@
export const defaultWebIncludes = [
"web.timers",
"web.immediate",
"web.dom.iterable",
];

View File

@@ -0,0 +1,272 @@
//@flow
import semver from "semver";
import builtInsList from "../data/built-ins.json";
import { logPlugin } from "./debug";
import { defaultWebIncludes } from "./default-includes";
import moduleTransformations from "./module-transformations";
import normalizeOptions from "./normalize-options.js";
import pluginList from "../data/plugins.json";
import {
builtIns as proposalBuiltIns,
features as proposalPlugins,
pluginSyntaxMap,
} from "../data/shipped-proposals.js";
import useBuiltInsEntryPlugin from "./use-built-ins-entry-plugin";
import addUsedBuiltInsPlugin from "./use-built-ins-plugin";
import getTargets from "./targets-parser";
import availablePlugins from "./available-plugins";
import { filterStageFromList, prettifyTargets, semverify } from "./utils";
import type { Plugin, Targets } from "./types";
const getPlugin = (pluginName: string) => {
const plugin = availablePlugins[pluginName];
if (!plugin) {
throw new Error(
`Could not find plugin "${pluginName}". Ensure there is an entry in ./available-plugins.js for it.`,
);
}
return plugin;
};
const builtInsListWithoutProposals = filterStageFromList(
builtInsList,
proposalBuiltIns,
);
const pluginListWithoutProposals = filterStageFromList(
pluginList,
proposalPlugins,
);
export const isPluginRequired = (
supportedEnvironments: Targets,
plugin: Targets,
): boolean => {
const targetEnvironments: Array<string> = Object.keys(supportedEnvironments);
if (targetEnvironments.length === 0) {
return true;
}
const isRequiredForEnvironments: Array<
string,
> = targetEnvironments.filter(environment => {
// Feature is not implemented in that environment
if (!plugin[environment]) {
return true;
}
const lowestImplementedVersion: string = plugin[environment];
const lowestTargetedVersion: string = supportedEnvironments[environment];
if (!semver.valid(lowestTargetedVersion)) {
throw new Error(
// eslint-disable-next-line max-len
`Invalid version passed for target "${environment}": "${lowestTargetedVersion}". Versions must be in semver format (major.minor.patch)`,
);
}
return semver.gt(
semverify(lowestImplementedVersion),
lowestTargetedVersion,
);
});
return isRequiredForEnvironments.length > 0;
};
let hasBeenLogged = false;
const getBuiltInTargets = targets => {
const builtInTargets = Object.assign({}, targets);
if (builtInTargets.uglify != null) {
delete builtInTargets.uglify;
}
return builtInTargets;
};
export const transformIncludesAndExcludes = (opts: Array<string>): Object => {
return opts.reduce(
(result, opt) => {
const target = opt.match(/^(es\d+|web)\./) ? "builtIns" : "plugins";
result[target].add(opt);
return result;
},
{
all: opts,
plugins: new Set(),
builtIns: new Set(),
},
);
};
const getPlatformSpecificDefaultFor = (targets: Targets): ?Array<string> => {
const targetNames = Object.keys(targets);
const isAnyTarget = !targetNames.length;
const isWebTarget = targetNames.some(name => name !== "node");
return isAnyTarget || isWebTarget ? defaultWebIncludes : null;
};
const filterItems = (
list,
includes,
excludes,
targets,
defaultItems,
): Set<string> => {
const result = new Set();
for (const item in list) {
const excluded = excludes.has(item);
if (!excluded) {
if (isPluginRequired(targets, list[item])) {
result.add(item);
} else {
const shippedProposalsSyntax = pluginSyntaxMap.get(item);
if (shippedProposalsSyntax) {
result.add(shippedProposalsSyntax);
}
}
}
}
if (defaultItems) {
defaultItems.forEach(item => !excludes.has(item) && result.add(item));
}
includes.forEach(item => result.add(item));
return result;
};
export default function buildPreset(
context: Object,
opts: Object = {},
): { plugins: Array<Plugin> } {
const {
configPath,
debug,
exclude: optionsExclude,
forceAllTransforms,
ignoreBrowserslistConfig,
include: optionsInclude,
loose,
modules,
shippedProposals,
spec,
targets: optionsTargets,
useBuiltIns,
} = normalizeOptions(opts);
// TODO: remove this in next major
let hasUglifyTarget = false;
if (optionsTargets && optionsTargets.uglify) {
hasUglifyTarget = true;
delete optionsTargets.uglify;
console.log("");
console.log("The uglify target has been deprecated. Set the top level");
console.log("option `forceAllTransforms: true` instead.");
console.log("");
}
const targets = getTargets(optionsTargets, {
ignoreBrowserslistConfig,
configPath,
});
const include = transformIncludesAndExcludes(optionsInclude);
const exclude = transformIncludesAndExcludes(optionsExclude);
const transformTargets = forceAllTransforms || hasUglifyTarget ? {} : targets;
const transformations = filterItems(
shippedProposals ? pluginList : pluginListWithoutProposals,
include.plugins,
exclude.plugins,
transformTargets,
);
let polyfills;
let polyfillTargets;
if (useBuiltIns) {
polyfillTargets = getBuiltInTargets(targets);
polyfills = filterItems(
shippedProposals ? builtInsList : builtInsListWithoutProposals,
include.builtIns,
exclude.builtIns,
polyfillTargets,
getPlatformSpecificDefaultFor(polyfillTargets),
);
}
const plugins = [];
const pluginUseBuiltIns = useBuiltIns !== false;
// NOTE: not giving spec here yet to avoid compatibility issues when
// transform-modules-commonjs gets its spec mode
if (modules !== false && moduleTransformations[modules]) {
plugins.push([getPlugin(moduleTransformations[modules]), { loose }]);
}
transformations.forEach(pluginName =>
plugins.push([
getPlugin(pluginName),
{ spec, loose, useBuiltIns: pluginUseBuiltIns },
]),
);
const regenerator = transformations.has("transform-regenerator");
if (debug && !hasBeenLogged) {
hasBeenLogged = true;
console.log("@babel/preset-env: `DEBUG` option");
console.log("\nUsing targets:");
console.log(JSON.stringify(prettifyTargets(targets), null, 2));
console.log(`\nUsing modules transform: ${modules.toString()}`);
console.log("\nUsing plugins:");
transformations.forEach(transform => {
logPlugin(transform, targets, pluginList);
});
if (!useBuiltIns) {
console.log(
"\nUsing polyfills: No polyfills were added, since the `useBuiltIns` option was not set.",
);
} else {
console.log(
`
Using polyfills with \`${useBuiltIns}\` option:`,
);
}
}
if (useBuiltIns === "usage" || useBuiltIns === "entry") {
const pluginOptions = {
debug,
polyfills,
regenerator,
onDebug: (polyfills, context) => {
polyfills.forEach(polyfill =>
logPlugin(polyfill, polyfillTargets, builtInsList, context),
);
},
};
plugins.push([
useBuiltIns === "usage" ? addUsedBuiltInsPlugin : useBuiltInsEntryPlugin,
pluginOptions,
]);
}
return {
plugins,
};
}

View File

@@ -0,0 +1,6 @@
export default {
amd: "transform-modules-amd",
commonjs: "transform-modules-commonjs",
systemjs: "transform-modules-systemjs",
umd: "transform-modules-umd",
};

View File

@@ -0,0 +1,175 @@
//@flow
import invariant from "invariant";
import browserslist from "browserslist";
import builtInsList from "../data/built-ins.json";
import { defaultWebIncludes } from "./default-includes";
import moduleTransformations from "./module-transformations";
import pluginsList from "../data/plugins.json";
import type { Targets, Options, ModuleOption, BuiltInsOption } from "./types";
const validIncludesAndExcludes = new Set([
...Object.keys(pluginsList),
...Object.keys(moduleTransformations).map(m => moduleTransformations[m]),
...Object.keys(builtInsList),
...defaultWebIncludes,
]);
export const validateIncludesAndExcludes = (
opts: Array<string> = [],
type: string,
): Array<string> => {
invariant(
Array.isArray(opts),
`Invalid Option: The '${type}' option must be an Array<String> of plugins/built-ins`,
);
const unknownOpts = opts.filter(opt => !validIncludesAndExcludes.has(opt));
invariant(
unknownOpts.length === 0,
`Invalid Option: The plugins/built-ins '${unknownOpts.join(
", ",
)}' passed to the '${type}' option are not
valid. Please check data/[plugin-features|built-in-features].js in babel-preset-env`,
);
return opts;
};
const validBrowserslistTargets = [
...Object.keys(browserslist.data),
...Object.keys(browserslist.aliases),
];
export const normalizePluginName = (plugin: string): string =>
plugin.replace(/^babel-plugin-/, "");
export const normalizePluginNames = (plugins: Array<string>): Array<string> =>
plugins.map(normalizePluginName);
export const checkDuplicateIncludeExcludes = (
include: Array<string> = [],
exclude: Array<string> = [],
): void => {
const duplicates: Array<string> = include.filter(
opt => exclude.indexOf(opt) >= 0,
);
invariant(
duplicates.length === 0,
`Invalid Option: The plugins/built-ins '${duplicates.join(
", ",
)}' were found in both the "include" and
"exclude" options.`,
);
};
export const validateConfigPathOption = (
configPath: string = process.cwd(),
) => {
invariant(
typeof configPath === "string",
`Invalid Option: The configPath option '${configPath}' is invalid, only strings are allowed.`,
);
return configPath;
};
export const validateBoolOption = (
name: string,
value: ?boolean,
defaultValue: boolean,
) => {
if (typeof value === "undefined") {
value = defaultValue;
}
if (typeof value !== "boolean") {
throw new Error(`Preset env: '${name}' option must be a boolean.`);
}
return value;
};
export const validateIgnoreBrowserslistConfig = (
ignoreBrowserslistConfig: boolean,
) =>
validateBoolOption(
"ignoreBrowserslistConfig",
ignoreBrowserslistConfig,
false,
);
export const validateModulesOption = (
modulesOpt: ModuleOption = "commonjs",
) => {
invariant(
modulesOpt === false ||
Object.keys(moduleTransformations).indexOf(modulesOpt) > -1,
`Invalid Option: The 'modules' option must be either 'false' to indicate no modules, or a
module type which can be be one of: 'commonjs' (default), 'amd', 'umd', 'systemjs'.`,
);
return modulesOpt;
};
export const objectToBrowserslist = (object: Targets) => {
return Object.keys(object).reduce((list, targetName) => {
if (validBrowserslistTargets.indexOf(targetName) >= 0) {
const targetVersion = object[targetName];
return list.concat(`${targetName} ${targetVersion}`);
}
return list;
}, []);
};
export const validateUseBuiltInsOption = (
builtInsOpt: BuiltInsOption = false,
): BuiltInsOption => {
invariant(
builtInsOpt === "usage" || builtInsOpt === false || builtInsOpt === "entry",
`Invalid Option: The 'useBuiltIns' option must be either
'false' (default) to indicate no polyfill,
'"entry"' to indicate replacing the entry polyfill, or
'"usage"' to import only used polyfills per file`,
);
return builtInsOpt;
};
export default function normalizeOptions(opts: Options) {
if (opts.exclude) {
opts.exclude = normalizePluginNames(opts.exclude);
}
if (opts.include) {
opts.include = normalizePluginNames(opts.include);
}
checkDuplicateIncludeExcludes(opts.include, opts.exclude);
return {
configPath: validateConfigPathOption(opts.configPath),
debug: opts.debug,
exclude: validateIncludesAndExcludes(opts.exclude, "exclude"),
forceAllTransforms: validateBoolOption(
"forceAllTransforms",
opts.forceAllTransforms,
false,
),
ignoreBrowserslistConfig: validateIgnoreBrowserslistConfig(
opts.ignoreBrowserslistConfig,
),
include: validateIncludesAndExcludes(opts.include, "include"),
loose: validateBoolOption("loose", opts.loose, false),
modules: validateModulesOption(opts.modules),
shippedProposals: validateBoolOption(
"shippedProposals",
opts.shippedProposals,
false,
),
spec: validateBoolOption("loose", opts.spec, false),
targets: opts.targets,
useBuiltIns: validateUseBuiltInsOption(opts.useBuiltIns),
};
}

View File

@@ -0,0 +1,144 @@
// @flow
import browserslist from "browserslist";
import semver from "semver";
import { semverify } from "./utils";
import { objectToBrowserslist } from "./normalize-options";
import type { Targets } from "./types";
const browserNameMap = {
android: "android",
chrome: "chrome",
and_chr: "chrome",
edge: "edge",
firefox: "firefox",
ie: "ie",
ios_saf: "ios",
safari: "safari",
};
const isBrowsersQueryValid = (browsers: string | Array<string>): boolean =>
typeof browsers === "string" || Array.isArray(browsers);
const semverMin = (first: ?string, second: string): string => {
return first && semver.lt(first, second) ? first : second;
};
const mergeBrowsers = (fromQuery: Targets, fromTarget: Targets) => {
return Object.keys(fromTarget).reduce((queryObj, targKey) => {
if (targKey !== "browsers") {
queryObj[targKey] = fromTarget[targKey];
}
return queryObj;
}, fromQuery);
};
const getLowestVersions = (browsers: Array<string>): Targets => {
return browsers.reduce((all: Object, browser: string): Object => {
const [browserName, browserVersion] = browser.split(" ");
const normalizedBrowserName = browserNameMap[browserName];
if (!normalizedBrowserName) {
return all;
}
try {
// Browser version can return as "10.0-10.2"
const splitVersion = browserVersion.split("-")[0];
const parsedBrowserVersion = semverify(splitVersion);
all[normalizedBrowserName] = semverMin(
all[normalizedBrowserName],
parsedBrowserVersion,
);
} catch (e) {}
return all;
}, {});
};
const outputDecimalWarning = (decimalTargets: Array<Object>): void => {
if (!decimalTargets || !decimalTargets.length) {
return;
}
console.log("Warning, the following targets are using a decimal version:");
console.log("");
decimalTargets.forEach(({ target, value }) =>
console.log(` ${target}: ${value}`),
);
console.log("");
console.log(
"We recommend using a string for minor/patch versions to avoid numbers like 6.10",
);
console.log("getting parsed as 6.1, which can lead to unexpected behavior.");
console.log("");
};
const targetParserMap = {
__default: (target, value) => [target, semverify(value)],
// Parse `node: true` and `node: "current"` to version
node: (target, value) => {
const parsed =
value === true || value === "current"
? process.versions.node
: semverify(value);
return [target, parsed];
},
};
type ParsedResult = {
targets: Targets,
decimalWarnings: Array<Object>,
};
const getTargets = (targets: Object = {}, options: Object = {}): Targets => {
const targetOpts: Targets = {};
// Parse browsers target via browserslist;
const queryIsValid = isBrowsersQueryValid(targets.browsers);
const browsersquery = queryIsValid ? targets.browsers : null;
if (queryIsValid || !options.ignoreBrowserslistConfig) {
browserslist.defaults = objectToBrowserslist(targets);
const browsers = browserslist(browsersquery, { path: options.configPath });
const queryBrowsers = getLowestVersions(browsers);
targets = mergeBrowsers(queryBrowsers, targets);
}
// Parse remaining targets
const parsed = Object.keys(targets)
.sort()
.reduce(
(results: ParsedResult, target: string): ParsedResult => {
if (target !== "browsers") {
const value = targets[target];
// Warn when specifying minor/patch as a decimal
if (typeof value === "number" && value % 1 !== 0) {
results.decimalWarnings.push({ target, value });
}
// Check if we have a target parser?
const parser = targetParserMap[target] || targetParserMap.__default;
const [parsedTarget, parsedValue] = parser(target, value);
if (parsedValue) {
// Merge (lowest wins)
results.targets[parsedTarget] = parsedValue;
}
}
return results;
},
{
targets: targetOpts,
decimalWarnings: [],
},
);
outputDecimalWarning(parsed.decimalWarnings);
return parsed.targets;
};
export default getTargets;

View File

@@ -0,0 +1,30 @@
//@flow
// Targets
export type Target = string;
export type Targets = {
[target: string]: Target,
};
// Options
// Use explicit modules to prevent typo errors.
export type ModuleOption = false | "amd" | "commonjs" | "systemjs" | "umd";
export type BuiltInsOption = false | "entry" | "usage";
export type Options = {
configPath: string,
debug: boolean,
exclude: Array<string>,
forceAllTransforms: boolean,
ignoreBrowserslistConfig: boolean,
include: Array<string>,
loose: boolean,
modules: ModuleOption,
shippedProposals: boolean,
spec: boolean,
targets: Targets,
useBuiltIns: BuiltInsOption,
};
// Babel
export type Plugin = [Object, Object];

View File

@@ -0,0 +1,126 @@
//@flow
import { logEntryPolyfills } from "./debug";
type Plugin = {
visitor: Object,
pre: Function,
post: Function,
name: string,
};
type RequireType = "require" | "import";
function isPolyfillSource(value: string): boolean {
return value === "@babel/polyfill";
}
export default function({ types: t }: { types: Object }): Plugin {
function createImportDeclaration(polyfill: string): Object {
const declar = t.importDeclaration([], t.stringLiteral(polyfill));
declar._blockHoist = 3;
return declar;
}
function createRequireStatement(polyfill: string): Object {
return t.expressionStatement(
t.callExpression(t.identifier("require"), [t.stringLiteral(polyfill)]),
);
}
function isRequire(path: Object): boolean {
return (
t.isExpressionStatement(path.node) &&
t.isCallExpression(path.node.expression) &&
t.isIdentifier(path.node.expression.callee) &&
path.node.expression.callee.name === "require" &&
path.node.expression.arguments.length === 1 &&
t.isStringLiteral(path.node.expression.arguments[0]) &&
isPolyfillSource(path.node.expression.arguments[0].value)
);
}
function createImport(
polyfill: string,
requireType: RequireType,
core: ?boolean,
): Object {
if (core) {
polyfill = `@babel/polyfill/lib/core-js/modules/${polyfill}`;
}
if (requireType === "import") {
return createImportDeclaration(polyfill);
}
return createRequireStatement(polyfill);
}
function createImports(
polyfills: Array<string>,
requireType: RequireType,
regenerator: boolean,
): Array<Object> {
const items = Array.isArray(polyfills) ? new Set(polyfills) : polyfills;
const imports = [];
items.forEach(p => imports.push(createImport(p, requireType, true)));
if (regenerator) {
imports.push(
createImport(
"@babel/polyfill/lib/regenerator-runtime/runtime",
requireType,
),
);
}
return imports;
}
const isPolyfillImport = {
ImportDeclaration(path, state) {
if (
path.node.specifiers.length === 0 &&
isPolyfillSource(path.node.source.value)
) {
this.importPolyfillIncluded = true;
path.replaceWithMultiple(
createImports(state.opts.polyfills, "import", state.opts.regenerator),
);
}
},
Program(path, state) {
path.get("body").forEach(bodyPath => {
if (isRequire(bodyPath)) {
bodyPath.replaceWithMultiple(
createImports(
state.opts.polyfills,
"require",
state.opts.regenerator,
),
);
}
});
},
};
return {
name: "transform-polyfill-require",
visitor: isPolyfillImport,
pre() {
this.numPolyfillImports = 0;
this.importPolyfillIncluded = false;
},
post() {
const { debug, onDebug, polyfills } = this.opts;
if (debug) {
logEntryPolyfills(
this.importPolyfillIncluded,
polyfills,
this.file.opts.filename,
onDebug,
);
}
},
};
}

View File

@@ -0,0 +1,303 @@
//@flow
import { definitions } from "./built-in-definitions";
import { logUsagePolyfills } from "./debug";
type Plugin = {
visitor: Object,
pre: Function,
name: string,
};
function isPolyfillSource(value: string): boolean {
return value === "@babel/polyfill";
}
// function warnOnInstanceMethod() {
// state.opts.debug &&
// console.warn(
// `Adding a polyfill: An instance method may have been used: ${details}`,
// );
// }
function has(obj: Object, key: string): boolean {
return Object.prototype.hasOwnProperty.call(obj, key);
}
// function getObjectString(node: Object): string {
// if (node.type === "Identifier") {
// return node.name;
// } else if (node.type === "MemberExpression") {
// return `${getObjectString(node.object)}.${getObjectString(node.property)}`;
// }
// return node.name;
// }
const modulePathMap = {
"regenerator-runtime": "@babel/polyfill/lib/regenerator-runtime/runtime",
};
const getModulePath = module => {
return (
modulePathMap[module] || `@babel/polyfill/lib/core-js/modules/${module}`
);
};
export default function({ types: t }: { types: Object }): Plugin {
function addImport(
path: Object,
builtIn: string,
builtIns: Set<string>,
): void {
if (builtIn && !builtIns.has(builtIn)) {
builtIns.add(builtIn);
const importDec = t.importDeclaration(
[],
t.stringLiteral(getModulePath(builtIn)),
);
importDec._blockHoist = 3;
const programPath = path.find(path => path.isProgram());
programPath.unshiftContainer("body", importDec);
}
}
function addUnsupported(
path: Object,
polyfills: Set<string>,
builtIn: Array<string> | string,
builtIns: Set<string>,
): void {
if (Array.isArray(builtIn)) {
for (const i of builtIn) {
if (polyfills.has(i)) {
addImport(path, i, builtIns);
}
}
} else {
if (polyfills.has(builtIn)) {
addImport(path, builtIn, builtIns);
}
}
}
function isRequire(path: Object): boolean {
return (
t.isExpressionStatement(path.node) &&
t.isCallExpression(path.node.expression) &&
t.isIdentifier(path.node.expression.callee) &&
path.node.expression.callee.name === "require" &&
path.node.expression.arguments.length === 1 &&
t.isStringLiteral(path.node.expression.arguments[0]) &&
isPolyfillSource(path.node.expression.arguments[0].value)
);
}
const addAndRemovePolyfillImports = {
ImportDeclaration(path) {
if (
path.node.specifiers.length === 0 &&
isPolyfillSource(path.node.source.value)
) {
console.warn(
`
When setting \`useBuiltIns: 'usage'\`, polyfills are automatically imported when needed.
Please remove the \`import '@babel/polyfill'\` call or use \`useBuiltIns: 'entry'\` instead.`,
);
path.remove();
}
},
Program: {
enter(path) {
path.get("body").forEach(bodyPath => {
if (isRequire(bodyPath)) {
console.warn(
`
When setting \`useBuiltIns: 'usage'\`, polyfills are automatically imported when needed.
Please remove the \`require('@babel/polyfill')\` call or use \`useBuiltIns: 'entry'\` instead.`,
);
bodyPath.remove();
}
});
},
},
// Symbol()
// new Promise
ReferencedIdentifier(path, state) {
const { node, parent, scope } = path;
if (t.isMemberExpression(parent)) return;
if (!has(definitions.builtins, node.name)) return;
if (scope.getBindingIdentifier(node.name)) return;
const builtIn = definitions.builtins[node.name];
addUnsupported(path, state.opts.polyfills, builtIn, this.builtIns);
},
// arr[Symbol.iterator]()
CallExpression(path) {
// we can't compile this
if (path.node.arguments.length) return;
const callee = path.node.callee;
if (!t.isMemberExpression(callee)) return;
if (!callee.computed) return;
if (!path.get("callee.property").matchesPattern("Symbol.iterator")) {
return;
}
addImport(path, "web.dom.iterable", this.builtIns);
},
// Symbol.iterator in arr
BinaryExpression(path) {
if (path.node.operator !== "in") return;
if (!path.get("left").matchesPattern("Symbol.iterator")) return;
addImport(path, "web.dom.iterable", this.builtIns);
},
// yield*
YieldExpression(path) {
if (!path.node.delegate) return;
addImport(path, "web.dom.iterable", this.builtIns);
},
// Array.from
MemberExpression: {
enter(path, state) {
if (!path.isReferenced()) return;
const { node } = path;
const obj = node.object;
const prop = node.property;
if (!t.isReferenced(obj, node)) return;
// doesn't reference the global
if (path.scope.getBindingIdentifier(obj.name)) return;
if (has(definitions.staticMethods, obj.name)) {
const staticMethods = definitions.staticMethods[obj.name];
if (has(staticMethods, prop.name)) {
const builtIn = staticMethods[prop.name];
addUnsupported(path, state.opts.polyfills, builtIn, this.builtIns);
// if (obj.name === "Array" && prop.name === "from") {
// addImport(
// path,
// "@babel/polyfill/lib/core-js/modules/web.dom.iterable",
// this.builtIns,
// );
// }
}
}
if (
!node.computed &&
t.isIdentifier(prop) &&
has(definitions.instanceMethods, prop.name)
) {
//warnOnInstanceMethod(state, getObjectString(node));
const builtIn = definitions.instanceMethods[prop.name];
addUnsupported(path, state.opts.polyfills, builtIn, this.builtIns);
} else if (node.computed) {
if (
t.isStringLiteral(prop) &&
has(definitions.instanceMethods, prop.value)
) {
const builtIn = definitions.instanceMethods[prop.value];
//warnOnInstanceMethod(state, `${obj.name}['${prop.value}']`);
addUnsupported(path, state.opts.polyfills, builtIn, this.builtIns);
} else {
const res = path.get("property").evaluate();
if (res.confident) {
const builtIn = definitions.instanceMethods[res.value];
//warnOnInstanceMethod(state, `${obj.name}['${res.value}']`);
addUnsupported(
path.get("property"),
state.opts.polyfills,
builtIn,
this.builtIns,
);
}
}
}
},
// Symbol.match
exit(path, state) {
if (!path.isReferenced()) return;
const { node } = path;
const obj = node.object;
if (!has(definitions.builtins, obj.name)) return;
if (path.scope.getBindingIdentifier(obj.name)) return;
const builtIn = definitions.builtins[obj.name];
addUnsupported(path, state.opts.polyfills, builtIn, this.builtIns);
},
},
// var { repeat, startsWith } = String
VariableDeclarator(path, state) {
if (!path.isReferenced()) return;
const { node } = path;
const obj = node.init;
if (!t.isObjectPattern(node.id)) return;
const props = node.id.properties;
if (!t.isReferenced(obj, node)) return;
// doesn't reference the global
if (path.scope.getBindingIdentifier(obj.name)) return;
for (let prop of props) {
prop = prop.key;
if (
!node.computed &&
t.isIdentifier(prop) &&
has(definitions.instanceMethods, prop.name)
) {
// warnOnInstanceMethod(
// state,
// `${path.parentPath.node.kind} { ${prop.name} } = ${obj.name}`,
// );
const builtIn = definitions.instanceMethods[prop.name];
addUnsupported(path, state.opts.polyfills, builtIn, this.builtIns);
}
}
},
Function(path, state) {
if (!this.usesRegenerator && (path.node.generator || path.node.async)) {
this.usesRegenerator = true;
if (state.opts.regenerator) {
addImport(path, "regenerator-runtime", this.builtIns);
}
}
},
};
return {
name: "use-built-ins",
pre() {
this.builtIns = new Set();
this.usesRegenerator = false;
},
post() {
const { debug, onDebug } = this.opts;
if (debug) {
logUsagePolyfills(this.builtIns, this.file.opts.filename, onDebug);
}
},
visitor: addAndRemovePolyfillImports,
};
}

View File

@@ -0,0 +1,63 @@
// @flow
import semver from "semver";
import type { Targets } from "./types";
// Convert version to a semver value.
// 2.5 -> 2.5.0; 1 -> 1.0.0;
export const semverify = (version: string | number): string => {
if (typeof version === "string" && semver.valid(version)) {
return version;
}
const split = version.toString().split(".");
while (split.length < 3) {
split.push("0");
}
return split.join(".");
};
export const prettifyVersion = (version: string): string => {
if (typeof version !== "string") {
return version;
}
const parts = [semver.major(version)];
const minor = semver.minor(version);
const patch = semver.patch(version);
if (minor || patch) {
parts.push(minor);
}
if (patch) {
parts.push(patch);
}
return parts.join(".");
};
export const prettifyTargets = (targets: Targets): Object => {
return Object.keys(targets).reduce((results, target) => {
let value = targets[target];
if (typeof value === "string") {
value = prettifyVersion(value);
}
results[target] = value;
return results;
}, {});
};
export const filterStageFromList = (list: any, stageList: any) => {
return Object.keys(list).reduce((result, item) => {
if (!stageList[item]) {
result[item] = list[item];
}
return result;
}, {});
};

View File

@@ -0,0 +1,8 @@
{
"env": {
"mocha": true
},
"rules": {
"max-len": 0
}
}

View File

@@ -0,0 +1,125 @@
const chai = require("chai");
const child = require("child_process");
const fs = require("fs-extra");
const helper = require("@babel/helper-fixtures");
const path = require("path");
const fixtureLoc = path.join(__dirname, "debug-fixtures");
const tmpLoc = path.join(__dirname, "tmp");
const clear = () => {
process.chdir(__dirname);
if (fs.existsSync(tmpLoc)) fs.removeSync(tmpLoc);
fs.mkdirSync(tmpLoc);
process.chdir(tmpLoc);
};
const saveInFiles = files => {
Object.keys(files).forEach(filename => {
const content = files[filename];
fs.outputFileSync(filename, content);
});
};
const testOutputType = (type, stdTarg, opts) => {
stdTarg = stdTarg.trim();
stdTarg = stdTarg.replace(/\\/g, "/");
const optsTarg = opts[type];
if (optsTarg) {
const expectStdout = optsTarg.trim();
chai.expect(stdTarg).to.equal(expectStdout, `${type} didn't match`);
} else {
const file = path.join(opts.testLoc, `${type}.txt`);
console.log(`New test file created: ${file}`);
fs.outputFileSync(file, stdTarg);
}
};
const assertTest = (stdout, stderr, opts) => {
testOutputType("stdout", stdout, opts);
if (stderr) {
testOutputType("stderr", stderr, opts);
}
};
const buildTest = opts => {
const binLoc = require.resolve("@babel/cli/bin/babel");
return callback => {
clear();
saveInFiles(opts.inFiles);
let args = [binLoc];
args = args.concat(opts.args);
const spawn = child.spawn(process.execPath, args);
let stdout = "";
let stderr = "";
spawn.stdout.on("data", chunk => (stdout += chunk));
spawn.stderr.on("data", chunk => (stderr += chunk));
spawn.on("close", () => {
let err;
try {
assertTest(stdout, stderr, opts);
} catch (e) {
err = e;
}
callback(err);
});
};
};
describe("debug output", () => {
fs.readdirSync(fixtureLoc).forEach(testName => {
if (testName.slice(0, 1) === ".") return;
const testLoc = path.join(fixtureLoc, testName);
if (testName.slice(0, 1) === ".") return;
const opts = {
args: ["src", "--out-dir", "lib"],
testLoc: testLoc,
};
const stdoutLoc = path.join(testLoc, "stdout.txt");
const stderrLoc = path.join(testLoc, "stderr.txt");
if (fs.existsSync(stdoutLoc)) {
opts.stdout = helper.readFile(stdoutLoc);
}
if (fs.existsSync(stderrLoc)) {
opts.stderr = helper.readFile(stderrLoc);
}
const optionsLoc = path.join(testLoc, "options.json");
if (!fs.existsSync(optionsLoc)) {
throw new Error(
`Debug test '${testName}' is missing an options.json file`,
);
}
const inFilesFolderLoc = path.join(testLoc, "in");
opts.inFiles = {
".babelrc": helper.readFile(optionsLoc),
};
if (!fs.existsSync(inFilesFolderLoc)) {
opts.inFiles["src/in.js"] = "";
} else {
fs.readdirSync(inFilesFolderLoc).forEach(filename => {
opts.inFiles[`src/${filename}`] = helper.readFile(
path.join(inFilesFolderLoc, filename),
);
});
}
it(testName, buildTest(opts));
});
});

View File

@@ -0,0 +1 @@
import '@babel/polyfill';

View File

@@ -0,0 +1,11 @@
{
"presets": [
["../../lib", {
"debug": true,
"targets": {
"browsers": [ "Android >= 4" ]
},
"useBuiltIns": "entry"
}]
]
}

View File

@@ -0,0 +1,135 @@
@babel/preset-env: `DEBUG` option
Using targets:
{
"android": "4"
}
Using modules transform: commonjs
Using plugins:
check-constants { "android":"4" }
transform-arrow-functions { "android":"4" }
transform-block-scoped-functions { "android":"4" }
transform-block-scoping { "android":"4" }
transform-classes { "android":"4" }
transform-computed-properties { "android":"4" }
transform-destructuring { "android":"4" }
transform-duplicate-keys { "android":"4" }
transform-for-of { "android":"4" }
transform-function-name { "android":"4" }
transform-literals { "android":"4" }
transform-object-super { "android":"4" }
transform-parameters { "android":"4" }
transform-shorthand-properties { "android":"4" }
transform-spread { "android":"4" }
transform-sticky-regex { "android":"4" }
transform-template-literals { "android":"4" }
transform-typeof-symbol { "android":"4" }
transform-unicode-regex { "android":"4" }
transform-new-target { "android":"4" }
transform-regenerator { "android":"4" }
transform-exponentiation-operator { "android":"4" }
transform-async-to-generator { "android":"4" }
Using polyfills with `entry` option:
[src/in.js] Replaced `@babel/polyfill` with the following polyfills:
es6.typed.array-buffer { "android":"4" }
es6.typed.int8-array { "android":"4" }
es6.typed.uint8-array { "android":"4" }
es6.typed.uint8-clamped-array { "android":"4" }
es6.typed.int16-array { "android":"4" }
es6.typed.uint16-array { "android":"4" }
es6.typed.int32-array { "android":"4" }
es6.typed.uint32-array { "android":"4" }
es6.typed.float32-array { "android":"4" }
es6.typed.float64-array { "android":"4" }
es6.map { "android":"4" }
es6.set { "android":"4" }
es6.weak-map { "android":"4" }
es6.weak-set { "android":"4" }
es6.reflect.apply { "android":"4" }
es6.reflect.construct { "android":"4" }
es6.reflect.define-property { "android":"4" }
es6.reflect.delete-property { "android":"4" }
es6.reflect.get { "android":"4" }
es6.reflect.get-own-property-descriptor { "android":"4" }
es6.reflect.get-prototype-of { "android":"4" }
es6.reflect.has { "android":"4" }
es6.reflect.is-extensible { "android":"4" }
es6.reflect.own-keys { "android":"4" }
es6.reflect.prevent-extensions { "android":"4" }
es6.reflect.set { "android":"4" }
es6.reflect.set-prototype-of { "android":"4" }
es6.promise { "android":"4" }
es6.symbol { "android":"4" }
es6.object.freeze { "android":"4" }
es6.object.seal { "android":"4" }
es6.object.prevent-extensions { "android":"4" }
es6.object.is-frozen { "android":"4" }
es6.object.is-sealed { "android":"4" }
es6.object.is-extensible { "android":"4" }
es6.object.get-own-property-descriptor { "android":"4" }
es6.object.get-prototype-of { "android":"4" }
es6.object.keys { "android":"4" }
es6.object.get-own-property-names { "android":"4" }
es6.object.assign { "android":"4" }
es6.object.is { "android":"4" }
es6.object.set-prototype-of { "android":"4" }
es6.function.name { "android":"4" }
es6.string.raw { "android":"4" }
es6.string.from-code-point { "android":"4" }
es6.string.code-point-at { "android":"4" }
es6.string.repeat { "android":"4" }
es6.string.starts-with { "android":"4" }
es6.string.ends-with { "android":"4" }
es6.string.includes { "android":"4" }
es6.regexp.flags { "android":"4" }
es6.regexp.match { "android":"4" }
es6.regexp.replace { "android":"4" }
es6.regexp.split { "android":"4" }
es6.regexp.search { "android":"4" }
es6.array.from { "android":"4" }
es6.array.of { "android":"4" }
es6.array.copy-within { "android":"4" }
es6.array.find { "android":"4" }
es6.array.find-index { "android":"4" }
es6.array.fill { "android":"4" }
es6.array.iterator { "android":"4" }
es6.number.is-finite { "android":"4" }
es6.number.is-integer { "android":"4" }
es6.number.is-safe-integer { "android":"4" }
es6.number.is-nan { "android":"4" }
es6.number.epsilon { "android":"4" }
es6.number.min-safe-integer { "android":"4" }
es6.number.max-safe-integer { "android":"4" }
es6.number.parse-float { "android":"4" }
es6.number.parse-int { "android":"4" }
es6.math.acosh { "android":"4" }
es6.math.asinh { "android":"4" }
es6.math.atanh { "android":"4" }
es6.math.cbrt { "android":"4" }
es6.math.clz32 { "android":"4" }
es6.math.cosh { "android":"4" }
es6.math.expm1 { "android":"4" }
es6.math.fround { "android":"4" }
es6.math.hypot { "android":"4" }
es6.math.imul { "android":"4" }
es6.math.log1p { "android":"4" }
es6.math.log10 { "android":"4" }
es6.math.log2 { "android":"4" }
es6.math.sign { "android":"4" }
es6.math.sinh { "android":"4" }
es6.math.tanh { "android":"4" }
es6.math.trunc { "android":"4" }
es7.array.includes { "android":"4" }
es7.object.values { "android":"4" }
es7.object.entries { "android":"4" }
es7.object.get-own-property-descriptors { "android":"4" }
es7.string.pad-start { "android":"4" }
es7.string.pad-end { "android":"4" }
web.timers { "android":"4" }
web.immediate { "android":"4" }
web.dom.iterable { "android":"4" }
src/in.js -> lib/in.js

View File

@@ -0,0 +1 @@
function hasAnyoneSeenImportBabelPolyfill() { return false };

View File

@@ -0,0 +1,11 @@
{
"presets": [
["../../lib", {
"debug": true,
"targets": {
"node": 6
},
"useBuiltIns": "entry"
}]
]
}

View File

@@ -0,0 +1,20 @@
@babel/preset-env: `DEBUG` option
Using targets:
{
"node": "6"
}
Using modules transform: commonjs
Using plugins:
transform-destructuring { "node":"6" }
transform-for-of { "node":"6" }
transform-function-name { "node":"6" }
transform-exponentiation-operator { "node":"6" }
transform-async-to-generator { "node":"6" }
Using polyfills with `entry` option:
[src/in.js] `import '@babel/polyfill'` was not found.
src/in.js -> lib/in.js

View File

@@ -0,0 +1 @@
import '@babel/polyfill';

View File

@@ -0,0 +1,13 @@
{
"presets": [
["../../lib", {
"debug": true,
"targets": {
"chrome": 55,
"uglify": true
},
"useBuiltIns": "entry",
"modules": false
}]
]
}

View File

@@ -0,0 +1,46 @@
The uglify target has been deprecated. Set the top level
option `forceAllTransforms: true` instead.
@babel/preset-env: `DEBUG` option
Using targets:
{
"chrome": "55"
}
Using modules transform: false
Using plugins:
check-constants {}
transform-arrow-functions {}
transform-block-scoped-functions {}
transform-block-scoping {}
transform-classes {}
transform-computed-properties {}
transform-destructuring {}
transform-duplicate-keys {}
transform-for-of {}
transform-function-name {}
transform-literals {}
transform-object-super {}
transform-parameters {}
transform-shorthand-properties {}
transform-spread {}
transform-sticky-regex {}
transform-template-literals {}
transform-typeof-symbol {}
transform-unicode-regex {}
transform-new-target {}
transform-regenerator {}
transform-exponentiation-operator {}
transform-async-to-generator {}
Using polyfills with `entry` option:
[src/in.js] Replaced `@babel/polyfill` with the following polyfills:
es7.string.pad-start { "chrome":"55" }
es7.string.pad-end { "chrome":"55" }
web.timers { "chrome":"55" }
web.immediate { "chrome":"55" }
web.dom.iterable { "chrome":"55" }
src/in.js -> lib/in.js

View File

@@ -0,0 +1 @@
import '@babel/polyfill';

View File

@@ -0,0 +1,12 @@
{
"presets": [
["../../lib", {
"debug": true,
"targets": {
"browsers": "chrome >= 54, ie 10",
"node": 6
},
"useBuiltIns": "entry"
}]
]
}

View File

@@ -0,0 +1,137 @@
@babel/preset-env: `DEBUG` option
Using targets:
{
"chrome": "54",
"ie": "10",
"node": "6"
}
Using modules transform: commonjs
Using plugins:
check-constants { "ie":"10" }
transform-arrow-functions { "ie":"10" }
transform-block-scoped-functions { "ie":"10" }
transform-block-scoping { "ie":"10" }
transform-classes { "ie":"10" }
transform-computed-properties { "ie":"10" }
transform-destructuring { "ie":"10", "node":"6" }
transform-duplicate-keys { "ie":"10" }
transform-for-of { "ie":"10", "node":"6" }
transform-function-name { "ie":"10", "node":"6" }
transform-literals { "ie":"10" }
transform-object-super { "ie":"10" }
transform-parameters { "ie":"10" }
transform-shorthand-properties { "ie":"10" }
transform-spread { "ie":"10" }
transform-sticky-regex { "ie":"10" }
transform-template-literals { "ie":"10" }
transform-typeof-symbol { "ie":"10" }
transform-unicode-regex { "ie":"10" }
transform-new-target { "ie":"10" }
transform-regenerator { "ie":"10" }
transform-exponentiation-operator { "ie":"10", "node":"6" }
transform-async-to-generator { "chrome":"54", "ie":"10", "node":"6" }
Using polyfills with `entry` option:
[src/in.js] Replaced `@babel/polyfill` with the following polyfills:
es6.typed.array-buffer { "ie":"10", "node":"6" }
es6.typed.int8-array { "ie":"10", "node":"6" }
es6.typed.uint8-array { "ie":"10", "node":"6" }
es6.typed.uint8-clamped-array { "ie":"10", "node":"6" }
es6.typed.int16-array { "ie":"10", "node":"6" }
es6.typed.uint16-array { "ie":"10", "node":"6" }
es6.typed.int32-array { "ie":"10", "node":"6" }
es6.typed.uint32-array { "ie":"10", "node":"6" }
es6.typed.float32-array { "ie":"10", "node":"6" }
es6.typed.float64-array { "ie":"10", "node":"6" }
es6.map { "ie":"10", "node":"6" }
es6.set { "ie":"10", "node":"6" }
es6.weak-map { "ie":"10", "node":"6" }
es6.weak-set { "ie":"10", "node":"6" }
es6.reflect.apply { "ie":"10" }
es6.reflect.construct { "ie":"10" }
es6.reflect.define-property { "ie":"10" }
es6.reflect.delete-property { "ie":"10" }
es6.reflect.get { "ie":"10" }
es6.reflect.get-own-property-descriptor { "ie":"10" }
es6.reflect.get-prototype-of { "ie":"10" }
es6.reflect.has { "ie":"10" }
es6.reflect.is-extensible { "ie":"10" }
es6.reflect.own-keys { "ie":"10" }
es6.reflect.prevent-extensions { "ie":"10" }
es6.reflect.set { "ie":"10" }
es6.reflect.set-prototype-of { "ie":"10" }
es6.promise { "ie":"10", "node":"6" }
es6.symbol { "ie":"10", "node":"6" }
es6.object.freeze { "ie":"10" }
es6.object.seal { "ie":"10" }
es6.object.prevent-extensions { "ie":"10" }
es6.object.is-frozen { "ie":"10" }
es6.object.is-sealed { "ie":"10" }
es6.object.is-extensible { "ie":"10" }
es6.object.get-own-property-descriptor { "ie":"10" }
es6.object.get-prototype-of { "ie":"10" }
es6.object.keys { "ie":"10" }
es6.object.get-own-property-names { "ie":"10" }
es6.object.assign { "ie":"10" }
es6.object.is { "ie":"10" }
es6.object.set-prototype-of { "ie":"10" }
es6.function.name { "ie":"10", "node":"6" }
es6.string.raw { "ie":"10" }
es6.string.from-code-point { "ie":"10" }
es6.string.code-point-at { "ie":"10" }
es6.string.repeat { "ie":"10" }
es6.string.starts-with { "ie":"10" }
es6.string.ends-with { "ie":"10" }
es6.string.includes { "ie":"10" }
es6.regexp.flags { "ie":"10" }
es6.regexp.match { "ie":"10" }
es6.regexp.replace { "ie":"10" }
es6.regexp.split { "ie":"10" }
es6.regexp.search { "ie":"10" }
es6.array.from { "ie":"10", "node":"6" }
es6.array.of { "ie":"10" }
es6.array.copy-within { "ie":"10" }
es6.array.find { "ie":"10" }
es6.array.find-index { "ie":"10" }
es6.array.fill { "ie":"10" }
es6.array.iterator { "ie":"10" }
es6.number.is-finite { "ie":"10" }
es6.number.is-integer { "ie":"10" }
es6.number.is-safe-integer { "ie":"10" }
es6.number.is-nan { "ie":"10" }
es6.number.epsilon { "ie":"10" }
es6.number.min-safe-integer { "ie":"10" }
es6.number.max-safe-integer { "ie":"10" }
es6.number.parse-float { "ie":"10" }
es6.number.parse-int { "ie":"10" }
es6.math.acosh { "ie":"10" }
es6.math.asinh { "ie":"10" }
es6.math.atanh { "ie":"10" }
es6.math.cbrt { "ie":"10" }
es6.math.clz32 { "ie":"10" }
es6.math.cosh { "ie":"10" }
es6.math.expm1 { "ie":"10" }
es6.math.fround { "ie":"10" }
es6.math.hypot { "ie":"10" }
es6.math.imul { "ie":"10" }
es6.math.log1p { "ie":"10" }
es6.math.log10 { "ie":"10" }
es6.math.log2 { "ie":"10" }
es6.math.sign { "ie":"10" }
es6.math.sinh { "ie":"10" }
es6.math.tanh { "ie":"10" }
es6.math.trunc { "ie":"10" }
es7.array.includes { "ie":"10" }
es7.object.values { "ie":"10", "node":"6" }
es7.object.entries { "ie":"10", "node":"6" }
es7.object.get-own-property-descriptors { "ie":"10", "node":"6" }
es7.string.pad-start { "chrome":"54", "ie":"10", "node":"6" }
es7.string.pad-end { "chrome":"54", "ie":"10", "node":"6" }
web.timers { "chrome":"54", "ie":"10", "node":"6" }
web.immediate { "chrome":"54", "ie":"10", "node":"6" }
web.dom.iterable { "chrome":"54", "ie":"10", "node":"6" }
src/in.js -> lib/in.js

View File

@@ -0,0 +1 @@
import '@babel/polyfill';

View File

@@ -0,0 +1,11 @@
{
"presets": [
["../../lib", {
"debug": true,
"targets": {
"electron": 0.36
},
"useBuiltIns": "entry"
}]
]
}

Some files were not shown because too many files have changed in this diff Show More