Make sure antd is used from Flipper
Summary: Fix build job that didn't include require rewrites for antd Reviewed By: timur-valiev Differential Revision: D26311554 fbshipit-source-id: 473a9c7d343e4534a33e5938ea27667f7795d8ac
This commit is contained in:
committed by
Facebook GitHub Bot
parent
949b57b473
commit
9987c8ee89
@@ -12,6 +12,7 @@ const fbjs = require('eslint-config-fbjs');
|
|||||||
// enforces copy-right header and @format directive to be present in every file
|
// enforces copy-right header and @format directive to be present in every file
|
||||||
const pattern = /^\*\r?\n[\S\s]*Facebook[\S\s]* \* @format\r?\n/;
|
const pattern = /^\*\r?\n[\S\s]*Facebook[\S\s]* \* @format\r?\n/;
|
||||||
|
|
||||||
|
// This list should match the replacements defined in `replace-flipper-requires.ts` and `dispatcher/plugins.tsx`
|
||||||
const builtInModules = [
|
const builtInModules = [
|
||||||
'fb-qpl-xplat',
|
'fb-qpl-xplat',
|
||||||
'flipper',
|
'flipper',
|
||||||
@@ -24,6 +25,7 @@ const builtInModules = [
|
|||||||
'antd',
|
'antd',
|
||||||
'immer',
|
'immer',
|
||||||
'@emotion/styled',
|
'@emotion/styled',
|
||||||
|
'@ant-design/icons',
|
||||||
];
|
];
|
||||||
|
|
||||||
const prettierConfig = require('./.prettierrc.json');
|
const prettierConfig = require('./.prettierrc.json');
|
||||||
|
|||||||
@@ -39,7 +39,10 @@ import {tryCatchReportPluginFailures, reportUsage} from '../utils/metrics';
|
|||||||
import * as FlipperPluginSDK from 'flipper-plugin';
|
import * as FlipperPluginSDK from 'flipper-plugin';
|
||||||
import {_SandyPluginDefinition} from 'flipper-plugin';
|
import {_SandyPluginDefinition} from 'flipper-plugin';
|
||||||
import loadDynamicPlugins from '../utils/loadDynamicPlugins';
|
import loadDynamicPlugins from '../utils/loadDynamicPlugins';
|
||||||
import Immer from 'immer';
|
import * as Immer from 'immer';
|
||||||
|
import * as antd from 'antd';
|
||||||
|
import * as emotion_styled from '@emotion/styled';
|
||||||
|
import * as antdesign_icons from '@ant-design/icons';
|
||||||
|
|
||||||
// eslint-disable-next-line import/no-unresolved
|
// eslint-disable-next-line import/no-unresolved
|
||||||
import getDefaultPluginsIndex from '../utils/getDefaultPluginsIndex';
|
import getDefaultPluginsIndex from '../utils/getDefaultPluginsIndex';
|
||||||
@@ -49,12 +52,17 @@ let defaultPluginsIndex: any = null;
|
|||||||
export default async (store: Store, logger: Logger) => {
|
export default async (store: Store, logger: Logger) => {
|
||||||
// expose Flipper and exact globally for dynamically loaded plugins
|
// expose Flipper and exact globally for dynamically loaded plugins
|
||||||
const globalObject: any = typeof window === 'undefined' ? global : window;
|
const globalObject: any = typeof window === 'undefined' ? global : window;
|
||||||
|
|
||||||
|
// this list should match `replace-flipper-requires.tsx` and the `builtInModules` in `desktop/.eslintrc`
|
||||||
globalObject.React = React;
|
globalObject.React = React;
|
||||||
globalObject.ReactDOM = ReactDOM;
|
globalObject.ReactDOM = ReactDOM;
|
||||||
globalObject.Flipper = require('../index');
|
globalObject.Flipper = require('../index');
|
||||||
globalObject.adbkit = adbkit;
|
globalObject.adbkit = adbkit;
|
||||||
globalObject.FlipperPlugin = FlipperPluginSDK;
|
globalObject.FlipperPlugin = FlipperPluginSDK;
|
||||||
globalObject.Immer = Immer;
|
globalObject.Immer = Immer;
|
||||||
|
globalObject.antd = antd;
|
||||||
|
globalObject.emotion_styled = emotion_styled;
|
||||||
|
globalObject.antdesign_icons = antdesign_icons;
|
||||||
|
|
||||||
const gatekeepedPlugins: Array<ActivatablePluginDetails> = [];
|
const gatekeepedPlugins: Array<ActivatablePluginDetails> = [];
|
||||||
const disabledPlugins: Array<ActivatablePluginDetails> = [];
|
const disabledPlugins: Array<ActivatablePluginDetails> = [];
|
||||||
|
|||||||
@@ -15,13 +15,17 @@ import {
|
|||||||
} from '@babel/types';
|
} from '@babel/types';
|
||||||
import {NodePath} from '@babel/traverse';
|
import {NodePath} from '@babel/traverse';
|
||||||
|
|
||||||
|
// This list should match `dispatcher/plugins.tsx` and `builtInModules` in `desktop/.eslintrc.js`
|
||||||
const requireReplacements: any = {
|
const requireReplacements: any = {
|
||||||
flipper: 'global.Flipper',
|
flipper: 'global.Flipper',
|
||||||
'flipper-plugin': 'global.FlipperPlugin',
|
'flipper-plugin': 'global.FlipperPlugin',
|
||||||
react: 'global.React',
|
react: 'global.React',
|
||||||
'react-dom': 'global.ReactDOM',
|
'react-dom': 'global.ReactDOM',
|
||||||
adbkit: 'global.adbkit',
|
adbkit: 'global.adbkit',
|
||||||
|
antd: 'global.antd',
|
||||||
immer: 'global.Immer',
|
immer: 'global.Immer',
|
||||||
|
'@emotion/styled': 'global.emotion_styled',
|
||||||
|
'@ant-design/icons': 'global.antdesign_icons',
|
||||||
};
|
};
|
||||||
|
|
||||||
export function tryReplaceFlipperRequire(path: NodePath<CallExpression>) {
|
export function tryReplaceFlipperRequire(path: NodePath<CallExpression>) {
|
||||||
|
|||||||
Reference in New Issue
Block a user