Provide @emotion/css to plugins

Summary: Changelog: Provide `emotion/css` to plugins

Reviewed By: antonk52

Differential Revision: D40057817

fbshipit-source-id: 1e931eb8527d62dd4312556a6d493fdf3e17b45a
This commit is contained in:
Andrey Goncharov
2022-10-04 05:07:36 -07:00
committed by Facebook GitHub Bot
parent 10189a2c3f
commit 9597e672a1
6 changed files with 18 additions and 0 deletions

View File

@@ -18,6 +18,7 @@ export const pluginExternalModules = {
antd: 'antd',
immer: 'Immer',
'@emotion/styled': 'emotion_styled',
'@emotion/css': 'emotion_css',
'@ant-design/icons': 'antdesign_icons',
// Used by "bloks-logger" (see its bundle's content)
'react/jsx-runtime': 'ReactJsxRuntime',

View File

@@ -18,6 +18,7 @@ export interface GlobalObject {
Immer: any;
antd: any;
emotion_styled: any;
emotion_css: any;
antdesign_icons: any;
ReactJsxRuntime: any;
}
@@ -32,6 +33,7 @@ declare module globalThis {
let Immer: any;
let antd: any;
let emotion_styled: any;
let emotion_css: any;
let antdesign_icons: any;
let ReactJsxRuntime: any;
}

View File

@@ -0,0 +1,10 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/
export const css = () => () => ({});

View File

@@ -17,6 +17,7 @@ import {initializeRenderHost} from './initializeRenderHost';
import * as React from './globalsReplacements/fakeReact';
import * as ReactDOM from './globalsReplacements/fakeReactDOM';
import {styled} from './globalsReplacements/fakeEmotionStyled';
import * as emotionCss from './globalsReplacements/fakeEmotionCss';
import * as legacyExports from './globalsReplacements/fakeLegacyExports';
import Module from 'module';
@@ -38,6 +39,7 @@ export const initCompanionEnv = async (
Immer,
antd: {},
emotion_styled: {default: styled},
emotion_css: emotionCss,
antdesign_icons: {},
ReactJsxRuntime: {},
});

View File

@@ -35,6 +35,7 @@ import {_SandyPluginDefinition} from 'flipper-plugin';
import * as Immer from 'immer';
import * as antd from 'antd';
import * as emotion_styled from '@emotion/styled';
import * as emotion_css from '@emotion/css';
import * as antdesign_icons from '@ant-design/icons';
import isPluginCompatible from '../utils/isPluginCompatible';
import {createSandyPluginWrapper} from '../utils/createSandyPluginWrapper';
@@ -113,6 +114,7 @@ export default async (store: Store, _logger: Logger) => {
Immer,
antd,
emotion_styled,
emotion_css,
antdesign_icons,
ReactJsxRuntime,
});

View File

@@ -62,6 +62,7 @@ async function runBuild({
'antd',
'immer',
'@emotion/styled',
'@emotion/css',
'@ant-design/icons',
// It is an optional dependency for rollup that we use in react-devtools
'fsevents',