@storm-software/tsup 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -63,11 +63,11 @@ var require_chunk_TWFEYLU4 = __commonJS({
63
63
  function _optionalChain(ops) {
64
64
  let lastAccessLHS = void 0;
65
65
  let value = ops[0];
66
- let i = 1;
67
- while (i < ops.length) {
68
- const op = ops[i];
69
- const fn = ops[i + 1];
70
- i += 2;
66
+ let i3 = 1;
67
+ while (i3 < ops.length) {
68
+ const op = ops[i3];
69
+ const fn = ops[i3 + 1];
70
+ i3 += 2;
71
71
  if ((op === "optionalAccess" || op === "optionalCall") && value == null) {
72
72
  return void 0;
73
73
  }
@@ -88,7 +88,7 @@ var require_chunk_TWFEYLU4 = __commonJS({
88
88
  var __getProtoOf2 = Object.getPrototypeOf;
89
89
  var __hasOwnProp2 = Object.prototype.hasOwnProperty;
90
90
  var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
91
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
91
+ get: (a3, b) => (typeof require !== "undefined" ? require : a3)[b]
92
92
  }) : x)(function(x) {
93
93
  if (typeof require !== "undefined") return require.apply(this, arguments);
94
94
  throw Error('Dynamic require of "' + x + '" is not supported');
@@ -121,7 +121,7 @@ var require_chunk_TWFEYLU4 = __commonJS({
121
121
  var singleComment = Symbol("singleComment");
122
122
  var multiComment = Symbol("multiComment");
123
123
  var stripWithoutWhitespace = () => "";
124
- var stripWithWhitespace = (string, start, end) => string.slice(start, end).replace(/\S/g, " ");
124
+ var stripWithWhitespace = (string3, start, end) => string3.slice(start, end).replace(/\S/g, " ");
125
125
  var isEscaped = (jsonString, quotePosition) => {
126
126
  let index = quotePosition - 1;
127
127
  let backslashCount = 0;
@@ -212,8 +212,8 @@ var require_chunk_TWFEYLU4 = __commonJS({
212
212
  return localRequire("@microsoft/api-extractor");
213
213
  }
214
214
  function localRequire(moduleName) {
215
- const p = _resolvefrom2.default.silent(process.cwd(), moduleName);
216
- return p && __require(p);
215
+ const p3 = _resolvefrom2.default.silent(process.cwd(), moduleName);
216
+ return p3 && __require(p3);
217
217
  }
218
218
  async function removeFiles(patterns, dir) {
219
219
  const files = await _tinyglobby.glob.call(void 0, patterns, {
@@ -257,26 +257,26 @@ var require_chunk_TWFEYLU4 = __commonJS({
257
257
  function jsoncParse(data) {
258
258
  try {
259
259
  return new Function(`return ${stripJsonComments(data).trim()}`)();
260
- } catch (e2) {
260
+ } catch (e22) {
261
261
  return {};
262
262
  }
263
263
  }
264
264
  function defaultOutExtension({
265
- format,
265
+ format: format2,
266
266
  pkgType
267
267
  }) {
268
268
  let jsExtension = ".js";
269
269
  let dtsExtension = ".d.ts";
270
270
  const isModule = pkgType === "module";
271
- if (isModule && format === "cjs") {
271
+ if (isModule && format2 === "cjs") {
272
272
  jsExtension = ".cjs";
273
273
  dtsExtension = ".d.cts";
274
274
  }
275
- if (!isModule && format === "esm") {
275
+ if (!isModule && format2 === "esm") {
276
276
  jsExtension = ".mjs";
277
277
  dtsExtension = ".d.mts";
278
278
  }
279
- if (format === "iife") {
279
+ if (format2 === "iife") {
280
280
  jsExtension = ".global.js";
281
281
  }
282
282
  return {
@@ -302,7 +302,7 @@ var require_chunk_TWFEYLU4 = __commonJS({
302
302
  if (!Array.isArray(entry)) {
303
303
  return entry;
304
304
  }
305
- entry = entry.map((e) => e.replace(/\\/g, "/"));
305
+ entry = entry.map((e4) => e4.replace(/\\/g, "/"));
306
306
  const ancestor = findLowestCommonAncestor(entry);
307
307
  return entry.reduce(
308
308
  (result, item) => {
@@ -334,11 +334,11 @@ var require_chunk_TWFEYLU4 = __commonJS({
334
334
  }
335
335
  return ancestor.length <= 1 && ancestor[0] === "" ? `/${ancestor[0]}` : ancestor.join("/");
336
336
  };
337
- function toAbsolutePath(p, cwd) {
338
- if (_path2.default.isAbsolute(p)) {
339
- return p;
337
+ function toAbsolutePath(p3, cwd) {
338
+ if (_path2.default.isAbsolute(p3)) {
339
+ return p3;
340
340
  }
341
- return slash(_path2.default.normalize(_path2.default.join(cwd || process.cwd(), p)));
341
+ return slash(_path2.default.normalize(_path2.default.join(cwd || process.cwd(), p3)));
342
342
  }
343
343
  function writeFileSync(filePath, content) {
344
344
  _fs2.default.mkdirSync(_path2.default.dirname(filePath), { recursive: true });
@@ -347,7 +347,7 @@ var require_chunk_TWFEYLU4 = __commonJS({
347
347
  function replaceDtsWithJsExtensions(dtsFilePath) {
348
348
  return dtsFilePath.replace(
349
349
  /\.d\.(ts|mts|cts)$/,
350
- (_, fileExtension) => {
350
+ (_3, fileExtension) => {
351
351
  switch (fileExtension) {
352
352
  case "ts":
353
353
  return ".js";
@@ -380,7 +380,7 @@ var require_chunk_TWFEYLU4 = __commonJS({
380
380
  };
381
381
  var resolveExperimentalDtsConfig = async (options2, tsconfig) => {
382
382
  const resolvedEntryPaths = await resolveEntryPaths(
383
- _optionalChain([options2, "access", (_2) => _2.experimentalDts, "optionalAccess", (_3) => _3.entry]) || options2.entry
383
+ _optionalChain([options2, "access", (_22) => _22.experimentalDts, "optionalAccess", (_3) => _3.entry]) || options2.entry
384
384
  );
385
385
  const experimentalDtsObjectEntry = Object.keys(resolvedEntryPaths).length === 0 ? Array.isArray(options2.entry) ? convertArrayEntriesToObjectEntries(options2.entry) : options2.entry : resolvedEntryPaths;
386
386
  const normalizedExperimentalDtsConfig = {
@@ -442,11 +442,11 @@ var require_chunk_VGC3FXLU = __commonJS({
442
442
  function _optionalChain(ops) {
443
443
  let lastAccessLHS = void 0;
444
444
  let value = ops[0];
445
- let i = 1;
446
- while (i < ops.length) {
447
- const op = ops[i];
448
- const fn = ops[i + 1];
449
- i += 2;
445
+ let i3 = 1;
446
+ while (i3 < ops.length) {
447
+ const op = ops[i3];
448
+ const fn = ops[i3 + 1];
449
+ i3 += 2;
450
450
  if ((op === "optionalAccess" || op === "optionalCall") && value == null) {
451
451
  return void 0;
452
452
  }
@@ -600,7 +600,7 @@ var require_chunk_VGC3FXLU = __commonJS({
600
600
  switch (type) {
601
601
  case "error": {
602
602
  if (!_worker_threads.isMainThread) {
603
- _optionalChain([_worker_threads.parentPort, "optionalAccess", (_) => _.postMessage, "call", (_2) => _2({
603
+ _optionalChain([_worker_threads.parentPort, "optionalAccess", (_3) => _3.postMessage, "call", (_22) => _22({
604
604
  type: "error",
605
605
  text: _util2.default.format(...args)
606
606
  })]);
@@ -636,12 +636,12 @@ var require_chunk_VGC3FXLU = __commonJS({
636
636
  var padRight = (str, maxLength) => {
637
637
  return str + " ".repeat(maxLength - str.length);
638
638
  };
639
- var reportSize = (logger, format, files) => {
639
+ var reportSize = (logger, format2, files) => {
640
640
  const filenames = Object.keys(files);
641
641
  const maxLength = getLengthOfLongestString(filenames) + 1;
642
642
  for (const name of filenames) {
643
643
  logger.success(
644
- format,
644
+ format2,
645
645
  `${_picocolors2.default.bold(padRight(name, maxLength))}${_picocolors2.default.green(
646
646
  prettyBytes(files[name])
647
647
  )}`
@@ -832,7 +832,7 @@ var require_commonjs_plugin = __commonJS({
832
832
  readInt(radix, len) {
833
833
  let start = this.pos;
834
834
  let total = 0;
835
- for (let i = 0; i < len; ++i, ++this.pos) {
835
+ for (let i3 = 0; i3 < len; ++i3, ++this.pos) {
836
836
  let code = this.input.charCodeAt(this.pos);
837
837
  let val;
838
838
  if (code >= 97) {
@@ -867,15 +867,15 @@ var require_commonjs_plugin = __commonJS({
867
867
  return code;
868
868
  }
869
869
  };
870
- function orderedUniq(array) {
870
+ function orderedUniq(array3) {
871
871
  let ret = [], visited = /* @__PURE__ */ new Set();
872
- for (let val of array) if (!visited.has(val)) visited.add(val), ret.push(val);
872
+ for (let val of array3) if (!visited.has(val)) visited.add(val), ret.push(val);
873
873
  return ret;
874
874
  }
875
- function cachedReduce(array, reducer, s) {
876
- let cache = [s], cacheLen = 1, last = s;
875
+ function cachedReduce(array3, reducer, s3) {
876
+ let cache = [s3], cacheLen = 1, last = s3;
877
877
  return (len) => {
878
- while (cacheLen <= len) cacheLen = cache.push(last = reducer(last, array[cacheLen - 1]));
878
+ while (cacheLen <= len) cacheLen = cache.push(last = reducer(last, array3[cacheLen - 1]));
879
879
  return cache[len];
880
880
  };
881
881
  }
@@ -884,7 +884,7 @@ var require_commonjs_plugin = __commonJS({
884
884
  var forbiddenIdentifiers = new Set(`${reservedWords} ${builtin}`.split(" "));
885
885
  forbiddenIdentifiers.add("");
886
886
  var makeLegalIdentifier = function makeLegalIdentifier2(str) {
887
- let identifier = str.replace(/-(\w)/g, (_, letter) => letter.toUpperCase()).replace(/[^$_a-zA-Z0-9]/g, "_");
887
+ let identifier = str.replace(/-(\w)/g, (_3, letter) => letter.toUpperCase()).replace(/[^$_a-zA-Z0-9]/g, "_");
888
888
  if (/\d/.test(identifier[0]) || forbiddenIdentifiers.has(identifier)) {
889
889
  identifier = `_${identifier}`;
890
890
  }
@@ -892,21 +892,21 @@ var require_commonjs_plugin = __commonJS({
892
892
  };
893
893
  function prepend(code, prefix) {
894
894
  if (code.startsWith("#!")) {
895
- const i = code.indexOf("\n") + 1;
896
- return code.slice(0, i) + prefix + code.slice(i);
895
+ const i3 = code.indexOf("\n") + 1;
896
+ return code.slice(0, i3) + prefix + code.slice(i3);
897
897
  }
898
898
  return prefix + code;
899
899
  }
900
900
  function commonjs({
901
901
  filter = /\.c?js$/,
902
- transform = false,
902
+ transform: transform2 = false,
903
903
  transformConfig,
904
904
  requireReturnsDefault = false,
905
905
  ignore
906
906
  } = {}) {
907
- const init_cjs_module_lexer = transform ? import("cjs-module-lexer") : void 0;
907
+ const init_cjs_module_lexer = transform2 ? import("cjs-module-lexer") : void 0;
908
908
  const use_default_export = typeof requireReturnsDefault === "function" ? requireReturnsDefault : (_path) => requireReturnsDefault;
909
- const is_ignored = typeof ignore === "function" ? ignore : Array.isArray(ignore) ? (path) => ignore.includes(path) : () => false;
909
+ const is_ignored = typeof ignore === "function" ? ignore : Array.isArray(ignore) ? (path2) => ignore.includes(path2) : () => false;
910
910
  return {
911
911
  name: "commonjs",
912
912
  setup({ onLoad, esbuild }) {
@@ -917,9 +917,9 @@ var require_commonjs_plugin = __commonJS({
917
917
  onLoad({ filter }, async (args) => {
918
918
  let parseCJS;
919
919
  if (init_cjs_module_lexer) {
920
- const { init, parse } = await init_cjs_module_lexer;
920
+ const { init, parse: parse2 } = await init_cjs_module_lexer;
921
921
  await init();
922
- parseCJS = parse;
922
+ parseCJS = parse2;
923
923
  }
924
924
  let contents;
925
925
  try {
@@ -927,7 +927,7 @@ var require_commonjs_plugin = __commonJS({
927
927
  } catch {
928
928
  return null;
929
929
  }
930
- const willTransform = transform === true || typeof transform === "function" && transform(args.path);
930
+ const willTransform = transform2 === true || typeof transform2 === "function" && transform2(args.path);
931
931
  let cjsExports;
932
932
  if (parseCJS && willTransform) {
933
933
  let sourcemapIndex = contents.lastIndexOf("//# sourceMappingURL=");
@@ -947,15 +947,15 @@ var require_commonjs_plugin = __commonJS({
947
947
  exports22 = orderedUniq(cjsExports.exports.concat(exports22 ?? []));
948
948
  sideEffects ?? (sideEffects = (transformConfig == null ? void 0 : transformConfig.sideEffects) ?? true);
949
949
  let exportDefault = behavior === "node" ? "export default exports;" : "export default exports.__esModule ? exports.default : exports;";
950
- let exportsMap = exports22.map((e) => [e, makeLegalIdentifier(e)]);
951
- if (exportsMap.some(([e]) => e === "default")) {
950
+ let exportsMap = exports22.map((e4) => [e4, makeLegalIdentifier(e4)]);
951
+ if (exportsMap.some(([e4]) => e4 === "default")) {
952
952
  if (behavior === "node") {
953
- exportsMap = exportsMap.filter(([e]) => e !== "default");
953
+ exportsMap = exportsMap.filter(([e4]) => e4 !== "default");
954
954
  } else {
955
955
  exportDefault = "";
956
956
  }
957
957
  }
958
- let reexports = cjsExports.reexports.map((e) => `export * from ${JSON.stringify(e)};`).join("");
958
+ let reexports = cjsExports.reexports.map((e4) => `export * from ${JSON.stringify(e4)};`).join("");
959
959
  let transformed;
960
960
  if (sideEffects === false) {
961
961
  transformed = [
@@ -964,11 +964,11 @@ var require_commonjs_plugin = __commonJS({
964
964
  "return module.exports})((mod = { exports: {} }).exports, mod); " + exportDefault
965
965
  ];
966
966
  if (exportsMap.length > 0) {
967
- for (const [e, name] of exportsMap) {
968
- transformed.push(`var ${name} = /* @__PURE__ */ (() => exports[${JSON.stringify(e)}])();`);
967
+ for (const [e4, name] of exportsMap) {
968
+ transformed.push(`var ${name} = /* @__PURE__ */ (() => exports[${JSON.stringify(e4)}])();`);
969
969
  }
970
970
  transformed.push(
971
- `export { ${exportsMap.map(([e, name]) => e === name ? e : `${name} as ${JSON.stringify(e)}`).join(", ")} };`
971
+ `export { ${exportsMap.map(([e4, name]) => e4 === name ? e4 : `${name} as ${JSON.stringify(e4)}`).join(", ")} };`
972
972
  );
973
973
  }
974
974
  } else {
@@ -978,15 +978,15 @@ var require_commonjs_plugin = __commonJS({
978
978
  ];
979
979
  if (exportsMap.length > 0) {
980
980
  transformed.push(
981
- `var { ${exportsMap.map(([e, name]) => e === name ? e : `${JSON.stringify(e)}: ${name}`).join(", ")} } = exports;`,
982
- `export { ${exportsMap.map(([e, name]) => e === name ? e : `${name} as ${JSON.stringify(e)}`).join(", ")} };`
981
+ `var { ${exportsMap.map(([e4, name]) => e4 === name ? e4 : `${JSON.stringify(e4)}: ${name}`).join(", ")} } = exports;`,
982
+ `export { ${exportsMap.map(([e4, name]) => e4 === name ? e4 : `${name} as ${JSON.stringify(e4)}`).join(", ")} };`
983
983
  );
984
984
  }
985
985
  }
986
986
  contents = transformed.join("\n") + (sourcemap ? "\n" + sourcemap : "");
987
987
  }
988
- function makeName(path) {
989
- let name = `__import_${makeLegalIdentifier(path)}`;
988
+ function makeName(path2) {
989
+ let name = `__import_${makeLegalIdentifier(path2)}`;
990
990
  if (contents.includes(name)) {
991
991
  let suffix = 2;
992
992
  while (contents.includes(`${name}${suffix}`)) suffix++;
@@ -1001,23 +1001,23 @@ var require_commonjs_plugin = __commonJS({
1001
1001
  ({ warnings } = err);
1002
1002
  }
1003
1003
  let lines = contents.split("\n");
1004
- let getOffset = cachedReduce(lines, (a, b) => a + 1 + b.length, 0);
1005
- if (warnings && (warnings = warnings.filter((e) => e.text.includes('"require" to "esm"'))).length) {
1004
+ let getOffset = cachedReduce(lines, (a3, b) => a3 + 1 + b.length, 0);
1005
+ if (warnings && (warnings = warnings.filter((e4) => e4.text.includes('"require" to "esm"'))).length) {
1006
1006
  let edits = [];
1007
1007
  let imports = [];
1008
1008
  for (const { location } of warnings) {
1009
1009
  if (location === null) continue;
1010
- const { line, lineText, column, length } = location;
1011
- const leftBrace = column + length + 1;
1012
- const path = lexer.readString(lineText, leftBrace);
1013
- if (path === null || is_ignored(path)) continue;
1014
- const rightBrace = lineText.indexOf(")", leftBrace + 2 + path.length) + 1;
1015
- let name = makeName(path);
1010
+ const { line, lineText, column, length: length3 } = location;
1011
+ const leftBrace = column + length3 + 1;
1012
+ const path2 = lexer.readString(lineText, leftBrace);
1013
+ if (path2 === null || is_ignored(path2)) continue;
1014
+ const rightBrace = lineText.indexOf(")", leftBrace + 2 + path2.length) + 1;
1015
+ let name = makeName(path2);
1016
1016
  let import_statement;
1017
- if (use_default_export(path)) {
1018
- import_statement = `import ${name} from ${JSON.stringify(path)};`;
1017
+ if (use_default_export(path2)) {
1018
+ import_statement = `import ${name} from ${JSON.stringify(path2)};`;
1019
1019
  } else {
1020
- import_statement = `import * as ${name} from ${JSON.stringify(path)};`;
1020
+ import_statement = `import * as ${name} from ${JSON.stringify(path2)};`;
1021
1021
  }
1022
1022
  let offset2 = getOffset(line - 1);
1023
1023
  edits.push([offset2 + column, offset2 + rightBrace, name]);
@@ -1076,11 +1076,11 @@ var require_dist = __commonJS({
1076
1076
  function _optionalChain(ops) {
1077
1077
  let lastAccessLHS = void 0;
1078
1078
  let value = ops[0];
1079
- let i = 1;
1080
- while (i < ops.length) {
1081
- const op = ops[i];
1082
- const fn = ops[i + 1];
1083
- i += 2;
1079
+ let i3 = 1;
1080
+ while (i3 < ops.length) {
1081
+ const op = ops[i3];
1082
+ const fn = ops[i3 + 1];
1083
+ i3 += 2;
1084
1084
  if ((op === "optionalAccess" || op === "optionalCall") && value == null) {
1085
1085
  return void 0;
1086
1086
  }
@@ -1186,12 +1186,12 @@ var require_dist = __commonJS({
1186
1186
  setup(build22) {
1187
1187
  let configCache;
1188
1188
  const getPostcssConfig = async () => {
1189
- const loadConfig = _chunkTWFEYLU4js.__require.call(void 0, "postcss-load-config");
1189
+ const loadConfig3 = _chunkTWFEYLU4js.__require.call(void 0, "postcss-load-config");
1190
1190
  if (configCache) {
1191
1191
  return configCache;
1192
1192
  }
1193
1193
  try {
1194
- const result = await loadConfig({}, options2.workspaceConfig?.workspaceRoot || process.cwd());
1194
+ const result = await loadConfig3({}, options2.workspaceConfig?.workspaceRoot || process.cwd());
1195
1195
  configCache = result;
1196
1196
  return result;
1197
1197
  } catch (error) {
@@ -1258,7 +1258,7 @@ var require_dist = __commonJS({
1258
1258
  ]
1259
1259
  };
1260
1260
  }
1261
- const result = await _optionalChain([postcss, "optionalAccess", (_2) => _2.default, "call", (_3) => _3(plugins), "access", (_4) => _4.process, "call", (_5) => _5(contents, { ...options3, from: args.path })]);
1261
+ const result = await _optionalChain([postcss, "optionalAccess", (_22) => _22.default, "call", (_3) => _3(plugins), "access", (_4) => _4.process, "call", (_5) => _5(contents, { ...options3, from: args.path })]);
1262
1262
  contents = result.css;
1263
1263
  }
1264
1264
  if (inject) {
@@ -1286,7 +1286,7 @@ var require_dist = __commonJS({
1286
1286
  }
1287
1287
  };
1288
1288
  };
1289
- var useSvelteCssExtension = (p) => p.replace(/\.svelte$/, ".svelte.css");
1289
+ var useSvelteCssExtension = (p3) => p3.replace(/\.svelte$/, ".svelte.css");
1290
1290
  var sveltePlugin = ({
1291
1291
  css,
1292
1292
  options: options2
@@ -1423,10 +1423,10 @@ var require_dist = __commonJS({
1423
1423
  }
1424
1424
  };
1425
1425
  };
1426
- var getOutputExtensionMap = (options2, format, pkgType) => {
1426
+ var getOutputExtensionMap = (options2, format2, pkgType) => {
1427
1427
  const outExtension = options2.outExtension || _chunkTWFEYLU4js.defaultOutExtension;
1428
- const defaultExtension = _chunkTWFEYLU4js.defaultOutExtension.call(void 0, { format, pkgType });
1429
- const extension = outExtension({ options: options2, format, pkgType });
1428
+ const defaultExtension = _chunkTWFEYLU4js.defaultOutExtension.call(void 0, { format: format2, pkgType });
1429
+ const extension = outExtension({ options: options2, format: format2, pkgType });
1430
1430
  return {
1431
1431
  ".js": extension.js || defaultExtension.js
1432
1432
  };
@@ -1445,7 +1445,7 @@ var require_dist = __commonJS({
1445
1445
  return result;
1446
1446
  };
1447
1447
  async function runEsbuild(options2, {
1448
- format,
1448
+ format: format2,
1449
1449
  css,
1450
1450
  logger: logger3,
1451
1451
  buildDependencies,
@@ -1459,43 +1459,43 @@ var require_dist = __commonJS({
1459
1459
  ...await generateExternal(options2.external || [])
1460
1460
  ];
1461
1461
  const outDir = options2.outDir;
1462
- const outExtension = getOutputExtensionMap(options2, format, pkg.type);
1462
+ const outExtension = getOutputExtensionMap(options2, format2, pkg.type);
1463
1463
  const env = {
1464
1464
  ...options2.env
1465
1465
  };
1466
1466
  if (options2.replaceNodeEnv) {
1467
1467
  env.NODE_ENV = options2.minify || options2.minifyWhitespace ? "production" : "development";
1468
1468
  }
1469
- logger3.info(format, "Build start");
1469
+ logger3.info(format2, "Build start");
1470
1470
  const startTime = Date.now();
1471
1471
  let result;
1472
- const splitting = format === "iife" ? false : typeof options2.splitting === "boolean" ? options2.splitting : format === "esm";
1472
+ const splitting = format2 === "iife" ? false : typeof options2.splitting === "boolean" ? options2.splitting : format2 === "esm";
1473
1473
  const platform = options2.platform || "node";
1474
1474
  const loader = options2.loader || {};
1475
1475
  const injectShims = options2.shims;
1476
1476
  const bundle = typeof options2.bundle === "undefined" ? true : options2.bundle;
1477
1477
  pluginContainer.setContext({
1478
- format,
1478
+ format: format2,
1479
1479
  splitting,
1480
1480
  options: options2,
1481
1481
  logger: logger3
1482
1482
  });
1483
1483
  await pluginContainer.buildStarted();
1484
1484
  const esbuildPlugins = [
1485
- format === "cjs" && options2.removeNodeProtocol && nodeProtocolPlugin(),
1486
- format === "esm" && bundle && _commonjsPluginjs.commonjs.call(void 0),
1485
+ format2 === "cjs" && options2.removeNodeProtocol && nodeProtocolPlugin(),
1486
+ format2 === "esm" && bundle && _commonjsPluginjs.commonjs.call(void 0),
1487
1487
  {
1488
1488
  name: "modify-options",
1489
1489
  setup(build22) {
1490
1490
  pluginContainer.modifyEsbuildOptions(build22.initialOptions);
1491
1491
  if (options2.esbuildOptions) {
1492
- options2.esbuildOptions(build22.initialOptions, { format });
1492
+ options2.esbuildOptions(build22.initialOptions, { format: format2 });
1493
1493
  }
1494
1494
  }
1495
1495
  },
1496
1496
  // esbuild's `external` option doesn't support RegExp
1497
1497
  // So here we use a custom plugin to implement it
1498
- format !== "iife" && externalPlugin({
1498
+ format2 !== "iife" && externalPlugin({
1499
1499
  external,
1500
1500
  noExternal: options2.noExternal,
1501
1501
  skipNodeModulesBundle: options2.skipNodeModulesBundle,
@@ -1512,12 +1512,12 @@ var require_dist = __commonJS({
1512
1512
  sveltePlugin({ css, options: options2 }),
1513
1513
  ...options2.esbuildPlugins || []
1514
1514
  ];
1515
- const banner = typeof options2.banner === "function" ? options2.banner({ format }) : options2.banner;
1516
- const footer = typeof options2.footer === "function" ? options2.footer({ format }) : options2.footer;
1515
+ const banner = typeof options2.banner === "function" ? options2.banner({ format: format2 }) : options2.banner;
1516
+ const footer = typeof options2.footer === "function" ? options2.footer({ format: format2 }) : options2.footer;
1517
1517
  try {
1518
1518
  result = await _esbuild.build.call(void 0, {
1519
1519
  entryPoints: options2.entry,
1520
- format: format === "cjs" && splitting || options2.treeshake ? "esm" : format,
1520
+ format: format2 === "cjs" && splitting || options2.treeshake ? "esm" : format2,
1521
1521
  bundle,
1522
1522
  platform,
1523
1523
  globalName: options2.globalName,
@@ -1553,8 +1553,8 @@ var require_dist = __commonJS({
1553
1553
  mainFields: platform === "node" ? ["module", "main"] : ["browser", "module", "main"],
1554
1554
  plugins: esbuildPlugins.filter(_chunkTWFEYLU4js.truthy),
1555
1555
  define: {
1556
- TSUP_FORMAT: JSON.stringify(format),
1557
- ...format === "cjs" && injectShims ? {
1556
+ TSUP_FORMAT: JSON.stringify(format2),
1557
+ ...format2 === "cjs" && injectShims ? {
1558
1558
  "import.meta.url": "importMetaUrl"
1559
1559
  } : {},
1560
1560
  ...options2.define,
@@ -1568,11 +1568,11 @@ var require_dist = __commonJS({
1568
1568
  }, {})
1569
1569
  },
1570
1570
  inject: [
1571
- format === "cjs" && injectShims ? _path2.default.join(__dirname, "../assets/cjs_shims.js") : "",
1572
- format === "esm" && injectShims && platform === "node" ? _path2.default.join(__dirname, "../assets/esm_shims.js") : "",
1571
+ format2 === "cjs" && injectShims ? _path2.default.join(__dirname, "../assets/cjs_shims.js") : "",
1572
+ format2 === "esm" && injectShims && platform === "node" ? _path2.default.join(__dirname, "../assets/esm_shims.js") : "",
1573
1573
  ...options2.inject || []
1574
1574
  ].filter(Boolean),
1575
- outdir: options2.legacyOutput && format !== "cjs" ? _path2.default.join(outDir, format) : outDir,
1575
+ outdir: options2.legacyOutput && format2 !== "cjs" ? _path2.default.join(outDir, format2) : outDir,
1576
1576
  outExtension: options2.legacyOutput ? void 0 : outExtension,
1577
1577
  write: false,
1578
1578
  splitting,
@@ -1586,7 +1586,7 @@ var require_dist = __commonJS({
1586
1586
  metafile: true
1587
1587
  });
1588
1588
  } catch (error) {
1589
- logger3.error(format, "Build failed");
1589
+ logger3.error(format2, "Build failed");
1590
1590
  throw error;
1591
1591
  }
1592
1592
  if (result && result.warnings && !_chunkVGC3FXLUjs.getSilent.call(void 0)) {
@@ -1612,14 +1612,14 @@ var require_dist = __commonJS({
1612
1612
  metafile: result.metafile
1613
1613
  });
1614
1614
  const timeInMs = Date.now() - startTime;
1615
- logger3.success(format, `\u26A1\uFE0F Build success in ${Math.floor(timeInMs)}ms`);
1615
+ logger3.success(format2, `\u26A1\uFE0F Build success in ${Math.floor(timeInMs)}ms`);
1616
1616
  }
1617
1617
  if (result.metafile) {
1618
1618
  for (const file of Object.keys(result.metafile.inputs)) {
1619
1619
  buildDependencies.add(file);
1620
1620
  }
1621
1621
  if (options2.metafile) {
1622
- const outPath = _path2.default.resolve(outDir, `metafile-${format}.json`);
1622
+ const outPath = _path2.default.resolve(outDir, `metafile-${format2}.json`);
1623
1623
  await _fs2.default.promises.mkdir(_path2.default.dirname(outPath), { recursive: true });
1624
1624
  await _fs2.default.promises.writeFile(
1625
1625
  outPath,
@@ -1632,7 +1632,7 @@ var require_dist = __commonJS({
1632
1632
  var shebang = () => {
1633
1633
  return {
1634
1634
  name: "shebang",
1635
- renderChunk(_, info) {
1635
+ renderChunk(_3, info) {
1636
1636
  if (info.type === "chunk" && /\.(cjs|js|mjs)$/.test(info.path) && info.code.startsWith("#!")) {
1637
1637
  info.mode = 493;
1638
1638
  }
@@ -1727,7 +1727,7 @@ var require_dist = __commonJS({
1727
1727
  type: "chunk",
1728
1728
  path: file.path,
1729
1729
  code: file.text,
1730
- map: _optionalChain([outputFiles, "access", (_8) => _8.find, "call", (_9) => _9((f) => f.path === `${file.path}.map`), "optionalAccess", (_10) => _10.text]),
1730
+ map: _optionalChain([outputFiles, "access", (_8) => _8.find, "call", (_9) => _9((f2) => f2.path === `${file.path}.map`), "optionalAccess", (_10) => _10.text]),
1731
1731
  entryPoint: _optionalChain([meta, "optionalAccess", (_11) => _11.entryPoint]),
1732
1732
  exports: _optionalChain([meta, "optionalAccess", (_12) => _12.exports]),
1733
1733
  imports: _optionalChain([meta, "optionalAccess", (_13) => _13.imports])
@@ -1815,10 +1815,10 @@ var require_dist = __commonJS({
1815
1815
  if (!map) return "";
1816
1816
  const prefix = isCssFile ? "/*" : "//";
1817
1817
  const suffix = isCssFile ? " */" : "";
1818
- const url = inline ? `data:application/json;base64,${Buffer.from(
1818
+ const url3 = inline ? `data:application/json;base64,${Buffer.from(
1819
1819
  typeof map === "string" ? map : JSON.stringify(map)
1820
1820
  ).toString("base64")}` : `${_path2.default.basename(filepath)}.map`;
1821
- return `${prefix}# sourceMappingURL=${url}${suffix}`;
1821
+ return `${prefix}# sourceMappingURL=${url3}${suffix}`;
1822
1822
  };
1823
1823
  var TARGETS = ["es5", "es3"];
1824
1824
  var swcTarget = () => {
@@ -1837,13 +1837,13 @@ var require_dist = __commonJS({
1837
1837
  if (!enabled || !/\.(cjs|mjs|js)$/.test(info.path)) {
1838
1838
  return;
1839
1839
  }
1840
- const swc = _chunkTWFEYLU4js.localRequire.call(void 0, "@swc/core");
1841
- if (!swc) {
1840
+ const swc2 = _chunkTWFEYLU4js.localRequire.call(void 0, "@swc/core");
1841
+ if (!swc2) {
1842
1842
  throw new (0, _chunkJZ25TPTYjs.PrettyError)(
1843
1843
  `@swc/core is required for ${target} target. Please install it with \`npm install @swc/core -D\``
1844
1844
  );
1845
1845
  }
1846
- const result = await swc.transform(code, {
1846
+ const result = await swc2.transform(code, {
1847
1847
  filename: info.path,
1848
1848
  sourceMaps: this.options.sourcemap,
1849
1849
  minify: Boolean(this.options.minify),
@@ -1951,7 +1951,7 @@ var require_dist = __commonJS({
1951
1951
  };
1952
1952
  var terserPlugin = ({
1953
1953
  minifyOptions,
1954
- format,
1954
+ format: format2,
1955
1955
  terserOptions = {},
1956
1956
  globalName,
1957
1957
  logger: logger3
@@ -1969,9 +1969,9 @@ var require_dist = __commonJS({
1969
1969
  }
1970
1970
  const { minify } = terser;
1971
1971
  const defaultOptions = {};
1972
- if (format === "esm") {
1972
+ if (format2 === "esm") {
1973
1973
  defaultOptions.module = true;
1974
- } else if (!(format === "iife" && globalName !== void 0)) {
1974
+ } else if (!(format2 === "iife" && globalName !== void 0)) {
1975
1975
  defaultOptions.toplevel = true;
1976
1976
  }
1977
1977
  try {
@@ -2056,7 +2056,7 @@ var require_dist = __commonJS({
2056
2056
  }
2057
2057
  function emitDtsFiles(program, host) {
2058
2058
  const fileMapping = /* @__PURE__ */ new Map();
2059
- const writeFile = (fileName, text, writeByteOrderMark, onError, sourceFiles, data) => {
2059
+ const writeFile2 = (fileName, text, writeByteOrderMark, onError, sourceFiles, data) => {
2060
2060
  const sourceFile = _optionalChain([sourceFiles, "optionalAccess", (_14) => _14[0]]);
2061
2061
  const sourceFileName = _optionalChain([sourceFile, "optionalAccess", (_15) => _15.fileName]);
2062
2062
  if (sourceFileName && !fileName.endsWith(".map")) {
@@ -2075,7 +2075,7 @@ var require_dist = __commonJS({
2075
2075
  data
2076
2076
  );
2077
2077
  };
2078
- const emitResult = program.emit(void 0, writeFile, void 0, true);
2078
+ const emitResult = program.emit(void 0, writeFile2, void 0, true);
2079
2079
  const diagnostics = _typescript2.default.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
2080
2080
  const diagnosticMessages = [];
2081
2081
  diagnostics.forEach((diagnostic) => {
@@ -2299,14 +2299,14 @@ ${diagnosticMessage}`
2299
2299
  );
2300
2300
  }
2301
2301
  }
2302
- async function rollupDtsFiles(options2, exports3, format) {
2302
+ async function rollupDtsFiles(options2, exports3, format2) {
2303
2303
  if (!options2.experimentalDts || !_optionalChain([options2, "access", (_18) => _18.experimentalDts, "optionalAccess", (_19) => _19.entry])) {
2304
2304
  return;
2305
2305
  }
2306
2306
  const declarationDir = _chunkTWFEYLU4js.ensureTempDeclarationDir.call(void 0, options2);
2307
2307
  const outDir = options2.outDir || "dist";
2308
2308
  const pkg = await _chunkVGC3FXLUjs.loadPkg.call(void 0, options2.workspaceConfig?.workspaceRoot || process.cwd());
2309
- const dtsExtension = _chunkTWFEYLU4js.defaultOutExtension.call(void 0, { format, pkgType: pkg.type }).dts;
2309
+ const dtsExtension = _chunkTWFEYLU4js.defaultOutExtension.call(void 0, { format: format2, pkgType: pkg.type }).dts;
2310
2310
  const tsconfig = options2.tsconfig || "tsconfig.json";
2311
2311
  let dtsInputFilePath = _path2.default.join(
2312
2312
  declarationDir,
@@ -2351,8 +2351,8 @@ ${diagnosticMessage}`
2351
2351
  throw new Error("Unexpected internal error: dts exports is not define");
2352
2352
  }
2353
2353
  await cleanDtsFiles(options2);
2354
- for (const format of options2.format) {
2355
- await rollupDtsFiles(options2, exports3, format);
2354
+ for (const format2 of options2.format) {
2355
+ await rollupDtsFiles(options2, exports3, format2);
2356
2356
  }
2357
2357
  logger2.success("dts", `\u26A1\uFE0F Build success in ${getDuration()}`);
2358
2358
  } catch (error) {
@@ -2380,10 +2380,10 @@ module.exports = exports.default;
2380
2380
  var isTaskkillCmdProcessNotFoundError = (err) => {
2381
2381
  return process.platform === "win32" && "cmd" in err && "code" in err && typeof err.cmd === "string" && err.cmd.startsWith("taskkill") && err.code === 128;
2382
2382
  };
2383
- var killProcess = ({ pid, signal }) => new Promise((resolve, reject) => {
2383
+ var killProcess = ({ pid, signal }) => new Promise((resolve2, reject) => {
2384
2384
  _treekill2.default.call(void 0, pid, signal, (err) => {
2385
2385
  if (err && !isTaskkillCmdProcessNotFoundError(err)) return reject(err);
2386
- resolve();
2386
+ resolve2();
2387
2387
  });
2388
2388
  });
2389
2389
  var normalizeOptions = async (logger3, optionsFromConfigFile, optionsOverride) => {
@@ -2494,7 +2494,7 @@ module.exports = exports.default;
2494
2494
  }
2495
2495
  await experimentalDtsTask();
2496
2496
  if (options2.dts) {
2497
- await new Promise((resolve, reject) => {
2497
+ await new Promise((resolve2, reject) => {
2498
2498
  let workerPath = _path2.default.join(__dirname, "./rollup.cjs");
2499
2499
  if (!_fs2.default.existsSync(workerPath)) {
2500
2500
  workerPath = _path2.default.join(__dirname, "./rollup.js");
@@ -2526,7 +2526,7 @@ module.exports = exports.default;
2526
2526
  reject(new Error("error occurred in dts build"));
2527
2527
  } else if (data === "success") {
2528
2528
  terminateWorker();
2529
- resolve();
2529
+ resolve2();
2530
2530
  } else {
2531
2531
  const { type, text } = data;
2532
2532
  if (type === "log") {
@@ -2579,7 +2579,7 @@ module.exports = exports.default;
2579
2579
  }
2580
2580
  const css = /* @__PURE__ */ new Map();
2581
2581
  await Promise.all([
2582
- ...options2.format.map(async (format, index) => {
2582
+ ...options2.format.map(async (format2, index) => {
2583
2583
  const pluginContainer = new PluginContainer([
2584
2584
  shebang(),
2585
2585
  ...options2.plugins || [],
@@ -2594,7 +2594,7 @@ module.exports = exports.default;
2594
2594
  sizeReporter(),
2595
2595
  terserPlugin({
2596
2596
  minifyOptions: options2.minify,
2597
- format,
2597
+ format: format2,
2598
2598
  terserOptions: options2.terserOptions,
2599
2599
  globalName: options2.globalName,
2600
2600
  logger: logger3
@@ -2602,13 +2602,13 @@ module.exports = exports.default;
2602
2602
  ]);
2603
2603
  await runEsbuild(options2, {
2604
2604
  pluginContainer,
2605
- format,
2605
+ format: format2,
2606
2606
  css: index === 0 || options2.injectStyle ? css : void 0,
2607
2607
  logger: logger3,
2608
2608
  buildDependencies
2609
2609
  }).catch((error) => {
2610
2610
  previousBuildDependencies.forEach(
2611
- (v) => buildDependencies.add(v)
2611
+ (v2) => buildDependencies.add(v2)
2612
2612
  );
2613
2613
  throw error;
2614
2614
  });
@@ -2641,16 +2641,16 @@ module.exports = exports.default;
2641
2641
  const watchPaths = typeof options2.watch === "boolean" ? "." : Array.isArray(options2.watch) ? options2.watch.filter((path12) => typeof path12 === "string") : options2.watch;
2642
2642
  logger3.info(
2643
2643
  "CLI",
2644
- `Watching for changes in ${Array.isArray(watchPaths) ? watchPaths.map((v) => `"${v}"`).join(" | ") : `"${watchPaths}"`}`
2644
+ `Watching for changes in ${Array.isArray(watchPaths) ? watchPaths.map((v2) => `"${v2}"`).join(" | ") : `"${watchPaths}"`}`
2645
2645
  );
2646
2646
  logger3.info(
2647
2647
  "CLI",
2648
- `Ignoring changes in ${ignored.map((v) => `"${v}"`).join(" | ")}`
2648
+ `Ignoring changes in ${ignored.map((v2) => `"${v2}"`).join(" | ")}`
2649
2649
  );
2650
2650
  const watcher = watch(await _tinyglobby.glob.call(void 0, watchPaths), {
2651
2651
  ignoreInitial: true,
2652
2652
  ignorePermissionErrors: true,
2653
- ignored: (p) => _tinyglobby.globSync.call(void 0, p, { ignore: ignored }).length === 0
2653
+ ignored: (p3) => _tinyglobby.globSync.call(void 0, p3, { ignore: ignored }).length === 0
2654
2654
  });
2655
2655
  watcher.on("all", async (type, file) => {
2656
2656
  file = _chunkTWFEYLU4js.slash.call(void 0, file);
@@ -2695,7 +2695,9 @@ module.exports = exports.default;
2695
2695
  // src/index.ts
2696
2696
  var index_exports = {};
2697
2697
  __export(index_exports, {
2698
- build: () => build
2698
+ DEFAULT_BUILD_OPTIONS: () => DEFAULT_BUILD_OPTIONS,
2699
+ build: () => build,
2700
+ resolveOptions: () => resolveOptions
2699
2701
  });
2700
2702
  module.exports = __toCommonJS(index_exports);
2701
2703
  init_cjs_shims();
@@ -2747,8 +2749,8 @@ var DEFAULT_COLOR_CONFIG = {
2747
2749
  init_cjs_shims();
2748
2750
  var import_chalk = __toESM(require("chalk"), 1);
2749
2751
  var chalkDefault = {
2750
- hex: (_) => (message) => message,
2751
- bgHex: (_) => ({
2752
+ hex: (_3) => (message) => message,
2753
+ bgHex: (_3) => ({
2752
2754
  whiteBright: (message) => message,
2753
2755
  white: (message) => message
2754
2756
  }),
@@ -2756,8 +2758,8 @@ var chalkDefault = {
2756
2758
  whiteBright: (message) => message,
2757
2759
  gray: (message) => message,
2758
2760
  bold: {
2759
- hex: (_) => (message) => message,
2760
- bgHex: (_) => ({
2761
+ hex: (_3) => (message) => message,
2762
+ bgHex: (_3) => ({
2761
2763
  whiteBright: (message) => message,
2762
2764
  white: (message) => message
2763
2765
  }),
@@ -2765,7 +2767,7 @@ var chalkDefault = {
2765
2767
  white: (message) => message
2766
2768
  },
2767
2769
  dim: {
2768
- hex: (_) => (message) => message,
2770
+ hex: (_3) => (message) => message,
2769
2771
  gray: (message) => message
2770
2772
  }
2771
2773
  };
@@ -2818,7 +2820,7 @@ var LogLevelLabel = {
2818
2820
  };
2819
2821
 
2820
2822
  // ../config-tools/dist/chunk-LM2UMGYA.js
2821
- var useIcon = (c, fallback) => isUnicodeSupported() ? c : fallback;
2823
+ var useIcon = (c3, fallback) => isUnicodeSupported() ? c3 : fallback;
2822
2824
  var CONSOLE_ICONS = {
2823
2825
  [LogLevelLabel.ERROR]: useIcon("\u2718", "\xD7"),
2824
2826
  [LogLevelLabel.FATAL]: useIcon("\u{1F480}", "\xD7"),
@@ -2860,13 +2862,40 @@ var getLogLevel = (label) => {
2860
2862
  return LogLevel.INFO;
2861
2863
  }
2862
2864
  };
2865
+ var getLogLevelLabel = (logLevel = LogLevel.INFO) => {
2866
+ if (logLevel >= LogLevel.ALL) {
2867
+ return LogLevelLabel.ALL;
2868
+ }
2869
+ if (logLevel >= LogLevel.TRACE) {
2870
+ return LogLevelLabel.TRACE;
2871
+ }
2872
+ if (logLevel >= LogLevel.DEBUG) {
2873
+ return LogLevelLabel.DEBUG;
2874
+ }
2875
+ if (logLevel >= LogLevel.INFO) {
2876
+ return LogLevelLabel.INFO;
2877
+ }
2878
+ if (logLevel >= LogLevel.WARN) {
2879
+ return LogLevelLabel.WARN;
2880
+ }
2881
+ if (logLevel >= LogLevel.ERROR) {
2882
+ return LogLevelLabel.ERROR;
2883
+ }
2884
+ if (logLevel >= LogLevel.FATAL) {
2885
+ return LogLevelLabel.FATAL;
2886
+ }
2887
+ if (logLevel <= LogLevel.SILENT) {
2888
+ return LogLevelLabel.SILENT;
2889
+ }
2890
+ return LogLevelLabel.INFO;
2891
+ };
2863
2892
 
2864
2893
  // ../config-tools/dist/chunk-7L77OWOV.js
2865
2894
  var getLogFn = (logLevel = LogLevel.INFO, config = {}, _chalk = getChalk()) => {
2866
2895
  const colors = !config.colors?.dark && !config.colors?.["base"] && !config.colors?.["base"]?.dark ? DEFAULT_COLOR_CONFIG : config.colors?.dark && typeof config.colors.dark === "string" ? config.colors : config.colors?.["base"]?.dark && typeof config.colors["base"].dark === "string" ? config.colors["base"].dark : config.colors?.["base"] ? config.colors?.["base"] : DEFAULT_COLOR_CONFIG;
2867
2896
  const configLogLevel = config.logLevel || process.env.STORM_LOG_LEVEL || LogLevelLabel.INFO;
2868
2897
  if (logLevel > getLogLevel(configLogLevel) || logLevel <= LogLevel.SILENT || getLogLevel(configLogLevel) <= LogLevel.SILENT) {
2869
- return (_) => {
2898
+ return (_3) => {
2870
2899
  };
2871
2900
  }
2872
2901
  if (typeof logLevel === "number" && LogLevel.FATAL >= logLevel) {
@@ -2940,7 +2969,9 @@ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.brand ?? DEFAULT_COLOR_CON
2940
2969
  );
2941
2970
  };
2942
2971
  };
2972
+ var writeWarning = (message, config) => getLogFn(LogLevel.WARN, config)(message);
2943
2973
  var writeDebug = (message, config) => getLogFn(LogLevel.DEBUG, config)(message);
2974
+ var writeTrace = (message, config) => getLogFn(LogLevel.TRACE, config)(message);
2944
2975
  var getStopwatch = (name) => {
2945
2976
  const start = process.hrtime();
2946
2977
  return () => {
@@ -2955,19 +2986,19 @@ var getStopwatch = (name) => {
2955
2986
  };
2956
2987
  };
2957
2988
  var MAX_DEPTH = 4;
2958
- var formatLogMessage = (message, options2 = {}, depth = 0) => {
2959
- if (depth > MAX_DEPTH) {
2989
+ var formatLogMessage = (message, options2 = {}, depth2 = 0) => {
2990
+ if (depth2 > MAX_DEPTH) {
2960
2991
  return "<max depth>";
2961
2992
  }
2962
2993
  const prefix = options2.prefix ?? "-";
2963
2994
  const skip = options2.skip ?? [];
2964
2995
  return typeof message === "undefined" || message === null || !message && typeof message !== "boolean" ? "<none>" : typeof message === "string" ? message : Array.isArray(message) ? `
2965
- ${message.map((item, index) => ` ${prefix}> #${index} = ${formatLogMessage(item, { prefix: `${prefix}-`, skip }, depth + 1)}`).join("\n")}` : typeof message === "object" ? `
2996
+ ${message.map((item, index) => ` ${prefix}> #${index} = ${formatLogMessage(item, { prefix: `${prefix}-`, skip }, depth2 + 1)}`).join("\n")}` : typeof message === "object" ? `
2966
2997
  ${Object.keys(message).filter((key) => !skip.includes(key)).map(
2967
2998
  (key) => ` ${prefix}> ${key} = ${_isFunction(message[key]) ? "<function>" : typeof message[key] === "object" ? formatLogMessage(
2968
2999
  message[key],
2969
3000
  { prefix: `${prefix}-`, skip },
2970
- depth + 1
3001
+ depth2 + 1
2971
3002
  ) : message[key]}`
2972
3003
  ).join("\n")}` : message;
2973
3004
  };
@@ -2981,6 +3012,2153 @@ var _isFunction = (value) => {
2981
3012
 
2982
3013
  // src/index.ts
2983
3014
  var import_tsup = __toESM(require_dist(), 1);
3015
+
3016
+ // src/constants.ts
3017
+ init_cjs_shims();
3018
+
3019
+ // ../build-tools/dist/index.mjs
3020
+ init_cjs_shims();
3021
+
3022
+ // ../build-tools/dist/chunk-KVP3YMX6.mjs
3023
+ init_cjs_shims();
3024
+
3025
+ // ../build-tools/dist/chunk-7ZALXK5F.mjs
3026
+ init_cjs_shims();
3027
+
3028
+ // ../build-tools/dist/chunk-RPSH5IFV.mjs
3029
+ init_cjs_shims();
3030
+
3031
+ // ../build-tools/dist/chunk-VXUVNB76.mjs
3032
+ init_cjs_shims();
3033
+
3034
+ // ../build-tools/dist/chunk-RPSH5IFV.mjs
3035
+ var import_node_fs = require("fs");
3036
+ var import_node_path = require("path");
3037
+
3038
+ // ../build-tools/dist/chunk-R2HS3O2S.mjs
3039
+ init_cjs_shims();
3040
+ var import_chalk2 = __toESM(require("chalk"), 1);
3041
+ var LogLevelLabel2 = {
3042
+ SILENT: "silent",
3043
+ FATAL: "fatal",
3044
+ ERROR: "error",
3045
+ WARN: "warn",
3046
+ SUCCESS: "success",
3047
+ INFO: "info",
3048
+ DEBUG: "debug",
3049
+ TRACE: "trace",
3050
+ ALL: "all"
3051
+ };
3052
+ function isUnicodeSupported2() {
3053
+ if (process.platform !== "win32") {
3054
+ return process.env.TERM !== "linux";
3055
+ }
3056
+ return Boolean(process.env.WT_SESSION) || // Windows Terminal
3057
+ Boolean(process.env.TERMINUS_SUBLIME) || // Terminus (<0.2.27)
3058
+ process.env.ConEmuTask === "{cmd::Cmder}" || // ConEmu and cmder
3059
+ process.env.TERM_PROGRAM === "Terminus-Sublime" || process.env.TERM_PROGRAM === "vscode" || process.env.TERM === "xterm-256color" || process.env.TERM === "alacritty" || process.env.TERM === "rxvt-unicode" || process.env.TERM === "rxvt-unicode-256color" || process.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
3060
+ }
3061
+ var useIcon2 = (c3, fallback) => isUnicodeSupported2() ? c3 : fallback;
3062
+ var CONSOLE_ICONS2 = {
3063
+ [LogLevelLabel2.ERROR]: useIcon2("\u2718", "\xD7"),
3064
+ [LogLevelLabel2.FATAL]: useIcon2("\u{1F480}", "\xD7"),
3065
+ [LogLevelLabel2.WARN]: useIcon2("\u26A0", "\u203C"),
3066
+ [LogLevelLabel2.INFO]: useIcon2("\u2139", "i"),
3067
+ [LogLevelLabel2.SUCCESS]: useIcon2("\u2714", "\u221A"),
3068
+ [LogLevelLabel2.DEBUG]: useIcon2("\u{1F6E0}", "D"),
3069
+ [LogLevelLabel2.TRACE]: useIcon2("\u{1F6E0}", "T"),
3070
+ [LogLevelLabel2.ALL]: useIcon2("\u2709", "\u2192")
3071
+ };
3072
+
3073
+ // ../build-tools/dist/chunk-7ZALXK5F.mjs
3074
+ var import_c12 = require("c12");
3075
+ var import_defu = __toESM(require("defu"), 1);
3076
+ var z = __toESM(require("zod/mini"), 1);
3077
+ var import_node_fs2 = require("fs");
3078
+ var import_promises = require("fs/promises");
3079
+ var import_node_path2 = require("path");
3080
+ var import_defu2 = __toESM(require("defu"), 1);
3081
+ var import_node_fs3 = require("fs");
3082
+ var import_node_fs4 = require("fs");
3083
+ var import_promises2 = require("fs/promises");
3084
+ var STORM_DEFAULT_CONTACT = "https://stormsoftware.com/contact";
3085
+ var STORM_DEFAULT_SOCIAL_DISCORD = "https://discord.gg/MQ6YVzakM5";
3086
+ var STORM_DEFAULT_SOCIAL_SLACK = "https://join.slack.com/t/storm-software/shared_invite/zt-2gsmk04hs-i6yhK_r6urq0dkZYAwq2pA";
3087
+ var STORM_DEFAULT_RELEASE_FOOTER = `
3088
+ Storm Software is an open source software development organization with the mission is to make software development more accessible. Our ideal future is one where anyone can create software without years of prior development experience serving as a barrier to entry. We hope to achieve this via LLMs, Generative AI, and intuitive, high-level data modeling/programming languages.
3089
+
3090
+ Join us on [Discord](${STORM_DEFAULT_SOCIAL_DISCORD}) to chat with the team, receive release notifications, ask questions, and get involved.
3091
+
3092
+ If this sounds interesting, and you would like to help us in creating the next generation of development tools, please reach out on our [website](${STORM_DEFAULT_CONTACT}) or join our [Slack](${STORM_DEFAULT_SOCIAL_SLACK}) channel!
3093
+ `;
3094
+ var STORM_DEFAULT_ERROR_CODES_FILE = "tools/errors/codes.json";
3095
+ var STORM_DEFAULT_BANNER_ALT = "The workspace's banner image";
3096
+ var schemaRegistry = z.registry();
3097
+ var colorSchema = z.string().check(
3098
+ z.length(7),
3099
+ z.toLowerCase(),
3100
+ z.regex(/^#([0-9a-f]{3}){1,2}$/i),
3101
+ z.trim()
3102
+ );
3103
+ schemaRegistry.add(colorSchema, {
3104
+ description: "A base schema for describing the format of colors"
3105
+ });
3106
+ var darkColorSchema = z._default(colorSchema, "#151718");
3107
+ schemaRegistry.add(darkColorSchema, {
3108
+ description: "The dark background color of the workspace"
3109
+ });
3110
+ var lightColorSchema = z._default(colorSchema, "#cbd5e1");
3111
+ schemaRegistry.add(lightColorSchema, {
3112
+ description: "The light background color of the workspace"
3113
+ });
3114
+ var brandColorSchema = z._default(colorSchema, "#1fb2a6");
3115
+ schemaRegistry.add(brandColorSchema, {
3116
+ description: "The primary brand specific color of the workspace"
3117
+ });
3118
+ var alternateColorSchema = z.optional(colorSchema);
3119
+ schemaRegistry.add(alternateColorSchema, {
3120
+ description: "The alternate brand specific color of the workspace"
3121
+ });
3122
+ var accentColorSchema = z.optional(colorSchema);
3123
+ schemaRegistry.add(accentColorSchema, {
3124
+ description: "The secondary brand specific color of the workspace"
3125
+ });
3126
+ var linkColorSchema = z._default(colorSchema, "#3fa6ff");
3127
+ schemaRegistry.add(linkColorSchema, {
3128
+ description: "The color used to display hyperlink text"
3129
+ });
3130
+ var helpColorSchema = z._default(colorSchema, "#818cf8");
3131
+ schemaRegistry.add(helpColorSchema, {
3132
+ description: "The second brand specific color of the workspace"
3133
+ });
3134
+ var successColorSchema = z._default(colorSchema, "#45b27e");
3135
+ schemaRegistry.add(successColorSchema, {
3136
+ description: "The success color of the workspace"
3137
+ });
3138
+ var infoColorSchema = z._default(colorSchema, "#38bdf8");
3139
+ schemaRegistry.add(infoColorSchema, {
3140
+ description: "The informational color of the workspace"
3141
+ });
3142
+ var warningColorSchema = z._default(colorSchema, "#f3d371");
3143
+ schemaRegistry.add(warningColorSchema, {
3144
+ description: "The warning color of the workspace"
3145
+ });
3146
+ var dangerColorSchema = z._default(colorSchema, "#d8314a");
3147
+ schemaRegistry.add(dangerColorSchema, {
3148
+ description: "The danger color of the workspace"
3149
+ });
3150
+ var fatalColorSchema = z.optional(colorSchema);
3151
+ schemaRegistry.add(fatalColorSchema, {
3152
+ description: "The fatal color of the workspace"
3153
+ });
3154
+ var positiveColorSchema = z._default(colorSchema, "#4ade80");
3155
+ schemaRegistry.add(positiveColorSchema, {
3156
+ description: "The positive number color of the workspace"
3157
+ });
3158
+ var negativeColorSchema = z._default(colorSchema, "#ef4444");
3159
+ schemaRegistry.add(negativeColorSchema, {
3160
+ description: "The negative number color of the workspace"
3161
+ });
3162
+ var gradientStopsSchema = z.optional(z.array(colorSchema));
3163
+ schemaRegistry.add(gradientStopsSchema, {
3164
+ description: "The color stops for the base gradient color pattern used in the workspace"
3165
+ });
3166
+ var darkColorsSchema = z.object({
3167
+ foreground: lightColorSchema,
3168
+ background: darkColorSchema,
3169
+ brand: brandColorSchema,
3170
+ alternate: alternateColorSchema,
3171
+ accent: accentColorSchema,
3172
+ link: linkColorSchema,
3173
+ help: helpColorSchema,
3174
+ success: successColorSchema,
3175
+ info: infoColorSchema,
3176
+ warning: warningColorSchema,
3177
+ danger: dangerColorSchema,
3178
+ fatal: fatalColorSchema,
3179
+ positive: positiveColorSchema,
3180
+ negative: negativeColorSchema,
3181
+ gradient: gradientStopsSchema
3182
+ });
3183
+ var lightColorsSchema = z.object({
3184
+ foreground: darkColorSchema,
3185
+ background: lightColorSchema,
3186
+ brand: brandColorSchema,
3187
+ alternate: alternateColorSchema,
3188
+ accent: accentColorSchema,
3189
+ link: linkColorSchema,
3190
+ help: helpColorSchema,
3191
+ success: successColorSchema,
3192
+ info: infoColorSchema,
3193
+ warning: warningColorSchema,
3194
+ danger: dangerColorSchema,
3195
+ fatal: fatalColorSchema,
3196
+ positive: positiveColorSchema,
3197
+ negative: negativeColorSchema,
3198
+ gradient: gradientStopsSchema
3199
+ });
3200
+ var multiColorsSchema = z.object({
3201
+ dark: darkColorsSchema,
3202
+ light: lightColorsSchema
3203
+ });
3204
+ var singleColorsSchema = z.object({
3205
+ dark: darkColorSchema,
3206
+ light: lightColorSchema,
3207
+ brand: brandColorSchema,
3208
+ alternate: alternateColorSchema,
3209
+ accent: accentColorSchema,
3210
+ link: linkColorSchema,
3211
+ help: helpColorSchema,
3212
+ success: successColorSchema,
3213
+ info: infoColorSchema,
3214
+ warning: warningColorSchema,
3215
+ danger: dangerColorSchema,
3216
+ fatal: fatalColorSchema,
3217
+ positive: positiveColorSchema,
3218
+ negative: negativeColorSchema,
3219
+ gradient: gradientStopsSchema
3220
+ });
3221
+ var registryUrlConfigSchema = z.optional(z.url());
3222
+ schemaRegistry.add(registryUrlConfigSchema, {
3223
+ description: "A remote registry URL used to publish distributable packages"
3224
+ });
3225
+ var registrySchema = z._default(
3226
+ z.object({
3227
+ github: registryUrlConfigSchema,
3228
+ npm: registryUrlConfigSchema,
3229
+ cargo: registryUrlConfigSchema,
3230
+ cyclone: registryUrlConfigSchema,
3231
+ container: registryUrlConfigSchema
3232
+ }),
3233
+ {}
3234
+ );
3235
+ schemaRegistry.add(registrySchema, {
3236
+ description: "A list of remote registry URLs used by Storm Software"
3237
+ });
3238
+ var colorsSchema = z.union([singleColorsSchema, multiColorsSchema]);
3239
+ schemaRegistry.add(colorsSchema, {
3240
+ description: "Colors used for various workspace elements"
3241
+ });
3242
+ var themeColorsSchema = z.record(
3243
+ z.union([z.union([z.literal("base"), z.string()]), z.string()]),
3244
+ colorsSchema
3245
+ );
3246
+ schemaRegistry.add(themeColorsSchema, {
3247
+ description: "Storm theme config values used for styling various package elements"
3248
+ });
3249
+ var extendsSchema = z.optional(
3250
+ z.union([z.string().check(z.trim()), z.array(z.string().check(z.trim()))])
3251
+ );
3252
+ schemaRegistry.add(extendsSchema, {
3253
+ description: "The path to a base config file to use as a configuration preset file. Documentation can be found at https://github.com/unjs/c12#extending-configuration."
3254
+ });
3255
+ var workspaceBotNameSchema = z.string().check(z.trim());
3256
+ schemaRegistry.add(workspaceBotNameSchema, {
3257
+ description: "The workspace bot user's name (this is the bot that will be used to perform various tasks)"
3258
+ });
3259
+ var workspaceBotEmailSchema = z.string().check(z.trim());
3260
+ schemaRegistry.add(workspaceBotEmailSchema, {
3261
+ description: "The email of the workspace bot"
3262
+ });
3263
+ var workspaceBotSchema = z.object({
3264
+ name: workspaceBotNameSchema,
3265
+ email: workspaceBotEmailSchema
3266
+ });
3267
+ schemaRegistry.add(workspaceBotSchema, {
3268
+ description: "The workspace's bot user's config used to automated various operations tasks"
3269
+ });
3270
+ var workspaceReleaseBannerUrlSchema = z.optional(
3271
+ z.string().check(z.trim(), z.url())
3272
+ );
3273
+ schemaRegistry.add(workspaceReleaseBannerUrlSchema, {
3274
+ description: "A URL to a banner image used to display the workspace's release"
3275
+ });
3276
+ var workspaceReleaseBannerAltSchema = z._default(
3277
+ z.string().check(z.trim()),
3278
+ STORM_DEFAULT_BANNER_ALT
3279
+ );
3280
+ schemaRegistry.add(workspaceReleaseBannerAltSchema, {
3281
+ description: "The alt text for the workspace's release banner image"
3282
+ });
3283
+ var workspaceReleaseBannerSchema = z.object({
3284
+ url: workspaceReleaseBannerUrlSchema,
3285
+ alt: workspaceReleaseBannerAltSchema
3286
+ });
3287
+ schemaRegistry.add(workspaceReleaseBannerSchema, {
3288
+ description: "The workspace's banner image used during the release process"
3289
+ });
3290
+ var workspaceReleaseHeaderSchema = z.optional(
3291
+ z.string().check(z.trim())
3292
+ );
3293
+ schemaRegistry.add(workspaceReleaseHeaderSchema, {
3294
+ description: "A header message appended to the start of the workspace's release notes"
3295
+ });
3296
+ var workspaceReleaseFooterSchema = z.optional(
3297
+ z.string().check(z.trim())
3298
+ );
3299
+ schemaRegistry.add(workspaceReleaseFooterSchema, {
3300
+ description: "A footer message appended to the end of the workspace's release notes"
3301
+ });
3302
+ var workspaceReleaseSchema = z.object({
3303
+ banner: z.union([
3304
+ workspaceReleaseBannerSchema,
3305
+ z.string().check(z.trim(), z.url())
3306
+ ]),
3307
+ header: workspaceReleaseHeaderSchema,
3308
+ footer: workspaceReleaseFooterSchema
3309
+ });
3310
+ schemaRegistry.add(workspaceReleaseSchema, {
3311
+ description: "The workspace's release config used during the release process"
3312
+ });
3313
+ var workspaceSocialsTwitterSchema = z.optional(
3314
+ z.string().check(z.trim())
3315
+ );
3316
+ schemaRegistry.add(workspaceSocialsTwitterSchema, {
3317
+ description: "A Twitter/X account associated with the organization/project"
3318
+ });
3319
+ var workspaceSocialsDiscordSchema = z.optional(
3320
+ z.string().check(z.trim())
3321
+ );
3322
+ schemaRegistry.add(workspaceSocialsDiscordSchema, {
3323
+ description: "A Discord account associated with the organization/project"
3324
+ });
3325
+ var workspaceSocialsTelegramSchema = z.optional(
3326
+ z.string().check(z.trim())
3327
+ );
3328
+ schemaRegistry.add(workspaceSocialsTelegramSchema, {
3329
+ description: "A Telegram account associated with the organization/project"
3330
+ });
3331
+ var workspaceSocialsSlackSchema = z.optional(
3332
+ z.string().check(z.trim())
3333
+ );
3334
+ schemaRegistry.add(workspaceSocialsSlackSchema, {
3335
+ description: "A Slack account associated with the organization/project"
3336
+ });
3337
+ var workspaceSocialsMediumSchema = z.optional(
3338
+ z.string().check(z.trim())
3339
+ );
3340
+ schemaRegistry.add(workspaceSocialsMediumSchema, {
3341
+ description: "A Medium account associated with the organization/project"
3342
+ });
3343
+ var workspaceSocialsGithubSchema = z.optional(
3344
+ z.string().check(z.trim())
3345
+ );
3346
+ schemaRegistry.add(workspaceSocialsGithubSchema, {
3347
+ description: "A GitHub account associated with the organization/project"
3348
+ });
3349
+ var workspaceSocialsSchema = z.object({
3350
+ twitter: workspaceSocialsTwitterSchema,
3351
+ discord: workspaceSocialsDiscordSchema,
3352
+ telegram: workspaceSocialsTelegramSchema,
3353
+ slack: workspaceSocialsSlackSchema,
3354
+ medium: workspaceSocialsMediumSchema,
3355
+ github: workspaceSocialsGithubSchema
3356
+ });
3357
+ schemaRegistry.add(workspaceSocialsSchema, {
3358
+ description: "The workspace's account config used to store various social media links"
3359
+ });
3360
+ var workspaceDirectoryCacheSchema = z.optional(
3361
+ z.string().check(z.trim())
3362
+ );
3363
+ schemaRegistry.add(workspaceDirectoryCacheSchema, {
3364
+ description: "The directory used to store the environment's cached file data"
3365
+ });
3366
+ var workspaceDirectoryDataSchema = z.optional(
3367
+ z.string().check(z.trim())
3368
+ );
3369
+ schemaRegistry.add(workspaceDirectoryDataSchema, {
3370
+ description: "The directory used to store the environment's data files"
3371
+ });
3372
+ var workspaceDirectoryConfigSchema = z.optional(
3373
+ z.string().check(z.trim())
3374
+ );
3375
+ schemaRegistry.add(workspaceDirectoryConfigSchema, {
3376
+ description: "The directory used to store the environment's configuration files"
3377
+ });
3378
+ var workspaceDirectoryTempSchema = z.optional(
3379
+ z.string().check(z.trim())
3380
+ );
3381
+ schemaRegistry.add(workspaceDirectoryTempSchema, {
3382
+ description: "The directory used to store the environment's temp files"
3383
+ });
3384
+ var workspaceDirectoryLogSchema = z.optional(
3385
+ z.string().check(z.trim())
3386
+ );
3387
+ schemaRegistry.add(workspaceDirectoryLogSchema, {
3388
+ description: "The directory used to store the environment's log files"
3389
+ });
3390
+ var workspaceDirectoryBuildSchema = z._default(
3391
+ z.string().check(z.trim()),
3392
+ "dist"
3393
+ );
3394
+ schemaRegistry.add(workspaceDirectoryBuildSchema, {
3395
+ description: "The directory used to store the workspace's distributable files after a build (relative to the workspace root)"
3396
+ });
3397
+ var workspaceDirectorySchema = z.object({
3398
+ cache: workspaceDirectoryCacheSchema,
3399
+ data: workspaceDirectoryDataSchema,
3400
+ config: workspaceDirectoryConfigSchema,
3401
+ temp: workspaceDirectoryTempSchema,
3402
+ log: workspaceDirectoryLogSchema,
3403
+ build: workspaceDirectoryBuildSchema
3404
+ });
3405
+ schemaRegistry.add(workspaceDirectorySchema, {
3406
+ description: "Various directories used by the workspace to store data, cache, and configuration files"
3407
+ });
3408
+ var variantSchema = z._default(
3409
+ z.enum(["minimal", "monorepo"]),
3410
+ "monorepo"
3411
+ );
3412
+ schemaRegistry.add(variantSchema, {
3413
+ description: "The variant of the workspace. This can be used to enable or disable certain features or configurations."
3414
+ });
3415
+ var errorCodesFileSchema = z._default(
3416
+ z.string().check(z.trim()),
3417
+ STORM_DEFAULT_ERROR_CODES_FILE
3418
+ );
3419
+ schemaRegistry.add(errorCodesFileSchema, {
3420
+ description: "The path to the workspace's error codes JSON file"
3421
+ });
3422
+ var errorUrlSchema = z.optional(z.url());
3423
+ schemaRegistry.add(errorUrlSchema, {
3424
+ description: "A URL to a page that looks up the workspace's error messages given a specific error code"
3425
+ });
3426
+ var errorSchema = z.object({
3427
+ codesFile: errorCodesFileSchema,
3428
+ url: errorUrlSchema
3429
+ });
3430
+ schemaRegistry.add(errorSchema, {
3431
+ description: "The workspace's error config used when creating error details during a system error"
3432
+ });
3433
+ var organizationNameSchema = z.optional(
3434
+ z.string().check(z.trim(), z.toLowerCase())
3435
+ );
3436
+ schemaRegistry.add(organizationNameSchema, {
3437
+ description: "The name of the organization"
3438
+ });
3439
+ var organizationDescriptionSchema = z.optional(
3440
+ z.string().check(z.trim())
3441
+ );
3442
+ schemaRegistry.add(organizationDescriptionSchema, {
3443
+ description: "A description of the organization"
3444
+ });
3445
+ var organizationLogoSchema = z.optional(z.url());
3446
+ schemaRegistry.add(organizationLogoSchema, {
3447
+ description: "A URL to the organization's logo image"
3448
+ });
3449
+ var organizationIconSchema = z.optional(z.url());
3450
+ schemaRegistry.add(organizationIconSchema, {
3451
+ description: "A URL to the organization's icon image"
3452
+ });
3453
+ var organizationUrlSchema = z.optional(z.url());
3454
+ schemaRegistry.add(organizationUrlSchema, {
3455
+ description: "A URL to a page that provides more information about the organization"
3456
+ });
3457
+ var organizationSchema = z.object({
3458
+ name: organizationNameSchema,
3459
+ description: organizationDescriptionSchema,
3460
+ logo: organizationLogoSchema,
3461
+ icon: organizationIconSchema,
3462
+ url: organizationUrlSchema
3463
+ });
3464
+ schemaRegistry.add(organizationSchema, {
3465
+ description: "The workspace's organization details"
3466
+ });
3467
+ var schemaNameSchema = z._default(
3468
+ z.string().check(z.trim(), z.toLowerCase()),
3469
+ "https://public.storm-cdn.com/schemas/storm-workspace.schema.json"
3470
+ );
3471
+ schemaRegistry.add(schemaNameSchema, {
3472
+ description: "The URL or file path to the JSON schema file that describes the Storm configuration file"
3473
+ });
3474
+ var nameSchema = z.string().check(z.trim(), z.toLowerCase());
3475
+ schemaRegistry.add(nameSchema, {
3476
+ description: "The name of the workspace/project/service/package/scope using this configuration"
3477
+ });
3478
+ var namespaceSchema = z.string().check(z.trim(), z.toLowerCase());
3479
+ schemaRegistry.add(namespaceSchema, {
3480
+ description: "The namespace of the workspace/project/service/package/scope using this configuration"
3481
+ });
3482
+ var orgSchema = z.union([
3483
+ organizationSchema,
3484
+ z.string().check(z.trim(), z.toLowerCase())
3485
+ ]);
3486
+ schemaRegistry.add(orgSchema, {
3487
+ description: "The organization of the workspace. This can be a string or an object containing the organization's details"
3488
+ });
3489
+ var repositorySchema = z.string().check(z.trim(), z.toLowerCase());
3490
+ schemaRegistry.add(repositorySchema, {
3491
+ description: "The repo URL of the workspace (i.e. the GitHub repository URL)"
3492
+ });
3493
+ var licenseSchema = z._default(
3494
+ z.string().check(z.trim()),
3495
+ "Apache-2.0"
3496
+ );
3497
+ schemaRegistry.add(licenseSchema, {
3498
+ description: "The license type of the package"
3499
+ });
3500
+ var homepageSchema = z.optional(z.url());
3501
+ schemaRegistry.add(homepageSchema, {
3502
+ description: "The homepage of the workspace"
3503
+ });
3504
+ var docsSchema = z.optional(z.url());
3505
+ schemaRegistry.add(docsSchema, {
3506
+ description: "The documentation site for the workspace"
3507
+ });
3508
+ var portalSchema = z.optional(z.url());
3509
+ schemaRegistry.add(portalSchema, {
3510
+ description: "The development portal site for the workspace"
3511
+ });
3512
+ var licensingSchema = z.optional(z.url());
3513
+ schemaRegistry.add(licensingSchema, {
3514
+ description: "The licensing site for the workspace"
3515
+ });
3516
+ var contactSchema = z.optional(z.url());
3517
+ schemaRegistry.add(contactSchema, {
3518
+ description: "The contact site for the workspace"
3519
+ });
3520
+ var supportSchema = z.optional(z.url());
3521
+ schemaRegistry.add(supportSchema, {
3522
+ description: "The support site for the workspace. If not provided, this is defaulted to the `contact` config value"
3523
+ });
3524
+ var branchSchema = z._default(
3525
+ z.string().check(z.trim(), z.toLowerCase()),
3526
+ "main"
3527
+ );
3528
+ schemaRegistry.add(branchSchema, {
3529
+ description: "The branch of the workspace"
3530
+ });
3531
+ var preidSchema = z.optional(
3532
+ z.string().check(z.trim(), z.toLowerCase())
3533
+ );
3534
+ schemaRegistry.add(preidSchema, {
3535
+ description: "A tag specifying the version pre-release identifier"
3536
+ });
3537
+ var ownerSchema = z.optional(
3538
+ z.string().check(z.trim(), z.toLowerCase())
3539
+ );
3540
+ schemaRegistry.add(ownerSchema, {
3541
+ description: "The owner of the package"
3542
+ });
3543
+ var modeSchema = z._default(
3544
+ z.enum(["development", "test", "production"]).check(z.trim(), z.toLowerCase()),
3545
+ "production"
3546
+ );
3547
+ schemaRegistry.add(modeSchema, {
3548
+ description: "The current runtime environment mode for the package"
3549
+ });
3550
+ var workspaceRootSchema = z.string().check(z.trim(), z.toLowerCase());
3551
+ schemaRegistry.add(workspaceRootSchema, {
3552
+ description: "The root directory of the workspace"
3553
+ });
3554
+ var skipCacheSchema = z._default(z.boolean(), false);
3555
+ schemaRegistry.add(skipCacheSchema, {
3556
+ description: "Should all known types of workspace caching be skipped?"
3557
+ });
3558
+ var packageManagerSchema = z._default(
3559
+ z.enum(["npm", "yarn", "pnpm", "bun"]),
3560
+ "npm"
3561
+ );
3562
+ schemaRegistry.add(packageManagerSchema, {
3563
+ description: "The JavaScript/TypeScript package manager used by the repository"
3564
+ });
3565
+ var timezoneSchema = z._default(
3566
+ z.string().check(z.trim()),
3567
+ "America/New_York"
3568
+ );
3569
+ schemaRegistry.add(timezoneSchema, {
3570
+ description: "The default timezone of the workspace"
3571
+ });
3572
+ var localeSchema = z._default(z.string().check(z.trim()), "en-US");
3573
+ schemaRegistry.add(localeSchema, {
3574
+ description: "The default locale of the workspace"
3575
+ });
3576
+ var logLevelSchema = z._default(
3577
+ z.enum([
3578
+ "silent",
3579
+ "fatal",
3580
+ "error",
3581
+ "warn",
3582
+ "success",
3583
+ "info",
3584
+ "debug",
3585
+ "trace",
3586
+ "all"
3587
+ ]),
3588
+ "info"
3589
+ );
3590
+ schemaRegistry.add(logLevelSchema, {
3591
+ description: "The log level used to filter out lower priority log messages. If not provided, this is defaulted using the `environment` config value (if `environment` is set to `production` then `level` is `error`, else `level` is `debug`)."
3592
+ });
3593
+ var skipConfigLoggingSchema = z._default(z.boolean(), true);
3594
+ schemaRegistry.add(skipConfigLoggingSchema, {
3595
+ description: "Should the logging of the current Storm Workspace configuration be skipped?"
3596
+ });
3597
+ var configFileSchema = z._default(
3598
+ z.nullable(z.string().check(z.trim())),
3599
+ null
3600
+ );
3601
+ schemaRegistry.add(configFileSchema, {
3602
+ description: "The filepath of the Storm config. When this field is null, no config file was found in the current workspace."
3603
+ });
3604
+ var extensionsSchema = z._default(z.record(z.string(), z.any()), {});
3605
+ schemaRegistry.add(extensionsSchema, {
3606
+ description: "Configuration of each used extension"
3607
+ });
3608
+ var workspaceConfigSchema = z.object({
3609
+ $schema: schemaNameSchema,
3610
+ extends: extendsSchema,
3611
+ name: nameSchema,
3612
+ variant: variantSchema,
3613
+ namespace: namespaceSchema,
3614
+ organization: orgSchema,
3615
+ repository: repositorySchema,
3616
+ license: licenseSchema,
3617
+ homepage: homepageSchema,
3618
+ docs: docsSchema,
3619
+ portal: portalSchema,
3620
+ licensing: licensingSchema,
3621
+ contact: contactSchema,
3622
+ support: supportSchema,
3623
+ branch: branchSchema,
3624
+ preid: preidSchema,
3625
+ owner: ownerSchema,
3626
+ bot: workspaceBotSchema,
3627
+ release: workspaceReleaseSchema,
3628
+ socials: workspaceSocialsSchema,
3629
+ error: errorSchema,
3630
+ mode: modeSchema,
3631
+ workspaceRoot: workspaceRootSchema,
3632
+ skipCache: skipCacheSchema,
3633
+ directories: workspaceDirectorySchema,
3634
+ packageManager: packageManagerSchema,
3635
+ timezone: timezoneSchema,
3636
+ locale: localeSchema,
3637
+ logLevel: logLevelSchema,
3638
+ skipConfigLogging: skipConfigLoggingSchema,
3639
+ registry: registrySchema,
3640
+ configFile: configFileSchema,
3641
+ colors: z.union([colorsSchema, themeColorsSchema]),
3642
+ extensions: extensionsSchema
3643
+ });
3644
+ schemaRegistry.add(extensionsSchema, {
3645
+ description: "Storm Workspace config values used during various dev-ops processes. This type is a combination of the StormPackageConfig and StormProject types. It represents the config of the entire monorepo."
3646
+ });
3647
+
3648
+ // ../build-tools/dist/chunk-JCFRYUYP.mjs
3649
+ init_cjs_shims();
3650
+ var import_create_task_graph = require("nx/src/tasks-runner/create-task-graph");
3651
+
3652
+ // ../build-tools/dist/chunk-7QY5Q44S.mjs
3653
+ init_cjs_shims();
3654
+ var import_copy_assets_handler = require("@nx/js/src/utils/assets/copy-assets-handler");
3655
+ var import_glob = require("glob");
3656
+ var import_promises3 = require("fs/promises");
3657
+
3658
+ // ../build-tools/dist/chunk-3UHONU2J.mjs
3659
+ init_cjs_shims();
3660
+ var import_buildable_libs_utils = require("@nx/js/src/utils/buildable-libs-utils");
3661
+ var import_glob2 = require("glob");
3662
+ var import_node_fs5 = require("fs");
3663
+ var import_promises4 = require("fs/promises");
3664
+ var import_project_graph = require("nx/src/project-graph/project-graph");
3665
+
3666
+ // ../build-tools/dist/chunk-UQSQD3UC.mjs
3667
+ init_cjs_shims();
3668
+ var import_glob3 = require("glob");
3669
+
3670
+ // ../build-tools/dist/chunk-HGTDDXA5.mjs
3671
+ init_cjs_shims();
3672
+
3673
+ // ../build-tools/dist/chunk-BEMVEXMQ.mjs
3674
+ init_cjs_shims();
3675
+ var DEFAULT_COMPILED_BANNER = `/*****************************************
3676
+ *
3677
+ * \u26A1 Built by Storm Software
3678
+ *
3679
+ *****************************************/
3680
+ `;
3681
+ var DEFAULT_ENVIRONMENT = "production";
3682
+ var DEFAULT_ORGANIZATION = "storm-software";
3683
+
3684
+ // ../build-tools/dist/chunk-HGTDDXA5.mjs
3685
+ var getEnv = (builder, options2) => {
3686
+ return {
3687
+ STORM_BUILD: builder,
3688
+ STORM_ORG: options2.orgName || DEFAULT_ORGANIZATION,
3689
+ STORM_NAME: options2.name,
3690
+ STORM_MODE: options2.mode || DEFAULT_ENVIRONMENT,
3691
+ STORM_PLATFORM: options2.platform,
3692
+ STORM_FORMAT: JSON.stringify(options2.format),
3693
+ STORM_TARGET: JSON.stringify(options2.target),
3694
+ ...options2.env
3695
+ };
3696
+ };
3697
+
3698
+ // ../build-tools/dist/chunk-KUEYIH7W.mjs
3699
+ init_cjs_shims();
3700
+
3701
+ // ../build-tools/dist/chunk-3VZVP5XV.mjs
3702
+ init_cjs_shims();
3703
+
3704
+ // ../build-tools/dist/chunk-ODQKLK6L.mjs
3705
+ init_cjs_shims();
3706
+
3707
+ // ../build-tools/dist/chunk-WBQAMGXK.mjs
3708
+ init_cjs_shims();
3709
+
3710
+ // ../build-tools/dist/chunk-UN3B7LBV.mjs
3711
+ init_cjs_shims();
3712
+
3713
+ // ../build-tools/dist/chunk-HDSL2EC4.mjs
3714
+ init_cjs_shims();
3715
+
3716
+ // ../build-tools/dist/chunk-7YKXR5JJ.mjs
3717
+ init_cjs_shims();
3718
+ var import_core = require("@swc/core");
3719
+
3720
+ // ../build-tools/dist/chunk-LKETNGJ2.mjs
3721
+ init_cjs_shims();
3722
+ var import_node_fs6 = __toESM(require("fs"), 1);
3723
+ var import_node_module = require("module");
3724
+ var import_node_path3 = __toESM(require("path"), 1);
3725
+ var import_resolve = __toESM(require("resolve"), 1);
3726
+
3727
+ // ../build-tools/dist/chunk-VGLIZ2H3.mjs
3728
+ init_cjs_shims();
3729
+ var import_devkit = require("@nx/devkit");
3730
+ var import_path = require("path");
3731
+
3732
+ // src/constants.ts
3733
+ var DEFAULT_BUILD_OPTIONS = {
3734
+ platform: "node",
3735
+ target: "node22",
3736
+ format: "esm",
3737
+ dts: true,
3738
+ keepNames: true,
3739
+ metafile: false,
3740
+ treeshake: true,
3741
+ splitting: true,
3742
+ shims: false,
3743
+ watch: false,
3744
+ bundle: true,
3745
+ clean: true,
3746
+ loader: {
3747
+ ".aac": "file",
3748
+ ".css": "file",
3749
+ ".eot": "file",
3750
+ ".flac": "file",
3751
+ ".gif": "file",
3752
+ ".jpeg": "file",
3753
+ ".jpg": "file",
3754
+ ".mp3": "file",
3755
+ ".mp4": "file",
3756
+ ".ogg": "file",
3757
+ ".otf": "file",
3758
+ ".png": "file",
3759
+ ".svg": "file",
3760
+ ".ttf": "file",
3761
+ ".wav": "file",
3762
+ ".webm": "file",
3763
+ ".webp": "file",
3764
+ ".woff": "file",
3765
+ ".woff2": "file"
3766
+ },
3767
+ banner: {
3768
+ js: DEFAULT_COMPILED_BANNER,
3769
+ css: DEFAULT_COMPILED_BANNER
3770
+ }
3771
+ };
3772
+
3773
+ // src/options.ts
3774
+ init_cjs_shims();
3775
+ var import_devkit2 = require("@nx/devkit");
3776
+
3777
+ // ../config-tools/dist/get-config.js
3778
+ init_cjs_shims();
3779
+
3780
+ // ../config-tools/dist/chunk-WOLTMI7X.js
3781
+ init_cjs_shims();
3782
+
3783
+ // ../config-tools/dist/chunk-R7MTORRG.js
3784
+ init_cjs_shims();
3785
+
3786
+ // ../config-tools/dist/chunk-RZM3NYPM.js
3787
+ init_cjs_shims();
3788
+
3789
+ // ../config-tools/dist/chunk-4A2P7H63.js
3790
+ init_cjs_shims();
3791
+
3792
+ // ../config-tools/dist/chunk-6JBGUE4A.js
3793
+ init_cjs_shims();
3794
+ var import_node_fs7 = require("fs");
3795
+ var import_node_path4 = require("path");
3796
+ var MAX_PATH_SEARCH_DEPTH = 30;
3797
+ var depth = 0;
3798
+ function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
3799
+ const _startPath = startPath ?? process.cwd();
3800
+ if (endDirectoryNames.some(
3801
+ (endDirName) => (0, import_node_fs7.existsSync)((0, import_node_path4.join)(_startPath, endDirName))
3802
+ )) {
3803
+ return _startPath;
3804
+ }
3805
+ if (endFileNames.some(
3806
+ (endFileName) => (0, import_node_fs7.existsSync)((0, import_node_path4.join)(_startPath, endFileName))
3807
+ )) {
3808
+ return _startPath;
3809
+ }
3810
+ if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
3811
+ const parent = (0, import_node_path4.join)(_startPath, "..");
3812
+ return findFolderUp(parent, endFileNames, endDirectoryNames);
3813
+ }
3814
+ return void 0;
3815
+ }
3816
+
3817
+ // ../config-tools/dist/chunk-V3GMJ4TX.js
3818
+ init_cjs_shims();
3819
+ var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
3820
+ function normalizeWindowsPath(input = "") {
3821
+ if (!input) {
3822
+ return input;
3823
+ }
3824
+ return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r3) => r3.toUpperCase());
3825
+ }
3826
+ var _UNC_REGEX = /^[/\\]{2}/;
3827
+ var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
3828
+ var _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
3829
+ var correctPaths2 = function(path2) {
3830
+ if (!path2 || path2.length === 0) {
3831
+ return ".";
3832
+ }
3833
+ path2 = normalizeWindowsPath(path2);
3834
+ const isUNCPath = path2?.match(_UNC_REGEX);
3835
+ const isPathAbsolute = isAbsolute(path2);
3836
+ const trailingSeparator = path2[path2.length - 1] === "/";
3837
+ path2 = normalizeString(path2, !isPathAbsolute);
3838
+ if (path2.length === 0) {
3839
+ if (isPathAbsolute) {
3840
+ return "/";
3841
+ }
3842
+ return trailingSeparator ? "./" : ".";
3843
+ }
3844
+ if (trailingSeparator) {
3845
+ path2 += "/";
3846
+ }
3847
+ if (_DRIVE_LETTER_RE.test(path2)) {
3848
+ path2 += "/";
3849
+ }
3850
+ if (isUNCPath) {
3851
+ if (!isPathAbsolute) {
3852
+ return `//./${path2}`;
3853
+ }
3854
+ return `//${path2}`;
3855
+ }
3856
+ return isPathAbsolute && !isAbsolute(path2) ? `/${path2}` : path2;
3857
+ };
3858
+ var joinPaths2 = function(...segments) {
3859
+ let path2 = "";
3860
+ for (const seg of segments) {
3861
+ if (!seg) {
3862
+ continue;
3863
+ }
3864
+ if (path2.length > 0) {
3865
+ const pathTrailing = path2[path2.length - 1] === "/";
3866
+ const segLeading = seg[0] === "/";
3867
+ const both = pathTrailing && segLeading;
3868
+ if (both) {
3869
+ path2 += seg.slice(1);
3870
+ } else {
3871
+ path2 += pathTrailing || segLeading ? seg : `/${seg}`;
3872
+ }
3873
+ } else {
3874
+ path2 += seg;
3875
+ }
3876
+ }
3877
+ return correctPaths2(path2);
3878
+ };
3879
+ function normalizeString(path2, allowAboveRoot) {
3880
+ let res = "";
3881
+ let lastSegmentLength = 0;
3882
+ let lastSlash = -1;
3883
+ let dots = 0;
3884
+ let char = null;
3885
+ for (let index = 0; index <= path2.length; ++index) {
3886
+ if (index < path2.length) {
3887
+ char = path2[index];
3888
+ } else if (char === "/") {
3889
+ break;
3890
+ } else {
3891
+ char = "/";
3892
+ }
3893
+ if (char === "/") {
3894
+ if (lastSlash === index - 1 || dots === 1) {
3895
+ } else if (dots === 2) {
3896
+ if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
3897
+ if (res.length > 2) {
3898
+ const lastSlashIndex = res.lastIndexOf("/");
3899
+ if (lastSlashIndex === -1) {
3900
+ res = "";
3901
+ lastSegmentLength = 0;
3902
+ } else {
3903
+ res = res.slice(0, lastSlashIndex);
3904
+ lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
3905
+ }
3906
+ lastSlash = index;
3907
+ dots = 0;
3908
+ continue;
3909
+ } else if (res.length > 0) {
3910
+ res = "";
3911
+ lastSegmentLength = 0;
3912
+ lastSlash = index;
3913
+ dots = 0;
3914
+ continue;
3915
+ }
3916
+ }
3917
+ if (allowAboveRoot) {
3918
+ res += res.length > 0 ? "/.." : "..";
3919
+ lastSegmentLength = 2;
3920
+ }
3921
+ } else {
3922
+ if (res.length > 0) {
3923
+ res += `/${path2.slice(lastSlash + 1, index)}`;
3924
+ } else {
3925
+ res = path2.slice(lastSlash + 1, index);
3926
+ }
3927
+ lastSegmentLength = index - lastSlash - 1;
3928
+ }
3929
+ lastSlash = index;
3930
+ dots = 0;
3931
+ } else if (char === "." && dots !== -1) {
3932
+ ++dots;
3933
+ } else {
3934
+ dots = -1;
3935
+ }
3936
+ }
3937
+ return res;
3938
+ }
3939
+ var isAbsolute = function(p3) {
3940
+ return _IS_ABSOLUTE_RE.test(p3);
3941
+ };
3942
+
3943
+ // ../config-tools/dist/chunk-4A2P7H63.js
3944
+ var rootFiles = [
3945
+ "storm-workspace.json",
3946
+ "storm-workspace.yaml",
3947
+ "storm-workspace.yml",
3948
+ "storm-workspace.js",
3949
+ "storm-workspace.ts",
3950
+ ".storm-workspace.json",
3951
+ ".storm-workspace.yaml",
3952
+ ".storm-workspace.yml",
3953
+ ".storm-workspace.js",
3954
+ ".storm-workspace.ts",
3955
+ "lerna.json",
3956
+ "nx.json",
3957
+ "turbo.json",
3958
+ "npm-workspace.json",
3959
+ "yarn-workspace.json",
3960
+ "pnpm-workspace.json",
3961
+ "npm-workspace.yaml",
3962
+ "yarn-workspace.yaml",
3963
+ "pnpm-workspace.yaml",
3964
+ "npm-workspace.yml",
3965
+ "yarn-workspace.yml",
3966
+ "pnpm-workspace.yml",
3967
+ "npm-lock.json",
3968
+ "yarn-lock.json",
3969
+ "pnpm-lock.json",
3970
+ "npm-lock.yaml",
3971
+ "yarn-lock.yaml",
3972
+ "pnpm-lock.yaml",
3973
+ "npm-lock.yml",
3974
+ "yarn-lock.yml",
3975
+ "pnpm-lock.yml",
3976
+ "bun.lockb"
3977
+ ];
3978
+ var rootDirectories = [
3979
+ ".storm-workspace",
3980
+ ".nx",
3981
+ ".git",
3982
+ ".github",
3983
+ ".vscode",
3984
+ ".verdaccio"
3985
+ ];
3986
+ function findWorkspaceRootSafe(pathInsideMonorepo) {
3987
+ if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
3988
+ return correctPaths2(
3989
+ process.env.STORM_WORKSPACE_ROOT ?? process.env.NX_WORKSPACE_ROOT_PATH
3990
+ );
3991
+ }
3992
+ return correctPaths2(
3993
+ findFolderUp(
3994
+ pathInsideMonorepo ?? process.cwd(),
3995
+ rootFiles,
3996
+ rootDirectories
3997
+ )
3998
+ );
3999
+ }
4000
+ function findWorkspaceRoot2(pathInsideMonorepo) {
4001
+ const result = findWorkspaceRootSafe(pathInsideMonorepo);
4002
+ if (!result) {
4003
+ throw new Error(
4004
+ `Cannot find workspace root upwards from known path. Files search list includes:
4005
+ ${rootFiles.join(
4006
+ "\n"
4007
+ )}
4008
+ Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`
4009
+ );
4010
+ }
4011
+ return result;
4012
+ }
4013
+
4014
+ // ../config-tools/dist/chunk-RZM3NYPM.js
4015
+ var import_c122 = require("c12");
4016
+ var import_defu3 = __toESM(require("defu"), 1);
4017
+ var getConfigFileByName = async (fileName, filePath, options2 = {}) => {
4018
+ const workspacePath = filePath || findWorkspaceRoot2(filePath);
4019
+ const configs = await Promise.all([
4020
+ (0, import_c122.loadConfig)({
4021
+ cwd: workspacePath,
4022
+ packageJson: true,
4023
+ name: fileName,
4024
+ envName: fileName?.toUpperCase(),
4025
+ jitiOptions: {
4026
+ debug: false,
4027
+ fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths2(
4028
+ process.env.STORM_CACHE_DIR || "node_modules/.cache/storm",
4029
+ "jiti"
4030
+ )
4031
+ },
4032
+ ...options2
4033
+ }),
4034
+ (0, import_c122.loadConfig)({
4035
+ cwd: workspacePath,
4036
+ packageJson: true,
4037
+ name: fileName,
4038
+ envName: fileName?.toUpperCase(),
4039
+ jitiOptions: {
4040
+ debug: false,
4041
+ fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths2(
4042
+ process.env.STORM_CACHE_DIR || "node_modules/.cache/storm",
4043
+ "jiti"
4044
+ )
4045
+ },
4046
+ configFile: fileName,
4047
+ ...options2
4048
+ })
4049
+ ]);
4050
+ return (0, import_defu3.default)(configs[0] ?? {}, configs[1] ?? {});
4051
+ };
4052
+ var getConfigFile = async (filePath, additionalFileNames = []) => {
4053
+ const workspacePath = filePath ? filePath : findWorkspaceRoot2(filePath);
4054
+ const result = await getConfigFileByName("storm-workspace", workspacePath);
4055
+ let config = result.config;
4056
+ const configFile = result.configFile;
4057
+ if (config && configFile && Object.keys(config).length > 0 && !config.skipConfigLogging) {
4058
+ writeTrace(
4059
+ `Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`,
4060
+ {
4061
+ logLevel: "all"
4062
+ }
4063
+ );
4064
+ }
4065
+ if (additionalFileNames && additionalFileNames.length > 0) {
4066
+ const results = await Promise.all(
4067
+ additionalFileNames.map(
4068
+ (fileName) => getConfigFileByName(fileName, workspacePath)
4069
+ )
4070
+ );
4071
+ for (const result2 of results) {
4072
+ if (result2?.config && result2?.configFile && Object.keys(result2.config).length > 0) {
4073
+ if (!config.skipConfigLogging && !result2.config.skipConfigLogging) {
4074
+ writeTrace(
4075
+ `Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`,
4076
+ {
4077
+ logLevel: "all"
4078
+ }
4079
+ );
4080
+ }
4081
+ config = (0, import_defu3.default)(result2.config ?? {}, config ?? {});
4082
+ }
4083
+ }
4084
+ }
4085
+ if (!config || Object.keys(config).length === 0) {
4086
+ return void 0;
4087
+ }
4088
+ config.configFile = configFile;
4089
+ return config;
4090
+ };
4091
+
4092
+ // ../config-tools/dist/chunk-OEBHWAYK.js
4093
+ init_cjs_shims();
4094
+
4095
+ // ../config/dist/index.js
4096
+ init_cjs_shims();
4097
+
4098
+ // ../config/dist/chunk-5QIMO5EY.js
4099
+ init_cjs_shims();
4100
+
4101
+ // ../config/dist/chunk-ZXJP5Q3G.js
4102
+ init_cjs_shims();
4103
+
4104
+ // ../config/dist/chunk-TYDRIJER.js
4105
+ init_cjs_shims();
4106
+ var s = "https://docs.stormsoftware.com";
4107
+ var r = "https://stormsoftware.com";
4108
+ var t = "https://stormsoftware.com/contact";
4109
+ var a = "https://stormsoftware.com/license";
4110
+ var i = "Apache-2.0";
4111
+ var o = "https://discord.gg/MQ6YVzakM5";
4112
+ var e = "https://join.slack.com/t/storm-software/shared_invite/zt-2gsmk04hs-i6yhK_r6urq0dkZYAwq2pA";
4113
+ var E = `
4114
+ Storm Software is an open source software development organization with the mission is to make software development more accessible. Our ideal future is one where anyone can create software without years of prior development experience serving as a barrier to entry. We hope to achieve this via LLMs, Generative AI, and intuitive, high-level data modeling/programming languages.
4115
+
4116
+ Join us on [Discord](${o}) to chat with the team, receive release notifications, ask questions, and get involved.
4117
+
4118
+ If this sounds interesting, and you would like to help us in creating the next generation of development tools, please reach out on our [website](${t}) or join our [Slack](${e}) channel!
4119
+ `;
4120
+ var S = "tools/errors/codes.json";
4121
+ var A = "The workspace's banner image";
4122
+
4123
+ // ../config/dist/chunk-ZXJP5Q3G.js
4124
+ var e2 = __toESM(require("zod/mini"), 1);
4125
+ var o2 = e2.registry();
4126
+ var t2 = e2.string().check(e2.length(7), e2.toLowerCase(), e2.regex(/^#([0-9a-f]{3}){1,2}$/i), e2.trim());
4127
+ o2.add(t2, { description: "A base schema for describing the format of colors" });
4128
+ var a2 = e2._default(t2, "#151718");
4129
+ o2.add(a2, { description: "The dark background color of the workspace" });
4130
+ var i2 = e2._default(t2, "#cbd5e1");
4131
+ o2.add(i2, { description: "The light background color of the workspace" });
4132
+ var c = e2._default(t2, "#1fb2a6");
4133
+ o2.add(c, { description: "The primary brand specific color of the workspace" });
4134
+ var s2 = e2.optional(t2);
4135
+ o2.add(s2, { description: "The alternate brand specific color of the workspace" });
4136
+ var n = e2.optional(t2);
4137
+ o2.add(n, { description: "The secondary brand specific color of the workspace" });
4138
+ var d = e2._default(t2, "#3fa6ff");
4139
+ o2.add(d, { description: "The color used to display hyperlink text" });
4140
+ var p = e2._default(t2, "#818cf8");
4141
+ o2.add(p, { description: "The second brand specific color of the workspace" });
4142
+ var h = e2._default(t2, "#45b27e");
4143
+ o2.add(h, { description: "The success color of the workspace" });
4144
+ var l = e2._default(t2, "#38bdf8");
4145
+ o2.add(l, { description: "The informational color of the workspace" });
4146
+ var m = e2._default(t2, "#f3d371");
4147
+ o2.add(m, { description: "The warning color of the workspace" });
4148
+ var z2 = e2._default(t2, "#d8314a");
4149
+ o2.add(z2, { description: "The danger color of the workspace" });
4150
+ var g = e2.optional(t2);
4151
+ o2.add(g, { description: "The fatal color of the workspace" });
4152
+ var u = e2._default(t2, "#4ade80");
4153
+ o2.add(u, { description: "The positive number color of the workspace" });
4154
+ var f = e2._default(t2, "#ef4444");
4155
+ o2.add(f, { description: "The negative number color of the workspace" });
4156
+ var k = e2.optional(e2.array(t2));
4157
+ o2.add(k, { description: "The color stops for the base gradient color pattern used in the workspace" });
4158
+ var je = e2.object({ foreground: i2, background: a2, brand: c, alternate: s2, accent: n, link: d, help: p, success: h, info: l, warning: m, danger: z2, fatal: g, positive: u, negative: f, gradient: k });
4159
+ var Ae = e2.object({ foreground: a2, background: i2, brand: c, alternate: s2, accent: n, link: d, help: p, success: h, info: l, warning: m, danger: z2, fatal: g, positive: u, negative: f, gradient: k });
4160
+ var Re = e2.object({ dark: je, light: Ae });
4161
+ var Ue = e2.object({ dark: a2, light: i2, brand: c, alternate: s2, accent: n, link: d, help: p, success: h, info: l, warning: m, danger: z2, fatal: g, positive: u, negative: f, gradient: k });
4162
+ var r2 = e2.optional(e2.url());
4163
+ o2.add(r2, { description: "A remote registry URL used to publish distributable packages" });
4164
+ var T = e2._default(e2.object({ github: r2, npm: r2, cargo: r2, cyclone: r2, container: r2 }), {});
4165
+ o2.add(T, { description: "A list of remote registry URLs used by Storm Software" });
4166
+ var w = e2.union([Ue, Re]);
4167
+ o2.add(w, { description: "Colors used for various workspace elements" });
4168
+ var v = e2.record(e2.union([e2.union([e2.literal("base"), e2.string()]), e2.string()]), w);
4169
+ o2.add(v, { description: "Storm theme config values used for styling various package elements" });
4170
+ var y = e2.optional(e2.union([e2.string().check(e2.trim()), e2.array(e2.string().check(e2.trim()))]));
4171
+ o2.add(y, { description: "The path to a base config file to use as a configuration preset file. Documentation can be found at https://github.com/unjs/c12#extending-configuration." });
4172
+ var C = e2.string().check(e2.trim());
4173
+ o2.add(C, { description: "The workspace bot user's name (this is the bot that will be used to perform various tasks)" });
4174
+ var _ = e2.string().check(e2.trim());
4175
+ o2.add(_, { description: "The email of the workspace bot" });
4176
+ var L = e2.object({ name: C, email: _ });
4177
+ o2.add(L, { description: "The workspace's bot user's config used to automated various operations tasks" });
4178
+ var j = e2.optional(e2.string().check(e2.trim(), e2.url()));
4179
+ o2.add(j, { description: "A URL to a banner image used to display the workspace's release" });
4180
+ var A2 = e2._default(e2.string().check(e2.trim()), A);
4181
+ o2.add(A2, { description: "The alt text for the workspace's release banner image" });
4182
+ var R = e2.object({ url: j, alt: A2 });
4183
+ o2.add(R, { description: "The workspace's banner image used during the release process" });
4184
+ var U = e2.optional(e2.string().check(e2.trim()));
4185
+ o2.add(U, { description: "A header message appended to the start of the workspace's release notes" });
4186
+ var D = e2.optional(e2.string().check(e2.trim()));
4187
+ o2.add(D, { description: "A footer message appended to the end of the workspace's release notes" });
4188
+ var B = e2.object({ banner: e2.union([R, e2.string().check(e2.trim(), e2.url())]), header: U, footer: D });
4189
+ o2.add(B, { description: "The workspace's release config used during the release process" });
4190
+ var F = e2.optional(e2.string().check(e2.trim()));
4191
+ o2.add(F, { description: "A Twitter/X account associated with the organization/project" });
4192
+ var N = e2.optional(e2.string().check(e2.trim()));
4193
+ o2.add(N, { description: "A Discord account associated with the organization/project" });
4194
+ var E2 = e2.optional(e2.string().check(e2.trim()));
4195
+ o2.add(E2, { description: "A Telegram account associated with the organization/project" });
4196
+ var M = e2.optional(e2.string().check(e2.trim()));
4197
+ o2.add(M, { description: "A Slack account associated with the organization/project" });
4198
+ var O = e2.optional(e2.string().check(e2.trim()));
4199
+ o2.add(O, { description: "A Medium account associated with the organization/project" });
4200
+ var I = e2.optional(e2.string().check(e2.trim()));
4201
+ o2.add(I, { description: "A GitHub account associated with the organization/project" });
4202
+ var G = e2.object({ twitter: F, discord: N, telegram: E2, slack: M, medium: O, github: I });
4203
+ o2.add(G, { description: "The workspace's account config used to store various social media links" });
4204
+ var H = e2.optional(e2.string().check(e2.trim()));
4205
+ o2.add(H, { description: "The directory used to store the environment's cached file data" });
4206
+ var J = e2.optional(e2.string().check(e2.trim()));
4207
+ o2.add(J, { description: "The directory used to store the environment's data files" });
4208
+ var W = e2.optional(e2.string().check(e2.trim()));
4209
+ o2.add(W, { description: "The directory used to store the environment's configuration files" });
4210
+ var P = e2.optional(e2.string().check(e2.trim()));
4211
+ o2.add(P, { description: "The directory used to store the environment's temp files" });
4212
+ var $ = e2.optional(e2.string().check(e2.trim()));
4213
+ o2.add($, { description: "The directory used to store the environment's log files" });
4214
+ var V = e2._default(e2.string().check(e2.trim()), "dist");
4215
+ o2.add(V, { description: "The directory used to store the workspace's distributable files after a build (relative to the workspace root)" });
4216
+ var X = e2.object({ cache: H, data: J, config: W, temp: P, log: $, build: V });
4217
+ o2.add(X, { description: "Various directories used by the workspace to store data, cache, and configuration files" });
4218
+ var Y = e2._default(e2.enum(["minimal", "monorepo"]), "monorepo");
4219
+ o2.add(Y, { description: "The variant of the workspace. This can be used to enable or disable certain features or configurations." });
4220
+ var q = e2._default(e2.string().check(e2.trim()), S);
4221
+ o2.add(q, { description: "The path to the workspace's error codes JSON file" });
4222
+ var K = e2.optional(e2.url());
4223
+ o2.add(K, { description: "A URL to a page that looks up the workspace's error messages given a specific error code" });
4224
+ var Q = e2.object({ codesFile: q, url: K });
4225
+ o2.add(Q, { description: "The workspace's error config used when creating error details during a system error" });
4226
+ var Z = e2.optional(e2.string().check(e2.trim(), e2.toLowerCase()));
4227
+ o2.add(Z, { description: "The name of the organization" });
4228
+ var ee = e2.optional(e2.string().check(e2.trim()));
4229
+ o2.add(ee, { description: "A description of the organization" });
4230
+ var oe = e2.optional(e2.url());
4231
+ o2.add(oe, { description: "A URL to the organization's logo image" });
4232
+ var te = e2.optional(e2.url());
4233
+ o2.add(te, { description: "A URL to the organization's icon image" });
4234
+ var re = e2.optional(e2.url());
4235
+ o2.add(re, { description: "A URL to a page that provides more information about the organization" });
4236
+ var ae = e2.object({ name: Z, description: ee, logo: oe, icon: te, url: re });
4237
+ o2.add(ae, { description: "The workspace's organization details" });
4238
+ var ie = e2._default(e2.string().check(e2.trim(), e2.toLowerCase()), "https://public.storm-cdn.com/schemas/storm-workspace.schema.json");
4239
+ o2.add(ie, { description: "The URL or file path to the JSON schema file that describes the Storm configuration file" });
4240
+ var ce = e2.string().check(e2.trim(), e2.toLowerCase());
4241
+ o2.add(ce, { description: "The name of the workspace/project/service/package/scope using this configuration" });
4242
+ var se = e2.string().check(e2.trim(), e2.toLowerCase());
4243
+ o2.add(se, { description: "The namespace of the workspace/project/service/package/scope using this configuration" });
4244
+ var ne = e2.union([ae, e2.string().check(e2.trim(), e2.toLowerCase())]);
4245
+ o2.add(ne, { description: "The organization of the workspace. This can be a string or an object containing the organization's details" });
4246
+ var de = e2.string().check(e2.trim(), e2.toLowerCase());
4247
+ o2.add(de, { description: "The repo URL of the workspace (i.e. the GitHub repository URL)" });
4248
+ var pe = e2._default(e2.string().check(e2.trim()), "Apache-2.0");
4249
+ o2.add(pe, { description: "The license type of the package" });
4250
+ var he = e2.optional(e2.url());
4251
+ o2.add(he, { description: "The homepage of the workspace" });
4252
+ var le = e2.optional(e2.url());
4253
+ o2.add(le, { description: "The documentation site for the workspace" });
4254
+ var me = e2.optional(e2.url());
4255
+ o2.add(me, { description: "The development portal site for the workspace" });
4256
+ var ze = e2.optional(e2.url());
4257
+ o2.add(ze, { description: "The licensing site for the workspace" });
4258
+ var ge = e2.optional(e2.url());
4259
+ o2.add(ge, { description: "The contact site for the workspace" });
4260
+ var ue = e2.optional(e2.url());
4261
+ o2.add(ue, { description: "The support site for the workspace. If not provided, this is defaulted to the `contact` config value" });
4262
+ var fe = e2._default(e2.string().check(e2.trim(), e2.toLowerCase()), "main");
4263
+ o2.add(fe, { description: "The branch of the workspace" });
4264
+ var ke = e2.optional(e2.string().check(e2.trim(), e2.toLowerCase()));
4265
+ o2.add(ke, { description: "A tag specifying the version pre-release identifier" });
4266
+ var we = e2.optional(e2.string().check(e2.trim(), e2.toLowerCase()));
4267
+ o2.add(we, { description: "The owner of the package" });
4268
+ var Se = e2._default(e2.enum(["development", "test", "production"]).check(e2.trim(), e2.toLowerCase()), "production");
4269
+ o2.add(Se, { description: "The current runtime environment mode for the package" });
4270
+ var xe = e2.string().check(e2.trim(), e2.toLowerCase());
4271
+ o2.add(xe, { description: "The root directory of the workspace" });
4272
+ var be = e2._default(e2.boolean(), false);
4273
+ o2.add(be, { description: "Should all known types of workspace caching be skipped?" });
4274
+ var Te = e2._default(e2.enum(["npm", "yarn", "pnpm", "bun"]), "npm");
4275
+ o2.add(Te, { description: "The JavaScript/TypeScript package manager used by the repository" });
4276
+ var ve = e2._default(e2.string().check(e2.trim()), "America/New_York");
4277
+ o2.add(ve, { description: "The default timezone of the workspace" });
4278
+ var ye = e2._default(e2.string().check(e2.trim()), "en-US");
4279
+ o2.add(ye, { description: "The default locale of the workspace" });
4280
+ var Ce = e2._default(e2.enum(["silent", "fatal", "error", "warn", "success", "info", "debug", "trace", "all"]), "info");
4281
+ o2.add(Ce, { description: "The log level used to filter out lower priority log messages. If not provided, this is defaulted using the `environment` config value (if `environment` is set to `production` then `level` is `error`, else `level` is `debug`)." });
4282
+ var _e = e2._default(e2.boolean(), true);
4283
+ o2.add(_e, { description: "Should the logging of the current Storm Workspace configuration be skipped?" });
4284
+ var Le = e2._default(e2.nullable(e2.string().check(e2.trim())), null);
4285
+ o2.add(Le, { description: "The filepath of the Storm config. When this field is null, no config file was found in the current workspace." });
4286
+ var S2 = e2._default(e2.record(e2.string(), e2.any()), {});
4287
+ o2.add(S2, { description: "Configuration of each used extension" });
4288
+ var Be = e2.object({ $schema: ie, extends: y, name: ce, variant: Y, namespace: se, organization: ne, repository: de, license: pe, homepage: he, docs: le, portal: me, licensing: ze, contact: ge, support: ue, branch: fe, preid: ke, owner: we, bot: L, release: B, socials: G, error: Q, mode: Se, workspaceRoot: xe, skipCache: be, directories: X, packageManager: Te, timezone: ve, locale: ye, logLevel: Ce, skipConfigLogging: _e, registry: T, configFile: Le, colors: e2.union([w, v]), extensions: S2 });
4289
+ o2.add(S2, { description: "Storm Workspace config values used during various dev-ops processes. This type is a combination of the StormPackageConfig and StormProject types. It represents the config of the entire monorepo." });
4290
+
4291
+ // ../config/dist/chunk-WIOU3CJS.js
4292
+ init_cjs_shims();
4293
+ var e3 = ["dark", "light", "base", "brand", "alternate", "accent", "link", "success", "help", "info", "warning", "danger", "fatal", "positive", "negative"];
4294
+
4295
+ // ../config-tools/dist/chunk-OEBHWAYK.js
4296
+ var import_node_fs8 = require("fs");
4297
+ var import_promises5 = require("fs/promises");
4298
+ var import_node_path5 = require("path");
4299
+ async function getPackageJsonConfig(root) {
4300
+ let license = i;
4301
+ let homepage = void 0;
4302
+ let support = void 0;
4303
+ let name = void 0;
4304
+ let namespace = void 0;
4305
+ let repository = void 0;
4306
+ const workspaceRoot = findWorkspaceRoot2(root);
4307
+ if ((0, import_node_fs8.existsSync)((0, import_node_path5.join)(workspaceRoot, "package.json"))) {
4308
+ const file = await (0, import_promises5.readFile)(
4309
+ joinPaths2(workspaceRoot, "package.json"),
4310
+ "utf8"
4311
+ );
4312
+ if (file) {
4313
+ const packageJson = JSON.parse(file);
4314
+ if (packageJson.name) {
4315
+ name = packageJson.name;
4316
+ }
4317
+ if (packageJson.namespace) {
4318
+ namespace = packageJson.namespace;
4319
+ }
4320
+ if (packageJson.repository) {
4321
+ if (typeof packageJson.repository === "string") {
4322
+ repository = packageJson.repository;
4323
+ } else if (packageJson.repository.url) {
4324
+ repository = packageJson.repository.url;
4325
+ }
4326
+ }
4327
+ if (packageJson.license) {
4328
+ license = packageJson.license;
4329
+ }
4330
+ if (packageJson.homepage) {
4331
+ homepage = packageJson.homepage;
4332
+ }
4333
+ if (packageJson.bugs) {
4334
+ if (typeof packageJson.bugs === "string") {
4335
+ support = packageJson.bugs;
4336
+ } else if (packageJson.bugs.url) {
4337
+ support = packageJson.bugs.url;
4338
+ }
4339
+ }
4340
+ }
4341
+ }
4342
+ return {
4343
+ workspaceRoot,
4344
+ name,
4345
+ namespace,
4346
+ repository,
4347
+ license,
4348
+ homepage,
4349
+ support
4350
+ };
4351
+ }
4352
+ function applyDefaultConfig(config) {
4353
+ if (!config.support && config.contact) {
4354
+ config.support = config.contact;
4355
+ }
4356
+ if (!config.contact && config.support) {
4357
+ config.contact = config.support;
4358
+ }
4359
+ if (config.homepage) {
4360
+ if (!config.docs) {
4361
+ config.docs = `${config.homepage}/docs`;
4362
+ }
4363
+ if (!config.license) {
4364
+ config.license = `${config.homepage}/license`;
4365
+ }
4366
+ if (!config.support) {
4367
+ config.support = `${config.homepage}/support`;
4368
+ }
4369
+ if (!config.contact) {
4370
+ config.contact = `${config.homepage}/contact`;
4371
+ }
4372
+ if (!config.error?.codesFile || !config?.error?.url) {
4373
+ config.error ??= { codesFile: S };
4374
+ if (config.homepage) {
4375
+ config.error.url ??= `${config.homepage}/errors`;
4376
+ }
4377
+ }
4378
+ }
4379
+ return config;
4380
+ }
4381
+
4382
+ // ../config-tools/dist/chunk-KJ7E5BJ3.js
4383
+ init_cjs_shims();
4384
+ var setExtensionEnv = (extensionName, extension) => {
4385
+ for (const key of Object.keys(extension ?? {})) {
4386
+ if (extension[key]) {
4387
+ const result = key?.replace(
4388
+ /([A-Z])+/g,
4389
+ (input) => input ? input[0]?.toUpperCase() + input.slice(1) : ""
4390
+ ).split(/(?=[A-Z])|[.\-\s_]/).map((x) => x.toLowerCase()) ?? [];
4391
+ let extensionKey;
4392
+ if (result.length === 0) {
4393
+ return;
4394
+ }
4395
+ if (result.length === 1) {
4396
+ extensionKey = result[0]?.toUpperCase() ?? "";
4397
+ } else {
4398
+ extensionKey = result.reduce((ret, part) => {
4399
+ return `${ret}_${part.toLowerCase()}`;
4400
+ });
4401
+ }
4402
+ process.env[`STORM_EXTENSION_${extensionName.toUpperCase()}_${extensionKey.toUpperCase()}`] = extension[key];
4403
+ }
4404
+ }
4405
+ };
4406
+ var setConfigEnv = (config) => {
4407
+ const prefix = "STORM_";
4408
+ if (config.extends) {
4409
+ process.env[`${prefix}EXTENDS`] = Array.isArray(config.extends) ? JSON.stringify(config.extends) : config.extends;
4410
+ }
4411
+ if (config.name) {
4412
+ process.env[`${prefix}NAME`] = config.name;
4413
+ }
4414
+ if (config.variant) {
4415
+ process.env[`${prefix}VARIANT`] = config.variant;
4416
+ }
4417
+ if (config.namespace) {
4418
+ process.env[`${prefix}NAMESPACE`] = config.namespace;
4419
+ }
4420
+ if (config.owner) {
4421
+ process.env[`${prefix}OWNER`] = config.owner;
4422
+ }
4423
+ if (config.bot) {
4424
+ process.env[`${prefix}BOT_NAME`] = config.bot.name;
4425
+ process.env[`${prefix}BOT_EMAIL`] = config.bot.email;
4426
+ }
4427
+ if (config.error) {
4428
+ process.env[`${prefix}ERROR_CODES_FILE`] = config.error.codesFile;
4429
+ process.env[`${prefix}ERROR_URL`] = config.error.url;
4430
+ }
4431
+ if (config.release) {
4432
+ if (config.release.banner) {
4433
+ if (typeof config.release.banner === "string") {
4434
+ process.env[`${prefix}RELEASE_BANNER`] = config.release.banner;
4435
+ process.env[`${prefix}RELEASE_BANNER_URL`] = config.release.banner;
4436
+ } else {
4437
+ process.env[`${prefix}RELEASE_BANNER`] = config.release.banner.url;
4438
+ process.env[`${prefix}RELEASE_BANNER_URL`] = config.release.banner.url;
4439
+ process.env[`${prefix}RELEASE_BANNER_ALT`] = config.release.banner.alt;
4440
+ }
4441
+ }
4442
+ process.env[`${prefix}RELEASE_HEADER`] = config.release.header;
4443
+ process.env[`${prefix}RELEASE_FOOTER`] = config.release.footer;
4444
+ }
4445
+ if (config.socials) {
4446
+ if (config.socials.twitter) {
4447
+ process.env[`${prefix}SOCIAL_TWITTER`] = config.socials.twitter;
4448
+ }
4449
+ if (config.socials.discord) {
4450
+ process.env[`${prefix}SOCIAL_DISCORD`] = config.socials.discord;
4451
+ }
4452
+ if (config.socials.telegram) {
4453
+ process.env[`${prefix}SOCIAL_TELEGRAM`] = config.socials.telegram;
4454
+ }
4455
+ if (config.socials.slack) {
4456
+ process.env[`${prefix}SOCIAL_SLACK`] = config.socials.slack;
4457
+ }
4458
+ if (config.socials.medium) {
4459
+ process.env[`${prefix}SOCIAL_MEDIUM`] = config.socials.medium;
4460
+ }
4461
+ if (config.socials.github) {
4462
+ process.env[`${prefix}SOCIAL_GITHUB`] = config.socials.github;
4463
+ }
4464
+ }
4465
+ if (config.organization) {
4466
+ if (typeof config.organization === "string") {
4467
+ process.env[`${prefix}ORG`] = config.organization;
4468
+ process.env[`${prefix}ORG_NAME`] = config.organization;
4469
+ process.env[`${prefix}ORGANIZATION`] = config.organization;
4470
+ process.env[`${prefix}ORGANIZATION_NAME`] = config.organization;
4471
+ } else {
4472
+ process.env[`${prefix}ORG`] = config.organization.name;
4473
+ process.env[`${prefix}ORG_NAME`] = config.organization.name;
4474
+ process.env[`${prefix}ORGANIZATION`] = config.organization.name;
4475
+ process.env[`${prefix}ORGANIZATION_NAME`] = config.organization.name;
4476
+ if (config.organization.url) {
4477
+ process.env[`${prefix}ORG_URL`] = config.organization.url;
4478
+ process.env[`${prefix}ORGANIZATION_URL`] = config.organization.url;
4479
+ }
4480
+ if (config.organization.description) {
4481
+ process.env[`${prefix}ORG_DESCRIPTION`] = config.organization.description;
4482
+ process.env[`${prefix}ORGANIZATION_DESCRIPTION`] = config.organization.description;
4483
+ }
4484
+ if (config.organization.logo) {
4485
+ process.env[`${prefix}ORG_LOGO`] = config.organization.logo;
4486
+ process.env[`${prefix}ORGANIZATION_LOGO`] = config.organization.logo;
4487
+ }
4488
+ if (config.organization.icon) {
4489
+ process.env[`${prefix}ORG_ICON`] = config.organization.icon;
4490
+ process.env[`${prefix}ORGANIZATION_ICON`] = config.organization.icon;
4491
+ }
4492
+ }
4493
+ }
4494
+ if (config.packageManager) {
4495
+ process.env[`${prefix}PACKAGE_MANAGER`] = config.packageManager;
4496
+ }
4497
+ if (config.license) {
4498
+ process.env[`${prefix}LICENSE`] = config.license;
4499
+ }
4500
+ if (config.homepage) {
4501
+ process.env[`${prefix}HOMEPAGE`] = config.homepage;
4502
+ }
4503
+ if (config.docs) {
4504
+ process.env[`${prefix}DOCS`] = config.docs;
4505
+ }
4506
+ if (config.portal) {
4507
+ process.env[`${prefix}PORTAL`] = config.portal;
4508
+ }
4509
+ if (config.licensing) {
4510
+ process.env[`${prefix}LICENSING`] = config.licensing;
4511
+ }
4512
+ if (config.contact) {
4513
+ process.env[`${prefix}CONTACT`] = config.contact;
4514
+ }
4515
+ if (config.support) {
4516
+ process.env[`${prefix}SUPPORT`] = config.support;
4517
+ }
4518
+ if (config.timezone) {
4519
+ process.env[`${prefix}TIMEZONE`] = config.timezone;
4520
+ process.env.TZ = config.timezone;
4521
+ process.env.DEFAULT_TIMEZONE = config.timezone;
4522
+ process.env.TIMEZONE = config.timezone;
4523
+ }
4524
+ if (config.locale) {
4525
+ process.env[`${prefix}LOCALE`] = config.locale;
4526
+ process.env.DEFAULT_LOCALE = config.locale;
4527
+ process.env.LOCALE = config.locale;
4528
+ process.env.LANG = config.locale ? `${config.locale.replaceAll("-", "_")}.UTF-8` : "en_US.UTF-8";
4529
+ }
4530
+ if (config.configFile) {
4531
+ process.env[`${prefix}WORKSPACE_CONFIG_FILE`] = correctPaths2(
4532
+ config.configFile
4533
+ );
4534
+ }
4535
+ if (config.workspaceRoot) {
4536
+ process.env[`${prefix}WORKSPACE_ROOT`] = correctPaths2(config.workspaceRoot);
4537
+ process.env.NX_WORKSPACE_ROOT = correctPaths2(config.workspaceRoot);
4538
+ process.env.NX_WORKSPACE_ROOT_PATH = correctPaths2(config.workspaceRoot);
4539
+ }
4540
+ if (config.directories) {
4541
+ if (!config.skipCache && config.directories.cache) {
4542
+ process.env[`${prefix}CACHE_DIR`] = correctPaths2(
4543
+ config.directories.cache
4544
+ );
4545
+ process.env[`${prefix}CACHE_DIRECTORY`] = process.env[`${prefix}CACHE_DIR`];
4546
+ }
4547
+ if (config.directories.data) {
4548
+ process.env[`${prefix}DATA_DIR`] = correctPaths2(config.directories.data);
4549
+ process.env[`${prefix}DATA_DIRECTORY`] = process.env[`${prefix}DATA_DIR`];
4550
+ }
4551
+ if (config.directories.config) {
4552
+ process.env[`${prefix}CONFIG_DIR`] = correctPaths2(
4553
+ config.directories.config
4554
+ );
4555
+ process.env[`${prefix}CONFIG_DIRECTORY`] = process.env[`${prefix}CONFIG_DIR`];
4556
+ }
4557
+ if (config.directories.temp) {
4558
+ process.env[`${prefix}TEMP_DIR`] = correctPaths2(config.directories.temp);
4559
+ process.env[`${prefix}TEMP_DIRECTORY`] = process.env[`${prefix}TEMP_DIR`];
4560
+ }
4561
+ if (config.directories.log) {
4562
+ process.env[`${prefix}LOG_DIR`] = correctPaths2(config.directories.log);
4563
+ process.env[`${prefix}LOG_DIRECTORY`] = process.env[`${prefix}LOG_DIR`];
4564
+ }
4565
+ if (config.directories.build) {
4566
+ process.env[`${prefix}BUILD_DIR`] = correctPaths2(
4567
+ config.directories.build
4568
+ );
4569
+ process.env[`${prefix}BUILD_DIRECTORY`] = process.env[`${prefix}BUILD_DIR`];
4570
+ }
4571
+ }
4572
+ if (config.skipCache !== void 0) {
4573
+ process.env[`${prefix}SKIP_CACHE`] = String(config.skipCache);
4574
+ if (config.skipCache) {
4575
+ process.env.NX_SKIP_NX_CACHE ??= String(config.skipCache);
4576
+ process.env.NX_CACHE_PROJECT_GRAPH ??= String(config.skipCache);
4577
+ }
4578
+ }
4579
+ if (config.mode) {
4580
+ process.env[`${prefix}MODE`] = config.mode;
4581
+ process.env.NODE_ENV = config.mode;
4582
+ process.env.ENVIRONMENT = config.mode;
4583
+ }
4584
+ if (config.colors?.base?.light || config.colors?.base?.dark) {
4585
+ for (const key of Object.keys(config.colors)) {
4586
+ setThemeColorsEnv(`${prefix}COLOR_${key}_`, config.colors[key]);
4587
+ }
4588
+ } else {
4589
+ setThemeColorsEnv(
4590
+ `${prefix}COLOR_`,
4591
+ config.colors
4592
+ );
4593
+ }
4594
+ if (config.repository) {
4595
+ process.env[`${prefix}REPOSITORY`] = config.repository;
4596
+ }
4597
+ if (config.branch) {
4598
+ process.env[`${prefix}BRANCH`] = config.branch;
4599
+ }
4600
+ if (config.preid) {
4601
+ process.env[`${prefix}PRE_ID`] = String(config.preid);
4602
+ }
4603
+ if (config.registry) {
4604
+ if (config.registry.github) {
4605
+ process.env[`${prefix}REGISTRY_GITHUB`] = String(config.registry.github);
4606
+ }
4607
+ if (config.registry.npm) {
4608
+ process.env[`${prefix}REGISTRY_NPM`] = String(config.registry.npm);
4609
+ }
4610
+ if (config.registry.cargo) {
4611
+ process.env[`${prefix}REGISTRY_CARGO`] = String(config.registry.cargo);
4612
+ }
4613
+ if (config.registry.cyclone) {
4614
+ process.env[`${prefix}REGISTRY_CYCLONE`] = String(
4615
+ config.registry.cyclone
4616
+ );
4617
+ }
4618
+ if (config.registry.container) {
4619
+ process.env[`${prefix}REGISTRY_CONTAINER`] = String(
4620
+ config.registry.container
4621
+ );
4622
+ }
4623
+ }
4624
+ if (config.logLevel) {
4625
+ process.env[`${prefix}LOG_LEVEL`] = String(config.logLevel);
4626
+ process.env.LOG_LEVEL = String(config.logLevel);
4627
+ process.env.NX_VERBOSE_LOGGING = String(
4628
+ getLogLevel(config.logLevel) >= LogLevel.DEBUG ? true : false
4629
+ );
4630
+ process.env.RUST_BACKTRACE = getLogLevel(config.logLevel) >= LogLevel.DEBUG ? "full" : "none";
4631
+ }
4632
+ if (config.skipConfigLogging !== void 0) {
4633
+ process.env[`${prefix}SKIP_CONFIG_LOGGING`] = String(
4634
+ config.skipConfigLogging
4635
+ );
4636
+ }
4637
+ process.env[`${prefix}WORKSPACE_CONFIG`] = JSON.stringify(config);
4638
+ for (const key of Object.keys(config.extensions ?? {})) {
4639
+ if (config.extensions[key] && Object.keys(config.extensions[key])) {
4640
+ setExtensionEnv(key, config.extensions[key]);
4641
+ }
4642
+ }
4643
+ };
4644
+ var setThemeColorsEnv = (prefix, config) => {
4645
+ return config?.light?.brand || config?.dark?.brand ? setMultiThemeColorsEnv(prefix, config) : setSingleThemeColorsEnv(prefix, config);
4646
+ };
4647
+ var setSingleThemeColorsEnv = (prefix, config) => {
4648
+ if (config.dark) {
4649
+ process.env[`${prefix}DARK`] = config.dark;
4650
+ }
4651
+ if (config.light) {
4652
+ process.env[`${prefix}LIGHT`] = config.light;
4653
+ }
4654
+ if (config.brand) {
4655
+ process.env[`${prefix}BRAND`] = config.brand;
4656
+ }
4657
+ if (config.alternate) {
4658
+ process.env[`${prefix}ALTERNATE`] = config.alternate;
4659
+ }
4660
+ if (config.accent) {
4661
+ process.env[`${prefix}ACCENT`] = config.accent;
4662
+ }
4663
+ if (config.link) {
4664
+ process.env[`${prefix}LINK`] = config.link;
4665
+ }
4666
+ if (config.help) {
4667
+ process.env[`${prefix}HELP`] = config.help;
4668
+ }
4669
+ if (config.success) {
4670
+ process.env[`${prefix}SUCCESS`] = config.success;
4671
+ }
4672
+ if (config.info) {
4673
+ process.env[`${prefix}INFO`] = config.info;
4674
+ }
4675
+ if (config.warning) {
4676
+ process.env[`${prefix}WARNING`] = config.warning;
4677
+ }
4678
+ if (config.danger) {
4679
+ process.env[`${prefix}DANGER`] = config.danger;
4680
+ }
4681
+ if (config.fatal) {
4682
+ process.env[`${prefix}FATAL`] = config.fatal;
4683
+ }
4684
+ if (config.positive) {
4685
+ process.env[`${prefix}POSITIVE`] = config.positive;
4686
+ }
4687
+ if (config.negative) {
4688
+ process.env[`${prefix}NEGATIVE`] = config.negative;
4689
+ }
4690
+ if (config.gradient) {
4691
+ for (let i3 = 0; i3 < config.gradient.length; i3++) {
4692
+ process.env[`${prefix}GRADIENT_${i3}`] = config.gradient[i3];
4693
+ }
4694
+ }
4695
+ };
4696
+ var setMultiThemeColorsEnv = (prefix, config) => {
4697
+ return {
4698
+ light: setBaseThemeColorsEnv(`${prefix}LIGHT_`, config.light),
4699
+ dark: setBaseThemeColorsEnv(`${prefix}DARK_`, config.dark)
4700
+ };
4701
+ };
4702
+ var setBaseThemeColorsEnv = (prefix, config) => {
4703
+ if (config.foreground) {
4704
+ process.env[`${prefix}FOREGROUND`] = config.foreground;
4705
+ }
4706
+ if (config.background) {
4707
+ process.env[`${prefix}BACKGROUND`] = config.background;
4708
+ }
4709
+ if (config.brand) {
4710
+ process.env[`${prefix}BRAND`] = config.brand;
4711
+ }
4712
+ if (config.alternate) {
4713
+ process.env[`${prefix}ALTERNATE`] = config.alternate;
4714
+ }
4715
+ if (config.accent) {
4716
+ process.env[`${prefix}ACCENT`] = config.accent;
4717
+ }
4718
+ if (config.link) {
4719
+ process.env[`${prefix}LINK`] = config.link;
4720
+ }
4721
+ if (config.help) {
4722
+ process.env[`${prefix}HELP`] = config.help;
4723
+ }
4724
+ if (config.success) {
4725
+ process.env[`${prefix}SUCCESS`] = config.success;
4726
+ }
4727
+ if (config.info) {
4728
+ process.env[`${prefix}INFO`] = config.info;
4729
+ }
4730
+ if (config.warning) {
4731
+ process.env[`${prefix}WARNING`] = config.warning;
4732
+ }
4733
+ if (config.danger) {
4734
+ process.env[`${prefix}DANGER`] = config.danger;
4735
+ }
4736
+ if (config.fatal) {
4737
+ process.env[`${prefix}FATAL`] = config.fatal;
4738
+ }
4739
+ if (config.positive) {
4740
+ process.env[`${prefix}POSITIVE`] = config.positive;
4741
+ }
4742
+ if (config.negative) {
4743
+ process.env[`${prefix}NEGATIVE`] = config.negative;
4744
+ }
4745
+ if (config.gradient) {
4746
+ for (let i3 = 0; i3 < config.gradient.length; i3++) {
4747
+ process.env[`${prefix}GRADIENT_${i3}`] = config.gradient[i3];
4748
+ }
4749
+ }
4750
+ };
4751
+
4752
+ // ../config-tools/dist/chunk-ZWZLRNXP.js
4753
+ init_cjs_shims();
4754
+ var getExtensionEnv = (extensionName) => {
4755
+ const prefix = `STORM_EXTENSION_${extensionName.toUpperCase()}_`;
4756
+ return Object.keys(process.env).filter((key) => key.startsWith(prefix)).reduce((ret, key) => {
4757
+ const name = key.replace(prefix, "").split("_").map(
4758
+ (i3) => i3.length > 0 ? i3.trim().charAt(0).toUpperCase() + i3.trim().slice(1) : ""
4759
+ ).join("");
4760
+ if (name) {
4761
+ ret[name] = process.env[key];
4762
+ }
4763
+ return ret;
4764
+ }, {});
4765
+ };
4766
+ var getConfigEnv = () => {
4767
+ const prefix = "STORM_";
4768
+ let config = {
4769
+ extends: process.env[`${prefix}EXTENDS`] || void 0,
4770
+ name: process.env[`${prefix}NAME`] || void 0,
4771
+ variant: process.env[`${prefix}VARIANT`] || void 0,
4772
+ namespace: process.env[`${prefix}NAMESPACE`] || void 0,
4773
+ owner: process.env[`${prefix}OWNER`] || void 0,
4774
+ bot: {
4775
+ name: process.env[`${prefix}BOT_NAME`] || void 0,
4776
+ email: process.env[`${prefix}BOT_EMAIL`] || void 0
4777
+ },
4778
+ release: {
4779
+ banner: {
4780
+ url: process.env[`${prefix}RELEASE_BANNER_URL`] || void 0,
4781
+ alt: process.env[`${prefix}RELEASE_BANNER_ALT`] || void 0
4782
+ },
4783
+ header: process.env[`${prefix}RELEASE_HEADER`] || void 0,
4784
+ footer: process.env[`${prefix}RELEASE_FOOTER`] || void 0
4785
+ },
4786
+ error: {
4787
+ codesFile: process.env[`${prefix}ERROR_CODES_FILE`] || void 0,
4788
+ url: process.env[`${prefix}ERROR_URL`] || void 0
4789
+ },
4790
+ socials: {
4791
+ twitter: process.env[`${prefix}SOCIAL_TWITTER`] || void 0,
4792
+ discord: process.env[`${prefix}SOCIAL_DISCORD`] || void 0,
4793
+ telegram: process.env[`${prefix}SOCIAL_TELEGRAM`] || void 0,
4794
+ slack: process.env[`${prefix}SOCIAL_SLACK`] || void 0,
4795
+ medium: process.env[`${prefix}SOCIAL_MEDIUM`] || void 0,
4796
+ github: process.env[`${prefix}SOCIAL_GITHUB`] || void 0
4797
+ },
4798
+ organization: process.env[`${prefix}ORG`] || process.env[`${prefix}ORGANIZATION`] || process.env[`${prefix}ORG_NAME`] || process.env[`${prefix}ORGANIZATION_NAME`] ? process.env[`${prefix}ORG_DESCRIPTION`] || process.env[`${prefix}ORGANIZATION_DESCRIPTION`] || process.env[`${prefix}ORG_URL`] || process.env[`${prefix}ORGANIZATION_URL`] || process.env[`${prefix}ORG_LOGO`] || process.env[`${prefix}ORGANIZATION_LOGO`] ? {
4799
+ name: process.env[`${prefix}ORG`] || process.env[`${prefix}ORGANIZATION`] || process.env[`${prefix}ORG_NAME`] || process.env[`${prefix}ORGANIZATION_NAME`],
4800
+ description: process.env[`${prefix}ORG_DESCRIPTION`] || process.env[`${prefix}ORGANIZATION_DESCRIPTION`] || void 0,
4801
+ url: process.env[`${prefix}ORG_URL`] || process.env[`${prefix}ORGANIZATION_URL`] || void 0,
4802
+ logo: process.env[`${prefix}ORG_LOGO`] || process.env[`${prefix}ORGANIZATION_LOGO`] || void 0,
4803
+ icon: process.env[`${prefix}ORG_ICON`] || process.env[`${prefix}ORGANIZATION_ICON`] || void 0
4804
+ } : process.env[`${prefix}ORG`] || process.env[`${prefix}ORGANIZATION`] || process.env[`${prefix}ORG_NAME`] || process.env[`${prefix}ORGANIZATION_NAME`] : void 0,
4805
+ packageManager: process.env[`${prefix}PACKAGE_MANAGER`] || void 0,
4806
+ license: process.env[`${prefix}LICENSE`] || void 0,
4807
+ homepage: process.env[`${prefix}HOMEPAGE`] || void 0,
4808
+ docs: process.env[`${prefix}DOCS`] || void 0,
4809
+ portal: process.env[`${prefix}PORTAL`] || void 0,
4810
+ licensing: process.env[`${prefix}LICENSING`] || void 0,
4811
+ contact: process.env[`${prefix}CONTACT`] || void 0,
4812
+ support: process.env[`${prefix}SUPPORT`] || void 0,
4813
+ timezone: process.env[`${prefix}TIMEZONE`] || process.env.TZ || void 0,
4814
+ locale: process.env[`${prefix}LOCALE`] || process.env.LOCALE || void 0,
4815
+ configFile: process.env[`${prefix}WORKSPACE_CONFIG_FILE`] ? correctPaths2(process.env[`${prefix}WORKSPACE_CONFIG_FILE`]) : void 0,
4816
+ workspaceRoot: process.env[`${prefix}WORKSPACE_ROOT`] ? correctPaths2(process.env[`${prefix}WORKSPACE_ROOT`]) : void 0,
4817
+ directories: {
4818
+ cache: process.env[`${prefix}CACHE_DIR`] ? correctPaths2(process.env[`${prefix}CACHE_DIR`]) : process.env[`${prefix}CACHE_DIRECTORY`] ? correctPaths2(process.env[`${prefix}CACHE_DIRECTORY`]) : void 0,
4819
+ data: process.env[`${prefix}DATA_DIR`] ? correctPaths2(process.env[`${prefix}DATA_DIR`]) : process.env[`${prefix}DATA_DIRECTORY`] ? correctPaths2(process.env[`${prefix}DATA_DIRECTORY`]) : void 0,
4820
+ config: process.env[`${prefix}CONFIG_DIR`] ? correctPaths2(process.env[`${prefix}CONFIG_DIR`]) : process.env[`${prefix}CONFIG_DIRECTORY`] ? correctPaths2(process.env[`${prefix}CONFIG_DIRECTORY`]) : void 0,
4821
+ temp: process.env[`${prefix}TEMP_DIR`] ? correctPaths2(process.env[`${prefix}TEMP_DIR`]) : process.env[`${prefix}TEMP_DIRECTORY`] ? correctPaths2(process.env[`${prefix}TEMP_DIRECTORY`]) : void 0,
4822
+ log: process.env[`${prefix}LOG_DIR`] ? correctPaths2(process.env[`${prefix}LOG_DIR`]) : process.env[`${prefix}LOG_DIRECTORY`] ? correctPaths2(process.env[`${prefix}LOG_DIRECTORY`]) : void 0,
4823
+ build: process.env[`${prefix}BUILD_DIR`] ? correctPaths2(process.env[`${prefix}BUILD_DIR`]) : process.env[`${prefix}BUILD_DIRECTORY`] ? correctPaths2(process.env[`${prefix}BUILD_DIRECTORY`]) : void 0
4824
+ },
4825
+ skipCache: process.env[`${prefix}SKIP_CACHE`] !== void 0 ? Boolean(process.env[`${prefix}SKIP_CACHE`]) : void 0,
4826
+ mode: (process.env[`${prefix}MODE`] ?? process.env.NODE_ENV ?? process.env.ENVIRONMENT) || void 0,
4827
+ // ci:
4828
+ // process.env[`${prefix}CI`] !== undefined
4829
+ // ? Boolean(
4830
+ // process.env[`${prefix}CI`] ??
4831
+ // process.env.CI ??
4832
+ // process.env.CONTINUOUS_INTEGRATION
4833
+ // )
4834
+ // : undefined,
4835
+ repository: process.env[`${prefix}REPOSITORY`] || void 0,
4836
+ branch: process.env[`${prefix}BRANCH`] || void 0,
4837
+ preid: process.env[`${prefix}PRE_ID`] || void 0,
4838
+ registry: {
4839
+ github: process.env[`${prefix}REGISTRY_GITHUB`] || void 0,
4840
+ npm: process.env[`${prefix}REGISTRY_NPM`] || void 0,
4841
+ cargo: process.env[`${prefix}REGISTRY_CARGO`] || void 0,
4842
+ cyclone: process.env[`${prefix}REGISTRY_CYCLONE`] || void 0,
4843
+ container: process.env[`${prefix}REGISTRY_CONTAINER`] || void 0
4844
+ },
4845
+ logLevel: process.env[`${prefix}LOG_LEVEL`] !== null && process.env[`${prefix}LOG_LEVEL`] !== void 0 ? process.env[`${prefix}LOG_LEVEL`] && Number.isSafeInteger(
4846
+ Number.parseInt(process.env[`${prefix}LOG_LEVEL`])
4847
+ ) ? getLogLevelLabel(
4848
+ Number.parseInt(process.env[`${prefix}LOG_LEVEL`])
4849
+ ) : process.env[`${prefix}LOG_LEVEL`] : void 0,
4850
+ skipConfigLogging: process.env[`${prefix}SKIP_CONFIG_LOGGING`] !== void 0 ? Boolean(process.env[`${prefix}SKIP_CONFIG_LOGGING`]) : void 0
4851
+ };
4852
+ const themeNames = Object.keys(process.env).filter(
4853
+ (envKey) => envKey.startsWith(`${prefix}COLOR_`) && e3.every(
4854
+ (colorKey) => !envKey.startsWith(`${prefix}COLOR_LIGHT_${colorKey}`) && !envKey.startsWith(`${prefix}COLOR_DARK_${colorKey}`)
4855
+ )
4856
+ );
4857
+ config.colors = themeNames.length > 0 ? themeNames.reduce(
4858
+ (ret, themeName) => {
4859
+ ret[themeName] = getThemeColorsEnv(prefix, themeName);
4860
+ return ret;
4861
+ },
4862
+ {}
4863
+ ) : getThemeColorsEnv(prefix);
4864
+ if (config.docs === s) {
4865
+ if (config.homepage === r) {
4866
+ config.docs = `${r}/projects/${config.name}/docs`;
4867
+ } else {
4868
+ config.docs = `${config.homepage}/docs`;
4869
+ }
4870
+ }
4871
+ if (config.licensing === a) {
4872
+ if (config.homepage === r) {
4873
+ config.licensing = `${r}/projects/${config.name}/licensing`;
4874
+ } else {
4875
+ config.licensing = `${config.homepage}/docs`;
4876
+ }
4877
+ }
4878
+ const serializedConfig = process.env[`${prefix}WORKSPACE_CONFIG`];
4879
+ if (serializedConfig) {
4880
+ const parsed = JSON.parse(serializedConfig);
4881
+ config = {
4882
+ ...config,
4883
+ ...parsed,
4884
+ colors: { ...config.colors, ...parsed.colors },
4885
+ extensions: { ...config.extensions, ...parsed.extensions }
4886
+ };
4887
+ }
4888
+ return config;
4889
+ };
4890
+ var getThemeColorsEnv = (prefix, theme) => {
4891
+ const themeName = `COLOR_${theme && theme !== "base" ? `${theme}_` : ""}`.toUpperCase();
4892
+ return process.env[`${prefix}${themeName}LIGHT_BRAND`] || process.env[`${prefix}${themeName}DARK_BRAND`] ? getMultiThemeColorsEnv(prefix + themeName) : getSingleThemeColorsEnv(prefix + themeName);
4893
+ };
4894
+ var getSingleThemeColorsEnv = (prefix) => {
4895
+ const gradient = [];
4896
+ if (process.env[`${prefix}GRADIENT_START`] && process.env[`${prefix}GRADIENT_END`]) {
4897
+ gradient.push(
4898
+ process.env[`${prefix}GRADIENT_START`],
4899
+ process.env[`${prefix}GRADIENT_END`]
4900
+ );
4901
+ } else if (process.env[`${prefix}GRADIENT_0`] || process.env[`${prefix}GRADIENT_1`]) {
4902
+ let index = process.env[`${prefix}GRADIENT_0`] ? 0 : 1;
4903
+ while (process.env[`${prefix}GRADIENT_${index}`]) {
4904
+ gradient.push(process.env[`${prefix}GRADIENT_${index}`]);
4905
+ index++;
4906
+ }
4907
+ }
4908
+ return {
4909
+ dark: process.env[`${prefix}DARK`],
4910
+ light: process.env[`${prefix}LIGHT`],
4911
+ brand: process.env[`${prefix}BRAND`],
4912
+ alternate: process.env[`${prefix}ALTERNATE`],
4913
+ accent: process.env[`${prefix}ACCENT`],
4914
+ link: process.env[`${prefix}LINK`],
4915
+ help: process.env[`${prefix}HELP`],
4916
+ success: process.env[`${prefix}SUCCESS`],
4917
+ info: process.env[`${prefix}INFO`],
4918
+ warning: process.env[`${prefix}WARNING`],
4919
+ danger: process.env[`${prefix}DANGER`],
4920
+ fatal: process.env[`${prefix}FATAL`],
4921
+ positive: process.env[`${prefix}POSITIVE`],
4922
+ negative: process.env[`${prefix}NEGATIVE`],
4923
+ gradient
4924
+ };
4925
+ };
4926
+ var getMultiThemeColorsEnv = (prefix) => {
4927
+ return {
4928
+ light: getBaseThemeColorsEnv(`${prefix}_LIGHT_`),
4929
+ dark: getBaseThemeColorsEnv(`${prefix}_DARK_`)
4930
+ };
4931
+ };
4932
+ var getBaseThemeColorsEnv = (prefix) => {
4933
+ const gradient = [];
4934
+ if (process.env[`${prefix}GRADIENT_START`] && process.env[`${prefix}GRADIENT_END`]) {
4935
+ gradient.push(
4936
+ process.env[`${prefix}GRADIENT_START`],
4937
+ process.env[`${prefix}GRADIENT_END`]
4938
+ );
4939
+ } else if (process.env[`${prefix}GRADIENT_0`] || process.env[`${prefix}GRADIENT_1`]) {
4940
+ let index = process.env[`${prefix}GRADIENT_0`] ? 0 : 1;
4941
+ while (process.env[`${prefix}GRADIENT_${index}`]) {
4942
+ gradient.push(process.env[`${prefix}GRADIENT_${index}`]);
4943
+ index++;
4944
+ }
4945
+ }
4946
+ return {
4947
+ foreground: process.env[`${prefix}FOREGROUND`],
4948
+ background: process.env[`${prefix}BACKGROUND`],
4949
+ brand: process.env[`${prefix}BRAND`],
4950
+ alternate: process.env[`${prefix}ALTERNATE`],
4951
+ accent: process.env[`${prefix}ACCENT`],
4952
+ link: process.env[`${prefix}LINK`],
4953
+ help: process.env[`${prefix}HELP`],
4954
+ success: process.env[`${prefix}SUCCESS`],
4955
+ info: process.env[`${prefix}INFO`],
4956
+ warning: process.env[`${prefix}WARNING`],
4957
+ danger: process.env[`${prefix}DANGER`],
4958
+ fatal: process.env[`${prefix}FATAL`],
4959
+ positive: process.env[`${prefix}POSITIVE`],
4960
+ negative: process.env[`${prefix}NEGATIVE`],
4961
+ gradient
4962
+ };
4963
+ };
4964
+
4965
+ // ../config/dist/schema.js
4966
+ init_cjs_shims();
4967
+
4968
+ // ../config-tools/dist/chunk-R7MTORRG.js
4969
+ var import_defu4 = __toESM(require("defu"), 1);
4970
+ var import_node_fs9 = require("fs");
4971
+ var _extension_cache = /* @__PURE__ */ new WeakMap();
4972
+ var _static_cache = void 0;
4973
+ var createStormWorkspaceConfig = async (extensionName, schema, workspaceRoot, skipLogs = false, useDefault = true) => {
4974
+ let result;
4975
+ if (!_static_cache?.data || !_static_cache?.timestamp || _static_cache.timestamp < Date.now() - 8e3) {
4976
+ let _workspaceRoot = workspaceRoot;
4977
+ if (!_workspaceRoot) {
4978
+ _workspaceRoot = findWorkspaceRoot2();
4979
+ }
4980
+ const configEnv = getConfigEnv();
4981
+ const configFile = await getConfigFile(_workspaceRoot);
4982
+ if (!configFile) {
4983
+ if (!skipLogs) {
4984
+ writeWarning(
4985
+ "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",
4986
+ { logLevel: "all" }
4987
+ );
4988
+ }
4989
+ if (useDefault === false) {
4990
+ return void 0;
4991
+ }
4992
+ }
4993
+ const defaultConfig = await getPackageJsonConfig(_workspaceRoot);
4994
+ const configInput = (0, import_defu4.default)(
4995
+ configEnv,
4996
+ configFile,
4997
+ defaultConfig
4998
+ );
4999
+ if (!configInput.variant) {
5000
+ configInput.variant = (0, import_node_fs9.existsSync)(joinPaths2(_workspaceRoot, "nx.json")) || (0, import_node_fs9.existsSync)(joinPaths2(_workspaceRoot, ".nx")) || (0, import_node_fs9.existsSync)(joinPaths2(_workspaceRoot, "lerna.json")) || (0, import_node_fs9.existsSync)(joinPaths2(_workspaceRoot, "turbo.json")) ? "monorepo" : "minimal";
5001
+ }
5002
+ try {
5003
+ result = applyDefaultConfig(
5004
+ await Be.parseAsync(configInput)
5005
+ );
5006
+ result.workspaceRoot ??= _workspaceRoot;
5007
+ } catch (error) {
5008
+ throw new Error(
5009
+ `Failed to parse Storm Workspace configuration${error?.message ? `: ${error.message}` : ""}
5010
+
5011
+ Please ensure your configuration file is valid JSON and matches the expected schema. The current workspace configuration input is: ${formatLogMessage(
5012
+ configInput
5013
+ )}`,
5014
+ {
5015
+ cause: error
5016
+ }
5017
+ );
5018
+ }
5019
+ } else {
5020
+ result = _static_cache.data;
5021
+ }
5022
+ if (schema && extensionName) {
5023
+ result.extensions = {
5024
+ ...result.extensions,
5025
+ [extensionName]: createConfigExtension(extensionName, schema)
5026
+ };
5027
+ }
5028
+ _static_cache = {
5029
+ timestamp: Date.now(),
5030
+ data: result
5031
+ };
5032
+ return result;
5033
+ };
5034
+ var createConfigExtension = (extensionName, schema) => {
5035
+ const extension_cache_key = { extensionName };
5036
+ if (_extension_cache.has(extension_cache_key)) {
5037
+ return _extension_cache.get(extension_cache_key);
5038
+ }
5039
+ let extension = getExtensionEnv(extensionName);
5040
+ if (schema) {
5041
+ extension = schema.parse(extension);
5042
+ }
5043
+ _extension_cache.set(extension_cache_key, extension);
5044
+ return extension;
5045
+ };
5046
+ var loadStormWorkspaceConfig = async (workspaceRoot, skipLogs = false) => {
5047
+ const config = await createStormWorkspaceConfig(
5048
+ void 0,
5049
+ void 0,
5050
+ workspaceRoot,
5051
+ skipLogs,
5052
+ true
5053
+ );
5054
+ setConfigEnv(config);
5055
+ if (!skipLogs && !config.skipConfigLogging) {
5056
+ writeTrace(
5057
+ `\u2699\uFE0F Using Storm Workspace configuration:
5058
+ ${formatLogMessage(config)}`,
5059
+ config
5060
+ );
5061
+ }
5062
+ return config;
5063
+ };
5064
+
5065
+ // ../config-tools/dist/chunk-WOLTMI7X.js
5066
+ function getConfig(workspaceRoot, skipLogs = false) {
5067
+ return loadStormWorkspaceConfig(workspaceRoot, skipLogs);
5068
+ }
5069
+ function getWorkspaceConfig(skipLogs = true, options2 = {}) {
5070
+ let workspaceRoot = options2.workspaceRoot;
5071
+ if (!workspaceRoot) {
5072
+ workspaceRoot = findWorkspaceRoot2(options2.cwd);
5073
+ }
5074
+ return getConfig(workspaceRoot, skipLogs);
5075
+ }
5076
+
5077
+ // ../config-tools/dist/utilities/correct-paths.js
5078
+ init_cjs_shims();
5079
+
5080
+ // src/options.ts
5081
+ var import_defu5 = __toESM(require("defu"), 1);
5082
+ var import_node_fs10 = require("fs");
5083
+ var import_promises6 = __toESM(require("fs/promises"), 1);
5084
+ var import_find_workspace_root = require("nx/src/utils/find-workspace-root");
5085
+ async function resolveOptions(userOptions) {
5086
+ const projectRoot = userOptions.projectRoot;
5087
+ const workspaceRoot = (0, import_find_workspace_root.findWorkspaceRoot)(projectRoot);
5088
+ if (!workspaceRoot) {
5089
+ throw new Error("Cannot find Nx workspace root");
5090
+ }
5091
+ const workspaceConfig = await getWorkspaceConfig(true, {
5092
+ workspaceRoot: workspaceRoot.dir
5093
+ });
5094
+ writeDebug(" \u2699\uFE0F Resolving build options", workspaceConfig);
5095
+ const stopwatch = getStopwatch("Build options resolution");
5096
+ const projectGraph = await (0, import_devkit2.createProjectGraphAsync)({
5097
+ exitOnError: true
5098
+ });
5099
+ const projectJsonPath = joinPaths2(
5100
+ workspaceRoot.dir,
5101
+ projectRoot,
5102
+ "project.json"
5103
+ );
5104
+ if (!(0, import_node_fs10.existsSync)(projectJsonPath)) {
5105
+ throw new Error("Cannot find project.json configuration");
5106
+ }
5107
+ const projectJsonFile = await import_promises6.default.readFile(projectJsonPath, "utf8");
5108
+ const projectJson = JSON.parse(projectJsonFile);
5109
+ const projectName = projectJson.name || userOptions.name;
5110
+ const projectConfigurations = (0, import_devkit2.readProjectsConfigurationFromProjectGraph)(projectGraph);
5111
+ if (!projectConfigurations?.projects?.[projectName]) {
5112
+ throw new Error(
5113
+ "The Build process failed because the project does not have a valid configuration in the project.json file. Check if the file exists in the root of the project."
5114
+ );
5115
+ }
5116
+ const options2 = (0, import_defu5.default)(userOptions, DEFAULT_BUILD_OPTIONS);
5117
+ options2.name ??= projectName;
5118
+ const packageJsonPath = joinPaths2(
5119
+ workspaceRoot.dir,
5120
+ options2.projectRoot,
5121
+ "package.json"
5122
+ );
5123
+ if (!(0, import_node_fs10.existsSync)(packageJsonPath)) {
5124
+ throw new Error("Cannot find package.json configuration");
5125
+ }
5126
+ const env = getEnv("esbuild", options2);
5127
+ const define = (0, import_defu5.default)(options2.define ?? {}, env ?? {});
5128
+ const resolvedOptions = {
5129
+ name: projectName,
5130
+ entry: [joinPaths2(workspaceRoot.dir, projectRoot, "src/index.ts")],
5131
+ clean: true,
5132
+ ...options2,
5133
+ outDir: options2.outputPath || joinPaths2(workspaceConfig.workspaceRoot, "dist", options2.projectRoot),
5134
+ tsconfig: userOptions.tsconfig === null ? void 0 : userOptions.tsconfig ? userOptions.tsconfig : joinPaths2(workspaceRoot.dir, projectRoot, "tsconfig.json"),
5135
+ env,
5136
+ define: {
5137
+ STORM_FORMAT: JSON.stringify(options2.format),
5138
+ ...Object.keys(define).filter((key) => define[key] !== void 0).reduce((res, key) => {
5139
+ const value = JSON.stringify(define[key]);
5140
+ const safeKey = key.replaceAll("(", "").replaceAll(")", "");
5141
+ return {
5142
+ ...res,
5143
+ [`process.env.${safeKey}`]: value,
5144
+ [`import.meta.env.${safeKey}`]: value
5145
+ };
5146
+ }, {})
5147
+ }
5148
+ };
5149
+ stopwatch();
5150
+ if (options2.verbose) {
5151
+ writeDebug(
5152
+ ` \u2699\uFE0F Build options resolved:
5153
+
5154
+ ${formatLogMessage(resolvedOptions)}`,
5155
+ workspaceConfig
5156
+ );
5157
+ }
5158
+ return resolvedOptions;
5159
+ }
5160
+
5161
+ // src/index.ts
2984
5162
  async function build(options2) {
2985
5163
  writeDebug(
2986
5164
  ` \u{1F680} Running ${options2.name || "tsup"} build`,
@@ -2992,5 +5170,7 @@ async function build(options2) {
2992
5170
  }
2993
5171
  // Annotate the CommonJS export names for ESM import in node:
2994
5172
  0 && (module.exports = {
2995
- build
5173
+ DEFAULT_BUILD_OPTIONS,
5174
+ build,
5175
+ resolveOptions
2996
5176
  });