From 8be651baafbcc407577b2871c293db1921657202 Mon Sep 17 00:00:00 2001 From: Alexey Raspopov Date: Wed, 15 Sep 2021 20:30:51 -0400 Subject: [PATCH] add babel-plugin-transform-flow-enums to Babel config for Flow Enums support --- package-lock.json | 18 ++++++++++++++++++ packages/babel-preset-react-app/create.js | 1 + packages/babel-preset-react-app/package.json | 1 + 3 files changed, 20 insertions(+) diff --git a/package-lock.json b/package-lock.json index 1138b9d702..be2d4412c9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7549,6 +7549,14 @@ "node": ">=4" } }, + "node_modules/babel-plugin-transform-flow-enums": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-flow-enums/-/babel-plugin-transform-flow-enums-0.0.2.tgz", + "integrity": "sha512-g4aaCrDDOsWjbm0PUUeVnkcVd6AKJsVc/MbnPhEotEpkeJQP6b8nzewohQi7+QS8UyPehOhGWn0nOwjvWpmMvQ==", + "dependencies": { + "@babel/plugin-syntax-flow": "^7.12.1" + } + }, "node_modules/babel-plugin-transform-react-remove-prop-types": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/babel-plugin-transform-react-remove-prop-types/-/babel-plugin-transform-react-remove-prop-types-0.4.24.tgz", @@ -32980,6 +32988,7 @@ "@babel/preset-typescript": "^7.14.5", "@babel/runtime": "^7.14.5", "babel-plugin-macros": "^3.1.0", + "babel-plugin-transform-flow-enums": "^0.0.2", "babel-plugin-transform-react-remove-prop-types": "^0.4.24" } }, @@ -39681,6 +39690,14 @@ } } }, + "babel-plugin-transform-flow-enums": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-flow-enums/-/babel-plugin-transform-flow-enums-0.0.2.tgz", + "integrity": "sha512-g4aaCrDDOsWjbm0PUUeVnkcVd6AKJsVc/MbnPhEotEpkeJQP6b8nzewohQi7+QS8UyPehOhGWn0nOwjvWpmMvQ==", + "requires": { + "@babel/plugin-syntax-flow": "^7.12.1" + } + }, "babel-plugin-transform-react-remove-prop-types": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/babel-plugin-transform-react-remove-prop-types/-/babel-plugin-transform-react-remove-prop-types-0.4.24.tgz", @@ -39732,6 +39749,7 @@ "@babel/preset-typescript": "^7.14.5", "@babel/runtime": "^7.14.5", "babel-plugin-macros": "^3.1.0", + "babel-plugin-transform-flow-enums": "^0.0.2", "babel-plugin-transform-react-remove-prop-types": "^0.4.24" } }, diff --git a/packages/babel-preset-react-app/create.js b/packages/babel-preset-react-app/create.js index 126de46ee5..da1d4288a5 100644 --- a/packages/babel-preset-react-app/create.js +++ b/packages/babel-preset-react-app/create.js @@ -112,6 +112,7 @@ module.exports = function (api, opts, env) { require('@babel/plugin-transform-flow-strip-types').default, false, ], + isFlowEnabled && require('babel-plugin-transform-flow-enums'), // Experimental macros support. Will be documented after it's had some time // in the wild. require('babel-plugin-macros'), diff --git a/packages/babel-preset-react-app/package.json b/packages/babel-preset-react-app/package.json index 7e5e72a2fd..76ca186982 100644 --- a/packages/babel-preset-react-app/package.json +++ b/packages/babel-preset-react-app/package.json @@ -36,6 +36,7 @@ "@babel/preset-typescript": "^7.14.5", "@babel/runtime": "^7.14.5", "babel-plugin-macros": "^3.1.0", + "babel-plugin-transform-flow-enums": "^0.0.2", "babel-plugin-transform-react-remove-prop-types": "^0.4.24" } }