@socketsecurity/lib 6.0.1 → 6.0.3

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.
Files changed (49) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/dist/ai/profiles.d.mts +48 -25
  3. package/dist/ai/profiles.js +40 -33
  4. package/dist/ai/spawn.d.mts +2 -2
  5. package/dist/ai/types.d.mts +3 -3
  6. package/dist/ai/worktree.d.mts +2 -2
  7. package/dist/constants/socket.js +1 -1
  8. package/dist/debug/_internal.d.ts +1 -1
  9. package/dist/dlx/detect.js +4 -12
  10. package/dist/dlx/firewall.js +2 -2
  11. package/dist/fs/access.d.ts +32 -0
  12. package/dist/fs/access.js +63 -0
  13. package/dist/fs/find-up.js +9 -31
  14. package/dist/fs/resolve-module.d.ts +57 -0
  15. package/dist/fs/resolve-module.js +63 -0
  16. package/dist/fs/validate.js +3 -6
  17. package/dist/http-request/download-types.d.ts +2 -2
  18. package/dist/http-request/http-request.d.ts +12 -0
  19. package/dist/http-request/http-request.js +36 -0
  20. package/dist/http-request/node.d.ts +29 -0
  21. package/dist/http-request/{convenience.js → node.js} +9 -3
  22. package/dist/logger/_internal.d.ts +1 -1
  23. package/dist/logger/browser.d.ts +14 -12
  24. package/dist/logger/browser.js +3 -10
  25. package/dist/logger/console.js +3 -3
  26. package/dist/logger/default.d.ts +8 -402
  27. package/dist/logger/default.js +5 -822
  28. package/dist/logger/logger.d.ts +10 -0
  29. package/dist/logger/logger.js +30 -0
  30. package/dist/logger/node.d.ts +400 -0
  31. package/dist/logger/node.js +856 -0
  32. package/dist/logger/symbols-builder.d.ts +1 -1
  33. package/dist/logger/types.d.ts +1 -1
  34. package/dist/packages/provenance.d.ts +42 -0
  35. package/dist/packages/provenance.js +71 -0
  36. package/dist/paths/walk.d.ts +40 -0
  37. package/dist/paths/walk.js +63 -0
  38. package/dist/primordials/map-set.d.ts +35 -0
  39. package/dist/primordials/map-set.js +43 -0
  40. package/dist/promises/_internal.d.ts +8 -2
  41. package/dist/promises/_internal.js +1 -5
  42. package/dist/releases/github-asset-url.js +2 -11
  43. package/dist/releases/github-listing.js +2 -11
  44. package/dist/releases/github-retry-config.d.ts +31 -0
  45. package/dist/releases/github-retry-config.js +52 -0
  46. package/dist/smol/path.d.ts +51 -0
  47. package/dist/smol/path.js +42 -0
  48. package/package.json +113 -40
  49. package/dist/http-request/convenience.d.ts +0 -104
@@ -23,18 +23,15 @@ __export(validate_exports, {
23
23
  validateFiles: () => validateFiles
24
24
  });
25
25
  module.exports = __toCommonJS(validate_exports);
26
- var import_fs = require("../node/fs");
26
+ var import_access = require("./access");
27
27
  // @__NO_SIDE_EFFECTS__
