Files
flipper/desktop/flipper-frontend-core/src/globalObject.tsx
Andrey Goncharov 9597e672a1 Provide @emotion/css to plugins
Summary: Changelog: Provide `emotion/css` to plugins

Reviewed By: antonk52

Differential Revision: D40057817

fbshipit-source-id: 1e931eb8527d62dd4312556a6d493fdf3e17b45a
2022-10-04 05:07:36 -07:00

46 lines
1.0 KiB
TypeScript

/**
* 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
*/
// this list should match `replace-flipper-requires.tsx` and the `builtInModules` in `desktop/.eslintrc`
export interface GlobalObject {
React: any;
ReactDOM: any;
ReactDOMClient: any;
ReactIs: any;
Flipper: any;
FlipperPlugin: any;
Immer: any;
antd: any;
emotion_styled: any;
emotion_css: any;
antdesign_icons: any;
ReactJsxRuntime: any;
}
declare module globalThis {
let React: any;
let ReactDOM: any;
let ReactDOMClient: any;
let ReactIs: any;
let Flipper: any;
let FlipperPlugin: any;
let Immer: any;
let antd: any;
let emotion_styled: any;
let emotion_css: any;
let antdesign_icons: any;
let ReactJsxRuntime: any;
}
export const setGlobalObject = (replacements: GlobalObject) => {
for (const [name, module] of Object.entries(replacements)) {
globalThis[name as keyof GlobalObject] = module;
}
};