14682 Commits

Author SHA1 Message Date
Huáng Jùnliàng
79d3276f61
Overhaul comment attachment (#13521)
* refactor: inline pushComment

* chore: add benchmark cases

* perf: overhaul comment attachment

* cleanup

* update test fixtures

They are all bugfixes.

* fix: merge HTMLComment parsing to skipSpace

* perf: remove unattachedCommentStack

baseline 128 nested leading comments: 11_034 ops/sec ±50.64% (0.091ms)
baseline 256 nested leading comments: 6_037 ops/sec ±11.46% (0.166ms)
baseline 512 nested leading comments: 3_077 ops/sec ±2.31% (0.325ms)
baseline 1024 nested leading comments: 1_374 ops/sec ±3.22% (0.728ms)
current 128 nested leading comments: 11_027 ops/sec ±37.41% (0.091ms)
current 256 nested leading comments: 6_736 ops/sec ±1.39% (0.148ms)
current 512 nested leading comments: 3_306 ops/sec ±0.69% (0.302ms)
current 1024 nested leading comments: 1_579 ops/sec ±2.09% (0.633ms)

baseline 128 nested trailing comments: 10_073 ops/sec ±42.95% (0.099ms)
baseline 256 nested trailing comments: 6_294 ops/sec ±2.19% (0.159ms)
baseline 512 nested trailing comments: 3_041 ops/sec ±0.8% (0.329ms)
baseline 1024 nested trailing comments: 1_530 ops/sec ±1.18% (0.654ms)
current 128 nested trailing comments: 11_461 ops/sec ±44.89% (0.087ms)
current 256 nested trailing comments: 7_212 ops/sec ±1.6% (0.139ms)
current 512 nested trailing comments: 3_403 ops/sec ±1% (0.294ms)
current 1024 nested trailing comments: 1_539 ops/sec ±1.49% (0.65ms)

* fix: do not expose CommentWhitespace type

* add comments on CommentWhitespace

* add test case for #11576

* fix: mark containerNode be the innermost node containing commentWS

* fix: adjust trailing comma comments for Record/Tuple/OptionalCall

* fix: drain comment stacks in parseExpression

* docs: update comments

* add a new benchmark

* chore: containerNode => containingNode

* add more benchmark cases

* fix: avoid finishNodeAt in stmtToDirective

* finalize comment right after containerNode is set

* add testcase about directive

* fix: finish SequenceExpression at current pos and adjust later

* chore: rename test cases

* add new test case on switch statement

* fix: adjust comments after trailing comma of function params

* add comment attachment design doc

* misc fix

* fix: reset previous trailing comments when parsing async method/accessor

* chore: add more comment testcases

* fix flow errors

* fix: handle comments when parsing async arrow

* fix: handle comments when "static" is a class modifier

* fix flow errors

* fix: handle comments when parsing async function/do

* refactor: simplify resetPreviousNodeTrailingComments

* update test fixtures
2021-07-07 11:51:40 -04:00
Huáng Jùnliàng
8a3e0fd960
Async do expression should start at async (#13534) 2021-07-07 00:09:34 -04:00
Huáng Jùnliàng
bfd2f8f4b1
fix: disallow computed async/get/set keyword (#13531) 2021-07-07 00:25:57 +02:00
Nitin Kumar
bc1b9537b0
Fix arrow transformation when arguments is defined as variable (#12344)
* fix: arrow-fn transformation when 'arguments' is defined as var

* fix: tests

* refactor: code

* Review by @nicolo-ribaudo

Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-07-06 13:59:24 -04:00
Colin Wang
a5a63e3033
fix: accept duplicated import/variable in different module (#13527)
Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
2021-07-06 19:18:12 +02:00
Colin Wang
fce35af691
fix(babel-types): accept UnaryExpression in TSLiteralType (#13525)
* fix(babel-types): add validator for TSLiteralType to accept UnaryExpression

seems that the generated files is missing typings

fix #13327

* fix(babel-types): add allowlist for TSLiteralType

now generated types seems correct

* fix(babel-types): use oneOfNodeTypes instead of oneOf
2021-07-03 00:34:26 +02:00
Mickey Rose
4ee78eb3f1
minor improvement to gulp generate-runtime-helpers error message (#13522)
* improve gulp generate-runtime-helpers error message

If you had some garbage in packages/babel-runtime-helpers/src/helpers/,
gulp generate-runtime-helpers would blow up with an unhelpful message:

    TypeError: Cannot read property 'groups' of null

* ignore files starting with a dot when generating runtime helpers
2021-07-02 09:12:19 -04:00
Federico Ciardi
9bad558d13
[babel 8] Use an identifier for TSTypeParameter.name (#12829) 2021-07-02 10:44:49 +02:00
Jaeseok Kang
6df0b7c25f
Fix config validation message typo (#13515)
* Fix config validation message typo

* Fix `checkNoUnwrappedItemOptionPairs` type param
2021-06-29 08:54:47 +02:00
lightmare
e6068cd9a5
enhance benchmark output with thousands separators (#13512) 2021-06-28 11:57:15 +02:00
Huáng Jùnliàng
90d5eb7f2f
fix: sync default_extensions to babel-cli usage (#13508) 2021-06-25 07:58:28 -04:00
Tony Gorez
b0fe6bdbc3
chore(parser): add test to handle optional paramteter in async call (#13504)
* chore(parser): add test to handle optional paramteter in async call

* chore(parser): add flow test

* chore(parser): add ts test
2021-06-23 11:11:06 -04:00
Huáng Jùnliàng
3840893b48
Add typeParameters to tagged template visitor keys (#13500)
* refactor: move ES2022 AST nodes to core

* fix: add typeParameters to visitor keys

* chore: update artifacts

* fix: add typeAnnotation to visitor keys
2021-06-22 17:40:42 -04:00
overlookmotel
5ac5e3572f
Fix const violations in ESM imports when transformed to CJS (#13258) 2021-06-22 19:33:46 +02:00
Bogdan Savluk
47ad54a057
convert @babel/preset-env to typescript (#13217)
* babel-preset-env flowts rename

* babel-preset-env flowts convert

* babel-preset-env fixes

* babel-preset-env

* make generate-tsconfig

* Minimize diff

* Fix many type errors

Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-06-22 10:58:08 -04:00
Babel Bot
22e5afc2f3 Add v7.14.7 to CHANGELOG.md [skip ci] 2021-06-21 21:54:42 +00:00
Babel Bot
268e4ca0de v7.14.7 2021-06-21 21:44:55 +00:00
Lively
8ae0efe98a
Don't hoist template literal keys in object-rest-spread (#13483)
* remove hoisting when using template strings in proposal-object-rest-spread

* remove const from test
2021-06-21 22:48:12 +02:00
Huáng Jùnliàng
5145c98a73
Simplify token context (#13450)
* refactor: unify tc.brace and tc.templateQuasi

* refactor: remove unused context check

* perf: reduce arrayPrototype call and hoist variables
2021-06-21 10:51:00 -04:00
Nicolò Ribaudo
8c229e7657
Bump core-js packages (#13496) 2021-06-21 09:34:49 -05:00
Terence Ng
9cbe283bb8
chore: fix comment typo (#13485)
* chore: fix comment typo

* chore: regenerate tsconfig file

Co-authored-by: terencekhwu <terencekhwu@tencent.com>
2021-06-19 13:16:54 +02:00
Tony Gorez
101249f3aa
refactor(parser): remove refNeedsArrowPos (#13419)
* fix(parser:expression): remove refNeedsArrowPos in parseExprListItem

* feat: use refExpressionErrors to catch optional parameters

* feat: delete useless refNeedArrowPos

* fix: forgotten deletion

* fix: lint and factorize

* fix: delete useless comment

* fix: review corrections

* fix: review corrections pt2

* fix: review correction pt2

* fix: nit correction

* fix: update types

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

* fix: add invariant comment in flow and ts file

Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-06-19 10:40:52 +02:00
Lively
eb22659817
remove unnecessary hosting when using template strings (#13482) 2021-06-17 21:43:08 -04:00
Huáng Jùnliàng
dddb4133d2
fix: remove traverse trap on NODE_ENV == "test" (#13475) 2021-06-17 16:29:56 +02:00
Pedro Lourenço
d74838609e
Add record and tuple tokens to eslint parser (#13477) 2021-06-17 16:29:32 +02:00
Nicolò Ribaudo
6beccb34cb
Update @babel/* dev dependencies (#13472) 2021-06-16 17:48:29 +02:00
Federico Ciardi
f808a3eb14
chore: fix renovate bot schedule (#13470) 2021-06-15 16:12:11 -04:00
Federico Ciardi
762d34dae4
chore: fix renovate bot schedule (#13468) 2021-06-15 12:10:41 -04:00
Nicolò Ribaudo
c0eaab13b0
Setup Renovate to update third-party parser tests (#13454) 2021-06-15 12:01:22 -04:00
Sagiv ben giat
a3c7497eb7
fix: tagged template incorrect receiver (#13395)
* fix: tagged template incorrect receiver

* review changes

* func exp instead of arrow

* review comments

* update tests output

* swap arrow funcs to regular funcs

Co-authored-by: sagiv.bengiat <sagiv.bengiat@appsflyer.com>
2021-06-15 12:01:07 -04:00
Babel Bot
45174730ab Add v7.14.6 to CHANGELOG.md [skip ci] 2021-06-14 21:57:39 +00:00
Babel Bot
1774e2aaef v7.14.6 2021-06-14 21:45:36 +00:00
Sosuke Suzuki
f79e9ffe44
Follow up formatting by Prettier 2.3.1 (#13463) 2021-06-14 19:30:32 +02:00
Sosuke Suzuki
ad693cc0a0
Update prettier to 2.3.1 (#13460) 2021-06-14 17:33:58 +02:00
Bogdan Savluk
66cbd6091e
babel-plugin-transform-spread add missing argument in build calls (#13459)
* babel-plugin-transform-spread add missing argument in build calls

* update tests for babel 8 test
2021-06-14 11:33:19 -04:00
Lively
950d3519e8
fix destructuring of empty string (#13444)
* fix destructuring empty string

* use variable on expect

* overwrite all tests

* fix test cases
2021-06-14 17:07:12 +02:00
Lively
903b600522
fix: reference to class expression in private method (#13429)
Co-authored-by: Henry Zhu <hi@henryzoo.com>
Co-authored-by: Federico Ciardi <fed.ciardi@gmail.com>
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-06-14 17:06:22 +02:00
Huáng Jùnliàng
69f423b873
Faster babel build (#13423)
* chore: add glob and jest-worker

* add buildBabel2 routine

* cleanup

* exit gracefully when CI does not have available workers

* perf: less IO when dest is not entity

* perf: pipe worker stdout/stderr to parent process

* Update Gulpfile.mjs

Co-authored-by: Brian Ng <bng412@gmail.com>

Co-authored-by: Brian Ng <bng412@gmail.com>
2021-06-11 14:50:51 -04:00
Huáng Jùnliàng
6c8b2336f6
Faster readRegexp (#13453) 2021-06-10 19:00:21 -04:00
Sosuke Suzuki
0eb2853732
[ts] Support override modifiers for parameter properties (#13428) 2021-06-10 22:29:38 +02:00
Huáng Jùnliàng
b1fe831e4a
fix: disallow JSX tag after non-null assertion (#13449) 2021-06-10 15:07:47 -04:00
Nicolò Ribaudo
f04406f24f
Move Yarn validation CI checks to a separate job (#13443)
* Move Yarn validation CI checks to a separate job

* Fix
2021-06-10 12:36:00 +02:00
Nicolò Ribaudo
e914d1219f
Correctly transform spreads of arrays with holes (#13439)
* Correctly transform spreads of arrays with holes

* Use `arrayWithoutHoles` helper

* Add exec test

* Update for Babel 8

Co-authored-by: phapp88 <phapp1988@gmail.com>
2021-06-10 12:34:42 +02:00
Babel Bot
366e6d9251 Add v7.14.5 to CHANGELOG.md [skip ci] 2021-06-09 23:13:58 +00:00
Babel Bot
7a2a928398 v7.14.5 2021-06-09 23:03:30 +00:00
Nicolò Ribaudo
a59522df83
Disallow dependency cycles (#13442) 2021-06-10 00:48:57 +02:00
Huáng Jùnliàng
d3f4c22c28
update test fixtures (#13440)
* update test fixtures

* chore: typo
2021-06-09 11:48:29 -04:00
Huáng Jùnliàng
b9c1884a58
Reduce exprAllowed usage (#13431) 2021-06-09 16:36:09 +02:00
Nicolò Ribaudo
9252da782b
Update @nicolo-ribaudo/chokidar-2 (#13438) 2021-06-09 16:32:13 +02:00
Federico Ciardi
a64d08c101
fix(parser): correctly parse record and tuple tokens (#13418)
* fix(parser): correctly parse token location for `#{` and `#[`

* fix: `bar` tokens

* fix: don't parse record and tuple pipe closing tokens as operators
2021-06-08 20:58:48 -04:00