@storm-software/config-tools 1.148.2 → 1.148.4

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 (106) hide show
  1. package/README.md +1 -1
  2. package/dist/config-file/get-config-file.cjs +66 -22
  3. package/dist/config-file/get-config-file.js +65 -21
  4. package/dist/config-file/index.cjs +1 -27
  5. package/dist/config-file/index.js +1 -27
  6. package/dist/create-storm-config.cjs +68 -26
  7. package/dist/create-storm-config.js +67 -25
  8. package/dist/env/get-env.cjs +152 -9
  9. package/dist/env/get-env.js +151 -8
  10. package/dist/env/index.cjs +2 -20
  11. package/dist/env/index.js +2 -20
  12. package/dist/env/set-env.cjs +259 -8
  13. package/dist/env/set-env.js +258 -7
  14. package/dist/get-config.cjs +9 -25
  15. package/dist/get-config.js +9 -25
  16. package/dist/index.cjs +7 -171
  17. package/dist/index.js +7 -171
  18. package/dist/logger/chalk.cjs +30 -4
  19. package/dist/logger/chalk.js +29 -3
  20. package/dist/logger/console-icons.cjs +15 -5
  21. package/dist/logger/console-icons.js +15 -5
  22. package/dist/logger/console.cjs +126 -38
  23. package/dist/logger/console.js +112 -24
  24. package/dist/logger/create-logger.cjs +31 -16
  25. package/dist/logger/create-logger.js +30 -15
  26. package/dist/logger/format-timestamp.cjs +5 -3
  27. package/dist/logger/format-timestamp.js +5 -3
  28. package/dist/logger/get-log-level.cjs +56 -6
  29. package/dist/logger/get-log-level.js +56 -6
  30. package/dist/logger/index.cjs +7 -62
  31. package/dist/logger/index.js +7 -62
  32. package/dist/logger/is-unicode-supported.cjs +16 -4
  33. package/dist/logger/is-unicode-supported.js +15 -3
  34. package/dist/types.cjs +24 -6
  35. package/dist/types.js +22 -4
  36. package/dist/utilities/apply-workspace-tokens.cjs +55 -9
  37. package/dist/utilities/apply-workspace-tokens.js +54 -8
  38. package/dist/utilities/correct-paths.cjs +242 -33
  39. package/dist/utilities/correct-paths.js +225 -16
  40. package/dist/utilities/file-path-utils.cjs +18 -5
  41. package/dist/utilities/file-path-utils.js +17 -4
  42. package/dist/utilities/find-up.cjs +22 -4
  43. package/dist/utilities/find-up.js +21 -3
  44. package/dist/utilities/find-workspace-root.cjs +64 -7
  45. package/dist/utilities/find-workspace-root.js +63 -6
  46. package/dist/utilities/get-default-config.cjs +79 -8
  47. package/dist/utilities/get-default-config.js +79 -8
  48. package/dist/utilities/index.cjs +7 -85
  49. package/dist/utilities/index.js +7 -85
  50. package/dist/utilities/process-handler.cjs +35 -17
  51. package/dist/utilities/process-handler.js +35 -17
  52. package/dist/utilities/run.cjs +34 -6
  53. package/dist/utilities/run.js +33 -5
  54. package/package.json +1 -1
  55. package/dist/chunk-2AVLCXLT.js +0 -0
  56. package/dist/chunk-2IKEUEGY.cjs +0 -94
  57. package/dist/chunk-2ZXJS2DW.js +0 -49
  58. package/dist/chunk-3557WSPY.js +0 -168
  59. package/dist/chunk-3NWKPYIG.cjs +0 -68
  60. package/dist/chunk-4DLP6LZY.cjs +0 -65
  61. package/dist/chunk-65SWKEHV.cjs +0 -1
  62. package/dist/chunk-6OM23J4N.js +0 -65
  63. package/dist/chunk-6T3V5XJK.js +0 -180
  64. package/dist/chunk-7CYF3NP3.cjs +0 -19
  65. package/dist/chunk-7NSHGJWY.cjs +0 -12
  66. package/dist/chunk-7PV6L7I7.cjs +0 -1
  67. package/dist/chunk-B7WWBK5Z.cjs +0 -93
  68. package/dist/chunk-BHZFTVXN.js +0 -42
  69. package/dist/chunk-C3W5DCMU.js +0 -19
  70. package/dist/chunk-DD3HX2NX.cjs +0 -1
  71. package/dist/chunk-GKI43HTL.cjs +0 -44
  72. package/dist/chunk-GZFXEQPB.js +0 -94
  73. package/dist/chunk-HESFC24Z.cjs +0 -245
  74. package/dist/chunk-HI33NNPB.js +0 -68
  75. package/dist/chunk-HSCCBYAV.js +0 -25
  76. package/dist/chunk-IRCFHYKZ.cjs +0 -28
  77. package/dist/chunk-IUT7Y2UY.js +0 -26
  78. package/dist/chunk-IWD6YQKX.cjs +0 -1
  79. package/dist/chunk-J2TOMCZU.cjs +0 -168
  80. package/dist/chunk-JHJGK3T7.js +0 -272
  81. package/dist/chunk-KNLWLA7O.cjs +0 -75
  82. package/dist/chunk-L6UNTUC4.js +0 -0
  83. package/dist/chunk-LOSUA6RB.js +0 -79
  84. package/dist/chunk-M7ASNATT.js +0 -142
  85. package/dist/chunk-MLUBD3PU.js +0 -245
  86. package/dist/chunk-NJVL3GF4.js +0 -0
  87. package/dist/chunk-OIEEXHKO.js +0 -75
  88. package/dist/chunk-POXTJ6GF.js +0 -28
  89. package/dist/chunk-PR7RQHRE.js +0 -12
  90. package/dist/chunk-QBS3OCHH.js +0 -22
  91. package/dist/chunk-QNYJXMP3.cjs +0 -79
  92. package/dist/chunk-RRKB32OH.js +0 -0
  93. package/dist/chunk-RVM5N5ZI.cjs +0 -22
  94. package/dist/chunk-SLGVSUEV.cjs +0 -36
  95. package/dist/chunk-SVQE7WVB.cjs +0 -180
  96. package/dist/chunk-SWX2MJHI.cjs +0 -28
  97. package/dist/chunk-TCTVN2ED.js +0 -44
  98. package/dist/chunk-U34AT42J.cjs +0 -49
  99. package/dist/chunk-ULZULP7Q.cjs +0 -142
  100. package/dist/chunk-XAJB3BSF.cjs +0 -25
  101. package/dist/chunk-XDBACKKN.cjs +0 -42
  102. package/dist/chunk-XQPQRRG3.js +0 -28
  103. package/dist/chunk-XY2LDOQ4.cjs +0 -26
  104. package/dist/chunk-XZ2SIQVM.js +0 -93
  105. package/dist/chunk-YBGTC6FM.cjs +0 -272
  106. package/dist/chunk-ZA4IO7YJ.js +0 -36
