13639 Commits

Author SHA1 Message Date
Huáng Jùnliàng
6a00cbe0ab
fix: isIdentifierName should reject empty string (#11339) 2020-03-26 21:54:50 +01:00
Huáng Jùnliàng
a901bd50b1
chore: remove unused graceful-fs (#11329) 2020-03-25 09:13:44 -05:00
Huáng Jùnliàng
8e7ef30968
polish: align optional chain whitespace behavior to their sibiling (#11328) 2020-03-24 15:52:36 -04:00
Mateusz Burzyński
025e4ae44c
Fixed issue with programPath.scope.references not being regist… (#11323) 2020-03-24 16:27:32 +01:00
Babel Bot
46f31460d6 Add v7.9.4 to CHANGELOG.md [skip ci] 2020-03-24 08:32:30 +00:00
Nicolò Ribaudo
d3cf5fb5f4 v7.9.4 2020-03-24 09:26:12 +01:00
Kai Cataldo
4e6c9c52ef
fix: token after strict mode block is evaluated in strict mode (#11186) 2020-03-24 08:38:02 +01:00
Huáng Jùnliàng
146ea4176e
fix: check parenthesis between optional chain and other types (#11325) 2020-03-24 08:28:47 +01:00
Huáng Jùnliàng
dc7c5640e9
Compact parser fixture loc info (#11322)
* chore: compact loc information in parser fixtures

* chore: update test fixtures
2020-03-23 20:10:29 -04:00
Brian Ng
6a728a05a8
Restore default pragmas in preset-react for classic runtime (#11324) 2020-03-24 00:06:44 +01:00
Nicolò Ribaudo
9b976b2164
Test Babel compiled using an old version of @babel/core (#11319)
* Test Babel compiled using an old version of @babel/core

This should catch regressions where we use a new helper without a fallback
for older versions, or when we use a new @babel/traverse method.

* Enable the test
2020-03-23 22:42:40 +01:00
Nicolò Ribaudo
d23f0ae0ec
Add regression tests for regenerator (#10223)
* Add regression tests for regenerator

* Update tests
2020-03-23 20:49:59 +01:00
Vlad Rindevich
2f549886e4
[preset-typescript] Fix private members type annotations (#11315) 2020-03-23 19:33:16 +01:00
Babel Bot
296d8ce179 Add v7.9.3 to CHANGELOG.md [skip ci] 2020-03-22 11:07:26 +00:00
Nicolò Ribaudo
1ae85560a7 v7.9.3 2020-03-22 11:57:58 +01:00
Nicolò Ribaudo
ceb54dd756
Define default value for vars shadowing params (#11307)
* Define default value for vars shadowing params

* Remove from package.json

* Only convert traverse the params if needed

This prevents this plugin from running after the destructuring
transform, which causes #11256

* Review

* Review

* Update packages/babel-plugin-transform-parameters/src/params.js [skip ci]

Co-Authored-By: Brian Ng <bng412@gmail.com>

Co-authored-by: Brian Ng <bng412@gmail.com>
2020-03-22 10:45:10 +01:00
Nicolò Ribaudo
b0315b81c7
Fix logic to insert parens in return statements with comments (#11306) 2020-03-21 20:53:38 +01:00
Huáng Jùnliàng
5b2c1f34d3
chore: fix build-babel exclude in gulpfile (#11293) 2020-03-21 19:39:22 +01:00
Vedant Roy
0e5c1da659
fix: async arrow functions should not be allowed after binary… (#11284)
* Forbid async arrow functions after binary operator.

This commit makes Babel throw an error when parsing
code like "3 + async() => 2".

* Make atPossibleAsync more accurate

* Change atPossibleAsync to atPossibleAsyncArrow

Add an extra test to atPossibleAsync and refactor it to
atPossibleAsyncArrow. This also fixes a bug in the Typescript plugin,
so a new test has been added.

* Add test for async arrow after unary operator
2020-03-21 19:38:36 +01:00
Babel Bot
a9b430b464 Add v7.9.2 to CHANGELOG.md [skip ci] 2020-03-21 14:15:41 +00:00
Nicolò Ribaudo
2399e0df23 v7.9.2 2020-03-21 14:57:31 +01:00
Nicolò Ribaudo
429dd2ce8a
Manually inline the createSuper helper on older Babel versions (#11298)
* Manually inline the createSuper helper on older Babel versions

* Forgot to commit this

* Add comments [skip ci]
2020-03-21 14:39:14 +01:00
Nicolò Ribaudo
3d8f48cb16
Don't use ES6 in the for-of helper (#11302) 2020-03-21 02:22:25 +01:00
Kai Cataldo
7ca814489a
fix: parse value imports named type as values (#11296)
* fix: parse value imports named type as values

* Address feedback

* Add plugin tests

* Add isContextual() check

* Remove importKind: value from extraneous nodes

* Ensure importKind is correct for more nodes

* Add additional test

* Address feedback

* Revert formatting

* Fix tests
2020-03-21 01:38:07 +01:00
Huáng Jùnliàng
469e8ed591
Transform cwd in string literal on win32 (#11297)
* chore: replace win32 cwd in string literal by <CWD>

* chore: update test fixtures
2020-03-20 23:59:02 +01:00
Babel Bot
ebca5807dc Add v7.9.1 to CHANGELOG.md [skip ci] 2020-03-20 21:55:02 +00:00
Nicolò Ribaudo
220ce702a1 v7.9.1 2020-03-20 22:47:03 +01:00
Nicolò Ribaudo
87b2781046
Consider jsxFrag as set when it's set to the default value (#11295)
* Consider jsxFrag as set when it's set to the default value

* Test #11294
2020-03-20 22:29:50 +01:00
Babel Bot
bb6a1580d2 Add v7.9.0 to CHANGELOG.md [skip ci] 2020-03-20 15:40:03 +00:00
Nicolò Ribaudo
8d5e422be2 v7.9.0 2020-03-20 16:32:55 +01:00
Huáng Jùnliàng
e39b508030
Add @babel/helper-validator-identifier (#11289)
* refactor: replace esutils.keywords.isIdentifierNameES6 by helper-validator-identifier

* refactor: replace esutils isReservedWordES6 by isKeyword || isReservedWord

* address review comments

* chore: specify both “main” and “exports”

* build helper-validator-identifier before babel-types
2020-03-20 12:23:14 +01:00
Oliver Dunk
693a5df7a9
Memoize call expressions in optional chains in loose mode (#11261)
* Memoize in loose mode when callee is a CallExpression

* Handle more complex OptionalCallExpressions where memoization is needed

* Convert calls to Function#call when member needs memoization

* Only update call context for member expressions
2020-03-20 08:59:03 +01:00
Nicolò Ribaudo
2e6f9583ca
Pass the correct this to JSX's __self with the old plugin (#11290) 2020-03-19 23:26:05 +01:00
Nicolò Ribaudo
11292a3c74
Use the correct this in __self for JSX elements in arrows (#11288)
* Inject `__source` and `__self` in JSX elements earlier

This fixes an issue where `this` was not correct inside arrow functions, similar to
906f8be24d

* Add test

* Remove try-catch

* Update error

* Update fixtures

* Update windows fixtures
2020-03-19 20:01:17 +01:00
Huáng Jùnliàng
0a02a12235
Move object-rest-spread after transform-parameters (#11280)
* fix: move proposal-object-rest-spread after transform-parameters

* update test fixtures

* fix: update plugin-features.js
2020-03-19 17:08:54 +01:00
Nicolò Ribaudo
f3912ac08f
Mark transpiled JSX elements as pure (#11126)
* Mark transpiled JSX elements as pure

* Avoid duble annotation

* Add "pure" option to the React preset

* Fix generator indentation

* Update tests

* Add tests for the "pure" option

* Update windows fixtures
2020-03-19 15:43:54 +01:00
Nicolò Ribaudo
fa7ec81771
Allow for-of on polyfilled or builtin iterables without Symbol support (#11285) 2020-03-19 11:02:12 +01:00
Nicolò Ribaudo
6f932978f8
Add for-of fallback for arrays in browsers without symbol supp… (#11263)
* Add for-of fallback for arrays in browsers without symbol support

* Update after rebase

* Re-throw error when iterating array

* Update fixture
2020-03-19 02:17:41 +01:00
Huáng Jùnliàng
d60802bf73
fix: object-rest-spread should not transform array rest (#11282) 2020-03-18 20:55:38 -04:00
Guy Bedford
375847b671
fix: ensure explicit file extensions in "exports" (#11283) 2020-03-19 00:23:02 +01:00
Andrew Neitsch
6892d51472
Add path separator to @babel/register sourceRoot (#11249) 2020-03-18 22:34:19 +01:00
Nicolò Ribaudo
78ace99615
Silence dynamic import() warnings in tests (#11279) 2020-03-18 15:42:19 +01:00
Brian Ng
f405cd809c
Update compat-data (#11277) 2020-03-18 10:24:14 +01:00
Huáng Jùnliàng
48d53f8fef
chore: bump json5 and minimist (#11276)
* chore: bump json5 and minimist

* update mkdirp to version 0.5.3
2020-03-18 10:21:22 +01:00
Huáng Jùnliàng
4bf36e64da
Create File class for babel helpers (#10575)
* add test

* fix: pass File to helper traverser

* pass babel.File to helpers.ensure
2020-03-17 09:58:46 +01:00
Luna Ruan
748897be07
Add experimental version of the `babel-plugin-transform-react-… (#11154)
* add next option for babel-plugin-transform-react-jsx

* address review comments

* chore: update test fixtures

* Update fixture

* Add "columnNumber" to the new React transform

* Update windows fixtures

* Delete unused output.js

* Update windows tests

* Fix windows again

* fix comments

Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
Co-authored-by: Moti Zilberman <motiz88@gmail.com>
2020-03-17 09:16:53 +01:00
Nicolò Ribaudo
10aa97bc10
Allow rest/spread on polyfilled or builtin iterables without Symbol support (#11268)
* Allow rest/spread on polyfilled or builtin iterables when `Symbol` unsupported

Currently, when `Symbol` is not supported, we allow using rest/spread with:
- arrays
- strings
- arguments

With this PR, it will be also possible to use it with
- maps
- sets
- binary arrays

While in old browsers es6 builtins would still need to be polyfilled, it's way
easier to polyfill them because `Symbol` cannot be reliably polyfilled.

I didn't use `instanceof` becase:
- it doesn't work with polyfills not attatched to the global scope
- when using Babel to load polyfills, it would force the inclusion of `Map` and `Set` polyfills even if they are not used

Downside: the current approach of relying on `toString || construcor.name` doesn't work with subclasses.

* Don't use Array.from for array-like objects
2020-03-17 08:14:05 +01:00
Huáng Jùnliàng
841f4428e8
Rephrase parser error message (#11208)
* refactor: rephrase some parser error messages

* update test fixtures

* Update packages/babel-parser/src/parser/location.js

Co-Authored-By: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>

* address review comments

* Update packages/babel-parser/src/parser/location.js

Co-Authored-By: Brian Ng <bng412@gmail.com>

* update test fixtures

Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
Co-authored-by: Brian Ng <bng412@gmail.com>
2020-03-16 21:48:32 -04:00
Nicolò Ribaudo
8e7ca22ed7
Create Npm_error.md issue template (#11217)
[skip ci]
2020-03-17 02:38:00 +01:00
Justin Ridgewell
56500603da
Add stricter Optional Chain node validation (#11250)
* Add stricter Optional Chain node validation

Optional chains cannot start with `optional: false`. Somewhere in the `object`/`callee` tree, there must be an optional with `optional: true`.

* Print current node's type when finding an error.
2020-03-17 02:17:11 +01:00