@storm-software/config-tools 1.169.6 → 1.169.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,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 _chunkJYKZS46Ucjs = require('./chunk-JYKZS46U.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
+ _chunkJYKZS46Ucjs.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;
@@ -0,0 +1,40 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2
+
3
+
4
+ var _chunkJYKZS46Ucjs = require('./chunk-JYKZS46U.cjs');
5
+
6
+
7
+ var _chunkAEZINHEAcjs = require('./chunk-AEZINHEA.cjs');
8
+
9
+
10
+ var _chunkC5OTFOQBcjs = require('./chunk-C5OTFOQB.cjs');
11
+
12
+ // src/logger/create-logger.ts
13
+ var _chalk = require('chalk'); var _chalk2 = _interopRequireDefault(_chalk);
14
+ async function createLogger(config) {
15
+ const workspaceRoot = _chunkAEZINHEAcjs.findWorkspaceRoot.call(void 0, );
16
+ if (!workspaceRoot) {
17
+ throw new Error("Cannot find workspace root");
18
+ }
19
+ const writeFatal = _chunkJYKZS46Ucjs.getLogFn.call(void 0, _chunkC5OTFOQBcjs.LogLevel.FATAL, config, _chalk2.default);
20
+ const writeError = _chunkJYKZS46Ucjs.getLogFn.call(void 0, _chunkC5OTFOQBcjs.LogLevel.ERROR, config, _chalk2.default);
21
+ const writeWarning = _chunkJYKZS46Ucjs.getLogFn.call(void 0, _chunkC5OTFOQBcjs.LogLevel.WARN, config, _chalk2.default);
22
+ const writeInfo = _chunkJYKZS46Ucjs.getLogFn.call(void 0, _chunkC5OTFOQBcjs.LogLevel.INFO, config, _chalk2.default);
23
+ const writeSuccess = _chunkJYKZS46Ucjs.getLogFn.call(void 0, _chunkC5OTFOQBcjs.LogLevel.SUCCESS, config, _chalk2.default);
24
+ const writeDebug = _chunkJYKZS46Ucjs.getLogFn.call(void 0, _chunkC5OTFOQBcjs.LogLevel.DEBUG, config, _chalk2.default);
25
+ const writeTrace = _chunkJYKZS46Ucjs.getLogFn.call(void 0, _chunkC5OTFOQBcjs.LogLevel.DEBUG, config, _chalk2.default);
26
+ return {
27
+ fatal: writeFatal,
28
+ error: writeError,
29
+ warning: writeWarning,
30
+ info: writeInfo,
31
+ success: writeSuccess,
32
+ debug: writeDebug,
33
+ trace: writeTrace,
34
+ getStopwatch: _chunkJYKZS46Ucjs.getStopwatch
35
+ };
36
+ }
37
+
38
+
39
+
40
+ exports.createLogger = createLogger;
@@ -0,0 +1,331 @@
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 _chunk7BZWQZUVcjs = require('./chunk-7BZWQZUV.cjs');
4
+
5
+
6
+ var _chunk4JREL2GQcjs = require('./chunk-4JREL2GQ.cjs');
7
+
8
+
9
+ var _chunkC5OTFOQBcjs = require('./chunk-C5OTFOQB.cjs');
10
+
11
+ // src/env/set-env.ts
12
+ var setExtensionEnv = (extensionName, extension) => {
13
+ for (const key of Object.keys(_nullishCoalesce(extension, () => ( {})))) {
14
+ if (extension[key]) {
15
+ const result = _nullishCoalesce(_optionalChain([key, 'optionalAccess', _ => _.replace, 'call', _2 => _2(
16
+ /([A-Z])+/g,
17
+ (input) => input ? _optionalChain([input, 'access', _3 => _3[0], 'optionalAccess', _4 => _4.toUpperCase, 'call', _5 => _5()]) + input.slice(1) : ""
18
+ ), 'access', _6 => _6.split, 'call', _7 => _7(/(?=[A-Z])|[.\-\s_]/), 'access', _8 => _8.map, 'call', _9 => _9((x) => x.toLowerCase())]), () => ( []));
19
+ let extensionKey;
20
+ if (result.length === 0) {
21
+ return;
22
+ }
23
+ if (result.length === 1) {
24
+ extensionKey = _nullishCoalesce(_optionalChain([result, 'access', _10 => _10[0], 'optionalAccess', _11 => _11.toUpperCase, 'call', _12 => _12()]), () => ( ""));
25
+ } else {
26
+ extensionKey = result.reduce((ret, part) => {
27
+ return `${ret}_${part.toLowerCase()}`;
28
+ });
29
+ }
30
+ process.env[`STORM_EXTENSION_${extensionName.toUpperCase()}_${extensionKey.toUpperCase()}`] = extension[key];
31
+ }
32
+ }
33
+ };
34
+ var setConfigEnv = (config) => {
35
+ const prefix = "STORM_";
36
+ if (config.extends) {
37
+ process.env[`${prefix}EXTENDS`] = Array.isArray(config.extends) ? JSON.stringify(config.extends) : config.extends;
38
+ }
39
+ if (config.name) {
40
+ process.env[`${prefix}NAME`] = config.name;
41
+ }
42
+ if (config.namespace) {
43
+ process.env[`${prefix}NAMESPACE`] = config.namespace;
44
+ }
45
+ if (config.owner) {
46
+ process.env[`${prefix}OWNER`] = config.owner;
47
+ }
48
+ if (config.bot) {
49
+ process.env[`${prefix}BOT_NAME`] = config.bot.name;
50
+ process.env[`${prefix}BOT_EMAIL`] = config.bot.email;
51
+ }
52
+ if (config.error) {
53
+ process.env[`${prefix}ERROR_CODES_FILE`] = config.error.codesFile;
54
+ process.env[`${prefix}ERROR_URL`] = config.error.url;
55
+ }
56
+ if (config.release) {
57
+ process.env[`${prefix}RELEASE_BANNER`] = config.release.banner;
58
+ process.env[`${prefix}RELEASE_HEADER`] = config.release.header;
59
+ process.env[`${prefix}RELEASE_FOOTER`] = config.release.footer;
60
+ }
61
+ if (config.account) {
62
+ if (config.account.twitter) {
63
+ process.env[`${prefix}ACCOUNT_TWITTER`] = config.account.twitter;
64
+ }
65
+ if (config.account.discord) {
66
+ process.env[`${prefix}ACCOUNT_DISCORD`] = config.account.discord;
67
+ }
68
+ if (config.account.telegram) {
69
+ process.env[`${prefix}ACCOUNT_TELEGRAM`] = config.account.telegram;
70
+ }
71
+ if (config.account.slack) {
72
+ process.env[`${prefix}ACCOUNT_SLACK`] = config.account.slack;
73
+ }
74
+ if (config.account.medium) {
75
+ process.env[`${prefix}ACCOUNT_MEDIUM`] = config.account.medium;
76
+ }
77
+ if (config.account.github) {
78
+ process.env[`${prefix}ACCOUNT_GITHUB`] = config.account.github;
79
+ }
80
+ }
81
+ if (config.organization) {
82
+ process.env[`${prefix}ORGANIZATION`] = config.organization;
83
+ }
84
+ if (config.packageManager) {
85
+ process.env[`${prefix}PACKAGE_MANAGER`] = config.packageManager;
86
+ }
87
+ if (config.license) {
88
+ process.env[`${prefix}LICENSE`] = config.license;
89
+ }
90
+ if (config.homepage) {
91
+ process.env[`${prefix}HOMEPAGE`] = config.homepage;
92
+ }
93
+ if (config.docs) {
94
+ process.env[`${prefix}DOCS`] = config.docs;
95
+ }
96
+ if (config.licensing) {
97
+ process.env[`${prefix}LICENSING`] = config.licensing;
98
+ }
99
+ if (config.contact) {
100
+ process.env[`${prefix}CONTACT`] = config.contact;
101
+ }
102
+ if (config.timezone) {
103
+ process.env[`${prefix}TIMEZONE`] = config.timezone;
104
+ process.env.TZ = config.timezone;
105
+ process.env.DEFAULT_TIMEZONE = config.timezone;
106
+ }
107
+ if (config.locale) {
108
+ process.env[`${prefix}LOCALE`] = config.locale;
109
+ process.env.LOCALE = config.locale;
110
+ process.env.DEFAULT_LOCALE = config.locale;
111
+ process.env.LANG = config.locale ? `${config.locale.replaceAll("-", "_")}.UTF-8` : "en_US.UTF-8";
112
+ }
113
+ if (config.configFile) {
114
+ process.env[`${prefix}CONFIG_FILE`] = _chunk4JREL2GQcjs.correctPaths.call(void 0, config.configFile);
115
+ }
116
+ if (config.workspaceRoot) {
117
+ process.env[`${prefix}WORKSPACE_ROOT`] = _chunk4JREL2GQcjs.correctPaths.call(void 0, config.workspaceRoot);
118
+ process.env.NX_WORKSPACE_ROOT = _chunk4JREL2GQcjs.correctPaths.call(void 0, config.workspaceRoot);
119
+ process.env.NX_WORKSPACE_ROOT_PATH = _chunk4JREL2GQcjs.correctPaths.call(void 0, config.workspaceRoot);
120
+ }
121
+ if (config.directories) {
122
+ if (!config.skipCache && config.directories.cache) {
123
+ process.env[`${prefix}CACHE_DIR`] = _chunk4JREL2GQcjs.correctPaths.call(void 0,
124
+ config.directories.cache
125
+ );
126
+ process.env[`${prefix}CACHE_DIRECTORY`] = process.env[`${prefix}CACHE_DIR`];
127
+ }
128
+ if (config.directories.data) {
129
+ process.env[`${prefix}DATA_DIR`] = _chunk4JREL2GQcjs.correctPaths.call(void 0, config.directories.data);
130
+ process.env[`${prefix}DATA_DIRECTORY`] = process.env[`${prefix}DATA_DIR`];
131
+ }
132
+ if (config.directories.config) {
133
+ process.env[`${prefix}CONFIG_DIR`] = _chunk4JREL2GQcjs.correctPaths.call(void 0,
134
+ config.directories.config
135
+ );
136
+ process.env[`${prefix}CONFIG_DIRECTORY`] = process.env[`${prefix}CONFIG_DIR`];
137
+ }
138
+ if (config.directories.temp) {
139
+ process.env[`${prefix}TEMP_DIR`] = _chunk4JREL2GQcjs.correctPaths.call(void 0, config.directories.temp);
140
+ process.env[`${prefix}TEMP_DIRECTORY`] = process.env[`${prefix}TEMP_DIR`];
141
+ }
142
+ if (config.directories.log) {
143
+ process.env[`${prefix}LOG_DIR`] = _chunk4JREL2GQcjs.correctPaths.call(void 0, config.directories.log);
144
+ process.env[`${prefix}LOG_DIRECTORY`] = process.env[`${prefix}LOG_DIR`];
145
+ }
146
+ if (config.directories.build) {
147
+ process.env[`${prefix}BUILD_DIR`] = _chunk4JREL2GQcjs.correctPaths.call(void 0,
148
+ config.directories.build
149
+ );
150
+ process.env[`${prefix}BUILD_DIRECTORY`] = process.env[`${prefix}BUILD_DIR`];
151
+ }
152
+ }
153
+ if (config.skipCache !== void 0) {
154
+ process.env[`${prefix}SKIP_CACHE`] = String(config.skipCache);
155
+ if (config.skipCache) {
156
+ process.env.NX_SKIP_NX_CACHE ??= String(config.skipCache);
157
+ process.env.NX_CACHE_PROJECT_GRAPH ??= String(config.skipCache);
158
+ }
159
+ }
160
+ if (config.mode) {
161
+ process.env[`${prefix}MODE`] = config.mode;
162
+ process.env.NODE_ENV = config.mode;
163
+ process.env.ENVIRONMENT = config.mode;
164
+ }
165
+ if (_optionalChain([config, 'access', _13 => _13.colors, 'optionalAccess', _14 => _14.base, 'optionalAccess', _15 => _15.light]) || _optionalChain([config, 'access', _16 => _16.colors, 'optionalAccess', _17 => _17.base, 'optionalAccess', _18 => _18.dark])) {
166
+ for (const key of Object.keys(config.colors)) {
167
+ setThemeColorConfigEnv(`${prefix}COLOR_${key}_`, config.colors[key]);
168
+ }
169
+ } else {
170
+ setThemeColorConfigEnv(
171
+ `${prefix}COLOR_`,
172
+ config.colors
173
+ );
174
+ }
175
+ if (config.repository) {
176
+ process.env[`${prefix}REPOSITORY`] = config.repository;
177
+ }
178
+ if (config.branch) {
179
+ process.env[`${prefix}BRANCH`] = config.branch;
180
+ }
181
+ if (config.preid) {
182
+ process.env[`${prefix}PRE_ID`] = String(config.preid);
183
+ }
184
+ if (config.externalPackagePatterns) {
185
+ process.env[`${prefix}EXTERNAL_PACKAGE_PATTERNS`] = JSON.stringify(
186
+ config.externalPackagePatterns
187
+ );
188
+ }
189
+ if (config.registry) {
190
+ if (config.registry.github) {
191
+ process.env[`${prefix}REGISTRY_GITHUB`] = String(config.registry.github);
192
+ }
193
+ if (config.registry.npm) {
194
+ process.env[`${prefix}REGISTRY_NPM`] = String(config.registry.npm);
195
+ }
196
+ if (config.registry.cargo) {
197
+ process.env[`${prefix}REGISTRY_CARGO`] = String(config.registry.cargo);
198
+ }
199
+ if (config.registry.cyclone) {
200
+ process.env[`${prefix}REGISTRY_CYCLONE`] = String(
201
+ config.registry.cyclone
202
+ );
203
+ }
204
+ if (config.registry.container) {
205
+ process.env[`${prefix}REGISTRY_CONTAINER`] = String(
206
+ config.registry.container
207
+ );
208
+ }
209
+ }
210
+ if (config.logLevel) {
211
+ process.env[`${prefix}LOG_LEVEL`] = String(config.logLevel);
212
+ process.env.LOG_LEVEL = String(config.logLevel);
213
+ process.env.NX_VERBOSE_LOGGING = String(
214
+ _chunk7BZWQZUVcjs.getLogLevel.call(void 0, config.logLevel) >= _chunkC5OTFOQBcjs.LogLevel.DEBUG ? true : false
215
+ );
216
+ process.env.RUST_BACKTRACE = _chunk7BZWQZUVcjs.getLogLevel.call(void 0, config.logLevel) >= _chunkC5OTFOQBcjs.LogLevel.DEBUG ? "full" : "none";
217
+ }
218
+ if (config.skipConfigLogging !== void 0) {
219
+ process.env[`${prefix}SKIP_CONFIG_LOGGING`] = String(
220
+ config.skipConfigLogging
221
+ );
222
+ }
223
+ process.env[`${prefix}CONFIG`] = JSON.stringify(config);
224
+ for (const key of Object.keys(_nullishCoalesce(config.extensions, () => ( {})))) {
225
+ if (config.extensions[key] && Object.keys(config.extensions[key])) {
226
+ setExtensionEnv(key, config.extensions[key]);
227
+ }
228
+ }
229
+ };
230
+ var setThemeColorConfigEnv = (prefix, config) => {
231
+ return _optionalChain([config, 'optionalAccess', _19 => _19.light, 'optionalAccess', _20 => _20.brand]) || _optionalChain([config, 'optionalAccess', _21 => _21.dark, 'optionalAccess', _22 => _22.brand]) ? setMultiThemeColorConfigEnv(prefix, config) : setSingleThemeColorConfigEnv(prefix, config);
232
+ };
233
+ var setSingleThemeColorConfigEnv = (prefix, config) => {
234
+ if (config.dark) {
235
+ process.env[`${prefix}DARK`] = config.dark;
236
+ }
237
+ if (config.light) {
238
+ process.env[`${prefix}LIGHT`] = config.light;
239
+ }
240
+ if (config.brand) {
241
+ process.env[`${prefix}BRAND`] = config.brand;
242
+ }
243
+ if (config.alternate) {
244
+ process.env[`${prefix}ALTERNATE`] = config.alternate;
245
+ }
246
+ if (config.accent) {
247
+ process.env[`${prefix}ACCENT`] = config.accent;
248
+ }
249
+ if (config.link) {
250
+ process.env[`${prefix}LINK`] = config.link;
251
+ }
252
+ if (config.help) {
253
+ process.env[`${prefix}HELP`] = config.help;
254
+ }
255
+ if (config.success) {
256
+ process.env[`${prefix}SUCCESS`] = config.success;
257
+ }
258
+ if (config.info) {
259
+ process.env[`${prefix}INFO`] = config.info;
260
+ }
261
+ if (config.warning) {
262
+ process.env[`${prefix}WARNING`] = config.warning;
263
+ }
264
+ if (config.danger) {
265
+ process.env[`${prefix}DANGER`] = config.danger;
266
+ }
267
+ if (config.fatal) {
268
+ process.env[`${prefix}FATAL`] = config.fatal;
269
+ }
270
+ if (config.positive) {
271
+ process.env[`${prefix}POSITIVE`] = config.positive;
272
+ }
273
+ if (config.negative) {
274
+ process.env[`${prefix}NEGATIVE`] = config.negative;
275
+ }
276
+ };
277
+ var setMultiThemeColorConfigEnv = (prefix, config) => {
278
+ return {
279
+ light: setBaseThemeColorConfigEnv(`${prefix}LIGHT_`, config.light),
280
+ dark: setBaseThemeColorConfigEnv(`${prefix}DARK_`, config.dark)
281
+ };
282
+ };
283
+ var setBaseThemeColorConfigEnv = (prefix, config) => {
284
+ if (config.foreground) {
285
+ process.env[`${prefix}FOREGROUND`] = config.foreground;
286
+ }
287
+ if (config.background) {
288
+ process.env[`${prefix}BACKGROUND`] = config.background;
289
+ }
290
+ if (config.brand) {
291
+ process.env[`${prefix}BRAND`] = config.brand;
292
+ }
293
+ if (config.alternate) {
294
+ process.env[`${prefix}ALTERNATE`] = config.alternate;
295
+ }
296
+ if (config.accent) {
297
+ process.env[`${prefix}ACCENT`] = config.accent;
298
+ }
299
+ if (config.link) {
300
+ process.env[`${prefix}LINK`] = config.link;
301
+ }
302
+ if (config.help) {
303
+ process.env[`${prefix}HELP`] = config.help;
304
+ }
305
+ if (config.success) {
306
+ process.env[`${prefix}SUCCESS`] = config.success;
307
+ }
308
+ if (config.info) {
309
+ process.env[`${prefix}INFO`] = config.info;
310
+ }
311
+ if (config.warning) {
312
+ process.env[`${prefix}WARNING`] = config.warning;
313
+ }
314
+ if (config.danger) {
315
+ process.env[`${prefix}DANGER`] = config.danger;
316
+ }
317
+ if (config.fatal) {
318
+ process.env[`${prefix}FATAL`] = config.fatal;
319
+ }
320
+ if (config.positive) {
321
+ process.env[`${prefix}POSITIVE`] = config.positive;
322
+ }
323
+ if (config.negative) {
324
+ process.env[`${prefix}NEGATIVE`] = config.negative;
325
+ }
326
+ };
327
+
328
+
329
+
330
+
331
+ exports.setExtensionEnv = setExtensionEnv; exports.setConfigEnv = setConfigEnv;
@@ -0,0 +1,47 @@
1
+ import {
2
+ writeError
3
+ } from "./chunk-SA3JCBON.js";
4
+
5
+ // src/utilities/toml.ts
6
+ import TOML from "@ltd/j-toml";
7
+ function parseCargoTomlWithTree(tree, projectRoot, projectName) {
8
+ const cargoTomlString = tree.read(`${projectRoot}/Cargo.toml`)?.toString();
9
+ if (!cargoTomlString) {
10
+ writeError(`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 TOML.parse(cargoString, {
20
+ x: { comment: true }
21
+ });
22
+ }
23
+ function stringifyCargoToml(cargoToml) {
24
+ const tomlString = TOML.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] ??= TOML.Section({});
34
+ toml[section][key] = typeof value === "object" && !Array.isArray(value) ? TOML.inline(value) : typeof value === "function" ? value() : value;
35
+ }
36
+ function modifyCargoNestedTable(toml, section, key, value) {
37
+ toml[section] ??= {};
38
+ toml[section][key] = TOML.Section(value);
39
+ }
40
+
41
+ export {
42
+ parseCargoTomlWithTree,
43
+ parseCargoToml,
44
+ stringifyCargoToml,
45
+ modifyCargoTable,
46
+ modifyCargoNestedTable
47
+ };
@@ -0,0 +1,55 @@
1
+ import {
2
+ writeError,
3
+ writeFatal,
4
+ writeSuccess,
5
+ writeTrace
6
+ } from "./chunk-SA3JCBON.js";
7
+
8
+ // src/utilities/process-handler.ts
9
+ var exitWithError = (config) => {
10
+ writeFatal("Exiting script with an error status...", config);
11
+ process.exit(1);
12
+ };
13
+ var exitWithSuccess = (config) => {
14
+ writeSuccess("Script completed successfully. Exiting...", config);
15
+ process.exit(0);
16
+ };
17
+ var handleProcess = (config) => {
18
+ writeTrace(
19
+ `Using the following arguments to process the script: ${process.argv.join(", ")}`,
20
+ config
21
+ );
22
+ process.on("unhandledRejection", (error) => {
23
+ writeError(
24
+ `An Unhandled Rejection occurred while running the program: ${error}`,
25
+ config
26
+ );
27
+ exitWithError(config);
28
+ });
29
+ process.on("uncaughtException", (error) => {
30
+ writeError(
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
+ writeError(`The program terminated with signal code: ${signal}`, config);
39
+ exitWithError(config);
40
+ });
41
+ process.on("SIGINT", (signal) => {
42
+ writeError(`The program terminated with signal code: ${signal}`, config);
43
+ exitWithError(config);
44
+ });
45
+ process.on("SIGHUP", (signal) => {
46
+ writeError(`The program terminated with signal code: ${signal}`, config);
47
+ exitWithError(config);
48
+ });
49
+ };
50
+
51
+ export {
52
+ exitWithError,
53
+ exitWithSuccess,
54
+ handleProcess
55
+ };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  loadStormWorkspaceConfig,
3
3
  tryLoadStormWorkspaceConfig
4
- } from "./chunk-GK6OSUUD.js";
4
+ } from "./chunk-MU2JW35A.js";
5
5
  import {
6
6
  findWorkspaceRoot
7
7
  } from "./chunk-VLWSWYG7.js";