@storm-software/config-tools 1.190.119 → 1.190.121

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 (211) hide show
  1. package/README.md +1 -1
  2. package/bin/config.cjs +1213 -1558
  3. package/bin/config.mjs +1271 -0
  4. package/dist/_virtual/_rolldown/runtime.cjs +23 -0
  5. package/dist/config-file/get-config-file.cjs +67 -28
  6. package/dist/config-file/get-config-file.d.cts +5 -5
  7. package/dist/config-file/{get-config-file.d.ts → get-config-file.d.mts} +7 -5
  8. package/dist/config-file/get-config-file.mjs +66 -0
  9. package/dist/config-file/index.cjs +4 -29
  10. package/dist/config-file/index.d.cts +2 -3
  11. package/dist/config-file/index.d.mts +4 -0
  12. package/dist/config-file/index.mjs +5 -0
  13. package/dist/create-storm-config.cjs +115 -34
  14. package/dist/create-storm-config.d.cts +5 -5
  15. package/dist/{create-storm-config.d.ts → create-storm-config.d.mts} +7 -5
  16. package/dist/create-storm-config.mjs +113 -0
  17. package/dist/env/get-env.cjs +202 -11
  18. package/dist/env/get-env.d.cts +5 -5
  19. package/dist/env/{get-env.d.ts → get-env.d.mts} +7 -5
  20. package/dist/env/get-env.mjs +203 -0
  21. package/dist/env/index.cjs +7 -18
  22. package/dist/env/index.d.cts +3 -4
  23. package/dist/env/index.d.mts +5 -0
  24. package/dist/env/index.mjs +6 -0
  25. package/dist/env/set-env.cjs +230 -11
  26. package/dist/env/set-env.d.cts +8 -8
  27. package/dist/env/{set-env.d.ts → set-env.d.mts} +10 -8
  28. package/dist/env/set-env.mjs +231 -0
  29. package/dist/get-config.cjs +46 -34
  30. package/dist/get-config.d.cts +18 -18
  31. package/dist/{get-config.d.ts → get-config.d.mts} +20 -18
  32. package/dist/get-config.mjs +46 -0
  33. package/dist/index.cjs +98 -201
  34. package/dist/index.d.cts +27 -28
  35. package/dist/index.d.mts +29 -0
  36. package/dist/index.mjs +26 -0
  37. package/dist/logger/chalk.cjs +43 -6
  38. package/dist/logger/chalk.d.cts +18 -17
  39. package/dist/logger/chalk.d.mts +37 -0
  40. package/dist/logger/chalk.mjs +43 -0
  41. package/dist/logger/console-icons.cjs +18 -8
  42. package/dist/logger/console-icons.d.cts +5 -8
  43. package/dist/logger/console-icons.d.mts +7 -0
  44. package/dist/logger/console-icons.mjs +20 -0
  45. package/dist/logger/console.cjs +195 -37
  46. package/dist/logger/console.d.cts +25 -25
  47. package/dist/logger/{console.d.ts → console.d.mts} +27 -25
  48. package/dist/logger/console.mjs +185 -0
  49. package/dist/logger/create-logger.cjs +34 -14
  50. package/dist/logger/create-logger.d.cts +5 -6
  51. package/dist/logger/{create-logger.d.ts → create-logger.d.mts} +7 -6
  52. package/dist/logger/create-logger.mjs +34 -0
  53. package/dist/logger/format-timestamp.cjs +14 -6
  54. package/dist/logger/format-timestamp.d.cts +3 -2
  55. package/dist/logger/{format-timestamp.d.ts → format-timestamp.d.mts} +5 -2
  56. package/dist/logger/format-timestamp.mjs +16 -0
  57. package/dist/logger/get-log-level.cjs +54 -11
  58. package/dist/logger/get-log-level.d.cts +4 -5
  59. package/dist/logger/{get-log-level.d.ts → get-log-level.d.mts} +6 -5
  60. package/dist/logger/get-log-level.mjs +54 -0
  61. package/dist/logger/index.cjs +29 -61
  62. package/dist/logger/index.d.cts +8 -10
  63. package/dist/logger/index.d.mts +10 -0
  64. package/dist/logger/index.mjs +11 -0
  65. package/dist/logger/is-unicode-supported.cjs +8 -6
  66. package/dist/logger/is-unicode-supported.d.cts +3 -2
  67. package/dist/logger/is-unicode-supported.d.mts +6 -0
  68. package/dist/logger/is-unicode-supported.mjs +10 -0
  69. package/dist/types.cjs +29 -8
  70. package/dist/types.d.cts +39 -41
  71. package/dist/types.d.mts +53 -0
  72. package/dist/types.mjs +30 -0
  73. package/dist/utilities/apply-workspace-tokens.cjs +37 -13
  74. package/dist/utilities/apply-workspace-tokens.d.cts +4 -5
  75. package/dist/utilities/{apply-workspace-tokens.d.ts → apply-workspace-tokens.d.mts} +6 -5
  76. package/dist/utilities/apply-workspace-tokens.mjs +37 -0
  77. package/dist/utilities/colors.cjs +98 -12
  78. package/dist/utilities/colors.d.cts +4 -4
  79. package/dist/utilities/{colors.d.ts → colors.d.mts} +6 -4
  80. package/dist/utilities/colors.mjs +97 -0
  81. package/dist/utilities/correct-paths.cjs +201 -32
  82. package/dist/utilities/correct-paths.d.cts +4 -4
  83. package/dist/utilities/{correct-paths.d.ts → correct-paths.d.mts} +6 -4
  84. package/dist/utilities/correct-paths.mjs +190 -0
  85. package/dist/utilities/file-path-utils.cjs +48 -11
  86. package/dist/utilities/file-path-utils.d.cts +15 -14
  87. package/dist/utilities/{file-path-utils.d.ts → file-path-utils.d.mts} +17 -14
  88. package/dist/utilities/file-path-utils.mjs +48 -0
  89. package/dist/utilities/find-up.cjs +17 -6
  90. package/dist/utilities/find-up.d.cts +3 -2
  91. package/dist/utilities/{find-up.d.ts → find-up.d.mts} +5 -2
  92. package/dist/utilities/find-up.mjs +19 -0
  93. package/dist/utilities/find-workspace-root.cjs +72 -10
  94. package/dist/utilities/find-workspace-root.d.cts +3 -2
  95. package/dist/utilities/{find-workspace-root.d.ts → find-workspace-root.d.mts} +5 -2
  96. package/dist/utilities/find-workspace-root.mjs +73 -0
  97. package/dist/utilities/get-default-config.cjs +73 -11
  98. package/dist/utilities/get-default-config.d.cts +4 -4
  99. package/dist/utilities/{get-default-config.d.ts → get-default-config.d.mts} +6 -4
  100. package/dist/utilities/get-default-config.mjs +74 -0
  101. package/dist/utilities/index.cjs +49 -109
  102. package/dist/utilities/index.d.cts +10 -14
  103. package/dist/utilities/index.d.mts +12 -0
  104. package/dist/utilities/index.mjs +13 -0
  105. package/dist/utilities/process-handler.cjs +38 -18
  106. package/dist/utilities/process-handler.d.cts +4 -4
  107. package/dist/utilities/process-handler.d.mts +9 -0
  108. package/dist/utilities/process-handler.mjs +38 -0
  109. package/dist/utilities/run.cjs +64 -10
  110. package/dist/utilities/run.d.cts +5 -6
  111. package/dist/utilities/{run.d.ts → run.d.mts} +7 -6
  112. package/dist/utilities/run.mjs +64 -0
  113. package/dist/utilities/toml.cjs +37 -24
  114. package/dist/utilities/toml.d.cts +148 -147
  115. package/dist/utilities/toml.d.mts +192 -0
  116. package/dist/utilities/toml.mjs +33 -0
  117. package/package.json +106 -158
  118. package/bin/config.js +0 -1616
  119. package/dist/chunk-24B36RDB.cjs +0 -81
  120. package/dist/chunk-27N3QEX5.js +0 -40
  121. package/dist/chunk-2AVLCXLT.js +0 -0
  122. package/dist/chunk-2RLMTBVZ.js +0 -233
  123. package/dist/chunk-2WBD2G3E.cjs +0 -38
  124. package/dist/chunk-3COHMHPU.cjs +0 -1
  125. package/dist/chunk-4Q45WJYQ.js +0 -165
  126. package/dist/chunk-5C7PIENF.js +0 -92
  127. package/dist/chunk-5J2SS4QU.js +0 -83
  128. package/dist/chunk-65SWKEHV.cjs +0 -1
  129. package/dist/chunk-6Y623TCS.cjs +0 -40
  130. package/dist/chunk-7PV6L7I7.cjs +0 -1
  131. package/dist/chunk-7QBTVNMR.cjs +0 -30
  132. package/dist/chunk-BDATZ3UB.cjs +0 -233
  133. package/dist/chunk-BZRTSWH4.cjs +0 -395
  134. package/dist/chunk-D3FRXXDE.js +0 -947
  135. package/dist/chunk-DTGT4OI3.cjs +0 -14
  136. package/dist/chunk-EC2KPWRG.cjs +0 -24
  137. package/dist/chunk-EENQN6N2.js +0 -40
  138. package/dist/chunk-ENI4UUSK.cjs +0 -35
  139. package/dist/chunk-FJNXECWU.js +0 -395
  140. package/dist/chunk-FMDVBSP6.cjs +0 -83
  141. package/dist/chunk-G2MK47WL.js +0 -14
  142. package/dist/chunk-HFS7WJVW.js +0 -81
  143. package/dist/chunk-HVVJHTFS.js +0 -36
  144. package/dist/chunk-IWD6YQKX.cjs +0 -1
  145. package/dist/chunk-IWQRXQ4N.cjs +0 -84
  146. package/dist/chunk-JK4TT5IV.js +0 -35
  147. package/dist/chunk-JWLDCEBZ.cjs +0 -70
  148. package/dist/chunk-JZAYHDV3.js +0 -8
  149. package/dist/chunk-KSMN3HSC.js +0 -38
  150. package/dist/chunk-L6UNTUC4.js +0 -0
  151. package/dist/chunk-LOY6ICHZ.cjs +0 -36
  152. package/dist/chunk-MBG2FTBL.cjs +0 -47
  153. package/dist/chunk-MQG74XF7.js +0 -102
  154. package/dist/chunk-MSAQEGBK.cjs +0 -92
  155. package/dist/chunk-NJFLUTGH.cjs +0 -25
  156. package/dist/chunk-PCYB64MB.cjs +0 -40
  157. package/dist/chunk-RALMUN5C.js +0 -30
  158. package/dist/chunk-RRKB32OH.js +0 -0
  159. package/dist/chunk-RUKM6FCF.js +0 -25
  160. package/dist/chunk-SIW7AXUG.js +0 -56
  161. package/dist/chunk-SLICWTO2.cjs +0 -165
  162. package/dist/chunk-SO3FWVXC.js +0 -84
  163. package/dist/chunk-SXPH7ILL.js +0 -70
  164. package/dist/chunk-T7YISGRS.cjs +0 -102
  165. package/dist/chunk-TZZRLM5J.cjs +0 -947
  166. package/dist/chunk-UJ77IBHD.cjs +0 -233
  167. package/dist/chunk-UKGRDKIH.js +0 -0
  168. package/dist/chunk-V3GMJ4TX.js +0 -233
  169. package/dist/chunk-WQJYIPSL.cjs +0 -8
  170. package/dist/chunk-YBVOKYAM.cjs +0 -56
  171. package/dist/chunk-YX4736HU.js +0 -47
  172. package/dist/chunk-ZFNAUMQS.js +0 -24
  173. package/dist/config-file/get-config-file.js +0 -28
  174. package/dist/config-file/index.d.ts +0 -3
  175. package/dist/config-file/index.js +0 -29
  176. package/dist/create-storm-config.js +0 -35
  177. package/dist/env/get-env.js +0 -11
  178. package/dist/env/index.d.ts +0 -4
  179. package/dist/env/index.js +0 -18
  180. package/dist/env/set-env.js +0 -11
  181. package/dist/get-config.js +0 -34
  182. package/dist/index.d.ts +0 -28
  183. package/dist/index.js +0 -201
  184. package/dist/logger/chalk.d.ts +0 -34
  185. package/dist/logger/chalk.js +0 -6
  186. package/dist/logger/console-icons.d.ts +0 -8
  187. package/dist/logger/console-icons.js +0 -8
  188. package/dist/logger/console.js +0 -37
  189. package/dist/logger/create-logger.js +0 -14
  190. package/dist/logger/format-timestamp.js +0 -6
  191. package/dist/logger/get-log-level.js +0 -11
  192. package/dist/logger/index.d.ts +0 -10
  193. package/dist/logger/index.js +0 -61
  194. package/dist/logger/is-unicode-supported.d.ts +0 -3
  195. package/dist/logger/is-unicode-supported.js +0 -6
  196. package/dist/types.d.ts +0 -53
  197. package/dist/types.js +0 -8
  198. package/dist/utilities/apply-workspace-tokens.js +0 -13
  199. package/dist/utilities/colors.js +0 -12
  200. package/dist/utilities/correct-paths.js +0 -32
  201. package/dist/utilities/file-path-utils.js +0 -11
  202. package/dist/utilities/find-up.js +0 -6
  203. package/dist/utilities/find-workspace-root.js +0 -10
  204. package/dist/utilities/get-default-config.js +0 -11
  205. package/dist/utilities/index.d.ts +0 -14
  206. package/dist/utilities/index.js +0 -109
  207. package/dist/utilities/process-handler.d.ts +0 -7
  208. package/dist/utilities/process-handler.js +0 -18
  209. package/dist/utilities/run.js +0 -10
  210. package/dist/utilities/toml.d.ts +0 -189
  211. package/dist/utilities/toml.js +0 -24
