remove window dependency

Summary:
Fixes required to be able to run Flipper in node.js:
* Adds checks if the `window`-object exists before using it, to allow running in node.
* Imports from within Flipper should directly reference the file they are requiring instead of `import from 'flipper'`. This was done in most of the places. Fixed a few occurrences where this wasn't the case. This is to prevent cyclic dependencies in node.
* shared packages (React, ReactDOM and Flipper) were exposed on the `window` before, changed this to `global` as this works in browser and node.
* Adds some missing methods to our electron stubs (used for testing and headless Flipper)

Reviewed By: passy

Differential Revision: D13786577

fbshipit-source-id: 145d560f1446e7d0bdec2acd8dd54dae983d7b36
This commit is contained in:
Daniel Büchele
2019-01-25 12:10:31 -08:00
committed by Facebook Github Bot
parent 7ac6a09af1
commit 771be72b3f
15 changed files with 77 additions and 46 deletions

View File

@@ -13,7 +13,7 @@ import {
maybeSnapTop,
SNAP_SIZE,
} from '../../utils/snap.js';
import {styled} from '../../ui';
import styled from '../styled/index.js';
const invariant = require('invariant');
const React = require('react');

View File

@@ -4,7 +4,7 @@
* LICENSE file in the root directory of this source tree.
* @format
*/
import {Link} from 'flipper';
import Link from '../Link';
import type {DataInspectorSetValue} from './DataInspector.js';
import {PureComponent} from 'react';
import styled from '../../styled/index.js';

View File

@@ -13,7 +13,7 @@ import Panel from '../Panel.js';
import ManagedDataInspector from '../data-inspector/ManagedDataInspector.js';
import {Component} from 'react';
import {Console} from '../console';
import {GK} from 'flipper';
import GK from '../../../fb-stubs/GK';
const deepEqual = require('deep-equal');