@storm-software/config-tools 1.169.8 → 1.170.0

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.
Files changed (78) hide show
  1. package/README.md +1 -1
  2. package/bin/config.cjs +50 -11
  3. package/bin/config.js +56 -17
  4. package/dist/{chunk-WITKEKZ5.js → chunk-26BPJW3I.js} +12 -9
  5. package/dist/{chunk-J2LCTMCI.cjs → chunk-26LV7S6Z.cjs} +9 -9
  6. package/dist/{chunk-BJ2W75ZO.cjs → chunk-2CVNUZFW.cjs} +22 -19
  7. package/dist/{chunk-XBNXWUW3.cjs → chunk-2IEYYP2I.cjs} +2 -2
  8. package/dist/{chunk-JX5NLB4S.js → chunk-4KZ3BMNG.js} +44 -10
  9. package/dist/{chunk-GIXUQACB.cjs → chunk-4PAEA5KV.cjs} +44 -10
  10. package/dist/chunk-4VJPNKRP.cjs +40 -0
  11. package/dist/{chunk-H425P7G5.cjs → chunk-5XVUNKW6.cjs} +5 -2
  12. package/dist/{chunk-56NGBR4S.cjs → chunk-6LO4SCE6.cjs} +1 -0
  13. package/dist/{chunk-BAWQ37NK.js → chunk-6YK3KZIF.js} +1 -1
  14. package/dist/{chunk-FCWF3I34.cjs → chunk-7BVMJTE2.cjs} +9 -9
  15. package/dist/{chunk-QDJMKPQQ.js → chunk-7OSBTSCE.js} +1 -1
  16. package/dist/{chunk-RSKVXFI5.js → chunk-BKQBZMGO.js} +4 -3
  17. package/dist/{chunk-7HCUD67D.cjs → chunk-BMDGKEGP.cjs} +3 -3
  18. package/dist/{chunk-7SIKKF62.cjs → chunk-DX767CQS.cjs} +2 -2
  19. package/dist/chunk-E5XT5FVB.cjs +193 -0
  20. package/dist/chunk-F7MZXFL2.cjs +334 -0
  21. package/dist/{chunk-PORZT4W3.js → chunk-FRM3M54F.js} +1 -1
  22. package/dist/chunk-JRKB77S5.js +47 -0
  23. package/dist/{chunk-H2GU4JMJ.cjs → chunk-KX7CIRN3.cjs} +3 -3
  24. package/dist/chunk-MN6CU3TR.js +138 -0
  25. package/dist/chunk-MNLUPWAB.cjs +158 -0
  26. package/dist/chunk-NUOCEMFW.js +40 -0
  27. package/dist/chunk-OD7DEEL5.cjs +55 -0
  28. package/dist/{chunk-QJUAU656.js → chunk-OUYYXBZX.js} +1 -1
  29. package/dist/chunk-QWVC3UD5.cjs +40 -0
  30. package/dist/chunk-RJVVMUQK.cjs +138 -0
  31. package/dist/{chunk-ELNIDXR5.js → chunk-STYJJA3M.js} +1 -1
  32. package/dist/{chunk-XS7LVKAI.js → chunk-TCSDVRRN.js} +6 -3
  33. package/dist/chunk-TGDG6POD.cjs +47 -0
  34. package/dist/chunk-TRI5HQQN.js +334 -0
  35. package/dist/chunk-U74E4EM6.js +55 -0
  36. package/dist/chunk-UPV2R6VP.cjs +92 -0
  37. package/dist/{chunk-XO6ICAFH.js → chunk-VSPBZRTR.js} +1 -1
  38. package/dist/chunk-WT2BVWII.js +40 -0
  39. package/dist/chunk-XT2XO7TR.js +92 -0
  40. package/dist/chunk-YPBNOKK2.js +158 -0
  41. package/dist/chunk-Z3RQ7QQH.js +193 -0
  42. package/dist/config-file/get-config-file.cjs +7 -7
  43. package/dist/config-file/get-config-file.js +6 -6
  44. package/dist/config-file/index.cjs +7 -7
  45. package/dist/config-file/index.js +6 -6
  46. package/dist/create-storm-config.cjs +10 -10
  47. package/dist/create-storm-config.js +9 -9
  48. package/dist/env/get-env.cjs +2 -2
  49. package/dist/env/get-env.js +1 -1
  50. package/dist/env/index.cjs +3 -3
  51. package/dist/env/index.js +2 -2
  52. package/dist/env/set-env.cjs +2 -2
  53. package/dist/env/set-env.js +1 -1
  54. package/dist/get-config.cjs +11 -11
  55. package/dist/get-config.js +10 -10
  56. package/dist/index.cjs +13 -11
  57. package/dist/index.d.cts +1 -1
  58. package/dist/index.d.ts +1 -1
  59. package/dist/index.js +14 -12
  60. package/dist/logger/console.cjs +3 -3
  61. package/dist/logger/console.js +2 -2
  62. package/dist/logger/create-logger.cjs +4 -4
  63. package/dist/logger/create-logger.js +3 -3
  64. package/dist/logger/index.cjs +4 -4
  65. package/dist/logger/index.js +3 -3
  66. package/dist/utilities/get-default-config.cjs +4 -2
  67. package/dist/utilities/get-default-config.d.cts +9 -4
  68. package/dist/utilities/get-default-config.d.ts +9 -4
  69. package/dist/utilities/get-default-config.js +5 -3
  70. package/dist/utilities/index.cjs +8 -6
  71. package/dist/utilities/index.d.cts +1 -1
  72. package/dist/utilities/index.d.ts +1 -1
  73. package/dist/utilities/index.js +9 -7
  74. package/dist/utilities/process-handler.cjs +4 -4
  75. package/dist/utilities/process-handler.js +3 -3
  76. package/dist/utilities/toml.cjs +5 -5
  77. package/dist/utilities/toml.js +4 -4
  78. package/package.json +2 -2