@@ -0,0 +1,23 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
+ key = keys[i];
11
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
+ get: ((k) => from[k]).bind(null, key),
13
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
+ });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
19
+ value: mod,
20
+ enumerable: true
21
+ }) : target, mod));
22
+ //#endregion
23
+ exports.__toESM = __toESM;
@@ -1,28 +1,67 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
-
4
- var _chunkMSAQEGBKcjs = require('../chunk-MSAQEGBK.cjs');
5
- require('../chunk-3COHMHPU.cjs');
6
- require('../chunk-YBVOKYAM.cjs');
7
- require('../chunk-6Y623TCS.cjs');
8
- require('../chunk-MBG2FTBL.cjs');
9
- require('../chunk-24B36RDB.cjs');
10
- require('../chunk-2WBD2G3E.cjs');
11
- require('../chunk-T7YISGRS.cjs');
12
- require('../chunk-IWQRXQ4N.cjs');
13
- require('../chunk-NJFLUTGH.cjs');
14
- require('../chunk-7PV6L7I7.cjs');
15
- require('../chunk-ENI4UUSK.cjs');
16
- require('../chunk-TZZRLM5J.cjs');
17
- require('../chunk-FMDVBSP6.cjs');
18
- require('../chunk-LOY6ICHZ.cjs');
19
- require('../chunk-EC2KPWRG.cjs');
20
- require('../chunk-DTGT4OI3.cjs');
21
- require('../chunk-WQJYIPSL.cjs');
22
- require('../chunk-BDATZ3UB.cjs');
23
- require('../chunk-JWLDCEBZ.cjs');
24
- require('../chunk-7QBTVNMR.cjs');
25
-
26
-
27
-
28
- exports.getConfigFile = _chunkMSAQEGBKcjs.getConfigFile; exports.getConfigFileByName = _chunkMSAQEGBKcjs.getConfigFileByName;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
3
+ const require_logger_console = require("../logger/console.cjs");
4
+ const require_utilities_correct_paths = require("../utilities/correct-paths.cjs");
5
+ const require_utilities_find_workspace_root = require("../utilities/find-workspace-root.cjs");
6
+ let defu = require("defu");
7
+ defu = require_runtime.__toESM(defu, 1);
8
+ let c12 = require("c12");
9
+ //#region src/config-file/get-config-file.ts
10
+ /**
11
+ * Get the config file for the current Storm workspace
12
+ *
13
+ * @param fileName - The name of the config file to search for
14
+ * @param filePath - The path to search for the config file in
15
+ * @returns The config file for the current Storm workspace
16
+ */
17
+ const getConfigFileByName = async (fileName, filePath, options = {}) => {
18
+ const workspacePath = filePath || require_utilities_find_workspace_root.findWorkspaceRoot(filePath);
19
+ const configs = await Promise.all([(0, c12.loadConfig)({
20
+ cwd: workspacePath,
21
+ packageJson: true,
22
+ name: fileName,
23
+ envName: fileName?.toUpperCase(),
24
+ jitiOptions: {
25
+ debug: false,
26
+ fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : require_utilities_correct_paths.joinPaths(process.env.STORM_CACHE_DIR || "node_modules/.cache/storm", "jiti")
27
+ },
28
+ ...options
29
+ }), (0, c12.loadConfig)({
30
+ cwd: workspacePath,
31
+ packageJson: true,
32
+ name: fileName,
33
+ envName: fileName?.toUpperCase(),
34
+ jitiOptions: {
35
+ debug: false,
36
+ fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : require_utilities_correct_paths.joinPaths(process.env.STORM_CACHE_DIR || "node_modules/.cache/storm", "jiti")
37
+ },
38
+ configFile: fileName,
39
+ ...options
40
+ })]);
41
+ return (0, defu.default)(configs[0] ?? {}, configs[1] ?? {});
42
+ };
43
+ /**
44
+ * Get the config file for the current Storm workspace
45
+ *
46
+ * @returns The config file for the current Storm workspace
47
+ */
48
+ const getConfigFile = async (filePath, additionalFileNames = []) => {
49
+ const workspacePath = filePath ? filePath : require_utilities_find_workspace_root.findWorkspaceRoot(filePath);
50
+ const result = await getConfigFileByName("storm-workspace", workspacePath);
51
+ let config = result.config;
52
+ const configFile = result.configFile;
53
+ if (config && configFile && Object.keys(config).length > 0 && !config.skipConfigLogging) require_logger_console.writeTrace(`Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`, { logLevel: "all" });
54
+ if (additionalFileNames && additionalFileNames.length > 0) {
55
+ const results = await Promise.all(additionalFileNames.map((fileName) => getConfigFileByName(fileName, workspacePath)));
56
+ for (const result of results) if (result?.config && result?.configFile && Object.keys(result.config).length > 0) {
57
+ if (!config.skipConfigLogging && !result.config.skipConfigLogging) require_logger_console.writeTrace(`Found alternative configuration file "${result.configFile.includes(`${workspacePath}/`) ? result.configFile.replace(`${workspacePath}/`, "") : result.configFile}" at "${workspacePath}"`, { logLevel: "all" });
58
+ config = (0, defu.default)(result.config ?? {}, config ?? {});
59
+ }
60
+ }
61
+ if (!config || Object.keys(config).length === 0) return;
62
+ config.configFile = configFile;
63
+ return config;
64
+ };
65
+ //#endregion
66
+ exports.getConfigFile = getConfigFile;
67
+ exports.getConfigFileByName = getConfigFileByName;
@@ -1,6 +1,6 @@
1
- import { StormWorkspaceConfigInput } from '@storm-software/config';
2
- import { LoadConfigOptions, ResolvedConfig } from 'c12';
3
-
1
+ import { StormWorkspaceConfigInput } from "@storm-software/config";
2
+ import { LoadConfigOptions, ResolvedConfig } from "c12";
3
+ //#region src/config-file/get-config-file.d.ts
4
4
  /**
5
5
  * Get the config file for the current Storm workspace
6
6
  *
@@ -15,5 +15,5 @@ declare const getConfigFileByName: (fileName: string, filePath?: string, options
15
15
  * @returns The config file for the current Storm workspace
16
16
  */
