mirror of
https://github.com/zebrajr/react.git
synced 2026-01-15 12:15:22 +00:00
@@ -261,3 +261,5 @@ export const enableUpdaterTracking = __PROFILE__;
|
||||
|
||||
// Internal only.
|
||||
export const enableDO_NOT_USE_disableStrictPassiveEffect = false;
|
||||
|
||||
export const enableRemoveConsolePatches = true;
|
||||
|
||||
@@ -27,3 +27,4 @@ export const enableFabricCompleteRootInCommitPhase = __VARIANT__;
|
||||
export const enableSiblingPrerendering = __VARIANT__;
|
||||
export const enableUseResourceEffectHook = __VARIANT__;
|
||||
export const enableOwnerStacks = __VARIANT__;
|
||||
export const enableRemoveConsolePatches = __VARIANT__;
|
||||
|
||||
@@ -29,6 +29,7 @@ export const {
|
||||
passChildrenWhenCloningPersistedNodes,
|
||||
enableSiblingPrerendering,
|
||||
enableOwnerStacks,
|
||||
enableRemoveConsolePatches,
|
||||
} = dynamicFlags;
|
||||
|
||||
// The rest of the flags are static for better dead code elimination.
|
||||
|
||||
@@ -78,6 +78,7 @@ export const enableProfilerTimer = __PROFILE__;
|
||||
export const enableProfilerCommitHooks = __PROFILE__;
|
||||
export const enableProfilerNestedUpdatePhase = __PROFILE__;
|
||||
export const enableUpdaterTracking = __PROFILE__;
|
||||
export const enableRemoveConsolePatches = false;
|
||||
|
||||
// Flow magic to verify the exports of this file match the original version.
|
||||
((((null: any): ExportsType): FeatureFlagsType): ExportsType);
|
||||
|
||||
@@ -88,6 +88,7 @@ export const disableDefaultPropsExceptForClasses = true;
|
||||
|
||||
export const enableObjectFiber = false;
|
||||
export const enableOwnerStacks = false;
|
||||
export const enableRemoveConsolePatches = true;
|
||||
|
||||
// Flow magic to verify the exports of this file match the original version.
|
||||
((((null: any): ExportsType): FeatureFlagsType): ExportsType);
|
||||
|
||||
@@ -68,6 +68,7 @@ export const enableHydrationLaneScheduling = true;
|
||||
export const enableYieldingBeforePassive = false;
|
||||
export const enableThrottledScheduling = false;
|
||||
export const enableViewTransition = false;
|
||||
export const enableRemoveConsolePatches = false;
|
||||
|
||||
// Flow magic to verify the exports of this file match the original version.
|
||||
((((null: any): ExportsType): FeatureFlagsType): ExportsType);
|
||||
|
||||
@@ -83,6 +83,7 @@ export const enableYieldingBeforePassive = false;
|
||||
|
||||
export const enableThrottledScheduling = false;
|
||||
export const enableViewTransition = false;
|
||||
export const enableRemoveConsolePatches = false;
|
||||
|
||||
// Flow magic to verify the exports of this file match the original version.
|
||||
((((null: any): ExportsType): FeatureFlagsType): ExportsType);
|
||||
|
||||
@@ -37,6 +37,7 @@ export const enableInfiniteRenderLoopDetection = __VARIANT__;
|
||||
export const enableSiblingPrerendering = __VARIANT__;
|
||||
|
||||
export const enableUseResourceEffectHook = __VARIANT__;
|
||||
export const enableRemoveConsolePatches = __VARIANT__;
|
||||
|
||||
// TODO: These flags are hard-coded to the default values used in open source.
|
||||
// Update the tests so that they pass in either mode, then set these
|
||||
|
||||
@@ -36,6 +36,7 @@ export const {
|
||||
syncLaneExpirationMs,
|
||||
transitionLaneExpirationMs,
|
||||
enableOwnerStacks,
|
||||
enableRemoveConsolePatches,
|
||||
} = dynamicFeatureFlags;
|
||||
|
||||
// On WWW, __EXPERIMENTAL__ is used for a new modern build.
|
||||
|
||||
@@ -5,18 +5,27 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
const {enableRemoveConsolePatches} = require('shared/ReactFeatureFlags');
|
||||
|
||||
// This refers to a WWW module.
|
||||
const warningWWW = require('warning');
|
||||
|
||||
let suppressWarning = false;
|
||||
export function setSuppressWarning(newSuppressWarning) {
|
||||
if (enableRemoveConsolePatches) {
|
||||
return;
|
||||
}
|
||||
if (__DEV__) {
|
||||
suppressWarning = newSuppressWarning;
|
||||
}
|
||||
}
|
||||
|
||||
export function warn(format, ...args) {
|
||||
if (__DEV__) {
|
||||
if (enableRemoveConsolePatches) {
|
||||
if (__DEV__) {
|
||||
console['warn'](format, ...args);
|
||||
}
|
||||
} else if (__DEV__) {
|
||||
if (!suppressWarning) {
|
||||
printWarning('warn', format, args);
|
||||
}
|
||||
@@ -24,7 +33,11 @@ export function warn(format, ...args) {
|
||||
}
|
||||
|
||||
export function error(format, ...args) {
|
||||
if (__DEV__) {
|
||||
if (enableRemoveConsolePatches) {
|
||||
if (__DEV__) {
|
||||
console['error'](format, ...args);
|
||||
}
|
||||
} else if (__DEV__) {
|
||||
if (!suppressWarning) {
|
||||
printWarning('error', format, args);
|
||||
}
|
||||
@@ -32,6 +45,9 @@ export function error(format, ...args) {
|
||||
}
|
||||
|
||||
function printWarning(level, format, args) {
|
||||
if (enableRemoveConsolePatches) {
|
||||
return;
|
||||
}
|
||||
if (__DEV__) {
|
||||
const React = require('react');
|
||||
const ReactSharedInternals =
|
||||
|
||||
Reference in New Issue
Block a user