209 Commits

Author SHA1 Message Date
Logan Smyth
d60c5e1736 Expose caller.supportsStaticESM as a flag to change preset-env behavior. 2018-08-20 10:27:55 -07:00
Brian Ng
1a0fe993f5
Ensure esmodule targets are parsed by browserslist (#8403) 2018-07-31 07:33:02 -05:00
Brian Ng
5fdcd29ef9 Ensure preset-env doesn't clobber browserslist defaults (#8391) 2018-07-26 15:22:26 -04:00
Mateusz Burzyński
c0c13ae30f Introduce objectWithoutPropertiesLoose helper (#8261) 2018-07-06 15:03:44 -04:00
Justin Ridgewell
e229ebbb8a
Optimize async to generator (#8267)
* Optimize async to generator

We can reuse the step function, avoiding a closure on every invocation.

* Rename step
2018-07-05 10:51:16 -04:00
John Buffington
236bd9309c remove emojis from cli output (#8243) (#8250) 2018-07-02 09:34:55 +02:00
Yuri Karadzhov
313960e601 Remove preset-env outdated test (#8149) 2018-06-12 08:51:11 -04:00
Yuri Karadzhov
9e4c56f990 Fix Safari TP and regular versions comparison (#8132) 2018-06-11 14:36:45 -04:00
Brian Ng
cc4ee350e4
Ensure regex-dot-all runs before unicode-regex in preset-env (#8138)
<!--
Before making a PR please make sure to read our contributing guidelines
https://github.com/babel/babel/blob/master/CONTRIBUTING.md

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 <!--(Can use an emoji 👍) -->
| ------------------------ | ---
| Fixed Issues?            | --
| Patch: Bug Fix?          |
| Major: Breaking Change?  |
| Minor: New Feature?      |
| Tests Added + Pass?      | Yes
| Documentation PR         | <!-- If so, add `[skip ci]` to your commit message to skip CI -->
| Any Dependency Changes?  |
| License                  | MIT

Good ol' plugin ordering 🙃

Ref: https://github.com/babel/babel/pull/7065#issuecomment-395959112
2018-06-11 08:09:44 -05:00
Serhii Nanovskyi
3de053cc6c Validate @babel/preset-env options (#8031) 2018-06-09 18:38:14 -05:00
Logan Smyth
53e4d74ebe
Treat all filenames as absolute paths. (#8044) 2018-05-24 20:56:19 -07:00
Justin Ridgewell
2af7a33c4e Fix class inheritance in IE10 (#7969)
* Revert "Move subclass inheritance to end (#7772)"

This reverts commit f8ab9466d331871a90f458af40b14e8d831e0c29.

* Only use getPrototypeOf if setPrototypeOf is implemented

* Update fixtures

* Helpers updates

* Update fixtures

* Fall back to getPrototypeOf

* Update fixtures
2018-05-23 16:21:21 -04:00
Nicolò Ribaudo
2351a638b5
Fix bugs in the _wrapNativeSuper helper (#7533)
* Remove second wrapper from _wrapNativeSuper

* Fix tests on node 4

I DON'T KNOW WHY IT WORKS.

* Update fixtures

* Use Reflect.construct

* Parens

* Fix things

* Fix things

* Undo changes

* Fix with sham

* Typo
2018-05-18 00:04:12 +02:00
Brian Ng
ee1ee0e7ae
Clean up and add some additional polyfill mappings in preset-env (#7809) 2018-05-10 09:09:38 -05:00
Brian Ng
6dca0ff9bf
Improve useBuiltIns: usage mappins in preset-env (#7810) 2018-05-07 11:45:09 -05:00
Logan Smyth
d6dcbdad48
Merge pull request #7358 from loganfsmyth/babelrc-resolution-changes
Allow more flexible file-based configuration while preventing .babelrcs from breaking things
2018-04-22 13:28:05 -07:00
Justin Ridgewell
f8ab9466d3
Move subclass inheritance to end (#7772)
We were using `Object.create` to setup the prototype chain at the start of the class definition, which lead to #7771.

I was a bit worried about a speed hit, but it seems everyone optimizes the two patterns the same way.
https://jsbench.github.io/#f9fca52407643d96458a35763b201215

Fixes #7771.
2018-04-21 17:31:44 -04:00
Logan Smyth
a67eb25547 Only search for .babelrc files in the 'root' package by default. 2018-04-20 17:00:53 -07:00
Brian Ng
81149a5cc9
Add initial support for ES2018 in preset-env (#7658) 2018-04-17 16:16:33 -05:00
Justin Ridgewell
ec3722b3f9
Get set helpers (#7687)
* Improve get/set helper

* fixtures

* Edge cases

* Add loose edge cases

* Spec compliant

* Add issue case

* Even more edge cases!

* Final updates

* Fix name

* Use Reflect.{get, set} when available

* Avoid block scoping in loose

* Remove semicolon

* Do not redefine a non-enumerable

* Get strictness from call site, not helpers

* Add called assertions

* Classes are always strict

* Update test fixture
2018-04-11 11:56:59 -04:00
Justin Ridgewell
d17adf40df
Use construct helper in New Spread (#7677)
* Use construct helper in New Spread

* CircleCI
2018-04-06 10:40:38 +01:00
Justin Ridgewell
450a1678f2
Use getProto and setProto helpers (#7675)
Depends on #7674.
2018-04-06 02:54:08 +01:00
Justin Ridgewell
e9ed0f5f21
Split _wrapNativeSuper into helpers (#7674)
These can be reused in a few transforms.
2018-04-06 01:18:44 +01:00
Deven Bansod
8b57a3e3b9 Migrate a few packages' tests to use Jest Expect (see below)
* Migrate the following packages' tests:
    * babel-helper-annotate-as-pure
    * babel-helper-module-imports
    * babel-helper-transform-fixture-test-runner
    * babel-highlight
    * babel-node
    * babel-plugin-transform-modules-commonjs
    * babel-preset-env-standalone
    * babel-preset-env
    * babel-preset-es2015
    * babel-preset-react
    * babel-standalone
    * babel-template
    * babel-traverse
    * babel-types
2018-03-24 16:22:10 +05:30
Brian Ng
669f6b97b2
Tweak es2015-related plugin order in preset-env (#7586) 2018-03-19 14:19:42 -05:00
Amin Marashi
8eee435cd6 Add RegExp support to include/exclude preset-env options (#7242)
* Add support for RegExp includes/excludes

* Keep the plugin order

* Detect invalid modules in regexp

* Add more tests for regexp

* Cover builtins, and unnormalized in the RegExp tests

* Remove babel-plugin- in all positions

* Change babel-plugin- prefix to string

* Add a test for the same module in include/exclude

* Handle partial matches explicitly

* Remove extra valid regexp check

* Optimise validation of plugins

* Optimise selecting the plugins

* Fix undefined include/exclude option

* Update documentation to reflect the new include matching

* Fix typo

* Apply reviews

Use regexp.test instead of string.match (slower)

Define flatten helper

Do not normalize babel-plugin anywhere in the string
2018-03-18 15:54:43 +01:00
Brian Ng
fed530f6bf
Use helper-module-import inside entry plugin too 2018-03-15 09:21:20 -05:00
Mateusz Burzyński
586d3b5929
Wrap wrapNativeSuper helpers in redefining functions for better tree-shakeability (#7188) 2018-03-14 23:48:33 +01:00
Simon Kjellberg
07ab02f6b2 Fix incorrect value of _cache in _wrapNativeSuper (#7570)
The boolean expressions returns false in environments where Map is missing.
This change explicitly sets _cache to undefined in such cases, to ensure the cache methods will be ignored.
2018-03-14 16:37:51 -04:00
Nicolò Ribaudo
91a114f74a [transform-classes] Fix typo in _wrapNativeSuper helper 2018-03-14 19:23:10 +01:00
Nicolò Ribaudo
6d9887fc0f [typeof-symbol] Guard against undefined built-in globals 2018-03-14 19:23:10 +01:00
Yael Hermon
dfb3795a97 update preset-env after build-data (#7543) 2018-03-12 20:49:52 -05:00
Yael Hermon
29807837bb preset-env - add Symbol.asyncIterator to shippedProposals builtIns (#7548)
* preset-env - add Symbol.asyncIterator to shippedProposals builtins

* fix typo
2018-03-11 16:29:22 -05:00
Brian Ng
2a0071028d
Add Number.parseFloat/parseInt mappins for preset-env 'usage' (#7421) 2018-03-08 09:08:43 -06:00
Gvozd
653318b7e4 Always transform for-await in async functions. (#7446)
for-await was transformed in @babel/helper-remap-async-to-generator, which was
called by @babel/plugin-transform-async-to-generator and
@babel/plugin-proposal-async-generator-functions. This prevented for-await
statements in async functions to be transpiled if the
transform-async-to-generator plugin was't enabled.
2018-03-05 09:30:25 +01:00
Logan Smyth
7cc00cce0d Require output fixture extension to match sourceType output. 2018-03-04 13:31:33 -08:00
Logan Smyth
beb99dfda1 Rename test fixtures using module syntax to .mjs files. 2018-03-04 13:31:32 -08:00
Michał Pierzchała
cc6e739f15 Add a brief summary to CLI's build output (#7439)
* feat(babel-cli): add a brief summary to build output

* address feedback

* further adjustments

* Use quiet output as default, add --verbose

* fix tests

* remove verbose alias
2018-03-03 13:29:26 +01:00
Daniel Tschinder
3e95830646
Migrate to jest (#7455) 2018-03-03 10:58:19 +01:00
Logan Smyth
ddd40bf5c7
Rely entirely on sourceType for module vs script differentiation. (#7417) 2018-02-27 18:11:13 -08:00
Brian Ng
182fe7b04e
Add missing promise polyfill deps for preset-env's useBuiltIns: usage (#7400) 2018-02-23 08:45:22 -06:00
Andrea Puddu
ee6dfd1580 Fix object spread according to spec (#7034) 2018-02-16 20:06:17 -05:00
Logan Smyth
d88173b9f8 Ensure that tests don't leave mutated global state in the environment. 2018-02-08 00:22:49 -08:00
Nicolò Ribaudo
dd0337cc85 Fix failing test (#7344) 2018-02-06 17:42:55 -06:00
Daniel Tschinder
593c1a0861 Add core-js as valid polyfill source (#7315) 2018-02-04 17:53:54 -06:00
Brian Ng
3deb246c7d
Add some es5 features to babel-preset-env (#6526) 2018-01-30 13:53:38 -06:00
Mateusz Burzyński
3316a554bf Support cjs shorthand for modules option in preset-es2015 & preset-env (#7283) 2018-01-30 11:46:21 -05:00
Mauro Bringolf
92fc26d399 Remove check-constants plugin (#6987)
* Rebased onto new version

* Moved constants check into a separate method
2018-01-26 10:43:09 -05:00
Kristofer Baxter
b3969d35fa Add preset-env target esmodules (#7212) 2018-01-22 15:44:10 -06:00
Nicolò Ribaudo
8659e1a88c Remove old expected.{js,json} files (#7187) 2018-01-09 13:10:30 -06:00