@storm-software/config-tools 1.190.13 → 1.190.14

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 (45) hide show
  1. package/bin/config.cjs +17 -8
  2. package/bin/config.js +17 -8
  3. package/dist/{chunk-S22A75II.cjs → chunk-44SHQAD4.cjs} +10 -10
  4. package/dist/{chunk-TOMKPXJE.js → chunk-4UFIHIMZ.js} +17 -8
  5. package/dist/{chunk-7KE7OYDW.js → chunk-5NAMOQCY.js} +1 -1
  6. package/dist/{chunk-DZS54O6N.cjs → chunk-AZJQFL6W.cjs} +17 -8
  7. package/dist/{chunk-PAQH5U2F.cjs → chunk-DFWIRJGH.cjs} +3 -3
  8. package/dist/{chunk-KOSKDPTM.cjs → chunk-EB63U2GG.cjs} +3 -3
  9. package/dist/{chunk-ORVHSCSN.js → chunk-FXQGOFJI.js} +1 -1
  10. package/dist/chunk-KRVACLYZ.cjs +40 -0
  11. package/dist/{chunk-CZGO7WY3.js → chunk-M7RUDRDH.js} +1 -1
  12. package/dist/{chunk-PN7H7GUE.js → chunk-MOXINQRL.js} +1 -1
  13. package/dist/{chunk-EEPODKNE.cjs → chunk-OLW3Y2DA.cjs} +14 -14
  14. package/dist/chunk-QXMSQMVN.cjs +165 -0
  15. package/dist/{chunk-HUQ5Y2QK.cjs → chunk-R5BZDTQW.cjs} +2 -2
  16. package/dist/chunk-TIH4RSTL.js +40 -0
  17. package/dist/{chunk-6IBSNO2S.cjs → chunk-TW273ZN4.cjs} +9 -9
  18. package/dist/{chunk-KVDT6KNS.js → chunk-UWI3QVYJ.js} +2 -2
  19. package/dist/chunk-UZBUUPX4.js +165 -0
  20. package/dist/{chunk-KLUNEHDC.js → chunk-VEYONVTU.js} +1 -1
  21. package/dist/config-file/get-config-file.cjs +6 -6
  22. package/dist/config-file/get-config-file.js +5 -5
  23. package/dist/config-file/index.cjs +6 -6
  24. package/dist/config-file/index.js +5 -5
  25. package/dist/create-storm-config.cjs +7 -7
  26. package/dist/create-storm-config.js +6 -6
  27. package/dist/get-config.cjs +8 -8
  28. package/dist/get-config.js +7 -7
  29. package/dist/index.cjs +8 -8
  30. package/dist/index.js +7 -7
  31. package/dist/logger/console.cjs +2 -2
  32. package/dist/logger/console.d.cts +9 -0
  33. package/dist/logger/console.d.ts +9 -0
  34. package/dist/logger/console.js +1 -1
  35. package/dist/logger/create-logger.cjs +3 -3
  36. package/dist/logger/create-logger.js +2 -2
  37. package/dist/logger/index.cjs +3 -3
  38. package/dist/logger/index.js +2 -2
  39. package/dist/utilities/index.cjs +5 -5
  40. package/dist/utilities/index.js +4 -4
  41. package/dist/utilities/process-handler.cjs +3 -3
  42. package/dist/utilities/process-handler.js +2 -2
  43. package/dist/utilities/toml.cjs +4 -4
  44. package/dist/utilities/toml.js +3 -3
  45. package/package.json +2 -2
package/bin/config.cjs CHANGED
@@ -377,22 +377,31 @@ var writeWarning = (message, config) => getLogFn(LogLevel.WARN, config)(message)
377
377
  var writeInfo = (message, config) => getLogFn(LogLevel.INFO, config)(message);
378
378
  var writeSuccess = (message, config) => getLogFn(LogLevel.SUCCESS, config)(message);
379
379
  var writeTrace = (message, config) => getLogFn(LogLevel.TRACE, config)(message);