17
17
  declare const getConfigFile: (filePath?: string, additionalFileNames?: string[]) => Promise<Partial<StormWorkspaceConfigInput> | undefined>;
18
-
19
- export { getConfigFile, getConfigFileByName };
18
+ //#endregion
19
+ export { getConfigFile, getConfigFileByName };
@@ -1,6 +1,8 @@
1
- import { StormWorkspaceConfigInput } from '@storm-software/config';
2
- import { LoadConfigOptions, ResolvedConfig } from 'c12';
3
-
1
+ import __tsdown_shims_path from 'node:path';
2
+ import __tsdown_shims_url from 'node:url';
3
+ import { LoadConfigOptions, ResolvedConfig } from "c12";
4
+ import { StormWorkspaceConfigInput } from "@storm-software/config";
5
+ //#region src/config-file/get-config-file.d.ts
4
6
  /**
5
7
  * Get the config file for the current Storm workspace
6
8
  *
@@ -15,5 +17,5 @@ declare const getConfigFileByName: (fileName: string, filePath?: string, options
15
17
  * @returns The config file for the current Storm workspace
16
18
  */
17
19
  declare const getConfigFile: (filePath?: string, additionalFileNames?: string[]) => Promise<Partial<StormWorkspaceConfigInput> | undefined>;