@@ -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 _chunkNS5PJ2RMcjs = require('./chunk-NS5PJ2RM.cjs');
4
+
5
+
6
+ var _chunkPSHJQ2NPcjs = require('./chunk-PSHJQ2NP.cjs');
7
+
8
+
9
+ var _chunkQNDF3RQLcjs = require('./chunk-QNDF3RQL.cjs');
10
+
11
+
12
+ var _chunk4PAEA5KVcjs = require('./chunk-4PAEA5KV.cjs');
13
+
14
+
15
+ var _chunk7BZWQZUVcjs = require('./chunk-7BZWQZUV.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;
@@ -0,0 +1,40 @@
1
+ import {
2
+ loadStormWorkspaceConfig,
3
+ tryLoadStormWorkspaceConfig
4
+ } from "./chunk-26BPJW3I.js";
5
+ import {
6
+ findWorkspaceRoot
7
+ } from "./chunk-VLWSWYG7.js";
8
+
9
+ // src/get-config.ts
10
+ var getConfig = (workspaceRoot, skipLogs = false) => {
11
+ return loadStormWorkspaceConfig(workspaceRoot, skipLogs);
12
+ };
13
+ var getWorkspaceConfig = (skipLogs = false, options = {}) => {
14
+ let workspaceRoot = options.workspaceRoot;
15
+ if (!workspaceRoot) {
16
+ workspaceRoot = findWorkspaceRoot(options.cwd);
17
+ }
18
+ return getConfig(workspaceRoot, skipLogs);
19
+ };
20
+ var tryGetWorkspaceConfig = async (skipLogs = false, options = {}) => {
21
+ try {
22
+ let workspaceRoot = options.workspaceRoot;
23
+ if (!workspaceRoot) {
24
+ workspaceRoot = findWorkspaceRoot(options.cwd);
25
+ }
26
+ return tryLoadStormWorkspaceConfig(
27
+ workspaceRoot,
28
+ skipLogs,
29
+ options.useDefault
30
+ );
31
+ } catch {
32
+ return void 0;
33
+ }
34
+ };
35
+
36
+ export {
37
+ getConfig,
38
+ getWorkspaceConfig,
39
+ tryGetWorkspaceConfig
40
+ };
@@ -0,0 +1,55 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+
5
+
6
+ var _chunkMNLUPWABcjs = require('./chunk-MNLUPWAB.cjs');
7
+
8
+ // src/utilities/process-handler.ts
9
+ var exitWithError = (config) => {
10
+ _chunkMNLUPWABcjs.writeFatal.call(void 0, "Exiting script with an error status...", config);
11
+ process.exit(1);
12
+ };
13
+ var exitWithSuccess = (config) => {
14
+ _chunkMNLUPWABcjs.writeSuccess.call(void 0, "Script completed successfully. Exiting...", config);
15
+ process.exit(0);
16
+ };
17
+ var handleProcess = (config) => {
18
+ _chunkMNLUPWABcjs.writeTrace.call(void 0,
19
+ `Using the following arguments to process the script: ${process.argv.join(", ")}`,
20
+ config
21
+ );
22
+ process.on("unhandledRejection", (error) => {
23
+ _chunkMNLUPWABcjs.writeError.call(void 0,
24
+ `An Unhandled Rejection occurred while running the program: ${error}`,
25
+ config
26
+ );
27
+ exitWithError(config);
28
+ });
29
+ process.on("uncaughtException", (error) => {
30
+ _chunkMNLUPWABcjs.writeError.call(void 0,
31
+ `An Uncaught Exception occurred while running the program: ${error.message}
32
+ Stacktrace: ${error.stack}`,
33
+ config
34
+ );
35
+ exitWithError(config);
36
+ });
37
+ process.on("SIGTERM", (signal) => {
38
+ _chunkMNLUPWABcjs.writeError.call(void 0, `The program terminated with signal code: ${signal}`, config);
39
+ exitWithError(config);
40
+ });
41
+ process.on("SIGINT", (signal) => {
42
+ _chunkMNLUPWABcjs.writeError.call(void 0, `The program terminated with signal code: ${signal}`, config);
43
+ exitWithError(config);
44
+ });
45
+ process.on("SIGHUP", (signal) => {
46
+ _chunkMNLUPWABcjs.writeError.call(void 0, `The program terminated with signal code: ${signal}`, config);
47
+ exitWithError(config);
48
+ });
49
+ };
50
+
51
+
52
+
53
+
54
+
55
+ exports.exitWithError = exitWithError; exports.exitWithSuccess = exitWithSuccess; exports.handleProcess = handleProcess;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  DEFAULT_COLOR_CONFIG
3
- } from "./chunk-JX5NLB4S.js";
3
+ } from "./chunk-4KZ3BMNG.js";
4
4
  import {
5
5
  getChalk
6
6
  } from "./chunk-T3MUE32G.js";
