@socketsecurity/lib 3.0.4 → 3.0.6

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.
@@ -34,10 +34,11 @@ __export(links_exports, {
34
34
  module.exports = __toCommonJS(links_exports);
35
35
  var import_yoctocolors_cjs = __toESM(require("../external/yoctocolors-cjs"));
36
36
  var import_context = require("../themes/context");
37
+ var import_themes = require("../themes/themes");
37
38
  var import_utils = require("../themes/utils");
38
39
  function link(text, url, options) {
39
40
  const opts = { __proto__: null, fallback: false, ...options };
40
- const theme = typeof opts.theme === "string" ? require("../themes/themes").THEMES[opts.theme] : opts.theme ?? (0, import_context.getTheme)();
41
+ const theme = typeof opts.theme === "string" ? import_themes.THEMES[opts.theme] : opts.theme ?? (0, import_context.getTheme)();
41
42
  const linkColor = (0, import_utils.resolveColor)(theme.colors.link, theme.colors);
42
43
  const colors = import_yoctocolors_cjs.default;
43
44
  let colored;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/links/index.ts"],
4
- "sourcesContent": ["/**\n * @fileoverview Themed hyperlink utilities for terminal output.\n * Provides colored hyperlinks using theme configuration.\n */\n\nimport yoctocolorsCjs from '../external/yoctocolors-cjs'\nimport type { ColorName } from '../spinner'\nimport { getTheme } from '../themes/context'\nimport { resolveColor } from '../themes/utils'\nimport type { Theme } from '../themes/types'\nimport type { ThemeName } from '../themes/themes'\n\n/**\n * Options for creating themed links.\n */\nexport type LinkOptions = {\n /** Theme to use (overrides global) */\n theme?: Theme | ThemeName | undefined\n /** Show URL as fallback if terminal doesn't support links */\n fallback?: boolean | undefined\n}\n\n/**\n * Create a themed hyperlink for terminal output.\n * The link text is colored using the theme's link color.\n *\n * Note: Most terminals support ANSI color codes but not clickable links.\n * This function colors the text but does not create clickable hyperlinks.\n * For clickable links, use a library like 'terminal-link' separately.\n *\n * @param text - Link text to display\n * @param url - URL (included in fallback mode)\n * @param options - Link configuration options\n * @returns Colored link text\n *\n * @example\n * ```ts\n * import { link } from '@socketsecurity/lib/links'\n *\n * // Use current theme\n * console.log(link('Documentation', 'https://socket.dev'))\n *\n * // Override theme\n * console.log(link('API Docs', 'https://api.socket.dev', {\n * theme: 'coana'\n * }))\n *\n * // Show URL as fallback\n * console.log(link('GitHub', 'https://github.com', {\n * fallback: true\n * }))\n * // Output: \"GitHub (https://github.com)\"\n * ```\n */\nexport function link(text: string, url: string, options?: LinkOptions): string {\n const opts = { __proto__: null, fallback: false, ...options } as LinkOptions\n\n // Resolve theme\n const theme =\n typeof opts.theme === 'string'\n ? require('../themes/themes').THEMES[opts.theme]\n : (opts.theme ?? getTheme())\n\n // Resolve link color\n const linkColor = resolveColor(theme.colors.link, theme.colors)\n\n // Apply color - for now just use cyan as a simple fallback\n // Note: RGB color support to be added in yoctocolors wrapper\n const colors = yoctocolorsCjs\n let colored: string\n if (typeof linkColor === 'string' && linkColor !== 'inherit') {\n // Use named color method if available\n const colorMethod = colors[linkColor as ColorName]\n colored = colorMethod ? colorMethod(text) : colors.cyan(text)\n } else if (Array.isArray(linkColor)) {\n // RGB color - for now fallback to cyan\n // Note: RGB color support to be implemented\n colored = colors.cyan(text)\n } else {\n colored = colors.cyan(text)\n }\n\n // Return with or without URL fallback\n return opts.fallback ? `${colored} (${url})` : colored\n}\n\n/**\n * Create multiple themed links from an array of link specifications.\n *\n * @param links - Array of [text, url] pairs\n * @param options - Link configuration options\n * @returns Array of colored link texts\n *\n * @example\n * ```ts\n * import { links } from '@socketsecurity/lib/links'\n *\n * const formatted = links([\n * ['Documentation', 'https://socket.dev'],\n * ['API Reference', 'https://api.socket.dev'],\n * ['GitHub', 'https://github.com/SocketDev']\n * ])\n *\n * formatted.forEach(link => console.log(link))\n * ```\n */\nexport function links(\n linkSpecs: Array<[text: string, url: string]>,\n options?: LinkOptions,\n): string[] {\n return linkSpecs.map(([text, url]) => link(text, url, options))\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,6BAA2B;AAE3B,qBAAyB;AACzB,mBAA6B;AA8CtB,SAAS,KAAK,MAAc,KAAa,SAA+B;AAC7E,QAAM,OAAO,EAAE,WAAW,MAAM,UAAU,OAAO,GAAG,QAAQ;AAG5D,QAAM,QACJ,OAAO,KAAK,UAAU,WAClB,QAAQ,kBAAkB,EAAE,OAAO,KAAK,KAAK,IAC5C,KAAK,aAAS,yBAAS;AAG9B,QAAM,gBAAY,2BAAa,MAAM,OAAO,MAAM,MAAM,MAAM;AAI9D,QAAM,SAAS,uBAAAA;AACf,MAAI;AACJ,MAAI,OAAO,cAAc,YAAY,cAAc,WAAW;AAE5D,UAAM,cAAc,OAAO,SAAsB;AACjD,cAAU,cAAc,YAAY,IAAI,IAAI,OAAO,KAAK,IAAI;AAAA,EAC9D,WAAW,MAAM,QAAQ,SAAS,GAAG;AAGnC,cAAU,OAAO,KAAK,IAAI;AAAA,EAC5B,OAAO;AACL,cAAU,OAAO,KAAK,IAAI;AAAA,EAC5B;AAGA,SAAO,KAAK,WAAW,GAAG,OAAO,KAAK,GAAG,MAAM;AACjD;AAsBO,SAAS,MACd,WACA,SACU;AACV,SAAO,UAAU,IAAI,CAAC,CAAC,MAAM,GAAG,MAAM,KAAK,MAAM,KAAK,OAAO,CAAC;AAChE;",
4
+ "sourcesContent": ["/**\n * @fileoverview Themed hyperlink utilities for terminal output.\n * Provides colored hyperlinks using theme configuration.\n */\n\nimport yoctocolorsCjs from '../external/yoctocolors-cjs'\nimport type { ColorName } from '../spinner'\nimport { getTheme } from '../themes/context'\nimport { THEMES } from '../themes/themes'\nimport { resolveColor } from '../themes/utils'\nimport type { Theme } from '../themes/types'\nimport type { ThemeName } from '../themes/themes'\n\n/**\n * Options for creating themed links.\n */\nexport type LinkOptions = {\n /** Theme to use (overrides global) */\n theme?: Theme | ThemeName | undefined\n /** Show URL as fallback if terminal doesn't support links */\n fallback?: boolean | undefined\n}\n\n/**\n * Create a themed hyperlink for terminal output.\n * The link text is colored using the theme's link color.\n *\n * Note: Most terminals support ANSI color codes but not clickable links.\n * This function colors the text but does not create clickable hyperlinks.\n * For clickable links, use a library like 'terminal-link' separately.\n *\n * @param text - Link text to display\n * @param url - URL (included in fallback mode)\n * @param options - Link configuration options\n * @returns Colored link text\n *\n * @example\n * ```ts\n * import { link } from '@socketsecurity/lib/links'\n *\n * // Use current theme\n * console.log(link('Documentation', 'https://socket.dev'))\n *\n * // Override theme\n * console.log(link('API Docs', 'https://api.socket.dev', {\n * theme: 'coana'\n * }))\n *\n * // Show URL as fallback\n * console.log(link('GitHub', 'https://github.com', {\n * fallback: true\n * }))\n * // Output: \"GitHub (https://github.com)\"\n * ```\n */\nexport function link(text: string, url: string, options?: LinkOptions): string {\n const opts = { __proto__: null, fallback: false, ...options } as LinkOptions\n\n // Resolve theme\n const theme =\n typeof opts.theme === 'string'\n ? THEMES[opts.theme]\n : (opts.theme ?? getTheme())\n\n // Resolve link color\n const linkColor = resolveColor(theme.colors.link, theme.colors)\n\n // Apply color - for now just use cyan as a simple fallback\n // Note: RGB color support to be added in yoctocolors wrapper\n const colors = yoctocolorsCjs\n let colored: string\n if (typeof linkColor === 'string' && linkColor !== 'inherit') {\n // Use named color method if available\n const colorMethod = colors[linkColor as ColorName]\n colored = colorMethod ? colorMethod(text) : colors.cyan(text)\n } else if (Array.isArray(linkColor)) {\n // RGB color - for now fallback to cyan\n // Note: RGB color support to be implemented\n colored = colors.cyan(text)\n } else {\n colored = colors.cyan(text)\n }\n\n // Return with or without URL fallback\n return opts.fallback ? `${colored} (${url})` : colored\n}\n\n/**\n * Create multiple themed links from an array of link specifications.\n *\n * @param links - Array of [text, url] pairs\n * @param options - Link configuration options\n * @returns Array of colored link texts\n *\n * @example\n * ```ts\n * import { links } from '@socketsecurity/lib/links'\n *\n * const formatted = links([\n * ['Documentation', 'https://socket.dev'],\n * ['API Reference', 'https://api.socket.dev'],\n * ['GitHub', 'https://github.com/SocketDev']\n * ])\n *\n * formatted.forEach(link => console.log(link))\n * ```\n */\nexport function links(\n linkSpecs: Array<[text: string, url: string]>,\n options?: LinkOptions,\n): string[] {\n return linkSpecs.map(([text, url]) => link(text, url, options))\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,6BAA2B;AAE3B,qBAAyB;AACzB,oBAAuB;AACvB,mBAA6B;AA8CtB,SAAS,KAAK,MAAc,KAAa,SAA+B;AAC7E,QAAM,OAAO,EAAE,WAAW,MAAM,UAAU,OAAO,GAAG,QAAQ;AAG5D,QAAM,QACJ,OAAO,KAAK,UAAU,WAClB,qBAAO,KAAK,KAAK,IAChB,KAAK,aAAS,yBAAS;AAG9B,QAAM,gBAAY,2BAAa,MAAM,OAAO,MAAM,MAAM,MAAM;AAI9D,QAAM,SAAS,uBAAAA;AACf,MAAI;AACJ,MAAI,OAAO,cAAc,YAAY,cAAc,WAAW;AAE5D,UAAM,cAAc,OAAO,SAAsB;AACjD,cAAU,cAAc,YAAY,IAAI,IAAI,OAAO,KAAK,IAAI;AAAA,EAC9D,WAAW,MAAM,QAAQ,SAAS,GAAG;AAGnC,cAAU,OAAO,KAAK,IAAI;AAAA,EAC5B,OAAO;AACL,cAAU,OAAO,KAAK,IAAI;AAAA,EAC5B;AAGA,SAAO,KAAK,WAAW,GAAG,OAAO,KAAK,GAAG,MAAM;AACjD;AAsBO,SAAS,MACd,WACA,SACU;AACV,SAAO,UAAU,IAAI,CAAC,CAAC,MAAM,GAAG,MAAM,KAAK,MAAM,KAAK,OAAO,CAAC;AAChE;",
6
6
  "names": ["yoctocolorsCjs"]
7
7
  }
package/dist/logger.js CHANGED
@@ -39,6 +39,7 @@ var import_is_unicode_supported = __toESM(require("./external/@socketregistry/is
39
39
  var import_yoctocolors_cjs = __toESM(require("./external/yoctocolors-cjs"));
40
40
  var import_strings = require("./strings");
41
41
  var import_context = require("./themes/context");
42
+ var import_themes = require("./themes/themes");
42
43
  const globalConsole = console;
43
44
  const ReflectApply = Reflect.apply;
44
45
  const ReflectConstruct = Reflect.construct;
@@ -196,6 +197,7 @@ class Logger {
196
197
  #logCallCount = 0;
197
198
  #options;
198
199
  #originalStdout;
200
+ #theme;
199
201
  /**
200
202
  * Creates a new Logger instance.
201
203
  *
@@ -223,6 +225,14 @@ class Logger {
223
225
  if (typeof options === "object" && options !== null) {
224
226
  this.#options = { __proto__: null, ...options };
225
227
  this.#originalStdout = options.stdout;
228
+ const themeOption = options.theme;
229
+ if (themeOption) {
230
+ if (typeof themeOption === "string") {
231
+ this.#theme = import_themes.THEMES[themeOption];
232
+ } else {
233
+ this.#theme = themeOption;
234
+ }
235
+ }
226
236
  } else {
227
237
  this.#options = { __proto__: null };
228
238
  }
@@ -285,6 +295,7 @@ class Logger {
285
295
  instance.#parent = this;
286
296
  instance.#boundStream = "stderr";
287
297
  instance.#options = { __proto__: null, ...this.#options };
298
+ instance.#theme = this.#theme;
288
299
  this.#stderrLogger = instance;
289
300
  }
290
301
  return this.#stderrLogger;
@@ -317,6 +328,7 @@ class Logger {
317
328
  instance.#parent = this;
318
329
  instance.#boundStream = "stdout";
319
330
  instance.#options = { __proto__: null, ...this.#options };
331
+ instance.#theme = this.#theme;
320
332
  this.#stdoutLogger = instance;
321
333
  }
322
334
  return this.#stdoutLogger;
@@ -328,6 +340,31 @@ class Logger {
328
340
  #getRoot() {
329
341
  return this.#parent || this;
330
342
  }
343
+ /**
344
+ * Get the resolved theme for this logger instance.
345
+ * Returns instance theme if set, otherwise falls back to context theme.
346
+ * @private
347
+ */
348
+ #getTheme() {
349
+ return this.#theme ?? (0, import_context.getTheme)();
350
+ }
351
+ /**
352
+ * Get logger-specific symbols using the resolved theme.
353
+ * @private
354
+ */
355
+ #getSymbols() {
356
+ const theme = this.#getTheme();
357
+ const supported = (0, import_is_unicode_supported.default)();
358
+ const colors = /* @__PURE__ */ getYoctocolors();
359
+ return {
360
+ __proto__: null,
361
+ fail: /* @__PURE__ */ applyColor(supported ? "\u2716" : "\xD7", theme.colors.error, colors),
362
+ info: /* @__PURE__ */ applyColor(supported ? "\u2139" : "i", theme.colors.info, colors),
363
+ step: /* @__PURE__ */ applyColor(supported ? "\u2192" : ">", theme.colors.step, colors),
364
+ success: /* @__PURE__ */ applyColor(supported ? "\u2714" : "\u221A", theme.colors.success, colors),
365
+ warn: /* @__PURE__ */ applyColor(supported ? "\u26A0" : "\u203C", theme.colors.warning, colors)
366
+ };
367
+ }
331
368
  /**
332
369
  * Get indentation for a specific stream.
333
370
  * @private
@@ -418,8 +455,9 @@ class Logger {
418
455
  text = "";
419
456
  }
420
457
  const indent = this.#getIndent("stderr");
458
+ const symbols = this.#getSymbols();
421
459
  con.error(
422
- (0, import_strings.applyLinePrefix)(`${LOG_SYMBOLS[symbolType]} ${text}`, {
460
+ (0, import_strings.applyLinePrefix)(`${symbols[symbolType]} ${text}`, {
423
461
  prefix: indent
424
462
  }),
425
463
  ...extras
@@ -984,9 +1022,10 @@ class Logger {
984
1022
  }
985
1023
  const text = this.#stripSymbols(msg);
986
1024
  const indent = this.#getIndent("stdout");
1025
+ const symbols = this.#getSymbols();
987
1026
  const con = this.#getConsole();
988
1027
  con.log(
989
- (0, import_strings.applyLinePrefix)(`${LOG_SYMBOLS.step} ${text}`, {
1028
+ (0, import_strings.applyLinePrefix)(`${symbols.step} ${text}`, {
990
1029
  prefix: indent
991
1030
  }),
992
1031
  ...extras
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/logger.ts"],
4
- "sourcesContent": ["/**\n * @fileoverview Console logging utilities with line prefix support.\n * Provides enhanced console methods with formatted output capabilities.\n */\n\nimport isUnicodeSupported from './external/@socketregistry/is-unicode-supported'\nimport yoctocolorsCjs from './external/yoctocolors-cjs'\nimport { applyLinePrefix, isBlankString } from './strings'\nimport type { ColorValue } from './spinner'\nimport { getTheme, onThemeChange } from './themes/context'\n\n/**\n * Log symbols for terminal output with colored indicators.\n *\n * Each symbol provides visual feedback for different message types, with\n * Unicode and ASCII fallback support.\n *\n * @example\n * ```typescript\n * import { LOG_SYMBOLS } from '@socketsecurity/lib'\n *\n * console.log(`${LOG_SYMBOLS.success} Operation completed`)\n * console.log(`${LOG_SYMBOLS.fail} Operation failed`)\n * console.log(`${LOG_SYMBOLS.warn} Warning message`)\n * console.log(`${LOG_SYMBOLS.info} Information message`)\n * console.log(`${LOG_SYMBOLS.step} Processing step`)\n * ```\n */\ntype LogSymbols = {\n /** Red colored failure symbol (\u2716 or \u00D7 in ASCII) */\n fail: string\n /** Blue colored information symbol (\u2139 or i in ASCII) */\n info: string\n /** Cyan colored step symbol (\u2192 or > in ASCII) */\n step: string\n /** Green colored success symbol (\u2714 or \u221A in ASCII) */\n success: string\n /** Yellow colored warning symbol (\u26A0 or \u203C in ASCII) */\n warn: string\n}\n\n/**\n * Type definition for logger methods that mirror console methods.\n *\n * All methods return the logger instance for method chaining.\n */\ntype LoggerMethods = {\n [K in keyof typeof console]: (typeof console)[K] extends (\n ...args: infer A\n ) => any\n ? (...args: A) => Logger\n : (typeof console)[K]\n}\n\n/**\n * A task that can be executed with automatic start/complete logging.\n *\n * @example\n * ```typescript\n * const task = logger.createTask('Database migration')\n * task.run(() => {\n * // Migration logic here\n * })\n * // Logs: \"Starting task: Database migration\"\n * // Logs: \"Completed task: Database migration\"\n * ```\n */\ninterface Task {\n /**\n * Executes the task function with automatic logging.\n *\n * @template T - The return type of the task function\n * @param f - The function to execute\n * @returns The result of the task function\n */\n run<T>(f: () => T): T\n}\n\nexport type { LogSymbols, LoggerMethods, Task }\n\nconst globalConsole = console\n// IMPORTANT: Do not use destructuring here - use direct assignment instead.\n// tsgo has a bug that incorrectly transpiles destructured exports, resulting in\n// `exports.SomeName = void 0;` which causes runtime errors.\n// See: https://github.com/SocketDev/socket-packageurl-js/issues/3\nconst ReflectApply = Reflect.apply\nconst ReflectConstruct = Reflect.construct\n\nlet _Console: typeof import('console').Console | undefined\n/**\n * Construct a new Console instance.\n * @private\n */\n/*@__NO_SIDE_EFFECTS__*/\nfunction constructConsole(...args: unknown[]) {\n if (_Console === undefined) {\n // Use non-'node:' prefixed require to avoid Webpack errors.\n\n const nodeConsole = /*@__PURE__*/ require('node:console')\n _Console = nodeConsole.Console\n }\n return ReflectConstruct(\n _Console! as new (\n ...args: unknown[]\n ) => Console, // eslint-disable-line no-undef\n args,\n )\n}\n\n/**\n * Get the yoctocolors module for terminal colors.\n * @private\n */\n/*@__NO_SIDE_EFFECTS__*/\nfunction getYoctocolors() {\n return yoctocolorsCjs\n}\n\n/**\n * Apply a color to text using yoctocolors.\n * Handles both named colors and RGB tuples.\n * @private\n */\n/*@__NO_SIDE_EFFECTS__*/\nfunction applyColor(\n text: string,\n color: ColorValue,\n colors: typeof yoctocolorsCjs,\n): string {\n if (typeof color === 'string') {\n // Named color like 'green', 'red', etc.\n return (colors as any)[color](text)\n }\n // RGB tuple [r, g, b]\n return colors.rgb(color[0], color[1], color[2])(text)\n}\n\n/**\n * Log symbols for terminal output with colored indicators.\n *\n * Provides colored Unicode symbols (\u2714, \u2716, \u26A0, \u2139, \u2192) with ASCII fallbacks (\u221A, \u00D7, \u203C, i, >)\n * for terminals that don't support Unicode. Symbols are colored according to the active\n * theme's color palette (success, error, warning, info, step).\n *\n * The symbols are lazily initialized on first access and automatically update when the\n * fallback theme changes (via setTheme()). Note that LOG_SYMBOLS reflect the global\n * fallback theme, not async-local theme contexts from withTheme().\n *\n * @example\n * ```typescript\n * import { LOG_SYMBOLS } from '@socketsecurity/lib'\n *\n * console.log(`${LOG_SYMBOLS.success} Build completed`) // Theme success color \u2714\n * console.log(`${LOG_SYMBOLS.fail} Build failed`) // Theme error color \u2716\n * console.log(`${LOG_SYMBOLS.warn} Deprecated API used`) // Theme warning color \u26A0\n * console.log(`${LOG_SYMBOLS.info} Starting process`) // Theme info color \u2139\n * console.log(`${LOG_SYMBOLS.step} Processing files`) // Theme step color \u2192\n * ```\n */\nexport const LOG_SYMBOLS = /*@__PURE__*/ (() => {\n const target: Record<string, string> = {\n __proto__: null,\n } as unknown as Record<string, string>\n\n let initialized = false\n\n // Mutable handler to simulate a frozen target.\n const handler: ProxyHandler<Record<string, string>> = {\n __proto__: null,\n } as unknown as ProxyHandler<Record<string, string>>\n\n const updateSymbols = () => {\n const supported = isUnicodeSupported()\n const colors = getYoctocolors()\n const theme = getTheme()\n\n // Get colors from theme\n const successColor = theme.colors.success\n const errorColor = theme.colors.error\n const warningColor = theme.colors.warning\n const infoColor = theme.colors.info\n const stepColor = theme.colors.step\n\n // Update symbol values\n target.fail = applyColor(supported ? '\u2716' : '\u00D7', errorColor, colors)\n target.info = applyColor(supported ? '\u2139' : 'i', infoColor, colors)\n target.step = applyColor(supported ? '\u2192' : '>', stepColor, colors)\n target.success = applyColor(supported ? '\u2714' : '\u221A', successColor, colors)\n target.warn = applyColor(supported ? '\u26A0' : '\u203C', warningColor, colors)\n }\n\n const init = () => {\n if (initialized) {\n return\n }\n\n updateSymbols()\n initialized = true\n\n // The handler of a Proxy is mutable after proxy instantiation.\n // We delete the traps to defer to native behavior for better performance.\n for (const trapName in handler) {\n delete handler[trapName as keyof ProxyHandler<Record<string, string>>]\n }\n }\n\n const reset = () => {\n if (!initialized) {\n return\n }\n\n // Update symbols with new theme colors\n updateSymbols()\n }\n\n for (const trapName of Reflect.ownKeys(Reflect)) {\n const fn = (Reflect as Record<PropertyKey, unknown>)[trapName]\n if (typeof fn === 'function') {\n ;(handler as Record<string, (...args: unknown[]) => unknown>)[\n trapName as string\n ] = (...args: unknown[]) => {\n init()\n return fn(...args)\n }\n }\n }\n\n // Listen for theme changes and reset symbols\n onThemeChange(() => {\n reset()\n })\n\n return new Proxy(target, handler)\n})()\n\nconst boundConsoleEntries = [\n // Add bound properties from console[kBindProperties](ignoreErrors, colorMode, groupIndentation).\n // https://github.com/nodejs/node/blob/v24.0.1/lib/internal/console/constructor.js#L230-L265\n '_stderrErrorHandler',\n '_stdoutErrorHandler',\n // Add methods that need to be bound to function properly.\n 'assert',\n 'clear',\n 'count',\n 'countReset',\n 'createTask',\n 'debug',\n 'dir',\n 'dirxml',\n 'error',\n // Skip group methods because in at least Node 20 with the Node --frozen-intrinsics\n // flag it triggers a readonly property for Symbol(kGroupIndent). Instead, we\n // implement these methods ourselves.\n //'group',\n //'groupCollapsed',\n //'groupEnd',\n 'info',\n 'log',\n 'table',\n 'time',\n 'timeEnd',\n 'timeLog',\n 'trace',\n 'warn',\n]\n .filter(n => typeof (globalConsole as any)[n] === 'function')\n .map(n => [n, (globalConsole as any)[n].bind(globalConsole)])\n\nconst consolePropAttributes = {\n __proto__: null,\n writable: true,\n enumerable: false,\n configurable: true,\n}\nconst maxIndentation = 1000\n\n/**\n * WeakMap storing the Console instance for each Logger.\n *\n * Console creation is lazy - deferred until first logging method call.\n * This allows logger to be imported during early Node.js bootstrap before\n * stdout is ready, avoiding ERR_CONSOLE_WRITABLE_STREAM errors.\n */\nconst privateConsole = new WeakMap()\n\n/**\n * WeakMap storing constructor arguments for lazy Console initialization.\n *\n * WeakMap is required instead of a private field (#constructorArgs) because:\n * 1. Private fields can't be accessed from dynamically created functions\n * 2. Logger adds console methods dynamically to its prototype (lines 1560+)\n * 3. These dynamic methods need constructor args for lazy initialization\n * 4. WeakMap allows both regular methods and dynamic functions to access args\n *\n * The args are deleted from the WeakMap after Console is created (memory cleanup).\n */\nconst privateConstructorArgs = new WeakMap()\n\n/**\n * Lazily get console symbols on first access.\n *\n * Deferred to avoid accessing global console during early Node.js bootstrap\n * before stdout is ready.\n * @private\n */\nlet _consoleSymbols: symbol[] | undefined\nfunction getConsoleSymbols(): symbol[] {\n if (_consoleSymbols === undefined) {\n _consoleSymbols = Object.getOwnPropertySymbols(globalConsole)\n }\n return _consoleSymbols\n}\n\n/**\n * Symbol for incrementing the internal log call counter.\n *\n * This is an internal symbol used to track the number of times logging\n * methods have been called on a logger instance.\n */\nexport const incLogCallCountSymbol = Symbol.for('logger.logCallCount++')\n\n/**\n * Lazily get kGroupIndentationWidth symbol on first access.\n * @private\n */\nlet _kGroupIndentationWidthSymbol: symbol | undefined\nfunction getKGroupIndentationWidthSymbol(): symbol {\n if (_kGroupIndentationWidthSymbol === undefined) {\n _kGroupIndentationWidthSymbol =\n getConsoleSymbols().find(s => (s as any).label === 'kGroupIndentWidth') ??\n Symbol('kGroupIndentWidth')\n }\n return _kGroupIndentationWidthSymbol\n}\n\n/**\n * Symbol for tracking whether the last logged line was blank.\n *\n * This is used internally to prevent multiple consecutive blank lines\n * and to determine whether to add spacing before certain messages.\n */\nexport const lastWasBlankSymbol = Symbol.for('logger.lastWasBlank')\n\n/**\n * Enhanced console logger with indentation, colored symbols, and stream management.\n *\n * Provides a fluent API for logging with automatic indentation tracking, colored\n * status symbols, separate stderr/stdout management, and method chaining. All\n * methods return `this` for easy chaining.\n *\n * Features:\n * - Automatic line prefixing with indentation\n * - Colored status symbols (success, fail, warn, info)\n * - Separate indentation tracking for stderr and stdout\n * - Stream-bound logger instances via `.stderr` and `.stdout`\n * - Group/indentation management\n * - Progress indicators with clearable lines\n * - Task execution with automatic logging\n *\n * @example\n * ```typescript\n * import { logger } from '@socketsecurity/lib'\n *\n * // Basic logging with symbols\n * logger.success('Build completed')\n * logger.fail('Build failed')\n * logger.warn('Deprecated API')\n * logger.info('Starting process')\n *\n * // Indentation and grouping\n * logger.log('Processing files:')\n * logger.indent()\n * logger.log('file1.js')\n * logger.log('file2.js')\n * logger.dedent()\n *\n * // Method chaining\n * logger\n * .log('Step 1')\n * .indent()\n * .log('Substep 1.1')\n * .log('Substep 1.2')\n * .dedent()\n * .log('Step 2')\n *\n * // Stream-specific logging\n * logger.stdout.log('Normal output')\n * logger.stderr.error('Error message')\n *\n * // Progress indicators\n * logger.progress('Processing...')\n * // ... do work ...\n * logger.clearLine()\n * logger.success('Done')\n *\n * // Task execution\n * const task = logger.createTask('Migration')\n * task.run(() => {\n * // Migration logic\n * })\n * ```\n */\n/*@__PURE__*/\nexport class Logger {\n /**\n * Static reference to log symbols for convenience.\n *\n * @example\n * ```typescript\n * console.log(`${Logger.LOG_SYMBOLS.success} Done`)\n * ```\n */\n static LOG_SYMBOLS = LOG_SYMBOLS\n\n #parent?: Logger\n #boundStream?: 'stderr' | 'stdout'\n #stderrLogger?: Logger\n #stdoutLogger?: Logger\n #stderrIndention = ''\n #stdoutIndention = ''\n #stderrLastWasBlank = false\n #stdoutLastWasBlank = false\n #logCallCount = 0\n #options: Record<string, unknown>\n #originalStdout?: any\n\n /**\n * Creates a new Logger instance.\n *\n * When called without arguments, creates a logger using the default\n * `process.stdout` and `process.stderr` streams. Can accept custom\n * console constructor arguments for advanced use cases.\n *\n * @param args - Optional console constructor arguments\n *\n * @example\n * ```typescript\n * // Default logger\n * const logger = new Logger()\n *\n * // Custom streams (advanced)\n * const customLogger = new Logger({\n * stdout: customWritableStream,\n * stderr: customErrorStream\n * })\n * ```\n */\n constructor(...args: unknown[]) {\n // Store constructor args for lazy Console initialization.\n privateConstructorArgs.set(this, args)\n\n // Store options if provided (for future extensibility)\n const options = args['0']\n if (typeof options === 'object' && options !== null) {\n this.#options = { __proto__: null, ...options }\n // Store reference to original stdout stream to bypass Console formatting\n this.#originalStdout = (options as any).stdout\n } else {\n this.#options = { __proto__: null }\n }\n\n // Note: Console initialization is now lazy (happens on first use).\n // This allows logger to be imported during early bootstrap before\n // stdout is ready, avoiding ERR_CONSOLE_WRITABLE_STREAM errors.\n }\n\n /**\n * Get the Console instance for this logger, creating it lazily on first access.\n *\n * This lazy initialization allows the logger to be imported during early\n * Node.js bootstrap before stdout is ready, avoiding Console initialization\n * errors (ERR_CONSOLE_WRITABLE_STREAM).\n *\n * @private\n */\n #getConsole(): typeof console & Record<string, unknown> {\n // Ensure prototype is initialized before creating Console.\n ensurePrototypeInitialized()\n\n let con = privateConsole.get(this)\n if (!con) {\n // Lazy initialization - create Console on first use.\n const ctorArgs = privateConstructorArgs.get(this) ?? []\n if (ctorArgs.length) {\n con = constructConsole(...ctorArgs)\n } else {\n // Create a new console that acts like the builtin one so that it will\n // work with Node's --frozen-intrinsics flag.\n con = constructConsole({\n stdout: process.stdout,\n stderr: process.stderr,\n }) as typeof console & Record<string, unknown>\n for (const { 0: key, 1: method } of boundConsoleEntries) {\n con[key] = method\n }\n }\n privateConsole.set(this, con)\n // Clean up constructor args - no longer needed after Console creation.\n privateConstructorArgs.delete(this)\n }\n return con\n }\n\n /**\n * Gets a logger instance bound exclusively to stderr.\n *\n * All logging operations on this instance will write to stderr only.\n * Indentation is tracked separately from stdout. The instance is\n * cached and reused on subsequent accesses.\n *\n * @returns A logger instance bound to stderr\n *\n * @example\n * ```typescript\n * // Write errors to stderr\n * logger.stderr.error('Configuration invalid')\n * logger.stderr.warn('Using fallback settings')\n *\n * // Indent only affects stderr\n * logger.stderr.indent()\n * logger.stderr.error('Nested error details')\n * logger.stderr.dedent()\n * ```\n */\n get stderr(): Logger {\n if (!this.#stderrLogger) {\n // Pass parent's constructor args to maintain config.\n const ctorArgs = privateConstructorArgs.get(this) ?? []\n const instance = new Logger(...ctorArgs)\n instance.#parent = this\n instance.#boundStream = 'stderr'\n instance.#options = { __proto__: null, ...this.#options }\n this.#stderrLogger = instance\n }\n return this.#stderrLogger\n }\n\n /**\n * Gets a logger instance bound exclusively to stdout.\n *\n * All logging operations on this instance will write to stdout only.\n * Indentation is tracked separately from stderr. The instance is\n * cached and reused on subsequent accesses.\n *\n * @returns A logger instance bound to stdout\n *\n * @example\n * ```typescript\n * // Write normal output to stdout\n * logger.stdout.log('Processing started')\n * logger.stdout.log('Items processed: 42')\n *\n * // Indent only affects stdout\n * logger.stdout.indent()\n * logger.stdout.log('Detailed output')\n * logger.stdout.dedent()\n * ```\n */\n get stdout(): Logger {\n if (!this.#stdoutLogger) {\n // Pass parent's constructor args to maintain config.\n const ctorArgs = privateConstructorArgs.get(this) ?? []\n const instance = new Logger(...ctorArgs)\n instance.#parent = this\n instance.#boundStream = 'stdout'\n instance.#options = { __proto__: null, ...this.#options }\n this.#stdoutLogger = instance\n }\n return this.#stdoutLogger\n }\n\n /**\n * Get the root logger (for accessing shared indentation state).\n * @private\n */\n #getRoot(): Logger {\n return this.#parent || this\n }\n\n /**\n * Get indentation for a specific stream.\n * @private\n */\n #getIndent(stream: 'stderr' | 'stdout'): string {\n const root = this.#getRoot()\n return stream === 'stderr' ? root.#stderrIndention : root.#stdoutIndention\n }\n\n /**\n * Set indentation for a specific stream.\n * @private\n */\n #setIndent(stream: 'stderr' | 'stdout', value: string): void {\n const root = this.#getRoot()\n if (stream === 'stderr') {\n root.#stderrIndention = value\n } else {\n root.#stdoutIndention = value\n }\n }\n\n /**\n * Get lastWasBlank state for a specific stream.\n * @private\n */\n #getLastWasBlank(stream: 'stderr' | 'stdout'): boolean {\n const root = this.#getRoot()\n return stream === 'stderr'\n ? root.#stderrLastWasBlank\n : root.#stdoutLastWasBlank\n }\n\n /**\n * Set lastWasBlank state for a specific stream.\n * @private\n */\n #setLastWasBlank(stream: 'stderr' | 'stdout', value: boolean): void {\n const root = this.#getRoot()\n if (stream === 'stderr') {\n root.#stderrLastWasBlank = value\n } else {\n root.#stdoutLastWasBlank = value\n }\n }\n\n /**\n * Get the target stream for this logger instance.\n * @private\n */\n #getTargetStream(): 'stderr' | 'stdout' {\n return this.#boundStream || 'stderr'\n }\n\n /**\n * Apply a console method with indentation.\n * @private\n */\n #apply(\n methodName: string,\n args: unknown[],\n stream?: 'stderr' | 'stdout',\n ): this {\n const con = this.#getConsole()\n const text = args.at(0)\n const hasText = typeof text === 'string'\n // Determine which stream this method writes to\n const targetStream = stream || (methodName === 'log' ? 'stdout' : 'stderr')\n const indent = this.#getIndent(targetStream)\n const logArgs = hasText\n ? [applyLinePrefix(text, { prefix: indent }), ...args.slice(1)]\n : args\n ReflectApply(\n con[methodName] as (...args: unknown[]) => unknown,\n con,\n logArgs,\n )\n this[lastWasBlankSymbol](hasText && isBlankString(logArgs[0]), targetStream)\n ;(this as any)[incLogCallCountSymbol]()\n return this\n }\n\n /**\n * Strip log symbols from the start of text.\n * @private\n */\n #stripSymbols(text: string): string {\n // Strip both unicode and emoji forms of log symbols from the start.\n // Matches: \u2716, \u2717, \u00D7, \u2716\uFE0F, \u26A0, \u203C, \u26A0\uFE0F, \u2714, \u2713, \u221A, \u2714\uFE0F, \u2713\uFE0F, \u2139, \u2139\uFE0F, \u2192, >\n // Also handles variation selectors (U+FE0F) and whitespace after symbol.\n // Note: We don't strip standalone 'i' or '>' to avoid breaking words.\n return text.replace(/^[\u2716\u2717\u00D7\u26A0\u203C\u2714\u2713\u221A\u2139\u2192]\\uFE0F?\\s*/u, '')\n }\n\n /**\n * Apply a method with a symbol prefix.\n * @private\n */\n #symbolApply(symbolType: string, args: unknown[]): this {\n const con = this.#getConsole()\n let text = args.at(0)\n // biome-ignore lint/suspicious/noImplicitAnyLet: Flexible argument handling.\n let extras\n if (typeof text === 'string') {\n text = this.#stripSymbols(text)\n extras = args.slice(1)\n } else {\n extras = args\n text = ''\n }\n // Note: Meta status messages (info/fail/etc) always go to stderr.\n const indent = this.#getIndent('stderr')\n con.error(\n applyLinePrefix(`${LOG_SYMBOLS[symbolType]} ${text}`, {\n prefix: indent,\n }),\n ...extras,\n )\n this[lastWasBlankSymbol](false, 'stderr')\n ;(this as any)[incLogCallCountSymbol]()\n return this\n }\n\n /**\n * Gets the total number of log calls made on this logger instance.\n *\n * Tracks all logging method calls including `log()`, `error()`, `warn()`,\n * `success()`, `fail()`, etc. Useful for testing and monitoring logging activity.\n *\n * @returns The number of times logging methods have been called\n *\n * @example\n * ```typescript\n * logger.log('Message 1')\n * logger.error('Message 2')\n * console.log(logger.logCallCount) // 2\n * ```\n */\n get logCallCount() {\n const root = this.#getRoot()\n return root.#logCallCount\n }\n\n /**\n * Increments the internal log call counter.\n *\n * This is called automatically by logging methods and should not\n * be called directly in normal usage.\n *\n * @returns The logger instance for chaining\n */\n [incLogCallCountSymbol]() {\n const root = this.#getRoot()\n root.#logCallCount += 1\n return this\n }\n\n /**\n * Sets whether the last logged line was blank.\n *\n * Used internally to track blank lines and prevent duplicate spacing.\n * This is called automatically by logging methods.\n *\n * @param value - Whether the last line was blank\n * @param stream - Optional stream to update (defaults to both streams if not bound, or target stream if bound)\n * @returns The logger instance for chaining\n */\n [lastWasBlankSymbol](value: unknown, stream?: 'stderr' | 'stdout'): this {\n if (stream) {\n // Explicit stream specified\n this.#setLastWasBlank(stream, !!value)\n } else if (this.#boundStream) {\n // Stream-bound logger - affect only the bound stream\n this.#setLastWasBlank(this.#boundStream, !!value)\n } else {\n // Root logger with no stream specified - affect both streams\n this.#setLastWasBlank('stderr', !!value)\n this.#setLastWasBlank('stdout', !!value)\n }\n return this\n }\n\n /**\n * Logs an assertion failure message if the value is falsy.\n *\n * Works like `console.assert()` but returns the logger for chaining.\n * If the value is truthy, nothing is logged. If falsy, logs an error\n * message with an assertion failure.\n *\n * @param value - The value to test\n * @param message - Optional message and additional arguments to log\n * @returns The logger instance for chaining\n *\n * @example\n * ```typescript\n * logger.assert(true, 'This will not log')\n * logger.assert(false, 'Assertion failed: value is false')\n * logger.assert(items.length > 0, 'No items found')\n * ```\n */\n assert(value: unknown, ...message: unknown[]): this {\n const con = this.#getConsole()\n con.assert(value, message[0] as string, ...message.slice(1))\n this[lastWasBlankSymbol](false)\n return value ? this : this[incLogCallCountSymbol]()\n }\n\n /**\n * Clears the visible terminal screen.\n *\n * Only available on the main logger instance, not on stream-bound instances\n * (`.stderr` or `.stdout`). Resets the log call count and blank line tracking\n * if the output is a TTY.\n *\n * @returns The logger instance for chaining\n * @throws {Error} If called on a stream-bound logger instance\n *\n * @example\n * ```typescript\n * logger.log('Some output')\n * logger.clearVisible() // Screen is now clear\n *\n * // Error: Can't call on stream-bound instance\n * logger.stderr.clearVisible() // throws\n * ```\n */\n clearVisible() {\n if (this.#boundStream) {\n throw new Error(\n 'clearVisible() is only available on the main logger instance, not on stream-bound instances',\n )\n }\n const con = this.#getConsole()\n con.clear()\n if ((con as any)._stdout.isTTY) {\n ;(this as any)[lastWasBlankSymbol](true)\n this.#logCallCount = 0\n }\n return this\n }\n\n /**\n * Increments and logs a counter for the given label.\n *\n * Each unique label maintains its own counter. Works like `console.count()`.\n *\n * @param label - Optional label for the counter\n * @default 'default'\n * @returns The logger instance for chaining\n *\n * @example\n * ```typescript\n * logger.count('requests') // requests: 1\n * logger.count('requests') // requests: 2\n * logger.count('errors') // errors: 1\n * logger.count() // default: 1\n * ```\n */\n count(label?: string | undefined): this {\n const con = this.#getConsole()\n con.count(label)\n this[lastWasBlankSymbol](false)\n return this[incLogCallCountSymbol]()\n }\n\n /**\n * Creates a task that logs start and completion messages automatically.\n *\n * Returns a task object with a `run()` method that executes the provided\n * function and logs \"Starting task: {name}\" before execution and\n * \"Completed task: {name}\" after completion.\n *\n * @param name - The name of the task\n * @returns A task object with a `run()` method\n *\n * @example\n * ```typescript\n * const task = logger.createTask('Database Migration')\n * const result = task.run(() => {\n * // Logs: \"Starting task: Database Migration\"\n * migrateDatabase()\n * return 'success'\n * // Logs: \"Completed task: Database Migration\"\n * })\n * console.log(result) // 'success'\n * ```\n */\n createTask(name: string): Task {\n return {\n run: <T>(f: () => T): T => {\n this.log(`Starting task: ${name}`)\n const result = f()\n this.log(`Completed task: ${name}`)\n return result\n },\n }\n }\n\n /**\n * Decreases the indentation level by removing spaces from the prefix.\n *\n * When called on the main logger, affects both stderr and stdout indentation.\n * When called on a stream-bound logger (`.stderr` or `.stdout`), affects\n * only that stream's indentation.\n *\n * @param spaces - Number of spaces to remove from indentation\n * @default 2\n * @returns The logger instance for chaining\n *\n * @example\n * ```typescript\n * logger.indent()\n * logger.log('Indented')\n * logger.dedent()\n * logger.log('Back to normal')\n *\n * // Remove custom amount\n * logger.indent(4)\n * logger.log('Four spaces')\n * logger.dedent(4)\n *\n * // Stream-specific dedent\n * logger.stdout.indent()\n * logger.stdout.log('Indented stdout')\n * logger.stdout.dedent()\n * ```\n */\n dedent(spaces = 2) {\n if (this.#boundStream) {\n // Only affect bound stream\n const current = this.#getIndent(this.#boundStream)\n this.#setIndent(this.#boundStream, current.slice(0, -spaces))\n } else {\n // Affect both streams\n const stderrCurrent = this.#getIndent('stderr')\n const stdoutCurrent = this.#getIndent('stdout')\n this.#setIndent('stderr', stderrCurrent.slice(0, -spaces))\n this.#setIndent('stdout', stdoutCurrent.slice(0, -spaces))\n }\n return this\n }\n\n /**\n * Displays an object's properties in a formatted way.\n *\n * Works like `console.dir()` with customizable options for depth,\n * colors, etc. Useful for inspecting complex objects.\n *\n * @param obj - The object to display\n * @param options - Optional formatting options (Node.js inspect options)\n * @returns The logger instance for chaining\n *\n * @example\n * ```typescript\n * const obj = { a: 1, b: { c: 2, d: { e: 3 } } }\n * logger.dir(obj)\n * logger.dir(obj, { depth: 1 }) // Limit nesting depth\n * logger.dir(obj, { colors: true }) // Enable colors\n * ```\n */\n dir(obj: unknown, options?: unknown | undefined): this {\n const con = this.#getConsole()\n con.dir(obj, options)\n this[lastWasBlankSymbol](false)\n return this[incLogCallCountSymbol]()\n }\n\n /**\n * Displays data as XML/HTML in a formatted way.\n *\n * Works like `console.dirxml()`. In Node.js, behaves the same as `dir()`.\n *\n * @param data - The data to display\n * @returns The logger instance for chaining\n *\n * @example\n * ```typescript\n * logger.dirxml(document.body) // In browser environments\n * logger.dirxml(xmlObject) // In Node.js\n * ```\n */\n dirxml(...data: unknown[]): this {\n const con = this.#getConsole()\n con.dirxml(data)\n this[lastWasBlankSymbol](false)\n return this[incLogCallCountSymbol]()\n }\n\n /**\n * Logs an error message to stderr.\n *\n * Automatically applies current indentation. All arguments are formatted\n * and logged like `console.error()`.\n *\n * @param args - Message and additional arguments to log\n * @returns The logger instance for chaining\n *\n * @example\n * ```typescript\n * logger.error('Build failed')\n * logger.error('Error code:', 500)\n * logger.error('Details:', { message: 'Not found' })\n * ```\n */\n error(...args: unknown[]): this {\n return this.#apply('error', args)\n }\n\n /**\n * Logs a newline to stderr only if the last line wasn't already blank.\n *\n * Prevents multiple consecutive blank lines. Useful for adding spacing\n * between sections without creating excessive whitespace.\n *\n * @returns The logger instance for chaining\n *\n * @example\n * ```typescript\n * logger.error('Error message')\n * logger.errorNewline() // Adds blank line\n * logger.errorNewline() // Does nothing (already blank)\n * logger.error('Next section')\n * ```\n */\n errorNewline() {\n return this.#getLastWasBlank('stderr') ? this : this.error('')\n }\n\n /**\n * Logs a failure message with a red colored fail symbol.\n *\n * Automatically prefixes the message with `LOG_SYMBOLS.fail` (red \u2716).\n * Always outputs to stderr. If the message starts with an existing\n * symbol, it will be stripped and replaced.\n *\n * @param args - Message and additional arguments to log\n * @returns The logger instance for chaining\n *\n * @example\n * ```typescript\n * logger.fail('Build failed')\n * logger.fail('Test suite failed:', { passed: 5, failed: 3 })\n * ```\n */\n fail(...args: unknown[]): this {\n return this.#symbolApply('fail', args)\n }\n\n /**\n * Starts a new indented log group.\n *\n * If a label is provided, it's logged before increasing indentation.\n * Groups can be nested. Each group increases indentation by the\n * `kGroupIndentWidth` (default 2 spaces). Call `groupEnd()` to close.\n *\n * @param label - Optional label to display before the group\n * @returns The logger instance for chaining\n *\n * @example\n * ```typescript\n * logger.group('Processing files:')\n * logger.log('file1.js')\n * logger.log('file2.js')\n * logger.groupEnd()\n *\n * // Nested groups\n * logger.group('Outer')\n * logger.log('Outer content')\n * logger.group('Inner')\n * logger.log('Inner content')\n * logger.groupEnd()\n * logger.groupEnd()\n * ```\n */\n group(...label: unknown[]): this {\n const { length } = label\n if (length) {\n ReflectApply(this.log, this, label)\n }\n this.indent((this as any)[getKGroupIndentationWidthSymbol()])\n if (length) {\n ;(this as any)[lastWasBlankSymbol](false)\n ;(this as any)[incLogCallCountSymbol]()\n }\n return this\n }\n\n /**\n * Starts a new collapsed log group (alias for `group()`).\n *\n * In browser consoles, this creates a collapsed group. In Node.js,\n * it behaves identically to `group()`.\n *\n * @param label - Optional label to display before the group\n * @returns The logger instance for chaining\n *\n * @example\n * ```typescript\n * logger.groupCollapsed('Details')\n * logger.log('Hidden by default in browsers')\n * logger.groupEnd()\n * ```\n */\n // groupCollapsed is an alias of group.\n // https://nodejs.org/api/console.html#consolegroupcollapsed\n groupCollapsed(...label: unknown[]): this {\n return ReflectApply(this.group, this, label)\n }\n\n /**\n * Ends the current log group and decreases indentation.\n *\n * Must be called once for each `group()` or `groupCollapsed()` call\n * to properly close the group and restore indentation.\n *\n * @returns The logger instance for chaining\n *\n * @example\n * ```typescript\n * logger.group('Group 1')\n * logger.log('Content')\n * logger.groupEnd() // Closes 'Group 1'\n * ```\n */\n groupEnd() {\n this.dedent((this as any)[getKGroupIndentationWidthSymbol()])\n return this\n }\n\n /**\n * Increases the indentation level by adding spaces to the prefix.\n *\n * When called on the main logger, affects both stderr and stdout indentation.\n * When called on a stream-bound logger (`.stderr` or `.stdout`), affects\n * only that stream's indentation. Maximum indentation is 1000 spaces.\n *\n * @param spaces - Number of spaces to add to indentation\n * @default 2\n * @returns The logger instance for chaining\n *\n * @example\n * ```typescript\n * logger.log('Level 0')\n * logger.indent()\n * logger.log('Level 1')\n * logger.indent()\n * logger.log('Level 2')\n * logger.dedent()\n * logger.dedent()\n *\n * // Custom indent amount\n * logger.indent(4)\n * logger.log('Indented 4 spaces')\n * logger.dedent(4)\n *\n * // Stream-specific indent\n * logger.stdout.indent()\n * logger.stdout.log('Only stdout is indented')\n * ```\n */\n indent(spaces = 2) {\n const spacesToAdd = ' '.repeat(Math.min(spaces, maxIndentation))\n if (this.#boundStream) {\n // Only affect bound stream\n const current = this.#getIndent(this.#boundStream)\n this.#setIndent(this.#boundStream, current + spacesToAdd)\n } else {\n // Affect both streams\n const stderrCurrent = this.#getIndent('stderr')\n const stdoutCurrent = this.#getIndent('stdout')\n this.#setIndent('stderr', stderrCurrent + spacesToAdd)\n this.#setIndent('stdout', stdoutCurrent + spacesToAdd)\n }\n return this\n }\n\n /**\n * Logs an informational message with a blue colored info symbol.\n *\n * Automatically prefixes the message with `LOG_SYMBOLS.info` (blue \u2139).\n * Always outputs to stderr. If the message starts with an existing\n * symbol, it will be stripped and replaced.\n *\n * @param args - Message and additional arguments to log\n * @returns The logger instance for chaining\n *\n * @example\n * ```typescript\n * logger.info('Starting build process')\n * logger.info('Configuration loaded:', config)\n * logger.info('Using cache directory:', cacheDir)\n * ```\n */\n info(...args: unknown[]): this {\n return this.#symbolApply('info', args)\n }\n\n /**\n * Logs a message to stdout.\n *\n * Automatically applies current indentation. All arguments are formatted\n * and logged like `console.log()`. This is the primary method for\n * standard output.\n *\n * @param args - Message and additional arguments to log\n * @returns The logger instance for chaining\n *\n * @example\n * ```typescript\n * logger.log('Processing complete')\n * logger.log('Items processed:', 42)\n * logger.log('Results:', { success: true, count: 10 })\n *\n * // Method chaining\n * logger.log('Step 1').log('Step 2').log('Step 3')\n * ```\n */\n log(...args: unknown[]): this {\n return this.#apply('log', args)\n }\n\n /**\n * Logs a newline to stdout only if the last line wasn't already blank.\n *\n * Prevents multiple consecutive blank lines. Useful for adding spacing\n * between sections without creating excessive whitespace.\n *\n * @returns The logger instance for chaining\n *\n * @example\n * ```typescript\n * logger.log('Section 1')\n * logger.logNewline() // Adds blank line\n * logger.logNewline() // Does nothing (already blank)\n * logger.log('Section 2')\n * ```\n */\n logNewline() {\n return this.#getLastWasBlank('stdout') ? this : this.log('')\n }\n\n /**\n * Resets all indentation to zero.\n *\n * When called on the main logger, resets both stderr and stdout indentation.\n * When called on a stream-bound logger (`.stderr` or `.stdout`), resets\n * only that stream's indentation.\n *\n * @returns The logger instance for chaining\n *\n * @example\n * ```typescript\n * logger.indent().indent().indent()\n * logger.log('Very indented')\n * logger.resetIndent()\n * logger.log('Back to zero indentation')\n *\n * // Reset only stdout\n * logger.stdout.resetIndent()\n * ```\n */\n resetIndent() {\n if (this.#boundStream) {\n // Only reset bound stream\n this.#setIndent(this.#boundStream, '')\n } else {\n // Reset both streams\n this.#setIndent('stderr', '')\n this.#setIndent('stdout', '')\n }\n return this\n }\n\n /**\n * Logs a main step message with a cyan arrow symbol and blank line before it.\n *\n * Automatically prefixes the message with `LOG_SYMBOLS.step` (cyan \u2192) and\n * adds a blank line before the message unless the last line was already blank.\n * Useful for marking major steps in a process with clear visual separation.\n * Always outputs to stdout. If the message starts with an existing symbol,\n * it will be stripped and replaced.\n *\n * @param msg - The step message to log\n * @param extras - Additional arguments to log\n * @returns The logger instance for chaining\n *\n * @example\n * ```typescript\n * logger.step('Building project')\n * logger.log('Compiling TypeScript...')\n * logger.step('Running tests')\n * logger.log('Running test suite...')\n * // Output:\n * // [blank line]\n * // \u2192 Building project\n * // Compiling TypeScript...\n * // [blank line]\n * // \u2192 Running tests\n * // Running test suite...\n * ```\n */\n step(msg: string, ...extras: unknown[]): this {\n // Add blank line before the step message.\n if (!this.#getLastWasBlank('stdout')) {\n // Use this.log() to properly track the blank line.\n this.log('')\n }\n // Strip existing symbols from the message.\n const text = this.#stripSymbols(msg)\n // Note: Step messages always go to stdout (unlike info/fail/etc which go to stderr).\n const indent = this.#getIndent('stdout')\n const con = this.#getConsole() as typeof console & Record<string, unknown>\n con.log(\n applyLinePrefix(`${LOG_SYMBOLS.step} ${text}`, {\n prefix: indent,\n }),\n ...extras,\n )\n this[lastWasBlankSymbol](false, 'stdout')\n ;(this as any)[incLogCallCountSymbol]()\n return this\n }\n\n /**\n * Logs an indented substep message (stateless).\n *\n * Adds a 2-space indent to the message without affecting the logger's\n * indentation state. Useful for showing sub-items under a main step.\n *\n * @param msg - The substep message to log\n * @param extras - Additional arguments to log\n * @returns The logger instance for chaining\n *\n * @example\n * ```typescript\n * logger.log('Installing dependencies:')\n * logger.substep('Installing react')\n * logger.substep('Installing typescript')\n * logger.substep('Installing eslint')\n * // Output:\n * // Installing dependencies:\n * // Installing react\n * // Installing typescript\n * // Installing eslint\n * ```\n */\n substep(msg: string, ...extras: unknown[]): this {\n // Add 2-space indent to the message.\n const indentedMsg = ` ${msg}`\n // Let log() handle all tracking.\n return this.log(indentedMsg, ...extras)\n }\n\n /**\n * Logs a success message with a green colored success symbol.\n *\n * Automatically prefixes the message with `LOG_SYMBOLS.success` (green \u2714).\n * Always outputs to stderr. If the message starts with an existing\n * symbol, it will be stripped and replaced.\n *\n * @param args - Message and additional arguments to log\n * @returns The logger instance for chaining\n *\n * @example\n * ```typescript\n * logger.success('Build completed')\n * logger.success('Tests passed:', { total: 42, passed: 42 })\n * logger.success('Deployment successful')\n * ```\n */\n success(...args: unknown[]): this {\n return this.#symbolApply('success', args)\n }\n\n /**\n * Logs a completion message with a success symbol (alias for `success()`).\n *\n * Provides semantic clarity when marking something as \"done\". Does NOT\n * automatically clear the current line - call `clearLine()` first if\n * needed after using `progress()`.\n *\n * @param args - Message and additional arguments to log\n * @returns The logger instance for chaining\n *\n * @example\n * ```typescript\n * logger.done('Task completed')\n *\n * // After progress indicator\n * logger.progress('Processing...')\n * // ... do work ...\n * logger.clearLine()\n * logger.done('Processing complete')\n * ```\n */\n done(...args: unknown[]): this {\n return this.#symbolApply('success', args)\n }\n\n /**\n * Displays data in a table format.\n *\n * Works like `console.table()`. Accepts arrays of objects or\n * objects with nested objects. Optionally specify which properties\n * to include in the table.\n *\n * @param tabularData - The data to display as a table\n * @param properties - Optional array of property names to include\n * @returns The logger instance for chaining\n *\n * @example\n * ```typescript\n * // Array of objects\n * logger.table([\n * { name: 'Alice', age: 30 },\n * { name: 'Bob', age: 25 }\n * ])\n *\n * // Specify properties to show\n * logger.table(users, ['name', 'email'])\n *\n * // Object with nested objects\n * logger.table({\n * user1: { name: 'Alice', age: 30 },\n * user2: { name: 'Bob', age: 25 }\n * })\n * ```\n */\n table(\n tabularData: unknown,\n properties?: readonly string[] | undefined,\n ): this {\n const con = this.#getConsole()\n con.table(tabularData, properties)\n this[lastWasBlankSymbol](false)\n return this[incLogCallCountSymbol]()\n }\n\n /**\n * Ends a timer and logs the elapsed time.\n *\n * Logs the duration since `console.time()` was called with the same\n * label. The timer is stopped and removed.\n *\n * @param label - Optional label for the timer\n * @default 'default'\n * @returns The logger instance for chaining\n *\n * @example\n * ```typescript\n * console.time('operation')\n * // ... do work ...\n * logger.timeEnd('operation')\n * // Logs: \"operation: 123.456ms\"\n *\n * console.time()\n * // ... do work ...\n * logger.timeEnd()\n * // Logs: \"default: 123.456ms\"\n * ```\n */\n timeEnd(label?: string | undefined): this {\n const con = this.#getConsole()\n con.timeEnd(label)\n this[lastWasBlankSymbol](false)\n return this[incLogCallCountSymbol]()\n }\n\n /**\n * Logs the current value of a timer without stopping it.\n *\n * Logs the duration since `console.time()` was called with the same\n * label, but keeps the timer running. Can include additional data\n * to log alongside the time.\n *\n * @param label - Optional label for the timer\n * @param data - Additional data to log with the time\n * @default 'default'\n * @returns The logger instance for chaining\n *\n * @example\n * ```typescript\n * console.time('process')\n * // ... partial work ...\n * logger.timeLog('process', 'Checkpoint 1')\n * // Logs: \"process: 123.456ms Checkpoint 1\"\n * // ... more work ...\n * logger.timeLog('process', 'Checkpoint 2')\n * // Logs: \"process: 234.567ms Checkpoint 2\"\n * console.timeEnd('process')\n * ```\n */\n timeLog(label?: string | undefined, ...data: unknown[]): this {\n const con = this.#getConsole()\n con.timeLog(label, ...data)\n this[lastWasBlankSymbol](false)\n return this[incLogCallCountSymbol]()\n }\n\n /**\n * Logs a stack trace to the console.\n *\n * Works like `console.trace()`. Shows the call stack leading to\n * where this method was called. Useful for debugging.\n *\n * @param message - Optional message to display with the trace\n * @param args - Additional arguments to log\n * @returns The logger instance for chaining\n *\n * @example\n * ```typescript\n * function debugFunction() {\n * logger.trace('Debug point reached')\n * }\n *\n * logger.trace('Trace from here')\n * logger.trace('Error context:', { userId: 123 })\n * ```\n */\n trace(message?: unknown | undefined, ...args: unknown[]): this {\n const con = this.#getConsole()\n con.trace(message, ...args)\n this[lastWasBlankSymbol](false)\n return this[incLogCallCountSymbol]()\n }\n\n /**\n * Logs a warning message with a yellow colored warning symbol.\n *\n * Automatically prefixes the message with `LOG_SYMBOLS.warn` (yellow \u26A0).\n * Always outputs to stderr. If the message starts with an existing\n * symbol, it will be stripped and replaced.\n *\n * @param args - Message and additional arguments to log\n * @returns The logger instance for chaining\n *\n * @example\n * ```typescript\n * logger.warn('Deprecated API used')\n * logger.warn('Low memory:', { available: '100MB' })\n * logger.warn('Missing optional configuration')\n * ```\n */\n warn(...args: unknown[]): this {\n return this.#symbolApply('warn', args)\n }\n\n /**\n * Writes text directly to stdout without a newline or indentation.\n *\n * Useful for progress indicators or custom formatting where you need\n * low-level control. Does not apply any indentation or formatting.\n *\n * @param text - The text to write\n * @returns The logger instance for chaining\n *\n * @example\n * ```typescript\n * logger.write('Processing... ')\n * // ... do work ...\n * logger.write('done\\n')\n *\n * // Build a line incrementally\n * logger.write('Step 1')\n * logger.write('... Step 2')\n * logger.write('... Step 3\\n')\n * ```\n */\n write(text: string): this {\n const con = this.#getConsole()\n // Write directly to the original stdout stream to bypass Console formatting\n // (e.g., group indentation). Try multiple approaches to get the raw stream:\n // 1. Use stored reference from constructor options\n // 2. Try to get from constructor args\n // 3. Fall back to con._stdout (which applies formatting)\n const ctorArgs = privateConstructorArgs.get(this) ?? []\n const stdout =\n this.#originalStdout || (ctorArgs[0] as any)?.stdout || con._stdout\n stdout.write(text)\n this[lastWasBlankSymbol](false)\n return this\n }\n\n /**\n * Shows a progress indicator that can be cleared with `clearLine()`.\n *\n * Displays a simple status message with a '\u2234' prefix. Does not include\n * animation or spinner. Intended to be cleared once the operation completes.\n * The output stream (stderr or stdout) depends on whether the logger is\n * stream-bound.\n *\n * @param text - The progress message to display\n * @returns The logger instance for chaining\n *\n * @example\n * ```typescript\n * logger.progress('Processing files...')\n * // ... do work ...\n * logger.clearLine()\n * logger.success('Files processed')\n *\n * // Stream-specific progress\n * logger.stdout.progress('Loading...')\n * // ... do work ...\n * logger.stdout.clearLine()\n * logger.stdout.log('Done')\n * ```\n */\n progress(text: string): this {\n const con = this.#getConsole()\n const stream = this.#getTargetStream()\n const streamObj = (\n stream === 'stderr' ? con._stderr : con._stdout\n ) as NodeJS.WriteStream & { write: (text: string) => boolean }\n streamObj.write(`\u2234 ${text}`)\n this[lastWasBlankSymbol](false)\n return this\n }\n\n /**\n * Clears the current line in the terminal.\n *\n * Moves the cursor to the beginning of the line and clears all content.\n * Works in both TTY and non-TTY environments. Useful for clearing\n * progress indicators created with `progress()`.\n *\n * The stream to clear (stderr or stdout) depends on whether the logger\n * is stream-bound.\n *\n * @returns The logger instance for chaining\n *\n * @example\n * ```typescript\n * logger.progress('Loading...')\n * // ... do work ...\n * logger.clearLine()\n * logger.success('Loaded')\n *\n * // Clear multiple progress updates\n * for (const file of files) {\n * logger.progress(`Processing ${file}`)\n * processFile(file)\n * logger.clearLine()\n * }\n * logger.success('All files processed')\n * ```\n */\n clearLine(): this {\n const con = this.#getConsole()\n const stream = this.#getTargetStream()\n const streamObj = (\n stream === 'stderr' ? con._stderr : con._stdout\n ) as NodeJS.WriteStream & {\n isTTY: boolean\n cursorTo: (x: number) => void\n clearLine: (dir: number) => void\n write: (text: string) => boolean\n }\n if (streamObj.isTTY) {\n streamObj.cursorTo(0)\n streamObj.clearLine(0)\n } else {\n streamObj.write('\\r\\x1b[K')\n }\n return this\n }\n}\n\n/**\n * Lazily add dynamic console methods to Logger prototype.\n *\n * This is deferred until first access to avoid calling Object.entries(globalConsole)\n * during early Node.js bootstrap before stdout is ready.\n * @private\n */\nlet _prototypeInitialized = false\nfunction ensurePrototypeInitialized() {\n if (_prototypeInitialized) {\n return\n }\n _prototypeInitialized = true\n\n const entries: Array<[string | symbol, PropertyDescriptor]> = [\n [\n getKGroupIndentationWidthSymbol(),\n {\n ...consolePropAttributes,\n value: 2,\n },\n ],\n [\n Symbol.toStringTag,\n {\n __proto__: null,\n configurable: true,\n value: 'logger',\n } as PropertyDescriptor,\n ],\n ]\n for (const { 0: key, 1: value } of Object.entries(globalConsole)) {\n if (!(Logger.prototype as any)[key] && typeof value === 'function') {\n // Dynamically name the log method without using Object.defineProperty.\n const { [key]: func } = {\n [key](this: Logger, ...args: unknown[]) {\n // Access Console via WeakMap directly since private methods can't be\n // called from dynamically created functions.\n let con = privateConsole.get(this)\n if (con === undefined) {\n // Lazy initialization - this will only happen if someone calls a\n // dynamically added console method before any core logger method.\n const ctorArgs = privateConstructorArgs.get(this) ?? []\n // Clean up constructor args - no longer needed after Console creation.\n privateConstructorArgs.delete(this)\n if (ctorArgs.length) {\n con = constructConsole(...ctorArgs)\n } else {\n con = constructConsole({\n stdout: process.stdout,\n stderr: process.stderr,\n }) as typeof console & Record<string, unknown>\n for (const { 0: k, 1: method } of boundConsoleEntries) {\n con[k] = method\n }\n }\n privateConsole.set(this, con)\n }\n const result = (con as any)[key](...args)\n return result === undefined || result === con ? this : result\n },\n }\n entries.push([\n key,\n {\n ...consolePropAttributes,\n value: func,\n },\n ])\n }\n }\n Object.defineProperties(Logger.prototype, Object.fromEntries(entries))\n}\n\n// Private singleton instance\nlet _logger: Logger | undefined\n\n/**\n * Get the default logger instance.\n * Lazily creates the logger to avoid circular dependencies during module initialization.\n * Reuses the same instance across calls.\n *\n * @returns Shared default logger instance\n *\n * @example\n * ```ts\n * import { getDefaultLogger } from '@socketsecurity/lib/logger'\n *\n * const logger = getDefaultLogger()\n * logger.log('Application started')\n * logger.success('Configuration loaded')\n * ```\n */\nexport function getDefaultLogger(): Logger {\n if (_logger === undefined) {\n _logger = new Logger()\n }\n return _logger\n}\n\n// REMOVED: Deprecated `logger` export\n// Migration: Use getDefaultLogger() instead\n// See: getDefaultLogger() function above\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,kCAA+B;AAC/B,6BAA2B;AAC3B,qBAA+C;AAE/C,qBAAwC;AAuExC,MAAM,gBAAgB;AAKtB,MAAM,eAAe,QAAQ;AAC7B,MAAM,mBAAmB,QAAQ;AAEjC,IAAI;AAAA;AAMJ,SAAS,oBAAoB,MAAiB;AAC5C,MAAI,aAAa,QAAW;AAG1B,UAAM,cAA4B,QAAQ,cAAc;AACxD,eAAW,YAAY;AAAA,EACzB;AACA,SAAO;AAAA,IACL;A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B,kBAAM,WAAW,uBAAuB,IAAI,IAAI,KAAK,CAAC;AAEtD,mCAAuB,OAAO,IAAI;AAClC,gBAAI,SAAS,QAAQ;AACnB,oBAAM,iCAAiB,GAAG,QAAQ;AAAA,YACpC,OAAO;AACL,oBAAM,iCAAiB;AAAA,gBACrB,QAAQ,QAAQ;AAAA,gBAChB,QAAQ,QAAQ;AAAA,cAClB,CAAC;AACD,yBAAW,EAAE,GAAG,GAAG,GAAG,OAAO,KAAK,qBAAqB;AACrD,oBAAI,CAAC,IAAI;AAAA,cACX;AAAA,YACF;AACA,2BAAe,IAAI,MAAM,GAAG;AAAA,UAC9B;AACA,gBAAM,SAAU,IAAY,GAAG,EAAE,GAAG,IAAI;AACxC,iBAAO,WAAW,UAAa,WAAW,MAAM,OAAO;AAAA,QACzD;AAAA,MACF;AACA,cAAQ,KAAK;AAAA,QACX;AAAA,QACA;AAAA,UACE,GAAG;AAAA,UACH,OAAO;AAAA,QACT;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACA,SAAO,iBAAiB,OAAO,WAAW,OAAO,YAAY,OAAO,CAAC;AACvE;AAGA,IAAI;AAkBG,SAAS,mBAA2B;AACzC,MAAI,YAAY,QAAW;AACzB,cAAU,IAAI,OAAO;AAAA,EACvB;AACA,SAAO;AACT;",
4
+ "sourcesContent": ["/**\n * @fileoverview Console logging utilities with line prefix support.\n * Provides enhanced console methods with formatted output capabilities.\n */\n\nimport isUnicodeSupported from './external/@socketregistry/is-unicode-supported'\nimport yoctocolorsCjs from './external/yoctocolors-cjs'\nimport { applyLinePrefix, isBlankString } from './strings'\nimport type { ColorValue } from './spinner'\nimport { getTheme, onThemeChange } from './themes/context'\nimport { THEMES } from './themes/themes'\n\n/**\n * Log symbols for terminal output with colored indicators.\n *\n * Each symbol provides visual feedback for different message types, with\n * Unicode and ASCII fallback support.\n *\n * @example\n * ```typescript\n * import { LOG_SYMBOLS } from '@socketsecurity/lib'\n *\n * console.log(`${LOG_SYMBOLS.success} Operation completed`)\n * console.log(`${LOG_SYMBOLS.fail} Operation failed`)\n * console.log(`${LOG_SYMBOLS.warn} Warning message`)\n * console.log(`${LOG_SYMBOLS.info} Information message`)\n * console.log(`${LOG_SYMBOLS.step} Processing step`)\n * ```\n */\ntype LogSymbols = {\n /** Red colored failure symbol (\u2716 or \u00D7 in ASCII) */\n fail: string\n /** Blue colored information symbol (\u2139 or i in ASCII) */\n info: string\n /** Cyan colored step symbol (\u2192 or > in ASCII) */\n step: string\n /** Green colored success symbol (\u2714 or \u221A in ASCII) */\n success: string\n /** Yellow colored warning symbol (\u26A0 or \u203C in ASCII) */\n warn: string\n}\n\n/**\n * Type definition for logger methods that mirror console methods.\n *\n * All methods return the logger instance for method chaining.\n */\ntype LoggerMethods = {\n [K in keyof typeof console]: (typeof console)[K] extends (\n ...args: infer A\n ) => any\n ? (...args: A) => Logger\n : (typeof console)[K]\n}\n\n/**\n * A task that can be executed with automatic start/complete logging.\n *\n * @example\n * ```typescript\n * const task = logger.createTask('Database migration')\n * task.run(() => {\n * // Migration logic here\n * })\n * // Logs: \"Starting task: Database migration\"\n * // Logs: \"Completed task: Database migration\"\n * ```\n */\ninterface Task {\n /**\n * Executes the task function with automatic logging.\n *\n * @template T - The return type of the task function\n * @param f - The function to execute\n * @returns The result of the task function\n */\n run<T>(f: () => T): T\n}\n\nexport type { LogSymbols, LoggerMethods, Task }\n\nconst globalConsole = console\n// IMPORTANT: Do not use destructuring here - use direct assignment instead.\n// tsgo has a bug that incorrectly transpiles destructured exports, resulting in\n// `exports.SomeName = void 0;` which causes runtime errors.\n// See: https://github.com/SocketDev/socket-packageurl-js/issues/3\nconst ReflectApply = Reflect.apply\nconst ReflectConstruct = Reflect.construct\n\nlet _Console: typeof import('console').Console | undefined\n/**\n * Construct a new Console instance.\n * @private\n */\n/*@__NO_SIDE_EFFECTS__*/\nfunction constructConsole(...args: unknown[]) {\n if (_Console === undefined) {\n // Use non-'node:' prefixed require to avoid Webpack errors.\n\n const nodeConsole = /*@__PURE__*/ require('node:console')\n _Console = nodeConsole.Console\n }\n return ReflectConstruct(\n _Console! as new (\n ...args: unknown[]\n ) => Console, // eslint-disable-line no-undef\n args,\n )\n}\n\n/**\n * Get the yoctocolors module for terminal colors.\n * @private\n */\n/*@__NO_SIDE_EFFECTS__*/\nfunction getYoctocolors() {\n return yoctocolorsCjs\n}\n\n/**\n * Apply a color to text using yoctocolors.\n * Handles both named colors and RGB tuples.\n * @private\n */\n/*@__NO_SIDE_EFFECTS__*/\nfunction applyColor(\n text: string,\n color: ColorValue,\n colors: typeof yoctocolorsCjs,\n): string {\n if (typeof color === 'string') {\n // Named color like 'green', 'red', etc.\n return (colors as any)[color](text)\n }\n // RGB tuple [r, g, b]\n return colors.rgb(color[0], color[1], color[2])(text)\n}\n\n/**\n * Log symbols for terminal output with colored indicators.\n *\n * Provides colored Unicode symbols (\u2714, \u2716, \u26A0, \u2139, \u2192) with ASCII fallbacks (\u221A, \u00D7, \u203C, i, >)\n * for terminals that don't support Unicode. Symbols are colored according to the active\n * theme's color palette (success, error, warning, info, step).\n *\n * The symbols are lazily initialized on first access and automatically update when the\n * fallback theme changes (via setTheme()). Note that LOG_SYMBOLS reflect the global\n * fallback theme, not async-local theme contexts from withTheme().\n *\n * @example\n * ```typescript\n * import { LOG_SYMBOLS } from '@socketsecurity/lib'\n *\n * console.log(`${LOG_SYMBOLS.success} Build completed`) // Theme success color \u2714\n * console.log(`${LOG_SYMBOLS.fail} Build failed`) // Theme error color \u2716\n * console.log(`${LOG_SYMBOLS.warn} Deprecated API used`) // Theme warning color \u26A0\n * console.log(`${LOG_SYMBOLS.info} Starting process`) // Theme info color \u2139\n * console.log(`${LOG_SYMBOLS.step} Processing files`) // Theme step color \u2192\n * ```\n */\nexport const LOG_SYMBOLS = /*@__PURE__*/ (() => {\n const target: Record<string, string> = {\n __proto__: null,\n } as unknown as Record<string, string>\n\n let initialized = false\n\n // Mutable handler to simulate a frozen target.\n const handler: ProxyHandler<Record<string, string>> = {\n __proto__: null,\n } as unknown as ProxyHandler<Record<string, string>>\n\n const updateSymbols = () => {\n const supported = isUnicodeSupported()\n const colors = getYoctocolors()\n const theme = getTheme()\n\n // Get colors from theme\n const successColor = theme.colors.success\n const errorColor = theme.colors.error\n const warningColor = theme.colors.warning\n const infoColor = theme.colors.info\n const stepColor = theme.colors.step\n\n // Update symbol values\n target.fail = applyColor(supported ? '\u2716' : '\u00D7', errorColor, colors)\n target.info = applyColor(supported ? '\u2139' : 'i', infoColor, colors)\n target.step = applyColor(supported ? '\u2192' : '>', stepColor, colors)\n target.success = applyColor(supported ? '\u2714' : '\u221A', successColor, colors)\n target.warn = applyColor(supported ? '\u26A0' : '\u203C', warningColor, colors)\n }\n\n const init = () => {\n if (initialized) {\n return\n }\n\n updateSymbols()\n initialized = true\n\n // The handler of a Proxy is mutable after proxy instantiation.\n // We delete the traps to defer to native behavior for better performance.\n for (const trapName in handler) {\n delete handler[trapName as keyof ProxyHandler<Record<string, string>>]\n }\n }\n\n const reset = () => {\n if (!initialized) {\n return\n }\n\n // Update symbols with new theme colors\n updateSymbols()\n }\n\n for (const trapName of Reflect.ownKeys(Reflect)) {\n const fn = (Reflect as Record<PropertyKey, unknown>)[trapName]\n if (typeof fn === 'function') {\n ;(handler as Record<string, (...args: unknown[]) => unknown>)[\n trapName as string\n ] = (...args: unknown[]) => {\n init()\n return fn(...args)\n }\n }\n }\n\n // Listen for theme changes and reset symbols\n onThemeChange(() => {\n reset()\n })\n\n return new Proxy(target, handler)\n})()\n\nconst boundConsoleEntries = [\n // Add bound properties from console[kBindProperties](ignoreErrors, colorMode, groupIndentation).\n // https://github.com/nodejs/node/blob/v24.0.1/lib/internal/console/constructor.js#L230-L265\n '_stderrErrorHandler',\n '_stdoutErrorHandler',\n // Add methods that need to be bound to function properly.\n 'assert',\n 'clear',\n 'count',\n 'countReset',\n 'createTask',\n 'debug',\n 'dir',\n 'dirxml',\n 'error',\n // Skip group methods because in at least Node 20 with the Node --frozen-intrinsics\n // flag it triggers a readonly property for Symbol(kGroupIndent). Instead, we\n // implement these methods ourselves.\n //'group',\n //'groupCollapsed',\n //'groupEnd',\n 'info',\n 'log',\n 'table',\n 'time',\n 'timeEnd',\n 'timeLog',\n 'trace',\n 'warn',\n]\n .filter(n => typeof (globalConsole as any)[n] === 'function')\n .map(n => [n, (globalConsole as any)[n].bind(globalConsole)])\n\nconst consolePropAttributes = {\n __proto__: null,\n writable: true,\n enumerable: false,\n configurable: true,\n}\nconst maxIndentation = 1000\n\n/**\n * WeakMap storing the Console instance for each Logger.\n *\n * Console creation is lazy - deferred until first logging method call.\n * This allows logger to be imported during early Node.js bootstrap before\n * stdout is ready, avoiding ERR_CONSOLE_WRITABLE_STREAM errors.\n */\nconst privateConsole = new WeakMap()\n\n/**\n * WeakMap storing constructor arguments for lazy Console initialization.\n *\n * WeakMap is required instead of a private field (#constructorArgs) because:\n * 1. Private fields can't be accessed from dynamically created functions\n * 2. Logger adds console methods dynamically to its prototype (lines 1560+)\n * 3. These dynamic methods need constructor args for lazy initialization\n * 4. WeakMap allows both regular methods and dynamic functions to access args\n *\n * The args are deleted from the WeakMap after Console is created (memory cleanup).\n */\nconst privateConstructorArgs = new WeakMap()\n\n/**\n * Lazily get console symbols on first access.\n *\n * Deferred to avoid accessing global console during early Node.js bootstrap\n * before stdout is ready.\n * @private\n */\nlet _consoleSymbols: symbol[] | undefined\nfunction getConsoleSymbols(): symbol[] {\n if (_consoleSymbols === undefined) {\n _consoleSymbols = Object.getOwnPropertySymbols(globalConsole)\n }\n return _consoleSymbols\n}\n\n/**\n * Symbol for incrementing the internal log call counter.\n *\n * This is an internal symbol used to track the number of times logging\n * methods have been called on a logger instance.\n */\nexport const incLogCallCountSymbol = Symbol.for('logger.logCallCount++')\n\n/**\n * Lazily get kGroupIndentationWidth symbol on first access.\n * @private\n */\nlet _kGroupIndentationWidthSymbol: symbol | undefined\nfunction getKGroupIndentationWidthSymbol(): symbol {\n if (_kGroupIndentationWidthSymbol === undefined) {\n _kGroupIndentationWidthSymbol =\n getConsoleSymbols().find(s => (s as any).label === 'kGroupIndentWidth') ??\n Symbol('kGroupIndentWidth')\n }\n return _kGroupIndentationWidthSymbol\n}\n\n/**\n * Symbol for tracking whether the last logged line was blank.\n *\n * This is used internally to prevent multiple consecutive blank lines\n * and to determine whether to add spacing before certain messages.\n */\nexport const lastWasBlankSymbol = Symbol.for('logger.lastWasBlank')\n\n/**\n * Enhanced console logger with indentation, colored symbols, and stream management.\n *\n * Provides a fluent API for logging with automatic indentation tracking, colored\n * status symbols, separate stderr/stdout management, and method chaining. All\n * methods return `this` for easy chaining.\n *\n * Features:\n * - Automatic line prefixing with indentation\n * - Colored status symbols (success, fail, warn, info)\n * - Separate indentation tracking for stderr and stdout\n * - Stream-bound logger instances via `.stderr` and `.stdout`\n * - Group/indentation management\n * - Progress indicators with clearable lines\n * - Task execution with automatic logging\n *\n * @example\n * ```typescript\n * import { logger } from '@socketsecurity/lib'\n *\n * // Basic logging with symbols\n * logger.success('Build completed')\n * logger.fail('Build failed')\n * logger.warn('Deprecated API')\n * logger.info('Starting process')\n *\n * // Indentation and grouping\n * logger.log('Processing files:')\n * logger.indent()\n * logger.log('file1.js')\n * logger.log('file2.js')\n * logger.dedent()\n *\n * // Method chaining\n * logger\n * .log('Step 1')\n * .indent()\n * .log('Substep 1.1')\n * .log('Substep 1.2')\n * .dedent()\n * .log('Step 2')\n *\n * // Stream-specific logging\n * logger.stdout.log('Normal output')\n * logger.stderr.error('Error message')\n *\n * // Progress indicators\n * logger.progress('Processing...')\n * // ... do work ...\n * logger.clearLine()\n * logger.success('Done')\n *\n * // Task execution\n * const task = logger.createTask('Migration')\n * task.run(() => {\n * // Migration logic\n * })\n * ```\n */\n/*@__PURE__*/\nexport class Logger {\n /**\n * Static reference to log symbols for convenience.\n *\n * @example\n * ```typescript\n * console.log(`${Logger.LOG_SYMBOLS.success} Done`)\n * ```\n */\n static LOG_SYMBOLS = LOG_SYMBOLS\n\n #parent?: Logger\n #boundStream?: 'stderr' | 'stdout'\n #stderrLogger?: Logger\n #stdoutLogger?: Logger\n #stderrIndention = ''\n #stdoutIndention = ''\n #stderrLastWasBlank = false\n #stdoutLastWasBlank = false\n #logCallCount = 0\n #options: Record<string, unknown>\n #originalStdout?: any\n #theme?: import('./themes/types').Theme\n\n /**\n * Creates a new Logger instance.\n *\n * When called without arguments, creates a logger using the default\n * `process.stdout` and `process.stderr` streams. Can accept custom\n * console constructor arguments for advanced use cases.\n *\n * @param args - Optional console constructor arguments\n *\n * @example\n * ```typescript\n * // Default logger\n * const logger = new Logger()\n *\n * // Custom streams (advanced)\n * const customLogger = new Logger({\n * stdout: customWritableStream,\n * stderr: customErrorStream\n * })\n * ```\n */\n constructor(...args: unknown[]) {\n // Store constructor args for lazy Console initialization.\n privateConstructorArgs.set(this, args)\n\n // Store options if provided (for future extensibility)\n const options = args['0']\n if (typeof options === 'object' && options !== null) {\n this.#options = { __proto__: null, ...options }\n // Store reference to original stdout stream to bypass Console formatting\n this.#originalStdout = (options as any).stdout\n\n // Handle theme option\n const themeOption = (options as any).theme\n if (themeOption) {\n if (typeof themeOption === 'string') {\n // Theme name - resolve to Theme object\n this.#theme = THEMES[themeOption]\n } else {\n // Theme object\n this.#theme = themeOption\n }\n }\n } else {\n this.#options = { __proto__: null }\n }\n\n // Note: Console initialization is now lazy (happens on first use).\n // This allows logger to be imported during early bootstrap before\n // stdout is ready, avoiding ERR_CONSOLE_WRITABLE_STREAM errors.\n }\n\n /**\n * Get the Console instance for this logger, creating it lazily on first access.\n *\n * This lazy initialization allows the logger to be imported during early\n * Node.js bootstrap before stdout is ready, avoiding Console initialization\n * errors (ERR_CONSOLE_WRITABLE_STREAM).\n *\n * @private\n */\n #getConsole(): typeof console & Record<string, unknown> {\n // Ensure prototype is initialized before creating Console.\n ensurePrototypeInitialized()\n\n let con = privateConsole.get(this)\n if (!con) {\n // Lazy initialization - create Console on first use.\n const ctorArgs = privateConstructorArgs.get(this) ?? []\n if (ctorArgs.length) {\n con = constructConsole(...ctorArgs)\n } else {\n // Create a new console that acts like the builtin one so that it will\n // work with Node's --frozen-intrinsics flag.\n con = constructConsole({\n stdout: process.stdout,\n stderr: process.stderr,\n }) as typeof console & Record<string, unknown>\n for (const { 0: key, 1: method } of boundConsoleEntries) {\n con[key] = method\n }\n }\n privateConsole.set(this, con)\n // Clean up constructor args - no longer needed after Console creation.\n privateConstructorArgs.delete(this)\n }\n return con\n }\n\n /**\n * Gets a logger instance bound exclusively to stderr.\n *\n * All logging operations on this instance will write to stderr only.\n * Indentation is tracked separately from stdout. The instance is\n * cached and reused on subsequent accesses.\n *\n * @returns A logger instance bound to stderr\n *\n * @example\n * ```typescript\n * // Write errors to stderr\n * logger.stderr.error('Configuration invalid')\n * logger.stderr.warn('Using fallback settings')\n *\n * // Indent only affects stderr\n * logger.stderr.indent()\n * logger.stderr.error('Nested error details')\n * logger.stderr.dedent()\n * ```\n */\n get stderr(): Logger {\n if (!this.#stderrLogger) {\n // Pass parent's constructor args to maintain config.\n const ctorArgs = privateConstructorArgs.get(this) ?? []\n const instance = new Logger(...ctorArgs)\n instance.#parent = this\n instance.#boundStream = 'stderr'\n instance.#options = { __proto__: null, ...this.#options }\n instance.#theme = this.#theme\n this.#stderrLogger = instance\n }\n return this.#stderrLogger\n }\n\n /**\n * Gets a logger instance bound exclusively to stdout.\n *\n * All logging operations on this instance will write to stdout only.\n * Indentation is tracked separately from stderr. The instance is\n * cached and reused on subsequent accesses.\n *\n * @returns A logger instance bound to stdout\n *\n * @example\n * ```typescript\n * // Write normal output to stdout\n * logger.stdout.log('Processing started')\n * logger.stdout.log('Items processed: 42')\n *\n * // Indent only affects stdout\n * logger.stdout.indent()\n * logger.stdout.log('Detailed output')\n * logger.stdout.dedent()\n * ```\n */\n get stdout(): Logger {\n if (!this.#stdoutLogger) {\n // Pass parent's constructor args to maintain config.\n const ctorArgs = privateConstructorArgs.get(this) ?? []\n const instance = new Logger(...ctorArgs)\n instance.#parent = this\n instance.#boundStream = 'stdout'\n instance.#options = { __proto__: null, ...this.#options }\n instance.#theme = this.#theme\n this.#stdoutLogger = instance\n }\n return this.#stdoutLogger\n }\n\n /**\n * Get the root logger (for accessing shared indentation state).\n * @private\n */\n #getRoot(): Logger {\n return this.#parent || this\n }\n\n /**\n * Get the resolved theme for this logger instance.\n * Returns instance theme if set, otherwise falls back to context theme.\n * @private\n */\n #getTheme(): import('./themes/types').Theme {\n return this.#theme ?? getTheme()\n }\n\n /**\n * Get logger-specific symbols using the resolved theme.\n * @private\n */\n #getSymbols(): LogSymbols {\n const theme = this.#getTheme()\n const supported = isUnicodeSupported()\n const colors = getYoctocolors()\n\n return {\n __proto__: null,\n fail: applyColor(supported ? '\u2716' : '\u00D7', theme.colors.error, colors),\n info: applyColor(supported ? '\u2139' : 'i', theme.colors.info, colors),\n step: applyColor(supported ? '\u2192' : '>', theme.colors.step, colors),\n success: applyColor(supported ? '\u2714' : '\u221A', theme.colors.success, colors),\n warn: applyColor(supported ? '\u26A0' : '\u203C', theme.colors.warning, colors),\n } as LogSymbols\n }\n\n /**\n * Get indentation for a specific stream.\n * @private\n */\n #getIndent(stream: 'stderr' | 'stdout'): string {\n const root = this.#getRoot()\n return stream === 'stderr' ? root.#stderrIndention : root.#stdoutIndention\n }\n\n /**\n * Set indentation for a specific stream.\n * @private\n */\n #setIndent(stream: 'stderr' | 'stdout', value: string): void {\n const root = this.#getRoot()\n if (stream === 'stderr') {\n root.#stderrIndention = value\n } else {\n root.#stdoutIndention = value\n }\n }\n\n /**\n * Get lastWasBlank state for a specific stream.\n * @private\n */\n #getLastWasBlank(stream: 'stderr' | 'stdout'): boolean {\n const root = this.#getRoot()\n return stream === 'stderr'\n ? root.#stderrLastWasBlank\n : root.#stdoutLastWasBlank\n }\n\n /**\n * Set lastWasBlank state for a specific stream.\n * @private\n */\n #setLastWasBlank(stream: 'stderr' | 'stdout', value: boolean): void {\n const root = this.#getRoot()\n if (stream === 'stderr') {\n root.#stderrLastWasBlank = value\n } else {\n root.#stdoutLastWasBlank = value\n }\n }\n\n /**\n * Get the target stream for this logger instance.\n * @private\n */\n #getTargetStream(): 'stderr' | 'stdout' {\n return this.#boundStream || 'stderr'\n }\n\n /**\n * Apply a console method with indentation.\n * @private\n */\n #apply(\n methodName: string,\n args: unknown[],\n stream?: 'stderr' | 'stdout',\n ): this {\n const con = this.#getConsole()\n const text = args.at(0)\n const hasText = typeof text === 'string'\n // Determine which stream this method writes to\n const targetStream = stream || (methodName === 'log' ? 'stdout' : 'stderr')\n const indent = this.#getIndent(targetStream)\n const logArgs = hasText\n ? [applyLinePrefix(text, { prefix: indent }), ...args.slice(1)]\n : args\n ReflectApply(\n con[methodName] as (...args: unknown[]) => unknown,\n con,\n logArgs,\n )\n this[lastWasBlankSymbol](hasText && isBlankString(logArgs[0]), targetStream)\n ;(this as any)[incLogCallCountSymbol]()\n return this\n }\n\n /**\n * Strip log symbols from the start of text.\n * @private\n */\n #stripSymbols(text: string): string {\n // Strip both unicode and emoji forms of log symbols from the start.\n // Matches: \u2716, \u2717, \u00D7, \u2716\uFE0F, \u26A0, \u203C, \u26A0\uFE0F, \u2714, \u2713, \u221A, \u2714\uFE0F, \u2713\uFE0F, \u2139, \u2139\uFE0F, \u2192, >\n // Also handles variation selectors (U+FE0F) and whitespace after symbol.\n // Note: We don't strip standalone 'i' or '>' to avoid breaking words.\n return text.replace(/^[\u2716\u2717\u00D7\u26A0\u203C\u2714\u2713\u221A\u2139\u2192]\\uFE0F?\\s*/u, '')\n }\n\n /**\n * Apply a method with a symbol prefix.\n * @private\n */\n #symbolApply(symbolType: string, args: unknown[]): this {\n const con = this.#getConsole()\n let text = args.at(0)\n // biome-ignore lint/suspicious/noImplicitAnyLet: Flexible argument handling.\n let extras\n if (typeof text === 'string') {\n text = this.#stripSymbols(text)\n extras = args.slice(1)\n } else {\n extras = args\n text = ''\n }\n // Note: Meta status messages (info/fail/etc) always go to stderr.\n const indent = this.#getIndent('stderr')\n const symbols = this.#getSymbols()\n con.error(\n applyLinePrefix(`${symbols[symbolType]} ${text}`, {\n prefix: indent,\n }),\n ...extras,\n )\n this[lastWasBlankSymbol](false, 'stderr')\n ;(this as any)[incLogCallCountSymbol]()\n return this\n }\n\n /**\n * Gets the total number of log calls made on this logger instance.\n *\n * Tracks all logging method calls including `log()`, `error()`, `warn()`,\n * `success()`, `fail()`, etc. Useful for testing and monitoring logging activity.\n *\n * @returns The number of times logging methods have been called\n *\n * @example\n * ```typescript\n * logger.log('Message 1')\n * logger.error('Message 2')\n * console.log(logger.logCallCount) // 2\n * ```\n */\n get logCallCount() {\n const root = this.#getRoot()\n return root.#logCallCount\n }\n\n /**\n * Increments the internal log call counter.\n *\n * This is called automatically by logging methods and should not\n * be called directly in normal usage.\n *\n * @returns The logger instance for chaining\n */\n [incLogCallCountSymbol]() {\n const root = this.#getRoot()\n root.#logCallCount += 1\n return this\n }\n\n /**\n * Sets whether the last logged line was blank.\n *\n * Used internally to track blank lines and prevent duplicate spacing.\n * This is called automatically by logging methods.\n *\n * @param value - Whether the last line was blank\n * @param stream - Optional stream to update (defaults to both streams if not bound, or target stream if bound)\n * @returns The logger instance for chaining\n */\n [lastWasBlankSymbol](value: unknown, stream?: 'stderr' | 'stdout'): this {\n if (stream) {\n // Explicit stream specified\n this.#setLastWasBlank(stream, !!value)\n } else if (this.#boundStream) {\n // Stream-bound logger - affect only the bound stream\n this.#setLastWasBlank(this.#boundStream, !!value)\n } else {\n // Root logger with no stream specified - affect both streams\n this.#setLastWasBlank('stderr', !!value)\n this.#setLastWasBlank('stdout', !!value)\n }\n return this\n }\n\n /**\n * Logs an assertion failure message if the value is falsy.\n *\n * Works like `console.assert()` but returns the logger for chaining.\n * If the value is truthy, nothing is logged. If falsy, logs an error\n * message with an assertion failure.\n *\n * @param value - The value to test\n * @param message - Optional message and additional arguments to log\n * @returns The logger instance for chaining\n *\n * @example\n * ```typescript\n * logger.assert(true, 'This will not log')\n * logger.assert(false, 'Assertion failed: value is false')\n * logger.assert(items.length > 0, 'No items found')\n * ```\n */\n assert(value: unknown, ...message: unknown[]): this {\n const con = this.#getConsole()\n con.assert(value, message[0] as string, ...message.slice(1))\n this[lastWasBlankSymbol](false)\n return value ? this : this[incLogCallCountSymbol]()\n }\n\n /**\n * Clears the visible terminal screen.\n *\n * Only available on the main logger instance, not on stream-bound instances\n * (`.stderr` or `.stdout`). Resets the log call count and blank line tracking\n * if the output is a TTY.\n *\n * @returns The logger instance for chaining\n * @throws {Error} If called on a stream-bound logger instance\n *\n * @example\n * ```typescript\n * logger.log('Some output')\n * logger.clearVisible() // Screen is now clear\n *\n * // Error: Can't call on stream-bound instance\n * logger.stderr.clearVisible() // throws\n * ```\n */\n clearVisible() {\n if (this.#boundStream) {\n throw new Error(\n 'clearVisible() is only available on the main logger instance, not on stream-bound instances',\n )\n }\n const con = this.#getConsole()\n con.clear()\n if ((con as any)._stdout.isTTY) {\n ;(this as any)[lastWasBlankSymbol](true)\n this.#logCallCount = 0\n }\n return this\n }\n\n /**\n * Increments and logs a counter for the given label.\n *\n * Each unique label maintains its own counter. Works like `console.count()`.\n *\n * @param label - Optional label for the counter\n * @default 'default'\n * @returns The logger instance for chaining\n *\n * @example\n * ```typescript\n * logger.count('requests') // requests: 1\n * logger.count('requests') // requests: 2\n * logger.count('errors') // errors: 1\n * logger.count() // default: 1\n * ```\n */\n count(label?: string | undefined): this {\n const con = this.#getConsole()\n con.count(label)\n this[lastWasBlankSymbol](false)\n return this[incLogCallCountSymbol]()\n }\n\n /**\n * Creates a task that logs start and completion messages automatically.\n *\n * Returns a task object with a `run()` method that executes the provided\n * function and logs \"Starting task: {name}\" before execution and\n * \"Completed task: {name}\" after completion.\n *\n * @param name - The name of the task\n * @returns A task object with a `run()` method\n *\n * @example\n * ```typescript\n * const task = logger.createTask('Database Migration')\n * const result = task.run(() => {\n * // Logs: \"Starting task: Database Migration\"\n * migrateDatabase()\n * return 'success'\n * // Logs: \"Completed task: Database Migration\"\n * })\n * console.log(result) // 'success'\n * ```\n */\n createTask(name: string): Task {\n return {\n run: <T>(f: () => T): T => {\n this.log(`Starting task: ${name}`)\n const result = f()\n this.log(`Completed task: ${name}`)\n return result\n },\n }\n }\n\n /**\n * Decreases the indentation level by removing spaces from the prefix.\n *\n * When called on the main logger, affects both stderr and stdout indentation.\n * When called on a stream-bound logger (`.stderr` or `.stdout`), affects\n * only that stream's indentation.\n *\n * @param spaces - Number of spaces to remove from indentation\n * @default 2\n * @returns The logger instance for chaining\n *\n * @example\n * ```typescript\n * logger.indent()\n * logger.log('Indented')\n * logger.dedent()\n * logger.log('Back to normal')\n *\n * // Remove custom amount\n * logger.indent(4)\n * logger.log('Four spaces')\n * logger.dedent(4)\n *\n * // Stream-specific dedent\n * logger.stdout.indent()\n * logger.stdout.log('Indented stdout')\n * logger.stdout.dedent()\n * ```\n */\n dedent(spaces = 2) {\n if (this.#boundStream) {\n // Only affect bound stream\n const current = this.#getIndent(this.#boundStream)\n this.#setIndent(this.#boundStream, current.slice(0, -spaces))\n } else {\n // Affect both streams\n const stderrCurrent = this.#getIndent('stderr')\n const stdoutCurrent = this.#getIndent('stdout')\n this.#setIndent('stderr', stderrCurrent.slice(0, -spaces))\n this.#setIndent('stdout', stdoutCurrent.slice(0, -spaces))\n }\n return this\n }\n\n /**\n * Displays an object's properties in a formatted way.\n *\n * Works like `console.dir()` with customizable options for depth,\n * colors, etc. Useful for inspecting complex objects.\n *\n * @param obj - The object to display\n * @param options - Optional formatting options (Node.js inspect options)\n * @returns The logger instance for chaining\n *\n * @example\n * ```typescript\n * const obj = { a: 1, b: { c: 2, d: { e: 3 } } }\n * logger.dir(obj)\n * logger.dir(obj, { depth: 1 }) // Limit nesting depth\n * logger.dir(obj, { colors: true }) // Enable colors\n * ```\n */\n dir(obj: unknown, options?: unknown | undefined): this {\n const con = this.#getConsole()\n con.dir(obj, options)\n this[lastWasBlankSymbol](false)\n return this[incLogCallCountSymbol]()\n }\n\n /**\n * Displays data as XML/HTML in a formatted way.\n *\n * Works like `console.dirxml()`. In Node.js, behaves the same as `dir()`.\n *\n * @param data - The data to display\n * @returns The logger instance for chaining\n *\n * @example\n * ```typescript\n * logger.dirxml(document.body) // In browser environments\n * logger.dirxml(xmlObject) // In Node.js\n * ```\n */\n dirxml(...data: unknown[]): this {\n const con = this.#getConsole()\n con.dirxml(data)\n this[lastWasBlankSymbol](false)\n return this[incLogCallCountSymbol]()\n }\n\n /**\n * Logs an error message to stderr.\n *\n * Automatically applies current indentation. All arguments are formatted\n * and logged like `console.error()`.\n *\n * @param args - Message and additional arguments to log\n * @returns The logger instance for chaining\n *\n * @example\n * ```typescript\n * logger.error('Build failed')\n * logger.error('Error code:', 500)\n * logger.error('Details:', { message: 'Not found' })\n * ```\n */\n error(...args: unknown[]): this {\n return this.#apply('error', args)\n }\n\n /**\n * Logs a newline to stderr only if the last line wasn't already blank.\n *\n * Prevents multiple consecutive blank lines. Useful for adding spacing\n * between sections without creating excessive whitespace.\n *\n * @returns The logger instance for chaining\n *\n * @example\n * ```typescript\n * logger.error('Error message')\n * logger.errorNewline() // Adds blank line\n * logger.errorNewline() // Does nothing (already blank)\n * logger.error('Next section')\n * ```\n */\n errorNewline() {\n return this.#getLastWasBlank('stderr') ? this : this.error('')\n }\n\n /**\n * Logs a failure message with a red colored fail symbol.\n *\n * Automatically prefixes the message with `LOG_SYMBOLS.fail` (red \u2716).\n * Always outputs to stderr. If the message starts with an existing\n * symbol, it will be stripped and replaced.\n *\n * @param args - Message and additional arguments to log\n * @returns The logger instance for chaining\n *\n * @example\n * ```typescript\n * logger.fail('Build failed')\n * logger.fail('Test suite failed:', { passed: 5, failed: 3 })\n * ```\n */\n fail(...args: unknown[]): this {\n return this.#symbolApply('fail', args)\n }\n\n /**\n * Starts a new indented log group.\n *\n * If a label is provided, it's logged before increasing indentation.\n * Groups can be nested. Each group increases indentation by the\n * `kGroupIndentWidth` (default 2 spaces). Call `groupEnd()` to close.\n *\n * @param label - Optional label to display before the group\n * @returns The logger instance for chaining\n *\n * @example\n * ```typescript\n * logger.group('Processing files:')\n * logger.log('file1.js')\n * logger.log('file2.js')\n * logger.groupEnd()\n *\n * // Nested groups\n * logger.group('Outer')\n * logger.log('Outer content')\n * logger.group('Inner')\n * logger.log('Inner content')\n * logger.groupEnd()\n * logger.groupEnd()\n * ```\n */\n group(...label: unknown[]): this {\n const { length } = label\n if (length) {\n ReflectApply(this.log, this, label)\n }\n this.indent((this as any)[getKGroupIndentationWidthSymbol()])\n if (length) {\n ;(this as any)[lastWasBlankSymbol](false)\n ;(this as any)[incLogCallCountSymbol]()\n }\n return this\n }\n\n /**\n * Starts a new collapsed log group (alias for `group()`).\n *\n * In browser consoles, this creates a collapsed group. In Node.js,\n * it behaves identically to `group()`.\n *\n * @param label - Optional label to display before the group\n * @returns The logger instance for chaining\n *\n * @example\n * ```typescript\n * logger.groupCollapsed('Details')\n * logger.log('Hidden by default in browsers')\n * logger.groupEnd()\n * ```\n */\n // groupCollapsed is an alias of group.\n // https://nodejs.org/api/console.html#consolegroupcollapsed\n groupCollapsed(...label: unknown[]): this {\n return ReflectApply(this.group, this, label)\n }\n\n /**\n * Ends the current log group and decreases indentation.\n *\n * Must be called once for each `group()` or `groupCollapsed()` call\n * to properly close the group and restore indentation.\n *\n * @returns The logger instance for chaining\n *\n * @example\n * ```typescript\n * logger.group('Group 1')\n * logger.log('Content')\n * logger.groupEnd() // Closes 'Group 1'\n * ```\n */\n groupEnd() {\n this.dedent((this as any)[getKGroupIndentationWidthSymbol()])\n return this\n }\n\n /**\n * Increases the indentation level by adding spaces to the prefix.\n *\n * When called on the main logger, affects both stderr and stdout indentation.\n * When called on a stream-bound logger (`.stderr` or `.stdout`), affects\n * only that stream's indentation. Maximum indentation is 1000 spaces.\n *\n * @param spaces - Number of spaces to add to indentation\n * @default 2\n * @returns The logger instance for chaining\n *\n * @example\n * ```typescript\n * logger.log('Level 0')\n * logger.indent()\n * logger.log('Level 1')\n * logger.indent()\n * logger.log('Level 2')\n * logger.dedent()\n * logger.dedent()\n *\n * // Custom indent amount\n * logger.indent(4)\n * logger.log('Indented 4 spaces')\n * logger.dedent(4)\n *\n * // Stream-specific indent\n * logger.stdout.indent()\n * logger.stdout.log('Only stdout is indented')\n * ```\n */\n indent(spaces = 2) {\n const spacesToAdd = ' '.repeat(Math.min(spaces, maxIndentation))\n if (this.#boundStream) {\n // Only affect bound stream\n const current = this.#getIndent(this.#boundStream)\n this.#setIndent(this.#boundStream, current + spacesToAdd)\n } else {\n // Affect both streams\n const stderrCurrent = this.#getIndent('stderr')\n const stdoutCurrent = this.#getIndent('stdout')\n this.#setIndent('stderr', stderrCurrent + spacesToAdd)\n this.#setIndent('stdout', stdoutCurrent + spacesToAdd)\n }\n return this\n }\n\n /**\n * Logs an informational message with a blue colored info symbol.\n *\n * Automatically prefixes the message with `LOG_SYMBOLS.info` (blue \u2139).\n * Always outputs to stderr. If the message starts with an existing\n * symbol, it will be stripped and replaced.\n *\n * @param args - Message and additional arguments to log\n * @returns The logger instance for chaining\n *\n * @example\n * ```typescript\n * logger.info('Starting build process')\n * logger.info('Configuration loaded:', config)\n * logger.info('Using cache directory:', cacheDir)\n * ```\n */\n info(...args: unknown[]): this {\n return this.#symbolApply('info', args)\n }\n\n /**\n * Logs a message to stdout.\n *\n * Automatically applies current indentation. All arguments are formatted\n * and logged like `console.log()`. This is the primary method for\n * standard output.\n *\n * @param args - Message and additional arguments to log\n * @returns The logger instance for chaining\n *\n * @example\n * ```typescript\n * logger.log('Processing complete')\n * logger.log('Items processed:', 42)\n * logger.log('Results:', { success: true, count: 10 })\n *\n * // Method chaining\n * logger.log('Step 1').log('Step 2').log('Step 3')\n * ```\n */\n log(...args: unknown[]): this {\n return this.#apply('log', args)\n }\n\n /**\n * Logs a newline to stdout only if the last line wasn't already blank.\n *\n * Prevents multiple consecutive blank lines. Useful for adding spacing\n * between sections without creating excessive whitespace.\n *\n * @returns The logger instance for chaining\n *\n * @example\n * ```typescript\n * logger.log('Section 1')\n * logger.logNewline() // Adds blank line\n * logger.logNewline() // Does nothing (already blank)\n * logger.log('Section 2')\n * ```\n */\n logNewline() {\n return this.#getLastWasBlank('stdout') ? this : this.log('')\n }\n\n /**\n * Resets all indentation to zero.\n *\n * When called on the main logger, resets both stderr and stdout indentation.\n * When called on a stream-bound logger (`.stderr` or `.stdout`), resets\n * only that stream's indentation.\n *\n * @returns The logger instance for chaining\n *\n * @example\n * ```typescript\n * logger.indent().indent().indent()\n * logger.log('Very indented')\n * logger.resetIndent()\n * logger.log('Back to zero indentation')\n *\n * // Reset only stdout\n * logger.stdout.resetIndent()\n * ```\n */\n resetIndent() {\n if (this.#boundStream) {\n // Only reset bound stream\n this.#setIndent(this.#boundStream, '')\n } else {\n // Reset both streams\n this.#setIndent('stderr', '')\n this.#setIndent('stdout', '')\n }\n return this\n }\n\n /**\n * Logs a main step message with a cyan arrow symbol and blank line before it.\n *\n * Automatically prefixes the message with `LOG_SYMBOLS.step` (cyan \u2192) and\n * adds a blank line before the message unless the last line was already blank.\n * Useful for marking major steps in a process with clear visual separation.\n * Always outputs to stdout. If the message starts with an existing symbol,\n * it will be stripped and replaced.\n *\n * @param msg - The step message to log\n * @param extras - Additional arguments to log\n * @returns The logger instance for chaining\n *\n * @example\n * ```typescript\n * logger.step('Building project')\n * logger.log('Compiling TypeScript...')\n * logger.step('Running tests')\n * logger.log('Running test suite...')\n * // Output:\n * // [blank line]\n * // \u2192 Building project\n * // Compiling TypeScript...\n * // [blank line]\n * // \u2192 Running tests\n * // Running test suite...\n * ```\n */\n step(msg: string, ...extras: unknown[]): this {\n // Add blank line before the step message.\n if (!this.#getLastWasBlank('stdout')) {\n // Use this.log() to properly track the blank line.\n this.log('')\n }\n // Strip existing symbols from the message.\n const text = this.#stripSymbols(msg)\n // Note: Step messages always go to stdout (unlike info/fail/etc which go to stderr).\n const indent = this.#getIndent('stdout')\n const symbols = this.#getSymbols()\n const con = this.#getConsole() as typeof console & Record<string, unknown>\n con.log(\n applyLinePrefix(`${symbols.step} ${text}`, {\n prefix: indent,\n }),\n ...extras,\n )\n this[lastWasBlankSymbol](false, 'stdout')\n ;(this as any)[incLogCallCountSymbol]()\n return this\n }\n\n /**\n * Logs an indented substep message (stateless).\n *\n * Adds a 2-space indent to the message without affecting the logger's\n * indentation state. Useful for showing sub-items under a main step.\n *\n * @param msg - The substep message to log\n * @param extras - Additional arguments to log\n * @returns The logger instance for chaining\n *\n * @example\n * ```typescript\n * logger.log('Installing dependencies:')\n * logger.substep('Installing react')\n * logger.substep('Installing typescript')\n * logger.substep('Installing eslint')\n * // Output:\n * // Installing dependencies:\n * // Installing react\n * // Installing typescript\n * // Installing eslint\n * ```\n */\n substep(msg: string, ...extras: unknown[]): this {\n // Add 2-space indent to the message.\n const indentedMsg = ` ${msg}`\n // Let log() handle all tracking.\n return this.log(indentedMsg, ...extras)\n }\n\n /**\n * Logs a success message with a green colored success symbol.\n *\n * Automatically prefixes the message with `LOG_SYMBOLS.success` (green \u2714).\n * Always outputs to stderr. If the message starts with an existing\n * symbol, it will be stripped and replaced.\n *\n * @param args - Message and additional arguments to log\n * @returns The logger instance for chaining\n *\n * @example\n * ```typescript\n * logger.success('Build completed')\n * logger.success('Tests passed:', { total: 42, passed: 42 })\n * logger.success('Deployment successful')\n * ```\n */\n success(...args: unknown[]): this {\n return this.#symbolApply('success', args)\n }\n\n /**\n * Logs a completion message with a success symbol (alias for `success()`).\n *\n * Provides semantic clarity when marking something as \"done\". Does NOT\n * automatically clear the current line - call `clearLine()` first if\n * needed after using `progress()`.\n *\n * @param args - Message and additional arguments to log\n * @returns The logger instance for chaining\n *\n * @example\n * ```typescript\n * logger.done('Task completed')\n *\n * // After progress indicator\n * logger.progress('Processing...')\n * // ... do work ...\n * logger.clearLine()\n * logger.done('Processing complete')\n * ```\n */\n done(...args: unknown[]): this {\n return this.#symbolApply('success', args)\n }\n\n /**\n * Displays data in a table format.\n *\n * Works like `console.table()`. Accepts arrays of objects or\n * objects with nested objects. Optionally specify which properties\n * to include in the table.\n *\n * @param tabularData - The data to display as a table\n * @param properties - Optional array of property names to include\n * @returns The logger instance for chaining\n *\n * @example\n * ```typescript\n * // Array of objects\n * logger.table([\n * { name: 'Alice', age: 30 },\n * { name: 'Bob', age: 25 }\n * ])\n *\n * // Specify properties to show\n * logger.table(users, ['name', 'email'])\n *\n * // Object with nested objects\n * logger.table({\n * user1: { name: 'Alice', age: 30 },\n * user2: { name: 'Bob', age: 25 }\n * })\n * ```\n */\n table(\n tabularData: unknown,\n properties?: readonly string[] | undefined,\n ): this {\n const con = this.#getConsole()\n con.table(tabularData, properties)\n this[lastWasBlankSymbol](false)\n return this[incLogCallCountSymbol]()\n }\n\n /**\n * Ends a timer and logs the elapsed time.\n *\n * Logs the duration since `console.time()` was called with the same\n * label. The timer is stopped and removed.\n *\n * @param label - Optional label for the timer\n * @default 'default'\n * @returns The logger instance for chaining\n *\n * @example\n * ```typescript\n * console.time('operation')\n * // ... do work ...\n * logger.timeEnd('operation')\n * // Logs: \"operation: 123.456ms\"\n *\n * console.time()\n * // ... do work ...\n * logger.timeEnd()\n * // Logs: \"default: 123.456ms\"\n * ```\n */\n timeEnd(label?: string | undefined): this {\n const con = this.#getConsole()\n con.timeEnd(label)\n this[lastWasBlankSymbol](false)\n return this[incLogCallCountSymbol]()\n }\n\n /**\n * Logs the current value of a timer without stopping it.\n *\n * Logs the duration since `console.time()` was called with the same\n * label, but keeps the timer running. Can include additional data\n * to log alongside the time.\n *\n * @param label - Optional label for the timer\n * @param data - Additional data to log with the time\n * @default 'default'\n * @returns The logger instance for chaining\n *\n * @example\n * ```typescript\n * console.time('process')\n * // ... partial work ...\n * logger.timeLog('process', 'Checkpoint 1')\n * // Logs: \"process: 123.456ms Checkpoint 1\"\n * // ... more work ...\n * logger.timeLog('process', 'Checkpoint 2')\n * // Logs: \"process: 234.567ms Checkpoint 2\"\n * console.timeEnd('process')\n * ```\n */\n timeLog(label?: string | undefined, ...data: unknown[]): this {\n const con = this.#getConsole()\n con.timeLog(label, ...data)\n this[lastWasBlankSymbol](false)\n return this[incLogCallCountSymbol]()\n }\n\n /**\n * Logs a stack trace to the console.\n *\n * Works like `console.trace()`. Shows the call stack leading to\n * where this method was called. Useful for debugging.\n *\n * @param message - Optional message to display with the trace\n * @param args - Additional arguments to log\n * @returns The logger instance for chaining\n *\n * @example\n * ```typescript\n * function debugFunction() {\n * logger.trace('Debug point reached')\n * }\n *\n * logger.trace('Trace from here')\n * logger.trace('Error context:', { userId: 123 })\n * ```\n */\n trace(message?: unknown | undefined, ...args: unknown[]): this {\n const con = this.#getConsole()\n con.trace(message, ...args)\n this[lastWasBlankSymbol](false)\n return this[incLogCallCountSymbol]()\n }\n\n /**\n * Logs a warning message with a yellow colored warning symbol.\n *\n * Automatically prefixes the message with `LOG_SYMBOLS.warn` (yellow \u26A0).\n * Always outputs to stderr. If the message starts with an existing\n * symbol, it will be stripped and replaced.\n *\n * @param args - Message and additional arguments to log\n * @returns The logger instance for chaining\n *\n * @example\n * ```typescript\n * logger.warn('Deprecated API used')\n * logger.warn('Low memory:', { available: '100MB' })\n * logger.warn('Missing optional configuration')\n * ```\n */\n warn(...args: unknown[]): this {\n return this.#symbolApply('warn', args)\n }\n\n /**\n * Writes text directly to stdout without a newline or indentation.\n *\n * Useful for progress indicators or custom formatting where you need\n * low-level control. Does not apply any indentation or formatting.\n *\n * @param text - The text to write\n * @returns The logger instance for chaining\n *\n * @example\n * ```typescript\n * logger.write('Processing... ')\n * // ... do work ...\n * logger.write('done\\n')\n *\n * // Build a line incrementally\n * logger.write('Step 1')\n * logger.write('... Step 2')\n * logger.write('... Step 3\\n')\n * ```\n */\n write(text: string): this {\n const con = this.#getConsole()\n // Write directly to the original stdout stream to bypass Console formatting\n // (e.g., group indentation). Try multiple approaches to get the raw stream:\n // 1. Use stored reference from constructor options\n // 2. Try to get from constructor args\n // 3. Fall back to con._stdout (which applies formatting)\n const ctorArgs = privateConstructorArgs.get(this) ?? []\n const stdout =\n this.#originalStdout || (ctorArgs[0] as any)?.stdout || con._stdout\n stdout.write(text)\n this[lastWasBlankSymbol](false)\n return this\n }\n\n /**\n * Shows a progress indicator that can be cleared with `clearLine()`.\n *\n * Displays a simple status message with a '\u2234' prefix. Does not include\n * animation or spinner. Intended to be cleared once the operation completes.\n * The output stream (stderr or stdout) depends on whether the logger is\n * stream-bound.\n *\n * @param text - The progress message to display\n * @returns The logger instance for chaining\n *\n * @example\n * ```typescript\n * logger.progress('Processing files...')\n * // ... do work ...\n * logger.clearLine()\n * logger.success('Files processed')\n *\n * // Stream-specific progress\n * logger.stdout.progress('Loading...')\n * // ... do work ...\n * logger.stdout.clearLine()\n * logger.stdout.log('Done')\n * ```\n */\n progress(text: string): this {\n const con = this.#getConsole()\n const stream = this.#getTargetStream()\n const streamObj = (\n stream === 'stderr' ? con._stderr : con._stdout\n ) as NodeJS.WriteStream & { write: (text: string) => boolean }\n streamObj.write(`\u2234 ${text}`)\n this[lastWasBlankSymbol](false)\n return this\n }\n\n /**\n * Clears the current line in the terminal.\n *\n * Moves the cursor to the beginning of the line and clears all content.\n * Works in both TTY and non-TTY environments. Useful for clearing\n * progress indicators created with `progress()`.\n *\n * The stream to clear (stderr or stdout) depends on whether the logger\n * is stream-bound.\n *\n * @returns The logger instance for chaining\n *\n * @example\n * ```typescript\n * logger.progress('Loading...')\n * // ... do work ...\n * logger.clearLine()\n * logger.success('Loaded')\n *\n * // Clear multiple progress updates\n * for (const file of files) {\n * logger.progress(`Processing ${file}`)\n * processFile(file)\n * logger.clearLine()\n * }\n * logger.success('All files processed')\n * ```\n */\n clearLine(): this {\n const con = this.#getConsole()\n const stream = this.#getTargetStream()\n const streamObj = (\n stream === 'stderr' ? con._stderr : con._stdout\n ) as NodeJS.WriteStream & {\n isTTY: boolean\n cursorTo: (x: number) => void\n clearLine: (dir: number) => void\n write: (text: string) => boolean\n }\n if (streamObj.isTTY) {\n streamObj.cursorTo(0)\n streamObj.clearLine(0)\n } else {\n streamObj.write('\\r\\x1b[K')\n }\n return this\n }\n}\n\n/**\n * Lazily add dynamic console methods to Logger prototype.\n *\n * This is deferred until first access to avoid calling Object.entries(globalConsole)\n * during early Node.js bootstrap before stdout is ready.\n * @private\n */\nlet _prototypeInitialized = false\nfunction ensurePrototypeInitialized() {\n if (_prototypeInitialized) {\n return\n }\n _prototypeInitialized = true\n\n const entries: Array<[string | symbol, PropertyDescriptor]> = [\n [\n getKGroupIndentationWidthSymbol(),\n {\n ...consolePropAttributes,\n value: 2,\n },\n ],\n [\n Symbol.toStringTag,\n {\n __proto__: null,\n configurable: true,\n value: 'logger',\n } as PropertyDescriptor,\n ],\n ]\n for (const { 0: key, 1: value } of Object.entries(globalConsole)) {\n if (!(Logger.prototype as any)[key] && typeof value === 'function') {\n // Dynamically name the log method without using Object.defineProperty.\n const { [key]: func } = {\n [key](this: Logger, ...args: unknown[]) {\n // Access Console via WeakMap directly since private methods can't be\n // called from dynamically created functions.\n let con = privateConsole.get(this)\n if (con === undefined) {\n // Lazy initialization - this will only happen if someone calls a\n // dynamically added console method before any core logger method.\n const ctorArgs = privateConstructorArgs.get(this) ?? []\n // Clean up constructor args - no longer needed after Console creation.\n privateConstructorArgs.delete(this)\n if (ctorArgs.length) {\n con = constructConsole(...ctorArgs)\n } else {\n con = constructConsole({\n stdout: process.stdout,\n stderr: process.stderr,\n }) as typeof console & Record<string, unknown>\n for (const { 0: k, 1: method } of boundConsoleEntries) {\n con[k] = method\n }\n }\n privateConsole.set(this, con)\n }\n const result = (con as any)[key](...args)\n return result === undefined || result === con ? this : result\n },\n }\n entries.push([\n key,\n {\n ...consolePropAttributes,\n value: func,\n },\n ])\n }\n }\n Object.defineProperties(Logger.prototype, Object.fromEntries(entries))\n}\n\n// Private singleton instance\nlet _logger: Logger | undefined\n\n/**\n * Get the default logger instance.\n * Lazily creates the logger to avoid circular dependencies during module initialization.\n * Reuses the same instance across calls.\n *\n * @returns Shared default logger instance\n *\n * @example\n * ```ts\n * import { getDefaultLogger } from '@socketsecurity/lib/logger'\n *\n * const logger = getDefaultLogger()\n * logger.log('Application started')\n * logger.success('Configuration loaded')\n * ```\n */\nexport function getDefaultLogger(): Logger {\n if (_logger === undefined) {\n _logger = new Logger()\n }\n return _logger\n}\n\n// REMOVED: Deprecated `logger` export\n// Migration: Use getDefaultLogger() instead\n// See: getDefaultLogger() function above\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,kCAA+B;AAC/B,6BAA2B;AAC3B,qBAA+C;AAE/C,qBAAwC;AACxC,oBAAuB;AAuEvB,MAAM,gBAAgB;AAKtB,MAAM,eAAe,QAAQ;AAC7B,MAAM,mBAAmB,QAAQ;AAEjC,IAAI;AAAA;AAMJ,SAAS,oBAAoB,MAAiB;AAC5C,MAAI,aAAa,QAAW;AAG1B,UAAM,cAA4B,QAAQ,cAAc;AACxD,eAAW,YAAY;AAAA,EACzB;AACA,SAAO;AAAA,IACL;AAAA;AAAA,IAGA;AAAA,EACF;AACF;AAAA;AAOA,SAAS,iBAAiB;AACxB,SAAO,uBAAAA;AACT;AAAA;AAQA,SAAS,WACP,MACA,OACA,QACQ;AACR,MAAI,OAAO,UAAU,UAAU;AAE7B,WAAQ,OAAe,KAAK,EAAE,IAAI;AAAA,EACpC;AAEA,SAAO,OAAO,IAAI,MAAM,CAAC,GAAG,MAAM,CAAC,GAAG,MAAM,CAAC,CAAC,EAAE,IAAI;AACtD;AAwBO,MAAM,cAA6B,uBAAM;AAC9C,QAAM,SAAiC;AAAA,IACrC,WAAW;AAAA,EACb;AAEA,MAAI,cAAc;AAGlB,QAAM,UAAgD;AAAA,IACpD,WAAW;AAAA,EACb;AAEA,QAAM,gBAAgB,MAAM;AAC1B,UAAM,gBAAY,4BAAAC,SAAmB;AACrC,UAAM,SAAS,+BAAe;AAC9B,UAAM,YAAQ,yBAAS;AAGvB,UAAM,eAAe,MAAM,OAAO;AAClC,UAAM,aAAa,MAAM,OAAO;AAChC,UAAM,eAAe,MAAM,OAAO;AA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AAM,KAAK,OAAO,QAAQ,aAAa,GAAG;AAChE,QAAI,CAAE,OAAO,UAAkB,GAAG,KAAK,OAAO,UAAU,YAAY;AAElE,YAAM,EAAE,CAAC,GAAG,GAAG,KAAK,IAAI;AAAA,QACtB,CAAC,GAAG,KAAmB,MAAiB;AAGtC,cAAI,MAAM,eAAe,IAAI,IAAI;AACjC,cAAI,QAAQ,QAAW;AAGrB,kBAAM,WAAW,uBAAuB,IAAI,IAAI,KAAK,CAAC;AAEtD,mCAAuB,OAAO,IAAI;AAClC,gBAAI,SAAS,QAAQ;AACnB,oBAAM,iCAAiB,GAAG,QAAQ;AAAA,YACpC,OAAO;AACL,oBAAM,iCAAiB;AAAA,gBACrB,QAAQ,QAAQ;AAAA,gBAChB,QAAQ,QAAQ;AAAA,cAClB,CAAC;AACD,yBAAW,EAAE,GAAG,GAAG,GAAG,OAAO,KAAK,qBAAqB;AACrD,oBAAI,CAAC,IAAI;AAAA,cACX;AAAA,YACF;AACA,2BAAe,IAAI,MAAM,GAAG;AAAA,UAC9B;AACA,gBAAM,SAAU,IAAY,GAAG,EAAE,GAAG,IAAI;AACxC,iBAAO,WAAW,UAAa,WAAW,MAAM,OAAO;AAAA,QACzD;AAAA,MACF;AACA,cAAQ,KAAK;AAAA,QACX;AAAA,QACA;AAAA,UACE,GAAG;AAAA,UACH,OAAO;AAAA,QACT;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACA,SAAO,iBAAiB,OAAO,WAAW,OAAO,YAAY,OAAO,CAAC;AACvE;AAGA,IAAI;AAkBG,SAAS,mBAA2B;AACzC,MAAI,YAAY,QAAW;AACzB,cAAU,IAAI,OAAO;AAAA,EACvB;AACA,SAAO;AACT;",
6
6
  "names": ["yoctocolorsCjs", "isUnicodeSupported"]
7
7
  }
@@ -118,11 +118,10 @@ async function isolatePackage(packageSpec, options) {
118
118
  await install(packageTempDir);
119
119
  } else {
120
120
  const { spawn } = require("../spawn");
121
- const WIN322 = require("../constants/platform").WIN32;
122
121
  const packageInstallSpec = spec.startsWith("https://") ? spec : `${packageName}@${spec}`;
123
122
  await spawn("pnpm", ["add", packageInstallSpec], {
124
123
  cwd: packageTempDir,
125
- shell: WIN322,
124
+ shell: import_platform.WIN32,
126
125
  stdio: "pipe"
127
126
  });
128
127
  }
@@ -163,10 +162,9 @@ async function isolatePackage(packageSpec, options) {
163
162
  await install(installedPath);
164
163
  } else {
165
164
  const { spawn } = require("../spawn");
166
- const WIN322 = require("../constants/platform").WIN32;
167
165
  await spawn("pnpm", ["install"], {
168
166
  cwd: installedPath,
169
- shell: WIN322,
167
+ shell: import_platform.WIN32,
170
168
  stdio: "pipe"
171
169
  });
172
170
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/packages/isolation.ts"],
4
- "sourcesContent": ["/**\n * @fileoverview Package isolation utilities for testing.\n * Provides tools to set up isolated test environments for packages.\n */\n\nimport { existsSync, promises as fs } from 'fs'\n\nimport { WIN32 } from '#constants/platform'\n\nimport type { PackageJson } from '../packages'\nimport { isAbsolute, isPath, trimLeadingDotSlash } from '../path'\nimport { readPackageJson } from './operations'\nimport { getOsTmpDir } from '#lib/paths'\n\nlet _path: typeof import('node:path') | undefined\n\n/*@__NO_SIDE_EFFECTS__*/\nfunction getPath() {\n if (_path === undefined) {\n // Use non-'node:' prefixed require to avoid Webpack errors.\n\n _path = /*@__PURE__*/ require('node:path')\n }\n return _path as typeof import('path')\n}\n\n/**\n * Copy options for fs.cp with cross-platform retry support.\n */\nconst FS_CP_OPTIONS = {\n dereference: true,\n errorOnExist: false,\n filter: (src: string) =>\n !src.includes('node_modules') && !src.endsWith('.DS_Store'),\n force: true,\n recursive: true,\n ...(WIN32 ? { maxRetries: 3, retryDelay: 100 } : {}),\n}\n\n/**\n * Resolve a path to its real location, handling symlinks.\n */\nasync function resolveRealPath(pathStr: string): Promise<string> {\n const path = getPath()\n return await fs.realpath(pathStr).catch(() => path.resolve(pathStr))\n}\n\n/**\n * Merge and write package.json with original and new values.\n */\nasync function mergePackageJson(\n pkgJsonPath: string,\n originalPkgJson: PackageJson | undefined,\n): Promise<PackageJson> {\n const pkgJson = JSON.parse(await fs.readFile(pkgJsonPath, 'utf8'))\n const mergedPkgJson = originalPkgJson\n ? { ...originalPkgJson, ...pkgJson }\n : pkgJson\n return mergedPkgJson\n}\n\nexport type IsolatePackageOptions = {\n imports?: Record<string, string> | undefined\n install?: ((cwd: string) => Promise<void>) | undefined\n onPackageJson?:\n | ((pkgJson: PackageJson) => PackageJson | Promise<PackageJson>)\n | undefined\n sourcePath?: string | undefined\n}\n\nexport type IsolatePackageResult = {\n exports?: Record<string, unknown> | undefined\n tmpdir: string\n}\n\n/**\n * Isolates a package in a temporary test environment.\n *\n * Supports multiple input types:\n * 1. File system path (absolute or relative)\n * 2. Package name with optional version spec\n * 3. npm package spec (parsed via npm-package-arg)\n *\n * @throws {Error} When package installation or setup fails.\n */\nexport async function isolatePackage(\n packageSpec: string,\n options?: IsolatePackageOptions | undefined,\n): Promise<IsolatePackageResult> {\n const path = getPath()\n const opts = { __proto__: null, ...options } as IsolatePackageOptions\n const { imports, install, onPackageJson, sourcePath: optSourcePath } = opts\n\n let sourcePath = optSourcePath\n let packageName: string | undefined\n let spec: string | undefined\n\n // Determine if this is a path or package spec.\n if (isPath(packageSpec)) {\n // File system path.\n // Handle edge case on Windows where path.relative() returns an absolute path\n // when paths are on different drives, and the test prepends './' to it.\n // Example: './C:\\path\\to\\file' should be treated as 'C:\\path\\to\\file'.\n const trimmedPath = trimLeadingDotSlash(packageSpec)\n const pathToResolve = isAbsolute(trimmedPath) ? trimmedPath : packageSpec\n sourcePath = path.resolve(pathToResolve)\n\n if (!existsSync(sourcePath)) {\n throw new Error(`Source path does not exist: ${sourcePath}`)\n }\n\n // Read package.json to get the name.\n const pkgJson = await readPackageJson(sourcePath, { normalize: true })\n if (!pkgJson) {\n throw new Error(`Could not read package.json from: ${sourcePath}`)\n }\n packageName = pkgJson.name as string\n } else {\n // Parse as npm package spec.\n const npa = /*@__PURE__*/ require('../external/npm-package-arg')\n const parsed = npa(packageSpec)\n\n packageName = parsed.name\n\n if (parsed.type === 'directory' || parsed.type === 'file') {\n sourcePath = parsed.fetchSpec\n if (!sourcePath || !existsSync(sourcePath)) {\n throw new Error(`Source path does not exist: ${sourcePath}`)\n }\n // If package name not provided by parser, read from package.json.\n if (!packageName) {\n const pkgJson = await readPackageJson(sourcePath, { normalize: true })\n if (!pkgJson) {\n throw new Error(`Could not read package.json from: ${sourcePath}`)\n }\n packageName = pkgJson.name as string\n }\n } else {\n // Registry package.\n spec = parsed.fetchSpec || parsed.rawSpec\n }\n }\n\n if (!packageName) {\n throw new Error(`Could not determine package name from: ${packageSpec}`)\n }\n\n // Create temp directory for this package.\n const sanitizedName = packageName.replace(/[@/]/g, '-')\n const tempDir = await fs.mkdtemp(\n path.join(getOsTmpDir(), `socket-test-${sanitizedName}-`),\n )\n const packageTempDir = path.join(tempDir, sanitizedName)\n await fs.mkdir(packageTempDir, { recursive: true })\n\n let installedPath: string\n let originalPackageJson: PackageJson | undefined\n\n if (spec) {\n // Installing from registry first, then copying source on top if provided.\n await fs.writeFile(\n path.join(packageTempDir, 'package.json'),\n JSON.stringify(\n {\n name: 'test-temp',\n private: true,\n version: '1.0.0',\n },\n null,\n 2,\n ),\n )\n\n // Use custom install function or default pnpm install.\n if (install) {\n await install(packageTempDir)\n } else {\n const { spawn } = /*@__PURE__*/ require('../spawn')\n const WIN32 = require('../constants/platform').WIN32\n const packageInstallSpec = spec.startsWith('https://')\n ? spec\n : `${packageName}@${spec}`\n\n await spawn('pnpm', ['add', packageInstallSpec], {\n cwd: packageTempDir,\n shell: WIN32,\n stdio: 'pipe',\n })\n }\n\n installedPath = path.join(packageTempDir, 'node_modules', packageName)\n\n // Save original package.json before copying source.\n originalPackageJson = await readPackageJson(installedPath, {\n normalize: true,\n })\n\n // Copy source files on top if provided.\n if (sourcePath) {\n // Check if source and destination are the same (symlinked).\n const realInstalledPath = await resolveRealPath(installedPath)\n const realSourcePath = await resolveRealPath(sourcePath)\n\n if (realSourcePath !== realInstalledPath) {\n await fs.cp(sourcePath, installedPath, FS_CP_OPTIONS)\n }\n }\n } else {\n // Just copying local package, no registry install.\n if (!sourcePath) {\n throw new Error('sourcePath is required when no version spec provided')\n }\n\n const scopedPath = packageName.startsWith('@')\n ? path.join(\n packageTempDir,\n 'node_modules',\n packageName.split('/')[0] ?? '',\n )\n : path.join(packageTempDir, 'node_modules')\n\n await fs.mkdir(scopedPath, { recursive: true })\n installedPath = path.join(packageTempDir, 'node_modules', packageName)\n\n await fs.cp(sourcePath, installedPath, FS_CP_OPTIONS)\n }\n\n // Prepare package.json if callback provided or if we need to merge with original.\n if (onPackageJson || originalPackageJson) {\n const pkgJsonPath = path.join(installedPath, 'package.json')\n const mergedPkgJson = await mergePackageJson(\n pkgJsonPath,\n originalPackageJson,\n )\n\n const finalPkgJson = onPackageJson\n ? await onPackageJson(mergedPkgJson)\n : mergedPkgJson\n\n await fs.writeFile(pkgJsonPath, JSON.stringify(finalPkgJson, null, 2))\n }\n\n // Install dependencies.\n if (install) {\n await install(installedPath)\n } else {\n const { spawn } = /*@__PURE__*/ require('../spawn')\n const WIN32 = require('../constants/platform').WIN32\n await spawn('pnpm', ['install'], {\n cwd: installedPath,\n shell: WIN32,\n stdio: 'pipe',\n })\n }\n\n // Load module exports if imports provided.\n const exports: Record<string, unknown> = imports\n ? { __proto__: null }\n : (undefined as unknown as Record<string, unknown>)\n\n if (imports) {\n for (const { 0: key, 1: specifier } of Object.entries(imports)) {\n const fullPath = path.join(installedPath, specifier)\n exports[key] = require(fullPath)\n }\n }\n\n return {\n exports,\n tmpdir: installedPath,\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,gBAA2C;AAE3C,sBAAsB;AAGtB,kBAAwD;AACxD,wBAAgC;AAChC,mBAA4B;AAE5B,IAAI;AAAA;AAGJ,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IACjC;AAEJ,UAAM,UAAAA,SAAG,UAAU,aAAa,KAAK,UAAU,cAAc,MAAM,CAAC,CAAC;AAAA,EACvE;AAGA,MAAI,SAAS;AACX,UAAM,QAAQ,aAAa;AAAA,EAC7B,OAAO;AACL,UAAM,EAAE,MAAM,IAAkB,QAAQ,UAAU;AAClD,UAAMC,SAAQ,QAAQ,uBAAuB,EAAE;AAC/C,UAAM,MAAM,QAAQ,CAAC,SAAS,GAAG;AAAA,MAC/B,KAAK;AAAA,MACL,OAAOA;AAAA,MACP,OAAO;AAAA,IACT,CAAC;AAAA,EACH;AAGA,QAAMC,WAAmC,UACrC,EAAE,WAAW,KAAK,IACjB;AAEL,MAAI,SAAS;AACX,eAAW,EAAE,GAAG,KAAK,GAAG,UAAU,KAAK,OAAO,QAAQ,OAAO,GAAG;AAC9D,YAAM,WAAW,KAAK,KAAK,eAAe,SAAS;AACnD,MAAAA,SAAQ,GAAG,IAAI,QAAQ,QAAQ;AAAA,IACjC;AAAA,EACF;AAEA,SAAO;AAAA,IACL,SAAAA;AAAA,IACA,QAAQ;AAAA,EACV;AACF;",
6
- "names": ["fs", "WIN32", "exports"]
4
+ "sourcesContent": ["/**\n * @fileoverview Package isolation utilities for testing.\n * Provides tools to set up isolated test environments for packages.\n */\n\nimport { existsSync, promises as fs } from 'fs'\n\nimport { WIN32 } from '#constants/platform'\n\nimport type { PackageJson } from '../packages'\nimport { isAbsolute, isPath, trimLeadingDotSlash } from '../path'\nimport { readPackageJson } from './operations'\nimport { getOsTmpDir } from '#lib/paths'\n\nlet _path: typeof import('node:path') | undefined\n\n/*@__NO_SIDE_EFFECTS__*/\nfunction getPath() {\n if (_path === undefined) {\n // Use non-'node:' prefixed require to avoid Webpack errors.\n\n _path = /*@__PURE__*/ require('node:path')\n }\n return _path as typeof import('path')\n}\n\n/**\n * Copy options for fs.cp with cross-platform retry support.\n */\nconst FS_CP_OPTIONS = {\n dereference: true,\n errorOnExist: false,\n filter: (src: string) =>\n !src.includes('node_modules') && !src.endsWith('.DS_Store'),\n force: true,\n recursive: true,\n ...(WIN32 ? { maxRetries: 3, retryDelay: 100 } : {}),\n}\n\n/**\n * Resolve a path to its real location, handling symlinks.\n */\nasync function resolveRealPath(pathStr: string): Promise<string> {\n const path = getPath()\n return await fs.realpath(pathStr).catch(() => path.resolve(pathStr))\n}\n\n/**\n * Merge and write package.json with original and new values.\n */\nasync function mergePackageJson(\n pkgJsonPath: string,\n originalPkgJson: PackageJson | undefined,\n): Promise<PackageJson> {\n const pkgJson = JSON.parse(await fs.readFile(pkgJsonPath, 'utf8'))\n const mergedPkgJson = originalPkgJson\n ? { ...originalPkgJson, ...pkgJson }\n : pkgJson\n return mergedPkgJson\n}\n\nexport type IsolatePackageOptions = {\n imports?: Record<string, string> | undefined\n install?: ((cwd: string) => Promise<void>) | undefined\n onPackageJson?:\n | ((pkgJson: PackageJson) => PackageJson | Promise<PackageJson>)\n | undefined\n sourcePath?: string | undefined\n}\n\nexport type IsolatePackageResult = {\n exports?: Record<string, unknown> | undefined\n tmpdir: string\n}\n\n/**\n * Isolates a package in a temporary test environment.\n *\n * Supports multiple input types:\n * 1. File system path (absolute or relative)\n * 2. Package name with optional version spec\n * 3. npm package spec (parsed via npm-package-arg)\n *\n * @throws {Error} When package installation or setup fails.\n */\nexport async function isolatePackage(\n packageSpec: string,\n options?: IsolatePackageOptions | undefined,\n): Promise<IsolatePackageResult> {\n const path = getPath()\n const opts = { __proto__: null, ...options } as IsolatePackageOptions\n const { imports, install, onPackageJson, sourcePath: optSourcePath } = opts\n\n let sourcePath = optSourcePath\n let packageName: string | undefined\n let spec: string | undefined\n\n // Determine if this is a path or package spec.\n if (isPath(packageSpec)) {\n // File system path.\n // Handle edge case on Windows where path.relative() returns an absolute path\n // when paths are on different drives, and the test prepends './' to it.\n // Example: './C:\\path\\to\\file' should be treated as 'C:\\path\\to\\file'.\n const trimmedPath = trimLeadingDotSlash(packageSpec)\n const pathToResolve = isAbsolute(trimmedPath) ? trimmedPath : packageSpec\n sourcePath = path.resolve(pathToResolve)\n\n if (!existsSync(sourcePath)) {\n throw new Error(`Source path does not exist: ${sourcePath}`)\n }\n\n // Read package.json to get the name.\n const pkgJson = await readPackageJson(sourcePath, { normalize: true })\n if (!pkgJson) {\n throw new Error(`Could not read package.json from: ${sourcePath}`)\n }\n packageName = pkgJson.name as string\n } else {\n // Parse as npm package spec.\n const npa = /*@__PURE__*/ require('../external/npm-package-arg')\n const parsed = npa(packageSpec)\n\n packageName = parsed.name\n\n if (parsed.type === 'directory' || parsed.type === 'file') {\n sourcePath = parsed.fetchSpec\n if (!sourcePath || !existsSync(sourcePath)) {\n throw new Error(`Source path does not exist: ${sourcePath}`)\n }\n // If package name not provided by parser, read from package.json.\n if (!packageName) {\n const pkgJson = await readPackageJson(sourcePath, { normalize: true })\n if (!pkgJson) {\n throw new Error(`Could not read package.json from: ${sourcePath}`)\n }\n packageName = pkgJson.name as string\n }\n } else {\n // Registry package.\n spec = parsed.fetchSpec || parsed.rawSpec\n }\n }\n\n if (!packageName) {\n throw new Error(`Could not determine package name from: ${packageSpec}`)\n }\n\n // Create temp directory for this package.\n const sanitizedName = packageName.replace(/[@/]/g, '-')\n const tempDir = await fs.mkdtemp(\n path.join(getOsTmpDir(), `socket-test-${sanitizedName}-`),\n )\n const packageTempDir = path.join(tempDir, sanitizedName)\n await fs.mkdir(packageTempDir, { recursive: true })\n\n let installedPath: string\n let originalPackageJson: PackageJson | undefined\n\n if (spec) {\n // Installing from registry first, then copying source on top if provided.\n await fs.writeFile(\n path.join(packageTempDir, 'package.json'),\n JSON.stringify(\n {\n name: 'test-temp',\n private: true,\n version: '1.0.0',\n },\n null,\n 2,\n ),\n )\n\n // Use custom install function or default pnpm install.\n if (install) {\n await install(packageTempDir)\n } else {\n const { spawn } = /*@__PURE__*/ require('../spawn')\n const packageInstallSpec = spec.startsWith('https://')\n ? spec\n : `${packageName}@${spec}`\n\n await spawn('pnpm', ['add', packageInstallSpec], {\n cwd: packageTempDir,\n shell: WIN32,\n stdio: 'pipe',\n })\n }\n\n installedPath = path.join(packageTempDir, 'node_modules', packageName)\n\n // Save original package.json before copying source.\n originalPackageJson = await readPackageJson(installedPath, {\n normalize: true,\n })\n\n // Copy source files on top if provided.\n if (sourcePath) {\n // Check if source and destination are the same (symlinked).\n const realInstalledPath = await resolveRealPath(installedPath)\n const realSourcePath = await resolveRealPath(sourcePath)\n\n if (realSourcePath !== realInstalledPath) {\n await fs.cp(sourcePath, installedPath, FS_CP_OPTIONS)\n }\n }\n } else {\n // Just copying local package, no registry install.\n if (!sourcePath) {\n throw new Error('sourcePath is required when no version spec provided')\n }\n\n const scopedPath = packageName.startsWith('@')\n ? path.join(\n packageTempDir,\n 'node_modules',\n packageName.split('/')[0] ?? '',\n )\n : path.join(packageTempDir, 'node_modules')\n\n await fs.mkdir(scopedPath, { recursive: true })\n installedPath = path.join(packageTempDir, 'node_modules', packageName)\n\n await fs.cp(sourcePath, installedPath, FS_CP_OPTIONS)\n }\n\n // Prepare package.json if callback provided or if we need to merge with original.\n if (onPackageJson || originalPackageJson) {\n const pkgJsonPath = path.join(installedPath, 'package.json')\n const mergedPkgJson = await mergePackageJson(\n pkgJsonPath,\n originalPackageJson,\n )\n\n const finalPkgJson = onPackageJson\n ? await onPackageJson(mergedPkgJson)\n : mergedPkgJson\n\n await fs.writeFile(pkgJsonPath, JSON.stringify(finalPkgJson, null, 2))\n }\n\n // Install dependencies.\n if (install) {\n await install(installedPath)\n } else {\n const { spawn } = /*@__PURE__*/ require('../spawn')\n await spawn('pnpm', ['install'], {\n cwd: installedPath,\n shell: WIN32,\n stdio: 'pipe',\n })\n }\n\n // Load module exports if imports provided.\n const exports: Record<string, unknown> = imports\n ? { __proto__: null }\n : (undefined as unknown as Record<string, unknown>)\n\n if (imports) {\n for (const { 0: key, 1: specifier } of Object.entries(imports)) {\n const fullPath = path.join(installedPath, specifier)\n exports[key] = require(fullPath)\n }\n }\n\n return {\n exports,\n tmpdir: installedPath,\n }\n}\n"],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