737 Commits

Author SHA1 Message Date
Babel Bot
c4b13725aa v7.15.8 2021-10-06 20:45:15 +00:00
Nicolò Ribaudo
64f14b05fa
Collect comments around parentheses in expressions (#13803)
Co-authored-by: Brian Ng <bng412@gmail.com>
2021-10-05 20:15:24 +02:00
Huáng Jùnliàng
178d43ff17
Tokenize keywords-like identifier as new tokens (#13769)
* refactor: add more identifier token helpers

* refactor: explode tt.name into multiple tokens

* fix: disallow escape in interface keyword

* refactor: simplify isMaybeDefaultImport

* review comments

* refactor: avoid string comparison
2021-09-23 10:54:44 -04:00
Nicolò Ribaudo
2e2d202694
[babel 8] Materialize ESTree's classFeatures option (#13752)
* [babel 8] Enable ESTree classFeatures by default in @babel/parser

* Fix `visitorKeys`

* Update tests
2021-09-22 15:28:10 -04:00
Babel Bot
8d0294edf8 v7.15.7 2021-09-17 22:54:10 +00:00
Huáng Jùnliàng
d2076a531f
Store token type as number (#13768)
* refactor: abstract token metadata access

* refactor: move token-specific update context logic

* refactor: centralize token definitions

* refactor: abstract token type creation

* refactor: use number as token storage

* build: replace tt.* as number

* fix flow errors

* fix: build on Node 12

* Update packages/babel-parser/src/tokenizer/types.js

Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>

* refactor: rename token types exports to tt

* update unit test

* test: update Babel 8 test fixtures

* fix: centralize obsolete token type updateContext

* fix flow errors

Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-09-17 09:36:11 -04:00
JuniorTour
da79c90f2a
fix(babel-parser): Allow line break before assert return type (#13771) 2021-09-16 23:24:11 +02:00
Nicolò Ribaudo
710b3919fa
[estree] Fix conversion of PrivateName in MemberExpression (#13755)
* Update test

* [estree] Fix conversion of `PrivateName` in `MemberExpression`
2021-09-14 17:14:04 +02:00
Babel Bot
34a27e46f8 v7.15.6 2021-09-09 19:22:51 +00:00
Nicolò Ribaudo
3c3f5205c9
Fix right precedence of Hack pipes (#13668) 2021-09-08 17:38:07 +02:00
Sosuke Suzuki
c25ec3e069
[babel-parser] add tests for static blocks with line breaks (#13734) 2021-09-04 16:27:38 +02:00
Sosuke Suzuki
62e42a3f60
fix(babel-parser): Fix end of range of SequenceExpression (#13731) 2021-09-04 12:01:20 +02:00
Babel Bot
e82e43ca33 v7.15.5 2021-09-04 08:50:23 +00:00
Nicolò Ribaudo
44388e6e81
Disallow #a in #b in c and similar expressions (#13727)
* Disallow `#a in #b in c` and similar expressions

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

Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>

* Add test for `await #x in`

* Flow

* Update flow allowlist

* Flow

Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
2021-09-04 10:05:09 +02:00
Babel Bot
b2376757d7 v7.15.4 2021-09-02 21:28:31 +00:00
Sosuke Suzuki
a54f041440
test(parser): add no_plugin tests for module blocks (#13714) 2021-08-30 09:09:05 +02:00
Sosuke Suzuki
64d116bd6a
fix(parser): [Babel8] Align error codes between Flow and TypeScript (#13294)
* Align error codes between Flow and TypeScript

* Implement compat fallback in makeErrorTemplates

* Add tests
2021-08-28 22:41:54 +09:00
Sosuke Suzuki
b141c85b17
fix(babel-parser): delete static property from class static block for TS (#13680)
* Delete static modifier from static blocks node

* Update tests

* Address review

* Address review

* Add tests from review

* Add tests
2021-08-25 14:19:04 -04:00
Dijun Liu
1d4bd31950
add missing ExportNamespaceSpecifier in spec.md (#13691)
* add missing ExportNamespaceSpecifier in spec.md

* add constrain note in ExportNamedDeclaration

Co-authored-by: 刘地军 <dijun.ldj@antgroup.com>
2021-08-20 11:43:16 -04:00
Huáng Jùnliàng
976bfbbf69
fix: assure left bracket is not consumed after dot (#13695)
* fix: assure left bracket is not consumed after dot

* address review comments
2021-08-20 11:29:44 +02:00
Federico Ciardi
10640b2aad
perf: partially replace .concat with .push (#13609) 2021-08-14 16:57:06 +02:00
Babel Bot
a5624ea457 v7.15.3 2021-08-11 07:11:36 +00:00
Nicolò Ribaudo
9286cdb072
Re-enable disabled flow parser test (#13661) 2021-08-10 20:57:27 +02:00
doing-art
1229336fea
Fix parse error when using named import "as" with flow parser (#13659) 2021-08-10 20:55:21 +02:00
Nicolò Ribaudo
e721f61110
[flow] Fix parsing of arrows in conditional exprs in parens (#13655) 2021-08-10 20:46:38 +02:00
Nicolò Ribaudo
9d0aa1ec9d
Disallow <T>(a => b) when parsing Flow (#13645) 2021-08-10 19:09:23 +02:00
Mickey Rose
da1d166ea6
perf: minor tokenizer tweaks (#13652) 2021-08-09 21:20:44 +02:00
Sosuke Suzuki
8a09993e39
fix(parser): add attachComment to ParserOptions type (#13657) 2021-08-09 10:05:19 +02:00
Babel Bot
084870faad v7.15.2 2021-08-08 16:05:27 +00:00
Sosuke Suzuki
e294beb3ac
Add .errors to the @babel/parser return type definitions (#13653) 2021-08-07 19:37:03 +02:00
Nicolò Ribaudo
f9dcc4e4bb
Fix array destructuring elision parsing in TS arrow functions (#13641) 2021-08-05 21:47:30 +02:00
Nicolò Ribaudo
6912f968a6 v7.15.0 2021-08-04 23:00:40 +02:00
Yeonju Hwang
0671afcf87
[ts] support optional chain call with generic (#13513)
* support optional chain call with generic

* Add testcase handling new line

* allow only call if optional chain type parameter

* use exact error message

* add transform-typescript optional-chain call test

* use exact error message

* apply feedbacks

* Fix lint error

Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-08-04 17:29:44 +02:00
Huáng Jùnliàng
d5b0d9e33d
Add attachComment parser option to disable comment attachment (#13229) 2021-08-04 17:04:22 +02:00
Nicolò Ribaudo
ddaf0d4296
Enable top-level await parsing by default (#13387) 2021-08-04 00:00:04 +02:00
Federico Ciardi
c35637e247
feat(ts): raise error for abstract property with initializer (#13523)
* feat: raise error for abstract property with initializer

* Improve tests

* Address review

* JLHwung review

* Update packages/babel-parser/src/plugins/typescript/index.js

* update test fixtures

Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
2021-08-03 23:50:27 +02:00
Nicolò Ribaudo
ff287ac5a5 Fix %== parsing in hack pipes (#13536)
* Fix `%==` parsing in hack pipes

* Use custom token type

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

Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>

* Apply suggestions from code review

Co-authored-by: J. S. Choi <jschoi@jschoi.org>

Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
Co-authored-by: J. S. Choi <jschoi@jschoi.org>
2021-08-03 23:30:16 +02:00
J. S. Choi
35e4e1f067 Hack-pipe proposal with % topic token (#13416)
Co-authored-by: Federico Ciardi <fed.ciardi@gmail.com>
2021-08-03 23:30:16 +02:00
J. S. Choi
cd4b3fbffe parser: Fix Hack/smart-pipe error positions (#13426) 2021-08-03 23:30:16 +02:00
J. S. Choi
6276853eb9 Add support for the "Hack" pipeline proposal (#13191)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-08-03 23:30:16 +02:00
Nicolò Ribaudo
a254ea38a4
Enable ergonomic brand checks (#priv in) by default (#13554)
* Enable ergonomic brand checks by default in `@babel/parser`

* Enable ergonomic brand checks by default in `preset-env`

* Fix error position

* Update Babel 8 tests
2021-08-03 23:02:17 +02:00
Oleksandr T
b3ab4769d0
fix(ts): raise error for export default interface {} (#13622) 2021-08-02 18:16:01 +02:00
Babel Bot
aa2cac5edc v7.14.9 2021-08-01 07:42:57 +00:00
Huáng Jùnliàng
d3a7cd5e8d
Replace generic __clone call by specific methods (#13611)
* update benchmark babel parser version

* perf: replace generic __clone by specific methods

baseline 256 length-1 named export: 4_704 ops/sec ±1.59% (0.213ms)
baseline 512 length-1 named export: 2_426 ops/sec ±0.52% (0.412ms)
baseline 1024 length-1 named export: 1_118 ops/sec ±1.23% (0.895ms)
baseline 2048 length-1 named export: 556 ops/sec ±0.77% (1.799ms)
current 256 length-1 named export: 7_073 ops/sec ±33.67% (0.141ms)
current 512 length-1 named export: 4_441 ops/sec ±0.79% (0.225ms)
current 1024 length-1 named export: 2_142 ops/sec ±1.09% (0.467ms)
current 2048 length-1 named export: 943 ops/sec ±2.12% (1.06ms)

* breaking: remove Node#__clone in Babel 8

* test: use t.cloneNode
2021-07-30 22:19:35 +02:00
Huáng Jùnliàng
e4de256cdd
chore: reorganize benchmarks (#13606) 2021-07-28 07:10:29 -04:00
Nicolò Ribaudo
4a56387330
ts: Check if param is assignable when parsing arrow return type (#13581) 2021-07-26 17:58:10 +02:00
Babel Bot
e591780244 v7.14.8 2021-07-20 17:51:55 +00:00
Sosuke Suzuki
22b2f4fc02
Update babel-parser.d.ts (#13575)
* Add moduleBlocks to ParserPlugin type

* Add TypeScriptPluginOptions to ParserPluginWithOptions
2021-07-20 10:44:13 -04:00
overlookmotel
dd942f92af
fix: parser strictMode option (#13548) 2021-07-20 10:42:04 -04:00
Nicholas Eveland
2c6db56696
Allow module block to start a member expression (#13573)
* Accept module in primaryExpression

* Add module blocks to primaryExpression

* Fix package.json

* Fix yarn.lock

* Fix yarn.lock

* Remove package.tgz file
2021-07-19 17:29:23 -04:00