@dbx-tools/shared-core 0.1.20 → 0.1.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/log.ts +11 -3
package/package.json
CHANGED
package/src/log.ts
CHANGED
|
@@ -129,7 +129,7 @@ const createConsolaLoggerFactory = memoize(
|
|
|
129
129
|
const consolaDisabled = toBoolean(globalProcess?.env?.LOG_CONSOLA_DISABLED);
|
|
130
130
|
if (!consolaDisabled) {
|
|
131
131
|
try {
|
|
132
|
-
const { consola, createConsola, LogLevels } = await import("consola");
|
|
132
|
+
const { consola, createConsola, LogLevels } = await import(/* @vite-ignore */ "consola");
|
|
133
133
|
const defaultOptions = consola.options;
|
|
134
134
|
const createConsolaOptions = {
|
|
135
135
|
...consola.options,
|
|
@@ -160,7 +160,13 @@ const createConsolaLoggerFactory = memoize(
|
|
|
160
160
|
return name ? consolaLogger.withTag(name) : consolaLogger;
|
|
161
161
|
};
|
|
162
162
|
} catch (error) {
|
|
163
|
-
|
|
163
|
+
// consola is an OPTIONAL peer - not having it installed is the EXPECTED
|
|
164
|
+
// path (the module degrades to the console fallback), so this is not an
|
|
165
|
+
// error. Note it only at debug level, and without a stack trace (the
|
|
166
|
+
// message, not `console.trace`, so a missing optional dep stays quiet).
|
|
167
|
+
if (isLevelEnabled("debug")) {
|
|
168
|
+
console.debug("consola not available; using console fallback:", String(error));
|
|
169
|
+
}
|
|
164
170
|
}
|
|
165
171
|
}
|
|
166
172
|
return undefined;
|
|
@@ -179,7 +185,9 @@ async function createConsoleLoggerFactory(globalProcessStdErr: any): Promise<Log
|
|
|
179
185
|
// Indirect specifier so this browser-safe module doesn't statically pull in
|
|
180
186
|
// node types: `node:util` is optional (the JSON fallback covers its absence).
|
|
181
187
|
const nodeUtil = "node:util";
|
|
182
|
-
const utils: { inspect?: any } | undefined = await import(nodeUtil).catch(
|
|
188
|
+
const utils: { inspect?: any } | undefined = await import(/* @vite-ignore */ nodeUtil).catch(
|
|
189
|
+
() => undefined,
|
|
190
|
+
);
|
|
183
191
|
const bunInspect =
|
|
184
192
|
globalBun !== undefined && !toBoolean(globalBun.env?.LOG_BUN_CONSOLE_DISABLED)
|
|
185
193
|
? globalBun.inspect
|