18
-
19
- export { getConfigFile, getConfigFileByName };
20
+ //#endregion
21
+ export { getConfigFile, getConfigFileByName };
@@ -0,0 +1,66 @@
1
+ import "node:path";
2
+ import "node:url";
3
+ import.meta.url;
4
+ import { writeTrace } from "../logger/console.mjs";
5
+ import { joinPaths } from "../utilities/correct-paths.mjs";
6
+ import { findWorkspaceRoot } from "../utilities/find-workspace-root.mjs";
7
+ import defu from "defu";
8
+ import { loadConfig } from "c12";
9
+ //#region src/config-file/get-config-file.ts
10
+ /**
11
+ * Get the config file for the current Storm workspace
12
+ *
13
+ * @param fileName - The name of the config file to search for
14
+ * @param filePath - The path to search for the config file in
15
+ * @returns The config file for the current Storm workspace
16
+ */
17
+ const getConfigFileByName = async (fileName, filePath, options = {}) => {
18
+ const workspacePath = filePath || findWorkspaceRoot(filePath);
19
+ const configs = await Promise.all([loadConfig({
20
+ cwd: workspacePath,
21
+ packageJson: true,
22
+ name: fileName,
23
+ envName: fileName?.toUpperCase(),
24
+ jitiOptions: {
25
+ debug: false,
26
+ fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(process.env.STORM_CACHE_DIR || "node_modules/.cache/storm", "jiti")
27
+ },
28
+ ...options
29
+ }), loadConfig({
30
+ cwd: workspacePath,
31
+ packageJson: true,
32
+ name: fileName,
33
+ envName: fileName?.toUpperCase(),
34
+ jitiOptions: {
35
+ debug: false,
36
+ fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(process.env.STORM_CACHE_DIR || "node_modules/.cache/storm", "jiti")
37
+ },
38
+ configFile: fileName,
39
+ ...options
40
+ })]);
41
+ return defu(configs[0] ?? {}, configs[1] ?? {});
42
+ };
43
+ /**
44
+ * Get the config file for the current Storm workspace
45
+ *
46
+ * @returns The config file for the current Storm workspace
47
+ */
48
+ const getConfigFile = async (filePath, additionalFileNames = []) => {
49
+ const workspacePath = filePath ? filePath : findWorkspaceRoot(filePath);
50
+ const result = await getConfigFileByName("storm-workspace", workspacePath);
51
+ let config = result.config;
52
+ const configFile = result.configFile;
53
+ if (config && configFile && Object.keys(config).length > 0 && !config.skipConfigLogging) writeTrace(`Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`, { logLevel: "all" });
54
+ if (additionalFileNames && additionalFileNames.length > 0) {
55
+ const results = await Promise.all(additionalFileNames.map((fileName) => getConfigFileByName(fileName, workspacePath)));
56
+ for (const result of results) if (result?.config && result?.configFile && Object.keys(result.config).length > 0) {
57
+ if (!config.skipConfigLogging && !result.config.skipConfigLogging) writeTrace(`Found alternative configuration file "${result.configFile.includes(`${workspacePath}/`) ? result.configFile.replace(`${workspacePath}/`, "") : result.configFile}" at "${workspacePath}"`, { logLevel: "all" });
58
+ config = defu(result.config ?? {}, config ?? {});
59
+ }
60
+ }
61
+ if (!config || Object.keys(config).length === 0) return;
62
+ config.configFile = configFile;
63
+ return config;
64
+ };
65
+ //#endregion
66
+ export { getConfigFile, getConfigFileByName };
@@ -1,29 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-IWD6YQKX.cjs');
2
-
3
-
4
-
5
- var _chunkMSAQEGBKcjs = require('../chunk-MSAQEGBK.cjs');
6
- require('../chunk-3COHMHPU.cjs');
7
- require('../chunk-YBVOKYAM.cjs');
8
- require('../chunk-6Y623TCS.cjs');
9
- require('../chunk-MBG2FTBL.cjs');
10
- require('../chunk-24B36RDB.cjs');
11
- require('../chunk-2WBD2G3E.cjs');
12
- require('../chunk-T7YISGRS.cjs');
13
- require('../chunk-IWQRXQ4N.cjs');
14
- require('../chunk-NJFLUTGH.cjs');
15
- require('../chunk-7PV6L7I7.cjs');
16
- require('../chunk-ENI4UUSK.cjs');
17
- require('../chunk-TZZRLM5J.cjs');
18
- require('../chunk-FMDVBSP6.cjs');
19
- require('../chunk-LOY6ICHZ.cjs');
20
- require('../chunk-EC2KPWRG.cjs');
21
- require('../chunk-DTGT4OI3.cjs');
22
- require('../chunk-WQJYIPSL.cjs');
23
- require('../chunk-BDATZ3UB.cjs');
24
- require('../chunk-JWLDCEBZ.cjs');
25
- require('../chunk-7QBTVNMR.cjs');
26
-
27
-
28
-
29
- exports.getConfigFile = _chunkMSAQEGBKcjs.getConfigFile; exports.getConfigFileByName = _chunkMSAQEGBKcjs.getConfigFileByName;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_config_file_get_config_file = require("./get-config-file.cjs");
3
+ exports.getConfigFile = require_config_file_get_config_file.getConfigFile;
4
+ exports.getConfigFileByName = require_config_file_get_config_file.getConfigFileByName;
@@ -1,3 +1,2 @@
1
- export { getConfigFile, getConfigFileByName } from './get-config-file.cjs';
2
- import '@storm-software/config';
3
- import 'c12';
1
+ import { getConfigFile, getConfigFileByName } from "./get-config-file.cjs";
2
+ export { getConfigFile, getConfigFileByName };
@@ -0,0 +1,4 @@
1
+ import __tsdown_shims_path from 'node:path';
2
+ import __tsdown_shims_url from 'node:url';
3
+ import { getConfigFile, getConfigFileByName } from "./get-config-file.mjs";
4
+ export { getConfigFile, getConfigFileByName };
@@ -0,0 +1,5 @@
1
+ import "node:path";
2
+ import "node:url";
3
+ import.meta.url;
4
+ import { getConfigFile, getConfigFileByName } from "./get-config-file.mjs";
5
+ export { getConfigFile, getConfigFileByName };
@@ -1,35 +1,116 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_runtime = require("./_virtual/_rolldown/runtime.cjs");
3
+ const require_logger_console = require("./logger/console.cjs");
4
+ const require_utilities_correct_paths = require("./utilities/correct-paths.cjs");
5
+ const require_utilities_find_workspace_root = require("./utilities/find-workspace-root.cjs");
6
+ const require_utilities_get_default_config = require("./utilities/get-default-config.cjs");
7
+ const require_config_file_get_config_file = require("./config-file/get-config-file.cjs");
8
+ const require_env_get_env = require("./env/get-env.cjs");
9
+ const require_env_set_env = require("./env/set-env.cjs");
10
+ let _storm_software_config_schema = require("@storm-software/config/schema");
11
+ let defu = require("defu");
12
+ defu = require_runtime.__toESM(defu, 1);
13
+ let node_fs = require("node:fs");
14
+ //#region src/create-storm-config.ts
15
+ const _extension_cache = /* @__PURE__ */ new WeakMap();
16
+ let _static_cache = void 0;
17
+ /**
18
+ * Get the config for the current Storm workspace
19
+ *
20
+ * @param extensionName - The name of the config extension
21
+ * @param schema - The schema for the config extension
22
+ * @param workspaceRoot - The root directory of the workspace
23
+ * @param skipLogs - Skip writing logs to the console
24
+ * @param useDefault - Whether to use the default config if no config file is found
25
+ * @returns The config for the current Storm workspace
26
+ */
27
+ const createStormWorkspaceConfig = async (extensionName, schema, workspaceRoot, skipLogs = false, useDefault = true) => {
28
+ let result;
29
+ if (!_static_cache?.data || !_static_cache?.timestamp || _static_cache.timestamp < Date.now() - 8e3) {
30
+ let _workspaceRoot = workspaceRoot;
31
+ if (!_workspaceRoot) _workspaceRoot = require_utilities_find_workspace_root.findWorkspaceRoot();
32
+ const configEnv = require_env_get_env.getConfigEnv();
33
+ const configFile = await require_config_file_get_config_file.getConfigFile(_workspaceRoot);
34
+ if (!configFile) {
35
+ if (!skipLogs) require_logger_console.writeWarning("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", { logLevel: "all" });
36
+ if (useDefault === false) return;
37
+ }
38
+ const defaultConfig = await require_utilities_get_default_config.getPackageJsonConfig(_workspaceRoot);
39
+ const configInput = (0, defu.default)(configEnv, configFile, defaultConfig);
40
+ if (!configInput.variant) configInput.variant = (0, node_fs.existsSync)(require_utilities_correct_paths.joinPaths(_workspaceRoot, "nx.json")) || (0, node_fs.existsSync)(require_utilities_correct_paths.joinPaths(_workspaceRoot, ".nx")) || (0, node_fs.existsSync)(require_utilities_correct_paths.joinPaths(_workspaceRoot, "lerna.json")) || (0, node_fs.existsSync)(require_utilities_correct_paths.joinPaths(_workspaceRoot, "turbo.json")) ? "monorepo" : "minimal";
41
+ try {
42
+ const parseResult = await Promise.resolve(_storm_software_config_schema.workspaceConfigSchema._zod.parse({
43
+ value: configInput,
44
+ issues: []
45
+ }, { async: true }));
46
+ result = require_utilities_get_default_config.applyDefaultConfig(parseResult.value);
47
+ result.workspaceRoot ??= _workspaceRoot;
48
+ } catch (error) {
49
+ throw new Error(`Failed to parse Storm Workspace configuration${error?.message ? `: ${error.message}` : ""}
2
50
 
3
-
4
-
5
-
6
- var _chunkSLICWTO2cjs = require('./chunk-SLICWTO2.cjs');
7
- require('./chunk-MSAQEGBK.cjs');
8
- require('./chunk-3COHMHPU.cjs');
9
- require('./chunk-YBVOKYAM.cjs');
10
- require('./chunk-6Y623TCS.cjs');
11
- require('./chunk-MBG2FTBL.cjs');
12
- require('./chunk-24B36RDB.cjs');
13
- require('./chunk-2WBD2G3E.cjs');
14
- require('./chunk-T7YISGRS.cjs');
15
- require('./chunk-IWQRXQ4N.cjs');
16
- require('./chunk-NJFLUTGH.cjs');
17
- require('./chunk-7PV6L7I7.cjs');
18
- require('./chunk-ENI4UUSK.cjs');
19
- require('./chunk-TZZRLM5J.cjs');
20
- require('./chunk-FMDVBSP6.cjs');
21
- require('./chunk-LOY6ICHZ.cjs');
22
- require('./chunk-EC2KPWRG.cjs');
23
- require('./chunk-DTGT4OI3.cjs');
24
- require('./chunk-WQJYIPSL.cjs');
25
- require('./chunk-BZRTSWH4.cjs');
26
- require('./chunk-UJ77IBHD.cjs');
27
- require('./chunk-BDATZ3UB.cjs');
28
- require('./chunk-JWLDCEBZ.cjs');
29
- require('./chunk-7QBTVNMR.cjs');
30
-
31
-
32
-
33
-
34
-
35
- exports.createConfigExtension = _chunkSLICWTO2cjs.createConfigExtension; exports.createStormWorkspaceConfig = _chunkSLICWTO2cjs.createStormWorkspaceConfig; exports.loadStormWorkspaceConfig = _chunkSLICWTO2cjs.loadStormWorkspaceConfig; exports.tryLoadStormWorkspaceConfig = _chunkSLICWTO2cjs.tryLoadStormWorkspaceConfig;
51
+ Please ensure your configuration file is valid JSON and matches the expected schema. The current workspace configuration input is: ${require_logger_console.formatLogMessage(configInput)}`, { cause: error });
52
+ }
53
+ } else result = _static_cache.data;
54
+ if (schema && extensionName) result.extensions = {
55
+ ...result.extensions,
56
+ [extensionName]: createConfigExtension(extensionName, schema)
57
+ };
58
+ _static_cache = {
59
+ timestamp: Date.now(),
60
+ data: result
61
+ };
62
+ return result;
63
+ };
64
+ /**
65
+ * Get the config for a specific Storm config Extension
66
+ *
67
+ * @param extensionName - The name of the config extension
68
+ * @param options - The options for the config extension
69
+ * @returns The config for the specified Storm config extension. If the extension does not exist, `undefined` is returned.
70
+ */
71
+ const createConfigExtension = (extensionName, schema) => {
72
+ const extension_cache_key = { extensionName };
73
+ if (_extension_cache.has(extension_cache_key)) return _extension_cache.get(extension_cache_key);
74
+ let extension = require_env_get_env.getExtensionEnv(extensionName);
75
+ if (schema) extension = schema.parse(extension);
76
+ _extension_cache.set(extension_cache_key, extension);
77
+ return extension;
78
+ };
79
+ /**
80
+ * Load the config file values for the current Storm workspace into environment variables
81
+ *
82
+ * @param workspaceRoot - The root directory of the workspace
83
+ * @param skipLogs - Skip writing logs to the console
84
+ * @returns The config for the current Storm workspace, throws an error if the config file could not be loaded
85
+ */
86
+ const loadStormWorkspaceConfig = async (workspaceRoot, skipLogs = false) => {
87
+ const config = await createStormWorkspaceConfig(void 0, void 0, workspaceRoot, skipLogs, true);
88
+ require_env_set_env.setConfigEnv(config);
89
+ if (!skipLogs && !config.skipConfigLogging) require_logger_console.writeTrace(`⚙️ Using Storm Workspace configuration: \n${require_logger_console.formatLogMessage(config)}`, config);
90
+ return config;
91
+ };
92
+ /**
93
+ * Try to load the config file values for the current Storm workspace into environment variables
94
+ *
95
+ * @param workspaceRoot - The root directory of the workspace
96
+ * @param skipLogs - Skip writing logs to the console
97
+ * @param useDefault - Whether to use the default config if no config file is found
98
+ * @returns The config for the current Storm workspace, or undefined if the config file could not be loaded
99
+ */
100
+ const tryLoadStormWorkspaceConfig = async (workspaceRoot, skipLogs = true, useDefault = false) => {
101
+ try {
102
+ const config = await createStormWorkspaceConfig(void 0, void 0, workspaceRoot, skipLogs, useDefault);
103
+ if (!config) return;
104
+ require_env_set_env.setConfigEnv(config);
105
+ if (!skipLogs && !config.skipConfigLogging) require_logger_console.writeTrace(`⚙️ Using Storm Workspace configuration: \n${require_logger_console.formatLogMessage(config)}`, config);
106
+ return config;
107
+ } catch (error) {
108
+ if (!skipLogs) require_logger_console.writeWarning(`⚠️ Failed to load Storm Workspace configuration: ${error}`, { logLevel: "all" });
109
+ return;
110
+ }
111
+ };
112
+ //#endregion
113
+ exports.createConfigExtension = createConfigExtension;
114
+ exports.createStormWorkspaceConfig = createStormWorkspaceConfig;
115
+ exports.loadStormWorkspaceConfig = loadStormWorkspaceConfig;
116
+ exports.tryLoadStormWorkspaceConfig = tryLoadStormWorkspaceConfig;
@@ -1,6 +1,6 @@
1
- import { StormWorkspaceConfig } from '@storm-software/config';
2
- import * as z from 'zod';
3
-
1
+ import { StormWorkspaceConfig } from "@storm-software/config";
2
+ import * as z from "zod";
3
+ //#region src/create-storm-config.d.ts
4
4
  /**
5
5
  * Get the config for the current Storm workspace
6
6
  *
@@ -37,5 +37,5 @@ declare const loadStormWorkspaceConfig: (workspaceRoot?: string, skipLogs?: bool
37
37
  * @returns The config for the current Storm workspace, or undefined if the config file could not be loaded
38
38
  */
