@storm-software/config-tools 1.119.0 → 1.130.1

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 (144) hide show
  1. package/README.md +1 -1
  2. package/dist/chunk-4IYEDNYJ.mjs +426 -0
  3. package/dist/chunk-5P4S7DMV.js +51 -0
  4. package/dist/chunk-5QZ7AV2J.js +27 -0
  5. package/dist/chunk-6OYLNZFT.mjs +169 -0
  6. package/dist/chunk-6SJLAEJ3.js +70 -0
  7. package/dist/chunk-6WPG3DXV.js +32 -0
  8. package/dist/chunk-7XY63NME.js +44 -0
  9. package/dist/chunk-A7VLTBS6.mjs +271 -0
  10. package/dist/chunk-BNNLKDKI.mjs +102 -0
  11. package/dist/chunk-BO45V6E2.mjs +51 -0
  12. package/dist/chunk-BS5OC5E6.js +426 -0
  13. package/dist/chunk-E3IN3SQD.mjs +6 -0
  14. package/dist/chunk-FW22KPOW.mjs +27 -0
  15. package/dist/chunk-GIZ23UUE.js +189 -0
  16. package/dist/chunk-GOQAHXJF.mjs +28 -0
  17. package/dist/chunk-H6XXDZ7A.js +28 -0
  18. package/dist/chunk-K6TQN2LZ.js +6 -0
  19. package/dist/chunk-LCD7F65X.js +545 -0
  20. package/dist/chunk-LKZSRXS7.js +169 -0
  21. package/dist/chunk-MGI2M3SX.js +6 -0
  22. package/dist/chunk-N32EGEJB.js +90 -0
  23. package/dist/chunk-N4BRCEYB.js +27 -0
  24. package/dist/chunk-PEHVR33I.js +67 -0
  25. package/dist/chunk-PQNCKJAR.js +271 -0
  26. package/dist/chunk-PVPSTJNJ.mjs +90 -0
  27. package/dist/chunk-QHVHX67K.js +6 -0
  28. package/dist/chunk-QUVGIEZZ.mjs +6 -0
  29. package/dist/chunk-RAWSXKTG.mjs +189 -0
  30. package/dist/chunk-RHGJNRVE.mjs +125 -0
  31. package/dist/chunk-RYIDKM6L.mjs +545 -0
  32. package/dist/chunk-SJO5XZQA.js +6 -0
  33. package/dist/chunk-T2X5W62C.js +125 -0
  34. package/dist/chunk-TEKFJAJJ.mjs +70 -0
  35. package/dist/chunk-TTCXDK6S.mjs +27 -0
  36. package/dist/chunk-UCUOC6LA.mjs +70 -0
  37. package/dist/chunk-VFRDDJD4.js +102 -0
  38. package/dist/chunk-VQLOUFMG.mjs +32 -0
  39. package/dist/chunk-WRFJFYOU.mjs +51 -0
  40. package/dist/chunk-WXOSG64C.js +70 -0
  41. package/dist/chunk-WXYJGX4C.mjs +6 -0
  42. package/dist/chunk-X6VIYUJR.mjs +6 -0
  43. package/dist/chunk-XJEQHMOE.js +49 -0
  44. package/dist/chunk-XLMGW4ZW.mjs +67 -0
  45. package/dist/chunk-XXHENMLT.mjs +44 -0
  46. package/dist/config-file/get-config-file.d.mts +20 -0
  47. package/dist/config-file/get-config-file.d.ts +20 -0
  48. package/dist/config-file/get-config-file.js +23 -0
  49. package/dist/config-file/get-config-file.mjs +23 -0
  50. package/dist/config-file/index.d.mts +4 -0
  51. package/dist/config-file/index.d.ts +4 -0
  52. package/dist/config-file/index.js +24 -0
  53. package/dist/config-file/index.mjs +24 -0
  54. package/dist/create-storm-config.d.mts +29 -0
  55. package/dist/create-storm-config.d.ts +29 -0
  56. package/dist/create-storm-config.js +30 -0
  57. package/dist/create-storm-config.mjs +30 -0
  58. package/dist/env/get-env.d.mts +19 -0
  59. package/dist/env/get-env.d.ts +19 -0
  60. package/dist/env/get-env.js +13 -0
  61. package/dist/env/get-env.mjs +13 -0
  62. package/dist/env/index.d.mts +5 -0
  63. package/dist/env/index.d.ts +5 -0
  64. package/dist/env/index.js +20 -0
  65. package/dist/env/index.mjs +20 -0
  66. package/{src/env/get-env.d.ts → dist/env/set-env.d.mts} +7 -4
  67. package/{src → dist}/env/set-env.d.ts +7 -3
  68. package/dist/env/set-env.js +12 -0
  69. package/dist/env/set-env.mjs +12 -0
  70. package/dist/index.d.mts +19 -0
  71. package/dist/index.d.ts +19 -0
  72. package/dist/index.js +132 -0
  73. package/dist/index.mjs +132 -0
  74. package/dist/types-DGWqy1xb.d.mts +1395 -0
  75. package/dist/types-DGWqy1xb.d.ts +1395 -0
  76. package/dist/types.d.mts +40 -0
  77. package/{src → dist}/types.d.ts +14 -7
  78. package/dist/types.js +9 -0
  79. package/dist/types.mjs +9 -0
  80. package/dist/utilities/apply-workspace-tokens.d.mts +9 -0
  81. package/dist/utilities/apply-workspace-tokens.d.ts +9 -0
  82. package/dist/utilities/apply-workspace-tokens.js +14 -0
  83. package/dist/utilities/apply-workspace-tokens.mjs +14 -0
  84. package/dist/utilities/correct-paths.d.mts +19 -0
  85. package/dist/utilities/correct-paths.d.ts +19 -0
  86. package/dist/utilities/correct-paths.js +9 -0
  87. package/dist/utilities/correct-paths.mjs +9 -0
  88. package/dist/utilities/file-path-utils.d.mts +4 -0
  89. package/dist/utilities/file-path-utils.d.ts +4 -0
  90. package/dist/utilities/file-path-utils.js +9 -0
  91. package/dist/utilities/file-path-utils.mjs +9 -0
  92. package/dist/utilities/find-up.d.mts +6 -0
  93. package/dist/utilities/find-up.d.ts +6 -0
  94. package/dist/utilities/find-up.js +7 -0
  95. package/dist/utilities/find-up.mjs +7 -0
  96. package/dist/utilities/find-workspace-root.d.mts +16 -0
  97. package/{src → dist}/utilities/find-workspace-root.d.ts +4 -2
  98. package/dist/utilities/find-workspace-root.js +11 -0
  99. package/dist/utilities/find-workspace-root.mjs +11 -0
  100. package/dist/utilities/get-default-config.d.mts +15 -0
  101. package/dist/utilities/get-default-config.d.ts +15 -0
  102. package/dist/utilities/get-default-config.js +13 -0
  103. package/dist/utilities/get-default-config.mjs +13 -0
  104. package/dist/utilities/index.d.mts +11 -0
  105. package/dist/utilities/index.d.ts +11 -0
  106. package/dist/utilities/index.js +58 -0
  107. package/dist/utilities/index.mjs +58 -0
  108. package/dist/utilities/process-handler.d.mts +8 -0
  109. package/dist/utilities/process-handler.d.ts +8 -0
  110. package/dist/utilities/process-handler.js +20 -0
  111. package/dist/utilities/process-handler.mjs +20 -0
  112. package/dist/utilities/run.d.mts +36 -0
  113. package/dist/utilities/run.d.ts +36 -0
  114. package/dist/utilities/run.js +11 -0
  115. package/dist/utilities/run.mjs +11 -0
  116. package/package.json +1 -24
  117. package/CHANGELOG.md +0 -3122
  118. package/declarations.d.ts +0 -304
  119. package/index.cjs +0 -67508
  120. package/index.js +0 -67463
  121. package/meta.cjs.json +0 -5352
  122. package/meta.esm.json +0 -5413
  123. package/src/config-file/get-config-file.d.ts +0 -16
  124. package/src/config-file/index.d.ts +0 -1
  125. package/src/create-storm-config.d.ts +0 -26
  126. package/src/env/index.d.ts +0 -2
  127. package/src/index.d.ts +0 -13
  128. package/src/utilities/apply-workspace-tokens.d.ts +0 -4
  129. package/src/utilities/chalk.d.ts +0 -23
  130. package/src/utilities/correct-paths.d.ts +0 -1
  131. package/src/utilities/file-path-utils.d.ts +0 -2
  132. package/src/utilities/find-up.d.ts +0 -4
  133. package/src/utilities/get-default-config.d.ts +0 -15
  134. package/src/utilities/get-log-level.d.ts +0 -22
  135. package/src/utilities/index.d.ts +0 -10
  136. package/src/utilities/logger.d.ts +0 -78
  137. package/src/utilities/process-handler.d.ts +0 -4
  138. package/src/utilities/run.d.ts +0 -18
  139. package/utilities/chalk.cjs +0 -1610
  140. package/utilities/chalk.js +0 -1605
  141. package/utilities/find-workspace-root.cjs +0 -118
  142. package/utilities/find-workspace-root.js +0 -91
  143. package/utilities/logger.cjs +0 -5914
  144. package/utilities/logger.js +0 -5897