@@ -1,7 +1,33 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var _chunkSLGVSUEVcjs = require('../chunk-SLGVSUEV.cjs');
4
- require('../chunk-USNT2KNT.cjs');
3
+ var _chunkUSNT2KNTcjs = require('../chunk-USNT2KNT.cjs');
4
+ var _chalk2 = require('chalk'); var _chalk3 = _interopRequireDefault(_chalk2);
5
+ const chalkDefault = {
6
+ hex: /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (_) => (message) => message, "hex"),
7
+ bgHex: /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (_) => ({
8
+ whiteBright: /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (message) => message, "whiteBright")
9
+ }), "bgHex"),
10
+ whiteBright: /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (message) => message, "whiteBright"),
11
+ gray: /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (message) => message, "gray"),
12
+ bold: {
13
+ hex: /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (_) => (message) => message, "hex"),
14
+ bgHex: /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (_) => ({
15
+ whiteBright: /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (message) => message, "whiteBright")
16
+ }), "bgHex"),
17
+ whiteBright: /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (message) => message, "whiteBright")
18
+ },
19
+ dim: {
20
+ hex: /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (_) => (message) => message, "hex"),
21
+ gray: /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (message) => message, "gray")
22
+ }
23
+ };
24
+ const getChalk = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, () => {
25
+ let _chalk = _chalk3.default;
26
+ if (!_optionalChain([_chalk, 'optionalAccess', _2 => _2.hex]) || !_optionalChain([_chalk, 'optionalAccess', _3 => _3.bold, 'optionalAccess', _4 => _4.hex]) || !_optionalChain([_chalk, 'optionalAccess', _5 => _5.bgHex]) || !_optionalChain([_chalk, 'optionalAccess', _6 => _6.whiteBright])) {
27
+ _chalk = chalkDefault;
28
+ }
29
+ return _chalk;
30
+ }, "getChalk");
5
31
 
6
32
 
7
- exports.getChalk = _chunkSLGVSUEVcjs.getChalk;
33
+ exports.getChalk = getChalk;
@@ -1,7 +1,33 @@
1
1
  import {
2
- getChalk
3
- } from "../chunk-ZA4IO7YJ.js";
4
- import "../chunk-SHUYVCID.js";
2
+ __name
3
+ } from "../chunk-SHUYVCID.js";
4
+ import chalk from "chalk";
5
+ const chalkDefault = {
6
+ hex: /* @__PURE__ */ __name((_) => (message) => message, "hex"),
7
+ bgHex: /* @__PURE__ */ __name((_) => ({
8
+ whiteBright: /* @__PURE__ */ __name((message) => message, "whiteBright")
9
+ }), "bgHex"),
10
+ whiteBright: /* @__PURE__ */ __name((message) => message, "whiteBright"),
11
+ gray: /* @__PURE__ */ __name((message) => message, "gray"),
12
+ bold: {
13
+ hex: /* @__PURE__ */ __name((_) => (message) => message, "hex"),
14
+ bgHex: /* @__PURE__ */ __name((_) => ({
15
+ whiteBright: /* @__PURE__ */ __name((message) => message, "whiteBright")
16
+ }), "bgHex"),
17
+ whiteBright: /* @__PURE__ */ __name((message) => message, "whiteBright")
18
+ },
19
+ dim: {
20
+ hex: /* @__PURE__ */ __name((_) => (message) => message, "hex"),
21
+ gray: /* @__PURE__ */ __name((message) => message, "gray")
22
+ }
23
+ };
24
+ const getChalk = /* @__PURE__ */ __name(() => {
25
+ let _chalk = chalk;
26
+ if (!_chalk?.hex || !_chalk?.bold?.hex || !_chalk?.bgHex || !_chalk?.whiteBright) {
27
+ _chalk = chalkDefault;
28
+ }
29
+ return _chalk;
30
+ }, "getChalk");
5
31
  export {
6
32
  getChalk
7
33
  };
