@storm-software/config-tools 1.163.25 → 1.163.27
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.
- package/README.md +1 -2
- package/bin/config.cjs +298 -205
- package/bin/config.js +308 -208
- package/dist/chunk-42TCRG4H.js +38 -0
- package/dist/{chunk-E5AUC34G.cjs → chunk-4JREL2GQ.cjs} +31 -43
- package/dist/{chunk-NKHVLY3K.js → chunk-4XRV4CVP.js} +6 -9
- package/dist/{chunk-GBY7M6XX.cjs → chunk-56NGBR4S.cjs} +51 -40
- package/dist/{chunk-2HSUVM5I.js → chunk-64DXC5WM.js} +4 -8
- package/dist/{chunk-7HCO3WBN.cjs → chunk-7BZWQZUV.cjs} +6 -9
- package/dist/{chunk-4AM2CTWO.cjs → chunk-7HCUD67D.cjs} +34 -21
- package/dist/{chunk-DLO4KL2Z.cjs → chunk-7SIKKF62.cjs} +78 -61
- package/dist/{chunk-6LIPH2JW.cjs → chunk-AEZINHEA.cjs} +19 -12
- package/dist/{chunk-WZSBZDAU.cjs → chunk-AQ2NOVJF.cjs} +32 -16
- package/dist/{chunk-JT77N7TT.js → chunk-BAWQ37NK.js} +13 -12
- package/dist/chunk-BJ2W75ZO.cjs +135 -0
- package/dist/{chunk-SFDIRWJY.js → chunk-ELNIDXR5.js} +20 -14
- package/dist/chunk-FCWF3I34.cjs +55 -0
- package/dist/{chunk-D6E6GZD2.js → chunk-FRR2ZRWD.js} +30 -42
- package/dist/{chunk-YSSMM2WQ.cjs → chunk-GIXUQACB.cjs} +11 -8
- package/dist/chunk-H2GU4JMJ.cjs +40 -0
- package/dist/{chunk-2LQBYJT5.cjs → chunk-H425P7G5.cjs} +54 -35
- package/dist/{chunk-CERDEPKZ.js → chunk-IETV2DPL.js} +32 -16
- package/dist/{chunk-ZFRJR2OY.cjs → chunk-J2LCTMCI.cjs} +11 -15
- package/dist/{chunk-2V4WR4HU.js → chunk-JX5NLB4S.js} +12 -9
- package/dist/chunk-NS5PJ2RM.cjs +32 -0
- package/dist/{chunk-FVYBJYYR.js → chunk-OJP4XIBV.js} +2 -5
- package/dist/{chunk-OSY5X2AI.cjs → chunk-PLLCZVZO.cjs} +1 -6
- package/dist/{chunk-KBPYCUVG.cjs → chunk-PSHJQ2NP.cjs} +2 -5
- package/dist/{chunk-OB4WNEXN.js → chunk-QDJMKPQQ.js} +2 -6
- package/dist/{chunk-XDS6C7HI.js → chunk-QJUAU656.js} +68 -51
- package/dist/chunk-QNDF3RQL.cjs +8 -0
- package/dist/{chunk-AWCU6JTS.js → chunk-R6A4VPC4.js} +0 -5
- package/dist/{chunk-G2XISPLW.cjs → chunk-RKGXITNB.cjs} +7 -8
- package/dist/{chunk-QRKAMMHF.js → chunk-RSKVXFI5.js} +45 -34
- package/dist/{chunk-NQFXB5CV.js → chunk-RWBPUJIZ.js} +6 -7
- package/dist/chunk-T3MUE32G.js +32 -0
- package/dist/{chunk-VULQ4N4Z.cjs → chunk-T4ZMKMEG.cjs} +21 -8
- package/dist/{chunk-K6PUXRK3.js → chunk-VLWSWYG7.js} +19 -12
- package/dist/{chunk-BC2QD5QZ.js → chunk-WITKEKZ5.js} +50 -33
- package/dist/chunk-XEZGYUS2.js +8 -0
- package/dist/{chunk-GYFE7GKG.js → chunk-XO6ICAFH.js} +32 -19
- package/dist/{chunk-ETZGNPAA.js → chunk-XS7LVKAI.js} +46 -27
- package/dist/{chunk-CHA6766N.cjs → chunk-ZGLOKOL3.cjs} +5 -9
- package/dist/config-file/get-config-file.cjs +16 -17
- package/dist/config-file/get-config-file.js +15 -16
- package/dist/config-file/index.cjs +16 -17
- package/dist/config-file/index.js +15 -16
- package/dist/create-storm-config.cjs +19 -20
- package/dist/create-storm-config.js +18 -19
- package/dist/env/get-env.cjs +4 -5
- package/dist/env/get-env.js +3 -4
- package/dist/env/index.cjs +5 -6
- package/dist/env/index.js +4 -5
- package/dist/env/set-env.cjs +4 -5
- package/dist/env/set-env.js +3 -4
- package/dist/get-config.cjs +20 -21
- package/dist/get-config.js +19 -20
- package/dist/index.cjs +23 -22
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +22 -21
- package/dist/logger/chalk.cjs +2 -3
- package/dist/logger/chalk.js +1 -2
- package/dist/logger/console-icons.cjs +3 -4
- package/dist/logger/console-icons.js +2 -3
- package/dist/logger/console.cjs +11 -12
- package/dist/logger/console.js +10 -11
- package/dist/logger/create-logger.cjs +12 -13
- package/dist/logger/create-logger.js +11 -12
- package/dist/logger/format-timestamp.cjs +2 -3
- package/dist/logger/format-timestamp.js +1 -2
- package/dist/logger/get-log-level.cjs +2 -3
- package/dist/logger/get-log-level.js +1 -2
- package/dist/logger/index.cjs +12 -13
- package/dist/logger/index.js +11 -12
- package/dist/logger/is-unicode-supported.cjs +2 -3
- package/dist/logger/is-unicode-supported.js +1 -2
- package/dist/types.cjs +0 -1
- package/dist/types.js +0 -1
- package/dist/utilities/apply-workspace-tokens.cjs +5 -6
- package/dist/utilities/apply-workspace-tokens.js +4 -5
- package/dist/utilities/correct-paths.cjs +2 -3
- package/dist/utilities/correct-paths.js +1 -2
- package/dist/utilities/file-path-utils.cjs +5 -3
- package/dist/utilities/file-path-utils.d.cts +42 -2
- package/dist/utilities/file-path-utils.d.ts +42 -2
- package/dist/utilities/file-path-utils.js +4 -2
- package/dist/utilities/find-up.cjs +2 -3
- package/dist/utilities/find-up.js +1 -2
- package/dist/utilities/find-workspace-root.cjs +4 -5
- package/dist/utilities/find-workspace-root.js +3 -4
- package/dist/utilities/get-default-config.cjs +5 -6
- package/dist/utilities/get-default-config.js +4 -5
- package/dist/utilities/index.cjs +17 -16
- package/dist/utilities/index.d.cts +1 -1
- package/dist/utilities/index.d.ts +1 -1
- package/dist/utilities/index.js +16 -15
- package/dist/utilities/process-handler.cjs +12 -13
- package/dist/utilities/process-handler.js +11 -12
- package/dist/utilities/run.cjs +2 -3
- package/dist/utilities/run.js +1 -2
- package/package.json +1 -1
- package/dist/chunk-75PQRIWX.js +0 -25
- package/dist/chunk-7DEX73IB.js +0 -36
- package/dist/chunk-HFKBN5GE.cjs +0 -118
- package/dist/chunk-IGUYFX5B.cjs +0 -12
- package/dist/chunk-SHUYVCID.js +0 -6
- package/dist/chunk-SIU3CSEY.cjs +0 -49
- package/dist/chunk-TKQCRNGC.js +0 -12
- package/dist/chunk-USNT2KNT.cjs +0 -6
- package/dist/chunk-VICC23NV.cjs +0 -36
- package/dist/chunk-VKTQOXWO.cjs +0 -39
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
findWorkspaceRoot
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-VLWSWYG7.js";
|
|
4
4
|
import {
|
|
5
5
|
joinPaths
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import {
|
|
8
|
-
__name
|
|
9
|
-
} from "./chunk-SHUYVCID.js";
|
|
6
|
+
} from "./chunk-FRR2ZRWD.js";
|
|
10
7
|
|
|
11
8
|
// src/utilities/get-default-config.ts
|
|
12
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
STORM_DEFAULT_HOMEPAGE,
|
|
11
|
+
STORM_DEFAULT_LICENSE
|
|
12
|
+
} from "@storm-software/config";
|
|
13
13
|
import { existsSync } from "node:fs";
|
|
14
14
|
import { readFile } from "node:fs/promises";
|
|
15
15
|
import { join } from "node:path";
|
|
@@ -41,7 +41,7 @@ var DEFAULT_COLOR_CONFIG = {
|
|
|
41
41
|
negative: "#dc2626"
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
|
-
var getDefaultConfig =
|
|
44
|
+
var getDefaultConfig = async (root) => {
|
|
45
45
|
let license = STORM_DEFAULT_LICENSE;
|
|
46
46
|
let homepage = STORM_DEFAULT_HOMEPAGE;
|
|
47
47
|
let name = void 0;
|
|
@@ -49,7 +49,10 @@ var getDefaultConfig = /* @__PURE__ */ __name(async (root) => {
|
|
|
49
49
|
let repository = void 0;
|
|
50
50
|
const workspaceRoot = findWorkspaceRoot(root);
|
|
51
51
|
if (existsSync(join(workspaceRoot, "package.json"))) {
|
|
52
|
-
const file = await readFile(
|
|
52
|
+
const file = await readFile(
|
|
53
|
+
joinPaths(workspaceRoot, "package.json"),
|
|
54
|
+
"utf8"
|
|
55
|
+
);
|
|
53
56
|
if (file) {
|
|
54
57
|
const packageJson = JSON.parse(file);
|
|
55
58
|
if (packageJson.name) {
|
|
@@ -86,7 +89,7 @@ var getDefaultConfig = /* @__PURE__ */ __name(async (root) => {
|
|
|
86
89
|
url: `${homepage || STORM_DEFAULT_HOMEPAGE}/errors`
|
|
87
90
|
}
|
|
88
91
|
};
|
|
89
|
-
}
|
|
92
|
+
};
|
|
90
93
|
|
|
91
94
|
export {
|
|
92
95
|
DEFAULT_COLOR_CONFIG,
|
|
@@ -0,0 +1,32 @@
|
|
|
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; }// src/logger/chalk.ts
|
|
2
|
+
var _chalk2 = require('chalk'); var _chalk3 = _interopRequireDefault(_chalk2);
|
|
3
|
+
var chalkDefault = {
|
|
4
|
+
hex: (_) => (message) => message,
|
|
5
|
+
bgHex: (_) => ({
|
|
6
|
+
whiteBright: (message) => message
|
|
7
|
+
}),
|
|
8
|
+
whiteBright: (message) => message,
|
|
9
|
+
gray: (message) => message,
|
|
10
|
+
bold: {
|
|
11
|
+
hex: (_) => (message) => message,
|
|
12
|
+
bgHex: (_) => ({
|
|
13
|
+
whiteBright: (message) => message
|
|
14
|
+
}),
|
|
15
|
+
whiteBright: (message) => message
|
|
16
|
+
},
|
|
17
|
+
dim: {
|
|
18
|
+
hex: (_) => (message) => message,
|
|
19
|
+
gray: (message) => message
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
var getChalk = () => {
|
|
23
|
+
let _chalk = _chalk3.default;
|
|
24
|
+
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])) {
|
|
25
|
+
_chalk = chalkDefault;
|
|
26
|
+
}
|
|
27
|
+
return _chalk;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
exports.getChalk = getChalk;
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isUnicodeSupported
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-R6A4VPC4.js";
|
|
4
4
|
import {
|
|
5
5
|
LogLevelLabel
|
|
6
6
|
} from "./chunk-3QAWRU2B.js";
|
|
7
|
-
import {
|
|
8
|
-
__name
|
|
9
|
-
} from "./chunk-SHUYVCID.js";
|
|
10
7
|
|
|
11
8
|
// src/logger/console-icons.ts
|
|
12
|
-
var useIcon =
|
|
9
|
+
var useIcon = (c, fallback) => isUnicodeSupported() ? c : fallback;
|
|
13
10
|
var CONSOLE_ICONS = {
|
|
14
11
|
[LogLevelLabel.ERROR]: useIcon("\u2718", "\xD7"),
|
|
15
12
|
[LogLevelLabel.FATAL]: useIcon("\u{1F480}", "\xD7"),
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true})
|
|
2
|
-
|
|
3
|
-
var _chunkUSNT2KNTcjs = require('./chunk-USNT2KNT.cjs');
|
|
4
|
-
|
|
5
|
-
// src/logger/is-unicode-supported.ts
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/logger/is-unicode-supported.ts
|
|
6
2
|
function isUnicodeSupported() {
|
|
7
3
|
if (process.platform !== "win32") {
|
|
8
4
|
return process.env.TERM !== "linux";
|
|
@@ -12,7 +8,6 @@ function isUnicodeSupported() {
|
|
|
12
8
|
process.env.ConEmuTask === "{cmd::Cmder}" || // ConEmu and cmder
|
|
13
9
|
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";
|
|
14
10
|
}
|
|
15
|
-
_chunkUSNT2KNTcjs.__name.call(void 0, isUnicodeSupported, "isUnicodeSupported");
|
|
16
11
|
|
|
17
12
|
|
|
18
13
|
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkPLLCZVZOcjs = require('./chunk-PLLCZVZO.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var _chunkC5OTFOQBcjs = require('./chunk-C5OTFOQB.cjs');
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
var _chunkUSNT2KNTcjs = require('./chunk-USNT2KNT.cjs');
|
|
10
|
-
|
|
11
8
|
// src/logger/console-icons.ts
|
|
12
|
-
var useIcon =
|
|
9
|
+
var useIcon = (c, fallback) => _chunkPLLCZVZOcjs.isUnicodeSupported.call(void 0, ) ? c : fallback;
|
|
13
10
|
var CONSOLE_ICONS = {
|
|
14
11
|
[_chunkC5OTFOQBcjs.LogLevelLabel.ERROR]: useIcon("\u2718", "\xD7"),
|
|
15
12
|
[_chunkC5OTFOQBcjs.LogLevelLabel.FATAL]: useIcon("\u{1F480}", "\xD7"),
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getLogFn,
|
|
3
3
|
getStopwatch
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-QJUAU656.js";
|
|
5
5
|
import {
|
|
6
6
|
findWorkspaceRoot
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-VLWSWYG7.js";
|
|
8
8
|
import {
|
|
9
9
|
LogLevel
|
|
10
10
|
} from "./chunk-3QAWRU2B.js";
|
|
11
|
-
import {
|
|
12
|
-
__name
|
|
13
|
-
} from "./chunk-SHUYVCID.js";
|
|
14
11
|
|
|
15
12
|
// src/logger/create-logger.ts
|
|
16
13
|
import chalk from "chalk";
|
|
@@ -37,7 +34,6 @@ async function createLogger(config) {
|
|
|
37
34
|
getStopwatch
|
|
38
35
|
};
|
|
39
36
|
}
|
|
40
|
-
__name(createLogger, "createLogger");
|
|
41
37
|
|
|
42
38
|
export {
|
|
43
39
|
createLogger
|
|
@@ -1,28 +1,25 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DEFAULT_COLOR_CONFIG
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-JX5NLB4S.js";
|
|
4
4
|
import {
|
|
5
5
|
getChalk
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-T3MUE32G.js";
|
|
7
7
|
import {
|
|
8
8
|
CONSOLE_ICONS
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-OJP4XIBV.js";
|
|
10
10
|
import {
|
|
11
11
|
formatTimestamp
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-XEZGYUS2.js";
|
|
13
13
|
import {
|
|
14
14
|
getLogLevel
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-4XRV4CVP.js";
|
|
16
16
|
import {
|
|
17
17
|
LogLevel,
|
|
18
18
|
LogLevelLabel
|
|
19
19
|
} from "./chunk-3QAWRU2B.js";
|
|
20
|
-
import {
|
|
21
|
-
__name
|
|
22
|
-
} from "./chunk-SHUYVCID.js";
|
|
23
20
|
|
|
24
21
|
// src/logger/console.ts
|
|
25
|
-
var getLogFn =
|
|
22
|
+
var getLogFn = (logLevel = LogLevel.INFO, config = {}, _chalk = getChalk()) => {
|
|
26
23
|
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;
|
|
27
24
|
const configLogLevel = config.logLevel || process.env.STORM_LOG_LEVEL || LogLevelLabel.INFO;
|
|
28
25
|
if (logLevel > getLogLevel(configLogLevel) || logLevel <= LogLevel.SILENT || getLogLevel(configLogLevel) <= LogLevel.SILENT) {
|
|
@@ -31,100 +28,120 @@ var getLogFn = /* @__PURE__ */ __name((logLevel = LogLevel.INFO, config = {}, _c
|
|
|
31
28
|
}
|
|
32
29
|
if (typeof logLevel === "number" && LogLevel.FATAL >= logLevel) {
|
|
33
30
|
return (message) => {
|
|
34
|
-
console.error(
|
|
31
|
+
console.error(
|
|
32
|
+
`
|
|
35
33
|
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.fatal ?? "#7d1a1a")(`[${CONSOLE_ICONS[LogLevelLabel.FATAL]} Fatal] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
36
|
-
`
|
|
34
|
+
`
|
|
35
|
+
);
|
|
37
36
|
};
|
|
38
37
|
}
|
|
39
38
|
if (typeof logLevel === "number" && LogLevel.ERROR >= logLevel) {
|
|
40
39
|
return (message) => {
|
|
41
|
-
console.error(
|
|
40
|
+
console.error(
|
|
41
|
+
`
|
|
42
42
|
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.danger ?? "#f85149")(`[${CONSOLE_ICONS[LogLevelLabel.ERROR]} Error] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
43
|
-
`
|
|
43
|
+
`
|
|
44
|
+
);
|
|
44
45
|
};
|
|
45
46
|
}
|
|
46
47
|
if (typeof logLevel === "number" && LogLevel.WARN >= logLevel) {
|
|
47
48
|
return (message) => {
|
|
48
|
-
console.warn(
|
|
49
|
+
console.warn(
|
|
50
|
+
`
|
|
49
51
|
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.warning ?? "#e3b341")(`[${CONSOLE_ICONS[LogLevelLabel.WARN]} Warn] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
50
|
-
`
|
|
52
|
+
`
|
|
53
|
+
);
|
|
51
54
|
};
|
|
52
55
|
}
|
|
53
56
|
if (typeof logLevel === "number" && LogLevel.SUCCESS >= logLevel) {
|
|
54
57
|
return (message) => {
|
|
55
|
-
console.info(
|
|
58
|
+
console.info(
|
|
59
|
+
`
|
|
56
60
|
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.success ?? "#56d364")(`[${CONSOLE_ICONS[LogLevelLabel.SUCCESS]} Success] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
57
|
-
`
|
|
61
|
+
`
|
|
62
|
+
);
|
|
58
63
|
};
|
|
59
64
|
}
|
|
60
65
|
if (typeof logLevel === "number" && LogLevel.INFO >= logLevel) {
|
|
61
66
|
return (message) => {
|
|
62
|
-
console.info(
|
|
67
|
+
console.info(
|
|
68
|
+
`
|
|
63
69
|
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.info ?? "#58a6ff")(`[${CONSOLE_ICONS[LogLevelLabel.INFO]} Info] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
64
|
-
`
|
|
70
|
+
`
|
|
71
|
+
);
|
|
65
72
|
};
|
|
66
73
|
}
|
|
67
74
|
if (typeof logLevel === "number" && LogLevel.DEBUG >= logLevel) {
|
|
68
75
|
return (message) => {
|
|
69
|
-
console.debug(
|
|
76
|
+
console.debug(
|
|
77
|
+
`
|
|
70
78
|
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.brand ?? "#1fb2a6")(`[${CONSOLE_ICONS[LogLevelLabel.DEBUG]} Debug] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
71
|
-
`
|
|
79
|
+
`
|
|
80
|
+
);
|
|
72
81
|
};
|
|
73
82
|
}
|
|
74
83
|
if (typeof logLevel === "number" && LogLevel.TRACE >= logLevel) {
|
|
75
84
|
return (message) => {
|
|
76
|
-
console.debug(
|
|
85
|
+
console.debug(
|
|
86
|
+
`
|
|
77
87
|
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.brand ?? "#1fb2a6")(`[${CONSOLE_ICONS[LogLevelLabel.TRACE]} Trace] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
78
|
-
`
|
|
88
|
+
`
|
|
89
|
+
);
|
|
79
90
|
};
|
|
80
91
|
}
|
|
81
92
|
return (message) => {
|
|
82
|
-
console.log(
|
|
93
|
+
console.log(
|
|
94
|
+
`
|
|
83
95
|
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.brand ?? "#1fb2a6")(`[${CONSOLE_ICONS[LogLevelLabel.ALL]} System] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
84
|
-
`
|
|
96
|
+
`
|
|
97
|
+
);
|
|
85
98
|
};
|
|
86
|
-
}
|
|
87
|
-
var writeFatal =
|
|
88
|
-
var writeError =
|
|
89
|
-
var writeWarning =
|
|
90
|
-
var writeInfo =
|
|
91
|
-
var writeSuccess =
|
|
92
|
-
var writeDebug =
|
|
93
|
-
var writeTrace =
|
|
94
|
-
var writeSystem =
|
|
95
|
-
var getStopwatch =
|
|
99
|
+
};
|
|
100
|
+
var writeFatal = (message, config) => getLogFn(LogLevel.FATAL, config)(message);
|
|
101
|
+
var writeError = (message, config) => getLogFn(LogLevel.ERROR, config)(message);
|
|
102
|
+
var writeWarning = (message, config) => getLogFn(LogLevel.WARN, config)(message);
|
|
103
|
+
var writeInfo = (message, config) => getLogFn(LogLevel.INFO, config)(message);
|
|
104
|
+
var writeSuccess = (message, config) => getLogFn(LogLevel.SUCCESS, config)(message);
|
|
105
|
+
var writeDebug = (message, config) => getLogFn(LogLevel.DEBUG, config)(message);
|
|
106
|
+
var writeTrace = (message, config) => getLogFn(LogLevel.TRACE, config)(message);
|
|
107
|
+
var writeSystem = (message, config) => getLogFn(LogLevel.ALL, config)(message);
|
|
108
|
+
var getStopwatch = (name) => {
|
|
96
109
|
const start = process.hrtime();
|
|
97
110
|
return () => {
|
|
98
111
|
const end = process.hrtime(start);
|
|
99
|
-
console.info(
|
|
100
|
-
|
|
101
|
-
`
|
|
112
|
+
console.info(
|
|
113
|
+
`
|
|
114
|
+
> \u23F1\uFE0F The${name ? ` ${name}` : ""} process took ${Math.round(
|
|
115
|
+
end[0] * 1e3 + end[1] / 1e6
|
|
116
|
+
)}ms to complete
|
|
117
|
+
`
|
|
118
|
+
);
|
|
102
119
|
};
|
|
103
|
-
}
|
|
120
|
+
};
|
|
104
121
|
var MAX_DEPTH = 4;
|
|
105
|
-
var formatLogMessage =
|
|
122
|
+
var formatLogMessage = (message, options = {}, depth = 0) => {
|
|
106
123
|
if (depth > MAX_DEPTH) {
|
|
107
124
|
return "<max depth>";
|
|
108
125
|
}
|
|
109
126
|
const prefix = options.prefix ?? "-";
|
|
110
127
|
const skip = options.skip ?? [];
|
|
111
128
|
return typeof message === "undefined" || message === null || !message && typeof message !== "boolean" ? "<none>" : typeof message === "string" ? message : Array.isArray(message) ? `
|
|
112
|
-
${message.map((item, index) => ` ${prefix}> #${index} = ${formatLogMessage(item, {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
var _isFunction =
|
|
129
|
+
${message.map((item, index) => ` ${prefix}> #${index} = ${formatLogMessage(item, { prefix: `${prefix}-`, skip }, depth + 1)}`).join("\n")}` : typeof message === "object" ? `
|
|
130
|
+
${Object.keys(message).filter((key) => !skip.includes(key)).map(
|
|
131
|
+
(key) => ` ${prefix}> ${key} = ${_isFunction(message[key]) ? "<function>" : typeof message[key] === "object" ? formatLogMessage(
|
|
132
|
+
message[key],
|
|
133
|
+
{ prefix: `${prefix}-`, skip },
|
|
134
|
+
depth + 1
|
|
135
|
+
) : message[key]}`
|
|
136
|
+
).join("\n")}` : message;
|
|
137
|
+
};
|
|
138
|
+
var _isFunction = (value) => {
|
|
122
139
|
try {
|
|
123
140
|
return value instanceof Function || typeof value === "function" || !!(value?.constructor && value?.call && value?.apply);
|
|
124
141
|
} catch (e) {
|
|
125
142
|
return false;
|
|
126
143
|
}
|
|
127
|
-
}
|
|
144
|
+
};
|
|
128
145
|
|
|
129
146
|
export {
|
|
130
147
|
getLogFn,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/logger/format-timestamp.ts
|
|
2
|
+
var formatTimestamp = (date = /* @__PURE__ */ new Date()) => {
|
|
3
|
+
return `${date.toLocaleDateString()} ${date.toLocaleTimeString()}`;
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
exports.formatTimestamp = formatTimestamp;
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__name
|
|
3
|
-
} from "./chunk-SHUYVCID.js";
|
|
4
|
-
|
|
5
1
|
// src/logger/is-unicode-supported.ts
|
|
6
2
|
function isUnicodeSupported() {
|
|
7
3
|
if (process.platform !== "win32") {
|
|
@@ -12,7 +8,6 @@ function isUnicodeSupported() {
|
|
|
12
8
|
process.env.ConEmuTask === "{cmd::Cmder}" || // ConEmu and cmder
|
|
13
9
|
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";
|
|
14
10
|
}
|
|
15
|
-
__name(isUnicodeSupported, "isUnicodeSupported");
|
|
16
11
|
|
|
17
12
|
export {
|
|
18
13
|
isUnicodeSupported
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
|
-
|
|
3
|
-
var _chunkUSNT2KNTcjs = require('./chunk-USNT2KNT.cjs');
|
|
4
|
-
|
|
5
|
-
// src/utilities/find-up.ts
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }// src/utilities/find-up.ts
|
|
6
2
|
var _fs = require('fs');
|
|
7
3
|
var _path = require('path');
|
|
8
4
|
var MAX_PATH_SEARCH_DEPTH = 30;
|
|
9
5
|
var depth = 0;
|
|
10
6
|
function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
|
|
11
7
|
const _startPath = _nullishCoalesce(startPath, () => ( process.cwd()));
|
|
12
|
-
if (endDirectoryNames.some(
|
|
8
|
+
if (endDirectoryNames.some(
|
|
9
|
+
(endDirName) => _fs.existsSync.call(void 0, _path.join.call(void 0, _startPath, endDirName))
|
|
10
|
+
)) {
|
|
13
11
|
return _startPath;
|
|
14
12
|
}
|
|
15
|
-
if (endFileNames.some(
|
|
13
|
+
if (endFileNames.some(
|
|
14
|
+
(endFileName) => _fs.existsSync.call(void 0, _path.join.call(void 0, _startPath, endFileName))
|
|
15
|
+
)) {
|
|
16
16
|
return _startPath;
|
|
17
17
|
}
|
|
18
18
|
if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
|
|
@@ -21,7 +21,6 @@ function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
|
|
|
21
21
|
}
|
|
22
22
|
return void 0;
|
|
23
23
|
}
|
|
24
|
-
_chunkUSNT2KNTcjs.__name.call(void 0, findFolderUp, "findFolderUp");
|
|
25
24
|
|
|
26
25
|
|
|
27
26
|
|
|
@@ -1,26 +1,30 @@
|
|
|
1
1
|
import {
|
|
2
2
|
correctPaths
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-FRR2ZRWD.js";
|
|
4
4
|
import {
|
|
5
5
|
getLogLevelLabel
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import {
|
|
8
|
-
__name
|
|
9
|
-
} from "./chunk-SHUYVCID.js";
|
|
6
|
+
} from "./chunk-4XRV4CVP.js";
|
|
10
7
|
|
|
11
8
|
// src/env/get-env.ts
|
|
12
|
-
import {
|
|
13
|
-
|
|
9
|
+
import {
|
|
10
|
+
COLOR_KEYS,
|
|
11
|
+
STORM_DEFAULT_DOCS,
|
|
12
|
+
STORM_DEFAULT_HOMEPAGE,
|
|
13
|
+
STORM_DEFAULT_LICENSING
|
|
14
|
+
} from "@storm-software/config";
|
|
15
|
+
var getExtensionEnv = (extensionName) => {
|
|
14
16
|
const prefix = `STORM_EXTENSION_${extensionName.toUpperCase()}_`;
|
|
15
17
|
return Object.keys(process.env).filter((key) => key.startsWith(prefix)).reduce((ret, key) => {
|
|
16
|
-
const name = key.replace(prefix, "").split("_").map(
|
|
18
|
+
const name = key.replace(prefix, "").split("_").map(
|
|
19
|
+
(i) => i.length > 0 ? i.trim().charAt(0).toUpperCase() + i.trim().slice(1) : ""
|
|
20
|
+
).join("");
|
|
17
21
|
if (name) {
|
|
18
22
|
ret[name] = process.env[key];
|
|
19
23
|
}
|
|
20
24
|
return ret;
|
|
21
25
|
}, {});
|
|
22
|
-
}
|
|
23
|
-
var getConfigEnv =
|
|
26
|
+
};
|
|
27
|
+
var getConfigEnv = () => {
|
|
24
28
|
const prefix = "STORM_";
|
|
25
29
|
let config = {
|
|
26
30
|
extends: process.env[`${prefix}EXTENDS`] || void 0,
|
|
@@ -88,14 +92,25 @@ var getConfigEnv = /* @__PURE__ */ __name(() => {
|
|
|
88
92
|
cyclone: process.env[`${prefix}REGISTRY_CYCLONE`] || void 0,
|
|
89
93
|
container: process.env[`${prefix}REGISTRY_CONTAINER`] || void 0
|
|
90
94
|
},
|
|
91
|
-
logLevel: process.env[`${prefix}LOG_LEVEL`] !== null && process.env[`${prefix}LOG_LEVEL`] !== void 0 ? process.env[`${prefix}LOG_LEVEL`] && Number.isSafeInteger(
|
|
95
|
+
logLevel: process.env[`${prefix}LOG_LEVEL`] !== null && process.env[`${prefix}LOG_LEVEL`] !== void 0 ? process.env[`${prefix}LOG_LEVEL`] && Number.isSafeInteger(
|
|
96
|
+
Number.parseInt(process.env[`${prefix}LOG_LEVEL`])
|
|
97
|
+
) ? getLogLevelLabel(
|
|
98
|
+
Number.parseInt(process.env[`${prefix}LOG_LEVEL`])
|
|
99
|
+
) : process.env[`${prefix}LOG_LEVEL`] : void 0,
|
|
92
100
|
skipConfigLogging: process.env[`${prefix}SKIP_CONFIG_LOGGING`] !== void 0 ? Boolean(process.env[`${prefix}SKIP_CONFIG_LOGGING`]) : void 0
|
|
93
101
|
};
|
|
94
|
-
const themeNames = Object.keys(process.env).filter(
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
102
|
+
const themeNames = Object.keys(process.env).filter(
|
|
103
|
+
(envKey) => envKey.startsWith(`${prefix}COLOR_`) && COLOR_KEYS.every(
|
|
104
|
+
(colorKey) => !envKey.startsWith(`${prefix}COLOR_LIGHT_${colorKey}`) && !envKey.startsWith(`${prefix}COLOR_DARK_${colorKey}`)
|
|
105
|
+
)
|
|
106
|
+
);
|
|
107
|
+
config.colors = themeNames.length > 0 ? themeNames.reduce(
|
|
108
|
+
(ret, themeName) => {
|
|
109
|
+
ret[themeName] = getThemeColorConfigEnv(prefix, themeName);
|
|
110
|
+
return ret;
|
|
111
|
+
},
|
|
112
|
+
{}
|
|
113
|
+
) : getThemeColorConfigEnv(prefix);
|
|
99
114
|
if (config.docs === STORM_DEFAULT_DOCS) {
|
|
100
115
|
if (config.homepage === STORM_DEFAULT_HOMEPAGE) {
|
|
101
116
|
config.docs = `${STORM_DEFAULT_HOMEPAGE}/projects/${config.name}/docs`;
|
|
@@ -116,23 +131,17 @@ var getConfigEnv = /* @__PURE__ */ __name(() => {
|
|
|
116
131
|
config = {
|
|
117
132
|
...config,
|
|
118
133
|
...parsed,
|
|
119
|
-
colors: {
|
|
120
|
-
|
|
121
|
-
...parsed.colors
|
|
122
|
-
},
|
|
123
|
-
extensions: {
|
|
124
|
-
...config.extensions,
|
|
125
|
-
...parsed.extensions
|
|
126
|
-
}
|
|
134
|
+
colors: { ...config.colors, ...parsed.colors },
|
|
135
|
+
extensions: { ...config.extensions, ...parsed.extensions }
|
|
127
136
|
};
|
|
128
137
|
}
|
|
129
138
|
return config;
|
|
130
|
-
}
|
|
131
|
-
var getThemeColorConfigEnv =
|
|
139
|
+
};
|
|
140
|
+
var getThemeColorConfigEnv = (prefix, theme) => {
|
|
132
141
|
const themeName = `COLOR_${theme && theme !== "base" ? `${theme}_` : ""}`.toUpperCase();
|
|
133
142
|
return process.env[`${prefix}${themeName}LIGHT_BRAND`] || process.env[`${prefix}${themeName}DARK_BRAND`] ? getMultiThemeColorConfigEnv(prefix + themeName) : getSingleThemeColorConfigEnv(prefix + themeName);
|
|
134
|
-
}
|
|
135
|
-
var getSingleThemeColorConfigEnv =
|
|
143
|
+
};
|
|
144
|
+
var getSingleThemeColorConfigEnv = (prefix) => {
|
|
136
145
|
return {
|
|
137
146
|
dark: process.env[`${prefix}DARK`],
|
|
138
147
|
light: process.env[`${prefix}LIGHT`],
|
|
@@ -149,14 +158,16 @@ var getSingleThemeColorConfigEnv = /* @__PURE__ */ __name((prefix) => {
|
|
|
149
158
|
positive: process.env[`${prefix}POSITIVE`],
|
|
150
159
|
negative: process.env[`${prefix}NEGATIVE`]
|
|
151
160
|
};
|
|
152
|
-
}
|
|
153
|
-
var getMultiThemeColorConfigEnv =
|
|
161
|
+
};
|
|
162
|
+
var getMultiThemeColorConfigEnv = (prefix) => {
|
|
154
163
|
return {
|
|
155
|
-
light: getBaseThemeColorConfigEnv(
|
|
164
|
+
light: getBaseThemeColorConfigEnv(
|
|
165
|
+
`${prefix}_LIGHT_`
|
|
166
|
+
),
|
|
156
167
|
dark: getBaseThemeColorConfigEnv(`${prefix}_DARK_`)
|
|
157
168
|
};
|
|
158
|
-
}
|
|
159
|
-
var getBaseThemeColorConfigEnv =
|
|
169
|
+
};
|
|
170
|
+
var getBaseThemeColorConfigEnv = (prefix) => {
|
|
160
171
|
return {
|
|
161
172
|
foreground: process.env[`${prefix}FOREGROUND`],
|
|
162
173
|
background: process.env[`${prefix}BACKGROUND`],
|
|
@@ -173,7 +184,7 @@ var getBaseThemeColorConfigEnv = /* @__PURE__ */ __name((prefix) => {
|
|
|
173
184
|
positive: process.env[`${prefix}POSITIVE`],
|
|
174
185
|
negative: process.env[`${prefix}NEGATIVE`]
|
|
175
186
|
};
|
|
176
|
-
}
|
|
187
|
+
};
|
|
177
188
|
|
|
178
189
|
export {
|
|
179
190
|
getExtensionEnv,
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__name
|
|
3
|
-
} from "./chunk-SHUYVCID.js";
|
|
4
|
-
|
|
5
1
|
// src/utilities/find-up.ts
|
|
6
2
|
import { existsSync } from "node:fs";
|
|
7
3
|
import { join } from "node:path";
|
|
@@ -9,10 +5,14 @@ var MAX_PATH_SEARCH_DEPTH = 30;
|
|
|
9
5
|
var depth = 0;
|
|
10
6
|
function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
|
|
11
7
|
const _startPath = startPath ?? process.cwd();
|
|
12
|
-
if (endDirectoryNames.some(
|
|
8
|
+
if (endDirectoryNames.some(
|
|
9
|
+
(endDirName) => existsSync(join(_startPath, endDirName))
|
|
10
|
+
)) {
|
|
13
11
|
return _startPath;
|
|
14
12
|
}
|
|
15
|
-
if (endFileNames.some(
|
|
13
|
+
if (endFileNames.some(
|
|
14
|
+
(endFileName) => existsSync(join(_startPath, endFileName))
|
|
15
|
+
)) {
|
|
16
16
|
return _startPath;
|
|
17
17
|
}
|
|
18
18
|
if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
|
|
@@ -21,7 +21,6 @@ function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
|
|
|
21
21
|
}
|
|
22
22
|
return void 0;
|
|
23
23
|
}
|
|
24
|
-
__name(findFolderUp, "findFolderUp");
|
|
25
24
|
|
|
26
25
|
export {
|
|
27
26
|
findFolderUp
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// src/logger/chalk.ts
|
|
2
|
+
import chalk from "chalk";
|
|
3
|
+
var chalkDefault = {
|
|
4
|
+
hex: (_) => (message) => message,
|
|
5
|
+
bgHex: (_) => ({
|
|
6
|
+
whiteBright: (message) => message
|
|
7
|
+
}),
|
|
8
|
+
whiteBright: (message) => message,
|
|
9
|
+
gray: (message) => message,
|
|
10
|
+
bold: {
|
|
11
|
+
hex: (_) => (message) => message,
|
|
12
|
+
bgHex: (_) => ({
|
|
13
|
+
whiteBright: (message) => message
|
|
14
|
+
}),
|
|
15
|
+
whiteBright: (message) => message
|
|
16
|
+
},
|
|
17
|
+
dim: {
|
|
18
|
+
hex: (_) => (message) => message,
|
|
19
|
+
gray: (message) => message
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
var getChalk = () => {
|
|
23
|
+
let _chalk = chalk;
|
|
24
|
+
if (!_chalk?.hex || !_chalk?.bold?.hex || !_chalk?.bgHex || !_chalk?.whiteBright) {
|
|
25
|
+
_chalk = chalkDefault;
|
|
26
|
+
}
|
|
27
|
+
return _chalk;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export {
|
|
31
|
+
getChalk
|
|
32
|
+
};
|