diff options
author | 2022-07-25 08:16:50 +0530 | |
---|---|---|
committer | 2022-07-25 08:17:10 +0530 | |
commit | cf282aa351cbc58691fb1b2fb4764830247cdbe8 (patch) | |
tree | 1a6ac4c9abd8b3de9d358016a5065da86cdd8510 /src/preload-safe-debug.ts | |
parent | 6.0.1-nightly.3 [skip ci] (diff) | |
download | ferdium-app-cf282aa351cbc58691fb1b2fb4764830247cdbe8.tar.gz ferdium-app-cf282aa351cbc58691fb1b2fb4764830247cdbe8.tar.zst ferdium-app-cf282aa351cbc58691fb1b2fb4764830247cdbe8.zip |
eslint needs to be executed at the top-level to actually workv6.0.1-nightly.3
Diffstat (limited to 'src/preload-safe-debug.ts')
-rw-r--r-- | src/preload-safe-debug.ts | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/preload-safe-debug.ts b/src/preload-safe-debug.ts index 1136e93c1..d18dd8639 100644 --- a/src/preload-safe-debug.ts +++ b/src/preload-safe-debug.ts | |||
@@ -9,20 +9,22 @@ | |||
9 | * because they correspond to preload scripts. | 9 | * because they correspond to preload scripts. |
10 | */ | 10 | */ |
11 | module.exports = function debug(namespace: string): (...params: any[]) => void { | 11 | module.exports = function debug(namespace: string): (...params: any[]) => void { |
12 | if (typeof process === 'object' && | 12 | if ( |
13 | 'contextIsolated' in process && | 13 | typeof process === 'object' && |
14 | (process as unknown as { contextIsolated: string }).contextIsolated) { | 14 | 'contextIsolated' in process && |
15 | (process as unknown as { contextIsolated: string }).contextIsolated | ||
16 | ) { | ||
15 | // Only output debug messages to the console if debugging is requested. | 17 | // Only output debug messages to the console if debugging is requested. |
16 | // We don't reimplement the matching algorithm from `debug` and just dump all | 18 | // We don't reimplement the matching algorithm from `debug` and just dump all |
17 | // messages to the console if some form of `Ferdium` debugging is enabled. | 19 | // messages to the console if some form of `Ferdium` debugging is enabled. |
18 | if (process.env.DEBUG?.startsWith('Ferdium:')) { | 20 | if (process.env.DEBUG?.startsWith('Ferdium:')) { |
19 | return (...params) => console.debug(`[${namespace}]`, ...params); | 21 | return (...params) => console.debug(`[${namespace}]`, ...params); |
20 | } | 22 | } |
21 | return () => { }; | 23 | return () => {}; |
22 | } | 24 | } |
23 | /* | 25 | /* |
24 | eslint-disable-next-line global-require -- | 26 | eslint-disable-next-line global-require -- |
25 | This file contains a workaround for situations were global require is problematic. | 27 | This file contains a workaround for situations were global require is problematic. |
26 | */ | 28 | */ |
27 | return require('debug')(namespace); | 29 | return require('debug')(namespace); |
28 | } | 30 | }; |