28
28
  function validateFiles(filepaths) {
29
- const fs = (0, import_fs.getNodeFs)();
30
29
  const validPaths = [];
31
30
  const invalidPaths = [];
32
- const { R_OK } = fs.constants;
33
31
  for (const filepath of filepaths) {
34
- try {
35
- fs.accessSync(filepath, R_OK);
32
+ if ((0, import_access.canRead)(filepath)) {
36
33
  validPaths.push(filepath);
37
- } catch {
34
+ } else {
38
35
  invalidPaths.push(filepath);
39
36
  }
40
37
  }
@@ -6,7 +6,7 @@
6
6
  * - `Checksums` / `FetchChecksumsOptions` — checksum-file helpers
7
7
  */
8
8
  import type { IncomingHttpHeaders } from 'node:http';
9
- import type { Logger } from '../logger/default';
9
+ import type { Logger } from '../logger/node';
10
10
  /**
11
11
  * Configuration options for file downloads.
12
12
  */
@@ -55,7 +55,7 @@ export interface HttpDownloadOptions {
55
55
  *
56
56
  * @example
57
57
  * ;```ts
58
- * import { getDefaultLogger } from '@socketsecurity/lib/logger/default'
58
+ * import { getDefaultLogger } from '@socketsecurity/lib/logger/node'
59
59
  *
60
60
  * const logger = getDefaultLogger()
61
61
  * await httpDownload('https://example.com/file.zip', '/tmp/file.zip', {
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @file Public HTTP-request entry — re-exports the platform-correct
3
+ * implementation. Bundlers that honor the package.json `'browser'` condition
4
+ * (rolldown, vite, esbuild on browser platform) swap this entry to
5
+ * `./browser`; Node consumers get `./node`. Same named exports (`httpJson`,
6
+ * `httpText`, `httpRequest`, `HttpResponseError`) on both platforms so
7
+ * callers can write `import { httpJson } from
8
+ * '@socketsecurity/lib/http-request/http-request'` without caring about
9
+ * platform.
10
+ */
11
+ export { httpJson, httpRequest, httpText, HttpResponseError } from './node';
12
+ export type { HttpResponse, HttpRequestOptions } from './node';
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ /* Socket Lib - Built with esbuild */
3
+ "use strict";
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
+ var http_request_exports = {};
22
+ __export(http_request_exports, {
23
+ HttpResponseError: () => import_node.HttpResponseError,
24
+ httpJson: () => import_node.httpJson,
25
+ httpRequest: () => import_node.httpRequest,
26
+ httpText: () => import_node.httpText
27
+ });
28
+ module.exports = __toCommonJS(http_request_exports);
29
+ var import_node = require("./node");
30
+ // Annotate the CommonJS export names for ESM import in node:
31
+ 0 && (module.exports = {
32
+ HttpResponseError,
33
+ httpJson,
34
+ httpRequest,
35
+ httpText
36
+ });
@@ -0,0 +1,29 @@
1
+ /**
2
+ * @file Node-side HTTP request layer — the public surface (`httpJson`,
3
+ * `httpText`, `httpRequest`, `HttpResponseError`) for consumers on Node.
4
+ * Pairs with `./browser` (browser-safe variant via `fetch`); both files
5
+ * expose the same named exports so the package.json `'browser'` condition can
6
+ * swap them by platform without consumers changing their imports. `httpJson`
7
+ * and `httpText` live here directly; `httpRequest` and the shared types are
8
+ * re-exported from their dedicated leaves so the sub-imports
9
+ * (`./http-request/request`, `./http-request/response-types`) stay loadable
10
+ * individually for callers that don't want the convenience wrappers in their
11
+ * bundle.
12
+ */
13
+ import type { HttpRequestOptions } from './request-types';
14
+ export { httpRequest } from './request';
15
+ export { HttpResponseError } from './response-types';
16
+ export type { HttpResponse } from './response-types';
17
+ export type { HttpRequestOptions } from './request-types';
18
+ /**
19
+ * GET / POST a JSON endpoint. Automatically sets `Accept: application/json` and
20
+ * `Content-Type: application/json` (when a body is present); user-supplied
21
+ * headers always win. Throws `HttpResponseError` on non-2xx.
22
+ */
23
+ export declare function httpJson<T = unknown>(url: string, options?: HttpRequestOptions | undefined): Promise<T>;
24
+ /**
25
+ * GET / POST a text endpoint. Sets `Accept: text/plain` (and `Content-Type:
26
+ * text/plain` on bodies); user headers override. Throws `HttpResponseError` on
27
+ * non-2xx.
28
+ */
29
+ export declare function httpText(url: string, options?: HttpRequestOptions | undefined): Promise<string>;
@@ -18,15 +18,19 @@ var __copyProps = (to, from, except, desc) => {
18
18
  return to;
19
19
  };
20
20
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
- var convenience_exports = {};
22
- __export(convenience_exports, {
21
+ var node_exports = {};
22
+ __export(node_exports, {
23
+ HttpResponseError: () => import_response_types2.HttpResponseError,
23
24
  httpJson: () => httpJson,
25
+ httpRequest: () => import_request2.httpRequest,
24
26
  httpText: () => httpText
25
27
  });
26
- module.exports = __toCommonJS(convenience_exports);
28
+ module.exports = __toCommonJS(node_exports);
27
29
  var import_error = require("../primordials/error");
28
30
  var import_request = require("./request");
29
31
  var import_response_types = require("./response-types");
32
+ var import_request2 = require("./request");
33
+ var import_response_types2 = require("./response-types");
30
34
  async function httpJson(url, options) {
31
35
  const {
32
36
  body,
@@ -91,6 +95,8 @@ async function httpText(url, options) {
91
95
  }
92
96
  // Annotate the CommonJS export names for ESM import in node:
93
97
  0 && (module.exports = {
98
+ HttpResponseError,
94
99
  httpJson,
100
+ httpRequest,
95
101
  httpText
96
102
  });
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @file Private state shared between the `logger/default` class (which owns the
2
+ * @file Private state shared between the `logger/node` class (which owns the
3
3
  * public `Logger` surface) and `logger/console-init` (which mutates
4
4
  * `Logger.prototype` to mirror `globalConsole`). The `_` prefix keeps this
5
5
  * module out of the generated package.json `exports` map (the `dist/**\/_*`
@@ -1,16 +1,18 @@
1
1
  /**
2
- * @file Browser-safe Logger surfaceminimal shim mirroring the public
3
- * `success`/`fail`/`warn`/`error`/`info`/`log` methods of the full Node
4
- * Logger, but backed by the global `console` so it works in Chrome MV3
2
+ * @file Browser-safe `Logger` implementationmirrors the public `success` /
3
+ * `fail` / `warn` / `error` / `info` / `log` surface of the Node `Logger`
4
+ * (see `./node`) but backed by the global `console` so it works in Chrome MV3
5
5
  * service workers, content scripts, popups, and any other browser context
6
- * that doesn't have `node:process` / `node:console` / fs.
6
+ * without `node:process` / `node:console` / fs. Consumers should import
7
+ * `Logger` from `./logger` (auto-routed by the package.json `browser`
8
+ * condition) or `./default` for the singleton. `./browser` is the
9
+ * explicit-platform name; useful for tests pinning to one implementation.
7
10
  */
8
- export interface BrowserLogger {
9
- log(message: unknown, ...args: unknown[]): BrowserLogger;
10
- info(message: unknown, ...args: unknown[]): BrowserLogger;
11
- warn(message: unknown, ...args: unknown[]): BrowserLogger;
12
- error(message: unknown, ...args: unknown[]): BrowserLogger;
13
- success(message: unknown, ...args: unknown[]): BrowserLogger;
14
- fail(message: unknown, ...args: unknown[]): BrowserLogger;
11
+ export declare class Logger {
12
+ log(message: unknown, ...args: unknown[]): this;
13
+ info(message: unknown, ...args: unknown[]): this;
14
+ warn(message: unknown, ...args: unknown[]): this;
15
+ error(message: unknown, ...args: unknown[]): this;
16
+ success(message: unknown, ...args: unknown[]): this;
17
+ fail(message: unknown, ...args: unknown[]): this;
15
18
  }
16
- export declare function getDefaultLogger(): BrowserLogger;
@@ -20,14 +20,14 @@ var __copyProps = (to, from, except, desc) => {
20
20
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
21
  var browser_exports = {};
22
22
  __export(browser_exports, {
23
- getDefaultLogger: () => getDefaultLogger
23
+ Logger: () => Logger
24
24
  });
25
25
  module.exports = __toCommonJS(browser_exports);
26
26
  const SYM_SUCCESS = "\u2713";
27
27
  const SYM_FAIL = "\u2715";
28
28
  const SYM_WARN = "\u26A0";
29
29
  const SYM_INFO = "\u2139";
30
- class ConsoleBrowserLogger {
30
+ class Logger {
31
31
  log(message, ...args) {
32
32
  console.log(message, ...args);
33
33
  return this;
@@ -52,14 +52,7 @@ class ConsoleBrowserLogger {
52
52
  return this.error(message, ...args);
53
53
  }
54
54
  }
55
- let sharedLogger;
56
- function getDefaultLogger() {
57
- if (!sharedLogger) {
58
- sharedLogger = new ConsoleBrowserLogger();
59
- }
60
- return sharedLogger;
61
- }
62
55
  // Annotate the CommonJS export names for ESM import in node:
63
56
  0 && (module.exports = {
64
- getDefaultLogger
57
+ Logger
65
58
  });
@@ -38,7 +38,7 @@ var import_node_process = __toESM(require("node:process"));
38
38
  var import_object = require("../primordials/object");
39
39
  var import_reflect = require("../primordials/reflect");
40
40
  var import_internal = require("./_internal");
41
- var import_default = require("./default");
41
+ var import_node = require("./node");
42
42
  var import_symbols = require("./symbols");
43
43
  let _Console;
44
44
  let _prototypeInitialized = false;
@@ -77,7 +77,7 @@ function ensurePrototypeInitialized() {
77
77
  ]
78
78
  ];
79
79
  for (const { 0: key, 1: value } of (0, import_object.ObjectEntries)(import_internal.globalConsole)) {
80
- if (!import_default.Logger.prototype[key] && typeof value === "function") {
80
+ if (!import_node.Logger.prototype[key] && typeof value === "function") {
81
81
  const { [key]: func } = {
82
82
  [key](...args) {
83
83
  let con = import_internal.privateConsole.get(this);
@@ -110,7 +110,7 @@ function ensurePrototypeInitialized() {
110
110
  ]);
111
111
  }
112
112
  }
113
- (0, import_object.ObjectDefineProperties)(import_default.Logger.prototype, (0, import_object.ObjectFromEntries)(entries));
113
+ (0, import_object.ObjectDefineProperties)(import_node.Logger.prototype, (0, import_object.ObjectFromEntries)(entries));
114
114
  }
115
115
  // Annotate the CommonJS export names for ESM import in node:
116
116
  0 && (module.exports = {
@@ -1,405 +1,11 @@
1
1
  /**
2
- * @file The `Logger` class + the shared-default `getDefaultLogger()` accessor —
3
- * the public class surface for `logger/*`. Owns the per-instance state
4
- * (parent, bound stream, indent buffers, theme), the symbol-prefixed semantic
5
- * methods (`success`, `fail`, `info`, ...), the chainable wrappers around the
6
- * underlying `Console` methods, AND the module-singleton accessor for the
7
- * shared default instance. Console construction is deliberately lazy: the
8
- * constructor only stashes its args in `_internal.privateConstructorArgs`;
9
- * the actual `node:console` instance is built on first call to
10
- * `#getConsole()`. This lets the logger be imported during early Node.js
11
- * bootstrap before stdout is ready, avoiding `ERR_CONSOLE_WRITABLE_STREAM`.
12
- * Free helpers live in sibling leaves (per `socket-lib`'s
13
- * export-top-level-functions rule):
14
- *
15
- * - color helpers — `./colors` (`applyColor`, `getYoctocolors`)
16
- * - log symbols + symbol getters — `./symbols`
17
- * - lazy console init + prototype mirror — `./console-init`
18
- * - shared private state — `./_internal`
19
- */
20
- import { incLogCallCountSymbol, lastWasBlankSymbol } from './symbols';
21
- import type { Task } from './types';
22
- /**
23
- * Enhanced console logger with indentation, colored symbols, and stream
24
- * management.
25
- */
26
- export declare class Logger {
27
- #private;
28
- /**
29
- * Static reference to log symbols for convenience.
30
- */
31
- static LOG_SYMBOLS: Record<string, string>;
32
- /**
33
- * Creates a new Logger instance.
34
- *
35
- * When called without arguments, creates a logger using the default
36
- * `process.stdout` and `process.stderr` streams. Can accept custom console
37
- * constructor arguments for advanced use cases.
38
- *
39
- * @param args - Optional console constructor arguments.
40
- */
41
- constructor(...args: unknown[]);
42
- /**
43
- * Gets a logger instance bound exclusively to stderr.
44
- *
45
- * All logging operations on this instance will write to stderr only.
46
- * Indentation is tracked separately from stdout. The instance is cached and
47
- * reused on subsequent accesses.
48
- *
49
- * @returns A logger instance bound to stderr
50
- */
51
- get stderr(): Logger;
52
- /**
53
- * Gets a logger instance bound exclusively to stdout.
54
- *
55
- * All logging operations on this instance will write to stdout only.
56
- * Indentation is tracked separately from stderr. The instance is cached and
57
- * reused on subsequent accesses.
58
- *
59
- * @returns A logger instance bound to stdout
60
- */
61
- get stdout(): Logger;
62
- /**
63
- * Gets the total number of log calls made on this logger instance.
64
- *
65
- * Tracks all logging method calls including `log()`, `error()`, `warn()`,
66
- * `success()`, `fail()`, etc. Useful for testing and monitoring logging
67
- * activity.
68
- *
69
- * @returns The number of times logging methods have been called
70
- */
71
- get logCallCount(): number;
72
- /**
73
- * Increments the internal log call counter.
74
- *
75
- * This is called automatically by logging methods and should not be called
76
- * directly in normal usage.
77
- */
78
- [incLogCallCountSymbol](): this;
79
- /**
80
- * Sets whether the last logged line was blank.
81
- *
82
- * Used internally to track blank lines and prevent duplicate spacing. This is
83
- * called automatically by logging methods.
84
- *
85
- * @param value - Whether the last line was blank.
86
- * @param stream - Optional stream to update (defaults to both streams if not
87
- * bound, or target stream if bound)
88
- */
89
- [lastWasBlankSymbol](value: unknown, stream?: 'stderr' | 'stdout'): this;
90
- /**
91
- * Logs an assertion failure message if the value is falsy.
92
- *
93
- * Works like `console.assert()` but returns the logger for chaining. If the
94
- * value is truthy, nothing is logged. If falsy, logs an error message with an
95
- * assertion failure.
96
- *
97
- * @param value - The value to test.
98
- * @param message - Optional message and additional arguments to log.
99
- */
100
- assert(value: unknown, ...message: unknown[]): this;
101
- /**
102
- * Clears the current line in the terminal.
103
- *
104
- * Moves the cursor to the beginning of the line and clears all content. Works
105
- * in both TTY and non-TTY environments. Useful for clearing progress
106
- * indicators created with `progress()`.
107
- *
108
- * The stream to clear (stderr or stdout) depends on whether the logger is
109
- * stream-bound.
110
- */
111
- clearLine(): this;
112
- /**
113
- * Clears the visible terminal screen.
114
- *
115
- * Only available on the main logger instance, not on stream-bound instances
116
- * (`.stderr` or `.stdout`). Resets the log call count and blank line tracking
117
- * if the output is a TTY.
118
- *
119
- * @throws {Error} If called on a stream-bound logger instance
120
- */
121
- clearVisible(): this;
122
- /**
123
- * Increments and logs a counter for the given label.
124
- *
125
- * Each unique label maintains its own counter. Works like `console.count()`.
126
- *
127
- * @default 'default'
128
- *
129
- * @param label - Optional label for the counter.
130
- */
131
- count(label?: string | undefined): this;
132
- /**
133
- * Creates a task that logs start and completion messages automatically.
134
- *
135
- * Returns a task object with a `run()` method that executes the provided
136
- * function and logs "Starting task: {name}" before execution and "Completed
137
- * task: {name}" after completion.
138
- *
139
- * @param name - The name of the task.
140
- *
141
- * @returns A task object with a `run()` method
142
- */
143
- createTask(name: string): Task;
144
- /**
145
- * Decreases the indentation level by removing spaces from the prefix.
146
- *
147
- * When called on the main logger, affects both stderr and stdout indentation.
148
- * When called on a stream-bound logger (`.stderr` or `.stdout`), affects only
149
- * that stream's indentation.
150
- *
151
- * @default 2
152
- */
153
- dedent(spaces?: number): this;
154
- /**
155
- * Displays an object's properties in a formatted way.
156
- *
157
- * Works like `console.dir()` with customizable options for depth, colors,
158
- * etc. Useful for inspecting complex objects.
159
- *
160
- * @param obj - The object to display.
161
- * @param options - Optional formatting options (Node.js inspect options)
162
- */
163
- dir(obj: unknown, options?: unknown | undefined): this;
164
- /**
165
- * Displays data as XML/HTML in a formatted way.
166
- *
167
- * Works like `console.dirxml()`. In Node.js, behaves the same as `dir()`.
168
- *
169
- * @param data - The data to display.
170
- */
171
- dirxml(...data: unknown[]): this;
172
- /**
173
- * Logs a completion message with a success symbol (alias for `success()`).
174
- *
175
- * Provides semantic clarity when marking something as "done". Does NOT
176
- * automatically clear the current line - call `clearLine()` first if needed
177
- * after using `progress()`.
178
- */
179
- done(...args: unknown[]): this;
180
- /**
181
- * Logs an error message to stderr.
182
- *
183
- * Automatically applies current indentation. All arguments are formatted and
184
- * logged like `console.error()`.
185
- */
186
- error(...args: unknown[]): this;
187
- /**
188
- * Logs a newline to stderr only if the last line wasn't already blank.
189
- *
190
- * Prevents multiple consecutive blank lines. Useful for adding spacing
191
- * between sections without creating excessive whitespace.
192
- */
193
- errorNewline(): this;
194
- /**
195
- * Logs a failure message with a red colored fail symbol.
196
- *
197
- * Automatically prefixes the message with `LOG_SYMBOLS.fail` (red ✖). Always
198
- * outputs to stderr. If the message starts with an existing symbol, it will
199
- * be stripped and replaced.
200
- */
201
- fail(...args: unknown[]): this;
202
- /**
203
- * Starts a new indented log group.
204
- *
205
- * If a label is provided, it's logged before increasing indentation. Groups
206
- * can be nested. Each group increases indentation by the `kGroupIndentWidth`
207
- * (default 2 spaces). Call `groupEnd()` to close.
208
- *
209
- * @param label - Optional label to display before the group.
210
- */
211
- group(...label: unknown[]): this;
212
- /**
213
- * Starts a new collapsed log group (alias for `group()`).
214
- *
215
- * In browser consoles, this creates a collapsed group. In Node.js, it behaves
216
- * identically to `group()`.
217
- *
218
- * @param label - Optional label to display before the group.
219
- */
220
- groupCollapsed(...label: unknown[]): this;
221
- /**
222
- * Ends the current log group and decreases indentation.
223
- *
224
- * Must be called once for each `group()` or `groupCollapsed()` call to
225
- * properly close the group and restore indentation.
226
- */
227
- groupEnd(): this;
228
- /**
229
- * Increases the indentation level by adding spaces to the prefix.
230
- *
231
- * When called on the main logger, affects both stderr and stdout indentation.
232
- * When called on a stream-bound logger (`.stderr` or `.stdout`), affects only
233
- * that stream's indentation. Maximum indentation is 1000 spaces.
234
- *
235
- * @default 2
236
- */
237
- indent(spaces?: number): this;
238
- /**
239
- * Logs an informational message with a blue colored info symbol.
240
- *
241
- * Automatically prefixes the message with `LOG_SYMBOLS.info` (blue ℹ). Always
242
- * outputs to stderr. If the message starts with an existing symbol, it will
243
- * be stripped and replaced.
244
- */
245
- info(...args: unknown[]): this;
246
- /**
247
- * Logs a message to stdout.
248
- *
249
- * Automatically applies current indentation. All arguments are formatted and
250
- * logged like `console.log()`. This is the primary method for standard
251
- * output.
252
- */
253
- log(...args: unknown[]): this;
254
- /**
255
- * Logs a newline to stdout only if the last line wasn't already blank.
256
- *
257
- * Prevents multiple consecutive blank lines. Useful for adding spacing
258
- * between sections without creating excessive whitespace.
259
- */
260
- logNewline(): this;
261
- /**
262
- * Shows a progress indicator that can be cleared with `clearLine()`.
263
- *
264
- * Displays a simple status message with a '∴' prefix. Does not include
265
- * animation or spinner. Intended to be cleared once the operation completes.
266
- * The output stream (stderr or stdout) depends on whether the logger is
267
- * stream-bound.
268
- *
269
- * @param text - The progress message to display.
270
- */
271
- progress(text: string): this;
272
- /**
273
- * Resets all indentation to zero.
274
- *
275
- * When called on the main logger, resets both stderr and stdout indentation.
276
- * When called on a stream-bound logger (`.stderr` or `.stdout`), resets only
277
- * that stream's indentation.
278
- */
279
- resetIndent(): this;
280
- /**
281
- * Logs a skip message with a cyan colored skip symbol.
282
- *
283
- * Automatically prefixes the message with `LOG_SYMBOLS.skip` (cyan ↻). Always
284
- * outputs to stderr. If the message starts with an existing symbol, it will
285
- * be stripped and replaced.
286
- */
287
- skip(...args: unknown[]): this;
288
- /**
289
- * Logs a main step message with a cyan arrow symbol and blank line before it.
290
- *
291
- * Automatically prefixes the message with `LOG_SYMBOLS.step` (cyan →) and
292
- * adds a blank line before the message unless the last line was already
293
- * blank. Useful for marking major steps in a process with clear visual
294
- * separation. Always outputs to stdout. If the message starts with an
295
- * existing symbol, it will be stripped and replaced.
296
- *
297
- * @param msg - The step message to log.
298
- * @param extras - Additional arguments to log.
299
- */
300
- step(msg: string, ...extras: unknown[]): this;
301
- /**
302
- * Logs an indented substep message (stateless).
303
- *
304
- * Adds a 2-space indent to the message without affecting the logger's
305
- * indentation state. Useful for showing sub-items under a main step.
306
- *
307
- * @param msg - The substep message to log.
308
- * @param extras - Additional arguments to log.
309
- */
310
- substep(msg: string, ...extras: unknown[]): this;
311
- /**
312
- * Logs a success message with a green colored success symbol.
313
- *
314
- * Automatically prefixes the message with `LOG_SYMBOLS.success` (green ✔).
315
- * Always outputs to stderr. If the message starts with an existing symbol, it
316
- * will be stripped and replaced.
317
- */
318
- success(...args: unknown[]): this;
319
- /**
320
- * Displays data in a table format.
321
- *
322
- * Works like `console.table()`. Accepts arrays of objects or objects with
323
- * nested objects. Optionally specify which properties to include in the
324
- * table.
325
- *
326
- * @param tabularData - The data to display as a table.
327
- * @param properties - Optional array of property names to include.
328
- */
329
- table(tabularData: unknown, properties?: readonly string[] | undefined): this;
330
- /**
331
- * Starts a timer for measuring elapsed time.
332
- *
333
- * Creates a timer with the given label. Use `timeEnd()` with the same label
334
- * to stop the timer and log the elapsed time, or use `timeLog()` to check the
335
- * time without stopping the timer.
336
- *
337
- * @default 'default'
338
- *
339
- * @param label - Optional label for the timer.
340
- */
341
- time(label?: string | undefined): this;
342
- /**
343
- * Ends a timer and logs the elapsed time.
344
- *
345
- * Logs the duration since `console.time()` or `logger.time()` was called with
346
- * the same label. The timer is stopped and removed.
347
- *
348
- * @default 'default'
349
- *
350
- * @param label - Optional label for the timer.
351
- */
352
- timeEnd(label?: string | undefined): this;
353
- /**
354
- * Logs the current value of a timer without stopping it.
355
- *
356
- * Logs the duration since `console.time()` was called with the same label,
357
- * but keeps the timer running. Can include additional data to log alongside
358
- * the time.
359
- *
360
- * @default 'default'
361
- *
362
- * @param label - Optional label for the timer.
363
- * @param data - Additional data to log with the time.
364
- */
365
- timeLog(label?: string | undefined, ...data: unknown[]): this;
366
- /**
367
- * Logs a stack trace to the console.
368
- *
369
- * Works like `console.trace()`. Shows the call stack leading to where this
370
- * method was called. Useful for debugging.
371
- *
372
- * @param message - Optional message to display with the trace.
373
- * @param args - Additional arguments to log.
374
- */
375
- trace(message?: unknown | undefined, ...args: unknown[]): this;
376
- /**
377
- * Logs a warning message with a yellow colored warning symbol.
378
- *
379
- * Automatically prefixes the message with `LOG_SYMBOLS.warn` (yellow ⚠).
380
- * Always outputs to stderr. If the message starts with an existing symbol, it
381
- * will be stripped and replaced.
382
- */
383
- warn(...args: unknown[]): this;
384
- /**
385
- * Writes text directly to stdout without a newline or indentation.
386
- *
387
- * Useful for progress indicators or custom formatting where you need
388
- * low-level control. Does not apply any indentation or formatting.
389
- *
390
- * @param text - The text to write.
391
- */
392
- write(text: string): this;
393
- }
394
- /**
395
- * Get the default logger instance. Lazily creates the logger to avoid circular
396
- * dependencies during module initialization. Reuses the same instance across
397
- * calls.
398
- *
399
- * Construction is lazy so that importing this module during early Node.js
400
- * bootstrap doesn't try to resolve `node:console` before stdout is ready
401
- * (mirrors the lazy `Console` init inside `Logger` itself).
402
- *
403
- * @returns Shared default logger instance
2
+ * @file Shared-default `Logger` singleton. One process-wide instance,
3
+ * constructed lazily on first call so importing the module during early
4
+ * bootstrap doesn't try to resolve `node:console` before stdout is ready
5
+ * (Node side) or touch `globalThis.console` during a service-worker cold
6
+ * start (browser side). The `Logger` class itself comes from `./logger`,
7
+ * which the package.json `'browser'` condition routes to the right
8
+ * implementation per platform.
404
9
  */
10
+ import { Logger } from './logger';
405
11
  export declare function getDefaultLogger(): Logger;