@@ -1,9 +1,19 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkXY2LDOQ4cjs = require('../chunk-XY2LDOQ4.cjs');
4
- require('../chunk-RVM5N5ZI.cjs');
5
- require('../chunk-IRCFHYKZ.cjs');
6
- require('../chunk-USNT2KNT.cjs');
3
+ var _chunkUSNT2KNTcjs = require('../chunk-USNT2KNT.cjs');
4
+ var _types = require('../types');
5
+ var _isunicodesupported = require('./is-unicode-supported');
6
+ const useIcon = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (c, fallback) => _isunicodesupported.isUnicodeSupported.call(void 0, ) ? c : fallback, "useIcon");
7
+ const CONSOLE_ICONS = {
8
+ [_types.LogLevelLabel.ERROR]: useIcon("\u2718", "\xD7"),
9
+ [_types.LogLevelLabel.FATAL]: useIcon("\u{1F480}", "\xD7"),
10
+ [_types.LogLevelLabel.WARN]: useIcon("\u26A0", "\u203C"),
11
+ [_types.LogLevelLabel.INFO]: useIcon("\u2139", "i"),
12
+ [_types.LogLevelLabel.SUCCESS]: useIcon("\u2714", "\u221A"),
13
+ [_types.LogLevelLabel.DEBUG]: useIcon("\u{1F6E0}", "D"),
14
+ [_types.LogLevelLabel.TRACE]: useIcon("\u{1F6E0}", "T"),
15
+ [_types.LogLevelLabel.ALL]: useIcon("\u2709", "\u2192")
16
+ };
7
17
 
8
18
 
9
- exports.CONSOLE_ICONS = _chunkXY2LDOQ4cjs.CONSOLE_ICONS;
19
+ exports.CONSOLE_ICONS = CONSOLE_ICONS;
@@ -1,9 +1,19 @@
1
1
  import {
2
- CONSOLE_ICONS
3
- } from "../chunk-IUT7Y2UY.js";
4
- import "../chunk-QBS3OCHH.js";
5
- import "../chunk-POXTJ6GF.js";
6
- import "../chunk-SHUYVCID.js";
2
+ __name
3
+ } from "../chunk-SHUYVCID.js";
4
+ import { LogLevelLabel } from "../types";
5
+ import { isUnicodeSupported } from "./is-unicode-supported";
6
+ const useIcon = /* @__PURE__ */ __name((c, fallback) => isUnicodeSupported() ? c : fallback, "useIcon");
7
+ const CONSOLE_ICONS = {
8
+ [LogLevelLabel.ERROR]: useIcon("\u2718", "\xD7"),
9
+ [LogLevelLabel.FATAL]: useIcon("\u{1F480}", "\xD7"),
10
+ [LogLevelLabel.WARN]: useIcon("\u26A0", "\u203C"),
11
+ [LogLevelLabel.INFO]: useIcon("\u2139", "i"),
12
+ [LogLevelLabel.SUCCESS]: useIcon("\u2714", "\u221A"),
13
+ [LogLevelLabel.DEBUG]: useIcon("\u{1F6E0}", "D"),
14
+ [LogLevelLabel.TRACE]: useIcon("\u{1F6E0}", "T"),
15
+ [LogLevelLabel.ALL]: useIcon("\u2709", "\u2192")
16
+ };
7
17
  export {
8
18
  CONSOLE_ICONS
9
19
  };