@@ -0,0 +1,40 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+ var _chunk2CVNUZFWcjs = require('./chunk-2CVNUZFW.cjs');
5
+
6
+
7
+ var _chunkAEZINHEAcjs = require('./chunk-AEZINHEA.cjs');
8
+
9
+ // src/get-config.ts
10
+ var getConfig = (workspaceRoot, skipLogs = false) => {
11
+ return _chunk2CVNUZFWcjs.loadStormWorkspaceConfig.call(void 0, workspaceRoot, skipLogs);
12
+ };
13
+ var getWorkspaceConfig = (skipLogs = false, options = {}) => {
14
+ let workspaceRoot = options.workspaceRoot;
15
+ if (!workspaceRoot) {
16
+ workspaceRoot = _chunkAEZINHEAcjs.findWorkspaceRoot.call(void 0, options.cwd);
17
+ }
18
+ return getConfig(workspaceRoot, skipLogs);
19
+ };
20
+ var tryGetWorkspaceConfig = async (skipLogs = false, options = {}) => {
21
+ try {
22
+ let workspaceRoot = options.workspaceRoot;
23
+ if (!workspaceRoot) {
24
+ workspaceRoot = _chunkAEZINHEAcjs.findWorkspaceRoot.call(void 0, options.cwd);
25
+ }
26
+ return _chunk2CVNUZFWcjs.tryLoadStormWorkspaceConfig.call(void 0,
27
+ workspaceRoot,
28
+ skipLogs,
29
+ options.useDefault
30
+ );
31
+ } catch (e) {
32
+ return void 0;
33
+ }
34
+ };
35
+
36
+
37
+
38
+
39
+
40
+ exports.getConfig = getConfig; exports.getWorkspaceConfig = getWorkspaceConfig; exports.tryGetWorkspaceConfig = tryGetWorkspaceConfig;
@@ -0,0 +1,138 @@
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 _chunkUPV2R6VPcjs = require('./chunk-UPV2R6VP.cjs');
4
+
5
+
6
+
7
+
8
+ var _chunkMNLUPWABcjs = require('./chunk-MNLUPWAB.cjs');
9
+
10
+
11
+
12
+ var _chunk4PAEA5KVcjs = require('./chunk-4PAEA5KV.cjs');
13
+
14
+
15
+ var _chunkAEZINHEAcjs = require('./chunk-AEZINHEA.cjs');
16
+
17
+
18
+ var _chunk5XVUNKW6cjs = require('./chunk-5XVUNKW6.cjs');
19
+
20
+
21
+
22
+ var _chunkE5XT5FVBcjs = require('./chunk-E5XT5FVB.cjs');
23
+
24
+ // src/create-storm-config.ts
25
+ var _schema = require('@storm-software/config/schema');
26
+ var _defu = require('defu'); var _defu2 = _interopRequireDefault(_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 (!_optionalChain([_static_cache, 'optionalAccess', _ => _.data]) || !_optionalChain([_static_cache, 'optionalAccess', _2 => _2.timestamp]) || _static_cache.timestamp < Date.now() - 8e3) {
32
+ let _workspaceRoot = workspaceRoot;
33
+ if (!_workspaceRoot) {
34
+ _workspaceRoot = _chunkAEZINHEAcjs.findWorkspaceRoot.call(void 0, );
35
+ }
36
+ const configEnv = _chunkE5XT5FVBcjs.getConfigEnv.call(void 0, );
37
+ const configFile = await _chunkUPV2R6VPcjs.getConfigFile.call(void 0, _workspaceRoot);
38
+ if (!configFile) {
39
+ if (!skipLogs) {
40
+ _chunkMNLUPWABcjs.writeWarning.call(void 0,
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 _chunk4PAEA5KVcjs.getPackageJsonConfig.call(void 0, _workspaceRoot);
50
+ result = _chunk4PAEA5KVcjs.applyDefaultConfig.call(void 0,
51
+ await _schema.stormWorkspaceConfigSchema.parseAsync(
52
+ _defu2.default.call(void 0, 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 = _chunkE5XT5FVBcjs.getExtensionEnv.call(void 0, 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
+ _chunk5XVUNKW6cjs.setConfigEnv.call(void 0, config);
92
+ if (!skipLogs && !config.skipConfigLogging) {
93
+ _chunkMNLUPWABcjs.writeTrace.call(void 0,
94
+ `\u2699\uFE0F Using Storm Workspace configuration:
95
+ ${_chunkMNLUPWABcjs.formatLogMessage.call(void 0, 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
+ _chunk5XVUNKW6cjs.setConfigEnv.call(void 0, config);
114
+ if (!skipLogs && !config.skipConfigLogging) {
115
+ _chunkMNLUPWABcjs.writeTrace.call(void 0,
116
+ `\u2699\uFE0F Using Storm Workspace configuration:
117
+ ${_chunkMNLUPWABcjs.formatLogMessage.call(void 0, config)}`,
118
+ config
119
+ );
120
+ }
121
+ return config;
122
+ } catch (error) {
123
+ if (!skipLogs) {
124
+ _chunkMNLUPWABcjs.writeWarning.call(void 0,
125
+ `\u26A0\uFE0F Failed to load Storm Workspace configuration: ${error}`,
126
+ { logLevel: "all" }
127
+ );
128
+ }
129
+ return void 0;
130
+ }
131
+ };
132
+
133
+
134
+
135
+
136
+
137
+
138
+ exports.createStormWorkspaceConfig = createStormWorkspaceConfig; exports.createConfigExtension = createConfigExtension; exports.loadStormWorkspaceConfig = loadStormWorkspaceConfig; exports.tryLoadStormWorkspaceConfig = tryLoadStormWorkspaceConfig;
@@ -3,7 +3,7 @@ import {
3
3
  writeFatal,
4
4
  writeSuccess,
5
5
  writeTrace
6
- } from "./chunk-QJUAU656.js";
6
+ } from "./chunk-YPBNOKK2.js";
7
7
 
8
8
  // src/utilities/process-handler.ts
9
9
  var exitWithError = (config) => {
@@ -1,9 +1,9 @@
1
- import {
2
- correctPaths
3
- } from "./chunk-FRR2ZRWD.js";
4
1
  import {
5
2
  getLogLevel
6
3
  } from "./chunk-4XRV4CVP.js";
4
+ import {
5
+ correctPaths
6
+ } from "./chunk-FRR2ZRWD.js";
7
7
  import {
8
8
  LogLevel
9
9
  } from "./chunk-3QAWRU2B.js";
@@ -99,6 +99,9 @@ var setConfigEnv = (config) => {
99
99
  if (config.contact) {
100
100
  process.env[`${prefix}CONTACT`] = config.contact;
101
101
  }
102
+ if (config.support) {
103
+ process.env[`${prefix}SUPPORT`] = config.support;
104
+ }
102
105
  if (config.timezone) {
103
106
  process.env[`${prefix}TIMEZONE`] = config.timezone;
104
107
  process.env.TZ = config.timezone;
@@ -0,0 +1,47 @@
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 _chunkDX767CQScjs = require('./chunk-DX767CQS.cjs');
4
+
5
+ // src/utilities/toml.ts
6
+ var _jtoml = require('@ltd/j-toml'); var _jtoml2 = _interopRequireDefault(_jtoml);
7
+ function parseCargoTomlWithTree(tree, projectRoot, projectName) {
8
+ const cargoTomlString = _optionalChain([tree, 'access', _ => _.read, 'call', _2 => _2(`${projectRoot}/Cargo.toml`), 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]);
9
+ if (!cargoTomlString) {
10
+ _chunkDX767CQScjs.writeError.call(void 0, `Cannot find a Cargo.toml file in the ${projectName}`);
11
+ throw new Error();
12
+ }
13
+ return parseCargoToml(cargoTomlString);
14
+ }
15
+ function parseCargoToml(cargoString) {
16
+ if (!cargoString) {
17
+ throw new Error("Cargo.toml is empty");
18
+ }
19
+ return _jtoml2.default.parse(cargoString, {
20
+ x: { comment: true }
21
+ });
22
+ }
23
+ function stringifyCargoToml(cargoToml) {
24
+ const tomlString = _jtoml2.default.stringify(cargoToml, {
25
+ newlineAround: "section"
26
+ });
27
+ if (Array.isArray(tomlString)) {
28
+ return tomlString.join("\n");
29
+ }
30
+ return tomlString;
31
+ }
32
+ function modifyCargoTable(toml, section, key, value) {
33
+ toml[section] ??= _jtoml2.default.Section({});
34
+ toml[section][key] = typeof value === "object" && !Array.isArray(value) ? _jtoml2.default.inline(value) : typeof value === "function" ? value() : value;
35
+ }
36
+ function modifyCargoNestedTable(toml, section, key, value) {
37
+ toml[section] ??= {};
38
+ toml[section][key] = _jtoml2.default.Section(value);
39
+ }
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+ exports.parseCargoTomlWithTree = parseCargoTomlWithTree; exports.parseCargoToml = parseCargoToml; exports.stringifyCargoToml = stringifyCargoToml; exports.modifyCargoTable = modifyCargoTable; exports.modifyCargoNestedTable = modifyCargoNestedTable;