mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
[DevTools] Add DevTools forked Feature flags (#18994)
Also resolve an uncaught error in extension build (#18843). Co-authored-by: Brian Vaughn <brian.david.vaughn@gmail.com> Co-authored-by: Brian Vaughn <bvaughn@fb.com>
This commit is contained in:
co-authored by
Brian Vaughn
Brian Vaughn
parent
4890779729
commit
7e405d458d
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow
|
||||
*/
|
||||
|
||||
/************************************************************************
|
||||
* This file is forked between different DevTools implementations.
|
||||
* It should never be imported directly!
|
||||
* It should always be imported from "react-devtools-feature-flags".
|
||||
************************************************************************/
|
||||
|
||||
// TODO Add feature flags here...
|
||||
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow
|
||||
*/
|
||||
|
||||
/************************************************************************
|
||||
* This file is forked between different DevTools implementations.
|
||||
* It should never be imported directly!
|
||||
* It should always be imported from "react-devtools-feature-flags".
|
||||
************************************************************************/
|
||||
|
||||
// TODO Add feature flags here...
|
||||
|
||||
/************************************************************************
|
||||
* Do not edit the code below.
|
||||
* It ensures this fork exports the same types as the default flags file.
|
||||
************************************************************************/
|
||||
|
||||
import typeof * as FeatureFlagsType from './DevToolsFeatureFlags.default';
|
||||
import typeof * as ExportsType from './DevToolsFeatureFlags.extension';
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
type Check<_X, Y: _X, X: Y = _X> = null;
|
||||
// eslint-disable-next-line no-unused-expressions
|
||||
(null: Check<ExportsType, FeatureFlagsType>);
|
||||
+5
-1
@@ -172,7 +172,11 @@ export function installHook(target: any): DevToolsHook | null {
|
||||
// In that case, we'll patch later (when the frontend attaches).
|
||||
//
|
||||
// Don't patch in test environments because we don't want to interfere with Jest's own console overrides.
|
||||
if (process.env.NODE_ENV !== 'test') {
|
||||
//
|
||||
// Note that because this function is inlined, this conditional check must only use static booleans.
|
||||
// Otherwise the extension will throw with an undefined error.
|
||||
// (See comments in the try/catch below for more context on inlining.)
|
||||
if (!__EXTENSION__ && !__TEST__) {
|
||||
try {
|
||||
const appendComponentStack =
|
||||
window.__REACT_DEVTOOLS_APPEND_COMPONENT_STACK__ !== false;
|
||||
|
||||
Reference in New Issue
Block a user