650 Commits

Author SHA1 Message Date
Babel Bot
7512095c84 v7.14.2 2021-05-12 16:58:57 +00:00
Sosuke Suzuki
b2d9156cc6
Update to Prettier 2.3 (#13288) 2021-05-10 15:34:13 +02:00
Sosuke Suzuki
1d54419ec4
Parse attributes of import expression with estree plugin (#13284)
* Parse attributes of import expression with estree plugin

* Add tests

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

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

Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
2021-05-07 16:37:20 -04:00
Huáng Jùnliàng
a8fea4037d
Faster identifier tokenizing (#13262)
* add benchmark

* perf: faster identifier tokenizing

- Mover iterator identifier parsing to the Flow plugin
- If the character is an identifier start, pass it to readWord1
2021-05-06 18:47:19 -04:00
Huáng Jùnliàng
a387973821
Refactor private name tokenizing (#13256)
* add benchmark

* refactor: create tt.privateName token for private names

* add backward compat privateName = hash + name to Babel 7

* perf: get private name SV from token value

* chore: tweak benchmark file

* chore: update test fixtures

* convert tt.privateName to PrivateIdentifier

* perf: avoid most isPrivateName call

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

Co-authored-by: Justin Ridgewell <justin@ridgewell.name>

* perf: use inlinable codePointAtPos

* make prettier happy

Co-authored-by: Justin Ridgewell <justin@ridgewell.name>
2021-05-06 09:46:09 -04:00
Huáng Jùnliàng
278193b6f7
fix: update chunkStart on missing unicode escape (#13261) 2021-05-06 08:31:11 -04:00
Babel Bot
3ecc7919c5 v7.14.1 2021-05-04 01:46:37 +00:00
Sosuke Suzuki
ef87648f3f
Parse static blocks with typescript plugin (#13243)
* Support static blocks with typescript

* Add tests

* Reuse isStatic var

* Disallow parsing static blocks with modifiers

* Add tests

* Raise recoverable errors

* Address review

* Add tests for static static {}
2021-05-03 16:17:08 -04:00
Nicolò Ribaudo
175a51f94e
Don't use "composite": true in tsc (until it supports cycles) (#13242)
* [ts] Don't use project references

* Commit `tsconfig.json` so it's ready-to-go

* Remove `clean-tsconfig` task

* Fix dts generation

* Add comment

* `yarn`

* Review

* Fix regexp
2021-05-03 20:47:53 +02:00
Stuart Cook
fa01fbe052
Parse for await (async of ...) (#13244) 2021-05-01 18:00:21 +02:00
Huáng Jùnliàng
2a3e35f026
chore: remove duplicate test262 parser tests (#13241) 2021-05-01 10:57:43 -04:00
Nicolò Ribaudo
3c0152a217 v7.14.0 2021-04-29 21:59:57 +02:00
Huáng Jùnliàng
0f2a1a8153
Add runFixtureTestsWithoutExactASTMatch in parser test runner (#13227) 2021-04-29 18:42:26 +02:00
Nicolò Ribaudo
a2ac2f39b5 Update @babel/parser fixtures 2021-04-28 18:41:10 +02:00
Huáng Jùnliàng
28d7442aae Parse async do expressions (#13043)
* parse async do expressions

* add test cases

* update test fixtures

* chore: add syntax-async-do-expressions

* generater support

* fix: do not transform async do expressions

* chore: add asyncDoExpressions to missing plugin helpers

* update ast types

* add more test cases

* throw when asyncDoExpressions is enabled but not doExpressions

* avoid add parentheses for async do expressions

* address review comments

* chore: update parser typings
2021-04-28 18:26:01 +02:00
Sosuke Suzuki
7f5b212322
babel-parser: Add new typescript plugin option dts: boolean (#13113) 2021-04-28 18:24:18 +02:00
Nicolò Ribaudo
22b0eb038f [ts] Enforce order for the override modifier (#13209)
* [ts] Enforce order for the `override` modifier

* generator

* Add more checks

* Update TS tests
2021-04-28 18:21:31 +02:00
George Zahariev
8433cd0c05 Support parsing Flow's Optional Indexed Access Types (#13224) 2021-04-28 18:21:31 +02:00
Nicolò Ribaudo
57daba85aa Parse string export names by default (moduleStringNames) (#13195)
* Parse string epxort names by default (`moduleStringNames`)

* Remove remaining references
2021-04-28 18:21:31 +02:00
Huáng Jùnliàng
ceaab0bae7 Parse class fields and private methods by default (#13175)
* feat: materialize class features

* chore: move testcases to es2022

* chore: update test fixtures

* chore: remove classPr\w+ from options.json

* chore: remove empty options.json

* update flow test allowlist

* update typescript allowlist
2021-04-28 18:21:31 +02:00
Sosuke Suzuki
b116865077 Use this.isThisParam in typescript parser (#13163) 2021-04-28 18:21:31 +02:00
Sosuke Suzuki
c949660b34 babel-parser: Deep freeze for makeErrorTemplates (#13142) 2021-04-28 18:21:31 +02:00
Sosuke Suzuki
7484b51e56 Support TS 4.3 get/set type members (#13089)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-04-28 18:21:31 +02:00
Sosuke Suzuki
2521c666f7 Add internal ESLint rule for consistent parser error messages (#13130) 2021-04-28 18:21:31 +02:00
Pig Fang
bf14a106ad Support TS 4.3 override syntax in class (#13097)
* support TS 4.3 `override` syntax in class

* fix types

* fix types

* tweak error message

* update TypeScript commit

* split tests

* add more tests

* update allowlist

* disallow `override` with `declare`

* disallow `override` in non-sub class

* update TypeScript allowlist

* rename error message key

* add more tests
2021-04-28 18:21:31 +02:00
Sosuke Suzuki
f8aa32f767 Support parsing Flow's Indexed Access Types (#13053) 2021-04-28 18:21:31 +02:00
Pig Fang
eac0259ce2 Support TS 4.3 static index signature in classes (#13096) 2021-04-28 18:21:31 +02:00
Sosuke Suzuki
0ee98139a6 Introduce parser error codes (#13033) 2021-04-28 18:21:31 +02:00
Huáng Jùnliàng
10f4d08efb
refactor: avoid parsing logic on locations (#13200) 2021-04-25 09:15:48 -04:00
Babel Bot
d94a8e50ed v7.13.16 2021-04-20 11:11:32 +00:00
Federico Ciardi
368bf893fa
[ts] raise SyntaxError for declare before getter/setter (#13143)
* fix: raise `SyntaxError` for `declare` before getter/setter

* fix: allow `declare` when class property name is `get` or `set`
2021-04-17 23:00:24 +02:00
Babel Bot
e50f6f7eef v7.13.15 2021-04-08 15:40:57 +00:00
Federico Ciardi
42e630e8a2
Allow trailing comma after rest parameter in TSDeclareFunction (#13101)
* fix(ts): allow trailing comma after rest parameter in `TSDeclareFunction`

* Apply code review changes

Co-Authored-By: Nicolò Ribaudo <7000710+nicolo-ribaudo@users.noreply.github.com>
2021-04-06 18:36:17 +02:00
Federico Ciardi
7fe3ebf4db
fix: raise SyntaxError for unparenthesized assert and assign (#13099)
* fix: raise `SyntaxError` for unparenthesized assert and assign

* chore
2021-04-06 16:07:13 +02:00
Bogdan Savluk
a647b9ea6b Convert @babel/core to TypeScript (#12929)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-03-30 19:51:35 +02:00
Huáng Jùnliàng
8efbac4a5d
fix: the LHS in for-of loop should not start with let (#13049)
* fix: the LHS in for-of loop should not start with let

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

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

Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-03-29 16:54:23 -04:00
Babel Bot
2f8203f190 v7.13.13 2021-03-26 21:09:38 +00:00
Huáng Jùnliàng
0067fd9e02
Disallow await before exponential (#12441)
* refactor: move unary exponential check to parseMaybeUnary

* fix: disallow await before exponential

* add test cases
2021-03-25 11:20:47 -04:00
Federico Ciardi
4f727139ec
fix(ts): Allow parenthesized "assert and assign" (#12933)
Co-authored-by: Nicolò Ribaudo <7000710+nicolo-ribaudo@users.noreply.github.com>
2021-03-22 17:00:03 +01:00
Babel Bot
edb11baabf v7.13.12 2021-03-22 15:36:45 +00:00
Sosuke Suzuki
beb7cf8b24
Sort error keys with ESLint (#13020) 2021-03-18 21:01:57 +01:00
Babel Bot
4b674ea031 v7.13.11 2021-03-15 09:34:23 +00:00
Huáng Jùnliàng
0988c471e9
Parse type imports in TSImportEqualsDeclaration (#12962) 2021-03-14 23:34:49 +01:00
Huáng Jùnliàng
1a05b81387
Support multiple static blocks (#12738) 2021-03-12 23:29:55 +01:00
Babel Bot
d1d404b9a3 v7.13.10 2021-03-08 22:23:36 +00:00
Nicolò Ribaudo
d04842a700
Avoid using CJS globals in internal source files (#12963)
* Lint against CJS globals in modules

* Use `import.meta.url` instead of `__filename` in `src` files

* Prepare fixtures runner for `import.meta.url`

* Use `import.meta.url` instead of `__filename` in `test/index` files

* Remove `__dirname` from remaining test files

dirname

* Avoid using `module` in `src` files

* Avoid using `require` in `src` files

* Avoid using `require` in `test` files

* Update `@types/node`

* Compile dynamic import in `@babel/node`

* Fix windows

* Use `@babel/plugin-proposal-dynamic-import` from npm
2021-03-05 19:55:36 +01:00
Sosuke Suzuki
b416847b61
(ts) Raise syntax error for abstract methods with a body (#12687)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-03-02 11:57:58 +01:00
Babel Bot
2c0e8d0008 v7.13.9 2021-03-01 21:33:11 +00:00
Huáng Jùnliàng
efdca01409
fix: add tokens when tokens: true is passed to parseExpression (#12939) 2021-03-01 14:09:56 -05:00
Sosuke Suzuki
b62fc3d44f
babel-parser(flow): Set this property to null for FunctionTypeAnnotation without parens (#12930)
* Add null property to FunctionTypeAnnotation without parens

* Update tests

* Update tests
2021-03-01 09:15:43 -05:00