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
Lively
eb22659817
remove unnecessary hosting when using template strings ( #13482 )
2021-06-17 21:43:08 -04:00
Alan Orozco
f35513fbaa
Hoist omitted keys from object spread operator ( #13384 )
2021-05-28 18:32:30 +02:00
Moti Zilberman
691c46846f
fix(destructuring): preserve loc of original declaration in output ( #13173 )
2021-04-20 10:36:06 -04: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
93978267ec
Add "allowArrayLike" opt to destructuring and spread transforms ( #11265 )
2020-05-24 23:00:06 +02:00
Zen
ca096c56aa
fix Incorrect destructuring compilation of `for (let [[x] = [1… ( #11360 )
2020-04-07 10:10:21 -05:00
Gerald
8cafd8f820
fix(transform-destructuring): update scope info after replacing
2020-03-05 21:23:50 +01:00
Tan Li Hau
b6486a22cb
fix destructuring rest with template literal ( #10013 )
...
* fix destructuring rest with template literal
* update test
2019-05-24 00:03:27 +02:00
Moti Zilberman
1f5444e96a
Destructuring: Fix handling of impure computed keys with object rest ( #9416 )
2019-03-26 19:11:44 -07:00
Moti Zilberman
f7bfc774ba
Destructuring: Fix array unpacking assignments with holes on RHS ( #9412 )
...
This fixes an issue where destructuring assignments eligible for the "array unpacking" optimization would fail to compile when the array literal on the right-hand side of the expression contained holes.
Example input:
```js
[a, b] = [, 2];
; // Avoid completion record special case
```
The error message was `Property right of AssignmentExpression expected node to be of a type ["Expression"] but instead got null`.
Now the above code compiles to:
```js
a = void 0;
b = 2;
;
```
This PR also adds a couple of related test cases that were missing, to ensure the change doesn't regress them:
* Normal assignment expression with unpacking
* Declaration with unpacking and a hole on RHS
2019-03-27 01:14:21 +01:00
Nicolò Ribaudo
0345c1bc1d
Use for..of Object.keys instead of for..in ( #9518 )
...
In https://github.com/babel/babel/issues/9511 (and #9495 is another symptom), @PavelKastornyy reported a node crash becaue the JavaScript heap run out of memory. The problem was that their code was adding enumerable properties to `Object.prototype`: it is something that shouldn't be done, but Babel shouldn't make node crash if someone adds them.
I reduced down the problem to `for...in` loops in `@babel/traverse` that grew the memory consumption exponentially because of that unexpected properties.
2019-02-26 20:09:02 +01:00
Moti Zilberman
1452e977a0
Destructuring: Create assignments from ForX non-declaration patterns ( #9414 )
2019-01-28 09:50:24 +01:00
Ruben Verborgh
9308c870f5
Fix destructuring assignment in arrow functions. ( #8916 )
...
Fixes 8912.
2018-11-25 19:29:58 +01:00
Nicolò Ribaudo
8c7d4b55c9
Add plugins name ( #8769 )
...
* Add plugins name
* Add missing names found by the plugin
* Add eslint plugin
2018-11-18 23:02:58 +01:00
Brian Ng
36d12b5969
Ensure destructuring's computed key handling matches object-rest-spread ( #8793 )
2018-10-02 20:46:08 -05:00
Nicolò Ribaudo
626f47982e
Do not unpack array patterns that update a referenced binding ( #8535 )
...
Fixes #8528
2018-09-28 11:45:42 -04:00
Mateusz Burzyński
c0c13ae30f
Introduce objectWithoutPropertiesLoose helper ( #8261 )
2018-07-06 15:03:44 -04:00
Mateusz Burzyński
d682e32529
Favour extends helper over objectWithoutProperties when whole object gets copied anyway ( #7390 )
2018-03-14 22:59:02 +01:00
Brian Ng
4f4dd3d4a6
Assign another temp var when parsing assignment patterns in destructuring ( #7333 )
2018-03-09 09:39:25 +01:00
Logan Smyth
a4795408b4
Allow plugins to assert that a specific babel version has loaded the plugin. ( #7450 )
2018-03-04 14:36:54 -08:00
Nicolò Ribaudo
252ea5a966
Fix reused nodes - part 2 ( #7149 )
2018-01-29 22:59:06 +01:00
Mateusz Burzyński
912bcc186d
Fix reused nodes - part 1 ( #7149 )
2018-01-29 22:59:06 +01:00
Nicolò Ribaudo
63ae923987
Add t.cloneNode and deprecate t.clone and t.cloneDeep ( #7149 )
2018-01-29 22:59:06 +01:00
Logan Smyth
e7c57ae85a
Move a few more references to plugin options to the top level.
2017-11-08 23:07:56 -08:00
Logan Smyth
b19b66d94b
Use peerDep rather than plugin param for common APIs.
2017-11-06 11:32:47 -08:00
Henry Zhu
9ac326b075
remove es20xx prefixes from plugins and rename folders ( #6575 )
2017-10-28 20:43:15 -04:00