12672 Commits

Author SHA1 Message Date
Nicolò Ribaudo
43aa7e262c
Don't throw when destructuring into a var named as an import (#10628) 2019-11-04 22:50:36 +01:00
Huáng Jùnliàng
5e24016623 fix: remove ExportNamedDeclaration when the specifier is empty (#10638) 2019-11-04 21:51:24 +01:00
Nicolò Ribaudo
d023e105b7 [TS] Parse calls with type args in optional chains (#10631)
* [TS] Parse calls with type args in optional chains

* Test output
2019-11-04 13:25:15 -05:00
Nicolò Ribaudo
abce0ef49d [TS] Correctly transform computed strings and templates in enums (#10555)
* [TS] Correctly transform computed strings and templates in enums

* Typo [skip ci]
2019-11-04 13:22:49 -05:00
Chris Garrett
5c0d8a9de7 add legacy decorators support to strict class fields (#10616)
This PR allows legacy decorators to work with strict class fields, which
are now stage 3 and have shipped in a number of browsers. Allowing this will
allow users of the legacy transform (which is currently recommended by the
champions of the decorator proposal) to use the proper class field semantics
for non-decorated fields, which should help prevent breakage later on.

This change is not a breaking change, since users had to explicitly opt into
loose mode in class fields before. This just gives them the option to remove
that opt-in.
2019-11-04 13:05:42 -05:00
Nicolò Ribaudo
bea1b0d0af
Add support for .cjs config files (#10599)
* Remove duplicate config loading logic and errors

* Add support for .cjs config files

* Add tests

* [tests] Fallback for fs.promises on node 6
2019-11-04 00:24:44 +01:00
Mohammad Ahmadi
58a646be59 corrected the grammar of option descriptions (#10589)
* corrected the grammar of option descriptions

* added comment
2019-11-04 00:24:00 +01:00
Martin Forsgren
c7d8b8a377 throw a TypeError if identifier validation fails (#10621)
* throw a TypeError if Identifier validation fails

* Relax identifier validation, reserved words are ok
2019-11-02 12:04:16 +01:00
Huáng Jùnliàng
d08702c9d2
inputSourceMap should work when it is in an external file (#10623)
* fix: construct comment block for fromMapFileComment

* add test

* small tweak: redundant capturing group
2019-10-31 16:12:44 -04:00
Huáng Jùnliàng
a2b5437b01 chore: remove output-file-sync dependency (#10619) 2019-10-31 11:51:36 -07:00
Linus Unnebäck
0b0edc3e3d chore: bump source-map-support to 0.5.16 (#10615) 2019-10-30 07:56:52 -04:00
Huáng Jùnliàng
e419e5fe42
chore: bump source-map-support to 0.5.14 (#10614) 2019-10-29 19:19:16 -04:00
Nicolò Ribaudo
4e6a4b08bb
Create @babel/plugin-syntax-top-level-await (#10573) 2019-10-29 23:27:56 +01:00
Ivan Medina
3d2f365074 [transform-react-jsx] Add useSpread option to transform JSX (#10572)
* [transform-react-jsx] Add useSpread option to transform JSX

* Add validation for default option

* Add error when using useSpread and useBuiltIns at the same time

* Move useSpread to convertAttribute helper function

* Add useSpread option to presect-react

* Remove casting useSpread to boolean in preset-react option.

Co-Authored-By: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2019-10-29 23:02:53 +01:00
Huáng Jùnliàng
8ffca0475a Merge multiple regex transform plugin (#10447)
* feat: implement create-regexp-features-plugin

* fix: test input is not effective

* refactor: leverage create-regexp-features-plugin

* test: add more test cases

* test: update test fixture

* chore: add type annotation to features

* test: add regression test for issue 9892

* add regression test for issue 9199

* address review comments from Nicolò

* address review comments from Brian

* small tweaks

* Enable dotAllFlag when flags includes u
2019-10-29 22:58:04 +01:00
George Zahariev
ec3345bb57 Flow enums parsing (#10344)
* Flow enums parsing

* Parse exporting enums

* Enums parsing remove lookahead, other improvements

* Enums: add EnumBody and EnumMember aliases, change boolean members to use BooleaLiteral value

* Fix enum member init flow type, now that boolean members have a BooleanLiteral value

* Flow enums: use contextual utils, change members length checks to use logic operators, remove reserved word logic modification

* Flow enums: remove unnecessary code in generator, fix error message
2019-10-29 22:55:12 +01:00
Vivek Nayyar
4b3a19ea9f fixed missing errors on assignment pattern in object expression (#10607)
* 🐛 fixed missing errors on assignment pattern in object expression

* ♻️ remove a non-needed comment

* 🐛 missed adding comma in the test input

* 🐛 fixed the failing valid-property-initializer test
2019-10-29 22:32:02 +01:00
Micah Zoltu
198b4a0fbd Changes UMD callsite to be more likely to pass in the intended… (#10477)
* Changes UMD callsite to be more likely to pass in the intended object.

Fixes #10476
Note: This PR should be considered pseudocode and used as an illustration of the proposed fix.  I do not know nearly enough about this project to know if this is an appropriate solution to the problem, nor do I have the confidence to update the tests appropriately.

* Update tests
2019-10-29 22:19:49 +01:00
Nicolò Ribaudo
143d159982
Create parser plugin "topLevelAwait" (#10449)
* Create parser plugin "topLevelAwait"

* Update test262 whitelist

* Update ts typings

* Fix "sourceType: unambiguous" with TLA

* Ambiguous tokens after await

* Update await %x(0)

* typo [skip ci]

* Typo [skip ci]

Co-Authored-By: Brian Ng <bng412@gmail.com>
2019-10-29 22:18:39 +01:00
Georgii Dolzhykov
63f9a3c946 rename assertsModifier to asserts (#10613)
see https://github.com/babel/babel/pull/10543#issuecomment-547571501
2019-10-29 16:25:42 -04:00
Devon Govett
3a5e8a8dd4 Add support for babel.config.json (#10501)
* Add support for babel.config.json root config

* Throw if multiple configuration files are found

* Add tests
2019-10-29 19:37:50 +01:00
Tan Li Hau
38a3063111 add assertions signature for TypeScript (#10543)
* add asserts predicate

* fix flow

* babel-generator for typescript assertions

* babel-types for typescript assertions

* asserts modifier as boolean
2019-10-29 18:51:33 +01:00
Nicolò Ribaudo
4cd93ab5f3
[parser] Enable "exportNamespaceFrom" by default (#10521) 2019-10-29 18:44:32 +01:00
Eugene Myunster
d248e2d188 moving proposalNullishCoalescingOperator and proposalOptionalChaining to stage 3 (#10590) 2019-10-29 18:44:01 +01:00
Nicolò Ribaudo
f47fbd5f39
Nit: Use ?. in the example used by the proposal readme (#10604) 2019-10-29 18:35:15 +01:00
Bogdan Chadkin
be0fcaaf49 Make dir for babel --out-file (#8622)
* Make dir for babel --out-file

Currently there's unexpected regression after upgrade from babel 6.
On creating file with any depth like dist/index.js the error about
not existing directory is thrown.

In this diff I modified babel-cli to create deep directory for out-file
command.

I also replaced `mkdirp` with more supported `make-dir` package which
also have official promise support.

* Fix test
2019-10-29 18:29:45 +01:00
彭驰
4e5ac1fd5c Fix #8326, add back --quiet option. (#10399)
* Fix issue #8326, quiet the @babel/cli with --quiet cli option.

* --quiet and --verbose options now conflict with each other.
2019-10-29 18:28:52 +01:00
Nicolò Ribaudo
1d1fab4ea2
[parser] Add support for private fields in TypeScript (#10483)
* [parser] Add support for private fields in TypeScript

* Fix flow
2019-10-29 18:27:54 +01:00
Simen Bekkhus
f1bc6c4e18 feat: if code frame error is on a single line, highlight the w… (#10361)
* feat: if code frame error is on a single line, highlight the whole path

* flow
2019-10-29 18:23:54 +01:00
gr
b6ef9689b2 [parser] Parse only modifiers of actual methods (#10594)
* Parse only modifiers of actual methods

* Throw question token if is used before the real name
2019-10-29 17:56:05 +01:00
Huáng Jùnliàng
01927babe2 chore: update web.immediate support fixtures (#10612) 2019-10-29 16:23:59 +01:00
Mateusz Burzyński
9ada30c207 Use .find instead of .filter to get targetPath in ImportInjector (#10608) 2019-10-27 15:09:03 -04:00
ExE Boss
43065a9e24 fix(babel‑helpers/interopRequireWildcard): Avoid double nullis… (#10585)
* fix(babel‑helpers/interopRequireWildcard): Avoid double nullish check

* Update fixtures
2019-10-24 23:14:44 +02:00
Brian Ng
fce1b74105 Test node@13 on CircleCI (#10600) 2019-10-24 09:28:01 -04:00
Huáng Jùnliàng
562b6c3bbb chore: replace outdated travis-ci.org badges [ci skip] (#10593) 2019-10-22 21:35:02 -04:00
Huáng Jùnliàng
1770dace34 chore: test against Node.js 13 (#10591) 2019-10-23 00:23:20 +02:00
Matthew Whitworth
5b40845afe add test and fix for string literal case (#10578) 2019-10-21 17:39:03 +02:00
samuel kwok
fe258dec04 fix: _interopRequireWildcard should only cache objects (#10574)
* fix: [#10561] _interopRequireWildcard should cache object only

* fix: narrow down cache restriction to object/function type

* test: add interop require null module case
2019-10-19 12:01:38 +02:00
Nicolò Ribaudo
78cd63d9cf
Fix invalid test layout in @babel/parser 2019-10-18 11:16:17 +02:00
Nicolò Ribaudo
43b623c1f1
[traverse] Allow skipping nodes inserted with .replaceWith() (#9777)
* Avoid regression
2019-10-18 00:16:35 +02:00
Daniel Arthur Gallagher
b5b8055cc0 docs: add homepage link to @babel/runtime package.json (#10418)
* docs: add homepage link

Adds a homepage link to populate npmjs.com.
Update the repository property syntax.

* Update the repository link

Point to the root repo plus a reference to the subdirectory.

* style: drop HTML extension
2019-10-17 23:26:14 +02:00
Jaideep Bhoosreddy
da9c9a64c2 Add master branch workflow for test262 tests (#10556)
The results of these tests will be stored in build artifacts which will be used to compare with test262 runs on PR (future work!). Robin has also done a
lot of work to ensure all babel packages are properly linked to the
test runner. Additionally, Nicolo has helped in mentorship and
contributions to babel-test262-runner which is used here.

We're no longer giving xunit output to CircleCI because once it sees failing tests it will mark babel's master as broken. As a stopgap, it will render the test results in the mocha spec format, which is human readable.

Co-Authored-By: Robin Ricard <rricard2@bloomberg.net>
Co-Authored-By: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2019-10-17 13:52:31 -04:00
Huáng Jùnliàng
8c94b3f209
Bump babel-types to ^7.6.3 (#10568)
* fix incorrect lerna bootstrap options

* chore: bump @babel/types dependencies to v7.6.3

* chore: remove ignore-engines on lerna bootstrap
2019-10-17 07:49:41 -04:00
gr
095f28a913 fix: Exclude catch clause from let identifier error (#10559)
* Exclude catch clause from let identifier error

* Disallow let binding based on parameter

* Add test

* Remove unused getter

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

Co-Authored-By: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2019-10-17 09:30:36 +02:00
Huáng Jùnliàng
487f10f84d fix: disable caching when babel could not read/write cache (#10557)
* fix: disable caching when babel could not read/write cache

* emit warning when cache folder resides in readonly fs

* fix: always register save handler

* cache: maintain old behaviour

* test: add more test case

* fix: next tick tasks are FIFO

* test: disable test on Windows
2019-10-17 09:30:01 +02:00
piotr
5800fc97b3 [parser] Exception to 8 and 9 in tagged template (#10567) 2019-10-17 00:01:22 +02:00
Nicolò Ribaudo
2254542010
Don't use deprecated "lerna publish --require-scripts" (#10558) [skip ci] 2019-10-16 22:13:21 +02:00
Brian Ng
d234ff6572 Revert "chore: introduce envinfo into environment section (#10553)" (#10564)
This reverts commit 800eccc046ff71e4c2a0cbdb3fdddbae87933a71.
2019-10-16 10:56:35 -04:00
Huáng Jùnliàng
800eccc046 chore: introduce envinfo into environment section (#10553)
* chore: introduce envinfo into environment section [skip ci]

* Apply suggestions from code review

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

* Address review comments from Nicolò

* Update .github/ISSUE_TEMPLATE/Bug_report.md [skip ci]

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

* chore: simplify issue template [skip ci]
2019-10-16 09:12:13 -05:00
Gerald
cd5d3abc32 fix: String#italics is incorrectly defined in babel-preset-env (#10563) 2019-10-16 09:23:47 -04:00