flipper-common
Version:
Server & UI shared Flipper utilities
39 lines • 1.43 kB
JavaScript
;
/**
* 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
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.wrapRequire = exports.pluginExternalModules = void 0;
// This list should match `flipper-ui/src/displatcher/plugins.tsx` and `builtInModules` in `desktop/.eslintrc.js`
exports.pluginExternalModules = {
flipper: 'Flipper',
'flipper-plugin': 'FlipperPlugin',
react: 'React',
'react-dom': 'ReactDOM',
'react-dom/client': 'ReactDOMClient',
'react-is': 'ReactIs',
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',
};
const wrapRequire = (require) => new Proxy(require, {
apply(target, thisArg, argumentsList) {
const moduleName = argumentsList[0];
const replacementName = exports.pluginExternalModules[moduleName];
if (replacementName && replacementName in globalThis) {
return globalThis[replacementName];
}
return Reflect.apply(target, thisArg, argumentsList);
},
});
exports.wrapRequire = wrapRequire;
//# sourceMappingURL=plugin-external-modules.js.map