Update babel configs used in jest (#32588)
Extracting portions of #32416 for easier review. This PR updates our babel configs (only used in jest) to support classes. Co-authored-by: michael faith <michaelfaith@users.noreply.github.com> --- [//]: # (BEGIN SAPLING FOOTER) Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/facebook/react/pull/32588). * #32592 * #32591 * #32590 * #32589 * __->__ #32588 Co-authored-by: michael faith <michaelfaith@users.noreply.github.com>
lauren committed
Mar 12, 2025 at 19:07 UTC
f695f95290aa3560a00e8a3b617205ac9e087e0e
4 files changed
+86
-3
babel.config-ts.js
+2
@@ -7,6 +7,8 @@ module.exports = {
7
plugins: [
8
'@babel/plugin-syntax-jsx',
9
'@babel/plugin-transform-flow-strip-types',
10
+ ['@babel/plugin-transform-class-properties', {loose: true}],
11
+ '@babel/plugin-transform-classes',
12
],
13
presets: [
14
['@babel/preset-env', {targets: {node: 'current'}}],
babel.config.js
+2
-1
@@ -4,7 +4,8 @@ module.exports = {
4
plugins: [
5
'@babel/plugin-syntax-jsx',
6
'@babel/plugin-transform-flow-strip-types',
7
- ['@babel/plugin-proposal-class-properties', {loose: true}],
7
+ ['@babel/plugin-transform-class-properties', {loose: true}],
8
+ '@babel/plugin-transform-classes',
9
'syntax-trailing-function-commas',
10
[
11
'@babel/plugin-proposal-object-rest-spread',
package.json
+2
-1
@@ -19,7 +19,8 @@
19
"@babel/plugin-transform-arrow-functions": "^7.10.4",
20
"@babel/plugin-transform-block-scoped-functions": "^7.10.4",
21
"@babel/plugin-transform-block-scoping": "^7.11.1",
22
- "@babel/plugin-transform-classes": "^7.10.4",
22
+ "@babel/plugin-transform-class-properties": "^7.25.9",
23
+ "@babel/plugin-transform-classes": "^7.25.9",
24
"@babel/plugin-transform-computed-properties": "^7.10.4",
25
"@babel/plugin-transform-destructuring": "^7.10.4",
26
"@babel/plugin-transform-for-of": "^7.10.4",
yarn.lock
+80
-1
@@ -103,6 +103,11 @@
103
resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.24.4.tgz#6f102372e9094f25d908ca0d34fc74c74606059a"
104
integrity sha512-vg8Gih2MLK+kOkHJp4gBEIkyaIi00jgWot2D9QOmmfLC8jINSOzmCLta6Bvz/JSBCqnegV0L80jhxkol5GWNfQ==
105
106
+"@babel/compat-data@^7.26.5":
107
+ version "7.26.8"
108
+ resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.26.8.tgz#821c1d35641c355284d4a870b8a4a7b0c141e367"
109
+ integrity sha512-oH5UPLMWR3L2wEFLnFJ1TZXqHufiTKAiLfqw5zkhS4dKXLJ10yVztfil/twG8EDTA4F/tvVNw9nOl4ZMslB8rQ==
110
+
111
"@babel/core@^7.0.0":
112
version "7.20.12"
113
resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.20.12.tgz#7930db57443c6714ad216953d1356dac0eb8496d"
@@ -358,6 +363,17 @@
363
lru-cache "^5.1.1"
364
semver "^6.3.1"
365
366
+"@babel/helper-compilation-targets@^7.25.9":
367
+ version "7.26.5"
368
+ resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.26.5.tgz#75d92bb8d8d51301c0d49e52a65c9a7fe94514d8"
369
+ integrity sha512-IXuyn5EkouFJscIDuFF5EsiSolseme1s0CZB+QxVugqJLYmKdxI1VfIBOst0SUu4rnk2Z7kqTwmoO1lp3HIfnA==
370
+ dependencies:
371
+ "@babel/compat-data" "^7.26.5"
372
+ "@babel/helper-validator-option" "^7.25.9"
373
+ browserslist "^4.24.0"
374
+ lru-cache "^5.1.1"
375
+ semver "^6.3.1"
376
+
377
"@babel/helper-create-class-features-plugin@^7.10.4":
378
version "7.10.5"
379
resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.10.5.tgz#9f61446ba80e8240b0a5c85c6fdac8459d6f259d"
@@ -740,7 +756,7 @@
756
"@babel/traverse" "^7.20.7"
757
"@babel/types" "^7.20.7"
758
743
-"@babel/helper-replace-supers@^7.26.5":
759
+"@babel/helper-replace-supers@^7.25.9", "@babel/helper-replace-supers@^7.26.5":
760
version "7.26.5"
761
resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.26.5.tgz#6cb04e82ae291dae8e72335dfe438b0725f14c8d"
762
integrity sha512-bJ6iIVdYX1YooY2X7w1q6VITt+LnUILtNk7zT78ykuwStx8BauCzxvFqFaHjOpW1bVnSUM1PN1f0p5P21wHxvg==
@@ -1469,6 +1485,14 @@
1485
dependencies:
1486
"@babel/helper-plugin-utils" "^7.10.4"
1487
1488
+"@babel/plugin-transform-class-properties@^7.25.9":
1489
+ version "7.25.9"
1490
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-class-properties/-/plugin-transform-class-properties-7.25.9.tgz#a8ce84fedb9ad512549984101fa84080a9f5f51f"
1491
+ integrity sha512-bbMAII8GRSkcd0h0b4X+36GksxuheLFjP65ul9w6C3KgAamI3JqErNgSrosX6ZPj+Mpim5VvEbawXxJCyEUV3Q==
1492
+ dependencies:
1493
+ "@babel/helper-create-class-features-plugin" "^7.25.9"
1494
+ "@babel/helper-plugin-utils" "^7.25.9"
1495
+
1496
"@babel/plugin-transform-classes@^7.0.0":
1497
version "7.20.7"
1498
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.20.7.tgz#f438216f094f6bb31dc266ebfab8ff05aecad073"
@@ -1498,6 +1522,18 @@
1522
"@babel/helper-split-export-declaration" "^7.10.4"
1523
globals "^11.1.0"
1524
1525
+"@babel/plugin-transform-classes@^7.25.9":
1526
+ version "7.25.9"
1527
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.25.9.tgz#7152457f7880b593a63ade8a861e6e26a4469f52"
1528
+ integrity sha512-mD8APIXmseE7oZvZgGABDyM34GUmK45Um2TXiBUt7PnuAxrgoSVf123qUzPxEr/+/BHrRn5NMZCdE2m/1F8DGg==
1529
+ dependencies:
1530
+ "@babel/helper-annotate-as-pure" "^7.25.9"
1531
+ "@babel/helper-compilation-targets" "^7.25.9"
1532
+ "@babel/helper-plugin-utils" "^7.25.9"
1533
+ "@babel/helper-replace-supers" "^7.25.9"
1534
+ "@babel/traverse" "^7.25.9"
1535
+ globals "^11.1.0"
1536
+
1537
"@babel/plugin-transform-computed-properties@^7.0.0":
1538
version "7.20.7"
1539
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.20.7.tgz#704cc2fd155d1c996551db8276d55b9d46e4d0aa"
@@ -5480,6 +5516,16 @@ browserslist@^4.21.3, browserslist@^4.22.2:
5516
node-releases "^2.0.14"
5517
update-browserslist-db "^1.0.13"
5518
5519
+browserslist@^4.24.0:
5520
+ version "4.24.4"
5521
+ resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.24.4.tgz#c6b2865a3f08bcb860a0e827389003b9fe686e4b"
5522
+ integrity sha512-KDi1Ny1gSePi1vm0q4oxSF8b4DR44GF4BbmS2YdhPLOEqd8pDviZOGH/GsmRwoWJ2+5Lr085X7naowMwKHDG1A==
5523
+ dependencies:
5524
+ caniuse-lite "^1.0.30001688"
5525
+ electron-to-chromium "^1.5.73"
5526
+ node-releases "^2.0.19"
5527
+ update-browserslist-db "^1.1.1"
5528
+
5529
browserslist@^4.8.3:
5530
version "4.8.5"
5531
resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.8.5.tgz#691af4e327ac877b25e7a3f7ee869c4ef36cdea3"
@@ -5758,6 +5804,11 @@ caniuse-lite@^1.0.30001449, caniuse-lite@^1.0.30001587:
5804
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001616.tgz#4342712750d35f71ebba9fcac65e2cf8870013c3"
5805
integrity sha512-RHVYKov7IcdNjVHJFNY/78RdG4oGVjbayxv8u5IO74Wv7Hlq4PnJE6mo/OjFijjVFNy5ijnCt6H3IIo4t+wfEw==
5806
5807
+caniuse-lite@^1.0.30001688:
5808
+ version "1.0.30001703"
5809
+ resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001703.tgz#977cb4920598c158f491ecf4f4f2cfed9e354718"
5810
+ integrity sha512-kRlAGTRWgPsOj7oARC9m1okJEXdL/8fekFVcxA8Hl7GH4r/sN4OJn/i6Flde373T50KS7Y37oFbMwlE8+F42kQ==
5811
+
5812
capture-stack-trace@^1.0.0:
5813
version "1.0.1"
5814
resolved "https://registry.yarnpkg.com/capture-stack-trace/-/capture-stack-trace-1.0.1.tgz#a6c0bbe1f38f3aa0b92238ecb6ff42c344d4135d"
@@ -7310,6 +7361,11 @@ electron-to-chromium@^1.4.284, electron-to-chromium@^1.4.668:
7361
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.758.tgz#f39e530cae2ca4329a0f0e1840629d8d1da73156"
7362
integrity sha512-/o9x6TCdrYZBMdGeTifAP3wlF/gVT+TtWJe3BSmtNh92Mw81U9hrYwW9OAGUh+sEOX/yz5e34sksqRruZbjYrw==
7363
7364
+electron-to-chromium@^1.5.73:
7365
+ version "1.5.115"
7366
+ resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.115.tgz#193dd534948b3ea77e3d95dd38ca12cdc01c76a9"
7367
+ integrity sha512-MN1nahVHAQMOz6dz6bNZ7apgqc9InZy7Ja4DBEVCTdeiUcegbyOYE9bi/f2Z/z6ZxLi0RxLpyJ3EGe+4h3w73A==
7368
+
7369
electron@^23.1.2:
7370
version "23.1.2"
7371
resolved "https://registry.yarnpkg.com/electron/-/electron-23.1.2.tgz#f03e361c94f8dd2407963b5461d19aadea335316"
@@ -7537,6 +7593,11 @@ escalade@^3.1.1, escalade@^3.1.2:
7593
resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.2.tgz#54076e9ab29ea5bf3d8f1ed62acffbb88272df27"
7594
integrity sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==
7595
7596
+escalade@^3.2.0:
7597
+ version "3.2.0"
7598
+ resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.2.0.tgz#011a3f69856ba189dffa7dc8fcce99d2a87903e5"
7599
+ integrity sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==
7600
+
7601
escape-goat@^2.0.0:
7602
version "2.1.1"
7603
resolved "https://registry.yarnpkg.com/escape-goat/-/escape-goat-2.1.1.tgz#1b2dc77003676c457ec760b2dc68edb648188675"
@@ -12534,6 +12595,11 @@ node-releases@^2.0.14, node-releases@^2.0.8:
12595
resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.14.tgz#2ffb053bceb8b2be8495ece1ab6ce600c4461b0b"
12596
integrity sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==
12597
12598
+node-releases@^2.0.19:
12599
+ version "2.0.19"
12600
+ resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.19.tgz#9e445a52950951ec4d177d843af370b411caf314"
12601
+ integrity sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw==
12602
+
12603
node-rsa@^1.0.5:
12604
version "1.0.5"
12605
resolved "https://registry.yarnpkg.com/node-rsa/-/node-rsa-1.0.5.tgz#854dc1b275729d69bc25883f83ca80705db9262e"
@@ -13366,6 +13432,11 @@ picocolors@^1.0.0:
13432
resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c"
13433
integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==
13434
13435
+picocolors@^1.1.1:
13436
+ version "1.1.1"
13437
+ resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.1.1.tgz#3d321af3eab939b083c8f929a1d12cda81c26b6b"
13438
+ integrity sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==
13439
+
13440
picomatch@^2.0.4, picomatch@^2.2.3, picomatch@^2.3.1:
13441
version "2.3.1"
13442
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42"
@@ -16544,6 +16615,14 @@ update-browserslist-db@^1.0.10, update-browserslist-db@^1.0.13:
16615
escalade "^3.1.2"
16616
picocolors "^1.0.0"
16617
16618
+update-browserslist-db@^1.1.1:
16619
+ version "1.1.3"
16620
+ resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.1.3.tgz#348377dd245216f9e7060ff50b15a1b740b75420"
16621
+ integrity sha512-UxhIZQ+QInVdunkDAaiazvvT/+fXL5Osr0JZlJulepYu6Jd7qJtDZjlur0emRlT71EN3ScPoE7gvsuIKKNavKw==
16622
+ dependencies:
16623
+ escalade "^3.2.0"
16624
+ picocolors "^1.1.1"
16625
+
16626
update-notifier@4.1.0:
16627
version "4.1.0"
16628
resolved "https://registry.yarnpkg.com/update-notifier/-/update-notifier-4.1.0.tgz#4866b98c3bc5b5473c020b1250583628f9a328f3"