@storm-software/config-tools 1.171.2 → 1.171.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/chunk-5XVUNKW6.cjs +334 -0
- package/dist/chunk-BF3O7ON5.cjs +40 -0
- package/dist/chunk-BKQBZMGO.js +193 -0
- package/dist/chunk-DGCHLT3G.js +47 -0
- package/dist/chunk-E5XT5FVB.cjs +193 -0
- package/dist/chunk-FICRNYND.js +158 -0
- package/dist/chunk-HYLJGZJL.js +138 -0
- package/dist/chunk-JP33UHF2.cjs +158 -0
- package/dist/chunk-MFZ5PISG.cjs +40 -0
- package/dist/chunk-NUSRFW2L.cjs +138 -0
- package/dist/chunk-OMZZPRFS.js +55 -0
- package/dist/chunk-T4YF5J4D.js +92 -0
- package/dist/chunk-TCSDVRRN.js +334 -0
- package/dist/chunk-VV7JCH26.cjs +92 -0
- package/dist/chunk-X5KVMDMC.js +40 -0
- package/dist/chunk-XU52ZWXV.cjs +47 -0
- package/dist/chunk-YKHRNVKI.cjs +55 -0
- package/dist/chunk-ZBGGXYLG.js +40 -0
- package/dist/config-file/get-config-file.cjs +11 -11
- package/dist/config-file/get-config-file.js +10 -10
- package/dist/config-file/index.cjs +11 -11
- package/dist/config-file/index.js +10 -10
- package/dist/create-storm-config.cjs +14 -14
- package/dist/create-storm-config.js +13 -13
- package/dist/env/get-env.cjs +3 -3
- package/dist/env/get-env.js +2 -2
- package/dist/env/index.cjs +4 -4
- package/dist/env/index.js +6 -6
- package/dist/env/set-env.cjs +3 -3
- package/dist/env/set-env.js +2 -2
- package/dist/get-config.cjs +15 -15
- package/dist/get-config.js +14 -14
- package/dist/index.cjs +27 -27
- package/dist/index.js +42 -42
- package/dist/logger/console.cjs +5 -5
- package/dist/logger/console.js +4 -4
- package/dist/logger/create-logger.cjs +6 -6
- package/dist/logger/create-logger.js +5 -5
- package/dist/logger/index.cjs +11 -11
- package/dist/logger/index.js +11 -11
- package/dist/utilities/index.cjs +15 -15
- package/dist/utilities/index.js +19 -19
- package/dist/utilities/process-handler.cjs +6 -6
- package/dist/utilities/process-handler.js +5 -5
- package/dist/utilities/toml.cjs +7 -7
- package/dist/utilities/toml.js +6 -6
- package/package.json +2 -2
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
|
+
|
|
3
|
+
var _chunk7BZWQZUVcjs = require('./chunk-7BZWQZUV.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunk4JREL2GQcjs = require('./chunk-4JREL2GQ.cjs');
|
|
7
|
+
|
|
8
|
+
// src/env/get-env.ts
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
var _config = require('@storm-software/config');
|
|
15
|
+
var getExtensionEnv = (extensionName) => {
|
|
16
|
+
const prefix = `STORM_EXTENSION_${extensionName.toUpperCase()}_`;
|
|
17
|
+
return Object.keys(process.env).filter((key) => key.startsWith(prefix)).reduce((ret, key) => {
|
|
18
|
+
const name = key.replace(prefix, "").split("_").map(
|
|
19
|
+
(i) => i.length > 0 ? i.trim().charAt(0).toUpperCase() + i.trim().slice(1) : ""
|
|
20
|
+
).join("");
|
|
21
|
+
if (name) {
|
|
22
|
+
ret[name] = process.env[key];
|
|
23
|
+
}
|
|
24
|
+
return ret;
|
|
25
|
+
}, {});
|
|
26
|
+
};
|
|
27
|
+
var getConfigEnv = () => {
|
|
28
|
+
const prefix = "STORM_";
|
|
29
|
+
let config = {
|
|
30
|
+
extends: process.env[`${prefix}EXTENDS`] || void 0,
|
|
31
|
+
name: process.env[`${prefix}NAME`] || void 0,
|
|
32
|
+
namespace: process.env[`${prefix}NAMESPACE`] || void 0,
|
|
33
|
+
owner: process.env[`${prefix}OWNER`] || void 0,
|
|
34
|
+
bot: {
|
|
35
|
+
name: process.env[`${prefix}BOT_NAME`] || void 0,
|
|
36
|
+
email: process.env[`${prefix}BOT_EMAIL`] || void 0
|
|
37
|
+
},
|
|
38
|
+
release: {
|
|
39
|
+
banner: process.env[`${prefix}RELEASE_BANNER`] || void 0,
|
|
40
|
+
header: process.env[`${prefix}RELEASE_HEADER`] || void 0,
|
|
41
|
+
footer: process.env[`${prefix}RELEASE_FOOTER`] || void 0
|
|
42
|
+
},
|
|
43
|
+
error: {
|
|
44
|
+
codesFile: process.env[`${prefix}ERROR_CODES_FILE`] || void 0,
|
|
45
|
+
url: process.env[`${prefix}ERROR_URL`] || void 0
|
|
46
|
+
},
|
|
47
|
+
account: {
|
|
48
|
+
twitter: process.env[`${prefix}ACCOUNT_TWITTER`] || void 0,
|
|
49
|
+
discord: process.env[`${prefix}ACCOUNT_DISCORD`] || void 0,
|
|
50
|
+
telegram: process.env[`${prefix}ACCOUNT_TELEGRAM`] || void 0,
|
|
51
|
+
slack: process.env[`${prefix}ACCOUNT_SLACK`] || void 0,
|
|
52
|
+
medium: process.env[`${prefix}ACCOUNT_MEDIUM`] || void 0,
|
|
53
|
+
github: process.env[`${prefix}ACCOUNT_GITHUB`] || void 0
|
|
54
|
+
},
|
|
55
|
+
organization: process.env[`${prefix}ORGANIZATION`] || void 0,
|
|
56
|
+
packageManager: process.env[`${prefix}PACKAGE_MANAGER`] || void 0,
|
|
57
|
+
license: process.env[`${prefix}LICENSE`] || void 0,
|
|
58
|
+
homepage: process.env[`${prefix}HOMEPAGE`] || void 0,
|
|
59
|
+
docs: process.env[`${prefix}DOCS`] || void 0,
|
|
60
|
+
licensing: process.env[`${prefix}LICENSING`] || void 0,
|
|
61
|
+
contact: process.env[`${prefix}CONTACT`] || void 0,
|
|
62
|
+
support: process.env[`${prefix}SUPPORT`] || void 0,
|
|
63
|
+
timezone: process.env[`${prefix}TIMEZONE`] || process.env.TZ || void 0,
|
|
64
|
+
locale: process.env[`${prefix}LOCALE`] || process.env.LOCALE || void 0,
|
|
65
|
+
configFile: process.env[`${prefix}CONFIG_FILE`] ? _chunk4JREL2GQcjs.correctPaths.call(void 0, process.env[`${prefix}CONFIG_FILE`]) : void 0,
|
|
66
|
+
workspaceRoot: process.env[`${prefix}WORKSPACE_ROOT`] ? _chunk4JREL2GQcjs.correctPaths.call(void 0, process.env[`${prefix}WORKSPACE_ROOT`]) : void 0,
|
|
67
|
+
directories: {
|
|
68
|
+
cache: process.env[`${prefix}CACHE_DIR`] ? _chunk4JREL2GQcjs.correctPaths.call(void 0, process.env[`${prefix}CACHE_DIR`]) : process.env[`${prefix}CACHE_DIRECTORY`] ? _chunk4JREL2GQcjs.correctPaths.call(void 0, process.env[`${prefix}CACHE_DIRECTORY`]) : void 0,
|
|
69
|
+
data: process.env[`${prefix}DATA_DIR`] ? _chunk4JREL2GQcjs.correctPaths.call(void 0, process.env[`${prefix}DATA_DIR`]) : process.env[`${prefix}DATA_DIRECTORY`] ? _chunk4JREL2GQcjs.correctPaths.call(void 0, process.env[`${prefix}DATA_DIRECTORY`]) : void 0,
|
|
70
|
+
config: process.env[`${prefix}CONFIG_DIR`] ? _chunk4JREL2GQcjs.correctPaths.call(void 0, process.env[`${prefix}CONFIG_DIR`]) : process.env[`${prefix}CONFIG_DIRECTORY`] ? _chunk4JREL2GQcjs.correctPaths.call(void 0, process.env[`${prefix}CONFIG_DIRECTORY`]) : void 0,
|
|
71
|
+
temp: process.env[`${prefix}TEMP_DIR`] ? _chunk4JREL2GQcjs.correctPaths.call(void 0, process.env[`${prefix}TEMP_DIR`]) : process.env[`${prefix}TEMP_DIRECTORY`] ? _chunk4JREL2GQcjs.correctPaths.call(void 0, process.env[`${prefix}TEMP_DIRECTORY`]) : void 0,
|
|
72
|
+
log: process.env[`${prefix}LOG_DIR`] ? _chunk4JREL2GQcjs.correctPaths.call(void 0, process.env[`${prefix}LOG_DIR`]) : process.env[`${prefix}LOG_DIRECTORY`] ? _chunk4JREL2GQcjs.correctPaths.call(void 0, process.env[`${prefix}LOG_DIRECTORY`]) : void 0,
|
|
73
|
+
build: process.env[`${prefix}BUILD_DIR`] ? _chunk4JREL2GQcjs.correctPaths.call(void 0, process.env[`${prefix}BUILD_DIR`]) : process.env[`${prefix}BUILD_DIRECTORY`] ? _chunk4JREL2GQcjs.correctPaths.call(void 0, process.env[`${prefix}BUILD_DIRECTORY`]) : void 0
|
|
74
|
+
},
|
|
75
|
+
skipCache: process.env[`${prefix}SKIP_CACHE`] !== void 0 ? Boolean(process.env[`${prefix}SKIP_CACHE`]) : void 0,
|
|
76
|
+
mode: (_nullishCoalesce(_nullishCoalesce(process.env[`${prefix}MODE`], () => ( process.env.NODE_ENV)), () => ( process.env.ENVIRONMENT))) || void 0,
|
|
77
|
+
// ci:
|
|
78
|
+
// process.env[`${prefix}CI`] !== undefined
|
|
79
|
+
// ? Boolean(
|
|
80
|
+
// process.env[`${prefix}CI`] ??
|
|
81
|
+
// process.env.CI ??
|
|
82
|
+
// process.env.CONTINUOUS_INTEGRATION
|
|
83
|
+
// )
|
|
84
|
+
// : undefined,
|
|
85
|
+
repository: process.env[`${prefix}REPOSITORY`] || void 0,
|
|
86
|
+
branch: process.env[`${prefix}BRANCH`] || void 0,
|
|
87
|
+
preid: process.env[`${prefix}PRE_ID`] || void 0,
|
|
88
|
+
externalPackagePatterns: process.env[`${prefix}EXTERNAL_PACKAGE_PATTERNS`] ? JSON.parse(process.env[`${prefix}EXTERNAL_PACKAGE_PATTERNS`]) : [],
|
|
89
|
+
registry: {
|
|
90
|
+
github: process.env[`${prefix}REGISTRY_GITHUB`] || void 0,
|
|
91
|
+
npm: process.env[`${prefix}REGISTRY_NPM`] || void 0,
|
|
92
|
+
cargo: process.env[`${prefix}REGISTRY_CARGO`] || void 0,
|
|
93
|
+
cyclone: process.env[`${prefix}REGISTRY_CYCLONE`] || void 0,
|
|
94
|
+
container: process.env[`${prefix}REGISTRY_CONTAINER`] || void 0
|
|
95
|
+
},
|
|
96
|
+
logLevel: process.env[`${prefix}LOG_LEVEL`] !== null && process.env[`${prefix}LOG_LEVEL`] !== void 0 ? process.env[`${prefix}LOG_LEVEL`] && Number.isSafeInteger(
|
|
97
|
+
Number.parseInt(process.env[`${prefix}LOG_LEVEL`])
|
|
98
|
+
) ? _chunk7BZWQZUVcjs.getLogLevelLabel.call(void 0,
|
|
99
|
+
Number.parseInt(process.env[`${prefix}LOG_LEVEL`])
|
|
100
|
+
) : process.env[`${prefix}LOG_LEVEL`] : void 0,
|
|
101
|
+
skipConfigLogging: process.env[`${prefix}SKIP_CONFIG_LOGGING`] !== void 0 ? Boolean(process.env[`${prefix}SKIP_CONFIG_LOGGING`]) : void 0
|
|
102
|
+
};
|
|
103
|
+
const themeNames = Object.keys(process.env).filter(
|
|
104
|
+
(envKey) => envKey.startsWith(`${prefix}COLOR_`) && _config.COLOR_KEYS.every(
|
|
105
|
+
(colorKey) => !envKey.startsWith(`${prefix}COLOR_LIGHT_${colorKey}`) && !envKey.startsWith(`${prefix}COLOR_DARK_${colorKey}`)
|
|
106
|
+
)
|
|
107
|
+
);
|
|
108
|
+
config.colors = themeNames.length > 0 ? themeNames.reduce(
|
|
109
|
+
(ret, themeName) => {
|
|
110
|
+
ret[themeName] = getThemeColorConfigEnv(prefix, themeName);
|
|
111
|
+
return ret;
|
|
112
|
+
},
|
|
113
|
+
{}
|
|
114
|
+
) : getThemeColorConfigEnv(prefix);
|
|
115
|
+
if (config.docs === _config.STORM_DEFAULT_DOCS) {
|
|
116
|
+
if (config.homepage === _config.STORM_DEFAULT_HOMEPAGE) {
|
|
117
|
+
config.docs = `${_config.STORM_DEFAULT_HOMEPAGE}/projects/${config.name}/docs`;
|
|
118
|
+
} else {
|
|
119
|
+
config.docs = `${config.homepage}/docs`;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
if (config.licensing === _config.STORM_DEFAULT_LICENSING) {
|
|
123
|
+
if (config.homepage === _config.STORM_DEFAULT_HOMEPAGE) {
|
|
124
|
+
config.licensing = `${_config.STORM_DEFAULT_HOMEPAGE}/projects/${config.name}/licensing`;
|
|
125
|
+
} else {
|
|
126
|
+
config.licensing = `${config.homepage}/docs`;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
const serializedConfig = process.env[`${prefix}CONFIG`];
|
|
130
|
+
if (serializedConfig) {
|
|
131
|
+
const parsed = JSON.parse(serializedConfig);
|
|
132
|
+
config = {
|
|
133
|
+
...config,
|
|
134
|
+
...parsed,
|
|
135
|
+
colors: { ...config.colors, ...parsed.colors },
|
|
136
|
+
extensions: { ...config.extensions, ...parsed.extensions }
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
return config;
|
|
140
|
+
};
|
|
141
|
+
var getThemeColorConfigEnv = (prefix, theme) => {
|
|
142
|
+
const themeName = `COLOR_${theme && theme !== "base" ? `${theme}_` : ""}`.toUpperCase();
|
|
143
|
+
return process.env[`${prefix}${themeName}LIGHT_BRAND`] || process.env[`${prefix}${themeName}DARK_BRAND`] ? getMultiThemeColorConfigEnv(prefix + themeName) : getSingleThemeColorConfigEnv(prefix + themeName);
|
|
144
|
+
};
|
|
145
|
+
var getSingleThemeColorConfigEnv = (prefix) => {
|
|
146
|
+
return {
|
|
147
|
+
dark: process.env[`${prefix}DARK`],
|
|
148
|
+
light: process.env[`${prefix}LIGHT`],
|
|
149
|
+
brand: process.env[`${prefix}BRAND`],
|
|
150
|
+
alternate: process.env[`${prefix}ALTERNATE`],
|
|
151
|
+
accent: process.env[`${prefix}ACCENT`],
|
|
152
|
+
link: process.env[`${prefix}LINK`],
|
|
153
|
+
help: process.env[`${prefix}HELP`],
|
|
154
|
+
success: process.env[`${prefix}SUCCESS`],
|
|
155
|
+
info: process.env[`${prefix}INFO`],
|
|
156
|
+
warning: process.env[`${prefix}WARNING`],
|
|
157
|
+
danger: process.env[`${prefix}DANGER`],
|
|
158
|
+
fatal: process.env[`${prefix}FATAL`],
|
|
159
|
+
positive: process.env[`${prefix}POSITIVE`],
|
|
160
|
+
negative: process.env[`${prefix}NEGATIVE`]
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
var getMultiThemeColorConfigEnv = (prefix) => {
|
|
164
|
+
return {
|
|
165
|
+
light: getBaseThemeColorConfigEnv(
|
|
166
|
+
`${prefix}_LIGHT_`
|
|
167
|
+
),
|
|
168
|
+
dark: getBaseThemeColorConfigEnv(`${prefix}_DARK_`)
|
|
169
|
+
};
|
|
170
|
+
};
|
|
171
|
+
var getBaseThemeColorConfigEnv = (prefix) => {
|
|
172
|
+
return {
|
|
173
|
+
foreground: process.env[`${prefix}FOREGROUND`],
|
|
174
|
+
background: process.env[`${prefix}BACKGROUND`],
|
|
175
|
+
brand: process.env[`${prefix}BRAND`],
|
|
176
|
+
alternate: process.env[`${prefix}ALTERNATE`],
|
|
177
|
+
accent: process.env[`${prefix}ACCENT`],
|
|
178
|
+
link: process.env[`${prefix}LINK`],
|
|
179
|
+
help: process.env[`${prefix}HELP`],
|
|
180
|
+
success: process.env[`${prefix}SUCCESS`],
|
|
181
|
+
info: process.env[`${prefix}INFO`],
|
|
182
|
+
warning: process.env[`${prefix}WARNING`],
|
|
183
|
+
danger: process.env[`${prefix}DANGER`],
|
|
184
|
+
fatal: process.env[`${prefix}FATAL`],
|
|
185
|
+
positive: process.env[`${prefix}POSITIVE`],
|
|
186
|
+
negative: process.env[`${prefix}NEGATIVE`]
|
|
187
|
+
};
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
exports.getExtensionEnv = getExtensionEnv; exports.getConfigEnv = getConfigEnv;
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_COLOR_CONFIG
|
|
3
|
+
} from "./chunk-4KZ3BMNG.js";
|
|
4
|
+
import {
|
|
5
|
+
formatTimestamp
|
|
6
|
+
} from "./chunk-XEZGYUS2.js";
|
|
7
|
+
import {
|
|
8
|
+
getLogLevel
|
|
9
|
+
} from "./chunk-4XRV4CVP.js";
|
|
10
|
+
import {
|
|
11
|
+
getChalk
|
|
12
|
+
} from "./chunk-T3MUE32G.js";
|
|
13
|
+
import {
|
|
14
|
+
CONSOLE_ICONS
|
|
15
|
+
} from "./chunk-OJP4XIBV.js";
|
|
16
|
+
import {
|
|
17
|
+
LogLevel,
|
|
18
|
+
LogLevelLabel
|
|
19
|
+
} from "./chunk-3QAWRU2B.js";
|
|
20
|
+
|
|
21
|
+
// src/logger/console.ts
|
|
22
|
+
var getLogFn = (logLevel = LogLevel.INFO, config = {}, _chalk = getChalk()) => {
|
|
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;
|
|
24
|
+
const configLogLevel = config.logLevel || process.env.STORM_LOG_LEVEL || LogLevelLabel.INFO;
|
|
25
|
+
if (logLevel > getLogLevel(configLogLevel) || logLevel <= LogLevel.SILENT || getLogLevel(configLogLevel) <= LogLevel.SILENT) {
|
|
26
|
+
return (_) => {
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
if (typeof logLevel === "number" && LogLevel.FATAL >= logLevel) {
|
|
30
|
+
return (message) => {
|
|
31
|
+
console.error(
|
|
32
|
+
`
|
|
33
|
+
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.fatal ?? "#7d1a1a")(`[${CONSOLE_ICONS[LogLevelLabel.FATAL]} Fatal] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
34
|
+
`
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
if (typeof logLevel === "number" && LogLevel.ERROR >= logLevel) {
|
|
39
|
+
return (message) => {
|
|
40
|
+
console.error(
|
|
41
|
+
`
|
|
42
|
+
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.danger ?? "#f85149")(`[${CONSOLE_ICONS[LogLevelLabel.ERROR]} Error] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
43
|
+
`
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
if (typeof logLevel === "number" && LogLevel.WARN >= logLevel) {
|
|
48
|
+
return (message) => {
|
|
49
|
+
console.warn(
|
|
50
|
+
`
|
|
51
|
+
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.warning ?? "#e3b341")(`[${CONSOLE_ICONS[LogLevelLabel.WARN]} Warn] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
52
|
+
`
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
if (typeof logLevel === "number" && LogLevel.SUCCESS >= logLevel) {
|
|
57
|
+
return (message) => {
|
|
58
|
+
console.info(
|
|
59
|
+
`
|
|
60
|
+
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.success ?? "#56d364")(`[${CONSOLE_ICONS[LogLevelLabel.SUCCESS]} Success] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
61
|
+
`
|
|
62
|
+
);
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
if (typeof logLevel === "number" && LogLevel.INFO >= logLevel) {
|
|
66
|
+
return (message) => {
|
|
67
|
+
console.info(
|
|
68
|
+
`
|
|
69
|
+
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.info ?? "#58a6ff")(`[${CONSOLE_ICONS[LogLevelLabel.INFO]} Info] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
70
|
+
`
|
|
71
|
+
);
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
if (typeof logLevel === "number" && LogLevel.DEBUG >= logLevel) {
|
|
75
|
+
return (message) => {
|
|
76
|
+
console.debug(
|
|
77
|
+
`
|
|
78
|
+
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.brand ?? "#1fb2a6")(`[${CONSOLE_ICONS[LogLevelLabel.DEBUG]} Debug] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
79
|
+
`
|
|
80
|
+
);
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
if (typeof logLevel === "number" && LogLevel.TRACE >= logLevel) {
|
|
84
|
+
return (message) => {
|
|
85
|
+
console.debug(
|
|
86
|
+
`
|
|
87
|
+
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.brand ?? "#1fb2a6")(`[${CONSOLE_ICONS[LogLevelLabel.TRACE]} Trace] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
88
|
+
`
|
|
89
|
+
);
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
return (message) => {
|
|
93
|
+
console.log(
|
|
94
|
+
`
|
|
95
|
+
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.brand ?? "#1fb2a6")(`[${CONSOLE_ICONS[LogLevelLabel.ALL]} System] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
96
|
+
`
|
|
97
|
+
);
|
|
98
|
+
};
|
|
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) => {
|
|
109
|
+
const start = process.hrtime();
|
|
110
|
+
return () => {
|
|
111
|
+
const end = process.hrtime(start);
|
|
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
|
+
);
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
var MAX_DEPTH = 4;
|
|
122
|
+
var formatLogMessage = (message, options = {}, depth = 0) => {
|
|
123
|
+
if (depth > MAX_DEPTH) {
|
|
124
|
+
return "<max depth>";
|
|
125
|
+
}
|
|
126
|
+
const prefix = options.prefix ?? "-";
|
|
127
|
+
const skip = options.skip ?? [];
|
|
128
|
+
return typeof message === "undefined" || message === null || !message && typeof message !== "boolean" ? "<none>" : typeof message === "string" ? message : Array.isArray(message) ? `
|
|
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) => {
|
|
139
|
+
try {
|
|
140
|
+
return value instanceof Function || typeof value === "function" || !!(value?.constructor && value?.call && value?.apply);
|
|
141
|
+
} catch (e) {
|
|
142
|
+
return false;
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
export {
|
|
147
|
+
getLogFn,
|
|
148
|
+
writeFatal,
|
|
149
|
+
writeError,
|
|
150
|
+
writeWarning,
|
|
151
|
+
writeInfo,
|
|
152
|
+
writeSuccess,
|
|
153
|
+
writeDebug,
|
|
154
|
+
writeTrace,
|
|
155
|
+
writeSystem,
|
|
156
|
+
getStopwatch,
|
|
157
|
+
formatLogMessage
|
|
158
|
+
};
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getConfigEnv,
|
|
3
|
+
getExtensionEnv
|
|
4
|
+
} from "./chunk-BKQBZMGO.js";
|
|
5
|
+
import {
|
|
6
|
+
setConfigEnv
|
|
7
|
+
} from "./chunk-TCSDVRRN.js";
|
|
8
|
+
import {
|
|
9
|
+
getConfigFile
|
|
10
|
+
} from "./chunk-T4YF5J4D.js";
|
|
11
|
+
import {
|
|
12
|
+
formatLogMessage,
|
|
13
|
+
writeTrace,
|
|
14
|
+
writeWarning
|
|
15
|
+
} from "./chunk-FICRNYND.js";
|
|
16
|
+
import {
|
|
17
|
+
applyDefaultConfig,
|
|
18
|
+
getPackageJsonConfig
|
|
19
|
+
} from "./chunk-4KZ3BMNG.js";
|
|
20
|
+
import {
|
|
21
|
+
findWorkspaceRoot
|
|
22
|
+
} from "./chunk-VLWSWYG7.js";
|
|
23
|
+
|
|
24
|
+
// src/create-storm-config.ts
|
|
25
|
+
import { stormWorkspaceConfigSchema } from "@storm-software/config/schema";
|
|
26
|
+
import defu from "defu";
|
|
27
|
+
var _extension_cache = /* @__PURE__ */ new WeakMap();
|
|
28
|
+
var _static_cache = void 0;
|
|
29
|
+
var createStormWorkspaceConfig = async (extensionName, schema, workspaceRoot, skipLogs = false, useDefault = true) => {
|
|
30
|
+
let result;
|
|
31
|
+
if (!_static_cache?.data || !_static_cache?.timestamp || _static_cache.timestamp < Date.now() - 8e3) {
|
|
32
|
+
let _workspaceRoot = workspaceRoot;
|
|
33
|
+
if (!_workspaceRoot) {
|
|
34
|
+
_workspaceRoot = findWorkspaceRoot();
|
|
35
|
+
}
|
|
36
|
+
const configEnv = getConfigEnv();
|
|
37
|
+
const configFile = await getConfigFile(_workspaceRoot);
|
|
38
|
+
if (!configFile) {
|
|
39
|
+
if (!skipLogs) {
|
|
40
|
+
writeWarning(
|
|
41
|
+
"No Storm Workspace configuration file found in the current repository. Please ensure this is the expected behavior - you can add a `storm-workspace.json` file to the root of your workspace if it is not.\n",
|
|
42
|
+
{ logLevel: "all" }
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
if (useDefault === false) {
|
|
46
|
+
return void 0;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
const defaultConfig = await getPackageJsonConfig(_workspaceRoot);
|
|
50
|
+
result = applyDefaultConfig(
|
|
51
|
+
await stormWorkspaceConfigSchema.parseAsync(
|
|
52
|
+
defu(configEnv, configFile, defaultConfig)
|
|
53
|
+
)
|
|
54
|
+
);
|
|
55
|
+
result.workspaceRoot ??= _workspaceRoot;
|
|
56
|
+
} else {
|
|
57
|
+
result = _static_cache.data;
|
|
58
|
+
}
|
|
59
|
+
if (schema && extensionName) {
|
|
60
|
+
result.extensions = {
|
|
61
|
+
...result.extensions,
|
|
62
|
+
[extensionName]: createConfigExtension(extensionName, schema)
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
_static_cache = {
|
|
66
|
+
timestamp: Date.now(),
|
|
67
|
+
data: result
|
|
68
|
+
};
|
|
69
|
+
return result;
|
|
70
|
+
};
|
|
71
|
+
var createConfigExtension = (extensionName, schema) => {
|
|
72
|
+
const extension_cache_key = { extensionName };
|
|
73
|
+
if (_extension_cache.has(extension_cache_key)) {
|
|
74
|
+
return _extension_cache.get(extension_cache_key);
|
|
75
|
+
}
|
|
76
|
+
let extension = getExtensionEnv(extensionName);
|
|
77
|
+
if (schema) {
|
|
78
|
+
extension = schema.parse(extension);
|
|
79
|
+
}
|
|
80
|
+
_extension_cache.set(extension_cache_key, extension);
|
|
81
|
+
return extension;
|
|
82
|
+
};
|
|
83
|
+
var loadStormWorkspaceConfig = async (workspaceRoot, skipLogs = false) => {
|
|
84
|
+
const config = await createStormWorkspaceConfig(
|
|
85
|
+
void 0,
|
|
86
|
+
void 0,
|
|
87
|
+
workspaceRoot,
|
|
88
|
+
skipLogs,
|
|
89
|
+
true
|
|
90
|
+
);
|
|
91
|
+
setConfigEnv(config);
|
|
92
|
+
if (!skipLogs && !config.skipConfigLogging) {
|
|
93
|
+
writeTrace(
|
|
94
|
+
`\u2699\uFE0F Using Storm Workspace configuration:
|
|
95
|
+
${formatLogMessage(config)}`,
|
|
96
|
+
config
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
return config;
|
|
100
|
+
};
|
|
101
|
+
var tryLoadStormWorkspaceConfig = async (workspaceRoot, skipLogs = true, useDefault = false) => {
|
|
102
|
+
try {
|
|
103
|
+
const config = await createStormWorkspaceConfig(
|
|
104
|
+
void 0,
|
|
105
|
+
void 0,
|
|
106
|
+
workspaceRoot,
|
|
107
|
+
skipLogs,
|
|
108
|
+
useDefault
|
|
109
|
+
);
|
|
110
|
+
if (!config) {
|
|
111
|
+
return void 0;
|
|
112
|
+
}
|
|
113
|
+
setConfigEnv(config);
|
|
114
|
+
if (!skipLogs && !config.skipConfigLogging) {
|
|
115
|
+
writeTrace(
|
|
116
|
+
`\u2699\uFE0F Using Storm Workspace configuration:
|
|
117
|
+
${formatLogMessage(config)}`,
|
|
118
|
+
config
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
return config;
|
|
122
|
+
} catch (error) {
|
|
123
|
+
if (!skipLogs) {
|
|
124
|
+
writeWarning(
|
|
125
|
+
`\u26A0\uFE0F Failed to load Storm Workspace configuration: ${error}`,
|
|
126
|
+
{ logLevel: "all" }
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
return void 0;
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
export {
|
|
134
|
+
createStormWorkspaceConfig,
|
|
135
|
+
createConfigExtension,
|
|
136
|
+
loadStormWorkspaceConfig,
|
|
137
|
+
tryLoadStormWorkspaceConfig
|
|
138
|
+
};
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
+
|
|
3
|
+
var _chunk4PAEA5KVcjs = require('./chunk-4PAEA5KV.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkQNDF3RQLcjs = require('./chunk-QNDF3RQL.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _chunk7BZWQZUVcjs = require('./chunk-7BZWQZUV.cjs');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
var _chunkNS5PJ2RMcjs = require('./chunk-NS5PJ2RM.cjs');
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
var _chunkPSHJQ2NPcjs = require('./chunk-PSHJQ2NP.cjs');
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
var _chunkC5OTFOQBcjs = require('./chunk-C5OTFOQB.cjs');
|
|
20
|
+
|
|
21
|
+
// src/logger/console.ts
|
|
22
|
+
var getLogFn = (logLevel = _chunkC5OTFOQBcjs.LogLevel.INFO, config = {}, _chalk = _chunkNS5PJ2RMcjs.getChalk.call(void 0, )) => {
|
|
23
|
+
const colors = !_optionalChain([config, 'access', _2 => _2.colors, 'optionalAccess', _3 => _3.dark]) && !_optionalChain([config, 'access', _4 => _4.colors, 'optionalAccess', _5 => _5["base"]]) && !_optionalChain([config, 'access', _6 => _6.colors, 'optionalAccess', _7 => _7["base"], 'optionalAccess', _8 => _8.dark]) ? _chunk4PAEA5KVcjs.DEFAULT_COLOR_CONFIG : _optionalChain([config, 'access', _9 => _9.colors, 'optionalAccess', _10 => _10.dark]) && typeof config.colors.dark === "string" ? config.colors : _optionalChain([config, 'access', _11 => _11.colors, 'optionalAccess', _12 => _12["base"], 'optionalAccess', _13 => _13.dark]) && typeof config.colors["base"].dark === "string" ? config.colors["base"].dark : _optionalChain([config, 'access', _14 => _14.colors, 'optionalAccess', _15 => _15["base"]]) ? _optionalChain([config, 'access', _16 => _16.colors, 'optionalAccess', _17 => _17["base"]]) : _chunk4PAEA5KVcjs.DEFAULT_COLOR_CONFIG;
|
|
24
|
+
const configLogLevel = config.logLevel || process.env.STORM_LOG_LEVEL || _chunkC5OTFOQBcjs.LogLevelLabel.INFO;
|
|
25
|
+
if (logLevel > _chunk7BZWQZUVcjs.getLogLevel.call(void 0, configLogLevel) || logLevel <= _chunkC5OTFOQBcjs.LogLevel.SILENT || _chunk7BZWQZUVcjs.getLogLevel.call(void 0, configLogLevel) <= _chunkC5OTFOQBcjs.LogLevel.SILENT) {
|
|
26
|
+
return (_) => {
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
if (typeof logLevel === "number" && _chunkC5OTFOQBcjs.LogLevel.FATAL >= logLevel) {
|
|
30
|
+
return (message) => {
|
|
31
|
+
console.error(
|
|
32
|
+
`
|
|
33
|
+
${_chalk.gray(_chunkQNDF3RQLcjs.formatTimestamp.call(void 0, ))} ${_chalk.hex(_nullishCoalesce(colors.fatal, () => ( "#7d1a1a")))(`[${_chunkPSHJQ2NPcjs.CONSOLE_ICONS[_chunkC5OTFOQBcjs.LogLevelLabel.FATAL]} Fatal] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
34
|
+
`
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
if (typeof logLevel === "number" && _chunkC5OTFOQBcjs.LogLevel.ERROR >= logLevel) {
|
|
39
|
+
return (message) => {
|
|
40
|
+
console.error(
|
|
41
|
+
`
|
|
42
|
+
${_chalk.gray(_chunkQNDF3RQLcjs.formatTimestamp.call(void 0, ))} ${_chalk.hex(_nullishCoalesce(colors.danger, () => ( "#f85149")))(`[${_chunkPSHJQ2NPcjs.CONSOLE_ICONS[_chunkC5OTFOQBcjs.LogLevelLabel.ERROR]} Error] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
43
|
+
`
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
if (typeof logLevel === "number" && _chunkC5OTFOQBcjs.LogLevel.WARN >= logLevel) {
|
|
48
|
+
return (message) => {
|
|
49
|
+
console.warn(
|
|
50
|
+
`
|
|
51
|
+
${_chalk.gray(_chunkQNDF3RQLcjs.formatTimestamp.call(void 0, ))} ${_chalk.hex(_nullishCoalesce(colors.warning, () => ( "#e3b341")))(`[${_chunkPSHJQ2NPcjs.CONSOLE_ICONS[_chunkC5OTFOQBcjs.LogLevelLabel.WARN]} Warn] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
52
|
+
`
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
if (typeof logLevel === "number" && _chunkC5OTFOQBcjs.LogLevel.SUCCESS >= logLevel) {
|
|
57
|
+
return (message) => {
|
|
58
|
+
console.info(
|
|
59
|
+
`
|
|
60
|
+
${_chalk.gray(_chunkQNDF3RQLcjs.formatTimestamp.call(void 0, ))} ${_chalk.hex(_nullishCoalesce(colors.success, () => ( "#56d364")))(`[${_chunkPSHJQ2NPcjs.CONSOLE_ICONS[_chunkC5OTFOQBcjs.LogLevelLabel.SUCCESS]} Success] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
61
|
+
`
|
|
62
|
+
);
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
if (typeof logLevel === "number" && _chunkC5OTFOQBcjs.LogLevel.INFO >= logLevel) {
|
|
66
|
+
return (message) => {
|
|
67
|
+
console.info(
|
|
68
|
+
`
|
|
69
|
+
${_chalk.gray(_chunkQNDF3RQLcjs.formatTimestamp.call(void 0, ))} ${_chalk.hex(_nullishCoalesce(colors.info, () => ( "#58a6ff")))(`[${_chunkPSHJQ2NPcjs.CONSOLE_ICONS[_chunkC5OTFOQBcjs.LogLevelLabel.INFO]} Info] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
70
|
+
`
|
|
71
|
+
);
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
if (typeof logLevel === "number" && _chunkC5OTFOQBcjs.LogLevel.DEBUG >= logLevel) {
|
|
75
|
+
return (message) => {
|
|
76
|
+
console.debug(
|
|
77
|
+
`
|
|
78
|
+
${_chalk.gray(_chunkQNDF3RQLcjs.formatTimestamp.call(void 0, ))} ${_chalk.hex(_nullishCoalesce(colors.brand, () => ( "#1fb2a6")))(`[${_chunkPSHJQ2NPcjs.CONSOLE_ICONS[_chunkC5OTFOQBcjs.LogLevelLabel.DEBUG]} Debug] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
79
|
+
`
|
|
80
|
+
);
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
if (typeof logLevel === "number" && _chunkC5OTFOQBcjs.LogLevel.TRACE >= logLevel) {
|
|
84
|
+
return (message) => {
|
|
85
|
+
console.debug(
|
|
86
|
+
`
|
|
87
|
+
${_chalk.gray(_chunkQNDF3RQLcjs.formatTimestamp.call(void 0, ))} ${_chalk.hex(_nullishCoalesce(colors.brand, () => ( "#1fb2a6")))(`[${_chunkPSHJQ2NPcjs.CONSOLE_ICONS[_chunkC5OTFOQBcjs.LogLevelLabel.TRACE]} Trace] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
88
|
+
`
|
|
89
|
+
);
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
return (message) => {
|
|
93
|
+
console.log(
|
|
94
|
+
`
|
|
95
|
+
${_chalk.gray(_chunkQNDF3RQLcjs.formatTimestamp.call(void 0, ))} ${_chalk.hex(_nullishCoalesce(colors.brand, () => ( "#1fb2a6")))(`[${_chunkPSHJQ2NPcjs.CONSOLE_ICONS[_chunkC5OTFOQBcjs.LogLevelLabel.ALL]} System] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
96
|
+
`
|
|
97
|
+
);
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
var writeFatal = (message, config) => getLogFn(_chunkC5OTFOQBcjs.LogLevel.FATAL, config)(message);
|
|
101
|
+
var writeError = (message, config) => getLogFn(_chunkC5OTFOQBcjs.LogLevel.ERROR, config)(message);
|
|
102
|
+
var writeWarning = (message, config) => getLogFn(_chunkC5OTFOQBcjs.LogLevel.WARN, config)(message);
|
|
103
|
+
var writeInfo = (message, config) => getLogFn(_chunkC5OTFOQBcjs.LogLevel.INFO, config)(message);
|
|
104
|
+
var writeSuccess = (message, config) => getLogFn(_chunkC5OTFOQBcjs.LogLevel.SUCCESS, config)(message);
|
|
105
|
+
var writeDebug = (message, config) => getLogFn(_chunkC5OTFOQBcjs.LogLevel.DEBUG, config)(message);
|
|
106
|
+
var writeTrace = (message, config) => getLogFn(_chunkC5OTFOQBcjs.LogLevel.TRACE, config)(message);
|
|
107
|
+
var writeSystem = (message, config) => getLogFn(_chunkC5OTFOQBcjs.LogLevel.ALL, config)(message);
|
|
108
|
+
var getStopwatch = (name) => {
|
|
109
|
+
const start = process.hrtime();
|
|
110
|
+
return () => {
|
|
111
|
+
const end = process.hrtime(start);
|
|
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
|
+
);
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
var MAX_DEPTH = 4;
|
|
122
|
+
var formatLogMessage = (message, options = {}, depth = 0) => {
|
|
123
|
+
if (depth > MAX_DEPTH) {
|
|
124
|
+
return "<max depth>";
|
|
125
|
+
}
|
|
126
|
+
const prefix = _nullishCoalesce(options.prefix, () => ( "-"));
|
|
127
|
+
const skip = _nullishCoalesce(options.skip, () => ( []));
|
|
128
|
+
return typeof message === "undefined" || message === null || !message && typeof message !== "boolean" ? "<none>" : typeof message === "string" ? message : Array.isArray(message) ? `
|
|
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) => {
|
|
139
|
+
try {
|
|
140
|
+
return value instanceof Function || typeof value === "function" || !!(_optionalChain([value, 'optionalAccess', _18 => _18.constructor]) && _optionalChain([value, 'optionalAccess', _19 => _19.call]) && _optionalChain([value, 'optionalAccess', _20 => _20.apply]));
|
|
141
|
+
} catch (e) {
|
|
142
|
+
return false;
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
exports.getLogFn = getLogFn; exports.writeFatal = writeFatal; exports.writeError = writeError; exports.writeWarning = writeWarning; exports.writeInfo = writeInfo; exports.writeSuccess = writeSuccess; exports.writeDebug = writeDebug; exports.writeTrace = writeTrace; exports.writeSystem = writeSystem; exports.getStopwatch = getStopwatch; exports.formatLogMessage = formatLogMessage;
|