@storm-software/unbuild 0.49.59 → 0.49.65

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,6 +1,6 @@
1
1
  import {
2
2
  writeTrace
3
- } from "./chunk-QX4UI7BX.js";
3
+ } from "./chunk-VKJOPPWJ.js";
4
4
 
5
5
  // src/plugins/tsc.ts
6
6
  import {
@@ -0,0 +1,317 @@
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/types.ts
2
+ var LogLevel = {
3
+ SILENT: 0,
4
+ FATAL: 10,
5
+ ERROR: 20,
6
+ WARN: 30,
7
+ SUCCESS: 35,
8
+ INFO: 40,
9
+ DEBUG: 60,
10
+ TRACE: 70,
11
+ ALL: 100
12
+ };
13
+ var LogLevelLabel = {
14
+ SILENT: "silent",
15
+ FATAL: "fatal",
16
+ ERROR: "error",
17
+ WARN: "warn",
18
+ SUCCESS: "success",
19
+ INFO: "info",
20
+ DEBUG: "debug",
21
+ TRACE: "trace",
22
+ ALL: "all"
23
+ };
24
+
25
+ // ../config-tools/src/logger/get-log-level.ts
26
+ var getLogLevel = (label) => {
27
+ switch (label) {
28
+ case "all":
29
+ return LogLevel.ALL;
30
+ case "trace":
31
+ return LogLevel.TRACE;
32
+ case "debug":
33
+ return LogLevel.DEBUG;
34
+ case "info":
35
+ return LogLevel.INFO;
36
+ case "warn":
37
+ return LogLevel.WARN;
38
+ case "error":
39
+ return LogLevel.ERROR;
40
+ case "fatal":
41
+ return LogLevel.FATAL;
42
+ case "silent":
43
+ return LogLevel.SILENT;
44
+ default:
45
+ return LogLevel.INFO;
46
+ }
47
+ };
48
+ var getLogLevelLabel = (logLevel = LogLevel.INFO) => {
49
+ if (logLevel >= LogLevel.ALL) {
50
+ return LogLevelLabel.ALL;
51
+ }
52
+ if (logLevel >= LogLevel.TRACE) {
53
+ return LogLevelLabel.TRACE;
54
+ }
55
+ if (logLevel >= LogLevel.DEBUG) {
56
+ return LogLevelLabel.DEBUG;
57
+ }
58
+ if (logLevel >= LogLevel.INFO) {
59
+ return LogLevelLabel.INFO;
60
+ }
61
+ if (logLevel >= LogLevel.WARN) {
62
+ return LogLevelLabel.WARN;
63
+ }
64
+ if (logLevel >= LogLevel.ERROR) {
65
+ return LogLevelLabel.ERROR;
66
+ }
67
+ if (logLevel >= LogLevel.FATAL) {
68
+ return LogLevelLabel.FATAL;
69
+ }
70
+ if (logLevel <= LogLevel.SILENT) {
71
+ return LogLevelLabel.SILENT;
72
+ }
73
+ return LogLevelLabel.INFO;
74
+ };
75
+ var isVerbose = (label = LogLevelLabel.SILENT) => {
76
+ const logLevel = typeof label === "string" ? getLogLevel(label) : label;
77
+ return logLevel >= LogLevel.DEBUG;
78
+ };
79
+
80
+ // ../config-tools/src/utilities/colors.ts
81
+ var DEFAULT_COLOR_CONFIG = {
82
+ light: {
83
+ background: "#fafafa",
84
+ foreground: "#1d1e22",
85
+ brand: "#1fb2a6",
86
+ alternate: "#db2777",
87
+ help: "#5C4EE5",
88
+ success: "#087f5b",
89
+ info: "#0550ae",
90
+ warning: "#e3b341",
91
+ danger: "#D8314A",
92
+ fatal: "#51070f",
93
+ link: "#3fa6ff",
94
+ positive: "#22c55e",
95
+ negative: "#dc2626",
96
+ gradient: ["#1fb2a6", "#db2777", "#5C4EE5"]
97
+ },
98
+ dark: {
99
+ background: "#1d1e22",
100
+ foreground: "#cbd5e1",
101
+ brand: "#2dd4bf",
102
+ alternate: "#db2777",
103
+ help: "#818cf8",
104
+ success: "#10b981",
105
+ info: "#58a6ff",
106
+ warning: "#f3d371",
107
+ danger: "#D8314A",
108
+ fatal: "#a40e26",
109
+ link: "#3fa6ff",
110
+ positive: "#22c55e",
111
+ negative: "#dc2626",
112
+ gradient: ["#1fb2a6", "#db2777", "#818cf8"]
113
+ }
114
+ };
115
+
116
+ // ../config-tools/src/logger/chalk.ts
117
+ var _chalk2 = require('chalk'); var _chalk3 = _interopRequireDefault(_chalk2);
118
+ var chalkDefault = {
119
+ hex: (_) => (message) => message,
120
+ bgHex: (_) => ({
121
+ whiteBright: (message) => message,
122
+ white: (message) => message
123
+ }),
124
+ white: (message) => message,
125
+ whiteBright: (message) => message,
126
+ gray: (message) => message,
127
+ bold: {
128
+ hex: (_) => (message) => message,
129
+ bgHex: (_) => ({
130
+ whiteBright: (message) => message,
131
+ white: (message) => message
132
+ }),
133
+ whiteBright: (message) => message,
134
+ white: (message) => message
135
+ },
136
+ dim: {
137
+ hex: (_) => (message) => message,
138
+ gray: (message) => message
139
+ }
140
+ };
141
+ var getChalk = () => {
142
+ let _chalk = _chalk3.default;
143
+ 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])) {
144
+ _chalk = chalkDefault;
145
+ }
146
+ return _chalk;
147
+ };
148
+
149
+ // ../config-tools/src/logger/is-unicode-supported.ts
150
+ function isUnicodeSupported() {
151
+ if (process.platform !== "win32") {
152
+ return process.env.TERM !== "linux";
153
+ }
154
+ return Boolean(process.env.WT_SESSION) || // Windows Terminal
155
+ Boolean(process.env.TERMINUS_SUBLIME) || // Terminus (<0.2.27)
156
+ process.env.ConEmuTask === "{cmd::Cmder}" || // ConEmu and cmder
157
+ 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";
158
+ }
159
+
160
+ // ../config-tools/src/logger/console-icons.ts
161
+ var useIcon = (c, fallback) => isUnicodeSupported() ? c : fallback;
162
+ var CONSOLE_ICONS = {
163
+ [LogLevelLabel.ERROR]: useIcon("\u2718", "\xD7"),
164
+ [LogLevelLabel.FATAL]: useIcon("\u{1F480}", "\xD7"),
165
+ [LogLevelLabel.WARN]: useIcon("\u26A0", "\u203C"),
166
+ [LogLevelLabel.INFO]: useIcon("\u2139", "i"),
167
+ [LogLevelLabel.SUCCESS]: useIcon("\u2714", "\u221A"),
168
+ [LogLevelLabel.DEBUG]: useIcon("\u{1F6E0}", "D"),
169
+ [LogLevelLabel.TRACE]: useIcon("\u{1F6E0}", "T"),
170
+ [LogLevelLabel.ALL]: useIcon("\u2709", "\u2192")
171
+ };
172
+
173
+ // ../config-tools/src/logger/format-timestamp.ts
174
+ var formatTimestamp = (date = /* @__PURE__ */ new Date()) => {
175
+ return `${date.toLocaleDateString()} ${date.toLocaleTimeString()}`;
176
+ };
177
+
178
+ // ../config-tools/src/logger/console.ts
179
+ var getLogFn = (logLevel = LogLevel.INFO, config = {}, _chalk = getChalk()) => {
180
+ 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;
181
+ const configLogLevel = config.logLevel || process.env.STORM_LOG_LEVEL || LogLevelLabel.INFO;
182
+ if (logLevel > getLogLevel(configLogLevel) || logLevel <= LogLevel.SILENT || getLogLevel(configLogLevel) <= LogLevel.SILENT) {
183
+ return (_) => {
184
+ };
185
+ }
186
+ if (typeof logLevel === "number" && LogLevel.FATAL >= logLevel) {
187
+ return (message) => {
188
+ console.error(
189
+ `
190
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(_nullishCoalesce(colors.fatal, () => ( DEFAULT_COLOR_CONFIG.dark.fatal)))(`[${CONSOLE_ICONS[LogLevelLabel.FATAL]} Fatal] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
191
+ `
192
+ );
193
+ };
194
+ }
195
+ if (typeof logLevel === "number" && LogLevel.ERROR >= logLevel) {
196
+ return (message) => {
197
+ console.error(
198
+ `
199
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(_nullishCoalesce(colors.danger, () => ( DEFAULT_COLOR_CONFIG.dark.danger)))(`[${CONSOLE_ICONS[LogLevelLabel.ERROR]} Error] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
200
+ `
201
+ );
202
+ };
203
+ }
204
+ if (typeof logLevel === "number" && LogLevel.WARN >= logLevel) {
205
+ return (message) => {
206
+ console.warn(
207
+ `
208
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(_nullishCoalesce(colors.warning, () => ( DEFAULT_COLOR_CONFIG.dark.warning)))(`[${CONSOLE_ICONS[LogLevelLabel.WARN]} Warn] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
209
+ `
210
+ );
211
+ };
212
+ }
213
+ if (typeof logLevel === "number" && LogLevel.SUCCESS >= logLevel) {
214
+ return (message) => {
215
+ console.info(
216
+ `
217
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(_nullishCoalesce(colors.success, () => ( DEFAULT_COLOR_CONFIG.dark.success)))(`[${CONSOLE_ICONS[LogLevelLabel.SUCCESS]} Success] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
218
+ `
219
+ );
220
+ };
221
+ }
222
+ if (typeof logLevel === "number" && LogLevel.INFO >= logLevel) {
223
+ return (message) => {
224
+ console.info(
225
+ `
226
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(_nullishCoalesce(colors.info, () => ( DEFAULT_COLOR_CONFIG.dark.info)))(`[${CONSOLE_ICONS[LogLevelLabel.INFO]} Info] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
227
+ `
228
+ );
229
+ };
230
+ }
231
+ if (typeof logLevel === "number" && LogLevel.DEBUG >= logLevel) {
232
+ return (message) => {
233
+ console.debug(
234
+ `
235
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(_nullishCoalesce(colors.info, () => ( DEFAULT_COLOR_CONFIG.dark.info)))(`[${CONSOLE_ICONS[LogLevelLabel.DEBUG]} Debug] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
236
+ `
237
+ );
238
+ };
239
+ }
240
+ if (typeof logLevel === "number" && LogLevel.TRACE >= logLevel) {
241
+ return (message) => {
242
+ console.debug(
243
+ `
244
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(_nullishCoalesce(colors.info, () => ( DEFAULT_COLOR_CONFIG.dark.info)))(`[${CONSOLE_ICONS[LogLevelLabel.TRACE]} Trace] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
245
+ `
246
+ );
247
+ };
248
+ }
249
+ return (message) => {
250
+ console.log(
251
+ `
252
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(_nullishCoalesce(colors.brand, () => ( DEFAULT_COLOR_CONFIG.dark.brand)))(`[${CONSOLE_ICONS[LogLevelLabel.ALL]} System] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
253
+ `
254
+ );
255
+ };
256
+ };
257
+ var writeFatal = (message, config) => getLogFn(LogLevel.FATAL, config)(message);
258
+ var writeError = (message, config) => getLogFn(LogLevel.ERROR, config)(message);
259
+ var writeWarning = (message, config) => getLogFn(LogLevel.WARN, config)(message);
260
+ var writeInfo = (message, config) => getLogFn(LogLevel.INFO, config)(message);
261
+ var writeSuccess = (message, config) => getLogFn(LogLevel.SUCCESS, config)(message);
262
+ var writeDebug = (message, config) => getLogFn(LogLevel.DEBUG, config)(message);
263
+ var writeTrace = (message, config) => getLogFn(LogLevel.TRACE, config)(message);
264
+ var getStopwatch = (name) => {
265
+ const start = process.hrtime();
266
+ return () => {
267
+ const end = process.hrtime(start);
268
+ console.info(
269
+ `
270
+ > \u23F1\uFE0F The${name ? ` ${name}` : ""} process took ${Math.round(
271
+ end[0] * 1e3 + end[1] / 1e6
272
+ )}ms to complete
273
+ `
274
+ );
275
+ };
276
+ };
277
+ var MAX_DEPTH = 4;
278
+ var formatLogMessage = (message, options = {}, depth = 0) => {
279
+ if (depth > MAX_DEPTH) {
280
+ return "<max depth>";
281
+ }
282
+ const prefix = _nullishCoalesce(options.prefix, () => ( "-"));
283
+ const skip = _nullishCoalesce(options.skip, () => ( []));
284
+ return typeof message === "undefined" || message === null || !message && typeof message !== "boolean" ? "<none>" : typeof message === "string" ? message : Array.isArray(message) ? `
285
+ ${message.map((item, index) => ` ${prefix}> #${index} = ${formatLogMessage(item, { prefix: `${prefix}-`, skip }, depth + 1)}`).join("\n")}` : typeof message === "object" ? `
286
+ ${Object.keys(message).filter((key) => !skip.includes(key)).map(
287
+ (key) => ` ${prefix}> ${key} = ${_isFunction(message[key]) ? "<function>" : typeof message[key] === "object" ? formatLogMessage(
288
+ message[key],
289
+ { prefix: `${prefix}-`, skip },
290
+ depth + 1
291
+ ) : message[key]}`
292
+ ).join("\n")}` : message;
293
+ };
294
+ var _isFunction = (value) => {
295
+ try {
296
+ 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]));
297
+ } catch (e) {
298
+ return false;
299
+ }
300
+ };
301
+
302
+
303
+
304
+
305
+
306
+
307
+
308
+
309
+
310
+
311
+
312
+
313
+
314
+
315
+
316
+
317
+ exports.LogLevel = LogLevel; exports.LogLevelLabel = LogLevelLabel; exports.getLogLevel = getLogLevel; exports.getLogLevelLabel = getLogLevelLabel; exports.isVerbose = isVerbose; exports.writeFatal = writeFatal; exports.writeError = writeError; exports.writeWarning = writeWarning; exports.writeInfo = writeInfo; exports.writeSuccess = writeSuccess; exports.writeDebug = writeDebug; exports.writeTrace = writeTrace; exports.getStopwatch = getStopwatch; exports.formatLogMessage = formatLogMessage;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  writeError
3
- } from "./chunk-QX4UI7BX.js";
3
+ } from "./chunk-VKJOPPWJ.js";
4
4
 
5
5
  // src/plugins/on-error.ts
6
6
  var onErrorPlugin = (options) => ({
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  writeInfo
3
- } from "./chunk-QX4UI7BX.js";
3
+ } from "./chunk-VKJOPPWJ.js";
4
4
 
5
5
  // src/plugins/analyze.ts
6
6
  var formatBytes = (bytes) => {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getStopwatch,
3
3
  writeDebug
4
- } from "./chunk-QX4UI7BX.js";
4
+ } from "./chunk-VKJOPPWJ.js";
5
5
 
6
6
  // src/clean.ts
7
7
  import { rm } from "node:fs/promises";
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
2
 
3
- var _chunk2RC3F2SNcjs = require('./chunk-2RC3F2SN.cjs');
3
+ var _chunkKRY2I44Jcjs = require('./chunk-KRY2I44J.cjs');
4
4
 
5
5
  // src/plugins/tsc.ts
6
6
 
@@ -45,7 +45,7 @@ async function createTsCompilerOptions(config, tsConfigPath, projectRoot, depend
45
45
  declaration: true,
46
46
  paths: _buildablelibsutils.computeCompilerOptionsPaths.call(void 0, tsConfig, _nullishCoalesce(dependencies, () => ( [])))
47
47
  };
48
- _chunk2RC3F2SNcjs.writeTrace.call(void 0, compilerOptions, config);
48
+ _chunkKRY2I44Jcjs.writeTrace.call(void 0, compilerOptions, config);
49
49
  return compilerOptions;
50
50
  }
51
51
 
@@ -1,13 +1,13 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunk2RC3F2SNcjs = require('./chunk-2RC3F2SN.cjs');
3
+ var _chunkKRY2I44Jcjs = require('./chunk-KRY2I44J.cjs');
4
4
 
5
5
  // src/plugins/on-error.ts
6
6
  var onErrorPlugin = (options) => ({
7
7
  name: "storm:on-error",
8
8
  buildEnd(error) {
9
9
  if (error) {
10
- _chunk2RC3F2SNcjs.writeError.call(void 0,
10
+ _chunkKRY2I44Jcjs.writeError.call(void 0,
11
11
  `The following errors occurred during the build:
12
12
  ${error ? error.message : "Unknown build error"}
13
13
 
@@ -18,7 +18,7 @@ ${error ? error.message : "Unknown build error"}
18
18
  }
19
19
  },
20
20
  renderError(error) {
21
- _chunk2RC3F2SNcjs.writeError.call(void 0,
21
+ _chunkKRY2I44Jcjs.writeError.call(void 0,
22
22
  `The following errors occurred during the build:
23
23
  ${error ? error.message : "Unknown build error"}
24
24