Initialise flipper-ui-browser with socket connection

Summary:
This diff sets up the socket connection between flipper-browser and flipper-server, and verifies that the initial UI initialisation work (e.g. `get-config` command works). The initial RenderHost is initialised as well based on the config and browser APIs.

Note that flipper-ui-core itself isn't started yet, as that has still a plethora of node imports, so Metro will correctly refuse to bundle

Not in this diff
* remove Node usage from flipper-ui-core
* implement all RenderHost APIs

Reviewed By: aigoncharov

Differential Revision: D32644074

fbshipit-source-id: 2c8065caf0191771a3867b69a431ca50eeb7a5a3
This commit is contained in:
Michel Weststrate
2021-12-08 04:25:28 -08:00
committed by Facebook GitHub Bot
parent 29a907c733
commit 5d45bd741b
20 changed files with 570 additions and 45 deletions

View File

@@ -10,6 +10,7 @@
window.flipperConfig = {
theme: 'light',
entryPoint: 'flipper-ui-browser/src/index-fast-refresh.bundle?platform=web&dev=true&minify=false',
debug: true,
}
</script>
<style>
@@ -62,7 +63,12 @@
(function() {
// FIXME: needed to make Metro work
window.global = window;
global.electronRequire = window.require;
// global.electronRequire = function(path) {
// // debugger;
// // throw(new Error("Tried to require: " + path));
// console.error("Tried to require " + path);
// return {};
// };
let suppressErrors = false;
@@ -87,6 +93,10 @@
box.textContent = text;
}
window.flipperShowError = openError;
window.flipperHideError = () => {
const box = document.querySelector('.__infinity-dev-box-error');
box.setAttribute('hidden', true);
}
// load correct theme (n.b. this doesn't handle system value specifically, will assume light in such cases)
try {