@storm-software/untyped 0.24.53 → 0.24.55

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.
@@ -1,49 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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; }var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
8
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
9
- }) : x)(function(x) {
10
- if (typeof require !== "undefined") return require.apply(this, arguments);
11
- throw Error('Dynamic require of "' + x + '" is not supported');
12
- });
13
- var __esm = (fn, res) => function __init() {
14
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
15
- };
16
- var __commonJS = (cb, mod) => function __require2() {
17
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
18
- };
19
- var __copyProps = (to, from, except, desc) => {
20
- if (from && typeof from === "object" || typeof from === "function") {
21
- for (let key of __getOwnPropNames(from))
22
- if (!__hasOwnProp.call(to, key) && key !== except)
23
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
24
- }
25
- return to;
26
- };
27
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
28
- // If the importer is in node compatibility mode or this is not an ESM
29
- // file that has been converted to a CommonJS file using a Babel-
30
- // compatible transform (i.e. "__esModule" has not been set), then set
31
- // "default" to the CommonJS "module.exports" for node compatibility.
32
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
33
- mod
34
- ));
35
-
36
- // ../../node_modules/.pnpm/tsup@8.4.0_patch_hash=751a554d775c3572381af4e7e5fa22eeda6dd6856012fb1cf521d6806eb2dc74__49fd9f9c3810cfbcde6f76ae97a1dcf0/node_modules/tsup/assets/cjs_shims.js
37
- var init_cjs_shims = __esm({
38
- "../../node_modules/.pnpm/tsup@8.4.0_patch_hash=751a554d775c3572381af4e7e5fa22eeda6dd6856012fb1cf521d6806eb2dc74__49fd9f9c3810cfbcde6f76ae97a1dcf0/node_modules/tsup/assets/cjs_shims.js"() {
39
- }
40
- });
41
-
42
- // src/utilities.ts
43
- init_cjs_shims();
44
-
45
- // ../config-tools/src/utilities/correct-paths.ts
46
- init_cjs_shims();
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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; }// ../config-tools/src/utilities/correct-paths.ts
47
2
  var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
