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