@@ -1,38 +1,126 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
- var _chunkULZULP7Qcjs = require('../chunk-ULZULP7Q.cjs');
14
- require('../chunk-SLGVSUEV.cjs');
15
- require('../chunk-XY2LDOQ4.cjs');
16
- require('../chunk-RVM5N5ZI.cjs');
17
- require('../chunk-7NSHGJWY.cjs');
18
- require('../chunk-2IKEUEGY.cjs');
19
- require('../chunk-KNLWLA7O.cjs');
20
- require('../chunk-SWX2MJHI.cjs');
21
- require('../chunk-3NWKPYIG.cjs');
22
- require('../chunk-SVQE7WVB.cjs');
23
- require('../chunk-HESFC24Z.cjs');
24
- require('../chunk-IRCFHYKZ.cjs');
25
- require('../chunk-USNT2KNT.cjs');
26
-
27
-
28
-
29
-
30
-
31
-
32
-
33
-
34
-
35
-
36
-
37
-
38
- exports.formatLogMessage = _chunkULZULP7Qcjs.formatLogMessage; exports.getLogFn = _chunkULZULP7Qcjs.getLogFn; exports.getStopwatch = _chunkULZULP7Qcjs.getStopwatch; exports.writeDebug = _chunkULZULP7Qcjs.writeDebug; exports.writeError = _chunkULZULP7Qcjs.writeError; exports.writeFatal = _chunkULZULP7Qcjs.writeFatal; exports.writeInfo = _chunkULZULP7Qcjs.writeInfo; exports.writeSuccess = _chunkULZULP7Qcjs.writeSuccess; exports.writeSystem = _chunkULZULP7Qcjs.writeSystem; exports.writeTrace = _chunkULZULP7Qcjs.writeTrace; exports.writeWarning = _chunkULZULP7Qcjs.writeWarning;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
+
3
+ var _chunkUSNT2KNTcjs = require('../chunk-USNT2KNT.cjs');
4
+ var _types = require('../types');
5
+ var _getdefaultconfig = require('../utilities/get-default-config');
6
+ var _chalk2 = require('./chalk');
7
+ var _consoleicons = require('./console-icons');
8
+ var _formattimestamp = require('./format-timestamp');
9
+ var _getloglevel = require('./get-log-level');
10
+ const getLogFn = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (logLevel = _types.LogLevel.INFO, config = {}, _chalk = _chalk2.getChalk.call(void 0, )) => {
11
+ const colors = !_optionalChain([config, 'access', _2 => _2.colors, 'optionalAccess', _3 => _3.dark]) && !_optionalChain([config, 'access', _4 => _4.colors, 'optionalAccess', _5 => _5["base"]]) && !_optionalChain([config, 'access', _6 => _6.colors, 'optionalAccess', _7 => _7["base"], 'optionalAccess', _8 => _8.dark]) ? _getdefaultconfig.DEFAULT_COLOR_CONFIG : _optionalChain([config, 'access', _9 => _9.colors, 'optionalAccess', _10 => _10.dark]) && typeof config.colors.dark === "string" ? config.colors : _optionalChain([config, 'access', _11 => _11.colors, 'optionalAccess', _12 => _12["base"], 'optionalAccess', _13 => _13.dark]) && typeof config.colors["base"].dark === "string" ? config.colors["base"].dark : _optionalChain([config, 'access', _14 => _14.colors, 'optionalAccess', _15 => _15["base"]]) ? _optionalChain([config, 'access', _16 => _16.colors, 'optionalAccess', _17 => _17["base"]]) : _getdefaultconfig.DEFAULT_COLOR_CONFIG;
12
+ const configLogLevel = config.logLevel || process.env.STORM_LOG_LEVEL || _types.LogLevelLabel.INFO;
13
+ if (logLevel > _getloglevel.getLogLevel.call(void 0, configLogLevel) || logLevel <= _types.LogLevel.SILENT || _getloglevel.getLogLevel.call(void 0, configLogLevel) <= _types.LogLevel.SILENT) {
14
+ return (_) => {
15
+ };
16
+ }
17
+ if (typeof logLevel === "number" && _types.LogLevel.FATAL >= logLevel) {
18
+ return (message) => {
19
+ console.error(`
20
+ ${_chalk.gray(_formattimestamp.formatTimestamp.call(void 0, ))} ${_chalk.hex(_nullishCoalesce(colors.fatal, () => ( "#7d1a1a")))(`[${_consoleicons.CONSOLE_ICONS[_types.LogLevelLabel.FATAL]} Fatal]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
21
+ `);
22
+ };
23
+ }
24
+ if (typeof logLevel === "number" && _types.LogLevel.ERROR >= logLevel) {
25
+ return (message) => {
26
+ console.error(`
27
+ ${_chalk.gray(_formattimestamp.formatTimestamp.call(void 0, ))} ${_chalk.hex(_nullishCoalesce(colors.danger, () => ( "#f85149")))(`[${_consoleicons.CONSOLE_ICONS[_types.LogLevelLabel.ERROR]} Error]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
28
+ `);
29
+ };
30
+ }
31
+ if (typeof logLevel === "number" && _types.LogLevel.WARN >= logLevel) {
32
+ return (message) => {
33
+ console.warn(`
34
+ ${_chalk.gray(_formattimestamp.formatTimestamp.call(void 0, ))} ${_chalk.hex(_nullishCoalesce(colors.warning, () => ( "#e3b341")))(`[${_consoleicons.CONSOLE_ICONS[_types.LogLevelLabel.WARN]} Warn]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
35
+ `);
36
+ };
37
+ }
38
+ if (typeof logLevel === "number" && _types.LogLevel.SUCCESS >= logLevel) {
39
+ return (message) => {
40
+ console.info(`
41
+ ${_chalk.gray(_formattimestamp.formatTimestamp.call(void 0, ))} ${_chalk.hex(_nullishCoalesce(colors.success, () => ( "#56d364")))(`[${_consoleicons.CONSOLE_ICONS[_types.LogLevelLabel.SUCCESS]} Success]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
42
+ `);
43
+ };
44
+ }
45
+ if (typeof logLevel === "number" && _types.LogLevel.INFO >= logLevel) {
46
+ return (message) => {
47
+ console.info(`
48
+ ${_chalk.gray(_formattimestamp.formatTimestamp.call(void 0, ))} ${_chalk.hex(_nullishCoalesce(colors.info, () => ( "#58a6ff")))(`[${_consoleicons.CONSOLE_ICONS[_types.LogLevelLabel.INFO]} Info]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
49
+ `);
50
+ };
51
+ }
52
+ if (typeof logLevel === "number" && _types.LogLevel.DEBUG >= logLevel) {
53
+ return (message) => {
54
+ console.debug(`
55
+ ${_chalk.gray(_formattimestamp.formatTimestamp.call(void 0, ))} ${_chalk.hex(_nullishCoalesce(colors.brand, () => ( "#1fb2a6")))(`[${_consoleicons.CONSOLE_ICONS[_types.LogLevelLabel.DEBUG]} Debug]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
56
+ `);
57
+ };
58
+ }
59
+ if (typeof logLevel === "number" && _types.LogLevel.TRACE >= logLevel) {
60
+ return (message) => {
61
+ console.debug(`
62
+ ${_chalk.gray(_formattimestamp.formatTimestamp.call(void 0, ))} ${_chalk.hex(_nullishCoalesce(colors.brand, () => ( "#1fb2a6")))(`[${_consoleicons.CONSOLE_ICONS[_types.LogLevelLabel.TRACE]} Trace]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
63
+ `);
64
+ };
65
+ }
66
+ return (message) => {
67
+ console.log(`
68
+ ${_chalk.gray(_formattimestamp.formatTimestamp.call(void 0, ))} ${_chalk.hex(_nullishCoalesce(colors.brand, () => ( "#1fb2a6")))(`[${_consoleicons.CONSOLE_ICONS[_types.LogLevelLabel.ALL]} System]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
69
+ `);
70
+ };
71
+ }, "getLogFn");
72
+ const writeFatal = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (message, config) => getLogFn(_types.LogLevel.FATAL, config)(message), "writeFatal");
73
+ const writeError = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (message, config) => getLogFn(_types.LogLevel.ERROR, config)(message), "writeError");
74
+ const writeWarning = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (message, config) => getLogFn(_types.LogLevel.WARN, config)(message), "writeWarning");
75
+ const writeInfo = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (message, config) => getLogFn(_types.LogLevel.INFO, config)(message), "writeInfo");
76
+ const writeSuccess = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (message, config) => getLogFn(_types.LogLevel.SUCCESS, config)(message), "writeSuccess");
77
+ const writeDebug = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (message, config) => getLogFn(_types.LogLevel.DEBUG, config)(message), "writeDebug");
78
+ const writeTrace = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (message, config) => getLogFn(_types.LogLevel.TRACE, config)(message), "writeTrace");
79
+ const writeSystem = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (message, config) => getLogFn(_types.LogLevel.ALL, config)(message), "writeSystem");
80
+ const getStopwatch = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (name) => {
81
+ const start = process.hrtime();
82
+ return () => {
83
+ const end = process.hrtime(start);
84
+ console.info(`
85
+ > \u23F1\uFE0F The${name ? ` ${name}` : ""} process took ${Math.round(end[0] * 1e3 + end[1] / 1e6)}ms to complete
86
+
87
+ `);
88
+ };
89
+ }, "getStopwatch");
90
+ const MAX_DEPTH = 4;
91
+ const formatLogMessage = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (message, options = {}, depth = 0) => {
92
+ if (depth > MAX_DEPTH) {
93
+ return "<max depth>";
94
+ }
95
+ const prefix = _nullishCoalesce(options.prefix, () => ( "-"));
96
+ const skip = _nullishCoalesce(options.skip, () => ( []));
97
+ return typeof message === "undefined" || message === null || !message && typeof message !== "boolean" ? "<none>" : typeof message === "string" ? message : Array.isArray(message) ? `
98
+ ${message.map((item, index) => ` ${prefix}> #${index} = ${formatLogMessage(item, {
99
+ prefix: `${prefix}-`,
100
+ skip
101
+ }, depth + 1)}`).join("\n")}` : typeof message === "object" ? `
102
+ ${Object.keys(message).filter((key) => !skip.includes(key)).map((key) => ` ${prefix}> ${key} = ${_isFunction(message[key]) ? "<function>" : typeof message[key] === "object" ? formatLogMessage(message[key], {
103
+ prefix: `${prefix}-`,
104
+ skip
105
+ }, depth + 1) : message[key]}`).join("\n")}` : message;
106
+ }, "formatLogMessage");
107
+ const _isFunction = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (value) => {
108
+ try {
109
+ return value instanceof Function || typeof value === "function" || !!(_optionalChain([value, 'optionalAccess', _18 => _18.constructor]) && _optionalChain([value, 'optionalAccess', _19 => _19.call]) && _optionalChain([value, 'optionalAccess', _20 => _20.apply]));
110
+ } catch (e) {
111
+ return false;
112
+ }
113
+ }, "_isFunction");
114
+
115
+
116
+
117
+
118
+
119
+
120
+
121
+
122
+
123
+
124
+
125
+
126
+ exports.formatLogMessage = formatLogMessage; exports.getLogFn = getLogFn; exports.getStopwatch = getStopwatch; exports.writeDebug = writeDebug; exports.writeError = writeError; exports.writeFatal = writeFatal; exports.writeInfo = writeInfo; exports.writeSuccess = writeSuccess; exports.writeSystem = writeSystem; exports.writeTrace = writeTrace; exports.writeWarning = writeWarning;
@@ -1,28 +1,116 @@
1
1
  import {
2
- formatLogMessage,
3
- getLogFn,
4
- getStopwatch,
5
- writeDebug,
6
- writeError,
7
- writeFatal,
8
- writeInfo,
9
- writeSuccess,
10
- writeSystem,
11
- writeTrace,
12
- writeWarning
13
- } from "../chunk-M7ASNATT.js";
14
- import "../chunk-ZA4IO7YJ.js";
15
- import "../chunk-IUT7Y2UY.js";
16
- import "../chunk-QBS3OCHH.js";
17
- import "../chunk-PR7RQHRE.js";
18
- import "../chunk-GZFXEQPB.js";
19
- import "../chunk-OIEEXHKO.js";
20
- import "../chunk-XQPQRRG3.js";
21
- import "../chunk-HI33NNPB.js";
22
- import "../chunk-6T3V5XJK.js";
23
- import "../chunk-MLUBD3PU.js";
24
- import "../chunk-POXTJ6GF.js";
25
- import "../chunk-SHUYVCID.js";
2
+ __name
3
+ } from "../chunk-SHUYVCID.js";
4
+ import { LogLevel, LogLevelLabel } from "../types";
5
+ import { DEFAULT_COLOR_CONFIG } from "../utilities/get-default-config";
6
+ import { getChalk } from "./chalk";
7
+ import { CONSOLE_ICONS } from "./console-icons";
8
+ import { formatTimestamp } from "./format-timestamp";
9
+ import { getLogLevel } from "./get-log-level";
10
+ const getLogFn = /* @__PURE__ */ __name((logLevel = LogLevel.INFO, config = {}, _chalk = getChalk()) => {
11
+ const colors = !config.colors?.dark && !config.colors?.["base"] && !config.colors?.["base"]?.dark ? DEFAULT_COLOR_CONFIG : config.colors?.dark && typeof config.colors.dark === "string" ? config.colors : config.colors?.["base"]?.dark && typeof config.colors["base"].dark === "string" ? config.colors["base"].dark : config.colors?.["base"] ? config.colors?.["base"] : DEFAULT_COLOR_CONFIG;
12
+ const configLogLevel = config.logLevel || process.env.STORM_LOG_LEVEL || LogLevelLabel.INFO;
13
+ if (logLevel > getLogLevel(configLogLevel) || logLevel <= LogLevel.SILENT || getLogLevel(configLogLevel) <= LogLevel.SILENT) {
14
+ return (_) => {
15
+ };
16
+ }
17
+ if (typeof logLevel === "number" && LogLevel.FATAL >= logLevel) {
18
+ return (message) => {
19
+ console.error(`
20
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.fatal ?? "#7d1a1a")(`[${CONSOLE_ICONS[LogLevelLabel.FATAL]} Fatal]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
21
+ `);
22
+ };
23
+ }
24
+ if (typeof logLevel === "number" && LogLevel.ERROR >= logLevel) {
25
+ return (message) => {
26
+ console.error(`
27
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.danger ?? "#f85149")(`[${CONSOLE_ICONS[LogLevelLabel.ERROR]} Error]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
28
+ `);
29
+ };
30
+ }
31
+ if (typeof logLevel === "number" && LogLevel.WARN >= logLevel) {
32
+ return (message) => {
33
+ console.warn(`
34
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.warning ?? "#e3b341")(`[${CONSOLE_ICONS[LogLevelLabel.WARN]} Warn]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
35
+ `);
36
+ };
37
+ }
38
+ if (typeof logLevel === "number" && LogLevel.SUCCESS >= logLevel) {
39
+ return (message) => {
40
+ console.info(`
41
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.success ?? "#56d364")(`[${CONSOLE_ICONS[LogLevelLabel.SUCCESS]} Success]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
42
+ `);
43
+ };
44
+ }
45
+ if (typeof logLevel === "number" && LogLevel.INFO >= logLevel) {
46
+ return (message) => {
47
+ console.info(`
48
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.info ?? "#58a6ff")(`[${CONSOLE_ICONS[LogLevelLabel.INFO]} Info]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
49
+ `);
50
+ };
51
+ }
52
+ if (typeof logLevel === "number" && LogLevel.DEBUG >= logLevel) {
53
+ return (message) => {
54
+ console.debug(`
55
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.brand ?? "#1fb2a6")(`[${CONSOLE_ICONS[LogLevelLabel.DEBUG]} Debug]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
56
+ `);
57
+ };
58
+ }
59
+ if (typeof logLevel === "number" && LogLevel.TRACE >= logLevel) {
60
+ return (message) => {
61
+ console.debug(`
62
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.brand ?? "#1fb2a6")(`[${CONSOLE_ICONS[LogLevelLabel.TRACE]} Trace]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
63
+ `);
64
+ };
65
+ }
66
+ return (message) => {
67
+ console.log(`
68
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.brand ?? "#1fb2a6")(`[${CONSOLE_ICONS[LogLevelLabel.ALL]} System]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
69
+ `);
70
+ };
71
+ }, "getLogFn");
72
+ const writeFatal = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.FATAL, config)(message), "writeFatal");
73
+ const writeError = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.ERROR, config)(message), "writeError");
74
+ const writeWarning = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.WARN, config)(message), "writeWarning");
75
+ const writeInfo = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.INFO, config)(message), "writeInfo");
76
+ const writeSuccess = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.SUCCESS, config)(message), "writeSuccess");
77
+ const writeDebug = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.DEBUG, config)(message), "writeDebug");
78
+ const writeTrace = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.TRACE, config)(message), "writeTrace");
79
+ const writeSystem = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.ALL, config)(message), "writeSystem");
80
+ const getStopwatch = /* @__PURE__ */ __name((name) => {
81
+ const start = process.hrtime();
82
+ return () => {
83
+ const end = process.hrtime(start);
84
+ console.info(`
85
+ > \u23F1\uFE0F The${name ? ` ${name}` : ""} process took ${Math.round(end[0] * 1e3 + end[1] / 1e6)}ms to complete
86
+
87
+ `);
88
+ };
89
+ }, "getStopwatch");
90
+ const MAX_DEPTH = 4;
91
+ const formatLogMessage = /* @__PURE__ */ __name((message, options = {}, depth = 0) => {
92
+ if (depth > MAX_DEPTH) {
93
+ return "<max depth>";
94
+ }
95
+ const prefix = options.prefix ?? "-";
96
+ const skip = options.skip ?? [];
97
+ return typeof message === "undefined" || message === null || !message && typeof message !== "boolean" ? "<none>" : typeof message === "string" ? message : Array.isArray(message) ? `
98
+ ${message.map((item, index) => ` ${prefix}> #${index} = ${formatLogMessage(item, {
99
+ prefix: `${prefix}-`,
100
+ skip
101
+ }, depth + 1)}`).join("\n")}` : typeof message === "object" ? `
102
+ ${Object.keys(message).filter((key) => !skip.includes(key)).map((key) => ` ${prefix}> ${key} = ${_isFunction(message[key]) ? "<function>" : typeof message[key] === "object" ? formatLogMessage(message[key], {
103
+ prefix: `${prefix}-`,
104
+ skip
105
+ }, depth + 1) : message[key]}`).join("\n")}` : message;
106
+ }, "formatLogMessage");
107
+ const _isFunction = /* @__PURE__ */ __name((value) => {
108
+ try {
109
+ return value instanceof Function || typeof value === "function" || !!(value?.constructor && value?.call && value?.apply);
110
+ } catch (e) {
111
+ return false;
112
+ }
113
+ }, "_isFunction");
26
114
  export {
27
115
  formatLogMessage,
28
116
  getLogFn,
@@ -1,19 +1,34 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2
2
 
3
- var _chunkGKI43HTLcjs = require('../chunk-GKI43HTL.cjs');
4
- require('../chunk-ULZULP7Q.cjs');
5
- require('../chunk-SLGVSUEV.cjs');
6
- require('../chunk-XY2LDOQ4.cjs');
7
- require('../chunk-RVM5N5ZI.cjs');
8
- require('../chunk-7NSHGJWY.cjs');
9
- require('../chunk-2IKEUEGY.cjs');
10
- require('../chunk-KNLWLA7O.cjs');
11
- require('../chunk-SWX2MJHI.cjs');
12
- require('../chunk-3NWKPYIG.cjs');
13
- require('../chunk-SVQE7WVB.cjs');
14
- require('../chunk-HESFC24Z.cjs');
15
- require('../chunk-IRCFHYKZ.cjs');
16
- require('../chunk-USNT2KNT.cjs');
3
+ var _chunkUSNT2KNTcjs = require('../chunk-USNT2KNT.cjs');
4
+ var _chalk = require('chalk'); var _chalk2 = _interopRequireDefault(_chalk);
5
+ var _types = require('../types');
6
+ var _findworkspaceroot = require('../utilities/find-workspace-root');
7
+ var _console = require('./console');
8
+ async function createLogger(config) {
9
+ const workspaceRoot = _findworkspaceroot.findWorkspaceRoot.call(void 0, );
10
+ if (!workspaceRoot) {
11
+ throw new Error("Cannot find workspace root");
12
+ }
13
+ const writeFatal = _console.getLogFn.call(void 0, _types.LogLevel.FATAL, config, _chalk2.default);
14
+ const writeError = _console.getLogFn.call(void 0, _types.LogLevel.ERROR, config, _chalk2.default);
15
+ const writeWarning = _console.getLogFn.call(void 0, _types.LogLevel.WARN, config, _chalk2.default);
16
+ const writeInfo = _console.getLogFn.call(void 0, _types.LogLevel.INFO, config, _chalk2.default);
17
+ const writeSuccess = _console.getLogFn.call(void 0, _types.LogLevel.SUCCESS, config, _chalk2.default);
18
+ const writeDebug = _console.getLogFn.call(void 0, _types.LogLevel.DEBUG, config, _chalk2.default);
19
+ const writeTrace = _console.getLogFn.call(void 0, _types.LogLevel.DEBUG, config, _chalk2.default);
20
+ return {
21
+ fatal: writeFatal,
22
+ error: writeError,
23
+ warning: writeWarning,
24
+ info: writeInfo,
25
+ success: writeSuccess,
26
+ debug: writeDebug,
27
+ trace: writeTrace,
28
+ getStopwatch: _console.getStopwatch
29
+ };
30
+ }
31
+ _chunkUSNT2KNTcjs.__name.call(void 0, createLogger, "createLogger");
17
32
 
18
33
 
19
- exports.createLogger = _chunkGKI43HTLcjs.createLogger;
34
+ exports.createLogger = createLogger;
@@ -1,19 +1,34 @@
1
1
  import {
2
- createLogger
3
- } from "../chunk-TCTVN2ED.js";
4
- import "../chunk-M7ASNATT.js";
5
- import "../chunk-ZA4IO7YJ.js";
6
- import "../chunk-IUT7Y2UY.js";
7
- import "../chunk-QBS3OCHH.js";
8
- import "../chunk-PR7RQHRE.js";
9
- import "../chunk-GZFXEQPB.js";
10
- import "../chunk-OIEEXHKO.js";
11
- import "../chunk-XQPQRRG3.js";
12
- import "../chunk-HI33NNPB.js";
13
- import "../chunk-6T3V5XJK.js";
14
- import "../chunk-MLUBD3PU.js";
15
- import "../chunk-POXTJ6GF.js";
16
- import "../chunk-SHUYVCID.js";
2
+ __name
3
+ } from "../chunk-SHUYVCID.js";
4
+ import chalk from "chalk";
5
+ import { LogLevel } from "../types";
6
+ import { findWorkspaceRoot } from "../utilities/find-workspace-root";
7
+ import { getLogFn, getStopwatch } from "./console";
8
+ async function createLogger(config) {
9
+ const workspaceRoot = findWorkspaceRoot();
10
+ if (!workspaceRoot) {
11
+ throw new Error("Cannot find workspace root");
12
+ }
13
+ const writeFatal = getLogFn(LogLevel.FATAL, config, chalk);
14
+ const writeError = getLogFn(LogLevel.ERROR, config, chalk);
15
+ const writeWarning = getLogFn(LogLevel.WARN, config, chalk);
16
+ const writeInfo = getLogFn(LogLevel.INFO, config, chalk);
17
+ const writeSuccess = getLogFn(LogLevel.SUCCESS, config, chalk);
18
+ const writeDebug = getLogFn(LogLevel.DEBUG, config, chalk);
19
+ const writeTrace = getLogFn(LogLevel.DEBUG, config, chalk);
20
+ return {
21
+ fatal: writeFatal,
22
+ error: writeError,
23
+ warning: writeWarning,
24
+ info: writeInfo,
25
+ success: writeSuccess,
26
+ debug: writeDebug,
27
+ trace: writeTrace,
28
+ getStopwatch
29
+ };
30
+ }
31
+ __name(createLogger, "createLogger");
17
32
  export {
18
33
  createLogger
19
34
  };
