Skip to content

[pull] main from facebook:main #189

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/react-client/src/ReactClientConsoleConfigBrowser.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

// Keep in sync with ReactServerConsoleConfig
const badgeFormat = '%c%s%c ';
const badgeFormat = '%c%s%c';
// Same badge styling as DevTools.
const badgeStyle =
// We use a fixed background if light-dark is not supported, otherwise
Expand Down Expand Up @@ -49,7 +49,7 @@ export function bindToConsole(
newArgs.splice(
offset,
1,
badgeFormat + newArgs[offset],
badgeFormat + ' ' + newArgs[offset],
badgeStyle,
pad + badgeName + pad,
resetStyle,
Expand Down
4 changes: 2 additions & 2 deletions packages/react-client/src/ReactClientConsoleConfigPlain.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

// Keep in sync with ReactServerConsoleConfig
const badgeFormat = '[%s] ';
const badgeFormat = '[%s]';
const pad = ' ';

const bind = Function.prototype.bind;
Expand Down Expand Up @@ -39,7 +39,7 @@ export function bindToConsole(
newArgs.splice(
offset,
1,
badgeFormat + newArgs[offset],
badgeFormat + ' ' + newArgs[offset],
pad + badgeName + pad,
);
} else {
Expand Down
4 changes: 2 additions & 2 deletions packages/react-client/src/ReactClientConsoleConfigServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

// Keep in sync with ReactServerConsoleConfig
// This flips color using ANSI, then sets a color styling, then resets.
const badgeFormat = '\x1b[0m\x1b[7m%c%s\x1b[0m%c ';
const badgeFormat = '\x1b[0m\x1b[7m%c%s\x1b[0m%c';
// Same badge styling as DevTools.
const badgeStyle =
// We use a fixed background if light-dark is not supported, otherwise
Expand Down Expand Up @@ -50,7 +50,7 @@ export function bindToConsole(
newArgs.splice(
offset,
1,
badgeFormat + newArgs[offset],
badgeFormat + ' ' + newArgs[offset],
badgeStyle,
pad + badgeName + pad,
resetStyle,
Expand Down
9 changes: 7 additions & 2 deletions packages/react-server/src/ReactServerConsoleConfigBrowser.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

// Keep in sync with ReactClientConsoleConfig
const badgeFormat = '%c%s%c ';
const badgeFormat = '%c%s%c';
// Same badge styling as DevTools.
const badgeStyle =
// We use a fixed background if light-dark is not supported, otherwise
Expand Down Expand Up @@ -54,7 +54,12 @@ export function unbadgeConsole(
typeof badge === 'string'
) {
// Remove our badging from the arguments.
args.splice(offset, 4, format.slice(badgeFormat.length));
let unbadgedFormat = format.slice(badgeFormat.length);
if (unbadgedFormat[0] === ' ') {
// Spacing added on the Client if the original argument was a string.
unbadgedFormat = unbadgedFormat.slice(1);
}
args.splice(offset, 4, unbadgedFormat);
return badge.slice(padLength, badge.length - padLength);
}
return null;
Expand Down
9 changes: 7 additions & 2 deletions packages/react-server/src/ReactServerConsoleConfigPlain.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

// Keep in sync with ReactClientConsoleConfig
const badgeFormat = '[%s] ';
const badgeFormat = '[%s]';
const padLength = 1;
const pad = ' ';

Expand Down Expand Up @@ -45,7 +45,12 @@ export function unbadgeConsole(
badge.endsWith(pad)
) {
// Remove our badging from the arguments.
args.splice(offset, 2, format.slice(badgeFormat.length));
let unbadgedFormat = format.slice(badgeFormat.length);
if (unbadgedFormat[0] === ' ') {
// Spacing added on the Client if the original argument was a string.
unbadgedFormat = unbadgedFormat.slice(1);
}
args.splice(offset, 4, unbadgedFormat);
return badge.slice(padLength, badge.length - padLength);
}
return null;
Expand Down
9 changes: 7 additions & 2 deletions packages/react-server/src/ReactServerConsoleConfigServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

// Keep in sync with ReactClientConsoleConfig
const badgeFormat = '\x1b[0m\x1b[7m%c%s\x1b[0m%c ';
const badgeFormat = '\x1b[0m\x1b[7m%c%s\x1b[0m%c';
// Same badge styling as DevTools.
const badgeStyle =
// We use a fixed background if light-dark is not supported, otherwise
Expand Down Expand Up @@ -53,7 +53,12 @@ export function unbadgeConsole(
typeof badge === 'string'
) {
// Remove our badging from the arguments.
args.splice(offset, 4, format.slice(badgeFormat.length));
let unbadgedFormat = format.slice(badgeFormat.length);
if (unbadgedFormat[0] === ' ') {
// Spacing added on the Client if the original argument was a string.
unbadgedFormat = unbadgedFormat.slice(1);
}
args.splice(offset, 4, unbadgedFormat);
return badge.slice(padLength, badge.length - padLength);
}
return null;
Expand Down
Loading