48
3
  function normalizeWindowsPath(input = "") {
49
4
  if (!input) {
@@ -183,8 +138,4 @@ var getOutputFile = (file, extension) => {
183
138
 
184
139
 
185
140
 
186
-
187
-
188
-
189
-
190
- exports.__require = __require; exports.__commonJS = __commonJS; exports.__toESM = __toESM; exports.init_cjs_shims = init_cjs_shims; exports.joinPaths = joinPaths; exports.getOutputFile = getOutputFile;
141
+ exports.joinPaths = joinPaths; exports.getOutputFile = getOutputFile;
@@ -0,0 +1,259 @@
1
+ // ../config-tools/src/logger/console.ts
2
+ import { formatDistanceToNow } from "date-fns/formatDistanceToNow";
3
+
4
+ // ../config-tools/src/types.ts
5
+ var LogLevel = {
6
+ SILENT: 0,
7
+ FATAL: 10,
8
+ ERROR: 20,
9
+ WARN: 30,
10
+ SUCCESS: 35,
11
+ INFO: 40,
12
+ DEBUG: 60,
13
+ TRACE: 70,
14
+ ALL: 100
15
+ };
16
+ var LogLevelLabel = {
17
+ SILENT: "silent",
18
+ FATAL: "fatal",
19
+ ERROR: "error",
20
+ WARN: "warn",
21
+ SUCCESS: "success",
22
+ INFO: "info",
23
+ DEBUG: "debug",
24
+ TRACE: "trace",
25
+ ALL: "all"
26
+ };
27
+
28
+ // ../config-tools/src/utilities/colors.ts
29
+ var DEFAULT_COLOR_CONFIG = {
30
+ light: {
31
+ background: "#fafafa",
32
+ foreground: "#1d1e22",
33
+ brand: "#1fb2a6",
34
+ alternate: "#db2777",
35
+ help: "#5C4EE5",
36
+ success: "#087f5b",
37
+ info: "#0550ae",
38
+ warning: "#e3b341",
39
+ danger: "#D8314A",
40
+ fatal: "#51070f",
41
+ link: "#3fa6ff",
42
+ positive: "#22c55e",
43
+ negative: "#dc2626",
44
+ gradient: ["#1fb2a6", "#db2777", "#5C4EE5"]
45
+ },
46
+ dark: {
47
+ background: "#1d1e22",
48
+ foreground: "#cbd5e1",
49
+ brand: "#2dd4bf",
50
+ alternate: "#db2777",
51
+ help: "#818cf8",
52
+ success: "#10b981",
53
+ info: "#58a6ff",
54
+ warning: "#f3d371",
55
+ danger: "#D8314A",
56
+ fatal: "#a40e26",
57
+ link: "#3fa6ff",
58
+ positive: "#22c55e",
59
+ negative: "#dc2626",
60
+ gradient: ["#1fb2a6", "#db2777", "#818cf8"]
61
+ }
62
+ };
63
+
64
+ // ../config-tools/src/logger/chalk.ts
65
+ import chalk from "chalk";
66
+ var chalkDefault = {
67
+ hex: (_) => (message) => message,
68
+ bgHex: (_) => ({
69
+ whiteBright: (message) => message,
70
+ white: (message) => message
71
+ }),
72
+ white: (message) => message,
73
+ whiteBright: (message) => message,
74
+ gray: (message) => message,
75
+ bold: {
76
+ hex: (_) => (message) => message,
77
+ bgHex: (_) => ({
78
+ whiteBright: (message) => message,
79
+ white: (message) => message
80
+ }),
81
+ whiteBright: (message) => message,
82
+ white: (message) => message
83
+ },
84
+ dim: {
85
+ hex: (_) => (message) => message,
86
+ gray: (message) => message
87
+ }
88
+ };
89
+ var getChalk = () => {
90
+ let _chalk = chalk;
91
+ if (!_chalk?.hex || !_chalk?.bold?.hex || !_chalk?.bgHex || !_chalk?.whiteBright || !_chalk?.white) {
92
+ _chalk = chalkDefault;
93
+ }
94
+ return _chalk;
95
+ };
96
+
97
+ // ../config-tools/src/logger/is-unicode-supported.ts
98
+ function isUnicodeSupported() {
99
+ if (process.platform !== "win32") {
100
+ return process.env.TERM !== "linux";
101
+ }
102
+ return Boolean(process.env.WT_SESSION) || // Windows Terminal
103
+ Boolean(process.env.TERMINUS_SUBLIME) || // Terminus (<0.2.27)
104
+ process.env.ConEmuTask === "{cmd::Cmder}" || // ConEmu and cmder
105
+ process.env.TERM_PROGRAM === "Terminus-Sublime" || process.env.TERM_PROGRAM === "vscode" || process.env.TERM === "xterm-256color" || process.env.TERM === "alacritty" || process.env.TERM === "rxvt-unicode" || process.env.TERM === "rxvt-unicode-256color" || process.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
106
+ }
107
+
108
+ // ../config-tools/src/logger/console-icons.ts
109
+ var useIcon = (c, fallback) => isUnicodeSupported() ? c : fallback;
110
+ var CONSOLE_ICONS = {
111
+ [LogLevelLabel.ERROR]: useIcon("\u2718", "\xD7"),
112
+ [LogLevelLabel.FATAL]: useIcon("\u{1F480}", "\xD7"),
113
+ [LogLevelLabel.WARN]: useIcon("\u26A0", "\u203C"),
114
+ [LogLevelLabel.INFO]: useIcon("\u2139", "i"),
115
+ [LogLevelLabel.SUCCESS]: useIcon("\u2714", "\u221A"),
116
+ [LogLevelLabel.DEBUG]: useIcon("\u{1F6E0}", "D"),
117
+ [LogLevelLabel.TRACE]: useIcon("\u{1F6E0}", "T"),
118
+ [LogLevelLabel.ALL]: useIcon("\u2709", "\u2192")
119
+ };
120
+
121
+ // ../config-tools/src/logger/format-timestamp.ts
122
+ var formatTimestamp = (date = /* @__PURE__ */ new Date()) => {
123
+ return `${date.toLocaleDateString()} ${date.toLocaleTimeString()}`;
124
+ };
125
+
126
+ // ../config-tools/src/logger/get-log-level.ts
127
+ var getLogLevel = (label) => {
128
+ switch (label) {
129
+ case "all":
130
+ return LogLevel.ALL;
131
+ case "trace":
132
+ return LogLevel.TRACE;
133
+ case "debug":
134
+ return LogLevel.DEBUG;
135
+ case "info":
136
+ return LogLevel.INFO;
137
+ case "warn":
138
+ return LogLevel.WARN;
139
+ case "error":
140
+ return LogLevel.ERROR;
141
+ case "fatal":
142
+ return LogLevel.FATAL;
143
+ case "silent":
144
+ return LogLevel.SILENT;
145
+ default:
146
+ return LogLevel.INFO;
147
+ }
148
+ };
149
+
150
+ // ../config-tools/src/logger/console.ts
151
+ var getLogFn = (logLevel = LogLevel.INFO, config = {}, _chalk = getChalk()) => {
152
+ 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;
153
+ const configLogLevel = config.logLevel || process.env.STORM_LOG_LEVEL || LogLevelLabel.INFO;
154
+ if (logLevel > getLogLevel(configLogLevel) || logLevel <= LogLevel.SILENT || getLogLevel(configLogLevel) <= LogLevel.SILENT) {
155
+ return (_) => {
156
+ };
157
+ }
158
+ if (typeof logLevel === "number" && LogLevel.FATAL >= logLevel) {
159
+ return (message) => {
160
+ console.error(
161
+ `
162
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.fatal ?? DEFAULT_COLOR_CONFIG.dark.fatal)(`[${CONSOLE_ICONS[LogLevelLabel.FATAL]} Fatal] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
163
+ `
164
+ );
165
+ };
166
+ }
167
+ if (typeof logLevel === "number" && LogLevel.ERROR >= logLevel) {
168
+ return (message) => {
169
+ console.error(
170
+ `
171
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.danger ?? DEFAULT_COLOR_CONFIG.dark.danger)(`[${CONSOLE_ICONS[LogLevelLabel.ERROR]} Error] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
172
+ `
173
+ );
174
+ };
175
+ }
176
+ if (typeof logLevel === "number" && LogLevel.WARN >= logLevel) {
177
+ return (message) => {
178
+ console.warn(
179
+ `
180
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.warning ?? DEFAULT_COLOR_CONFIG.dark.warning)(`[${CONSOLE_ICONS[LogLevelLabel.WARN]} Warn] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
181
+ `
182
+ );
183
+ };
184
+ }
185
+ if (typeof logLevel === "number" && LogLevel.SUCCESS >= logLevel) {
186
+ return (message) => {
187
+ console.info(
188
+ `
189
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.success ?? DEFAULT_COLOR_CONFIG.dark.success)(`[${CONSOLE_ICONS[LogLevelLabel.SUCCESS]} Success] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
190
+ `
191
+ );
192
+ };
193
+ }
194
+ if (typeof logLevel === "number" && LogLevel.INFO >= logLevel) {
195
+ return (message) => {
196
+ console.info(
197
+ `
198
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.info ?? DEFAULT_COLOR_CONFIG.dark.info)(`[${CONSOLE_ICONS[LogLevelLabel.INFO]} Info] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
199
+ `
200
+ );
201
+ };
202
+ }
203
+ if (typeof logLevel === "number" && LogLevel.DEBUG >= logLevel) {
204
+ return (message) => {
205
+ console.debug(
206
+ `
207
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.info ?? DEFAULT_COLOR_CONFIG.dark.info)(`[${CONSOLE_ICONS[LogLevelLabel.DEBUG]} Debug] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
208
+ `
209
+ );
210
+ };
211
+ }
212
+ if (typeof logLevel === "number" && LogLevel.TRACE >= logLevel) {
213
+ return (message) => {
214
+ console.debug(
215
+ `
216
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.info ?? DEFAULT_COLOR_CONFIG.dark.info)(`[${CONSOLE_ICONS[LogLevelLabel.TRACE]} Trace] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
217
+ `
218
+ );
219
+ };
220
+ }
221
+ return (message) => {
222
+ console.log(
223
+ `
224
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.brand ?? DEFAULT_COLOR_CONFIG.dark.brand)(`[${CONSOLE_ICONS[LogLevelLabel.ALL]} System] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
225
+ `
226
+ );
227
+ };
228
+ };
229
+ var writeError = (message, config) => getLogFn(LogLevel.ERROR, config)(message);
230
+ var writeTrace = (message, config) => getLogFn(LogLevel.TRACE, config)(message);
231
+ var MAX_DEPTH = 4;
232
+ var formatLogMessage = (message, options = {}, depth = 0) => {
233
+ if (depth > MAX_DEPTH) {
234
+ return "<max depth>";
235
+ }
236
+ const prefix = options.prefix ?? "-";
237
+ const skip = options.skip ?? [];
238
+ return typeof message === "undefined" || message === null || !message && typeof message !== "boolean" ? "<none>" : typeof message === "string" ? message : Array.isArray(message) ? `
239
+ ${message.map((item, index) => ` ${prefix}> #${index} = ${formatLogMessage(item, { prefix: `${prefix}-`, skip }, depth + 1)}`).join("\n")}` : typeof message === "object" ? `
240
+ ${Object.keys(message).filter((key) => !skip.includes(key)).map(
241
+ (key) => ` ${prefix}> ${key} = ${_isFunction(message[key]) ? "<function>" : typeof message[key] === "object" ? formatLogMessage(
242
+ message[key],
243
+ { prefix: `${prefix}-`, skip },
244
+ depth + 1
245
+ ) : message[key]}`
246
+ ).join("\n")}` : message;
247
+ };
248
+ var _isFunction = (value) => {
249
+ try {
250
+ return value instanceof Function || typeof value === "function" || !!(value?.constructor && value?.call && value?.apply);
251
+ } catch {
252
+ return false;
253
+ }
254
+ };
255
+
256
+ export {
257
+ writeError,
258
+ writeTrace
259
+ };
@@ -1,14 +1,12 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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
3
 
4
- var _chunkOFYCXEXTcjs = require('./chunk-OFYCXEXT.cjs');
4
+ var _chunkDUNUNFJ4cjs = require('./chunk-DUNUNFJ4.cjs');
5
5
 
6
6
 
7
-
8
- var _chunkN77CW7VOcjs = require('./chunk-N77CW7VO.cjs');
7
+ var _chunk4G3IU22Jcjs = require('./chunk-4G3IU22J.cjs');
9
8
 
10
9
  // src/generators/markdown.ts
11
- _chunkN77CW7VOcjs.init_cjs_shims.call(void 0, );
12
10
  var _promises = require('fs/promises');
13
11
  function generateMarkdown(schema, generatedBy = "@storm-software/untyped") {
14
12
  return `
@@ -46,11 +44,11 @@ function generateMarkdownLevel(schema, title, level) {
46
44
  }
47
45
  function generateMarkdownFile(schema, file, generatedBy = "@storm-software/untyped", config) {
48
46
  try {
49
- const declarations = _chunkN77CW7VOcjs.getOutputFile.call(void 0, file, "md");
50
- _chunkOFYCXEXTcjs.writeTrace.call(void 0, `Writing type markdown file ${declarations}`, config);
47
+ const declarations = _chunk4G3IU22Jcjs.getOutputFile.call(void 0, file, "md");
48
+ _chunkDUNUNFJ4cjs.writeTrace.call(void 0, `Writing type markdown file ${declarations}`, config);
51
49
  return _promises.writeFile.call(void 0, declarations, generateMarkdown(schema, generatedBy));
52
50
  } catch (error) {
53
- _chunkOFYCXEXTcjs.writeError.call(void 0,
51
+ _chunkDUNUNFJ4cjs.writeError.call(void 0,
54
52
  `Error writing markdown file for ${file.name}
55
53
 
56
54
  Error:
@@ -1,14 +1,12 @@
1
1
  import {
2
2
  writeError,
3
3
  writeTrace
4
- } from "./chunk-H3BI2RS6.js";
4
+ } from "./chunk-4U6ARZBV.js";
5
5
  import {
6
- getOutputFile,
7
- init_esm_shims
8
- } from "./chunk-7WW4JGOJ.js";
6
+ getOutputFile
7
+ } from "./chunk-NTN5YK5X.js";
9
8
 
10
9
  // src/generators/json-schema.ts
11
- init_esm_shims();
12
10
  import { writeFile } from "node:fs/promises";
13
11
  function generateJsonSchemaFile(schema, file, config) {
14
12
  try {
File without changes
@@ -1,22 +1,20 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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
3
 
4
- var _chunkOFYCXEXTcjs = require('./chunk-OFYCXEXT.cjs');
4
+ var _chunkDUNUNFJ4cjs = require('./chunk-DUNUNFJ4.cjs');
5
5
 
6
6
 
7
-
8
- var _chunkN77CW7VOcjs = require('./chunk-N77CW7VO.cjs');
7
+ var _chunk4G3IU22Jcjs = require('./chunk-4G3IU22J.cjs');
9
8
 
10
9
  // src/generators/json-schema.ts
11
- _chunkN77CW7VOcjs.init_cjs_shims.call(void 0, );
12
10
  var _promises = require('fs/promises');
13
11
  function generateJsonSchemaFile(schema, file, config) {
14
12
  try {
15
- const jsonSchema = _chunkN77CW7VOcjs.getOutputFile.call(void 0, file, "json");
16
- _chunkOFYCXEXTcjs.writeTrace.call(void 0, `Writing JSON schema file ${jsonSchema}`, config);
13
+ const jsonSchema = _chunk4G3IU22Jcjs.getOutputFile.call(void 0, file, "json");
14
+ _chunkDUNUNFJ4cjs.writeTrace.call(void 0, `Writing JSON schema file ${jsonSchema}`, config);
17
15
  return _promises.writeFile.call(void 0, jsonSchema, JSON.stringify(schema, null, 2));
18
16
  } catch (error) {
19
- _chunkOFYCXEXTcjs.writeError.call(void 0,
17
+ _chunkDUNUNFJ4cjs.writeError.call(void 0,
20
18
  `Error writing JSON schema file for ${file.name}
21
19
 
22
20
  Error:
@@ -0,0 +1,259 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 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; }// ../config-tools/src/logger/console.ts
2
+ var _formatDistanceToNow = require('date-fns/formatDistanceToNow');
3
+
4
+ // ../config-tools/src/types.ts
5
+ var LogLevel = {
6
+ SILENT: 0,
7
+ FATAL: 10,
8
+ ERROR: 20,
9
+ WARN: 30,
10
+ SUCCESS: 35,
11
+ INFO: 40,
12
+ DEBUG: 60,
13
+ TRACE: 70,
14
+ ALL: 100
15
+ };
16
+ var LogLevelLabel = {
17
+ SILENT: "silent",
18
+ FATAL: "fatal",
19
+ ERROR: "error",
20
+ WARN: "warn",
21
+ SUCCESS: "success",
22
+ INFO: "info",
23
+ DEBUG: "debug",
24
+ TRACE: "trace",
25
+ ALL: "all"
26
+ };
27
+
28
+ // ../config-tools/src/utilities/colors.ts
29
+ var DEFAULT_COLOR_CONFIG = {
30
+ light: {
31
+ background: "#fafafa",
32
+ foreground: "#1d1e22",
33
+ brand: "#1fb2a6",
34
+ alternate: "#db2777",
35
+ help: "#5C4EE5",
36
+ success: "#087f5b",
37
+ info: "#0550ae",
38
+ warning: "#e3b341",
39
+ danger: "#D8314A",
40
+ fatal: "#51070f",
41
+ link: "#3fa6ff",
42
+ positive: "#22c55e",
43
+ negative: "#dc2626",
44
+ gradient: ["#1fb2a6", "#db2777", "#5C4EE5"]
45
+ },
46
+ dark: {
47
+ background: "#1d1e22",
48
+ foreground: "#cbd5e1",
49
+ brand: "#2dd4bf",
50
+ alternate: "#db2777",
51
+ help: "#818cf8",
52
+ success: "#10b981",
53
+ info: "#58a6ff",
54
+ warning: "#f3d371",
55
+ danger: "#D8314A",
56
+ fatal: "#a40e26",
57
+ link: "#3fa6ff",
58
+ positive: "#22c55e",
59
+ negative: "#dc2626",
60
+ gradient: ["#1fb2a6", "#db2777", "#818cf8"]
61
+ }
62
+ };
63
+
64
+ // ../config-tools/src/logger/chalk.ts
65
+ var _chalk2 = require('chalk'); var _chalk3 = _interopRequireDefault(_chalk2);
66
+ var chalkDefault = {
67
+ hex: (_) => (message) => message,
68
+ bgHex: (_) => ({
69
+ whiteBright: (message) => message,
70
+ white: (message) => message
71
+ }),
72
+ white: (message) => message,
73
+ whiteBright: (message) => message,
74
+ gray: (message) => message,
75
+ bold: {
76
+ hex: (_) => (message) => message,
77
+ bgHex: (_) => ({
78
+ whiteBright: (message) => message,
79
+ white: (message) => message
80
+ }),
81
+ whiteBright: (message) => message,
82
+ white: (message) => message
83
+ },
84
+ dim: {
85
+ hex: (_) => (message) => message,
86
+ gray: (message) => message
87
+ }
88
+ };
89
+ var getChalk = () => {
90
+ let _chalk = _chalk3.default;
91
+ 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]) || !_optionalChain([_chalk, 'optionalAccess', _7 => _7.white])) {
92
+ _chalk = chalkDefault;
93
+ }
94
+ return _chalk;
95
+ };
96
+
97
+ // ../config-tools/src/logger/is-unicode-supported.ts
98
+ function isUnicodeSupported() {
99
+ if (process.platform !== "win32") {
100
+ return process.env.TERM !== "linux";
101
+ }
102
+ return Boolean(process.env.WT_SESSION) || // Windows Terminal
103
+ Boolean(process.env.TERMINUS_SUBLIME) || // Terminus (<0.2.27)
104
+ process.env.ConEmuTask === "{cmd::Cmder}" || // ConEmu and cmder
105
+ process.env.TERM_PROGRAM === "Terminus-Sublime" || process.env.TERM_PROGRAM === "vscode" || process.env.TERM === "xterm-256color" || process.env.TERM === "alacritty" || process.env.TERM === "rxvt-unicode" || process.env.TERM === "rxvt-unicode-256color" || process.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
106
+ }
107
+
108
+ // ../config-tools/src/logger/console-icons.ts
109
+ var useIcon = (c, fallback) => isUnicodeSupported() ? c : fallback;
110
+ var CONSOLE_ICONS = {
111
+ [LogLevelLabel.ERROR]: useIcon("\u2718", "\xD7"),
112
+ [LogLevelLabel.FATAL]: useIcon("\u{1F480}", "\xD7"),
113
+ [LogLevelLabel.WARN]: useIcon("\u26A0", "\u203C"),
114
+ [LogLevelLabel.INFO]: useIcon("\u2139", "i"),
115
+ [LogLevelLabel.SUCCESS]: useIcon("\u2714", "\u221A"),
116
+ [LogLevelLabel.DEBUG]: useIcon("\u{1F6E0}", "D"),
117
+ [LogLevelLabel.TRACE]: useIcon("\u{1F6E0}", "T"),
118
+ [LogLevelLabel.ALL]: useIcon("\u2709", "\u2192")
119
+ };
120
+
121
+ // ../config-tools/src/logger/format-timestamp.ts
122
+ var formatTimestamp = (date = /* @__PURE__ */ new Date()) => {
123
+ return `${date.toLocaleDateString()} ${date.toLocaleTimeString()}`;
124
+ };
125
+
126
+ // ../config-tools/src/logger/get-log-level.ts
127
+ var getLogLevel = (label) => {
128
+ switch (label) {
129
+ case "all":
130
+ return LogLevel.ALL;
131
+ case "trace":
132
+ return LogLevel.TRACE;
133
+ case "debug":
134
+ return LogLevel.DEBUG;
135
+ case "info":
136
+ return LogLevel.INFO;
137
+ case "warn":
138
+ return LogLevel.WARN;
139
+ case "error":
140
+ return LogLevel.ERROR;
141
+ case "fatal":
142
+ return LogLevel.FATAL;
143
+ case "silent":
144
+ return LogLevel.SILENT;
145
+ default:
146
+ return LogLevel.INFO;
147
+ }
148
+ };
149
+
150
+ // ../config-tools/src/logger/console.ts
151
+ var getLogFn = (logLevel = LogLevel.INFO, config = {}, _chalk = getChalk()) => {
152
+ const colors = !_optionalChain([config, 'access', _8 => _8.colors, 'optionalAccess', _9 => _9.dark]) && !_optionalChain([config, 'access', _10 => _10.colors, 'optionalAccess', _11 => _11["base"]]) && !_optionalChain([config, 'access', _12 => _12.colors, 'optionalAccess', _13 => _13["base"], 'optionalAccess', _14 => _14.dark]) ? DEFAULT_COLOR_CONFIG : _optionalChain([config, 'access', _15 => _15.colors, 'optionalAccess', _16 => _16.dark]) && typeof config.colors.dark === "string" ? config.colors : _optionalChain([config, 'access', _17 => _17.colors, 'optionalAccess', _18 => _18["base"], 'optionalAccess', _19 => _19.dark]) && typeof config.colors["base"].dark === "string" ? config.colors["base"].dark : _optionalChain([config, 'access', _20 => _20.colors, 'optionalAccess', _21 => _21["base"]]) ? _optionalChain([config, 'access', _22 => _22.colors, 'optionalAccess', _23 => _23["base"]]) : DEFAULT_COLOR_CONFIG;
153
+ const configLogLevel = config.logLevel || process.env.STORM_LOG_LEVEL || LogLevelLabel.INFO;
154
+ if (logLevel > getLogLevel(configLogLevel) || logLevel <= LogLevel.SILENT || getLogLevel(configLogLevel) <= LogLevel.SILENT) {
155
+ return (_) => {
156
+ };
157
+ }
158
+ if (typeof logLevel === "number" && LogLevel.FATAL >= logLevel) {
159
+ return (message) => {
160
+ console.error(
161
+ `
162
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(_nullishCoalesce(colors.fatal, () => ( DEFAULT_COLOR_CONFIG.dark.fatal)))(`[${CONSOLE_ICONS[LogLevelLabel.FATAL]} Fatal] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
163
+ `
164
+ );
165
+ };
166
+ }
167
+ if (typeof logLevel === "number" && LogLevel.ERROR >= logLevel) {
168
+ return (message) => {
169
+ console.error(
170
+ `
171
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(_nullishCoalesce(colors.danger, () => ( DEFAULT_COLOR_CONFIG.dark.danger)))(`[${CONSOLE_ICONS[LogLevelLabel.ERROR]} Error] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
172
+ `
173
+ );
174
+ };
175
+ }
176
+ if (typeof logLevel === "number" && LogLevel.WARN >= logLevel) {
177
+ return (message) => {
178
+ console.warn(
179
+ `
180
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(_nullishCoalesce(colors.warning, () => ( DEFAULT_COLOR_CONFIG.dark.warning)))(`[${CONSOLE_ICONS[LogLevelLabel.WARN]} Warn] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
181
+ `
182
+ );
183
+ };
184
+ }
185
+ if (typeof logLevel === "number" && LogLevel.SUCCESS >= logLevel) {
186
+ return (message) => {
187
+ console.info(
188
+ `
189
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(_nullishCoalesce(colors.success, () => ( DEFAULT_COLOR_CONFIG.dark.success)))(`[${CONSOLE_ICONS[LogLevelLabel.SUCCESS]} Success] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
190
+ `
191
+ );
192
+ };
193
+ }
194
+ if (typeof logLevel === "number" && LogLevel.INFO >= logLevel) {
195
+ return (message) => {
196
+ console.info(
197
+ `
198
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(_nullishCoalesce(colors.info, () => ( DEFAULT_COLOR_CONFIG.dark.info)))(`[${CONSOLE_ICONS[LogLevelLabel.INFO]} Info] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
199
+ `
200
+ );
201
+ };
202
+ }
203
+ if (typeof logLevel === "number" && LogLevel.DEBUG >= logLevel) {
204
+ return (message) => {
205
+ console.debug(
206
+ `
207
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(_nullishCoalesce(colors.info, () => ( DEFAULT_COLOR_CONFIG.dark.info)))(`[${CONSOLE_ICONS[LogLevelLabel.DEBUG]} Debug] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
208
+ `
209
+ );
210
+ };
211
+ }
212
+ if (typeof logLevel === "number" && LogLevel.TRACE >= logLevel) {
213
+ return (message) => {
214
+ console.debug(
215
+ `
216
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(_nullishCoalesce(colors.info, () => ( DEFAULT_COLOR_CONFIG.dark.info)))(`[${CONSOLE_ICONS[LogLevelLabel.TRACE]} Trace] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
217
+ `
218
+ );
219
+ };
220
+ }
221
+ return (message) => {
222
+ console.log(
223
+ `
224
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(_nullishCoalesce(colors.brand, () => ( DEFAULT_COLOR_CONFIG.dark.brand)))(`[${CONSOLE_ICONS[LogLevelLabel.ALL]} System] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
225
+ `
226
+ );
227
+ };
228
+ };
229
+ var writeError = (message, config) => getLogFn(LogLevel.ERROR, config)(message);
230
+ var writeTrace = (message, config) => getLogFn(LogLevel.TRACE, config)(message);
231
+ var MAX_DEPTH = 4;
232
+ var formatLogMessage = (message, options = {}, depth = 0) => {
233
+ if (depth > MAX_DEPTH) {
234
+ return "<max depth>";
235
+ }
236
+ const prefix = _nullishCoalesce(options.prefix, () => ( "-"));
237
+ const skip = _nullishCoalesce(options.skip, () => ( []));
238
+ return typeof message === "undefined" || message === null || !message && typeof message !== "boolean" ? "<none>" : typeof message === "string" ? message : Array.isArray(message) ? `
239
+ ${message.map((item, index) => ` ${prefix}> #${index} = ${formatLogMessage(item, { prefix: `${prefix}-`, skip }, depth + 1)}`).join("\n")}` : typeof message === "object" ? `
240
+ ${Object.keys(message).filter((key) => !skip.includes(key)).map(
241
+ (key) => ` ${prefix}> ${key} = ${_isFunction(message[key]) ? "<function>" : typeof message[key] === "object" ? formatLogMessage(
242
+ message[key],
243
+ { prefix: `${prefix}-`, skip },
244
+ depth + 1
245
+ ) : message[key]}`
246
+ ).join("\n")}` : message;
247
+ };
248
+ var _isFunction = (value) => {
249
+ try {
250
+ return value instanceof Function || typeof value === "function" || !!(_optionalChain([value, 'optionalAccess', _24 => _24.constructor]) && _optionalChain([value, 'optionalAccess', _25 => _25.call]) && _optionalChain([value, 'optionalAccess', _26 => _26.apply]));
251
+ } catch (e) {
252
+ return false;
253
+ }
254
+ };
255
+
256
+
257
+
258
+
259
+ exports.writeError = writeError; exports.writeTrace = writeTrace;