@sprucelabs/spruce-skill-utils 31.2.18 → 31.2.19

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.
@@ -13,16 +13,16 @@ const getMaxLogPrefixesLength = () => {
13
13
  : undefined;
14
14
  };
15
15
  export default function buildLog(prefix = undefined, options) {
16
- var _a, _b, _c, _d, _e;
16
+ var _a, _b, _c, _d, _e, _f;
17
17
  const { colors = {}, log, useColors } = options !== null && options !== void 0 ? options : {};
18
18
  const { info = 'yellow', error = 'red' } = colors;
19
- const isInteractive = (_b = (_a = getProcess()) === null || _a === void 0 ? void 0 : _a.stdout) === null || _b === void 0 ? void 0 : _b.isTTY;
19
+ 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
20
  const shouldUseColors = useColors !== false && isInteractive;
21
21
  const pre = prefix ? `${prefix} ::` : undefined;
22
22
  const transports = {
23
- ERROR: (_c = options === null || options === void 0 ? void 0 : options.transportsByLevel) === null || _c === void 0 ? void 0 : _c.ERROR,
24
- INFO: (_d = options === null || options === void 0 ? void 0 : options.transportsByLevel) === null || _d === void 0 ? void 0 : _d.INFO,
25
- WARN: (_e = options === null || options === void 0 ? void 0 : options.transportsByLevel) === null || _e === void 0 ? void 0 : _e.WARN,
23
+ ERROR: (_d = options === null || options === void 0 ? void 0 : options.transportsByLevel) === null || _d === void 0 ? void 0 : _d.ERROR,
24
+ INFO: (_e = options === null || options === void 0 ? void 0 : options.transportsByLevel) === null || _e === void 0 ? void 0 : _e.INFO,
25
+ WARN: (_f = options === null || options === void 0 ? void 0 : options.transportsByLevel) === null || _f === void 0 ? void 0 : _f.WARN,
26
26
  };
27
27
  const logUtil = {
28
28
  prefix,
@@ -104,8 +104,8 @@ export default function buildLog(prefix = undefined, options) {
104
104
  : ((_h = console[logMethod]) !== null && _h !== void 0 ? _h : console.log).bind(console));
105
105
  let message = shouldUseColors === false
106
106
  ? `(${level})${prefix}`
107
- : chalkMethod(...chalkArgs);
108
- if (env.SHOULD_LOG_TIME_DETLAS !== 'false') {
107
+ : chalkMethod === null || chalkMethod === void 0 ? void 0 : chalkMethod(...chalkArgs);
108
+ if (env.SHOULD_LOG_TIME_DELTAS !== 'false') {
109
109
  const now = Date.now();
110
110
  const diff = now - lastLogTimeMs;
111
111
  lastLogTimeMs = now;
@@ -134,14 +134,15 @@ export const stubLog = buildLog('STUB', {
134
134
  useColors: false,
135
135
  });
136
136
  function shouldWrite(maxLogLevel, level) {
137
+ var _a, _b, _c, _d, _e, _f;
137
138
  if (maxLogLevel) {
138
- if (process.env.LOG_LEVEL == 'none') {
139
+ if (((_b = (_a = getProcess()) === null || _a === void 0 ? void 0 : _a.env) === null || _b === void 0 ? void 0 : _b.LOG_LEVEL) == 'none') {
139
140
  return false;
140
141
  }
141
- if (process.env.LOG_LEVEL == 'error' && level !== 'ERROR') {
142
+ if (((_d = (_c = getProcess()) === null || _c === void 0 ? void 0 : _c.env) === null || _d === void 0 ? void 0 : _d.LOG_LEVEL) == 'error' && level !== 'ERROR') {
142
143
  return false;
143
144
  }
144
- if (process.env.LOG_LEVEL == 'warn' && level === 'INFO') {
145
+ if (((_f = (_e = getProcess()) === null || _e === void 0 ? void 0 : _e.env) === null || _f === void 0 ? void 0 : _f.LOG_LEVEL) == 'warn' && level === 'INFO') {
145
146
  return false;
146
147
  }
147
148
  }
@@ -21,7 +21,7 @@ const getMaxLogPrefixesLength = () => {
21
21
  function buildLog(prefix = undefined, options) {
22
22
  const { colors = {}, log, useColors } = options ?? {};
23
23
  const { info = 'yellow', error = 'red' } = colors;
24
- const isInteractive = getProcess()?.stdout?.isTTY;
24
+ const isInteractive = getProcess()?.stdout?.isTTY ?? false;
25
25
  const shouldUseColors = useColors !== false && isInteractive;
26
26
  const pre = prefix ? `${prefix} ::` : undefined;
27
27
  const transports = {
@@ -109,8 +109,8 @@ function buildLog(prefix = undefined, options) {
109
109
  : (console[logMethod] ?? console.log).bind(console));
110
110
  let message = shouldUseColors === false
111
111
  ? `(${level})${prefix}`
112
- : chalkMethod(...chalkArgs);
113
- if (env.SHOULD_LOG_TIME_DETLAS !== 'false') {
112
+ : chalkMethod?.(...chalkArgs);
113
+ if (env.SHOULD_LOG_TIME_DELTAS !== 'false') {
114
114
  const now = Date.now();
115
115
  const diff = now - lastLogTimeMs;
116
116
  lastLogTimeMs = now;
@@ -139,13 +139,13 @@ exports.stubLog = buildLog('STUB', {
139
139
  });
140
140
  function shouldWrite(maxLogLevel, level) {
141
141
  if (maxLogLevel) {
142
- if (process.env.LOG_LEVEL == 'none') {
142
+ if (getProcess()?.env?.LOG_LEVEL == 'none') {
143
143
  return false;
144
144
  }
145
- if (process.env.LOG_LEVEL == 'error' && level !== 'ERROR') {
145
+ if (getProcess()?.env?.LOG_LEVEL == 'error' && level !== 'ERROR') {
146
146
  return false;
147
147
  }
148
- if (process.env.LOG_LEVEL == 'warn' && level === 'INFO') {
148
+ if (getProcess()?.env?.LOG_LEVEL == 'warn' && level === 'INFO') {
149
149
  return false;
150
150
  }
151
151
  }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "31.2.18",
6
+ "version": "31.2.19",
7
7
  "skill": {
8
8
  "namespace": "skill-utils",
9
9
  "upgradeIgnoreList": [