From f7a48a485fac2ce51542c8d03a7486b473a52ee3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nacho=20Codo=C3=B1er?= Date: Wed, 6 Mar 2024 06:49:48 +0100 Subject: [PATCH] spread debug mode to the client --- packages/meteor/debug.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/packages/meteor/debug.js b/packages/meteor/debug.js index 8bb4fdb0a5..707bd26915 100644 --- a/packages/meteor/debug.js +++ b/packages/meteor/debug.js @@ -1,3 +1,19 @@ +if (Meteor.isServer) { + if (typeof __meteor_runtime_config__ === 'object') { + __meteor_runtime_config__.debug = + !!process.env.NODE_INSPECTOR_IPC || + !!process.env.VSCODE_INSPECTOR_OPTIONS || + process.execArgv.some(_arg => + /^--(inspect|debug)(-brk)?(=\d+)?$/i.test(_arg), + ); + } +} + +Meteor.isDebug = Meteor.isClient + ? typeof window === 'object' && !!window.__meteor_runtime_config__.debug + : typeof __meteor_runtime_config__ === 'object' && + !!__meteor_runtime_config__.debug; + var suppress = 0; // replacement for console.log. This is a temporary API. We should @@ -61,4 +77,3 @@ Meteor._suppress_log = function (count) { Meteor._suppressed_log_expected = function () { return suppress !== 0; }; -