39
39
  declare const tryLoadStormWorkspaceConfig: (workspaceRoot?: string, skipLogs?: boolean, useDefault?: boolean) => Promise<StormWorkspaceConfig | undefined>;
40
-
41
- export { createConfigExtension, createStormWorkspaceConfig, loadStormWorkspaceConfig, tryLoadStormWorkspaceConfig };
40
+ //#endregion
41
+ export { createConfigExtension, createStormWorkspaceConfig, loadStormWorkspaceConfig, tryLoadStormWorkspaceConfig };
@@ -1,6 +1,8 @@
1
- import { StormWorkspaceConfig } from '@storm-software/config';
2
- import * as z from 'zod';
3
-
1
+ import __tsdown_shims_path from 'node:path';
2
+ import __tsdown_shims_url from 'node:url';
3
+ import { StormWorkspaceConfig } from "@storm-software/config";
4
+ import * as z from "zod";
5
+ //#region src/create-storm-config.d.ts
4
6
  /**
5
7
  * Get the config for the current Storm workspace
6
8
  *
@@ -37,5 +39,5 @@ declare const loadStormWorkspaceConfig: (workspaceRoot?: string, skipLogs?: bool
37
39
  * @returns The config for the current Storm workspace, or undefined if the config file could not be loaded
38
40
  */