@@ -0,0 +1,70 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
+
3
+ var _chunkN4BRCEYBjs = require('./chunk-N4BRCEYB.js');
4
+
5
+
6
+ var _chunkH6XXDZ7Ajs = require('./chunk-H6XXDZ7A.js');
7
+
8
+
9
+
10
+ var _chunkXJEQHMOEjs = require('./chunk-XJEQHMOE.js');
11
+
12
+ // src/utilities/find-workspace-root.ts
13
+ _chunkXJEQHMOEjs.init_cjs_shims.call(void 0, );
14
+ var rootFiles = [
15
+ "storm.json",
16
+ "storm.json",
17
+ "storm.yaml",
18
+ "storm.yml",
19
+ "storm.js",
20
+ "storm.ts",
21
+ ".storm.json",
22
+ ".storm.yaml",
23
+ ".storm.yml",
24
+ ".storm.js",
25
+ ".storm.ts",
26
+ "lerna.json",
27
+ "nx.json",
28
+ "turbo.json",
29
+ "npm-workspace.json",
30
+ "yarn-workspace.json",
31
+ "pnpm-workspace.json",
32
+ "npm-workspace.yaml",
33
+ "yarn-workspace.yaml",
34
+ "pnpm-workspace.yaml",
35
+ "npm-workspace.yml",
36
+ "yarn-workspace.yml",
37
+ "pnpm-workspace.yml",
38
+ "npm-lock.json",
39
+ "yarn-lock.json",
40
+ "pnpm-lock.json",
41
+ "npm-lock.yaml",
42
+ "yarn-lock.yaml",
43
+ "pnpm-lock.yaml",
44
+ "npm-lock.yml",
45
+ "yarn-lock.yml",
46
+ "pnpm-lock.yml",
47
+ "bun.lockb"
48
+ ];
49
+ function findWorkspaceRootSafe(pathInsideMonorepo) {
50
+ if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
51
+ return _chunkH6XXDZ7Ajs.correctPaths.call(void 0, _nullishCoalesce(process.env.STORM_WORKSPACE_ROOT, () => ( process.env.NX_WORKSPACE_ROOT_PATH)));
52
+ }
53
+ return _chunkH6XXDZ7Ajs.correctPaths.call(void 0, _chunkN4BRCEYBjs.findFolderUp.call(void 0, _nullishCoalesce(pathInsideMonorepo, () => ( process.cwd())), rootFiles));
54
+ }
55
+ _chunkXJEQHMOEjs.__name.call(void 0, findWorkspaceRootSafe, "findWorkspaceRootSafe");
56
+ function findWorkspaceRoot(pathInsideMonorepo) {
57
+ const result = findWorkspaceRootSafe(pathInsideMonorepo);
58
+ if (!result) {
59
+ throw new Error(`Cannot find workspace root upwards from known path. Files search list includes:
60
+ ${rootFiles.join("\n")}
61
+ Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`);
62
+ }
63
+ return result;
64
+ }
65
+ _chunkXJEQHMOEjs.__name.call(void 0, findWorkspaceRoot, "findWorkspaceRoot");
66
+
67
+
68
+
69
+
70
+ exports.findWorkspaceRootSafe = findWorkspaceRootSafe; exports.findWorkspaceRoot = findWorkspaceRoot;
@@ -0,0 +1,32 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunkXJEQHMOEjs = require('./chunk-XJEQHMOE.js');
4
+
5
+ // src/types.ts
6
+ _chunkXJEQHMOEjs.init_cjs_shims.call(void 0, );
7
+ var LogLevel = {
8
+ SILENT: 0,
9
+ FATAL: 10,
10
+ ERROR: 20,
11
+ WARN: 30,
12
+ SUCCESS: 35,
13
+ INFO: 40,
14
+ DEBUG: 60,
15
+ TRACE: 70,
16
+ ALL: 100
17
+ };
18
+ var LogLevelLabel = {
19
+ SILENT: "silent",
20
+ FATAL: "fatal",
21
+ ERROR: "error",
22
+ WARN: "warn",
23
+ INFO: "info",
24
+ DEBUG: "debug",
25
+ TRACE: "trace",
26
+ ALL: "all"
27
+ };
28
+
29
+
30
+
31
+
32
+ exports.LogLevel = LogLevel; exports.LogLevelLabel = LogLevelLabel;
@@ -0,0 +1,44 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
+
3
+
4
+ var _chunkXJEQHMOEjs = require('./chunk-XJEQHMOE.js');
5
+
6
+ // src/utilities/run.ts
7
+ _chunkXJEQHMOEjs.init_cjs_shims.call(void 0, );
8
+ var _child_process = require('child_process');
9
+ var LARGE_BUFFER = 1024 * 1e6;
10
+ var run = /* @__PURE__ */ _chunkXJEQHMOEjs.__name.call(void 0, (config, command, cwd = _nullishCoalesce(config.workspaceRoot, () => ( process.cwd())), stdio = "inherit", env = process.env) => {
11
+ return _child_process.execSync.call(void 0, command, {
12
+ cwd,
13
+ env: {
14
+ ...process.env,
15
+ ...env,
16
+ CLICOLOR: "true",
17
+ FORCE_COLOR: "true"
18
+ },
19
+ windowsHide: true,
20
+ stdio,
21
+ maxBuffer: LARGE_BUFFER,
22
+ killSignal: "SIGTERM"
23
+ });
24
+ }, "run");
25
+ var runAsync = /* @__PURE__ */ _chunkXJEQHMOEjs.__name.call(void 0, (config, command, cwd = _nullishCoalesce(config.workspaceRoot, () => ( process.cwd())), env = process.env) => {
26
+ return _child_process.exec.call(void 0, command, {
27
+ cwd,
28
+ env: {
29
+ ...process.env,
30
+ ...env,
31
+ CLICOLOR: "true",
32
+ FORCE_COLOR: "true"
33
+ },
34
+ windowsHide: true,
35
+ maxBuffer: LARGE_BUFFER,
36
+ killSignal: "SIGTERM"
37
+ });
38
+ }, "runAsync");
39
+
40
+
41
+
42
+
43
+
44
+ exports.LARGE_BUFFER = LARGE_BUFFER; exports.run = run; exports.runAsync = runAsync;
@@ -0,0 +1,271 @@
1
+ import {
2
+ getLogLevel
3
+ } from "./chunk-UCUOC6LA.mjs";
4
+ import {
5
+ correctPaths
6
+ } from "./chunk-GOQAHXJF.mjs";
7
+ import {
8
+ LogLevel
9
+ } from "./chunk-VQLOUFMG.mjs";
10
+ import {
11
+ __name,
12
+ init_esm_shims
13
+ } from "./chunk-WRFJFYOU.mjs";
14
+
15
+ // src/env/set-env.ts
16
+ init_esm_shims();
17
+ var setExtensionEnv = /* @__PURE__ */ __name((extensionName, extension) => {
18
+ for (const key of Object.keys(extension ?? {})) {
19
+ if (extension[key]) {
20
+ const result = key?.replace(/([A-Z])+/g, (input) => input ? input[0]?.toUpperCase() + input.slice(1) : "").split(/(?=[A-Z])|[.\-\s_]/).map((x) => x.toLowerCase()) ?? [];
21
+ let extensionKey;
22
+ if (result.length === 0) {
23
+ return;
24
+ }
25
+ if (result.length === 1) {
26
+ extensionKey = result[0]?.toUpperCase() ?? "";
27
+ } else {
28
+ extensionKey = result.reduce((ret, part) => {
29
+ return `${ret}_${part.toLowerCase()}`;
30
+ });
31
+ }
32
+ process.env[`STORM_EXTENSION_${extensionName.toUpperCase()}_${extensionKey.toUpperCase()}`] = extension[key];
33
+ }
34
+ }
35
+ }, "setExtensionEnv");
36
+ var setConfigEnv = /* @__PURE__ */ __name((config) => {
37
+ const prefix = "STORM_";
38
+ if (config.extends) {
39
+ process.env[`${prefix}EXTENDS`] = config.extends;
40
+ }
41
+ if (config.name) {
42
+ process.env[`${prefix}NAME`] = config.name;
43
+ }
44
+ if (config.namespace) {
45
+ process.env[`${prefix}NAMESPACE`] = config.namespace;
46
+ }
47
+ if (config.owner) {
48
+ process.env[`${prefix}OWNER`] = config.owner;
49
+ }
50
+ if (config.bot) {
51
+ process.env[`${prefix}BOT_NAME`] = config.bot.name;
52
+ process.env[`${prefix}BOT_EMAIL`] = config.bot.email;
53
+ }
54
+ if (config.organization) {
55
+ process.env[`${prefix}ORGANIZATION`] = config.organization;
56
+ }
57
+ if (config.packageManager) {
58
+ process.env[`${prefix}PACKAGE_MANAGER`] = config.packageManager;
59
+ }
60
+ if (config.license) {
61
+ process.env[`${prefix}LICENSE`] = config.license;
62
+ }
63
+ if (config.homepage) {
64
+ process.env[`${prefix}HOMEPAGE`] = config.homepage;
65
+ }
66
+ if (config.docs) {
67
+ process.env[`${prefix}DOCS`] = config.docs;
68
+ }
69
+ if (config.licensing) {
70
+ process.env[`${prefix}LICENSING`] = config.licensing;
71
+ }
72
+ if (config.timezone) {
73
+ process.env[`${prefix}TIMEZONE`] = config.timezone;
74
+ process.env.TZ = config.timezone;
75
+ process.env.DEFAULT_TIMEZONE = config.timezone;
76
+ }
77
+ if (config.locale) {
78
+ process.env[`${prefix}LOCALE`] = config.locale;
79
+ process.env.LOCALE = config.locale;
80
+ process.env.DEFAULT_LOCALE = config.locale;
81
+ process.env.LANG = config.locale ? `${config.locale.replaceAll("-", "_")}.UTF-8` : "en_US.UTF-8";
82
+ }
83
+ if (config.configFile) {
84
+ process.env[`${prefix}CONFIG_FILE`] = correctPaths(config.configFile);
85
+ }
86
+ if (config.workspaceRoot) {
87
+ process.env[`${prefix}WORKSPACE_ROOT`] = correctPaths(config.workspaceRoot);
88
+ process.env.NX_WORKSPACE_ROOT = correctPaths(config.workspaceRoot);
89
+ process.env.NX_WORKSPACE_ROOT_PATH = correctPaths(config.workspaceRoot);
90
+ }
91
+ if (config.directories) {
92
+ if (!config.skipCache && config.directories.cache) {
93
+ process.env[`${prefix}CACHE_DIR`] = correctPaths(config.directories.cache);
94
+ }
95
+ if (config.directories.data) {
96
+ process.env[`${prefix}DATA_DIR`] = correctPaths(config.directories.data);
97
+ }
98
+ if (config.directories.config) {
99
+ process.env[`${prefix}CONFIG_DIR`] = correctPaths(config.directories.config);
100
+ }
101
+ if (config.directories.temp) {
102
+ process.env[`${prefix}TEMP_DIR`] = correctPaths(config.directories.temp);
103
+ }
104
+ if (config.directories.log) {
105
+ process.env[`${prefix}LOG_DIR`] = correctPaths(config.directories.log);
106
+ }
107
+ if (config.directories.build) {
108
+ process.env[`${prefix}BUILD_DIR`] = correctPaths(config.directories.build);
109
+ }
110
+ }
111
+ if (config.skipCache !== void 0) {
112
+ process.env[`${prefix}SKIP_CACHE`] = String(config.skipCache);
113
+ if (config.skipCache) {
114
+ process.env.NX_SKIP_NX_CACHE ??= String(config.skipCache);
115
+ process.env.NX_CACHE_PROJECT_GRAPH ??= String(config.skipCache);
116
+ }
117
+ }
118
+ if (config.env) {
119
+ process.env[`${prefix}ENV`] = config.env;
120
+ process.env.NODE_ENV = config.env;
121
+ process.env.ENVIRONMENT = config.env;
122
+ }
123
+ if (config.colors?.base?.light || config.colors?.base?.dark) {
124
+ for (const key of Object.keys(config.colors)) {
125
+ setThemeColorConfigEnv(`${prefix}COLOR_${key}_`, config.colors[key]);
126
+ }
127
+ } else {
128
+ setThemeColorConfigEnv(`${prefix}COLOR_`, config.colors);
129
+ }
130
+ if (config.repository) {
131
+ process.env[`${prefix}REPOSITORY`] = config.repository;
132
+ }
133
+ if (config.branch) {
134
+ process.env[`${prefix}BRANCH`] = config.branch;
135
+ }
136
+ if (config.preid) {
137
+ process.env[`${prefix}PRE_ID`] = String(config.preid);
138
+ }
139
+ if (config.externalPackagePatterns) {
140
+ process.env[`${prefix}EXTERNAL_PACKAGE_PATTERNS`] = JSON.stringify(config.externalPackagePatterns);
141
+ }
142
+ if (config.registry) {
143
+ if (config.registry.github) {
144
+ process.env[`${prefix}REGISTRY_GITHUB`] = String(config.registry.github);
145
+ }
146
+ if (config.registry.npm) {
147
+ process.env[`${prefix}REGISTRY_NPM`] = String(config.registry.npm);
148
+ }
149
+ if (config.registry.cargo) {
150
+ process.env[`${prefix}REGISTRY_CARGO`] = String(config.registry.cargo);
151
+ }
152
+ if (config.registry.cyclone) {
153
+ process.env[`${prefix}REGISTRY_CYCLONE`] = String(config.registry.cyclone);
154
+ }
155
+ if (config.registry.container) {
156
+ process.env[`${prefix}REGISTRY_CONTAINER`] = String(config.registry.cyclone);
157
+ }
158
+ }
159
+ if (config.logLevel) {
160
+ process.env[`${prefix}LOG_LEVEL`] = String(config.logLevel);
161
+ process.env.LOG_LEVEL = String(config.logLevel);
162
+ process.env.NX_VERBOSE_LOGGING = String(getLogLevel(config.logLevel) >= LogLevel.DEBUG ? true : false);
163
+ process.env.RUST_BACKTRACE = getLogLevel(config.logLevel) >= LogLevel.DEBUG ? "full" : "none";
164
+ }
165
+ process.env[`${prefix}CONFIG`] = JSON.stringify(config);
166
+ for (const key of Object.keys(config.extensions ?? {})) {
167
+ config.extensions[key] && Object.keys(config.extensions[key]) && setExtensionEnv(key, config.extensions[key]);
168
+ }
169
+ }, "setConfigEnv");
170
+ var setThemeColorConfigEnv = /* @__PURE__ */ __name((prefix, config) => {
171
+ return config?.light?.brand || config?.dark?.brand ? setMultiThemeColorConfigEnv(prefix, config) : setSingleThemeColorConfigEnv(prefix, config);
172
+ }, "setThemeColorConfigEnv");
173
+ var setSingleThemeColorConfigEnv = /* @__PURE__ */ __name((prefix, config) => {
174
+ if (config.dark) {
175
+ process.env[`${prefix}DARK`] = config.dark;
176
+ }
177
+ if (config.light) {
178
+ process.env[`${prefix}LIGHT`] = config.light;
179
+ }
180
+ if (config.brand) {
181
+ process.env[`${prefix}BRAND`] = config.brand;
182
+ }
183
+ if (config.alternate) {
184
+ process.env[`${prefix}ALTERNATE`] = config.alternate;
185
+ }
186
+ if (config.accent) {
187
+ process.env[`${prefix}ACCENT`] = config.accent;
188
+ }
189
+ if (config.link) {
190
+ process.env[`${prefix}LINK`] = config.link;
191
+ }
192
+ if (config.help) {
193
+ process.env[`${prefix}HELP`] = config.help;
194
+ }
195
+ if (config.success) {
196
+ process.env[`${prefix}SUCCESS`] = config.success;
197
+ }
198
+ if (config.info) {
199
+ process.env[`${prefix}INFO`] = config.info;
200
+ }
201
+ if (config.warning) {
202
+ process.env[`${prefix}WARNING`] = config.warning;
203
+ }
204
+ if (config.danger) {
205
+ process.env[`${prefix}DANGER`] = config.danger;
206
+ }
207
+ if (config.fatal) {
208
+ process.env[`${prefix}FATAL`] = config.fatal;
209
+ }
210
+ if (config.positive) {
211
+ process.env[`${prefix}POSITIVE`] = config.positive;
212
+ }
213
+ if (config.negative) {
214
+ process.env[`${prefix}NEGATIVE`] = config.negative;
215
+ }
216
+ }, "setSingleThemeColorConfigEnv");
217
+ var setMultiThemeColorConfigEnv = /* @__PURE__ */ __name((prefix, config) => {
218
+ return {
219
+ light: setBaseThemeColorConfigEnv(`${prefix}LIGHT_`, config.light),
220
+ dark: setBaseThemeColorConfigEnv(`${prefix}DARK_`, config.dark)
221
+ };
222
+ }, "setMultiThemeColorConfigEnv");
223
+ var setBaseThemeColorConfigEnv = /* @__PURE__ */ __name((prefix, config) => {
224
+ if (config.foreground) {
225
+ process.env[`${prefix}FOREGROUND`] = config.foreground;
226
+ }
227
+ if (config.background) {
228
+ process.env[`${prefix}BACKGROUND`] = config.background;
229
+ }
230
+ if (config.brand) {
231
+ process.env[`${prefix}BRAND`] = config.brand;
232
+ }
233
+ if (config.alternate) {
234
+ process.env[`${prefix}ALTERNATE`] = config.alternate;
235
+ }
236
+ if (config.accent) {
237
+ process.env[`${prefix}ACCENT`] = config.accent;
238
+ }
239
+ if (config.link) {
240
+ process.env[`${prefix}LINK`] = config.link;
241
+ }
242
+ if (config.help) {
243
+ process.env[`${prefix}HELP`] = config.help;
244
+ }
245
+ if (config.success) {
246
+ process.env[`${prefix}SUCCESS`] = config.success;
247
+ }
248
+ if (config.info) {
249
+ process.env[`${prefix}INFO`] = config.info;
250
+ }
251
+ if (config.warning) {
252
+ process.env[`${prefix}WARNING`] = config.warning;
253
+ }
254
+ if (config.danger) {
255
+ process.env[`${prefix}DANGER`] = config.danger;
256
+ }
257
+ if (config.fatal) {
258
+ process.env[`${prefix}FATAL`] = config.fatal;
259
+ }
260
+ if (config.positive) {
261
+ process.env[`${prefix}POSITIVE`] = config.positive;
262
+ }
263
+ if (config.negative) {
264
+ process.env[`${prefix}NEGATIVE`] = config.negative;
265
+ }
266
+ }, "setBaseThemeColorConfigEnv");
267
+
268
+ export {
269
+ setExtensionEnv,
270
+ setConfigEnv
271
+ };
@@ -0,0 +1,102 @@
1
+ import {
2
+ defu,
3
+ getConfigFile
4
+ } from "./chunk-RYIDKM6L.mjs";
5
+ import {
6
+ formatLogMessage,
7
+ writeTrace,
8
+ writeWarning
9
+ } from "./chunk-RHGJNRVE.mjs";
10
+ import {
11
+ getDefaultConfig
12
+ } from "./chunk-PVPSTJNJ.mjs";
13
+ import {
14
+ findWorkspaceRoot
15
+ } from "./chunk-TEKFJAJJ.mjs";
16
+ import {
17
+ getConfigEnv,
18
+ getExtensionEnv
19
+ } from "./chunk-6OYLNZFT.mjs";
20
+ import {
21
+ StormConfigSchema
22
+ } from "./chunk-RAWSXKTG.mjs";
23
+ import {
24
+ setConfigEnv
25
+ } from "./chunk-A7VLTBS6.mjs";
26
+ import {
27
+ __name,
28
+ init_esm_shims
29
+ } from "./chunk-WRFJFYOU.mjs";
30
+
31
+ // src/create-storm-config.ts
32
+ init_esm_shims();
33
+ var _extension_cache = /* @__PURE__ */ new WeakMap();
34
+ var _static_cache = void 0;
35
+ var createConfig = /* @__PURE__ */ __name((workspaceRoot) => {
36
+ return createStormConfig(void 0, void 0, workspaceRoot);
37
+ }, "createConfig");
38
+ var createStormConfig = /* @__PURE__ */ __name((extensionName, schema, workspaceRoot) => {
39
+ let result;
40
+ if (!_static_cache?.data || !_static_cache?.timestamp || _static_cache.timestamp < Date.now() - 3e4) {
41
+ const config = getConfigEnv();
42
+ const defaultConfig = getDefaultConfig(workspaceRoot);
43
+ result = StormConfigSchema.parse(defu(config, defaultConfig));
44
+ result.workspaceRoot ??= defaultConfig.workspaceRoot || findWorkspaceRoot(workspaceRoot);
45
+ } else {
46
+ result = _static_cache.data;
47
+ }
48
+ if (schema && extensionName) {
49
+ result.extensions = {
50
+ ...result.extensions,
51
+ [extensionName]: createConfigExtension(extensionName, schema)
52
+ };
53
+ }
54
+ _static_cache = {
55
+ timestamp: Date.now(),
56
+ data: result
57
+ };
58
+ return result;
59
+ }, "createStormConfig");
60
+ var createConfigExtension = /* @__PURE__ */ __name((extensionName, schema) => {
61
+ const extension_cache_key = {
62
+ extensionName
63
+ };
64
+ if (_extension_cache.has(extension_cache_key)) {
65
+ return _extension_cache.get(extension_cache_key);
66
+ }
67
+ let extension = getExtensionEnv(extensionName);
68
+ if (schema) {
69
+ extension = schema.parse(extension);
70
+ }
71
+ _extension_cache.set(extension_cache_key, extension);
72
+ return extension;
73
+ }, "createConfigExtension");
74
+ var loadStormConfig = /* @__PURE__ */ __name(async (workspaceRoot) => {
75
+ let config = {};
76
+ if (_static_cache?.data && _static_cache?.timestamp && _static_cache.timestamp >= Date.now() + 3e4) {
77
+ writeTrace(`Configuration cache hit - ${_static_cache.timestamp}`, _static_cache.data);
78
+ return _static_cache.data;
79
+ }
80
+ let _workspaceRoot = workspaceRoot;
81
+ if (!_workspaceRoot) {
82
+ _workspaceRoot = findWorkspaceRoot();
83
+ }
84
+ const configFile = await getConfigFile(_workspaceRoot);
85
+ if (!configFile) {
86
+ writeWarning("No Storm config file found in the current workspace. Please ensure this is the expected behavior - you can add a `storm.json` file to the root of your workspace if it is not.\n", {
87
+ logLevel: "all"
88
+ });
89
+ }
90
+ config = defu(getConfigEnv(), configFile, getDefaultConfig(_workspaceRoot));
91
+ setConfigEnv(config);
92
+ writeTrace(`\u2699\uFE0F Using Storm configuration:
93
+ ${formatLogMessage(config)}`, config);
94
+ return config;
95
+ }, "loadStormConfig");
96
+
97
+ export {
98
+ createConfig,
99
+ createStormConfig,
100
+ createConfigExtension,
101
+ loadStormConfig
102
+ };
@@ -0,0 +1,51 @@
1
+ import {
2
+ writeError,
3
+ writeFatal,
4
+ writeSuccess,
5
+ writeTrace
6
+ } from "./chunk-RHGJNRVE.mjs";
7
+ import {
8
+ __name,
9
+ init_esm_shims
10
+ } from "./chunk-WRFJFYOU.mjs";
11
+
12
+ // src/utilities/process-handler.ts
13
+ init_esm_shims();
14
+ var exitWithError = /* @__PURE__ */ __name((config) => {
15
+ writeFatal("Exiting script with an error status...", config);
16
+ process.exit(1);
17
+ }, "exitWithError");
18
+ var exitWithSuccess = /* @__PURE__ */ __name((config) => {
19
+ writeSuccess("Script completed successfully. Exiting...", config);
20
+ process.exit(0);
21
+ }, "exitWithSuccess");
22
+ var handleProcess = /* @__PURE__ */ __name((config) => {
23
+ writeTrace(`Using the following arguments to process the script: ${process.argv.join(", ")}`, config);
24
+ process.on("unhandledRejection", (error) => {
25
+ writeError(`An Unhandled Rejection occurred while running the program: ${error}`, config);
26
+ exitWithError(config);
27
+ });
28
+ process.on("uncaughtException", (error) => {
29
+ writeError(`An Uncaught Exception occurred while running the program: ${error.message}
30
+ Stacktrace: ${error.stack}`, config);
31
+ exitWithError(config);
32
+ });
33
+ process.on("SIGTERM", (signal) => {
34
+ writeError(`The program terminated with signal code: ${signal}`, config);
35
+ exitWithError(config);
36
+ });
37
+ process.on("SIGINT", (signal) => {
38
+ writeError(`The program terminated with signal code: ${signal}`, config);
39
+ exitWithError(config);
40
+ });
41
+ process.on("SIGHUP", (signal) => {
42
+ writeError(`The program terminated with signal code: ${signal}`, config);
43
+ exitWithError(config);
44
+ });
45
+ }, "handleProcess");
46
+
47
+ export {
48
+ exitWithError,
49
+ exitWithSuccess,
50
+ handleProcess
51
+ };