Skip to content

Commit cd6612c

Browse files
committed
[internal] fix console patch, add RN (facebook#32075)
The forking for `shared/ReactFeatureFlags` doesn't work in the console patches. Since they're already forked, we can import the internal ReactFeatureFlags files directly. Would have caught this in testing a PR sync, but the PR syncs are broken right now. DiffTrain build for [43d18bc](facebook@43d18bc)
1 parent c88a790 commit cd6612c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+628
-503
lines changed

compiled/facebook-www/JSXDEVRuntime-dev.classic.js

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,21 @@ __DEV__ &&
2222
_key2++
2323
)
2424
args[_key2 - 1] = arguments[_key2];
25-
_len2 = format;
26-
_key2 =
27-
require("react").__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
28-
null != _key2 &&
29-
_key2.getCurrentStack &&
30-
((_key2 = _key2.getCurrentStack()),
31-
"" !== _key2 && ((_len2 += "%s"), args.push(_key2)));
32-
args.unshift(_len2);
33-
args.unshift(!1);
34-
warningWWW.apply(null, args);
25+
if (enableRemoveConsolePatches) {
26+
var _console2;
27+
(_console2 = console).error.apply(_console2, [format].concat(args));
28+
} else
29+
(_len2 = format),
30+
enableRemoveConsolePatches ||
31+
((_key2 =
32+
require("react").__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE),
33+
null != _key2 &&
34+
_key2.getCurrentStack &&
35+
((_key2 = _key2.getCurrentStack()),
36+
"" !== _key2 && ((_len2 += "%s"), args.push(_key2))),
37+
args.unshift(_len2),
38+
args.unshift(!1),
39+
warningWWW.apply(null, args));
3540
}
3641
function getComponentNameFromType(type) {
3742
if (null == type) return null;
@@ -727,6 +732,8 @@ __DEV__ &&
727732
REACT_TRACING_MARKER_TYPE = Symbol.for("react.tracing_marker"),
728733
REACT_VIEW_TRANSITION_TYPE = Symbol.for("react.view_transition"),
729734
MAYBE_ITERATOR_SYMBOL = Symbol.iterator,
735+
enableRemoveConsolePatches =
736+
require("ReactFeatureFlags").enableRemoveConsolePatches,
730737
warningWWW = require("warning"),
731738
REACT_CLIENT_REFERENCE$2 = Symbol.for("react.client.reference"),
732739
ReactSharedInternals =

compiled/facebook-www/JSXDEVRuntime-dev.modern.js

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,21 @@ __DEV__ &&
2222
_key2++
2323
)
2424
args[_key2 - 1] = arguments[_key2];
25-
_len2 = format;
26-
_key2 =
27-
require("react").__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
28-
null != _key2 &&
29-
_key2.getCurrentStack &&
30-
((_key2 = _key2.getCurrentStack()),
31-
"" !== _key2 && ((_len2 += "%s"), args.push(_key2)));
32-
args.unshift(_len2);
33-
args.unshift(!1);
34-
warningWWW.apply(null, args);
25+
if (enableRemoveConsolePatches) {
26+
var _console2;
27+
(_console2 = console).error.apply(_console2, [format].concat(args));
28+
} else
29+
(_len2 = format),
30+
enableRemoveConsolePatches ||
31+
((_key2 =
32+
require("react").__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE),
33+
null != _key2 &&
34+
_key2.getCurrentStack &&
35+
((_key2 = _key2.getCurrentStack()),
36+
"" !== _key2 && ((_len2 += "%s"), args.push(_key2))),
37+
args.unshift(_len2),
38+
args.unshift(!1),
39+
warningWWW.apply(null, args));
3540
}
3641
function getComponentNameFromType(type) {
3742
if (null == type) return null;
@@ -727,6 +732,8 @@ __DEV__ &&
727732
REACT_TRACING_MARKER_TYPE = Symbol.for("react.tracing_marker"),
728733
REACT_VIEW_TRANSITION_TYPE = Symbol.for("react.view_transition"),
729734
MAYBE_ITERATOR_SYMBOL = Symbol.iterator,
735+
enableRemoveConsolePatches =
736+
require("ReactFeatureFlags").enableRemoveConsolePatches,
730737
warningWWW = require("warning"),
731738
REACT_CLIENT_REFERENCE$2 = Symbol.for("react.client.reference"),
732739
ReactSharedInternals =

compiled/facebook-www/REVISION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
886c5ad936428f168e50e077bd37fe9472ff8d3e
1+
43d18bc2d3d31f43706f513a996ef9b4a7495237
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
886c5ad936428f168e50e077bd37fe9472ff8d3e
1+
43d18bc2d3d31f43706f513a996ef9b4a7495237

compiled/facebook-www/React-dev.classic.js

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ __DEV__ &&
4141
_key++
4242
)
4343
args[_key - 1] = arguments[_key];
44-
printWarning("warn", format, args);
44+
if (enableRemoveConsolePatches) {
45+
var _console;
46+
(_console = console).warn.apply(_console, [format].concat(args));
47+
} else printWarning("warn", format, args);
4548
}
4649
function error$jscomp$0(format) {
4750
for (
@@ -52,18 +55,22 @@ __DEV__ &&
5255
_key2++
5356
)
5457
args[_key2 - 1] = arguments[_key2];
55-
printWarning("error", format, args);
58+
if (enableRemoveConsolePatches) {
59+
var _console2;
60+
(_console2 = console).error.apply(_console2, [format].concat(args));
61+
} else printWarning("error", format, args);
5662
}
5763
function printWarning(level, format, args) {
58-
level =
59-
require("react").__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
60-
null != level &&
61-
level.getCurrentStack &&
62-
((level = level.getCurrentStack()),
63-
"" !== level && ((format += "%s"), args.push(level)));
64-
args.unshift(format);
65-
args.unshift(!1);
66-
warningWWW.apply(null, args);
64+
enableRemoveConsolePatches ||
65+
((level =
66+
require("react").__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE),
67+
null != level &&
68+
level.getCurrentStack &&
69+
((level = level.getCurrentStack()),
70+
"" !== level && ((format += "%s"), args.push(level))),
71+
args.unshift(format),
72+
args.unshift(!1),
73+
warningWWW.apply(null, args));
6774
}
6875
function warnNoop(publicInstance, callerName) {
6976
publicInstance =
@@ -1139,6 +1146,8 @@ __DEV__ &&
11391146
REACT_TRACING_MARKER_TYPE = Symbol.for("react.tracing_marker"),
11401147
REACT_VIEW_TRANSITION_TYPE = Symbol.for("react.view_transition"),
11411148
MAYBE_ITERATOR_SYMBOL = Symbol.iterator,
1149+
enableRemoveConsolePatches =
1150+
require("ReactFeatureFlags").enableRemoveConsolePatches,
11421151
warningWWW = require("warning"),
11431152
didWarnStateUpdateForUnmountedComponent = {},
11441153
ReactNoopUpdateQueue = {
@@ -1947,7 +1956,7 @@ __DEV__ &&
19471956
exports.useTransition = function () {
19481957
return resolveDispatcher().useTransition();
19491958
};
1950-
exports.version = "19.1.0-www-classic-886c5ad9-20250115";
1959+
exports.version = "19.1.0-www-classic-43d18bc2-20250115";
19511960
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
19521961
"function" ===
19531962
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/React-dev.modern.js

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ __DEV__ &&
4141
_key++
4242
)
4343
args[_key - 1] = arguments[_key];
44-
printWarning("warn", format, args);
44+
if (enableRemoveConsolePatches) {
45+
var _console;
46+
(_console = console).warn.apply(_console, [format].concat(args));
47+
} else printWarning("warn", format, args);
4548
}
4649
function error$jscomp$0(format) {
4750
for (
@@ -52,18 +55,22 @@ __DEV__ &&
5255
_key2++
5356
)
5457
args[_key2 - 1] = arguments[_key2];
55-
printWarning("error", format, args);
58+
if (enableRemoveConsolePatches) {
59+
var _console2;
60+
(_console2 = console).error.apply(_console2, [format].concat(args));
61+
} else printWarning("error", format, args);
5662
}
5763
function printWarning(level, format, args) {
58-
level =
59-
require("react").__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
60-
null != level &&
61-
level.getCurrentStack &&
62-
((level = level.getCurrentStack()),
63-
"" !== level && ((format += "%s"), args.push(level)));
64-
args.unshift(format);
65-
args.unshift(!1);
66-
warningWWW.apply(null, args);
64+
enableRemoveConsolePatches ||
65+
((level =
66+
require("react").__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE),
67+
null != level &&
68+
level.getCurrentStack &&
69+
((level = level.getCurrentStack()),
70+
"" !== level && ((format += "%s"), args.push(level))),
71+
args.unshift(format),
72+
args.unshift(!1),
73+
warningWWW.apply(null, args));
6774
}
6875
function warnNoop(publicInstance, callerName) {
6976
publicInstance =
@@ -1139,6 +1146,8 @@ __DEV__ &&
11391146
REACT_TRACING_MARKER_TYPE = Symbol.for("react.tracing_marker"),
11401147
REACT_VIEW_TRANSITION_TYPE = Symbol.for("react.view_transition"),
11411148
MAYBE_ITERATOR_SYMBOL = Symbol.iterator,
1149+
enableRemoveConsolePatches =
1150+
require("ReactFeatureFlags").enableRemoveConsolePatches,
11421151
warningWWW = require("warning"),
11431152
didWarnStateUpdateForUnmountedComponent = {},
11441153
ReactNoopUpdateQueue = {
@@ -1947,7 +1956,7 @@ __DEV__ &&
19471956
exports.useTransition = function () {
19481957
return resolveDispatcher().useTransition();
19491958
};
1950-
exports.version = "19.1.0-www-modern-886c5ad9-20250115";
1959+
exports.version = "19.1.0-www-modern-43d18bc2-20250115";
19511960
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
19521961
"function" ===
19531962
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/React-prod.classic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,4 +630,4 @@ exports.useSyncExternalStore = function (
630630
exports.useTransition = function () {
631631
return ReactSharedInternals.H.useTransition();
632632
};
633-
exports.version = "19.1.0-www-classic-886c5ad9-20250115";
633+
exports.version = "19.1.0-www-classic-43d18bc2-20250115";

compiled/facebook-www/React-prod.modern.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,4 +630,4 @@ exports.useSyncExternalStore = function (
630630
exports.useTransition = function () {
631631
return ReactSharedInternals.H.useTransition();
632632
};
633-
exports.version = "19.1.0-www-modern-886c5ad9-20250115";
633+
exports.version = "19.1.0-www-modern-43d18bc2-20250115";

compiled/facebook-www/React-profiling.classic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ exports.useSyncExternalStore = function (
634634
exports.useTransition = function () {
635635
return ReactSharedInternals.H.useTransition();
636636
};
637-
exports.version = "19.1.0-www-classic-886c5ad9-20250115";
637+
exports.version = "19.1.0-www-classic-43d18bc2-20250115";
638638
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
639639
"function" ===
640640
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/React-profiling.modern.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ exports.useSyncExternalStore = function (
634634
exports.useTransition = function () {
635635
return ReactSharedInternals.H.useTransition();
636636
};
637-
exports.version = "19.1.0-www-modern-886c5ad9-20250115";
637+
exports.version = "19.1.0-www-modern-43d18bc2-20250115";
638638
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
639639
"function" ===
640640
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

0 commit comments

Comments
 (0)