aboutsummaryrefslogtreecommitdiffstats
path: root/src/preload-safe-debug.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/preload-safe-debug.ts')
-rw-r--r--src/preload-safe-debug.ts4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/preload-safe-debug.ts b/src/preload-safe-debug.ts
index d18dd8639..471ae1a1f 100644
--- a/src/preload-safe-debug.ts
+++ b/src/preload-safe-debug.ts
@@ -8,6 +8,7 @@
8 * We disable the `debug` package in context isolated renderers, 8 * We disable the `debug` package in context isolated renderers,
9 * because they correspond to preload scripts. 9 * because they correspond to preload scripts.
10 */ 10 */
11// eslint-disable-next-line unicorn/no-empty-file
11module.exports = function debug(namespace: string): (...params: any[]) => void { 12module.exports = function debug(namespace: string): (...params: any[]) => void {
12 if ( 13 if (
13 typeof process === 'object' && 14 typeof process === 'object' &&
@@ -18,13 +19,14 @@ module.exports = function debug(namespace: string): (...params: any[]) => void {
18 // We don't reimplement the matching algorithm from `debug` and just dump all 19 // We don't reimplement the matching algorithm from `debug` and just dump all
19 // messages to the console if some form of `Ferdium` debugging is enabled. 20 // messages to the console if some form of `Ferdium` debugging is enabled.
20 if (process.env.DEBUG?.startsWith('Ferdium:')) { 21 if (process.env.DEBUG?.startsWith('Ferdium:')) {
22 // eslint-disable-next-line no-console
21 return (...params) => console.debug(`[${namespace}]`, ...params); 23 return (...params) => console.debug(`[${namespace}]`, ...params);
22 } 24 }
23 return () => {}; 25 return () => {};
24 } 26 }
25 /* 27 /*
26 eslint-disable-next-line global-require --
27 This file contains a workaround for situations were global require is problematic. 28 This file contains a workaround for situations were global require is problematic.
28 */ 29 */
30 // eslint-disable-next-line global-require
29 return require('debug')(namespace); 31 return require('debug')(namespace);
30}; 32};