From 828385e246f21933b3561c26b145a59f4b2bb308 Mon Sep 17 00:00:00 2001 From: Michel Weststrate Date: Thu, 28 May 2020 10:12:10 -0700 Subject: [PATCH] Enable babel transformer for emotion Summary: This diff enables the babel transformer for emotion. It is supposed to be a bit faster, but the most interesting thing is that it will show component names inside the dom tree, which, at least for me, will be a huge performance booster is it will make it much easier to find out to which component style changes need to be applied Reviewed By: nikoant Differential Revision: D21722021 fbshipit-source-id: cab1278046b1aa7f8b875c016d43dfafdbaa0a2d --- .../ExportDataPluginSheet.node.tsx.snap | 96 +++++++++---------- .../ShareSheetPendingDialog.node.tsx.snap | 32 +++---- .../__tests__/DataInspector.node.tsx | 2 +- desktop/babel-transformer/package.json | 1 + desktop/babel-transformer/src/transform.ts | 3 + desktop/yarn.lock | 2 +- 6 files changed, 70 insertions(+), 66 deletions(-) diff --git a/desktop/app/src/chrome/__tests__/__snapshots__/ExportDataPluginSheet.node.tsx.snap b/desktop/app/src/chrome/__tests__/__snapshots__/ExportDataPluginSheet.node.tsx.snap index 5e00f6ab4..eb7b9dfe9 100644 --- a/desktop/app/src/chrome/__tests__/__snapshots__/ExportDataPluginSheet.node.tsx.snap +++ b/desktop/app/src/chrome/__tests__/__snapshots__/ExportDataPluginSheet.node.tsx.snap @@ -2,27 +2,27 @@ exports[`SettingsSheet snapshot with nothing enabled 1`] = `
Select the plugins for which you want to export the data
@@ -30,7 +30,7 @@ exports[`SettingsSheet snapshot with nothing enabled 1`] = ` className="css-1jrm6r3" >
TestDevicePlugin
@@ -71,7 +71,7 @@ exports[`SettingsSheet snapshot with nothing enabled 1`] = ` className="css-1jrm6r3" >
TestPlugin
@@ -106,16 +106,16 @@ exports[`SettingsSheet snapshot with nothing enabled 1`] = ` className="css-1yqvjo0" >
Select the plugins for which you want to export the data
@@ -175,7 +175,7 @@ exports[`SettingsSheet snapshot with one plugin enabled 1`] = ` className="css-1jrm6r3" >
TestDevicePlugin
@@ -216,7 +216,7 @@ exports[`SettingsSheet snapshot with one plugin enabled 1`] = ` className="css-1jrm6r3" >
TestPlugin
@@ -251,16 +251,16 @@ exports[`SettingsSheet snapshot with one plugin enabled 1`] = ` className="css-1yqvjo0" >
Update
wubba lubba dub dub
{ "j son diff --git a/desktop/babel-transformer/package.json b/desktop/babel-transformer/package.json index 924e0c58c..8311c678f 100644 --- a/desktop/babel-transformer/package.json +++ b/desktop/babel-transformer/package.json @@ -25,6 +25,7 @@ "@babel/types": "^7.9.0", "@types/fs-extra": "^8.1.0", "@types/node": "^13.7.5", + "babel-plugin-emotion": "^10.0.33", "fs-extra": "^8.1.0", "tslib": "^1" }, diff --git a/desktop/babel-transformer/src/transform.ts b/desktop/babel-transformer/src/transform.ts index 96be54109..a6a048d81 100644 --- a/desktop/babel-transformer/src/transform.ts +++ b/desktop/babel-transformer/src/transform.ts @@ -41,12 +41,14 @@ const objectRestSpreadPlugin = require('@babel/plugin-proposal-object-rest-sprea const flowStripTypesPlugin = require('@babel/plugin-transform-flow-strip-types'); const dynamicRequiresPlugin = require('./dynamic-requires'); const typeScriptPlugin = require('@babel/plugin-transform-typescript'); +const emotionPlugin = require('babel-plugin-emotion'); const tsTransformPlugins = [ typeScriptPlugin, classPropertiesPlugin, commonJsPlugin, optionalChainingPlugin, coalescingOperatorPlugin, + [emotionPlugin, {autoLabel: true}], ]; const jsTransformPlugins = [ commonJsPlugin, @@ -56,6 +58,7 @@ const jsTransformPlugins = [ optionalChainingPlugin, coalescingOperatorPlugin, dynamicRequiresPlugin, + [emotionPlugin, {autoLabel: true}], ]; export default function transform({ diff --git a/desktop/yarn.lock b/desktop/yarn.lock index 2c2484cfe..4a9612110 100644 --- a/desktop/yarn.lock +++ b/desktop/yarn.lock @@ -3184,7 +3184,7 @@ babel-plugin-dynamic-import-node@^2.3.0: dependencies: object.assign "^4.1.0" -babel-plugin-emotion@^10.0.27: +babel-plugin-emotion@^10.0.27, babel-plugin-emotion@^10.0.33: version "10.0.33" resolved "https://registry.yarnpkg.com/babel-plugin-emotion/-/babel-plugin-emotion-10.0.33.tgz#ce1155dcd1783bbb9286051efee53f4e2be63e03" integrity sha512-bxZbTTGz0AJQDHm8k6Rf3RQJ8tX2scsfsRyKVgAbiUPUNIRtlK+7JxP+TAd1kRLABFxe0CFm2VdK4ePkoA9FxQ==