@@ -1,7 +1,9 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunk7NSHGJWYcjs = require('../chunk-7NSHGJWY.cjs');
4
- require('../chunk-USNT2KNT.cjs');
3
+ var _chunkUSNT2KNTcjs = require('../chunk-USNT2KNT.cjs');
4
+ const formatTimestamp = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (date = /* @__PURE__ */ new Date()) => {
5
+ return `${date.toLocaleDateString()} ${date.toLocaleTimeString()}`;
6
+ }, "formatTimestamp");
5
7
 
6
8
 
7
- exports.formatTimestamp = _chunk7NSHGJWYcjs.formatTimestamp;
9
+ exports.formatTimestamp = formatTimestamp;
@@ -1,7 +1,9 @@
1
1
  import {
2
- formatTimestamp
3
- } from "../chunk-PR7RQHRE.js";
4
- import "../chunk-SHUYVCID.js";
2
+ __name
3
+ } from "../chunk-SHUYVCID.js";
4
+ const formatTimestamp = /* @__PURE__ */ __name((date = /* @__PURE__ */ new Date()) => {
5
+ return `${date.toLocaleDateString()} ${date.toLocaleTimeString()}`;
6
+ }, "formatTimestamp");
5
7
  export {
6
8
  formatTimestamp
7
9
  };
