@storm-software/cloudflare-tools 0.54.2 → 0.54.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +1 -1
  3. package/dist/{chunk-KVL4WOIH.mjs → chunk-23YXGFBU.mjs} +1 -1
  4. package/dist/{chunk-UJORUWGK.mjs → chunk-2XNO3U7C.mjs} +5 -5
  5. package/dist/{chunk-H63GI4CR.js → chunk-BM5BCBD5.js} +3 -3
  6. package/dist/{chunk-CU5DCV52.mjs → chunk-CXOUHOZ7.mjs} +9 -9
  7. package/dist/{chunk-THKJZT32.js → chunk-DFG3KJWS.js} +119 -70
  8. package/dist/{chunk-6H63LE3D.mjs → chunk-DQHMNZ47.mjs} +88 -39
  9. package/dist/{chunk-6OLSW63F.mjs → chunk-EZCE5VIE.mjs} +1 -1
  10. package/dist/{chunk-W6YNIJQD.js → chunk-ILLCSSWN.js} +20 -17
  11. package/dist/{chunk-3D3WO4IH.mjs → chunk-IXEWBCGZ.mjs} +17 -14
  12. package/dist/{chunk-ZPVFJJMY.js → chunk-LOFONHDQ.js} +12 -12
  13. package/dist/{chunk-H43VNU3H.js → chunk-LW7DSVEL.js} +159 -159
  14. package/dist/{chunk-U6QKP7CG.js → chunk-LXXVBXFM.js} +16 -16
  15. package/dist/{chunk-WL2BHAOY.js → chunk-NVFBJS7C.js} +1 -1
  16. package/dist/{chunk-BGWUN6JU.mjs → chunk-XIDK2YZE.mjs} +5 -5
  17. package/dist/executors.js +5 -5
  18. package/dist/executors.mjs +5 -5
  19. package/dist/generators.js +5 -5
  20. package/dist/generators.mjs +4 -4
  21. package/dist/index.js +8 -8
  22. package/dist/index.mjs +7 -7
  23. package/dist/src/executors/cloudflare-publish/executor.js +3 -3
  24. package/dist/src/executors/cloudflare-publish/executor.mjs +3 -3
  25. package/dist/src/executors/r2-upload-publish/executor.js +5 -5
  26. package/dist/src/executors/r2-upload-publish/executor.mjs +4 -4
  27. package/dist/src/executors/serve/executor.d.mts +3 -3
  28. package/dist/src/executors/serve/executor.d.ts +3 -3
  29. package/dist/src/executors/serve/executor.js +4 -4
  30. package/dist/src/executors/serve/executor.mjs +3 -3
  31. package/dist/src/generators/init/generator.js +2 -2
  32. package/dist/src/generators/init/generator.mjs +1 -1
  33. package/dist/src/generators/worker/generator.js +5 -5
  34. package/dist/src/generators/worker/generator.mjs +4 -4
  35. package/dist/src/utils/index.js +3 -3
  36. package/dist/src/utils/index.mjs +2 -2
  37. package/dist/src/utils/r2-bucket-helpers.js +3 -3
  38. package/dist/src/utils/r2-bucket-helpers.mjs +2 -2
  39. package/package.json +1 -1
@@ -4,6 +4,7 @@ import {
4
4
  STORM_DEFAULT_DOCS,
5
5
  STORM_DEFAULT_HOMEPAGE,
6
6
  STORM_DEFAULT_LICENSING,
7
+ StormConfigSchema,
7
8
  correctPaths,
8
9
  findWorkspaceRoot,
9
10
  formatLogMessage,
@@ -11,10 +12,9 @@ import {
11
12
  getLogLevel,
12
13
  getLogLevelLabel,
13
14
  joinPaths,
14
- writeSystem,
15
15
  writeTrace,
16
16
  writeWarning
17
- } from "./chunk-3D3WO4IH.mjs";
17
+ } from "./chunk-IXEWBCGZ.mjs";
18
18
  import {
19
19
  __name
20
20
  } from "./chunk-A7FFSBE6.mjs";
@@ -27,19 +27,19 @@ import { loadConfig } from "c12";
27
27
  import defu from "defu";
