/** * @file Private state shared between the `logger/node` class (which owns the * public `Logger` surface) and `logger/console-init` (which mutates * `Logger.prototype` to mirror `globalConsole`). The `_` prefix keeps this * module out of the generated package.json `exports` map (the `dist/**\/_*` * ignore pattern in `scripts/fleet/make-package-exports.mts` filters it * out), so it is not part of the public surface — it exists only to give the * two leaves above a common owner for the WeakMap-backed lazy-init state. Why * two WeakMaps instead of `#privateField` slots: * * - Logger adds dynamic console methods to its prototype at first use (see * `console-init.ts` `ensurePrototypeInitialized`). Those dynamic methods * are constructed via the `{ [key]: function () }` shorthand and CANNOT * access TC39 private fields on `this`. * - WeakMaps work for both the static methods on the `Logger` class body AND * the dynamically-attached prototype methods. WeakMap entries are GC'd * alongside the `Logger` instance. * - `privateConstructorArgs` is deleted after first `Console` build so we don't * pin the original args for the lifetime of the logger. */ /** * The global `console` reference captured at module load. Pinned to a local so * dynamic `console` overrides at runtime can't affect the logger's source * console (e.g., test rewiring of `globalThis.console`). */ export declare const globalConsole: Console; /** * Property-descriptor template used when registering dynamic console methods on * `Logger.prototype`. Writable + configurable so tests can override; * non-enumerable so the methods don't leak into `for...in` iteration on a * logger instance. */ export declare const consolePropAttributes: { __proto__: null; configurable: boolean; enumerable: boolean; writable: boolean; }; /** * Cap on the indentation prefix length so a runaway `indent(n)` call with a * huge `n` can't allocate a multi-megabyte string. */ export declare const maxIndentation = 1000; /** * Pre-bound copies of the console methods that need their original `this` to * function (e.g., `console.error.bind(globalConsole)`). Returns `[name, * boundFn]` pairs so `console-init.ts` can apply them onto the per-instance * Console without re-binding on every call. * * Built LAZILY (memoized) rather than at module-eval: `fn.bind(globalConsole)` * of a native console method produces a bound function wrapping a native C++ * function pointer, which serializes as an unresolvable external reference and * aborts V8 --build-snapshot. Deferring construction to first Console build * keeps the bind-once/reuse win while leaving module import snapshot-safe. */ export declare function getBoundConsoleEntries(): Array<[ string, (...args: unknown[]) => unknown ]>; /** * WeakMap storing the Console instance for each Logger. * * Console creation is lazy - deferred until first logging method call. This * allows logger to be imported during early Node.js bootstrap before stdout is * ready, avoiding ERR_CONSOLE_WRITABLE_STREAM errors. */ export declare const privateConsole: WeakMap; /** * WeakMap storing constructor arguments for lazy Console initialization. * * WeakMap is required instead of a private field (#constructorArgs) because: 1. * Private fields can't be accessed from dynamically created functions 2. Logger * adds console methods dynamically to its prototype 3. These dynamic methods * need constructor args for lazy initialization 4. WeakMap allows both regular * methods and dynamic functions to access args. * * The args are deleted from the WeakMap after Console is created (memory * cleanup). */ export declare const privateConstructorArgs: WeakMap;