@sprucelabs/spruce-skill-utils 33.2.0 → 33.3.0

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.
@@ -7,15 +7,17 @@ export declare class Logger implements Log {
7
7
  private readonly colors;
8
8
  private readonly pre;
9
9
  private readonly shouldUseColors;
10
- private history;
11
- private historyLimit;
10
+ private static history;
11
+ private static historyLimit;
12
12
  constructor(prefix?: string | undefined, options?: LogOptions);
13
- startTrackingHistory(limit: number): void;
13
+ static startTrackingHistory(limit: number): void;
14
14
  info(...args: LoggableType[]): string;
15
15
  warn(...args: LoggableType[]): string;
16
16
  error(...args: LoggableType[]): string;
17
17
  buildLog(prefix?: string | undefined, options?: LogOptions): Log;
18
- getHistory(): string[];
18
+ private get history();
19
+ private get historyLimit();
20
+ static getHistory(): string[];
19
21
  private write;
20
22
  private shouldLog;
21
23
  private resolveChalk;
@@ -58,8 +60,6 @@ export type LoggableType = Anything | Anything[] | Record<string, Anything>;
58
60
  export type LogTransport = (...messageParts: string[]) => void;
59
61
  type TransportMap = Record<Level, LogTransport | LogTransport[] | null | undefined>;
60
62
  export interface Log {
61
- startTrackingHistory(limit: number): void;
62
- getHistory(): string[];
63
63
  readonly prefix: string | undefined;
64
64
  info: (...args: LoggableType[]) => string;
65
65
  error: (...args: LoggableType[]) => string;
@@ -2,8 +2,6 @@ import chalk from 'chalk';
2
2
  export class Logger {
3
3
  constructor(prefix = undefined, options) {
4
4
  var _a, _b, _c;
5
- this.history = [];
6
- this.historyLimit = 0;
7
5
  const { colors = {}, log, useColors, transportsByLevel } = options !== null && options !== void 0 ? options : {};
8
6
  const { info = 'yellow', error = 'red' } = colors;
9
7
  this.prefix = prefix;
@@ -19,7 +17,7 @@ export class Logger {
19
17
  const isInteractive = (_c = (_b = (_a = getProcess()) === null || _a === void 0 ? void 0 : _a.stdout) === null || _b === void 0 ? void 0 : _b.isTTY) !== null && _c !== void 0 ? _c : false;
20
18
  this.shouldUseColors = useColors !== false && isInteractive;
21
19
  }
22
- startTrackingHistory(limit) {
20
+ static startTrackingHistory(limit) {
23
21
  this.historyLimit = limit;
24
22
  }
25
23
  info(...args) {
@@ -35,7 +33,13 @@ export class Logger {
35
33
  const childPrefix = this.combinePrefixes(prefix);
36
34
  return new Logger(childPrefix, Object.assign({ log: this.baseLog, useColors: this.useColorsOption, transportsByLevel: this.transports }, options));
37
35
  }
38
- getHistory() {
36
+ get history() {
37
+ return Logger.history;
38
+ }
39
+ get historyLimit() {
40
+ return Logger.historyLimit;
41
+ }
42
+ static getHistory() {
39
43
  return this.history;
40
44
  }
41
45
  write(chalkMethod, rawArgs, level) {
@@ -235,6 +239,8 @@ export class Logger {
235
239
  return true;
236
240
  }
237
241
  }
242
+ Logger.history = [];
243
+ Logger.historyLimit = 0;
238
244
  export default function buildLog(prefix = undefined, options) {
239
245
  return new Logger(prefix, options);
240
246
  }
@@ -7,15 +7,17 @@ export declare class Logger implements Log {
7
7
  private readonly colors;
8
8
  private readonly pre;
9
9
  private readonly shouldUseColors;
10
- private history;
11
- private historyLimit;
10
+ private static history;
11
+ private static historyLimit;
12
12
  constructor(prefix?: string | undefined, options?: LogOptions);
13
- startTrackingHistory(limit: number): void;
13
+ static startTrackingHistory(limit: number): void;
14
14
  info(...args: LoggableType[]): string;
15
15
  warn(...args: LoggableType[]): string;
16
16
  error(...args: LoggableType[]): string;
17
17
  buildLog(prefix?: string | undefined, options?: LogOptions): Log;
18
- getHistory(): string[];
18
+ private get history();
19
+ private get historyLimit();
20
+ static getHistory(): string[];
19
21
  private write;
20
22
  private shouldLog;
21
23
  private resolveChalk;
@@ -58,8 +60,6 @@ export type LoggableType = Anything | Anything[] | Record<string, Anything>;
58
60
  export type LogTransport = (...messageParts: string[]) => void;
59
61
  type TransportMap = Record<Level, LogTransport | LogTransport[] | null | undefined>;
60
62
  export interface Log {
61
- startTrackingHistory(limit: number): void;
62
- getHistory(): string[];
63
63
  readonly prefix: string | undefined;
64
64
  info: (...args: LoggableType[]) => string;
65
65
  error: (...args: LoggableType[]) => string;
@@ -8,8 +8,6 @@ exports.default = buildLog;
8
8
  const chalk_1 = __importDefault(require("chalk"));
9
9
  class Logger {
10
10
  constructor(prefix = undefined, options) {
11
- this.history = [];
12
- this.historyLimit = 0;
13
11
  const { colors = {}, log, useColors, transportsByLevel } = options ?? {};
14
12
  const { info = 'yellow', error = 'red' } = colors;
15
13
  this.prefix = prefix;
@@ -25,7 +23,7 @@ class Logger {
25
23
  const isInteractive = getProcess()?.stdout?.isTTY ?? false;
26
24
  this.shouldUseColors = useColors !== false && isInteractive;
27
25
  }
28
- startTrackingHistory(limit) {
26
+ static startTrackingHistory(limit) {
29
27
  this.historyLimit = limit;
30
28
  }
31
29
  info(...args) {
@@ -46,7 +44,13 @@ class Logger {
46
44
  ...options,
47
45
  });
48
46
  }
49
- getHistory() {
47
+ get history() {
48
+ return Logger.history;
49
+ }
50
+ get historyLimit() {
51
+ return Logger.historyLimit;
52
+ }
53
+ static getHistory() {
50
54
  return this.history;
51
55
  }
52
56
  write(chalkMethod, rawArgs, level) {
@@ -243,6 +247,8 @@ class Logger {
243
247
  }
244
248
  }
245
249
  exports.Logger = Logger;
250
+ Logger.history = [];
251
+ Logger.historyLimit = 0;
246
252
  function buildLog(prefix = undefined, options) {
247
253
  return new Logger(prefix, options);
248
254
  }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "33.2.0",
6
+ "version": "33.3.0",
7
7
  "skill": {
8
8
  "namespace": "skill-utils",
9
9
  "upgradeIgnoreList": [
@@ -19,6 +19,18 @@
19
19
  "types": "./build/index.d.ts",
20
20
  "module": "./build/esm/index.js",
21
21
  "sideEffects": false,
22
+ "exports": {
23
+ ".": {
24
+ "import": {
25
+ "types": "./build/esm/index.d.ts",
26
+ "default": "./build/esm/index.js"
27
+ },
28
+ "require": {
29
+ "types": "./build/index.d.ts",
30
+ "default": "./build/index.js"
31
+ }
32
+ }
33
+ },
22
34
  "license": "MIT",
23
35
  "description": "Loosely coupled classes and functions to make skill development faster! 🏎",
24
36
  "keywords": [