From 2004f32b4b20455e0a3c1c2aee46f5ffd270bf05 Mon Sep 17 00:00:00 2001 From: Alex Hunt Date: Thu, 3 Oct 2024 16:39:25 +0100 Subject: [PATCH] Restore Metro log forwarding, change notice to signal future removal --- .../Libraries/Core/setUpDeveloperTools.js | 6 +++++- .../react-native/Libraries/Utilities/HMRClient.js | 11 ++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/packages/react-native/Libraries/Core/setUpDeveloperTools.js b/packages/react-native/Libraries/Core/setUpDeveloperTools.js index 5cc39eae9c12..6dfae179e335 100644 --- a/packages/react-native/Libraries/Core/setUpDeveloperTools.js +++ b/packages/react-native/Libraries/Core/setUpDeveloperTools.js @@ -42,9 +42,13 @@ if (__DEV__) { if (!Platform.isTesting) { const HMRClient = require('../Utilities/HMRClient'); + // [0.76 only] When under React Native DevTools, log "JavaScript logs will + // be removed from Metro..." warning, and continue to forward logs. if (global.__FUSEBOX_HAS_FULL_CONSOLE_SUPPORT__) { HMRClient.unstable_notifyFuseboxConsoleEnabled(); - } else if (console._isPolyfilled) { + } + + if (console._isPolyfilled) { // We assume full control over the console and send JavaScript logs to Metro. [ 'trace', diff --git a/packages/react-native/Libraries/Utilities/HMRClient.js b/packages/react-native/Libraries/Utilities/HMRClient.js index bed704f269c0..5651788b2a12 100644 --- a/packages/react-native/Libraries/Utilities/HMRClient.js +++ b/packages/react-native/Libraries/Utilities/HMRClient.js @@ -153,11 +153,12 @@ const HMRClient: HMRClientNativeInterface = { level: 'info', data: [ '\n' + - '\x1b[7m' + - ' \x1b[1mJavaScript logs have moved!\x1b[22m They will now appear in the debugger console. ' + - 'Tip: Type \x1b[1mj\x1b[22m in the terminal to open the debugger (requires Google Chrome ' + - 'or Microsoft Edge).' + - '\x1b[27m' + + '\u001B[7m' + + ' \u001B[1m💡 JavaScript logs will be removed from Metro in React ' + + 'Native 0.77!\u001B[22m Please use React Native DevTools as your ' + + 'default tool. Tip: Type \u001B[1mj\u001B[22m in the terminal to ' + + 'open (requires Google Chrome or Microsoft Edge).' + + '\u001B[27m' + '\n', ], }),