127 Commits

Author SHA1 Message Date
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
45308f3cba v7.16.0 2021-10-30 01:26:04 +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
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
Babel Bot
b2376757d7 v7.15.4 2021-09-02 21:28:31 +00: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
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
王清雨
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
Nicolò Ribaudo
6912f968a6 v7.15.0 2021-08-04 23:00:40 +02:00
Federico Ciardi
7e50ee2d82
feat: add noIncompleteNsImportDetection assumption to plugin-transform-modules-commonjs (#13290) 2021-08-03 23:55:09 +02: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
Babel Bot
e591780244 v7.14.8 2021-07-20 17:51:55 +00: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
Babel Bot
1774e2aaef v7.14.6 2021-06-14 21:45:36 +00: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
Babel Bot
7a2a928398 v7.14.5 2021-06-09 23:03:30 +00:00
Kristoffer K
140ec5aa5c
chore: setup Yarn constraints (#13363) 2021-05-31 18:46:03 +02:00
Babel Bot
219fd3ab1f v7.14.4 2021-05-28 16:50:09 +00: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
Babel Bot
1487a46dd5 v7.14.3 2021-05-17 20:26:25 +00:00
Nicolò Ribaudo
989aac2a4c
Don't duplicate the base class when using constantSuper (#13303) 2021-05-15 00:02:46 +02: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
Babel Bot
7512095c84 v7.14.2 2021-05-12 16:58:57 +00:00
Sosuke Suzuki
b2d9156cc6
Update to Prettier 2.3 (#13288) 2021-05-10 15:34:13 +02:00
Babel Bot
3ecc7919c5 v7.14.1 2021-05-04 01:46:37 +00:00
aancer-rca
3b55e8877c
fix: Typo in @babel/helper-create-class-features-plugin (#13237) 2021-04-30 17:40:28 +02:00
Nicolò Ribaudo
3c0152a217 v7.14.0 2021-04-29 21:59:57 +02:00
Nicolò Ribaudo
f30c99aa24 Mark WeakMaps of private fields as pure (#13194) 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
Babel Bot
4b674ea031 v7.13.11 2021-03-15 09:34:23 +00:00
Nicolò Ribaudo
8ad6b75cde
Use function rather than var to compile private methods (#12990) 2021-03-11 02:08:31 +01:00
Babel Bot
d1d404b9a3 v7.13.10 2021-03-08 22:23:36 +00:00
Nicolò Ribaudo
c702895256
Update min Babel version for #12917 (#12977) 2021-03-07 21:09:05 +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
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
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
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
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
c827193d9c v7.13.0 2021-02-22 23:35:18 +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
2f755ef052 v7.12.17 2021-02-18 15:58:43 +01:00
Nicolò Ribaudo
8063fde0d8
Reuse the readOnlyError helper for private methods (#12792) 2021-02-12 14:33:23 +01:00
Babel Bot
dd5c9f958c v7.12.16 2021-02-11 22:36:24 +00: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
Nicolò Ribaudo
d291edbdf1 v7.12.13 2021-02-03 01:59:31 +01:00
Nicolò Ribaudo
3d69dc9471
Add # to the private name in "write-only" errors (#12713) 2021-01-29 17:58:13 +01: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