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
@@ -21,11 +21,21 @@ export interface GlobalObject {
|
|||||||
antdesign_icons: any;
|
antdesign_icons: 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 antdesign_icons: any;
|
||||||
|
}
|
||||||
|
|
||||||
export const setGlobalObject = (replacements: GlobalObject) => {
|
export const setGlobalObject = (replacements: GlobalObject) => {
|
||||||
const globalObject = (function (this: any) {
|
|
||||||
return this;
|
|
||||||
})();
|
|
||||||
for (const [name, module] of Object.entries(replacements)) {
|
for (const [name, module] of Object.entries(replacements)) {
|
||||||
globalObject[name] = module;
|
globalThis[name as keyof GlobalObject] = module;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ export function initializeRenderHost(
|
|||||||
flipperServer: FlipperServer,
|
flipperServer: FlipperServer,
|
||||||
flipperServerConfig: FlipperServerConfig,
|
flipperServerConfig: FlipperServerConfig,
|
||||||
) {
|
) {
|
||||||
FlipperRenderHostInstance = {
|
globalThis.FlipperRenderHostInstance = {
|
||||||
readTextFromClipboard() {
|
readTextFromClipboard() {
|
||||||
// TODO:
|
// TODO:
|
||||||
return undefined;
|
return undefined;
|
||||||
@@ -83,8 +83,6 @@ export function initializeRenderHost(
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getDefaultPluginsIndex() {
|
function getDefaultPluginsIndex() {
|
||||||
// @ts-ignore
|
// TODO: Fix me
|
||||||
// eslint-disable-next-line import/no-unresolved
|
return {};
|
||||||
const index = require('./defaultPlugins');
|
|
||||||
return index.default || index;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
"invariant": "^2.2.4",
|
"invariant": "^2.2.4",
|
||||||
"js-base64": "^3.7.2",
|
"js-base64": "^3.7.2",
|
||||||
"lodash.memoize": "^4.1.2",
|
"lodash.memoize": "^4.1.2",
|
||||||
"node-fetch": "^3.2.4",
|
"node-fetch": "2",
|
||||||
"node-forge": "^0.10.0",
|
"node-forge": "^0.10.0",
|
||||||
"open": "^8.3.0",
|
"open": "^8.3.0",
|
||||||
"openssl-wrapper": "^0.3.4",
|
"openssl-wrapper": "^0.3.4",
|
||||||
@@ -46,12 +46,13 @@
|
|||||||
"xdg-basedir": "^4.0.0"
|
"xdg-basedir": "^4.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@types/archiver": "^5.3.1",
|
||||||
"@types/express": "^4.17.13",
|
"@types/express": "^4.17.13",
|
||||||
"@types/http-proxy": "^1.17.8",
|
"@types/http-proxy": "^1.17.8",
|
||||||
"@types/archiver": "^5.3.1",
|
|
||||||
"@types/invariant": "^2.2.35",
|
"@types/invariant": "^2.2.35",
|
||||||
"@types/memorystream": "^0.3.0",
|
"@types/memorystream": "^0.3.0",
|
||||||
"@types/node": "^17.0.31",
|
"@types/node": "^17.0.31",
|
||||||
|
"@types/node-fetch": "2",
|
||||||
"@types/node-forge": "^0.10",
|
"@types/node-forge": "^0.10",
|
||||||
"@types/rimraf": "^3.0.2",
|
"@types/rimraf": "^3.0.2",
|
||||||
"@types/rsocket-core": "^0.0.7",
|
"@types/rsocket-core": "^0.0.7",
|
||||||
@@ -60,10 +61,10 @@
|
|||||||
"@types/tmp": "^0.2.3",
|
"@types/tmp": "^0.2.3",
|
||||||
"@types/which": "^2.0.1",
|
"@types/which": "^2.0.1",
|
||||||
"@types/ws": "^8.5.3",
|
"@types/ws": "^8.5.3",
|
||||||
"memorystream": "^0.3.1",
|
|
||||||
"exit-hook": "^2.1.1",
|
"exit-hook": "^2.1.1",
|
||||||
|
"express": "^4.17.3",
|
||||||
"http-proxy": "^1.18.1",
|
"http-proxy": "^1.18.1",
|
||||||
"express": "^4.17.3"
|
"memorystream": "^0.3.1"
|
||||||
},
|
},
|
||||||
"peerDependencies": {},
|
"peerDependencies": {},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import {FlipperServer, MarketplacePluginDetails} from 'flipper-common';
|
import {FlipperServer, MarketplacePluginDetails} from 'flipper-common';
|
||||||
|
import fetch from 'node-fetch';
|
||||||
|
|
||||||
export async function loadAvailablePlugins(
|
export async function loadAvailablePlugins(
|
||||||
server: FlipperServer,
|
server: FlipperServer,
|
||||||
|
|||||||
@@ -8,9 +8,5 @@
|
|||||||
* @format
|
* @format
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* eslint-disable */
|
// eslint-disable-next-line import/no-unresolved
|
||||||
|
require('./lib/index.js');
|
||||||
// flipper-server uses the same infra & babel transforms as Electron
|
|
||||||
// to make sure our own sources are bundled up, but node modules arent
|
|
||||||
global.electronRequire = require;
|
|
||||||
require('./dist/index.js');
|
|
||||||
|
|||||||
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
|
* @format
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import './fb-stubs';
|
||||||
|
import './electronRequire';
|
||||||
import process from 'process';
|
import process from 'process';
|
||||||
import chalk from 'chalk';
|
import chalk from 'chalk';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
|||||||
@@ -16,8 +16,9 @@ import {
|
|||||||
genMercurialRevision,
|
genMercurialRevision,
|
||||||
getVersionNumber,
|
getVersionNumber,
|
||||||
prepareDefaultPlugins,
|
prepareDefaultPlugins,
|
||||||
prepareHeadlessPlugins,
|
buildHeadlessPlugins,
|
||||||
moveServerSourceMaps,
|
moveServerSourceMaps,
|
||||||
|
buildServerAddOns,
|
||||||
} from './build-utils';
|
} from './build-utils';
|
||||||
import {defaultPluginsDir, distDir, serverDir, staticDir} from './paths';
|
import {defaultPluginsDir, distDir, serverDir, staticDir} from './paths';
|
||||||
import isFB from './isFB';
|
import isFB from './isFB';
|
||||||
@@ -217,7 +218,7 @@ async function copyStaticResources(outDir: string, versionNumber: string) {
|
|||||||
console.log(`⚙️ Copying package resources...`);
|
console.log(`⚙️ Copying package resources...`);
|
||||||
|
|
||||||
// static folder, without the things that are only for Electron
|
// static folder, without the things that are only for Electron
|
||||||
const packageFilesToCopy = ['README.md', 'package.json', 'server.js', 'dist'];
|
const packageFilesToCopy = ['README.md', 'package.json', 'server.js', 'lib'];
|
||||||
|
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
packageFilesToCopy.map((e) =>
|
packageFilesToCopy.map((e) =>
|
||||||
@@ -352,8 +353,9 @@ async function buildServerRelease() {
|
|||||||
// create plugin output dir
|
// create plugin output dir
|
||||||
await fs.mkdirp(path.join(dir, 'static', 'defaultPlugins'));
|
await fs.mkdirp(path.join(dir, 'static', 'defaultPlugins'));
|
||||||
|
|
||||||
await prepareDefaultPlugins(argv.channel === 'insiders');
|
await prepareDefaultPlugins(argv.channel === 'insiders', true);
|
||||||
await prepareHeadlessPlugins();
|
await buildServerAddOns(false);
|
||||||
|
await buildHeadlessPlugins(false);
|
||||||
await compileServerMain(false);
|
await compileServerMain(false);
|
||||||
await copyStaticResources(dir, versionNumber);
|
await copyStaticResources(dir, versionNumber);
|
||||||
await downloadIcons(path.join(dir, 'static'));
|
await downloadIcons(path.join(dir, 'static'));
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import MetroResolver from 'metro-resolver';
|
|||||||
import tmp from 'tmp';
|
import tmp from 'tmp';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import fs from 'fs-extra';
|
import fs from 'fs-extra';
|
||||||
import {spawn} from 'promisify-child-process';
|
import {spawn, exec} from 'promisify-child-process';
|
||||||
import {
|
import {
|
||||||
getWatchFolders,
|
getWatchFolders,
|
||||||
runBuild,
|
runBuild,
|
||||||
@@ -37,7 +37,6 @@ import {
|
|||||||
rootDir,
|
rootDir,
|
||||||
browserUiDir,
|
browserUiDir,
|
||||||
serverCoreDir,
|
serverCoreDir,
|
||||||
serverCompanionDir,
|
|
||||||
} from './paths';
|
} from './paths';
|
||||||
import pFilter from 'p-filter';
|
import pFilter from 'p-filter';
|
||||||
import child from 'child_process';
|
import child from 'child_process';
|
||||||
@@ -76,7 +75,10 @@ export function die(err: Error) {
|
|||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function prepareDefaultPlugins(isInsidersBuild: boolean = false) {
|
export async function prepareDefaultPlugins(
|
||||||
|
isInsidersBuild: boolean = false,
|
||||||
|
flipperServerBuild = false,
|
||||||
|
) {
|
||||||
console.log(
|
console.log(
|
||||||
`⚙️ Preparing default plugins (isInsidersBuild=${isInsidersBuild})...`,
|
`⚙️ Preparing default plugins (isInsidersBuild=${isInsidersBuild})...`,
|
||||||
);
|
);
|
||||||
@@ -105,18 +107,29 @@ export async function prepareDefaultPlugins(isInsidersBuild: boolean = false) {
|
|||||||
await buildDefaultPlugins(defaultPlugins);
|
await buildDefaultPlugins(defaultPlugins);
|
||||||
await generateDefaultPluginEntryPoints([]); // calling it here just to generate empty indexes
|
await generateDefaultPluginEntryPoints([]); // calling it here just to generate empty indexes
|
||||||
} else {
|
} else {
|
||||||
await generateDefaultPluginEntryPoints(defaultPlugins);
|
await generateDefaultPluginEntryPoints(
|
||||||
|
defaultPlugins,
|
||||||
|
flipperServerBuild,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log('✅ Prepared default plugins.');
|
console.log('✅ Prepared default plugins.');
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function prepareHeadlessPlugins() {
|
export async function buildHeadlessPlugins(dev: boolean) {
|
||||||
console.log(`⚙️ Preparing headless plugins...`);
|
console.log(`⚙️ Building headless plugins...`);
|
||||||
const sourcePlugins = await getSourcePlugins();
|
const sourcePlugins = await getSourcePlugins();
|
||||||
const headlessPlugins = sourcePlugins.filter((p) => p.headless);
|
const headlessPlugins = sourcePlugins.filter((p) => p.headless);
|
||||||
await generateHeadlessPluginEntryPoints(headlessPlugins);
|
await Promise.all(headlessPlugins.map((p) => runBuild(p.dir, dev)));
|
||||||
console.log('✅ Prepared headless plugins.');
|
console.log('✅ Built headless plugins.');
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function buildServerAddOns(dev: boolean) {
|
||||||
|
console.log(`⚙️ Building plugins with server add-ons plugins...`);
|
||||||
|
const sourcePlugins = await getSourcePlugins();
|
||||||
|
const serverAddOns = sourcePlugins.filter((p) => p.serverAddOnSource);
|
||||||
|
await Promise.all(serverAddOns.map((p) => runBuild(p.dir, dev)));
|
||||||
|
console.log('✅ Built plugins with server add-ons plugins.');
|
||||||
}
|
}
|
||||||
|
|
||||||
function getGeneratedIndex(pluginRequires: string) {
|
function getGeneratedIndex(pluginRequires: string) {
|
||||||
@@ -142,6 +155,7 @@ function getGeneratedIndex(pluginRequires: string) {
|
|||||||
|
|
||||||
async function generateDefaultPluginEntryPoints(
|
async function generateDefaultPluginEntryPoints(
|
||||||
defaultPlugins: InstalledPluginDetails[],
|
defaultPlugins: InstalledPluginDetails[],
|
||||||
|
flipperServerBuild?: boolean,
|
||||||
) {
|
) {
|
||||||
console.log(
|
console.log(
|
||||||
`⚙️ Generating entry points for ${defaultPlugins.length} bundled plugins...`,
|
`⚙️ Generating entry points for ${defaultPlugins.length} bundled plugins...`,
|
||||||
@@ -181,9 +195,9 @@ async function generateDefaultPluginEntryPoints(
|
|||||||
generatedIndex,
|
generatedIndex,
|
||||||
);
|
);
|
||||||
|
|
||||||
const serverAddOns = defaultPlugins.filter(
|
const serverAddOns = flipperServerBuild
|
||||||
({serverAddOnSource}) => !!serverAddOnSource,
|
? []
|
||||||
);
|
: defaultPlugins.filter(({serverAddOnSource}) => !!serverAddOnSource);
|
||||||
const serverAddOnRequires = serverAddOns
|
const serverAddOnRequires = serverAddOns
|
||||||
.map(
|
.map(
|
||||||
(x) =>
|
(x) =>
|
||||||
@@ -200,28 +214,6 @@ async function generateDefaultPluginEntryPoints(
|
|||||||
console.log('✅ Generated bundled plugin entry points.');
|
console.log('✅ Generated bundled plugin entry points.');
|
||||||
}
|
}
|
||||||
|
|
||||||
async function generateHeadlessPluginEntryPoints(
|
|
||||||
headlessPlugins: InstalledPluginDetails[],
|
|
||||||
) {
|
|
||||||
console.log(
|
|
||||||
`⚙️ Generating entry points for ${headlessPlugins.length} headless plugins...`,
|
|
||||||
);
|
|
||||||
const headlessRequires = headlessPlugins
|
|
||||||
.map(
|
|
||||||
(x) =>
|
|
||||||
` '${x.name}': tryRequire('${x.name}', () => require('${x.name}'))`,
|
|
||||||
)
|
|
||||||
.join(',\n');
|
|
||||||
const generatedIndexHeadless = getGeneratedIndex(headlessRequires);
|
|
||||||
await fs.ensureDir(path.join(serverCompanionDir, 'src', 'defaultPlugins'));
|
|
||||||
await fs.writeFile(
|
|
||||||
path.join(serverCompanionDir, 'src', 'defaultPlugins', 'index.tsx'),
|
|
||||||
generatedIndexHeadless,
|
|
||||||
);
|
|
||||||
|
|
||||||
console.log('✅ Generated headless plugin entry points.');
|
|
||||||
}
|
|
||||||
|
|
||||||
async function buildDefaultPlugins(defaultPlugins: InstalledPluginDetails[]) {
|
async function buildDefaultPlugins(defaultPlugins: InstalledPluginDetails[]) {
|
||||||
if (process.env.FLIPPER_NO_REBUILD_PLUGINS) {
|
if (process.env.FLIPPER_NO_REBUILD_PLUGINS) {
|
||||||
console.log(
|
console.log(
|
||||||
@@ -468,40 +460,7 @@ export function genMercurialRevision(): Promise<string | null> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function compileServerMain(dev: boolean) {
|
export async function compileServerMain(dev: boolean) {
|
||||||
await fs.promises.mkdir(path.join(serverDir, 'dist'), {recursive: true});
|
await exec(`cd ${serverDir} && yarn build`);
|
||||||
const out = path.join(serverDir, 'dist', 'index.js');
|
|
||||||
console.log('⚙️ Compiling server bundle...');
|
|
||||||
const config = Object.assign({}, await Metro.loadConfig(), {
|
|
||||||
reporter: {update: () => {}},
|
|
||||||
projectRoot: rootDir,
|
|
||||||
transformer: {
|
|
||||||
babelTransformerPath: path.join(
|
|
||||||
babelTransformationsDir,
|
|
||||||
'transform-server-' + (dev ? 'dev' : 'prod'),
|
|
||||||
),
|
|
||||||
...minifierConfig,
|
|
||||||
},
|
|
||||||
resolver: {
|
|
||||||
// no 'mjs' / 'module'; it caused issues
|
|
||||||
sourceExts: ['tsx', 'ts', 'js', 'json', 'cjs'],
|
|
||||||
resolverMainFields: ['flipperBundlerEntry', 'main'],
|
|
||||||
resolveRequest(context: any, moduleName: string, ...rest: any[]) {
|
|
||||||
assertSaneImport(context, moduleName);
|
|
||||||
return defaultResolve(context, moduleName, ...rest);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
await Metro.runBuild(config, {
|
|
||||||
platform: 'node',
|
|
||||||
entry: path.join(serverDir, 'src', 'index.tsx'),
|
|
||||||
out,
|
|
||||||
dev,
|
|
||||||
minify: false, // !dev,
|
|
||||||
sourceMap: true,
|
|
||||||
sourceMapUrl: dev ? 'index.map' : undefined,
|
|
||||||
inlineSourceMap: false,
|
|
||||||
resetCache: !dev,
|
|
||||||
});
|
|
||||||
console.log('✅ Compiled server bundle.');
|
console.log('✅ Compiled server bundle.');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -611,7 +570,6 @@ export async function launchServer(
|
|||||||
if (proc) {
|
if (proc) {
|
||||||
console.log('⚙️ Killing old flipper-server...');
|
console.log('⚙️ Killing old flipper-server...');
|
||||||
proc.kill(9);
|
proc.kill(9);
|
||||||
await sleep(1000);
|
|
||||||
}
|
}
|
||||||
console.log('⚙️ Launching flipper-server...');
|
console.log('⚙️ Launching flipper-server...');
|
||||||
proc = child.spawn(
|
proc = child.spawn(
|
||||||
|
|||||||
@@ -9,11 +9,9 @@
|
|||||||
|
|
||||||
/* eslint-disable flipper/no-console-error-without-context */
|
/* eslint-disable flipper/no-console-error-without-context */
|
||||||
|
|
||||||
import {prepareDefaultPlugins, prepareHeadlessPlugins} from './build-utils';
|
import {prepareDefaultPlugins} from './build-utils';
|
||||||
|
|
||||||
Promise.all([prepareDefaultPlugins(), prepareHeadlessPlugins()]).catch(
|
prepareDefaultPlugins().catch((err) => {
|
||||||
(err) => {
|
console.error(err);
|
||||||
console.error(err);
|
process.exit(1);
|
||||||
process.exit(1);
|
});
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import {hostname} from 'os';
|
|||||||
import {
|
import {
|
||||||
compileMain,
|
compileMain,
|
||||||
prepareDefaultPlugins,
|
prepareDefaultPlugins,
|
||||||
prepareHeadlessPlugins,
|
buildHeadlessPlugins,
|
||||||
} from './build-utils';
|
} from './build-utils';
|
||||||
import Watchman from './watchman';
|
import Watchman from './watchman';
|
||||||
// @ts-ignore no typings for metro
|
// @ts-ignore no typings for metro
|
||||||
@@ -445,7 +445,7 @@ function checkDevServer() {
|
|||||||
await prepareDefaultPlugins(
|
await prepareDefaultPlugins(
|
||||||
process.env.FLIPPER_RELEASE_CHANNEL === 'insiders',
|
process.env.FLIPPER_RELEASE_CHANNEL === 'insiders',
|
||||||
);
|
);
|
||||||
await prepareHeadlessPlugins();
|
await buildHeadlessPlugins(true);
|
||||||
await ensurePluginFoldersWatchable();
|
await ensurePluginFoldersWatchable();
|
||||||
const port = await detect(DEFAULT_PORT);
|
const port = await detect(DEFAULT_PORT);
|
||||||
const {app, server} = await startAssetServer(port);
|
const {app, server} = await startAssetServer(port);
|
||||||
|
|||||||
@@ -14,7 +14,8 @@ import {
|
|||||||
compileServerMain,
|
compileServerMain,
|
||||||
launchServer,
|
launchServer,
|
||||||
prepareDefaultPlugins,
|
prepareDefaultPlugins,
|
||||||
prepareHeadlessPlugins,
|
buildHeadlessPlugins,
|
||||||
|
buildServerAddOns,
|
||||||
} from './build-utils';
|
} from './build-utils';
|
||||||
import Watchman from './watchman';
|
import Watchman from './watchman';
|
||||||
import isFB from './isFB';
|
import isFB from './isFB';
|
||||||
@@ -59,11 +60,6 @@ const argv = yargs
|
|||||||
'[FB-internal only] Will force using public sources only, to be able to iterate quickly on the public version. If sources are checked out from GitHub this is already the default. Setting env var "FLIPPER_FORCE_PUBLIC_BUILD" is equivalent.',
|
'[FB-internal only] Will force using public sources only, to be able to iterate quickly on the public version. If sources are checked out from GitHub this is already the default. Setting env var "FLIPPER_FORCE_PUBLIC_BUILD" is equivalent.',
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
},
|
},
|
||||||
open: {
|
|
||||||
describe: 'Open Flipper in the default browser after starting',
|
|
||||||
type: 'boolean',
|
|
||||||
default: true,
|
|
||||||
},
|
|
||||||
tcp: {
|
tcp: {
|
||||||
describe: 'Enable TCP connections on flipper-server.',
|
describe: 'Enable TCP connections on flipper-server.',
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
@@ -136,7 +132,7 @@ let startCount = 0;
|
|||||||
async function restartServer() {
|
async function restartServer() {
|
||||||
try {
|
try {
|
||||||
await compileServerMain(true);
|
await compileServerMain(true);
|
||||||
await launchServer(true, argv.open && ++startCount === 1, argv.tcp); // only open on the first time
|
await launchServer(true, ++startCount === 1, argv.tcp); // only open on the first time
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(
|
console.error(
|
||||||
chalk.red(
|
chalk.red(
|
||||||
@@ -190,12 +186,14 @@ async function startWatchChanges() {
|
|||||||
}
|
}
|
||||||
await prepareDefaultPlugins(
|
await prepareDefaultPlugins(
|
||||||
process.env.FLIPPER_RELEASE_CHANNEL === 'insiders',
|
process.env.FLIPPER_RELEASE_CHANNEL === 'insiders',
|
||||||
|
true,
|
||||||
);
|
);
|
||||||
await prepareHeadlessPlugins();
|
await buildHeadlessPlugins(true);
|
||||||
|
await buildServerAddOns(true);
|
||||||
|
|
||||||
// watch
|
|
||||||
await startWatchChanges();
|
|
||||||
await ensurePluginFoldersWatchable();
|
await ensurePluginFoldersWatchable();
|
||||||
// builds and starts
|
// builds and starts
|
||||||
await restartServer();
|
await restartServer();
|
||||||
|
// watch
|
||||||
|
await startWatchChanges();
|
||||||
})();
|
})();
|
||||||
|
|||||||
4
desktop/types/flipperGlobals.d.ts
vendored
4
desktop/types/flipperGlobals.d.ts
vendored
@@ -15,4 +15,8 @@ declare const electronRequire: {
|
|||||||
cache: {[module: string]: any};
|
cache: {[module: string]: any};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
declare module globalThis {
|
||||||
|
// eslint-disable-next-line no-var
|
||||||
|
var FlipperRenderHostInstance: any /* RenderHost */;
|
||||||
|
}
|
||||||
declare let FlipperRenderHostInstance: any /* RenderHost */;
|
declare let FlipperRenderHostInstance: any /* RenderHost */;
|
||||||
|
|||||||
@@ -3469,6 +3469,14 @@
|
|||||||
"@types/node" "*"
|
"@types/node" "*"
|
||||||
form-data "^3.0.0"
|
form-data "^3.0.0"
|
||||||
|
|
||||||
|
"@types/node-fetch@2":
|
||||||
|
version "2.6.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.6.2.tgz#d1a9c5fd049d9415dce61571557104dec3ec81da"
|
||||||
|
integrity sha512-DHqhlq5jeESLy19TYhLakJ07kNumXWjcDdxXsLUMJZ6ue8VZJj4kLPQVE/2mdHh3xZziNF1xppu5lwmS53HR+A==
|
||||||
|
dependencies:
|
||||||
|
"@types/node" "*"
|
||||||
|
form-data "^3.0.0"
|
||||||
|
|
||||||
"@types/node-fetch@^2.5.12":
|
"@types/node-fetch@^2.5.12":
|
||||||
version "2.5.12"
|
version "2.5.12"
|
||||||
resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.5.12.tgz#8a6f779b1d4e60b7a57fb6fd48d84fb545b9cc66"
|
resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.5.12.tgz#8a6f779b1d4e60b7a57fb6fd48d84fb545b9cc66"
|
||||||
@@ -5919,11 +5927,6 @@ dashdash@^1.12.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
assert-plus "^1.0.0"
|
assert-plus "^1.0.0"
|
||||||
|
|
||||||
data-uri-to-buffer@^4.0.0:
|
|
||||||
version "4.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/data-uri-to-buffer/-/data-uri-to-buffer-4.0.0.tgz#b5db46aea50f6176428ac05b73be39a57701a64b"
|
|
||||||
integrity sha512-Vr3mLBA8qWmcuschSLAOogKgQ/Jwxulv3RNE4FXnYWRGujzrRWQI4m12fQqRkwX06C0KanhLr4hK+GydchZsaA==
|
|
||||||
|
|
||||||
data-urls@^1.1.0:
|
data-urls@^1.1.0:
|
||||||
version "1.1.0"
|
version "1.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/data-urls/-/data-urls-1.1.0.tgz#15ee0582baa5e22bb59c77140da8f9c76963bbfe"
|
resolved "https://registry.yarnpkg.com/data-urls/-/data-urls-1.1.0.tgz#15ee0582baa5e22bb59c77140da8f9c76963bbfe"
|
||||||
@@ -7281,14 +7284,6 @@ fd-slicer@~1.1.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
pend "~1.2.0"
|
pend "~1.2.0"
|
||||||
|
|
||||||
fetch-blob@^3.1.2, fetch-blob@^3.1.4:
|
|
||||||
version "3.1.4"
|
|
||||||
resolved "https://registry.yarnpkg.com/fetch-blob/-/fetch-blob-3.1.4.tgz#e8c6567f80ad7fc22fd302e7dcb72bafde9c1717"
|
|
||||||
integrity sha512-Eq5Xv5+VlSrYWEqKrusxY1C3Hm/hjeAsCGVG3ft7pZahlUAChpGZT/Ms1WmSLnEAisEXszjzu/s+ce6HZB2VHA==
|
|
||||||
dependencies:
|
|
||||||
node-domexception "^1.0.0"
|
|
||||||
web-streams-polyfill "^3.0.3"
|
|
||||||
|
|
||||||
figures@^3.0.0:
|
figures@^3.0.0:
|
||||||
version "3.1.0"
|
version "3.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/figures/-/figures-3.1.0.tgz#4b198dd07d8d71530642864af2d45dd9e459c4ec"
|
resolved "https://registry.yarnpkg.com/figures/-/figures-3.1.0.tgz#4b198dd07d8d71530642864af2d45dd9e459c4ec"
|
||||||
@@ -7494,13 +7489,6 @@ form-data@~2.3.2:
|
|||||||
combined-stream "^1.0.6"
|
combined-stream "^1.0.6"
|
||||||
mime-types "^2.1.12"
|
mime-types "^2.1.12"
|
||||||
|
|
||||||
formdata-polyfill@^4.0.10:
|
|
||||||
version "4.0.10"
|
|
||||||
resolved "https://registry.yarnpkg.com/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz#24807c31c9d402e002ab3d8c720144ceb8848423"
|
|
||||||
integrity sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==
|
|
||||||
dependencies:
|
|
||||||
fetch-blob "^3.1.2"
|
|
||||||
|
|
||||||
forwarded@0.2.0:
|
forwarded@0.2.0:
|
||||||
version "0.2.0"
|
version "0.2.0"
|
||||||
resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.2.0.tgz#2269936428aad4c15c7ebe9779a84bf0b2a81811"
|
resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.2.0.tgz#2269936428aad4c15c7ebe9779a84bf0b2a81811"
|
||||||
@@ -10747,31 +10735,17 @@ node-dir@^0.1.17:
|
|||||||
dependencies:
|
dependencies:
|
||||||
minimatch "^3.0.2"
|
minimatch "^3.0.2"
|
||||||
|
|
||||||
node-domexception@^1.0.0:
|
node-fetch@2, node-fetch@^2.2.0, node-fetch@^2.6.0, node-fetch@^2.6.1, node-fetch@^2.6.6, node-fetch@^2.6.7:
|
||||||
version "1.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/node-domexception/-/node-domexception-1.0.0.tgz#6888db46a1f71c0b76b3f7555016b63fe64766e5"
|
|
||||||
integrity sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==
|
|
||||||
|
|
||||||
node-fetch@2.6.0:
|
|
||||||
version "2.6.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd"
|
|
||||||
integrity sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==
|
|
||||||
|
|
||||||
node-fetch@^2.2.0, node-fetch@^2.6.0, node-fetch@^2.6.1, node-fetch@^2.6.6, node-fetch@^2.6.7:
|
|
||||||
version "2.6.7"
|
version "2.6.7"
|
||||||
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad"
|
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad"
|
||||||
integrity sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==
|
integrity sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
whatwg-url "^5.0.0"
|
whatwg-url "^5.0.0"
|
||||||
|
|
||||||
node-fetch@^3.2.4:
|
node-fetch@2.6.0:
|
||||||
version "3.2.4"
|
version "2.6.0"
|
||||||
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-3.2.4.tgz#3fbca2d8838111048232de54cb532bd3cf134947"
|
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd"
|
||||||
integrity sha512-WvYJRN7mMyOLurFR2YpysQGuwYrJN+qrrpHjJDuKMcSPdfFccRUla/kng2mz6HWSBxJcqPbvatS6Gb4RhOzCJw==
|
integrity sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==
|
||||||
dependencies:
|
|
||||||
data-uri-to-buffer "^4.0.0"
|
|
||||||
fetch-blob "^3.1.4"
|
|
||||||
formdata-polyfill "^4.0.10"
|
|
||||||
|
|
||||||
node-forge@^0.10.0, node-forge@^0.7.1, node-forge@^1.0.6:
|
node-forge@^0.10.0, node-forge@^0.7.1, node-forge@^1.0.6:
|
||||||
version "1.3.1"
|
version "1.3.1"
|
||||||
@@ -14380,11 +14354,6 @@ wcwidth@^1.0.1:
|
|||||||
dependencies:
|
dependencies:
|
||||||
defaults "^1.0.3"
|
defaults "^1.0.3"
|
||||||
|
|
||||||
web-streams-polyfill@^3.0.3:
|
|
||||||
version "3.2.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-3.2.0.tgz#a6b74026b38e4885869fb5c589e90b95ccfc7965"
|
|
||||||
integrity sha512-EqPmREeOzttaLRm5HS7io98goBgZ7IVz79aDvqjD0kYXLtFZTc0T/U6wHTPKyIjb+MdN7DFIIX6hgdBEpWmfPA==
|
|
||||||
|
|
||||||
webidl-conversions@^3.0.0:
|
webidl-conversions@^3.0.0:
|
||||||
version "3.0.1"
|
version "3.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871"
|
resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871"
|
||||||
|
|||||||
Reference in New Issue
Block a user