28
28
  var getConfigFileByName = /* @__PURE__ */ __name(async (fileName, filePath, options = {}) => {
29
29
  const workspacePath = filePath || findWorkspaceRoot(filePath);
30
- let config = await loadConfig({
31
- cwd: workspacePath,
32
- packageJson: true,
33
- name: fileName,
34
- envName: fileName?.toUpperCase(),
35
- jitiOptions: {
36
- debug: false,
37
- fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(process.env.STORM_CACHE_DIR || "node_modules/.cache/storm", "jiti")
38
- },
39
- ...options
40
- });
41
- if (!config || Object.keys(config).length === 0) {
42
- config = await loadConfig({
30
+ const configs = await Promise.all([
31
+ loadConfig({
32
+ cwd: workspacePath,
33
+ packageJson: true,
34
+ name: fileName,
35
+ envName: fileName?.toUpperCase(),
36
+ jitiOptions: {
37
+ debug: false,
38
+ fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(process.env.STORM_CACHE_DIR || "node_modules/.cache/storm", "jiti")
39
+ },
40
+ ...options
41
+ }),
42
+ loadConfig({
43
43
  cwd: workspacePath,
44
44
  packageJson: true,
45
45
  name: fileName,
@@ -50,9 +50,9 @@ var getConfigFileByName = /* @__PURE__ */ __name(async (fileName, filePath, opti
50
50
  },
51
51
  configFile: fileName,
52
52
  ...options
53
- });
54
- }
55
- return config;
53
+ })
54
+ ]);
55
+ return defu(configs[0] ?? {}, configs[1] ?? {});
56
56
  }, "getConfigFileByName");
57
57
  var getConfigFile = /* @__PURE__ */ __name(async (filePath, additionalFileNames = []) => {
58
58
  const workspacePath = filePath ? filePath : findWorkspaceRoot(filePath);
@@ -60,7 +60,7 @@ var getConfigFile = /* @__PURE__ */ __name(async (filePath, additionalFileNames
60
60
  let config = result.config;
61
61
  const configFile = result.configFile;
62
62
  if (config && configFile && Object.keys(config).length > 0) {
63
- writeSystem(`Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`, {
63
+ writeTrace(`Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`, {
64
64
  logLevel: "all"
65
65
  });
66
66
  }
@@ -68,7 +68,7 @@ var getConfigFile = /* @__PURE__ */ __name(async (filePath, additionalFileNames
68
68
  const results = await Promise.all(additionalFileNames.map((fileName) => getConfigFileByName(fileName, workspacePath)));
69
69
  for (const result2 of results) {
70
70
  if (result2?.config && result2?.configFile && Object.keys(result2.config).length > 0) {
71
- writeSystem(`Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`, {
71
+ writeTrace(`Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`, {
72
72
  logLevel: "all"
73
73
  });
74
74
  config = defu(result2.config ?? {}, config ?? {});
@@ -83,6 +83,16 @@ var getConfigFile = /* @__PURE__ */ __name(async (filePath, additionalFileNames
83
83
  }, "getConfigFile");
84
84
 
85
85
  // ../config-tools/src/env/get-env.ts
86
+ var getExtensionEnv = /* @__PURE__ */ __name((extensionName) => {
87
+ const prefix = `STORM_EXTENSION_${extensionName.toUpperCase()}_`;
88
+ return Object.keys(process.env).filter((key) => key.startsWith(prefix)).reduce((ret, key) => {
89
+ const name = key.replace(prefix, "").split("_").map((i) => i.length > 0 ? i.trim().charAt(0).toUpperCase() + i.trim().slice(1) : "").join("");
90
+ if (name) {
91
+ ret[name] = process.env[key];
92
+ }
93
+ return ret;
94
+ }, {});
95
+ }, "getExtensionEnv");
86
96
  var getConfigEnv = /* @__PURE__ */ __name(() => {
87
97
  const prefix = "STORM_";
88
98
  let config = {
@@ -242,7 +252,7 @@ var setExtensionEnv = /* @__PURE__ */ __name((extensionName, extension) => {
242
252
  var setConfigEnv = /* @__PURE__ */ __name((config) => {
243
253
  const prefix = "STORM_";
244
254
  if (config.extends) {
245
- process.env[`${prefix}EXTENDS`] = config.extends;
255
+ process.env[`${prefix}EXTENDS`] = Array.isArray(config.extends) ? JSON.stringify(config.extends) : config.extends;
246
256
  }
247
257
  if (config.name) {
248
258
  process.env[`${prefix}NAME`] = config.name;
@@ -472,30 +482,69 @@ var setBaseThemeColorConfigEnv = /* @__PURE__ */ __name((prefix, config) => {
472
482
  }, "setBaseThemeColorConfigEnv");
473
483
 
474
484
  // ../config-tools/src/create-storm-config.ts
485
+ var _extension_cache = /* @__PURE__ */ new WeakMap();
475
486
  var _static_cache = void 0;
476
- var loadStormConfig = /* @__PURE__ */ __name(async (workspaceRoot) => {
477
- let config = {};
478
- if (_static_cache?.data && _static_cache?.timestamp && _static_cache.timestamp >= Date.now() + 3e4) {
479
- writeTrace(`Configuration cache hit - ${_static_cache.timestamp}`, _static_cache.data);
480
- return _static_cache.data;
481
- }
482
- let _workspaceRoot = workspaceRoot;
483
- if (!_workspaceRoot) {
484
- _workspaceRoot = findWorkspaceRoot();
485
- }
486
- const configFile = await getConfigFile(_workspaceRoot);
487
- if (!configFile) {
488
- writeWarning("No Storm config file found in the current workspace. Please ensure this is the expected behavior - you can add a `storm.json` file to the root of your workspace if it is not.\n", {
489
- logLevel: "all"
490
- });
487
+ var createStormConfig = /* @__PURE__ */ __name(async (extensionName, schema, workspaceRoot, skipLogs = false) => {
488
+ let result;
489
+ if (!_static_cache?.data || !_static_cache?.timestamp || _static_cache.timestamp < Date.now() - 8e3) {
490
+ let _workspaceRoot = workspaceRoot;
491
+ if (!_workspaceRoot) {
492
+ _workspaceRoot = findWorkspaceRoot();
493
+ }
494
+ const configEnv = getConfigEnv();
495
+ const defaultConfig = await getDefaultConfig(_workspaceRoot);
496
+ const configFile = await getConfigFile(_workspaceRoot);
497
+ if (!configFile && !skipLogs) {
498
+ writeWarning("No Storm config file found in the current workspace. Please ensure this is the expected behavior - you can add a `storm.json` file to the root of your workspace if it is not.\n", {
499
+ logLevel: "all"
500
+ });
501
+ }
502
+ result = await StormConfigSchema.parseAsync(defu2(configEnv, configFile, defaultConfig));
503
+ result.workspaceRoot ??= _workspaceRoot;
504
+ } else {
505
+ result = _static_cache.data;
491
506
  }
492
- config = defu2(getConfigEnv(), configFile, getDefaultConfig(_workspaceRoot));
507
+ if (schema && extensionName) {
508
+ result.extensions = {
509
+ ...result.extensions,
510
+ [extensionName]: createConfigExtension(extensionName, schema)
511
+ };
512
+ }
513
+ _static_cache = {
514
+ timestamp: Date.now(),
515
+ data: result
516
+ };
517
+ return result;
518
+ }, "createStormConfig");
519
+ var createConfigExtension = /* @__PURE__ */ __name((extensionName, schema) => {
520
+ const extension_cache_key = {
521
+ extensionName
522
+ };
523
+ if (_extension_cache.has(extension_cache_key)) {
524
+ return _extension_cache.get(extension_cache_key);
525
+ }
526
+ let extension = getExtensionEnv(extensionName);
527
+ if (schema) {
528
+ extension = schema.parse(extension);
529
+ }
530
+ _extension_cache.set(extension_cache_key, extension);
531
+ return extension;
532
+ }, "createConfigExtension");
533
+ var loadStormConfig = /* @__PURE__ */ __name(async (workspaceRoot, skipLogs = false) => {
534
+ const config = await createStormConfig(void 0, void 0, workspaceRoot, skipLogs);
493
535
  setConfigEnv(config);
494
- writeTrace(`\u2699\uFE0F Using Storm configuration:
536
+ if (!skipLogs) {
537
+ writeTrace(`\u2699\uFE0F Using Storm configuration:
495
538
  ${formatLogMessage(config)}`, config);
539
+ }
496
540
  return config;
497
541
  }, "loadStormConfig");
498
542
 
543
+ // ../config-tools/src/get-config.ts
544
+ var getConfig = /* @__PURE__ */ __name((workspaceRoot, skipLogs = false) => {
545
+ return loadStormConfig(workspaceRoot, skipLogs);
546
+ }, "getConfig");
547
+
499
548
  export {
500
- loadStormConfig
549
+ getConfig
501
550
  };
@@ -8,7 +8,7 @@ var require_package = __commonJS({
8
8
  "package.json"(exports, module) {
9
9
  module.exports = {
10
10
  name: "@storm-software/cloudflare-tools",
11
- version: "0.54.2",
11
+ version: "0.54.3",
12
12
  description: "A Nx plugin package that contains various executors, generators, and utilities that assist in managing Cloudflare services.",
13
13
  repository: {
14
14
  type: "github",
@@ -205,6 +205,8 @@ var ColorConfigMapSchema = _zod2.default.union([
205
205
  }),
206
206
  _zod2.default.record(_zod2.default.string(), ColorConfigSchema)
207
207
  ]);
208
+ var ExtendsItemSchema = _zod2.default.string().trim().describe("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.");
209
+ var ExtendsSchema = ExtendsItemSchema.or(_zod2.default.array(ExtendsItemSchema)).describe("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.");
208
210
  var WorkspaceBotConfigSchema = _zod2.default.object({
209
211
  name: _zod2.default.string().trim().default("Stormie-Bot").describe("The workspace bot user's name (this is the bot that will be used to perform various tasks)"),
210
212
  email: _zod2.default.string().trim().email().default("bot@stormsoftware.com").describe("The email of the workspace bot")
@@ -219,11 +221,11 @@ var WorkspaceDirectoryConfigSchema = _zod2.default.object({
219
221
  }).describe("Various directories used by the workspace to store data, cache, and configuration files");
220
222
  var StormConfigSchema = _zod2.default.object({
221
223
  $schema: _zod2.default.string().trim().default("https://cdn.jsdelivr.net/npm/@storm-software/config/schemas/storm.schema.json").optional().nullish().describe("The URL to the JSON schema file that describes the Storm configuration file"),
222
- extends: _zod2.default.string().trim().optional().describe("The path to a base JSON file to use as a configuration preset file"),
224
+ extends: ExtendsSchema.optional(),
223
225
  name: _zod2.default.string().trim().toLowerCase().optional().describe("The name of the service/package/scope using this configuration"),
224
226
  namespace: _zod2.default.string().trim().toLowerCase().optional().describe("The namespace of the package"),
225
227
  organization: _zod2.default.string().trim().default("storm-software").describe("The organization of the workspace"),
226
- repository: _zod2.default.string().trim().url().optional().describe("The repo URL of the workspace (i.e. GitHub)"),
228
+ repository: _zod2.default.string().trim().optional().describe("The repo URL of the workspace (i.e. GitHub)"),
227
229
  license: _zod2.default.string().trim().default("Apache-2.0").describe("The license type of the package"),
228
230
  homepage: _zod2.default.string().trim().url().default(STORM_DEFAULT_HOMEPAGE).describe("The homepage of the workspace"),
229
231
  docs: _zod2.default.string().trim().url().default(STORM_DEFAULT_DOCS).describe("The base documentation site for the workspace"),
@@ -287,6 +289,7 @@ var COLOR_KEYS = [
287
289
 
288
290
  // ../config-tools/src/utilities/get-default-config.ts
289
291
 
292
+ var _promises = require('fs/promises');
290
293
 
291
294
  var DEFAULT_COLOR_CONFIG = {
292
295
  "light": {
@@ -316,17 +319,15 @@ var DEFAULT_COLOR_CONFIG = {
316
319
  "negative": "#dc2626"
317
320
  }
318
321
  };
319
- var getDefaultConfig = /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, (root) => {
322
+ var getDefaultConfig = /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, async (root) => {
320
323
  let license = STORM_DEFAULT_LICENSE;
321
324
  let homepage = STORM_DEFAULT_HOMEPAGE;
322
- let name;
323
- let namespace;
324
- let repository;
325
+ let name = void 0;
326
+ let namespace = void 0;
327
+ let repository = void 0;
325
328
  const workspaceRoot = findWorkspaceRoot(root);
326
329
  if (_fs.existsSync.call(void 0, _path.join.call(void 0, workspaceRoot, "package.json"))) {
327
- const file = _fs.readFileSync.call(void 0, _path.join.call(void 0, workspaceRoot, "package.json"), {
328
- encoding: "utf8"
329
- });
330
+ const file = await _promises.readFile.call(void 0, joinPaths(workspaceRoot, "package.json"), "utf8");
330
331
  if (file) {
331
332
  const packageJson = JSON.parse(file);
332
333
  if (packageJson.name) {
@@ -335,8 +336,12 @@ var getDefaultConfig = /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, (roo
335
336
  if (packageJson.namespace) {
336
337
  namespace = packageJson.namespace;
337
338
  }
338
- if (_optionalChain([packageJson, 'access', _2 => _2.repository, 'optionalAccess', _3 => _3.url])) {
339
- repository = _optionalChain([packageJson, 'access', _4 => _4.repository, 'optionalAccess', _5 => _5.url]);
339
+ if (packageJson.repository) {
340
+ if (typeof packageJson.repository === "string") {
341
+ repository = packageJson.repository;
342
+ } else if (packageJson.repository.url) {
343
+ repository = packageJson.repository.url;
344
+ }
340
345
  }
341
346
  if (packageJson.license) {
342
347
  license = packageJson.license;
@@ -381,7 +386,7 @@ var chalkDefault = {
381
386
  };
382
387
  var getChalk = /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, () => {
383
388
  let _chalk = _chalk3.default;
384
- if (!_optionalChain([_chalk, 'optionalAccess', _6 => _6.hex]) || !_optionalChain([_chalk, 'optionalAccess', _7 => _7.bold, 'optionalAccess', _8 => _8.hex]) || !_optionalChain([_chalk, 'optionalAccess', _9 => _9.bgHex]) || !_optionalChain([_chalk, 'optionalAccess', _10 => _10.whiteBright])) {
389
+ if (!_optionalChain([_chalk, 'optionalAccess', _2 => _2.hex]) || !_optionalChain([_chalk, 'optionalAccess', _3 => _3.bold, 'optionalAccess', _4 => _4.hex]) || !_optionalChain([_chalk, 'optionalAccess', _5 => _5.bgHex]) || !_optionalChain([_chalk, 'optionalAccess', _6 => _6.whiteBright])) {
385
390
  _chalk = chalkDefault;
386
391
  }
387
392
  return _chalk;
@@ -477,7 +482,7 @@ var isVerbose = /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, (label = Lo
477
482
 
478
483
  // ../config-tools/src/logger/console.ts
479
484
  var getLogFn = /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, (logLevel = LogLevel.INFO, config = {}, _chalk = getChalk()) => {
480
- const colors = !_optionalChain([config, 'access', _11 => _11.colors, 'optionalAccess', _12 => _12.dark]) && !_optionalChain([config, 'access', _13 => _13.colors, 'optionalAccess', _14 => _14["base"]]) && !_optionalChain([config, 'access', _15 => _15.colors, 'optionalAccess', _16 => _16["base"], 'optionalAccess', _17 => _17.dark]) ? DEFAULT_COLOR_CONFIG : _optionalChain([config, 'access', _18 => _18.colors, 'optionalAccess', _19 => _19.dark]) && typeof config.colors.dark === "string" ? config.colors : _optionalChain([config, 'access', _20 => _20.colors, 'optionalAccess', _21 => _21["base"], 'optionalAccess', _22 => _22.dark]) && typeof config.colors["base"].dark === "string" ? config.colors["base"].dark : _optionalChain([config, 'access', _23 => _23.colors, 'optionalAccess', _24 => _24["base"]]) ? _optionalChain([config, 'access', _25 => _25.colors, 'optionalAccess', _26 => _26["base"]]) : DEFAULT_COLOR_CONFIG;
485
+ const colors = !_optionalChain([config, 'access', _7 => _7.colors, 'optionalAccess', _8 => _8.dark]) && !_optionalChain([config, 'access', _9 => _9.colors, 'optionalAccess', _10 => _10["base"]]) && !_optionalChain([config, 'access', _11 => _11.colors, 'optionalAccess', _12 => _12["base"], 'optionalAccess', _13 => _13.dark]) ? DEFAULT_COLOR_CONFIG : _optionalChain([config, 'access', _14 => _14.colors, 'optionalAccess', _15 => _15.dark]) && typeof config.colors.dark === "string" ? config.colors : _optionalChain([config, 'access', _16 => _16.colors, 'optionalAccess', _17 => _17["base"], 'optionalAccess', _18 => _18.dark]) && typeof config.colors["base"].dark === "string" ? config.colors["base"].dark : _optionalChain([config, 'access', _19 => _19.colors, 'optionalAccess', _20 => _20["base"]]) ? _optionalChain([config, 'access', _21 => _21.colors, 'optionalAccess', _22 => _22["base"]]) : DEFAULT_COLOR_CONFIG;
481
486
  const configLogLevel = config.logLevel || process.env.STORM_LOG_LEVEL || LogLevelLabel.INFO;
482
487
  if (logLevel > getLogLevel(configLogLevel) || logLevel <= LogLevel.SILENT || getLogLevel(configLogLevel) <= LogLevel.SILENT) {
483
488
  return (_) => {
@@ -545,7 +550,6 @@ var writeInfo = /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, (message, c
545
550
  var writeSuccess = /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, (message, config) => getLogFn(LogLevel.SUCCESS, config)(message), "writeSuccess");
546
551
  var writeDebug = /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, (message, config) => getLogFn(LogLevel.DEBUG, config)(message), "writeDebug");
547
552
  var writeTrace = /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, (message, config) => getLogFn(LogLevel.TRACE, config)(message), "writeTrace");
548
- var writeSystem = /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, (message, config) => getLogFn(LogLevel.ALL, config)(message), "writeSystem");
549
553
  var getStopwatch = /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, (name) => {
550
554
  const start = process.hrtime();
551
555
  return () => {
@@ -575,7 +579,7 @@ ${Object.keys(message).filter((key) => !skip.includes(key)).map((key) => ` ${pre
575
579
  }, "formatLogMessage");
576
580
  var _isFunction = /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, (value) => {
577
581
  try {
578
- return value instanceof Function || typeof value === "function" || !!(_optionalChain([value, 'optionalAccess', _27 => _27.constructor]) && _optionalChain([value, 'optionalAccess', _28 => _28.call]) && _optionalChain([value, 'optionalAccess', _29 => _29.apply]));
582
+ return value instanceof Function || typeof value === "function" || !!(_optionalChain([value, 'optionalAccess', _23 => _23.constructor]) && _optionalChain([value, 'optionalAccess', _24 => _24.call]) && _optionalChain([value, 'optionalAccess', _25 => _25.apply]));
579
583
  } catch (e) {
580
584
  return false;
581
585
  }
@@ -604,5 +608,4 @@ var _isFunction = /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, (value) =
604
608
 
605
609
 
606
610
 
607
-
608
- exports.LogLevel = LogLevel; exports.STORM_DEFAULT_DOCS = STORM_DEFAULT_DOCS; exports.STORM_DEFAULT_HOMEPAGE = STORM_DEFAULT_HOMEPAGE; exports.STORM_DEFAULT_LICENSING = STORM_DEFAULT_LICENSING; exports.StormConfigSchema = StormConfigSchema; exports.COLOR_KEYS = COLOR_KEYS; exports.correctPaths = correctPaths; exports.joinPaths = joinPaths; exports.findWorkspaceRoot = findWorkspaceRoot; exports.getDefaultConfig = getDefaultConfig; exports.getLogLevel = getLogLevel; exports.getLogLevelLabel = getLogLevelLabel; exports.isVerbose = isVerbose; exports.writeFatal = writeFatal; exports.writeError = writeError; exports.writeWarning = writeWarning; exports.writeInfo = writeInfo; exports.writeSuccess = writeSuccess; exports.writeDebug = writeDebug; exports.writeTrace = writeTrace; exports.writeSystem = writeSystem; exports.getStopwatch = getStopwatch; exports.formatLogMessage = formatLogMessage;
611
+ exports.LogLevel = LogLevel; exports.STORM_DEFAULT_DOCS = STORM_DEFAULT_DOCS; exports.STORM_DEFAULT_HOMEPAGE = STORM_DEFAULT_HOMEPAGE; exports.STORM_DEFAULT_LICENSING = STORM_DEFAULT_LICENSING; exports.StormConfigSchema = StormConfigSchema; exports.COLOR_KEYS = COLOR_KEYS; exports.correctPaths = correctPaths; exports.joinPaths = joinPaths; exports.findWorkspaceRoot = findWorkspaceRoot; exports.getDefaultConfig = getDefaultConfig; exports.getLogLevel = getLogLevel; exports.getLogLevelLabel = getLogLevelLabel; exports.isVerbose = isVerbose; exports.writeFatal = writeFatal; exports.writeError = writeError; exports.writeWarning = writeWarning; exports.writeInfo = writeInfo; exports.writeSuccess = writeSuccess; exports.writeDebug = writeDebug; exports.writeTrace = writeTrace; exports.getStopwatch = getStopwatch; exports.formatLogMessage = formatLogMessage;
@@ -205,6 +205,8 @@ var ColorConfigMapSchema = z.union([
205
205
  }),
206
206
  z.record(z.string(), ColorConfigSchema)
207
207
  ]);
208
+ var ExtendsItemSchema = z.string().trim().describe("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.");
209
+ var ExtendsSchema = ExtendsItemSchema.or(z.array(ExtendsItemSchema)).describe("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.");
208
210
  var WorkspaceBotConfigSchema = z.object({
209
211
  name: z.string().trim().default("Stormie-Bot").describe("The workspace bot user's name (this is the bot that will be used to perform various tasks)"),
210
212
  email: z.string().trim().email().default("bot@stormsoftware.com").describe("The email of the workspace bot")
@@ -219,11 +221,11 @@ var WorkspaceDirectoryConfigSchema = z.object({
219
221
  }).describe("Various directories used by the workspace to store data, cache, and configuration files");
220
222
  var StormConfigSchema = z.object({
221
223
  $schema: z.string().trim().default("https://cdn.jsdelivr.net/npm/@storm-software/config/schemas/storm.schema.json").optional().nullish().describe("The URL to the JSON schema file that describes the Storm configuration file"),
222
- extends: z.string().trim().optional().describe("The path to a base JSON file to use as a configuration preset file"),
224
+ extends: ExtendsSchema.optional(),
223
225
  name: z.string().trim().toLowerCase().optional().describe("The name of the service/package/scope using this configuration"),
224
226
  namespace: z.string().trim().toLowerCase().optional().describe("The namespace of the package"),
225
227
  organization: z.string().trim().default("storm-software").describe("The organization of the workspace"),
226
- repository: z.string().trim().url().optional().describe("The repo URL of the workspace (i.e. GitHub)"),
228
+ repository: z.string().trim().optional().describe("The repo URL of the workspace (i.e. GitHub)"),
227
229
  license: z.string().trim().default("Apache-2.0").describe("The license type of the package"),
228
230
  homepage: z.string().trim().url().default(STORM_DEFAULT_HOMEPAGE).describe("The homepage of the workspace"),
229
231
  docs: z.string().trim().url().default(STORM_DEFAULT_DOCS).describe("The base documentation site for the workspace"),
@@ -286,7 +288,8 @@ var COLOR_KEYS = [
286
288
  ];
287
289
 
288
290
  // ../config-tools/src/utilities/get-default-config.ts
289
- import { existsSync as existsSync2, readFileSync } from "node:fs";
291
+ import { existsSync as existsSync2 } from "node:fs";
292
+ import { readFile } from "node:fs/promises";
290
293
  import { join as join2 } from "node:path";
291
294
  var DEFAULT_COLOR_CONFIG = {
292
295
  "light": {
@@ -316,17 +319,15 @@ var DEFAULT_COLOR_CONFIG = {
316
319
  "negative": "#dc2626"
317
320
  }
318
321
  };
319
- var getDefaultConfig = /* @__PURE__ */ __name((root) => {
322
+ var getDefaultConfig = /* @__PURE__ */ __name(async (root) => {
320
323
  let license = STORM_DEFAULT_LICENSE;
321
324
  let homepage = STORM_DEFAULT_HOMEPAGE;
322
- let name;
323
- let namespace;
324
- let repository;
325
+ let name = void 0;
326
+ let namespace = void 0;
327
+ let repository = void 0;
325
328
  const workspaceRoot = findWorkspaceRoot(root);
326
329
  if (existsSync2(join2(workspaceRoot, "package.json"))) {
327
- const file = readFileSync(join2(workspaceRoot, "package.json"), {
328
- encoding: "utf8"
329
- });
330
+ const file = await readFile(joinPaths(workspaceRoot, "package.json"), "utf8");
330
331
  if (file) {
331
332
  const packageJson = JSON.parse(file);
332
333
  if (packageJson.name) {
@@ -335,8 +336,12 @@ var getDefaultConfig = /* @__PURE__ */ __name((root) => {
335
336
  if (packageJson.namespace) {
336
337
  namespace = packageJson.namespace;
337
338
  }
338
- if (packageJson.repository?.url) {
339
- repository = packageJson.repository?.url;
339
+ if (packageJson.repository) {
340
+ if (typeof packageJson.repository === "string") {
341
+ repository = packageJson.repository;
342
+ } else if (packageJson.repository.url) {
343
+ repository = packageJson.repository.url;
344
+ }
340
345
  }
341
346
  if (packageJson.license) {
342
347
  license = packageJson.license;
@@ -545,7 +550,6 @@ var writeInfo = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.IN
545
550
  var writeSuccess = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.SUCCESS, config)(message), "writeSuccess");
546
551
  var writeDebug = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.DEBUG, config)(message), "writeDebug");
547
552
  var writeTrace = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.TRACE, config)(message), "writeTrace");
548
- var writeSystem = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.ALL, config)(message), "writeSystem");
549
553
  var getStopwatch = /* @__PURE__ */ __name((name) => {
550
554
  const start = process.hrtime();
551
555
  return () => {
@@ -602,7 +606,6 @@ export {
602
606
  writeSuccess,
603
607
  writeDebug,
604
608
  writeTrace,
605
- writeSystem,
606
609
  getStopwatch,
607
610
  formatLogMessage
608
611
  };
@@ -1,9 +1,9 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var _chunkWL2BHAOYjs = require('./chunk-WL2BHAOY.js');
3
+ var _chunkNVFBJS7Cjs = require('./chunk-NVFBJS7C.js');
4
4
 
5
5
 
6
- var _chunkTHKJZT32js = require('./chunk-THKJZT32.js');
6
+ var _chunkDFG3KJWSjs = require('./chunk-DFG3KJWS.js');
7
7
 
8
8
 
9
9
 
@@ -12,7 +12,7 @@ var _chunkTHKJZT32js = require('./chunk-THKJZT32.js');
12
12
 
13
13
 
14
14
 
15
- var _chunkW6YNIJQDjs = require('./chunk-W6YNIJQD.js');
15
+ var _chunkILLCSSWNjs = require('./chunk-ILLCSSWN.js');
16
16
 
17
17
 
18
18
  var _chunkJ5SB6L2Ljs = require('./chunk-J5SB6L2L.js');
@@ -38,21 +38,21 @@ var vitestScript = `"test": "vitest run"`;
38
38
 
39
39
  // src/generators/worker/generator.ts
40
40
  async function applicationGenerator(tree, schema) {
41
- const stopwatch = _chunkW6YNIJQDjs.getStopwatch.call(void 0, "Storm Worker generator");
41
+ const stopwatch = _chunkILLCSSWNjs.getStopwatch.call(void 0, "Storm Worker generator");
42
42
  let config;
43
43
  try {
44
- _chunkW6YNIJQDjs.writeInfo.call(void 0, `\u26A1 Running the Storm Worker generator...
44
+ _chunkILLCSSWNjs.writeInfo.call(void 0, `\u26A1 Running the Storm Worker generator...
45
45
 
46
46
  `, config);
47
- const workspaceRoot = _chunkW6YNIJQDjs.findWorkspaceRoot.call(void 0, );
48
- _chunkW6YNIJQDjs.writeDebug.call(void 0, `Loading the Storm Config from environment variables and storm.json file...
47
+ const workspaceRoot = _chunkILLCSSWNjs.findWorkspaceRoot.call(void 0, );
48
+ _chunkILLCSSWNjs.writeDebug.call(void 0, `Loading the Storm Config from environment variables and storm.json file...
49
49
  - workspaceRoot: ${workspaceRoot}`, config);
50
- config = await _chunkTHKJZT32js.loadStormConfig.call(void 0, workspaceRoot);
51
- _chunkW6YNIJQDjs.writeTrace.call(void 0, `Loaded Storm config into env:
50
+ config = await _chunkDFG3KJWSjs.getConfig.call(void 0, workspaceRoot);
51
+ _chunkILLCSSWNjs.writeTrace.call(void 0, `Loaded Storm config into env:
52
52
  ${Object.keys(process.env).map((key) => ` - ${key}=${JSON.stringify(process.env[key])}`).join("\n")}`, config);
53
53
  const options = await normalizeOptions(tree, schema, config);
54
54
  const tasks = [];
55
- tasks.push(await _chunkWL2BHAOYjs.generator_default.call(void 0, tree, {
55
+ tasks.push(await _chunkNVFBJS7Cjs.generator_default.call(void 0, tree, {
56
56
  ...options,
57
57
  skipFormat: true
58
58
  }));
@@ -107,8 +107,8 @@ ${Object.keys(process.env).map((key) => ` - ${key}=${JSON.stringify(process.env[
107
107
  return _devkit.runTasksInSerial.call(void 0, ...tasks);
108
108
  } catch (error) {
109
109
  return () => {
110
- _chunkW6YNIJQDjs.writeFatal.call(void 0, "A fatal error occurred while running the generator - the process was forced to terminate", config);
111
- _chunkW6YNIJQDjs.writeError.call(void 0, `An exception was thrown in the generator's process
110
+ _chunkILLCSSWNjs.writeFatal.call(void 0, "A fatal error occurred while running the generator - the process was forced to terminate", config);
111
+ _chunkILLCSSWNjs.writeError.call(void 0, `An exception was thrown in the generator's process
112
112
  - Details: ${error.message}
113
113
  - Stacktrace: ${error.stack}`, config);
114
114
  };