Compare commits

...

2334 Commits

Author SHA1 Message Date
b2bb97f001 Merge of 2022-01-19 babel decorators. Disabling new-version-checklist as this is intended for a private publish for testing 2022-01-19 01:52:05 +01:00
Chris Hewell Garrett
1eb2e68c7b
Fix interop between class and static decorators 2022-01-16 13:24:27 -05:00
Huáng Jùnliàng
aa4d6e2525
use legacy visitor when version is "legacy" 2022-01-16 10:25:33 -05:00
Chris Hewell Garrett
938ce50695
Object.create(null) -> standard object 2022-01-16 09:41:22 -05:00
Nicolò Ribaudo
0876e7a160 Fallback to Symbol.for("Symbol.metadata") 2022-01-16 15:02:57 +01:00
Huáng Jùnliàng
2fc8ad9539 fix TS errors 2022-01-16 14:15:10 +01:00
Huáng Jùnliàng
351f1585b7 fix test errors 2022-01-16 14:15:10 +01:00
Huáng Jùnliàng
e9f56f3c2a remove noop parser plugin
babel-parser 7.17 has materalized classStaticBlock
2022-01-16 14:15:10 +01:00
Huáng Jùnliàng
be798df427 refactor: centralize option validation in syntax-decorators 2022-01-16 14:15:10 +01:00
Huáng Jùnliàng
e52f1dc4b2 fix init 2022-01-16 14:15:10 +01:00
Huáng Jùnliàng
e67b698cbd fix: throw when legacy and version are both specified
also fix decoratorsBeforeExport error when version: "legacy" is specified
2022-01-16 14:15:10 +01:00
Huáng Jùnliàng
62acebe844 add decoratorsVersion support to babel-standalone 2022-01-16 14:15:10 +01:00
Nicolò Ribaudo
9ecadfd8d2 Fix test 2022-01-16 14:15:09 +01:00
Nicolò Ribaudo
9a876a2a64 Simplify _initProto injection for existing super() 2022-01-16 14:15:09 +01:00
Nicolò Ribaudo
5ba1365f9a Fix _initProto injection 2022-01-16 14:15:09 +01:00
Nicolò Ribaudo
faf44db9d9 Add test for _initProto with existing constructor 2022-01-16 14:15:09 +01:00
Nicolò Ribaudo
f23bcbc28b Minor code update 2022-01-16 14:15:09 +01:00
Nicolò Ribaudo
0e745e50c9 undefined -> void 0 in helper 2022-01-16 14:15:09 +01:00
Nicolò Ribaudo
9ce9c7b861 Update makefile 2022-01-16 14:15:09 +01:00
Nicolò Ribaudo
e1c0086fe0 Install static fields and private methods on the correct class 2022-01-16 14:15:09 +01:00
Nicolò Ribaudo
910e1a782a Rename tests 2022-01-16 14:15:08 +01:00
Chris Hewell Garrett
46c54fbbf6 Allow version: "legacy", use built-in Identifier generation, simplify private UID code 2022-01-16 14:15:08 +01:00
Chris Hewell Garrett
ab6d74a9cc Ensure private UID generation takes into account all referenced private names 2022-01-16 14:15:08 +01:00
Chris Hewell Garrett
3f7644823d Adds the 2021-12 transform for decorators
Implements the 2021-12 transform for the decorators proposal, with
support for the `accessor` keyword.
2022-01-16 14:15:08 +01:00
Chris Garrett
3f3ce5f668 Add the decoratorsAutoAccessors parser plugin (#13681)
Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2022-01-16 14:14:19 +01:00
renovate[bot]
dc5f419fa9
chore(deps): update yarn to v3.1.1 (#14158)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-01-15 18:14:19 +01:00
Nicolò Ribaudo
8035ad90f9
Disable "Reentrant plugin detected" error in async mode (#14153) 2022-01-14 23:58:29 +01:00
Huáng Jùnliàng
ab2c578f98
test: add prettier e2e test (#14058)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2022-01-13 18:38:45 +01:00
Babel Bot
4ac8f7704c Add v7.16.9 to CHANGELOG.md [skip ci] 2022-01-11 23:14:39 +00:00
Babel Bot
fd0e37ea3e v7.16.9 2022-01-11 23:07:22 +00:00
Nicolò Ribaudo
928f06ca99
Follow up to #14136 (#14137) 2022-01-11 23:53:06 +01:00
Nicolò Ribaudo
db08d945d0
Restore @babel/register compat with @babel/core@7.5.x (#14136) 2022-01-11 23:26:07 +01:00
Babel Bot
6870e7f10f Add v7.16.8 to CHANGELOG.md [skip ci] 2022-01-10 21:19:19 +00:00
Babel Bot
bc0d1ef860 v7.16.8 2022-01-10 21:11:46 +00:00
Sosuke Suzuki
69246b6212
[babel 8] fix properties name for function-like TS nodes (#13709)
* Align AST

* Add tests for parser

* Generator

* Add babel-types support

* Address review

* Address review
2022-01-10 17:35:03 +01:00
Arthur
335622f75d
Delete useless check for variable redeclaration (#14129) 2022-01-10 15:39:52 +01:00
Sosuke Suzuki
04f3f17556
test: Add importAssertions to TS tests and update TS tests (#14127) 2022-01-10 15:38:01 +01:00
Ozan H
1c32b670ce
Print trailing comma after a single TS generic in arrow fns (#14113) 2022-01-10 15:37:05 +01:00
Nicolò Ribaudo
72e63b9ef7 Fix test 2022-01-09 01:24:27 +01:00
Nicolò Ribaudo
82612add5c Simplify _initProto injection for existing super() 2022-01-09 00:46:37 +01:00
Nicolò Ribaudo
0f7463e77d Fix _initProto injection 2022-01-09 00:30:41 +01:00
Nicolò Ribaudo
b7dfda8209 Add test for _initProto with existing constructor 2022-01-09 00:24:01 +01:00
Nicolò Ribaudo
0a99902cc0 Minor code update 2022-01-09 00:15:20 +01:00
Nicolò Ribaudo
b86c25a800 undefined -> void 0 in helper 2022-01-09 00:10:05 +01:00
Nicolò Ribaudo
9cd2c7886e Update makefile 2022-01-08 23:54:08 +01:00
Nicolò Ribaudo
00f94dc88a Install static fields and private methods on the correct class 2022-01-08 23:54:08 +01:00
Nicolò Ribaudo
a6d77d07b4
[babel 8] Remove @babel/runtime@<=7.13.0 compat check (#14120) 2022-01-08 21:06:40 +01:00
magic-akari
910ece5e2a
Optimize transform-async-to-generator output (#14122)
* Optimize `transform-async-to-generator` output

- remove wrapper if the function length is zero.
- remove wrapper if the `assumptions.ignoreFunctionLength` is `true`.

* chore: update test case and code style

* chore: add test
2022-01-08 21:01:20 +01:00
Nicolò Ribaudo
213397be99
Always use the plugin/preset name in fixtures options (#14118) 2022-01-08 18:32:15 +01:00
Nicolò Ribaudo
393d5d74d8
[babel 8] Remove @nicolo-ribaudo/chokidar-2 fallback (#14119) 2022-01-08 16:50:37 +01:00
Nicolò Ribaudo
53ac687a59
Update core-js 3 (#14108) 2022-01-06 18:46:37 +01:00
Huáng Jùnliàng
b9ba4f9de8
fix: forward stop signal to parent path (#14105) 2022-01-06 18:38:07 +01:00
Nicolò Ribaudo
d158a48945
Don't mutate @babel/register options (#14107) 2022-01-06 18:37:45 +01:00
Sneh Khatri
ed3036d11c
Register binding for newly created vars for commonjs transforms (#14097) 2022-01-06 18:37:05 +01:00
Nicolò Ribaudo
c78320d1a7 Rename tests 2022-01-06 17:05:13 +01:00
Chris Hewell Garrett
690846ca9e Allow version: "legacy", use built-in Identifier generation, simplify private UID code 2022-01-06 17:01:21 +01:00
Chris Hewell Garrett
3e8ba6782e Ensure private UID generation takes into account all referenced private names 2022-01-06 17:01:21 +01:00
Chris Hewell Garrett
1f63f94718 Adds the 2021-12 transform for decorators
Implements the 2021-12 transform for the decorators proposal, with
support for the `accessor` keyword.
2022-01-06 17:01:18 +01:00
Chris Garrett
579ab3fc81 Add the decoratorsAutoAccessors parser plugin (#13681)
Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2022-01-06 17:00:15 +01:00
magic-akari
bee3e35851
Fix TypeScript Enum self-references (#14093) 2022-01-06 16:47:09 +01:00
Nicolò Ribaudo
028cc880a1 Update lockfile 2022-01-06 16:45:10 +01:00
overlookmotel
3942d72745
Always print directives with double quotes when minified (#14094) 2022-01-06 16:28:28 +01:00
Babel Bot
ddd93b9c61 Add v7.16.7 to CHANGELOG.md [skip ci] 2021-12-31 00:23:48 +00:00
Babel Bot
23e884048a v7.16.7 2021-12-31 00:13:43 +00:00
Endrit Bajo
f69f1a80d5
Import the correct ./typeof.js helper in @babel/runtime (#14081) 2021-12-31 00:58:07 +01:00
Nicolò Ribaudo
2810dc6460
Fix derived classes in Chrome <= 36 (#14072) 2021-12-30 23:58:16 +01:00
Nicolò Ribaudo
e77e3de402
[babel 8] Move @babel/register transform to a separate worker (#14025) 2021-12-29 16:33:12 +01:00
Nicolò Ribaudo
d1cabf6bc8
[babel 8] Add "exports" to every package (#14013) 2021-12-29 16:29:10 +01:00
Sneh Khatri
2c68d03bf2
Allow $schema property in json config files (#14067)
* Fix: Error on  property in json config files

* options[] delete moved down
2021-12-28 22:13:14 -05:00
Nicolò Ribaudo
69ae3b5a25 Update lockfile 2021-12-21 18:02:35 +01:00
Sneh Khatri
d6ff91d560
Fix unicode handling in generated function names (#14047) 2021-12-20 22:03:35 +01:00
Huáng Jùnliàng
ad17fe1cce
fix: check preceding line break before exclamation (#14049) 2021-12-16 15:50:15 -05:00
Babel Bot
7178fbb008 Add v7.16.6 to CHANGELOG.md [skip ci] 2021-12-14 23:39:47 +00:00
Babel Bot
5687ade5e7 v7.16.6 2021-12-14 23:32:57 +00:00
Huáng Jùnliàng
7794201940
fix: handle tokens for invalid template element (#14055) 2021-12-14 17:54:09 -05:00
Nicolò Ribaudo
f32e3dddc4
Update jest-worker in CRA tests (#14050) 2021-12-14 01:09:34 +01:00
Babel Bot
bd3e6b1dd8 Add v7.16.5 to CHANGELOG.md [skip ci] 2021-12-13 22:29:32 +00:00
Babel Bot
7b7ab94066 v7.16.5 2021-12-13 22:12:58 +00:00
Nicolò Ribaudo
7dec78de28
Skip hasMoreThanOneBinding tests on publish (#14048) 2021-12-13 23:07:24 +01:00
Sneh Khatri
a7acde3885
Fix: default rest argument array elements as undefined (#14032) 2021-12-13 21:51:57 +01:00
Sneh Khatri
add64e870b
Don't resolve shadowed arguments variables from functions (#14036) 2021-12-13 18:29:10 +01:00
Nicolò Ribaudo
dfcfbf3b27
Disable test262 CircleCI job (#14044) 2021-12-11 17:49:33 +01:00
Nicolò Ribaudo
2d9fb7f83b
Pin jest-worker to 27.2.1 in CRA e2e tests (#14040) 2021-12-11 17:31:54 +01:00
wentout
c59870c526
Mark class prototype as read-only (#12115)
* initial code 2 fix the issue #2025

* Mark class prototype as read-only

* Update fixtures

* Fix failure

* Update Babel 8 fixtures

* Disable in loose mode

* Update fixtures

Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-12-10 21:44:48 +01:00
Huáng Jùnliàng
39080492f4
maintain estree string literal shape when cloned (#14039) 2021-12-09 17:58:25 -05:00
Huáng Jùnliàng
94af0e5c62
Improve template tokenizing (#13919)
* add benchmarks

* refactor: tokenize template as middle + tail

* perf: avoid push tc.brace

* refactor: overwrite skipSpace in jsx plugin

* transform tl.templateMiddle/Tail

* refactor: simplify JSX context tracking

* fix flow error

* refactor: move JSX context to context.js

* fix: ensure comment stack is correctly handled

* rename createPositionFromPosition

* rename token type and methods

* add tokenIsTemplate

* refactor: merge babel 7 logic in babel7CompatTokens

* fix flow error
2021-12-06 16:43:46 -05:00
Nicolò Ribaudo
3a85ddfb1b
Bring back deferred require() calls in core and cli (#14028) 2021-12-06 21:33:33 +01:00
Nicolò Ribaudo
2a3b0b9601
Update @typescript-eslint/* packages (#14029) 2021-12-05 23:20:11 +01:00
Sneh Khatri
a943f576d1
Fix duplicate declaration error on ambient class declarations (#14016) 2021-12-05 18:24:56 +01:00
Nicolò Ribaudo
2d989a983d
Run tests in a native Node.js ESM environment (#13966) 2021-12-03 15:32:58 +01:00
Nicolò Ribaudo
578ab22fb7
Update test262 parser tests ignoredFeatures list (#14019) 2021-12-03 09:06:42 -05:00
Babel Bot
2597184d27
Update test262 (#14020) 2021-12-03 11:05:13 +01:00
Kyle Rosenberg
4079ee519f
Support flow function type annotation with no parent (#14014) 2021-12-02 20:16:19 -05:00
J. S. Choi
f4236f43a1
Extend hasPlugin to accept plugin-configuration array pairs (#13982)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-12-02 23:17:51 +01:00
renovate[bot]
ecae53a98e
chore(deps): update dependency typescript to ~4.5.0 (#14018)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
2021-12-02 16:59:11 +01:00
Sneh Khatri
029cd15bd9
Fix JSX pragma anywhere in comment (#14012)
* Fix JSX pragma anywhere in comment

* jsx regex patterns support jsx docs

* removed extra spaces from regex patterns
2021-12-02 10:35:44 -05:00
Nicolò Ribaudo
36a5ac4145
Fix handling of this&co in computed keys in arrows transform (#14005) 2021-11-30 22:54:17 +01:00
chimurai
893650130a
chore(deps): update dependency husky to v7 (#14011) 2021-11-29 22:04:50 +01:00
Nicolò Ribaudo
29de280006
Use Node.js interop when importing lib in test (#13995) 2021-11-29 21:48:34 +01:00
Nicolò Ribaudo
1bbe1fc3cb
Regenerate monorepo READMEs (#14006)
* Fix script to generate readmes

* Regenerate READMEs
2021-11-29 10:03:23 -05:00
Huáng Jùnliàng
4a337538f9
chore: update @babel/* deps (#14002) 2021-11-29 08:54:15 -06:00
Nicolò Ribaudo
23fec0c8c9
Update to prettier 2.5.0 (#14000) 2021-11-26 10:48:16 +01:00
Babel Bot
bafa016bff
Update test262 (#14001) 2021-11-26 01:23:17 +01:00
Bogdan Savluk
0058b7fef4
Migrate Babel from Flow to TypeScript (except Babel parser) (#11578)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-11-25 23:09:13 +01:00
Nicolò Ribaudo
473f145b27
Don't use ESM for required files in @babel/helpers tests (#13996) 2021-11-25 16:19:07 +01:00
Huáng Jùnliàng
55f020e02d
Convert proposal-object-rest-spread to TS (#13948)
* chore: add typings to object-rest-spread

* chore: bundle object-rest-spread package

* improve type inference

* address review comments
2021-11-24 10:48:31 -05:00
Nicolò Ribaudo
ad1798ed48
Only bundle the release build, and don't import src in tests (#13978)
* Only bundle the release build, and don't import `src` in tests

* Use file extension to signal skipping

* Remove unnecessary config change

* Fix imports
2021-11-24 10:08:53 -05:00
Nicolò Ribaudo
75996cb62b
Use full import specifier path in tests (#13938) 2021-11-24 11:43:18 +01:00
Huáng Jùnliàng
a470f7b479
Recover from shorthand assign exprs (#13968)
* refactor: avoid duplicate property access

* refactor: tweak parseMember

* polish: recover from shorthand assign in exprs
2021-11-19 10:22:29 -05:00
Babel Bot
d017d43535
Update test262 (#13979) 2021-11-19 01:09:44 +01:00
Nicolò Ribaudo
90c659b4cb
Fail CI when @babel/runtime ESM tests fail (#13976) 2021-11-19 00:22:32 +01:00
Mickey Rose
cd77ad1680
minify helpers-generated.ts (#13837)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-11-18 23:51:28 +01:00
Huáng Jùnliàng
d30308fe8e
fix: update UnexpectedPrivateField error message (#13975) 2021-11-17 18:54:23 +01:00
Babel Bot
6e2222756d Add v7.16.4 to CHANGELOG.md [skip ci] 2021-11-16 22:46:57 +00:00
Babel Bot
99774ee9fa v7.16.4 2021-11-16 22:37:47 +00:00
Sosuke Suzuki
87fc2e76d7
Add assertions to ExportNamedDeclaration without from (#13957) 2021-11-16 11:53:28 +01:00
Francisco Ryan Tolmasky I
966387d263
Always expose expressionValue in DirectiveLiteral nodes (#13960)
* fix(babel-parser): Move storage of expressionValue in DirectiveLiteral to main parser so it is accessible to others.

Closes #13953.

Reviewed by @tolmasky.

* Add results from running `OVERWRITE=true yarn jest babel-parser`.

Reviewed by @tolmasky.
2021-11-13 20:46:16 -05:00
M Behzad
d3fffd95b6
Add file extension when using absoluteRuntime (#12827)
* fix: add file extention when the absolute path to the runtime files are used (#12824)
the es module imports need the file extention (e.g. import "@babel/runtime/helpers/jsx.js", Or the filenames being listed in the package.json's subpath exports (e.g. "import "@babel/runtime/helpers/jsx" + pkg: "./helpers/jsx": "./helpers/jsx.js"). when the user passes a path via `absoluteRuntime` then the rendered require staemnts is not the module name + subpath which will be resolved via pkg.json but rather the absolute path to the file. for this case, add the file extention / index.js to prevent bundlers from raising a warning.

* Update deps

* Fix imports resolution

* Update fixtures (Windows)

Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
Co-authored-by: Babel Bot <babel-bot@users.noreply.github.com>
2021-11-14 02:03:30 +01:00
Nicolò Ribaudo
d16f8111ea
Wait the correct number of ticks on nested await (#13961) 2021-11-14 02:02:35 +01:00
Huáng Jùnliàng
54c539ecc1
Refactor bindingProperty parsing (#13929)
* refactor: inline parseMaybePrivateName

* correct test case

* perf: fast exit in checkExpressionErrors

* refactor: add parseBindingProperty

* fix: private property with variance

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

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

* chore: update testcase

* refactor: remove refExpressionErrors for record/tuple

They are always non-ambiguous.

Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-11-12 10:11:46 -05:00
Sneh Khatri
135ab837bc
Throw on duplicate __proto__ props followed by assignment (#13951) 2021-11-12 14:45:56 +01:00
Babel Bot
dd63950c99
Update test262 (#13955) 2021-11-12 14:32:29 +01:00
Huáng Jùnliàng
f731522125
chore: update compat-data (#13949)
* chore: update compat-data

* update compat-data sources

* fix: exclude deno from compat-data

* update test fixtures

* update Babel 8 test fixtures
2021-11-10 15:39:34 -05:00
Babel Bot
f8b331ca0d Add v7.16.3 to CHANGELOG.md [skip ci] 2021-11-09 21:53:35 +00:00
Babel Bot
3b6f061e18 v7.16.3 2021-11-09 21:44:15 +00:00
Mickey Rose
74bec41db5
fix(helpers): match Reflect.get behaviour (#13862) 2021-11-09 17:39:41 +01:00
Nicolò Ribaudo
43f989941b
Support transforming params of arrow functions in class fields (#13941) 2021-11-09 12:12:23 +01:00
Sneh Khatri
a6a526968d
fix: incorrect await rejection following arrow function in parameters (fixes #13872) (#13928)
* fix: incorrect await rejection following arrow func in params

* expressionScope.exit() shifted to end

* test added for yield
2021-11-05 15:41:31 -04:00
Babel Bot
5134505bf9
Update test262 (#13932) 2021-11-05 13:53:34 -05:00
Huáng Jùnliàng
7250d2562b
Simplifiy tracking of valid JSX positions (#13891)
Remove `state.inPropertyName` and simplifies `state.canStartJSXElement` tracking
2021-11-04 17:12:42 +01:00
Nicolò Ribaudo
de28707dfe
[babel 8] Align allow* parser options with ESLint behavior (#13921)
* [babel 8] Align `allow*` parser options with ESLint behavior

- The `@babel/eslint-parser` `allowImportExportEverywhere` option is removed; users can pass it to `parserOpts`
- `allowSuperOutsideMethod` is disabled
- `allowReturnOutsideFunction` is inferred from `ecmaFeatures.globalReturn`

* Update failing tests
2021-11-04 07:56:06 +01:00
Nicolò Ribaudo
531db5dc4e
Fix parserOverride support in @babel/eslint-parser (#13918) 2021-11-04 01:15:26 +01:00
Nicolò Ribaudo
6393e60a68
Update runtime integration tests for Node.js >= 16.6 (#13923) 2021-11-04 01:10:28 +01:00
Nicolò Ribaudo
76e4566bfc
Update browserslist (#13914) 2021-11-02 07:20:58 +01:00
Huáng Jùnliàng
1fa759f989
refactor: extract tt.lt and tt.gt from tt.relation (#13892) 2021-11-01 21:15:42 -04:00
Babel Bot
05af38cff2 Add v7.16.2 to CHANGELOG.md [skip ci] 2021-11-01 21:57:27 +00:00
Babel Bot
68fad796b1 v7.16.2 2021-11-01 21:47:31 +00:00
Nicolò Ribaudo
5b29557af9
Fix "e2e-babel" Babel 8 test (#13909) 2021-11-01 21:49:50 +01:00
Huáng Jùnliàng
833b39112d
fix: early return when param binding is not found (#13910) 2021-11-01 15:11:30 -04:00
Sosuke Suzuki
cba7f9e503
Add missing assertions type (#13905) 2021-11-01 08:43:39 -04:00
Babel Bot
2d9de5f7f9 Add v7.16.1 to CHANGELOG.md [skip ci] 2021-10-30 21:33:53 +00:00
Babel Bot
67eb2c805e v7.16.1 2021-10-30 21:21:37 +00:00
Nicolò Ribaudo
7396f05341
Skip ESLint 8 tests on publish (#13898) 2021-10-30 15:11:28 -04:00
Peach
c20506e594
Fix binding access for plugin-transform-typescript (#13900) 2021-10-30 19:54:42 +02:00
Nicolò Ribaudo
07d1a8008e
Lint our codebase with ESLint 8 (#13899)
* Use ESLint 8

* Update lockfile
2021-10-30 11:39:43 -04:00
Nicolò Ribaudo
b1dca95801 Add 7.16.0 to CHANGELOG.md 2021-10-30 01:49:31 +02:00
Nicolò Ribaudo
45308f3cba v7.16.0 2021-10-30 01:26:04 +02:00
Nicolò Ribaudo
e33186c68e Pre-release updates
Update the release tool to 0c289ca7ee
2021-10-30 01:25:25 +02:00
Nicolò Ribaudo
0c820a456d
Update core-js and polyfill plugins (#13897) 2021-10-30 01:09:58 +02:00
Babel Bot
bff3f4f37d
chore: update test262 to ba82d46238bd16c3e31b93d21d2846c81a9ccf7a (#13893) 2021-10-28 23:28:41 -04:00
Sosuke Suzuki
d5ba355867
Support TypeScript 4.5 type-only import/export specifiers (#13802) 2021-10-29 01:23:23 +02:00
Huáng Jùnliàng
872086a9a0
feat: support startColumn option (#13887) 2021-10-29 01:20:32 +02:00
Nicolò Ribaudo
718c6cb7de
Handle .mts and .cts files in @babel/preset-typescript (#13838) 2021-10-29 01:13:37 +02:00
Nicolò Ribaudo
381277ae35
Add ESLint 8 support to @babel/eslint-parser (#13782)
* Add ESLint 8 support to `@babel/eslint-parser`

* Only read eslint version dynamically during dev

* Fix tests

* Update ESLint

* Use ESLint 8 stable

* Review

* Check

* Fix babel config
2021-10-28 16:41:55 -04:00
J. S. Choi
ad59a2c618
Caret topic (pipe operator) (#13749)
* parser: Add caret as topic reference (tests)

* parser: Add caret as topic reference (implement)

* generator: Avoid reconstructing validTopicTokenSet

* babel-parser: Remove redundant throws in expression.js

* Minimize diff

* Update error message

Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-10-28 16:04:55 -04:00
Sosuke Suzuki
ddc45a5a50
Enable class static blocks by default (#13713)
* Remove classStaticBlock plugin

* Update tests

* Remove class static blocks from proposalPlugins

* Update tests

* Remove classStaticBlock from mapping for test262

* chore: update babel-types

Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
2021-10-28 14:39:04 -04:00
Mickey Rose
99a3fefede
add skipTransparentExprWrapperNodes helper (#13687)
* overload `skipTransparentExprWrappers`

* fixes isSimpleMemberExpression
  in @babel/plugin-proposal-optional-chaining

* use skipTransparentExprWrappers<Expression> instead of the NodePath
  overload where possible in @babel/plugin-proposal-optional-chaining

* Revert "overload `skipTransparentExprWrappers`"

This reverts commit fad47596a64a8d33aadacb7695dbf1aa60a528ae.

* add helper `skipTransparentExprWrapperNodes`

* avoids constructing NodePaths when only the Node is needed

* fixes isSimpleMemberExpression
  in @babel/plugin-proposal-optional-chaining

* use this new helper instead of skipTransparentExprWrappers
  where possible in @babel/plugin-proposal-optional-chaining
2021-10-28 14:16:22 -04:00
Justin Ridgewell
b1793656e6
Add aliases for Standardized, TypeScript, and Flow (#13666)
* Ensure non-standard types have an appropriate alias

This helps with filter out the types. Eg, I'm concerned with just the core JS types, and in I can derive them via:

```typescript
type Core = Exclude<t.Node, t.TypeScript | t.Flow>;
```

* Lint

* Export deprecated alias types

* Add docs descriptions for new aliases

* Add Standardized alias

* Fix inherits aliases

* Filter aliases from node types

* Remove Proposal alias
2021-10-28 14:14:32 -04:00
Nicolò Ribaudo
248aa9d302
Use Yarn 3.1 stable (#13885) 2021-10-26 19:23:23 +02:00
Nicolò Ribaudo
fb7ddf4d38
[ts] Support private methods overloads (#13876)
* [parser] Allow private methods overloads when parsing TS

* Add transform tests

* Fix estree

* Fix flow
2021-10-26 07:29:20 +02:00
Nicolò Ribaudo
290d52fdc1
Lint benchmarks (#13881) 2021-10-25 07:23:43 +02:00
Nicolò Ribaudo
ff922962a4
Fix create-react-app and vue-cli tests on Node.js 17 (#13879)
* Fix `create-react-app` and `vue-cli` tests on Node.js 17

* Only on Node 17

* Fix
2021-10-25 07:22:42 +02:00
Nicolò Ribaudo
c7ddb1ae93
Use workspace:^ to specify @babel/ dependencies (#13772)
* Enforce `workspace:^` to specify `@babel/` dependencies

* `yarn constraints --fix`

* Update lockfile
2021-10-25 07:22:08 +02:00
Nicolò Ribaudo
62b2c5ebb9
Regenerate parser fixtures (#13882) 2021-10-24 18:12:10 +02:00
Huáng Jùnliàng
e45d86c333
[babel 8] Enable preset-env bugfixes by default (#13866) 2021-10-24 15:17:19 +02:00
Nicolò Ribaudo
f2b3134791
Update to Yarn 3.1 (#13856) 2021-10-24 14:47:03 +02:00
Mickey Rose
76a7e65229
add benchmarks for babel-types builders (#13874) 2021-10-23 23:28:47 +02:00
Mickey Rose
b5907ef967
remove executable permission from files that shouldn't have it (#13873) 2021-10-23 14:18:30 +02:00
Mickey Rose
cfe6739dc0
fix: allow enum member without initializer after non-literal member (#13865) 2021-10-22 08:52:23 -04:00
Babel Bot
c75fa21cb8
Update test262 (#13869) 2021-10-22 09:00:06 +02:00
Mickey Rose
35ec4394a7
Simplify (transpiled) babel-types builder wrappers (#13843) 2021-10-21 18:55:42 +02:00
Nicolò Ribaudo
362c623a1c
Test on Node.js 17 (#13867) 2021-10-21 13:23:11 +02:00
Emily Marigold Klassen
fca5c9a501
Don't transform declare class in proposal-class-properties (#13854)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-10-21 00:30:05 +02:00
Huáng Jùnliàng
29f697c84e
Implement @babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression (#13842)
* fix: register function expression id after params

* implement bugfix plugin

* add more testcases

* fix: do not skip pattern binding referencing id

* update compat-table

* add bugfix plugin to preset-env

* update Babel 8 test fixtures

* Update packages/babel-plugin-bugfix-safari-id-destructuring-collision-in-function-expression/README.md

* chore: bundle bugfix plugin

* address review comments

* add runtime version check

* update compat table

* fix syntax error

* update test fixtures

* revert bugfixes targets update

* update Babel 8 test fixtures
2021-10-20 15:53:40 -04:00
Nicolò Ribaudo
780aa48d2a
Force loading plugins/presets from the monorepo in tests (#13858) 2021-10-18 14:03:50 +02:00
Babel Bot
513b00e60d
chore: update test262 to 8d420cef415f3501cb24d674b8c032d1f09402a0 (#13850) 2021-10-14 22:55:02 -04:00
Mickey Rose
24aa1b44fe
[ts] precise return type on createTypeAnnotationBasedOnTypeof (#13844) 2021-10-14 09:00:19 +02:00
Mickey Rose
2403a4889d
remove ineffectual helper names filter (#13841) 2021-10-12 10:30:28 -04:00
Nicolò Ribaudo
2df453d2da
Update failing fixture (#13840) 2021-10-11 15:55:40 -05:00
Huáng Jùnliàng
21eeb8e7a9
Restore traversal context after enter / traverse (#13813) 2021-10-11 19:04:01 +02:00
Nicolò Ribaudo
6880898510
[babel 8] Remove make-dir polyfill for fs.mkdirSync (#13828)
* [babel 8] Remove `make-dir` polyfill for `fs.makeDitSync`

* `yarn`

* fix

* Inject polyfills in jest tests when needed
2021-10-11 07:01:30 +02:00
Huáng Jùnliàng
49a0d65be1
Mark static block as FunctionParent (#13832)
* refactor: move StaticBlock definition to core

* update generated types

* fix: mark StaticBlock as FunctionParent

* revise testcase

* update babel-types docs
2021-10-10 20:22:27 -04:00
Mickey Rose
00f8ee3484
ignore non-js files in babel-helpers/src/helpers (#13833)
* ignore non-js files in `babel-helpers/src/helpers`

* fix misnamed `generateAsserts` -> `generateHelpers`
2021-10-11 00:21:55 +02:00
Nicolò Ribaudo
65e963e5de
Regenerate helpers-generated.ts (#13831) 2021-10-08 22:02:07 +02:00
renovate[bot]
ce2876e190
chore(deps): update third-party parser tests to 64a1628 (#13816)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-10-08 00:13:02 +02:00
Nicolò Ribaudo
b9ea196259
Await promises from sync iterators with for-await (#13824)
Co-authored-by: Mickey Rose <lightmare@users.noreply.github.com>
2021-10-07 23:57:25 +02:00
overlookmotel
6029252bec
Fix missing inner comments in function expressions (#13825) 2021-10-07 23:34:12 +02:00
Huáng Jùnliàng
c2f747c9b9
Improve transform-react-jsx typings (#13820)
* improve transform-react-jsx typings

* rename test fixtures

* remove unreachable sourceSelf check

* update test fixtures

* Update packages/babel-core/src/index.ts

* Update packages/babel-plugin-transform-react-jsx/src/create-plugin.ts

Co-authored-by: Henry Zhu <hi@henryzoo.com>

* Update packages/babel-plugin-transform-react-jsx/src/create-plugin.ts

Co-authored-by: Henry Zhu <hi@henryzoo.com>
2021-10-07 14:01:50 -04:00
renovate[bot]
41325645f8
chore(deps): update dependency through2 to v4 (#13822)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-10-07 00:18:04 +02:00
Nicolò Ribaudo
289e4a9bbe Update yarn.lock 2021-10-06 23:05:51 +02:00
Babel Bot
a89b315cd4 Add v7.15.8 to CHANGELOG.md [skip ci] 2021-10-06 20:55:25 +00:00
Babel Bot
c4b13725aa v7.15.8 2021-10-06 20:45:15 +00:00
renovate[bot]
e97a6baecb
chore(deps): update dependency gulp-filter to v7 (#13818)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-10-06 17:16:46 +02:00
overlookmotel
58a65e99c0
Fix missing inner comments in class expressions (#13821) 2021-10-06 14:54:20 +02:00
Patrick Eriksson
7acc68a86b
Improve debug logging for IgnoreList (#13814) 2021-10-06 14:53:28 +02:00
Alexander Zaytsev
42c9edaf6e
Optimization of string splitting (#13812) 2021-10-05 20:15:55 +02: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
Sosuke Suzuki
7bbdf096aa
Update parser plugins for ts tests (#13808) 2021-10-03 19:51:34 +09:00
Huáng Jùnliàng
ce31b76ac9
remove verifyPackageTree patch (#13805) 2021-10-01 15:15:15 -04:00
Babel Bot
c7a401a998
Update test262 (#13804) 2021-09-30 20:30:41 -05:00
Hirotaka Tagawa / wafuwafu13
6c684f9b54
Convert @babel/plugin-transform-spread to TypeScript (#13770)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-10-01 01:37:04 +02:00
Huáng Jùnliàng
89cab4311c
fix: remove imported types from export (#13800)
* fix: remove imported types from export

* add onlyRemoveTypeImports testcase
2021-09-28 15:13:37 -04:00
NotWearingPants
767b72f9c2
[skip-ci] Fixed typo in issues' welcome comment in CI (#13797) 2021-09-27 11:49:03 +02:00
NotWearingPants
26d0a7e10f
Fix Gulpfile path separator issue on Windows (#13795) 2021-09-26 23:51:05 +02:00
Huáng Jùnliàng
14572e1881
Sort module export names (#13788)
* fix: sort export init statements by name

* update test fixtures

* refactor: reduce memory footprint

* review comments
2021-09-26 10:12:18 -04:00
Julien Wajsberg
6818b22dc0
[@babel/node] Forward the signal SIGTERM as well (#13784) 2021-09-25 10:18:10 +02:00
Babel Bot
8960f9e68e
Update test262 (#13789) 2021-09-24 17:59:13 +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
613ae6fac7
Update polyfill plugins (#13781)
* Update polyfill plugins

* Babel 8
2021-09-23 09:24:45 +02: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
3d1481f363 Add v7.15.7 to CHANGELOG.md [skip ci] 2021-09-17 23:06:44 +00:00
Babel Bot
8d0294edf8 v7.15.7 2021-09-17 22:54:10 +00:00
Nicolò Ribaudo
a815d7dd10
Update Jest to 27.2.0 (#13776)
* Update Jest to `27.2.0`

* Update
2021-09-17 19:02:36 +02:00
Nicolò Ribaudo
422b87a76f
Update to @nicolo-ribaudo/chokidar-2@2.1.8-no-fsevents.3 (#13775) 2021-09-17 11:29:12 -04: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
Babel Bot
eec8372b56
chore: update test262 to 650e7add4a4a2d9ee468d2e7625c0b68c130be04 (#13774) 2021-09-17 09:00:53 +02:00
JuniorTour
da79c90f2a
fix(babel-parser): Allow line break before assert return type (#13771) 2021-09-16 23:24:11 +02:00
Nicolò Ribaudo
8fb50429ea
Throw a better error when transforming imported bindings in types (#13739)
* Throw a better error when transforming imported bindings in types

* Also type casts

* Update error message
2021-09-16 23:14:41 +02:00
Nicolò Ribaudo
2ffb19828f
Update to Yarn 3 (#13140) 2021-09-16 22:23:46 +02:00
Steven Degutis
137fecc765
Move pipeline operator to Stage 2 (#13754) 2021-09-16 17:54:31 +02:00
Nicolò Ribaudo
69ae2388f8
Fix regexpu-core bundling in @babel/standalone (#13767) 2021-09-15 23:45:30 +02:00
Huáng Jùnliàng
a27c1b8881
Update Identifier definitions to Unicode 14 (#13759) 2021-09-15 07:33:13 -04:00
Nicolò Ribaudo
f57bb79791
Update regexpu-core (#13764) 2021-09-15 07:30:21 -04: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
Nicolò Ribaudo
8af57dbfb7
[eslint-parser] Represent static using a Keyword token (#13751) 2021-09-13 16:35:32 +02:00
TagawaHirotaka
9780c5667f
Replace the deprecated produceCachedData option used in vm module with script.createCachedData() (#13741)
* Replace the deprecated vm produceCachedData option with createCachedData

* Use BABEL_8_BREAKING flag
2021-09-12 01:09:05 +02:00
Kristoffer K
0ca601a86f
chore: add constraint for duplicate dependency declarations (#13744) 2021-09-10 09:08:01 +02:00
Babel Bot
37e1b91b74
chore: update test262 to 66a3c3aa8b6170f84613dc66a87cd50c68e505df (#13745) 2021-09-09 20:13:53 -04:00
Babel Bot
be33f6a907 Add v7.15.6 to CHANGELOG.md [skip ci] 2021-09-09 19:35:48 +00: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
TagawaHirotaka
8c061f0848
Use @types/node for vm module (#13738) 2021-09-08 15:56:25 +02:00
Daniel Kezerashvili
40e43f5a14
fix: Duplicate function call in variable destructuring (#13711)
* Add test case demonstrating invalid behavior

* Add conditional check for child properties so RHS is not duplicated

* Add recursive check to find any nested non single-property case

* Add case for array destructuring

* Add test case for a nested rest element

* More safely recurse through array destructuring

* Traverse assignment and nested rest operations

* Refactor to be more clear which case statement we are executing against

* Update missed snapshots

* Update packages/babel-plugin-proposal-object-rest-spread/src/index.js

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

* Filter null array elements, add early return, remove optional chaining

* Use stronger type assertions

* Update fall through to be false; add early return to RestElement case

* Move hasMoreThanOneBinding to its own file with distinct tests

* Rename testing helper to more appropriately match business logic

* Yarn Dedup & rename hasMoreThanOneBinding to shouldStoreRHSInTemporaryVariable

Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
2021-09-07 17:27:52 -04:00
Huáng Jùnliàng
d87a3d9e13
id in import attributes should not be referenced (#13733) 2021-09-07 08:29:15 -04:00
Yvan Zhu
1ebc5b7f7b
Remove duplicate dependency and devDependency in preset-env (#13737)
Co-authored-by: zhuyunfeng <ext.zhuyunfeng1@jd.com>
2021-09-07 14:27:03 +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
0d5ca876fd Add v7.15.5 to CHANGELOG.md [skip ci] 2021-09-04 08:59:16 +00: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
5a361fedb4
Update test262 (#13729) 2021-09-04 09:40:42 +02:00
Federico Ciardi
66cadea103
Revert "fix: non breaking align options naming" (#13732)
This reverts commit 51a0caa8a2dac2651856035760413d76fb422d77.
2021-09-04 09:34:41 +02:00
Babel Bot
5fcf876c57 Add v7.15.4 to CHANGELOG.md [skip ci] 2021-09-02 23:45:22 +02:00
Babel Bot
b2376757d7 v7.15.4 2021-09-02 21:28:31 +00:00
Huáng Jùnliàng
51c6a99c8e
getBindingIdentifiers should return params for private methods (#13723)
* docs: add comments on binding kind

* refactor: simplify For collector visitor

* getBinding does not return falsy values

* chore: table style tests

* add more test cases

* fix: return params for private methods
2021-09-02 21:55:39 +02:00
Nicolò Ribaudo
b335dcc67f
Don't manually update npm in CRA test on CircleCI (#13725) 2021-09-02 19:24:30 +02:00
Nicolò Ribaudo
fce0cffc30
Use npm@7 for CRA e2e test (#13724) 2021-09-02 08:16:20 -05:00
Huáng Jùnliàng
1f79784a99
archive stage 4 parser plugins (#13717)
* archive stage 4 parser plugins

* use npm protocol for archived plugins

* fix: get module.exports from archived plugins

* remove syntax-top-level-await from test options

* use npm syntax-class-static-block
2021-09-01 15:35:24 -04:00
Nicolò Ribaudo
804a94f829
Use import.meta.url instead of __dirname (#13721) 2021-09-01 15:57:55 +02:00
Nicolò Ribaudo
4ffbcc4bb2
Don't load top-level config in internal test (#13720) 2021-09-01 15:57:41 +02:00
Huáng Jùnliàng
6436733d7d
fix: stricter rest element check (#13715) 2021-08-31 09:31:21 -04:00
Felipe Armoni
fdfe97879e
Disallow reinitializing private elements (#13601)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
Co-authored-by: Justin Ridgewell <justin@ridgewell.name>
2021-08-30 12:44:38 +02:00
meskill
cb3ebde8ce
fix: pass browserslistEnv to resolveTargets (#13697) 2021-08-30 12:35:19 +02:00
fisker Cheung
c1f5ca6676
[eslint] Allow "latest" as ecmaVersion (#13638) 2021-08-30 12:05:37 +02:00
王清雨
313ecb579d
fix: fix static private field shadowed by local variable (#13656)
* fix: fix static private field shadowed by local variable

currently throw an error, maybe we could generate correct code

fix #12960

* feat: rename local variable and add test cases

* feat: add unshadow to privateIn visitor

also add test cases

* test: add reference to shadowed variable

* refactor: apply suggested changes

simplify logic and add comments
2021-08-30 12:03:47 +02:00
Sosuke Suzuki
a54f041440
test(parser): add no_plugin tests for module blocks (#13714) 2021-08-30 09:09:05 +02:00
Nicolò Ribaudo
1355d0078c
[ts] Fix transform for nested namespaces shorthand syntax (#13664) 2021-08-29 18:27:08 +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
Babel Bot
38d70e2da9
chore: update test262 to 836111dc3cca6345563dbf86a2dbc108a7e2939c (#13705) 2021-08-27 12:13:04 +02: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
Babel Bot
8ae4159940
chore: update test262 to 2c4f2665ec86f01bff7e42d3a5b54c9a09f9a362 (#13696) 2021-08-20 07:06:34 -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
Mickey Rose
e0c3969a24
convert @babel/helper-skip-transparent-expression-wrappers to typescript (#13686) 2021-08-20 11:08:05 +02:00
Federico Ciardi
51a0caa8a2
fix: set parserOpts.sourceFilename from root sourceFileName (#13532)
* Partial #13518

* Update tests
2021-08-19 15:54:53 -04:00
Huáng Jùnliàng
614b486780
Use named imports for babel types (#13685)
* migrate to named babel types imports

* perf: transform babel types import to destructuring

* fix merge errors

* apply plugin to itself
2021-08-18 10:28:40 -04:00
Nicolò Ribaudo
fc66d4dd05
Workaround for hanging e2e-breaking Babel test (#13623)
* Workaround for hanging e2e-breaking Babel test

* Maybe this

* Update scripts/integration-tests/e2e-babel.sh

* Update scripts/integration-tests/e2e-babel.sh
2021-08-17 20:37:34 +02:00
王清雨
b00bd94ad8
convert @babel/helpers to typescript (#13679)
Co-authored-by: Federico Ciardi <fed.ciardi@gmail.com>
2021-08-16 22:39:30 +02:00
Federico Ciardi
10640b2aad
perf: partially replace .concat with .push (#13609) 2021-08-14 16:57:06 +02:00
Babel Bot
6a651e4641
chore: update test262 to 45a913c057892bdd26f7bc06a59a0c7420f2d3ec (#13673) 2021-08-13 09:32:30 +02:00
Babel Bot
936fe405e0 Add v7.15.3 to CHANGELOG.md [skip ci] 2021-08-11 07:20:03 +00:00
Babel Bot
a5624ea457 v7.15.3 2021-08-11 07:11:36 +00:00
Nicolò Ribaudo
9188e9575c
Build the initial React Native project in e2e tests (#13642) 2021-08-10 21:40:10 +02: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
Bogdan Savluk
d48a5cb55c
convert @babel/plugin-transform-block-scoping to typescript (#13219) 2021-08-10 20:53:18 +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
Nicolò Ribaudo
b15ec33146
Lock core-js-compat version used for dev&tests (#13660) 2021-08-10 11:12:26 +02:00
dhrubesh
23d4f8c563 Derived constructors should not be allowed to return primitives (#13571)
Closes gh-13571
2021-08-09 22:47:46 +02:00
Nicolò Ribaudo
ab79f08b63
Use @babel/eslint-parser/experimental-worker for our own repo (#13643) 2021-08-09 21:39:45 +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
overlookmotel
39ba1ff300
Reduce stat calls in register (#13654) 2021-08-09 09:14:52 +02:00
Babel Bot
ebc55398a3 Add v7.15.2 to CHANGELOG.md [skip ci] 2021-08-08 16:14:38 +00: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
Babel Bot
5884adaa93
chore: update test262 to e6c21464f5f9d46679ad537dbc3e2be753fb5b5c (#13646) 2021-08-06 08:36:36 +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
bdc75dce72
Update @babel/* devDependencies to 7.15.0 (#13633) 2021-08-05 10:35:18 +02:00
Babel Bot
482e33b068 Add v7.15.1 to CHANGELOG.md [skip ci] 2021-08-05 07:29:13 +00:00
Nicolò Ribaudo
546e3d958d v7.15.1 2021-08-05 09:17:03 +02:00
Nicolò Ribaudo
da2168e110
Revert "Add display name after create context (#13501)" (#13637)
This reverts commit e9bc7c18c0de029e1cc0e0935c26f208a683e75b.
2021-08-05 09:04:57 +02:00
Babel Bot
e891601cb5 Add v7.15.0 to CHANGELOG.md [skip ci] 2021-08-04 21:13:43 +00: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
fc3b09e533
Minor updates after merging 7.15.0 PRs (#13628) 2021-08-04 09:38:10 -04:00
Tony Gorez
70c66b3799
Handle typescript function overloading in a default export (#13605)
* feat(ransform-typescript): add test case

* feat(transform-typescript): avoid calling registerGlobalType if node.id is not defined
2021-08-04 00:37:53 +02:00
Sosuke Suzuki
13af87cd3b
standalone: update preset-stage-* (#13476)
* Move classStaticBlock to stage-3

* Remove stage-4 proposals

* Move PrivatePropertyInObject

* Remove options from preset-stage-3

* Move RecordAndTuple to stage-2

* Move ModuleBlocks to stage-2

* Undo breaking change

Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-08-04 00:36:38 +02:00
Nicolò Ribaudo
ddaf0d4296
Enable top-level await parsing by default (#13387) 2021-08-04 00:00:04 +02:00
Nicolò Ribaudo
b707842dd0
Support TypeScript const enums (#13324) 2021-08-03 23:57:09 +02:00
王清雨
0542f0d7da
feat(typescript): implement namespace alias (#13528)
support `import alias = Namespace`, reject `import alias = require('foo')`

fix #12345
2021-08-03 23:55:56 +02:00
Federico Ciardi
7e50ee2d82
feat: add noIncompleteNsImportDetection assumption to plugin-transform-modules-commonjs (#13290) 2021-08-03 23:55:09 +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
Huáng Jùnliàng
e9bc7c18c0
Add display name after create context (#13501) 2021-08-03 23:32:54 +02:00
Huáng Jùnliàng
15f2f171ab feat: support hack pipeline in @babel/standalone (#13555) 2021-08-03 23:30:16 +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
885e1e02f5
Expose @babel/eslint-parser/experimental-worker (#13398)
* Expose `@babel/eslint-parser/experimental-worker`

* Fix `@babel/runtime` build on Windows
2021-08-03 23:23:32 +02:00
Samuel Gaus
830b99dc83
Add support for rhino as a compilation target (#13448)
* Add support for rhino as a compilation target

* Add tests for target: rhino

* Fix test failing due to whitespace

* Keep consistent names for rhino tests in babel 7 and 8

* Bump core-js-compat to 3.15.0

* Change references to rhino to include patch version

* Update compat table data import

* Split transpilation of arrow function features more finely

* Rename rhino fixtures to include the patch number and update to include syntax that is and isn't supported for better testing

* Only use the relevant features for transform-new-target and transform-classes
2021-08-03 23:03: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
Tony Gorez
5f4b58f678
chore(doc): add jest specific pckg command (#13607)
* chore(doc): add jest specific pckg command

* chore(doc): add debug and grep

* fix(doc): nitpicks

* chore(doc): 🎨 reshape a bit

* fix(doc): 🔍 fix nitpicks 2

* fix(doc): useless tabs

* chore(doc): simplify few lines

* chore(doc): nit picks
2021-08-03 10:25:14 -04:00
王清雨
1960f23c22
Add typings to create-class-features-plugin helper (#13570)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-08-02 21:22:37 +02:00
Oleksandr T
b3ab4769d0
fix(ts): raise error for export default interface {} (#13622) 2021-08-02 18:16:01 +02:00
Babel Bot
86fae72e5b Add v7.14.9 to CHANGELOG.md [skip ci] 2021-08-01 07:53:51 +00:00
Babel Bot
aa2cac5edc v7.14.9 2021-08-01 07:42:57 +00:00
Nicolò Ribaudo
93bade2a71
Update core-js@3 packages (#13621)
* Update `core-js@3` packages

* Update fixtures

* Update Babel 8 fixtures
2021-08-01 09:22:09 +02: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
Babel Bot
2340b87094
Update test262 (#13619) 2021-07-30 09:38:34 +02:00
Nicolò Ribaudo
862d9f8dfd
Update Rollup to ~2.54.0 (#13614) 2021-07-29 10:01:06 -04:00
Nicolò Ribaudo
82350d529b
[eslint, babel 8] Pass cwd to worker (#13526) 2021-07-28 23:12:19 +02:00
王清雨
d45ad500e7
Improve path.get typings with TS template literal types (#13588) 2021-07-28 21:47:29 +02:00
Henry Zhu
0a4b1b339c
Update README.md (github sponsors link) (#13610) 2021-07-28 19:03:46 +02:00
Huáng Jùnliàng
e4de256cdd
chore: reorganize benchmarks (#13606) 2021-07-28 07:10:29 -04:00
Anna Henningsen
d1f908924c
Fix completion record for variable declarations (#13596) 2021-07-27 23:50:47 +02:00
王清雨
e0dc925bbe
feat(traverse): specific return type for virtual types' validators (#13578)
* feat(traverse): specific return type for virtual types' validators

update generator script to use virtualType.types[0] as it's type

fix #13576

* fix: remove unused ts-expect-error

so glad that it works

* feat: use VirtualTypeAliases to generate validators for virtual types

* fix: return boolean when it doesn't have any alias

* fix: use type only import and simplify condition
2021-07-27 10:02:09 -04:00
Nicolò Ribaudo
790c5180d4
Extract computed keys from the class closure (#13600) 2021-07-26 23:31:45 +02:00
Rin Tepis
224a35c5c6
Don't insert __self: this within constructors of derived classes (#13552)
* Don't insert `__self: this` prior to `super()` calls (#13550)

`__self: this` is inserted for debugging purposes. However, it will cause a runtime error if it is inserted prior to a `super()` call in a constructor. This commit will prevent `__self: this` from inserted when there is a following `super()` call.

* Prevent adding `__self` within a constructor that has `super()` altogether.

* Fix 2 typos in the comments.

* Add an additional test case for constructors that do not have a `super()` call.

* Detect `super()` call by testing whether the class has a superclass.

* Update method name and corresponding comments

* Add an additional test for the case where the derived class do not have a `super()` call.

* Apply the same changes to babel-plugin-transform-react-jsx
2021-07-26 13:32: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
Andy Edwards
1d48bb0d8c
add 12 missing NODE_FIELDS (#13577)
* test: add fields test

* fix(babel-types): add missing NODE_FIELDS and tests

fix #13558
fix #13563

* chore: avoid using fs-extra

* chore: code cleanup

* chore: avoid util.promisify

* fix: remove bad ts-expect-error suppressions
2021-07-23 09:36:08 -04:00
Babel Bot
844baebd26
chore: update test262 to 6e2a29417ad52ba114c26838a288510d704efa1b (#13595) 2021-07-23 08:54:49 +02:00
Huáng Jùnliàng
03e8476b27
Generator performance (#13593)
* bench: setup benchmarks

* add charcodes

* perf: use string as buffer backend

baseline 256 empty statements: 3_718 ops/sec ±18.65% (0.269ms)
baseline 512 empty statements: 2_070 ops/sec ±0.96% (0.483ms)
baseline 1024 empty statements: 1_012 ops/sec ±1.76% (0.988ms)
baseline 2048 empty statements: 510 ops/sec ±1.53% (1.96ms)
current 256 empty statements: 3_965 ops/sec ±21.14% (0.252ms)
current 512 empty statements: 2_219 ops/sec ±1.29% (0.451ms)
current 1024 empty statements: 1_089 ops/sec ±1.53% (0.918ms)
current 2048 empty statements: 548 ops/sec ±1.87% (1.824ms)

* perf: add endsWithCharAndNewline

baseline 256 1-length identifiers: 1_947 ops/sec ±25.11% (0.514ms)
baseline 512 1-length identifiers: 1_115 ops/sec ±0.89% (0.897ms)
baseline 1024 1-length identifiers: 537 ops/sec ±1.71% (1.862ms)
baseline 2048 1-length identifiers: 273 ops/sec ±0.57% (3.669ms)
current 256 1-length identifiers: 2_178 ops/sec ±27.17% (0.459ms)
current 512 1-length identifiers: 1_250 ops/sec ±1.19% (0.8ms)
current 1024 1-length identifiers: 622 ops/sec ±0.71% (1.608ms)
current 2048 1-length identifiers: 308 ops/sec ±1.35% (3.251ms)

* perf: avoid one byte string compare

* perf: avoid scaning word for /

* perf: hoist babel type methods

baseline 256 25-length identifiers: 1_869 ops/sec ±29.4% (0.535ms)
baseline 512 25-length identifiers: 1_092 ops/sec ±1.62% (0.916ms)
baseline 1024 25-length identifiers: 537 ops/sec ±1.29% (1.862ms)
baseline 2048 25-length identifiers: 264 ops/sec ±2% (3.793ms)
current 256 25-length identifiers: 2_462 ops/sec ±23.38% (0.406ms)
current 512 25-length identifiers: 1_401 ops/sec ±0.73% (0.714ms)
current 1024 25-length identifiers: 671 ops/sec ±1.55% (1.491ms)
current 2048 25-length identifiers: 332 ops/sec ±1.44% (3.014ms)

* perf: hoist parens methods

baseline 256 1-length identifiers: 2_678 ops/sec ±24.96% (0.373ms)
baseline 512 1-length identifiers: 1_472 ops/sec ±2.33% (0.68ms)
baseline 1024 1-length identifiers: 737 ops/sec ±1.74% (1.357ms)
baseline 2048 1-length identifiers: 371 ops/sec ±0.79% (2.695ms)
current 256 1-length identifiers: 2_633 ops/sec ±32.44% (0.38ms)
current 512 1-length identifiers: 1_676 ops/sec ±1.49% (0.597ms)
current 1024 1-length identifiers: 803 ops/sec ±1.95% (1.246ms)
current 2048 1-length identifiers: 385 ops/sec ±2.22% (2.596ms)

* cleanup unused benchcase

* Update packages/babel-generator/src/buffer.ts

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

* cleanup benchmarks

Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-07-22 23:01:48 -04:00
Nicolò Ribaudo
2b6acada3c
Fix _step.value access in for await (#13491) 2021-07-21 19:12:18 +02:00
Andy Edwards
b67ea12c4d
[build docs] Update required node versions to ^12.20 || >=14.13 (#13580) 2021-07-20 23:14:14 +02:00
Babel Bot
86a99b662b Add v7.14.8 to CHANGELOG.md [skip ci] 2021-07-20 18:03:23 +00: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
Huáng Jùnliàng
fa439d6a73
test: patch verifyPackageTree for test purposes (#13567) 2021-07-19 23:26:52 +02:00
王清雨
aa18da08cd
fix(class-properties): replace new.target in static properties with undefined (#13560)
* fix(class-properties): replace `new.target` in static properties with `undefined`

non-static prop is not affected

fix #12737

* Update packages/babel-helper-create-class-features-plugin/src/fields.ts

fix typo

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

* fix: add loose test case and fix replace condition

* test: add new.target tests for static block

* feat: move new-target replace into thisContextVisitor

defaults to replace new.target, do not replace within function

* feat: simplify thisContextVisitor

remove function visitor since environmentVisitor is skipping arrow function

* test: remove unused fixme comments

Co-authored-by: Brian Ng <bng412@gmail.com>
2021-07-16 15:58:55 -04:00
Huáng Jùnliàng
6e57617138
Fix await binding error within static block (#13088)
* fix: allow await within SCOPE_FUNCTION under static block

* perf: scan scopeStack for once

* add new test case

* chore: update allowlist
2021-07-16 10:35:19 -04:00
Babel Bot
1c7da020e4
Update test262 (#13561) 2021-07-16 09:10:11 -05:00
Sosuke Suzuki
47d79ac975
Fix make generate-standalone -> make build-standalone (#13562) 2021-07-16 09:42:59 +02:00
Babel Bot
bfcf783834
Update test262 (#13544) 2021-07-10 17:49:41 +02:00
Huáng Jùnliàng
574f907e61
chore: bump test262-stream (#13543) 2021-07-09 22:34:58 -04:00
Mickey Rose
f639eee2f5
Dedupe code when calling buildOptimizedSequenceExpression (#13535) 2021-07-09 15:37:41 +02:00
Huáng Jùnliàng
234316161f
fix: use BABEL_8_BREAKING for new babel-types breaking changes (#13538) 2021-07-09 09:27:59 -04:00
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
Eyoatam Tamirat
56db172b0e
fix(@babel/parser): fix tokenizer context update code (#13422)
* fix(`@babel/parser`): fix `_function` update code

* fmt
2021-06-08 08:26:50 -04:00
Nicolò Ribaudo
f6f37fb8cd
Update packages related to compat data (#13432)
* Update `core-js@3`

* Update `compat-table`

* Update pinned `caniuse-lite` and `electron-to-chromium`

* Regenerate fixtures

* Regenerate Babel 8 fixtures
2021-06-08 08:24:16 -04:00
Huáng Jùnliàng
4eda1c8605
chore: bump eslint and its plugins (#13412) 2021-06-03 23:42:32 -04:00
Huáng Jùnliàng
8720919665
fix: hoist variable declaration within do block (#13122)
* fix: hoist variable declaration within do block

* test: add input for variable-declaration-start

* test: actually write a test for this issue

* make prettier happy
2021-06-03 21:39:19 -04:00
Huáng Jùnliàng
4100b42ea2
chore: specify @babel/eslint-parser deps (#13420) 2021-06-03 20:28:46 -05:00
Tony Gorez
a0369fdbfa
fix: throw when async() call param is object with assignement (#13410) 2021-06-03 16:12:15 +02:00
Daniel Tschinder
176bc24312
[Babel 8] Remove optional field from MemberExpression (#13407) 2021-06-03 16:08:34 +02:00
lightmare
92bca21011
Makefile: invoke yarn consistently via $(YARN) (#13415) 2021-06-03 01:36:24 +02:00
Huáng Jùnliàng
b8175ec060
Relax import assertion key-is-type constraint (#13409) 2021-06-02 07:51:56 -04:00
Huáng Jùnliàng
b281fe352c
Use set in parser scope (#13408)
* chore: rename benchmark

* perf: back parser scope names storage by set

* chore: add benchmark
2021-06-01 10:35:19 -04:00
Huáng Jùnliàng
cbad50ac1d
Faster checkReservedWord (#13386)
* perf: faster parser scope check

* perf: early return for identifier length > 10

* perf: early return for normal identifier names

* chore: add benchmark

* Update packages/babel-parser/src/parser/expression.js
2021-06-01 08:42:23 -04:00
Huáng Jùnliàng
ae3f5d905a
Back parser state exportedIdentifiers by set (#13406) 2021-06-01 07:17:30 -04:00
lightmare
b397aca024
fix generate-helpers failing in URL-encoded path (#13404)
HELPERS_FOLDER.pathname may be URL-encoded, if the working tree's
absolute path contains spaces, some reserved characters, or anything
beyond ASCII.

readFile accepts a plain String or URL for the path, but does not
automatically decode URL-encoded Strings.
2021-05-31 21:45:54 +02:00
Nicolò Ribaudo
08772e28f2
Update polyfill plugins (#13373) 2021-05-31 18:47:13 +02:00
Kristoffer K
140ec5aa5c
chore: setup Yarn constraints (#13363) 2021-05-31 18:46:03 +02:00
Yosuke Ota
0b29b5c2c0
Add support for d flag of regex literals in parser (#13396) 2021-05-31 08:34:53 -04:00
Babel Bot
813f2a3cce Add v7.14.4 to CHANGELOG.md [skip ci] 2021-05-28 17:00:38 +00:00
Babel Bot
219fd3ab1f v7.14.4 2021-05-28 16:50:09 +00:00
Alan Orozco
f35513fbaa
Hoist omitted keys from object spread operator (#13384) 2021-05-28 18:32:30 +02:00
Babel Bot
612f19fbdc
chore: update test262 to d454b8389b07dae252c008adb64ae242b812c801 (#13385) 2021-05-28 09:27:05 +02:00
Sosuke Suzuki
c6bebfe653
[ts] Remove override modifier (#13381) 2021-05-27 09:21:22 -05:00
Nicolò Ribaudo
1341e560ff
Skip flow/typecasts/3 test on Node.js 6 (#13382) 2021-05-27 09:20:45 -05:00
Huáng Jùnliàng
079f8cd5bc
fix: disallow surrogate in the end of contextual name (#13377) 2021-05-26 22:57:59 -04:00
Tobias Koppers
dbfa87740c
Improve performance (#13376) 2021-05-26 20:04:58 -05:00
Bogdan Savluk
4ee6a27780
convert @babel/helper-create-class-features-plugin to TS (#13214)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-05-26 15:49:35 +02:00
dependabot[bot]
342fec1a78
Update compat data dependencies (#13368)
* Bump browserslist from 4.16.4 to 4.16.5

Bumps [browserslist](https://github.com/browserslist/browserslist) from 4.16.4 to 4.16.5.
- [Release notes](https://github.com/browserslist/browserslist/releases)
- [Changelog](https://github.com/browserslist/browserslist/blob/main/CHANGELOG.md)
- [Commits](https://github.com/browserslist/browserslist/compare/4.16.4...4.16.5)

Signed-off-by: dependabot[bot] <support@github.com>

* Update compat data packages

* Update tests

* Add to resolutions

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-05-26 15:27:13 +02:00
renovate[bot]
2b06883a5b
chore(deps): update dependency jest to v27 (#13375)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-05-26 15:26:47 +02:00
fisker Cheung
9332579fc0
Fix @babel/plugin-syntax-private-property-in-object README.md (#13372)
[skip ci]
2021-05-26 11:22:43 +02:00
Huáng Jùnliàng
acf2a10899
Faster tokenizer lookahead (#13341)
* refactor: simplify token context structure

* add benchmark

* perf: return a sub-state on tokenizer lookahead

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

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

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

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

* remove irrelevant comment

* fix: guard curPosition with isLookahead

* add test cases

Co-authored-by: Brian Ng <bng412@gmail.com>
2021-05-25 21:12:38 -04:00
Daniel Tschinder
b1f57e5fb5
Only allow TSParameterProperty in ClassMethod parameters (#13349) 2021-05-23 20:14:21 +02:00
Sosuke Suzuki
d6a5f6190d
[ts] Default typeAnnotation of TSTypePredicate to null (#13354) 2021-05-23 20:12:42 +02:00
Kristoffer K
533e63af52
chore(eslint-tests): add missing dependency @babel/core (#13355) 2021-05-23 17:59:14 +02:00
Babel Bot
82a2ca82ca
Update test262 (#13347)
* chore: update test262 to 5e0fc43c6641e6655632ca73479c79f1dcb86a17

* Enable `importAssertions` parser plugin

Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-05-21 10:40:53 -04:00
Nicolò Ribaudo
c3e99a0cfb
Make Renovate run yarn dedupe after updating dependencies (#13348)
* Make Renovate run `yarn dedupe` after updating dependencies

* Update renovate.json

Co-authored-by: Matthieu MOREL <mmorel-35@users.noreply.github.com>

Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
Co-authored-by: Matthieu MOREL <mmorel-35@users.noreply.github.com>
2021-05-21 10:39:08 -04:00
Nicolò Ribaudo
cd7f40a564
[e2e-jest] Remove t.Noop from @types/babel__traverse (#13342) 2021-05-21 14:10:11 +02:00
renovate[bot]
205e4bf3e4
chore(deps): update actions/github-script action to v4 (#13344)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-05-21 01:06:26 +02:00
Will Binns-Smith
b4c798e754
[ts] Insert export {} when necessary to imply ESM (#13314) 2021-05-21 00:54:39 +02:00
renovate[bot]
f0b9b25a23
Configure Renovate (#13337)
Co-authored-by: Matthieu MOREL <mmorel-35@users.noreply.github.com>
Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-05-21 00:43:14 +02:00
Bogdan Savluk
8b1bcd1079
convert @babel/helper-compilation-targets to typescript (#13218)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-05-21 00:20:42 +02:00
François Servant
12190042e6 Fix error when parsing ignored files with @babel/eslint-parser (#13338)
* fix(babel-eslint-parser): prevent typeerror in maybeParse
* fix(babel-eslint-parser): prevent other typeerrors in convert modules
* test(babel-eslint-parser): test maybeParse when file is ignored
* refactor(babel-eslint-parser): use fallback options instead of typeerror protections

Co-authored-by: devfservant <43757707+devfservant@users.noreply.github.com>
Co-authored-by: François Servant <francois.servant.e@thalesdigital.io>
2021-05-20 00:20:58 +02:00
Huáng Jùnliàng
461ba2531a
refactor: add parse*Literal parser routines (#13333)
* refactor: simplify parseLiteral interface

* refactor: extract specific methods on parsing literals

* fix: avoid StringLiteral type comparison

* add test cases

* fix: remove redundant node

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

Co-authored-by: Federico Ciardi <fed.ciardi@gmail.com>

* update test fixtures

* fix: refine parseLiteral typings

Co-authored-by: Federico Ciardi <fed.ciardi@gmail.com>
2021-05-19 16:00:24 -04:00
Bogdan Savluk
053f94fc77
convert @babel/plugin-transform-classes to typescript (#13220)
* babel-plugin-transform-classes flowts rename

* babel-plugin-transform-classes flowts convert

* babel-plugin-transform-classes

* babel-plugin-transform-classes add optional paramter

* babel-plugin-transform-classes

* babel-plugin-transform-classes

* make generate-tsconfig

* yarn install

* Fix type checking

Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-05-19 16:15:09 +02:00
Huáng Jùnliàng
2a5b23186a
perf: minimize identifier lookahead when parsing let (#13328) 2021-05-18 08:19:58 -04:00
Babel Bot
f7a9f10ba4 Add v7.14.3 to CHANGELOG.md [skip ci] 2021-05-17 20:45:12 +00:00
Babel Bot
1487a46dd5 v7.14.3 2021-05-17 20:26:25 +00:00
Nicolò Ribaudo
f85c6437c5
Pass assumptions set in presets to plugins (#13321) 2021-05-17 22:00:01 +02:00
Huáng Jùnliàng
0d0950f341
fix: preserve tokensLength in tryParse (#13326)
* fix: preserve tokensLength in tryParse

* Apply suggestions from code review

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

Co-authored-by: Brian Ng <bng412@gmail.com>
2021-05-17 15:32:12 -04:00
Nicolò Ribaudo
9d620c2d42
[babel 8] Move ESLint parsing to a Worker (#13199) 2021-05-17 17:04:10 +02:00
Nicolò Ribaudo
c2181343f1
Parse let declarations whose id starts with \ (#13325) 2021-05-17 08:46:59 -05:00
Nicolò Ribaudo
229a5481f4
Remove warnings about loose mode for class feats in tests (#13301) 2021-05-15 00:14:02 +02:00
Nicolò Ribaudo
989aac2a4c
Don't duplicate the base class when using constantSuper (#13303) 2021-05-15 00:02:46 +02:00
Huáng Jùnliàng
3195883923
chore: add class-static-block test262 mapping (#13313) 2021-05-14 17:11:10 -04:00
Huáng Jùnliàng
c1c8d5e1db
update yarn lockfile (#13311) 2021-05-14 14:03:08 -04:00
Nicolò Ribaudo
8732dd39c6
Compile static blocks without the intermediate priv field step (#13297)
* Remove ordering constraints for `static-blocks` plugin

* Handle static blocks directly in `helper-create-class-features-plugin`
2021-05-14 11:35:59 -04:00
Huáng Jùnliàng
b3d35cd412
[Babel 8]: remove module attributes parser/generator support (#13308)
* breaking: remove support of moduleAttributes

* Update packages/babel-parser/src/plugin-utils.js

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

* chore: remove todo comments

* make prettier happy

Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-05-14 09:55:40 -04:00
Bogdan Savluk
b670c11070
convert @babel/standalone to typescript (#13212)
* babel-standalone flowts rename

* babel-standalone flowts convert

* babel-standalone - update rollup plugin to support ts files

* babel-standalone code generation update

* babel-standalone

* babel-standalone eslint fixes

* babel-standalone tsconfig.json

* babel-standalone

* babel-standalone tsconfig related fix

* make generate-tsconfig

* yarn install

* babel-standalone use fs.existsSync

Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-05-14 09:54:09 -04:00
Bogdan Savluk
bb70ea47f5
convert @babel/cli to typescript (#13213)
* babel-cli flowts rename

* babel-cli flowts convert

* babel-cli

* yarn install
2021-05-14 09:32:38 +02:00
Babel Bot
5def29d1ca
chore: update test262 to 4f50cbfc771ffe41ac5e4a9d2f12b1d3a5d3b938 (#13310) 2021-05-13 20:37:26 -04:00
Bogdan Savluk
4bf5f45d42
convert @babel/plugin-transform-runtime to typescript (#13216)
Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
2021-05-13 22:27:57 +02:00
Bogdan Savluk
acfff5d7fe
convert @babel/plugin-transform-typescript to typescript (#13222)
* babel-plugin-transform-typescript flowts rename

* babel-plugin-transform-typescript flowts convert

* babel-plugin-transform-typescript

* babel-plugin-transform-typescript type fixes

* babel-plugin-transform-typescript

* make generate-tsconfig

* yarn install

* babel-plugin-transform-typescript

* babel-plugin-transform-typescript avoid typecast
2021-05-13 14:37:34 -04:00
Bogdan Savluk
72371cb637
convert @babel/helper-create-regexp-features-plugin to typescript (#13215) 2021-05-12 23:18:20 -04:00
Nicolò Ribaudo
e21abad016
Add test for fixed block scoping issue (#13304) 2021-05-12 20:16:10 -05:00
Bogdan Savluk
379bc775ed
convert @babel/plugin-transform-react-jsx to typescript (#13221)
* babel-plugin-transform-react-jsx flowts rename

* babel-plugin-transform-react-jsx flowts convert

* babel-plugin-transform-react-jsx

* babel-plugin-transform-react-jsx fix

* make generate-tsconfig

* yarn install

* babel-plugin-transform-react-jsx remove unused typecast
2021-05-12 21:15:31 -04:00
Babel Bot
7c9f618dfc Add v7.14.2 to CHANGELOG.md [skip ci] 2021-05-12 17:10:23 +00:00
Babel Bot
7512095c84 v7.14.2 2021-05-12 16:58:57 +00:00
Huáng Jùnliàng
9e241fc180
Better error for export * as ns without the correct plugin (#13296) 2021-05-12 00:40:13 +02:00
Clark Jacobsohn
cca97d1e78
Fix: Only create @babel/node IPC channel when needed (#13295)
Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
2021-05-11 23:59:07 +02:00
Huáng Jùnliàng
875fc8e693
[babel 8] Do not skip requeued paths (#13291) 2021-05-11 23:55:23 +02:00
Sosuke Suzuki
b2d9156cc6
Update to Prettier 2.3 (#13288) 2021-05-10 15:34:13 +02:00
Trinangkur Chatterjee
5ae3a6c2a4
Update lodash version for fixing security vulnerability (#13289)
* Update lodash version for fixing security vulnerability

* Update yarn.lock
2021-05-10 09:20:23 -04: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
serut
e74b3fb1c6
[DOC] Add missing Monorepo configuration (#13253)
* [DOC] Add missing Monorepo configuration

* Update eslint/babel-eslint-parser/README.md

Co-authored-by: Federico Ciardi <fed.ciardi@gmail.com>

* [DOC] Unify monorepo config file

* [DOC] Clean monorepo configuration

* [DOC] Monorepo conf when eslint runned by package

Co-authored-by: Federico Ciardi <fed.ciardi@gmail.com>
2021-05-07 13:53:01 -04:00
Nicolò Ribaudo
4c725f8cf8
Support objects from other contexts in t.valueToNode (#13275) 2021-05-07 12:34:30 +02:00
Babel Bot
4c1b8cc751
chore: update test262 to c11d6b00bc2c53323fe26a5813a720fd74cd25ad (#13276) 2021-05-07 10:27:04 +02: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
Nicolò Ribaudo
1879491af7
[eslint] Don't crash on multiple @babel/parser copies (#13274) 2021-05-06 23:31:19 +02:00
Stuart Cook
68bc4dfd31
Print parentheses around identifier let where necessary (#13269) 2021-05-06 21:10:45 +02:00
Huáng Jùnliàng
96fce81438
chore: bump eslint-visitor-keys (#13272) 2021-05-06 12:23:21 -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
Nicolò Ribaudo
9440318309
Update Rollup plugins (#13265) 2021-05-06 08:53:30 +02:00
Yen-Wei Liu
187094b9a6
[babel-types] Update matchesPattern to account for this (#13264) 2021-05-05 23:08:43 +02:00
Babel Bot
8873d0c402 Add v7.14.1 to CHANGELOG.md [skip ci] 2021-05-04 01:56:35 +00: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
Nicolò Ribaudo
07440424d9
Archive @@babel/plugin-syntax-module-string-names (#13246)
babel/babel-archive@15c88ef856
2021-05-03 14:07:25 -04:00
overlookmotel
f166b7ae58
Fix plugin-transform-block-scoping const violations (#13248)
* Fix plugin-transform-block-scoping const violations

Fixes #13245

* Replace `a++` with `+a` where const violation

* Remove assignment where const violation

* Remove assignment for `&&=`, `||=`, `??=` where const violation

* Shorten test
2021-05-03 11:47:25 -04: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
Huáng Jùnliàng
9d6893d51f
Add alias docs for @babel/types (#13151)
* add alias docs generator

* fix LVal and PatternLike

* sort alias covered node types

* add inner links between alias and node types

* review comments

* tiny tweaks
2021-04-30 16:08:12 -04:00
aancer-rca
3b55e8877c
fix: Typo in @babel/helper-create-class-features-plugin (#13237) 2021-04-30 17:40:28 +02:00
Nicolò Ribaudo
41c02246fb
Update @babel/* packages (#13231) 2021-04-30 11:07:16 -04:00
Babel Bot
b99c4f06d4
chore: update test262 to 70bc32edab22b44db9d671ce505db8842ae200b6 (#13233) 2021-04-29 21:50:43 -04:00
Nicolò Ribaudo
910b1f266f
Archive @babel/plugin-syntax-class-properties (#13232)
babel/babel-archive@b95d3626ad
2021-04-29 23:56:03 +02:00
Babel Bot
437a6f32c9 Add v7.14.0 to CHANGELOG.md [skip ci] 2021-04-29 20:11:07 +00: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
50e0e353ee Implement async-do-expressions transform (#13117)
Co-authored-by: Brian Ng <bng412@gmail.com>
2021-04-28 18:26:01 +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
Nicolò Ribaudo
f30c99aa24 Mark WeakMaps of private fields as pure (#13194) 2021-04-28 18:25:17 +02:00
Nicolò Ribaudo
b4c21c729f Enable class fields & private methods by default (#13091) 2021-04-28 18:25:17 +02:00
Nicolò Ribaudo
5a7a782da2 Add private brand checks to shippedProposals (#13176) 2021-04-28 18:25:17 +02:00
Nicolò Ribaudo
2fc288576e Allow compiling #foo in obj without compiling private fields (#13172) 2021-04-28 18:25:17 +02:00
Nicolò Ribaudo
3c2b98ff06 Add class static blocks to preset-env's shippedProposals (#13114) 2021-04-28 18:25:17 +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
be03be1bc3
Implement importInterop: "node" option for module transforms (#12838) 2021-04-28 18:22:47 +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
Chris West
d0fcbfccdd
perf(core): check files before interacting with them (#13090)
* perf(core): check files before interacting with them

* refactor: inline fs.exists.sync -> nodeFs.existsSync
2021-04-28 00:41:18 +02:00
Huáng Jùnliàng
47537688d2
Improve isIdentifierName performance (#13211) 2021-04-27 23:04:48 +02:00
Huáng Jùnliàng
88da2e80ed
perf: avoid loadFullConfig when creating block hoist plugin (#13223)
* perf: avoid loadFullConfig when creating block hoist plugin

* address code review comments
2021-04-27 14:39:18 -04:00
Nicolò Ribaudo
a0e20ac5df
Simplify the wrapRegExp helper for named groups (#13201) 2021-04-26 23:39:32 +02:00
Stuart Cook
026e7f5a95
Prevent ForOfStatement from printing the forbidden sequence "for ( async of" (#13208) 2021-04-26 11:34:10 -04:00
Simon Lydell
504d22d29b
babel-highlight: Upgrade to js-tokens@7 (#13203)
Support for ES2021: The `||=`, `&&=` and `??=` operators, as well as
undescores in numeric literals (`1_000`).
2021-04-26 16:56:59 +02:00
Stuart Cook
3d4b801bb9
Simplify the special-case printing of single-param arrow functions (#13204)
* Simplify the special-case printing of single-param arrow functions

* Update test fixtures with single-param arrow functions

* Add some explicit snapshot tests for known edge-cases
2021-04-26 10:26:45 -04:00
Huáng Jùnliàng
10f4d08efb
refactor: avoid parsing logic on locations (#13200) 2021-04-25 09:15:48 -04:00
Babel Bot
fb908fd87e
Update test262 (#13196)
* chore: update test262 to eca69e2c95972a4c5780ef58fe1f1e53e871b9b1

* test262: add mapping for privateIn

* test262: ignored syntax-free features

Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
2021-04-23 10:40:54 +02:00
Nicolò Ribaudo
f63d73c94e
Allow putting helpers in individual files (#13190)
* Allow putting helpers in individual files

* Lint

* Also move `objectSpread2` (to show an helper with deps)

* Update fixture and package.json

* fixture
2021-04-22 20:45:52 +02:00
Jason
66181dbe37
fix: don't deduplicate comments with same start index (#13169) 2021-04-21 15:57:57 +02:00
Micha Reiser
adb5adac0c
fix: Don't load browserslist in block-hoist-plugin (#13182)
* fix: Don't load browserslist in block-hoist-plugin

* Remove test case

* Remove added new line
2021-04-21 09:20:17 -04:00
Huáng Jùnliàng
0c425cfb97
chore: run coverage-test against node 16 (#13183) 2021-04-20 19:47:17 -04:00
Babel Bot
304f316e60 Add v7.13.17 to CHANGELOG.md [skip ci] 2021-04-20 23:19:47 +00:00
Babel Bot
006e2c9393 v7.13.17 2021-04-20 23:05:58 +00:00
Nicolò Ribaudo
87e35ae5c7
Fix undeclared variable in iterableToArrayLimit (#13185) 2021-04-21 00:39:00 +02:00
Anna Henningsen
b971e00eb0
Fix completion record for labeled statement (#13084)
`{labelAlthoughIMeantItToBeAKey: value}` strikes again :)
2021-04-20 11:08:46 -04:00
Moti Zilberman
691c46846f
fix(destructuring): preserve loc of original declaration in output (#13173) 2021-04-20 10:36:06 -04:00
Jason
ab06ccad49
fix: clone comments in cloneNode (#13178) 2021-04-20 10:34:12 -04:00
Babel Bot
86d9cf5020 Add v7.13.16 to CHANGELOG.md [skip ci] 2021-04-20 11:21:56 +00:00
Babel Bot
d94a8e50ed v7.13.16 2021-04-20 11:11:32 +00:00
Nicolò Ribaudo
21ef7c8816
Workaround GitHub issue templates bug (#13179)
* Update bug_report.yml

* Update feature_request.yml

* Update bug_report.yml

* Update bug_report.yml

* Update bug_report.yml

* Update bug_report.yml

* Update bug_report.yml

* Update bug_report.yml

* Update feature_request.yml

* Update bug_report.yml

* Update feature_request.yml
2021-04-20 12:15:47 +02:00
Nicolò Ribaudo
bdbd07d170
Update browserslist and caniuse-lite (#13174) 2021-04-19 20:04:59 +02:00
Huáng Jùnliàng
b6168e6917
chore: update @babel/* deps (#13166) 2021-04-19 19:07:59 +02: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
Nicolò Ribaudo
e92d6b2458
Use the new GitHub issues template (#13168)
Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
2021-04-16 22:59:34 +02:00
Babel Bot
0cfe3dc107
Update test262 (#13164) 2021-04-16 02:20:50 +02:00
Nicolò Ribaudo
eaea9693ff
Install psmisc in vue-cli e2e tests on CircleCI (#13162) 2021-04-16 01:50:09 +02:00
Nicolò Ribaudo
808d437cf4
Support iterating generators in browsers without Symbol (#13129) 2021-04-15 23:47:53 +02:00
Huáng Jùnliàng
5d55055537
fix: add default value for browserslist config path (#13159) 2021-04-15 17:05:35 -04:00
Huáng Jùnliàng
cbfcee59c7
Archive helper-explode-class and helper-bindify-decorators (#13160) 2021-04-15 22:25:23 +02:00
Henry Zhu
ed4ccd6482
codecov: token not required (#13158) 2021-04-15 15:31:32 -04:00
Cody Mims
54e088b347
Update links in @babel/eslint-parser README (#13155)
Co-authored-by: Kai Cataldo <kai@kaicataldo.com>
2021-04-15 01:17:34 +02:00
Nicolò Ribaudo
5c7d2a7fa2
Archive @babel/helper-call-delegate (#13153) 2021-04-14 23:54:46 +02:00
Huáng Jùnliàng
d6d942ddac
docs: refine babel-types docs generator (#13148)
* docs: refine babel-types docs generator

* avoid AST node shape title when it does not have node fields

* remove h1 from the output

* refactor docs generators
2021-04-14 16:26:25 -04:00
Huáng Jùnliàng
1e31d415be
refactor: use FunctionParent on visiting var scope (#13152) 2021-04-14 16:00:40 -04:00
Nicolò Ribaudo
d24bd7ce5c
Remove remaining lodash dependencies (#13139) 2021-04-13 22:41:22 +02:00
Huáng Jùnliàng
b35c78f08d
docs: add README to helper-compilation-targets (#13131) 2021-04-12 12:06:05 -04:00
Nathan Walters
30f93b36a2
Fix printing of single-param async arrow function with comments (#13136)
* Fix printing of async arrow function with a single param and comments

* Add OVERWRITE support to generator tests
2021-04-12 10:10:02 -04:00
Babel Bot
672a58660f Add v7.13.15 to CHANGELOG.md [skip ci] 2021-04-08 15:51:08 +00:00
Babel Bot
e50f6f7eef v7.13.15 2021-04-08 15:40:57 +00:00
Nicolò Ribaudo
be1003b837
[preset-env - debug] Print targets that need each plugin (#13115) 2021-04-07 22:50:14 +02:00
Nicolò Ribaudo
6d89daf064
Align regenerator-transform import with native ESM (#13086)
* Align `regenerator-transform` import with native ESM

* Add `regenerator` test to `@babel/standalone`
2021-04-07 17:25:46 +02: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
Tan Li Hau
6b57145d38
Support yield in do expression (#10101)
Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
2021-04-06 17:09:14 +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
Huáng Jùnliàng
7bc72bb451
fix: do not filter report from functions within class elements (#13106) 2021-04-05 16:02:02 -04:00
Nicolò Ribaudo
61e866f6b8
Do not load root babel.config.js in tests (#13087)
* Do not load root `babel.config.js` in tests

* Update packages/babel-helper-transform-fixture-test-runner/src/index.ts
2021-04-02 21:57:49 +02:00
Huáng Jùnliàng
b577e44d16
Refactor switch support in NodePath#getCompletionRecords (#13030) 2021-04-02 13:36:05 -04:00
Nicolò Ribaudo
86c44ba62e
Update CoC contacts (#13081) 2021-03-31 20:24:48 -04:00
Nicolò Ribaudo
8b137c638f
Update @rollup/plugin-node-resolve (#13080) 2021-03-31 23:11:48 +02:00
Nicolò Ribaudo
8d4da69e9d
Update polyfill plugins (#13079)
* Update polyfill plugins

* Update fixtures

* Update Babel 8 fixtures
2021-03-31 13:46:15 -04:00
Nicolò Ribaudo
d563773723
Compile classes when spread is unsupported (#13075) 2021-03-31 16:42:52 +02:00
Huáng Jùnliàng
3e174e9cbd
perf: lazy load preset-env plugins (#13076) 2021-03-30 21:43:41 +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
Bogdan Savluk
c8a91d9eef Rename @babel/core files to .ts (#12929) 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
5c0d2f6032 Add v7.13.14 to CHANGELOG.md [skip ci] 2021-03-29 14:16:26 +00:00
Babel Bot
7ac9e9f740 v7.13.14 2021-03-29 13:34:28 +00:00
Charles Suh
409244685a
fix: make sure "clone-deep-browser" code path is used on browsers (#13068) 2021-03-29 09:32:15 -04:00
Henry Zhu
c38469d191
add SHOW_CONFIG_FOR to template [skip ci] (#13066) 2021-03-28 23:32:52 -04:00
Nicolò Ribaudo
06eb3b73cb
Only resolve package.json when relative configs are enabled (#13063) 2021-03-28 12:04:42 +02:00
Nicolò Ribaudo
8e8954b470
[babel 8] Remove module-specific options from @babel/core (#12724) 2021-03-28 01:27:37 +01:00
Henry Zhu
6b39bafab6
Remove lodash deps (#13057)
* inline escapeRegExp instead of using any dep

* inline camelCase

* replace merge with object spread

* copy if array instead of using clone

* inline isRegExp

* review fixes!

* remove escape-string-regexp from package.json and in test

* add error for field defaults that are not primitives or empty arrays

* replace merge with object spread

* yarn
2021-03-27 17:59:34 +01:00
Bogdan Savluk
6ac07a1647
convert @babel/helper-module-transforms to typescript (#12928)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-03-27 01:40:32 +01:00
Mark Banner
e5e37b94a5
Update eslint-scope to be compatible with ESlint's dependency (#13058) 2021-03-27 00:58:29 +01:00
Babel Bot
4f9ec8310e Add v7.13.13 to CHANGELOG.md [skip ci] 2021-03-26 21:21:04 +00:00
Babel Bot
2f8203f190 v7.13.13 2021-03-26 21:09:38 +00:00
Huáng Jùnliàng
1e3ef05685
[babel 8] Type checking preset-react options (#12741)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-03-26 20:11:39 +01:00
Nicolò Ribaudo
e68f2ce195
Correctly handle relative browserslistConfigFile paths (#13031)
* Correctly handle relative `browserslistConfigFile`

* Fix flow
2021-03-26 15:07:28 -04:00
Huáng Jùnliàng
16d83002de
[babel 8] type checking preset-flow options (#12751)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-03-26 00:33:02 +01:00
Nicolò Ribaudo
b0d83daceb
Resolve .browserslistrc as a project-wide file (#13028) 2021-03-25 21:37:42 +01:00
Nicolò Ribaudo
8c445e60ba
Fix e2e vue-cli Babel 8 tests (#13050)
Co-authored-by: Henry Zhu <hi@henryzoo.com>
2021-03-25 19:23:18 +01:00
Justin Ridgewell
327b4cec49
Remove lodash sortBy use (#13021) 2021-03-25 18:56:18 +01:00
Justin Ridgewell
73dcd06293
Remove some lodash/cloneDeep calls (#13032) 2021-03-25 18:01:19 +01:00
Huáng Jùnliàng
0233e3c8eb
Replace CircleCI badge to GitHub CI (#13055) 2021-03-25 11:40:44 -04:00
Clint Goodman
266e07736e
fix: Don't hoist JSX elements referencing mutable variables (#13054)
issue-13051

Co-authored-by: Clint Goodman <clintgoodman@workfront.com>
2021-03-25 16:38:31 +01: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
Nicolò Ribaudo
2ae19d01b1
Update fixtures (#13045)
* Update fixtures

* Update standalone tests
2021-03-24 14:18:02 +01:00
Anna Henningsen
1ef78ca55b
Expand type definitions for path.{get,set}Data to cover symbols (#13044) 2021-03-24 14:04:13 +01:00
JounQin
238ce0bac8
fix(types): add missing range for BaseNode (#13046)
close #13027
2021-03-24 14:02:52 +01:00
Huáng Jùnliàng
6ee87eea49
[babel 8] fallback targets to "defaults, not ie 11" (#12989) 2021-03-23 20:17:16 +01:00
Nicolò Ribaudo
564ca6638f
Set rootMode: "root" in loadPartialConfig (#13040) 2021-03-23 20:11:10 +01:00
Huáng Jùnliàng
b784c81aeb
Do not bail on SHOW_CONFIG_FOR matches (#12954)
Co-authored-by: Babel Bot <babel-bot@users.noreply.github.com>
2021-03-23 20:02:07 +01:00
KevinMolotov
b360d8d614 fix: make @babel/node spawned process bubble msg (#13037)
* Add ipc test

Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-03-23 14:36:49 +01:00
Nicolò Ribaudo
afef4f85ff Move @babel/node tests (#13037) 2021-03-23 14:36:49 +01: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
69e22c325d Add v7.13.12 to CHANGELOG.md [skip ci] 2021-03-22 15:48:01 +00:00
Babel Bot
edb11baabf v7.13.12 2021-03-22 15:36:45 +00:00
Nicolò Ribaudo
4beca3999e
Fix importing polyfill plugins in the Rollup bundle (#13017) 2021-03-22 14:48:48 +01:00
Justin Ridgewell
2b11748555
Remove lodash from @babel/compat-data (#13024)
* Remove lodash from babel-compat-data

* Remove flatMap poorlyfill.
2021-03-20 00:11:58 +01:00
Huáng Jùnliàng
c2a42492db
Implement @babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining (#13009) 2021-03-19 13:26:28 -04:00
Nicolò Ribaudo
974f9c5b01
Update TypeScript (#13029) 2021-03-19 13:25:01 -04:00
Huáng Jùnliàng
85963167b4
fix: do not throw when creating type annotation based on bigint (#12971) 2021-03-19 11:44:11 -04:00
Justin Ridgewell
e2244c92d9
Remove lodash from @babel/node tests (#13025) 2021-03-19 15:53:13 +01:00
Justin Ridgewell
830a93cc97
Remove lodash/chunk (#13022) 2021-03-19 15:52:25 +01:00
Justin Ridgewell
d12f9a98c7
Remove lodash/pull (#13026) 2021-03-19 15:51:34 +01:00
Justin Ridgewell
78cf07767a
Remove lodash/has (#13023) 2021-03-19 15:50:52 +01:00
Huáng Jùnliàng
020c88e74b
Update compat data (#13008) 2021-03-19 08:33:59 -04:00
Nicolò Ribaudo
52d2716bf6
Update Yarn to v2.4.1 (#12892) 2021-03-19 13:02:51 +01:00
Bogdan Savluk
d1f3d30598
convert @babel/helper-member-expression-to-functions to ts (#12925) 2021-03-19 12:53:21 +01:00
Sosuke Suzuki
beb7cf8b24
Sort error keys with ESLint (#13020) 2021-03-18 21:01:57 +01:00
Bogdan Savluk
21e8e59f7d
convert @babel/helper-module-imports to typescript (#12924) 2021-03-18 16:05:44 +01:00
Bogdan Savluk
ff8e9f74d8
convert @babel/helper-transform-fixture-test-runner to typescript (#12923)
* babel-helper-transform-fixture-test-runner flowts rename

* babel-helper-transform-fixture-test-runner flowts convert

* babel-helper-transform-fixture-test-runner

* babel-helper-transform-fixture-test-runner eslint fixes

* babel-helper-transform-fixture-test-runner type fix

* babel-helper-transform-fixture-test-runner

* yarn install
2021-03-18 10:52:19 -04:00
Bogdan Savluk
b97a627964
convert @babel/helper-simple-access to typescript (#12927) 2021-03-16 15:31:59 +01:00
Bogdan Savluk
befa46567f
convert @babel/helper-replace-supers to typescript (#12926) 2021-03-16 13:05:15 +01:00
hajnalbendeguz
281acd6448
Improve error message when not providing a value for JSX key (#12983)
* Improve error message when not providing a value for key

* Update packages/babel-plugin-transform-react-jsx/src/create-plugin.js

Show location of attribute instead of only the path

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

* Change error message to be less aggressive

* Throw error when runtime is "classic"

Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
2021-03-16 13:02:08 +01:00
Bogdan Savluk
6e1e00388b
update tsconfig generation to reference dependencies used in source code (#12941)
* update tsconfig generation to reference dependencies used in source code

in some cases there are devDependecnies used for type-checking, this change adds references to them when generationg tsconfig

* use regexp to extract import sources instead of parsing the code

* try reverting globby to previously installed version

* Run `generate-tsconfig` after `bootstrap-only`

* Revert "try reverting globby to previously installed version"

This reverts commit 56489622137f6f56938c781ea3aec5c98528b033.

Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-03-15 12:13:36 -04:00
Babel Bot
df51ba03cd Add v7.13.11 to CHANGELOG.md [skip ci] 2021-03-15 09:45:03 +00:00
Babel Bot
4b674ea031 v7.13.11 2021-03-15 09:34:23 +00:00
Nicolò Ribaudo
759f8ecdce
Point to CJS files in @babel/compat-data's exports (#13000) 2021-03-15 10:14:47 +01: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
Nicolò Ribaudo
05fa18e652
Run e2e tests on GH actions (#12517)
Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
Co-authored-by: Juan Picado <juanpicado19@gmail.com>
2021-03-12 22:33:40 +01:00
Huáng Jùnliàng
71417bbfcf
Fix esmodule: "intersect" on iOS versions (#12996) 2021-03-12 22:14:00 +01:00
Babel Bot
bc856e03c2
chore: update test262 to 31126581e7290f9233c29cefd93f66c6ac78f1c9 (#12993) 2021-03-12 10:12:10 -05:00
Nicolò Ribaudo
8ad6b75cde
Use function rather than var to compile private methods (#12990) 2021-03-11 02:08:31 +01:00
Babel Bot
b3e2bcda73 Add v7.13.10 to CHANGELOG.md [skip ci] 2021-03-08 22:36:59 +00:00
Babel Bot
d1d404b9a3 v7.13.10 2021-03-08 22:23:36 +00:00
MrBrain295
4bd24a92ae
Capitalize design docs headings (#12974)
[skip ci]
2021-03-08 23:20:47 +01:00
Justin Ridgewell
49a9b70cb1
Optionally enable external-helpers in tests (#12982)
* Optionally enable external-helpers in tests

https://github.com/babel/babel/pull/12911 was a breaking change that now requires you to keep `babel-plugin-external-helpers` in your `package.json`. It'll will probably be unnoticeable for most, because another dependency could transitively depend on it, but AMP recently hit it when cleaning up our deps.

* Cast to boolean

* Fix package name
2021-03-08 16:58:30 -05:00
Nicolò Ribaudo
c702895256
Update min Babel version for #12917 (#12977) 2021-03-07 21:09:05 +01:00
Nicolò Ribaudo
8dacf85859
Lazily initialize and cache constant JSX elements (#12967)
Co-authored-by: Justin Ridgewell <justin@ridgewell.name>
2021-03-06 17:33:43 +01: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
Babel Bot
ea620e822e
Update test262 (#12968) 2021-03-05 01:27:02 +01:00
Nicolò Ribaudo
6e551ae882
Suggest using babel.config.json when linting dependencies (#12956) 2021-03-04 21:13:19 +01:00
Nicolò Ribaudo
5f60bf0d14
Regenerate @babel/runtime-* package.json (#12964) 2021-03-04 19:18:57 +01:00
Nicolò Ribaudo
d9ebfab07f
[internal] Use the Node.js behavior for default imports (#12795) 2021-03-04 13:55:15 +01:00
Huáng Jùnliàng
ac758f7d70
Ensure static private method init run before static property (#12918) 2021-03-04 00:02:23 +01:00
Huáng Jùnliàng
bdb207cb75
Class static private field destructure set (#12917)
* fix: support static private field destructure set ([C.#p] = [0])

* 🚧

* fix: add compatibility warning for older @babel/helper versions

* refactor: extract common routines among classPrivateFiled helpers

* More 🚧
2021-03-03 16:38:16 -05:00
Huáng Jùnliàng
70c77e550c
check descriptor before private field access (#12910)
* fix: check descriptor before private field access

* add test cases
2021-03-03 15:06:38 -05:00
Nicolò Ribaudo
b12a4de457
Update @babel/helper-create-class-features-plugin (#12944) 2021-03-02 16:28:14 +01:00
Nicolò Ribaudo
42752a430e
Don't show warning from spied console.warn (#12946) 2021-03-02 15:22:20 +01:00
Nicolò Ribaudo
8574aa33d5
Remove accidentally commited file (#12947) 2021-03-02 08:34:23 -05: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
Nicolò Ribaudo
0d9ad433b4
Fix esmodules: true without specified browsers (#12908)
* Fix `esmodules: true` without specified browsers

* fix
2021-03-02 08:16:25 +01:00
Huáng Jùnliàng
82e089c7dd
Evaluate object and initializer when setting a private method (#12707)
* fix: evaluate initializer when a private method is set as a field

* make legacy node happy

* add accessor test cases

* fix: evaluate object before RHS

* fix: evaluate object before throwing writeOnlyError
2021-03-01 17:49:59 -05:00
Babel Bot
78d1950aed Add v7.13.9 to CHANGELOG.md [skip ci] 2021-03-01 21:44:41 +00:00
Babel Bot
2c0e8d0008 v7.13.9 2021-03-01 21:33:11 +00:00
Nicolò Ribaudo
c155caf1e8
Load .browserslistrc when using old @babel/core versions (#12934) 2021-03-01 20:46:02 +01: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
Nicolò Ribaudo
9844eeee84
Put back ESM helpers in a folder where we can use .js (#12919) 2021-03-01 17:31:12 +01:00
Bogdan Savluk
a653b9c08e
Convert @babel/helper-fixtures to typescript (#12922) 2021-03-01 16:44:23 +01:00
Michael サイトー 中村 Bashurov
d05fdbc3c7
Fix invalid print output when empty array is passed to t.tsInterfaceDeclaration (#12921)
If you pass an empty array as `extends` in `t.tsInterfaceDeclaration` you'll get an invalid code printed

```ts
t.tsInterfaceDeclaration(
  t.identifier('x'),
  undefined,
  [],
  t.tsInterfaceBody([])
)
```

You will get
```ts
interface A extends {}
```

Which is an invalid TS, this PR fixes that
2021-03-01 10:43:24 -05:00
Michael サイトー 中村 Bashurov
4c343ac853
Allow nullish extends in interfaceish (#12920)
* Allow nullish extends in interfaceish

Otherwise code such as

```ts
t.interfaceDeclaration(
  t.identifier('id'),
  undefined,
  undefined,
  t.objectTypeAnnotation([])
)
```

Will fail when priting with ` TypeError: unknown: Cannot read property 'length' of null`
Despite nullish values being allowed in `t.interfaceDeclaration` definitions

* Update packages/babel-generator/src/generators/flow.ts

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

Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-03-01 10:42:40 -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
Babel Bot
265424d43f Add v7.13.8 to CHANGELOG.md [skip ci] 2021-02-26 23:40:48 +00:00
Babel Bot
e2abc19c4c v7.13.8 2021-02-26 23:28:19 +00:00
Nicolò Ribaudo
ea6a438315
Enable external-helpers by default in tests (#12911)
Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
Co-authored-by: Babel Bot <babel-bot@users.noreply.github.com>
2021-02-26 23:33:26 +01:00
Huáng Jùnliàng
bfd30b9445
chore: do not provide polyfills on bundling @babel/standalone (#12909)
* chore: do not provide polyfills on bundling @babel/standalone

* review from Nicolò

* chore: update @babel/helper-define-polyfill-provider
2021-02-26 17:10:10 -05:00
Babel Bot
cf7860ffa2
chore: update test262 to 0d922ddc97f7a9ad9a3636cb578bbf03604cd9d6 (#12912) 2021-02-26 09:00:23 -05:00
Alan Lu - 川古
6a0394634f
Don't inject invalid core-js@2 polyfills (#12901) 2021-02-25 21:52:21 +01:00
Nicolò Ribaudo
962d81483e
Skip _extends helper for {…x} with modern targets (#12899) 2021-02-25 21:16:56 +01:00
Nicolò Ribaudo
9a1b59f1f9
Do not warn for loose of class features in preset-env (#12898) 2021-02-25 21:15:48 +01:00
Nicolò Ribaudo
b17231e1af
[internal] Keep the .cjs extension when compiling source files (#12820)
* [internal] Keep the .cjs extension when compiling

* yarn
2021-02-25 18:03:05 +01:00
Nicolò Ribaudo
74db827c0a
Workaround yarn bug with self-referencing packages (#12906) 2021-02-25 17:33:15 +01:00
Nicolò Ribaudo
bb558aaf28
Allow require() of runtime helpers in Node.js 13.2-13.6 (#12893) 2021-02-25 12:28:50 +01:00
Nicolò Ribaudo
039eb2710d
Update all the @babel/* dependencies (#12897) 2021-02-25 02:46:56 +01:00
Bogdan Savluk
0a4dc05806
convert @babel/highlight to typescript (#12432)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-02-25 01:38:47 +01:00
Huáng Jùnliàng
4fa7a72874
chore: pin typescript to 4.1 (#12894) 2021-02-24 22:07:44 +01:00
Huáng Jùnliàng
227f881f35
fix(eslint-parser): merge input estree options (#12891)
Co-authored-by: Kai Cataldo <kai@kaicataldo.com>
2021-02-24 20:13:47 +01:00
Nicolò Ribaudo
6a471decc3
Improve @babel/runtime esm stability (#12883) 2021-02-24 20:04:03 +01:00
pigcan
c9da9650eb
chore: downgrade semver to ^6.3.2 (#12890) 2021-02-24 19:55:42 +01:00
Babel Bot
4e87b80eba Add v7.13.7 to CHANGELOG.md [skip ci] 2021-02-24 09:01:38 +00:00
Babel Bot
c39082ab74 v7.13.7 2021-02-24 08:52:11 +00:00
Nicolò Ribaudo
cfdbdc0d1c Add back export maps for the helpers/esm folder 2021-02-23 19:08:30 +01:00
Babel Bot
0666145742 Add v7.13.6 to CHANGELOG.md [skip ci] 2021-02-23 17:45:36 +00:00
Babel Bot
30a89c969a v7.13.6 2021-02-23 17:34:04 +00:00
Nicolò Ribaudo
ac7ac540ee
Define fallback exports for @babel/runtime on old Node (#12877)
* Define fallback `exports` for `@babel/runtime` on old Node

* Update .github/workflows/ci.yml
2021-02-23 18:32:48 +01:00
Huáng Jùnliàng
4acb73449f
Update compat table (#12850)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-02-23 15:32:54 +01:00
Babel Bot
4575b37c90 Add v7.13.5 to CHANGELOG.md [skip ci] 2021-02-23 14:03:09 +00:00
Babel Bot
9a4269e7b6 v7.13.5 2021-02-23 13:52:17 +00:00
Eli Gao
1484260f62
Add es6.array.slice in corejs2 builtins (#12870) 2021-02-23 13:49:09 +01:00
Nicolò Ribaudo
115841e778
Ensure that @babel/runtime-corejs3 imports are injected (#12869)
* Add failing test for #12863

* Minimal

* Ensure that `@babel/runtime-corejs2` imports are injected
2021-02-23 12:47:04 +01:00
Babel Bot
ce22ac012b Add v7.13.4 to CHANGELOG.md [skip ci] 2021-02-23 10:41:05 +00:00
Babel Bot
e940b8c4b9 v7.13.4 2021-02-23 10:31:04 +00:00
Nicolò Ribaudo
c30039029a
Don't enable class features by default in estree (#12867)
* Don't enable class features by default in `estree`

* Flow

* Reduce breakage
2021-02-23 11:30:01 +01:00
Nicolò Ribaudo
a2114d452c
Always load the CJS helpers when using require (#12865) 2021-02-23 11:21:01 +01:00
Babel Bot
f47737c31c Add v7.13.3 to CHANGELOG.md [skip ci] 2021-02-23 02:24:23 +00:00
Nicolò Ribaudo
9281110bf1 v7.13.3 2021-02-23 03:13:20 +01:00
Babel Bot
a95bcf5cf3 Add v7.13.2 to CHANGELOG.md [skip ci] 2021-02-23 02:11:36 +00:00
Babel Bot
bcd70d988f v7.13.2 2021-02-23 02:00:44 +00:00
Nicolò Ribaudo
c4320a6019
Correctly update module.exports.default of typeof helper (#12858) 2021-02-23 02:59:03 +01:00
Babel Bot
feb78c7735 Add v7.13.1 to CHANGELOG.md [skip ci] 2021-02-23 01:20:04 +00:00
Babel Bot
103b187e6f v7.13.1 2021-02-23 01:10:37 +00:00
Nicolò Ribaudo
0c65ff7a55
Rename index.mjs to _index.mjs in @babel/runtime (#12855) 2021-02-23 02:08:41 +01:00
Nicolò Ribaudo
5861704361
Export function versions of createConfigItem (#12852) 2021-02-23 02:01:39 +01:00
Babel Bot
e3f090395a Add v7.13.0 to CHANGELOG.md [skip ci] 2021-02-22 22:51:10 +00:00
Nicolò Ribaudo
c827193d9c v7.13.0 2021-02-22 23:35:18 +01:00
Nicolò Ribaudo
771841f764
Fix _isNativeReflectConstruct helper (#8461) 2021-02-22 22:49:44 +01:00
Nicolò Ribaudo
484667b54c
Use babel-plugin-polyfill-* packages in transform-runtime (#12845) 2021-02-22 22:30:27 +01:00
Michael Tsulaya
5bec993b7b
[babel-cli] Don't fail when chmod throws an error (#12846)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
Co-authored-by: Federico Ciardi <fed.ciardi@gmail.com>
2021-02-22 19:21:52 +01:00
Nicolò Ribaudo
c294de3529
Update @rollup/plugin-replace (#12847) 2021-02-22 19:20:18 +01:00
Nicolò Ribaudo
eefd83794c
Don't use useESModules in @babel/runtime build script (#12842) 2021-02-22 16:12:32 +01:00
Huáng Jùnliàng
ba4ac7d587
chore: bump semver to 7.0.0 (#12015)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-02-21 23:56:43 +01:00
Nicolò Ribaudo
8e7a164490
Make sure that Rollup's dynamicRequireTargets are included (#12839)
* Make sure that Rollup's `dynamicRequireTargets` are included

* Update packages/babel-standalone/src/dynamic-require-entrypoint.cjs

Co-authored-by: Brian Ng <bng412@gmail.com>
2021-02-21 22:32:50 +01:00
Siddhant N Trivedi
507ad63140
[babel 8] Remove the Noop node type (#12361)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-02-21 21:59:53 +01:00
Huáng Jùnliàng
03d7911be6
Implement class features in estree (#12370)
Co-authored-by: Kai Cataldo <kai@kaicataldo.com>
2021-02-21 20:12:12 +01:00
Sosuke Suzuki
9c567baa9b
Parse JS Module Blocks proposal (#12469) 2021-02-21 20:08:20 +01:00
Sosuke Suzuki
e4588bed22
Support TypeScript 4.2 abstract constructor signatures (#12628)
Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-02-21 20:07:55 +01:00
Huáng Jùnliàng
74dc70aabb
fix: create IPC channel for spawned babel-node process (#12836) 2021-02-21 19:31:36 +01:00
George Zahariev
5b99b8f221
Flow Enums with unknown members support (#12193)
* Flow Enums with unknown members parsing

* Updates after rebase

Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-02-21 18:42:23 +01:00
Julian Grinblat
d1d6ee6dc2
Add cjs as a default extension (#11498) 2021-02-21 17:56:15 +01:00
Tim Seckinger
774c526390
referencesImport: support named exports accessed via * imports (#12603)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-02-21 17:54:43 +01:00
Huáng Jùnliàng
a93bbce867
Enable allowNamespaces in transform-typescript by default (#12765) 2021-02-21 17:46:06 +01:00
Daniel Sainati
16e9f1c8e5
Support Flow this parameter annotations (#12234) 2021-02-21 17:44:27 +01:00
Rick Button
407e8b5c7b
Implement "Records and Tuples" transform (#12145)
Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-02-21 17:42:17 +01:00
Nicolò Ribaudo
c10825ab05
Use conditional exports in @babel/runtime for CJS/ESM (#12632) 2021-02-21 17:41:10 +01:00
Nicolò Ribaudo
143ee801e6
Use the babel-plugin-polyfill-* packages in preset-env (#12583) 2021-02-21 17:40:29 +01:00
Huáng Jùnliàng
33fbf84fa3 Optimās: respect noDocumentAll when transforming obj?.#p (#12762) 2021-02-21 17:09:46 +01:00
Nicolò Ribaudo
6ef7b51a11 Implement assumptions defined in the babel/rfcs#5 RFC
- `mutableTemplateObject` and `ignoreToPrimitiveHint` (#12408)
- `setClassMethods` (#12407)
- `setComputedProperties` (#12490)
- `ignoreFunctionLength` (#12491)
- `noDocumentAll` (#12481)
- `iterableIsArray` and `arrayLikeIsIterable` (#12489)
- `pureGetters` (#12504)
- `skipForOfIteratorClosing` (#12496)
- `objectRestNoSymbols`, `setSpreadProperties` and `pureGetters` (#12505)
- `noNewArrows` (#12613, #12793)
- `setPublicClassFields` and `privateFieldsAsProperties` (#12497)
- `constantReexports` and `enumerableModuleMeta` (#12618)
- `constantSuper`, `superIsCallableConstructor` and `noClassCalls` (#12726)

Co-authored-by: Justin Ridgewell <justin@ridgewell.name>
Co-authored-by: Huáng Jùnliàng <JLHwung@users.noreply.github.com>
2021-02-21 17:09:45 +01:00
Nicolò Ribaudo
7965c15557 Add @babel/core support for the new assumptions option (#12219)
- Disallow setting assumptions to `false` in presets (#12498)
2021-02-21 17:09:45 +01:00
Nicolò Ribaudo
cb404e4776 Add targets and browserslist* options to @babel/core (#12189) 2021-02-21 17:09:43 +01:00
Nicolò Ribaudo
31ca15ef58 Support .mjs plugins/presets and async factories (#12266) 2021-02-21 17:08:30 +01:00
Huáng Jùnliàng
bfd3f80bdb
refactor: move @babel/helper-hoist-variables to ts (#12413)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-02-21 00:30:35 +01:00
Huáng Jùnliàng
62c1ccbf81
Convert @babel/helper-explode-assignable-expression to ts (#12417)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-02-21 00:11:11 +01:00
Federico Ciardi
8316cdaa8a
typo: correct variable name (#12837) 2021-02-20 22:03:24 +01:00
Huáng Jùnliàng
72961e4564
fix: add regenerate-unicode-properties to dynamicRequireTargets (#12819)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-02-20 20:05:12 +01:00
Babel Bot
3af936fc2b
chore: update test262 to f6034ebe9fb92d4d3dea644b9225bdc18b44a7ab (#12826) 2021-02-19 12:03:22 -05:00
Nicolò Ribaudo
7757a2850c
Minor refactor to expect().toEqualFile assertion (#12830) 2021-02-19 17:39:31 +01:00
Nicolò Ribaudo
1387d66e6c
Merge "Build and Test" and "Publish" release jobs (#12818) 2021-02-19 16:00:55 +01:00
Huáng Jùnliàng
af2ed36535
chore: bump core-js-compat (#12821) 2021-02-19 13:27:38 +01:00
overlookmotel
792672ec60
Fix scope of computed method keys (#12812)
* Fix scope of computed method keys

* Test for nested computed keys

* Fix scope.rename with computed method keys

* Optional chaining tests
2021-02-19 02:36:34 +01:00
Anders Kaseorg
a940c0984f
babel-register: Don’t rewrite the cache if it’s not dirty (#12813)
This saves time and avoids unnecessary SSD wear.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2021-02-18 23:36:46 +01:00
Babel Bot
6af24480c4 Add v7.12.18 to CHANGELOG.md [skip ci] 2021-02-18 16:20:52 +00:00
Nicolò Ribaudo
d0b6f0fe0f v7.12.18 2021-02-18 17:02:30 +01:00
Nicolò Ribaudo
c0875b043c
Make sure to publish all the necessary files (#12817) 2021-02-18 17:01:20 +01:00
Babel Bot
ab2539125b Add v7.12.17 to CHANGELOG.md [skip ci] 2021-02-18 15:14:42 +00:00
Nicolò Ribaudo
2f755ef052 v7.12.17 2021-02-18 15:58:43 +01:00
Devon Govett
35c41148dd
Do not cache non-existent JS config files forever (#12211)
Missed a spot in #11906. Currently if you don't have a JS config file and then add one to your project, it will not be picked up without restarting the process. Changing from caching forever to never caching when files don't exist fixes the issue.
2021-02-18 12:18:02 +01:00
Nicolò Ribaudo
0e06a3822b
Store LICENSE files when publishing from GH actions (#12810)
* Generate LICENSE files in GH actions

* Add LICENSE files to the build artifact
2021-02-17 19:38:26 +01:00
Huáng Jùnliàng
99130bcfdd
Register binding when transforming TSParameterProperty (#12796) 2021-02-17 00:42:01 +01:00
Tim Seckinger
0bb57005c6
test: avoid deprecated jest.addMatchers (#12811) 2021-02-17 00:36:19 +01:00
Federico Ciardi
8e9143f06f
fix(ts): parse multiline declarations correctly (#12776)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-02-16 23:51:24 +01:00
Huáng Jùnliàng
4462eeae6b
Clean up traverse scope (#12797) 2021-02-16 23:23:34 +01:00
Ikko Ashimine
4819ce70e4
refactor: fix typo in error.js (#12808)
postion -> position
2021-02-16 12:35:58 -05:00
Sosuke Suzuki
c22e72eb24
Raise recoverable error for type members with invalid modifiers (#12785) 2021-02-12 17:20:06 +01:00
Nicolò Ribaudo
8063fde0d8
Reuse the readOnlyError helper for private methods (#12792) 2021-02-12 14:33:23 +01:00
Nicolò Ribaudo
30dc25db0e
Fix "Add to CHANGELOG.md" commit message (#12791) 2021-02-12 10:10:29 +01:00
Nicolò Ribaudo
7c9dd78b8d
Fix import assertions type definitions (#12794)
* Fix import assertions type definitions

* Ensure that an array validator is followed by assertEach
2021-02-12 10:10:05 +01:00
Babel Bot
4e2f8301dc Add to CHANGELOG.md [skip ci] 2021-02-11 22:47:51 +00:00
Babel Bot
dd5c9f958c v7.12.16 2021-02-11 22:36:24 +00:00
Huáng Jùnliàng
4f92f8c11c
fix: use semver gte comparison on polyfill version tester (#12783) 2021-02-10 22:54:50 -05:00
Huáng Jùnliàng
4b8a6a8e80
Polish @babel/node REPL (#12786) 2021-02-11 00:34:29 +01:00
Nicolò Ribaudo
c07185207c
[parser] Fix scope handling of Flow declared functions (#12735) 2021-02-10 21:07:14 +01:00
Sosuke Suzuki
f1a327506e
ts: Throw recoverable for duplicates access modifier (#12775)
* Support parsing for duplicates access modifiers

Support parsing for duplicates access modifiers

* Fix lint problems

* Address reviews
2021-02-09 09:59:06 +01:00
Sosuke Suzuki
d242ea04c8
babel-parser(ts): Raise recoverable error for abstract interface (#12771)
* Support parsing abstract interface

* Address review

Address reviews

Address reviews

* Fix types

* Add hasFollowingLineBreak
2021-02-09 09:56:18 +01:00
Babel Bot
4778e32570
chore: update test262 to 950d09751616a104cb87588e21b3a32563d332d4 (#12782) 2021-02-08 23:29:23 +01:00
Huáng Jùnliàng
8bb56d4c6e
fix broken parser tests updater (#12781) 2021-02-08 16:23:08 -05:00
Nicolò Ribaudo
759a82abb1
Fix failing CI with Jest 24 (#12779) 2021-02-07 08:17:26 -05:00
Nicolò Ribaudo
e735266dee
Avoid importing .json files (#12759)
* Avoid importing `.json` files

* Use ESold in babel.config.json

* Use `import/extensions` eslint plugin
2021-02-05 23:34:36 +01:00
Sosuke Suzuki
87f264cc7b
Update build requirements in CONTRIBUTING.md (#12766) 2021-02-05 16:20:52 -05:00
Federico Ciardi
bf523da0b0
fix(ts): include asserts in TSTypePredicate location (#12763) 2021-02-05 20:02:41 +01:00
Federico Ciardi
eccbcca948
[TS] Create TSUnionType or TSIntersectionType when typealias has a leading operator (#12758)
* Create `TSUnionType` or `TSIntersectionType` when typealias has a leading operator

* Apply code review suggestions

* Test `TSIntersectionType`
2021-02-05 20:00:27 +01:00
Huáng Jùnliàng
74ed698c2e
Support destructuring variable declarator within TS namespace (#12760)
* refactor: extract handleVariableDeclaration

* fix: support general variable declarator under namespace

* fix: support general declarator on export module id duplication check

* refactor: use for-in
2021-02-05 11:52:15 -05:00
Nicolò Ribaudo
328ef420a4 Fix changelog for 7.12.15 2021-02-04 22:46:26 +01:00
Babel Bot
e7e60579cf Add to CHANGELOG.md [skip ci] 2021-02-04 21:38:31 +00:00
Babel Bot
b1921d2d9b v7.12.15 2021-02-04 21:27:03 +00:00
Nicolò Ribaudo
44bc6d672a
Allow publishing patch versions from the GH UI (#12752) 2021-02-04 22:17:45 +01:00
Federico Ciardi
d1cf66e8c1
fix(ts): include leading operator in TSUnionType and TSIntersectionType locations (#12757) 2021-02-04 19:24:35 +01:00
Nicolò Ribaudo
0fdec6b7e7
Convert runtime helpers build script to ESM (#12756) 2021-02-04 18:15:30 +01:00
Nicolò Ribaudo
77d46bcb1a
Respect the jsescOption.minimal generator option (#12755) 2021-02-04 16:45:02 +01:00
Nicolò Ribaudo
a0e3ef2117
Remove workaround for #12567 in e2e Jest tests (#12749) 2021-02-04 14:46:09 +01:00
Babel Bot
a038d787c6 Add v7.12.14 to CHANGELOG.md [skip ci] 2021-02-03 15:07:22 +00:00
Nicolò Ribaudo
dd18d87152 v7.12.14 2021-02-03 15:58:57 +01:00
Federico Ciardi
94ba66c89b
fix(ts): allow abstract methods with export default abstract class (#12748) 2021-02-03 09:48:41 -05:00
Huáng Jùnliàng
7fb6048e7c
test: add tests on {parser,generator}Override (#12740) 2021-02-02 23:18:41 -05:00
Nicolò Ribaudo
887eb0758f Remove a Babel 8 commit from CHANGELOG.md 2021-02-03 02:40:10 +01:00
Babel Bot
c56246af2d Add v7.12.13 to CHANGELOG.md [skip ci] 2021-02-03 01:13:05 +00:00
Nicolò Ribaudo
d291edbdf1 v7.12.13 2021-02-03 01:59:31 +01:00
Nicolò Ribaudo
bab5c62f90
Fix class fields when super() is in a default param (#12729)
* Fix class fields when `super()` is in a default param

* Use assertion instead of type cast
2021-02-02 15:38:07 +01:00
Nicolò Ribaudo
60ef190d05
Define class elements in the correct order (#12723)
* Define class elements in the correct order

* Object.gOPDescriptors is not available on Node.js 6

* Handle numeric keys

* Update test

* Update fixtures
2021-02-02 02:22:16 +01:00
Stuart Cook
20664a430e
Permit %%placeholder%% in left-hand-side of a let declaration (#12725)
* Permit %%placeholder%% in left-hand-side of a let declaration

* Test that "let" followed by modulo is still treated as an identifier

* More tests for edge-case handling of "let" with placeholders enabled
2021-02-01 20:00:21 -05:00
Huáng Jùnliàng
ecfe20395b
spec: disable await binding identifier within static block (#12661) 2021-02-01 21:55:43 +01:00
Nicolò Ribaudo
d0a965b71f
Throw when compiling spread in super() but not classes (#12722)
* Throw when compiling spread in `super()` but not classes

* Add comment
2021-02-01 20:16:10 +01:00
Nicolò Ribaudo
4f2d47500f
Don't use require() in ESM files (#12728)
* Update `yarn-plugin-conditions`

* Don't use `require()` in ESM files
2021-02-01 17:09:02 +01:00
Huáng Jùnliàng
108564fdad
refactor: raise AwaitNotInAsyncContext when an AwaitExpression will be parsed (#12716)
* refactor: raise AwaitNotInAsyncContext when an AwaitExpression will be parsed

* tweak logic

* early exit when errors are before thrown error position

* fix: always return true in assert.throws callback

See https://nodejs.org/api/assert.html#assert_assert_throws_fn_error_message

* update test fixtures

* fix flow error
2021-02-01 10:46:43 -05:00
Nicolò Ribaudo
8cf0a757d5
Recover from "missing semicolon" errors (#12437)
* Recover from "missing semicolon" errors

* Update other tests

* Fix flow

* Fix windows test

* Add back deleted test
2021-02-01 10:08:43 +01:00
Nicolò Ribaudo
2ea0a5d021
Add "📢 Deprecation" to the changelog labels (#12698) 2021-02-01 10:08:20 +01:00
Karan Sapolia
b63be942ce
Use native ESM for dev scripts (#12296)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-01-30 18:36:21 +01:00
Huáng Jùnliàng
f8fe8eaab1
breaking: throw on missing dynamic import when import() is seen in systemjs (#12700) 2021-01-29 13:14:13 -05:00
Nicolò Ribaudo
3d69dc9471
Add # to the private name in "write-only" errors (#12713) 2021-01-29 17:58:13 +01:00
Babel Bot
0138553403
chore: update test262 to 11624af8d0c3bdeb6bbc75a803a75ad146b92508 (#12708) 2021-01-28 19:39:03 -05:00
Nicolò Ribaudo
89d55d0786
Lint for extraneous dependencies in every file (#12699)
* Lint for extraneous dependencies in every file

* Deps fixes

* dedupe
2021-01-28 14:04:02 +01:00
Bogdan Savluk
9ac36b136a
convert @babel/generator to TypeScript (#12487)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-01-27 19:21:07 +01:00
Sosuke Suzuki
45fdde0ce2
(ts) Throw for abstract methods in a non-abstract class (#12686) 2021-01-27 18:56:55 +01:00
Huáng Jùnliàng
463cb332aa
refactor: move @babel/helper-bindify-decorators to ts (#12416) 2021-01-27 08:23:21 -05:00
Federico Ciardi
fbfd1b2aa6
fix(parser): throw error with wrong typescript 'export declare' (#12684) 2021-01-26 22:51:12 -06:00
Сковорода Никита Андреевич
9907bd86c9
Avoid hitting __proto__ in _inheritsLoose (#12693) 2021-01-26 20:15:41 +01:00
Federico Ciardi
f7f0560bda
fix: wrong helper version (#12694) 2021-01-26 12:48:38 -05:00
Federico Ciardi
5a020b24b7
fix: throw error when accessing private method without a getter (#12689)
* fix: class private accessor without getter

* Provide default return if 'writeOnlyError' is not available

* Add warning for old `@babel/helpers`

* Add missing helper call
2021-01-26 11:16:47 -05:00
overlookmotel
b727e67347
babel-register run default register with global module cache (#12674)
Follow-up to PR #12665.
2021-01-25 21:51:16 +01:00
Huáng Jùnliàng
446c70c6c3
fix: avoid line breaks between class members head and key (#12653) 2021-01-24 02:06:01 +01:00
Sosuke Suzuki
8fcba6eb55
Raise recoverable error for await expressions in sync functions (#12520) 2021-01-24 01:45:27 +01:00
Bogdan Savluk
d98418efbe
Convert @babel/traverse to TypeScript (#12488)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-01-24 01:33:09 +01:00
Huáng Jùnliàng
cd090e9842
[babel 8] Output minimal strings by default (#12675)
Co-authored-by: Justin Ridgewell <justin@ridgewell.name>
Co-authored-by: Justin Ridgewell <jridgewell@google.com>
2021-01-23 22:50:07 +01:00
Henry Zhu
464a02ffe1
[babel 8] Replace lodash/escapeRegExp with escape-string-regexp (#12677)
Co-authored-by: James Addison <jay@jp-hosting.net>
2021-01-23 22:21:34 +01:00
Huáng Jùnliàng
568679e301
fix: start TypePredicate node after returnToken (#12678) 2021-01-23 11:06:54 -06:00
Nicolò Ribaudo
8c03fb0152
[babel 8] Remove chokidar@2 fallback (#12679)
* Update yarn-plugin-conditions for optionalDependencies support

* Remove chokidar@2 fallback
2021-01-23 03:56:42 +01:00
Nicolò Ribaudo
f795fff1e4
[babel 8] Update globals, find-cache-dir and slash (#12656) 2021-01-22 17:57:07 +01:00
Nicolò Ribaudo
6a961497aa
[babel 8] Improve syntax highlighting (#12660)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
Co-authored-by: Simon Lydell <simon.lydell@gmail.com>
2021-01-22 17:56:20 +01:00
overlookmotel
22eb99bea4
fix: babel-register transform internal dependencies (#12665)
Closes #11964, #12662.
2021-01-22 11:08:20 +01:00
ExE Boss
f1314a1683
fix: correctly transform __proto__ properties (#12664)
* fix: correctly transform `__proto__` properties

* fixup! fix: correctly transform `__proto__` properties
2021-01-22 10:58:33 +01:00
Nicolò Ribaudo
2811b535d6
Add yarn-plugin-conditions to update Babel 8 dependencies (#12659)
* Add `yarn-plugin-conditions` to update Babel 8 dependencies

https://github.com/nicolo-ribaudo/yarn-plugin-conditions

* Update .gitattributes
2021-01-22 10:45:03 +01:00
Babel Bot
dc4bace114
Update test262 (#12671) 2021-01-21 22:04:35 -06:00
Armano
6783308875
fix: allow to execute util scripts (#12670)
[skip ci]
2021-01-22 00:31:09 +01:00
Nicolò Ribaudo
10978bb65a
[babel 8] Use the JSX automatic runtime by default (#12630)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
Co-authored-by: Arun Kumar Mohan <arunmohandm@gmail.com>
2021-01-19 01:41:07 +01:00
Huáng Jùnliàng
6e8250a3a6
fix: place _babel-node after process.execArgv (#12638)
Workaround https://github.com/nodejs/node/issues/36948
2021-01-18 15:15:03 -05:00
Huáng Jùnliàng
bc39a081f5
chore: update typescript to 4.1.3 (#12652) 2021-01-18 15:13:11 -05:00
Huáng Jùnliàng
ddd7cc6f83
chore: update rollup to 2.36 (#12651) 2021-01-18 15:12:55 -05:00
Armano
53f9fcd5f3
test: reuse lodash library within eslint tests (#12640) 2021-01-18 09:00:22 -06:00
Babel Bot
5a193cc14c
Update test262 (#12636) 2021-01-15 02:06:11 +01:00
Brian Ng
fec4a132ad
Bump prettier@2.2.1 (#12633) 2021-01-14 14:10:47 -05:00
Huáng Jùnliàng
6e9a174e7f
fix: print warning messages to stderr (#12626) 2021-01-14 08:45:48 -05:00
Chris West
bd4590e546
fix: cloneNode(deep, withoutLoc) handles absent comments (#12602)
This fragment (maybe all fragments?) throw during cloning, as
'comments' is unset here. Handle it being unset, by returning
undefined.
2021-01-12 20:40:23 -05:00
Huáng Jùnliàng
62290aa1ba
[babel 8] Don't create TSParenthesizedType nodes by default (#12608)
Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
Co-authored-by: Sergey Melyukov <s.melukov@gmail.com>
2021-01-13 01:13:09 +01:00
Leslie Leigh (李的序)
2338b052ad
[systemjs] Fix: export star alongside with named export (#12612) 2021-01-13 00:12:12 +01:00
Nicolò Ribaudo
58d2f41930
Transform labeled for-of inside braceless if statement (#12611) 2021-01-12 12:19:15 -06:00
Huáng Jùnliàng
eda4130d5e
Tweak helper compilation targets (#12615)
* refactor: simply browserslists defaults overwriting

When `hasTargets` is `false`,  `targets` is always an empty object by definition, `objectToBrowserslist({})` always return `[]` therefore we can remove `objectToBrowserslist`.

* test: apply external-helpers on preset-env test fixtures

* test: add ie 6 to force all transforms in corejs 3, debug, corejs 2 fixtures

* Add ie 6 as targets for test fixtures
2021-01-12 13:09:45 -05:00
Huáng Jùnliàng
e004a91566
[babel 8] chore: do not push objectRestSpread parser option (#12607)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-01-12 10:46:52 +01:00
Zen
cba64f9a09
Correctly access shadowed class binding in super.* (#12544)
* rename own binding inside methods if it collides with class ref. fix #11994

* fix name collisions in constructor

* do fix name collisions in constructor

* move logic in ReplaceSupers

* fix tests of helper-create-class-features-plugin

* remove replaceSupers in pushConstructor

* use environmentVisitor

* skip classLike nodes

* fix super ref in computed key
2021-01-12 02:31:06 +01:00
Nicolò Ribaudo
4f83a09dd8
Load jsx-runtime after existing imports (#12546)
Co-authored-by: Brian Ng <bng412@gmail.com>
Co-authored-by: Babel Bot <babel-bot@users.noreply.github.com>
2021-01-10 16:23:22 +01:00
Zen
6c9a481e83
@babel/preset-typescript: fix tsx assigment issue (#12599) 2021-01-10 09:21:39 -06:00
Nicolò Ribaudo
fce3e7124a
[babel 8] Remove useSpread and useBuiltIns jsx options (#12593)
* [babel 8] Remove `useSpread` and `useBuiltIns` jsx options

backport of 8cc8696851fa4bf02d7f6ae591404626d1ca32a3

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

* Update fixtures (Windows)

Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
Co-authored-by: Brian Ng <bng412@gmail.com>
Co-authored-by: Babel Bot <babel-bot@users.noreply.github.com>
2021-01-08 18:16:30 +01:00
Nicolò Ribaudo
606c91cd33
[babel 8] Remove uglify target support in preset-env (#12594)
Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
2021-01-08 17:58:44 +01:00
Nicolò Ribaudo
6e70deabcf
Use correct label for "Update Parser Tests" action (#12596) 2021-01-07 21:52:54 -05:00
Babel Bot
37f3aabb66
Update test262 (#12595) 2021-01-08 01:45:09 +01:00
Nicolò Ribaudo
50462eb5e4
[babel 8] Enable allowDeclareFields option by default with TS (#12461) 2021-01-08 01:28:20 +01:00
Huáng Jùnliàng
ff52acee79
[babel 8] Type checking preset-typescript options (#12460)
* refactor: extract option normalization in preset-typescript

* breaking: type checking preset-typescript options

* chore: bundle preset-typescript into a single lib

* test: disable Babel 7 test on Babel 8 breaking change test

* workaround Jest 24 error snapshot dedent issue

* skip Babel 8 test when the Breaking ENV is not available

* chore: update test snapshot

* Update packages/babel-preset-typescript/test/normalize-options.spec.js

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

* update test fixtures

Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-01-07 20:58:58 +01:00
Nicolò Ribaudo
866a742bf7
Remove remaining references to lerna (#12592) 2021-01-07 10:22:23 +01:00
Nicolò Ribaudo
c8117b6a49 fixup! Remove dependency from update-windows-fixtures job 2021-01-06 19:16:20 +01:00
Nicolò Ribaudo
47312bf1d1
Add a utility action to update fixtures in PRs (#12547) 2021-01-06 19:13:21 +01:00
Sosuke Suzuki
c1473e30b2
[ts]Add optional property to OptionalCallExpression node that has type arguments (#12562) 2021-01-06 08:41:45 -06:00
Bogdan Savluk
584518d04c
Improve types in @babel/helper-function-name (#12550) 2021-01-06 14:12:45 +01:00
Daniel Arthur Gallagher
e8b08523f4
docs: add package-specific documentation links (#12531)
[skip ci]
2021-01-06 14:11:53 +01:00
Nicolò Ribaudo
fb12afc289
Declare template objects inline (#12588) 2021-01-05 23:25:15 +01:00
Martin Packman
ed90f17978
Optimize jsx spreads of object expressions (#12557) 2021-01-05 23:04:26 +01:00
Babel Bot
0d6063f1b9
chore: update test262 to 9ca13b12728b7e0089c7eb03fa2bd17f8abe297f (#12579) 2021-01-03 23:59:04 +01:00
Niklas Mischkulnig
fdb5829a60
Use isIdentifierChar instead of regex for toIdentifier (#12575)
* Use isIdentifierChar instead of regex for toIdentifier

* Apply suggestions from code review

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

* Undo dep

* Update packages/babel-types/test/converters.js

* Add testcase starting with a number

* Add test for non-ascii starting character

Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
2020-12-31 11:22:46 -05:00
Simen Bekkhus
2d35f5a8f7
fix(code-frame): do not pad gutter of empty lines (#12567)
* fix(code-frame): do not pad gutter of empty lines

* Add workaround for expected Jest e2e test failure

Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2020-12-29 15:26:13 +01:00
Nicolò Ribaudo
fbef603c43
Report a SyntaxError for } and > in JSX text (#12451)
cherry-pick  #11046

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

Co-authored-by: Brad Zacher <brad.zacher@gmail.com>
Co-authored-by: Kai Cataldo <kai@kaicataldo.com>
2020-12-28 19:04:54 +01:00
Zach Panzarino
0dbc3dd4a0
Add errorRecovery option to type definitions in babel-parser (#12564)
* Fix options types for babel-parser

* I love editing files on gh.com
2020-12-27 13:25:48 +01:00
Babel Bot
0d55896483 Add v7.12.12 to CHANGELOG.md [skip ci] 2020-12-23 14:06:07 +00:00
Nicolò Ribaudo
d88c60cea9 v7.12.12 2020-12-23 14:55:59 +01:00
Nicolò Ribaudo
5b5b548036
Publish to npm from GitHub actions (#12526)
* Publish to npm from GitHub actions

* Remove publish-ci from Makefile

This was meant to be used _now_, but I didn't end up using it

* Test

* Revert "Test"

This reverts commit 04095c17db8352710c12849a5b1fa53e853bd6f5.
2020-12-23 00:18:03 +01:00
Nicolò Ribaudo
d9dfd29ce8
Archive @babel/polyfill (#12541)
babel/babel-archive@701775cd9f
2020-12-22 16:52:40 +01:00
Babel Bot
60138bea0d
chore: update test262 to b2e9dff2816cceb5ee84c0c226c50a31d01a7297 (#12539) 2020-12-22 10:39:39 -05:00
Nicolò Ribaudo
17d62c3743
refactor: Move react-jsx-development implementation into react-jsx (#12524)
* Move react-jsx-development implementation into react-jsx

* Move helper-builder-jsx-experimental into transform-react-jsx

* Move JSX validation

* Move Program visitor

* introduce get/set utils

* pre -> getTag

* Dedupe code

* post -> getState

* Simplify logic

* Move final pieces

* Other simplifications

* Update lockfile

* Fix standalone bundling
2020-12-22 11:53:14 +01:00
Zen
e08f68bf61
Skip discriminant when renaming starting from SwitchStatement (#12530) 2020-12-22 03:10:43 +01:00
Huáng Jùnliàng
814212f0be
Remove babel polyfill from fixture test runner (#12130)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2020-12-22 02:42:39 +01:00
Huáng Jùnliàng
14534e6f78
polish: create ascii-only labels [skip ci] (#12540) 2020-12-22 01:52:12 +01:00
Huáng Jùnliàng
1805d50bb8
fix parser tests updater again (#12538) 2020-12-21 18:09:07 -05:00
Huáng Jùnliàng
bb2343aba4
fix: updater does not work on main branch (#12537)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>

Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2020-12-21 17:06:15 -05:00
Huáng Jùnliàng
0f866ed9d2
Add a workflow to update test262 tests weekly (#12523)
* chore: draft update parser tests workflow

* Build babel parser

* chore: use Babel bot as git user name

* use babel-bot token

* refactor: use actions/github-script

* rename
2020-12-21 10:04:57 -05:00
Nicolò Ribaudo
56c7024d5d
Update release-tool and define implicit deps for runtime (#12527) 2020-12-19 01:13:01 +01:00
Huáng Jùnliàng
d28c1e52d0
Enable PnP linker on CI build job (#12011)
* chore: use pnp when building babel artifacts

* chore: refine ci config

* fix: match any n_m as unambiguous

The pnp module path starts from global cache path, which does not
match **/n_m

* fix: remove dedupe option and abort rollup on unexpected warning messages

* chore: suppress Circular_Dependency warning

* fix build error

* replace make bootstrap-only by yarn install
2020-12-18 19:00:43 -05:00
Nicolò Ribaudo
b9deeb458b
Restore @babel/types support for old TS versions (#12521) 2020-12-17 18:34:23 +01:00
Nicolò Ribaudo
bfb51362c7
Fix annex B block function hoisting semantics (#12512) 2020-12-16 18:42:00 +01:00
Babel Bot
70fa1b3d49 Add v7.12.11 to CHANGELOG.md [skip ci] 2020-12-16 00:01:15 +00:00
Nicolò Ribaudo
a1acfba387 v7.12.11 2020-12-16 00:55:11 +01:00
Bogdan Savluk
e29742717d
convert @babel/helper-split-export-declaration to TypeScript (#12485)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2020-12-16 00:05:48 +01:00
Bogdan Savluk
2f6de2f0c5
Improve AST node definitions in @babel/types (#12510) 2020-12-15 23:48:58 +01:00
Bogdan Savluk
4f1df9a713
convert @babel/helper-function-name to TypeScript (#12486)
Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
2020-12-15 23:19:58 +01:00
Nicolò Ribaudo
0ea065014b
Mark optional AST fields in generated type definitions (#12511) 2020-12-15 23:19:19 +01:00
vitorveiga
90fb8d275e
fix: handle block-level function declaration (#11801) 2020-12-15 18:22:15 +01:00
Huáng Jùnliàng
ecbbd9da48
chore: always check yarn lock and dedupe during update (#12508)
* chore: always check yarn lock and dedupe during update

* update yarn.lock
2020-12-15 10:18:51 -05:00
Nicolò Ribaudo
28d2cbcbf3
Lazily inject imports to the JSX runtime (#12493) 2020-12-15 12:55:17 +01:00
Huáng Jùnliàng
a0c1a9a9e4
Disallow non octal decimal escape before use strict (#12366) 2020-12-15 12:24:32 +01:00
Huáng Jùnliàng
73f30329a6
refactor: move @babel/helper-validator-option to ts (#12410) 2020-12-15 11:56:14 +01:00
Mateusz Burzyński
581aeb9a23
Reorganize some JSX-related tests (#12502) 2020-12-15 00:02:23 +01:00
Nicolò Ribaudo
1bba1b6da3
Actually run BABEL_8_BREAKING tests (#12492) 2020-12-14 16:08:51 +01:00
Mateusz Burzyński
01ab1e3e7b
Fixed issue with skipping over self & source generated by another instance (#12495) 2020-12-12 17:39:25 +01:00
Huáng Jùnliàng
fc82169b4e
refactor: move @babel/helper-validator-identifier to ts (#12409)
* refactor: rename helper-validator-identifier to ts

* fix flow errors
2020-12-11 17:41:56 -05:00
Bogdan Savluk
a46cd643ab
convert @babel/code-frame to typescript (#12433) 2020-12-10 23:03:47 +01:00
Bogdan Savluk
1290d215f1 Convert @babel/types to TS (#12431)
* babel-types flowts convert
* babel-types code generation updates
* babel-types add more generated types to src (copy logic from scripts/typescript)
* babel-types update generateBuilders to specify exact argument types
* babel-types fix deprecated types generation
* babel-types fixes
* babel-types fix potential bug
* babel-types update generateBuilders, to include proper return types
* babel-types backport types from generated index.d.ts to be included in sources
* babel-types fixes
* babel-types avoid export of builders starting with upper case in ts sources
* babel-types
* babel-types todo updates, small fixes
* babel-types generate helpers
* babel-types remove typescript definitions generation
* babel-types generate files
* babel-types copy d.ts file for deprecated ast node creators into lib folder
* babel-types use t as alias for ast node types namespace
* babel-types update generateBuilders script to use "t" as alias instead of "types"
* babel-types update deprecated builders generation to have more compact file
* babel-types publish the .d.ts file for `@babel/types`
* Publish the .d.ts file for `@babel/types`
* Fix flowcheck
* Prettier
* No need to lint generated .d.ts files (now they are generated by tsc)
* Run prepublish-prepare-dts from prepublish-build
* Fix Babel 8 tests
* Update codecov config
* babel-types more improvements
  - better type for gatherSequenceExpressions
  - mark createUnionTypeAnnotation as deprecated
  - fix createTSUnionType
  - babel-types better type for builder
  - other improvements from PR comments
* babel-types lint fix
* babel-types fix createTSUnionType
* Don't commit .d.ts file in lib, and rename "deprecated"->"uppercase" for builders
* Add back types for TS 3.7
* Update packages/babel-types/package.json
* Cleanup converters types

Co-Authored-By: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2020-12-10 21:22:10 +01:00
Bogdan Savluk
c0a8cbd989 Convert @babel/types to TS: rename files (#12431) 2020-12-10 21:22:10 +01:00
Huáng Jùnliàng
1382437ad6
Add js extension to preset-env generated polyfill imports (#10862) 2020-12-10 20:16:46 +01:00
Huáng Jùnliàng
b929a493da
Avoid force trailing comma on test files (#12480)
[skip ci]
2020-12-10 20:16:24 +01:00
Nicolò Ribaudo
211104b09a
Run e2e tests also with BABEL_8_BREAKING (#12462) 2020-12-10 20:11:04 +01:00
Nicolò Ribaudo
bf417186bf
Setup JSX runtime even if the file doesn't contain JSX (#12479) 2020-12-10 19:27:22 +01:00
Huáng Jùnliàng
e5b2680756
Move some build steps to gulp (#12127)
* chore: move generate-standalone to gulp tasks

* move build-flow-typings to gulp tasks

* chore: move build-typescript-typings to gulp tasks

* move generate-type-helpers to gulp tasks

* chore: include build-typings and generate-type-helpers in gulp build

* update generate-standalone comments

* address review comments

* chore: revert build-typings refactor

* fix: run build-typings in build-no-bundle
2020-12-10 12:25:16 -05:00
Mateusz Burzyński
1ef9e196d3
Allow multiple __self/__source props with classic JSX runtime (#12475) 2020-12-10 18:17:20 +01:00
Nicolò Ribaudo
e8176de528
[babel 8] Remove the jsonCompatibleStrings option (#12477)
Co-authored-by: Tan Li Hau <tanhauhau@users.noreply.github.com>
2020-12-10 18:14:13 +01:00
Babel Bot
4f3fcf1110 Add v7.12.10 to CHANGELOG.md [skip ci] 2020-12-09 22:50:09 +00:00
Nicolò Ribaudo
e901454096 v7.12.10 2020-12-09 23:44:59 +01:00
Nicolò Ribaudo
0e271055c4
Use new CircleCI images (#12450)
* Use new CircleCI images

* Update .circleci/config.yml

* Update .circleci/config.yml
2020-12-09 19:24:24 +01:00
Bogdan Savluk
5067edfdd9
Updates for tsconfig generation (#12420)
* improve makefile to not remove tsconfigs already in git

* update tsconfig generation script to include packages in eslint and codemods folders

* use git clean
2020-12-09 10:27:55 -05:00
Nicolò Ribaudo
a17e4715c9
[babel 8] Enable allowDeclareFields option by default w/ Flow (#12457)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
Co-authored-by: Ajaykumar <pajay2507@gmail.com>
2020-12-09 00:16:10 +01:00
Nicolò Ribaudo
98aa72ca74
Use native Node.js functions when available (#12458) 2020-12-09 00:03:47 +01:00
Mateusz Burzyński
c2fcd69e94
Stop using old JSX transform (#12253) 2020-12-08 22:41:13 +01:00
Nicolò Ribaudo
aca5edb339
Use Yarn 2.4.0 (#12453)
* Use Yarn 2.4.0

* Update the release plugin

* Check yarn bug on CI

* Patch yarn bug

* Update lockfile
2020-12-08 16:21:27 -05:00
Huáng Jùnliàng
6165bc60d1
chore: fix broken REPL link in issue template (#12459) [ci-skip]
* chore: fix broken REPL link in issue template

* Update .github/ISSUE_TEMPLATE/Bug_report.md
2020-12-08 16:17:07 -05:00
Nicolò Ribaudo
b422c7f0ef
[babel 8] Disallow sequence expressions in JSX expression containers (#12447)
* jsx: fix sequence expression at JSXAttributeValue (#8787)

* jsx: fix sequence expression at JSXAttributeValue

* Change logic for detecting unparenthesized expressions

* use parseMaybeAssign instead of custom error handling

Co-authored-by: Daniel Tschinder <daniel@tschinder.de>
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>

* I'm not good at booleans

* Format

* Throw a recoverable error

Co-authored-by: Bruno Macabeus <macabeus@users.noreply.github.com>
Co-authored-by: Daniel Tschinder <daniel@tschinder.de>
2020-12-08 10:15:03 +01:00
Sosuke Suzuki
2ba9265198
Add missing semicolon in AST spec (#12454)
[skip ci]
2020-12-07 19:32:35 +01:00
Nicolò Ribaudo
b5b95f81dc
Add @babel/traverse tests for re-exported bindings (#12429) 2020-12-06 19:33:21 +01:00
Sosuke Suzuki
285402d82f
Add StaticBlock to Table of Contents in AST spec (#12449) 2020-12-05 14:12:42 +01:00
Nicolò Ribaudo
c139d1602b
Prepare codebase for inline Babel 8 breaking changes (#12440) 2020-12-04 21:30:40 +01:00
Huáng Jùnliàng
3bd6a3d781
Make sure estree test should not throw if babel parser does not throw (#12443)
* test: run estree on tests that does not expect an errors

* fix: record the directive expression value to extra AST properties
2020-12-04 13:58:01 -05:00
Nicolò Ribaudo
208acb1d6c
Use require.resolve instead of the resolve package (#12439) 2020-12-04 08:57:09 +01:00
Huáng Jùnliàng
8478027d1a
Make sure babel parser throws exactly same recoverable errors when estree plugin is enabled (#12375)
* refactor: introduce isPrivateName and getPrivateNameSV

* feat: check recoverable errors on estree-throw

* fix: pass through all params of parseBlockBody

* fix: set bigInt to null when invalid bigInt value is parsed

e.g. 0.1n

* fix: use string literal value in error message

When estree plugin is enabled, stringLiteral#extra.raw is not accessible. Use StringLiteral#value instead.

* refactor: introduce hasPropertyAsPrivateName

* fix: adapt to ChainExpression

* fix: port checkLVal early return for method in object pattern

* fix: throw new a?.() on estree

* fix: early return for __proto__ in accessors

* fix: test record element via isObjectProperty

* fix: pass through isLHS in toAssignable

* refactor: introduce isObjectMethod methods
2020-12-03 08:36:54 +00:00
Huáng Jùnliàng
c6aea4e85d
chore: remove travis-ci badge (#12430) 2020-12-01 12:06:44 -05:00
Huáng Jùnliàng
7000ae04a5
refactor: move @babel/helper-annotate-as-pure to ts (#12415)
* refactor: move @babel/helper-annotate-as-pure to ts

* chore: add flow types
2020-12-01 11:23:23 -05:00
Huáng Jùnliàng
5e4b85ab1c
refactor: move @babel/helper-get-function-arity to ts (#12414)
* refactor: move @babel/helper-get-function-arity to ts

* Review comments

* chore: add flow interface
2020-12-01 10:45:05 -05:00
Huáng Jùnliàng
3266d2679a
move @babel/helper-optimise-call-expression to ts (#12411)
* move @babel/helper-optimise-call-expression to ts

* chore: add flow interface
2020-12-01 10:31:39 -05:00
Andrew Smith
71f87874ce
Clarify warning source about underspecified corejs option in preset-env. (#12402)
* Clarify these warnings are for babel-preset-env.

* Fix lint.

* Fix specs.

* Fix merge conflict.

* PR feedback.
2020-12-01 08:58:06 +00:00
Nicolò Ribaudo
4b79ab4a90
Migrate from Travis to GH actions (#12412)
* Migrate linting to GH actions

* Migrate windows tests

* Migrate parser tests

* Update .github/workflows/ci.yml

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

* Run parser tests in a single job

* Use a single yarn cache

* Remove unused commands from Makefile

* Update .github/workflows/ci.yml

Co-authored-by: Kristoffer K. <merceyz@users.noreply.github.com>

Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
Co-authored-by: Kristoffer K. <merceyz@users.noreply.github.com>
2020-12-01 08:55:51 +00:00
Brian Ng
7018ed6e46
Fix printing BigIntLiterals/DecimalLiterals with compact option (#12424) 2020-11-30 20:18:57 -06:00
Bogdan Savluk
2ca28d78e6
@babel/types: update OptionalCallExpression to support ArgumentPlaceholder (#12418) 2020-11-30 12:49:22 -05:00
Huáng Jùnliàng
9891c020b1
Bump core-js-compat to version 3.8.0 (#12399) 2020-11-25 22:46:07 +01:00
Huáng Jùnliàng
97a71b665b
chore: bump chokidar in glob-watcher to ^3.4.0 (#12397) 2020-11-25 13:50:04 -05:00
Huáng Jùnliàng
89f3247e32
refactor: simplify isAwaitAllowed (#12398) 2020-11-25 13:49:35 -05:00
Nicolò Ribaudo
645fe637f2
Fix t.isReferenced() for named re-exports (#12395) 2020-11-25 19:39:45 +01:00
Nicolò Ribaudo
695abb8dfc
Set correct path.context un push/unshiftContainer (#12394) 2020-11-25 16:51:58 +01:00
Babel Bot
0f3db5deea Add v7.12.9 to CHANGELOG.md [skip ci] 2020-11-24 21:03:26 +00:00
Nicolò Ribaudo
e334a88884 v7.12.9 2020-11-24 21:59:33 +01:00
Huáng Jùnliàng
eea3065039
Update pathCache in NodePath#_replaceWith (#12391)
* add tests on regression 12386

* fix: update cache on _replaceWith

* fix: pathCache in replaceWithMultiple could be nullish

* Update packages/babel-traverse/src/path/replacement.js

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

* test: add replaceWith test to traverse

Co-authored-by: Brian Ng <bng412@gmail.com>
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2020-11-24 15:07:20 -05:00
Babel Bot
8ab668beee Add v7.12.8 to CHANGELOG.md [skip ci] 2020-11-23 22:30:27 +00:00
Nicolò Ribaudo
16184887ab v7.12.8 2020-11-23 23:26:07 +01:00
Nicolò Ribaudo
4f9ad5cc3a
Avoid infinite loops in type inference logic (#12390) 2020-11-23 17:03:01 +01:00
Huáng Jùnliàng
243d3b2dfd
chore: fix watcher config (#12372) 2020-11-23 10:43:54 -05:00
Nicolò Ribaudo
7d2a14b856
Initialize NodePath context when using getSibling (#12387) 2020-11-23 16:03:11 +01:00
Filipp Riabchun
2b13863680
Fix Node version check (#12382)
`process.version` always starts with `v`, so `parseInt(process.version)` always evaluates to `NaN`. See https://nodejs.org/api/process.html#process_process_version
2020-11-23 09:00:50 -05:00
Babel Bot
b36f988b10 Add v7.12.7 to CHANGELOG.md [skip ci] 2020-11-20 21:09:26 +00:00
Nicolò Ribaudo
23226d93d4 v7.12.7 2020-11-20 22:02:43 +01:00
Huáng Jùnliàng
a44151acef
optimize optional chain when expression will be cast to boolean (#12291) 2020-11-20 20:55:33 +01:00
Nicolò Ribaudo
e7e0c25d6a
Archive @babel/helper-regex (#12377)
babel/babel-archive@32d1b8eeaf
2020-11-20 10:40:48 -05:00
Huáng Jùnliàng
2e3eec6646
refactor: use option-validator in preset-typescript (#12347) 2020-11-20 15:11:20 +01:00
Huáng Jùnliàng
ab5a90ce47
refactor: remove @babel/helper-regex usage (#12349) 2020-11-18 10:06:59 -05:00
Nicolò Ribaudo
6a0e909c13
Don't compile import() in development (#12288) 2020-11-18 16:02:02 +01:00
Sosuke Suzuki
94d116052f
[ts] Allow modifiers as names of methods with type parameters (#12356) 2020-11-18 15:29:02 +01:00
Nicolò Ribaudo
e8457ea5d3
Update yarn-plugin-babel-release-tool (#12369) 2020-11-17 17:31:22 +01:00
Huáng Jùnliàng
2db500451b
Bump caniuse-lite resolutions (#12368) 2020-11-17 16:38:02 +01:00
Huáng Jùnliàng
b564368d6e
refactor: reorder checkLVal parameters (#12346)
* refactor: reorder checkLVal parameters

* update allow list

* Apply suggestions from code review
2020-11-17 09:07:32 -05:00
Bogdan Savluk
0f838be944
improve asserts type annotations (#12341) 2020-11-16 11:21:30 -05:00
Sosuke Suzuki
a4e4aede14
[ts]Set false to default value of TsTypePredicate.asserts (#12352) 2020-11-16 09:51:27 -06:00
Nitin Kumar
56fd90452c
chore: fix grammar in bug template (#12362)
Co-authored-by: Brian Ng <bng412@gmail.com>
2020-11-16 16:20:12 +01:00
Huáng Jùnliàng
f54f1ee492
Fix: correctly transform this.#m?.(...arguments) (#12350)
* add tests on @babel/helper-optimise-call-expression

* fix: correctly optimise `a.b?.(...arguments)`

* add integration test with properties transform
2020-11-16 10:16:46 -05:00
Huáng Jùnliàng
7850682387
chore: pin stack-utils to 1.0.2 on legacy node tests (#12365) 2020-11-16 10:16:24 -05:00
Huáng Jùnliàng
cff0d7c727
chore: prompt maintainer to quit make watch before publish (#12357)
* chore: prompt maintainer to quit make watch before publish

* move shell prompt to Makefile
2020-11-14 08:23:29 -05:00
Nicolò Ribaudo
3e0fa927c0
Final configuration changes in preparation for TS (#12351) 2020-11-12 16:09:29 +01:00
Huáng Jùnliàng
5bbad8936b
fix: disallow all parenthesized pattern except parsing LHS (#12327)
* fix: disallow all parenthesized pattern except parsing LHS

* fix: forStatement requires LHS

* simplify toAssignable

* add more test cases

* fix: pass through isLHS on object property and assignment expression

* fix: record parenthesized identifier error for LHS

* remove duplicated skipped tests

* fix: do not record errors on ancestry arrow head

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

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

Co-authored-by: Brian Ng <bng412@gmail.com>
2020-11-10 14:42:37 -05:00
Brian Ng
08c7280167
Fix support for polyfilling Array.prototype.values in core-js@2 (#12340) 2020-11-10 16:43:11 +01:00
ExE Boss
3505eaadba
Add type definitions for assertion methods (#11883)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2020-11-10 16:42:25 +01:00
Nicolò Ribaudo
2984f0cb88
Use the correct context when re-using a cached NodePath (#12331) 2020-11-10 15:03:21 +01:00
Jason Miller
ddd868f838
Account for ConfigItem being generated by another copy of Babel (#11734)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
2020-11-10 15:02:46 +01:00
Nicolò Ribaudo
4b1b961bd1
Fix CircleCI test262 job (#12338) 2020-11-10 13:33:33 +01:00
Nicolò Ribaudo
40727ab5f6
Use chokidar@2 without fsevents@1 (#12322) 2020-11-10 09:12:16 +01:00
Huáng Jùnliàng
d7e32d8c3d
Add typings for recordAndTuple parser plugin (#12326) 2020-11-09 23:57:41 +01:00
Bogdan Savluk
089c200c8b Convert @babel/template from Flow to TS (#12317)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2020-11-09 23:17:25 +01:00
Nicolò Ribaudo
f80478c06d Prepare repository for gradual flow->ts migration (#12317)
Co-authored-by: Bogdan Savluk <savluk.bogdan@gmail.com>
2020-11-09 23:17:24 +01:00
Nicolò Ribaudo
a9bc9becc5 Use TS3.7 when possible for @babel/type dts (#12317) 2020-11-09 23:17:24 +01:00
Huáng Jùnliàng
07607fa7c7
chore: remove Node.js 13 from CI (#12328) 2020-11-09 12:08:23 -05:00
Mateusz Burzyński
21f42544ca
Fixed incorrectly implemented tests for loadOptions (#12301) 2020-11-09 16:14:56 +01:00
Sosuke Suzuki
ad8a4d62fd
Fix syntax error for getter and setter with ts and estree plugin (#12333) 2020-11-09 08:36:39 +01:00
Nicolò Ribaudo
32279147e6
Update core-js-compat (#12323)
* Update `core-js-compat`

* Update lockfile
2020-11-06 18:19:57 +01:00
Huáng Jùnliàng
0641a15030
Reduce linear search on list traversing (#12302)
* perf: reduce linear search on list traversing

* fix: remove parent cache when replacing node
2020-11-04 20:14:51 -05:00
Huáng Jùnliàng
6cb6f9f5ea
test: add tests about behaviour of replaceWithMultiple (#12309)
* test: add tests about behaviour of replaceWithMultiple

* add more tests
2020-11-04 14:46:53 -05:00
Austin Anderson
ddf30ee233
Adding includes fix for plugin-proposal-numeric-separator (#12311)
Co-authored-by: fraywing <austin@rupie.io>
2020-11-04 13:20:04 -06:00
Babel Bot
12c6db6fae Add v7.12.6 to CHANGELOG.md [skip ci] 2020-11-04 11:10:33 +00:00
Nicolò Ribaudo
4a6fed1335 v7.12.6 2020-11-04 12:05:56 +01:00
Nicolò Ribaudo
dd5a977048
Revert "Mark ThisExpression and Super as Purish" (#12307) 2020-11-04 11:50:46 +01:00
Nicolò Ribaudo
7a8c63d8db
Update lerna.json (#12304) 2020-11-03 23:08:15 -05:00
Mark
4141793a37
babel-node: support require flag in repl mode (#12297) 2020-11-04 01:39:33 +01:00
Babel Bot
487f82e446 Add v7.12.5 to CHANGELOG.md [skip ci] 2020-11-03 22:35:34 +00:00
Nicolò Ribaudo
a41da05ce9 v7.12.5 2020-11-03 23:30:17 +01:00
Joel Van Horn
f4edf62f6b
Fix typo [skip ci] (#12294) 2020-11-01 13:31:50 +01:00
Álvaro Mondéjar
b649f8d192
Fix packages documentation README links. (#12289) 2020-10-30 21:19:21 +01:00
Huáng Jùnliàng
8ee4345a61
chore: avoid duplicate coverage data upload (#12187) 2020-10-30 09:28:38 -05:00
Huáng Jùnliàng
09c0ee0a8b
chore: bump Jest to v26 (#12190) 2020-10-30 12:06:14 +01:00
Huáng Jùnliàng
766df9c369
fix: support string assertion key in assert entries (#12281)
* fix: support string assertion key in assert entries

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

Co-authored-by: Sosuke Suzuki <aosukeke@gmail.com>

Co-authored-by: Sosuke Suzuki <aosukeke@gmail.com>
2020-10-29 15:10:20 -04:00
Sosuke Suzuki
963537d5f5
[ts] Make ImportDeclaration always have importKind (#12170) 2020-10-29 20:07:10 +01:00
Sosuke Suzuki
ff6c3792bb
Make assertions optional and update AST spec (#12280) 2020-10-29 10:21:52 -05:00
流浪大法师
f5f9f51b5e
docs: Fix packages/babel-standalone/README.md website link[skip ci] (#12277) 2020-10-29 10:25:51 -04:00
Sosuke Suzuki
d04b4dd116
fix(babel-types): Add assertions to ExportAllDeclaration (#12273) 2020-10-29 08:24:56 -05:00
Huáng Jùnliàng
b7754d3c82
fix: disallow import assertionts in export without from (#12264) 2020-10-28 07:07:20 +01:00
Huáng Jùnliàng
a8c66f4680
Handle exprAllowed before ObjectLike is parsed (#12267)
* fix: disallow expression after `}` is consumed in parseObjectLike

* refactor: avoid accessing this.prodParam in context update
2020-10-27 20:25:50 -04:00
Huáng Jùnliàng
f04bbf62b5
chore: test on node 15 (#12265) 2020-10-27 17:33:43 -04:00
Huáng Jùnliàng
750d869db9
chore: bump compat-table and electron-to-chromium (#12244) 2020-10-27 13:03:07 -04:00
Huáng Jùnliàng
ea2892fefc
add declare to class properties type annotations (#12257)
* add declare to class properties type annotations

* chore: use preset-flow
2020-10-27 10:05:01 -04:00
coderaiser
9eb661b285
fix: babel-types: ImportDeclaration: add assertions (#12263) 2020-10-27 08:58:25 -05:00
Nicolò Ribaudo
df908fc63b
Mark ThisExpression and Super as Purish (#12251)
* Mark `ThisExpression` as `Purish`

The other purish types are functions and literals, so I
guess it means "it doesn't have side effects"

* Super & tests

* Fix tests
2020-10-27 13:12:49 +01:00
Ian Craig
87a30524f6
Correctly indent multiline comments when retainLines: true (#12260) 2020-10-27 12:46:25 +01:00
Huáng Jùnliàng
5b48f40a08
Polish parser errors (#12258)
* polish: update AwaitNotInAsyncFunction message

* polish: update YieldInParameter error message

* Apply suggestions from code review

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

* update test fixtures

Co-authored-by: Brian Ng <bng412@gmail.com>
2020-10-26 20:55:04 -04:00
Huáng Jùnliàng
2782a549e9
Refactor yield await classification (#12230)
* fix: incomplete ParamKind declaration

* refactor: add expression scope handler

* test: update test262 allowlist

* chore: cleanup

* fix: push expression scope for function body

* fix: push new expression scope for initializer and static block

* test: add more test cases

* fix flow error

* refactor: remove unecessary expression scope

* fix: parameter initializer error should not cross expression scope boundary

* chore: cleanup outdated comments

* fix: do not record async arrow error on ParameterDeclaration

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

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

* polish: clear ancestry declaration error on validate

Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2020-10-26 11:42:02 -04:00
Sosuke Suzuki
faaebfe91f
Support Import Assertions for re-export statement (#12249) 2020-10-26 15:18:45 +01:00
Sosuke Suzuki
f5bd9f2013
Allows the interface to be used as an Identifier for flow plugin (#12254) 2020-10-26 08:50:57 -05:00
Nicolò Ribaudo
a967910b8b
Throw a TypeError when reassigning a const (#12252) 2020-10-25 22:30:28 +01:00
Nicolò Ribaudo
b4ae7b7893
Update to Browserslist 4.14.5 (#12241) 2020-10-23 21:15:49 -04:00
Brian Ng
c00bb14f79
[ts] Error on invalid type casts in JSX (#12221) 2020-10-23 08:09:35 -05:00
Huáng Jùnliàng
8b579a27dc
feat: support bigInt in numeric-separator transform (#12240) 2020-10-22 16:49:31 -04:00
Huáng Jùnliàng
d6816f0e6c
fix: support optionalCall in replace super handler (#12238) 2020-10-22 16:09:19 -04:00
Brian Ng
d51aa6d761
[ts] Allow optional binding pattern parameters within types/interfaces (#12227) 2020-10-21 08:16:43 -05:00
Kai Cataldo
ddb7e05f07
docs: add note about TypeScript in ESLint packages (#12222) 2020-10-20 23:46:56 +02:00
Sosuke Suzuki
f1bc314c79
Fix parsing of imports with module string name in flow plugin (#12224) 2020-10-20 23:46:12 +02:00
hirochachacha
136bf231ea
packages/babel-standalone: make data-type="module" option avilable without data-presets option (#12226)
* use "env" preset instead of "es2015" preset
* configure "env" preset if data-type="module" is given
2020-10-20 18:01:53 +02:00
Nicolò Ribaudo
86f535b863
Update CHANGELOG.md 2020-10-19 21:21:43 +02:00
Babel Bot
e7c0bfe49e Add v7.12.4 to CHANGELOG.md [skip ci] 2020-10-19 19:09:05 +00:00
Nicolò Ribaudo
f31a3a6cc6 v7.12.4 2020-10-19 21:04:23 +02:00
Nicolò Ribaudo
02fc9e835c
Revert "add .js extension to react runtime for JSX transform" (#12213) 2020-10-19 19:50:43 +02:00
Nicolò Ribaudo
ed498a772b
Use workspace:* for devDependencies (again) (#12217)
Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
2020-10-19 18:32:06 +02:00
Nicolò Ribaudo
63567f0667
Run jest's tests in the e2e tests (#12202)
Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
2020-10-16 23:19:39 +02:00
Babel Bot
9f83b5a4df Add v7.12.3 to CHANGELOG.md [skip ci] 2020-10-16 21:15:45 +00:00
Nicolò Ribaudo
2562c8d8fa v7.12.3 2020-10-16 23:11:14 +02:00
Huáng Jùnliàng
1964c961ae
chore: update test262 tests (#12204) 2020-10-16 16:55:10 -04:00
Mongkii
7870465b62
[ts] Add parser test: destructuring-with-annotation-newline (#12203) 2020-10-16 16:45:11 +02:00
Huáng Jùnliàng
a9cd0945b7
fix: properly wrap private class methods (#12192) 2020-10-16 10:12:50 -04:00
Nicolò Ribaudo
31396b286d
Make loadPartialConfig's options optional (#12200) 2020-10-16 15:46:49 +02:00
Brian Ng
47250ffa65
[ts] Disallow invalid type annotations in ExpressionStatements (#12185)
* Fix regression with invalid type annotations in ExpressionStatements
2020-10-16 10:20:53 +02:00
Babel Bot
ee1f742035 Add v7.12.2 to CHANGELOG.md [skip ci] 2020-10-16 06:51:08 +00:00
Nicolò Ribaudo
a534d8746e v7.12.2 2020-10-16 08:47:05 +02:00
Nicolò Ribaudo
4fe8c3acc5
Revert "Fix: check if param is assignable when parsing arrow return type annotation" (#12198)
This reverts commit 84987a00e632e65bdafdf7f70df46ded7fb083c8.
2020-10-16 08:16:37 +02:00
Babel Bot
93e7261e0f Add v7.12.1 to CHANGELOG.md [skip ci] 2020-10-15 22:43:36 +00:00
Nicolò Ribaudo
7f4b83833f v7.12.1 2020-10-16 00:36:30 +02:00
Nicolò Ribaudo
b877726a89
Don't force chokidar@2 to be downloaded from registry.npmjs.org (#12182) 2020-10-16 00:30:20 +02:00
Huáng Jùnliàng
19dc038907
Guard against yarn-issue-1882 (#12188) 2020-10-16 00:15:11 +02:00
Nicolò Ribaudo
9018716905
Allow importing @babel/runtime/package (#12184) 2020-10-15 23:15:03 +02:00
Huáng Jùnliàng
eec01fe078
chore: use workspace:* for dev deps (#12186) 2020-10-15 14:03:50 -04:00
Nicolò Ribaudo
84987a00e6
Reland "Fix: check if param is assignable when parsing arrow return type annotation" (#12183)
* Reland "Fix: check if param is assignable when parsing arrow return type annotation"

This reverts commit 91a7a64b4b0c30ab1fdfbb12f77522afa2285ec4.

* Mark `RestElement` as assignable
2020-10-15 11:32:37 -04:00
Nicolò Ribaudo
6cb0056519
Remove unused dependencies and devDependencies (#12175) 2020-10-15 10:01:30 +02:00
Nicolò Ribaudo
2d43341019
Update @babel/* deps (#12174) 2020-10-15 01:08:18 +02:00
Nicolò Ribaudo
c9990d6034
Update CHANGELOG.md 2020-10-14 22:30:38 +02:00
Babel Bot
65613eb89d Add v7.12.0 to CHANGELOG.md [skip ci] 2020-10-14 20:07:47 +00:00
Nicolò Ribaudo
726154c78e v7.12.0 2020-10-14 21:48:45 +02:00
Nicolò Ribaudo
9ad0d45b41 Update version check in proposal-class-static-block plugin 2020-10-14 21:48:05 +02:00
Nicolò Ribaudo
49fe00cc0d Update version check in proposal-class-static-block plugin 2020-10-14 21:46:34 +02:00
Nicolò Ribaudo
02975b9ae1
Use a yarn plugin to manage releases (#12138) 2020-10-14 21:43:53 +02:00
Nicolò Ribaudo
91a7a64b4b
Revert "Fix: check if param is assignable when parsing arrow return type annotation" (#12173)
This reverts commit 136e6301cbfa9448cfb20396f82f93f0d3e10c12.
2020-10-14 21:42:05 +02:00
Sven Sauleau
af8e0facc1
Parse import-assertions (#12139)
Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2020-10-14 21:18:16 +02:00
iamfotx
59d97d9bca
[parser] Better error message for missing number exponent (#12072)
* fix(babel-parser) better error message for missing number exponent after 'e'

* fix(babel-parser) requested changes

* msg

Co-authored-by: Brian Ng <bng412@gmail.com>
2020-10-14 21:17:38 +02:00
Huáng Jùnliàng
f697e7995d Transform class static block (#12143)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
Co-authored-by: Brian Ng <bng412@gmail.com>
2020-10-14 21:16:24 +02:00
Huáng Jùnliàng
3ccca88178 Parse class static block (#12079)
Co-authored-by: Brian Ng <bng412@gmail.com>
2020-10-14 21:16:24 +02:00
Brian Ng
6830c90ac9
Support TypeScript mapped type 'as' clauses (#12129) 2020-10-14 20:16:22 +02:00
Nicolò Ribaudo
3fd963fdc8
[ts] Add support for template interpolations in types (#12131)
Co-authored-by: Brian Ng <bng412@gmail.com>
2020-10-14 20:15:42 +02:00
Nicolò Ribaudo
9f40d6fcd0
[ts] Add support for the "intrinsic" keyword (#12147) 2020-10-14 20:15:17 +02:00
Guy Bedford
9c7d9c0fe5
SystemJS top-level await support (#12163)
Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
2020-10-14 20:14:52 +02:00
Huáng Jùnliàng
d0d1fdb921
Add jsxPragmaFrag support to typescript transform (#11950) 2020-10-14 20:12:57 +02:00
James Addison
94b5f92e39
Replace lodash 'defaults' usage with ES6 Spread initializer (#11797)
Co-authored-by: Corey Farrell <git@cfware.com>
2020-10-14 20:10:44 +02:00
Huáng Jùnliàng
136e6301cb
Check if param is assignable when parsing arrow return type (#11992) 2020-10-14 20:09:48 +02:00
Huáng Jùnliàng
4e66b8eb6b
Specify runtime exports (#10853) 2020-10-14 20:06:56 +02:00
Huáng Jùnliàng
21d7ee2610 String import/export specifier (#12091)
* feat: parse moduleExportName
* feat: add validators
* Support string specifier name in commonjs transform
* Support string specifier name in export-ns-from
* test: add loose testcases
* test: add testcases for amd and umd
* feat: support systemjs
* test: update fixtures fixed in #12110
* add plugin name typings
* test: rename test layout
* feat: implement under moduleStringNames flag
* chore: add plugin syntax module string names
* feat: support ModuleExportName as ModuleExportName
* test: update test fixtures
* fix flow errors
* docs: update AST spec
* feat: support { "some imports" as "some exports" }
* feat: support { "some imports" as "some exports" } in systemjs
* test: add test on `import { "foo" }`
* Address review comments
* add moduleStringNames to missing plugin helpers
* Apply suggestions from code review
* update test fixtures
* Update packages/babel-parser/src/parser/error-message.js
* update test fixtures

Co-Authored-By: Kai Cataldo <kai@kaicataldo.com>
Co-authored-by: Brian Ng <bng412@gmail.com>
2020-10-14 20:01:37 +02:00
Nicolò Ribaudo
1b90d90fcc Instantiate presets before plugins (#11689) 2020-10-14 19:59:02 +02:00
Devon Govett
ce7b170ab7 Return a list of files that were read from loadPartialConfig (#11907) 2020-10-14 19:59:02 +02:00
Sosuke Suzuki
a5bed04f55
Make asserts property boolean, not undefined (#12167) 2020-10-13 23:56:08 +02:00
Nicolò Ribaudo
d49e5507ae
Remove unused devDependency from @babel/register (#12166) 2020-10-12 16:07:30 +02:00
Brian Ng
13a1cfd396
Move check for TSTypeCastExpression to catch another case (#12161) 2020-10-11 13:03:57 +02:00
Huáng Jùnliàng
62965e3880
Archive plugins (#12117) 2020-10-09 16:29:37 +02:00
Ryan Rhee
ebec7c8baf
[babel-types] Add extra property to BaseNode type (#12136) 2020-10-09 16:29:04 +02:00
An Phi
f6bd7493a8
fix transform-typescript logic to remove definite fields (#12149) 2020-10-08 12:35:43 -05:00
Huáng Jùnliàng
e6669988d0
chore: bump gulp-cli to 2.3.0 (#12154) 2020-10-08 11:04:44 -04:00
Nitin Kumar
3ec4537baa
chore: update issue templates (#12142)
[skip ci]
2020-10-06 16:04:49 +02:00
Nicolò Ribaudo
8c4e76c69e Run 'yarn dedupe' 2020-10-05 18:32:03 +02:00
Huáng Jùnliàng
769669f6f8
hack: use chokidar@2 only on node < 8 (#11560) 2020-10-05 18:24:27 +02:00
Nicolò Ribaudo
2a3dfa051a
Yarn 2.3 (#12134)
Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
2020-10-05 17:39:14 +02:00
Huáng Jùnliàng
5f83a8c1a2
Handle cases when ?? and ?. is in binding initializers (#12032)
* test: add test for nullish coalescing

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

* test: add control group

* test: add tests for optional chaining

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

* test: add tests on optional chaining mixed with private class elements

* fix: wrap member chains to IIFE when it is in parameter default

* chore: add more testcases

* chore: update test fixtures

* fix: NodePath.get is always non nullish

Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2020-10-03 10:03:58 -04:00
Luna Ruan
9808d2566e
add js extension to react runtime (#12116) 2020-09-30 08:31:45 +02:00
Иван Плесских
7ad9917793
[transform-typescript] Fix import elision for type exports (#12122) 2020-09-29 14:35:57 -05:00
Huáng Jùnliàng
e0b2bfb78f
fix: mark Pattern in CatchClause as scope (#12119) 2020-09-29 15:04:24 -04:00
Huáng Jùnliàng
afc03581cc
chore: bump electron-to-chromium (#12118)
* chore: bump electron-to-chromium

* test: update test fixtures
2020-09-29 13:51:20 -04:00
Sosuke Suzuki
45f0cc2ed9
Recover from error for missing initializer in const declaration (#12120) 2020-09-29 18:40:51 +02:00
Brian Ng
3ba1ece0ce
Fix printing TSTypeOperator (#12114) 2020-09-28 11:01:13 -05:00
Huáng Jùnliàng
62df8d2b79
fix: push exported variable when hoisting export declared names (#12110) 2020-09-28 11:38:39 -04:00
Niklas Mischkulnig
a080c82777
[cjs] Skip duplicate reexported bindings in namespace reexports (#11739) 2020-09-28 16:22:13 +02:00
Sosuke Suzuki
39a12674b4
Improve syntax error for class fields in ambient context (#12108)
* Improve error messages for ambient context class fields

* Modify switching state.isDeclareContext for class fields with declare
2020-09-26 15:52:12 -04:00
Huáng Jùnliàng
3d5da4c2b9
fix: apply terser plugin only on *.min.js (#12099)
* fix: apply terser plugin only on *.min.js

* chore: move rollup terser to output plugin

* chore: simplify rollup build scripts
2020-09-26 15:50:34 -04:00
Sosuke Suzuki
434b65bc2a
[ts] Throw a syntax error for index signature with declare (#12111) 2020-09-26 18:06:13 +02:00
overlookmotel
1a074ee7e6
Ensure expressions wrapped in parens (#12082) 2020-09-25 15:58:04 -05:00
Huáng Jùnliàng
63d9f5397b
Update minimum node version in build requirement (#12098) 2020-09-25 15:25:42 -04:00
Ananda Umamil
af612db8c3
Fix @babel/generator does not print decorators of private properties (#12081) 2020-09-25 08:16:28 -05:00
Huáng Jùnliàng
6d87f46a7a
Bump compat-table (#12073)
* chore: update compat-table data source

* refactor: use chromeVersions from electron-to-chromium

* chore: deduplicate yarn.lock
2020-09-24 16:28:26 -04:00
Huáng Jùnliàng
f2da186714
refactor: add @babel/helper-validator-option (#12006)
* refactor: add @babel/helper-validator-option

* refactor: simplify validateTopLevelOptions

* perf: the recursive version is not practically fast

* Update packages/babel-helper-validator-option/README.md

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

* Update packages/babel-helper-validator-option/src/validator.js

* fix: incorrect type annotation

* refactor: use babel/helper-option-validator in babel/compat-data

* chore: fix flow types error

* Address review comments

* address review comments

Co-authored-by: Brian Ng <bng412@gmail.com>
2020-09-24 16:23:35 -04:00
Sosuke Suzuki
0d32e3fc36
Add missing tests for TypeScript syntax errors (#12103)
* Add missing tests for index signatures with modifiers

* Add missing test for import type
2020-09-24 14:38:11 -04:00
Tim Gates
1334bc99e0
docs: Fix simple typo, preprelease -> pre-release (#12102)
There is a small typo in packages/babel-core/src/transformation/file/file.js, packages/babel-plugin-transform-runtime/src/helpers.js.

Should read `pre-release` rather than `preprelease`.
2020-09-23 16:06:21 -04:00
Justin Ridgewell
f49234aa69
Add sourcemap markings for each line of a string (#12086)
* Add sourcemap markings for each line of a string

Fixes https://github.com/babel/babel/issues/12083

* Fix for multiple newlines

* Optimize with indexOf

* Comment explaining newline search
2020-09-22 21:36:21 -04:00
Sosuke Suzuki
a4a14caee7
Throw a syntax error for empty type parameter/argument (#12088) 2020-09-22 08:26:30 -05:00
Sosuke Suzuki
cb4e436018
Throw an error for a declare class field that have an initializer (#12093) 2020-09-22 08:23:58 -05:00
Sosuke Suzuki
3628c52867
Do not throw an error for optional binding pattern params in function declaration (#12085) 2020-09-21 09:14:13 -05:00
fisker Cheung
18d13d0032
Fix invalid setter parse (#12076)
* Fix invalid `setter` parse

* estree

Co-authored-by: Brian Ng <bng412@gmail.com>
2020-09-19 10:03:35 +02:00
Sosuke Suzuki
ae18f9c0d9
Throw a syntax error for a declare function with a body (#12054) 2020-09-19 00:35:37 +02:00
Brian Ng
6182001a4c
Bump regexpu-core (#12077)
* Bump regexpu-core

* dedupe
2020-09-18 15:36:37 -04:00
Brian Ng
37a02dfc0e
Bump Babel deps (#12078) 2020-09-18 13:07:48 -05:00
Barron Wei
1a8e7ff2ec
fix(do-expr): SwitchStatement with IfStatement cases (#11728)
* test(do-expr): condition before break

* test(do-expr): labeled break

* fix(do-expr): add check for break in BlockStatement

* fix(do-expr): add LabeledStatement case for getCompletionRecords

* test(do-expr): rename condition before break to condition before expression

* revert(do-expr): undo remove break for do switch

* revert(do-expr): undo remove labeled break

* test(do-expr): add condition before break

* test(do-expr): update condition before break

* test(do-expr): remove labeled break

* fix(do-expr): add tree search in findBreak

* fix(do-expr): ignore isFunction case in findBreak
2020-09-18 10:34:35 -04:00
Huáng Jùnliàng
44f8287d7a
chore: pin browserslist version to 4.12.0 (#12070) 2020-09-17 21:46:38 +02:00
Sosuke Suzuki
7028a14c7f
fix: throw for constructors with type parameters (#12065)
* Throw a syntax error for a constructor with type parameters

* Modify to match error location with TypeScript

* Update typescript parser tests

Update allowlist.txt
2020-09-17 13:03:33 -04:00
Huáng Jùnliàng
69e98fcf4a
chore: add git-blame-ignore-revs (#12063) 2020-09-17 09:37:10 -05:00
Sosuke Suzuki
bbe0cf09fc
Throw a syntax error for a parameter properties in not constructor (#12061) 2020-09-14 16:28:06 -05:00
Huáng Jùnliàng
c8f0b6dc1e
chore: use latest node on ci workflow when possible (#12049) 2020-09-10 17:33:19 -04:00
Huáng Jùnliàng
70cf2d704a
chore: remove unused dependencies (#12044) 2020-09-09 22:05:57 -04:00
Huáng Jùnliàng
20fd450ab7
Update CHANGELOG.md 2020-09-03 11:57:40 -04:00
Babel Bot
a8e5fc1540 Add v7.11.6 to CHANGELOG.md [skip ci] 2020-09-03 15:55:50 +00:00
Huáng Jùnliàng
e51139d7fd v7.11.6 2020-09-03 11:11:11 -04:00
Huáng Jùnliàng
a8505c2c96
Revert "Update Yarn to 2.2.2 (#12023)" (#12031)
This reverts commit b5481cccbf4aeac6bfdf1c3e37ccc7de5a70c3b9.
2020-09-03 11:09:23 -04:00
Huáng Jùnliàng
2026a42497
Run prepublish build after versioning (#12028)
* test: run prepublish-build after versioning in publish test

* chore: run yarn install when lerna version is invoked
2020-09-03 08:25:44 -04:00
Huáng Jùnliàng
b5481cccbf
Update Yarn to 2.2.2 (#12023)
* chore: update Yarn to 2.2.2

* chore: add yarn dedupe check on CI
2020-09-03 09:24:34 +02:00
Huáng Jùnliàng
a91fdeb1f6
Revert #12014 (#12027)
* Revert "chore: bump source-map to 0.6.1 (#12014)"

This reverts commit d5bcc08bf7134db165af91a88a61c8c6bfe39144.

* test: add regression tests for #12025
2020-09-01 15:42:01 -04:00
Nicolò Ribaudo
cb3a9515b8
Update CHANGELOG.md [skip ci]
Replaced the list of all the packages in the Yarn 2 commit with "Every package", as already done in the past, to make it more readable.
2020-09-01 14:59:56 +02:00
Jan Brašna
a023b6456c
docs: Fix minor link wording woes [skip ci] (#12024)
* Fix design/monorepo.md DO blog link [skip ci]

* Fix README signup wording [skip ci]

* Update README link [skip ci]

* Fix CONTRIBUTING signup wording [skip ci]

* Fix CONTRIBUTING Slack link [skip ci]
2020-08-31 23:29:29 -04:00
Huáng Jùnliàng
3342374710 chore: update yarn.lock 2020-08-31 16:08:41 -04:00
Babel Bot
d0671e72b3 Add v7.11.5 to CHANGELOG.md [skip ci] 2020-08-31 20:05:30 +00:00
Huáng Jùnliàng
af64ccb2b0 v7.11.5 2020-08-31 15:54:06 -04:00
Joe Haddad
371e152cd2
fix(jsx): do not throw on generated element in development mode (#12017)
* Fix `jsxDEV` for generated elements

* Throw invariant error

* Add test

* test: revise test layout

* fix: node 6 does not support trailing comma

* Use undefined node

Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
2020-08-31 15:16:47 -04:00
Huáng Jùnliàng
ce6a7f1d98
Remove unused enhanced-resolve and normalize lock resolutions (#12013)
* chore: remove enhanced-resolve

It was introduced as a peer dependency of `webpack-dependency-suite`, see https://github.com/babel/babel/pull/7453 and https://travis-ci.org/github/babel/babel/jobs/347175454#L545

* chore: remove custom @lerna/collect-updates resolution

The forked @lerna/collect-updates are meant to update runtime-corejs2 when helpers
are updated. However they are now always force published. So we don't need the fork
anymore
2020-08-27 20:12:41 -04:00
Huáng Jùnliàng
d5bcc08bf7
chore: bump source-map to 0.6.1 (#12014) 2020-08-27 17:17:49 -04:00
Huáng Jùnliàng
8d59ff658d
chore: use Rollup 2 (#12010)
* chore: use Rollup 2

* chore: downupgrade @rollup/plugin-commonjs to 13.0.2

* nit: restore extraPlugins move

* chore: remove unused rollup-plugin-babel

* chore: bump rollup-plugin-terser to 7.0.0

* chore: remove invalid terser options
2020-08-26 18:20:14 -04:00
Huáng Jùnliàng
2c60595342
fix: ExpressionBody should respect [In] parameter (#11931) 2020-08-26 13:24:44 -04:00
Huáng Jùnliàng
97075c9091
Restructure CI workflow (#12002)
* chore: share build artifacts in node version tests

* chore: build runtime in test stage

* Update .github/workflows/ci.yml

* Update .github/workflows/ci.yml

* Update .travis.yml

Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2020-08-26 13:14:04 -04:00
Huáng Jùnliàng
b8f3453d3c
chore: improve Yarn 2 cache on CI (#11781)
* chore: add cache actions for yarn

* chore: validate yarn cache before CI jobs

* chore: remove restore-keys as cache-hit must be true

* chore: disable post install scripts in yarn-cache validate

* chore: use pnp linker in validate-yarn-cache step

* chore: add job names
2020-08-26 11:53:06 -04:00
Huáng Jùnliàng
2e20f1b8a6
add test on ES2021 features (#12005) 2020-08-25 15:23:45 -04:00
Huáng Jùnliàng
3fad7eab9b
Use Yarn 2 (#11962)
* chore: use yarn 2

* chore: remove redundant yarn locks

* chore: remove publishEslintPkg

* chore: remove redundant make bootstrap

* Update .yarnrc.yml

Co-authored-by: Kristoffer K. <merceyz@users.noreply.github.com>

* chore: use workspace protocol for eslint packages in the root

Co-Authored-By: merceyz <merceyz@users.noreply.github.com>

* chore: pin caniuse-lite versions

Testcases in packages/babel-preset-env/test/fixtures/debug/browserslists-defaults-not-ie
depends on specific caniuse-lite versions. We pinned the version here
so we don't have to deal with fixture different in e2e-tests
where all deps will be updated and tested.

* chore: resolve yarn install warnings

* chore: update yarn cache path on circle/travis

* chore: add yarn deduplicate plugin

* chore: deduplicate lock files

* chore: move devDependencies to leaf packages

* chore: remove @yarnpkg/plugin-constraints

* chore: remove unused dedupe options

* test: fix unwanted self reference

* chore: remove output-file-sync dependency

* chore: update browserify to 16.5.2

Co-authored-by: Kristoffer K. <merceyz@users.noreply.github.com>
2020-08-25 14:37:30 -04:00
Giovanni Calò
304eea4133
Added linting support for private class methods (#11993)
* Added linting support for private class methods

* Renamed variable

* Renamed variable
2020-08-24 14:57:17 -04:00
uhyo
76d571e285
fix(plugin-proposal-function-bind): fix invalid code emitted for ::super.foo (#12000) 2020-08-24 12:35:31 -05:00
Brian Ng
941f610275
Set generator to true during error recovery of accessor (#11987) 2020-08-21 14:37:52 -05:00
Johan Holmerin
b9407d7660
Forward deopt node path in NodePath#evaludate (#11832)
* Forward deopt node path

* Move deopt evaluation tests

* Document evaluate deopt property
2020-08-20 16:20:19 -04:00
Babel Bot
bd07cda4a5 Add v7.11.4 to CHANGELOG.md [skip ci] 2020-08-20 19:01:17 +00:00
Huáng Jùnliàng
90b1989569 v7.11.4 2020-08-20 14:51:38 -04:00
Huáng Jùnliàng
565cfff486 chore: test against workspace babel/core 2020-08-20 14:51:09 -04:00
Huáng Jùnliàng
d844700449
fix: declare @babel/traverse as a dependency (#11985) 2020-08-20 14:01:29 -04:00
Huáng Jùnliàng
4be67fb19a
Ensure import() is not transpiled in babel-core published source (#11974)
* fix: Ensure `import()` is not transpiled when published

* Update packages/babel-core/test/config-chain.js [skip ci]
2020-08-20 13:31:26 -04:00
Brian Ng
84ea6e4501
Throw error on invalid flow async generic arrow syntax (#11979) 2020-08-19 16:11:17 -05:00
Huáng Jùnliàng
1b0f19b019
fix: do not mutate newTypes (#11978) 2020-08-19 15:35:27 -04:00
Brian Ng
96cc8292b7
Fix parsing type casted generic flow arrow exprs (#11955) 2020-08-19 14:15:01 -05:00
Kai Cataldo
180e9c00e3
fix: ensure defaults are set in @babel/eslint-parser (#11970)
* fix: ensure defaults are set in @babel/eslint-parser

* Address feedback

* Update eslint config normalization
2020-08-18 20:23:35 -04:00
Huáng Jùnliàng
cdada5800d
fix: do not transform ClassPrivateMethods in estree (#11973)
* fix: do not transform ClassPrivateMethods in estree

* fix: use MethodDefinition as ClassPrivateMethod visitor keys
2020-08-18 11:18:38 -04:00
Huáng Jùnliàng
028a051c2b
Move legacy node version tests to GitHub actions (#11952)
* chore: run node 6 and 8 test on GitHub actions

* fix: apply dynamicImportUrlToPath polyfill on publish

* Apply hacks unconditionally

* try fix highlight issues

* address review comments

* chore: add test-legacy build env

* Update .travis.yml [skip ci]

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

Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2020-08-14 14:20:06 -04:00
Huáng Jùnliàng
66c6b3b949
Add more parser test cases (#11923)
* remove unused codes

* refactor: remove unused parseAccessModifier

* refactor: remove redundant async function checks

* refactor: remove redundant class check in checkExport

* add more parser test cases

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

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

* chore: add sourceType: unambiguous test

Co-authored-by: Brian Ng <bng412@gmail.com>
2020-08-14 11:53:17 -04:00
James C. Davis
9c565a97d5
chore: remove obsolete comment (#11953) 2020-08-13 12:43:07 +02:00
Huáng Jùnliàng
2e2d15fb4c
chore: build babel-polyfill-dist on make watch (#11951) 2020-08-12 10:18:36 -04:00
Huáng Jùnliàng
df9ee2c7cd
Simplify tokenizer update context (#11944)
* replace lineBreak.test by hasPrecedingLingBreak

* refactor: simplify updateContext
2020-08-11 13:43:03 -04:00
Huáng Jùnliàng
3995160fc7
fix: push new token context when braceHashL is seen (#11941)
* fix: push new token context when braceHashL is seen

* Update packages/babel-parser/src/tokenizer/context.js
2020-08-11 09:55:13 -04:00
Justin Ridgewell
a5bc48661b
Isolated exec tests (#11531)
* Run exec tests in fresh contexts

* Reevaluate modules in every context

* Cache module code when running tests

* Eliminate weakmap accesses as much as possible

* Remove old multiline usage

* Using bundled polyfill to significantly increase performance

The individual requires for each file were the part that was sooooo slow.

* Drop LRU cache size

* Fixes

* Fix test

Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
2020-08-10 18:57:48 -04:00
Huáng Jùnliàng
3bff1ce35a
fix: disallow line break between async and property (#11947) 2020-08-10 17:33:14 -05:00
Huáng Jùnliàng
008fe25ae2
fix: reset EndLocation for catch param (#11943) 2020-08-10 17:06:34 -04:00
Huáng Jùnliàng
a3893129ec
chore: enable flowcheck on CI (#11945)
* chore: enable flowcheck on CI

* fix: flow errors
2020-08-10 16:57:29 -04:00
Yuku Kotani
00b974298b
Move some @babel/traverse from deps to devDeps (#11937) 2020-08-10 11:36:09 -05:00
Huáng Jùnliàng
4bb1e164da
Refactor [In] production parameter tracking (#11930)
* refactor: track [In] parameter in prodParam

* Apply suggestions from code review
2020-08-10 07:32:38 -04:00
Huáng Jùnliàng
fccf31aca6
chore: do not push version commit on lerna version (#11936) 2020-08-10 07:29:52 -04:00
Babel Bot
199ee60571 Add v7.11.3 to CHANGELOG.md [skip ci] 2020-08-08 20:09:53 +00:00
Huáng Jùnliàng
57b658c4d8 v7.11.3 2020-08-08 15:59:38 -04:00
Huáng Jùnliàng
48e793e964
fix: add ImportExpression visitorKeys (#11932) 2020-08-08 15:44:22 -04:00
Алексей
32744b2346
fixed the names of the rules (#11933) 2020-08-08 13:34:11 -04:00
Huáng Jùnliàng
a827ca41f3
refactor: simplify smart pipeline parsing (#11919) 2020-08-05 21:15:42 -04:00
Huáng Jùnliàng
76f033f8c7
simplify isLookaheadRelational method (#11922)
* refactor: move isLookaheadRelational to flow plugins

* refactor: simplify isLookaheadRelational to isLookaheadToken_lt
2020-08-05 20:21:35 -04:00
Huáng Jùnliàng
cd577eedfd
refactor: add recoverable error on accessorIsGenerator (#11921)
* refactor: add recoverable error on accessorIsGenerator

* Update packages/babel-parser/src/parser/error-message.js

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

* Apply suggestions from code review

Co-authored-by: Brian Ng <bng412@gmail.com>
2020-08-05 17:52:13 -04:00
Brian Ng
c0f6f0394d
Support ConditionalExpressions in dry-error-messages rule (#11917)
* Support ConditionalExpressions in dry-error-messages rule

* tests
2020-08-05 16:28:35 -04:00
Huáng Jùnliàng
50b3262063
refactor: avoid unnecessary property access (#11918)
* refactor: avoid unnecessary property access

* refactor: `else` is redundant because keyName is const
2020-08-05 15:39:45 -04:00
Babel Bot
acf2b144a4 Add v7.11.2 to CHANGELOG.md [skip ci] 2020-08-05 14:31:08 +00:00
Huáng Jùnliàng
bc7a811fce v7.11.2 2020-08-05 10:15:43 -04:00
Huáng Jùnliàng
92434269af
fix: do not eat get/set after async is parsed (#11916) 2020-08-05 08:19:59 -05:00
Babel Bot
de75d4f081 Add v7.11.1 to CHANGELOG.md [skip ci] 2020-08-04 22:13:36 +00:00
Huáng Jùnliàng
953ae82159 v7.11.1 2020-08-04 17:58:35 -04:00
Huáng Jùnliàng
a1eabb84ea
rescan gt/lt token after TsAsExpression is parsed (#11912)
* refactor: move inType checks to flow plugin

* polish: replace hardcoded char codes

* fix: rescan greater/less token after asExpression is parsed
2020-08-04 17:00:21 -04:00
Devon Govett
c29138fd72
Do not cache non-existent files forever (#11906) 2020-08-04 16:07:25 -04:00
Huáng Jùnliàng
a4ebe29b3f
Parser refactoring (#11871)
* refactor: parseMaybeUnary => parseUnary

* refactor: extract shouldExitDescending method

* refactor: add parseUpdate

* refactor: avoid comparing with hardcoded token value

* refactor: add ParseNewOrNewTarget

* refactor: add parseCoverCallAndAsyncArrowHead

* add parseBind

* refactor: polish parseTaggedTemplateExpression interface

* refactor: add parseMember method

* refactor: add parseSuper method

* refactor: add parseAsyncArrowUnaryFunction method

* fix: disallow line break before async binding arrow

* refactor: simplify tt.name logic

* refactor: add parseDo method

* refactor: misc

* refactor: rename parseObjectMember by parsePropertyDefinition

* refactor: unify set/get/async keyword parsing in ObjectMethod

* refactor: misc

* refactor: add parseArrayLike method

* refactor: move fsharp epilogure and prologue inside parseObjectLike

* fixup

* refactor: rename parseFunctionExpression to parseFunctionOrFunctionSent

* refactor: remove redundant logic

* refactor: rename parseClassPropertyName by parseClassElementName

* refactor: avoid unecessary lookahead when parsing tt._export

* fix: export-default-from should support escaped async as export binding

* address review comments

* parseUnary -> parseMaybeUnary
2020-07-31 20:36:04 -04:00
Huáng Jùnliàng
ad60153a98
Update @babel/* deps (#11899)
* chore: remove extra install step for eslint packages

* chore: update babel deps
2020-07-31 20:35:19 -04:00
Huáng Jùnliàng
c41dcd045b
fix: ensure […map.keys] can be correctly transformed in loose mode (#11901) 2020-07-31 14:26:22 -05:00
Huáng Jùnliàng
08054181c3
docs: remove experimental warning on README (#11900) 2020-07-31 13:13:30 -04:00
Babel Bot
231328aafc Add v7.11.0 to CHANGELOG.md [skip ci] 2020-07-30 21:31:37 +00:00
Huáng Jùnliàng
45fdb87747 v7.11.0 2020-07-30 17:12:07 -04:00
Kai Cataldo
f7ec170ba3
update: hardcode @babel/eslint-parser min supported version check (#11896)
* update: change babel-eslint-parser version mismatch error to log

* Bump @babel/core version

* Change to 7.2.0

* Add period to error message
2020-07-30 15:45:43 -04:00
Oliver Dunk
db56261414
Skip TSAsExpression when transforming spread in CallExpression (#11404)
* Skip TSAsExpression when transforming spread in CallExpression

* Create @babel/helper-get-call-context package

* Support OptionalCallExpressions

* Use helper in optional chaining plugin, and move tests

* Update package.json files

* Use dot notation to access property

* Remove private method tests until future MR

* Update packages/babel-plugin-transform-spread/package.json

* Rename @babel/helper-get-call-context to @babel/helper-skip-transparent-expr-wrappers

* Handle typed OptionalMemberExpressions

* Make @babel/helper-skip-transparent-expr-wrappers a dependency

* Support TSNonNullExpressions

* Use named import instead of default

* Add test for call context when parenthesized call expression has type

* Improve handling of member expressions inside transparent expression wrappers

* Add comment explaining what a transparent expression wrapper is

* Add newlines to test fixtures

* Pass correct parameter type to skipTransparentExprWrappers

* Rename to babel-helper-skip-transparent-expression-wrappers

* Remove getCallContext helper

* Fixed exports key

* Preserve types in babel-plugin-transform-spread tests

* Use external-helpers to avoid inlining helper functions in tests

Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2020-07-30 14:17:37 -04:00
Bogdan Savluk
32e7bb4027
fix build config to work the same when running on windows (#11688) 2020-07-30 14:11:58 -04:00
Ujjwal Sharma
2ac49ba7c4
add support for logical assignments with private properties (#11702)
* add support for logical assignments with private properties

Patches the logic for handling assignment operators and adds support for
handling the logical assignment operators appropriately.

Fixes: https://github.com/babel/babel/issues/11646

* replace hardcoded logical assignment operators with constant

Replace a hardcoded check for logical assignment operators with the
LOGICAL_OPERATORS constant in
plugin-proposal-logical-assignment-operators.

Refs: https://github.com/babel/babel/pull/11702#discussion_r438554423
2020-07-30 14:10:16 -04:00
James C. Davis
aa82ab6358
Typescript: always strip declare from class fields (#11747)
* test: add failing test for decorated declare

* fix: always strip declare from class fields

* test: add decorated-declare-properties test
2020-07-30 14:06:45 -04:00
Huáng Jùnliàng
4c9929ca28
Prepare to publish @babel/eslint-* packages (#11894)
* remove private flag, bump node and babel versions

* disallow submodule imports

* Revert "Do not automatically publish eslint packages (#10722)"

This reverts commit 5ca8acdb38bc7a9a4669ad3249c219531f8f6579.

# Conflicts:
#	Makefile
#	eslint/babel-eslint-parser/package.json
#	eslint/babel-eslint-plugin-development/package.json
#	lerna.json
#	scripts/integration-tests/publish-local.sh

* disable submodule imports for babel-eslint-config-internal

* chore: push back a bit to make tests happy
2020-07-30 13:32:38 -04:00
Huáng Jùnliàng
0e4cf1e6a2
chore: build standalone once in prepublish step (#11777) 2020-07-30 12:54:56 -04:00
SZ-Coder
4ce1b70ade
Fix incorrect module path when absoluteRuntime is specified (#11893)
* - Added failing tests for issue #11885.

* - Fix issue #11885: absoluteRuntime does not work as expected with corejs3.

* - Removed helper code from test output files (tests for issue #11885).

* chore: add @babel/runtime-corejs3 to dev deps

* chore: update test fixtures

Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
2020-07-30 10:35:37 -04:00
Huáng Jùnliàng
164a93945d
add showConfig support (#11588)
* draft: showConfig support

* feat: pass through showConfig command options

* update test file

* refactor: add createLogger to makeChainWalker

* serializing dynamic plugin instance

* fix flow errors

* chore: add tests on extended config

* fix: do not print empty presets

* add more test cases

* add windows testcases

* address review comments

* throw error when showConfigPath does not exist

* print reason when showConfig is targetting an ignored file

* remove showConfig: boolean

* refactor: simplify environment flag name

* rename test fixtures

* fix: throw when SHOW_CONFIG_FOR is not a regular file

* cleanup test fixtures

* add test on only

* Update packages/babel-core/src/config/files/configuration.js

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

* address review comments

* update test fixtures

* feat: sort config items in ascending priority

Co-authored-by: Brian Ng <bng412@gmail.com>
2020-07-30 09:24:19 -04:00
dependabot[bot]
374a253d0c
chore(deps): bump elliptic from 6.5.2 to 6.5.3 (#11891)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-07-29 20:26:38 -05:00
Huáng Jùnliàng
01d4625412
Correctly check reserved word for PropertyDefinition: IdentifierReference (#11862)
* fix: check IdentifierReference in PropertyDefinition

* chore: add more test cases

* fix: incorrect test title
2020-07-29 19:40:52 -04:00
Kai Cataldo
4ac9c7afe2
Upgrade to ESLint v7 (#11857)
* Upgrade to ESLint v7

* Upgrade eslint-plugin-import

* Update peer deps

* Remove max-len from ESLint config

* Update tests

* Only test babel-eslint-* packages in Node >=10

* Remove babel-eslint

* Fix linking in dev

* Add comment to Makefile

* Fix e2e tests

* Add --ignore-engines flag when installing in ESLint packages

* fix: convert tt.questionDot to Punctuator

* chore: update lockfile

Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
2020-07-29 19:11:48 -04:00
Huáng Jùnliàng
95fcb3e16c Update compat-table (#11890)
* chore: update compat-table

* chore: friendly to node < 14 contributors

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

Co-authored-by: Brian Ng <bng412@gmail.com>
2020-07-29 18:32:12 -04:00
morrme
2f89e72321 enable logical assignment in babel preset env (#11876)
Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
2020-07-29 18:32:12 -04:00
Vahagn Aharonian
b651a6f6ab Enable logical assignment by default in @babel/parser (#11860) (#11869) 2020-07-29 18:32:12 -04:00
Huáng Jùnliàng
0e985fb287 feat: enable numericSeparator parsing support (#11863) 2020-07-29 18:32:12 -04:00
Huáng Jùnliàng
ccd98f042c Add numeric-separator to preset-env (#11865) 2020-07-29 18:32:12 -04:00
Huáng Jùnliàng
cdb81d7703 Add export-namespace-from to preset-env (#11849)
* feat: add compat-data of proposal-export-namespace-from

* feat: add export-namespace-from to preset-env

* chore: update test fixtures

* address review comments
2020-07-29 18:32:12 -04:00
Nicolò Ribaudo
eba4c3b6ed TypeScript 4.0: Support labeled tuple elements (#11754)
* TypeScript 4.0: Support labeled tuple elements

* More tests

* Disallow mixing labeled and unlabeled elements

* Update AST shape

* Enable test after rebase

* Allow labeled spread types

* Fix flow

* Add types and generator suport

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

* Prettier
2020-07-29 16:51:48 -04:00
Huáng Jùnliàng
9e6663f125 Follow-up on initial TS4 catch param support (#11767)
* refactor: align with AST shape convention

* feat: print catch param type annotations

* test: add test case on transform
2020-07-29 16:51:48 -04:00
Brian Ng
8a1d7e41f2 Allow unknown/any in TS catch clause param (#11755) 2020-07-29 16:51:48 -04:00
Nicolò Ribaudo
5b4b3a3e4a TypeScript 4.0: Allow spread in the middle of tuples (#11753) 2020-07-29 16:51:48 -04:00
Huáng Jùnliàng
d7347fb8bd
eslint-parser: ES2020 features (#11815)
* chore: update espree test on nullish coalescing

* feat: add optional chaining support

* fix: adapt to estree AST shape

* chore: update lockfile

* add estree optional-chaining test fixtures

* address review comments

* chore: simplify smoke test

* export * support

Co-authored-by: Brian Ng <bng412@gmail.com>
2020-07-29 16:46:29 -04:00
Huáng Jùnliàng
059e9124ff
Add decimal parsing support (#11640)
* docs: add DecimalLiteral to AST spec

* add decimal support

* fix: throw invalid decimal on start

* add DecimalLiteral type definitions

* update parser typings

* add generator support

* add syntax-decimal plugin

* Add syntax-decimal to babel-standalone

* add syntax-decimal to missing plugin helpers

* fix incorrect test macro
2020-07-29 16:43:15 -04:00
James Addison
9daa50e005
babel-traverse: prefer clearer, reduced-bias option naming (#11791)
* babel-traverse: prefer clearer, reduced-bias option naming

* Apply suggestions from code review

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

Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2020-07-29 16:41:20 -04:00
coderaiser
cf425a0bde
feature: babel-core: add cloneInputAst (#10241)
Co-authored-by: coderaiser <coderaiser@cloudcmd.io>
2020-07-29 16:40:02 -04:00
Huáng Jùnliàng
6373eb5d82
chore: use modules: "auto" (#11879)
* chore: use modules: “auto”

* address review comments
2020-07-28 09:41:35 -04:00
Sven
3a0aa8e829
chore(github): fix issue template typo (#11875) 2020-07-24 19:33:33 -04:00
Huáng Jùnliàng
2bf38fb914
fix: disallow \8, \9 in strict mode string (#11852) 2020-07-21 09:44:56 -04:00
Huáng Jùnliàng
3680f019d7
fix: allow 09.1_1 and 09e1_1 in sloppy mode (#11854)
* fix: allow 09.1_1 and 09e1_1 in sloppy mode

* polish: avoid extra input source scanning

* chore: move comment [skip ci]
2020-07-21 09:44:28 -04:00
Huáng Jùnliàng
48be93b46c
refactor: replace caniuse-db by mdn-browser-compat-data (#11838)
* refactor: replace caniuse-db by mdn-browser-compat-data

* fix broken test
2020-07-20 17:11:21 -04:00
Huáng Jùnliàng
e51a91e131
fix: eval?.() is indirect (#11850) 2020-07-20 17:06:27 -04:00
Huáng Jùnliàng
238cadda4c
chore: update spec-new in CONTRIBUTING.md [skip ci] (#11706)
* chore: update CONTRIBUTING.md [skip ci]

* Update CONTRIBUTING.md [skip ci]

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

* Update CONTRIBUTING.md [skip ci]

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

* Apply suggestions from code review [skip ci]

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

Co-authored-by: Brian Ng <bng412@gmail.com>
2020-07-16 21:46:41 -04:00
Huáng Jùnliàng
f4eeff947d
fix: correctly set innerEndPos in CoverParenthesizedExpressionAndArrowParameterList (#11847) 2020-07-16 17:11:06 -05:00
Huáng Jùnliàng
8f191ead92
chore: fix typo in codebase (#11846) 2020-07-16 16:01:20 -05:00
Huáng Jùnliàng
02f30af59c
refactor: reorganize babel types definitions structure (#11843)
* refactor: reorganize babel types definitions structure

* chore: update generated artifacts
2020-07-15 17:34:31 -04:00
Joshua Ohlman
e12caf4f69
Always retain lines for async arrow (#11836) 2020-07-15 22:48:08 +02:00
Huáng Jùnliàng
7eaf37ea3e
chore: use repository HEAD when pulling third party repos (#11837) 2020-07-14 18:14:25 -04:00
Babel Bot
cc646fa10a Add v7.10.5 to CHANGELOG.md [skip ci] 2020-07-14 18:51:51 +00:00
Huáng Jùnliàng
f7964a9ac5 v7.10.5 2020-07-14 14:10:36 -04:00
Huáng Jùnliàng
5dd64ecc4a
Disallow duplicated AST nodes (#11807) 2020-07-14 08:32:16 -05:00
Brian Ng
ffb42488ba
Bump some deps for audit (#11818) 2020-07-10 21:42:18 +02:00
Huáng Jùnliàng
02c8fd92bd
fix: add optional: false to chained optional call expression (#11814) 2020-07-09 20:33:50 -04:00
Rafael Salguero Iturrios
f32d5debda
Typescript transform now removes generic arguments from optional calls (Fixes #11813) (#11816) 2020-07-09 17:32:05 -05:00
James Addison
55ce749f42
Replace lodash 'clone' usage with ES6 Spread initializer (#11811) 2020-07-09 10:32:04 -05:00
James Addison
aae1862170
Replace lodash 'extend' usage with Object.assign (#11812) 2020-07-09 09:04:48 -05:00
James Addison
bff6298578
Reduce dependency on lodash functions: values, extends (#11798)
* Replace lodash 'values' usage with Object.keys => .map(obj[key])

* Block scoping: refactor letReferences, outsideLetReferences as objects of type Map

* Remove lodash dependency from babel-plugin-transform-block-scoping

* Fixup: Add missing Object.keys call

* Fixup: Update remaining property accessors

* Coerce Map.values() iterator results into an array via spread operator

* Fixup: Map.put -> Map.set

* Fixup: undo incorrect variable de-duplication

* Replace array-spread-plus-map combination with Array.from call

* Extract an extendMap function as an attempt to create an optimization boundary

* Experiment: cast objects to string (eliminates one Map/object difference per https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map )

* Fixup: perform String cast on map keys, not values

* Revert "Fixup: perform String cast on map keys, not values"

This reverts commit abdd147438fa74f51ac50ef1f96bb462810cd3f2.

* Revert "Experiment: cast objects to string (eliminates one Map/object difference per https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map )"

This reverts commit a4035c885b37bfd6e926a0362bda9dcf5b5a52c2.

* Experiment: filter keys via Object.prototype.hasOwnProperty.call

* Revert "Experiment: filter keys via Object.prototype.hasOwnProperty.call"

This reverts commit 491c093f213c6229815b2e6dc9243245376265b0.

* Migrate back from Map-based reference storage to Object-based storage; access performance appears much improved for Object property access

* Revert "Migrate back from Map-based reference storage to Object-based storage; access performance appears much improved for Object property access"

This reverts commit 2119acc7f0d78ced3b9ad77820b4b72e5ad67475.

* Iterate over a clone of outsideRefs keys

* Revert "Extract an extendMap function as an attempt to create an optimization boundary"

This reverts commit 85689f2bfc180d0b5c0e674e5de7954470c7ec69.

* Fixup: migrate remaining Object property access to Map.get in tdz module
2020-07-08 13:17:04 +02:00
Brian Ng
58cfaf20ee
Fix break/continue when switch is nested inside loop (#11802)
* Fix break/continue when switch is nested inside loop

* merge retCheck
2020-07-07 18:38:11 -04:00
Bogdan Savluk
b1a8e72e16
Refactor generated builder names in @babel/types (#11582)
* ensure only builders starting with lowercase are used

* update generate builders to have function name starting flow lowercase

* fix bug in deprecated builders

* remove comment about not yet discussed change in next major version
2020-07-07 09:53:00 +02:00
Huáng Jùnliàng
3a53f7244d
docs: update README example and REPL link (#11799) 2020-07-06 20:21:38 -04:00
James Addison
3e55270135
Reduce dependency on lodash functions: includes, uniq, repeat, isinteger (#11790)
* Replace lodash 'includes' usage with Array.prototype.includes

* Replace lodash 'values' usage with Object.values

* Replace lodash 'uniq' usage with Array.from(new Set(...))

* Property safety: ensure that ignoreSuites/ignoreTasks are populated prior to access

* Property safety: ensure that blacklistTypes is populated prior to access

* Revert "Replace lodash 'values' usage with Object.values"

This reverts commit 9fd3679d6db03066daee09fad0050e5292a32aa1.

* Replace lodash 'repeat' usage with String.prototype.repeat

* Replace lodash 'isinteger' usage with Number.isInteger

* Remove explicit lodash dependency from babel-generator package

* Update packages/babel-helper-transform-fixture-test-runner/src/index.js

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

* Rely on optional chaining operator as sole boolean check

* Handle additional optional chaining operator simplification

* Update type signature

Co-authored-by: Brian Ng <bng412@gmail.com>
2020-07-06 09:27:41 +02:00
Huáng Jùnliàng
c664fbdd07
fix: update class properties support matrix (#11783) 2020-07-03 07:54:40 -04:00
Huáng Jùnliàng
0d444072ba
chore: refine yarn cache config (#11782)
* chore: refine yarn cache config

* fix: Circle CI does not support template on paths

* chore: manually update yarn cache key

* remove debug command
2020-07-03 07:53:25 -04:00
Huáng Jùnliàng
1a65ba76f0
test: add console warn spy on babel-register tests (#11780)
* test: add console warn spy on register tests

* address review comments
2020-07-02 11:32:41 -04:00
Huáng Jùnliàng
ae1e40a678
chore: remove babel-register generated test artifacts (#11776)
* chore: use customized cache path in babel-register path

* chore: remove node_modules cache after tests
2020-07-01 17:07:16 -04:00
Huáng Jùnliàng
d67629b114
fix: throw expect jsx plugin error when an idStart or > is seen (#11774)
* fix: throw expect jsx plugin error when an idStart or > is seen

* fix: avoid throwing undefined

* add test case
2020-07-01 15:17:05 -04:00
Huáng Jùnliàng
b1b21e5c03
docs: add AST spec on optional chain [skip ci] (#11729) 2020-07-01 14:20:17 -04:00
Kai Cataldo
3d498d05e7
Add note about running Make targets in Windows 10 (#11761) 2020-06-30 14:45:27 -04:00
Nicolò Ribaudo
12dc4966ad
Push changelog to main instead of master (#11764) 2020-06-30 17:43:11 +02:00
Nicolò Ribaudo
7ee7d16495 Add 7.10.3 and 7.10.4 to CHANGELOG.md 2020-06-30 16:53:42 +02:00
Huáng Jùnliàng
7fd40d86a0 v7.10.4 2020-06-30 09:04:22 -04:00
Simon Kotwicz
379e1c5593
Support private properties for semi rule (#11748)
* Support private properties for semi rule

* Combine selectors
2020-06-29 17:36:03 -04:00
Nicolò Ribaudo
5743ad3923
[regression] Don't validate file.comments in @babel/types (#11752)
Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
2020-06-29 23:23:36 +02:00
Wojciech Maj
1dd94e813e
Replace non-inclusive "whitelist" and "blacklist" terms with "allowlist" etc. (#11758) 2020-06-29 15:39:38 -04:00
William Law
cfaa70dcf4
skip following empty statements in toSequenceExpression (#11724)
* fix: statementlist behavior

* fixed prettier and babel-types/converter errors

* added check for first node

* remove node length check, only check if node is first

* add reset eLU if proceeding is non-empty

* fix failure for ci tests

* remove .expressions since sequence expression isn't produced

* changed test title
2020-06-25 13:38:01 -04:00
Huáng Jùnliàng
65911144e9
support delete obj?.#x.a (#11669) 2020-06-23 16:10:29 -04:00
Kai Cataldo
75c2300c28
Add @babel/eslint-plugin-development-internal (#11376)
* Add @babel/eslint-plugin-internal

* Add dry-error-messages rule

* Address feedback

* Enable new rule

* fix author field

* Fix errors

* Add readme

* Add example configuration

* Handle directories

* run make bootstrap

* More updates!

* Fix errors

* Update tests

* Fix CI race condition
2020-06-22 19:43:29 -04:00
Jorge Henriquez
beca7e2d8e
Add better parser error when using jsx (#11722)
* Add "<" parser tests

*  No {jsx,flow,typescript} plugin

* Type parameter

* Valid JS Code

* Add: better parser error when using jsx

Address #11499

* Add: babel parser test

Test parser with no plugins and when jsx is given with a js expression

* Add: no flow but with typescript test

* Add: type paramter test with no plugins (no flow)

* Add: unclosed jsx element test
2020-06-22 18:12:52 -04:00
Huáng Jùnliàng
601c824873
Refine babel core types (#11544)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2020-06-21 22:04:12 +02:00
Huáng Jùnliàng
30835f14db
fix: implement early errors for record and tuple (#11652) 2020-06-20 02:35:27 +02:00
Huáng Jùnliàng
2787ee2f96 v7.10.3 2020-06-19 16:42:41 -04:00
Huáng Jùnliàng
7cc8f8db8a
Revert "chore: pin windows node.js version (#11522)" (#11730) 2020-06-19 11:41:38 +02:00
Nicolò Ribaudo
eea156b2cb Migrate from "master" branch to "main" (#11715)
* Remove dead link

* Use consistent "homepage" url in package.json

* Update md links

* Update comment link in parser d.ts

* Add comment in gitpod config

* Update circleci config

* Update PULL_REQUEST_TEMPLATE

* Update badges

* Trigger CI

* Update 404 link
2020-06-18 21:52:29 -04:00
Huáng Jùnliàng
e498bee10f
replace whitelist by allowlist in parser-tests (#11727) 2020-06-17 15:32:46 -04:00
Nicolò Ribaudo
fd3c76941e
[gitpod] Run "make watch" in a second terminal (#11718)
Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>

[skip ci]
2020-06-15 23:35:19 +02:00
骗你是小猫咪
e15a5c7509
Fix innercomments (#11697) 2020-06-12 20:22:47 -05:00
William Law
183acbae25
fix:added check for forXstatement pattern (#11703) 2020-06-12 08:22:33 -05:00
Nicolò Ribaudo
3704728637
Fix README markdown formatting [skip ci] 2020-06-12 01:05:37 +02:00
Nicolò Ribaudo
1b95879614
Setup Gitpod (#11704)
Co-authored-by: Brian Ng <bng412@gmail.com>

[skip ci]
2020-06-12 01:03:39 +02:00
Huáng Jùnliàng
b27abd39a8
fix: add optional: false to MemberExpression (#11709) 2020-06-12 00:26:26 +02:00
Justin Ridgewell
3fba9710dc
Allow templates to parse v8intrinsics (#11695)
* Allow templates to parse v8intrinsics

The `v8intrinsic` and `placeholders` parser plugins conflict, so enabling `placeholders` unconditionally was causing errors for V8's internal codemods. This allows them to set `syntacticPlaceholders = false` (so they'll use the legacy identifier format) and enable `v8intrinsic` by itself.

* Fix linter

* Linter
2020-06-10 14:50:09 -04:00
Bogdan Savluk
36f9798f42
improve node type definitions to avoid any's in generated types (#11687) 2020-06-09 00:39:46 +02:00
Bogdan Savluk
4108524856
Update prettier to v2 (#11579)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2020-06-07 22:21:33 +02:00
Jesse Thomson
426acf336e
Add React.createContext to @babel/plugin-transform-react-pure-annotat… (#11685)
Co-authored-by: Jesse Thomson <jesset@qualtrics.com>
2020-06-05 21:36:06 -05:00
Sajad Torkamani
9d289c1457
Fix small typo (#11682) 2020-06-05 15:08:56 -04:00
Huáng Jùnliàng
71d3527ef5
Properly parse export default from when exportDefaultFrom is not enabled (#11676)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2020-06-05 09:08:21 -05:00
Brian Ng
3874470841
Bump @babel/* deps (#11677) 2020-06-04 20:09:19 -05:00
Huáng Jùnliàng
c9da3bc8b8
refactor: do not rely on AST extra properties in plugins (#11662) 2020-06-05 01:12:07 +02:00
Huáng Jùnliàng
fdbbb57434
chore: add npmignore to babel-helper-plugin-utils (#11674) 2020-06-05 00:43:10 +02:00
Huáng Jùnliàng
8a98ec9877
chore: output ascii only standalone minified bundle (#11672) 2020-06-04 14:10:19 -04:00
Justin Ridgewell
a3f00896f7
Infer names of anonymous functions in logical assignments (#11658)
This is a partial revert of #11370, updating the tests to match the [new consensus](https://github.com/babel/proposals/issues/66#issuecomment-636984546).
2020-06-03 23:23:40 +02:00
Huáng Jùnliàng
1440d97d9c update test fixture 2020-06-01 11:11:30 -04:00
Huáng Jùnliàng
1e115aed33
fix: ensure (a?.b)() has proper this (#11623)
* fix: ensure (a?.b)() has proper this

* let test be more restrictive

* fix: transformed member call should preserve computed

* chore: revamp test files

* refactor: simplify

* fix: unwrap parthenthesizedExpression

* add loose test cases

* add `(a?.#b)()` support

* add with-transform test cases

* Update packages/babel-plugin-proposal-optional-chaining/src/index.js

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

* address review comments

* update test fixtures

Co-authored-by: Justin Ridgewell <justin@ridgewell.name>
2020-06-01 10:25:22 -04:00
Brian Ng
3a3457d808
Fix some test fixtures (#11655) 2020-05-31 09:57:00 -05:00
Kai Cataldo
30d7236397
chore: check version lazily in babel-eslint-parser (#11647) 2020-05-31 00:50:46 -04:00
Ajay Poshak
b1923fd140
Add a check for privateMap's existence (#11571)
Co-authored-by: Ajay Poshak <ajay.poshak@bookmyshow.com>
2020-05-30 22:38:15 +02:00
Babel Bot
cd9c71c5b3 Add v7.10.2 to CHANGELOG.md [skip ci] 2020-05-30 19:27:12 +00:00
Nicolò Ribaudo
b0350e5b1e v7.10.2 2020-05-30 19:16:08 +00:00
Huáng Jùnliàng
b5c4a46a69
refactor: split locationParser into ParserErrors and error message (#11653) 2020-05-30 15:05:42 -04:00
Stanley Stuart
15d6da076a
fix: don't mutate InputTarget's passed to @babel/helper-compilation-targets (#11648) 2020-05-30 09:56:34 -05:00
Nicolò Ribaudo
e6d873e061
Class features loose should have precedence over preset-env (#11634)
* Class features loose should have precedence over preset-env

* Comment

* Update packages/babel-helper-create-class-features-plugin/src/features.js

[skip ci]

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

* Future proof

* Add warning when loose mode changes automatically

* Better message

Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
2020-05-29 23:56:32 +02:00
Huáng Jùnliàng
5b24d79875
fix: add bigIntSuffix to minified output (#11645) 2020-05-29 22:09:20 +02:00
Kai Cataldo
69198beee6
feature: babel-eslint-parser passes through config options (#11639)
* Refactor

* feature: babel-eslint-plugin passes through config options

* Address feedback

* Remove unnecessary temporary variable
2020-05-29 15:00:12 -04:00
Huáng Jùnliàng
6b7a6dccd2
fix: add new plugin names to missing plugin helpers (#11643) 2020-05-29 14:04:47 -04:00
Brian Ng
d7d36a6c25
Add support for printing ImportAttribute (#11641) 2020-05-29 08:49:38 -05:00
Matt Hamlin
8e41f26e12
Fix moduleAttributesVersion errors with stage-0 preset in babel standalone (#11631)
* Fix moduleAttributesVersion errors with stage-0 preset in babel standalone

* Add regression test for stage-0 not erroring on missing moduleattributes version

* Remove moduleAttributesVersion from preset config
2020-05-28 14:35:06 -04:00
Nicolò Ribaudo
ddfdf00167 Update CHANGELOG.md [skip ci] 2020-05-27 22:16:58 +00:00
Babel Bot
1b670c26a9 Add v7.10.1 to CHANGELOG.md [skip ci] 2020-05-27 22:10:07 +00:00
Nicolò Ribaudo
88f57a7ea6 v7.10.1 2020-05-27 21:56:37 +00:00
Nicolò Ribaudo
32bd530f25
[hotfix] Use same targets for fields as for private methods (#11633) 2020-05-27 22:43:23 +02:00
Dan Fabulich
05804b166c
Fix standalone tag when data-type is not set. (#11624) 2020-05-27 11:19:12 -05:00
Saulo Santiago
242d9e0b20
Use repository.directory field in package.json files (#11625)
Co-authored-by: Nicolas Stepien <567105+nstepien@users.noreply.github.com>
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2020-05-27 16:32:25 +02:00
Babel Bot
58df7786ee Add v7.10.0 to CHANGELOG.md [skip ci] 2020-05-26 21:45:09 +00:00
Nicolò Ribaudo
5da2440adf v7.10.0 2020-05-26 21:20:43 +00:00
Nicolò Ribaudo
a06e8e5dd0 Uncomment code for Babel 7.10.0 2020-05-26 21:20:11 +00:00
任文龙
429840dc2b
scope.rename() missing identifier in VariableDeclarator (#11595) 2020-05-26 23:05:12 +02:00
Henry Zhu
0ca5f8b2ec
feature request issue template fix [skip ci] (#11618) 2020-05-26 16:38:43 -04:00
Justin Ridgewell
bda759ac3d Handle private access chained on an optional chain (#11248)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
2020-05-26 22:18:17 +02:00
Huáng Jùnliàng
852520eff5 feat: add privatePropertyInObject to babel-standalone (#11593) 2020-05-26 22:18:17 +02:00
Justin Ridgewell
7459038db8 Add private-property-in-object support (#11372)
https://github.com/tc39/proposal-private-fields-in-in

Co-Authored-By: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
Co-Authored-By: Huáng Jùnliàng <jlhwung@gmail.com>
2020-05-26 22:18:17 +02:00
Nicolò Ribaudo
2d27cf819e
Mention babel/rfcs in the "New feature" issue template (#11592)
* Mention babel/rfcs in the "New feature" issue template
* move npm issue to external gist, reword some issue template names and descriptions

Co-authored-by: Henry Zhu <hi@henryzoo.com>
2020-05-26 12:47:42 -04:00
Huáng Jùnliàng
b457f52ab5 update test fixture 2020-05-25 15:00:40 -04:00
Justin Ridgewell
97f0b7c4a0
Transform ES2015 Unicode Escapes to ES5 (#11377) 2020-05-25 01:26:55 +02:00
Vivek Nayyar
66b86e088c
added basic support for module attributes and tests updated (#10962)
Co-Authored-By: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2020-05-25 01:26:28 +02:00
Andrew Leedham
c5ba345ac2
[preset-env] Add browserslistEnv option (#11434) 2020-05-24 23:44:39 +02:00
Nicolò Ribaudo
698fe8ef50
Log after subsequent compilations in --watch mode (#11220) 2020-05-24 23:03:22 +02:00
Nicolò Ribaudo
93978267ec
Add "allowArrayLike" opt to destructuring and spread transforms (#11265) 2020-05-24 23:00:06 +02:00
Nicolò Ribaudo
28231e1be6
Add "allowArrayLike" support to the for-of transform (#11266) 2020-05-24 22:58:47 +02:00
Kiko Estrada
5dd7f438c9
Enable import.meta by default in @babel/parser (#11406) 2020-05-24 22:57:34 +02:00
Bruno Macabeus
75a6530abe
Fix optional-chaining with TS non-null operator (#10961) 2020-05-24 22:56:31 +02:00
Devon Govett
6ba1f0dd22
Implement @babel/plugin-transform-react-pure-annotations (#11428)
The new plugin is also enabled in `@babel/preset-react`
2020-05-24 22:55:29 +02:00
Huáng Jùnliàng
93a50056ca
Add class proposals to shipped proposals (#11451) 2020-05-24 22:32:53 +02:00
dfabulich
8fce3717a3
Support data-type="module" to generate <script type="module"> (#11466) 2020-05-24 22:31:30 +02:00
fisker Cheung
a33f0d83be
Fix typo (#11603) 2020-05-24 13:28:55 -04:00
lazytype
62e686af91
Fix comments for smartPipeline topic-forbidding contexts (#11597)
[skip ci]
2020-05-23 22:59:46 +02:00
Huáng Jùnliàng
87d747976d
chore: use latest node in GitHub actions (#11598)
* chore: use latest node and update actions

* chore: clean up unused information
2020-05-22 22:12:31 -04:00
Huáng Jùnliàng
dcd23c7949
chore: update test262 (#11590) 2020-05-21 08:20:10 -05:00
Henry Zhu
73ab27c11a
Update templates, add link to github discussions (#11585) [skip ci] 2020-05-18 15:28:16 -04:00
Huáng Jùnliàng
2f31ecf85d
fix: allow bigInt in method name and TSLiteralType (#11547)
* refactor: add isLiteralPropertyName to parser utils

* address review comments [skip-ci]

* refactor: keyword is valid identifierName

* fix: allow bigint in TSLiteralType

* update typescript test whitelist
2020-05-14 18:40:52 -04:00
Jason Quense
de8264c8a7
fix: don't elide jsx pragma import namespaces (#11523)
* fix: don't elide jsx pragma import namespaces

* use the correct pragma oops
2020-05-14 16:01:54 +02:00
Nikita Kirsanov
9a52019019
Use computed memberExpression for literal keys with object rest (#11550) 2020-05-12 22:56:03 +02:00
Nicolò Ribaudo
07347544fd
Downgrade rollup to 1.27.9 (#11538)
* Downgrade rollup to 1.27.9

* Add test
2020-05-11 23:53:04 -04:00
Nicolò Ribaudo
31b361b736
Use ?. where it represents the intended semantics (#11512) 2020-05-09 23:31:50 +02:00
Nicolò Ribaudo
aeb51f463c Do not remove "estree": null in ESLint tests 2020-05-09 22:12:28 +02:00
Justin Ridgewell
c3a5bf1ff5
Update preset-env tests, and add yarn.lock deps (#11537) 2020-05-08 23:53:09 +02:00
Justin Ridgewell
a080a1d345
Use single object spread call in loose mode (#11520) 2020-05-08 13:07:59 +02:00
Huáng Jùnliàng
b8a6145e50
fix: skip transform delete something.includes (#11530) 2020-05-07 06:50:59 -04:00
Henry Zhu
8aa5e574a0
Update issue template (#11524)
* Update Bug_report.md

* Update ci.json

[skip ci]
2020-05-05 21:13:05 +02:00
Arun Kumar Mohan
a8061ae7d8
logical-assignment: Do not assign names to anonymous functions (#11370) 2020-05-05 16:00:41 +02:00
Huáng Jùnliàng
812f3750c8
chore: pin windows node.js version (#11522) 2020-05-05 07:46:45 -05:00
Christoph Nakazawa
2bb2933dea
[helpers] Add a private function name within createSuper (#11514) 2020-05-04 23:30:53 +02:00
Nicolò Ribaudo
4d40bf646e
Update browserslist (#11517) 2020-05-04 15:48:02 -04:00
Huáng Jùnliàng
bdd5621ecd
chore: update babel deps (#11504) 2020-04-30 08:52:18 -05:00
Nicolò Ribaudo
90a9103e55
Update Flow to 0.123.0 (#11500) 2020-04-30 15:26:03 +02:00
Bogdan Savluk
96ccf56436
add support for getters and setters in generator for declare class statement (#11502) 2020-04-30 09:47:42 +02:00
Babel Bot
bb180eba9f Add v7.9.6 to CHANGELOG.md [skip ci] 2020-04-29 18:39:38 +00:00
Nicolò Ribaudo
9c2846bcac v7.9.6 2020-04-29 20:33:47 +02:00
Nicolò Ribaudo
7c80ed9598
Update compat table script (#11496)
* Update compat-data build script

* Update generated data

* Update fixtures

* Use older --shallow-since (the last commit has 04-17 as the date)
2020-04-28 16:14:43 -04:00
Huáng Jùnliàng
fa98a0a5b3
docs: update AST spec (#11492)
Co-Authored-By: Brian Ng <bng412@gmail.com>
2020-04-28 12:30:01 -04:00
Kai Cataldo
2d8edf7c6f
Add note about experimental nature of @babel/eslint-* packages (#11493)
[skip ci]
2020-04-28 07:28:04 +02:00
Chintan Acharya
93429f8b09
Fix helpers.unsupportedIterableToArray for Map and Set (#11495)
Fixes #11494
2020-04-28 07:27:03 +02:00
Nicolò Ribaudo
1b777f5266
Update preset-env fixtures (#11486) 2020-04-26 21:34:29 +02:00
Justin Ridgewell
c1d65d8842
Fix evaluation order with object spread, 2 (#11471) 2020-04-26 20:30:48 +02:00
Zen
83d365acb6
handle objectMethod in scope.isPure (#11482) 2020-04-25 18:34:52 +02:00
Justin Ridgewell
0bbf2da568
Super property eval order (#11480) 2020-04-25 18:34:07 +02:00
Huáng Jùnliàng
2e4f18ac92
Add some parser missing plugins errors (#11478)
* fix: do not throw invalid hash in tokenizer

* refactor: bigint has been enabled by default

* polish: add numeric separator missing plugin error

* fix: forward expectPlugin declaration
2020-04-25 10:26:39 +02:00
Jacob Dreesen
d05334bde2
Fix typo and remove outdated doc comment (#11472)
* Fix typo

* Fix outdated doc comment [skip ci]
2020-04-25 10:24:22 +02:00
Henry Zhu
e010db84aa
Canary build of packages using CodeSandbox CI + mini repl link per PR (#11479)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2020-04-24 18:19:57 -04:00
Zen
af669297ef
Fix evaluation order with object spread (#11412)
* Fix object spread runtime semantics

* limit this deoptimization

* optimize empty objects

* declare variables
2020-04-23 17:59:35 -04:00
Huáng Jùnliàng
5f299bab18
chore: test against node.js 14 (#11467) 2020-04-23 07:06:39 -04:00
Kevin Lau
9b716518ed
Throw error on TypeScript declare const enum (#11410)
Throw error on `const enum` even if it has `declare`.

Resolves: #10785
2020-04-23 11:27:19 +02:00
beraliv
a34424a894
Adding createFlowUnionType in place of createUnionTypeAnnotati… (#11448)
* 🔄 createUnionTypeAnnotation => createFlowUnionType

*  add createFlowUnionType if it exists (in new versions only ⚠️)

* 🔄 use createFlowUnionType for createUnionTypeAnnotation
2020-04-22 19:11:01 +02:00
Huáng Jùnliàng
928b9f8c95
chore: add node.js 14 support data (#11462) 2020-04-22 09:42:15 -05:00
Brian Ng
1a2f67191c
Update flow test whitelist (#11459) 2020-04-21 16:39:40 -05:00
Nicolò Ribaudo
d4c8db5177
Update babel-plugin-dynamic-import-node to 2.3.3 (#11458) 2020-04-21 21:26:33 +02:00
Brian Ng
40c517ed84
Set exprAllowed to false for star token (#11449) 2020-04-21 14:22:40 -05:00
Huáng Jùnliàng
fba64d439d
fix: disallow expression after binding identifier of (#11355) 2020-04-21 15:12:23 -04:00
Huáng Jùnliàng
d18d465cf3
remove < x.y.z engines specification (#11456)
* chore: remove lt engines specification

* remove unecessary yarn update
2020-04-21 21:02:27 +02:00
Nicolò Ribaudo
5b8477e969
Update dynamic import (#11453)
* Update babel-plugin-proposal-dynamic-import fixture test outputs

* Update package.json files

Co-authored-by: Arun Kumar Mohan <arunmohandm@gmail.com>
2020-04-21 12:12:54 +02:00
Huáng Jùnliàng
53008803fb
Update compat data (#11450)
* chore: update compat-data

* refactor: use Set for proposalPlugins
2020-04-21 11:37:47 +02:00
Arun Kumar Mohan
7e6839f42b
refactor(babel-node): Refactor babel-node tests configuration (#11440) 2020-04-20 16:03:58 -04:00
Nicolò Ribaudo
1a08aa5adc
Update failing fixtures (#11447) 2020-04-20 18:06:08 +02:00
Justin Ridgewell
d6efed5b22
Fix redeclaring private in nested class's superClass (#11424)
If a nested class's `superClass` redeclares the outer class's private field and access it in a computed key, that should fail.

Follow up to #11405.
2020-04-20 16:54:14 +02:00
Huáng Jùnliàng
0aa5a47196
chore: remove included proposal plugins (#11433) 2020-04-16 21:14:46 +02:00
Huáng Jùnliàng
1c0970131e
polish: recommend preset for js extensions (#11421) 2020-04-16 21:13:57 +02:00
Nicolò Ribaudo
d9eb94327a
Don't include "resolve" in @babel/standalone (#11432)
* Don't include "resolve" in @babel/standalone

* Also alias src
2020-04-16 20:19:22 +02:00
beraliv
6b8f6ab2de
transform-spread: create TS types (not Flow) when using TS (#11378)
*  add test fixture

*  add removeTypeDuplicates for typescript

*  add createTSUnionType for typescript

* 💊 fix ConditionalExpression for typescript

* 💊 fix ConditionalExpression

* 💊 fix added test case

*  add new line at the end of the file

* 💊 types.every(f) => f(types[0])

* 🔄 bug => foo

*  add TSBaseType

*  add conditions NOT to break backward compatibility
2020-04-15 21:47:28 +02:00
Huáng Jùnliàng
c85aafdff6
chore: upgrade @babel/* deps (#11422)
* chore: upgrade @babel/* deps

* chore: run build-bundle-ci before check-compat-data
2020-04-15 16:57:22 +02:00
Justin Ridgewell
9b48a8ead7
Fix nested classes reference private fields (#11405)
* Fix nested classes reference private fields

* Process only visible private fields when redeclaring

* Comments

* Skip class traversal if there are no private fields

* Handle redeclared private field in computed key
2020-04-14 21:51:51 +02:00
Henry Zhu
aaced0156d
contributing.md updates [skip ci] (#11403)
* contributing.md updates [skip ci]

* [skip ci]

* Update CONTRIBUTING.md

* Update CONTRIBUTING.md

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

* Use Yarn > 1

Co-authored-by: Brian Ng <bng412@gmail.com>
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2020-04-14 15:27:15 +02:00
Huáng Jùnliàng
a466f9c310
fix: report missing plugins on type exports (#11417)
* fix: report missing plugins on type exports

* nit refactors

* Update packages/babel-parser/src/parser/statement.js [skip ci]
2020-04-14 15:23:54 +02:00
Justin Ridgewell
070ec201bb
Speed up the createSuper helper (#11401) 2020-04-10 16:00:20 +02:00
Huáng Jùnliàng
88b12e3dd1
fix: add classPrivateProperties and classPrivateMethods to missing plugin helper (#11397)
* fix: add classPrivateProperties and classPrivateMethods to missing plugin helper

* make flow happy
2020-04-09 19:41:14 -04:00
Nicolò Ribaudo
cab1e79ba7
Update browserslist (#11398) 2020-04-09 22:51:28 +02:00
Huáng Jùnliàng
eb6d5c6a80
chore: update stage preset in babel-standalone (#11395) 2020-04-09 20:55:29 +02:00
Huáng Jùnliàng
8b976b0670
fix: do not push new token context when function is following dot/questionDot (#11388)
* fix: do not push new token context when function is following dot/questionDot

* more cautiously poping context
2020-04-08 10:10:36 -04:00
johannes
fbcb251d61
fix: replace backslashes with forward slashes from resolved pa… (#11366)
* fix: replace backslashes with forward slashes from resolved path for windows environments

* add test for resolveAbsoluteRuntime under windows
2020-04-08 15:36:55 +02:00
Nicolò Ribaudo
ce6cc4eb55
Unify parens printing for postfix-like expressions (#11382)
* Unify parens printing for postfix exprs: (), [...], !

* Also move template tags handling

* Add tagged template test

* isPostfixExpression -> hasPostfixPart
2020-04-07 21:36:35 +02:00
Babel Bot
b04ddff853 Add v7.9.5 to CHANGELOG.md [skip ci] 2020-04-07 19:27:45 +00:00
Nicolò Ribaudo
5b97e77e03 v7.9.5 2020-04-07 21:15:23 +02:00
Vedant Roy
aea0fcd599
Correctly transpile when cross-param refs with obj rest (#11326)
* Transform initializers with ids in rest elements

Fix issue 11281. Transform parameters with default initializers that
have ids that are also in a parameter with a rest element.
Before, these parameters were not transformed.

* Add plugin-transform-parameters as dependency

* Remove outdated comment

* Use set instead of array for paramsWithRestElement

* Skip when encounter "Scope"

Previously, f({...R}, f = R => R) would be incorrectly transformed.

* Pass in loose mode option instead of false

* Address review and re-organize tests

Checking the RHS of an assignment pattern/checking the parent of
an identifier node fails on cases like "({...R}, a = f(R))" or
"({...R}, {[R.key]: a = 42})".

Also refactor tests by removing unecessary tests and
separating "should transform" from "should not transform" tests.
2020-04-07 21:06:43 +02:00
Mateusz Burzyński
70cc111b35
Fixed generateUid creating clashing ids after scope re-crawling (#11375) 2020-04-07 17:32:46 +02:00
Zen
ca096c56aa
fix Incorrect destructuring compilation of `for (let [[x] = [1… (#11360) 2020-04-07 10:10:21 -05:00
Nicolò Ribaudo
e3ad798a24
Remove unnecessary test file (#11383)
bigInts are enabled by default
2020-04-05 22:18:59 -04:00
Nicolò Ribaudo
65d09e46a0
Don't check type annotations when deciding params scope (#11349)
* Don't check type annotations when deciding params scope

* Also type params
2020-04-05 23:43:20 +02:00
Mateusz Burzyński
aeebc08234
Simplify scope.hasReferences implementation (#11368) 2020-04-04 00:44:44 +02:00
Brian Ng
051fc0a791
Bump handlebars dep (#11374) 2020-04-03 21:41:48 +02:00
Jovica Markoski
40db926170
Fixed useBuiltIns and modules validation when using 'false' as option (#11373)
* Fixed useBuiltIns and modules validation when using 'false' as option

* Added tests for 'validateUseBuiltInsOptions' and for 'validateModulesOption' when input is 'false'

Co-authored-by: Jovica Markoski <jovica@upshiftwork.com>
2020-04-03 15:41:32 -04:00
Nicolò Ribaudo
2c31587aa1
Fix createSuper in Babel <7.5.5 (#11341)
* Fix createSuper in Babel <7.5.5

In Babel <7.5.5, addHelper only throws when called for the first time.
This was fixed by babel/babel#10208, but since we are already adding
a workaround for <7.9.0, we may as well fix <7.5.5

* Use 7.0.0 in "babel-old-version" test
2020-04-02 17:52:50 +02:00
Huáng Jùnliàng
c3042cfd27
fix: don’t add function name when operator is not = (#11361) 2020-04-02 11:12:13 -04:00
Luna Ruan
94447135c7
fix auto import error with whitespace JSXText (#11354) 2020-04-02 00:29:27 +02:00
Huáng Jùnliàng
df819a060c
fix: allow logical assignment operators in AssignmentExpression (#11359) 2020-04-01 18:09:46 -04:00
Nicolò Ribaudo
67609a1232
Don't call createSuper in loose mode (it was unused) (#11358)
* Don't call `createSuper` in loose mode (it was unused)

* Update fixtures
2020-04-01 23:08:21 +02:00
Nicolò Ribaudo
548cb3ee89
Fix e2e publish test when branching from an older version (#11347)
* Fix e2e publish test when branching from an older version

* Fix

* Fix

* Fix
2020-03-30 12:55:52 -04:00
Nicolò Ribaudo
c8a8be7221
Set correct async/generator in IIFE for params (#11346)
* Set correct async/generator in IIFE for params

* Reject in async params

* Skip async test on node 6 (it doesn't support async fns)
2020-03-29 22:01:15 +02:00
Oliver Dunk
71e7a7b1e0
Ignore abstract methods when decorating class (#11345)
* Ignore abstract methods when decorating class

* Address Nico's feedback

* Add input/output test

* Update test output to account for _nonIterableRest changes
2020-03-29 00:17:29 +01:00
Huáng Jùnliàng
6a00cbe0ab
fix: isIdentifierName should reject empty string (#11339) 2020-03-26 21:54:50 +01:00
Huáng Jùnliàng
a901bd50b1
chore: remove unused graceful-fs (#11329) 2020-03-25 09:13:44 -05:00
Huáng Jùnliàng
8e7ef30968
polish: align optional chain whitespace behavior to their sibiling (#11328) 2020-03-24 15:52:36 -04:00
Mateusz Burzyński
025e4ae44c
Fixed issue with programPath.scope.references not being regist… (#11323) 2020-03-24 16:27:32 +01:00
Babel Bot
46f31460d6 Add v7.9.4 to CHANGELOG.md [skip ci] 2020-03-24 08:32:30 +00:00
Nicolò Ribaudo
d3cf5fb5f4 v7.9.4 2020-03-24 09:26:12 +01:00
Kai Cataldo
4e6c9c52ef
fix: token after strict mode block is evaluated in strict mode (#11186) 2020-03-24 08:38:02 +01:00
Huáng Jùnliàng
146ea4176e
fix: check parenthesis between optional chain and other types (#11325) 2020-03-24 08:28:47 +01:00
Huáng Jùnliàng
dc7c5640e9
Compact parser fixture loc info (#11322)
* chore: compact loc information in parser fixtures

* chore: update test fixtures
2020-03-23 20:10:29 -04:00
Brian Ng
6a728a05a8
Restore default pragmas in preset-react for classic runtime (#11324) 2020-03-24 00:06:44 +01:00
Nicolò Ribaudo
9b976b2164
Test Babel compiled using an old version of @babel/core (#11319)
* Test Babel compiled using an old version of @babel/core

This should catch regressions where we use a new helper without a fallback
for older versions, or when we use a new @babel/traverse method.

* Enable the test
2020-03-23 22:42:40 +01:00
Nicolò Ribaudo
d23f0ae0ec
Add regression tests for regenerator (#10223)
* Add regression tests for regenerator

* Update tests
2020-03-23 20:49:59 +01:00
Vlad Rindevich
2f549886e4
[preset-typescript] Fix private members type annotations (#11315) 2020-03-23 19:33:16 +01:00
Babel Bot
296d8ce179 Add v7.9.3 to CHANGELOG.md [skip ci] 2020-03-22 11:07:26 +00:00
Nicolò Ribaudo
1ae85560a7 v7.9.3 2020-03-22 11:57:58 +01:00
Nicolò Ribaudo
ceb54dd756
Define default value for vars shadowing params (#11307)
* Define default value for vars shadowing params

* Remove from package.json

* Only convert traverse the params if needed

This prevents this plugin from running after the destructuring
transform, which causes #11256

* Review

* Review

* Update packages/babel-plugin-transform-parameters/src/params.js [skip ci]

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

Co-authored-by: Brian Ng <bng412@gmail.com>
2020-03-22 10:45:10 +01:00
Nicolò Ribaudo
b0315b81c7
Fix logic to insert parens in return statements with comments (#11306) 2020-03-21 20:53:38 +01:00
Huáng Jùnliàng
5b2c1f34d3
chore: fix build-babel exclude in gulpfile (#11293) 2020-03-21 19:39:22 +01:00
Vedant Roy
0e5c1da659
fix: async arrow functions should not be allowed after binary… (#11284)
* Forbid async arrow functions after binary operator.

This commit makes Babel throw an error when parsing
code like "3 + async() => 2".

* Make atPossibleAsync more accurate

* Change atPossibleAsync to atPossibleAsyncArrow

Add an extra test to atPossibleAsync and refactor it to
atPossibleAsyncArrow. This also fixes a bug in the Typescript plugin,
so a new test has been added.

* Add test for async arrow after unary operator
2020-03-21 19:38:36 +01:00
Babel Bot
a9b430b464 Add v7.9.2 to CHANGELOG.md [skip ci] 2020-03-21 14:15:41 +00:00
Nicolò Ribaudo
2399e0df23 v7.9.2 2020-03-21 14:57:31 +01:00
Nicolò Ribaudo
429dd2ce8a
Manually inline the createSuper helper on older Babel versions (#11298)
* Manually inline the createSuper helper on older Babel versions

* Forgot to commit this

* Add comments [skip ci]
2020-03-21 14:39:14 +01:00
Nicolò Ribaudo
3d8f48cb16
Don't use ES6 in the for-of helper (#11302) 2020-03-21 02:22:25 +01:00
Kai Cataldo
7ca814489a
fix: parse value imports named type as values (#11296)
* fix: parse value imports named type as values

* Address feedback

* Add plugin tests

* Add isContextual() check

* Remove importKind: value from extraneous nodes

* Ensure importKind is correct for more nodes

* Add additional test

* Address feedback

* Revert formatting

* Fix tests
2020-03-21 01:38:07 +01:00
Huáng Jùnliàng
469e8ed591
Transform cwd in string literal on win32 (#11297)
* chore: replace win32 cwd in string literal by <CWD>

* chore: update test fixtures
2020-03-20 23:59:02 +01:00
Babel Bot
ebca5807dc Add v7.9.1 to CHANGELOG.md [skip ci] 2020-03-20 21:55:02 +00:00
Nicolò Ribaudo
220ce702a1 v7.9.1 2020-03-20 22:47:03 +01:00
Nicolò Ribaudo
87b2781046
Consider jsxFrag as set when it's set to the default value (#11295)
* Consider jsxFrag as set when it's set to the default value

* Test #11294
2020-03-20 22:29:50 +01:00
Babel Bot
bb6a1580d2 Add v7.9.0 to CHANGELOG.md [skip ci] 2020-03-20 15:40:03 +00:00
Nicolò Ribaudo
8d5e422be2 v7.9.0 2020-03-20 16:32:55 +01:00
Huáng Jùnliàng
e39b508030
Add @babel/helper-validator-identifier (#11289)
* refactor: replace esutils.keywords.isIdentifierNameES6 by helper-validator-identifier

* refactor: replace esutils isReservedWordES6 by isKeyword || isReservedWord

* address review comments

* chore: specify both “main” and “exports”

* build helper-validator-identifier before babel-types
2020-03-20 12:23:14 +01:00
Oliver Dunk
693a5df7a9
Memoize call expressions in optional chains in loose mode (#11261)
* Memoize in loose mode when callee is a CallExpression

* Handle more complex OptionalCallExpressions where memoization is needed

* Convert calls to Function#call when member needs memoization

* Only update call context for member expressions
2020-03-20 08:59:03 +01:00
Nicolò Ribaudo
2e6f9583ca
Pass the correct this to JSX's __self with the old plugin (#11290) 2020-03-19 23:26:05 +01:00
Nicolò Ribaudo
11292a3c74
Use the correct this in __self for JSX elements in arrows (#11288)
* Inject `__source` and `__self` in JSX elements earlier

This fixes an issue where `this` was not correct inside arrow functions, similar to
906f8be24d

* Add test

* Remove try-catch

* Update error

* Update fixtures

* Update windows fixtures
2020-03-19 20:01:17 +01:00
Huáng Jùnliàng
0a02a12235
Move object-rest-spread after transform-parameters (#11280)
* fix: move proposal-object-rest-spread after transform-parameters

* update test fixtures

* fix: update plugin-features.js
2020-03-19 17:08:54 +01:00
Nicolò Ribaudo
f3912ac08f
Mark transpiled JSX elements as pure (#11126)
* Mark transpiled JSX elements as pure

* Avoid duble annotation

* Add "pure" option to the React preset

* Fix generator indentation

* Update tests

* Add tests for the "pure" option

* Update windows fixtures
2020-03-19 15:43:54 +01:00
Nicolò Ribaudo
fa7ec81771
Allow for-of on polyfilled or builtin iterables without Symbol support (#11285) 2020-03-19 11:02:12 +01:00
Nicolò Ribaudo
6f932978f8
Add for-of fallback for arrays in browsers without symbol supp… (#11263)
* Add for-of fallback for arrays in browsers without symbol support

* Update after rebase

* Re-throw error when iterating array

* Update fixture
2020-03-19 02:17:41 +01:00
Huáng Jùnliàng
d60802bf73
fix: object-rest-spread should not transform array rest (#11282) 2020-03-18 20:55:38 -04:00
Guy Bedford
375847b671
fix: ensure explicit file extensions in "exports" (#11283) 2020-03-19 00:23:02 +01:00
Andrew Neitsch
6892d51472
Add path separator to @babel/register sourceRoot (#11249) 2020-03-18 22:34:19 +01:00
Nicolò Ribaudo
78ace99615
Silence dynamic import() warnings in tests (#11279) 2020-03-18 15:42:19 +01:00
Brian Ng
f405cd809c
Update compat-data (#11277) 2020-03-18 10:24:14 +01:00
Huáng Jùnliàng
48d53f8fef
chore: bump json5 and minimist (#11276)
* chore: bump json5 and minimist

* update mkdirp to version 0.5.3
2020-03-18 10:21:22 +01:00
Huáng Jùnliàng
4bf36e64da
Create File class for babel helpers (#10575)
* add test

* fix: pass File to helper traverser

* pass babel.File to helpers.ensure
2020-03-17 09:58:46 +01:00
Luna Ruan
748897be07
Add experimental version of the `babel-plugin-transform-react-… (#11154)
* add next option for babel-plugin-transform-react-jsx

* address review comments

* chore: update test fixtures

* Update fixture

* Add "columnNumber" to the new React transform

* Update windows fixtures

* Delete unused output.js

* Update windows tests

* Fix windows again

* fix comments

Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
Co-authored-by: Moti Zilberman <motiz88@gmail.com>
2020-03-17 09:16:53 +01:00
Nicolò Ribaudo
10aa97bc10
Allow rest/spread on polyfilled or builtin iterables without Symbol support (#11268)
* Allow rest/spread on polyfilled or builtin iterables when `Symbol` unsupported

Currently, when `Symbol` is not supported, we allow using rest/spread with:
- arrays
- strings
- arguments

With this PR, it will be also possible to use it with
- maps
- sets
- binary arrays

While in old browsers es6 builtins would still need to be polyfilled, it's way
easier to polyfill them because `Symbol` cannot be reliably polyfilled.

I didn't use `instanceof` becase:
- it doesn't work with polyfills not attatched to the global scope
- when using Babel to load polyfills, it would force the inclusion of `Map` and `Set` polyfills even if they are not used

Downside: the current approach of relying on `toString || construcor.name` doesn't work with subclasses.

* Don't use Array.from for array-like objects
2020-03-17 08:14:05 +01:00
Huáng Jùnliàng
841f4428e8
Rephrase parser error message (#11208)
* refactor: rephrase some parser error messages

* update test fixtures

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

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

* address review comments

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

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

* update test fixtures

Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
Co-authored-by: Brian Ng <bng412@gmail.com>
2020-03-16 21:48:32 -04:00
Nicolò Ribaudo
8e7ca22ed7
Create Npm_error.md issue template (#11217)
[skip ci]
2020-03-17 02:38:00 +01:00
Justin Ridgewell
56500603da
Add stricter Optional Chain node validation (#11250)
* Add stricter Optional Chain node validation

Optional chains cannot start with `optional: false`. Somewhere in the `object`/`callee` tree, there must be an optional with `optional: true`.

* Print current node's type when finding an error.
2020-03-17 02:17:11 +01:00
Nicolò Ribaudo
59976680df
Extract for-of iterator handling to a helper (#11262)
* Extract for-of iterator handling to a helper

Dis greatly recudes the code size when for-of is used multiple times across the
codebase. Also, makes it easier to read what's happening in a compiled loop.

* Unify spec and loose code

* Legacy implementation fallback

* Update tmp var name

* Updates from review and after rebase
2020-03-17 00:45:34 +01:00
Nicolò Ribaudo
a11855e586
Include preset modules (#11083)
* Prepare preset-env and compat-data for preset-modules

* Add transform-edge-default-parameters from preset-modules

* AUtomatically generate data from compat-table

* Add compat data for other plugins

* Updates after rebase

* Add more bugfixes to preset-env

* Update tests

* Add bugfix/transform-safari-for-shadowing

* Fix build script

* bugfix/transform-safari-block-shadowing

* Fix flow

* Include changes from 7127330f02b423d9cb0555b3d2a24dbccbc149b5

* Fix check-compat-data
2020-03-17 00:36:29 +01:00
Nicolò Ribaudo
f6c7bf36ce
Allow extending untranspiled classes (#8656) 2020-03-16 23:59:15 +01:00
Nicolò Ribaudo
a875560c31
Allow defining the moduleIds-related option in the transform p… (#11194)
* Update "moduleIds" tests

* Allow defining the moduleIds related options in the transform plugins

- moduleIds
- moduleId
- getModuleId
- moduleRoot

* Sort deps
2020-03-16 23:58:04 +01:00
Rick Button
3ce7c2e394
Added support for record and tuple syntax. (#10865)
* Added support for record and tuple syntax.

This commit adds support for both the hash #{} and bar {||}
syntaxes to babel-parser, as well as adds the supporting
babel-plugin-syntax-record-and-tuple plugin to enable support
for the syntax. Does not include any transform for records and
tuples.

* typo

* added check to ensure recordAndTuple in babel-parser

* switched to syntaxType option instead of explicit entries for each record and tuple type

* switched to using recordAndTupleSyntaxType for generator options instead of adding to node

* added tests for generator option recordAndTupleSyntaxType

* added test for record and tuple bar syntax with flow typings

* added tests for invalid/missing recordAndTuple syntaxType parser option

* fixed flowcheck errors

* fix merge with class privates in tokenizer

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

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

* improved recordAndTuple generator error message, added tests for invalid,missing options

* updated error messages for invalid parser syntaxType option

* updated error message

* added better error messages for when the recordAndTuple syntaxType is doesn't match the syntax used

* updated record and tuple support to use new error message templates

* added recordAndTuple to missing plugin helpers

* Fix linting

Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2020-03-16 23:57:44 +01:00
Ye Wei
e06bf8ffdb
Add numeric separator to shippedProposals (#10971)
* add plugins

* add plugin description

* run build-data

* set shipped proposals true

* update test fixtures

* corejs.proposals should not imply shipped proposals

* fix eslint errors
Please enter the commit message for your changes. Lines starting

* create new object in packages/babel-compat-data/scripts/data/plugin-features.js
2020-03-16 23:09:33 +01:00
Nicolò Ribaudo
5c1a8210da
Implement support for declare on class fields with Flow (#11178)
* Add parser support for Flow declare fields

* Add generator test

* Add "allowDeclareFields" option to flow-strip-types

* Add test

* Update error messages

* More tests
2020-03-16 23:08:26 +01:00
Taym Haddadi
286aaeadd9
Add cloneDeepWithoutLoc (#10680)
* feat: add cloneDeepWithoutLoc

* fix: sort functions alphabetically

* doc: add documentation for the withoutLoc parameter

* test: add a test for  shallow cloneWithoutLoc

* test: add loc object to node and fix test

* fix: set loc object on deeper node

* test: check loc on deeper node is null

* doc: adjust withoutLoc documentation

* fix: add withoutLoc param to deep clones

* fix: apply cloneIfNodeOrArray for leadingComments, innerComments and trailingComments

* test: add test for leadingComments, innerComments and trailingComments

* Cleanup PR

Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2020-03-16 23:07:01 +01:00
Siddhant N Trivedi
f232d4d109
Added jsescOptions to Numeric Literals (#11028)
* Added jsescOptions to Numeric Literals

* Added tests and hexadecimal opts to NumericLiterals

* Fixed the bug of every numeric literal being coverted to hex

* Added conditions when jsesc should be applied

* Removed numbers and lowercaseHex from format object

* Added newline to test of jsonEscape (to exclude the change)

* Modified conditions to apply jsesc

* Made the required changes.

* Using node.value instead of value
2020-03-16 23:06:32 +01:00
Brian Ng
4f394e30d2
Add support for flow's SymbolTypeAnnotation (#11077) 2020-03-16 23:00:17 +01:00
Nicolò Ribaudo
2bce1e5e20
Parse BigInts by default (#11117) 2020-03-16 22:59:45 +01:00
Moti Zilberman
1971b7e87d
feat(react-jsx-source): add columnNumber property (#11139)
* feat(react-jsx-source): add column property

This will be useful to tools that consume the injected `__source` prop, allowing precise source locations to be displayed.

* Rename column -> columnNumber, make 1-based
2020-03-16 22:59:22 +01:00
Nicolò Ribaudo
740260b236
Add import type and export type support to TypeScript (#11171)
* Add support for type only imports in TS (#11053)
* Implement "export type {}" (#11122)
* Add "exportKind: type" when needed with TS (#11157)
* Add `onlyRemoveTypeImports` option to `transform-typescript` (#11173)
* Add onlyRemoveTypeImports to preset-typescript (#11179)

Co-authored-by: Brian Ng <bng412@gmail.com>
Co-authored-by: Raja Sekar <rajasekarm.dev@gmail.com>
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
Co-authored-by: Kai Cataldo <kai@kaicataldo.com>
Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
Co-authored-by: Henry Zhu <smiley.we@gmail.com>
Co-authored-by: Siddhant N Trivedi <sidntrivedi012@gmail.com>
2020-03-16 22:58:51 +01:00
Brian Ng
20d9a10186
Add estree parsing support for export * as A (#11254) 2020-03-16 22:52:33 +01:00
Huáng Jùnliàng
4a4845585c
feat: align ID_Start/ID_Continue regex to Unicode 13.0.0 (#11246) 2020-03-16 22:52:08 +01:00
Arun Kumar Mohan
84a9ea455b
Allow await when it is not in AsyncArrowHead (#11148) 2020-03-16 22:26:48 +01:00
Nicolò Ribaudo
1ba41f2084
Throw better errors for non-iterables when Symbol doesn't exist (#11264) 2020-03-16 16:34:33 +01:00
Justin Ridgewell
10058901d0
Update Purish aliases (#11267)
* Update Purish aliases

- Adds `Purish` to `RegexLiteral`, since it can't cause any side-effects.
- Removes `Purish` from `ClassExpression` and `ClassDeclaration`, since they can be impure with static class fields.

* Update types
2020-03-16 16:30:38 +01:00
Carlos Lopez
7b9bc7c28b
fix(rest-spread): Do not require Symbol.iterator for strings (#9794) 2020-03-15 14:54:44 +01:00
Justin Ridgewell
661ffbd830
Support more node types in generateUidBasedOnNode (#11260)
* Support more node types in generateUidBasedOnNode

* More nodes
2020-03-14 16:24:50 +01:00
Brian Ng
b85d9f57f6
Remove unused gulp-rename (#11259) 2020-03-14 12:02:00 +01:00
Justin Ridgewell
b1a589f0aa
Fix printing edge cases in Nullish Coalescing and Optional Ch… (#11255)
This is a mix of changes, most importantly:

- Always print parens when mixing nullish coalescing and another logical
- Fixes assignment in the callee of an optional chain, which now blocks #11248

Also, cleans up a bit of code, and removes an unnecessary parens around `class A extends new B {}`
2020-03-13 16:35:28 +01:00
Babel Bot
420f2ee69a Add v7.8.8 to CHANGELOG.md [skip ci] 2020-03-12 18:51:08 +00:00
Nicolò Ribaudo
c831a2450d v7.8.8 2020-03-12 19:44:17 +01:00
Huáng Jùnliàng
565ab9a3fc
fix: preserve shadowed for-loop declarators (#11242)
* fix: do not remove for-loop declarators

* fix: do not remove uninitialized var declarators in for init
2020-03-12 14:07:59 -04:00
Huáng Jùnliàng
dadd22e161
chore: update caniuse fixtrues (#11253) 2020-03-12 12:27:40 -04:00
Nicolò Ribaudo
d030793248
Add support for Unicode 13 in regexps (update regexpu-core) (#11244)
* Update regexpu-core

* Add tests
2020-03-11 23:24:02 +01:00
Nicolò Ribaudo
cbbf0bc6ac
Archive @babel/plugin-syntax-export-namespace-from (#11236)
* Archive @babel/plugin-syntax-export-namespace-from

Enabled by default in https://github.com/babel/babel/pull/10521

5ccc77e287

* Fix tests
2020-03-11 21:50:23 +01:00
Huáng Jùnliàng
f9d4b799b7
chore: pin @rollup/plugin-json to 4.0.1 (#11235) 2020-03-11 01:21:27 +01:00
Brian Ng
0616f06b00
Bump kind-of for audit (#11232) 2020-03-10 17:40:20 -04:00
Brian Ng
a82e7399ed
Bump rollup deps (#11233) 2020-03-10 17:40:08 -04:00
Huáng Jùnliàng
3cc833da14
chore: update acorn to latest patch (#11230) 2020-03-10 17:39:49 -04:00
Brian Ng
5ee1433c2a
Bump ESLint-related deps (#11228) 2020-03-10 15:48:03 -04:00
Sergey Melyukov
cb9d28c42c
Force parentheses around array and conditional infer (#11227) 2020-03-10 12:27:52 -04:00
Brian Ng
eb65195f09
Update @babel deps (#11225)
* Update @babel deps

* fixture
2020-03-10 12:27:13 -04:00
Kai Cataldo
2057d2b159
fix: non-directive "use strict" should not enable parsing in strict mode (#11188)
* fix: non-directive "use strict" should not enable parsing in strict mode

* Remove dead code

* Add stricter type annotations

* set oldStrict explicitly to null

* Fix error

* label callback argument

* update comment

* Address feedback

* Remove this.state.octalPosition

* Add additional tests

* Revert "Remove this.state.octalPosition"

This reverts commit bcc78c9530f8c840f85e86053b75efce662f34d1.

* Remove containsOctal

* Report multiple octal literals in single token

* Fix comments

* remove Array.prototype.flat()
2020-03-05 17:34:27 -05:00
Huáng Jùnliàng
e297e406ce
refactor: remove redundant contextDescription empty check (#11219) 2020-03-05 16:17:01 -05:00
Gerald
8cafd8f820 fix(transform-destructuring): update scope info after replacing 2020-03-05 21:23:50 +01:00
Huáng Jùnliàng
1011e58c6c
update: preset-env-fixtures (#11218)
Co-authored-by: Kai Cataldo <kai@kaicataldo.com>
2020-03-05 15:01:29 -05:00
Babel Bot
1e7ab24bb3 Add v7.8.7 to CHANGELOG.md [skip ci] 2020-03-05 01:56:31 +00:00
Nicolò Ribaudo
595f65f33b v7.8.7 2020-03-05 02:52:13 +01:00
Nicolò Ribaudo
7127330f02
Allow using preset-env with newer versions of compat-data (#11201)
* Use ~ for preset-env's @babel/compat-data dependency

* Revert "Use ~ for preset-env's @babel/compat-data dependency"

This reverts commit e7d57c7894095d381670cddfbbce06bd2a480a32.

* Allow using `preset-env` with newer versions of `compat-data`
2020-03-05 02:35:31 +01:00
Nicolò Ribaudo
a12001a0f9
chore: bump browserslist to version 4.9.1 (#11207) 2020-03-05 00:46:10 +01:00
Huáng Jùnliàng
21c9141872
Refactor: add parser message template (#11192)
* refactor: add raiseWithData method

* refactor: error message template

* fix missing plugin error structure

* fix flow errors

* refactor: use error message template in eslint plugin

* refacotr: use error message template in flow plugin

* refactor: use error message template in typescript plugin

* refactor: use error message template in jsx plugin

* address review comments

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

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

Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2020-03-03 14:06:05 -05:00
Nicolò Ribaudo
114f6726a7
Pass URLs to import() rather than paths (#11193)
* Pass URLs to import() rather than paths

* Make tests pass

* (╯°□°)╯︵ ┻━┻

* (╯°□°)╯︵ ┻━┻           (╯°□°)╯︵ ┻━┻             (╯°□°)╯︵ ┻━┻
2020-03-03 19:54:01 +01:00
vages
2603c2e227
fix(babel-parser): chain off optionally chained keys named cla… (#11198)
* fix(babel-parser): chain off optionally chained keys named class and function

Fixes #11197

* Extract override as variable to satisfy typechecker

Flow did not trust that curContext.override would be defined
2020-03-03 18:27:41 +01:00
Nicolò Ribaudo
8f281f578d
Bump regenerator (#11191) 2020-03-02 17:54:13 +01:00
Daryl Tan
9015fda3c1
Fix scope of function body when var redeclares param (#11158)
* Fix scope of function body when var redeclares param

* Fix empty var declarations

* Apply suggestions
2020-03-01 16:26:22 +01:00
Sagiv ben giat
a39beda58b
print parenthesis around forced calls of optional chains (#11190) 2020-02-28 18:43:43 -05:00
George Zahariev
9c261aeafe
Add "Statement" as alias to Flow enum declaration (#11184) 2020-02-28 09:24:25 +01:00
Nicolò Ribaudo
d13fd7c7bd Add .yarn/install-state.gz to .gitignore [skip ci] 2020-02-27 22:05:39 +01:00
Nicolò Ribaudo
9b16bf3bd2
Set correct version for @babel/eslint-plugin-development (#11181)
[skip ci]
2020-02-27 21:45:57 +01:00
James C. Davis
a5f63299eb
TypeScript: Preserve decorated definite class properties (#11129)
* test: update fixture with decorated definite class property

* fix: don't remove decorated definite class properties
2020-02-27 21:31:23 +01:00
Babel Bot
bb97823abd Add v7.8.6 to CHANGELOG.md [skip ci] 2020-02-27 12:21:40 +00:00
Nicolò Ribaudo
750d3dde3b v7.8.6 2020-02-27 13:17:19 +01:00
Huáng Jùnliàng
e9ea523c5b
replace gulp-watch by gulp.watch (#11175)
* chore: remove gulp-watch

* chore: update lock file
2020-02-26 18:08:28 -05:00
Nicolò Ribaudo
0018881f9d
Add missing dependencies (#11170) 2020-02-25 23:40:48 +01:00
Huáng Jùnliàng
afb0f489de
Enable more eslint recommended rules (#11168)
* chore: enable no-constant-condition

* chore: enable no-empty rule

* chore: enable no-unreachable

* chore: enable no-cond-assign

* chore: enable no-inner-declarations

* chore: remove disabled rules that are not in eslint:recommended

* fix: oops
2020-02-24 19:04:25 -05:00
MO
2d1bac9666
fix: search for browserslist if esmodules is falsy (#11124)
* fix: search for browserslist if esmodules is falsy

closes #11123

* fix: delete falsy targets.esmodules

* style: fix code style

* fix: remove esmodules after being consumed
2020-02-24 22:30:24 +01:00
Nicolò Ribaudo
a192c0fcd3 Update preset-env fixture 2020-02-24 22:29:03 +01:00
Huáng Jùnliàng
eaff9f837a
chore: migrate lock threads to github actions (#11163)
Co-Authored-By: Armin Sebastian <hi@armin.dev>

Co-authored-by: Armin Sebastian <github@armin.dev>
2020-02-22 11:18:52 +01:00
Huáng Jùnliàng
2ce7008173
chore: specify dependency rule of check-compat-data-ci (#11164) 2020-02-21 15:58:19 -05:00
Nicolò Ribaudo
4b045819b8
Mark wrapNativeSuper and wrapRegExp as pure (#11134) 2020-02-21 09:15:59 +01:00
Huáng Jùnliàng
a583eab41f
fix: workaround misleading ENOENT error (#11160) 2020-02-20 23:30:42 -05:00
Huáng Jùnliàng
223cee7246
Parse declare modifier around accessibility modifiers (#11146)
* fix: parse declare modifiers around accessibility modifiers

* test: add tests

* fix: check duplicate modifiers in modified nodes

* fix flow error
2020-02-20 23:29:47 -05:00
Kai Cataldo
3960f4de64
Breaking: align babel-eslint-parser & espree (#11137)
* Chore: align babel-eslint-parser & espree

* Start program at beginning of comment when no tokens exist

* Import correct version of Espree for tests

* Remove hasOwnProperty guard
2020-02-20 17:31:57 +01:00
Huáng Jùnliàng
1613418f9b
Update preset-env builtin-definitions (#10929)
* chore: build corejs3-proposals.json from core-js-compat

* fix: include finished proposals by default

* update test fixtures

* update test fixtures

* chore: rename scripts

* fix: add standarized entries for finished proposals

* refactor: remove unused finished proposals json

* revert test fixtures update

* test against corejs 3.6

* fix: move corejs builtin definitions to babel/compat-data
2020-02-17 19:30:53 +01:00
liuxingbaoyu
31b0506040
fix: @babel/traverse can't use path.remove() with noScope (#11136) 2020-02-14 12:19:32 -05:00
Nicolò Ribaudo
4cfbd64f6c
Add Yarn 2 files to .gitignore (#11143)
[skip ci]
2020-02-14 00:33:06 +01:00
Nicolò Ribaudo
d21e2217d5
Skip newlines around inline #__PURE__ annotations (#11133)
* Skip newlines around #__PURE__ annotations

* Update tests
2020-02-13 19:16:33 +01:00
Siddhant N Trivedi
3c6a8ae200
Fix rewriteThis in helper-module-transforms for computed class… (#11109)
* Fix rewriteThis in helper-module-transforms for computed class elements

* Added test file and corrected the visitor

* Revert .gitignore

* Using skipAllButComputedKey method from plugin-replace-supers

* added tests for class methods

* Added tests for both class properties and methods and fixed skipping computed key for methods

* Fixed condition for class methods

* revised the conditions for class methods

* Added more tests and used else-if in classmethod condition

* Update packages/babel-helper-replace-supers/src/index.js

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

Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2020-02-12 21:19:10 +01:00
Siddhant N Trivedi
3fc904e1d4
Fix classNameTDZError in computed prototype methods with class fields (#11068)
* Draft fix for TDZError in computed prototype methods

* Added tests for loose:false and also extracted handleClassTDZ

* Added state parameter to handleClassTDZ function

* Extracted the state object to a variable

* Added helper comments for environmentVisitor

* Added else condition to traverse computed Path

* Cached computed path key into a variable
2020-02-12 11:55:38 +01:00
Brian Ng
157bb6e831
Fix typing of ReplaceSupers options (#11121)
* Fix type opts.getObjetRef to opts.getObjectRef

* Added // @flow to possibly catch for more errors.

* tweaks

Co-authored-by: InsignificantReasons <41794038+InsignificantReasons@users.noreply.github.com>
2020-02-11 10:55:46 +01:00
Martin Forsgren
bc308a1b15
Respect preserveComments option in tempate.ast() (#11112) 2020-02-11 10:34:21 +01:00
Daryl Tan
3907396bd8
Allow redeclaration of loop variable in body (#11088) 2020-02-11 10:19:03 +01:00
Huáng Jùnliàng
865d5155c2
Add eslint-plugin-jest (#11119)
* chore: add eslint-plugin-jest

* chore: update test sources

* chore: suppress preset-env debug log when linting
2020-02-11 00:11:32 +09:00
Nicolò Ribaudo
a4d5c6253e
Update preset-env fixtures (#11120) 2020-02-10 23:32:31 +09:00
Huáng Jùnliàng
df78258765 chore: use npm install in babel-test262-runner setup (#11113)
* chore: use npm i on babel-test262-runner

* chore: use npm ci
2020-02-10 07:53:44 +01:00
Huáng Jùnliàng
38529699d6
Refactor await/yield production parameter tracking (#10956)
* test: add test fixtures

* refactor: track AWAIT and YIELD in separate handler

* fix flow errors

* add flow type annotation to production-parameter

* address review comments

* refactor: track [Return] parameter
2020-02-09 15:31:29 +01:00
Nicolò Ribaudo
8ab27c8ffe Wrap type-only class fields in flow comments (#11096)
* Wrap type-only class fields in flow comments

* Fix
2020-02-09 11:45:42 +01:00
Vedant Roy
dadba01249 Fix export bindings not updated by 'for...in' and 'for...of' (#11074)
* Correctly transpile export bindings for some for-of loops

* Correctly transform non-destructured for of loops to update exported variables

* Add tests

* Don't replace entire for of loop

* Correctly transform destructured for-of/for-in exports

* Update exported variables in array pattern and more fixes

* Refresh test output

* Update tests and rebase on master

* Refactor ForOf|ForIn visitor

* Don't transform re-declared exported vars

* Generate better name for loop id

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

* Idiomatically generate UidIdentifier

* Update scope after replacing loop declaration

Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2020-02-09 11:41:29 +01:00
Kai Cataldo
5aa368cec1
Centralize @babel/eslint-* tests (#11106)
* Centralize @babel/eslint-* tests

* Enable linting of @babel/eslint-* test files

* Add missing sourceType
2020-02-08 10:04:49 -05:00
Huáng Jùnliàng
1599e9025d
fix: specify sourceFileName when generating inline sourcemaps (#10797) 2020-02-07 22:42:18 +01:00
Huáng Jùnliàng
0b3dea8f54
Turn on no-fallthrough rule (#11093)
* chore: turn on no-fallthrough

* chore: fix no-fallthrough errors
2020-02-07 22:05:19 +01:00
Nicolò Ribaudo
5e58903250
Remove stage presets from the monorepo (#11101)
babel/babel-archive already includes the last working version of these presets (v7.0.0-beta.52), and they have been throwing since 7.0.0
2020-02-06 18:02:59 +01:00
Nicolò Ribaudo
755ec192e2
Archive @babel/preset-env-standalone (#10993)
* Move @babel/preset-env-standalone to babel-archive

babel/babel-archive@a1fadd2d77

* Move tests to @babel/standalone

* Remove references in build scripts

* Update lockfile

* Delete duplicated test file.

It's already in babel-standalone/test/babel.js
2020-02-06 01:03:36 +01:00
Jacob Williams
761563571c
Make isReferenced return false for method parameter name (#11089)
* Change isReferenced to return false for object/class method parameter names.

* use indexOf instead of for-of loop

* replace `.indexOf` check with `.includes` and assume `parent.params` exists

Co-Authored-By: Justin Ridgewell <justin@ridgewell.name>

* check .params within case block for ClassMethod/ClassPrivateMethod/ObjectMethod only

* add comment clarifying that case clause fall-through is intentional

Co-authored-by: Justin Ridgewell <justin@ridgewell.name>
2020-02-06 00:59:16 +01:00
Nicolò Ribaudo
0ae61f060a
Update fixtures again (#11094) 2020-02-04 23:09:38 +01:00
Liam Doran
11d9826e77
Fix Async Generic After Await Parsing Error (#11092)
* test: add test case

* fix: reset awaitPos before parsing generic arrow fn

* fix: maybeInArrowParameters reset to true
2020-02-04 23:06:04 +01:00
Nicolò Ribaudo
636c1dc86d
Only download compat-table if it's not already downloaded (#11081)
* Only download compat-table if it's not already downloaded

* Use git rev-parse
2020-02-04 22:39:15 +01:00
Nicolò Ribaudo
bd1daa756e
Update fixtures after browserslist release (#11091) 2020-02-04 09:19:14 +01:00
Brian Ng
779f00b8e9
Update @babel deps (#11072) 2020-02-01 01:00:47 +01:00
Kai Cataldo
f987821099
Clean babel-eslint-*/**/lib (#11070) 2020-01-31 20:49:27 +01:00
Nicolò Ribaudo
4070b7a7f6 Update changelog [skip ci] 2020-01-31 19:59:51 +01:00
Babel Bot
011f11c1de Add v7.8.5 to CHANGELOG.md [skip ci] 2020-01-31 18:53:09 +00:00
Nicolò Ribaudo
11641b5f70 v7.8.5 2020-01-31 19:43:51 +01:00
Daniel Tschinder
7ee98363df
Do not publish build directory of compat-data (#11078) [skip ci] 2020-01-31 19:40:50 +01:00
Kai Cataldo
66721eaa0e
Further refactoring of @babel/eslint-parser (#11071) 2020-01-31 00:07:26 +01:00
Nicolò Ribaudo
d57b9aabdd
Update CHANGELOG.md [skip ci] 2020-01-30 13:49:20 +01:00
Nicolò Ribaudo
8b13513daa
Update CHANGELOG.md [skip ci] 2020-01-30 13:47:56 +01:00
Babel Bot
32de1ac97b Add v7.8.4 to CHANGELOG.md [skip ci] 2020-01-30 12:21:40 +00:00
Nicolò Ribaudo
5c2e6bc07f v7.8.4 2020-01-30 13:18:09 +01:00
Nicolò Ribaudo
92c6807ae8
[@babel/cli] Copy ignored files by default (#11063)
This commit restores the pre-7.8.0 behavior of the --copy-files option, by making
--copy-ignored default to true when --copy-files is enabled.
2020-01-30 13:01:04 +01:00
Daniel Tschinder
1528d7d2d3
Fix core-js 2 builtin data for opera (#11066) 2020-01-29 18:14:26 +01:00
Tan Li Hau
3e21a09da3 feat: support node 6 for levenary (#11059) 2020-01-28 06:57:35 +01:00
Nicolò Ribaudo
eae6211258
Update compat table (#11039)
* Fix compat-data build script

* Update compat table

* Update mappings for transform-parameters

kangax/compat-table#1570

* Update unrelated fixture

* Update
2020-01-27 22:23:27 +01:00
Nicolò Ribaudo
916429b516
Avoid compiling the _typeof helper with itself (#11049)
* Avoid compiling the typeof helper with itself

* Update fixtures
2020-01-27 22:02:34 +01:00
Pavel Pustovalov
d0518b7566 Update browserslist (#11058) 2020-01-27 21:54:18 +01:00
Nicolò Ribaudo
2e5594d562 Update failing tests after last merged PR 2020-01-24 23:07:34 +01:00
Nicolò Ribaudo
ed47d2e89a
Delete duplicated file in @babel/compat-data (#11041)
This file is the same as `native-modules.json`, which is exported in package.json
2020-01-24 22:45:37 +01:00
Huáng Jùnliàng
b54a946048 chore: map mobile browser data to their desktop version (#10814)
* chore: map mobile browser data to their desktop version

* chore: skip android until upstream support is resolved

* Revert "chore: skip android until upstream support is resolved"

This reverts commit 436e9af8297b284a426b5a3240e2a550a20fca86.

* Update fixtures

Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2020-01-24 22:40:11 +01:00
Nicolò Ribaudo
1815c34987
Update preset-env fixtures (#11040) 2020-01-21 22:46:49 +01:00
Huáng Jùnliàng
fa975bf7cd polish: throw human-friendly error when item-option pair is in… (#10969)
* polish: throw human-friendly error when item-option pair is incorrectly unwrapped

* add testcase for plugin

* fix: exclude false positive

* fix: validate should support plugin optionsSourceKind

* Revert "fix: validate should support plugin optionsSourceKind"

* fix: validate plugin object in assertNoUnwrappedItemOptionPairs

* fix flow error

* update test fixtures

* refactor: move to loadDescriptor catch clause

* chore: throw Error instead of builtin ReferenceError

* fix flow errors

* chore: add more test cases
2020-01-20 21:05:07 +01:00
Huáng Jùnliàng
43b23e0869 refactor: simplify toAssignable routine (#11032)
* refactor: remove isBinding parameter

* remove unused contextDescription

* refactor: remove unnecessary nullish check

* refactor: simplify toAssignable on ParenthesizedExpression

* tests: categorize createParenthesizedExpression tests
2020-01-20 21:04:16 +01:00
Chunpeng Huo
9bc04baeb5 fix(babel-parser): avoid state.clone() to clone the whole token store (#11029)
* fix(babel-parser): avoid state.clone() to clone the whole token store

Fixed the performance issue on large input when turned on option {tokens: true} and typescript plugin which uses quite a few state.clone().

* test(babel-parser): turn on 2 typescript tests with tokens:true

The output.json is generated by old master to make sure no regression.

* fix(babel-parser): avoid duplicated tokens trapped by mainly typescript/flow plugins

* test(babel-parser): update output.json to latest master result

* chore(babel-parser): improve performance by storing tokensLength in state
2020-01-19 22:38:33 -05:00
Erlend Tobiassen
740064ced7 Fix missing ClassDeclaration references after scope#crawl (#11011)
* Bug replication test

* Simplify test

* Fixes #10896

* Merge path.crawl `ClassDeclaration` and `Declaration` visitors

Merged to avoid subtle assumption that `Declaration` is called before `ClassDeclaration`

* Move registartion of class id in crawl to BlockScoped

* Add some assertions to crawl test
2020-01-19 21:32:05 -05:00
Nicolò Ribaudo
2b23c283dd
Check that generated compat-data is up to date on CI (#11024) 2020-01-20 01:42:47 +01:00
Huáng Jùnliàng
de75dbf2a0 update compat-data related docs/config [skip ci] (#11030)
* ignore compat-data build

* ignore CONTRIBUTING.md when publishing preset-env

* docs: update preset-env CONTRIBUTING.md
2020-01-20 01:00:38 +01:00
Huáng Jùnliàng
facfd4d8a1 Enable no-process-exit ESLint rule (#11025) 2020-01-20 00:48:47 +01:00
Vedant Roy
341964bd4e fix: properly parse member expression after property initializ… (#11031)
Fixes issue 10989 where the only the identifier in a member expression that is the value of an object property would be parsed. Removing checkExpressionErrors in parseExprSubscripts results in the subscript also being parsed.
2020-01-20 00:33:09 +01:00
Benoît Zugmeyer
85ddc297c2 Fix rest parameters indexing with TypeScript 'this parameter' (#9714)
* Fix rest parameters indexing with TypeScript 'this parameter'

The TypeScript [this parameter][0] is a fake parameter and should not be
taken into account when counting the function parameters.  This patch
skips it by using the condition taken from the `transform-typescript`
plugin.

Note: since the `transform-typescript` plugin is removing this kind of
parameter, including it before the `transform-parameters` plugin solves
the issue.  This patch fixes the issue in other cases.

[0]: https://www.typescriptlang.org/docs/handbook/functions.html#this-parameters

* nit: improve the 'this parameter' detection condition

* improve performance by checking the parameter list length before
accessing it
* simplify the test a bit by using the `isIdentifier` second
parameter
2020-01-17 21:00:37 +01:00
Sven Sauleau
34a9653281 add AST for the module attribute proposal (#11015)
Introduce a `ImportAttribute` structure and add an `attributes` key on
the `ImportDeclaration` node.

[skip ci]
2020-01-17 20:58:30 +01:00
Huáng Jùnliàng
45301c5304 Update coalesce precedence (#11017)
* refactor: reimplement nullish coalescing precedence tracking

Co-authored-by: Toru Nagashima <public@mysticatea.dev>

* fix: Coalesce has same precedence with LogicalOR

* fix flow errors

Co-authored-by: Toru Nagashima <public@mysticatea.dev>
2020-01-17 20:57:07 +01:00
Huáng Jùnliàng
6648d62f40
chore: use @babel/eslint-config-internal (#11026) 2020-01-17 07:57:25 -05:00
Huáng Jùnliàng
1a1454328b
chore: replace yarn-upgrade by bump-babel-dependencies in e2e tests (#11021)
* chore: pin yarn version in e2e vue tests

* fix: replace yarn-upgrade by bump-babel-dependencies

* chore: update e2e-cra test
2020-01-17 07:55:29 -05:00
Huáng Jùnliàng
06dace1cdb fix: for-of transform should skip for-await-of (#11023) 2020-01-17 00:15:31 +01:00
Nicolò Ribaudo
3daab41e61 Re-generate preset-env fixtures (#11016)
* Fix plugin ordering in preset-env

* Update stdout fixtures

* Comments [skip ci]
2020-01-16 10:49:30 -05:00
Huáng Jùnliàng
a1063d2583
fix: triple __proto__ in object patterns should be allowed (#11009) 2020-01-16 09:34:47 -05:00
Nicolò Ribaudo
6363b594cc Re-generate plugins compat data
They are now alphabetically ordered, but the data is the same
2020-01-16 01:45:02 +01:00
Nicolò Ribaudo
d75652eb5e
Exclude import() tests from pubilsh build (#10995)
I really don't like this commit, but import() is currently breaking
our publish script.
When "normal" tests we are transpiling import() so that it works
with Jest. We can't do it while publishing because we need to
publish the untranspiled import() so that it can load real .mjs files.

Follow up to #10903
2020-01-15 23:38:18 +01:00
Siddhant N Trivedi
6ad7e19a27 Fix parentheses removal in nullish-coalescing operation (#11014)
* Added precedence for nullish-coalescing-operator

* Made precedence equal to logical OR

* Renamed the folders made for testing

* Fixed the output test file of nullish-coalescing op
2020-01-15 23:30:28 +01:00
Huáng Jùnliàng
e7961a08a8
fix: supply ‘.’ subpath for node.js < 13.2 (#11006) 2020-01-14 22:54:41 -05:00
Huáng Jùnliàng
9df70b4505
Duplicate __proto__ key should be allowed in object patterns (#10987)
* refactor: replace refShorthandDefaultPos by refExpressionErrors

* fix: duplicate __proto__ keys should be allowed in patterns

* docs: add comments for ExpressionErrors.doubleProto [ci-skip]

* test: add more test for coverage
2020-01-14 22:53:45 -05:00
Huáng Jùnliàng
a0a9c64a47
chore: test against babel-preset-app (#11004) 2020-01-13 18:30:37 -05:00
Babel Bot
b138b5a62e Add v7.8.3 to CHANGELOG.md [skip ci] 2020-01-13 21:44:41 +00:00
Nicolò Ribaudo
a7620bd266 v7.8.3 2020-01-13 22:36:19 +01:00
Huáng Jùnliàng
6874c244ab fix: generated builder parameter should respect builder keys (#11002) 2020-01-13 22:30:24 +01:00
Nicolò Ribaudo
8fce431d88
Revert "chore: specify package type (#10849)" (#11003)
This reverts commit e8dac621de9dba27b47646169562c0a0c2e02c96.

Fixes installs when using npm <= 3.9.5 (Node.js <= 6.2.2)
2020-01-13 21:18:42 +01:00
Nicolò Ribaudo
d0a8982c12 Ignore .map files in standalone packages (#10994) 2020-01-12 19:43:10 -05:00
Nicolò Ribaudo
a677d59a63
Archive syntax plugins enabled by default (#10820)
* Remove syntax plugins enabled by default

Moved to babel-archive: babel/babel-archive@8f23ddce03

- `@babel/plugin-syntax-async-generators`
- `@babel/plugin-syntax-bigint`
- `@babel/plugin-syntax-dynamic-import`
- `@babel/plugin-syntax-json-strings`
- `@babel/plugin-syntax-nullish-coalescing-operator`
- `@babel/plugin-syntax-object-rest-spread`
- `@babel/plugin-syntax-optional-catch-binding`
- `@babel/plugin-syntax-optional-chaining`

* Fix build script

* Fix jest config

* Remove archived plugins from tests
2020-01-13 00:31:48 +01:00
Babel Bot
c7f7f9b8b5 Add v7.8.2 to CHANGELOG.md [skip ci] 2020-01-12 22:50:23 +00:00
Nicolò Ribaudo
61d01f1114 v7.8.2 2020-01-12 23:44:39 +01:00
Haoqun Jiang
f995f8e02c fix: isPluginRequired returns the opposite result in v7.8.0 (#10992) 2020-01-12 23:43:03 +01:00
Babel Bot
2ccc451e96 Add v7.8.1 to CHANGELOG.md [skip ci] 2020-01-12 13:04:04 +00:00
Nicolò Ribaudo
575eeb370e v7.8.1 2020-01-12 13:58:53 +01:00
Nicolò Ribaudo
27668377b5
Downgrade semver for compatibility with Node 6 (#10991) 2020-01-12 13:56:09 +01:00
Nicolò Ribaudo
d1c93e7e3e
Remove ESLint packages from the changelog
They are not published
2020-01-12 01:54:11 +01:00
Babel Bot
9647560dd6 Add v7.8.0 to CHANGELOG.md [skip ci] 2020-01-12 00:27:36 +00:00
Nicolò Ribaudo
2486615a74 v7.8.0 2020-01-12 01:09:29 +01:00
Kai Cataldo
d8e6219ad9 @babel/eslint-plugin: Update rules/tests to use @babel/eslint-parser (#10977)
* Use @babel/eslint-parser for tests

* Update rules/tests

* Update docs

* add @babel/eslint-shared-fixtures to package.json

* remove bug fix

* convert RuleTester to ESM

* Update devDep versions
2020-01-11 20:42:21 +01:00
Huáng Jùnliàng
81c5f1f22d
Disallow private name in object elements and TS type elements (#10980)
* fix: disallow private name in object member and TS type elements

* chore: update test262 whitelist

* chore: make flow happy

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

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

* chore: update test fixtures

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

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

* chore: update test fixtures

Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
Co-authored-by: Brian Ng <bng412@gmail.com>
2020-01-11 11:26:10 -05:00
Nicolò Ribaudo
e7b80a2cb9
Improve @babel/types with env.BABEL_TYPES_8_BREAKING (#10917)
Co-authored-by: Justin Ridgewell <justin@ridgewell.name>
2020-01-11 10:34:30 +01:00
Huáng Jùnliàng
405c1aaad8 Merge env-standalone to babel-standalone (#10821)
* feat: add babel-preset-env to babel-standalone

* chore: copy preset-env-standalone test

* polish: tune warning message when babel-preset-env-standalone is loaded
2020-01-11 10:31:29 +01:00
Huáng Jùnliàng
a1310333f7 chore: update corejs fixtures (#10983) 2020-01-11 09:23:58 +01:00
Huáng Jùnliàng
903ad6160d
Filename detection should respect short flags (#10763)
* chore: add test files

# Conflicts:
#	packages/babel-node/package.json

* fix: respect short flags when finding filename index

* fix: use attributeName for kebab-case
2020-01-10 20:46:19 -05:00
Anders Kaseorg
5a3e97073e CONTRIBUTING: Update link to plugin-features.js [skip ci] (#10982)
It was moved in #10899.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2020-01-10 20:43:10 -05:00
Yordis Prieto
4c28f54152 Add babelrc.json support (#10783)
* Add babelrc.json support

* Add tests

Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2020-01-10 23:41:42 +01:00
Nicolò Ribaudo
ae06baf22f
Add support for babel.config.mjs and .babelrc.mjs (#10903)
* Add support for babel.config.mjs and .babelrc.mjs

* Use path.extname
2020-01-10 23:14:29 +01:00
Nicolò Ribaudo
282f81bd67
Prepare @babel/core for asynchronicity (#10507)
* Prepare @babel/core for asynchronicity

* Include regenerator-runtime in standalone build

* Fix rollup build
2020-01-10 22:44:13 +01:00
Huáng Jùnliàng
9fec528016 Reduce false negative cases of typescript parser tests (#10979)
* tests: read baesline errors for typescript parsing error

* chore: add error codes

* chore: tune the regex
2020-01-10 22:11:10 +01:00
James Beavers
80aa7dc3c6 Add optional-chaining and nullish-coalescing to preset-env (#10811)
* Add support for optional-chaining (stage 4) in present-env

* revert babel-preset-env built-in-modules.json

* add shipped proposal syntax map entry, optional chaining

* update remaining syntax plugin references, proposal description

* Add support for nullish coalescing operator in preset-env

* selectively enable sort-keys rule

* enforce sort-keys on shipped-proposals

* don't use Object.entries()

* Update fixtures
2020-01-10 22:07:43 +01:00
Kai Cataldo
4cb2148273 @babel/eslint-plugin: remove deprecated rules (#10975) 2020-01-10 20:22:39 +01:00
Siddhant N Trivedi
3dcb8ca99e Added instructions to fork the repo in order to setup. (#10973)
* Added instructions to fork the repo to setup

* Capitalized Github and Indented the guidelines

[skip ci]
2020-01-10 20:05:58 +01:00
Nicolò Ribaudo
bfc56ebbab Update Test262, Flow and TS parser tests (#10976)
* Update Test262, Flow and TS parser tests

* Updates
2020-01-10 09:50:11 -05:00
Huáng Jùnliàng
e8dac621de
chore: specify package type (#10849) 2020-01-09 21:40:15 -05:00
Huáng Jùnliàng
44f9d85904 add allowTopLevelThis option to transform-modules-systemjs (#10780)
* feat: expose rewriteThis method

* feat: add allowTopLevelThis option to transform-modules-systemjs
2020-01-10 03:16:26 +01:00
Nicolò Ribaudo
04354d1556
Extract targets parser and compat data from preset-env (#10899)
* Extract targets parser and compat data from preset-env

* Review by Jùnliàng

* isItemRequired -> targetsSupported

* Export isRequired
2020-01-10 03:15:20 +01:00
jack
5f807ae45b Enable optional chaining by default in @babel/parser (#10817) 2020-01-10 03:09:39 +01:00
ZYSzys
646409b23e Use babel > as prompt in babel-node (#9695) 2020-01-10 03:04:02 +01:00
Raja Sekar
8415065d99 --copy-ignored flag added to CLI (#10887)
* prevent ignored files in out dir

* added includeIgnore cli option

* Help text change

* Update packages/babel-cli/src/babel/options.js

Copy review.

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

* review comments

* throw error if copyIgnored is used without ignore flag

* check for ignored files

* duplicate pathToPattern fn in babel/cli

* change implementation

* removed ignore option from cliOption

* added test case with ignore in config

* added test case with ignore in config

* review

Co-authored-by: Brian Ng <bng412@gmail.com>
2020-01-10 03:03:37 +01:00
Sebastian Silbermann
3af02f63de Add --out-file-extension option to babel-cli (#9144)
* Add --use-file-extension option to babel-cli

* refactor file extension logic

use existing methods from path module

* Rename use-file-extension -> out-file-extension

* add error message if bot keep- and out-file-extension is used

* add test for error when mixing --keep- and --out-file-extension

* poke travis
2020-01-10 03:02:52 +01:00
Oleksandr Fediashov
c3388ea42f Enable nullish coalescing by default in @babel/parser (#10819)
* move files, remove hasPlugin() & expectPlugin()

* restore permissions
2020-01-10 02:52:53 +01:00
Abdul Ali
5b907e9bb7 [parser] enable dynamic import by default (#10843)
* [parser] enable dynamic import by default

* chore: add back babel-core api test
2020-01-10 02:28:52 +01:00
Huáng Jùnliàng
7bc22e42f5 StringNumericLiteral does not include NumericLiteralSeparator (#10938) 2020-01-10 02:28:16 +01:00
Nicolò Ribaudo
771c730fda
[parser] Disallow duplicate and undeclared private names (#10456)
* [parser] Add private names tracking to Scope

- Disallow duplicate private names
- Disallow undeclared private names

* Update tests

* Test all possible duplications

* Test undeclared private names

* Better error message for top-level private names

* Fix flow

* Update test262 whitelist

* Update fixtures

* Update flow whitelist

* Remove old output.json

* Move ClassScopeHandler to a separate class

* Make the code readable
2020-01-10 02:22:05 +01:00
Huáng Jùnliàng
9f148a1603 chore: update caniuse-usage fixtures (#10974) 2020-01-10 00:38:21 +01:00
Huáng Jùnliàng
09cb4273bc update corejs-compat fixtures (#10967)
* update corejs-compat fixtures

* chore: bump core-js-compat to 3.6.2
2020-01-07 18:43:14 +01:00
Huáng Jùnliàng
8fd532db39
LiteralPropertyName should allow BigIntLiteral (#10955)
* fix: property name should allow BigIntLiteral

* test: add non decimal test case

* add bigintIndex to whitelist
2020-01-07 10:23:50 -05:00
Nicolò Ribaudo
3fa37d2da3 Bump coverage target from 80% to 90% (#10964) 2020-01-05 18:08:50 -05:00
Nicolò Ribaudo
4636321f06
Make @babel/transform-runtime's absoluteRuntime/relative test meaningful (#10963) 2020-01-05 17:28:44 +01:00
Huáng Jùnliàng
a7dac49518 chore: workaround yarn issue (#10958) 2020-01-04 11:35:24 +01:00
Huáng Jùnliàng
03d163a0d9
Use chrome data when android is absent (#10790)
* chore: rename test folder

* chore: add test case

* fix: use chrome support data when android is absent

* chore: add type annotation

* chore: add testcases last 2 versions not ie

* chore: bump browerslist to v4.8.2

* chore: update test fixtures

* chore: update test fixtures
2020-01-03 18:26:27 -05:00
Huáng Jùnliàng
455d782ef0 test: add invalid-lone-import test (#10950)
* test: add lone import test

* polish: raise recoverable error
2020-01-03 23:08:59 +01:00
Huáng Jùnliàng
a28353703f fix: check await when parsing AsyncArrowBindingIdentifier (#10953) 2020-01-03 23:08:28 +01:00
Huáng Jùnliàng
467667af88 When reading a new string, U+2028/2029 should correctly set th… (#10944)
* test: add test on template

* fix: update lineStart when string contains U+2028/U+2029
2020-01-03 23:07:54 +01:00
Huáng Jùnliàng
6ee8c97e6a Fix: TopLevelAwait should respect await identifiers defined in… (#10947) 2020-01-03 23:07:11 +01:00
Huáng Jùnliàng
e5048053aa Add integration test: e2e-vue-cli (#10919)
* chore: add e2e-vue-cli test

* chore: add node-browsers-executor

* chore: state why node-browsers-executor is required
2020-01-03 23:06:13 +01:00
Kai Cataldo
9f832c2716
@babel/eslint-parser: Fix ClassPrivateMethods (#10913) 2020-01-02 18:36:58 -05:00
Jayen Ashar
daaa2063bb Override toString in case this function is printed (#10949)
* Override toString in case this function is printed

Related to https://stackoverflow.com/questions/59543968/unexpected-return-value-from-visitor-method

* Don't override `toString` if `wrapper` is true

Override `toString` immediately before returning a newFn, otherwise it will be overridden if wrapper is true

https://github.com/babel/babel/pull/10949#discussion_r362302625

* prettier
2020-01-01 15:36:20 +01:00
Huáng Jùnliàng
26eb891870
fix: Class Field Initializer should not allow await expression as immediate child (#10946)
* fix: scope.inAsync should exclude reference in class property initializers

* chore: add test on await in computed class property

* fix flow error :(
2019-12-31 09:36:03 -05:00
Huáng Jùnliàng
0238244268
refactor: remove unecessary checkYieldAwaitInDefaultParams (#10936) 2019-12-30 16:12:09 -05:00
Huáng Jùnliàng
2f3f77926d
refactor: remove unused invalidTemplateEscapePosition tokenizer state (#10935)
* refactor: remove unused invalidTemplateEscapePosition tokenizer state

* fix flow error
2019-12-30 16:11:56 -05:00
Huáng Jùnliàng
30449fe05d
Refactor parseSubscript (#10937)
* refactor: unify optionalMemberExpression generation

* test: add optional calls invalid typecasts

* fix: do not parse async arrow when call is optional

* test: update test fixtures
2019-12-30 16:11:39 -05:00
Huáng Jùnliàng
86245a83a2
TSTypeCastExpression should not be inside call parameters (#10939) 2019-12-30 16:10:19 -05:00
Huáng Jùnliàng
197a8da04d
Remove unused parser methods (#10942)
* chore: remove unused isStrictBody

* chore: remove unused eatRelational
2019-12-30 16:09:50 -05:00
Huáng Jùnliàng
314513374d
chore: update test262 (#10943)
* chore: update test262

* chore: ignore untoggleable features
2019-12-29 21:35:19 -05:00
Klaus Meinhardt
b91720c1cc helper-module-transforms: dereference imported template tag (#10934)
* Dereference imported template tag

* apply fix for OptionalCallExpression as well
2019-12-28 16:46:20 -05:00
Huáng Jùnliàng
e9dc74e787
fix: Promise.any requires global.AggregateError (#10930)
* fix: promise.any requires global.AggregateError

* address review comments
2019-12-26 20:29:47 -05:00
Nicolò Ribaudo
30f3b07ebf Replace custom "findSuggestion" function with "levenary" (#10924)
* Replace custom "findSuggestion" function with "levenary"

* Update
2019-12-26 00:45:26 +01:00
Huáng Jùnliàng
db3c31a8af fix: minified should not accept optional argument (#10923) 2019-12-25 19:13:23 +01:00
Nicolò Ribaudo
00758308ae Always use forked @lerna/collect-updates 2019-12-25 01:22:43 +01:00
Huáng Jùnliàng
fc5365fe4a
Fix parameter expression get binding (#10912)
* fix: parameter expression closure should not have access to the declaration inside function body

* fix: renameVisitor should skip when a pattern is a scope

* address review comments
2019-12-24 15:18:46 -05:00
Kai Cataldo
ee5b79d75d @babel-core: parse should parse only (#10914)
* @babel/core: parse methods should parse only

* Update Flow types
2019-12-24 18:28:57 +01:00
Huáng Jùnliàng
875e9619b7
chore: refine e2e test scripts (#10918) 2019-12-24 12:25:23 -05:00
Huáng Jùnliàng
a18166d2a9 refactor: remove inClassProperty parser state (#10906) 2019-12-24 11:43:39 +01:00
Kai Cataldo
c09664f35d @babel/eslint-parser: Refactor (#10916) 2019-12-23 23:12:07 +01:00
Huáng Jùnliàng
83993b08d5 chore: separate build-standalone with coverage (#10905)
* chore: separate build-standalone with coverage

* style polish
2019-12-23 19:03:45 +01:00
Barthélémy Ledoux
f651f22f96 fix: lost leading comment after named import (#10901)
* create test for 10892

* update expected output

* fixed #10892

* add colon to restart build

* remove colon as it makes tests fail
2019-12-22 10:22:28 +01:00
Tsubasa Nakayama
416ce35638 fix: Object.getOwnPropertySymbols called on non-object (#10902)
* fix: Object.getOwnPropertySymbols called on non-object

* convert Object
2019-12-22 00:16:51 +01:00
Huáng Jùnliàng
c5cfc83182 Move coverage to GitHub actions (#10898)
* chore: remove Circle CI test config

* chore: add GitHub Actions: Report Coverage

* chore: polish the step names

* chore: remove Circle CI test job definition

* chore: remove cache actions as it seems that they are hanging forever
2019-12-20 21:32:22 +01:00
Nicolò Ribaudo
d389b702e6 Remove reverted PR from changelog [skip ci] 2019-12-19 02:02:16 +01:00
Babel Bot
aaa1b1f4b0 Add v7.7.7 to CHANGELOG.md [skip ci] 2019-12-19 00:53:52 +00:00
Nicolò Ribaudo
12da0941c8 v7.7.7 2019-12-19 01:33:19 +01:00
Huáng Jùnliàng
9be27bcfea fix: add computed property support for object Ref (#10863)
* fix: add computed property support for object Ref

* Apply suggestions from code review

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

* Update output.js
2019-12-19 01:29:46 +01:00
Nicolò Ribaudo
c0d0bf2e5e Update core-js fixtures 2019-12-19 01:28:41 +01:00
Huáng Jùnliàng
e85c9b9ec8 fix: skip merging large input sourcemaps (#10890) 2019-12-19 01:16:20 +01:00
Nicolò Ribaudo
80e95d0c83 Fix flow 2019-12-18 14:34:06 +01:00
Raja Sekar
dbf3f91f1e Revert "Prevent ignored files in out dir (#10831)" (#10886)
This reverts commit 2b3590929b4eb955b0e8b287f9749b5af66cc1a0.
2019-12-18 11:17:35 +01:00
Huáng Jùnliàng
aa814073b7 Ignore some files in npm package (#10882) 2019-12-17 23:53:53 -06:00
Huáng Jùnliàng
8afeef2d96 chore: cache chocolatey install temp (#10874) 2019-12-17 23:32:05 -06:00
Nicolò Ribaudo
3d7bc435d5 Allow -r from node_modules with @babel/node (#10871) 2019-12-17 23:31:26 -06:00
Raja Sekar
2b3590929b Prevent ignored files in out dir (#10831)
Co-Authored-By: Brian Ng <bng412@gmail.com>
2019-12-17 21:39:36 -06:00
Huáng Jùnliàng
b3c7df9314 fix: avoid string copy when processing input source-map (#10885)
Co-Authored-By: Justin Ridgewell <justin@ridgewell.name>
2019-12-17 21:12:55 -06:00
Huáng Jùnliàng
ff8a295ea7 chore: download compat-table when build-data is run (#10873) 2019-12-17 21:12:10 -06:00
Huáng Jùnliàng
c35ba3d3ab
chore: add PR Intent checkbox [ci-skip] (#10880)
* chore: add PR Intent checkbox

* chore: rephrase [ci-skip]
2019-12-17 14:36:09 -05:00
Nicolò Ribaudo
4f77a5aaad
e2e test: create-react-app (#10704)
* e2e test: create-react-app

* Fix

* Fix

* Fix

* Fix
2019-12-16 22:13:23 +01:00
Huáng Jùnliàng
0e9c49606a chore: update babel-eslint to 11.0.0-beta.2 (#10870) 2019-12-16 22:10:29 +01:00
Aziz Khambati
a0d76a8c0e Fix pragmaFrag spelling in error message (#10868) 2019-12-16 09:55:08 -05:00
Huáng Jùnliàng
bffa415b83 Check shadow variable to identifier in default parameters (#10053)
When there is a variable declaration inside the function body, which shares its name to a referenced identifier in default parameter expression, the function body should be wrapped into iife, otherwise the binding in default parameter scope will be shadowed by function body.
2019-12-13 14:39:37 +01:00
Nicolò Ribaudo
0b3f883ed1 Properly serialize non-json values in parser tests (#10858) 2019-12-12 10:22:17 +01:00
Kai Cataldo
25f7e6808e
@babel/eslint-parser: refactor configuration logic (#10860) 2019-12-11 18:06:37 -05:00
Kai Cataldo
7b54a94389 @babel/eslint-parser: fix ImportExpression node to match ESTree spec (#10828)
* @babel/eslint-parser: fix ImportExpression node to match ESTree spec

* Update caller name for @babel/core.parseSync

* Move logic into estree plugin

* Add estree plugin tests

* Fix Flow error

* Fix flow

* Remove extra properties on ImportExpression node

* Incorporate review feedback
2019-12-11 11:13:57 +01:00
Nicolò Ribaudo
5156d3ea06
Restore @babel/parser tests (#10854)
* Make parser tests work again

* Update failing fixtures

* Fix serialization of BigInt

* Fix
2019-12-11 11:09:13 +01:00
Bowei Han
20e43ad103 validate parentheses in the left-hand side of assignment expressions (#10576)
* invalid left-hand assignments based on parenthesis

* validate against nested ParenthesizedExpressions
2019-12-09 20:29:02 -05:00
Huáng Jùnliàng
de1fa902f0 Tune eslint packages test configuration (#10848)
* Do not load root babel.config.js in esilnt tests

* add testcase: sourceType: script + globalReturn: true

* chore: remove globalReturn on default test config
2019-12-10 01:14:29 +01:00
Huáng Jùnliàng
f02e5e6d0a Add missing dev dependencies (#10847)
* chore: declare eslint-import-resolver-node dependency

# Conflicts:
#	yarn.lock

* chore: add devDependencies

* Add browserify devDep to babel-register

# Conflicts:
#	packages/babel-register/package.json
#	yarn.lock

* chore: resolve eslint-scope to 5.0.0
2019-12-09 23:56:22 +01:00
Nicolò Ribaudo
2884bac44b Use async-to-generator even when regenerator is enabled (#10839)
While it isn't technically needed because regenerator already handles
async functions, it doesn't play well with the Promise detection logic
used by @babel/preset-env's useBuiltIns and @babel/transform-runtime.

The plugin exclusion logic isn't removed, because
1) it will be useful when merging @babel/preset-modules
    into @babel/preset-env
2) if/when regenerator will support injecting a custom promise,
    we can enable this optimization again
2019-12-09 16:54:25 -05:00
Huáng Jùnliàng
b7989419c7 Update corejs fixtures (#10846)
* chore: add update-env-corejs-fixture recipe

* chore: update corejs fixtures
2019-12-09 19:50:34 +01:00
Huáng Jùnliàng
0164662944 refactor: rewrite available-plugins to esm (#10837) 2019-12-08 14:53:28 +01:00
Kai Cataldo
fb100eee41 @babel/eslint-parser: fix BigIntLiteral node to match ESTree spec (#10827)
* @babel/eslint-parser: fix BigIntLiteral node to match ESTree spec

* Move token conversion to @babel/eslint-parser

* Add estree plugin tests

* Update test helpers to handle BigInt serializing

* Update Literal union type to include BigIntLiteral

* Add FlowIgnore comment for BigInt
2019-12-08 02:59:18 +01:00
Babel Bot
b2429fe203 Add v7.7.6 to CHANGELOG.md [skip ci] 2019-12-07 23:29:56 +00:00
Nicolò Ribaudo
f753c48f74 v7.7.6 2019-12-08 00:25:57 +01:00
Huáng Jùnliàng
4436ffd604 Revert "Add ".js" extension to injected polyfill imports (#10549)" (#10835)
This reverts commit d3a37b5d08074c007268eb15a11ae432165bad5d.
2019-12-07 23:05:35 +01:00
Huáng Jùnliàng
655a972737 chore: add PR Revert labels to changelog (#10836) 2019-12-07 21:21:52 +01:00
Babel Bot
8a8474c321 Add v7.7.5 to CHANGELOG.md [skip ci] 2019-12-06 13:15:23 +00:00
Nicolò Ribaudo
d04508e510 v7.7.5 2019-12-06 14:12:41 +01:00
shimataro
d3a37b5d08 Add ".js" extension to injected polyfill imports (#10549)
* Node modules compatibility: add ".js" extension to imported polyfills

* Update fixtures

* add extensions on calling `addDefaultImport()`, not in the function.
2019-12-06 13:30:23 +01:00
Huáng Jùnliàng
c9a68984d6 babel --watch should have equivalent file selection logic with babel (#10283)
* fix(watcher): skip non-compilable file only when it is not included in filenames argument

* perf: disable globbing for watch
2019-12-05 08:28:52 +01:00
Huáng Jùnliàng
c6e966cac9 [parser] Use scope flags to check arguments (#10801)
* chore: add test case

Co-authored-by: Jens Maier<jens@elberet.de>

* use scope flags to check arguments
2019-12-05 08:23:53 +01:00
Huáng Jùnliàng
a0bed42aec
Bundle standalone using rollup (#10779)
* chore: bundle babel-standalone via rollup

Co-authored-by: Daniel Tschinder <daniel.tschinder@researchgate.net>

* chore: build babel-preset-env-standalone via Rollup

# Conflicts:
#	yarn.lock

* chore: add babelEnvName

* chore: farewell webpack

* chore: add terser minification

* chore: dedupe some popular dependencies

* chore: remove unused devDependencies

* chore: move plugin-babel-source to scripts/

* make prettier happy

* fix: rewrite available-plugins into esm

* chore: add extra unambiguous sources when env is rollup/standalone
2019-12-04 23:09:52 -05:00
Huáng Jùnliàng
2b472912e4
Tune makefile scripts (#10781)
* chore: replace node by `yarn node`

* chore: fix tsc command

* chore: use `yarn` to wrap node

* chore: supress yarn run output

* chore: disable silent mode for builtin yarn command
2019-12-04 22:28:25 -05:00
Huáng Jùnliàng
e94da0dce5 Incorrect trace position in fixture runner (#10566)
* test: add test case

* fix: incorrect fixture callsite position
2019-12-05 00:35:37 +01:00
Alex Lewis
bb6cc61979 fix(optional chaining): Optional delete returns true with nullish base (#10806)
Per issue 10805, the return value when using delete on a nullish base is
currently undefined. The correct return type should be true.
2019-12-04 12:56:25 +01:00
Nicolò Ribaudo
3d0c5d2afc
Do not transpile typeof helper with itself in babel/runtime (#10788)
* Do not transpile typeof helper with itself in babel/runtime

* Nits

* Remove console.log
2019-12-04 01:09:14 +01:00
YeonJuan
d18afbd7c3 Allow tuple rest trailing comma (#10800) 2019-12-03 18:32:36 +01:00
Nicolò Ribaudo
e74efd2c0a Run parser tests from the official TypeScript parser (#10444) 2019-12-03 01:09:54 +01:00
Nicolò Ribaudo
7195f0d8cf Unify logic for running parser tests from external suites (#10444) 2019-12-03 01:09:54 +01:00
Nicolò Ribaudo
5440ae1cae
Correctly disambiguate / after async fuctions (#10475)
* Correctly disambiguate / after async fuctions
2019-12-02 22:41:39 +01:00
Nicolò Ribaudo
8f89167486
Update core-js-compat (#10795)
* Update core-js-compat

* Update lockfile
2019-12-02 22:30:21 +01:00
Jaroslav Kubíček
26c0a32c7c refactor: Improve error message in @babel/core when root config is not found (#10778) 2019-12-01 00:07:05 +01:00
Jaroslav Kubicek
a6e8b3843b chore: update snapshot for corejs3 targets unit test 2019-11-29 14:49:08 -05:00
Huáng Jùnliàng
4e774b7264 fix: rewriteBindingInitVisitor should skip on scopable node (#10764) 2019-11-26 08:51:11 +01:00
Kai Cataldo
7f732ad019 Clean up @babel/eslint-plugin (#10756)
* Clean up @babel/eslint-plugin

* Add directory field to package.json

* Update eslint/babel-eslint-plugin/README.md

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

* Incorporate feedback :)
2019-11-25 17:15:34 -05:00
Kai Cataldo
e81bbd69b3 Clean up @babel/eslint-parser (#10753)
* Ensure compilation works for @babel/eslint-parser

* Update with review suggestions

* Incorporate feedback :)
2019-11-25 22:17:45 +01:00
Kai Cataldo
52f964126d Update babel-eslint-plugin-dev engines (#10761) [ci-skip] 2019-11-25 16:14:00 -05:00
Nicolò Ribaudo
01c33a5719
Fix dependencies on @babel/* packages (#10762)
* Remove dep on Babel 7 beta

* Add missing dependencies used in babel.config.js

* Update lockfile
2019-11-25 21:48:12 +01:00
Ives van Hoorne
66a70267b6 Add CodeSandbox CI Config (#10639)
* Add CodeSandbox CI Config

* Force build

* New build
2019-11-25 13:02:02 -05:00
Kai Cataldo
0b06b23b00 Clean up @babel/eslint-plugin-development (#10757)
* Clean up @babel/eslint-plugin-development

* Add directory field to package.json
2019-11-25 18:44:46 +01:00
Nicolò Ribaudo
e239eb4c55 Update babel-eslint used in top-level package.json (#10754) 2019-11-23 21:59:26 -05:00
Nicolò Ribaudo
d38c4dd57b babel-eslint-v11.0.0-beta.1 2019-11-23 12:17:11 +01:00
Nicolò Ribaudo
5dbb90ede3 Add v7.7.4 to CHANGELOG.md [skip ci] 2019-11-23 00:38:07 +01:00
Nicolò Ribaudo
75767d87cb v7.7.4 2019-11-23 00:05:58 +01:00
Nicolò Ribaudo
1b4cfc21d9
Add support for native esm to @babel/runtime (#10748)
* Add support for native esm to @babel/runtime

* Test

* Do not remove new package.json files

* Remove git diff
2019-11-22 23:59:30 +01:00
Kai Cataldo
2dfc06e83b
Merge pull request #10744 from kaicataldo/@babel/eslint-config-internal
Rename babel-eslint-config-internal -> @babel/eslint-config-internal
2019-11-22 17:11:53 -05:00
Kai Cataldo
2c40b8c706 Fix failing tests 2019-11-22 16:25:38 -05:00
Kai Cataldo
ca88cf1060 Incorporate feedback 2019-11-22 16:05:44 -05:00
Kai Cataldo
74e2c2cd78 Update eslint/babel-eslint-config-internal/package.json
Co-Authored-By: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2019-11-22 16:05:43 -05:00
Kai Cataldo
25169901de Rename babel-eslint-config-internal -> @babel/eslint-config-internal 2019-11-22 16:05:43 -05:00
Jaideep Bhoosreddy
74fb914fe3 Use the local version of babel in test262 job (#10749)
* Use the local version of babel

* retrigger

* correctly remove other changes

* d'oh last one

* remove link part
2019-11-22 11:21:19 -05:00
Huáng Jùnliàng
683adcbb70 Reduce standalone build size (#10668)
* infra: build standalone against src

* infra: add absoluteRuntime

# Conflicts:
#	babel.config.js

* chore: remove `process.env` replace

* add $ to signify exact match

credits to Nicolò
2019-11-21 14:31:38 +01:00
Nicolò Ribaudo
cc51f2a1f2
Update lerna (#10733)
* Update lerna

* yarn-deduplicate

* Update lockfile
2019-11-21 01:05:47 +01:00
Brian Ng
83fc3f2623 Update preset-env mappings (#10742) 2019-11-20 18:48:38 -05:00
Huáng Jùnliàng
fee4d936a3 chore: introduce envinfo into environment section [ci-skip] (#10565)
This reverts commit d234ff6572e7593f36620780319b4e183aec7561.
2019-11-20 21:49:34 +01:00
George Zahariev
01d6d6dd3b Flow enums: fix enum body location (#10737) 2019-11-19 22:46:08 -06:00
Huáng Jùnliàng
6ba113197f
fix: add missing available plugins to babel-preset-env-standalone (#10732)
* fix: add missing available plugins to babel-preset-env-standalone

* skip available-plugins test in CI coverage test
2019-11-18 14:29:18 -05:00
Brian Ng
a502d88043 Fix some incorrect typeof parsing in flow (#10657) 2019-11-18 19:22:27 +01:00
gr
10213655bc [parser] Allow optional async methods (#10582)
* Add parsePostMemberNameModifiers to aync method

* Add test
2019-11-18 19:18:36 +01:00
Huáng Jùnliàng
cfd26fdbf2
register ImportEqualsSpecifier to scope (#10710)
Co-authored-by: <jaejoon.choi>
2019-11-18 13:04:34 -05:00
Raja Sekar
faf149226b minor config change (#10731) 2019-11-18 09:27:53 +01:00
Kai Cataldo
dba5bd3012
Merge pull request #10730 from kaicataldo/node-6-tests
Do not run eslint/* tests in Node v6
2019-11-18 00:26:23 -05:00
Kai Cataldo
d18d0b6478 Run Prettier 2019-11-17 23:31:38 -05:00
Kai Cataldo
db2b601886 Add TODO comment 2019-11-17 23:28:51 -05:00
Kai Cataldo
e9e6918df6 Do not run eslint/* tests in Node v6 2019-11-17 23:28:51 -05:00
Kai Cataldo
53a3dac011 Clean up eslint/* directories (#10729) 2019-11-17 11:01:10 +01:00
Kai Cataldo
401c9bbe83 Update ESLint/Prettier config for eslint/* packages (#10724) 2019-11-16 23:28:02 +01:00
Brian Ng
c37361ba2e Bump prettier@1.19.1 (#10728) 2019-11-16 16:05:40 +01:00
Raja Sekar
f087cf842f Mocha to jest migration for eslint packages (#10716)
* migrated mocha to jest

* migrated mocha to jest - 2

* migrated mocha to jest - removed preversion hook from script

* migrated mocha to jest - 3

* migrated mocha to jest - 4

* cleanup

* review

* review
2019-11-16 12:32:19 +01:00
Kai Cataldo
bcd181f051 ESLint: disable max-len (#10727)
* ESLint: disable max-len

* Rename .eslintrc.json -> .eslintrc.js

* Fix up .eslintrc.js
2019-11-16 11:10:33 +01:00
Nicolò Ribaudo
5ca8acdb38
Do not automatically publish eslint packages (#10722)
* Do not automatically publish eslint packages

* Fix

* Fix

* Fix

* Fix

* Fix
2019-11-16 11:09:18 +01:00
Kai Cataldo
a6d134804a Unify build step for ESLint packages (#10723) 2019-11-16 10:15:15 +01:00
Arun Kumar Mohan
1b75fe3cba chore: fix typo: prest -> preset (#10726) [ci-skip] 2019-11-15 23:56:59 -05:00
Huáng Jùnliàng
3846d2a7fa chore: fix typo (#10725) 2019-11-15 20:56:32 -06:00
Huáng Jùnliàng
6c7f8291d4 polish: skip creating extra reference for safely re-used node (#10720)
* polish: skip creating extra reference for safely re-used node

* reimplement using scope.maybeGenerateMemoised
2019-11-16 01:11:03 +01:00
Nicolò Ribaudo
d56911b88d
Reorganize meta files for ESLint packages (#10714)
* Move COC and CONTRIBUTING

* Add changelog links

* Reorganize gitignore and licenses
2019-11-16 01:10:26 +01:00
Nicolò Ribaudo
72eca8f0c2
Fix publishing broken by eslint packages (#10721) 2019-11-15 20:54:04 +01:00
Huáng Jùnliàng
5bb4ee73da chore: use loose mode of transform (#10718) 2019-11-15 10:48:37 -06:00
Nicolò Ribaudo
b4c42601d1
Fix linting in ESLint packages (#10712)
* Lint eslint/*

* Run "make fix-js"

* Fix remaining problems

* Remove linting from subpackages

* Remove husky

* Add back eslint dep
2019-11-14 22:05:26 +01:00
Huáng Jùnliàng
17dfdab7d2 chore: ignore engines for eslint packages (#10713) 2019-11-14 22:00:46 +01:00
Raja Sekar
927b89bec8 removed yarn lock from eslint packages (#10711) 2019-11-14 21:46:40 +01:00
dependabot[bot]
ec18c30ce7 Bump js-yaml from 3.12.0 to 3.13.1 (babel/eslint-plugin-babel-plugin#2)
Bumps [js-yaml](https://github.com/nodeca/js-yaml) from 3.12.0 to 3.13.1.
- [Release notes](https://github.com/nodeca/js-yaml/releases)
- [Changelog](https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nodeca/js-yaml/compare/3.12.0...3.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2019-07-08 21:05:37 +02:00
Nicolò Ribaudo
f7c3d0717a 1.0.1 2018-12-18 22:35:38 +01:00
Nicolò Ribaudo
f5e482d3f6 Add repo url 2018-12-18 22:35:25 +01:00
Nicolò Ribaudo
31c3de6bfa Typo 🤦 2018-12-18 22:33:27 +01:00
Nicolò Ribaudo
cc78743ac8 Add .npmignore 2018-12-18 22:09:51 +01:00
Nicolò Ribaudo
1bd82dd6c1 1.0.0 2018-12-18 21:24:54 +01:00
Nicolò Ribaudo
cc2d738343 Update readme with the new package name 2018-12-18 21:23:50 +01:00
Nicolò Ribaudo
76ece4576e Add publishConfig to package.json 2018-12-18 21:04:36 +01:00
Nicolò Ribaudo
ef29bf53ff Rename to @babel/eslint-plugin-developement. Fixes babel/eslint-plugin-babel-plugin#1 2018-12-18 19:59:26 +01:00
Nicolò Ribaudo
e146ae748e Create Test workflow 2018-12-17 21:15:50 +01:00
Nicolò Ribaudo
ed1cee365f Update package.json#main 2018-12-17 20:13:53 +01:00
Nicolò Ribaudo
b615efba87 Export rules 2018-11-20 21:20:58 +01:00
Nicolò Ribaudo
69cc2c30c5 Docs 2018-11-20 21:11:47 +01:00
Nicolò Ribaudo
110191d81e Add plugin-name rule 2018-11-20 20:30:08 +01:00
Nicolò Ribaudo
c59db52954 Extract isBabelPluginFactory helper 2018-11-20 20:30:02 +01:00
Nicolò Ribaudo
2be54111c0 Add no-undefined-identifier rule 2018-11-20 18:13:37 +01:00
Nicolò Ribaudo
1f7197ec16 Extract isFromBabelTypes helper 2018-11-20 18:02:40 +01:00
Nicolò Ribaudo
6285cb9b64 Add no-deprecated-clone rule 2018-11-19 00:53:17 +01:00
Nicolò Ribaudo
3243af3e07 First commit 2018-11-18 23:57:36 +01:00
fergald
f3e2752df3 Support private properties in no-invalid-this (babel/eslint-plugin-babel#183)
* add failing test

* support ClassPrivateProperty
2019-08-24 17:12:15 +09:00
dependabot[bot]
693fa1aa0d Bump js-yaml from 3.11.0 to 3.13.1 (babel/eslint-plugin-babel#177)
Bumps [js-yaml](https://github.com/nodeca/js-yaml) from 3.11.0 to 3.13.1.
- [Release notes](https://github.com/nodeca/js-yaml/releases)
- [Changelog](https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nodeca/js-yaml/compare/3.11.0...3.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2019-07-15 18:52:01 +02:00
dependabot[bot]
7061d966ab Bump lodash from 4.17.4 to 4.17.14 (babel/eslint-plugin-babel#181)
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.4 to 4.17.14.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.4...4.17.14)

Signed-off-by: dependabot[bot] <support@github.com>
2019-07-12 20:20:59 -05:00
Brian Ng
ebe197f12e 5.3.0 2018-11-15 09:13:03 -06:00
Ville Saukkonen
eccbdab734 Camelcase - support for optional chaining (babel/eslint-plugin-babel#163) 2018-11-08 17:47:03 +02:00
Brian Ng
2358ed1bf9 5.2.1 2018-09-27 09:09:40 -05:00
Brian Ng
e8c0f529a0 Fix missing valid-typeof export (babel/eslint-plugin-babel#165) 2018-09-27 08:20:52 -05:00
Brian Ng
7c97b5587a 5.2.0 2018-09-06 10:45:30 -05:00
Brian Ng
d86c6dd449 Add valid-typeof rule with support for BigInt (babel/eslint-plugin-babel#161) 2018-09-06 10:39:48 -05:00
Brian Ng
f70f68e44a Update readme for opt call support in no-unused-expressions [skip ci] (babel/eslint-plugin-babel#160) 2018-09-05 09:41:55 -05:00
Brian Ng
d03a00c1a4 mocha@5.2.0 (babel/eslint-plugin-babel#159) 2018-09-05 09:26:43 -05:00
Brian Ng
b3ce66b1ff Merge pull request babel/eslint-plugin-babel#158 from lehni/fix/optional-call-expression-in-no-unused-expressions 2018-09-05 09:20:31 -05:00
Brian Ng
2ea80c845e Merge pull request babel/eslint-plugin-babel#157 from amilajack/patch-1
Test against modern node versions
2018-09-04 10:34:28 -05:00
Brian Ng
3e7fe7b25e 5.1.0 2018-04-20 08:49:02 -05:00
Brian Ng
562deb8f09 Merge pull request babel/eslint-plugin-babel#144 from babel/issue142
Fix bug with semi rule with class properties and omitLastInOneLineBlock option
2018-04-19 23:30:41 -05:00
Brian Ng
ae68b5bf24 Refresh new-cap tests 2018-04-18 20:33:36 -05:00
Brian Ng
5b5d9a5dec eslint-rule-composer@0.3.0 2018-04-18 20:29:53 -05:00
Brian Ng
bc15f0627d Merge pull request babel/eslint-plugin-babel#131 from lyleunderwood/do-expressions
add no-unused-expressions with do expressions support
2018-04-18 20:25:42 -05:00
Henry Zhu
1037e37418 5.0.0 2018-03-31 08:42:29 -04:00
Brian Ng
8e49bbbb09 Add quotes rule to index 2018-03-30 09:28:48 -05:00
Brian Ng
550dcfc96a Merge pull request babel/eslint-plugin-babel#139 from babel/quotes-jsxfragment
Add babel/quotes rule for JSXFragment workaround
2018-03-30 09:11:10 -05:00
Brian Ng
2624190887 Update deprecation table with versions 2018-03-30 09:09:23 -05:00
Brian Ng
b41b3af879 Merge pull request babel/eslint-plugin-babel#138 from babel/composer
Refactor rules to use eslint-rule-composer
2018-03-30 08:34:43 -05:00
Henry Zhu
15c5245d55 4.1.2 2017-07-25 16:42:26 -04:00
Brandon Kobel
da75b8484f Modifying semi rule to support for await (babel/eslint-plugin-babel#126) 2017-05-10 12:09:23 -04:00
Henry Zhu
dc0109ad3d 4.1.1 2017-03-06 10:48:48 -05:00
Jason Quense
399c182ab5 Merge pull request babel/eslint-plugin-babel#123 from daltones/master
Deprecate rule `no-await-in-loop`
2017-03-04 09:35:33 -05:00
Henry Zhu
c548da9d36 4.1.0 2017-02-27 15:00:01 -05:00
Aaron Jensen
71202609b5 Add babel semi (babel/eslint-plugin-babel#121)
* Add semi from eslint

* Add ClassProperty support to semi rule

Fixes babel/eslint-plugin-babel#43
2017-02-27 11:58:50 -08:00
Henry Zhu
4b52a4c707 4.0.1 2017-01-18 18:03:24 -05:00
Matthew Wagerfield
7f94d5f75f Updated rules to new format, added deprecated flag (babel/eslint-plugin-babel#119) 2017-01-18 23:01:31 +00:00
Henry Zhu
3855f28ebb 4.0.0 2016-11-17 16:46:29 -05:00
Henry Zhu
9c9bff745c readme: drop node < 4 [skip ci] 2016-11-17 16:45:47 -05:00
Henry Zhu
d38551cc23 Breaking: Deprecate built-in rules (babel/eslint-plugin-babel#115)
* Deprecate built-in rules

* fix update to babel-eslint 7 with awaitexpression

* deprecate flow-object-type
2016-11-17 16:39:04 -05:00
greenkeeper[bot]
48010c551b chore(package): update dependencies (babel/eslint-plugin-babel#109)
https://greenkeeper.io/
2016-11-17 15:23:38 -05:00
Mathieu M-Gosselin
5b5f8e32a0 Updated Node versions to test against in the Travis configuration. (babel/eslint-plugin-babel#110) 2016-11-17 15:23:23 -05:00
Plusb Preco
c7d8d991a8 Drop support of Node < 4 (babel/eslint-plugin-babel#113)
* Drop support Node < 4

* Add missing changes

* Update `.travis.yml`
2016-11-18 05:21:46 +09:00
Jason Quense
2b52d67ebc Merge pull request babel/eslint-plugin-babel#101 from mathieumg/no-invalid-this
Added `babel/no-invalid-this`
2016-11-02 14:38:46 -04:00
Greenkeeper
831a217d00 chore(package): update mocha to version 3.0.0 (babel/eslint-plugin-babel#79)
https://greenkeeper.io/
2016-09-22 10:27:31 +02:00
Greenkeeper
57b06a504a chore(package): update eslint to version 3.0.0 (babel/eslint-plugin-babel#70)
https://greenkeeper.io/
2016-07-01 21:27:59 +02:00
Kai Cataldo
6e4d44f312 Update Dependencies (babel/eslint-plugin-babel#67)
* Update Dependencies

fixes babel/eslint-plugin-babel#65

* Remove PhantomJS & is-my-json-valid

PhantomJS & is-my-json-valid is not actually used anywhere

* Change ESLint peerDependency version back to >=1.0.0
2016-07-01 10:15:59 -04:00
Henry Zhu
f6c2d2e0e5 --save-dev instead of -D [skip ci] 2016-07-01 08:24:41 -04:00
Kai Cataldo
1daf7f9865 Run Travis CI in same Node versions as babel-eslint (babel/eslint-plugin-babel#68) 2016-07-01 07:58:05 -04:00
Henry Zhu
cae8513636 3.3.0 2016-06-21 16:17:06 -04:00
Henry Zhu
8cd329f611 Merge pull request babel/eslint-plugin-babel#64 from zertosh/master
Add func-params-comma-dangle rule
2016-06-21 16:15:36 -04:00
Henry Zhu
148e6be60f show which rules are fixable 2016-06-01 18:13:06 -04:00
Jason Quense
f57dc5227a Merge pull request babel/eslint-plugin-babel#62 from lemonmade/fix-for-arrow-parens
Add an automated fix for arrow-parens
2016-06-01 16:45:26 -04:00
Henry Zhu
8487ec8a67 3.2.0 2016-04-07 18:25:57 -04:00
Henry Zhu
ba2b2bc04d Merge pull request babel/eslint-plugin-babel#57 from nmote/docs
Add docs for flow-object-type rule
2016-04-07 18:24:59 -04:00
Jason Quense
5363ff85cc Merge pull request babel/eslint-plugin-babel#56 from nmote/flow-object-type
Add flow-object-type rule
2016-04-05 16:19:28 -04:00
jquense
6ac58744fe update readme 2016-02-03 19:30:16 -05:00
jquense
7fa3aa9116 3.1.0 2016-02-03 19:28:25 -05:00
Jason Quense
7a2ecd2516 Merge pull request babel/eslint-plugin-babel#44 from ssorallen/arrow-type-annotations
Add type annotations to arrow-parens "as-needed"
2016-01-21 20:20:23 -05:00
Jason Quense
d58dc7bd1d Merge pull request babel/eslint-plugin-babel#41 from zaygraveyard/issue35
Fix: array-bracket-spacing for destructuring typed parameter (fixes babel/eslint-plugin-babel#35)
2015-12-20 19:45:01 -05:00
Jason Quense
8bc70e3aac Merge pull request babel/eslint-plugin-babel#40 from zaygraveyard/issue18
Update: Add tests to check the issue babel/eslint-plugin-babel#18
2015-12-20 19:13:30 -05:00
Jason Quense
b5cdcbe06e Merge pull request babel/eslint-plugin-babel#39 from zaygraveyard/issue37
Update: Implement auto fix for object-curly-spacing (fixes babel/eslint-plugin-babel#37)
2015-12-20 17:14:32 -05:00
Jason Quense
9eebd7b057 Merge pull request babel/eslint-plugin-babel#38 from zaygraveyard/issue36
Fix: `object-curly-spacing` had been crashing on an empty object patt…
2015-12-20 16:43:33 -05:00
Henry Zhu
885bfe95dc Merge pull request babel/eslint-plugin-babel#32 from hawkrives/patch-1
Fix typo in README rules section
2015-11-29 19:28:01 -05:00
Henry Zhu
1168d60564 3.0.0 2015-11-25 18:51:45 -05:00
Jason Quense
a2c695275d Merge pull request babel/eslint-plugin-babel#29 from evocateur/no-deps
Future-proofing
2015-11-25 14:47:17 -05:00
jquense
fcdf7ec95d v2.2.0 2015-11-23 19:16:41 -05:00
Jason Quense
dd8f357639 Merge pull request babel/eslint-plugin-babel#22 from nmote/await
Add no-await-in-loop rule.
2015-11-01 11:46:24 -05:00
Jason Quense
9d8a2f14dd Merge pull request babel/eslint-plugin-babel#23 from LegNeato/master
Support trailing commas in import and export statements. Fixes babel/eslint-plugin-babel#21
2015-10-26 10:36:36 +07:00
Jason Quense
64291d8d52 Merge pull request babel/eslint-plugin-babel#11 from pascalduez/pr__fix-readme
Improve the Readme
2015-08-18 15:30:38 -04:00
Henry Zhu
eb438f0f98 2.1.1 2015-08-18 10:53:41 -04:00
Henry Zhu
cc73bb56b6 Merge pull request babel/eslint-plugin-babel#10 from aruberto/master
add arrow-parens to index.js
2015-08-18 10:52:55 -04:00
Henry Zhu
902ae7e6e7 2.1.0 2015-08-15 21:08:57 -04:00
Henry Zhu
f5f7b50e17 Merge pull request babel/eslint-plugin-babel#9 from babel/arrow-parens
Add support for async functions in arrow-parens
2015-08-15 21:05:46 -04:00
jquense
fc31183a20 v2.0.0 2015-08-04 23:33:06 -04:00
Jason Quense
3eeaa4aa36 Merge pull request babel/eslint-plugin-babel#7 from mathieumg/eslint1.0
Updated for ESLint 1.0
2015-08-04 23:30:13 -04:00
Jason Quense
89011d92fc Merge pull request babel/eslint-plugin-babel#5 from deepsweet/eslint-1.0-rc
support eslint@>=1.0.0-rc-1
2015-07-24 14:14:14 -04:00
jquense
f0a2fb6b7b v1.2.0 2015-07-20 14:55:25 -04:00
Jason Quense
51d6ba733f Merge pull request babel/eslint-plugin-babel#4 from mathieumg/objectcurlyspacing_export
Added support for experimental exports in the `object-curly-spacing` rule
2015-07-16 09:17:20 -04:00
jquense
1bfe4aa02f v1.1.0 2015-07-07 19:40:03 -04:00
Jason Quense
fadd5b55ca Merge pull request babel/eslint-plugin-babel#3 from mathieumg/spaceinbrackets_export
Added support for experimental exports in the `space-in-brackets` rule.
2015-07-03 23:15:14 -04:00
Jason Quense
c2c9933797 Merge pull request babel/eslint-plugin-babel#1 from mathieumg/blockscopedvar_export
Added support for experimental export types
2015-07-03 23:14:57 -04:00
Jason Quense
382c3f2bb9 Merge pull request babel/eslint-plugin-babel#2 from mathieumg/newcap_decorators
Added support for decorators in the new-cap rule.
2015-07-01 13:39:08 -04:00
jquense
e9e6dee39a Typos and copy 2015-06-19 00:08:09 -04:00
Jason Quense
cc35677cff Update README.md 2015-06-19 00:04:01 -04:00
jquense
c442efa7c5 Initial 2015-06-19 00:01:10 -04:00
Brian Ng
5b35722d63 Bump semver@6 (babel/babel-eslint#802) 2019-11-01 18:08:47 -05:00
Chiawen Chen
3396fdd7f7 Breaking: make AST match Espree 6 (babel/babel-eslint#785) 2019-11-02 07:08:32 +08:00
dependabot[bot]
6b3e9e3f1e Bump eslint-utils from 1.4.0 to 1.4.2 (babel/babel-eslint#796)
Bumps [eslint-utils](https://github.com/mysticatea/eslint-utils) from 1.4.0 to 1.4.2.
- [Release notes](https://github.com/mysticatea/eslint-utils/releases)
- [Commits](https://github.com/mysticatea/eslint-utils/compare/v1.4.0...v1.4.2)

Signed-off-by: dependabot[bot] <support@github.com>
2019-08-26 21:16:13 -05:00
Daniel Tschinder
030fddb0b8 chore: Update deps and fix tests for new mocha and eslint (babel/babel-eslint#781) 2019-07-15 18:49:52 +02:00
dependabot[bot]
8635063118 Bump js-yaml from 3.12.0 to 3.13.1 (babel/babel-eslint#780)
Bumps [js-yaml](https://github.com/nodeca/js-yaml) from 3.12.0 to 3.13.1.
- [Release notes](https://github.com/nodeca/js-yaml/releases)
- [Changelog](https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nodeca/js-yaml/compare/3.12.0...3.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2019-07-15 18:27:39 +02:00
dependabot[bot]
6748797681 Bump lodash from 4.17.5 to 4.17.14 (babel/babel-eslint#779)
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.5 to 4.17.14.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.5...4.17.14)

Signed-off-by: dependabot[bot] <support@github.com>
2019-07-15 18:25:29 +02:00
Param Aggarwal
f9836caee5 fix typo in README.md (babel/babel-eslint#762) 2019-04-04 19:51:25 +05:30
Yosuke Ota
3fcfc90a12 Fix to convert hash token. (babel/babel-eslint#753) 2019-02-15 07:56:30 +09:00
Kai Cataldo
025fff7871 Docs: Add glob-based configuration example (babel/babel-eslint#748)
* Docs: Add glob-based configuration example

* Fix quotes style for consistency
2019-01-29 10:56:54 -05:00
Henry Zhu
2d64900b46 11.0.0-beta.0 2019-01-21 16:29:18 -05:00
Kai Cataldo
37cf65c6f8 Add requireConfigFile option (babel/babel-eslint#743)
* Add requireConfigFile option

* Update README.md
2019-01-21 11:06:29 -05:00
Kai Cataldo
0581ce1559 Add code of conduct (same as Babel) (babel/babel-eslint#740) [skip ci] 2019-01-11 15:27:36 -05:00
Kai Cataldo
bbce2b3807 Remove comment attachment (babel/babel-eslint#736)
* Remove comment attachment

* Simplify error messaging in tests
2019-01-11 12:23:34 -05:00
Kai Cataldo
2b9ee42ded Remove monkeypatching dead code (babel/babel-eslint#737) 2019-01-10 18:28:40 -05:00
Kai Cataldo
47de99e1b8 Use @babel/core#parse (babel/babel-eslint#711) 2019-01-10 15:25:00 -05:00
Kai Cataldo
bede064c0b Major: remove parseNoPatch (babel/babel-eslint#733) 2019-01-07 09:55:16 -05:00
Kai Cataldo
c209725ada Test Node v11 in CI (babel/babel-eslint#712) 2018-11-08 10:43:04 -05:00
Emerson Laurentino
de38cfc510 fix index path typo (babel/babel-eslint#709) 2018-11-07 16:36:11 -03:00
Kai Cataldo
22a1681e11 Merge pull request babel/babel-eslint#706 from kaicataldo/es6
Update ESLint config
2018-10-30 14:48:37 -05:00
Henry Zhu
40d9bb3a77 10.0.1 2018-09-27 10:29:57 -04:00
Henry Zhu
e56b342e59 Revert babel/babel-eslint#584 (babel/babel-eslint#697)
* Revert "Treat type alias declarationlike function declaration (babel/babel-eslint#584)"

This reverts commit 020d012c554913fea137f4129798ce31a4896dfe.
2018-09-27 10:29:29 -04:00
Henry Zhu
9adb82e68a 10.0.0 2018-09-25 15:32:56 -04:00
Henry Zhu
742aa412a7 test value should be switched 2018-09-25 15:29:14 -04:00
Joa Ebert
22fa8e6f20 Treat type alias declarationlike function declaration (babel/babel-eslint#584)
A type alias shouldn't trigger a no-use-before-define warning just
like a function declaration.

Cyclic type dependencies are common when using flow.
For instance: type Node<T> = { head: T; tail: Node<T> }

Fixes babel/babel-eslint#485
2018-09-25 20:39:43 +02:00
Henry Zhu
78a2f603ce Test eslint5, update peerDep (babel/babel-eslint#690)
* test against eslint 5
* set peerDep
2018-09-25 14:32:16 -04:00
Brian Ng
990ea0f1ae Drop old monkeypatching behavior (babel/babel-eslint#689)
An alternative to adding a direct dep on estraverse (https://github.com/babel/babel-eslint/pull/685), let's just drop the old monkeypatching behavior.

Closes babel/babel-eslint#685, Closes babel/babel-eslint#680
2018-09-25 13:07:46 -05:00
Henry Zhu
dae75e1853 9.0.0 2018-08-27 18:09:21 -04:00
Brian Ng
b6a7601e4a Bump to babel@7.0.0 🎉 (babel/babel-eslint#676) 2018-08-27 17:04:26 -05:00
Ed Morley
c456fdddd7 Docs: Make the default parserOptions more explicit (babel/babel-eslint#673)
In particular, previously the `.eslintrc` example implied that the default value for `codeFrame` was `false`, when in fact it is `true`:
https://github.com/babel/babel-eslint/blob/v9.0.0-beta.3/lib/parse.js#L14
2018-08-23 06:23:06 +01:00
Alexandre Borela
2a1c76e070 Add logical assignment plugin (babel/babel-eslint#674)
Fix babel/babel-eslint#672
2018-08-23 02:21:45 -03:00
Brian Ng
57c825eebb Bump some devDeps 2018-08-21 15:18:02 -05:00
Leo Yin
6ab458b512 build(deps): upgrade @babel/* to 7.0.0-rc.2 (babel/babel-eslint#668) 2018-08-22 04:00:17 +08:00
Henry Zhu
35c49ddf97 9.0.0-beta.3 2018-07-12 09:50:58 -04:00
Henry Zhu
098ab73be1 update lock 2018-07-12 09:50:30 -04:00
Mark Tse
e675cd7445 chore - fixing eslint-scope to a safe version; resolves babel/babel-eslint#656. (babel/babel-eslint#657) 2018-07-12 09:49:43 -04:00
Brian Ng
a1f9458052 9.0.0-beta.2 2018-07-06 11:24:45 -05:00
Rubén Norte
a17917810d Merge pull request babel/babel-eslint#645 from rubennorte/support-new-flow-syntax-in-scope-analysis
Support new flow syntax in scope analysis
2018-07-06 17:20:52 +01:00
Rubén Norte
dcf55cb730 Upgrade Babel to v7.0.0-beta.52 (babel/babel-eslint#650)
* Upgrade Babel to v7.0.0-beta.52

* Fixed failing test
2018-07-06 14:50:59 +01:00
Brian Ng
28c4507866 9.0.0-beta.1 2018-06-29 08:37:18 -05:00
Rubén Norte
4f9e2a5be6 Breaking: Upgraded Babel to 7.0.0-beta.51 (babel/babel-eslint#642)
* Upgraded Babel to 7.0.0-beta.51, with changes to decorators

* Removed support for Node 4 and added it for Node 10

* nit: fix typo [skip ci]
2018-06-29 14:26:43 +01:00
Brian Ng
8dae11e6d2 8.2.5 2018-06-23 08:20:40 -05:00
Brian Ng
9342a5b74c Revert bump to babel 51 (babel/babel-eslint#640) 2018-06-23 08:20:08 -05:00
Brian Ng
92507e598f 8.2.4 2018-06-22 13:39:23 -05:00
Brian Ng
42d0769683 Add test for template string with object with template string inside (babel/babel-eslint#639)
Closes https://github.com/babel/babel-eslint/pull/538.
Fixes https://github.com/babel/babel-eslint/issues/537.

Now that https://github.com/babel/babel-eslint/pull/610 has landed, I wanted to make sure this case was covered.
2018-06-22 11:12:54 -05:00
Brian Ng
6a6c2bad50 Support OptionalMemberExpression with scope too (babel/babel-eslint#634) 2018-06-22 11:03:15 -05:00
Brian Ng
b537da9b53 Drop node4 in travis 2018-06-15 16:39:58 -05:00
Brian Ng
85d8f70478 Bump Babel deps 2018-06-11 08:47:15 -05:00
Cristian Pallarés
da43afb5de refactor: rename babylon to @babel/parser 2018-06-06 00:18:13 +02:00
Brian Ng
077bea0a45 Fix converting template types to handle nested templates (babel/babel-eslint#610)
Fixes https://github.com/babel/babel-eslint/issues/603 (and the fixture from https://github.com/babel/babel-eslint/issues/609 works).

Reworks our code that converts the format of Babylon template tokens to be a bit more robust, especially with things like nested templates with arrows.

(Adapted the logic from https://github.com/eslint/espree/blob/master/lib/token-translator.js)
2018-06-18 16:46:31 -05:00
Rubén Norte
99968db2b1 Fix token types for experimental operators (babel/babel-eslint#632)
* Added failing tests

* Recognized nullish coalescing, optional chaining and pipeline operators as Punctuator tokens
2018-06-15 15:42:05 +01:00
Rubén Norte
3477626973 Add support for the optional chaining operator (babel/babel-eslint#630) 2018-06-15 15:31:43 +01:00
jmurretxactly
735abb06b4 don't require unpad per test fixture, fixes babel/babel-eslint#572 (babel/babel-eslint#618) 2018-05-08 05:52:59 -06:00
Ankur Oberoi
cadb22334e updates readme for latest eslint & babel-eslint (babel/babel-eslint#607) [skip ci] 2018-04-13 09:26:41 -07:00
Henry Zhu
b2bc4fe4f4 8.2.3 2018-04-13 11:25:03 -04:00
Henry Zhu
2f7aea98eb lock to beta.44 2018-04-13 11:23:59 -04:00
Bary Levi
b2c065976b Save babel beta packages as exact versions (babel/babel-eslint#606) [skip ci] 2018-04-13 18:23:03 +03:00
Daniel Tschinder
f75f7a0601 8.2.2 2018-02-20 11:57:07 +01:00
Daniel Tschinder
1bd58fa018 Allow newer versions of babel 2018-02-20 11:56:40 +01:00
Daniel Tschinder
c27c2b6e68 Update dependencies 2018-02-20 11:54:09 +01:00
Daniel Tschinder
c03d5c41a5 chore(package): update lint-staged to version 6.1.1 (babel/babel-eslint#592)
Closes babel/babel-eslint#539
2018-02-20 11:49:19 +01:00
Brian Ng
7057e9fb73 Bump deps (babel/babel-eslint#591) 2018-02-15 21:39:42 -06:00
Toru Nagashima
fbb7ff6e44 Fix: wrong token type of ! and ~ (fixes babel/babel-eslint#576) (babel/babel-eslint#577) 2018-01-17 15:10:55 +09:00
Henry Zhu
6d37c551dd 8.2.1 2018-01-08 19:15:40 -05:00
Henry Zhu
23d12acd15 fix export change (babel/babel-eslint#571) 2018-01-08 19:15:22 -05:00
Kai Cataldo
b6ce2b649f 8.2.0 2018-01-08 18:06:57 -05:00
Henry Zhu
2afde99434 Add other parser plugins, update yarn.lock (babel/babel-eslint#569) 2018-01-08 17:46:57 -05:00
Kai Cataldo
97c9442511 Make 2018 the default ecmaVersion for rules relying on parserOptions (babel/babel-eslint#556) 2018-01-08 17:45:24 -05:00
jony89
660180b932 update babel packages (babel/babel-eslint#565)
* update babel packages

There is some critical bug fixes in version babylon#7.0.0-beta.33 regard `async` - `await` syntax which is needed pretty immediately :)

* remove test 42 (test for import type *)

`import type *` is invalid, since the namespace can't be a type
2018-01-09 00:40:11 +02:00
Toru Nagashima
d0d84aca9b 8.1.2 2017-12-26 10:59:19 +09:00
Toru Nagashima
624a425f7d Fix: add Literal type to visitorKeys (babel/babel-eslint#562)
* Fix: add Literal type to visitorKeys
* Fix: use ./visitor-keys
2017-12-26 10:50:13 +09:00
Toru Nagashima
3cb154df82 Fix: ignore eval (fixes babel/babel-eslint#560) (babel/babel-eslint#561) 2017-12-26 10:49:36 +09:00
Toru Nagashima
a706e85b19 8.1.1 2017-12-25 15:57:19 +09:00
Teddy Katz
e988a88af0 Fix: Prevent parseForESLint() behavior from changing after parse() is called (fixes babel/babel-eslint#558)(babel/babel-eslint#559)
* Prevent parseForESLint() behavior from changing after parse() is called

(fixes https://github.com/babel/babel-eslint/issues/558, fixes https://github.com/eslint/eslint/issues/9767)

* Avoid using the enhanced referencer after monkeypatching

* Chore: add test for babel/babel-eslint#558

* Pass correct scope analyzer options

* fix escope patch and improve tests

* remove process.exit(1)
2017-12-25 01:52:36 -05:00
Teddy Katz
5b08714a4d 8.1.0 2017-12-24 02:02:44 -05:00
Teddy Katz
d33839a9c3 Re-add parseNoPatch function (accidentally removed) (babel/babel-eslint#557) 2017-12-24 02:00:29 -05:00
Toru Nagashima
5d6d52f04e Use new scopeManager/visitorKeys APIs (babel/babel-eslint#542)
(fixes https://github.com/eslint/eslint/issues/9762)
2017-12-24 15:42:17 +09:00
Logan Smyth
7ed6bfb925 8.0.3 2017-12-01 10:06:40 -08:00
Logan Smyth
3a36eca1b4 Fix mocha command path. 2017-12-01 10:06:24 -08:00
Logan Smyth
b6172b2ed3 Lock down dependency versions. 2017-12-01 10:05:34 -08:00
Henry Zhu
39cef92885 8.0.2 2017-11-06 15:00:41 -05:00
Henry Zhu
0e2bbc3705 require correct deps 2017-11-06 14:57:56 -05:00
Henry Zhu
090269e5a0 Always use unpad (babel/babel-eslint#535) 2017-11-06 12:51:19 -05:00
Henry Zhu
f43062ebbb Allow ^ version for babel dependencies (babel/babel-eslint#534) 2017-11-06 12:47:47 -05:00
greenkeeper[bot]
38f372b8ea fix(package): update babylon to version 7.0.0-beta.31 (babel/babel-eslint#533) 2017-11-06 12:25:35 -05:00
Henry Zhu
c958724bbd 8.0.1 2017-09-26 16:18:43 -04:00
Clement Hoang
b0d8baf320 Update README.md support (babel/babel-eslint#531) [skip ci]
#linting channel is now archived in babel slack.
2017-10-31 11:50:35 -07:00
greenkeeper[bot]
5b3caf7b66 chore(package): update mocha to version 4.0.0 (babel/babel-eslint#524) 2017-10-11 14:14:29 +02:00
Jordan Gensler
04cf4246b8 Adding optionalCatchBinding to plugins. (babel/babel-eslint#521) 2017-09-26 13:17:44 -07:00
Henry Zhu
b576677e9f 8.0.0 2017-09-12 09:44:23 -04:00
Henry Zhu
d61b06b8b5 update to beta.0 2017-09-12 09:42:30 -04:00
Daniel Tschinder
15e2aa0a24 Remove already fixed workaround (babel/babel-eslint#508) 2017-08-02 14:37:01 +02:00
Henry Zhu
bc9b69590b 8.0.0-alpha.17 2017-07-26 16:19:29 -04:00
Henry Zhu
cf86d94597 alpha.17 2017-07-26 16:18:45 -04:00
Henry Zhu
35f79cb272 8.0.0-alpha.15 2017-07-13 13:01:31 -04:00
Henry Zhu
522140b43f update (babel/babel-eslint#504) 2017-07-13 12:58:45 -04:00
Evan Brodie
c9b8d2dfd1 Readme update usage section (babel/babel-eslint#501) [skip ci]
* Updates README: Consolidates versioning table

Basically a revert of 52b4a13. It is easier to read a single table instead of two locations in the README for the version compatabilities between ESLint and babel-eslint

* Updates README: Add yarn command for installation

* [skip ci]
2017-07-09 21:03:59 -04:00
greenkeeper[bot]
469e679b6d Update eslint to the latest version 🚀 (babel/babel-eslint#500)
* chore(package): update eslint to version 4.1.0

* escope -> eslint-scope

* Fix linting
2017-06-25 08:30:29 -07:00
greenkeeper[bot]
dcb4bffee5 chore(package): update husky to version 0.14.0 (babel/babel-eslint#498) 2017-06-22 13:18:47 -07:00
Kevin Mårtensson
9a791d175c Update install instructions to use latest stable release (babel/babel-eslint#497) [skip ci] 2017-06-20 23:49:46 +02:00
Henry Zhu
d40a6dd9b7 8.0.0-alpha.13 2017-06-18 18:33:40 -04:00
Henry Zhu
6aec93c468 Merge pull request babel/babel-eslint#493 from danez/regression-test
Test for babylon regression
2017-06-18 18:30:59 -04:00
Brian Ng
94e69f399b Add Prettier (babel/babel-eslint#491) 2017-06-17 14:14:42 -05:00
Henry Zhu
001064885d 8.0.0-alpha.12 2017-06-16 16:56:32 -04:00
Daniel Tschinder
bffbaff7e2 Use babylon estree and ranges (babel/babel-eslint#489) 2017-06-15 23:03:02 +02:00
Mark Banner
36a630e023 Fix: allow options to be optional when monkey patching escope.analyze (fixes babel/babel-eslint#470). (babel/babel-eslint#484) 2017-06-08 17:23:08 +01:00
Reyad Attiyat
45a9f64174 Use Node 8 and drop Node 5 from travis (babel/babel-eslint#483)
* Use Node 8 and drop Node 5 from travis

* switch the order [skip ci]
2017-06-06 20:38:49 -05:00
Reyad Attiyat
4e4aa05639 Update to Babylon 7 (fixes babel/babel-eslint#481) (babel/babel-eslint#482)
* Update to Babylon 7 (fixes babel/babel-eslint#481)

* Pin dependencies to alpha version

* fix deprecation, add other plugins

* oops

* Update index.js

* Add tests for private class properties with rules no-undef no-unused-vars
2017-06-06 20:37:57 -05:00
Reyad Attiyat
cb2eb3a1fb Fix: Convert RegExpLieteral value to RegExp object (fixes babel/babel-eslint#477) (babel/babel-eslint#478) 2017-05-29 20:41:14 -05:00
Sebastian McKenzie
b4daa5eae2 7.2.3 2017-04-21 22:14:19 +01:00
Andres Suarez
6feaee84e0 Fix flow type spread handling (babel/babel-eslint#465) 2017-04-21 11:48:52 -04:00
Henry Zhu
b5c058bf6e 7.2.2 2017-04-12 12:07:05 -04:00
Vitor Balocco
267731917b Fix: use eslint-scope instead of escope if present (babel/babel-eslint#461) 2017-04-12 17:59:23 +02:00
Andres Suarez
b8a3af8cd6 Separate finding peer deps from monkeypatching (babel/babel-eslint#460) 2017-03-30 13:49:51 -04:00
Andres Suarez
9a558bd942 Remove unused .gitmodules (babel/babel-eslint#457) 2017-03-25 19:36:10 -04:00
Andres Suarez
d78b0debd7 Use dedent for unpadding (babel/babel-eslint#456) 2017-03-25 19:32:05 -04:00
Henry Zhu
711c1e2f4b Merge pull request babel/babel-eslint#455 from babel/babylon-to-espree-tidy
Tidy up babylon-to-espree
2017-03-25 19:15:23 -04:00
Andres Suarez
2ca65d5451 Add type parameter scope tests (babel/babel-eslint#454) 2017-03-23 15:46:48 -04:00
Henry Zhu
e8b91f8862 7.2.1 2017-03-23 14:03:23 -04:00
Andres Suarez
26daac8690 Remove left over eslint 2 estraverse code (babel/babel-eslint#452)
This was missed in babel/babel-eslint#361
2017-03-23 14:02:24 -04:00
Andres Suarez
1c5400a670 Fix type param and interface declaration scoping (babel/babel-eslint#449) 2017-03-23 12:49:19 -04:00
Andres Suarez
700f62e28e Remove lodash dependency (babel/babel-eslint#450) 2017-03-22 22:35:31 -04:00
Andres Suarez
371488c102 Format non-regression errors for legibility (babel/babel-eslint#451) 2017-03-22 22:34:13 -04:00
Luís Couto
1cda9b6a80 Update README.md with codeFrame option (babel/babel-eslint#448) 2017-03-21 00:11:30 +00:00
Henry Zhu
f9b19189d7 7.2.0 2017-03-20 17:53:26 -04:00
wtgtybhertgeghgtwtg
d3c40a1851 Use lodash instead of lodash.pickby. (babel/babel-eslint#435) 2017-03-20 14:50:09 -07:00
Alex Rattray
65413344bd [flow] Process polymorphic type bounds on functions (babel/babel-eslint#444) 2017-03-20 14:46:07 -07:00
Luís Couto
2bee348c9a Add option to disable code frame. (babel/babel-eslint#446)
* Add option to disable code hightlight.

* Rename codeHighlight with codeFrame

* Add codeFrame tests

* Remove colors from test assertions
2017-03-20 21:45:11 +00:00
Henry Zhu
dccd5a7593 Merge pull request babel/babel-eslint#447 from kaicataldo/clean-up-eslint
Chore: Clean up and upgrades
2017-03-20 11:44:33 -04:00
Henry Zhu
b3c41bd5d7 remove deprecated rule examples [skip ci] 2017-02-28 23:41:03 -05:00
Henry Zhu
ad8a7e78e1 update readme [skip ci] 2017-02-28 23:39:49 -05:00
Henry Zhu
4f4d229e0a chore(package): update eslint-config-babel to version 6.0.0 (babel/babel-eslint#433)
* chore(package): update eslint-config-babel to version 6.0.0

Closes babel/babel-eslint#432

https://greenkeeper.io/

* Fix linting
2017-01-15 06:59:51 -05:00
Nazim Hajidin
d76cfe05b1 Update to use Node 4 features (babel/babel-eslint#425)
* Change for loops to forEach

* Change more for loops

* Arrow functions

* Use object shorthand

* Put this on one line

* Change back to using for loops
2017-01-14 17:15:54 -05:00
greenkeeper[bot]
fd2093914e chore(package): update eslint-config-babel to version 4.0.0 (babel/babel-eslint#430)
https://greenkeeper.io/
2017-01-10 19:36:02 +01:00
Henry Zhu
10864cfa71 add badges [skip ci] 2016-12-06 18:02:37 -05:00
Henry Zhu
38072c0716 Revert "use *" (babel/babel-eslint#426) 2016-12-02 16:51:16 -05:00
Henry Zhu
122acf8f81 use * (babel/babel-eslint#421) 2016-11-18 08:52:17 -05:00
greenkeeper[bot]
332da936b7 chore(package): update eslint-config-babel to version 3.0.0 (babel/babel-eslint#423)
https://greenkeeper.io/
2016-11-17 18:05:03 -05:00
Henry Zhu
f78ab342fd 7.1.1 2016-11-17 17:59:19 -05:00
greenkeeper[bot]
49625639f2 chore(package): update dependencies (babel/babel-eslint#422)
https://greenkeeper.io/
2016-11-17 17:57:52 -05:00
Henry Zhu
838bada36d append code frame on parse error (babel/babel-eslint#418) 2016-11-17 17:48:58 -05:00
Henry Zhu
1be2c47da6 chore(package): update babylon to version 6.13.0 (babel/babel-eslint#420)
https://greenkeeper.io/
2016-11-03 09:37:12 -04:00
Henry Zhu
8c12b515b8 chore(package): update eslint to version 3.9.1 (babel/babel-eslint#419)
https://greenkeeper.io/
2016-11-03 09:36:59 -04:00
Henry Zhu
93a4c3c699 7.1.0 2016-10-26 14:36:47 -04:00
Jordan Gensler
1d52247080 [import()] Adding support to lint dynamic imports (babel/babel-eslint#413)
* [import()] Adding support to lint dynamic imports

* [import()] Adding regression test to import
2016-10-17 14:40:06 -04:00
Steven Job
1f04cab99f Now using template strings (babel/babel-eslint#410)
* Use template strings in non-regression tests

* Refactor non-regression tests to fix test failures

Moved backtick to fix test 'getter/setter babel/babel-eslint#218' as indent matters
Fixed line numbers for some tests

* Use template strings in babel-eslint tests

* Fix tests for babel-eslint

Avoids error that shows when using template strings for tests:
	line 253 line comments
	line 260 block comments
	line 306 jsdoc

Error: At loc.start.column: are different (6 !== 0)

* Other small template literal changes

* Add unpad to correctly indent template literals
2016-10-17 19:27:20 +01:00
Daniel Tschinder
31f48f0651 Update test for eslint 3.8 (babel/babel-eslint#412)
* Update test for eslint 3.8

also ignore yarn lock

* Run lint only on latest version
2016-10-15 11:04:55 +02:00
Greenkeeper
610cf28dab Update eslint-config-babel to version 2.0.1 🚀 (babel/babel-eslint#408)
* chore(package): update eslint-config-babel to version 2.0.1

https://greenkeeper.io/

* Fix plugin
2016-10-10 14:36:10 +02:00
Nick
994eea7a53 docs: Update built-in support notes in README (babel/babel-eslint#398) [skip ci]
* docs: Update built-in support notes in README

eslint v3.6.0 supports ES2017 features

* docs: Update built-in support notes in README

eslint v3.6.0 supports ES2017 features
2016-09-29 21:25:35 +01:00
Henry Zhu
8d48eecc2f 7.0.0 2016-09-27 12:35:24 -04:00
Henry Zhu
aa6c5ccd45 updates 2016-09-27 12:34:26 -04:00
Henry Zhu
3c414db312 remove eslint 2 logic (babel/babel-eslint#361)
* remove old code

* remove async/await logic before eslint supported it

* not needed
2016-09-27 12:32:10 -04:00
Ville Immonen
ce6d9df192 Remove the lodash.assign dependency (babel/babel-eslint#393)
lodash.assign is deprecated:
```
npm WARN deprecated lodash.assign@4.2.0: This package is deprecated.
Use Object.assign.
```
2016-09-27 18:32:52 +03:00
Greenkeeper
33343e6688 chore(package): update babylon to version 6.11.2 (babel/babel-eslint#391)
https://greenkeeper.io/
2016-09-27 14:43:22 +02:00
Greenkeeper
2339c8af0f chore(package): update espree to version 3.3.1 (babel/babel-eslint#394)
https://greenkeeper.io/
2016-09-27 14:43:14 +02:00
Greenkeeper
93a73cc483 chore(package): update eslint to version 3.6.0 (babel/babel-eslint#392)
https://greenkeeper.io/
2016-09-27 14:43:03 +02:00
Henry Zhu
3d4e8cfea3 update test line number [skip ci] 2016-09-27 08:42:41 -04:00
Dan Harper
f97d83d847 eslint-plugin-flow-vars -> eslint-plugin-flowtype (babel/babel-eslint#374) [skip ci] 2016-09-09 16:28:19 +01:00
Henry Zhu
9c70c76cfd add deps for npm 2 2016-09-09 11:26:47 -04:00
Henry Zhu
313388b293 typo 2016-08-03 09:36:15 -04:00
Henry Zhu
2b812b087c Merge pull request babel/babel-eslint#354 from babel/eslint-config-babel
Use eslint-config-babel
2016-08-03 09:34:51 -04:00
Greenkeeper
481329a47e chore(package): update mocha to version 3.0.0 (babel/babel-eslint#356)
https://greenkeeper.io/
2016-08-02 04:34:39 +02:00
Henry Zhu
50e0abfd16 Drop node < 4 (babel/babel-eslint#358) 2016-08-01 15:00:01 -04:00
Daniel Tschinder
0534eb7644 Fix tests for eslint 3.2 (babel/babel-eslint#352) 2016-07-30 19:44:42 +02:00
Daniel Tschinder
289bf4f84a Add note about eslint 3 [skip ci] 2016-07-11 01:18:41 +02:00
Daniel Tschinder
af44a1cc83 Test eslint 3 and 2 on travis (babel/babel-eslint#340)
closes babel/babel-eslint#332
2016-07-11 00:28:57 +02:00
Daniel Tschinder
0cb35ab04e Fix tests for eslint 3.0
Seems that eslint got a lot smarter and reports vars that are used, but are useless as unused
These examples are also failing with espree
2016-07-10 23:47:44 +02:00
Henry Zhu
b0dbbfcc03 6.1.2 2016-07-09 11:40:34 -04:00
Toru Nagashima
1766a21145 Fix: improve handling of class properties (fixes babel/babel-eslint#337) (babel/babel-eslint#338)
I added ClassProperty method into Referencer of escope. This method will
address class properties and those type anotations.
2016-07-10 00:40:08 +09:00
Henry Zhu
52d9c34465 6.1.1 2016-07-08 14:23:39 -04:00
Henry Zhu
9ee5e6e59c Create a variable for class properties in scope instead of deleting the key (babel/babel-eslint#336) 2016-07-08 14:23:04 -04:00
Henry Zhu
66a4cf578f remove hardcoded strict mode value (babel/babel-eslint#331) 2016-06-27 01:53:27 -04:00
Daniel Tschinder
19baee2242 Add testcase for space-comment and shebang babel/babel-eslint#163
This works as of babylon 6.8.2
2016-06-26 22:50:50 +02:00
Daniel Tschinder
ce54b07e2d Testcase for newline-before-return shouldn't fail with comments. (babel/babel-eslint#300) 2016-06-26 21:52:39 +02:00
Henry Zhu
167b8bf0a0 6.1.0 2016-06-22 16:37:11 -04:00
rhettlivingston
ab9afd33d1 Add allowImportExportEverywhere parserOption (babel/babel-eslint#327) (babel/babel-eslint#329)
* Add allowImportExportEverywhere parserOption (babel/babel-eslint#327)

* Added "allowImportExportEverywhere option (babel/babel-eslint#327)" test.
2016-06-22 16:36:47 -04:00
Henry Zhu
4d473c3305 6.0.5 2016-06-20 17:12:33 -04:00
Daniel Tschinder
93a9a8d638 Reset TypeParameters to Identifier (babel/babel-eslint#325) 2016-06-20 23:11:38 +02:00
Henry Zhu
c8fe9136d7 add a message about using the default parser (babel/babel-eslint#306)
* add a message about using the default parser

* decrease the size
2016-05-02 08:41:41 -04:00
Daniel Tschinder
97af2b0b62 Add regression test for babel/babel-eslint#223 (babel/babel-eslint#305) 2016-04-29 23:23:13 +02:00
Daniel Tschinder
81ce743986 Add node 6 to travis tests. 2016-04-29 23:22:40 +02:00
Daniel Tschinder
2b66040f0d Add tests for two issues and rename test suite (babel/babel-eslint#304) 2016-04-29 23:07:02 +02:00
Daniel Tschinder
872449d6fc Add configuration section to README (babel/babel-eslint#303) 2016-04-26 18:11:33 +02:00
Henry Zhu
a2f345b24b add changelog command 2016-04-25 18:00:58 -04:00
Henry Zhu
161edcca48 6.0.4 2016-04-25 17:55:19 -04:00
Rafał Ruciński
cfd35799da Fix parent not being set for decorator nodes. (babel/babel-eslint#296) 2016-04-25 23:51:43 +02:00
Daniel Tschinder
0ccbceb9e8 Ensure strictmode is enabled/disabled when changing sourceType (babel/babel-eslint#302) 2016-04-25 15:41:43 +02:00
Daniel Tschinder
cbc0475634 Update lodash and replace pick by pickBy (babel/babel-eslint#301) 2016-04-25 01:14:39 +02:00
Daniel Tschinder
cf456bfe4a Fix escope to take sourceType and ecmaVersion from options (babel/babel-eslint#288)
escope was hardcoded to sourcetype: "module" and ecmaVersion: "6"
This changes it to take the configuration from the eslint options and still
defaulting to "module" and "6".
This is done by having to global variables, as monkeypatch is only triggered once.
To fix scoping issues, the same logic as in eslint is applied. It disables the nodejs scope
if the sourceType is module.
2016-04-20 02:56:15 +02:00
Rafał Ruciński
fd36e3cf8d Declare eslint call more simply in the scripts. (babel/babel-eslint#297) 2016-04-20 02:55:24 +02:00
Rafał Ruciński
149dd082f3 Add root: true to eslint config. (babel/babel-eslint#294)
This prevents taking user's eslint config files that are higher in the
directory structure into consideration.
2016-04-18 04:01:15 +02:00
Rafał Ruciński
44ff360379 Make npm scripts work on Windows too. (babel/babel-eslint#295) 2016-04-18 03:59:08 +02:00
Henry Zhu
8a089b65fb 6.0.2 2016-03-31 19:14:07 -04:00
Henry Zhu
3c9ef8ec7e Merge pull request babel/babel-eslint#285 from josh/revert-282-no-implicit-globals-regression
Revert "Fix processing sourceType: script"
2016-03-31 19:09:30 -04:00
Henry Zhu
1fe0d4a94b Merge pull request babel/babel-eslint#282 from josh/no-implicit-globals-regression
Fix processing sourceType: script
2016-03-31 16:49:31 -04:00
Henry Zhu
cccce9d0ab update install instructions for eslint 1 and 2 2016-03-28 18:23:37 -04:00
Henry Zhu
c6401945d9 6.0.0 2016-03-25 23:51:29 -04:00
Henry Zhu
c6a69b763f 6.0.0-beta.6 2016-03-14 08:37:34 -04:00
Henry Zhu
080f0c7b22 Merge pull request babel/babel-eslint#273 from mysticatea/fix-monkeypatching-for-2.3.0
Fix: Remove throwing an error when estraverse-fb has not found.
2016-03-14 08:36:44 -04:00
Henry Zhu
2c6b323a62 6.0.0-beta.5 2016-03-08 11:06:58 -05:00
Henry Zhu
b42d59b29c errror on estraverse-fb.. 2016-03-08 11:06:47 -05:00
Henry Zhu
c8ff9bad93 6.0.0-beta.4 2016-03-08 11:04:19 -05:00
Henry Zhu
7fbf6111e3 just throw an error right now instead of it silently working but with bugs 2016-03-08 10:57:22 -05:00
Henry Zhu
d75bd7b82c 6.0.0-beta.3 2016-03-07 23:13:50 -05:00
Henry Zhu
217f83fd56 Merge pull request babel/babel-eslint#271 from danez/fix-use-before-define
Remove visiting of properties left of spread, fixes babel/babel-eslint#249.
2016-03-07 23:09:46 -05:00
Henry Zhu
6e3aa3357c Merge pull request babel/babel-eslint#272 from kaicataldo/fixes259
Update readme to fix npm registry escaped HTML (fixes babel/babel-eslint#259)
2016-03-07 23:09:33 -05:00
Henry Zhu
e886404171 6.0.0-beta.2 2016-03-07 12:34:10 -05:00
Henry Zhu
4a8c6d8a8b Merge pull request babel/babel-eslint#270 from danez/cleanup-monkey
remove monkey-patching of patternVisitor as unused
2016-03-07 08:31:48 -05:00
Henry Zhu
a827ab2d4e Merge pull request babel/babel-eslint#269 from babel/eslint-2.3.0
try catch estraverse-fb since eslint removed it in 2.3.0, temp skip b…
2016-03-06 22:29:51 -05:00
Henry Zhu
c3915b9798 6.0.0-beta.1 2016-03-01 22:39:34 -05:00
Henry Zhu
c28b839c17 Update README.md 2016-03-01 22:37:28 -05:00
Henry Zhu
511862c4ee Merge pull request babel/babel-eslint#264 from hzoo/eslint2
ESLint 2
2016-03-01 22:34:53 -05:00
Henry Zhu
dce22ce5f6 Merge pull request babel/babel-eslint#257 from gmaclennan/patch-1
Update README.md install docs for eslint v1.x
2016-02-27 10:23:01 -05:00
Henry Zhu
edc91849cb Update .travis.yml 2016-02-16 18:13:32 -05:00
Henry Zhu
f117721251 5.0.0 2016-02-16 18:06:37 -05:00
Henry Zhu
5df6babfad Update README.md 2016-02-16 17:43:05 -05:00
Henry Zhu
e4f43aa51b Merge pull request babel/babel-eslint#255 from deepsweet/npm-ignore
include only necessary files in npm package
2016-02-16 12:32:56 -05:00
Henry Zhu
05f708c330 Merge pull request babel/babel-eslint#250 from danez/patch-1
Testcase for babel/babel-eslint#239
2016-02-02 17:11:01 -05:00
Henry Zhu
8f9f800dc5 5.0.0-beta10 2016-02-01 23:06:09 -05:00
Henry Zhu
83debbfda0 Merge pull request babel/babel-eslint#246 from babel/escope-patterns
Prevent escope referencer from traversing into param pattern type annotations
2016-02-01 23:05:06 -05:00
Henry Zhu
c1bec5c4de check using __esModule 2016-02-01 20:22:03 -05:00
Henry Zhu
740a546249 5.0.0-beta9 2016-02-01 14:40:54 -05:00
Henry Zhu
a55236d383 Merge pull request babel/babel-eslint#244 from christophehurpeau/patch-1
fix babel/babel-eslint#243
2016-02-01 14:40:01 -05:00
Henry Zhu
e2464f462e 5.0.0-beta8 2016-01-30 12:20:15 -05:00
Henry Zhu
177c0b4979 Add a test for use strict and directive ast change
Fixes babel/babel-eslint#242
2016-01-30 12:19:44 -05:00
Henry Zhu
167741b80b 5.0.0-beta7 2016-01-30 10:37:21 -05:00
Henry Zhu
f083e49a63 Merge pull request babel/babel-eslint#241 from jmm/rule-strict
Add tests for `strict` rule
2016-01-30 10:34:38 -05:00
Henry Zhu
9380324a0f temporarily remove test 2016-01-30 10:32:47 -05:00
Henry Zhu
0778f623fb Merge pull request babel/babel-eslint#232 from vaibhavmule/patch-1
update Licenses date
2016-01-16 00:16:50 -05:00
Henry Zhu
1adc834b10 skip for now 2015-12-29 13:48:29 -05:00
Henry Zhu
c510fa79d0 add test for es6 unicode escapes 2015-12-29 13:44:12 -05:00
Henry Zhu
02d63b7ec4 5.0.0-beta6 2015-12-09 08:42:02 -05:00
Henry Zhu
c35137040a update acorn-to-esprima, account for getter/setter kind property 2015-12-09 08:40:27 -05:00
Henry Zhu
3b673ef4b6 5.0.0-beta5 2015-12-09 08:27:37 -05:00
Henry Zhu
318a530dfa update acorn-to-esprima, add getter/setter tests 2015-12-09 08:27:19 -05:00
Henry Zhu
fa7dfc272a update eslint 2015-12-01 09:58:43 -05:00
Henry Zhu
423683e7ef 5.0.0-beta4 2015-11-29 08:24:29 -05:00
Henry Zhu
c078e11bcf update acorn-to-esprima to 2.0.1 2015-11-29 08:24:10 -05:00
Henry Zhu
61e1c5b546 5.0.0-beta3 2015-11-28 16:31:24 -05:00
Henry Zhu
4249dcd353 update acorn-to-esprima, add tests for babel/babel-eslint#216 2015-11-28 16:31:13 -05:00
Henry Zhu
f76be581b3 5.0.0-beta2 2015-11-27 15:45:09 -05:00
Henry Zhu
faa003168c add functionSent to parser 2015-11-27 15:44:07 -05:00
Henry Zhu
204ba86418 Merge pull request babel/babel-eslint#215 from zertosh/master
babylon/espree option alignment
2015-11-27 15:42:16 -05:00
Henry Zhu
c435628b6a 5.0.0-beta1 2015-11-26 14:46:42 -05:00
Henry Zhu
72e8f9d969 Merge pull request babel/babel-eslint#202 from hzoo/babel6
Update to babel 6
2015-11-26 14:44:37 -05:00
Henry Zhu
27c9abfae5 4.1.6 2015-11-23 21:19:53 -05:00
Henry Zhu
78361c1518 skip for now 2015-11-23 21:19:08 -05:00
Henry Zhu
12dd87f96b add node 5 2015-11-23 20:38:48 -05:00
Henry Zhu
2ddb2d4c89 test for no-redeclare 2015-11-23 20:37:44 -05:00
Henry Zhu
3d901f5960 Merge pull request babel/babel-eslint#212 from evocateur/fix-with-latest-eslint
Avoid errors with eslint 1.10.x when excluding destructured properties
2015-11-23 20:33:39 -05:00
Henry Zhu
0859607b4e Merge pull request babel/babel-eslint#209 from Constellation/pattern-visitor
Patch SpreadProperty to escope's PatternVisitor
2015-11-23 13:34:48 -05:00
Henry Zhu
5352ad41c5 mention eslint-plugin-flow-vars for flow issues 2015-11-15 20:59:48 -05:00
Henry Zhu
8f9cc6b827 4.1.5 2015-11-09 21:11:56 -05:00
Henry Zhu
a294ab4545 Merge pull request babel/babel-eslint#206 from mysticatea/fix-for-eslint-1.9
Fix for ESLint@1.9 and npm@3
2015-11-09 21:04:45 -05:00
Henry Zhu
d08053d483 4.1.4 2015-11-04 09:51:00 -05:00
Henry Zhu
677d42f7ad update eslint, acorn-to-esprima 2015-11-01 10:10:08 -05:00
Henry Zhu
b4fb1d3aca test with ecmaFeatures on by default, add test for babel/babel-eslint#192
Ref babel/babel-eslint#192
2015-10-07 20:23:41 -04:00
Henry Zhu
dd8ba490ee update readme, add contributing 2015-10-07 20:11:00 -04:00
Henry Zhu
afd72ba541 update packages 2015-10-07 20:05:11 -04:00
Henry Zhu
463cda9a10 4.1.3 2015-09-17 09:42:26 -04:00
Henry Zhu
b5e0dbe8e8 check AssignmentPattern types - fixes babel/babel-eslint#184 2015-09-17 09:42:18 -04:00
Henry Zhu
6dc026c203 un-comment babel/babel-eslint#124 test 2015-09-15 09:20:14 -04:00
Henry Zhu
cc4ce5bbed add node 4 to travis 2015-09-14 14:48:14 -04:00
Henry Zhu
95c4c77df1 4.1.2 2015-09-14 14:45:10 -04:00
Henry Zhu
c0a7ebf51b fix attachComment typo, add comment tests 2015-09-14 14:26:21 -04:00
Henry Zhu
742b1cb65d Merge pull request babel/babel-eslint#182 from bryanrsmith/patch-1
fix typo in comment
2015-09-11 18:38:53 -04:00
Henry Zhu
229a1922d8 4.1.1 2015-08-31 10:23:10 -04:00
Henry Zhu
2b17528c5d Merge pull request babel/babel-eslint#180 from hzoo/master
update eslint, acorn-to-esprima - ref eslint/eslint#3596
2015-08-31 10:22:52 -04:00
Henry Zhu
61243967ac 4.1.0 2015-08-25 12:14:17 -04:00
Henry Zhu
4cdf59532d Merge pull request babel/babel-eslint#177 from hzoo/use-acorn-to-esprima
use `acorn-to-esprima` package
2015-08-25 12:11:24 -04:00
Henry Zhu
b2405a9924 lint fix, lint task 2015-08-20 15:07:05 -04:00
Henry Zhu
8812bf735e update espree, update eslintester for eslint 1.0 2015-08-20 15:04:30 -04:00
Henry Zhu
ac163a64fe do not use local 2015-08-20 14:41:06 -04:00
Henry Zhu
412aee0be0 update eslint to 1.2.0 2015-08-20 14:39:37 -04:00
Henry Zhu
fea7ef937e remove note about babel-eslint being experimental 2015-08-19 09:46:50 -04:00
Henry Zhu
03492bae52 4.0.10 2015-08-16 22:49:15 -04:00
Henry Zhu
e8c6b4e988 Merge pull request babel/babel-eslint#165 from hzoo/remove-spread-transform
use SpreadProperty type, revert other transforms
2015-08-16 22:48:56 -04:00
Henry Zhu
8d46c00125 4.0.9 2015-08-16 22:33:38 -04:00
Henry Zhu
2140a08e3e Merge pull request babel/babel-eslint#170 from hzoo/remove-super-transform
remove super transform since it should be in espree
2015-08-16 21:54:01 -04:00
Henry Zhu
d06c003344 4.0.8 2015-08-16 16:12:18 -04:00
Henry Zhu
9740af8be4 Merge pull request babel/babel-eslint#169 from hzoo/i-168
async func and space-before-function-paren
2015-08-16 16:11:57 -04:00
Henry Zhu
5b57763788 4.0.7 2015-08-15 19:49:44 -04:00
Henry Zhu
69c303ea00 Merge pull request babel/babel-eslint#166 from hzoo/remove-async-transform
remove async func transform
2015-08-15 19:49:21 -04:00
Henry Zhu
7d8de4e2ae 4.0.6 2015-08-15 09:25:14 -04:00
Henry Zhu
cd0f5ccc93 add older tests 2015-08-15 09:24:14 -04:00
Henry Zhu
6476a8d916 Merge pull request babel/babel-eslint#164 from hzoo/remove-rest-transform
Remove rest transform
2015-08-15 08:48:41 -04:00
Henry Zhu
839c5ed577 use --follow-tags 2015-08-14 22:00:25 -04:00
Henry Zhu
21294eb228 update to eslint@1.1.0 2015-08-14 22:00:10 -04:00
Henry Zhu
71ab33eff4 update to eslint 1.0.0, fix tests 2015-08-03 10:57:06 -04:00
Sebastian McKenzie
4255c0f812 4.0.5 2015-07-27 04:20:26 +01:00
Sebastian McKenzie
436716fdd7 update babel-core to 5.6.9 2015-07-27 04:20:19 +01:00
Sebastian McKenzie
f79577a7ec add Makefile 2015-07-27 04:07:19 +01:00
Sebastian McKenzie
18b029ca88 4.0.4 2015-07-27 04:04:37 +01:00
Sebastian McKenzie
2c868efbad fix range generation for template tokens - fixes babel/babel-eslint#156 2015-07-27 04:04:30 +01:00
Sebastian McKenzie
39e9fc9e40 4.0.3 2015-07-27 02:58:45 +01:00
Sebastian McKenzie
19e2f1bb33 use start/end rather than directly using range in attachComments 2015-07-27 02:58:37 +01:00
Sebastian McKenzie
af51b545ba 4.0.2 2015-07-27 02:44:56 +01:00
Sebastian McKenzie
582cf6cc8a add missing ranges 2015-07-27 02:44:49 +01:00
Sebastian McKenzie
06ccbca763 4.0.1 2015-07-27 02:21:29 +01:00
Sebastian McKenzie
56a27a0647 add range property - fixes babel/babel-eslint#155 2015-07-27 02:21:18 +01:00
Henry Zhu
4437132372 4.0.0 2015-07-25 11:08:25 -04:00
Henry Zhu
c5bbf91892 Merge pull request babel/babel-eslint#152 from bgw/line-x
Replace 'Line X' with actual line number
2015-07-25 11:08:08 -04:00
Henry Zhu
d4318aa0d8 Merge pull request babel/babel-eslint#128 from hzoo/i-124
add tests - for babel/babel-eslint#124
2015-07-25 11:00:42 -04:00
Henry Zhu
80888a1b23 3.1.27 2015-07-25 10:53:17 -04:00
Henry Zhu
8d65e3e894 Merge pull request babel/babel-eslint#154 from alexkuz/master
fix visiting filter in comprehension
2015-07-25 10:08:31 -04:00
Henry Zhu
bb29041dce 3.1.26 2015-07-22 01:35:33 -04:00
Henry Zhu
9c452f5b14 remove estraverse attach comments method, fix up tests 2015-07-22 00:36:03 -04:00
Henry Zhu
2bb5101112 add test for babel/babel-eslint#149 2015-07-21 23:57:13 -04:00
Sebastian McKenzie
ec9a75173b 3.1.25 2015-07-22 01:19:45 +01:00
Sebastian McKenzie
c551545f29 filter comment tokens - fixes babel/babel-eslint#153 2015-07-22 01:19:23 +01:00
Sebastian McKenzie
8baea68c6c 3.1.24 2015-07-21 22:34:24 +01:00
Sebastian McKenzie
e7aecdce71 convert comment node types from babel to espree - ref facebook/react#4449 2015-07-21 22:34:14 +01:00
Henry Zhu
61555c6ebd fix typo: attachComment -> attachComments 2015-07-10 18:37:45 -04:00
Henry Zhu
efef3af7b8 update readme - separate channel/signup, categorize known issues better 2015-07-09 13:11:14 -04:00
Henry Zhu
39fa1c4ac2 3.1.23 2015-07-06 10:40:56 -04:00
Henry Zhu
05f5cc3ea8 Merge pull request babel/babel-eslint#146 from hzoo/i-142-2
use node.babelType for SpreadProperty
2015-07-06 10:40:11 -04:00
Henry Zhu
f57dde1ac3 3.1.22 2015-07-06 09:38:11 -04:00
Henry Zhu
d9bf8d252e fix no-unused-vars issue with spread
Use a private _spread property on Property node instead of SpreadProperty

Fixes https://github.com/babel/babel-eslint/issues/142#issuecomment-118707124
2015-07-06 09:36:34 -04:00
Henry Zhu
8c4adbf98d 3.1.21 2015-07-05 22:08:19 -04:00
Henry Zhu
4e884f439e Merge pull request babel/babel-eslint#143 from hzoo/i-142
only visit properties in object destructuring when there is a SpreadP…
2015-07-05 22:06:15 -04:00
Henry Zhu
78a7af3c0a add known issue for babel/babel-eslint#130 - no-undef for global flow types 2015-07-01 11:38:00 -04:00
Henry Zhu
b26b8efca4 add known issue for babel/babel-eslint#136 2015-07-01 11:27:42 -04:00
Henry Zhu
0de11015cc update devDep eslint@0.24.0 2015-06-29 14:19:06 -04:00
Henry Zhu
6b05576d99 3.1.20 2015-06-29 13:51:50 -04:00
Henry Zhu
dee7261bbe Merge pull request babel/babel-eslint#140 from hzoo/i-138
create scope for each comprehension - fixes babel/babel-eslint#138
2015-06-29 13:48:19 -04:00
Sebastian McKenzie
1502bf6a2d 3.1.19 2015-06-26 15:06:21 +01:00
Sebastian McKenzie
e72e79694f attempt to resolve estraverse relative to esrecurse if found - this is necessary because of the tree flattening in npm 3 2015-06-26 15:06:18 +01:00
Henry Zhu
b05ae77e41 3.1.18 2015-06-23 18:32:44 -04:00
Henry Zhu
7ff5dd56e8 Merge pull request babel/babel-eslint#135 from PiPeep/fix-jest
Fix eslint module path resolution in jest
2015-06-23 18:32:09 -04:00
Henry Zhu
c22414c1fd fix tests after updating babel 2015-06-22 17:00:31 -04:00
Henry Zhu
96a9af0a06 update eslint, update tests 2015-06-22 16:48:51 -04:00
Henry Zhu
cec51daa04 add message about using eslint-plugin-babel 2015-06-18 21:22:59 -04:00
Henry Zhu
c3b0bb21e9 3.1.17 2015-06-17 20:32:16 -04:00
Henry Zhu
cf57c817cb Known Issues: add flow declarations with 'no-unused-vars' 2015-06-17 20:31:58 -04:00
Henry Zhu
0de733b66a flow: create var declaration for flow declarations 2015-06-17 09:18:51 -04:00
Henry Zhu
d16f726b15 3.1.16 2015-06-17 07:18:47 -04:00
Henry Zhu
d224153cba Merge pull request babel/babel-eslint#133 from hzoo/i-132
support flow declarations correctly, lint - fixes babel/babel-eslint#132
2015-06-17 07:17:26 -04:00
Henry Zhu
da3d4bf537 Known Issue: object-shorthand with spread operator 2015-06-15 20:25:44 -04:00
Henry Zhu
0c47ebe881 fix build.. 2015-06-10 17:11:21 -04:00
Henry Zhu
eaec0f1595 remove uneeded param 2015-06-10 17:07:53 -04:00
Henry Zhu
d5e2ac1fb6 3.1.15 2015-06-09 15:01:13 -04:00
Henry Zhu
1c25c8eed3 Merge pull request babel/babel-eslint#126 from leebyron/fix-flow-type
Fixes flow type scoping issues - fixes babel/babel-eslint#123
2015-06-09 15:00:38 -04:00
Henry Zhu
d83aa7f6ce clarify known eslint issues, add to link slack channel for questions 2015-06-08 09:41:12 -04:00
Henry Zhu
4ba3178d8e Merge pull request babel/babel-eslint#116 from hzoo/eslint-tests
Add eslint submodule to run eslint tests - Ref babel/babel-eslint#62
2015-06-08 09:37:55 -04:00
Henry Zhu
5d23153aed 3.1.14 2015-06-06 16:55:00 -04:00
Henry Zhu
adc009b832 Merge pull request babel/babel-eslint#122 from hzoo/i-95
visit properties in ObjectPattern - fixes babel/babel-eslint#95
2015-06-06 16:54:05 -04:00
Henry Zhu
c15a7c6b65 lint: fix quotes, rule 2015-06-06 09:21:23 -04:00
Henry Zhu
face6ff6af add lint config from babel, lint 2015-06-06 09:14:24 -04:00
Henry Zhu
c38ea387e5 3.1.13 2015-06-05 05:29:59 -04:00
Henry Zhu
84a8d342f2 Merge pull request babel/babel-eslint#121 from hzoo/i-120
don't visit var decl - fixes babel/babel-eslint#120
2015-06-05 05:24:20 -04:00
Sebastian McKenzie
8d3a7244c3 3.1.12 2015-06-05 10:00:26 +01:00
Sebastian McKenzie
b10c9b0357 update to babel 5.5.1 2015-06-05 10:00:15 +01:00
Henry Zhu
6bcdfb11cc 3.1.11 2015-06-03 17:13:06 -04:00
Henry Zhu
6a2938deaa Merge pull request babel/babel-eslint#118 from hzoo/poly-types
add flow exceptions for polymorphic types (<A>) - Ref babel/babel-eslint#109
2015-06-03 17:11:28 -04:00
Henry Zhu
ade0b3b21b Merge pull request babel/babel-eslint#114 from hzoo/i-9
support comprehensions (no-undef) - fixes babel/babel-eslint#9
2015-06-03 17:06:42 -04:00
Henry Zhu
e6ba27075e 3.1.10 2015-06-01 21:18:54 -04:00
Henry Zhu
a4f6edab85 Merge pull request babel/babel-eslint#109 from hzoo/i-108
visit flow types - fixes babel/babel-eslint#108
2015-06-01 21:16:02 -04:00
Henry Zhu
866a77a8cc Merge pull request babel/babel-eslint#117 from hzoo/eslint-0.22.1
update to eslint@0.22.1
2015-06-01 21:14:33 -04:00
Sebastian McKenzie
b95ea1092e 3.1.9 2015-05-25 05:48:21 +01:00
Sebastian McKenzie
7f0ce79fae Merge pull request babel/babel-eslint#113 from babel/paths
Use Path-based introspection methods rather than node-based
2015-05-25 05:48:08 +01:00
Henry Zhu
813ede0cd5 3.1.8 2015-05-22 21:05:00 -04:00
Henry Zhu
b845304ce2 update readme about issues/jsx 2015-05-22 21:04:00 -04:00
Henry Zhu
9cc077638a add all espree ecmaFeatures, fixes babel/babel-eslint#31 again 2015-05-21 07:46:01 -04:00
Henry Zhu
573020678a 3.1.7 2015-05-21 06:51:52 -04:00
Henry Zhu
48c23ad8ef remove from dependency (update devDependency 2015-05-21 06:51:17 -04:00
Henry Zhu
1230588b98 3.1.6 2015-05-20 19:06:06 -04:00
Henry Zhu
0e50a0b6e0 Merge pull request babel/babel-eslint#105 from hzoo/visit-decorators
patch escope to visit decorators - fixes babel/babel-eslint#72
2015-05-20 19:03:56 -04:00
Henry Zhu
80114dda35 Merge pull request babel/babel-eslint#107 from hzoo/update-eslint
eslint@0.21.2
2015-05-20 18:14:18 -04:00
Henry Zhu
a5f9a8fea0 3.1.5 2015-05-17 17:13:40 -04:00
Henry Zhu
7fa06fa566 add test for babel/babel-eslint#66 2015-05-16 23:26:48 -04:00
Henry Zhu
47a771a7b1 Merge pull request babel/babel-eslint#100 from babel/es7.functionBind
add ES7 function bind (::) as Punctuator
2015-05-16 23:23:28 -04:00
Henry Zhu
82f3fe4147 Merge pull request babel/babel-eslint#101 from hzoo/more-jsx
add JSXText type, more tests
2015-05-16 23:22:53 -04:00
Sebastian McKenzie
54adf244dd 3.1.4 2015-05-16 23:17:12 +01:00
Sebastian McKenzie
b699e4f2aa add support for type cast expressions - fixes babel/babel-eslint#102 2015-05-16 23:17:03 +01:00
Sebastian McKenzie
5ba504f809 3.1.3 2015-05-15 20:55:56 +01:00
Henry Zhu
730f2528dc Merge pull request babel/babel-eslint#97 from hzoo/fix-templates
fix template type issues
2015-05-15 14:42:28 -04:00
Sebastian McKenzie
9731e496c8 3.1.2 2015-05-14 21:39:13 +01:00
Sebastian McKenzie
d84fc559f2 Merge pull request babel/babel-eslint#94 from hzoo/support-templates
support template strings - Fixes babel/babel-eslint#31
2015-05-14 21:38:56 +01:00
Sebastian McKenzie
527287aa29 Merge pull request babel/babel-eslint#93 from hzoo/tokenTypes
add tokenTypes: Null, Boolean, RegularExpression
2015-05-13 00:27:19 +01:00
Sebastian McKenzie
758e8d40e5 Merge pull request babel/babel-eslint#90 from hzoo/morePunctuatorTypes
change more tokentypes to be punctuator - fixes babel/babel-eslint#59
2015-05-11 08:15:41 +01:00
Sebastian McKenzie
0f13e5708b 3.1.1 2015-05-07 13:49:05 +01:00
Sebastian McKenzie
77c5b0f3b7 Merge pull request babel/babel-eslint#86 from hzoo/patchestraverse-fb
also patch estraverse-fb - fixes babel/babel-eslint#73
2015-05-07 13:48:32 +01:00
Sebastian McKenzie
e571aec2ff 3.1.0 2015-05-06 17:19:48 +01:00
Sebastian McKenzie
46f65bcf49 Merge pull request babel/babel-eslint#76 from Cellule/attach_comments
Attach comments to ast using estraverse
2015-05-06 17:19:30 +01:00
Sebastian McKenzie
47c1673092 remove flow types and class property keys 2015-04-13 18:05:58 -07:00
Sebastian McKenzie
d301c8e099 upgrade to babel 5.1.8 2015-04-13 17:12:08 -07:00
Sebastian McKenzie
729cedc925 Merge branch 'master' of github.com:babel/babel-eslint 2015-04-08 22:07:28 -07:00
Sebastian McKenzie
4a531aaba4 port to babel 5.0.0 2015-04-08 22:07:21 -07:00
Sebastian McKenzie
ded2e420b1 bump version 2015-03-16 12:49:43 +11:00
Sebastian McKenzie
b9ae556f9f add sourceType property 2015-03-16 12:49:38 +11:00
Sebastian McKenzie
ce91f1869b Merge pull request babel/babel-eslint#50 from UltCombo/fix-48
acorn-to-esprima: fix ExportNamedDeclaration, closes babel/babel-eslint#48
2015-03-16 12:42:57 +11:00
Sebastian McKenzie
0d0cc6bb83 Merge pull request babel/babel-eslint#44 from Globegitter/patch-1
Added global flag to install command
2015-03-11 21:35:12 +11:00
Sebastian McKenzie
665f0d6002 upgrade babel-core to 4.7.8 2015-03-11 01:15:32 +11:00
Sebastian McKenzie
fcb367666d add class usage non regression test 2015-03-11 01:15:15 +11:00
Sebastian McKenzie
cbe8c84ec1 add messages to non regression test output 2015-03-11 00:40:11 +11:00
Sebastian McKenzie
3fced333e8 bump to 2.0.0 2015-03-11 00:40:00 +11:00
Sebastian McKenzie
6762396aec fix module conversion 2015-03-11 00:35:00 +11:00
Sebastian McKenzie
7625971974 Merge branch 'master' of github.com:babel/babel-eslint 2015-03-11 00:17:22 +11:00
Sebastian McKenzie
24eef21756 convert playground assignment operators - fixes babel/babel-eslint#40 2015-03-11 00:15:07 +11:00
Sebastian McKenzie
64b63e44bf update to babel-core and eslint 0.16 2015-03-11 00:13:34 +11:00
Sebastian McKenzie
47e3808aa4 update to eslint 0.16, remove certain mangling 2015-03-10 18:18:35 +11:00
Sebastian McKenzie
78ca83eb6f 1.0.14 2015-03-09 02:46:17 +11:00
Sebastian McKenzie
6556b06f23 Merge branch 'master' of github.com:babel/babel-eslint 2015-03-09 02:45:56 +11:00
Sebastian McKenzie
a31835836d bump version 2015-03-04 22:29:49 +11:00
Sebastian McKenzie
71a5782ab7 make spread properties computed - fixes babel/babel-eslint#16 2015-03-02 12:31:08 +11:00
Sebastian McKenzie
9a77a7dbaa ensure function expression body is a block statement - fixes babel/babel-eslint#20 2015-03-02 12:25:08 +11:00
Sebastian McKenzie
955dd1e126 turn async functions into generators - fixes babel/babel-eslint#22 2015-03-02 12:04:59 +11:00
Sebastian McKenzie
02f4f5e885 turn super references into a this expression - fixes babel/babel-eslint#10 2015-02-28 17:37:12 +11:00
Sebastian McKenzie
e08a0fab99 Merge branch 'master' of github.com:babel/babel-eslint 2015-02-28 17:07:28 +11:00
Sebastian McKenzie
e4cee14aa6 better XJSIdentifier -> Identifier logic - fixes babel/babel-eslint#12 2015-02-28 17:07:11 +11:00
Sebastian McKenzie
0f1910891d explode all rest elements - fixes babel/babel-eslint#11 2015-02-28 16:33:21 +11:00
Sebastian McKenzie
1cc579cb5d move up explantory paragraph 2015-02-28 12:09:20 +11:00
Sebastian McKenzie
e891659b21 bump version 2015-02-28 12:07:33 +11:00
Sebastian McKenzie
bde03060a5 remove ClassDeclaration transformation 2015-02-28 12:07:21 +11:00
Sebastian McKenzie
24aa904d99 add how does it work section to readme 2015-02-28 12:03:01 +11:00
Sebastian McKenzie
5b2df4ce30 bump version 2015-02-28 11:59:26 +11:00
Sebastian McKenzie
1ca488c3ec turn class declarations into variable declarations - fixes babel/babel-eslint#8 2015-02-28 11:58:56 +11:00
Sebastian McKenzie
9117398452 bump version 2015-02-28 11:50:44 +11:00
Sebastian McKenzie
1d1d7a5145 transform JSX identifiers and member expressions - fixes babel/babel-eslint#5 2015-02-28 11:31:54 +11:00
Sebastian McKenzie
a14e1e8fd1 clean up toAst method and properly transform rest elements away - fixes babel/babel-eslint#7 2015-02-28 11:28:22 +11:00
Sebastian McKenzie
932d799e28 pop off last token which will be an EOF, currently not used anywhere by espree and it runs into issues with some rules - fixes babel/babel-eslint#2 2015-02-27 23:40:59 +11:00
Sebastian McKenzie
be9da7ef08 output esprima compatible error messages - fixes babel/babel-eslint#3 2015-02-27 23:23:15 +11:00
Sebastian McKenzie
65a6fce75c turn ArrowFunctionExpression into a FunctionExpression - fixes babel/babel-eslint#1 2015-02-27 23:06:47 +11:00
Sebastian McKenzie
041c7e246f add support for spread property 2015-02-27 22:40:56 +11:00
Sebastian McKenzie
5c226d0451 add more comments to acorn-to-esprima source 2015-02-27 21:57:03 +11:00
Sebastian McKenzie
d70e358a94 clean up readme 2015-02-27 21:49:54 +11:00
Sebastian McKenzie
5d5c7c6ae1 first commit 2015-02-27 21:44:06 +11:00
Daniel Tschinder
b0fcf28267 9.0.0 2019-02-10 14:19:02 -08:00
Daniel Tschinder
3a5d6ee433 Update peer dependencies and allow babel-eslint 11 2019-02-10 14:17:27 -08:00
Brian Ng
7c39f9477f 8.0.2 2018-11-21 09:10:50 -06:00
Brian Ng
0076d85f5d Relax eslint-plugin-flowtype peerDep 2018-11-21 09:04:12 -06:00
Brian Ng
ad2ca8dd4b Merge tag 'v8.0.1'
8.0.1
2018-11-21 09:09:28 -06:00
Brian Ng
a3230ce730 Merge pull request babel/eslint-config-babel#29 from babel/babel-eslint 2018-09-25 16:24:38 -05:00
Brian Ng
e13c2f535c 8.0.0 2018-09-11 11:20:13 -05:00
Brian Ng
7499b0cab0 Merge pull request babel/eslint-config-babel#20 from babel/existentialism-patch-1 2018-09-11 10:28:37 -05:00
Brian Ng
74d47288c0 Merge pull request babel/eslint-config-babel#28 from babel/b 2018-09-11 10:28:24 -05:00
Henry Zhu
a47d722c07 7.0.2 2017-08-07 19:59:01 -04:00
Brian Ng
85d858984b Update babel-eslint peer dep (babel/eslint-config-babel#25) 2017-08-07 18:58:40 -05:00
Henry Zhu
794e8b12eb 7.0.1 2017-06-17 14:53:43 -04:00
Brian Ng
288a74e55f Re-add es6 env option (babel/eslint-config-babel#24) 2017-06-17 13:53:32 -05:00
Henry Zhu
4b35717b04 7.0.0 2017-06-17 14:35:27 -04:00
Brian Ng
a2f678151d Breaking: Drop style rules (babel/eslint-config-babel#22)
* Drop style rules

* es tweaks

* fix

* Update index.js
2017-06-17 13:35:03 -05:00
Daniel Tschinder
8a527d1ef5 Enable comma-dangle (babel/eslint-config-babel#19) 2017-02-20 17:45:06 +01:00
Daniel Tschinder
1ce807d5de Enable key-spacing and no-multi-spaces (babel/eslint-config-babel#18)
Fixes babel/eslint-config-babel#16
2017-02-20 17:14:45 +01:00
Daniel Tschinder
773c340514 Add func-call-spacing rule (babel/eslint-config-babel#15) 2017-02-20 16:59:50 +01:00
Henry Zhu
50122b7078 6.0.0 2017-01-14 16:01:07 -05:00
Daniel Tschinder
3bbc507a3f Add object-curly-spacing rule (babel/eslint-config-babel#14)
Fixes babel/eslint-config-babel#12
2017-01-14 22:00:42 +01:00
Henry Zhu
cada67daeb 5.0.0 2017-01-14 07:54:17 -05:00
Daniel Tschinder
af4dcb616d better indent switch, iife, multiline functions (babel/eslint-config-babel#10) 2017-01-14 13:51:41 +01:00
Daniel Tschinder
d4a1e97249 Add comma-spacing rule (babel/eslint-config-babel#11) 2017-01-14 13:51:22 +01:00
Kai Cataldo
292003444d peerDeps: remove eslint-plugin-babel (babel/eslint-config-babel#13) 2017-01-14 07:51:07 -05:00
Henry Zhu
d9b467403a 4.0.1 2017-01-10 12:27:01 -05:00
Henry Zhu
ff304c3890 fix 2017-01-10 12:26:45 -05:00
Henry Zhu
42ad818e3f 4.0.0 2017-01-08 22:19:51 -05:00
Henry Zhu
6117b83b55 Merge pull request babel/eslint-config-babel#9 from kaicataldo/prefer-const
Enable prefer-const
2017-01-08 22:19:01 -05:00
Henry Zhu
1f4e239217 3.0.0 2016-11-17 18:03:35 -05:00
Henry Zhu
4819beb149 use builtin (babel/eslint-config-babel#8)
* use built-in

* Update package.json
2016-11-17 18:03:01 -05:00
Henry Zhu
9279489413 2.0.1 2016-10-05 16:36:03 -04:00
Dan Harper
1536dfda0a flowtype plugin (babel/eslint-config-babel#6) 2016-10-05 21:35:44 +01:00
Henry Zhu
b2b1416fbc 2.0.0 2016-10-05 16:32:27 -04:00
Henry Zhu
c3bc500240 update info/links 2016-10-05 16:32:19 -04:00
Daniel Tschinder
0f87764827 Ensure unix line endings (babel/eslint-config-babel#4) 2016-10-01 18:12:35 +02:00
Daniel Tschinder
978f3392c5 Do not allow trailing spaces (babel/eslint-config-babel#3) 2016-10-01 18:12:29 +02:00
Henry Zhu
c88f903374 readme [skip ci] 2016-09-24 02:10:40 -04:00
Daniel Tschinder
edcf1b59dd Exchange flow plugin with new one (babel/eslint-config-babel#2)
* Change to eslint-plugin-flowtype

* Use new plugin

* Make dependencies peerDependencies

* Readd babel-eslint
2016-09-24 08:09:47 +02:00
Henry Zhu
b95c7aa556 1.0.2 2016-09-02 18:49:34 -04:00
Bo Borgerson
bfa69bbdb6 Add the "space-infix-ops" rule (babel/eslint-config-babel#1)
Require whitespace around infix operators.

The babel code base already mostly satisfies this.  Nice to keep it that way.

This is used by Lerna, too.
2016-09-02 15:48:46 -07:00
Henry Zhu
5706f0531b 1.0.1 2016-06-29 17:33:34 -04:00
Henry Zhu
a48f2e209c fix bug with config, use other way of specifying severity 2016-06-29 17:33:26 -04:00
Henry Zhu
13feb7278e init 2016-06-29 16:40:35 -04:00
Kai Cataldo
15b0283650 2019-11-13 19:40:27 -05:00
Huáng Jùnliàng
e1839e5ec9 Circumvent typeof transform for umd build template (#10701)
* add test case

* fix: circumvent typeof transform

* chore: update test fixtures
2019-11-13 22:47:56 +01:00
Jaideep Bhoosreddy
433b6ba3a4 Ignore PR job on master branch (#10702) 2019-11-13 21:42:44 +01:00
ZYSzys
1d1101eb7c Add missing flow type to babel-cli for consistency (#10692) 2019-11-13 17:39:19 +01:00
Jaideep Bhoosreddy
67ea7f4b4d Implement PR workflow for running test262 on babel PRs (#10579)
* Implement PR workflow with test262

* revisions
2019-11-13 17:31:29 +01:00
Huáng Jùnliàng
7633f09479 Babel should not silently remove unknown options after command… (#10698)
* chore: add test case

* chore: bump commander to 4.0.1

* fix: let commander.js throw on unknown options after args
2019-11-13 00:25:24 +01:00
Huáng Jùnliàng
ce070ce422 bump @babel/* dev dependencies (#10648)
* bump @babel/* dev dependencies

* chore: align version to @babel/runtime

* chore: bump to 7.7.1

* chore: bump to 7.7.2
2019-11-13 00:05:38 +01:00
Nicolò Ribaudo
f71338baf9
E2E test Babel with itself before publishing (#10569)
* Add e2e test using Babel itself

* Make checks run again
2019-11-12 23:55:36 +01:00
Shriram Balaji
ecad667dda Fix optional method chaining in derived classes (#10694) 2019-11-12 10:28:40 -06:00
4geru koichi uchinishi
d9fd07929a chore: add missing new line to fixture (#10697) 2019-11-12 11:08:35 -05:00
Huáng Jùnliàng
d413a3078c Add asserts this [is type] parsing support (#10677) 2019-11-11 16:36:10 -06:00
Sakibul Mowla
4cb5e0a013 Allow TypeScript type assertions in array destructuring (#10592)
* Add test

* Add fix

* Fix test, destructure with as assertion

* Add angle-bracket assertion case

* Use isBinding to make typeCastToParameter decision
2019-11-11 22:38:13 +01:00
Benjamin Blackwood
b2767c7d8a Add funding field to package.json (#10687) [ci-skip] 2019-11-11 08:08:18 -05:00
17289 changed files with 406872 additions and 576983 deletions

View File

@ -1,22 +1,13 @@
version: 2
version: 2.1
aliases:
- &restore-node-modules-cache
keys:
- v1-yarn-deps-{{ checksum "yarn.lock" }}
- &restore-yarn-cache
keys:
- v1-yarn-cache
- &save-node-modules-cache
paths:
- node_modules
key: v1-yarn-deps-{{ checksum "yarn.lock" }}
key: v2-yarn-cache-{{ checksum "yarn.lock" }}
- &save-yarn-cache
paths:
- ~/.yarn-cache
key: v1-yarn-cache
- ~/.yarn/berry/cache
key: v2-yarn-cache-{{ checksum "yarn.lock" }}
- &artifact_babel
path: ~/babel/packages/babel-standalone/babel.js
@ -24,12 +15,6 @@ aliases:
- &artifact_babel_min
path: ~/babel/packages/babel-standalone/babel.min.js
- &artifact_env
path: ~/babel/packages/babel-preset-env-standalone/babel-preset-env.js
- &artifact_env_min
path: ~/babel/packages/babel-preset-env-standalone/babel-preset-env.min.js
- &test262_workdir
working_directory: ~/babel/babel-test262-runner
@ -39,83 +24,235 @@ aliases:
- &artifact_test262_xunit
path: ~/test-results
jobs:
test:
working_directory: ~/babel
- &artifact_test262_diff_tap
path: ~/diff.tap
executors:
node-executor:
docker:
- image: circleci/node:13
- image: cimg/node:current
working_directory: ~/babel
# e2e-vue-cli test requires chromium
node-browsers-executor:
docker:
- image: cimg/node:current-browsers
working_directory: ~/babel
# e2e-jest test requires python
node-python-executor:
docker:
- image: cimg/python:3.9-node
working_directory: ~/babel
jobs:
build-standalone:
executor: node-executor
steps:
- checkout
- restore-cache: *restore-yarn-cache
- restore-cache: *restore-node-modules-cache
- run: yarn --version
- run: make test-ci-coverage
# Builds babel-standalone with the regular Babel config
- run: IS_PUBLISH=true make build
# test-ci-coverage doesn't test babel-standalone, as trying to gather coverage
# data for a JS file that's several megabytes large is bound to fail. Here,
# we just run the babel-standalone test separately.
- run: ./node_modules/.bin/jest packages/babel-standalone/test/
- run: ./node_modules/.bin/jest packages/babel-preset-env-standalone/test/
- restore_cache: *restore-yarn-cache
# Builds babel-standalone with the regular Babel config
# test-ci-coverage doesn't test babel-standalone, as trying to gather coverage
- run: IS_PUBLISH=true make -j build-standalone-ci
# data for a JS file that's several megabytes large is bound to fail. Here,
# we just run the babel-standalone test separately.
- run: yarn jest "\-standalone/test"
- store_artifacts: *artifact_babel
- store_artifacts: *artifact_babel_min
- store_artifacts: *artifact_env
- store_artifacts: *artifact_env_min
- save_cache: *save-node-modules-cache
- save_cache: *save-yarn-cache
test262:
working_directory: ~/babel
docker:
- image: circleci/node:12
executor: node-executor
steps:
- checkout
- restore-cache: *restore-yarn-cache
- restore-cache: *restore-node-modules-cache
- run:
name: Sync with latest main branch (only on PRs)
command: |
if [ -n "$CIRCLE_PULL_REQUEST" ]
then
# $CIRCLE_PR_NUMBER is not always defined:
# https://support.circleci.com/hc/en-us/articles/360047521451-Why-is-CIRCLE-PR-NUMBER-empty-
git fetch origin refs/pull/${CIRCLE_PULL_REQUEST##*/}/merge
git checkout -qf FETCH_HEAD
fi
- restore_cache: *restore-yarn-cache
- run:
name: Build Babel
command: BABEL_ENV=test make bootstrap
- run:
name: Link Babel
command: |
cd packages
for package in */; do
cd $package
yarn link
cd ..
done
- run:
name: Setup Test Runner
command: |
git clone --recurse-submodules https://github.com/babel/babel-test262-runner
git clone --depth=1 --recurse-submodules https://github.com/babel/babel-test262-runner
cd babel-test262-runner
yarn
yarn add tap-mocha-reporter --dev
curl -L https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64 > jq
chmod +x ./jq
for package in ../packages/*/package.json; do
yarn link $(./jq -j ".name" $package)
done
npm ci
npm i tap-mocha-reporter --save-dev
node lib/download-node
- run:
name: Download main branch Test262 artifact
command: node lib/download-main-artifact ~/test262-main.tap
<<: *test262_workdir
- run:
name: Run Test262
command: node lib/run-tests I_AM_SURE | tee ~/test262.tap
command: BABEL_PATH=.. node lib/run-tests I_AM_SURE | tee ~/test262.tap
<<: *test262_workdir
- store_artifacts: *artifact_test262_tap
- run:
name: Output test262 results
name: Output Test262 results
command: |
cat ~/test262.tap | $(npm bin)/tap-mocha-reporter spec || true
<<: *test262_workdir
- run:
name: Compare previous main branch & current job results
command: |
mkdir -p ~/test-results/test262
node lib/compare-results ~/test262-main.tap ~/test262.tap | tee ~/diff.tap
<<: *test262_workdir
- store_artifacts: *artifact_test262_diff_tap
- run:
name: Output comparison results and report to CircleCI
command: |
mkdir -p ~/test-results/test262
cat ~/diff.tap | $(npm bin)/tap-merge | $(npm bin)/tap-mocha-reporter xunit | tee ~/test-results/test262/results.xml
<<: *test262_workdir
- store_test_results: *artifact_test262_xunit
- save_cache: *save-yarn-cache
publish-verdaccio-babel-8-breaking:
executor: node-executor
steps:
- checkout
- restore_cache: *restore-yarn-cache
- run: BABEL_8_BREAKING=true ./scripts/integration-tests/publish-local.sh
- persist_to_workspace:
root: /tmp/verdaccio-workspace
paths:
- storage
- htpasswd
- save_cache: *save-yarn-cache
e2e-breaking-babel:
executor: node-executor
steps:
- checkout
- attach_workspace:
at: /tmp/verdaccio-workspace
- run: BABEL_8_BREAKING=true ./scripts/integration-tests/e2e-babel.sh
e2e-breaking-create-react-app:
executor: node-executor
steps:
- checkout
- attach_workspace:
at: /tmp/verdaccio-workspace
- run: BABEL_8_BREAKING=true ./scripts/integration-tests/e2e-create-react-app.sh
e2e-breaking-vue-cli:
executor: node-browsers-executor
steps:
- checkout
- attach_workspace:
at: /tmp/verdaccio-workspace
- run:
# - vue-cli uses puppeteer, and it depends on the libXss.so.1 shared library
# - We use fuser (psmisc) in local-registry.sh, and for some reason it's
# missing in this Docker image
name: Install Headless Chrome dependencies
command: sudo apt-get update && sudo apt-get install -yq libxss1 psmisc
- run: BABEL_8_BREAKING=true ./scripts/integration-tests/e2e-vue-cli.sh
e2e-breaking-jest:
executor: node-python-executor
steps:
- checkout
- attach_workspace:
at: /tmp/verdaccio-workspace
- run: BABEL_8_BREAKING=true ./scripts/integration-tests/e2e-jest.sh
e2e-breaking-prettier:
executor: node-executor
steps:
- checkout
- attach_workspace:
at: /tmp/verdaccio-workspace
- run: BABEL_8_BREAKING=true ./scripts/integration-tests/e2e-prettier.sh
workflows:
version: 2
test:
build-standalone:
jobs:
- test
master:
- build-standalone
# test262:
# jobs:
# - test262:
# filters:
# branches:
# only:
# - main
# - next-8-dev
# - next-8-rebased
# context: babel-test262
# test262-pr:
# jobs:
# - approve-test262-run:
# type: approval
# filters:
# branches:
# ignore:
# - main
# - master
# - next-8-dev
# - next-8-rebased
# - test262:
# requires:
# - approve-test262-run
# filters:
# branches:
# ignore:
# - main
# - master
# - next-8-dev
# - next-8-rebased
# context: babel-test262
e2e-breaking:
jobs:
- test262:
- publish-verdaccio-babel-8-breaking:
filters:
branches:
only:
- master
only: [main, next-8-dev, next-8-rebased]
- e2e-breaking-babel:
requires:
- publish-verdaccio-babel-8-breaking
- e2e-breaking-create-react-app:
requires:
- publish-verdaccio-babel-8-breaking
- e2e-breaking-vue-cli:
requires:
- publish-verdaccio-babel-8-breaking
- e2e-breaking-jest:
requires:
- publish-verdaccio-babel-8-breaking
e2e-breaking-pr:
jobs:
- approve-e2e-breaking-run:
type: approval
filters:
branches:
ignore: [main, next-8-dev, next-8-rebased]
- publish-verdaccio-babel-8-breaking:
requires:
- approve-e2e-breaking-run
- e2e-breaking-babel:
requires:
- publish-verdaccio-babel-8-breaking
- e2e-breaking-create-react-app:
requires:
- publish-verdaccio-babel-8-breaking
- e2e-breaking-vue-cli:
requires:
- publish-verdaccio-babel-8-breaking
- e2e-breaking-jest:
requires:
- publish-verdaccio-babel-8-breaking
- e2e-breaking-prettier:
requires:
- publish-verdaccio-babel-8-breaking

6
.codesandbox/ci.json Normal file
View File

@ -0,0 +1,6 @@
{
"buildCommand": "codesandbox:build",
"sandboxes": ["7s08o", "vhm64"],
"packages": ["packages/*"],
"node": "14"
}

View File

@ -2,7 +2,6 @@
/build
/.git
package.json
lerna.json
packages/babel-runtime
!packages/babel-plugin-transform-runtime/scripts
packages/babel-runtime-corejs2
@ -17,10 +16,16 @@ codemods/*/lib
codemods/*/dist
codemods/*/test/fixtures
codemods/*/test/tmp
packages/babel-preset-env/data
packages/babel-compat-data/build
packages/babel-preset-env/data/[^(plugin-features|shipped-proposals).js]
packages/babel-preset-env/test/debug-fixtures
packages/babel-preset-env-standalone/babel-preset-env.js
packages/babel-preset-env-standalone/babel-preset-env.min.js
packages/babel-standalone/babel.js
packages/babel-standalone/babel.min.js
packages/babel-parser/test/expressions
eslint/*/lib
eslint/*/node_modules
eslint/*/test/fixtures
test/runtime-integration/*/output.js
test/runtime-integration/*/output-absolute.js

163
.eslintrc.cjs Normal file
View File

@ -0,0 +1,163 @@
"use strict";
const path = require("path");
const cjsGlobals = ["__dirname", "__filename", "require", "module", "exports"];
const testFiles = [
"packages/*/test/**/*.js",
"codemods/*/test/**/*.js",
"eslint/*/test/**/*.js",
];
const sourceFiles = exts => [
`packages/*/src/**/*.{${exts}}`,
`codemods/*/src/**/*.{${exts}}`,
`eslint/*/src/**/*.{${exts}}`,
];
module.exports = {
root: true,
plugins: [
"import",
"node",
"jest",
"prettier",
"@babel/development",
"@babel/development-internal",
],
extends: "@babel/internal",
rules: {
"prettier/prettier": "error",
"import/no-extraneous-dependencies": "error",
},
env: {
node: true,
},
overrides: [
{
files: ["**/*.ts"],
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint"],
rules: {
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "error",
"no-dupe-class-members": "off",
"@typescript-eslint/no-dupe-class-members": "error",
"no-undef": "off",
"no-redeclare": "off",
},
},
{
files: sourceFiles("js,ts,cjs,mjs"),
rules: {
"@babel/development/no-undefined-identifier": "error",
"@babel/development/no-deprecated-clone": "error",
"guard-for-in": "error",
"import/extensions": ["error", { json: "always", cjs: "always" }],
},
globals: { PACKAGE_JSON: "readonly" },
},
{
files: [
...testFiles,
"packages/babel-helper-transform-fixture-test-runner/src/helpers.{ts,js}",
"test/**/*.js",
],
env: {
jest: true,
},
extends: "plugin:jest/recommended",
rules: {
"jest/expect-expect": "off",
"jest/no-identical-title": "off",
"jest/no-standalone-expect": "off",
"jest/no-test-callback": "off",
"jest/valid-describe": "off",
"import/extensions": ["error", "always"],
"import/no-extraneous-dependencies": "off",
"no-restricted-imports": ["error", { patterns: ["**/src/**"] }],
},
},
{
files: testFiles,
rules: {
"node/no-unsupported-features": [
"error",
{ version: "12.17.0", ignores: ["modules"] },
],
},
},
{
files: [...sourceFiles("js,ts,mjs"), ...testFiles, "test/**/*.js"],
excludedFiles: [
// @babel/register is the require() hook, so it will always be CJS-based
"packages/babel-register/**/*.{js,ts}",
],
rules: {
"no-restricted-globals": ["error", ...cjsGlobals],
},
},
{
files: ["packages/babel-plugin-*/src/index.{js,ts}"],
excludedFiles: ["packages/babel-plugin-transform-regenerator/**/*.js"],
rules: {
"@babel/development/plugin-name": "error",
eqeqeq: ["error", "always", { null: "ignore" }],
},
},
{
files: ["packages/babel-parser/src/**/*.{js,ts}"],
rules: {
"@babel/development-internal/dry-error-messages": [
"error",
{
errorModule: path.resolve(
__dirname,
"packages/babel-parser/src/parser/error.js"
),
},
],
"@babel/development-internal/report-error-message-format": "error",
},
},
{
files: ["packages/babel-helpers/src/helpers/**.js"],
rules: {
"no-var": "off",
"comma-dangle": "off",
"no-func-assign": "off",
"import/no-extraneous-dependencies": "off",
},
},
{
files: ["packages/babel-traverse/scripts/**/*.js"],
rules: {
"import/no-extraneous-dependencies": [
"error",
{ packageDir: "./packages/babel-traverse" },
],
},
},
{
files: ["eslint/babel-eslint-parser/src/**/*.js"],
rules: {
"no-restricted-imports": ["error", "@babel/core"],
},
},
{
files: ["packages/babel-plugin-transform-runtime/scripts/**/*.js"],
rules: {
"import/no-extraneous-dependencies": [
"error",
{ packageDir: "./packages/babel-plugin-transform-runtime" },
],
},
},
{
files: ["scripts/**/*.js"],
rules: {
"import/no-extraneous-dependencies": ["error", { packageDir: "." }],
},
},
],
};

View File

@ -1,41 +0,0 @@
{
"root": true,
"plugins": ["prettier", "@babel/development", "import"],
"extends": "babel",
"rules": {
"prettier/prettier": "error"
},
"env": {
"node": true
},
"overrides": [
{
"files": ["packages/*/src/**/*.js", "codemods/*/src/**/*.js"],
"rules": {
"@babel/development/no-undefined-identifier": "error",
"@babel/development/no-deprecated-clone": "error",
"import/no-extraneous-dependencies": "error",
"guard-for-in": "error"
}
},
{
"files": [
"packages/*/test/**/*.js",
"codemods/*/test/**/*.js",
"packages/babel-helper-transform-fixture-test-runner/src/helpers.js",
"test/**/*.js"
],
"env": {
"jest": true
}
},
{
"files": ["packages/babel-plugin-*/src/index.js"],
"excludedFiles": ["packages/babel-plugin-transform-regenerator/**/*.js"],
"rules": {
"@babel/development/plugin-name": "error",
"eqeqeq": ["error", "always", { "null": "ignore" }]
}
}
]
}

View File

@ -5,6 +5,8 @@
<PROJECT_ROOT>/codemods/.*/lib
<PROJECT_ROOT>/codemods/.*/test
<PROJECT_ROOT>/node_modules/module-deps/
<PROJECT_ROOT>/node_modules/webpack-cli/
<PROJECT_ROOT>/test/runtime-integration/
[include]
packages/*/src
@ -14,7 +16,11 @@ codemods/*/src
lib/file.js
lib/parser.js
lib/third-party-libs.js.flow
lib/preset-modules.js.flow
lib/babel-polyfills.js.flow
packages/babel-types/lib/index.js.flow
lib/babel-packages.js.flow
lib/package-json.js.flow
[options]
include_warnings=true
@ -26,4 +32,7 @@ suppress_type=$FlowSubtype
esproposal.export_star_as=enable
esproposal.optional_chaining=enable
esproposal.nullish_coalescing=enable
module.name_mapper='^@babel\/\([a-zA-Z0-9_\-]+\)$' -> '<PROJECT_ROOT>/packages/babel-\1/src/index'
module.name_mapper='^@babel/\([a-zA-Z0-9_-]+\)$' -> '<PROJECT_ROOT>/packages/babel-\1/src/index'
; Todo: can not make it works, 🤷‍♂️
; module.name_mapper='^@babel/plugin-syntax-import-meta$' -> '<PROJECT_ROOT>/packages/babel-standalone/node_modules/@babel/plugin-syntax-import-meta/lib/index'
module.ignore_non_literal_requires=true

11
.git-blame-ignore-revs Normal file
View File

@ -0,0 +1,11 @@
# git-blame ignored revisions
# To configure, run
# git config blame.ignoreRevsFile .git-blame-ignore-revs
# Requires Git > 2.23
# See https://git-scm.com/docs/git-blame#Documentation/git-blame.txt---ignore-revs-fileltfilegt
# Use prettier (#600)
5180ecdca48e486b4b0f347fcbd752f865df5e55
# Update prettier to v2 (#11579)
41085248560b1403b8d0f99f108491e679531c6c

1
.gitattributes vendored
View File

@ -1 +1,2 @@
* text eol=lf
/.yarn/** linguist-vendored

View File

@ -1,6 +0,0 @@
<!---
Thanks for filing an issue 😄 ! Before you submit, please read the following:
Check the other issue templates if you are trying to submit a bug report, feature request, or question
Search open/closed issues before submitting since someone might have asked the same thing before!
-->

View File

@ -1,44 +0,0 @@
---
name: "\U0001F41B Bug Report"
about: "If something isn't working as expected \U0001F914."
title: ''
labels: 'i: bug, i: needs triage'
assignees: ''
---
## Bug Report
**Current Behavior**
A clear and concise description of the behavior.
**Input Code**
- REPL or Repo link if applicable:
```js
var your => (code) => here;
```
**Expected behavior/code**
A clear and concise description of what you expected to happen (or code).
**Babel Configuration (.babelrc, package.json, cli command)**
```js
{
"your": { "config": "here" }
}
```
**Environment**
- Babel version(s): [e.g. v6.0.0, v7.0.0-beta.34]
- Node/npm version: [e.g. Node 8/npm 5]
- OS: [e.g. OSX 10.13.4, Windows 10]
- Monorepo: [e.g. yes/no/Lerna]
- How you are using Babel: [e.g. `cli`, `register`, `loader`]
**Possible Solution**
<!--- Only if you have suggestions on a fix for the bug -->
**Additional context/Screenshots**
Add any other context about the problem here. If applicable, add screenshots to help explain.

View File

@ -1,23 +0,0 @@
---
name: "\U0001F680 Feature Request"
about: "I have a suggestion (and may want to implement it \U0001F642)!"
title: ''
labels: 'i: enhancement, i: needs triage'
assignees: ''
---
## Feature Request
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I have an issue when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen. Add any considered drawbacks.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Teachability, Documentation, Adoption, Migration Strategy**
If you can, explain how users will be able to use this and possibly write out a version the docs.
Maybe a screenshot or design?

View File

@ -1,45 +0,0 @@
---
name: "\U0001F4A5 v7 Regression"
about: Report an unexpected behavior in v7 from v6 (Check the upgrade guide first
✌️)
title: ''
labels: 'i: bug, 7.x: regression, i: needs triage'
assignees: ''
---
# v7 Regression
> First check out: https://babeljs.io/docs/en/v7-migration
> Also a partial upgrade tool: https://github.com/babel/babel-upgrade
**Potential Commit/PR that introduced the regression**
If you have time to investigate, what PR/date introduced this issue.
**Describe the regression**
A clear and concise description of what the regression is.
**Input Code**
<!--- If you have link to our REPL or a standalone repo please link that! -->
```js
var your => (code) => here;
```
**Babel Configuration (.babelrc, package.json, cli command)**
```js
{
"your": { "config": "here" }
}
```
**Expected behavior/code**
A clear and concise description of what you expected to happen (or code).
**Environment**
- Babel version(s): [e.g. v6.0.0, v7.0.0-beta.34]
- Node/npm version: [e.g. Node 8/npm 5]
- OS: [e.g. OSX 10.13.4, Windows 10]
- Monorepo [e.g. yes/no/Lerna]
- How you are using Babel: [e.g. `cli`, `register`, `loader`]

View File

@ -1,19 +0,0 @@
---
name: "\U0001F917 Support Question"
about: "If you have a question \U0001F4AC, please check out our Slack or StackOverflow!"
title: ''
labels: 'i: question, i: needs triage'
assignees: ''
---
--------------^ Click "Preview" for a nicer view!
We primarily use GitHub as an issue tracker; for usage and support questions, please check out these resources below. Thanks! 😁.
---
* Slack Community Chat: https://babeljs.slack.com (you can sign-up at https://slack.babeljs.io/ for an invite)
* StackOverflow: https://stackoverflow.com/questions/tagged/babeljs using the tag `babeljs`
* Twitter: If it's just a quick question you can ping our Twitter: https://twitter.com/babeljs
* Also have a look at the readme for more information on how to get support:
https://github.com/babel/babel/blob/master/README.md

View File

@ -1,28 +0,0 @@
---
name: "\U0001F91D Support us on Babel"
about: "If you would like to support our efforts in maintaining this community-driven
project \U0001F64C!"
title: ''
labels: ''
assignees: ''
---
--------------^ Click "Preview" for a nicer view!
> Open Collective: https://opencollective.com/babel
> Henry's Patreon: https://www.patreon.com/henryzhu
Help support Babel!
Babel has always been a community project, not really backed or owned by any single (or group) of companies. While some maintainers used to work at Facebook (and Henry at Adobe) no one was working on it full time and there certainly isn't a huge company or team anywhere doing all this work.
---
As a group of volunteers you can help us in a few ways
- Giving developer time on the project. (Message us on [Twitter](https://twitter.com/babeljs) or [Slack](https://slack.babeljs.io/) for guidance). Companies should be paying their employees to contribute back to the open source projects they use everyday.
- Giving funds by becoming one of our sponsors/donators!
If you'd like to sustain the future of the project as a whole, we have an [Open Collective](https://opencollective.com/babel) that you can donate to. This is a way for funds to be allocated to the core team.
You can also support [Henry](https://github.com/hzoo) directly since I [left my job to work on Babel and Open Source full time](https://twitter.com/left_pad/status/969793227862790144) at my [Patreon](https://www.patreon.com/henryzhu).

109
.github/ISSUE_TEMPLATE/bug_report.yml vendored Normal file
View File

@ -0,0 +1,109 @@
name: "🐛 Bug Report"
description: "If something isn't working as expected 🤔."
title: "[Bug]: "
labels: ["i: needs triage"]
body:
- type: markdown
attributes:
value: Thanks for taking the time to file a bug report! Please fill out this form as completely as possible.
- type: checkboxes
id: input1
attributes:
label: "💻"
options:
- label: Would you like to work on a fix?
- type: dropdown
attributes:
label: How are you using Babel?
options:
- babel-loader (webpack)
- "@rollup/plugin-babel"
- "@babel/eslint-parser"
- "@babel/cli"
- "@babel/register or @babel/node"
- Programmatic API (`babel.transform`, `babel.parse`)
- Other (Next.js, Gatsby, vue-cli, ...)
validations:
required: true
- type: textarea
attributes:
label: Input code
description: |
You must write here the minimal input code necessary to reproduce the bug.
Even better, you can share a link to the Babel [REPL](https://babel.dev/repl):
this will make it easier for us to reproduce the issue, and it may help fixing
the bug sooner.
If it's not possible to reproduce the bug with a single file, a GitHub Repository
is also ok.
placeholder: |
```js
var your => (code) => here;
```
validations:
required: true
- type: dropdown
attributes:
label: Configuration file name
description: |
**NOTE**: If it's possible that Babel is not correctly loading your config, it's probably because you are using
`.babelrc`/`package.json` instead of `babel.config.json`.
multiple: true
options:
- babel.config.json
- babel.config.js
- babel.config.cjs
- babel.config.mjs
- .babelrc.json
- .babelrc.js
- .babelrc.cjs
- .babelrc.mjs
- .babelrc
- package.json
- type: textarea
attributes:
label: Configuration
description: |
**Tip:** You can also run Babel with the environment variable SHOW_CONFIG_FOR=your_file_path to print all configs associated with a path.
See https://babeljs.io/docs/en/configuration#print-effective-configs for more information
placeholder: |
```json
{
"your": { "config": "here" }
}
```
- type: textarea
attributes:
label: Current and expected behavior
description: A clear and concise description of what Babel is doing and what you would expect.
validations:
required: true
- type: textarea
attributes:
label: Environment
description: |
**Tip:** you can run `npx envinfo --preset babel` and paste the result below
placeholder: |
- Babel version(s): [e.g. v7.12.0]
- Node: [e.g. Node 15]
- npm/Yarn version: [e.g. npm 7/Yarn 2.3]
- OS: [e.g. macOS 10.15.4, Windows 10]
- Monorepo: [e.g. yes/no/Lerna]
validations:
required: true
- type: textarea
attributes:
label: Possible solution
description: "If you have suggestions on a fix for the bug."
- type: textarea
attributes:
label: Additional context
description: "Add any other context about the problem here. Or a screenshot if applicable."

14
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@ -0,0 +1,14 @@
blank_issues_enabled: false
contact_links:
- name: 📦 "No matching version found"
url: https://gist.github.com/hzoo/df94af2d2ec48696e683b772c775aa67
about: You may have an npm error related to proxies/caching.
- name: 🗣 Ask a Question, Discuss
url: https://github.com/babel/babel/discussions
about: How does X work 🤔? I made this! I have an idea...
- name: 💡 Propose an RFC
url: https://github.com/babel/rfcs
about: To suggest a new option or substantial change.
- name: 🤗 Support the Project
url: https://github.com/sponsors/babel
about: Support the Babel team financially.

View File

@ -0,0 +1,44 @@
name: "🚀 Feature Request"
description: "I have a specific suggestion for Babel!"
labels: ["i: needs triage", "i: enhancement"]
body:
- type: markdown
attributes:
value: Thanks for taking the time to suggest a new feature! Please fill out this form as completely as possible.
- type: checkboxes
id: input1
attributes:
label: "💻"
description: |
Check this if you would like to implement a PR, we are more than happy to help you go through the process
options:
- label: Would you like to work on this feature?
- type: textarea
attributes:
label: What problem are you trying to solve?
description: |
A concise description of what the problem is.
placeholder: |
I have an issue when [...]
validations:
required: true
- type: textarea
attributes:
label: Describe the solution you'd like
validations:
required: true
- type: textarea
attributes:
label: Describe alternatives you've considered
validations:
required: true
- type: textarea
attributes:
label: Documentation, Adoption, Migration Strategy
description: |
If you can, explain how users will be able to use this and how it might be documented. Maybe a mock-up?

View File

@ -1,6 +1,6 @@
<!--
Before making a PR, please read our contributing guidelines
https://github.com/babel/babel/blob/master/CONTRIBUTING.md
https://github.com/babel/babel/blob/main/CONTRIBUTING.md
Please note that the Babel Team requires two approvals before merging most PRs.

12
.github/lock.yml vendored
View File

@ -1,12 +0,0 @@
# Configuration for lock-threads - https://github.com/dessant/lock-threads
# Number of days of inactivity before a closed issue or pull request is locked
daysUntilLock: 91
# Comment to post before locking. Set to `false` to disable
lockComment: false
# The label to be applied when an issue is locked
lockLabel: 'outdated'
# Issues or pull requests with these labels will not be locked
# exemptLabels:
# - no-locking

462
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,462 @@
name: CI
on: [push, pull_request]
jobs:
prepare-yarn-cache:
name: Prepare Cache
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Use Node.js latest
uses: actions/setup-node@v2-beta
with:
node-version: "*"
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: yarn-${{ hashFiles('yarn.lock') }}
restore-keys: |
yarn-
- name: 'Check or update Yarn cache (fix w/ "yarn install")'
env:
YARN_ENABLE_SCRIPTS: false # disable post-install scripts
YARN_NODE_LINKER: pnp # use pnp linker for better linking performance: it's meant to update yarn cache only
run: |
yarn install --mode=skip-build
yarn-validate:
name: Validate Yarn dependencies and constraints
needs: prepare-yarn-cache
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Use Node.js latest
uses: actions/setup-node@v2-beta
with:
node-version: "*"
- name: 'Check for unmet constraints (fix w/ "yarn constraints --fix")'
run: |
yarn constraints
- name: 'Check for duplicate dependencies (fix w/ "yarn dedupe")'
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: |
yarn dedupe --check
- name: Check for dependency cycles
run: |
yarn release-tool check-cycles
test-coverage:
name: Test on Node.js Latest
needs: prepare-yarn-cache
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Use Node.js latest
uses: actions/setup-node@v2-beta
with:
node-version: 17
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: yarn-${{ hashFiles('yarn.lock') }}
- name: Generate coverage report
run: |
make -j test-ci-coverage
yarn test:esm
- name: Upload coverage report
uses: codecov/codecov-action@v1
build:
name: Build Babel Artifacts
needs: prepare-yarn-cache
runs-on: ubuntu-latest
# Yarn PnP does not support native ESM yet (https://github.com/yarnpkg/berry/issues/638)
# env:
# YARN_NODE_LINKER: pnp # use pnp linker for better linking performance and stricter checks
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Use Node.js latest
uses: actions/setup-node@v2-beta
with:
node-version: "*"
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: yarn-${{ hashFiles('yarn.lock') }}
restore-keys: |
yarn-
- name: Build babel artifacts
run: |
BABEL_ENV=test-legacy make -j build-standalone-ci
env:
BABEL_8_BREAKING: false
STRIP_BABEL_8_FLAG: true
- uses: actions/upload-artifact@v2
with:
name: babel-artifact
path: |
codemods/*/lib/**/*
eslint/*/lib/**/*
packages/*/lib/**/*
packages/babel-standalone/*.js
!**/node_modules/**
lint:
name: Lint
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Use Node.js latest
uses: actions/setup-node@v2-beta
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: yarn-${{ hashFiles('yarn.lock') }}
- name: Install
run: yarn install
- uses: actions/download-artifact@v2
with:
name: babel-artifact
- name: Lint
run: make -j tscheck flowcheck-ci lint-ci
test:
name: Test on Node.js # GitHub will add ${{ matrix.node-version }} to this title
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16, 14, 12, 10, 8, 6]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Use Node.js latest # Run yarn on latest node
uses: actions/setup-node@v2-beta
with:
node-version: "*" # Build Babel on latest node LTS versions
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: yarn-${{ hashFiles('yarn.lock') }}
- name: Install
run: |
yarn install
- name: Downgrade Jest for node <= 8
if: matrix.node-version == '6' || matrix.node-version == '8'
run: |
yarn remove jest
yarn add --dev jest@24
# Deduplicate dependencies, because duplicate copies of graceful-fs cause
# problems with the "path" module: https://github.com/facebook/jest/issues/9656
yarn dedupe
- uses: actions/download-artifact@v2
with:
name: babel-artifact
- name: Generate runtime helpers
run: |
make build-plugin-transform-runtime-dist
- name: Use Node.js ${{ matrix.node-version }} # Checkout node version for test executor
uses: actions/setup-node@v2-beta
with:
node-version: ${{ matrix.node-version }}
- name: Test on node.js ${{ matrix.node-version }}
# Hack: --color has supports-color@5 returned true for GitHub CI
# Remove once `chalk` is bumped to 4.0.
# Todo(Babel 8): Jest execution path is hardcoded because Yarn 2 does not support node 6
run: |
BABEL_ENV=test node ./node_modules/.bin/jest --ci --color
test-babel-8-breaking:
name: Test Babel 8 breaking changes
needs: prepare-yarn-cache
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Use Node.js 12
uses: actions/setup-node@v2-beta
with:
node-version: 12 # Node.js 12 is the first LTS supported by Babel 8
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: yarn-${{ hashFiles('yarn.lock') }}
- name: Install and build
run: make -j bootstrap
env:
BABEL_ENV: test
BABEL_8_BREAKING: true
STRIP_BABEL_8_FLAG: true
- name: Lint
run: make lint
env:
BABEL_ENV: test
BABEL_8_BREAKING: true
BABEL_TYPES_8_BREAKING: true
- name: Test
# Hack: --color has supports-color@5 returned true for GitHub CI
# Remove once `chalk` is bumped to 4.0.
run: |
yarn jest --ci --color
yarn test:esm
env:
BABEL_ENV: test
BABEL_8_BREAKING: true
BABEL_TYPES_8_BREAKING: true
test-windows:
name: Test on Windows
needs: build
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Use Node.js latest
uses: actions/setup-node@v2-beta
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: yarn-${{ hashFiles('yarn.lock') }}
- name: Install
run: yarn install
- uses: actions/download-artifact@v2
with:
name: babel-artifact
- name: Generate runtime helpers
run: |
make build-plugin-transform-runtime-dist
- name: Test on Windows
# Hack: --color has supports-color@5 returned true for GitHub CI
# Remove once `chalk` is bumped to 4.0.
run: yarn jest --ci --color
env:
BABEL_ENV: test
external-parser-tests:
name: Third-party Parser Tests
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Use Node.js latest
uses: actions/setup-node@v2-beta
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: yarn-${{ hashFiles('yarn.lock') }}
- name: Install
run: yarn install
- uses: actions/download-artifact@v2
with:
name: babel-artifact
- name: Download tests
run: make -j bootstrap-flow bootstrap-typescript bootstrap-test262
- name: Run Test262 Tests
run: make test-test262
- name: Run Flow Tests
run: make test-flow
- name: Run TypeScript Tests
run: make test-typescript
runtime-interop:
name: Test @babel/runtime integrations
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Use Node.js latest
uses: actions/setup-node@v2-beta
with:
node-version: "*"
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: yarn-${{ hashFiles('yarn.lock') }}
# See https://github.com/babel/babel/pull/12906
- name: Support self-references on old Node.js
run: |
echo '{
"private": true,
"devDependencies": {
"@babel/runtime": "workspace:*",
"@babel/runtime-corejs3": "workspace:*"
}
}' > packages/package.json
node -e "
const pkg = require('./package.json');
pkg.workspaces.push('packages');
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2))
"
- name: Install
run: yarn install
env:
# The "Support self-references on old Node.js" step mutates the
# package.json file, causing a yarn.lock update.
YARN_ENABLE_IMMUTABLE_INSTALLS: false
- uses: actions/download-artifact@v2
with:
name: babel-artifact
- name: Generate runtime helpers
run: |
make build-plugin-transform-runtime-dist
- name: Generate absoluteRuntime tests
run: yarn test:runtime:generate-absolute-runtime
- name: Test bundlers
run: yarn test:runtime:bundlers
- name: Test Node.js
run: yarn test:runtime:node
- name: Use Node.js 10
uses: actions/setup-node@v2-beta
with:
node-version: 10
- name: Test Node.js 10
run: node test/runtime-integration/node.cjs
- name: Use Node.js 12.0
uses: actions/setup-node@v2-beta
with:
node-version: "12.0" # quoted, otherwise it's just 13
- name: Test Node.js 12.0
run: yarn test:runtime:node
- name: Use Node.js 12.17
uses: actions/setup-node@v2-beta
with:
node-version: 12.17
- name: Test Node.js 12.17
run: yarn test:runtime:node
- name: Use Node.js 13.0
uses: actions/setup-node@v2-beta
with:
node-version: "13.0" # quoted, otherwise it's just 13
- name: Test Node.js 13.0
run: yarn test:runtime:node
- name: Use Node.js 13.2
uses: actions/setup-node@v2-beta
with:
node-version: 13.2
- name: Test Node.js 13.2
run: yarn test:runtime:node
- name: Use Node.js 13.6
uses: actions/setup-node@v2-beta
with:
node-version: 13.6
- name: Test Node.js 13.6
run: yarn test:runtime:node
- name: Use Node.js 13.7
uses: actions/setup-node@v2-beta
with:
node-version: 13.7
- name: Test Node.js 13.7
run: yarn test:runtime:node
- name: Use Node.js 14.2
uses: actions/setup-node@v2-beta
with:
node-version: 14.2
- name: Test Node.js 14.2
run: yarn test:runtime:node
- name: Use Node.js 16.5
uses: actions/setup-node@v2-beta
with:
node-version: 16.5
- name: Test Node.js 16.5
run: yarn test:runtime:node
- name: Use Node.js 16.6
uses: actions/setup-node@v2-beta
with:
node-version: 16.6
- name: Test Node.js 16.6
run: yarn test:runtime:node
e2e-publish:
name: Publish to local Verdaccio registry
needs: prepare-yarn-cache
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Use Node.js latest
uses: actions/setup-node@v2-beta
with:
node-version: "*"
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- name: Setup Yarn cache
uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: yarn-${{ hashFiles('yarn.lock') }}
- name: Publish
run: ./scripts/integration-tests/publish-local.sh
- uses: actions/upload-artifact@v2
with:
name: verdaccio-workspace
path: /tmp/verdaccio-workspace
e2e-tests:
name: E2E
needs: e2e-publish
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
project:
- babel
- babel-old-version
- create-react-app
- vue-cli
- jest
- react-native
- prettier
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Use Node.js latest
uses: actions/setup-node@v2-beta
with:
node-version: "*"
- uses: actions/download-artifact@v2
with:
name: verdaccio-workspace
path: /tmp/verdaccio-workspace
- name: Test
run: ./scripts/integration-tests/e2e-${{ matrix.project }}.sh

View File

@ -35,7 +35,7 @@ jobs:
If you need any help, or just have general Babel or JavaScript questions, we have a
vibrant [Slack community](https://babeljs.slack.com) that typically always has someone
willing to help. You can sign-up [here](https://slack.babeljs.io/) for an invite."
willing to help. You can sign-up [here](https://slack.babeljs.io/) for an invite.
needs_info:
name: Needs Info

17
.github/workflows/lock.yml vendored Normal file
View File

@ -0,0 +1,17 @@
name: Lock Threads
on:
schedule:
- cron: '0 4 * * *'
jobs:
lock:
runs-on: ubuntu-latest
steps:
- uses: dessant/lock-threads@v2
with:
github-token: ${{ github.token }}
issue-lock-inactive-days: '91'
issue-lock-labels: 'outdated'
pr-lock-inactive-days: '91'
pr-lock-labels: 'outdated'

View File

@ -3,14 +3,116 @@ name: Release
on:
push:
tags: ["v*"]
workflow_dispatch:
inputs:
version:
# This input isn't actually used as an input, but it's a reminder that
# this workflow can only automatically push patch versions.
# This is because often minor versions require human intervention, so
# it's safer if we force ourselves to always create them locally.
description: ⚠️ This workflow can only automatically release patch versions
required: true
default: patch
jobs:
github_release:
name: Trigger GitHub release
log-updates:
name: Log packages to publish
runs-on: ubuntu-latest
steps:
- name: Checkout the new tag
uses: actions/checkout@v1.0.0
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: This release will publish the following packages
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
yarn release-tool version --dry patch
else
git diff --name-only HEAD^..HEAD
fi;
git-version:
name: Create git tag and commit
runs-on: ubuntu-latest
needs: log-updates
if: github.event_name == 'workflow_dispatch'
outputs:
branch: ${{ steps.push.outputs.branch }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set @babel-bot as committer
run: |
git config user.name "Babel Bot"
git config user.email "babel-bot@users.noreply.github.com"
- name: Create new version
run: |
make new-version-checklist
yarn release-tool version -f @babel/standalone --yes patch
- name: Push to GitHub
id: push
run: |
branch="release/temp/$(git describe --abbrev=0)"
echo $branch
echo "::set-output name=branch::$branch"
git push "https://babel-bot:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git" HEAD:"$branch" --follow-tags
npm-release:
name: Build, Test and Publish
runs-on: ubuntu-latest
needs: git-version
environment: npm
# The default condition is success(), but this is false when one of the previous jobs is skipped
if: |
always() &&
(needs.git-version.result == 'success' || needs.git-version.result == 'skipped')
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Checkout the temporary branch
if: needs.git-version.result == 'success'
run: git checkout ${{ needs.git-version.outputs.branch }}
- name: Build and Test
run: make prepublish
- name: Publish to npm
run: yarn release-tool publish --yes
env:
YARN_NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
github-release:
name: Create GitHub release draft
runs-on: ubuntu-latest
needs: git-version
# The default condition is success(), but this is false when one of the previous jobs is skipped
if: |
always() &&
(needs.git-version.result == 'success' || needs.git-version.result == 'skipped')
outputs:
is-main: ${{ steps.is-main.outputs.result == 1 }}
changelog: ${{ steps.changelog.outputs.changelog }}
version: ${{ steps.tags.outputs.new }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Check if releasing from main
id: is-main
uses: babel/actions/ref-matches-branch@v2
with:
name: main
- name: Checkout the temporary branch
if: needs.git-version.result == 'success'
run: git checkout ${{ needs.git-version.outputs.branch }}
- name: Get tag info
id: tags
@ -32,22 +134,39 @@ jobs:
changelog: ${{ steps.changelog.outputs.changelog }}
token: ${{ secrets.BOT_TOKEN }}
- name: Check if releasing from master
id: is_master
uses: babel/actions/ref-matches-branch@v2
github-push:
name: Push release commit to "main"
runs-on: ubuntu-latest
needs: [npm-release, github-release, git-version]
# The default condition is success(), but this is false when one of the previous jobs is skipped
if: |
always() &&
needs.npm-release.result == 'success' &&
needs.github-release.result == 'success' &&
needs.github-release.outputs.is-main
steps:
- uses: actions/checkout@v2
with:
name: master
fetch-depth: 0
- name: Checkout the temporary branch
if: needs.git-version.result == 'success'
run: git checkout ${{ needs.git-version.outputs.branch }}
- name: Update CHANGELOG.md
if: steps.is_master.outputs.result == 1
uses: babel/actions/update-changelog@v2
with:
changelog: ${{ steps.changelog.outputs.changelog }}
changelog: ${{ needs.github-release.outputs.changelog }}
- name: Commit CHANGELOG.md
if: steps.is_master.outputs.result == 1
run: |
git add CHANGELOG.md
git -c user.name="Babel Bot" -c user.email="babel-bot@users.noreply.github.com" \
commit -m "Add ${{ steps.tags.outputs.new }} to CHANGELOG.md [skip ci]" --no-verify --quiet
git push "https://babel-bot:${{ secrets.BOT_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git" master
commit -m "Add ${{ needs.github-release.outputs.version }} to CHANGELOG.md [skip ci]" --no-verify --quiet
- name: Push to GitHub
run: |
git push "https://babel-bot:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git" HEAD:main --follow-tags
- name: Delete temporary branch from GitHub
if: needs.git-version.result == 'success'
run: git push "https://babel-bot:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git" :${{ needs.git-version.outputs.branch }}

View File

@ -0,0 +1,90 @@
name: Update Test262 parser tests
env:
YARN_ENABLE_SCRIPTS: false # disable post-install scripts
on:
workflow_dispatch:
inputs: {}
schedule:
- cron: "0 0 * * 5"
jobs:
createPullRequest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2
with:
repository: tc39/test262
path: build/test262
- name: Use Node.js latest
uses: actions/setup-node@v2-beta
with:
node-version: "*"
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: yarn-${{ hashFiles('yarn.lock') }}
restore-keys: |
yarn-
- name: Get latest test262 version
id: test262
run: echo "::set-output name=sha1::$(sh ./scripts/parser-tests/get-test262-version.sh)"
- name: Update test262 commit
run: |
echo ${{ steps.test262.outputs.sha1 }} | ./scripts/parser-tests/bump-test262-version.sh
- name: Build babel parser
run: |
yarn install --immutable --mode=skip-build
yarn gulp build-rollup
- name: Update test262 allow list
run: |
make test-test262-update-allowlist
- name: Commit changes
run: |
git config user.name "Babel Bot"
git config user.email "babel-bot@users.noreply.github.com"
git checkout -b update-test262-parser
git commit -am "chore: update test262 to ${{ steps.test262.outputs.sha1 }}"
git push --force origin update-test262-parser
- name: Create Pull Request
uses: actions/github-script@v4
with:
github-token: ${{ secrets.BOT_TOKEN }}
script: |
const base = process.env.GITHUB_REF.replace("refs/heads/", "");
const requestParam = {
owner: context.repo.owner,
repo: context.repo.repo,
head: context.repo.owner + ":update-test262-parser",
base: base,
state: "open"
};
const result = await github.pulls.list(requestParam);
console.log("Open PR request: ", requestParam);
console.log("Open PR response: ", result);
const prs = result.data;
if (prs.length === 0) {
const requestParam = {
owner: context.repo.owner,
repo: context.repo.repo,
head: "update-test262-parser",
base: base,
maintainer_can_modify: true,
title: "Update test262",
body: "Update test262 to [${{ steps.test262.outputs.sha1 }}](https://github.com/tc39/test262/commit/${{ steps.test262.outputs.sha1 }}).",
};
const result = await github.pulls.create(requestParam);
console.log("Create PR request: ", requestParam)
console.log("Create PR response: ", result);
github.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: result.data.number,
labels: ["area: test262", "repo automation :robot:"]
})
}

View File

@ -0,0 +1,75 @@
name: Update Windows Fixtures
on:
workflow_dispatch:
inputs:
pull_request:
description: Pull Request number
required: true
jobs:
update-windows-fixtures:
runs-on: windows-latest
steps:
- name: Get Pull Request branch
uses: actions/github-script@v4
id: pr-meta
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { data: pullRequest } = await github.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: ${{ github.event.inputs.pull_request }},
});
const {
ref: branch,
repo: { full_name: repository }
} = pullRequest.head;
console.log(`::set-output name=branch::${branch}`);
console.log(`::set-output name=repository::${repository}`);
- name: Checkout code
uses: actions/checkout@v2
with:
repository: ${{ steps.pr-meta.outputs.repository }}
ref: ${{ steps.pr-meta.outputs.branch }}
fetch-depth: 0 # Otherwise we cannot push
persist-credentials: false # So that we can push with BOT_TOKEN, otherwise it doesn't trigger CI
- name: Use Node.js latest
uses: actions/setup-node@v2-beta
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- uses: actions/cache@v2
id: cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: yarn-${{ hashFiles('yarn.lock') }}
- name: Install and build
# make bootstrap modifies some files (babel-runtime-*/package.json), so we reset them
run: |
make -j bootstrap
git reset --hard HEAD
- name: Regenerate fixtures
# Hack: --color has supports-color@5 returned true for GitHub CI
# Remove once `chalk` is bumped to 4.0.
run: |
yarn jest -u --ci --color || true
env:
BABEL_ENV: test
OVERWRITE: true
- name: Commit updates
run: |
git config user.name "Babel Bot"
git config user.email "babel-bot@users.noreply.github.com"
git add .
git commit -m "Update fixtures (Windows)" --no-verify --quiet
git push "https://babel-bot:${{ secrets.BOT_TOKEN }}@github.com/${{ steps.pr-meta.outputs.repository }}.git" ${{ steps.pr-meta.outputs.branch }}

42
.gitignore vendored
View File

@ -1,9 +1,14 @@
.npmrc
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.js
.DS_Store
/node_modules
/.github/actions/*/node_modules
/packages/*/node_modules
**/node_modules
!**/test/fixtures/**/node_modules
/packages/*/LICENSE
!/packages/babel-parser/LICENSE
!/packages/babel-plugin-transform-object-assign/LICENSE
@ -11,8 +16,6 @@
*.cache
/build
/.eslintcache
/browser.js
/browser-polyfill.js
/runtime.js
coverage
dist
@ -20,43 +23,64 @@ dist
package-lock.json
!/.github/actions/*/package-lock.json
/packages/babel-compat-data/build
/packages/babel-runtime/helpers/*.js
!/packages/babel-runtime/helpers/toArray.js
!/packages/babel-runtime/helpers/iterableToArray.js
!/packages/babel-runtime/helpers/possibleConstructorReturn.js
!/packages/babel-runtime/helpers/temporalRef.js
!/packages/babel-runtime/helpers/typeof.js
/packages/babel-runtime/helpers/esm/*.js
!/packages/babel-runtime/helpers/esm/toArray.js
!/packages/babel-runtime/helpers/esm/iterableToArray.js
!/packages/babel-runtime/helpers/esm/possibleConstructorReturn.js
!/packages/babel-runtime/helpers/esm/temporalRef.js
/packages/babel-runtime-corejs2/helpers/*.js
!/packages/babel-runtime-corejs2/helpers/toArray.js
!/packages/babel-runtime-corejs2/helpers/iterableToArray.js
!/packages/babel-runtime-corejs2/helpers/possibleConstructorReturn.js
!/packages/babel-runtime-corejs2/helpers/temporalRef.js
!/packages/babel-runtime-corejs2/helpers/typeof.js
/packages/babel-runtime-corejs2/helpers/esm/*.js
!/packages/babel-runtime-corejs2/helpers/esm/toArray.js
!/packages/babel-runtime-corejs2/helpers/esm/iterableToArray.js
!/packages/babel-runtime-corejs2/helpers/esm/possibleConstructorReturn.js
!/packages/babel-runtime-corejs2/helpers/esm/temporalRef.js
/packages/babel-runtime-corejs2/core-js/**/*.js
!/packages/babel-runtime-corejs2/core-js/map.js
/packages/babel-runtime-corejs3/helpers/*.js
!/packages/babel-runtime-corejs3/helpers/possibleConstructorReturn.js
/packages/babel-runtime-corejs3/helpers/esm/*.js
!/packages/babel-runtime-corejs3/helpers/esm/possibleConstructorReturn.js
/packages/babel-runtime-corejs3/core-js/**/*.js
/packages/babel-runtime-corejs3/core-js-stable/**/*.js
/packages/babel-register/test/.babel
/packages/babel-register/test/.cache.babel
/packages/babel-register/test/.index.babel
/packages/babel-cli/test/tmp
/packages/babel-node/test/tmp
/packages/*/lib
.nyc_output
/babel.sublime-workspace
packages/babel-standalone/babel.js
packages/babel-standalone/babel.js.map
packages/babel-standalone/babel.min.js
packages/babel-preset-env-standalone/babel-preset-env.js
packages/babel-preset-env-standalone/babel-preset-env.min.js
/codemods/*/lib
/codemods/*/node_modules
/packages/babel-parser/build
.idea/
/.changelog
/eslint/*/lib
/eslint/*/LICENSE
!/packages/babel-eslint-plugin/LICENSE
/.vscode
# local directory for VSCode Extension - https://marketplace.visualstudio.com/items?itemName=xyz.local-history
/.history
/dts
/test/runtime-integration/*/output.js
/test/runtime-integration/*/absolute-output.js

40
.gitpod.yml Normal file
View File

@ -0,0 +1,40 @@
# List the start up tasks. You can start them in parallel in multiple terminals. See https://www.gitpod.io/docs/config-start-tasks/
tasks:
- init: make bootstrap
command: make watch
- openMode: split-right
command: |-
clear && echo '
Welcome to Gitpod!
If you haven'\''t forked Babel yet and you want to prepare a PR, you can use
the Ctrl+P (or ⌘P) shortcut, type `>Fork` and press ENTER: Gitpod\ will
create the fork for you.
<-- The other terminal is building Babel. It should automatically rebuild
when you change a file, so you don'\''t need to worry about it.
If it'\''s still building, please wait until it'\''s finished!
If you want to run the tests, you can run `yarn jest` in this terminal,
or filter by package name (for example, `yarn jest babel-parser`).
'
#' # <-- This is just because the gitpod theme has broken syntax highlighting
github:
# https://www.gitpod.io/docs/prebuilds/#configure-prebuilds
prebuilds:
master: true # enable for the default branch (even if it's not named "master")
branches: true
pullRequests: true
pullRequestsFromForks: true
addCheck: true
addComment: false
addBadge: true
addLabel: false
vscode:
extensions:
- dbaeumer.vscode-eslint@2.1.5:9Wg0Glx/TwD8ElFBg+FKcQ==
- esbenp.prettier-vscode@5.0.0:qca7d0cHbKkrkb5rvNlpcg==
- flowtype.flow-for-vscode@1.5.0:AwOT6wgHTF43loZQCAUMLA==

4
.husky/pre-commit Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
yarn lint-staged

View File

@ -1,5 +1,7 @@
package.json
packages/babel-preset-env/data
packages/babel-compat-data/data
packages/babel-compat-data/scripts/data/overlapping-plugins.js
packages/*/test/fixtures/**/input.*
packages/*/test/fixtures/**/exec.*
packages/*/test/fixtures/**/output.*

View File

@ -5,19 +5,28 @@
"semi": true,
"singleQuote": false,
"bracketSpacing": true,
"jsxBracketSameLine": false,
"bracketSameLine": false,
"tabWidth": 2,
"printWidth": 80,
"overrides": [{
"files": [
"**/codemods/*/src/**/*.js",
"**/codemods/*/test/**/*.js",
"**/packages/*/src/**/*.js",
"**/packages/*/test/**/*.js"
"**/{codemods,eslint,packages}/*/{src,test}/**/*.{js,ts,cjs}"
],
"parser": "babylon",
"excludeFiles": ["**/packages/babel-helpers/src/helpers/**/*.js"],
"options": {
"trailingComma": "all"
}
}, {
"files": "**/packages/babel-helpers/src/helpers/**/*.js",
"options": {
"trailingComma": "es5"
}
}, {
"files": [
"**/{codemods,eslint,packages}/*/test/fixtures/**/*.{js,ts}"
],
"options": {
"trailingComma": "es5"
}
}]
}

View File

@ -1,60 +0,0 @@
git:
depth: 5
language: node_js
cache:
yarn: true
os: linux
env:
global:
- PATH=$HOME/.yarn/bin:$PATH
- JOB=test
install: skip
before_script:
- curl -o- -L https://yarnpkg.com/install.sh | bash
- if [ "$TRAVIS_OS_NAME" = "windows" ]; then choco install make; fi
script:
- if [ "$JOB" = "test" ]; then make -j test-ci; fi
- if [ "$JOB" = "lint" ]; then make -j code-quality-ci; fi
- if [ "$JOB" = "babel-parser-flow-tests" ]; then make -j test-flow-ci; fi
- if [ "$JOB" = "babel-parser-test262-tests" ]; then make -j test-test262-ci; fi
matrix:
fast_finish: true
include:
- node_js: "node"
env: JOB=lint
# We test the latest version on circleci
- node_js: "12"
# Move `windows` build to be the third since it is slow
- os: windows
node_js: "node"
env:
- JOB=test
# https://travis-ci.community/t/build-doesnt-finish-after-completing-tests/288/9
- YARN_GPG=no
# Continue node_js matrix
- node_js: "6"
- node_js: "10"
- node_js: "8"
- node_js: "node"
env: JOB=babel-parser-flow-tests
- node_js: "node"
env: JOB=babel-parser-test262-tests
notifications:
slack:
on_success: change
on_failure: always
rooms:
# Generate with
# travis encrypt "babeljs:<token>#activity" --add notifications.slack.rooms
# where <token> is from the Slack integration settings.
secure: SrwPKRe2AiNAKRo/+2yW/x4zxbWf2FBXuBuuPkdTJVTpWe++Jin1lXYJWTKP1a1i/IbmhffBO9YZcUFbeuXJpRM083vO8VYpyuBMQRqWD+Z3o+ttPlHGOJgnj0nkIcGRk6k7PpyHNnIkixfEJDvbbg9lN1Jswb3xkL8iYIHpuFE=
branches:
except:
- /^v\d+\.\d+\.\d+$/

View File

@ -0,0 +1,28 @@
See packages/babel-standalone/src/dynamic-require-entrypoint.cjs for the reason for this diff.
diff --git a/dist/index.es.js b/dist/index.es.js
index 81cb408c8482fc7591a3381eb00b46abc9d21b14..1816113246e075ba7ae99638b64f004fd985ec74 100644
--- a/dist/index.es.js
+++ b/dist/index.es.js
@@ -1641,7 +1641,7 @@ function commonjs(options = {}) {
const sourceMap = options.sourceMap !== false;
function transformAndCheckExports(code, id) {
- if (isDynamicRequireModulesEnabled && this.getModuleInfo(id).isEntry) {
+ if (isDynamicRequireModulesEnabled && (this.getModuleInfo(id).isEntry || id.endsWith("/dynamic-require-entrypoint.cjs"))) {
// eslint-disable-next-line no-param-reassign
code =
getDynamicPackagesEntryIntro(dynamicRequireModuleDirPaths, dynamicRequireModuleSet) + code;
diff --git a/dist/index.js b/dist/index.js
index 8ef2184001cb697c6fc2466e9b5fe084c7f1d08c..056ded21d0bb35b8a7c36d1ec50a6ddb5508d386 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -1650,7 +1650,7 @@ function commonjs(options = {}) {
const sourceMap = options.sourceMap !== false;
function transformAndCheckExports(code, id) {
- if (isDynamicRequireModulesEnabled && this.getModuleInfo(id).isEntry) {
+ if (isDynamicRequireModulesEnabled && (this.getModuleInfo(id).isEntry || id.endsWith("/dynamic-require-entrypoint.cjs"))) {
// eslint-disable-next-line no-param-reassign
code =
getDynamicPackagesEntryIntro(dynamicRequireModuleDirPaths, dynamicRequireModuleSet) + code;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

768
.yarn/releases/yarn-3.1.1.cjs vendored Executable file

File diff suppressed because one or more lines are too long

3
.yarnrc Normal file
View File

@ -0,0 +1,3 @@
# Use Yarn 3
# This path should always match the one in .yarnrc.yml
yarn-path ".yarn/releases/yarn-3.0.2.cjs"

38
.yarnrc.yml Normal file
View File

@ -0,0 +1,38 @@
conditions:
BABEL_8_BREAKING:
default: false
enableGlobalCache: true
enableTransparentWorkspaces: false
nodeLinker: node-modules
plugins:
- path: .yarn/plugins/@yarnpkg/plugin-babel-release-tool.cjs
spec: "https://raw.githubusercontent.com/nicolo-ribaudo/yarn-plugin-babel-release-tool/main/bundles/%40yarnpkg/plugin-babel-release-tool.js"
- path: .yarn/plugins/@yarnpkg/plugin-conditions.cjs
spec: "https://raw.githubusercontent.com/nicolo-ribaudo/yarn-plugin-conditions/main/bundles/%40yarnpkg/plugin-conditions.js"
- path: .yarn/plugins/@yarnpkg/plugin-constraints.cjs
spec: "@yarnpkg/plugin-constraints"
releaseTool:
ignoreChanges:
- "*.md"
- "*.txt"
- test/**
- "**/test/**"
- codemods/**
- "@(!(native-modules|built-ins|plugins|package)).json"
implicitDependencies:
"@babel/runtime":
- "@babel/helpers"
"@babel/runtime-corejs2":
- "@babel/helpers"
"@babel/runtime-corejs3":
- "@babel/helpers"
unsafeHttpWhitelist:
- localhost
yarnPath: .yarn/releases/yarn-3.1.1.cjs

File diff suppressed because one or more lines are too long

View File

@ -55,7 +55,9 @@ further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting Henry Zhu <hi@henryzoo.com>, Logan Smyth <loganfsmyth@gmail.com> or one of the other [Babel core team members](https://babeljs.io/team). All
reported by contacting the Core Team (<team@babeljs.io>), or one or more of the
Core Team members (Brian Ng <bng412@gmail.com>, Henry Zhu <hi@henryzoo.com>,
Huáng Jùnliàng <jlhwung@gmail.com>, Nicolò Ribaudo <nicolo.ribaudo@gmail.com>). All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.

View File

@ -1,56 +1,59 @@
----
---
<p align="center" class="toc">
<strong><a href="#setup">Setup</a></strong>
|
<strong><a href="#running-lintingtests">Running linting/tests</a></strong>
|
<strong><a href="#writing-tests">Writing tests</a></strong>
|
<strong><a href="#debugging-code">Debugging code</a></strong>
|
<strong><a href="#internals">Internals</a></strong>
<strong><a href="#setup">Setup</a></strong>
|
<strong><a href="#running-lintingtests">Running linting/tests</a></strong>
|
<strong><a href="#writing-tests">Writing tests</a></strong>
|
<strong><a href="#debugging-code">Debugging code</a></strong>
|
<strong><a href="#internals">Internals</a></strong>
</p>
----
---
# Contributing
Contributions are always welcome, no matter how large or small. Before
contributing, please read the
[code of conduct](https://github.com/babel/babel/blob/master/CODE_OF_CONDUCT.md).
Contributions are always welcome, no matter how large or small! Before contributing, please read the [code of conduct](https://github.com/babel/babel/blob/main/CODE_OF_CONDUCT.md).
If you want an already configured online IDE to contribute to Babel, you can use [Gitpod](https://gitpod.io/#https://github.com/babel/babel)!
## Not sure where to start?
- If you aren't just making a documentation change, you'll probably want to learn a bit about a few topics.
- [ASTs](https://en.wikipedia.org/wiki/Abstract_syntax_tree) (Abstract Syntax Tree): The Babel AST [spec](https://github.com/babel/babel/blob/master/packages/babel-parser/ast/spec.md) is a bit different from [ESTree](https://github.com/estree/estree). The differences are listed [here](https://babeljs.io/docs/en/next/babel-parser.html#output).
- Check out [`/doc`](https://github.com/babel/babel/tree/master/doc) for information about Babel's internals
- Check out [the Babel Plugin Handbook](https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#babel-plugin-handbook) - core plugins are written the same way as any other plugin!
- Check out [AST Explorer](http://astexplorer.net/#/scUfOmVOG5) to learn more about ASTs or make your own plugin in the browser
- [ASTs](https://en.wikipedia.org/wiki/Abstract_syntax_tree) (Abstract Syntax Tree): The Babel AST [spec](https://github.com/babel/babel/blob/main/packages/babel-parser/ast/spec.md) is a bit different from [ESTree](https://github.com/estree/estree). The differences are listed [here](https://babeljs.io/docs/en/next/babel-parser.html#output).
- Check out [`/doc`](https://github.com/babel/babel/tree/main/doc) for information about Babel's internals
- Check out [the Babel Plugin Handbook](https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#babel-plugin-handbook) - core plugins are written the same way as any other plugin!
- Check out [AST Explorer](http://astexplorer.net/#/scUfOmVOG5) to learn more about ASTs or make your own plugin in the browser
- When you feel ready to jump into the Babel source code, a good place to start is to look for issues tagged with [help wanted](https://github.com/babel/babel/labels/help%20wanted) and/or [good first issue](https://github.com/babel/babel/labels/good%20first%20issue).
- Follow along with what we are working on by joining our [Slack](https://babeljs.slack.com) (you can sign-up [here](https://slack.babeljs.io/)
for an invite), following our announcements on [Twitter](https://twitter.com/babeljs), and reading (or participating!) in our [meeting notes](https://github.com/babel/notes).
- Follow along with what we are working on by joining our [Slack](https://babeljs.slack.com) (you can [sign up here](https://slack.babeljs.io/)
for an invite), following our announcements on [Twitter](https://twitter.com/babeljs), and reading (or participating!) in our [meeting notes](https://github.com/babel/notes).
- Check out our [website](http://babeljs.io/) and the [repo](https://github.com/babel/website)
- You can contribute by triaging issues which may include reproducing bug reports or asking for vital information, such as version numbers or reproduction instructions. If you would like to start triaging issues, one easy way to get started is to [subscribe to babel on CodeTriage](https://www.codetriage.com/babel/babel). [![Open Source Helpers](https://www.codetriage.com/babel/babel/badges/users.svg)](https://www.codetriage.com/babel/babel)
## Chat
Feel free to check out the `#discussion`/`#development` channels on our [Slack](https://slack.babeljs.io) (you can sign-up [here](https://slack.babeljs.io/) for an invite). Some of us are always online to chat!
Feel free to check out the `#discussion`/`#development` channels on our [Slack](https://babeljs.slack.com) (you can [sign up here](https://slack.babeljs.io/) for an invite). Some of us are always online to chat!
## Developing
**Note:** Versions `< 5.1.10` can't be built.
_Node_: Check that Node is [installed](https://nodejs.org/en/download/) with version `^12.20 || >= 14.13`. You can check this with `node -v`.
Babel is built for Node 6 and up but we develop using Node 8 and yarn. You can check this with `node -v`.
_Yarn_: Make sure that Yarn 1 is [installed](https://classic.yarnpkg.com/en/docs/install) with version >= `1.19.0`.
Make sure that Yarn is installed with version >= `0.28.0`.
Installation instructions can be found here: https://yarnpkg.com/en/docs/install.
_Make_: If you are running Windows 10, you'll need to do one of the following:
- Clone the repository and run the commands inside [WSL 2](https://docs.microsoft.com/en-us/windows/wsl/install-win10).
- Install [Make for Windows](http://gnuwin32.sourceforge.net/packages/make.htm).
### Setup
Fork the `babel` repository to your GitHub Account.
Then, run:
```sh
$ git clone https://github.com/babel/babel
$ git clone https://github.com/<your-github-username>/babel
$ cd babel
$ make bootstrap
```
@ -69,7 +72,7 @@ $ make watch
to have Babel build itself and incrementally build files on change.
You can access the built files for individual packages from `packages/<package-name>/lib`.
> You can access the built files for individual packages from `packages/<package-name>/lib`.
If you wish to build a copy of Babel for distribution, then run:
@ -79,47 +82,59 @@ $ make build-dist
### Running linting/tests
You can run lint via:
#### Lint
```sh
# ~6 sec on a MacBook Pro (Mid 2015)
$ make lint
```
You can run eslint's autofix via:
- You can run eslint's autofix via:
```sh
$ make fix
```
You can run tests + lint for all packages (slow) via:
#### Tests + lint for all packages (slow) via:
```sh
# ~46 sec on a MacBook Pro (Mid 2015)
$ make test
```
If you just want to run all tests:
#### All tests:
```sh
# ~40 sec on a MacBook Pro (Mid 2015)
$ make test-only
```
Most likely you'll want to focus in on a specific issue.
#### Run tests for a specific package
To run tests for a specific package in [packages](https://github.com/babel/babel/tree/master/packages), you can use the `TEST_ONLY` environment variable:
When working on an issue, you will most likely want to focus on a particular [packages](https://github.com/babel/babel/tree/main/packages). Using `TEST_ONLY` will only run tests for that specific package.
```sh
$ TEST_ONLY=babel-cli make test
```
`TEST_ONLY` will also match substrings of the package name:
<details>
<summary>More options</summary>
<code>TEST_ONLY</code> will also match substrings of the package name:
```sh
# Run tests for the @babel/plugin-transform-classes package.
$ TEST_ONLY=babel-plugin-transform-classes make test
```
```sh
# Run tests for the @babel/plugin-transform-classes package.
$ TEST_ONLY=babel-plugin-transform-classes make test
```
Or you can use Yarn:
```sh
$ yarn jest babel-cli
```
</details>
<br>
#### Run a subset of tests
Use the `TEST_GREP` variable to run a subset of tests by name:
@ -129,17 +144,40 @@ $ TEST_GREP=transformation make test
Substitute spaces for hyphens and forward slashes when targeting specific test names:
For example, for the following path:
```sh
packages/babel-plugin-transform-arrow-functions/test/fixtures/arrow-functions/destructuring-parameters
```
You can use:
```sh
$ TEST_GREP="arrow functions destructuring parameters" make test
```
To enable the Node.js debugger added in v6.3.0, set the `TEST_DEBUG` environment variable:
Or you can directly use Yarn:
```sh
$ yarn jest -t "arrow functions destructuring parameters"
```
#### Run test with Node debugger
To enable the Node.js debugger, set the <code>TEST_DEBUG</code> environment variable:
```sh
$ TEST_DEBUG=true make test
```
You can combine `TEST_DEBUG` with `TEST_GREP` or `TEST_ONLY` to debug a subset of tests. If you plan to stay long in the debugger (which you'll likely do!), you may increase the test timeout by editing [test/mocha.opts](https://github.com/babel/babel/blob/master/test/mocha.opts).
<details>
<summary>More options</summary>
Or you can directly use Yarn
```sh
$ yarn node --inspect-brk node_modules/jest/bin/jest.js --runInBand
```
</details>
<br>
You can combine `TEST_DEBUG` with `TEST_GREP` or `TEST_ONLY` to debug a subset of tests. If you plan to stay long in the debugger (which you'll likely do!), you may increase the test timeout by editing [test/testSetupFile.js](https://github.com/babel/babel/blob/main/test/testSetupFile.js).
To overwrite any test fixtures when fixing a bug or anything, add the env variable `OVERWRITE=true`
@ -147,6 +185,8 @@ To overwrite any test fixtures when fixing a bug or anything, add the env variab
$ OVERWRITE=true TEST_ONLY=babel-plugin-transform-classes make test-only
```
#### Test coverage
To test the code coverage, use:
```sh
@ -158,34 +198,35 @@ $ ./scripts/test-cov.sh
In case you're not able to reproduce an error on CI locally, it may be due to
- Node Version: Travis CI runs the tests against all major node versions. If your tests use JavaScript features unsupported by lower versions of node, then use [minNodeVersion option](#writing-tests) in options.json.
- Timeout: Check the CI log and if the only errors are timeout errors and you are sure that it's not related to the changes you made, ask someone in the slack channel to trigger rebuild on the CI build and it might be resolved
- Node Version: Travis CI runs the tests against all major node versions. If your tests use JavaScript features unsupported by lower versions of node, then use [minNodeVersion option](#writing-tests) in options.json.
- Timeout: Check the CI log and if the only errors are timeout errors and you are sure that it's not related to the changes you made, ask someone in the slack channel to trigger rebuild on the CI build and it might be resolved
In case you're locally getting errors which are not on the CI, it may be due to
- Updates in Dependencies: Make sure you run `make bootstrap` before you run `make build` or `make watch` before you run the tests.
- Updates in Dependencies: Make sure you run `make bootstrap` before you run `make build` or `make watch` before you run the tests.
### Writing tests
Most packages in [`/packages`](https://github.com/babel/babel/tree/master/packages) have a `test` folder, however some tests might be in other packages or in [`/packages/babel-core`](https://github.com/babel/babel/tree/master/packages/babel-core/test/fixtures).
Most packages in [`/packages`](https://github.com/babel/babel/tree/main/packages) have a `test` folder, however some tests might be in other packages or in [`/packages/babel-core`](https://github.com/babel/babel/tree/main/packages/babel-core/test/fixtures).
#### `@babel/plugin-x`
All the Babel plugins (and other packages) that have a `/test/fixtures` are written in a similar way.
For example, in [`@babel/plugin-transform-exponentiation-operator/test`](https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-exponentiation-operator/test):
For example, in [`@babel/plugin-transform-exponentiation-operator/test`](https://github.com/babel/babel/tree/main/packages/babel-plugin-transform-exponentiation-operator/test):
- There is an `index.js` file. It imports our [test helper](https://github.com/babel/babel/tree/master/packages/babel-helper-plugin-test-runner). (You don't have to worry about this).
- There can be multiple folders under [`/fixtures`](https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-exponentiation-operator/test/fixtures)
- There is an [`options.json`](https://github.com/babel/babel/blob/master/packages/babel-plugin-transform-exponentiation-operator/test/fixtures/exponentian-operator/options.json) file whose function is similar to a `.babelrc` file, allowing you to pass in the plugins and settings you need for your tests.
- For this test, we only need the relevant plugin, so it's just `{ "plugins": ["@babel/plugin-transform-exponentiation-operator"] }`.
- If necessary, you can have an `options.json` with different options in each subfolder.
- There is an `index.js` file. It imports our [test helper](https://github.com/babel/babel/tree/main/packages/babel-helper-plugin-test-runner). (You don't have to worry about this).
- There can be multiple folders under [`/fixtures`](https://github.com/babel/babel/tree/main/packages/babel-plugin-transform-exponentiation-operator/test/fixtures)
- There is an [`options.json`](https://github.com/babel/babel/blob/main/packages/babel-plugin-transform-exponentiation-operator/test/fixtures/exponentian-operator/options.json) file whose function is similar to a `.babelrc` file, allowing you to pass in the plugins and settings you need for your tests.
- For this test, we only need the relevant plugin, so it's just `{ "plugins": ["@babel/plugin-transform-exponentiation-operator"] }`.
- If necessary, you can have an `options.json` with different options in each subfolder.
- In each subfolder, you can organize your directory structure by categories of tests. (Example: these folders can be named after the feature you are testing or can reference the issue number they fix)
- Generally, there are two kinds of tests for plugins
  - The first is a simple test of the input and output produced by running Babel on some code. We do this by creating an [`input.js`](https://github.com/babel/babel/blob/master/packages/babel-plugin-transform-exponentiation-operator/test/fixtures/exponentian-operator/binary/input.js) file and an [`output.js`](https://github.com/babel/babel/blob/master/packages/babel-plugin-transform-exponentiation-operator/test/fixtures/exponentian-operator/binary/output.js) file. This kind of test only works in sub-subdirectories of `/fixtures`, i.e. `/fixtures/exponentian-operator/binary/input.js` and **not** `/fixtures/exponentian-operator/input.js`.
- If you need to expect an error, you can ignore creating the `output.js` file and pass a new `throws` key to the `options.json` that contains the error string that is created.
- The second and preferred type is a test that actually evaluates the produced code and asserts that certain properties are true or false. We do this by creating an [`exec.js`](https://github.com/babel/babel/blob/master/packages/babel-plugin-transform-exponentiation-operator/test/fixtures/exponentian-operator/comprehensive/exec.js) file.
  - The first is a simple test of the input and output produced by running Babel on some code. We do this by creating an [`input.js`](https://github.com/babel/babel/blob/main/packages/babel-plugin-transform-exponentiation-operator/test/fixtures/exponentian-operator/binary/input.js) file and an [`output.js`](https://github.com/babel/babel/blob/main/packages/babel-plugin-transform-exponentiation-operator/test/fixtures/exponentian-operator/binary/output.js) file. This kind of test only works in sub-subdirectories of `/fixtures`, i.e. `/fixtures/exponentian-operator/binary/input.js` and **not** `/fixtures/exponentian-operator/input.js`.
- If you need to expect an error, you can ignore creating the `output.js` file and pass a new `throws` key to the `options.json` that contains the error string that is created.
- The second and preferred type is a test that actually evaluates the produced code and asserts that certain properties are true or false. We do this by creating an [`exec.js`](https://github.com/babel/babel/blob/main/packages/babel-plugin-transform-exponentiation-operator/test/fixtures/exponentian-operator/comprehensive/exec.js) file.
In a fixture test, you simply write out the code you want to transform in `input.js`.
@ -200,6 +241,7 @@ and the expected output after transforming it with your `options.json` in `outpu
// output.js
Math.pow(2, 2);
```
In an `exec.js` test, we run or check that the code actually does what it's supposed to do rather than just check the static output.
```js
@ -208,24 +250,48 @@ expect(2 ** 3).toBe(8);
expect(3 * 2 ** 3).toBe(24);
```
If you need to check for an error that is thrown you can add to the `options.json`
##### `options.json` settings
```js
// options.json example
{
"plugins": [["@babel/plugin-proposal-object-rest-spread", { "useBuiltIns": "invalidOption" }]],
"throws": "@babel/plugin-proposal-object-rest-spread currently only accepts a boolean option for useBuiltIns (defaults to false)"
}
```
Other than normal Babel options, `options.json` can contain other properties to configure the test behavior:
If the test requires a minimum Node version, you can add `minNodeVersion` (must be in semver format).
- **`throws`** (string)
```js
// options.json example
{
"minNodeVersion": "5.0.0"
}
```
If you need to check for an error that is thrown you can add to the `options.json`
```jsonc
// options.json example
{
"plugins": [
[
"@babel/plugin-proposal-object-rest-spread",
{ "useBuiltIns": "invalidOption" }
]
],
"throws": "@babel/plugin-proposal-object-rest-spread currently only accepts a boolean option for useBuiltIns (defaults to false)"
}
```
- **`minNodeVersion`** (string)
If the test requires a minimum Node version, you can add `minNodeVersion` (must be in semver format).
```jsonc
// options.json example
{
"minNodeVersion": "5.0.0"
}
```
- **`externalHelpers`** (boolean)
By default, all the tests run with the [`@babel/plugin-external-helpers`](https://babel.dev/docs/en/babel-plugin-external-helpers) enabled. You can disable this behavior with
```jsonc
// options.json example
{
"externalHelpers": false
}
```
#### `@babel/parser` (babylon)
@ -235,9 +301,9 @@ Inside the `packages/babel-parser/test/fixtures` folder are categories/groupings
etc.). To add a test, create a folder under one of these groupings (or create a new one) with a
descriptive name, and add the following:
* Create an `input.js` file that contains the code you want the babel parser to parse.
- Create an `input.js` file that contains the code you want the babel parser to parse.
* Add an `output.json` file with the expected parser output. For added convenience, if there is no `output.json` present, the test runner will generate one for you.
- Add an `output.json` file with the expected parser output. For added convenience, if there is no `output.json` present, the test runner will generate one for you.
After writing tests for @babel/parser, just build it by running:
@ -306,19 +372,27 @@ Note that the code shown in Chrome DevTools is compiled code and therefore diffe
## Creating a new plugin (`spec-new`)
> Example: https://github.com/babel/babylon/pull/541
> Example: https://github.com/babel/babel/pull/11640
- Create a new issue that describes the proposal (ex: [#538](https://github.com/babel/babylon/issues/538)). Include any relevant information like proposal repo/author, examples, parsing approaches, meeting notes, presentation slides, and more.
- The pull request should include:
- [ ] An update to the [plugins](https://github.com/babel/babel/tree/master/packages/babel-parser#plugins) part of the readme. Add a new entry to that list for the new plugin flag (and link to the proposal)
- [ ] If any new nodes or modifications need to be added to the AST, update [ast/spec.md](https://github.com/babel/babel/blob/master/packages/babel-parser/ast/spec.md)
- [ ] Make sure you use the `this.hasPlugin("plugin-name-here")` check in the babel parser so that your new plugin code only runs when that flag is turned on (not default behavior)
- Create a new PR that describes the proposed AST shape in [ESTree](https://github.com/estree/estree) (ex: [Decimal AST](https://github.com/estree/estree/pull/220)). The new AST should follow ESTree's [design philosophy](https://github.com/estree/estree#philosophy).
- After the ESTree PR is accepted, update [ast/spec.md](https://github.com/babel/babel/blob/master/packages/babel-parser/ast/spec.md). Note that there are differences between Babel AST and ESTree. In these cases, consistency with current Babel AST outweighs alignment to ESTree. Otherwise it should follow ESTree.
- [ ] Implement parser plugins based on the new AST. The parser plugin name should be the unprefixed slug of the TC39 proposal URL in _camelcase_, i.e. `exportDefaultFrom` from `https://github.com/tc39/proposal-export-default-from`.
- [ ] Use the `this.expectPlugin("pluginName")` check within `@babel/parser` to ensure your new plugin code only runs when that flag is turned on (not default behavior), and a friendly error is thrown if users forget to enable a plugin. You can also supply an array pair to require certain configuration options, e.g., `this.expectPlugin(["pluginName", { configOption: value }])`.
- [ ] Add failing/passing tests according to spec behavior
- Start working about the Babel transform itself!
- [ ] Add `@babel/syntax-new-syntax` package. You can copy `packages/babel-plugin-syntax-decimal` and replace `decimal` to `new-syntax`.
- [ ] Add `@babel/syntax-new-syntax` to `@babel/standalone`.
- [ ] Add `@babel/syntax-new-syntax` to `package.json`
- [ ] Add `@babel/syntax-new-syntax` to [`pluginsConfig.json`](https://github.com/babel/babel/blob/master/packages/babel-standalone/scripts/pluginConfig.json), run `make build-standalone`.
- [ ] Add `@babel/syntax-new-syntax` to `src/preset-stage-x`.
- [ ] Add `"newSyntax"` to parser [typings](https://github.com/babel/babel/blob/master/packages/babel-parser/typings/babel-parser.d.ts)
- [ ] Implement generator support in `packages/babel-generator/src/generators`. The generator converts AST to source code.
- [ ] If this feature can be transpiled, start working on the Babel transform.
## Internals
- AST spec ([babel-parser/ast/spec.md](https://github.com/babel/babel/blob/master/packages/babel-parser/ast/spec.md))
- Versioning ([doc/design/versioning.md](https://github.com/babel/babel/blob/master/doc/design/versioning.md))
- Monorepo ([doc/design/monorepo.md](https://github.com/babel/babel/blob/master/doc/design/monorepo.md))
- Compiler environment support ([doc/design/compiler-environment-support.md](https://github.com/babel/babel/blob/master/doc/design/compiler-environment-support.md))
- Compiler assumptions ([doc/design/compiler-assumptions.md](https://github.com/babel/babel/blob/master/doc/design/compiler-assumptions.md))
- AST spec ([babel-parser/ast/spec.md](https://github.com/babel/babel/blob/main/packages/babel-parser/ast/spec.md))
- Versioning ([doc/design/versioning.md](https://github.com/babel/babel/blob/main/doc/design/versioning.md))
- Monorepo ([doc/design/monorepo.md](https://github.com/babel/babel/blob/main/doc/design/monorepo.md))
- Compiler environment support ([doc/design/compiler-environment-support.md](https://github.com/babel/babel/blob/main/doc/design/compiler-environment-support.md))
- Compiler assumptions ([doc/design/compiler-assumptions.md](https://github.com/babel/babel/blob/main/doc/design/compiler-assumptions.md))

View File

@ -1,168 +0,0 @@
"use strict";
const plumber = require("gulp-plumber");
const through = require("through2");
const chalk = require("chalk");
const newer = require("gulp-newer");
const babel = require("gulp-babel");
const gulpWatch = require("gulp-watch");
const fancyLog = require("fancy-log");
const filter = require("gulp-filter");
const gulp = require("gulp");
const path = require("path");
const webpack = require("webpack");
const rollup = require("rollup");
const rollupBabel = require("rollup-plugin-babel");
const rollupNodeResolve = require("rollup-plugin-node-resolve");
const rollupReplace = require("rollup-plugin-replace");
const { registerStandalonePackageTask } = require("./scripts/gulp-tasks");
const defaultSourcesGlob = "./@(codemods|packages)/*/src/**/*.js";
function swapSrcWithLib(srcPath) {
const parts = srcPath.split(path.sep);
parts[2] = "lib";
return parts.join(path.sep);
}
function getIndexFromPackage(name) {
return `${name}/src/index.js`;
}
function compilationLogger() {
return through.obj(function(file, enc, callback) {
fancyLog(`Compiling '${chalk.cyan(file.relative)}'...`);
callback(null, file);
});
}
function errorsLogger() {
return plumber({
errorHandler(err) {
fancyLog(err.stack);
},
});
}
function rename(fn) {
return through.obj(function(file, enc, callback) {
file.path = fn(file);
callback(null, file);
});
}
function buildBabel(exclude, sourcesGlob = defaultSourcesGlob) {
const base = __dirname;
let stream = gulp.src(sourcesGlob, { base: __dirname });
if (exclude) {
const filters = exclude.map(p => `!**/${p}/**`);
filters.unshift("**");
stream = stream.pipe(filter(filters));
}
return stream
.pipe(errorsLogger())
.pipe(newer({ dest: base, map: swapSrcWithLib }))
.pipe(compilationLogger())
.pipe(babel())
.pipe(
// Passing 'file.relative' because newer() above uses a relative
// path and this keeps it consistent.
rename(file => path.resolve(file.base, swapSrcWithLib(file.relative)))
)
.pipe(gulp.dest(base));
}
function buildRollup(packages) {
return Promise.all(
packages.map(pkg => {
const input = getIndexFromPackage(pkg);
fancyLog(`Compiling '${chalk.cyan(input)}' with rollup ...`);
return rollup
.rollup({
input,
plugins: [
rollupReplace({
"process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV),
}),
rollupBabel({
envName: "babel-parser",
}),
rollupNodeResolve(),
],
})
.then(bundle => {
return bundle.write({
file: path.join(pkg, "lib/index.js"),
format: "cjs",
name: "babel-parser",
sourcemap: process.env.NODE_ENV !== "production",
});
});
})
);
}
const bundles = ["packages/babel-parser"];
gulp.task("build-rollup", () => buildRollup(bundles));
gulp.task("build-babel", () => buildBabel(/* exclude */ bundles));
gulp.task("build-babel-types", () =>
buildBabel(/* exclude */ bundles, "packages/babel-types/src/**/*.js")
);
gulp.task("build", gulp.parallel("build-rollup", "build-babel"));
gulp.task("default", gulp.series("build"));
gulp.task("build-no-bundle", () => buildBabel());
gulp.task(
"watch",
gulp.series("build-no-bundle", function watch() {
gulpWatch(
defaultSourcesGlob,
{ debounceDelay: 200 },
gulp.task("build-no-bundle")
);
})
);
registerStandalonePackageTask(
gulp,
"babel",
"Babel",
path.join(__dirname, "packages"),
require("./packages/babel-standalone/package.json").version
);
const presetEnvWebpackPlugins = [
new webpack.NormalModuleReplacementPlugin(
/\.\/available-plugins/,
require.resolve(
path.join(
__dirname,
"./packages/babel-preset-env-standalone/src/available-plugins"
)
)
),
new webpack.NormalModuleReplacementPlugin(
/caniuse-lite\/data\/regions\/.+/,
require.resolve(
path.join(
__dirname,
"./packages/babel-preset-env-standalone/src/caniuse-lite-regions"
)
)
),
];
registerStandalonePackageTask(
gulp,
"babel-preset-env",
"babelPresetEnv",
path.join(__dirname, "packages"),
require("./packages/babel-preset-env-standalone/package.json").version,
presetEnvWebpackPlugins
);

581
Gulpfile.mjs Normal file
View File

@ -0,0 +1,581 @@
import path from "path";
import fs from "fs";
import { createRequire } from "module";
import { fileURLToPath } from "url";
import plumber from "gulp-plumber";
import through from "through2";
import chalk from "chalk";
import fancyLog from "fancy-log";
import filter from "gulp-filter";
import gulp from "gulp";
import { rollup } from "rollup";
import { babel as rollupBabel } from "@rollup/plugin-babel";
import rollupCommonJs from "@rollup/plugin-commonjs";
import rollupJson from "@rollup/plugin-json";
import rollupNodePolyfills from "rollup-plugin-node-polyfills";
import rollupNodeResolve from "@rollup/plugin-node-resolve";
import rollupReplace from "@rollup/plugin-replace";
import { terser as rollupTerser } from "rollup-plugin-terser";
import _rollupDts from "rollup-plugin-dts";
const { default: rollupDts } = _rollupDts;
import { Worker as JestWorker } from "jest-worker";
import glob from "glob";
import rollupBabelSource from "./scripts/rollup-plugin-babel-source.js";
import formatCode from "./scripts/utils/formatCode.js";
const require = createRequire(import.meta.url);
const monorepoRoot = path.dirname(fileURLToPath(import.meta.url));
const defaultPackagesGlob = "./@(codemods|packages|eslint)/*";
const defaultSourcesGlob = `${defaultPackagesGlob}/src/**/{*.js,*.cjs,!(*.d).ts}`;
const babelStandalonePluginConfigGlob =
"./packages/babel-standalone/scripts/pluginConfig.json";
const buildTypingsWatchGlob = [
"./packages/babel-types/lib/definitions/**/*.js",
"./packages/babel-types/scripts/generators/*.js",
];
/**
* map source code path to the generated artifacts path
* @example
* mapSrcToLib("packages/babel-core/src/index.js")
* // returns "packages/babel-core/lib/index.js"
* @example
* mapSrcToLib("packages/babel-template/src/index.ts")
* // returns "packages/babel-template/lib/index.js"
* @example
* mapSrcToLib("packages/babel-template/src/index.d.ts")
* // returns "packages/babel-template/lib/index.d.ts"
* @param {string} srcPath
* @returns {string}
*/
function mapSrcToLib(srcPath) {
const parts = srcPath.replace(/(?<!\.d)\.ts$/, ".js").split("/");
parts[2] = "lib";
return parts.join("/");
}
function mapToDts(packageName) {
return packageName.replace(
/(?<=\\|\/|^)(packages|eslint|codemods)(?=\\|\/)/,
"dts/$1"
);
}
function getIndexFromPackage(name) {
try {
fs.statSync(`./${name}/src/index.ts`);
return `${name}/src/index.ts`;
} catch {
return `${name}/src/index.js`;
}
}
function errorsLogger() {
return plumber({
errorHandler(err) {
fancyLog(err.stack);
},
});
}
function rename(fn) {
return through.obj(function (file, enc, callback) {
file.path = fn(file);
callback(null, file);
});
}
/**
* @param {string} generator
* @param {string} pkg
* @param {string} filename
* @param {string} message
*/
function generateHelpers(generator, dest, filename, message) {
const stream = gulp
.src(".", { base: monorepoRoot })
.pipe(errorsLogger())
.pipe(
through.obj(async (file, enc, callback) => {
const { default: generateCode } = await import(generator);
file.path = filename;
file.contents = Buffer.from(
formatCode(await generateCode(filename), dest + file.path)
);
fancyLog(`${chalk.green("✔")} Generated ${message}`);
callback(null, file);
})
)
.pipe(gulp.dest(dest, { mode: 0o644 }));
return finish(stream);
}
/**
*
* @typedef {("asserts" | "builders" | "constants" | "validators")} TypesHelperKind
* @param {TypesHelperKind} helperKind
* @param {string} filename
*/
async function generateTypeHelpers(helperKind, filename = "index.ts") {
return generateHelpers(
`./packages/babel-types/scripts/generators/${helperKind}.js`,
`./packages/babel-types/src/${helperKind}/generated/`,
filename,
`@babel/types -> ${helperKind}`
);
}
/**
*
* @typedef {("asserts" | "validators" | "virtual-types")} TraverseHelperKind
* @param {TraverseHelperKind} helperKind
*/
async function generateTraverseHelpers(helperKind) {
return generateHelpers(
`./packages/babel-traverse/scripts/generators/${helperKind}.js`,
`./packages/babel-traverse/src/path/generated/`,
`${helperKind}.ts`,
`@babel/traverse -> ${helperKind}`
);
}
async function generateRuntimeHelpers() {
return generateHelpers(
`./packages/babel-helpers/scripts/generate-helpers.js`,
`./packages/babel-helpers/src/`,
"helpers-generated.ts",
"@babel/helpers"
);
}
function generateStandalone() {
const dest = "./packages/babel-standalone/src/generated/";
return gulp
.src(babelStandalonePluginConfigGlob, { base: monorepoRoot })
.pipe(
through.obj((file, enc, callback) => {
fancyLog("Generating @babel/standalone files");
const pluginConfig = JSON.parse(file.contents);
let imports = "";
let list = "";
let allList = "";
for (const plugin of pluginConfig) {
const camelPlugin = plugin.replace(/-[a-z]/g, c =>
c[1].toUpperCase()
);
imports += `import ${camelPlugin} from "@babel/plugin-${plugin}";`;
list += `${camelPlugin},`;
allList += `"${plugin}": ${camelPlugin},`;
}
const fileContents = `/*
* This file is auto-generated! Do not modify it directly.
* To re-generate run 'yarn gulp generate-standalone'
*/
${imports}
export {${list}};
export const all: { [k: string]: any } = {${allList}};`;
file.path = "plugins.ts";
file.contents = Buffer.from(formatCode(fileContents, dest));
callback(null, file);
})
)
.pipe(gulp.dest(dest));
}
function finish(stream) {
return new Promise((resolve, reject) => {
stream.on("end", resolve);
stream.on("finish", resolve);
stream.on("error", reject);
});
}
function getFiles(glob, { include, exclude }) {
let stream = gulp.src(glob, { base: monorepoRoot });
if (exclude) {
const filters = exclude.map(p => `!**/${p}/**`);
filters.unshift("**");
stream = stream.pipe(filter(filters));
}
if (include) {
const filters = include.map(p => `**/${p}/**`);
stream = stream.pipe(filter(filters));
}
return stream;
}
function createWorker(useWorker) {
const numWorkers = require("os").cpus().length / 2 - 1;
if (numWorkers === 0 || !useWorker) {
return require("./babel-worker.cjs");
}
const worker = new JestWorker(require.resolve("./babel-worker.cjs"), {
numWorkers,
exposedMethods: ["transform"],
});
worker.getStdout().pipe(process.stdout);
worker.getStderr().pipe(process.stderr);
return worker;
}
async function buildBabel(useWorker, ignore = []) {
const worker = createWorker(useWorker);
const files = await new Promise((resolve, reject) => {
glob(
defaultSourcesGlob,
{
ignore: ignore.map(p => `./${p.src}/**`),
},
(err, files) => {
if (err) reject(err);
resolve(files);
}
);
});
const promises = [];
for (const file of files) {
// @example ./packages/babel-parser/src/index.js
const dest = "./" + mapSrcToLib(file.slice(2));
promises.push(worker.transform(file, dest));
}
return Promise.all(promises).finally(() => {
if (worker.end !== undefined) {
worker.end();
}
});
}
/**
* Resolve a nested dependency starting from the given file
*/
function resolveChain(baseUrl, ...packages) {
const require = createRequire(baseUrl);
return packages.reduce(
(base, pkg) =>
path.dirname(require.resolve(pkg + "/package.json", { paths: [base] })),
path.dirname(fileURLToPath(baseUrl))
);
}
// If this build is part of a pull request, include the pull request number in
// the version number.
let versionSuffix = "";
if (process.env.CIRCLE_PR_NUMBER) {
versionSuffix = "+pr." + process.env.CIRCLE_PR_NUMBER;
}
const babelVersion =
require("./packages/babel-core/package.json").version + versionSuffix;
function buildRollup(packages, targetBrowsers) {
const sourcemap = process.env.NODE_ENV === "production";
return Promise.all(
packages.map(
async ({ src, format, dest, name, filename, envName = "rollup" }) => {
const pkgJSON = require("./" + src + "/package.json");
const version = pkgJSON.version + versionSuffix;
const { dependencies = {}, peerDependencies = {} } = pkgJSON;
const external = Object.keys(dependencies).concat(
Object.keys(peerDependencies)
);
const input = getIndexFromPackage(src);
fancyLog(`Compiling '${chalk.cyan(input)}' with rollup ...`);
const bundle = await rollup({
input,
external,
onwarn(warning, warn) {
if (warning.code === "CIRCULAR_DEPENDENCY") return;
if (warning.code === "UNUSED_EXTERNAL_IMPORT") {
warn(warning);
return;
}
// Rollup warns about using babel.default at
// https://github.com/babel/babel-polyfills/blob/4ac92be5b70b13e3d8a34614d8ecd900eb3f40e4/packages/babel-helper-define-polyfill-provider/src/types.js#L5
// We can safely ignore this warning, and let Rollup replace it with undefined.
if (
warning.code === "MISSING_EXPORT" &&
warning.exporter === "packages/babel-core/src/index.ts" &&
warning.missing === "default" &&
[
"@babel/helper-define-polyfill-provider",
"babel-plugin-polyfill-corejs2",
"babel-plugin-polyfill-corejs3",
"babel-plugin-polyfill-regenerator",
].some(pkg => warning.importer.includes(pkg))
) {
return;
}
// We use console.warn here since it prints more info than just "warn",
// in case we want to stop throwing for a specific message.
console.warn(warning);
// https://github.com/babel/babel/pull/12011#discussion_r540434534
throw new Error("Rollup aborted due to warnings above");
},
plugins: [
rollupBabelSource(),
rollupReplace({
preventAssignment: true,
values: {
"process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV),
BABEL_VERSION: JSON.stringify(babelVersion),
VERSION: JSON.stringify(version),
},
}),
rollupCommonJs({
include: [
/node_modules/,
"packages/babel-runtime/regenerator/**",
"packages/babel-preset-env/data/*.js",
// Rollup doesn't read export maps, so it loads the cjs fallback
"packages/babel-compat-data/*.js",
"packages/*/src/**/*.cjs",
// See the comment in this file for the reason to include it
"packages/babel-standalone/src/dynamic-require-entrypoint.cjs",
],
dynamicRequireTargets: [
// https://github.com/mathiasbynens/regexpu-core/blob/ffd8fff2e31f4597f6fdfee75d5ac1c5c8111ec3/rewrite-pattern.js#L48
resolveChain(
import.meta.url,
"./packages/babel-helper-create-regexp-features-plugin",
"regexpu-core",
"regenerate-unicode-properties"
) + "/**/*.js",
],
// Never delegate to the native require()
ignoreDynamicRequires: true,
// Align with the Node.js behavior
defaultIsModuleExports: true,
}),
rollupBabel({
envName,
babelrc: false,
babelHelpers: "bundled",
extends: "./babel.config.js",
extensions: [".ts", ".js", ".mjs", ".cjs"],
}),
rollupNodeResolve({
extensions: [".ts", ".js", ".mjs", ".cjs", ".json"],
browser: targetBrowsers,
exportConditions: targetBrowsers ? ["browser"] : [],
// It needs to be set to 'false' when using rollupNodePolyfills
// https://github.com/rollup/plugins/issues/772
preferBuiltins: !targetBrowsers,
}),
rollupJson(),
targetBrowsers &&
rollupNodePolyfills({
sourceMap: sourcemap,
include: "**/*.{js,cjs,ts}",
}),
].filter(Boolean),
});
const outputFile = path.join(src, dest, filename || "index.js");
await bundle.write({
file: outputFile,
format,
name,
sourcemap: sourcemap,
exports: "named",
});
if (!process.env.IS_PUBLISH) {
fancyLog(
chalk.yellow(
`Skipped minification of '${chalk.cyan(
outputFile
)}' because not publishing`
)
);
return undefined;
}
fancyLog(`Minifying '${chalk.cyan(outputFile)}'...`);
await bundle.write({
file: outputFile.replace(/\.js$/, ".min.js"),
format,
name,
sourcemap: sourcemap,
exports: "named",
plugins: [
rollupTerser({
// workaround https://bugs.webkit.org/show_bug.cgi?id=212725
output: {
ascii_only: true,
},
numWorkers: process.env.CIRCLECI ? 1 : undefined,
}),
],
});
}
)
);
}
function buildRollupDts(packages) {
const sourcemap = process.env.NODE_ENV === "production";
return Promise.all(
packages.map(async packageName => {
const input = `${mapToDts(packageName)}/src/index.d.ts`;
const output = `${packageName}/lib/index.d.ts`;
fancyLog(`Bundling '${chalk.cyan(output)}' with rollup ...`);
const bundle = await rollup({
input,
plugins: [rollupDts()],
onwarn(warning, warn) {
if (warning.code !== "CIRCULAR_DEPENDENCY") warn(warning);
},
});
await bundle.write({
file: output,
format: "es",
sourcemap: sourcemap,
exports: "named",
});
})
);
}
function copyDts(packages) {
return getFiles(`${defaultPackagesGlob}/src/**/*.d.ts`, { include: packages })
.pipe(rename(file => path.resolve(file.base, mapToDts(file.relative))))
.pipe(gulp.dest(monorepoRoot));
}
const libBundles = [
"packages/babel-parser",
"packages/babel-plugin-proposal-object-rest-spread",
"packages/babel-plugin-proposal-optional-chaining",
"packages/babel-preset-react",
"packages/babel-preset-typescript",
"packages/babel-helper-member-expression-to-functions",
"packages/babel-plugin-bugfix-v8-spread-parameters-in-optional-chaining",
"packages/babel-plugin-bugfix-safari-id-destructuring-collision-in-function-expression",
].map(src => ({
src,
format: "cjs",
dest: "lib",
}));
const dtsBundles = ["packages/babel-types"];
const standaloneBundle = [
{
src: "packages/babel-standalone",
format: "umd",
name: "Babel",
filename: "babel.js",
dest: "",
version: babelVersion,
envName: "standalone",
},
];
gulp.task("generate-type-helpers", () => {
fancyLog("Generating @babel/types and @babel/traverse dynamic functions");
return Promise.all([
generateTypeHelpers("asserts"),
generateTypeHelpers("builders"),
generateTypeHelpers("builders", "uppercase.js"),
generateTypeHelpers("constants"),
generateTypeHelpers("validators"),
generateTypeHelpers("ast-types"),
generateTraverseHelpers("asserts"),
generateTraverseHelpers("validators"),
generateTraverseHelpers("virtual-types"),
]);
});
gulp.task("generate-runtime-helpers", () => {
fancyLog("Generating @babel/helpers runtime helpers");
return generateRuntimeHelpers();
});
gulp.task("generate-standalone", () => generateStandalone());
gulp.task("build-rollup", () => buildRollup(libBundles));
gulp.task("rollup-babel-standalone", () => buildRollup(standaloneBundle, true));
gulp.task(
"build-babel-standalone",
gulp.series("generate-standalone", "rollup-babel-standalone")
);
gulp.task("copy-dts", () => copyDts(dtsBundles));
gulp.task(
"bundle-dts",
gulp.series("copy-dts", () => buildRollupDts(dtsBundles))
);
gulp.task("build-babel", () => buildBabel(true, /* exclude */ libBundles));
gulp.task(
"build",
gulp.series(
gulp.parallel("build-rollup", "build-babel", "generate-runtime-helpers"),
gulp.parallel(
"generate-standalone",
gulp.series(
"generate-type-helpers",
// rebuild @babel/types since type-helpers may be changed
"build-babel"
)
)
)
);
gulp.task("default", gulp.series("build"));
// First build on worker processes for compilation speed
gulp.task("build-no-bundle", () => buildBabel(true));
// Incremental builds take place in main process
gulp.task("build-no-bundle-watch", () => buildBabel(false));
gulp.task(
"build-dev",
gulp.series(
"build-no-bundle",
gulp.parallel(
"generate-standalone",
gulp.series(
"generate-type-helpers",
// rebuild @babel/types since type-helpers may be changed
"build-no-bundle"
)
)
)
);
gulp.task(
"watch",
gulp.series("build-dev", function watch() {
gulp.watch(defaultSourcesGlob, gulp.task("build-no-bundle-watch"));
gulp.watch(
babelStandalonePluginConfigGlob,
gulp.task("generate-standalone")
);
gulp.watch(buildTypingsWatchGlob, gulp.task("generate-type-helpers"));
gulp.watch(
"./packages/babel-helpers/src/helpers/*.js",
gulp.task("generate-runtime-helpers")
);
})
);

249
Makefile
View File

@ -1,140 +1,129 @@
FLOW_COMMIT = 09669846b7a7ca5a6c23c12d56bb3bebdafd67e9
TEST262_COMMIT = 8688c4ab79059c3097098605e69f1ee5eda6c409
FLOW_COMMIT = 92bbb5e9dacb8185aa73ea343954d0434b42c40b
TEST262_COMMIT = 46f165ae490de7f1343165ab8d228db81eaa02c5
TYPESCRIPT_COMMIT = b53073bf66571b4c99f0a93b8f76fb06b36d8991
# Fix color output until TravisCI fixes https://github.com/travis-ci/travis-ci/issues/7967
export FORCE_COLOR = true
SOURCES = packages codemods
SOURCES = packages codemods eslint
COMMA := ,
EMPTY :=
SPACE := $(EMPTY) $(EMPTY)
COMMA_SEPARATED_SOURCES = $(subst $(SPACE),$(COMMA),$(SOURCES))
YARN := yarn
NODE := $(YARN) node
.PHONY: build build-dist watch lint fix clean test-clean test-only test test-ci publish bootstrap
build: build-bundle
build: build-no-bundle
ifneq ("$(BABEL_COVERAGE)", "true")
$(MAKE) build-standalone
endif
build-bundle: clean clean-lib
yarn gulp build
$(MAKE) generate-standalone generate-type-helpers
# call build again as the generated files might need to be compiled again.
yarn gulp build
$(MAKE) build-typings
$(YARN) gulp build
$(MAKE) build-flow-typings
$(MAKE) build-dist
build-bundle-ci: bootstrap-only
$(MAKE) build-bundle
build-no-bundle-ci: bootstrap-only
$(YARN) gulp build-dev
$(MAKE) build-flow-typings
$(MAKE) build-dist
generate-standalone:
node packages/babel-standalone/scripts/generate.js
build-no-bundle: clean clean-lib
BABEL_ENV=development $(YARN) gulp build-dev
$(MAKE) build-flow-typings
$(MAKE) build-dist
generate-tsconfig:
$(NODE) scripts/generators/tsconfig.js
generate-type-helpers:
node packages/babel-types/scripts/generateTypeHelpers.js
build-typings: build-flow-typings build-typescript-typings
$(YARN) gulp generate-type-helpers
build-flow-typings:
node packages/babel-types/scripts/generators/flow.js > packages/babel-types/lib/index.js.flow
$(NODE) packages/babel-types/scripts/generators/flow.js > packages/babel-types/lib/index.js.flow
build-typescript-typings:
node packages/babel-types/scripts/generators/typescript.js > packages/babel-types/lib/index.d.ts
# For TypeScript older than 3.7
build-typescript-legacy-typings:
$(NODE) packages/babel-types/scripts/generators/typescript-legacy.js > packages/babel-types/lib/index-legacy.d.ts
build-standalone: build-babel-standalone build-preset-env-standalone
build-standalone: build-babel-standalone
build-standalone-ci: build-bundle-ci
build-standalone-ci: build-no-bundle-ci
$(MAKE) build-standalone
build-babel-standalone:
yarn gulp build-babel-standalone
build-preset-env-standalone:
yarn gulp build-babel-preset-env-standalone
$(YARN) gulp build-babel-standalone
prepublish-build-standalone:
BABEL_ENV=production IS_PUBLISH=true yarn gulp build-babel-standalone
BABEL_ENV=production IS_PUBLISH=true $(YARN) gulp build-babel-standalone
prepublish-build-preset-env-standalone:
BABEL_ENV=production IS_PUBLISH=true yarn gulp build-babel-preset-env-standalone
build-dist: build-polyfill-dist build-plugin-transform-runtime-dist
build-polyfill-dist:
cd packages/babel-polyfill; \
scripts/build-dist.sh
build-dist: build-plugin-transform-runtime-dist
build-plugin-transform-runtime-dist:
cd packages/babel-plugin-transform-runtime; \
node scripts/build-dist.js
build-no-bundle: clean clean-lib
BABEL_ENV=development yarn gulp build-no-bundle
# Ensure that build artifacts for types are created during local
# development too.
$(MAKE) generate-type-helpers
$(MAKE) build-typings
$(NODE) scripts/build-dist.js
watch: build-no-bundle
BABEL_ENV=development yarn gulp watch
BABEL_ENV=development $(YARN) gulp watch
code-quality-ci: flowcheck-ci lint-ci
flowcheck-ci: bootstrap-flowcheck
flowcheck-ci:
$(MAKE) flow
code-quality: flow lint
code-quality: tscheck flow lint
flow:
yarn flow check --strip-root
tscheck: generate-tsconfig
rm -rf dts
$(YARN) tsc -b .
bootstrap-flowcheck: bootstrap-only
yarn gulp build-babel-types
$(MAKE) build-typings
flow: build-flow-typings
$(YARN) flow check --strip-root
lint-ci: lint-js-ci lint-ts-ci
lint-ci: lint check-compat-data-ci
lint-js-ci: bootstrap-only
$(MAKE) lint-js
check-compat-data-ci:
$(MAKE) check-compat-data
lint-ts-ci: bootstrap-flowcheck
$(MAKE) lint-ts
lint: lint-js lint-ts
lint-js:
yarn eslint scripts $(SOURCES) '*.js' --format=codeframe
lint-ts:
scripts/tests/typescript/lint.sh
lint:
BABEL_ENV=test $(YARN) eslint scripts benchmark $(SOURCES) '*.{js,cjs,mjs,ts}' --format=codeframe --ext .js,.cjs,.mjs,.ts
fix: fix-json fix-js
fix-js:
yarn eslint scripts $(SOURCES) '*.js' --format=codeframe --fix
$(YARN) eslint scripts benchmark $(SOURCES) '*.{js,cjs,mjs,ts}' --format=codeframe --ext .js,.cjs,.mjs,.ts --fix
fix-json:
yarn prettier "{packages,codemod}/*/test/fixtures/**/options.json" --write --loglevel warn
$(YARN) prettier "{$(COMMA_SEPARATED_SOURCES)}/*/test/fixtures/**/options.json" --write --loglevel warn
check-compat-data:
cd packages/babel-compat-data; CHECK_COMPAT_DATA=true $(YARN) run build-data
build-compat-data:
cd packages/babel-compat-data; $(YARN) run build-data
clean: test-clean
rm -f .npmrc
rm -rf packages/babel-polyfill/browser*
rm -rf packages/babel-polyfill/dist
rm -rf coverage
rm -rf packages/*/npm-debug*
rm -rf node_modules/.cache
test-clean:
$(foreach source, $(SOURCES), \
$(call clean-source-test, $(source)))
# Does not work on Windows; use "yarn jest" instead
# Does not work on Windows; use "$(YARN) jest" instead
test-only:
BABEL_ENV=test ./scripts/test.sh
$(MAKE) test-clean
test: lint test-only
test-ci: jest-ci
jest-ci: build-standalone-ci
BABEL_ENV=test yarn jest --maxWorkers=4 --ci
test-ci: build-standalone-ci
BABEL_ENV=test $(YARN) jest --maxWorkers=4 --ci
$(MAKE) test-clean
# Does not work on Windows
@ -142,89 +131,115 @@ test-ci-coverage: SHELL:=/bin/bash
test-ci-coverage:
BABEL_COVERAGE=true BABEL_ENV=test $(MAKE) bootstrap
BABEL_ENV=test TEST_TYPE=cov ./scripts/test-cov.sh
bash <(curl -s https://codecov.io/bash) -f coverage/coverage-final.json
bootstrap-flow:
rm -rf build/flow
mkdir -p build
git clone --branch=master --single-branch --shallow-since=2018-11-01 https://github.com/facebook/flow.git build/flow
cd build/flow && git checkout $(FLOW_COMMIT)
git clone --single-branch --shallow-since=2021-05-01 https://github.com/facebook/flow.git build/flow
cd build/flow && git checkout -q $(FLOW_COMMIT)
test-flow:
node scripts/tests/flow/run_babel_parser_flow_tests.js
$(NODE) scripts/parser-tests/flow
test-flow-ci: build-bundle-ci bootstrap-flow
$(MAKE) test-flow
test-flow-update-allowlist:
$(NODE) scripts/parser-tests/flow --update-allowlist
test-flow-update-whitelist:
node scripts/tests/flow/run_babel_parser_flow_tests.js --update-whitelist
bootstrap-typescript:
rm -rf ./build/typescript
mkdir -p ./build
git clone --single-branch --shallow-since=2021-05-01 https://github.com/microsoft/TypeScript.git ./build/typescript
cd build/typescript && git checkout -q $(TYPESCRIPT_COMMIT)
test-typescript:
$(NODE) scripts/parser-tests/typescript
test-typescript-update-allowlist:
$(NODE) scripts/parser-tests/typescript --update-allowlist
bootstrap-test262:
rm -rf build/test262
mkdir -p build
git clone --branch=master --single-branch --shallow-since=2019-09-01 https://github.com/tc39/test262.git build/test262
cd build/test262 && git checkout $(TEST262_COMMIT)
git clone --single-branch --shallow-since=2021-05-01 https://github.com/tc39/test262.git build/test262
cd build/test262 && git checkout -q $(TEST262_COMMIT)
test-test262:
node scripts/tests/test262/run_babel_parser_test262.js
$(NODE) scripts/parser-tests/test262
test-test262-ci: build-bundle-ci bootstrap-test262
$(MAKE) test-test262
test-test262-update-whitelist:
node scripts/tests/test262/run_babel_parser_test262.js --update-whitelist
test-test262-update-allowlist:
$(NODE) scripts/parser-tests/test262 --update-allowlist
# Does not work on Windows
clone-license:
./scripts/clone-license.sh
prepublish-build: clean-lib clean-runtime-helpers
NODE_ENV=production BABEL_ENV=production $(MAKE) build
$(MAKE) clone-license
NODE_ENV=production BABEL_ENV=production STRIP_BABEL_8_FLAG=true $(MAKE) build-bundle
STRIP_BABEL_8_FLAG=true $(MAKE) prepublish-build-standalone clone-license prepublish-prepare-dts
prepublish-prepare-dts:
$(MAKE) tscheck
$(YARN) gulp bundle-dts
$(MAKE) build-typescript-legacy-typings
prepublish:
$(MAKE) bootstrap-only
$(MAKE) prepublish-build
$(MAKE) test
IS_PUBLISH=true $(MAKE) test
new-version-checklist:
# @echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
# @echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
# @echo "!!!!!! !!!!!!"
# @echo "!!!!!! Update the version of the "identity" !!!!!!"
# @echo "!!!!!! and "applyDecs" helpers to 7.17.0 !!!!!!"
# @echo "!!!!!! !!!!!!"
# @echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
# @echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
# @exit 1
new-version:
$(MAKE) new-version-checklist
git pull --rebase
yarn lerna version --force-publish="@babel/runtime,@babel/runtime-corejs2,@babel/runtime-corejs3,@babel/standalone,@babel/preset-env-standalone"
$(YARN) release-tool version -f @babel/standalone
# NOTE: Run make new-version first
publish: prepublish
yarn lerna publish from-git
publish:
@echo "Please confirm you have stopped make watch. (y)es, [N]o:"; \
read CLEAR; \
if [ "_$$CLEAR" != "_y" ]; then \
exit 1; \
fi
$(MAKE) prepublish
$(YARN) release-tool publish
$(MAKE) clean
publish-ci: prepublish
ifneq ("$(NPM_TOKEN)", "")
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc
else
echo "Missing NPM_TOKEN env var"
publish-test:
ifneq ("$(I_AM_USING_VERDACCIO)", "I_AM_SURE")
echo "You probably don't know what you are doing"
exit 1
endif
yarn lerna publish from-git --yes
rm -f .npmrc
$(YARN) release-tool version $(VERSION) --all --yes --tag-version-prefix="version-e2e-test-"
$(MAKE) prepublish-build
YARN_NPM_PUBLISH_REGISTRY=http://localhost:4873 $(YARN) release-tool publish --yes --tag-version-prefix="version-e2e-test-"
$(MAKE) clean
bootstrap-only: lerna-bootstrap
yarn-install: clean-all
yarn --ignore-engines
lerna-bootstrap: yarn-install
yarn lerna bootstrap
bootstrap-only: clean-all
$(YARN) install
bootstrap: bootstrap-only
$(MAKE) build
$(MAKE) generate-tsconfig build
clean-lib:
$(foreach source, $(SOURCES), \
$(call clean-source-lib, $(source)))
clean-runtime-helpers:
rm -rf packages/babel-runtime/helpers
rm -rf packages/babel-runtime-corejs2/helpers
rm -f packages/babel-runtime/helpers/**/*.js
rm -f packages/babel-runtime-corejs2/helpers/**/*.js
rm -f packages/babel-runtime-corejs3/helpers/**/*.js
rm -f packages/babel-runtime/helpers/**/*.mjs
rm -f packages/babel-runtime-corejs2/helpers/**/*.mjs
rm -f packages/babel-runtime-corejs3/helpers/**/*.mjs
rm -rf packages/babel-runtime-corejs2/core-js
clean-all:
@ -237,6 +252,12 @@ clean-all:
$(MAKE) clean
update-env-corejs-fixture:
rm -rf packages/babel-preset-env/node_modules/core-js-compat
$(YARN)
$(MAKE) build-bundle
OVERWRITE=true $(YARN) jest packages/babel-preset-env
define clean-source-lib
rm -rf $(1)/*/lib
@ -249,7 +270,7 @@ define clean-source-test
endef
define clean-source-all
rm -rf $(1)/*/lib
$(call clean-source-lib, $1)
rm -rf $(1)/*/node_modules
rm -rf $(1)/*/package-lock.json

View File

@ -8,14 +8,16 @@
The compiler for writing next generation JavaScript.
</p>
<p align="center">
<a href="https://gitpod.io/#https://github.com/babel/babel"><img alt="Gitpod ready-to-code" src="https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod"></a>
</p>
<p align="center">
<a href="https://www.npmjs.com/package/@babel/core"><img alt="v7 npm Downloads" src="https://img.shields.io/npm/dm/@babel/core.svg?maxAge=43200&label=v7%20downloads"></a>
<a href="https://www.npmjs.com/package/babel-core"><img alt="v6 npm Downloads" src="https://img.shields.io/npm/dm/babel-core.svg?maxAge=43200&label=v6%20downloads"></a>
</p>
<p align="center">
<a href="https://travis-ci.com/babel/babel"><img alt="Travis Status" src="https://img.shields.io/travis/com/babel/babel/master.svg?label=travis&maxAge=43200"></a>
<a href="https://circleci.com/gh/babel/babel"><img alt="CircleCI Status" src="https://img.shields.io/circleci/project/github/babel/babel/master.svg?label=circle&maxAge=43200"></a>
<a href="https://codecov.io/github/babel/babel"><img alt="Coverage Status" src="https://img.shields.io/codecov/c/github/babel/babel/master.svg?maxAge=43200"></a>
<a href="https://github.com/babel/babel/actions/workflows/ci.yml"><img alt="GitHub CI Status" src="https://github.com/babel/babel/actions/workflows/ci.yml/badge.svg?branch=main"></a>
<a href="https://codecov.io/github/babel/babel"><img alt="Coverage Status" src="https://img.shields.io/codecov/c/github/babel/babel/main.svg?maxAge=43200"></a>
<a href="https://slack.babeljs.io/"><img alt="Slack Status" src="https://slack.babeljs.io/badge.svg"></a>
<a href="https://twitter.com/intent/follow?screen_name=babeljs"><img alt="Follow on Twitter" src="https://img.shields.io/twitter/follow/babeljs.svg?style=social&label=Follow"></a>
</p>
@ -31,7 +33,7 @@
Babel (pronounced ["babble"](https://soundcloud.com/sebmck/how-to-pronounce-babel)) is a community-driven project used by many companies and projects, and is maintained by a group of [volunteers](https://babeljs.io/team). If you'd like to help support the future of the project, please consider:
- Giving developer time on the project. (Message us on [Twitter](https://twitter.com/babeljs) or [Slack](https://slack.babeljs.io/) for guidance!)
- Giving funds by becoming a sponsor on [Open Collective](https://opencollective.com/babel) or [Patreon](https://www.patreon.com/henryzhu)!
- Giving funds by becoming a sponsor on [Open Collective](https://opencollective.com/babel) or [GitHub](https://github.com/sponsors/babel/) (which goes to our Open Collective account)!
## Sponsors
@ -60,19 +62,21 @@ Babel is a tool that helps you write code in the latest version of JavaScript. W
**In**
```js
// ES2015 arrow function
[1, 2, 3].map((n) => n + 1);
// ES2020 nullish coalescing
function greet(input) {
return input ?? "Hello world";
}
```
**Out**
```js
[1, 2, 3].map(function(n) {
return n + 1;
});
function greet(input) {
return input != null ? input : "Hello world";
}
```
Try it out at our [REPL](https://babeljs.io/repl/build/master#?code_lz=NoRgNATGDMC6B0BbAhgBwBQDsAEBeAfNjgNTYgCUA3EA&lineWrap=true&presets=es2015%2Ces2016%2Ces2017&version=7.0.0-beta.2).
Try it out at our [REPL](https://babel.dev/repl#?browsers=defaults%2C%20not%20ie%2011&loose=true&code_lz=GYVwdgxgLglg9mABAcwE4FN1QBQzABxCgEpEBvAKEUQyhFST0KkQH5XEAiACXQBs-cRAHc4qPgBNOAbgoBfIA&shippedProposals=true&sourceType=script&lineWrap=true&presets=env%2Cenv&prettier=true).
## FAQ
@ -86,7 +90,7 @@ I'm so glad you asked: [Hallelujah —— In Praise of Babel](SONG.md) by [@angu
### Looking for support?
For questions and support please join our [Slack Community](https://slack.babeljs.io/) (you can sign-up [here](https://slack.babeljs.io/) for an invite), ask a question on [Stack Overflow](https://stackoverflow.com/questions/tagged/babeljs), or ping us on [Twitter](https://twitter.com/babeljs).
For questions and support please join our [Slack Community](https://slack.babeljs.io/) (you can [sign up here](https://slack.babeljs.io/) for an invite), ask a question on [Stack Overflow](https://stackoverflow.com/questions/tagged/babeljs), or ping us on [Twitter](https://twitter.com/babeljs).
### Where are the docs?
@ -100,7 +104,7 @@ Please read through our [CONTRIBUTING.md](CONTRIBUTING.md) and fill out the issu
Check out:
- Our [#development](https://babeljs.slack.com/messages/development) Slack channel and say hi ([signup](https://slack.babeljs.io))!
- Our [#development](https://babeljs.slack.com/messages/development) Slack channel and say hi! ([sign-up](https://slack.babeljs.io))
- Issues with the [good first issue](https://github.com/babel/babel/labels/good%20first%20issue) and [help wanted](https://github.com/babel/babel/labels/help%20wanted) label. We suggest also looking at the [closed ones](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aclosed+label%3A%22good+first+issue%22) to get a sense of the kinds of issues you can tackle.
Some resources:
@ -108,7 +112,7 @@ Some resources:
- Our [CONTRIBUTING.md](CONTRIBUTING.md) to get started with setting up the repo.
- Our discussions/notes/roadmap: [babel/notes](https://github.com/babel/notes)
- Our progress on TC39 proposals: [babel/proposals](https://github.com/babel/proposals)
- Our blog which contains release posts and explainations: [/blog](https://babeljs.io/blog)
- Our blog which contains release posts and explanations: [/blog](https://babeljs.io/blog)
- Our videos page with talks about open source and Babel: [/videos](https://babeljs.io/videos)
- Our [podcast](https://podcast.babeljs.io)

39
babel-worker.cjs Normal file
View File

@ -0,0 +1,39 @@
const { transformSync } = require("@babel/core");
const { mkdirSync, statSync, readFileSync, writeFileSync } = require("fs");
const { dirname } = require("path");
const chalk = require("chalk");
const fancyLog = require("fancy-log");
function needCompile(src, dest) {
let destStat;
try {
destStat = statSync(dest);
} catch (err) {
if (err.code === "ENOENT") {
return true;
} else {
throw err;
}
}
const srcStat = statSync(src);
return srcStat.mtimeMs > destStat.mtimeMs;
}
exports.transform = function (src, dest) {
mkdirSync(dirname(dest), { recursive: true });
if (!needCompile(src, dest)) {
return;
}
fancyLog(`Compiling '${chalk.cyan(src)}'...`);
const content = readFileSync(src, { encoding: "utf8" });
const { code } = transformSync(content, {
filename: src,
caller: {
// We have wrapped packages/babel-core/src/config/files/configuration.js with feature detection
supportsDynamicImport: true,
name: "babel-worker",
},
});
writeFileSync(dest, code, "utf8");
};

View File

@ -1,56 +1,149 @@
"use strict";
module.exports = function(api) {
const pathUtils = require("path");
const fs = require("fs");
const { parseSync } = require("@babel/core");
function normalize(src) {
return src.replace(/\//, pathUtils.sep);
}
module.exports = function (api) {
const env = api.env();
const sources = ["packages/*/src", "codemods/*/src", "eslint/*/src"];
const includeCoverage = process.env.BABEL_COVERAGE === "true";
const envOptsNoTargets = {
loose: true,
const envOpts = {
shippedProposals: true,
modules: false,
exclude: ["transform-typeof-symbol"],
exclude: [
"transform-typeof-symbol",
// We need to enable useBuiltIns
"proposal-object-rest-spread",
],
};
const envOpts = Object.assign({}, envOptsNoTargets);
// These are "safe" assumptions, that we can enable globally
const assumptions = {
constantSuper: true,
ignoreFunctionLength: true,
ignoreToPrimitiveHint: true,
mutableTemplateObject: true,
noClassCalls: true,
noDocumentAll: true,
noNewArrows: true,
setClassMethods: true,
setComputedProperties: true,
setSpreadProperties: true,
skipForOfIteratorClosing: true,
superIsCallableConstructor: true,
};
// These are "less safe": we only enable them on our own code
// and not when compiling dependencies.
const sourceAssumptions = {
objectRestNoSymbols: true,
pureGetters: true,
setPublicClassFields: true,
};
const parserAssumptions = {
iterableIsArray: true,
};
let targets = {};
let convertESM = true;
let ignoreLib = true;
let includeRuntime = false;
let includeRegeneratorRuntime = false;
let needsPolyfillsForOldNode = false;
let dynamicESLintVersionCheck = false;
let transformRuntimeOptions;
const nodeVersion = "6.9";
// The vast majority of our src files are modules, but we use
// unambiguous to keep things simple until we get around to renaming
// the modules to be more easily distinguished from CommonJS
const unambiguousSources = [
...sources,
"packages/*/test",
"codemods/*/test",
"eslint/*/test",
];
const lazyRequireSources = [
"./packages/babel-cli",
"./packages/babel-core",
"./packages/babel-preset-env/src/available-plugins.js",
];
switch (env) {
// Configs used during bundling builds.
case "babel-parser":
convertESM = false;
ignoreLib = false;
envOpts.targets = {
node: nodeVersion,
};
break;
case "standalone":
includeRegeneratorRuntime = true;
convertESM = false;
ignoreLib = false;
includeRuntime = true;
// rollup-commonjs will converts node_modules to ESM
unambiguousSources.push(
"/**/node_modules",
"packages/babel-preset-env/data",
"packages/babel-compat-data",
"packages/babel-runtime/regenerator"
);
break;
case "rollup":
convertESM = false;
ignoreLib = false;
// rollup-commonjs will converts node_modules to ESM
unambiguousSources.push(
"/**/node_modules",
"packages/babel-preset-env/data",
"packages/babel-compat-data"
);
targets = { node: nodeVersion };
needsPolyfillsForOldNode = true;
break;
case "test-legacy": // In test-legacy environment, we build babel on latest node but test on minimum supported legacy versions
dynamicESLintVersionCheck = true;
// fall through
case "production":
// Config during builds before publish.
envOpts.targets = {
node: nodeVersion,
};
targets = { node: nodeVersion };
needsPolyfillsForOldNode = true;
break;
case "test":
targets = { node: "current" };
needsPolyfillsForOldNode = true;
dynamicESLintVersionCheck = true;
break;
case "development":
envOpts.debug = true;
envOpts.targets = {
node: "current",
};
break;
case "test":
envOpts.targets = {
node: "current",
};
targets = { node: "current" };
dynamicESLintVersionCheck = true;
break;
}
if (process.env.STRIP_BABEL_8_FLAG && bool(process.env.BABEL_8_BREAKING)) {
// Never apply polyfills when compiling for Babel 8
needsPolyfillsForOldNode = false;
}
if (includeRegeneratorRuntime) {
const babelRuntimePkgPath = require.resolve("@babel/runtime/package.json");
transformRuntimeOptions = {
helpers: false, // Helpers are handled by rollup when needed
regenerator: true,
version: require(babelRuntimePkgPath).version,
};
}
const config = {
targets,
assumptions,
// Our dependencies are all standard CommonJS, along with all sorts of
// other random files in Babel's codebase, so we use script as the default,
// and then mark actual modules as modules farther down.
@ -63,69 +156,100 @@ module.exports = function(api) {
"packages/*/test/fixtures",
ignoreLib ? "packages/*/lib" : null,
"packages/babel-standalone/babel.js",
"packages/babel-preset-env-standalone/babel-preset-env.js",
].filter(Boolean),
presets: [["@babel/env", envOpts]],
plugins: [
// TODO: Use @babel/preset-flow when
// https://github.com/babel/babel/issues/7233 is fixed
"@babel/plugin-transform-flow-strip-types",
["@babel/proposal-class-properties", { loose: true }],
"@babel/proposal-export-namespace-from",
"@babel/proposal-numeric-separator",
]
.filter(Boolean)
.map(normalize),
presets: [
[
"@babel/proposal-object-rest-spread",
{ useBuiltIns: true, loose: true },
"@babel/preset-typescript",
{ onlyRemoveTypeImports: true, allowDeclareFields: true },
],
"@babel/plugin-proposal-optional-chaining",
"@babel/plugin-proposal-nullish-coalescing-operator",
["@babel/env", envOpts],
["@babel/preset-flow", { allowDeclareFields: true }],
],
plugins: [
["@babel/proposal-object-rest-spread", { useBuiltIns: true }],
convertESM ? "@babel/transform-modules-commonjs" : null,
convertESM ? "@babel/proposal-export-namespace-from" : null,
convertESM ? pluginImportMetaUrl : null,
pluginPackageJsonMacro,
process.env.STRIP_BABEL_8_FLAG && [
pluginToggleBabel8Breaking,
{ breaking: bool(process.env.BABEL_8_BREAKING) },
],
needsPolyfillsForOldNode && pluginPolyfillsOldNode,
].filter(Boolean),
overrides: [
{
test: "packages/babel-parser",
test: [
"packages/babel-parser",
"packages/babel-helper-validator-identifier",
].map(normalize),
plugins: [
"babel-plugin-transform-charcodes",
["@babel/transform-for-of", { assumeArray: true }],
pluginBabelParserTokenType,
],
assumptions: parserAssumptions,
},
{
test: ["./packages/babel-cli", "./packages/babel-core"],
test: [
"packages/babel-generator",
"packages/babel-plugin-proposal-decorators",
].map(normalize),
plugins: ["babel-plugin-transform-charcodes"],
},
convertESM && {
test: ["./packages/babel-node/src"].map(normalize),
// Used to conditionally import kexec
plugins: ["@babel/plugin-proposal-dynamic-import"],
},
{
test: sources.map(normalize),
assumptions: sourceAssumptions,
plugins: [transformNamedBabelTypesImportToDestructuring],
},
convertESM && {
test: lazyRequireSources.map(normalize),
plugins: [
// Explicitly use the lazy version of CommonJS modules.
convertESM
? ["@babel/transform-modules-commonjs", { lazy: true }]
: null,
].filter(Boolean),
},
{
test: "./packages/babel-polyfill",
presets: [["@babel/env", envOptsNoTargets]],
},
{
// The vast majority of our src files are modules, but we use
// unambiguous to keep things simple until we get around to renaming
// the modules to be more easily distinguished from CommonJS
test: [
"packages/*/src",
"packages/*/test",
"codemods/*/src",
"codemods/*/test",
[
"@babel/transform-modules-commonjs",
{ importInterop: importInteropSrc, lazy: true },
],
],
},
convertESM && {
test: sources.map(normalize),
exclude: lazyRequireSources.map(normalize),
plugins: [
[
"@babel/transform-modules-commonjs",
{ importInterop: importInteropSrc },
],
],
},
{
test: sources.map(source => normalize(source.replace("/src", "/test"))),
plugins: [
[
"@babel/transform-modules-commonjs",
{ importInterop: importInteropTest },
],
],
},
{
test: unambiguousSources.map(normalize),
sourceType: "unambiguous",
},
{
// The runtime transform shouldn't process its own runtime or core-js.
exclude: [
"packages/babel-runtime",
/[\\/]node_modules[\\/](?:@babel\/runtime|babel-runtime|core-js)[\\/]/,
],
plugins: [
includeRuntime
? ["@babel/transform-runtime", { version: "7.4.4" }]
: null,
].filter(Boolean),
includeRegeneratorRuntime && {
exclude: /regenerator-runtime/,
plugins: [["@babel/transform-runtime", transformRuntimeOptions]],
},
dynamicESLintVersionCheck && {
test: ["./eslint/*/src"].map(normalize),
plugins: [pluginDynamicESLintVersionCheck],
},
].filter(Boolean),
};
@ -138,3 +262,471 @@ module.exports = function(api) {
return config;
};
const monorepoPackages = ["codemods", "eslint", "packages"]
.map(folder => fs.readdirSync(__dirname + "/" + folder))
.reduce((a, b) => a.concat(b))
.map(name => name.replace(/^babel-/, "@babel/"));
function importInteropSrc(source) {
if (
// These internal files are "real CJS" (whose default export is
// on module.exports) and not compiled ESM.
source.startsWith("@babel/compat-data/") ||
source.includes("babel-eslint-shared-fixtures/utils")
) {
return "node";
}
if (
source[0] === "." ||
monorepoPackages.some(name => source.startsWith(name))
) {
// We don't need to worry about interop for internal files, since we know
// for sure that they are ESM modules compiled to CJS
return "none";
}
// For external modules, we want to match the Node.js behavior
return "node";
}
function importInteropTest(source) {
// This file will soon have an esm entrypoint
if (source === "@babel/helper-plugin-test-runner") {
return "none";
}
if (
// non-test files
!source.startsWith(".") ||
// lib files
/(?:\.\.\/)+(?:babel-[a-z-]+\/)?lib/.test(source)
) {
return "node";
}
return "babel";
}
// env vars from the cli are always strings, so !!ENV_VAR returns true for "false"
function bool(value) {
return value && value !== "false" && value !== "0";
}
// A minimum semver GTE implementation
// Limitation:
// - it only supports comparing major and minor version, assuming Node.js will never ship
// features in patch release so we will never need to compare a version with "1.2.3"
//
// @example
// semverGte("8.10", "8.9") // true
// semverGte("8.9", "8.9") // true
// semverGte("9.0", "8.9") // true
// semverGte("8.9", "8.10") // false
// TODO: figure out how to inject it to the `@babel/template` usage so we don't need to
// copy and paste it.
// `((v,w)=>(v=v.split("."),w=w.split("."),+v[0]>+w[0]||v[0]==w[0]&&+v[1]>=+w[1]))`;
// TODO(Babel 8) This polyfills are only needed for Node.js 6 and 8
/** @param {import("@babel/core")} api */
function pluginPolyfillsOldNode({ template, types: t }) {
const polyfills = [
{
name: "require.resolve",
necessary({ node, parent }) {
return (
t.isCallExpression(parent, { callee: node }) &&
parent.arguments.length > 1
);
},
supported({ parent: { arguments: args } }) {
return (
t.isObjectExpression(args[1]) &&
args[1].properties.length === 1 &&
t.isIdentifier(args[1].properties[0].key, { name: "paths" }) &&
t.isArrayExpression(args[1].properties[0].value) &&
args[1].properties[0].value.elements.length === 1
);
},
// require.resolve's paths option has been introduced in Node.js 8.9
// https://nodejs.org/api/modules.html#modules_require_resolve_request_options
replacement: template({ syntacticPlaceholders: true })`
((v,w)=>(v=v.split("."),w=w.split("."),+v[0]>+w[0]||v[0]==w[0]&&+v[1]>=+w[1]))(process.versions.node, "8.9")
? require.resolve
: (/* request */ r, { paths: [/* base */ b] }, M = require("module")) => {
let /* filename */ f = M._findPath(r, M._nodeModulePaths(b).concat(b));
if (f) return f;
f = new Error(\`Cannot resolve module '\${r}'\`);
f.code = "MODULE_NOT_FOUND";
throw f;
}
`,
},
{
// NOTE: This polyfills depends on the "make-dir" library. Any package
// using fs.mkdirSync must have "make-dir" as a dependency.
name: "fs.mkdirSync",
necessary({ node, parent }) {
return (
t.isCallExpression(parent, { callee: node }) &&
parent.arguments.length > 1
);
},
supported({ parent: { arguments: args } }) {
return (
t.isObjectExpression(args[1]) &&
args[1].properties.length === 1 &&
t.isIdentifier(args[1].properties[0].key, { name: "recursive" }) &&
t.isBooleanLiteral(args[1].properties[0].value, { value: true })
);
},
// fs.mkdirSync's recursive option has been introduced in Node.js 10.12
// https://nodejs.org/api/fs.html#fs_fs_mkdirsync_path_options
replacement: template`
((v,w)=>(v=v.split("."),w=w.split("."),+v[0]>+w[0]||v[0]==w[0]&&+v[1]>=+w[1]))(process.versions.node, "10.12")
? fs.mkdirSync
: require("make-dir").sync
`,
},
{
// NOTE: This polyfills depends on the "node-environment-flags"
// library. Any package using process.allowedNodeEnvironmentFlags
// must have "node-environment-flags" as a dependency.
name: "process.allowedNodeEnvironmentFlags",
necessary({ parent, node }) {
// To avoid infinite replacement loops
return !t.isLogicalExpression(parent, { operator: "||", left: node });
},
supported: () => true,
// process.allowedNodeEnvironmentFlags has been introduced in Node.js 10.10
// https://nodejs.org/api/process.html#process_process_allowednodeenvironmentflags
replacement: template`
process.allowedNodeEnvironmentFlags || require("node-environment-flags")
`,
},
];
return {
visitor: {
MemberExpression(path) {
for (const polyfill of polyfills) {
if (!path.matchesPattern(polyfill.name)) continue;
if (!polyfill.necessary(path)) return;
if (!polyfill.supported(path)) {
throw path.buildCodeFrameError(
`This '${polyfill.name}' usage is not supported by the inline polyfill.`
);
}
path.replaceWith(polyfill.replacement());
break;
}
},
},
};
}
function pluginToggleBabel8Breaking({ types: t }, { breaking }) {
return {
visitor: {
"IfStatement|ConditionalExpression"(path) {
let test = path.get("test");
let keepConsequent = breaking;
if (test.isUnaryExpression({ operator: "!" })) {
test = test.get("argument");
keepConsequent = !keepConsequent;
}
// yarn-plugin-conditions inject bool(process.env.BABEL_8_BREAKING)
// tests, to properly cast the env variable to a boolean.
if (
test.isCallExpression() &&
test.get("callee").isIdentifier({ name: "bool" }) &&
test.get("arguments").length === 1
) {
test = test.get("arguments")[0];
}
if (!test.matchesPattern("process.env.BABEL_8_BREAKING")) return;
path.replaceWith(
keepConsequent
? path.node.consequent
: path.node.alternate || t.emptyStatement()
);
},
MemberExpression(path) {
if (path.matchesPattern("process.env.BABEL_8_BREAKING")) {
throw path.buildCodeFrameError("This check could not be stripped.");
}
},
},
};
}
function pluginPackageJsonMacro({ types: t }) {
const fnName = "PACKAGE_JSON";
return {
visitor: {
ReferencedIdentifier(path) {
if (path.isIdentifier({ name: fnName })) {
throw path.buildCodeFrameError(
`"${fnName}" is only supported in member expressions.`
);
}
},
MemberExpression(path) {
if (!path.get("object").isIdentifier({ name: fnName })) return;
if (path.node.computed) {
throw path.buildCodeFrameError(
`"${fnName}" does not support computed properties.`
);
}
const field = path.node.property.name;
// TODO: When dropping old Node.js versions, use require.resolve
// instead of looping through the folders hierarchy
let pkg;
for (let dir = pathUtils.dirname(this.filename); ; ) {
try {
pkg = fs.readFileSync(pathUtils.join(dir, "package.json"), "utf8");
break;
} catch (_) {}
const prev = dir;
dir = pathUtils.resolve(dir, "..");
// We are in the root and didn't find a package.json file
if (dir === prev) return;
}
const value = JSON.parse(pkg)[field];
path.replaceWith(t.valueToNode(value));
},
},
};
}
// transform `import { x } from "@babel/types"` to `import * as _t from "@babel/types"; const { x } = _t;
function transformNamedBabelTypesImportToDestructuring({
types: {
cloneNode,
importNamespaceSpecifier,
objectPattern,
objectProperty,
variableDeclarator,
variableDeclaration,
},
}) {
return {
name: "transform-babel-types-named-imports",
visitor: {
ImportDeclaration(path) {
const { node } = path;
if (
node.importKind === "value" &&
node.source.value === "@babel/types" &&
node.specifiers[0].type === "ImportSpecifier"
) {
const hoistedDestructuringProperties = [];
for (const { imported, local } of node.specifiers) {
hoistedDestructuringProperties.push(
objectProperty(
imported,
local,
false,
imported.name === local.name
)
);
}
const babelTypeNsImport = path.scope.generateUidIdentifier("t");
node.specifiers = [importNamespaceSpecifier(babelTypeNsImport)];
path.insertAfter([
variableDeclaration("const", [
variableDeclarator(
objectPattern(hoistedDestructuringProperties),
cloneNode(babelTypeNsImport)
),
]),
]);
}
},
},
};
}
function pluginImportMetaUrl({ types: t, template }) {
const isImportMeta = node =>
t.isMetaProperty(node) &&
t.isIdentifier(node.meta, { name: "import" }) &&
t.isIdentifier(node.property, { name: "meta" });
const isImportMetaUrl = node =>
t.isMemberExpression(node, { computed: false }) &&
t.isIdentifier(node.property, { name: "url" }) &&
isImportMeta(node.object);
return {
visitor: {
Program(programPath) {
// We must be sure to run this before the instanbul plugins, because its
// instrumentation breaks our detection.
programPath.traverse({
// fileURLToPath(import.meta.url)
CallExpression(path) {
const { node } = path;
if (
!t.isIdentifier(node.callee, { name: "fileURLToPath" }) ||
node.arguments.length !== 1
) {
return;
}
const arg = node.arguments[0];
if (
!t.isMemberExpression(arg, { computed: false }) ||
!t.isIdentifier(arg.property, { name: "url" }) ||
!isImportMeta(arg.object)
) {
return;
}
path.replaceWith(t.identifier("__filename"));
},
// const require = createRequire(import.meta.url)
VariableDeclarator(path) {
const { node } = path;
if (
!t.isIdentifier(node.id, { name: "require" }) ||
!t.isCallExpression(node.init) ||
!t.isIdentifier(node.init.callee, { name: "createRequire" }) ||
node.init.arguments.length !== 1 ||
!isImportMetaUrl(node.init.arguments[0])
) {
return;
}
// Let's just remove this declaration to unshadow the "global" cjs require.
path.remove();
},
// import.meta.url
MemberExpression(path) {
if (!isImportMetaUrl(path.node)) return;
path.replaceWith(
template.expression
.ast`\`file://\${__filename.replace(/\\\\/g, "/")}\``
);
},
MetaProperty(path) {
if (isImportMeta(path.node)) {
throw path.buildCodeFrameError("Unsupported import.meta");
}
},
});
},
},
};
}
const tokenTypesMapping = new Map();
const tokenTypeSourcePath = "./packages/babel-parser/src/tokenizer/types.js";
function pluginBabelParserTokenType({
types: { isIdentifier, numericLiteral },
}) {
return {
visitor: {
MemberExpression(path) {
const { node } = path;
if (
isIdentifier(node.object, { name: "tt" }) &&
isIdentifier(node.property) &&
!node.computed
) {
const tokenName = node.property.name;
const tokenType = tokenTypesMapping.get(node.property.name);
if (tokenType === undefined) {
throw path.buildCodeFrameError(
`${tokenName} is not defined in ${tokenTypeSourcePath}`
);
}
path.replaceWith(numericLiteral(tokenType));
}
},
},
};
}
(function generateTokenTypesMapping() {
const tokenTypesAst = parseSync(
fs.readFileSync(tokenTypeSourcePath, {
encoding: "utf-8",
}),
{
configFile: false,
parserOpts: { attachComments: false, plugins: ["flow"] },
}
);
let typesDeclaration;
for (const n of tokenTypesAst.program.body) {
if (n.type === "ExportNamedDeclaration" && n.exportKind === "value") {
const declarations = n.declaration.declarations;
if (declarations !== undefined) typesDeclaration = declarations[0];
if (
typesDeclaration !== undefined &&
typesDeclaration.id.name === "types"
) {
break;
}
}
}
if (typesDeclaration === undefined) {
throw new Error(
"The plugin can not find TokenType definition in " + tokenTypeSourcePath
);
}
const tokenTypesDefinition = typesDeclaration.init.properties;
for (let i = 0; i < tokenTypesDefinition.length; i++) {
tokenTypesMapping.set(tokenTypesDefinition[i].key.name, i);
}
})();
// Transforms
// ESLINT_VERSION
// to
// process.env.ESLINT_VERSION_FOR_BABEL
// ? parseInt(process.env.ESLINT_VERSION_FOR_BABEL, 10)
// : ESLINT_VERSION
function pluginDynamicESLintVersionCheck({ template }) {
const transformed = new WeakSet();
return {
visitor: {
ReferencedIdentifier(path) {
if (path.node.name !== "ESLINT_VERSION") return;
if (transformed.has(path.node)) return;
transformed.add(path.node);
path.replaceWith(template.expression.ast`
process.env.ESLINT_VERSION_FOR_BABEL
? parseInt(process.env.ESLINT_VERSION_FOR_BABEL, 10)
: ${path.node}
`);
},
},
};
}

View File

@ -0,0 +1,42 @@
import Benchmark from "benchmark";
import baseline from "@babel-baseline/core";
import current from "@babel/core";
import parser from "@babel-baseline/parser";
import { report } from "../../util.mjs";
import { readFileSync } from "fs";
const suite = new Benchmark.Suite();
const fixtureName = "babel-parser-expression.txt";
function createInput() {
return parser.parse(
readFileSync(new URL("./" + fixtureName, import.meta.url), {
encoding: "utf-8",
}),
{ sourceType: "module", plugins: ["flow"] }
);
}
function benchCases(name, implementation, options) {
const input = createInput();
suite.add(
`${name} ${fixtureName}`,
() => {
implementation(input, {
plugins: ["@babel/preset-env", "@babel/preset-flow"],
targets: "ie 11",
configFile: false,
babelrc: false,
...options,
});
},
{
// increase minSamples for accuracy
minSamples: 100,
}
);
}
benchCases("baseline", baseline.transformFromAstSync, {});
benchCases("current", current.transformFromAstSync, {});
suite.on("cycle", report).run();

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,25 @@
import Benchmark from "benchmark";
import baseline from "@babel-baseline/generator";
import current from "@babel/generator";
import parser from "@babel/parser";
import { report } from "../../util.mjs";
const suite = new Benchmark.Suite();
function createInput(length) {
return parser.parse(";".repeat(length));
}
function benchCases(name, implementation, options) {
for (const length of [256, 512, 1024, 2048]) {
const input = createInput(length);
suite.add(`${name} ${length} empty statements`, () => {
implementation(input, options);
});
}
}
benchCases("baseline", baseline.default);
benchCases("current", current.default);
suite.on("cycle", report).run();

View File

@ -0,0 +1,25 @@
import Benchmark from "benchmark";
import baseline from "@babel-baseline/generator";
import current from "@babel/generator";
import parser from "@babel/parser";
import { report } from "../../util.mjs";
const suite = new Benchmark.Suite();
function createInput(length) {
return parser.parse("a;".repeat(length));
}
function benchCases(name, implementation, options) {
for (const length of [256, 512, 1024, 2048]) {
const input = createInput(length);
suite.add(`${name} ${length} 1-length identifiers`, () => {
implementation(input, options);
});
}
}
benchCases("baseline", baseline.default);
benchCases("current", current.default);
suite.on("cycle", report).run();

View File

@ -0,0 +1,25 @@
import Benchmark from "benchmark";
import baseline from "@babel-baseline/generator";
import current from "@babel/generator";
import parser from "@babel/parser";
import { report } from "../../util.mjs";
const suite = new Benchmark.Suite();
function createInput(length) {
return parser.parse("parseMaybeImportAssertion;".repeat(length));
}
function benchCases(name, implementation, options) {
for (const length of [256, 512, 1024, 2048]) {
const input = createInput(length);
suite.add(`${name} ${length} 25-length identifiers`, () => {
implementation(input, options);
});
}
}
benchCases("baseline", baseline.default);
benchCases("current", current.default);
suite.on("cycle", report).run();

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,30 @@
import Benchmark from "benchmark";
import baseline from "@babel-baseline/generator";
import current from "@babel/generator";
import parser from "@babel/parser";
import { report } from "../../util.mjs";
import { readFileSync } from "fs";
const suite = new Benchmark.Suite();
function createInput(length) {
return parser.parse(
readFileSync(new URL("./jquery-3.6.txt", import.meta.url), {
encoding: "utf-8",
}).repeat(length)
);
}
function benchCases(name, implementation, options) {
for (const length of [1, 2]) {
const input = createInput(length);
suite.add(`${name} ${length} jquery 3.6`, () => {
implementation(input, options);
});
}
}
benchCases("baseline", baseline.default);
benchCases("current", current.default);
suite.on("cycle", report).run();

View File

@ -0,0 +1,3 @@
import "./isIdentifierChar.bench.mjs";
import "./isIdentifierStart.bench.mjs";
import "./isIdentifierName.bench.mjs";

View File

@ -0,0 +1,31 @@
import Benchmark from "benchmark";
import baseline from "@babel-baseline/helper-validator-identifier";
import current from "@babel/helper-validator-identifier";
import { report } from "../util.mjs";
const suite = new Benchmark.Suite();
function benchCases(implementation, name) {
suite.add(name + "#isIdentifierChar on 4 ASCII characters", () => {
implementation.isIdentifierChar(0x61);
implementation.isIdentifierChar(0x7b);
implementation.isIdentifierChar(0x5f);
implementation.isIdentifierChar(0x24);
});
suite.add(name + "#isIdentifierChar on 4 non-ASCII characters", () => {
implementation.isIdentifierChar(0x80);
implementation.isIdentifierChar(0x4e00);
implementation.isIdentifierChar(0xffff);
implementation.isIdentifierChar(0x10000);
});
suite.add(name + "#isIdentifierChar on TIP character", () => {
implementation.isIdentifierChar(0x30000);
});
}
benchCases(baseline, "baseline");
benchCases(current, "current");
suite.on("cycle", report).run();

View File

@ -0,0 +1,30 @@
import Benchmark from "benchmark";
import baseline from "@babel-baseline/helper-validator-identifier";
import current from "@babel/helper-validator-identifier";
import { report } from "../util.mjs";
const suite = new Benchmark.Suite();
function benchCases(implementation, name) {
suite.add(name + "#isIdentifierName on 2 short ASCII words", () => {
implementation.isIdentifierName("aforementioned");
implementation.isIdentifierName("zap cannon");
});
suite.add(name + "#isIdentifierName on 1 long ASCII words", () => {
implementation.isIdentifierName(
"Pneumonoultramicroscopicsilicovolcanoconiosis"
);
});
suite.add(name + "#isIdentifierName on 3 non-ASCII words", () => {
implementation.isIdentifierName("مذكور أعلاه");
implementation.isIdentifierName("cañón de zap");
implementation.isIdentifierName("𠡦𠧋𡆠囝〇𠁈𢘑𤯔𠀑埊");
});
}
benchCases(baseline, "baseline");
benchCases(current, "current");
suite.on("cycle", report).run();

View File

@ -0,0 +1,31 @@
import Benchmark from "benchmark";
import baseline from "@babel-baseline/helper-validator-identifier";
import current from "@babel/helper-validator-identifier";
import { report } from "../util.mjs";
const suite = new Benchmark.Suite();
function benchCases(implementation, name) {
suite.add(name + "#isIdentifierStart on 4 ASCII characters", () => {
implementation.isIdentifierStart(0x61);
implementation.isIdentifierStart(0x7b);
implementation.isIdentifierStart(0x5f);
implementation.isIdentifierStart(0x24);
});
suite.add(name + "#isIdentifierStart on 4 non-ASCII characters", () => {
implementation.isIdentifierStart(0x80);
implementation.isIdentifierStart(0x4e00);
implementation.isIdentifierStart(0xffff);
implementation.isIdentifierStart(0x10000);
});
suite.add(name + "#isIdentifierStart on TIP character", () => {
implementation.isIdentifierStart(0x30000);
});
}
benchCases(baseline, "baseline");
benchCases(current, "current");
suite.on("cycle", report).run();

View File

@ -0,0 +1,27 @@
import Benchmark from "benchmark";
import baseline from "@babel-baseline/helper-validator-identifier";
import current from "@babel/helper-validator-identifier";
import { report } from "../util.mjs";
const suite = new Benchmark.Suite();
function benchCases(implementation, name) {
suite.add(name + "#isKeyword on 4 keywords", () => {
implementation.isKeyword("debugger");
implementation.isKeyword("throw");
implementation.isKeyword("extends");
implementation.isKeyword("instanceof");
});
suite.add(name + "#isKeyword on 4 non-keywords", () => {
implementation.isKeyword("debuggerr");
implementation.isKeyword("threw");
implementation.isKeyword("extend");
implementation.isKeyword("instanceOf");
});
}
benchCases(baseline, "baseline");
benchCases(current, "current");
suite.on("cycle", report).run();

View File

@ -0,0 +1,27 @@
import Benchmark from "benchmark";
import baseline from "@babel-baseline/helper-validator-identifier";
import current from "@babel/helper-validator-identifier";
import { report } from "../util.mjs";
const suite = new Benchmark.Suite();
function benchCases(implementation, name) {
suite.add(name + "#isStrictBindReservedWord on 4 keywords", () => {
implementation.isStrictBindReservedWord("arguments");
implementation.isStrictBindReservedWord("eval");
implementation.isStrictBindReservedWord("implements");
implementation.isStrictBindReservedWord("instanceof");
});
suite.add(name + "#isStrictBindReservedWord on 4 non-keywords", () => {
implementation.isStrictBindReservedWord("argumentss");
implementation.isStrictBindReservedWord("evals");
implementation.isStrictBindReservedWord("implement");
implementation.isStrictBindReservedWord("instanceOf");
});
}
benchCases(baseline, "baseline");
benchCases(current, "current");
suite.on("cycle", report).run({ async: false });

View File

@ -0,0 +1,22 @@
import Benchmark from "benchmark";
import baseline from "@babel-baseline/parser";
import current from "@babel/parser";
import { report } from "../../util.mjs";
const suite = new Benchmark.Suite();
function createInput(length) {
return "const a = /" + "[/\\\\]".repeat(length / 4) + "/igsudm";
}
function benchCases(name, implementation, options) {
for (const length of [256, 512, 1024, 2048]) {
const input = createInput(length);
suite.add(`${name} ${length}-size RegExp literal `, () => {
implementation.parse(input, options);
});
}
}
benchCases("baseline", baseline);
benchCases("current", current);
suite.on("cycle", report).run();

View File

@ -0,0 +1,22 @@
import Benchmark from "benchmark";
import baseline from "@babel-baseline/parser";
import current from "@babel/parser";
import { report } from "../../util.mjs";
const suite = new Benchmark.Suite();
function createInput(length) {
return "type A = " + "| (x) => void".repeat(length);
}
function benchCases(name, implementation, options) {
for (const length of [256, 512, 1024, 2048]) {
const input = createInput(length);
suite.add(`${name} ${length} arrow function types`, () => {
implementation.parse(input, options);
});
}
}
benchCases("baseline", baseline, { plugins: ["flow"] });
benchCases("current", current, { plugins: ["flow"] });
suite.on("cycle", report).run();

View File

@ -0,0 +1,22 @@
import Benchmark from "benchmark";
import baseline from "@babel-baseline/parser";
import current from "@babel/parser";
import { report } from "../../util.mjs";
const suite = new Benchmark.Suite();
function createInput(length) {
return "async () => {};".repeat(length);
}
function benchCases(name, implementation, options) {
for (const length of [256, 512, 1024, 2048]) {
const input = createInput(length);
suite.add(`${name} ${length} async arrow functions`, () => {
implementation.parse(input, options);
});
}
}
benchCases("baseline", baseline);
benchCases("current", current);
suite.on("cycle", report).run();

View File

@ -0,0 +1,34 @@
import Benchmark from "benchmark";
import baseline from "@babel-baseline/parser";
import current from "@babel/parser";
import { report } from "../../util.mjs";
const suite = new Benchmark.Suite();
// All codepoints in [0x4e00, 0x9ffc] are valid identifier name per Unicode 13
function createInput(length) {
if (length > 0x9ffc - 0x4e00) {
throw new Error(
`Length greater than ${
0x9ffc - 0x4e00
} is not supported! Consider modify the \`createInput\`.`
);
}
let source = "class C { ";
for (let i = 0; i < length; i++) {
source += "#" + String.fromCharCode(0x4e00 + i) + ";";
}
return source + " }";
}
function benchCases(name, implementation, options) {
for (const length of [256, 512, 1024, 2048]) {
const input = createInput(length);
suite.add(`${name} ${length} length-1 private properties`, () => {
implementation.parse(input, options);
});
}
}
benchCases("baseline", baseline);
benchCases("current", current);
suite.on("cycle", report).run();

View File

@ -0,0 +1,20 @@
import Benchmark from "benchmark";
import baseline from "@babel-baseline/parser";
import current from "@babel/parser";
import { report } from "../../util.mjs";
const suite = new Benchmark.Suite();
function benchCases(name, implementation, options) {
for (const length of [256, 512, 1024, 2048]) {
const input = ";".repeat(length);
suite.add(`${name} ${length} empty statement`, () => {
implementation.parse(input, options);
});
}
}
benchCases("baseline", baseline, { attachComment: true });
benchCases("current + attachComment: false", current, { attachComment: false });
suite.on("cycle", report).run();

View File

@ -0,0 +1,23 @@
import Benchmark from "benchmark";
import baseline from "@babel-baseline/parser";
import current from "@babel/parser";
import { report } from "../../util.mjs";
const suite = new Benchmark.Suite();
function createInput(length) {
return "a;".repeat(length);
}
current.parse("a");
function benchCases(name, implementation, options) {
for (const length of [64, 128, 256, 512, 1024]) {
const input = createInput(length);
suite.add(`${name} ${length} length-1 identifiers`, () => {
implementation.parse(input, options);
});
}
}
benchCases("baseline", baseline);
benchCases("current", current);
suite.on("cycle", report).run();

View File

@ -0,0 +1,23 @@
import Benchmark from "benchmark";
import baseline from "../../lib/index-main.js";
import current from "@babel/parser";
import { report } from "../../util.mjs";
const suite = new Benchmark.Suite();
function createInput(length) {
return "abcde12345z;".repeat(length);
}
current.parse("a");
function benchCases(name, implementation, options) {
for (const length of [64, 128, 256, 512]) {
const input = createInput(length);
suite.add(`${name} ${length} length-11 identifiers`, () => {
implementation.parse(input, options);
});
}
}
benchCases("baseline", baseline);
benchCases("current", current);
suite.on("cycle", report).run();

View File

@ -0,0 +1,23 @@
import Benchmark from "benchmark";
import baseline from "@babel-baseline/parser";
import current from "@babel/parser";
import { report } from "../../util.mjs";
const suite = new Benchmark.Suite();
function createInput(length) {
return "aa;".repeat(length);
}
current.parse("a");
function benchCases(name, implementation, options) {
for (const length of [64, 128, 256, 512, 1024]) {
const input = createInput(length);
suite.add(`${name} ${length} length-2 identifiers`, () => {
implementation.parse(input, options);
});
}
}
benchCases("baseline", baseline);
benchCases("current", current);
suite.on("cycle", report).run();

View File

@ -0,0 +1,23 @@
import Benchmark from "benchmark";
import baseline from "../../lib/index-main.js";
import current from "@babel/parser";
import { report } from "../../util.mjs";
const suite = new Benchmark.Suite();
function createInput(length) {
return "await;".repeat(length);
}
current.parse("a");
function benchCases(name, implementation, options) {
for (const length of [64, 128, 256, 512]) {
const input = createInput(length);
suite.add(`${name} ${length} await identifier`, () => {
implementation.parse(input, options);
});
}
}
benchCases("baseline", baseline);
benchCases("current", current);
suite.on("cycle", report).run();

View File

@ -0,0 +1,22 @@
import Benchmark from "benchmark";
import baseline from "@babel-baseline/parser";
import current from "@babel/parser";
import { report } from "../../util.mjs";
const suite = new Benchmark.Suite();
function createInput(length) {
return "[,\n// c\n".repeat(length) + "\n]".repeat(length);
}
function benchCases(name, implementation, options) {
for (const length of [128, 256, 512, 1024]) {
const input = createInput(length);
suite.add(`${name} ${length} nested inner comments`, () => {
implementation.parse(input, options);
});
}
}
benchCases("baseline", baseline);
benchCases("current", current);
suite.on("cycle", report).run();

View File

@ -0,0 +1,24 @@
import Benchmark from "benchmark";
import baseline from "@babel-baseline/parser";
import current from "@babel/parser";
import { report } from "../../util.mjs";
const suite = new Benchmark.Suite();
function createInput(length) {
return "[" + "// c\n".repeat(length) + "]";
}
current.parse(createInput(256), {});
function benchCases(name, implementation, options) {
for (const length of [128, 256, 512, 1024]) {
const input = createInput(length);
const { parse } = implementation;
suite.add(`${name} ${length} inner comments`, () => {
parse(input, options);
});
}
}
benchCases("baseline", baseline);
benchCases("current", current);
suite.on("cycle", report).run();

View File

@ -0,0 +1,24 @@
import Benchmark from "benchmark";
import baseline from "@babel-baseline/parser";
import current from "@babel/parser";
import { report } from "../../util.mjs";
const suite = new Benchmark.Suite();
function createInput(length) {
return "// c\n{\n".repeat(length) + "}".repeat(length);
}
current.parse(createInput(256), {});
function benchCases(name, implementation, options) {
for (const length of [128, 256, 512, 1024]) {
const input = createInput(length);
const { parse } = implementation;
suite.add(`${name} ${length} nested leading comments`, () => {
parse(input, options);
});
}
}
benchCases("baseline", baseline);
benchCases("current", current);
suite.on("cycle", report).run();

View File

@ -0,0 +1,24 @@
import Benchmark from "benchmark";
import baseline from "@babel-baseline/parser";
import current from "@babel/parser";
import { report } from "../../util.mjs";
const suite = new Benchmark.Suite();
function createInput(length) {
return "// c\n".repeat(length) + "{}";
}
current.parse(createInput(256), {});
function benchCases(name, implementation, options) {
for (const length of [128, 256, 512, 1024]) {
const input = createInput(length);
const { parse } = implementation;
suite.add(`${name} ${length} leading comments`, () => {
parse(input, options);
});
}
}
benchCases("baseline", baseline);
benchCases("current", current);
suite.on("cycle", report).run();

View File

@ -0,0 +1,28 @@
import Benchmark from "benchmark";
import baseline from "@babel-baseline/parser";
import current from "../../lib/index.js";
import { report } from "../util.mjs";
const suite = new Benchmark.Suite();
function createInput(length) {
return "\n// c\na".repeat(length);
}
function benchCases(name, implementation, options) {
for (const length of [256, 512, 1024, 2048]) {
const input = createInput(length);
const { parse } = implementation;
suite.add(
`${name} ${length} leading comments + ${length - 1} trailing comments`,
() => {
parse(input, options);
}
);
}
}
benchCases("baseline", baseline, { attachComment: true });
benchCases("current + attachComment: false", current, { attachComment: false });
suite.on("cycle", report).run();

View File

@ -0,0 +1,27 @@
import Benchmark from "benchmark";
import baseline from "@babel-baseline/parser";
import current from "@babel/parser";
import { report } from "../../util.mjs";
const suite = new Benchmark.Suite();
function createInput(length) {
return "\n// c\na".repeat(length);
}
function benchCases(name, implementation, options) {
for (const length of [128, 256, 512, 1024]) {
const input = createInput(length);
const { parse } = implementation;
suite.add(
`${name} ${length} leading comments + ${length - 1} trailing comments`,
() => {
parse(input, options);
}
);
}
}
benchCases("baseline", baseline);
benchCases("current", current);
suite.on("cycle", report).run();

View File

@ -0,0 +1,22 @@
import Benchmark from "benchmark";
import baseline from "@babel-baseline/parser";
import current from "@babel/parser";
import { report } from "../../util.mjs";
const suite = new Benchmark.Suite();
function createInput(length) {
return "{ let foecnatsni };".repeat(length);
}
function benchCases(name, implementation, options) {
for (const length of [64, 128, 256, 512]) {
const input = createInput(length);
suite.add(`${name} ${length} let and length-10 binding identifiers`, () => {
implementation.parse(input, options);
});
}
}
benchCases("baseline", baseline);
benchCases("current", current);
suite.on("cycle", report).run();

View File

@ -0,0 +1,34 @@
import Benchmark from "benchmark";
import baseline from "@babel-baseline/parser";
import current from "@babel/parser";
import { report } from "../../util.mjs";
const suite = new Benchmark.Suite();
// All codepoints in [0x4e00, 0x9ffc] are valid identifier name per Unicode 13
function createInput(length) {
if (length > 0x9ffc - 0x4e00) {
throw new Error(
`Length greater than ${
0x9ffc - 0x4e00
} is not supported! Consider modify the \`createInput\`.`
);
}
let source = "";
for (let i = 0; i < length; i++) {
source += "let " + String.fromCharCode(0x4e00 + i) + ";";
}
return source;
}
function benchCases(name, implementation, options) {
for (const length of [256, 512, 1024, 2048]) {
const input = createInput(length);
suite.add(`${name} ${length} length-1 let bindings`, () => {
implementation.parse(input, options);
});
}
}
benchCases("baseline", baseline);
benchCases("current", current);
suite.on("cycle", report).run();

View File

@ -0,0 +1,34 @@
import Benchmark from "benchmark";
import baseline from "@babel-baseline/parser";
import current from "@babel/parser";
import { report } from "../../util.mjs";
const suite = new Benchmark.Suite();
// All codepoints in [0x4e00, 0x9ffc] are valid identifier name per Unicode 13
function createInput(length) {
if (length > 0x9ffc - 0x4e00) {
throw new Error(
`Length greater than ${
0x9ffc - 0x4e00
} is not supported! Consider modify the \`createInput\`.`
);
}
let source = "export { ";
for (let i = 0; i < length; i++) {
source += String.fromCharCode(0x4e00 + i) + ",";
}
return source + " } from './foo'";
}
function benchCases(name, implementation, options) {
for (const length of [256, 512, 1024, 2048]) {
const input = createInput(length);
suite.add(`${name} ${length} length-1 named export`, () => {
implementation.parse(input, options);
});
}
}
benchCases("baseline", baseline, { sourceType: "module" });
benchCases("current", current, { sourceType: "module" });
suite.on("cycle", report).run();

View File

@ -0,0 +1,22 @@
import Benchmark from "benchmark";
import baseline from "@babel-baseline/parser";
import current from "@babel/parser";
import { report } from "../../util.mjs";
const suite = new Benchmark.Suite();
function createInput(length) {
return "{".repeat(length) + "0" + "}".repeat(length);
}
function benchCases(name, implementation, options) {
for (const length of [128, 256, 512, 1024]) {
const input = createInput(length);
suite.add(`${name} ${length} nested template elements`, () => {
implementation.parse(input, options);
});
}
}
benchCases("baseline", baseline);
benchCases("current", current);
suite.on("cycle", report).run();

View File

@ -0,0 +1,25 @@
import Benchmark from "benchmark";
import baseline from "@babel-baseline/parser";
import current from "@babel/parser";
import { report } from "../../util.mjs";
const suite = new Benchmark.Suite();
function createInput(length) {
return "<t a={x}>{y}".repeat(length) + "</t>".repeat(length);
}
function benchCases(name, implementation, options) {
for (const length of [128, 256, 512, 1024]) {
const input = createInput(length);
suite.add(
`${name} ${length} nested jsx elements with one attribute and text`,
() => {
implementation.parse(input, options);
}
);
}
}
benchCases("baseline", baseline, { plugins: ["jsx"] });
benchCases("current", current, { plugins: ["jsx"] });
suite.on("cycle", report).run();

View File

@ -0,0 +1,22 @@
import Benchmark from "benchmark";
import baseline from "@babel-baseline/parser";
import current from "@babel/parser";
import { report } from "../../util.mjs";
const suite = new Benchmark.Suite();
function createInput(length) {
return "` ${".repeat(length) + "0" + "}`".repeat(length);
}
function benchCases(name, implementation, options) {
for (const length of [128, 256, 512, 1024]) {
const input = createInput(length);
suite.add(`${name} ${length} nested template elements`, () => {
implementation.parse(input, options);
});
}
}
benchCases("baseline", baseline);
benchCases("current", current);
suite.on("cycle", report).run();

View File

@ -0,0 +1,22 @@
import Benchmark from "benchmark";
import baseline from "../../lib/index-v2.js";
import current from "@babel/parser";
import { report } from "../../util.mjs";
const suite = new Benchmark.Suite();
function createInput(length) {
return "/x/dgimsuy;".repeat(length);
}
function benchCases(name, implementation, options) {
for (const length of [256, 512, 1024, 2048]) {
const input = createInput(length);
suite.add(`${name} ${length} small regexp literal with all flags`, () => {
implementation.parse(input, options);
});
}
}
benchCases("baseline", baseline);
benchCases("current", current);
suite.on("cycle", report).run();

View File

@ -0,0 +1,23 @@
import Benchmark from "benchmark";
import baseline from "@babel-baseline/parser";
import current from "@babel/parser";
import { report } from "../../util.mjs";
const suite = new Benchmark.Suite();
function createInput(length) {
return "`" + " ${0}".repeat(length) + "`";
}
function benchCases(name, implementation, options) {
for (const length of [128, 256, 512, 1024]) {
const input = createInput(length);
suite.add(`${name} ${length} template elements`, () => {
implementation.parse(input, options);
});
}
}
current.parse(createInput(1));
benchCases("baseline", baseline);
benchCases("current", current);
suite.on("cycle", report).run();

View File

@ -0,0 +1,22 @@
import Benchmark from "benchmark";
import baseline from "@babel-baseline/parser";
import current from "@babel/parser";
import { report } from "../../util.mjs";
const suite = new Benchmark.Suite();
function createInput(length) {
return "{".repeat(length) + "} // c\n".repeat(length);
}
function benchCases(name, implementation, options) {
for (const length of [128, 256, 512, 1024]) {
const input = createInput(length);
suite.add(`${name} ${length} nested trailing comments`, () => {
implementation.parse(input, options);
});
}
}
benchCases("baseline", baseline);
benchCases("current", current);
suite.on("cycle", report).run();

View File

@ -0,0 +1,24 @@
import Benchmark from "benchmark";
import baseline from "@babel-baseline/parser";
import current from "@babel/parser";
import { report } from "../../util.mjs";
const suite = new Benchmark.Suite();
function createInput(length) {
return "{}" + "// c\n".repeat(length);
}
current.parse(createInput(256), {});
function benchCases(name, implementation, options) {
for (const length of [128, 256, 512, 1024]) {
const input = createInput(length);
const { parse } = implementation;
suite.add(`${name} ${length} trailing comments`, () => {
parse(input, options);
});
}
}
benchCases("baseline", baseline);
benchCases("current", current);
suite.on("cycle", report).run();

View File

@ -0,0 +1,37 @@
import Benchmark from "benchmark";
import baseline from "@babel-baseline/traverse";
import current from "@babel/traverse";
import parser from "@babel-baseline/parser";
import { report } from "../../util.mjs";
const suite = new Benchmark.Suite();
function createInput(length) {
return parser.parse(";".repeat(length));
}
function benchCases(name, implementation, options) {
for (const length of [256, 512, 1024, 2048]) {
const input = createInput(length);
suite.add(`${name} ${length} empty statements`, () => {
implementation(input, options);
});
}
}
benchCases("baseline", baseline.default, {
enter() {},
});
benchCases("baseline mutating context", baseline.default, {
enter(path) {
path.context = undefined;
},
});
benchCases("current", current.default, {
enter() {},
});
benchCases("current mutating context", current.default, {
enter(path) {
path.context = undefined;
},
});
suite.on("cycle", report).run();

View File

@ -0,0 +1,23 @@
import Benchmark from "benchmark";
import baseline from "@babel-baseline/types";
import current from "@babel/types";
import { report } from "../../util.mjs";
const suite = new Benchmark.Suite();
function benchCases(implementations) {
const funcName = "memberExpression";
for (const version in implementations) {
const t = implementations[version];
const func = t[funcName];
const idObj = t.identifier("obj");
const idProp = t.identifier("prop");
suite.add(`${version} ${funcName} builder`, () => {
func(idObj, idProp, /*computed?*/ false /*, optional? missing*/);
});
}
}
benchCases({ baseline, current });
suite.on("cycle", report).run();

View File

@ -0,0 +1,21 @@
import Benchmark from "benchmark";
import baseline from "@babel-baseline/types";
import current from "@babel/types";
import { report } from "../../util.mjs";
const suite = new Benchmark.Suite();
function benchCases(implementations) {
const funcName = "stringLiteral";
for (const version in implementations) {
const t = implementations[version];
const func = t[funcName];
suite.add(`${version} ${funcName} builder`, () => {
func("bar");
});
}
}
benchCases({ baseline, current });
suite.on("cycle", report).run();

23
benchmark/package.json Normal file
View File

@ -0,0 +1,23 @@
{
"name": "@babel/benchmark",
"private": true,
"type": "module",
"devDependencies": {
"@babel-baseline/core": "npm:@babel/core@7.15.8",
"@babel-baseline/generator": "npm:@babel/generator@7.14.5",
"@babel-baseline/helper-validator-identifier": "npm:@babel/helper-validator-identifier@7.10.4",
"@babel-baseline/parser": "npm:@babel/parser@7.14.8",
"@babel-baseline/traverse": "npm:@babel/traverse@7.15.4",
"@babel-baseline/types": "npm:@babel/types@7.15.6",
"@babel/core": "workspace:^",
"@babel/generator": "workspace:^",
"@babel/helper-validator-identifier": "workspace:^",
"@babel/parser": "workspace:^",
"@babel/preset-env": "workspace:^",
"@babel/preset-flow": "workspace:^",
"@babel/traverse": "workspace:^",
"@babel/types": "workspace:^",
"benchmark": "^2.1.4"
},
"version": "7.16.5"
}

17
benchmark/util.mjs Normal file
View File

@ -0,0 +1,17 @@
export function report(event) {
const bench = event.target;
const timeMs = bench.stats.mean * 1000;
const time =
timeMs < 10
? `${Math.round(timeMs * 1000) / 1000}ms`
: `${Math.round(timeMs)}ms`;
const msg = `${bench.name}: ${formatNumber(bench.hz)} ops/sec ±${
Math.round(bench.stats.rme * 100) / 100
}% (${time})`;
console.log(msg);
}
function formatNumber(x) {
if (x < 100) return `${Math.round(x * 100) / 100}`;
return `${Math.round(x)}`.replace(/\d(?=(?:\d{3})+$)/g, "$&_");
}

View File

@ -5,8 +5,8 @@ coverage:
status:
project:
default:
target: "80%"
target: "90%"
patch:
enabled: false
ignore:
- packages/babel-types/src/*/generated/index.js
- packages/babel-types/src/*/generated/*

View File

@ -1,28 +1,45 @@
{
"name": "@babel/plugin-codemod-object-assign-to-object-spread",
"version": "7.0.0",
"version": "7.10.4",
"description": "Transforms Object.assign into object spread syntax",
"repository": "https://github.com/babel/babel/tree/master/codemods/babel-plugin-codemod-object-assign-to-object-spread",
"repository": {
"type": "git",
"url": "https://github.com/babel/babel.git",
"directory": "codemods/babel-plugin-codemod-object-assign-to-object-spread"
},
"license": "MIT",
"publishConfig": {
"access": "public"
},
"main": "lib/index.js",
"main": "./lib/index.js",
"keywords": [
"@babel/codemod",
"@babel/plugin"
],
"dependencies": {
"@babel/plugin-syntax-object-rest-spread": "^7.0.0"
"@babel/plugin-syntax-object-rest-spread": "^7.8.3"
},
"peerDependencies": {
"@babel/core": "^7.0.0-0"
},
"devDependencies": {
"@babel/core": "^7.0.0",
"@babel/helper-plugin-test-runner": "^7.0.0"
"@babel/core": "workspace:^",
"@babel/helper-plugin-test-runner": "workspace:^"
},
"publishConfig": {
"access": "public"
"engines": {
"node": ">=6.9.0"
},
"author": "The Babel Team (https://babel.dev/team)",
"conditions": {
"BABEL_8_BREAKING": [
null,
{
"exports": null
}
]
},
"exports": {
".": "./lib/index.js",
"./package.json": "./package.json"
}
}

View File

@ -1,35 +0,0 @@
import syntaxObjectRestSpread from "@babel/plugin-syntax-object-rest-spread";
export default function({ types: t }) {
return {
inherits: syntaxObjectRestSpread,
visitor: {
CallExpression(path) {
if (!path.get("callee").matchesPattern("Object.assign")) return;
const args = path.get("arguments");
if (args.length === 0) return;
const [objPath] = args;
if (!objPath.isObjectExpression()) return;
const obj = objPath.node;
const { properties } = obj;
for (let i = 1; i < args.length; i++) {
const arg = args[i];
const { node } = arg;
if (arg.isObjectExpression()) {
properties.push(...node.properties);
} else {
properties.push(t.spreadElement(node));
}
}
path.replaceWith(obj);
},
},
};
}

View File

@ -0,0 +1,35 @@
import syntaxObjectRestSpread from "@babel/plugin-syntax-object-rest-spread";
export default function ({ types: t }) {
return {
inherits: syntaxObjectRestSpread.default,
visitor: {
CallExpression(path) {
if (!path.get("callee").matchesPattern("Object.assign")) return;
const args = path.get("arguments");
if (args.length === 0) return;
const [objPath] = args;
if (!objPath.isObjectExpression()) return;
const obj = objPath.node;
const { properties } = obj;
for (let i = 1; i < args.length; i++) {
const arg = args[i];
const { node } = arg;
if (arg.isObjectExpression()) {
properties.push(...node.properties);
} else {
properties.push(t.spreadElement(node));
}
}
path.replaceWith(obj);
},
},
};
}

View File

@ -1,3 +1,3 @@
{
"plugins": ["../../../../lib"]
"plugins": ["codemod-object-assign-to-object-spread"]
}

View File

@ -1,3 +1,3 @@
{
"plugins": ["../../../../lib"]
"plugins": ["codemod-object-assign-to-object-spread"]
}

View File

@ -1,3 +1,3 @@
{
"plugins": ["../../../../lib"]
"plugins": ["codemod-object-assign-to-object-spread"]
}

View File

@ -1,3 +1,3 @@
{
"plugins": ["../../../../lib"]
"plugins": ["codemod-object-assign-to-object-spread"]
}

View File

@ -1,3 +1,3 @@
import runner from "@babel/helper-plugin-test-runner";
runner(__dirname);
runner(import.meta.url);

View File

@ -0,0 +1 @@
{ "type": "module" }

Some files were not shown because too many files have changed in this diff Show More