380
- var MAX_DEPTH = 6;
380
+ var MAX_DEPTH = 10;
381
381
  var formatLogMessage = (message, options = {}, depth2 = 0) => {
382
382
  if (depth2 > MAX_DEPTH) {
383
383
  return "<max depth>";
384
384
  }
385
- const prefix = options.prefix ?? "-";
385
+ const prefix = options.prefix ?? "";
386
386
  const skip = options.skip ?? [];
387
- return typeof message === "undefined" || message === null || !message && typeof message !== "boolean" ? "<none>" : typeof message === "string" ? message : Array.isArray(message) ? `
388
- ${message.map((item, index) => ` ${prefix}> #${index} = ${formatLogMessage(item, { prefix: `${prefix}-`, skip }, depth2 + 1)}`).join("\n")}` : typeof message === "object" ? `
389
- ${Object.keys(message).filter((key) => !skip.includes(key)).map(
390
- (key) => ` ${prefix}> ${key} = ${_isFunction(message[key]) ? "<function>" : typeof message[key] === "object" ? formatLogMessage(
387
+ const sort = options.sort ?? true;
388
+ return typeof message === "undefined" || message === null ? "<empty>" : typeof message === "string" ? !message ? "<empty string>" : message : Array.isArray(message) ? `
389
+ ${message.map(
390
+ (item, index) => ` ${prefix}> #${index} = ${formatLogMessage(
391
+ item,
392
+ { prefix: `${prefix}--`, skip, sort },
393
+ depth2 + 1
394
+ )}`
395
+ ).join("\n")}` : typeof message === "object" ? `
396
+ ${Object.keys(message).filter((key) => !skip.includes(key)).sort(sort ? (a, b) => a.localeCompare(b) : void 0).map(
397
+ (key) => ` ${prefix}> ${key} = ${_isFunction(message[key]) ? "<function>" : typeof message[key] === "object" ? Object.keys(message[key]).filter(
398
+ (key2) => !skip.includes(key2)
399
+ ).length === 0 ? "{}" : formatLogMessage(
391
400
  message[key],
392
- { prefix: `${prefix}-`, skip },
401
+ { prefix: `${prefix}--`, skip, sort },
393
402
  depth2 + 1
394
403
  ) : message[key]}`
395
- ).join("\n")}` : message;
404
+ ).join("\n")}` : String(message);
396
405
  };
397
406
  var _isFunction = (value) => {
398
407
  try {
package/bin/config.js CHANGED
@@ -344,22 +344,31 @@ var writeWarning = (message, config) => getLogFn(LogLevel.WARN, config)(message)
344
344
  var writeInfo = (message, config) => getLogFn(LogLevel.INFO, config)(message);
345
345
  var writeSuccess = (message, config) => getLogFn(LogLevel.SUCCESS, config)(message);
346
346
  var writeTrace = (message, config) => getLogFn(LogLevel.TRACE, config)(message);
347
- var MAX_DEPTH = 6;
347
+ var MAX_DEPTH = 10;
348
348
  var formatLogMessage = (message, options = {}, depth2 = 0) => {
349
349
  if (depth2 > MAX_DEPTH) {
350
350
  return "<max depth>";
351
351
  }
352
- const prefix = options.prefix ?? "-";
352
+ const prefix = options.prefix ?? "";
353
353
  const skip = options.skip ?? [];
354
- return typeof message === "undefined" || message === null || !message && typeof message !== "boolean" ? "<none>" : typeof message === "string" ? message : Array.isArray(message) ? `
355
- ${message.map((item, index) => ` ${prefix}> #${index} = ${formatLogMessage(item, { prefix: `${prefix}-`, skip }, depth2 + 1)}`).join("\n")}` : typeof message === "object" ? `
356
- ${Object.keys(message).filter((key) => !skip.includes(key)).map(
357
- (key) => ` ${prefix}> ${key} = ${_isFunction(message[key]) ? "<function>" : typeof message[key] === "object" ? formatLogMessage(
354
+ const sort = options.sort ?? true;
355
+ return typeof message === "undefined" || message === null ? "<empty>" : typeof message === "string" ? !message ? "<empty string>" : message : Array.isArray(message) ? `
356
+ ${message.map(
357
+ (item, index) => ` ${prefix}> #${index} = ${formatLogMessage(
358
+ item,
359
+ { prefix: `${prefix}--`, skip, sort },
360
+ depth2 + 1
361
+ )}`
362
+ ).join("\n")}` : typeof message === "object" ? `
363
+ ${Object.keys(message).filter((key) => !skip.includes(key)).sort(sort ? (a, b) => a.localeCompare(b) : void 0).map(
364
+ (key) => ` ${prefix}> ${key} = ${_isFunction(message[key]) ? "<function>" : typeof message[key] === "object" ? Object.keys(message[key]).filter(
365
+ (key2) => !skip.includes(key2)
366
+ ).length === 0 ? "{}" : formatLogMessage(
358
367
  message[key],
359
- { prefix: `${prefix}-`, skip },
368
+ { prefix: `${prefix}--`, skip, sort },
360
369
  depth2 + 1
361
370
  ) : message[key]}`
362
- ).join("\n")}` : message;
371
+ ).join("\n")}` : String(message);
363
372
  };
364
373
  var _isFunction = (value) => {
365
374
  try {
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2
2
 
3
3
 
4
- var _chunkDZS54O6Ncjs = require('./chunk-DZS54O6N.cjs');
4
+ var _chunkAZJQFL6Wcjs = require('./chunk-AZJQFL6W.cjs');
5
5
 
6
6
 
7
7
  var _chunk7QBTVNMRcjs = require('./chunk-7QBTVNMR.cjs');
@@ -9,14 +9,14 @@ var _chunk7QBTVNMRcjs = require('./chunk-7QBTVNMR.cjs');
9
9
  // src/logger/create-logger.ts
10
10
  var _chalk = require('chalk'); var _chalk2 = _interopRequireDefault(_chalk);
11
11
  async function createLogger(config) {
12
- const writeFatal = _chunkDZS54O6Ncjs.getLogFn.call(void 0, _chunk7QBTVNMRcjs.LogLevel.FATAL, config, { chalk: _chalk2.default });
13
- const writeError = _chunkDZS54O6Ncjs.getLogFn.call(void 0, _chunk7QBTVNMRcjs.LogLevel.ERROR, config, { chalk: _chalk2.default });
14
- const writeWarning = _chunkDZS54O6Ncjs.getLogFn.call(void 0, _chunk7QBTVNMRcjs.LogLevel.WARN, config, { chalk: _chalk2.default });
15
- const writeInfo = _chunkDZS54O6Ncjs.getLogFn.call(void 0, _chunk7QBTVNMRcjs.LogLevel.INFO, config, { chalk: _chalk2.default });
16
- const writeSuccess = _chunkDZS54O6Ncjs.getLogFn.call(void 0, _chunk7QBTVNMRcjs.LogLevel.SUCCESS, config, { chalk: _chalk2.default });
17
- const writeDebug = _chunkDZS54O6Ncjs.getLogFn.call(void 0, _chunk7QBTVNMRcjs.LogLevel.DEBUG, config, { chalk: _chalk2.default });
18
- const writePerformance = _chunkDZS54O6Ncjs.getLogFn.call(void 0, _chunk7QBTVNMRcjs.LogLevel.PERFORMANCE, config, { chalk: _chalk2.default });
19
- const writeTrace = _chunkDZS54O6Ncjs.getLogFn.call(void 0, _chunk7QBTVNMRcjs.LogLevel.TRACE, config, { chalk: _chalk2.default });
12
+ const writeFatal = _chunkAZJQFL6Wcjs.getLogFn.call(void 0, _chunk7QBTVNMRcjs.LogLevel.FATAL, config, { chalk: _chalk2.default });
13
+ const writeError = _chunkAZJQFL6Wcjs.getLogFn.call(void 0, _chunk7QBTVNMRcjs.LogLevel.ERROR, config, { chalk: _chalk2.default });
14
+ const writeWarning = _chunkAZJQFL6Wcjs.getLogFn.call(void 0, _chunk7QBTVNMRcjs.LogLevel.WARN, config, { chalk: _chalk2.default });
15
+ const writeInfo = _chunkAZJQFL6Wcjs.getLogFn.call(void 0, _chunk7QBTVNMRcjs.LogLevel.INFO, config, { chalk: _chalk2.default });
16
+ const writeSuccess = _chunkAZJQFL6Wcjs.getLogFn.call(void 0, _chunk7QBTVNMRcjs.LogLevel.SUCCESS, config, { chalk: _chalk2.default });
17
+ const writeDebug = _chunkAZJQFL6Wcjs.getLogFn.call(void 0, _chunk7QBTVNMRcjs.LogLevel.DEBUG, config, { chalk: _chalk2.default });
18
+ const writePerformance = _chunkAZJQFL6Wcjs.getLogFn.call(void 0, _chunk7QBTVNMRcjs.LogLevel.PERFORMANCE, config, { chalk: _chalk2.default });
19
+ const writeTrace = _chunkAZJQFL6Wcjs.getLogFn.call(void 0, _chunk7QBTVNMRcjs.LogLevel.TRACE, config, { chalk: _chalk2.default });
20
20
  return {
21
21
  fatal: writeFatal,
22
22
  error: writeError,
@@ -26,7 +26,7 @@ async function createLogger(config) {
26
26
  performance: writePerformance,
27
27
  debug: writeDebug,
28
28
  trace: writeTrace,
29
- getStopwatch: _chunkDZS54O6Ncjs.getStopwatch
29
+ getStopwatch: _chunkAZJQFL6Wcjs.getStopwatch
30
30
  };
31
31
  }
32
32
 
@@ -889,22 +889,31 @@ var getStopwatch = (name) => {
889
889
  );
890
890
  };
891
891
  };
892
- var MAX_DEPTH = 6;
892
+ var MAX_DEPTH = 10;
893
893
  var formatLogMessage = (message, options = {}, depth = 0) => {
894
894
  if (depth > MAX_DEPTH) {
895
895
  return "<max depth>";
896
896
  }
897
- const prefix = options.prefix ?? "-";
897
+ const prefix = options.prefix ?? "";
898
898
  const skip = options.skip ?? [];
899
- return typeof message === "undefined" || message === null || !message && typeof message !== "boolean" ? "<none>" : typeof message === "string" ? message : Array.isArray(message) ? `
900
- ${message.map((item, index) => ` ${prefix}> #${index} = ${formatLogMessage(item, { prefix: `${prefix}-`, skip }, depth + 1)}`).join("\n")}` : typeof message === "object" ? `
901
- ${Object.keys(message).filter((key) => !skip.includes(key)).map(
902
- (key) => ` ${prefix}> ${key} = ${_isFunction(message[key]) ? "<function>" : typeof message[key] === "object" ? formatLogMessage(
899
+ const sort = options.sort ?? true;
900
+ return typeof message === "undefined" || message === null ? "<empty>" : typeof message === "string" ? !message ? "<empty string>" : message : Array.isArray(message) ? `
901
+ ${message.map(
902
+ (item, index) => ` ${prefix}> #${index} = ${formatLogMessage(
903
+ item,
904
+ { prefix: `${prefix}--`, skip, sort },
905
+ depth + 1
906
+ )}`
907
+ ).join("\n")}` : typeof message === "object" ? `
908
+ ${Object.keys(message).filter((key) => !skip.includes(key)).sort(sort ? (a, b) => a.localeCompare(b) : void 0).map(
909
+ (key) => ` ${prefix}> ${key} = ${_isFunction(message[key]) ? "<function>" : typeof message[key] === "object" ? Object.keys(message[key]).filter(
910
+ (key2) => !skip.includes(key2)
911
+ ).length === 0 ? "{}" : formatLogMessage(
903
912
  message[key],
904
- { prefix: `${prefix}-`, skip },
913
+ { prefix: `${prefix}--`, skip, sort },
905
914
  depth + 1
906
915
  ) : message[key]}`
907
- ).join("\n")}` : message;
916
+ ).join("\n")}` : String(message);
908
917
  };
909
918
  var _isFunction = (value) => {
910
919
  try {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getLogFn,
3
3
  getStopwatch
4
- } from "./chunk-TOMKPXJE.js";
4
+ } from "./chunk-4UFIHIMZ.js";
5
5
  import {
6
6
  LogLevel
7
7
  } from "./chunk-RALMUN5C.js";
@@ -889,22 +889,31 @@ var getStopwatch = (name) => {
889
889
  );
890
890
  };
891
891
  };
892
- var MAX_DEPTH = 6;
892
+ var MAX_DEPTH = 10;
893
893
  var formatLogMessage = (message, options = {}, depth = 0) => {
894
894
  if (depth > MAX_DEPTH) {
895
895
  return "<max depth>";
896
896
  }
897
- const prefix = _nullishCoalesce(options.prefix, () => ( "-"));
897
+ const prefix = _nullishCoalesce(options.prefix, () => ( ""));
898
898
  const skip = _nullishCoalesce(options.skip, () => ( []));
899
- return typeof message === "undefined" || message === null || !message && typeof message !== "boolean" ? "<none>" : typeof message === "string" ? message : Array.isArray(message) ? `
900
- ${message.map((item, index) => ` ${prefix}> #${index} = ${formatLogMessage(item, { prefix: `${prefix}-`, skip }, depth + 1)}`).join("\n")}` : typeof message === "object" ? `
901
- ${Object.keys(message).filter((key) => !skip.includes(key)).map(
902
- (key) => ` ${prefix}> ${key} = ${_isFunction(message[key]) ? "<function>" : typeof message[key] === "object" ? formatLogMessage(
899
+ const sort = _nullishCoalesce(options.sort, () => ( true));
900
+ return typeof message === "undefined" || message === null ? "<empty>" : typeof message === "string" ? !message ? "<empty string>" : message : Array.isArray(message) ? `
901
+ ${message.map(
902
+ (item, index) => ` ${prefix}> #${index} = ${formatLogMessage(
903
+ item,
904
+ { prefix: `${prefix}--`, skip, sort },
905
+ depth + 1
906
+ )}`
907
+ ).join("\n")}` : typeof message === "object" ? `
908
+ ${Object.keys(message).filter((key) => !skip.includes(key)).sort(sort ? (a, b) => a.localeCompare(b) : void 0).map(
909
+ (key) => ` ${prefix}> ${key} = ${_isFunction(message[key]) ? "<function>" : typeof message[key] === "object" ? Object.keys(message[key]).filter(
910
+ (key2) => !skip.includes(key2)
911
+ ).length === 0 ? "{}" : formatLogMessage(
903
912
  message[key],
904
- { prefix: `${prefix}-`, skip },
913
+ { prefix: `${prefix}--`, skip, sort },
905
914
  depth + 1
906
915
  ) : message[key]}`
907
- ).join("\n")}` : message;
916
+ ).join("\n")}` : String(message);
908
917
  };
909
918
  var _isFunction = (value) => {
910
919
  try {
@@ -3,7 +3,7 @@
3
3
  var _chunk3CNCDDWZcjs = require('./chunk-3CNCDDWZ.cjs');
4
4
 
5
5
 
6
- var _chunkDZS54O6Ncjs = require('./chunk-DZS54O6N.cjs');
6
+ var _chunkAZJQFL6Wcjs = require('./chunk-AZJQFL6W.cjs');
7
7
 
8
8
 
9
9
  var _chunkBDATZ3UBcjs = require('./chunk-BDATZ3UB.cjs');
@@ -52,7 +52,7 @@ var getConfigFile = async (filePath, additionalFileNames = []) => {
52
52
  let config = result.config;
53
53
  const configFile = result.configFile;
54
54
  if (config && configFile && Object.keys(config).length > 0 && !config.skipConfigLogging) {
55
- _chunkDZS54O6Ncjs.writeTrace.call(void 0,
55
+ _chunkAZJQFL6Wcjs.writeTrace.call(void 0,
56
56
  `Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`,
57
57
  {
58
58
  logLevel: "all"
@@ -68,7 +68,7 @@ var getConfigFile = async (filePath, additionalFileNames = []) => {
68
68
  for (const result2 of results) {
69
69
  if (_optionalChain([result2, 'optionalAccess', _5 => _5.config]) && _optionalChain([result2, 'optionalAccess', _6 => _6.configFile]) && Object.keys(result2.config).length > 0) {
70
70
  if (!config.skipConfigLogging && !result2.config.skipConfigLogging) {
71
- _chunkDZS54O6Ncjs.writeTrace.call(void 0,
71
+ _chunkAZJQFL6Wcjs.writeTrace.call(void 0,
72
72
  `Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`,
73
73
  {
74
74
  logLevel: "all"
@@ -1,14 +1,14 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
- var _chunkEEPODKNEcjs = require('./chunk-EEPODKNE.cjs');
4
+ var _chunkOLW3Y2DAcjs = require('./chunk-OLW3Y2DA.cjs');
5
5
 
6
6
 
7
7
  var _chunk3CNCDDWZcjs = require('./chunk-3CNCDDWZ.cjs');
8
8
 
9
9
  // src/get-config.ts
10
10
  function getConfig(workspaceRoot, skipLogs = false) {
11
- return _chunkEEPODKNEcjs.loadStormWorkspaceConfig.call(void 0, workspaceRoot, skipLogs);
11
+ return _chunkOLW3Y2DAcjs.loadStormWorkspaceConfig.call(void 0, workspaceRoot, skipLogs);
12
12
  }
13
13
  function getWorkspaceConfig(skipLogs = true, options = {}) {
14
14
  let workspaceRoot = options.workspaceRoot;
@@ -23,7 +23,7 @@ async function tryGetWorkspaceConfig(skipLogs = true, options = {}) {
23
23
  if (!workspaceRoot) {
24
24
  workspaceRoot = _chunk3CNCDDWZcjs.findWorkspaceRoot.call(void 0, options.cwd);
25
25
  }
26
- return _chunkEEPODKNEcjs.tryLoadStormWorkspaceConfig.call(void 0,
26
+ return _chunkOLW3Y2DAcjs.tryLoadStormWorkspaceConfig.call(void 0,
27
27
  workspaceRoot,
28
28
  skipLogs,
29
29
  options.useDefault
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-LF3SAK2O.js";
4
4
  import {
5
5
  writeTrace
6
- } from "./chunk-TOMKPXJE.js";
6
+ } from "./chunk-4UFIHIMZ.js";
7
7
  import {
8
8
  joinPaths
9
9
  } from "./chunk-V3GMJ4TX.js";
@@ -0,0 +1,40 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+ var _chunkQXMSQMVNcjs = require('./chunk-QXMSQMVN.cjs');
5
+
6
+
7
+ var _chunk3CNCDDWZcjs = require('./chunk-3CNCDDWZ.cjs');
8
+
9
+ // src/get-config.ts
10
+ function getConfig(workspaceRoot, skipLogs = false) {
11
+ return _chunkQXMSQMVNcjs.loadStormWorkspaceConfig.call(void 0, workspaceRoot, skipLogs);
12
+ }
13
+ function getWorkspaceConfig(skipLogs = true, options = {}) {
14
+ let workspaceRoot = options.workspaceRoot;
15
+ if (!workspaceRoot) {
16
+ workspaceRoot = _chunk3CNCDDWZcjs.findWorkspaceRoot.call(void 0, options.cwd);
17
+ }
18
+ return getConfig(workspaceRoot, skipLogs);
19
+ }
20
+ async function tryGetWorkspaceConfig(skipLogs = true, options = {}) {
21
+ try {
22
+ let workspaceRoot = options.workspaceRoot;
23
+ if (!workspaceRoot) {
24
+ workspaceRoot = _chunk3CNCDDWZcjs.findWorkspaceRoot.call(void 0, options.cwd);
25
+ }
26
+ return _chunkQXMSQMVNcjs.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;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  loadStormWorkspaceConfig,
3
3
  tryLoadStormWorkspaceConfig
4
- } from "./chunk-KVDT6KNS.js";
4
+ } from "./chunk-UZBUUPX4.js";
5
5
  import {
6
6
  findWorkspaceRoot
7
7
  } from "./chunk-LF3SAK2O.js";
@@ -3,7 +3,7 @@ import {
3
3
  writeFatal,
4
4
  writeSuccess,
5
5
  writeTrace
6
- } from "./chunk-TOMKPXJE.js";
6
+ } from "./chunk-4UFIHIMZ.js";
7
7
 
8
8
  // src/utilities/process-handler.ts
9
9
  var exitWithError = (config) => {
@@ -1,25 +1,25 @@
1
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
2
 
3
- var _chunkPAQH5U2Fcjs = require('./chunk-PAQH5U2F.cjs');
4
3
 
4
+ var _chunkNHILCONIcjs = require('./chunk-NHILCONI.cjs');
5
5
 
6
6
 
7
- var _chunkCFXT4ZAWcjs = require('./chunk-CFXT4ZAW.cjs');
7
+ var _chunkB2CQPVVLcjs = require('./chunk-B2CQPVVL.cjs');
8
8
 
9
9
 
10
- var _chunk3CNCDDWZcjs = require('./chunk-3CNCDDWZ.cjs');
10
+ var _chunkDFWIRJGHcjs = require('./chunk-DFWIRJGH.cjs');
11
11
 
12
12
 
13
13
 
14
+ var _chunkCFXT4ZAWcjs = require('./chunk-CFXT4ZAW.cjs');
14
15
 
15
- var _chunkDZS54O6Ncjs = require('./chunk-DZS54O6N.cjs');
16
16
 
17
+ var _chunk3CNCDDWZcjs = require('./chunk-3CNCDDWZ.cjs');
17
18
 
18
- var _chunkB2CQPVVLcjs = require('./chunk-B2CQPVVL.cjs');
19
19
 
20
20
 
21
21
 
22
- var _chunkNHILCONIcjs = require('./chunk-NHILCONI.cjs');
22
+ var _chunkAZJQFL6Wcjs = require('./chunk-AZJQFL6W.cjs');
23
23
 
24
24
 
25
25
  var _chunkBDATZ3UBcjs = require('./chunk-BDATZ3UB.cjs');
@@ -38,10 +38,10 @@ var createStormWorkspaceConfig = async (extensionName, schema, workspaceRoot, sk
38
38
  _workspaceRoot = _chunk3CNCDDWZcjs.findWorkspaceRoot.call(void 0, );
39
39
  }
40
40
  const configEnv = _chunkNHILCONIcjs.getConfigEnv.call(void 0, );
41
- const configFile = await _chunkPAQH5U2Fcjs.getConfigFile.call(void 0, _workspaceRoot);
41
+ const configFile = await _chunkDFWIRJGHcjs.getConfigFile.call(void 0, _workspaceRoot);
42
42
  if (!configFile) {
43
43
  if (!skipLogs) {
44
- _chunkDZS54O6Ncjs.writeWarning.call(void 0,
44
+ _chunkAZJQFL6Wcjs.writeWarning.call(void 0,
45
45
  "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",
46
46
  { logLevel: "all" }
47
47
  );
@@ -72,7 +72,7 @@ var createStormWorkspaceConfig = async (extensionName, schema, workspaceRoot, sk
72
72
  throw new Error(
73
73
  `Failed to parse Storm Workspace configuration${_optionalChain([error, 'optionalAccess', _3 => _3.message]) ? `: ${error.message}` : ""}
74
74
 
75
- Please ensure your configuration file is valid JSON and matches the expected schema. The current workspace configuration input is: ${_chunkDZS54O6Ncjs.formatLogMessage.call(void 0,
75
+ Please ensure your configuration file is valid JSON and matches the expected schema. The current workspace configuration input is: ${_chunkAZJQFL6Wcjs.formatLogMessage.call(void 0,
76
76
  configInput
77
77
  )}`,
78
78
  {
@@ -117,9 +117,9 @@ var loadStormWorkspaceConfig = async (workspaceRoot, skipLogs = false) => {
117
117
  );
118
118
  _chunkB2CQPVVLcjs.setConfigEnv.call(void 0, config);
119
119
  if (!skipLogs && !config.skipConfigLogging) {
120
- _chunkDZS54O6Ncjs.writeTrace.call(void 0,
120
+ _chunkAZJQFL6Wcjs.writeTrace.call(void 0,
121
121
  `\u2699\uFE0F Using Storm Workspace configuration:
122
- ${_chunkDZS54O6Ncjs.formatLogMessage.call(void 0, config)}`,
122
+ ${_chunkAZJQFL6Wcjs.formatLogMessage.call(void 0, config)}`,
123
123
  config
124
124
  );
125
125
  }
@@ -139,16 +139,16 @@ var tryLoadStormWorkspaceConfig = async (workspaceRoot, skipLogs = true, useDefa
139
139
  }
140
140
  _chunkB2CQPVVLcjs.setConfigEnv.call(void 0, config);
141
141
  if (!skipLogs && !config.skipConfigLogging) {
142
- _chunkDZS54O6Ncjs.writeTrace.call(void 0,
142
+ _chunkAZJQFL6Wcjs.writeTrace.call(void 0,
143
143
  `\u2699\uFE0F Using Storm Workspace configuration:
144
- ${_chunkDZS54O6Ncjs.formatLogMessage.call(void 0, config)}`,
144
+ ${_chunkAZJQFL6Wcjs.formatLogMessage.call(void 0, config)}`,
145
145
  config
146
146
  );
147
147
  }
148
148
  return config;
149
149
  } catch (error) {
150
150
  if (!skipLogs) {
151
- _chunkDZS54O6Ncjs.writeWarning.call(void 0,
151
+ _chunkAZJQFL6Wcjs.writeWarning.call(void 0,
152
152
  `\u26A0\uFE0F Failed to load Storm Workspace configuration: ${error}`,
153
153
  { logLevel: "all" }
154
154
  );
@@ -0,0 +1,165 @@
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 _chunkDFWIRJGHcjs = require('./chunk-DFWIRJGH.cjs');
4
+
5
+
6
+
7
+ var _chunkCFXT4ZAWcjs = require('./chunk-CFXT4ZAW.cjs');
8
+
9
+
10
+ var _chunk3CNCDDWZcjs = require('./chunk-3CNCDDWZ.cjs');
11
+
12
+
13
+
14
+
15
+ var _chunkAZJQFL6Wcjs = require('./chunk-AZJQFL6W.cjs');
16
+
17
+
18
+ var _chunkB2CQPVVLcjs = require('./chunk-B2CQPVVL.cjs');
19
+
20
+
21
+
22
+ var _chunkNHILCONIcjs = require('./chunk-NHILCONI.cjs');
23
+
24
+
25
+ var _chunkBDATZ3UBcjs = require('./chunk-BDATZ3UB.cjs');
26
+
27
+ // src/create-storm-config.ts
28
+ var _schema = require('@storm-software/config/schema');
29
+ var _defu = require('defu'); var _defu2 = _interopRequireDefault(_defu);
30
+ var _fs = require('fs');
31
+ var _extension_cache = /* @__PURE__ */ new WeakMap();
32
+ var _static_cache = void 0;
33
+ var createStormWorkspaceConfig = async (extensionName, schema, workspaceRoot, skipLogs = false, useDefault = true) => {
34
+ let result;
35
+ if (!_optionalChain([_static_cache, 'optionalAccess', _ => _.data]) || !_optionalChain([_static_cache, 'optionalAccess', _2 => _2.timestamp]) || _static_cache.timestamp < Date.now() - 8e3) {
36
+ let _workspaceRoot = workspaceRoot;
37
+ if (!_workspaceRoot) {
38
+ _workspaceRoot = _chunk3CNCDDWZcjs.findWorkspaceRoot.call(void 0, );
39
+ }
40
+ const configEnv = _chunkNHILCONIcjs.getConfigEnv.call(void 0, );
41
+ const configFile = await _chunkDFWIRJGHcjs.getConfigFile.call(void 0, _workspaceRoot);
42
+ if (!configFile) {
43
+ if (!skipLogs) {
44
+ _chunkAZJQFL6Wcjs.writeWarning.call(void 0,
45
+ "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",
46
+ { logLevel: "all" }
47
+ );
48
+ }
49
+ if (useDefault === false) {
50
+ return void 0;
51
+ }
52
+ }
53
+ const defaultConfig = await _chunkCFXT4ZAWcjs.getPackageJsonConfig.call(void 0, _workspaceRoot);
54
+ const configInput = _defu2.default.call(void 0,
55
+ configEnv,
56
+ configFile,
57
+ defaultConfig
58
+ );
59
+ if (!configInput.variant) {
60
+ configInput.variant = _fs.existsSync.call(void 0, _chunkBDATZ3UBcjs.joinPaths.call(void 0, _workspaceRoot, "nx.json")) || _fs.existsSync.call(void 0, _chunkBDATZ3UBcjs.joinPaths.call(void 0, _workspaceRoot, ".nx")) || _fs.existsSync.call(void 0, _chunkBDATZ3UBcjs.joinPaths.call(void 0, _workspaceRoot, "lerna.json")) || _fs.existsSync.call(void 0, _chunkBDATZ3UBcjs.joinPaths.call(void 0, _workspaceRoot, "turbo.json")) ? "monorepo" : "minimal";
61
+ }
62
+ try {
63
+ const parseResult = await Promise.resolve(
64
+ _schema.workspaceConfigSchema._zod.parse(
65
+ { value: configInput, issues: [] },
66
+ { async: true }
67
+ )
68
+ );
69
+ result = _chunkCFXT4ZAWcjs.applyDefaultConfig.call(void 0, parseResult.value);
70
+ result.workspaceRoot ??= _workspaceRoot;
71
+ } catch (error) {
72
+ throw new Error(
73
+ `Failed to parse Storm Workspace configuration${_optionalChain([error, 'optionalAccess', _3 => _3.message]) ? `: ${error.message}` : ""}
74
+
75
+ Please ensure your configuration file is valid JSON and matches the expected schema. The current workspace configuration input is: ${_chunkAZJQFL6Wcjs.formatLogMessage.call(void 0,
76
+ configInput
77
+ )}`,
78
+ {
79
+ cause: error
80
+ }
81
+ );
82
+ }
83
+ } else {
84
+ result = _static_cache.data;
85
+ }
86
+ if (schema && extensionName) {
87
+ result.extensions = {
88
+ ...result.extensions,
89
+ [extensionName]: createConfigExtension(extensionName, schema)
90
+ };
91
+ }
92
+ _static_cache = {
93
+ timestamp: Date.now(),
94
+ data: result
95
+ };
96
+ return result;
97
+ };
98
+ var createConfigExtension = (extensionName, schema) => {
99
+ const extension_cache_key = { extensionName };
100
+ if (_extension_cache.has(extension_cache_key)) {
101
+ return _extension_cache.get(extension_cache_key);
102
+ }
103
+ let extension = _chunkNHILCONIcjs.getExtensionEnv.call(void 0, extensionName);
104
+ if (schema) {
105
+ extension = schema.parse(extension);
106
+ }
107
+ _extension_cache.set(extension_cache_key, extension);
108
+ return extension;
109
+ };
110
+ var loadStormWorkspaceConfig = async (workspaceRoot, skipLogs = false) => {
111
+ const config = await createStormWorkspaceConfig(
112
+ void 0,
113
+ void 0,
114
+ workspaceRoot,
115
+ skipLogs,
116
+ true
117
+ );
118
+ _chunkB2CQPVVLcjs.setConfigEnv.call(void 0, config);
119
+ if (!skipLogs && !config.skipConfigLogging) {
120
+ _chunkAZJQFL6Wcjs.writeTrace.call(void 0,
121
+ `\u2699\uFE0F Using Storm Workspace configuration:
122
+ ${_chunkAZJQFL6Wcjs.formatLogMessage.call(void 0, config)}`,
123
+ config
124
+ );
125
+ }
126
+ return config;
127
+ };
128
+ var tryLoadStormWorkspaceConfig = async (workspaceRoot, skipLogs = true, useDefault = false) => {
129
+ try {
130
+ const config = await createStormWorkspaceConfig(
131
+ void 0,
132
+ void 0,
133
+ workspaceRoot,
134
+ skipLogs,
135
+ useDefault
136
+ );
137
+ if (!config) {
138
+ return void 0;
139
+ }
140
+ _chunkB2CQPVVLcjs.setConfigEnv.call(void 0, config);
141
+ if (!skipLogs && !config.skipConfigLogging) {
142
+ _chunkAZJQFL6Wcjs.writeTrace.call(void 0,
143
+ `\u2699\uFE0F Using Storm Workspace configuration:
144
+ ${_chunkAZJQFL6Wcjs.formatLogMessage.call(void 0, config)}`,
145
+ config
146
+ );
147
+ }
148
+ return config;
149
+ } catch (error) {
150
+ if (!skipLogs) {
151
+ _chunkAZJQFL6Wcjs.writeWarning.call(void 0,
152
+ `\u26A0\uFE0F Failed to load Storm Workspace configuration: ${error}`,
153
+ { logLevel: "all" }
154
+ );
155
+ }
156
+ return void 0;
157
+ }
158
+ };
159
+
160
+
161
+
162
+
163
+
164
+
165
+ exports.createStormWorkspaceConfig = createStormWorkspaceConfig; exports.createConfigExtension = createConfigExtension; exports.loadStormWorkspaceConfig = loadStormWorkspaceConfig; exports.tryLoadStormWorkspaceConfig = tryLoadStormWorkspaceConfig;
@@ -1,13 +1,13 @@
1
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
2
 
3
- var _chunkDZS54O6Ncjs = require('./chunk-DZS54O6N.cjs');
3
+ var _chunkAZJQFL6Wcjs = require('./chunk-AZJQFL6W.cjs');
4
4
 
5
5
  // src/utilities/toml.ts
6
6
  var _jtoml = require('@ltd/j-toml'); var _jtoml2 = _interopRequireDefault(_jtoml);
7
7
  function parseCargoTomlWithTree(tree, projectRoot, projectName) {
8
8
  const cargoTomlString = _optionalChain([tree, 'access', _ => _.read, 'call', _2 => _2(`${projectRoot}/Cargo.toml`), 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]);
9
9
  if (!cargoTomlString) {
10
- _chunkDZS54O6Ncjs.writeError.call(void 0, `Cannot find a Cargo.toml file in the ${projectName}`);
10
+ _chunkAZJQFL6Wcjs.writeError.call(void 0, `Cannot find a Cargo.toml file in the ${projectName}`);
11
11
  throw new Error();
12
12
  }
13
13
  return parseCargoToml(cargoTomlString);
@@ -0,0 +1,40 @@
1
+ import {
2
+ loadStormWorkspaceConfig,
3
+ tryLoadStormWorkspaceConfig
4
+ } from "./chunk-UWI3QVYJ.js";
5
+ import {
6
+ findWorkspaceRoot
7
+ } from "./chunk-LF3SAK2O.js";
8
+
9
+ // src/get-config.ts
10
+ function getConfig(workspaceRoot, skipLogs = false) {
11
+ return loadStormWorkspaceConfig(workspaceRoot, skipLogs);
12
+ }
13
+ function getWorkspaceConfig(skipLogs = true, options = {}) {
14
+ let workspaceRoot = options.workspaceRoot;
15
+ if (!workspaceRoot) {
16
+ workspaceRoot = findWorkspaceRoot(options.cwd);
17
+ }
18
+ return getConfig(workspaceRoot, skipLogs);
19
+ }
20
+ async function tryGetWorkspaceConfig(skipLogs = true, 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
+ };