@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,130 +1,147 @@
|
|
|
1
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
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkGIXUQACBcjs = require('./chunk-GIXUQACB.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkNS5PJ2RMcjs = require('./chunk-NS5PJ2RM.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkPSHJQ2NPcjs = require('./chunk-PSHJQ2NP.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkQNDF3RQLcjs = require('./chunk-QNDF3RQL.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var _chunk7BZWQZUVcjs = require('./chunk-7BZWQZUV.cjs');
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
var _chunkC5OTFOQBcjs = require('./chunk-C5OTFOQB.cjs');
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
var _chunkUSNT2KNTcjs = require('./chunk-USNT2KNT.cjs');
|
|
23
|
-
|
|
24
21
|
// src/logger/console.ts
|
|
25
|
-
var getLogFn =
|
|
26
|
-
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]) ?
|
|
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]) ? _chunkGIXUQACBcjs.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"]]) : _chunkGIXUQACBcjs.DEFAULT_COLOR_CONFIG;
|
|
27
24
|
const configLogLevel = config.logLevel || process.env.STORM_LOG_LEVEL || _chunkC5OTFOQBcjs.LogLevelLabel.INFO;
|
|
28
|
-
if (logLevel >
|
|
25
|
+
if (logLevel > _chunk7BZWQZUVcjs.getLogLevel.call(void 0, configLogLevel) || logLevel <= _chunkC5OTFOQBcjs.LogLevel.SILENT || _chunk7BZWQZUVcjs.getLogLevel.call(void 0, configLogLevel) <= _chunkC5OTFOQBcjs.LogLevel.SILENT) {
|
|
29
26
|
return (_) => {
|
|
30
27
|
};
|
|
31
28
|
}
|
|
32
29
|
if (typeof logLevel === "number" && _chunkC5OTFOQBcjs.LogLevel.FATAL >= logLevel) {
|
|
33
30
|
return (message) => {
|
|
34
|
-
console.error(
|
|
35
|
-
|
|
36
|
-
`)
|
|
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
|
+
);
|
|
37
36
|
};
|
|
38
37
|
}
|
|
39
38
|
if (typeof logLevel === "number" && _chunkC5OTFOQBcjs.LogLevel.ERROR >= logLevel) {
|
|
40
39
|
return (message) => {
|
|
41
|
-
console.error(
|
|
42
|
-
|
|
43
|
-
`)
|
|
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
|
+
);
|
|
44
45
|
};
|
|
45
46
|
}
|
|
46
47
|
if (typeof logLevel === "number" && _chunkC5OTFOQBcjs.LogLevel.WARN >= logLevel) {
|
|
47
48
|
return (message) => {
|
|
48
|
-
console.warn(
|
|
49
|
-
|
|
50
|
-
`)
|
|
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
|
+
);
|
|
51
54
|
};
|
|
52
55
|
}
|
|
53
56
|
if (typeof logLevel === "number" && _chunkC5OTFOQBcjs.LogLevel.SUCCESS >= logLevel) {
|
|
54
57
|
return (message) => {
|
|
55
|
-
console.info(
|
|
56
|
-
|
|
57
|
-
`)
|
|
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
|
+
);
|
|
58
63
|
};
|
|
59
64
|
}
|
|
60
65
|
if (typeof logLevel === "number" && _chunkC5OTFOQBcjs.LogLevel.INFO >= logLevel) {
|
|
61
66
|
return (message) => {
|
|
62
|
-
console.info(
|
|
63
|
-
|
|
64
|
-
`)
|
|
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
|
+
);
|
|
65
72
|
};
|
|
66
73
|
}
|
|
67
74
|
if (typeof logLevel === "number" && _chunkC5OTFOQBcjs.LogLevel.DEBUG >= logLevel) {
|
|
68
75
|
return (message) => {
|
|
69
|
-
console.debug(
|
|
70
|
-
|
|
71
|
-
`)
|
|
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
|
+
);
|
|
72
81
|
};
|
|
73
82
|
}
|
|
74
83
|
if (typeof logLevel === "number" && _chunkC5OTFOQBcjs.LogLevel.TRACE >= logLevel) {
|
|
75
84
|
return (message) => {
|
|
76
|
-
console.debug(
|
|
77
|
-
|
|
78
|
-
`)
|
|
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
|
+
);
|
|
79
90
|
};
|
|
80
91
|
}
|
|
81
92
|
return (message) => {
|
|
82
|
-
console.log(
|
|
83
|
-
|
|
84
|
-
`)
|
|
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
|
+
);
|
|
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(_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) => {
|
|
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 = _nullishCoalesce(options.prefix, () => ( "-"));
|
|
110
127
|
const skip = _nullishCoalesce(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" || !!(_optionalChain([value, 'optionalAccess', _18 => _18.constructor]) && _optionalChain([value, 'optionalAccess', _19 => _19.call]) && _optionalChain([value, 'optionalAccess', _20 => _20.apply]));
|
|
124
141
|
} catch (e) {
|
|
125
142
|
return false;
|
|
126
143
|
}
|
|
127
|
-
}
|
|
144
|
+
};
|
|
128
145
|
|
|
129
146
|
|
|
130
147
|
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkRKGXITNBcjs = require('./chunk-RKGXITNB.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var _chunkUSNT2KNTcjs = require('./chunk-USNT2KNT.cjs');
|
|
6
|
+
var _chunk4JREL2GQcjs = require('./chunk-4JREL2GQ.cjs');
|
|
10
7
|
|
|
11
8
|
// src/utilities/find-workspace-root.ts
|
|
12
9
|
var rootFiles = [
|
|
@@ -53,21 +50,31 @@ var rootDirectories = [
|
|
|
53
50
|
];
|
|
54
51
|
function findWorkspaceRootSafe(pathInsideMonorepo) {
|
|
55
52
|
if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
|
|
56
|
-
return
|
|
53
|
+
return _chunk4JREL2GQcjs.correctPaths.call(void 0,
|
|
54
|
+
_nullishCoalesce(process.env.STORM_WORKSPACE_ROOT, () => ( process.env.NX_WORKSPACE_ROOT_PATH))
|
|
55
|
+
);
|
|
57
56
|
}
|
|
58
|
-
return
|
|
57
|
+
return _chunk4JREL2GQcjs.correctPaths.call(void 0,
|
|
58
|
+
_chunkRKGXITNBcjs.findFolderUp.call(void 0,
|
|
59
|
+
_nullishCoalesce(pathInsideMonorepo, () => ( process.cwd())),
|
|
60
|
+
rootFiles,
|
|
61
|
+
rootDirectories
|
|
62
|
+
)
|
|
63
|
+
);
|
|
59
64
|
}
|
|
60
|
-
_chunkUSNT2KNTcjs.__name.call(void 0, findWorkspaceRootSafe, "findWorkspaceRootSafe");
|
|
61
65
|
function findWorkspaceRoot(pathInsideMonorepo) {
|
|
62
66
|
const result = findWorkspaceRootSafe(pathInsideMonorepo);
|
|
63
67
|
if (!result) {
|
|
64
|
-
throw new Error(
|
|
65
|
-
|
|
66
|
-
|
|
68
|
+
throw new Error(
|
|
69
|
+
`Cannot find workspace root upwards from known path. Files search list includes:
|
|
70
|
+
${rootFiles.join(
|
|
71
|
+
"\n"
|
|
72
|
+
)}
|
|
73
|
+
Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`
|
|
74
|
+
);
|
|
67
75
|
}
|
|
68
76
|
return result;
|
|
69
77
|
}
|
|
70
|
-
_chunkUSNT2KNTcjs.__name.call(void 0, findWorkspaceRoot, "findWorkspaceRoot");
|
|
71
78
|
|
|
72
79
|
|
|
73
80
|
|
|
@@ -1,12 +1,9 @@
|
|
|
1
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
2
|
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var _chunkUSNT2KNTcjs = require('./chunk-USNT2KNT.cjs');
|
|
3
|
+
var _chunkAEZINHEAcjs = require('./chunk-AEZINHEA.cjs');
|
|
7
4
|
|
|
8
5
|
// src/utilities/apply-workspace-tokens.ts
|
|
9
|
-
var applyWorkspaceBaseTokens =
|
|
6
|
+
var applyWorkspaceBaseTokens = async (option, tokenParams) => {
|
|
10
7
|
let result = option;
|
|
11
8
|
if (!result) {
|
|
12
9
|
return result;
|
|
@@ -16,7 +13,10 @@ var applyWorkspaceBaseTokens = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(voi
|
|
|
16
13
|
if (optionKeys.some((optionKey) => result.includes(`{${optionKey}}`))) {
|
|
17
14
|
for (const optionKey of optionKeys) {
|
|
18
15
|
if (result.includes(`{${optionKey}}`)) {
|
|
19
|
-
result = result.replaceAll(
|
|
16
|
+
result = result.replaceAll(
|
|
17
|
+
`{${optionKey}}`,
|
|
18
|
+
_optionalChain([tokenParams, 'optionalAccess', _ => _[optionKey]]) || ""
|
|
19
|
+
);
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -26,37 +26,53 @@ var applyWorkspaceBaseTokens = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(voi
|
|
|
26
26
|
if (configKeys.some((configKey) => result.includes(`{${configKey}}`))) {
|
|
27
27
|
for (const configKey of configKeys) {
|
|
28
28
|
if (result.includes(`{${configKey}}`)) {
|
|
29
|
-
result = result.replaceAll(
|
|
29
|
+
result = result.replaceAll(
|
|
30
|
+
`{${configKey}}`,
|
|
31
|
+
tokenParams.config[configKey] || ""
|
|
32
|
+
);
|
|
30
33
|
}
|
|
31
34
|
}
|
|
32
35
|
}
|
|
33
36
|
}
|
|
34
37
|
if (result.includes("{workspaceRoot}")) {
|
|
35
|
-
result = result.replaceAll(
|
|
38
|
+
result = result.replaceAll(
|
|
39
|
+
"{workspaceRoot}",
|
|
40
|
+
_nullishCoalesce(_nullishCoalesce(tokenParams.workspaceRoot, () => ( _optionalChain([tokenParams, 'access', _2 => _2.config, 'optionalAccess', _3 => _3.workspaceRoot]))), () => ( _chunkAEZINHEAcjs.findWorkspaceRoot.call(void 0, )))
|
|
41
|
+
);
|
|
36
42
|
}
|
|
37
43
|
return result;
|
|
38
|
-
}
|
|
39
|
-
var applyWorkspaceProjectTokens =
|
|
44
|
+
};
|
|
45
|
+
var applyWorkspaceProjectTokens = (option, tokenParams) => {
|
|
40
46
|
return applyWorkspaceBaseTokens(option, tokenParams);
|
|
41
|
-
}
|
|
42
|
-
var applyWorkspaceTokens =
|
|
47
|
+
};
|
|
48
|
+
var applyWorkspaceTokens = async (options, tokenParams, tokenizerFn) => {
|
|
43
49
|
if (!options) {
|
|
44
50
|
return {};
|
|
45
51
|
}
|
|
46
52
|
const result = {};
|
|
47
53
|
for (const option of Object.keys(options)) {
|
|
48
54
|
if (typeof options[option] === "string") {
|
|
49
|
-
result[option] = await Promise.resolve(
|
|
55
|
+
result[option] = await Promise.resolve(
|
|
56
|
+
tokenizerFn(options[option], tokenParams)
|
|
57
|
+
);
|
|
50
58
|
} else if (Array.isArray(options[option])) {
|
|
51
|
-
result[option] = await Promise.all(
|
|
59
|
+
result[option] = await Promise.all(
|
|
60
|
+
options[option].map(
|
|
61
|
+
async (item) => typeof item === "string" ? await Promise.resolve(tokenizerFn(item, tokenParams)) : item
|
|
62
|
+
)
|
|
63
|
+
);
|
|
52
64
|
} else if (typeof options[option] === "object") {
|
|
53
|
-
result[option] = await applyWorkspaceTokens(
|
|
65
|
+
result[option] = await applyWorkspaceTokens(
|
|
66
|
+
options[option],
|
|
67
|
+
tokenParams,
|
|
68
|
+
tokenizerFn
|
|
69
|
+
);
|
|
54
70
|
} else {
|
|
55
71
|
result[option] = options[option];
|
|
56
72
|
}
|
|
57
73
|
}
|
|
58
74
|
return result;
|
|
59
|
-
}
|
|
75
|
+
};
|
|
60
76
|
|
|
61
77
|
|
|
62
78
|
|
|
@@ -1,36 +1,37 @@
|
|
|
1
1
|
import {
|
|
2
2
|
loadStormWorkspaceConfig,
|
|
3
3
|
tryLoadStormWorkspaceConfig
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-WITKEKZ5.js";
|
|
5
5
|
import {
|
|
6
6
|
findWorkspaceRoot
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import {
|
|
9
|
-
__name
|
|
10
|
-
} from "./chunk-SHUYVCID.js";
|
|
7
|
+
} from "./chunk-VLWSWYG7.js";
|
|
11
8
|
|
|
12
9
|
// src/get-config.ts
|
|
13
|
-
var getConfig =
|
|
10
|
+
var getConfig = (workspaceRoot, skipLogs = false) => {
|
|
14
11
|
return loadStormWorkspaceConfig(workspaceRoot, skipLogs);
|
|
15
|
-
}
|
|
16
|
-
var getWorkspaceConfig =
|
|
12
|
+
};
|
|
13
|
+
var getWorkspaceConfig = (skipLogs = false, options = {}) => {
|
|
17
14
|
let workspaceRoot = options.workspaceRoot;
|
|
18
15
|
if (!workspaceRoot) {
|
|
19
16
|
workspaceRoot = findWorkspaceRoot(options.cwd);
|
|
20
17
|
}
|
|
21
18
|
return getConfig(workspaceRoot, skipLogs);
|
|
22
|
-
}
|
|
23
|
-
var tryGetWorkspaceConfig =
|
|
19
|
+
};
|
|
20
|
+
var tryGetWorkspaceConfig = async (skipLogs = false, options = {}) => {
|
|
24
21
|
try {
|
|
25
22
|
let workspaceRoot = options.workspaceRoot;
|
|
26
23
|
if (!workspaceRoot) {
|
|
27
24
|
workspaceRoot = findWorkspaceRoot(options.cwd);
|
|
28
25
|
}
|
|
29
|
-
return tryLoadStormWorkspaceConfig(
|
|
26
|
+
return tryLoadStormWorkspaceConfig(
|
|
27
|
+
workspaceRoot,
|
|
28
|
+
skipLogs,
|
|
29
|
+
options.useDefault
|
|
30
|
+
);
|
|
30
31
|
} catch {
|
|
31
32
|
return void 0;
|
|
32
33
|
}
|
|
33
|
-
}
|
|
34
|
+
};
|
|
34
35
|
|
|
35
36
|
export {
|
|
36
37
|
getConfig,
|
|
@@ -0,0 +1,135 @@
|
|
|
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; }
|
|
2
|
+
|
|
3
|
+
var _chunk7HCUD67Dcjs = require('./chunk-7HCUD67D.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
var _chunk7SIKKF62cjs = require('./chunk-7SIKKF62.cjs');
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
var _chunkGIXUQACBcjs = require('./chunk-GIXUQACB.cjs');
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
var _chunkAEZINHEAcjs = require('./chunk-AEZINHEA.cjs');
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
var _chunkH425P7G5cjs = require('./chunk-H425P7G5.cjs');
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
var _chunk56NGBR4Scjs = require('./chunk-56NGBR4S.cjs');
|
|
22
|
+
|
|
23
|
+
// src/create-storm-config.ts
|
|
24
|
+
var _schema = require('@storm-software/config/schema');
|
|
25
|
+
var _defu = require('defu'); var _defu2 = _interopRequireDefault(_defu);
|
|
26
|
+
var _extension_cache = /* @__PURE__ */ new WeakMap();
|
|
27
|
+
var _static_cache = void 0;
|
|
28
|
+
var createStormWorkspaceConfig = async (extensionName, schema, workspaceRoot, skipLogs = false, useDefault = true) => {
|
|
29
|
+
let result;
|
|
30
|
+
if (!_optionalChain([_static_cache, 'optionalAccess', _ => _.data]) || !_optionalChain([_static_cache, 'optionalAccess', _2 => _2.timestamp]) || _static_cache.timestamp < Date.now() - 8e3) {
|
|
31
|
+
let _workspaceRoot = workspaceRoot;
|
|
32
|
+
if (!_workspaceRoot) {
|
|
33
|
+
_workspaceRoot = _chunkAEZINHEAcjs.findWorkspaceRoot.call(void 0, );
|
|
34
|
+
}
|
|
35
|
+
const configEnv = _chunk56NGBR4Scjs.getConfigEnv.call(void 0, );
|
|
36
|
+
const configFile = await _chunk7HCUD67Dcjs.getConfigFile.call(void 0, _workspaceRoot);
|
|
37
|
+
if (!configFile) {
|
|
38
|
+
if (!skipLogs) {
|
|
39
|
+
_chunk7SIKKF62cjs.writeWarning.call(void 0,
|
|
40
|
+
"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",
|
|
41
|
+
{ logLevel: "all" }
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
if (useDefault === false) {
|
|
45
|
+
return void 0;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const defaultConfig = await _chunkGIXUQACBcjs.getDefaultConfig.call(void 0, _workspaceRoot);
|
|
49
|
+
result = await _schema.stormWorkspaceConfigSchema.parseAsync(
|
|
50
|
+
_defu2.default.call(void 0, configEnv, configFile, defaultConfig)
|
|
51
|
+
);
|
|
52
|
+
result.workspaceRoot ??= _workspaceRoot;
|
|
53
|
+
} else {
|
|
54
|
+
result = _static_cache.data;
|
|
55
|
+
}
|
|
56
|
+
if (schema && extensionName) {
|
|
57
|
+
result.extensions = {
|
|
58
|
+
...result.extensions,
|
|
59
|
+
[extensionName]: createConfigExtension(extensionName, schema)
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
_static_cache = {
|
|
63
|
+
timestamp: Date.now(),
|
|
64
|
+
data: result
|
|
65
|
+
};
|
|
66
|
+
return result;
|
|
67
|
+
};
|
|
68
|
+
var createConfigExtension = (extensionName, schema) => {
|
|
69
|
+
const extension_cache_key = { extensionName };
|
|
70
|
+
if (_extension_cache.has(extension_cache_key)) {
|
|
71
|
+
return _extension_cache.get(extension_cache_key);
|
|
72
|
+
}
|
|
73
|
+
let extension = _chunk56NGBR4Scjs.getExtensionEnv.call(void 0, extensionName);
|
|
74
|
+
if (schema) {
|
|
75
|
+
extension = schema.parse(extension);
|
|
76
|
+
}
|
|
77
|
+
_extension_cache.set(extension_cache_key, extension);
|
|
78
|
+
return extension;
|
|
79
|
+
};
|
|
80
|
+
var loadStormWorkspaceConfig = async (workspaceRoot, skipLogs = false) => {
|
|
81
|
+
const config = await createStormWorkspaceConfig(
|
|
82
|
+
void 0,
|
|
83
|
+
void 0,
|
|
84
|
+
workspaceRoot,
|
|
85
|
+
skipLogs,
|
|
86
|
+
true
|
|
87
|
+
);
|
|
88
|
+
_chunkH425P7G5cjs.setConfigEnv.call(void 0, config);
|
|
89
|
+
if (!skipLogs && !config.skipConfigLogging) {
|
|
90
|
+
_chunk7SIKKF62cjs.writeTrace.call(void 0,
|
|
91
|
+
`\u2699\uFE0F Using Storm Workspace configuration:
|
|
92
|
+
${_chunk7SIKKF62cjs.formatLogMessage.call(void 0, config)}`,
|
|
93
|
+
config
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
return config;
|
|
97
|
+
};
|
|
98
|
+
var tryLoadStormWorkspaceConfig = async (workspaceRoot, skipLogs = true, useDefault = false) => {
|
|
99
|
+
try {
|
|
100
|
+
const config = await createStormWorkspaceConfig(
|
|
101
|
+
void 0,
|
|
102
|
+
void 0,
|
|
103
|
+
workspaceRoot,
|
|
104
|
+
skipLogs,
|
|
105
|
+
useDefault
|
|
106
|
+
);
|
|
107
|
+
if (!config) {
|
|
108
|
+
return void 0;
|
|
109
|
+
}
|
|
110
|
+
_chunkH425P7G5cjs.setConfigEnv.call(void 0, config);
|
|
111
|
+
if (!skipLogs && !config.skipConfigLogging) {
|
|
112
|
+
_chunk7SIKKF62cjs.writeTrace.call(void 0,
|
|
113
|
+
`\u2699\uFE0F Using Storm Workspace configuration:
|
|
114
|
+
${_chunk7SIKKF62cjs.formatLogMessage.call(void 0, config)}`,
|
|
115
|
+
config
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
return config;
|
|
119
|
+
} catch (error) {
|
|
120
|
+
if (!skipLogs) {
|
|
121
|
+
_chunk7SIKKF62cjs.writeWarning.call(void 0,
|
|
122
|
+
`\u26A0\uFE0F Failed to load Storm Workspace configuration: ${error}`,
|
|
123
|
+
{ logLevel: "all" }
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
return void 0;
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
exports.createStormWorkspaceConfig = createStormWorkspaceConfig; exports.createConfigExtension = createConfigExtension; exports.loadStormWorkspaceConfig = loadStormWorkspaceConfig; exports.tryLoadStormWorkspaceConfig = tryLoadStormWorkspaceConfig;
|
|
@@ -3,29 +3,35 @@ import {
|
|
|
3
3
|
writeFatal,
|
|
4
4
|
writeSuccess,
|
|
5
5
|
writeTrace
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import {
|
|
8
|
-
__name
|
|
9
|
-
} from "./chunk-SHUYVCID.js";
|
|
6
|
+
} from "./chunk-QJUAU656.js";
|
|
10
7
|
|
|
11
8
|
// src/utilities/process-handler.ts
|
|
12
|
-
var exitWithError =
|
|
9
|
+
var exitWithError = (config) => {
|
|
13
10
|
writeFatal("Exiting script with an error status...", config);
|
|
14
11
|
process.exit(1);
|
|
15
|
-
}
|
|
16
|
-
var exitWithSuccess =
|
|
12
|
+
};
|
|
13
|
+
var exitWithSuccess = (config) => {
|
|
17
14
|
writeSuccess("Script completed successfully. Exiting...", config);
|
|
18
15
|
process.exit(0);
|
|
19
|
-
}
|
|
20
|
-
var handleProcess =
|
|
21
|
-
writeTrace(
|
|
16
|
+
};
|
|
17
|
+
var handleProcess = (config) => {
|
|
18
|
+
writeTrace(
|
|
19
|
+
`Using the following arguments to process the script: ${process.argv.join(", ")}`,
|
|
20
|
+
config
|
|
21
|
+
);
|
|
22
22
|
process.on("unhandledRejection", (error) => {
|
|
23
|
-
writeError(
|
|
23
|
+
writeError(
|
|
24
|
+
`An Unhandled Rejection occurred while running the program: ${error}`,
|
|
25
|
+
config
|
|
26
|
+
);
|
|
24
27
|
exitWithError(config);
|
|
25
28
|
});
|
|
26
29
|
process.on("uncaughtException", (error) => {
|
|
27
|
-
writeError(
|
|
28
|
-
|
|
30
|
+
writeError(
|
|
31
|
+
`An Uncaught Exception occurred while running the program: ${error.message}
|
|
32
|
+
Stacktrace: ${error.stack}`,
|
|
33
|
+
config
|
|
34
|
+
);
|
|
29
35
|
exitWithError(config);
|
|
30
36
|
});
|
|
31
37
|
process.on("SIGTERM", (signal) => {
|
|
@@ -40,7 +46,7 @@ Stacktrace: ${error.stack}`, config);
|
|
|
40
46
|
writeError(`The program terminated with signal code: ${signal}`, config);
|
|
41
47
|
exitWithError(config);
|
|
42
48
|
});
|
|
43
|
-
}
|
|
49
|
+
};
|
|
44
50
|
|
|
45
51
|
export {
|
|
46
52
|
exitWithError,
|