@@ -1,12 +1,62 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
+ var _chunkUSNT2KNTcjs = require('../chunk-USNT2KNT.cjs');
4
+ var _types = require('../types');
5
+ const getLogLevel = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (label) => {
6
+ switch (label) {
7
+ case "all":
8
+ return _types.LogLevel.ALL;
9
+ case "trace":
10
+ return _types.LogLevel.TRACE;
11
+ case "debug":
12
+ return _types.LogLevel.DEBUG;
13
+ case "info":
14
+ return _types.LogLevel.INFO;
15
+ case "warn":
16
+ return _types.LogLevel.WARN;
17
+ case "error":
18
+ return _types.LogLevel.ERROR;
19
+ case "fatal":
20
+ return _types.LogLevel.FATAL;
21
+ case "silent":
22
+ return _types.LogLevel.SILENT;
23
+ default:
24
+ return _types.LogLevel.INFO;
25
+ }
26
+ }, "getLogLevel");
27
+ const getLogLevelLabel = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (logLevel = _types.LogLevel.INFO) => {
28
+ if (logLevel >= _types.LogLevel.ALL) {
29
+ return _types.LogLevelLabel.ALL;
30
+ }
31
+ if (logLevel >= _types.LogLevel.TRACE) {
32
+ return _types.LogLevelLabel.TRACE;
33
+ }
34
+ if (logLevel >= _types.LogLevel.DEBUG) {
35
+ return _types.LogLevelLabel.DEBUG;
36
+ }
37
+ if (logLevel >= _types.LogLevel.INFO) {
38
+ return _types.LogLevelLabel.INFO;
39
+ }
40
+ if (logLevel >= _types.LogLevel.WARN) {
41
+ return _types.LogLevelLabel.WARN;
42
+ }
43
+ if (logLevel >= _types.LogLevel.ERROR) {
44
+ return _types.LogLevelLabel.ERROR;
45
+ }
46
+ if (logLevel >= _types.LogLevel.FATAL) {
47
+ return _types.LogLevelLabel.FATAL;
48
+ }
49
+ if (logLevel <= _types.LogLevel.SILENT) {
50
+ return _types.LogLevelLabel.SILENT;
51
+ }
52
+ return _types.LogLevelLabel.INFO;
53
+ }, "getLogLevelLabel");
54
+ const isVerbose = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (label = _types.LogLevelLabel.SILENT) => {
55
+ const logLevel = typeof label === "string" ? getLogLevel(label) : label;
56
+ return logLevel >= _types.LogLevel.DEBUG;
57
+ }, "isVerbose");
3
58
 
4
59
 
5
- var _chunk3NWKPYIGcjs = require('../chunk-3NWKPYIG.cjs');
6
- require('../chunk-IRCFHYKZ.cjs');
7
- require('../chunk-USNT2KNT.cjs');
8
60
 
9
61
 
10
-
11
-
12
- exports.getLogLevel = _chunk3NWKPYIGcjs.getLogLevel; exports.getLogLevelLabel = _chunk3NWKPYIGcjs.getLogLevelLabel; exports.isVerbose = _chunk3NWKPYIGcjs.isVerbose;
62
+ exports.getLogLevel = getLogLevel; exports.getLogLevelLabel = getLogLevelLabel; exports.isVerbose = isVerbose;