From ae90522bc6ea80d87f22e845024dc82e2c05e3d5 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Tue, 22 Oct 2024 19:51:58 +0200 Subject: [PATCH] chore: remove unsued deps from React Compiler Babel plugin (#31315) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary Since the Babel plugin is bundled into a single file (except for `@babel/types` https://github.com/facebook/react/blob/45804af18d589fd2c181f3b020f07661c46b73ea/compiler/packages/babel-plugin-react-compiler/rollup.config.js#L18) we can move these deps to `devDependencies`. Main motivation is e.g. not installing ancient version of `pretty-format` (asked in https://github.com/facebook/react/issues/29062 without getting a reason, but if consumers can just skip the deps entirely that's even better). ## How did you test this change? I tested by installing the plugin into an empty project, deleting everything in `node_modules` _except_ for `babel-plugin-react-compiler` and doing `require('babel-plugin-react-compiler')`. It still worked fine, so it should work in other cases as well 😀 --- .../babel-plugin-react-compiler/package.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/compiler/packages/babel-plugin-react-compiler/package.json b/compiler/packages/babel-plugin-react-compiler/package.json index 5891ce2b85..28f25f927d 100644 --- a/compiler/packages/babel-plugin-react-compiler/package.json +++ b/compiler/packages/babel-plugin-react-compiler/package.json @@ -18,16 +18,11 @@ "lint": "yarn eslint src" }, "dependencies": { - "@babel/generator": "7.2.0", - "@babel/types": "^7.19.0", - "chalk": "4", - "invariant": "^2.2.4", - "pretty-format": "^24", - "zod": "^3.22.4", - "zod-validation-error": "^2.1.0" + "@babel/types": "^7.19.0" }, "devDependencies": { "@babel/core": "^7.2.0", + "@babel/generator": "7.2.0", "@babel/parser": "^7.2.0", "@babel/plugin-syntax-typescript": "^7.18.6", "@babel/plugin-transform-block-scoping": "^7.18.9", @@ -46,15 +41,20 @@ "babel-jest": "^29.0.3", "babel-plugin-fbt": "^1.0.0", "babel-plugin-fbt-runtime": "^1.0.0", + "chalk": "4", "eslint": "^8.57.1", "glob": "^7.1.6", + "invariant": "^2.2.4", "jest": "^29.0.3", "jest-environment-jsdom": "^29.0.3", + "pretty-format": "^24", "react": "19.0.0-beta-b498834eab-20240506", "react-dom": "19.0.0-beta-b498834eab-20240506", "rimraf": "^3.0.2", "ts-jest": "^29.1.1", - "ts-node": "^10.9.2" + "ts-node": "^10.9.2", + "zod": "^3.22.4", + "zod-validation-error": "^2.1.0" }, "resolutions": { "./**/@babel/parser": "7.7.4",