39
41
  declare const tryLoadStormWorkspaceConfig: (workspaceRoot?: string, skipLogs?: boolean, useDefault?: boolean) => Promise<StormWorkspaceConfig | undefined>;
40
-
41
- export { createConfigExtension, createStormWorkspaceConfig, loadStormWorkspaceConfig, tryLoadStormWorkspaceConfig };
42
+ //#endregion
43
+ export { createConfigExtension, createStormWorkspaceConfig, loadStormWorkspaceConfig, tryLoadStormWorkspaceConfig };
@@ -0,0 +1,113 @@
1
+ import "node:path";
2
+ import "node:url";
3
+ import.meta.url;
4
+ import { formatLogMessage, writeTrace, writeWarning } from "./logger/console.mjs";
5
+ import { joinPaths } from "./utilities/correct-paths.mjs";
6
+ import { findWorkspaceRoot } from "./utilities/find-workspace-root.mjs";
7
+ import { applyDefaultConfig, getPackageJsonConfig } from "./utilities/get-default-config.mjs";
8
+ import { getConfigFile } from "./config-file/get-config-file.mjs";
9
+ import { getConfigEnv, getExtensionEnv } from "./env/get-env.mjs";
10
+ import { setConfigEnv } from "./env/set-env.mjs";
11
+ import { workspaceConfigSchema } from "@storm-software/config/schema";
12
+ import defu from "defu";
13
+ import { existsSync } from "node:fs";
14
+ //#region src/create-storm-config.ts
15
+ const _extension_cache = /* @__PURE__ */ new WeakMap();
16
+ let _static_cache = void 0;
17
+ /**
18
+ * Get the config for the current Storm workspace
19
+ *
20
+ * @param extensionName - The name of the config extension
21
+ * @param schema - The schema for the config extension
22
+ * @param workspaceRoot - The root directory of the workspace
23
+ * @param skipLogs - Skip writing logs to the console
24
+ * @param useDefault - Whether to use the default config if no config file is found
25
+ * @returns The config for the current Storm workspace
26
+ */
27
+ const createStormWorkspaceConfig = async (extensionName, schema, workspaceRoot, skipLogs = false, useDefault = true) => {
28
+ let result;
29
+ if (!_static_cache?.data || !_static_cache?.timestamp || _static_cache.timestamp < Date.now() - 8e3) {
30
+ let _workspaceRoot = workspaceRoot;
31
+ if (!_workspaceRoot) _workspaceRoot = findWorkspaceRoot();
32
+ const configEnv = getConfigEnv();
33
+ const configFile = await getConfigFile(_workspaceRoot);
34
+ if (!configFile) {
35
+ if (!skipLogs) writeWarning("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", { logLevel: "all" });
36
+ if (useDefault === false) return;
37
+ }
38
+ const defaultConfig = await getPackageJsonConfig(_workspaceRoot);
39
+ const configInput = defu(configEnv, configFile, defaultConfig);
40
+ if (!configInput.variant) configInput.variant = existsSync(joinPaths(_workspaceRoot, "nx.json")) || existsSync(joinPaths(_workspaceRoot, ".nx")) || existsSync(joinPaths(_workspaceRoot, "lerna.json")) || existsSync(joinPaths(_workspaceRoot, "turbo.json")) ? "monorepo" : "minimal";
41
+ try {
42
+ const parseResult = await Promise.resolve(workspaceConfigSchema._zod.parse({
43
+ value: configInput,
44
+ issues: []
45
+ }, { async: true }));
46
+ result = applyDefaultConfig(parseResult.value);
47
+ result.workspaceRoot ??= _workspaceRoot;
48
+ } catch (error) {
49
+ throw new Error(`Failed to parse Storm Workspace configuration${error?.message ? `: ${error.message}` : ""}
50
+
51
+ Please ensure your configuration file is valid JSON and matches the expected schema. The current workspace configuration input is: ${formatLogMessage(configInput)}`, { cause: error });
52
+ }
53
+ } else result = _static_cache.data;
54
+ if (schema && extensionName) result.extensions = {
55
+ ...result.extensions,
56
+ [extensionName]: createConfigExtension(extensionName, schema)
57
+ };
58
+ _static_cache = {
59
+ timestamp: Date.now(),
60
+ data: result
61
+ };
62
+ return result;
63
+ };
64
+ /**
65
+ * Get the config for a specific Storm config Extension
66
+ *
67
+ * @param extensionName - The name of the config extension
68
+ * @param options - The options for the config extension
69
+ * @returns The config for the specified Storm config extension. If the extension does not exist, `undefined` is returned.
70
+ */
71
+ const createConfigExtension = (extensionName, schema) => {
72
+ const extension_cache_key = { extensionName };
73
+ if (_extension_cache.has(extension_cache_key)) return _extension_cache.get(extension_cache_key);
74
+ let extension = getExtensionEnv(extensionName);
75
+ if (schema) extension = schema.parse(extension);
76
+ _extension_cache.set(extension_cache_key, extension);
77
+ return extension;
78
+ };
79
+ /**
80
+ * Load the config file values for the current Storm workspace into environment variables
81
+ *
82
+ * @param workspaceRoot - The root directory of the workspace
83
+ * @param skipLogs - Skip writing logs to the console
84
+ * @returns The config for the current Storm workspace, throws an error if the config file could not be loaded
85
+ */
86
+ const loadStormWorkspaceConfig = async (workspaceRoot, skipLogs = false) => {
87
+ const config = await createStormWorkspaceConfig(void 0, void 0, workspaceRoot, skipLogs, true);
88
+ setConfigEnv(config);
89
+ if (!skipLogs && !config.skipConfigLogging) writeTrace(`⚙️ Using Storm Workspace configuration: \n${formatLogMessage(config)}`, config);
90
+ return config;
91
+ };
92
+ /**
93
+ * Try to load the config file values for the current Storm workspace into environment variables
94
+ *
95
+ * @param workspaceRoot - The root directory of the workspace
96
+ * @param skipLogs - Skip writing logs to the console
97
+ * @param useDefault - Whether to use the default config if no config file is found
98
+ * @returns The config for the current Storm workspace, or undefined if the config file could not be loaded
99
+ */
100
+ const tryLoadStormWorkspaceConfig = async (workspaceRoot, skipLogs = true, useDefault = false) => {
101
+ try {
102
+ const config = await createStormWorkspaceConfig(void 0, void 0, workspaceRoot, skipLogs, useDefault);
103
+ if (!config) return;
104
+ setConfigEnv(config);
105
+ if (!skipLogs && !config.skipConfigLogging) writeTrace(`⚙️ Using Storm Workspace configuration: \n${formatLogMessage(config)}`, config);
106
+ return config;
107
+ } catch (error) {
108
+ if (!skipLogs) writeWarning(`⚠️ Failed to load Storm Workspace configuration: ${error}`, { logLevel: "all" });
109
+ return;
110
+ }
111
+ };
112
+ //#endregion
113
+ export { createConfigExtension, createStormWorkspaceConfig, loadStormWorkspaceConfig, tryLoadStormWorkspaceConfig };