@storm-software/tsdown 0.15.1

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.
@@ -0,0 +1,565 @@
1
+ import {
2
+ __name
3
+ } from "./chunk-SHUYVCID.js";
4
+
5
+ // src/clean.ts
6
+ import { hfs } from "@humanfs/node";
7
+
8
+ // ../config-tools/src/types.ts
9
+ var LogLevel = {
10
+ SILENT: 0,
11
+ FATAL: 10,
12
+ ERROR: 20,
13
+ WARN: 30,
14
+ SUCCESS: 35,
15
+ INFO: 40,
16
+ DEBUG: 60,
17
+ TRACE: 70,
18
+ ALL: 100
19
+ };
20
+ var LogLevelLabel = {
21
+ SILENT: "silent",
22
+ FATAL: "fatal",
23
+ ERROR: "error",
24
+ WARN: "warn",
25
+ INFO: "info",
26
+ DEBUG: "debug",
27
+ TRACE: "trace",
28
+ ALL: "all"
29
+ };
30
+
31
+ // ../config/src/constants.ts
32
+ var STORM_DEFAULT_DOCS = "https://docs.stormsoftware.com";
33
+ var STORM_DEFAULT_HOMEPAGE = "https://stormsoftware.com";
34
+ var STORM_DEFAULT_LICENSING = "https://license.stormsoftware.com";
35
+ var STORM_DEFAULT_LICENSE = "Apache-2.0";
36
+
37
+ // ../config/src/schema.ts
38
+ import z from "zod";
39
+ var DarkColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#1d1e22").describe("The dark background color of the workspace");
40
+ var LightColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#f4f4f5").describe("The light background color of the workspace");
41
+ var BrandColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#1fb2a6").describe("The primary brand specific color of the workspace");
42
+ var AlternateColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).optional().describe("The alternate brand specific color of the workspace");
43
+ var AccentColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).optional().describe("The secondary brand specific color of the workspace");
44
+ var LinkColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).optional().describe("The color used to display hyperlink text");
45
+ var HelpColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#8256D0").describe("The second brand specific color of the workspace");
46
+ var SuccessColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#12B66A").describe("The success color of the workspace");
47
+ var InfoColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#0070E0").describe("The informational color of the workspace");
48
+ var WarningColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#fcc419").describe("The warning color of the workspace");
49
+ var DangerColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#D8314A").describe("The danger color of the workspace");
50
+ var FatalColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).optional().describe("The fatal color of the workspace");
51
+ var PositiveColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#4ade80").describe("The positive number color of the workspace");
52
+ var NegativeColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#ef4444").describe("The negative number color of the workspace");
53
+ var DarkThemeColorConfigSchema = z.object({
54
+ foreground: LightColorSchema,
55
+ background: DarkColorSchema,
56
+ brand: BrandColorSchema,
57
+ alternate: AlternateColorSchema,
58
+ accent: AccentColorSchema,
59
+ link: LinkColorSchema,
60
+ help: HelpColorSchema,
61
+ success: SuccessColorSchema,
62
+ info: InfoColorSchema,
63
+ warning: WarningColorSchema,
64
+ danger: DangerColorSchema,
65
+ fatal: FatalColorSchema,
66
+ positive: PositiveColorSchema,
67
+ negative: NegativeColorSchema
68
+ });
69
+ var LightThemeColorConfigSchema = z.object({
70
+ foreground: DarkColorSchema,
71
+ background: LightColorSchema,
72
+ brand: BrandColorSchema,
73
+ alternate: AlternateColorSchema,
74
+ accent: AccentColorSchema,
75
+ link: LinkColorSchema,
76
+ help: HelpColorSchema,
77
+ success: SuccessColorSchema,
78
+ info: InfoColorSchema,
79
+ warning: WarningColorSchema,
80
+ danger: DangerColorSchema,
81
+ fatal: FatalColorSchema,
82
+ positive: PositiveColorSchema,
83
+ negative: NegativeColorSchema
84
+ });
85
+ var MultiThemeColorConfigSchema = z.object({
86
+ dark: DarkThemeColorConfigSchema,
87
+ light: LightThemeColorConfigSchema
88
+ });
89
+ var SingleThemeColorConfigSchema = z.object({
90
+ dark: DarkColorSchema,
91
+ light: LightColorSchema,
92
+ brand: BrandColorSchema,
93
+ alternate: AlternateColorSchema,
94
+ accent: AccentColorSchema,
95
+ link: LinkColorSchema,
96
+ help: HelpColorSchema,
97
+ success: SuccessColorSchema,
98
+ info: InfoColorSchema,
99
+ warning: WarningColorSchema,
100
+ danger: DangerColorSchema,
101
+ fatal: FatalColorSchema,
102
+ positive: PositiveColorSchema,
103
+ negative: NegativeColorSchema
104
+ });
105
+ var RegistryUrlConfigSchema = z.string().trim().toLowerCase().url().optional().describe("A remote registry URL used to publish distributable packages");
106
+ var RegistryConfigSchema = z.object({
107
+ github: RegistryUrlConfigSchema,
108
+ npm: RegistryUrlConfigSchema,
109
+ cargo: RegistryUrlConfigSchema,
110
+ cyclone: RegistryUrlConfigSchema,
111
+ container: RegistryUrlConfigSchema
112
+ }).default({}).describe("A list of remote registry URLs used by Storm Software");
113
+ var ColorConfigSchema = SingleThemeColorConfigSchema.or(MultiThemeColorConfigSchema).describe("Colors used for various workspace elements");
114
+ var ColorConfigMapSchema = z.union([
115
+ z.object({
116
+ "base": ColorConfigSchema
117
+ }),
118
+ z.record(z.string(), ColorConfigSchema)
119
+ ]);
120
+ var WorkspaceBotConfigSchema = z.object({
121
+ name: z.string().trim().default("Stormie-Bot").describe("The workspace bot user's name (this is the bot that will be used to perform various tasks)"),
122
+ email: z.string().trim().email().default("bot@stormsoftware.com").describe("The email of the workspace bot")
123
+ }).describe("The workspace's bot user's config used to automated various operations tasks");
124
+ var WorkspaceDirectoryConfigSchema = z.object({
125
+ cache: z.string().trim().optional().describe("The directory used to store the environment's cached file data"),
126
+ data: z.string().trim().optional().describe("The directory used to store the environment's data files"),
127
+ config: z.string().trim().optional().describe("The directory used to store the environment's configuration files"),
128
+ temp: z.string().trim().optional().describe("The directory used to store the environment's temp files"),
129
+ log: z.string().trim().optional().describe("The directory used to store the environment's temp files"),
130
+ build: z.string().trim().default("dist").describe("The directory used to store the workspace's distributable files after a build (relative to the workspace root)")
131
+ }).describe("Various directories used by the workspace to store data, cache, and configuration files");
132
+ var StormConfigSchema = z.object({
133
+ $schema: z.string().trim().default("https://cdn.jsdelivr.net/npm/@storm-software/config/schemas/storm.schema.json").optional().nullish().describe("The URL to the JSON schema file that describes the Storm configuration file"),
134
+ extends: z.string().trim().optional().describe("The path to a base JSON file to use as a configuration preset file"),
135
+ name: z.string().trim().toLowerCase().optional().describe("The name of the service/package/scope using this configuration"),
136
+ namespace: z.string().trim().toLowerCase().optional().describe("The namespace of the package"),
137
+ organization: z.string().trim().default("storm-software").describe("The organization of the workspace"),
138
+ repository: z.string().trim().url().optional().describe("The repo URL of the workspace (i.e. GitHub)"),
139
+ license: z.string().trim().default("Apache-2.0").describe("The license type of the package"),
140
+ homepage: z.string().trim().url().default(STORM_DEFAULT_HOMEPAGE).describe("The homepage of the workspace"),
141
+ docs: z.string().trim().url().default(STORM_DEFAULT_DOCS).describe("The base documentation site for the workspace"),
142
+ licensing: z.string().trim().url().default(STORM_DEFAULT_LICENSING).describe("The base licensing site for the workspace"),
143
+ branch: z.string().trim().default("main").describe("The branch of the workspace"),
144
+ preid: z.string().optional().describe("A tag specifying the version pre-release identifier"),
145
+ owner: z.string().trim().default("@storm-software/admin").describe("The owner of the package"),
146
+ bot: WorkspaceBotConfigSchema,
147
+ env: z.enum([
148
+ "development",
149
+ "staging",
150
+ "production"
151
+ ]).default("production").describe("The current runtime environment name for the package"),
152
+ workspaceRoot: z.string().trim().default("").describe("The root directory of the workspace"),
153
+ externalPackagePatterns: z.array(z.string()).default([]).describe("The build will use these package patterns to determine if they should be external to the bundle"),
154
+ skipCache: z.boolean().default(false).describe("Should all known types of workspace caching be skipped?"),
155
+ directories: WorkspaceDirectoryConfigSchema,
156
+ packageManager: z.enum([
157
+ "npm",
158
+ "yarn",
159
+ "pnpm",
160
+ "bun"
161
+ ]).default("npm").describe("The JavaScript/TypeScript package manager used by the repository"),
162
+ timezone: z.string().trim().default("America/New_York").describe("The default timezone of the workspace"),
163
+ locale: z.string().trim().default("en-US").describe("The default locale of the workspace"),
164
+ logLevel: z.enum([
165
+ "silent",
166
+ "fatal",
167
+ "error",
168
+ "warn",
169
+ "info",
170
+ "debug",
171
+ "trace",
172
+ "all"
173
+ ]).default("info").describe("The log level used to filter out lower priority log messages. If not provided, this is defaulted using the `environment` config value (if `environment` is set to `production` then `level` is `error`, else `level` is `debug`)."),
174
+ registry: RegistryConfigSchema,
175
+ configFile: z.string().trim().nullable().default(null).describe("The filepath of the Storm config. When this field is null, no config file was found in the current workspace."),
176
+ colors: ColorConfigSchema.or(ColorConfigMapSchema).describe("Storm theme config values used for styling various package elements"),
177
+ extensions: z.record(z.any()).optional().default({}).describe("Configuration of each used extension")
178
+ }).describe("Storm Workspace config values used during various dev-ops processes. This type is a combination of the StormPackageConfig and StormProject types. It represents the config of the entire monorepo.");
179
+
180
+ // ../config/src/types.ts
181
+ var COLOR_KEYS = [
182
+ "dark",
183
+ "light",
184
+ "base",
185
+ "brand",
186
+ "alternate",
187
+ "accent",
188
+ "link",
189
+ "success",
190
+ "help",
191
+ "info",
192
+ "warning",
193
+ "danger",
194
+ "fatal",
195
+ "positive",
196
+ "negative"
197
+ ];
198
+
199
+ // ../config-tools/src/utilities/get-default-config.ts
200
+ import { existsSync as existsSync2, readFileSync } from "node:fs";
201
+ import { join as join2 } from "node:path";
202
+
203
+ // ../config-tools/src/utilities/correct-paths.ts
204
+ import { joinPathFragments } from "@nx/devkit";
205
+ var correctPaths = /* @__PURE__ */ __name((path) => {
206
+ if (!path) {
207
+ return "";
208
+ }
209
+ if (!path.toUpperCase().startsWith("C:") && path.includes("\\")) {
210
+ path = `C:${path}`;
211
+ }
212
+ return path.replaceAll("\\", "/");
213
+ }, "correctPaths");
214
+ var joinPaths = /* @__PURE__ */ __name((...paths) => {
215
+ if (!paths || paths.length === 0) {
216
+ return "";
217
+ }
218
+ return correctPaths(joinPathFragments(...paths.map((path) => correctPaths(path))));
219
+ }, "joinPaths");
220
+
221
+ // ../config-tools/src/utilities/find-up.ts
222
+ import { existsSync } from "node:fs";
223
+ import { join } from "node:path";
224
+ var MAX_PATH_SEARCH_DEPTH = 30;
225
+ var depth = 0;
226
+ function findFolderUp(startPath, endFileNames) {
227
+ const _startPath = startPath ?? process.cwd();
228
+ if (endFileNames.some((endFileName) => existsSync(join(_startPath, endFileName)))) {
229
+ return _startPath;
230
+ }
231
+ if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
232
+ const parent = join(_startPath, "..");
233
+ return findFolderUp(parent, endFileNames);
234
+ }
235
+ return void 0;
236
+ }
237
+ __name(findFolderUp, "findFolderUp");
238
+
239
+ // ../config-tools/src/utilities/find-workspace-root.ts
240
+ var rootFiles = [
241
+ "storm.json",
242
+ "storm.json",
243
+ "storm.yaml",
244
+ "storm.yml",
245
+ "storm.js",
246
+ "storm.ts",
247
+ ".storm.json",
248
+ ".storm.yaml",
249
+ ".storm.yml",
250
+ ".storm.js",
251
+ ".storm.ts",
252
+ "lerna.json",
253
+ "nx.json",
254
+ "turbo.json",
255
+ "npm-workspace.json",
256
+ "yarn-workspace.json",
257
+ "pnpm-workspace.json",
258
+ "npm-workspace.yaml",
259
+ "yarn-workspace.yaml",
260
+ "pnpm-workspace.yaml",
261
+ "npm-workspace.yml",
262
+ "yarn-workspace.yml",
263
+ "pnpm-workspace.yml",
264
+ "npm-lock.json",
265
+ "yarn-lock.json",
266
+ "pnpm-lock.json",
267
+ "npm-lock.yaml",
268
+ "yarn-lock.yaml",
269
+ "pnpm-lock.yaml",
270
+ "npm-lock.yml",
271
+ "yarn-lock.yml",
272
+ "pnpm-lock.yml",
273
+ "bun.lockb"
274
+ ];
275
+ function findWorkspaceRootSafe(pathInsideMonorepo) {
276
+ if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
277
+ return correctPaths(process.env.STORM_WORKSPACE_ROOT ?? process.env.NX_WORKSPACE_ROOT_PATH);
278
+ }
279
+ return correctPaths(findFolderUp(pathInsideMonorepo ?? process.cwd(), rootFiles));
280
+ }
281
+ __name(findWorkspaceRootSafe, "findWorkspaceRootSafe");
282
+ function findWorkspaceRoot(pathInsideMonorepo) {
283
+ const result = findWorkspaceRootSafe(pathInsideMonorepo);
284
+ if (!result) {
285
+ throw new Error(`Cannot find workspace root upwards from known path. Files search list includes:
286
+ ${rootFiles.join("\n")}
287
+ Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`);
288
+ }
289
+ return result;
290
+ }
291
+ __name(findWorkspaceRoot, "findWorkspaceRoot");
292
+
293
+ // ../config-tools/src/utilities/get-default-config.ts
294
+ var DEFAULT_COLOR_CONFIG = {
295
+ "light": {
296
+ "background": "#fafafa",
297
+ "foreground": "#1d1e22",
298
+ "brand": "#1fb2a6",
299
+ "alternate": "#db2777",
300
+ "help": "#5C4EE5",
301
+ "success": "#087f5b",
302
+ "info": "#0550ae",
303
+ "warning": "#e3b341",
304
+ "danger": "#D8314A",
305
+ "positive": "#22c55e",
306
+ "negative": "#dc2626"
307
+ },
308
+ "dark": {
309
+ "background": "#1d1e22",
310
+ "foreground": "#cbd5e1",
311
+ "brand": "#2dd4bf",
312
+ "alternate": "#db2777",
313
+ "help": "#818cf8",
314
+ "success": "#10b981",
315
+ "info": "#58a6ff",
316
+ "warning": "#f3d371",
317
+ "danger": "#D8314A",
318
+ "positive": "#22c55e",
319
+ "negative": "#dc2626"
320
+ }
321
+ };
322
+ var getDefaultConfig = /* @__PURE__ */ __name((root) => {
323
+ let license = STORM_DEFAULT_LICENSE;
324
+ let homepage = STORM_DEFAULT_HOMEPAGE;
325
+ let name;
326
+ let namespace;
327
+ let repository;
328
+ const workspaceRoot = findWorkspaceRoot(root);
329
+ if (existsSync2(join2(workspaceRoot, "package.json"))) {
330
+ const file = readFileSync(join2(workspaceRoot, "package.json"), {
331
+ encoding: "utf8"
332
+ });
333
+ if (file) {
334
+ const packageJson = JSON.parse(file);
335
+ if (packageJson.name) {
336
+ name = packageJson.name;
337
+ }
338
+ if (packageJson.namespace) {
339
+ namespace = packageJson.namespace;
340
+ }
341
+ if (packageJson.repository?.url) {
342
+ repository = packageJson.repository?.url;
343
+ }
344
+ if (packageJson.license) {
345
+ license = packageJson.license;
346
+ }
347
+ if (packageJson.homepage) {
348
+ homepage = packageJson.homepage;
349
+ }
350
+ }
351
+ }
352
+ return {
353
+ workspaceRoot,
354
+ name,
355
+ namespace,
356
+ repository,
357
+ license,
358
+ homepage,
359
+ docs: `${homepage || STORM_DEFAULT_HOMEPAGE}/docs`,
360
+ licensing: `${homepage || STORM_DEFAULT_HOMEPAGE}/license`
361
+ };
362
+ }, "getDefaultConfig");
363
+
364
+ // ../config-tools/src/logger/chalk.ts
365
+ import chalk from "chalk";
366
+ var chalkDefault = {
367
+ hex: /* @__PURE__ */ __name((_) => (message) => message, "hex"),
368
+ bgHex: /* @__PURE__ */ __name((_) => ({
369
+ whiteBright: /* @__PURE__ */ __name((message) => message, "whiteBright")
370
+ }), "bgHex"),
371
+ whiteBright: /* @__PURE__ */ __name((message) => message, "whiteBright"),
372
+ bold: {
373
+ hex: /* @__PURE__ */ __name((_) => (message) => message, "hex"),
374
+ bgHex: /* @__PURE__ */ __name((_) => ({
375
+ whiteBright: /* @__PURE__ */ __name((message) => message, "whiteBright")
376
+ }), "bgHex"),
377
+ whiteBright: /* @__PURE__ */ __name((message) => message, "whiteBright")
378
+ }
379
+ };
380
+ var getChalk = /* @__PURE__ */ __name(() => {
381
+ let _chalk = chalk;
382
+ if (!_chalk?.hex || !_chalk?.bold?.hex || !_chalk?.bgHex || !_chalk?.whiteBright) {
383
+ _chalk = chalkDefault;
384
+ }
385
+ return _chalk;
386
+ }, "getChalk");
387
+
388
+ // ../config-tools/src/logger/get-log-level.ts
389
+ var getLogLevel = /* @__PURE__ */ __name((label) => {
390
+ switch (label) {
391
+ case "all":
392
+ return LogLevel.ALL;
393
+ case "trace":
394
+ return LogLevel.TRACE;
395
+ case "debug":
396
+ return LogLevel.DEBUG;
397
+ case "info":
398
+ return LogLevel.INFO;
399
+ case "warn":
400
+ return LogLevel.WARN;
401
+ case "error":
402
+ return LogLevel.ERROR;
403
+ case "fatal":
404
+ return LogLevel.FATAL;
405
+ case "silent":
406
+ return LogLevel.SILENT;
407
+ default:
408
+ return LogLevel.INFO;
409
+ }
410
+ }, "getLogLevel");
411
+ var getLogLevelLabel = /* @__PURE__ */ __name((logLevel = LogLevel.INFO) => {
412
+ if (logLevel >= LogLevel.ALL) {
413
+ return LogLevelLabel.ALL;
414
+ }
415
+ if (logLevel >= LogLevel.TRACE) {
416
+ return LogLevelLabel.TRACE;
417
+ }
418
+ if (logLevel >= LogLevel.DEBUG) {
419
+ return LogLevelLabel.DEBUG;
420
+ }
421
+ if (logLevel >= LogLevel.INFO) {
422
+ return LogLevelLabel.INFO;
423
+ }
424
+ if (logLevel >= LogLevel.WARN) {
425
+ return LogLevelLabel.WARN;
426
+ }
427
+ if (logLevel >= LogLevel.ERROR) {
428
+ return LogLevelLabel.ERROR;
429
+ }
430
+ if (logLevel >= LogLevel.FATAL) {
431
+ return LogLevelLabel.FATAL;
432
+ }
433
+ if (logLevel <= LogLevel.SILENT) {
434
+ return LogLevelLabel.SILENT;
435
+ }
436
+ return LogLevelLabel.INFO;
437
+ }, "getLogLevelLabel");
438
+ var isVerbose = /* @__PURE__ */ __name((label = LogLevelLabel.SILENT) => {
439
+ const logLevel = typeof label === "string" ? getLogLevel(label) : label;
440
+ return logLevel <= LogLevel.DEBUG;
441
+ }, "isVerbose");
442
+
443
+ // ../config-tools/src/logger/console.ts
444
+ var getLogFn = /* @__PURE__ */ __name((logLevel = LogLevel.INFO, config = {}) => {
445
+ const _chalk = getChalk();
446
+ 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;
447
+ const configLogLevel = config.logLevel || process.env.STORM_LOG_LEVEL || LogLevelLabel.INFO;
448
+ if (typeof logLevel === "number" && (logLevel >= getLogLevel(configLogLevel) || logLevel <= LogLevel.SILENT) || typeof logLevel === "string" && getLogLevel(logLevel) >= getLogLevel(configLogLevel)) {
449
+ return (_) => {
450
+ };
451
+ }
452
+ if (typeof logLevel === "number" && LogLevel.FATAL >= logLevel || typeof logLevel === "string" && LogLevel.FATAL >= getLogLevel(logLevel)) {
453
+ return (message) => {
454
+ console.error(`${_chalk.bold.hex(colors.fatal ?? "#7d1a1a")(">")} ${_chalk.bold.bgHex(colors.fatal ?? "#7d1a1a").whiteBright(" \u{1F480} Fatal ")} ${_chalk.hex(colors.fatal ?? "#7d1a1a")(formatLogMessage(message))}
455
+ `);
456
+ };
457
+ }
458
+ if (typeof logLevel === "number" && LogLevel.ERROR >= logLevel || typeof logLevel === "string" && LogLevel.ERROR >= getLogLevel(logLevel)) {
459
+ return (message) => {
460
+ console.error(`${_chalk.bold.hex(colors.danger ?? "#f85149")(">")} ${_chalk.bold.bgHex(colors.danger ?? "#f85149").whiteBright(" \u2718 Error ")} ${_chalk.hex(colors.danger ?? "#f85149")(formatLogMessage(message))}
461
+ `);
462
+ };
463
+ }
464
+ if (typeof logLevel === "number" && LogLevel.WARN >= logLevel || typeof logLevel === "string" && LogLevel.WARN >= getLogLevel(logLevel)) {
465
+ return (message) => {
466
+ console.warn(`${_chalk.bold.hex(colors.warning ?? "#e3b341")(">")} ${_chalk.bold.bgHex(colors.warning ?? "#e3b341").whiteBright(" \u26A0 Warn ")} ${_chalk.hex(colors.warning ?? "#e3b341")(formatLogMessage(message))}
467
+ `);
468
+ };
469
+ }
470
+ if (typeof logLevel === "number" && LogLevel.SUCCESS >= logLevel || typeof logLevel === "string" && LogLevel.SUCCESS >= getLogLevel(logLevel)) {
471
+ return (message) => {
472
+ console.info(`${_chalk.bold.hex(colors.success ?? "#56d364")(">")} ${_chalk.bold.bgHex(colors.success ?? "#56d364").whiteBright(" \u2713 Success ")} ${_chalk.hex(colors.success ?? "#56d364")(formatLogMessage(message))}
473
+ `);
474
+ };
475
+ }
476
+ if (typeof logLevel === "number" && LogLevel.INFO >= logLevel || typeof logLevel === "string" && LogLevel.INFO >= getLogLevel(logLevel)) {
477
+ return (message) => {
478
+ console.info(`${_chalk.bold.hex(colors.info ?? "#58a6ff")(">")} ${_chalk.bold.bgHex(colors.info ?? "#58a6ff").whiteBright(" \u2139 Info ")} ${_chalk.hex(colors.info ?? "#58a6ff")(formatLogMessage(message))}
479
+ `);
480
+ };
481
+ }
482
+ if (typeof logLevel === "number" && LogLevel.TRACE >= logLevel || typeof logLevel === "string" && LogLevel.TRACE >= getLogLevel(logLevel)) {
483
+ return (message) => {
484
+ console.debug(`${_chalk.bold.hex(colors.brand ?? "#1fb2a6")(">")} ${_chalk.bold.bgHex(colors.brand ?? "#1fb2a6").whiteBright(" \u{1F6E0} Debug ")} ${_chalk.hex(colors.brand ?? "#1fb2a6")(formatLogMessage(message))}
485
+ `);
486
+ };
487
+ }
488
+ return (message) => {
489
+ console.log(`${_chalk.bold.hex(colors.brand ?? "#1fb2a6")(">")} ${_chalk.bold.bgHex(colors.brand ?? "#1fb2a6").whiteBright(" \u2709 System ")} ${_chalk.hex(colors.brand ?? "#1fb2a6")(formatLogMessage(message))}
490
+ `);
491
+ };
492
+ }, "getLogFn");
493
+ var writeFatal = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.FATAL, config)(message), "writeFatal");
494
+ var writeWarning = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.WARN, config)(message), "writeWarning");
495
+ var writeSuccess = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.SUCCESS, config)(message), "writeSuccess");
496
+ var writeDebug = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.DEBUG, config)(message), "writeDebug");
497
+ var writeTrace = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.TRACE, config)(message), "writeTrace");
498
+ var writeSystem = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.ALL, config)(message), "writeSystem");
499
+ var getStopwatch = /* @__PURE__ */ __name((name) => {
500
+ const start = process.hrtime();
501
+ return () => {
502
+ const end = process.hrtime(start);
503
+ console.info(`
504
+ > \u23F1\uFE0F The${name ? ` ${name}` : ""} process took ${Math.round(end[0] * 1e3 + end[1] / 1e6)}ms to complete
505
+
506
+ `);
507
+ };
508
+ }, "getStopwatch");
509
+ var MAX_DEPTH = 4;
510
+ var formatLogMessage = /* @__PURE__ */ __name((message, options = {}, depth2 = 0) => {
511
+ if (depth2 > MAX_DEPTH) {
512
+ return "<max depth>";
513
+ }
514
+ const prefix = options.prefix ?? "-";
515
+ const skip = options.skip ?? [];
516
+ return typeof message === "undefined" || message === null || !message && typeof message !== "boolean" ? "<none>" : typeof message === "string" ? message : Array.isArray(message) ? `
517
+ ${message.map((item, index) => ` ${prefix}> #${index} = ${formatLogMessage(item, {
518
+ prefix: `${prefix}-`,
519
+ skip
520
+ }, depth2 + 1)}`).join("\n")}` : typeof message === "object" ? `
521
+ ${Object.keys(message).filter((key) => !skip.includes(key)).map((key) => ` ${prefix}> ${key} = ${_isFunction(message[key]) ? "<function>" : typeof message[key] === "object" ? formatLogMessage(message[key], {
522
+ prefix: `${prefix}-`,
523
+ skip
524
+ }, depth2 + 1) : message[key]}`).join("\n")}` : message;
525
+ }, "formatLogMessage");
526
+ var _isFunction = /* @__PURE__ */ __name((value) => {
527
+ try {
528
+ return value instanceof Function || typeof value === "function" || !!(value?.constructor && value?.call && value?.apply);
529
+ } catch (e) {
530
+ return false;
531
+ }
532
+ }, "_isFunction");
533
+
534
+ // src/clean.ts
535
+ async function clean(name = "ESBuild", directory, config) {
536
+ writeDebug(` \u{1F9F9} Cleaning ${name} output path: ${directory}`, config);
537
+ const stopwatch = getStopwatch(`${name} output clean`);
538
+ await hfs.deleteAll(directory);
539
+ stopwatch();
540
+ }
541
+ __name(clean, "clean");
542
+
543
+ export {
544
+ LogLevel,
545
+ STORM_DEFAULT_DOCS,
546
+ STORM_DEFAULT_HOMEPAGE,
547
+ STORM_DEFAULT_LICENSING,
548
+ COLOR_KEYS,
549
+ correctPaths,
550
+ joinPaths,
551
+ findWorkspaceRoot,
552
+ getDefaultConfig,
553
+ getLogLevel,
554
+ getLogLevelLabel,
555
+ isVerbose,
556
+ writeFatal,
557
+ writeWarning,
558
+ writeSuccess,
559
+ writeDebug,
560
+ writeTrace,
561
+ writeSystem,
562
+ getStopwatch,
563
+ formatLogMessage,
564
+ clean
565
+ };