Remove babel transforms for flipper-server
Summary: Flipper server itself requires no babel transforms. We applied extra transforms only for the bundled plugins. However, we pack and ship all plugins in the /static folder. They are always available on the FS. Therefore we could stop bundling any plugins into flipper-server's source code. Reviewed By: lblasa Differential Revision: D38910251 fbshipit-source-id: b3e9fe5ae2ab69ce5579b01b6793ebf7e88baf66
This commit is contained in:
committed by
Facebook GitHub Bot
parent
218cb6abf2
commit
a67a4e5d0f
11
desktop/flipper-server/src/electronRequire.tsx
Normal file
11
desktop/flipper-server/src/electronRequire.tsx
Normal file
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
|
||||
// @ts-expect-error
|
||||
global.electronRequire = require;
|
||||
34
desktop/flipper-server/src/fb-stubs.tsx
Normal file
34
desktop/flipper-server/src/fb-stubs.tsx
Normal file
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
|
||||
import Module from 'module';
|
||||
|
||||
Module.prototype.require = new Proxy(Module.prototype.require, {
|
||||
apply(target, thisArg, argumentsList) {
|
||||
const name = argumentsList[0];
|
||||
|
||||
if (
|
||||
process.env.FLIPPER_FORCE_PUBLIC_BUILD !== 'true' &&
|
||||
typeof name === 'string' &&
|
||||
name.includes('fb-stubs')
|
||||
) {
|
||||
const replacement = name.replace('/fb-stubs/', '/fb/');
|
||||
try {
|
||||
return Reflect.apply(target, thisArg, [
|
||||
replacement,
|
||||
argumentsList.slice(1),
|
||||
]);
|
||||
} catch {
|
||||
return Reflect.apply(target, thisArg, argumentsList);
|
||||
}
|
||||
}
|
||||
|
||||
return Reflect.apply(target, thisArg, argumentsList);
|
||||
},
|
||||
});
|
||||
@@ -7,6 +7,8 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
import './fb-stubs';
|
||||
import './electronRequire';
|
||||
import process from 'process';
|
||||
import chalk from 'chalk';
|
||||
import path from 'path';
|
||||
|
||||
Reference in New Issue
Block a user