11219 Commits

Author SHA1 Message Date
Nicolò Ribaudo
3d49766f6b Don't extract rest elements from nested expressions (#7364)
* Don't extract rest elements from nested expressions

* Node 4
2018-02-17 16:22:38 +01:00
Brian Ng
4d17a96d50
Minor object-rest-spread README tweaks [skip ci] 2018-02-16 20:56:21 -06:00
James Reggio
6cbc585cf4 Fix over-zealous traversal by object-rest-spread (#7388)
Prior to this change, we'd conduct an open-ended traversal on the 'id'
of any VariableDeclarator to find a RestElement. The 'id' of
a VariableDeclarator can contain an AssignmentPattern (to supply
a default value), and if the right-hand side of the AssignmentPattern
contained a RestElement, we'd transform it.

The problem here is that the right-hand side of an AssignmentPattern can
be *any* Expression. If the right-hand side is a function body, we'd
traverse the entire function body, and if a RestElement occurred
anywhere in that function body, we'd transform it and emit the
transformations wherever we began the traversal (at least one scope
outside its usage).

The fix is to stop the inner traversal if we encounter an
AssignmentPattern. The outer traversal will still visit the
AssignmentPattern, so RestElements within the right-hand side of an
AssignmentPattern will be properly transformed at that time.
2018-02-16 21:19:09 -05:00
Andrea Puddu
ee6dfd1580 Fix object spread according to spec (#7034) 2018-02-16 20:06:17 -05:00
Logan Smyth
e732ee0c5b
Preserve import binding locations during module rewriting (#7378)
* Only wrap import references that need it.

* Preserve the import binding location for sourcemaps.

* Add tests.
2018-02-14 10:17:27 -08:00
Justin Falcone
128fc6864e Link generator readme to Babylon AST spec [skip ci] (#7380) 2018-02-14 11:40:39 -05:00
Raja Sekar
6aed8e944f updated node debugger usage command in test (#7376) [skip ci] 2018-02-13 11:17:19 -05:00
Mateusz Burzyński
4d164bd8e6
Added babel-helper-split-export-declaration (#7313) 2018-02-13 16:44:05 +01:00
Henry Zhu
ea3f2d9299 v7.0.0-beta.40 v7.0.0-beta.40 2018-02-12 11:41:13 -05:00
Vojtěch Štěpančík
88a0f52230 Fix CLI compilation callback calling (#7366) 2018-02-12 08:10:35 -05:00
Yeonghoon Park
4a2e1dbbc3 Fix stage-3 name in README.md (#7363)
[skip-ci] Fix a typo in preset-env doc: `@babel/preset-stage-3` package name.
2018-02-11 14:04:31 +02:00
Clar Roʒe
2979dd99ac Update browserslist for babel-preset-env. (#7365) 2018-02-11 09:57:50 +02:00
Suchipi Izumi
534ee4734c Extract @babel/highlight package from @babel/code-frame
This creates a new package called @babel/highlight which syntax highlights
JavaScript code for terminal output. This functionality was already
present in @babel/code-frame, but exposing it as a separate package lets
other projects leverage it. @babel/code-frame has been refactored
slightly so that it uses @babel/highlight to do its syntax highlighting.
2018-02-09 09:31:37 +01:00
Steven Hargrove
a01007a3d3 Allow falsey, yet valid options for codeFrameColumns() (#7341)
Allow for overriding default linesAbove/linesBelow values.
2018-02-08 16:52:12 -05:00
Logan Smyth
493996e02a
Merge pull request #7345 from loganfsmyth/small-bug-fixes
Small tweaks to prep for coming .babelrc lookup work
2018-02-08 13:30:49 -08:00
Justin Ridgewell
c03a34e509
Typo in nullish-coalescing-operator README.md 2018-02-08 14:34:41 -05:00
Naveen jain
92580e750d Fixes issues regarding super in optionalChain (#7356) 2018-02-08 14:31:47 -05:00
Logan Smyth
213805f21e Avoid duplicating types in index-browser. 2018-02-08 09:19:16 -08:00
Logan Smyth
28d13cb09b Fix small bug in the new .parse function. 2018-02-08 00:22:50 -08:00
Logan Smyth
9a8ba76e1f Merge .babelrc and .babelignore searching into a single pass. 2018-02-08 00:22:49 -08:00
Logan Smyth
d88173b9f8 Ensure that tests don't leave mutated global state in the environment. 2018-02-08 00:22:49 -08:00
Logan Smyth
85174b6ce1 Remove unneeded param from buildRootConfig. 2018-02-07 23:23:19 -08:00
Logan Smyth
ec2e0b664a Properly allow undefined ignore patterns for test/include/exclude. 2018-02-07 23:23:19 -08:00
Naveen jain
a3ad518ce1 [BugFix] : OptionalChaining Bug fixes (#7288)
* Added optionalExpression types to babylon and babel-types

* OptionalChain transforms bug fix

* Added OptionalExpressions to babel-generator. Fixed OptionalChain Bugs

* Removed 'optionalChain' from newExpression and added test cases

* Added test cases for optionalChain

* Update index.js
2018-02-07 19:42:14 -05:00
Nicolò Ribaudo
dd0337cc85 Fix failing test (#7344) 2018-02-06 17:42:55 -06:00
Nicolò Ribaudo
4887d81929 Remove bindings of removed paths from scope 2018-02-06 23:59:12 +01:00
Ben Newman
22555cd15d Failing test involving object rest/spread and clearScope().
This failing test case demonstrates a regression between 7.0.0-beta.38 and
7.0.0-beta.39 in the @babel/plugin-proposal-object-rest-spread package.

I distilled this test case from a larger configuration of plugins in my
application, one of which calls api.traverse.cache.clearScope(). Although
calling clearScope() is an uncommon thing for a plugin to do, it was a
reliable way to reproduce the problem. If I can find other reliable
reproductions, I'll push some additional failing tests to this PR.
Regardless of how common it is, clearing the scope cache should be a safe
operation that only slows down the transform (because scopes have to be
recreated and re-crawled). Crashing due to a spurious duplicate
declaration seems like a bug worth fixing.

My hunch is that [these two lines](eb38ea2b10/packages/babel-plugin-proposal-object-rest-spread/src/index.js (L75-L76))
(which were changed in `7.0.0-beta.39`) are not actually removing the
original rest element as a binding from the enclosing `Scope`, in certain
circumstances, so the new variable declaration ends up colliding with the
old (removed) binding.

Possibly related: #7304 (reported by @julien-f)
2018-02-06 23:59:12 +01:00
Daniel Tschinder
593c1a0861 Add core-js as valid polyfill source (#7315) 2018-02-04 17:53:54 -06:00
Kai Cataldo
7234442fde Add location information to parsing errors (#7314) 2018-02-04 13:00:03 -06:00
Justin Ridgewell
5ea1bfe780
Do not optimize away async/gen arrow functions (#7319)
* Do not optimize away async/gen arrow functions

* Node version 8
2018-02-03 17:08:12 -05:00
Tauyekel Kunzhol
2254ed45d2 [Bug fix] Reaching maximum calls stack when copying large number of non-js files in babel-cli (#7320)
Maximum call stack occurs when you try to copy large number of non-js files using `babel-cli@7.0.0-beta.38` or `babel-cli@7.0.0-beta.39`
2018-02-02 20:56:57 -08:00
Logan Smyth
278cd5e572
Preserve identifier location information when mapping this and arguments. (#7312) 2018-02-01 18:54:15 -08:00
Mathias Bynens
96c0415c86
Remove outdated sentence from README (#7311)
Unicode property escapes are now part of ECMAScript proper.

[skip ci]
2018-02-01 14:27:13 -08:00
K Sashi Kumar
ed98d2491e [Typescript] - Fix SyntaxError in async arrow functions with rest params (#7297)
* Fix: [Typescript] - SyntaxError in async arrow functions with rest params

* Fix optional params and add test code in flow
2018-01-31 21:05:24 +01:00
Henry Zhu
eb38ea2b10
Update babel to beta.39 (#7302) 2018-01-30 22:59:00 -05:00
Nicolò Ribaudo
f19d559ff3
Compile Babylon with Gulp (#7240) 2018-01-30 23:13:40 +01:00
Henry Zhu
73e64c6cb0 v7.0.0-beta.39 v7.0.0-beta.39 2018-01-30 15:27:19 -05:00
Brian Ng
3deb246c7d
Add some es5 features to babel-preset-env (#6526) 2018-01-30 13:53:38 -06:00
Henry Zhu
1ebc229fa5
Revert "make babel injectable in babel-register" (#7298)
Revert "make babel injectable in babel-register"
2018-01-30 14:16:02 -05:00
Nicolò Ribaudo
cc4913699b Update packages/babylon/README.md [skip ci]
https://github.com/babel/babel/pull/7292#discussion_r164765384
2018-01-30 20:08:15 +01:00
Henry Zhu
82b6ee734b
Revert "make babel injectable in babel-register" 2018-01-30 12:39:38 -05:00
Kai Cataldo
22c8f6376c babel-core: Add parse method (#7291) 2018-01-30 12:38:58 -05:00
Raja Sekar
023550c87b Docs: updated link relative to babel/babylon (#7292) [skip ci] 2018-01-30 12:05:43 -05:00
Henry Zhu
8e0d247e8c Fix: fixup package name [skip ci] 2018-01-30 12:04:52 -05:00
Naveen jain
65ae4ff15b Fix: export default decorated class parsed as class expression (#7189) 2018-01-30 12:00:29 -05:00
Owen Buckley
2185256589 update substitution placeholder message in @babel/template (#7255) 2018-01-30 11:54:31 -05: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
Nicolò Ribaudo
252ea5a966 Fix reused nodes - part 2 (#7149) 2018-01-29 22:59:06 +01:00
Mateusz Burzyński
912bcc186d Fix reused nodes - part 1 (#7149) 2018-01-29 22:59:06 +01:00
Nicolò Ribaudo
63ae923987 Add t.cloneNode and deprecate t.clone and t.cloneDeep (#7149) 2018-01-29 22:59:06 +01:00