@storm-software/unbuild 0.30.4 → 0.30.6

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.
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  cleanDirectories
3
- } from "./chunk-VC7N2YVM.js";
3
+ } from "./chunk-XGZOR6PZ.js";
4
4
  import {
5
5
  getDefaultBuildPlugins
6
- } from "./chunk-K2D7TQ7G.js";
6
+ } from "./chunk-OAOLAATA.js";
7
7
  import {
8
8
  loadConfig
9
- } from "./chunk-C5IHRWT3.js";
9
+ } from "./chunk-NYVG7QMW.js";
10
10
  import {
11
11
  COLOR_KEYS,
12
12
  LogLevel,
@@ -14,6 +14,7 @@ import {
14
14
  STORM_DEFAULT_DOCS,
15
15
  STORM_DEFAULT_HOMEPAGE,
16
16
  STORM_DEFAULT_LICENSING,
17
+ StormConfigSchema,
17
18
  correctPaths,
18
19
  findWorkspaceRoot,
19
20
  formatLogMessage,
@@ -26,10 +27,9 @@ import {
26
27
  writeDebug,
27
28
  writeFatal,
28
29
  writeSuccess,
29
- writeSystem,
30
30
  writeTrace,
31
31
  writeWarning
32
- } from "./chunk-TPFSDZCR.js";
32
+ } from "./chunk-VWXW3RW5.js";
33
33
  import {
34
34
  __name
35
35
  } from "./chunk-3GQAWCBQ.js";
@@ -63,19 +63,19 @@ import { loadConfig as loadConfig2 } from "c12";
63
63
  import defu from "defu";
64
64
  var getConfigFileByName = /* @__PURE__ */ __name(async (fileName, filePath, options = {}) => {
65
65
  const workspacePath = filePath || findWorkspaceRoot(filePath);
66
- let config = await loadConfig2({
67
- cwd: workspacePath,
68
- packageJson: true,
69
- name: fileName,
70
- envName: fileName?.toUpperCase(),
71
- jitiOptions: {
72
- debug: false,
73
- fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(process.env.STORM_CACHE_DIR || "node_modules/.cache/storm", "jiti")
74
- },
75
- ...options
76
- });
77
- if (!config || Object.keys(config).length === 0) {
78
- config = await loadConfig2({
66
+ const configs = await Promise.all([
67
+ loadConfig2({
68
+ cwd: workspacePath,
69
+ packageJson: true,
70
+ name: fileName,
71
+ envName: fileName?.toUpperCase(),
72
+ jitiOptions: {
73
+ debug: false,
74
+ fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(process.env.STORM_CACHE_DIR || "node_modules/.cache/storm", "jiti")
75
+ },
76
+ ...options
77
+ }),
78
+ loadConfig2({
79
79
  cwd: workspacePath,
80
80
  packageJson: true,
81
81
  name: fileName,
@@ -86,9 +86,9 @@ var getConfigFileByName = /* @__PURE__ */ __name(async (fileName, filePath, opti
86
86
  },
87
87
  configFile: fileName,
88
88
  ...options
89
- });
90
- }
91
- return config;
89
+ })
90
+ ]);
91
+ return defu(configs[0] ?? {}, configs[1] ?? {});
92
92
  }, "getConfigFileByName");
93
93
  var getConfigFile = /* @__PURE__ */ __name(async (filePath, additionalFileNames = []) => {
94
94
  const workspacePath = filePath ? filePath : findWorkspaceRoot(filePath);
@@ -96,7 +96,7 @@ var getConfigFile = /* @__PURE__ */ __name(async (filePath, additionalFileNames
96
96
  let config = result.config;
97
97
  const configFile = result.configFile;
98
98
  if (config && configFile && Object.keys(config).length > 0) {
99
- writeSystem(`Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`, {
99
+ writeTrace(`Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`, {
100
100
  logLevel: "all"
101
101
  });
102
102
  }
@@ -104,7 +104,7 @@ var getConfigFile = /* @__PURE__ */ __name(async (filePath, additionalFileNames
104
104
  const results = await Promise.all(additionalFileNames.map((fileName) => getConfigFileByName(fileName, workspacePath)));
105
105
  for (const result2 of results) {
106
106
  if (result2?.config && result2?.configFile && Object.keys(result2.config).length > 0) {
107
- writeSystem(`Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`, {
107
+ writeTrace(`Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`, {
108
108
  logLevel: "all"
109
109
  });
110
110
  config = defu(result2.config ?? {}, config ?? {});
@@ -122,6 +122,16 @@ var getConfigFile = /* @__PURE__ */ __name(async (filePath, additionalFileNames
122
122
  import defu2 from "defu";
123
123
 
124
124
  // ../config-tools/src/env/get-env.ts
125
+ var getExtensionEnv = /* @__PURE__ */ __name((extensionName) => {
126
+ const prefix = `STORM_EXTENSION_${extensionName.toUpperCase()}_`;
127
+ return Object.keys(process.env).filter((key) => key.startsWith(prefix)).reduce((ret, key) => {
128
+ const name = key.replace(prefix, "").split("_").map((i) => i.length > 0 ? i.trim().charAt(0).toUpperCase() + i.trim().slice(1) : "").join("");
129
+ if (name) {
130
+ ret[name] = process.env[key];
131
+ }
132
+ return ret;
133
+ }, {});
134
+ }, "getExtensionEnv");
125
135
  var getConfigEnv = /* @__PURE__ */ __name(() => {
126
136
  const prefix = "STORM_";
127
137
  let config = {
@@ -281,7 +291,7 @@ var setExtensionEnv = /* @__PURE__ */ __name((extensionName, extension) => {
281
291
  var setConfigEnv = /* @__PURE__ */ __name((config) => {
282
292
  const prefix = "STORM_";
283
293
  if (config.extends) {
284
- process.env[`${prefix}EXTENDS`] = config.extends;
294
+ process.env[`${prefix}EXTENDS`] = Array.isArray(config.extends) ? JSON.stringify(config.extends) : config.extends;
285
295
  }
286
296
  if (config.name) {
287
297
  process.env[`${prefix}NAME`] = config.name;
@@ -511,37 +521,76 @@ var setBaseThemeColorConfigEnv = /* @__PURE__ */ __name((prefix, config) => {
511
521
  }, "setBaseThemeColorConfigEnv");
512
522
 
513
523
  // ../config-tools/src/create-storm-config.ts
524
+ var _extension_cache = /* @__PURE__ */ new WeakMap();
514
525
  var _static_cache = void 0;
515
- var loadStormConfig = /* @__PURE__ */ __name(async (workspaceRoot) => {
516
- let config = {};
517
- if (_static_cache?.data && _static_cache?.timestamp && _static_cache.timestamp >= Date.now() + 3e4) {
518
- writeTrace(`Configuration cache hit - ${_static_cache.timestamp}`, _static_cache.data);
519
- return _static_cache.data;
520
- }
521
- let _workspaceRoot = workspaceRoot;
522
- if (!_workspaceRoot) {
523
- _workspaceRoot = findWorkspaceRoot();
524
- }
525
- const configFile = await getConfigFile(_workspaceRoot);
526
- if (!configFile) {
527
- 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", {
528
- logLevel: "all"
529
- });
526
+ var createStormConfig = /* @__PURE__ */ __name(async (extensionName, schema, workspaceRoot, skipLogs = false) => {
527
+ let result;
528
+ if (!_static_cache?.data || !_static_cache?.timestamp || _static_cache.timestamp < Date.now() - 8e3) {
529
+ let _workspaceRoot = workspaceRoot;
530
+ if (!_workspaceRoot) {
531
+ _workspaceRoot = findWorkspaceRoot();
532
+ }
533
+ const configEnv = getConfigEnv();
534
+ const defaultConfig = await getDefaultConfig(_workspaceRoot);
535
+ const configFile = await getConfigFile(_workspaceRoot);
536
+ if (!configFile && !skipLogs) {
537
+ 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", {
538
+ logLevel: "all"
539
+ });
540
+ }
541
+ result = await StormConfigSchema.parseAsync(defu2(configEnv, configFile, defaultConfig));
542
+ result.workspaceRoot ??= _workspaceRoot;
543
+ } else {
544
+ result = _static_cache.data;
530
545
  }
531
- config = defu2(getConfigEnv(), configFile, getDefaultConfig(_workspaceRoot));
546
+ if (schema && extensionName) {
547
+ result.extensions = {
548
+ ...result.extensions,
549
+ [extensionName]: createConfigExtension(extensionName, schema)
550
+ };
551
+ }
552
+ _static_cache = {
553
+ timestamp: Date.now(),
554
+ data: result
555
+ };
556
+ return result;
557
+ }, "createStormConfig");
558
+ var createConfigExtension = /* @__PURE__ */ __name((extensionName, schema) => {
559
+ const extension_cache_key = {
560
+ extensionName
561
+ };
562
+ if (_extension_cache.has(extension_cache_key)) {
563
+ return _extension_cache.get(extension_cache_key);
564
+ }
565
+ let extension = getExtensionEnv(extensionName);
566
+ if (schema) {
567
+ extension = schema.parse(extension);
568
+ }
569
+ _extension_cache.set(extension_cache_key, extension);
570
+ return extension;
571
+ }, "createConfigExtension");
572
+ var loadStormConfig = /* @__PURE__ */ __name(async (workspaceRoot, skipLogs = false) => {
573
+ const config = await createStormConfig(void 0, void 0, workspaceRoot, skipLogs);
532
574
  setConfigEnv(config);
533
- writeTrace(`\u2699\uFE0F Using Storm configuration:
575
+ if (!skipLogs) {
576
+ writeTrace(`\u2699\uFE0F Using Storm configuration:
534
577
  ${formatLogMessage(config)}`, config);
578
+ }
535
579
  return config;
536
580
  }, "loadStormConfig");
537
581
 
582
+ // ../config-tools/src/get-config.ts
583
+ var getConfig = /* @__PURE__ */ __name((workspaceRoot, skipLogs = false) => {
584
+ return loadStormConfig(workspaceRoot, skipLogs);
585
+ }, "getConfig");
586
+
538
587
  // ../build-tools/src/utilities/read-nx-config.ts
539
588
  import { existsSync } from "node:fs";
540
589
  import { readFile } from "node:fs/promises";
541
590
  var readNxConfig = /* @__PURE__ */ __name(async (workspaceRoot) => {
542
591
  let rootDir = workspaceRoot;
543
592
  if (!rootDir) {
544
- const config = await loadStormConfig();
593
+ const config = await getConfig();
545
594
  rootDir = config.workspaceRoot;
546
595
  }
547
596
  const nxJsonPath = joinPaths(rootDir, "nx.json");
@@ -556,7 +605,7 @@ var readNxConfig = /* @__PURE__ */ __name(async (workspaceRoot) => {
556
605
  var copyAssets = /* @__PURE__ */ __name(async (config, assets, outputPath, projectRoot, projectName, sourceRoot, generatePackageJson2 = true, includeSrc = false, banner, footer) => {
557
606
  const pendingAssets = Array.from(assets ?? []);
558
607
  pendingAssets.push({
559
- input: projectRoot,
608
+ input: joinPaths(config.workspaceRoot, projectRoot),
560
609
  glob: "*.md",
561
610
  output: "."
562
611
  });
@@ -2477,7 +2526,7 @@ async function build2(options) {
2477
2526
  if (!workspaceRoot) {
2478
2527
  throw new Error("Cannot find workspace root");
2479
2528
  }
2480
- const config = await loadStormConfig(workspaceRoot.dir);
2529
+ const config = await getConfig(workspaceRoot.dir);
2481
2530
  writeDebug(` \u26A1 Executing Storm Unbuild pipeline`, config);
2482
2531
  const stopwatch = getStopwatch("Unbuild pipeline");
2483
2532
  try {
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
- var _chunkFG6XQ26Mcjs = require('./chunk-FG6XQ26M.cjs');
4
+ var _chunkLXCK6Y4Ccjs = require('./chunk-LXCK6Y4C.cjs');
5
5
 
6
6
 
7
7
  var _chunkYDYGZTJKcjs = require('./chunk-YDYGZTJK.cjs');
@@ -9,8 +9,8 @@ var _chunkYDYGZTJKcjs = require('./chunk-YDYGZTJK.cjs');
9
9
  // src/clean.ts
10
10
  var _promises = require('fs/promises');
11
11
  async function clean(name = "Unbuild", directory, config) {
12
- _chunkFG6XQ26Mcjs.writeDebug.call(void 0, ` \u{1F9F9} Cleaning ${name} output path: ${directory}`, config);
13
- const stopwatch = _chunkFG6XQ26Mcjs.getStopwatch.call(void 0, `${name} output clean`);
12
+ _chunkLXCK6Y4Ccjs.writeDebug.call(void 0, ` \u{1F9F9} Cleaning ${name} output path: ${directory}`, config);
13
+ const stopwatch = _chunkLXCK6Y4Ccjs.getStopwatch.call(void 0, `${name} output clean`);
14
14
  await cleanDirectories(name, directory, config);
15
15
  stopwatch();
16
16
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  writeError
3
- } from "./chunk-TPFSDZCR.js";
3
+ } from "./chunk-VWXW3RW5.js";
4
4
  import {
5
5
  __name
6
6
  } from "./chunk-3GQAWCBQ.js";
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkFG6XQ26Mcjs = require('./chunk-FG6XQ26M.cjs');
3
+ var _chunkLXCK6Y4Ccjs = require('./chunk-LXCK6Y4C.cjs');
4
4
 
5
5
 
6
6
  var _chunkYDYGZTJKcjs = require('./chunk-YDYGZTJK.cjs');
@@ -10,7 +10,7 @@ var onErrorPlugin = /* @__PURE__ */ _chunkYDYGZTJKcjs.__name.call(void 0, (optio
10
10
  name: "storm:on-error",
11
11
  buildEnd(error) {
12
12
  if (error) {
13
- _chunkFG6XQ26Mcjs.writeError.call(void 0, `The following errors occurred during the build:
13
+ _chunkLXCK6Y4Ccjs.writeError.call(void 0, `The following errors occurred during the build:
14
14
  ${error ? error.message : "Unknown build error"}
15
15
 
16
16
  `, resolvedOptions.config);
@@ -18,7 +18,7 @@ ${error ? error.message : "Unknown build error"}
18
18
  }
19
19
  },
20
20
  renderError(error) {
21
- _chunkFG6XQ26Mcjs.writeError.call(void 0, `The following errors occurred during the build:
21
+ _chunkLXCK6Y4Ccjs.writeError.call(void 0, `The following errors occurred during the build:
22
22
  ${error ? error.message : "Unknown build error"}
23
23
 
24
24
  `, resolvedOptions.config);
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkFG6XQ26Mcjs = require('./chunk-FG6XQ26M.cjs');
3
+ var _chunkLXCK6Y4Ccjs = require('./chunk-LXCK6Y4C.cjs');
4
4
 
5
5
 
6
6
  var _chunkYDYGZTJKcjs = require('./chunk-YDYGZTJK.cjs');
@@ -25,7 +25,7 @@ var analyzePlugin = /* @__PURE__ */ _chunkYDYGZTJKcjs.__name.call(void 0, (optio
25
25
  renderChunk(source, chunk) {
26
26
  const sourceBytes = formatBytes(source.length);
27
27
  const fileName = chunk.fileName;
28
- _chunkFG6XQ26Mcjs.writeInfo.call(void 0, ` - ${fileName} ${sourceBytes}`, resolvedOptions.config);
28
+ _chunkLXCK6Y4Ccjs.writeInfo.call(void 0, ` - ${fileName} ${sourceBytes}`, resolvedOptions.config);
29
29
  }
30
30
  };
31
31
  }, "analyzePlugin");
@@ -188,6 +188,8 @@ var ColorConfigMapSchema = _zod2.default.union([
188
188
  }),
189
189
  _zod2.default.record(_zod2.default.string(), ColorConfigSchema)
190
190
  ]);
191
+ 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.");
192
+ 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.");
191
193
  var WorkspaceBotConfigSchema = _zod2.default.object({
192
194
  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)"),
193
195
  email: _zod2.default.string().trim().email().default("bot@stormsoftware.com").describe("The email of the workspace bot")
@@ -202,11 +204,11 @@ var WorkspaceDirectoryConfigSchema = _zod2.default.object({
202
204
  }).describe("Various directories used by the workspace to store data, cache, and configuration files");
203
205
  var StormConfigSchema = _zod2.default.object({
204
206
  $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"),
205
- extends: _zod2.default.string().trim().optional().describe("The path to a base JSON file to use as a configuration preset file"),
207
+ extends: ExtendsSchema.optional(),
206
208
  name: _zod2.default.string().trim().toLowerCase().optional().describe("The name of the service/package/scope using this configuration"),
207
209
  namespace: _zod2.default.string().trim().toLowerCase().optional().describe("The namespace of the package"),
208
210
  organization: _zod2.default.string().trim().default("storm-software").describe("The organization of the workspace"),
209
- repository: _zod2.default.string().trim().url().optional().describe("The repo URL of the workspace (i.e. GitHub)"),
211
+ repository: _zod2.default.string().trim().optional().describe("The repo URL of the workspace (i.e. GitHub)"),
210
212
  license: _zod2.default.string().trim().default("Apache-2.0").describe("The license type of the package"),
211
213
  homepage: _zod2.default.string().trim().url().default(STORM_DEFAULT_HOMEPAGE).describe("The homepage of the workspace"),
212
214
  docs: _zod2.default.string().trim().url().default(STORM_DEFAULT_DOCS).describe("The base documentation site for the workspace"),
@@ -270,6 +272,7 @@ var COLOR_KEYS = [
270
272
 
271
273
  // ../config-tools/src/utilities/get-default-config.ts
272
274
  var _fs = require('fs');
275
+ var _promises = require('fs/promises');
273
276
  var _path = require('path');
274
277
 
275
278
  // ../config-tools/src/utilities/find-up.ts
@@ -373,17 +376,15 @@ var DEFAULT_COLOR_CONFIG = {
373
376
  "negative": "#dc2626"
374
377
  }
375
378
  };
376
- var getDefaultConfig = /* @__PURE__ */ _chunkYDYGZTJKcjs.__name.call(void 0, (root) => {
379
+ var getDefaultConfig = /* @__PURE__ */ _chunkYDYGZTJKcjs.__name.call(void 0, async (root) => {
377
380
  let license = STORM_DEFAULT_LICENSE;
378
381
  let homepage = STORM_DEFAULT_HOMEPAGE;
379
- let name;
380
- let namespace;
381
- let repository;
382
+ let name = void 0;
383
+ let namespace = void 0;
384
+ let repository = void 0;
382
385
  const workspaceRoot = findWorkspaceRoot(root);
383
386
  if (_fs.existsSync.call(void 0, _path.join.call(void 0, workspaceRoot, "package.json"))) {
384
- const file = _fs.readFileSync.call(void 0, _path.join.call(void 0, workspaceRoot, "package.json"), {
385
- encoding: "utf8"
386
- });
387
+ const file = await _promises.readFile.call(void 0, joinPaths(workspaceRoot, "package.json"), "utf8");
387
388
  if (file) {
388
389
  const packageJson = JSON.parse(file);
389
390
  if (packageJson.name) {
@@ -392,8 +393,12 @@ var getDefaultConfig = /* @__PURE__ */ _chunkYDYGZTJKcjs.__name.call(void 0, (ro
392
393
  if (packageJson.namespace) {
393
394
  namespace = packageJson.namespace;
394
395
  }
395
- if (_optionalChain([packageJson, 'access', _2 => _2.repository, 'optionalAccess', _3 => _3.url])) {
396
- repository = _optionalChain([packageJson, 'access', _4 => _4.repository, 'optionalAccess', _5 => _5.url]);
396
+ if (packageJson.repository) {
397
+ if (typeof packageJson.repository === "string") {
398
+ repository = packageJson.repository;
399
+ } else if (packageJson.repository.url) {
400
+ repository = packageJson.repository.url;
401
+ }
397
402
  }
398
403
  if (packageJson.license) {
399
404
  license = packageJson.license;
@@ -438,7 +443,7 @@ var chalkDefault = {
438
443
  };
439
444
  var getChalk = /* @__PURE__ */ _chunkYDYGZTJKcjs.__name.call(void 0, () => {
440
445
  let _chalk = _chalk3.default;
441
- 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])) {
446
+ 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])) {
442
447
  _chalk = chalkDefault;
443
448
  }
444
449
  return _chalk;
@@ -479,7 +484,7 @@ var formatTimestamp = /* @__PURE__ */ _chunkYDYGZTJKcjs.__name.call(void 0, (dat
479
484
 
480
485
  // ../config-tools/src/logger/console.ts
481
486
  var getLogFn = /* @__PURE__ */ _chunkYDYGZTJKcjs.__name.call(void 0, (logLevel = LogLevel.INFO, config = {}, _chalk = getChalk()) => {
482
- 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;
487
+ 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;
483
488
  const configLogLevel = config.logLevel || process.env.STORM_LOG_LEVEL || LogLevelLabel.INFO;
484
489
  if (logLevel > getLogLevel(configLogLevel) || logLevel <= LogLevel.SILENT || getLogLevel(configLogLevel) <= LogLevel.SILENT) {
485
490
  return (_) => {
@@ -547,7 +552,6 @@ var writeInfo = /* @__PURE__ */ _chunkYDYGZTJKcjs.__name.call(void 0, (message,
547
552
  var writeSuccess = /* @__PURE__ */ _chunkYDYGZTJKcjs.__name.call(void 0, (message, config) => getLogFn(LogLevel.SUCCESS, config)(message), "writeSuccess");
548
553
  var writeDebug = /* @__PURE__ */ _chunkYDYGZTJKcjs.__name.call(void 0, (message, config) => getLogFn(LogLevel.DEBUG, config)(message), "writeDebug");
549
554
  var writeTrace = /* @__PURE__ */ _chunkYDYGZTJKcjs.__name.call(void 0, (message, config) => getLogFn(LogLevel.TRACE, config)(message), "writeTrace");
550
- var writeSystem = /* @__PURE__ */ _chunkYDYGZTJKcjs.__name.call(void 0, (message, config) => getLogFn(LogLevel.ALL, config)(message), "writeSystem");
551
555
  var getStopwatch = /* @__PURE__ */ _chunkYDYGZTJKcjs.__name.call(void 0, (name) => {
552
556
  const start = process.hrtime();
553
557
  return () => {
@@ -577,7 +581,7 @@ ${Object.keys(message).filter((key) => !skip.includes(key)).map((key) => ` ${pre
577
581
  }, "formatLogMessage");
578
582
  var _isFunction = /* @__PURE__ */ _chunkYDYGZTJKcjs.__name.call(void 0, (value) => {
579
583
  try {
580
- 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]));
584
+ 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]));
581
585
  } catch (e) {
582
586
  return false;
583
587
  }
@@ -607,4 +611,4 @@ var _isFunction = /* @__PURE__ */ _chunkYDYGZTJKcjs.__name.call(void 0, (value)
607
611
 
608
612
 
609
613
 
610
- exports.LogLevel = LogLevel; exports.LogLevelLabel = LogLevelLabel; exports.STORM_DEFAULT_DOCS = STORM_DEFAULT_DOCS; exports.STORM_DEFAULT_HOMEPAGE = STORM_DEFAULT_HOMEPAGE; exports.STORM_DEFAULT_LICENSING = STORM_DEFAULT_LICENSING; 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;
614
+ exports.LogLevel = LogLevel; exports.LogLevelLabel = LogLevelLabel; 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;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  writeTrace
3
- } from "./chunk-TPFSDZCR.js";
3
+ } from "./chunk-VWXW3RW5.js";
4
4
  import {
5
5
  __name
6
6
  } from "./chunk-3GQAWCBQ.js";
@@ -1,25 +1,25 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkV627S7QUcjs = require('./chunk-V627S7QU.cjs');
3
+ var _chunk26OHEX55cjs = require('./chunk-26OHEX55.cjs');
4
4
 
5
5
 
6
6
  var _chunkSHHAZOHNcjs = require('./chunk-SHHAZOHN.cjs');
7
7
 
8
8
 
9
- var _chunkPSYW5YJBcjs = require('./chunk-PSYW5YJB.cjs');
9
+ var _chunkKDTFDJN3cjs = require('./chunk-KDTFDJN3.cjs');
10
10
 
11
11
 
12
- var _chunkCF2C3GEVcjs = require('./chunk-CF2C3GEV.cjs');
12
+ var _chunkGVX7LSWKcjs = require('./chunk-GVX7LSWK.cjs');
13
13
 
14
14
 
15
15
  var _chunkYDYGZTJKcjs = require('./chunk-YDYGZTJK.cjs');
16
16
 
17
17
  // src/config.ts
18
18
  var getDefaultBuildPlugins = /* @__PURE__ */ _chunkYDYGZTJKcjs.__name.call(void 0, async (options, resolvedOptions) => Promise.all([
19
- _chunkPSYW5YJBcjs.analyzePlugin.call(void 0, options, resolvedOptions),
19
+ _chunkKDTFDJN3cjs.analyzePlugin.call(void 0, options, resolvedOptions),
20
20
  _chunkSHHAZOHNcjs.typeDefinitions.call(void 0, resolvedOptions.projectRoot),
21
- _chunkV627S7QUcjs.tscPlugin.call(void 0, options, resolvedOptions),
22
- _chunkCF2C3GEVcjs.onErrorPlugin.call(void 0, options, resolvedOptions)
21
+ _chunk26OHEX55cjs.tscPlugin.call(void 0, options, resolvedOptions),
22
+ _chunkGVX7LSWKcjs.onErrorPlugin.call(void 0, options, resolvedOptions)
23
23
  ].map((plugin) => Promise.resolve(plugin))), "getDefaultBuildPlugins");
24
24
 
25
25
 
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  tscPlugin
3
- } from "./chunk-C5IHRWT3.js";
3
+ } from "./chunk-NYVG7QMW.js";
4
4
  import {
5
5
  typeDefinitions
6
6
  } from "./chunk-ESRR2FD2.js";
7
7
  import {
8
8
  analyzePlugin
9
- } from "./chunk-KPFCICEG.js";
9
+ } from "./chunk-3Q2ZB7CN.js";
10
10
  import {
11
11
  onErrorPlugin
12
- } from "./chunk-5S4A4OEA.js";
12
+ } from "./chunk-G2BQ6VSR.js";
13
13
  import {
14
14
  __name
15
15
  } from "./chunk-3GQAWCBQ.js";
@@ -188,6 +188,8 @@ var ColorConfigMapSchema = z.union([
188
188
  }),
189
189
  z.record(z.string(), ColorConfigSchema)
190
190
  ]);
191
+ 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.");
192
+ 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.");
191
193
  var WorkspaceBotConfigSchema = z.object({
192
194
  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)"),
193
195
  email: z.string().trim().email().default("bot@stormsoftware.com").describe("The email of the workspace bot")
@@ -202,11 +204,11 @@ var WorkspaceDirectoryConfigSchema = z.object({
202
204
  }).describe("Various directories used by the workspace to store data, cache, and configuration files");
203
205
  var StormConfigSchema = z.object({
204
206
  $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"),
205
- extends: z.string().trim().optional().describe("The path to a base JSON file to use as a configuration preset file"),
207
+ extends: ExtendsSchema.optional(),
206
208
  name: z.string().trim().toLowerCase().optional().describe("The name of the service/package/scope using this configuration"),
207
209
  namespace: z.string().trim().toLowerCase().optional().describe("The namespace of the package"),
208
210
  organization: z.string().trim().default("storm-software").describe("The organization of the workspace"),
209
- repository: z.string().trim().url().optional().describe("The repo URL of the workspace (i.e. GitHub)"),
211
+ repository: z.string().trim().optional().describe("The repo URL of the workspace (i.e. GitHub)"),
210
212
  license: z.string().trim().default("Apache-2.0").describe("The license type of the package"),
211
213
  homepage: z.string().trim().url().default(STORM_DEFAULT_HOMEPAGE).describe("The homepage of the workspace"),
212
214
  docs: z.string().trim().url().default(STORM_DEFAULT_DOCS).describe("The base documentation site for the workspace"),
@@ -269,7 +271,8 @@ var COLOR_KEYS = [
269
271
  ];
270
272
 
271
273
  // ../config-tools/src/utilities/get-default-config.ts
272
- import { existsSync as existsSync2, readFileSync } from "node:fs";
274
+ import { existsSync as existsSync2 } from "node:fs";
275
+ import { readFile } from "node:fs/promises";
273
276
  import { join as join2 } from "node:path";
274
277
 
275
278
  // ../config-tools/src/utilities/find-up.ts
@@ -373,17 +376,15 @@ var DEFAULT_COLOR_CONFIG = {
373
376
  "negative": "#dc2626"
374
377
  }
375
378
  };
376
- var getDefaultConfig = /* @__PURE__ */ __name((root) => {
379
+ var getDefaultConfig = /* @__PURE__ */ __name(async (root) => {
377
380
  let license = STORM_DEFAULT_LICENSE;
378
381
  let homepage = STORM_DEFAULT_HOMEPAGE;
379
- let name;
380
- let namespace;
381
- let repository;
382
+ let name = void 0;
383
+ let namespace = void 0;
384
+ let repository = void 0;
382
385
  const workspaceRoot = findWorkspaceRoot(root);
383
386
  if (existsSync2(join2(workspaceRoot, "package.json"))) {
384
- const file = readFileSync(join2(workspaceRoot, "package.json"), {
385
- encoding: "utf8"
386
- });
387
+ const file = await readFile(joinPaths(workspaceRoot, "package.json"), "utf8");
387
388
  if (file) {
388
389
  const packageJson = JSON.parse(file);
389
390
  if (packageJson.name) {
@@ -392,8 +393,12 @@ var getDefaultConfig = /* @__PURE__ */ __name((root) => {
392
393
  if (packageJson.namespace) {
393
394
  namespace = packageJson.namespace;
394
395
  }
395
- if (packageJson.repository?.url) {
396
- repository = packageJson.repository?.url;
396
+ if (packageJson.repository) {
397
+ if (typeof packageJson.repository === "string") {
398
+ repository = packageJson.repository;
399
+ } else if (packageJson.repository.url) {
400
+ repository = packageJson.repository.url;
401
+ }
397
402
  }
398
403
  if (packageJson.license) {
399
404
  license = packageJson.license;
@@ -547,7 +552,6 @@ var writeInfo = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.IN
547
552
  var writeSuccess = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.SUCCESS, config)(message), "writeSuccess");
548
553
  var writeDebug = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.DEBUG, config)(message), "writeDebug");
549
554
  var writeTrace = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.TRACE, config)(message), "writeTrace");
550
- var writeSystem = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.ALL, config)(message), "writeSystem");
551
555
  var getStopwatch = /* @__PURE__ */ __name((name) => {
552
556
  const start = process.hrtime();
553
557
  return () => {
@@ -589,6 +593,7 @@ export {
589
593
  STORM_DEFAULT_DOCS,
590
594
  STORM_DEFAULT_HOMEPAGE,
591
595
  STORM_DEFAULT_LICENSING,
596
+ StormConfigSchema,
592
597
  COLOR_KEYS,
593
598
  correctPaths,
594
599
  joinPaths,
@@ -604,7 +609,6 @@ export {
604
609
  writeSuccess,
605
610
  writeDebug,
606
611
  writeTrace,
607
- writeSystem,
608
612
  getStopwatch,
609
613
  formatLogMessage
610
614
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getStopwatch,
3
3
  writeDebug
4
- } from "./chunk-TPFSDZCR.js";
4
+ } from "./chunk-VWXW3RW5.js";
5
5
  import {
6
6
  __name
7
7
  } from "./chunk-3GQAWCBQ.js";
package/dist/clean.cjs CHANGED
@@ -1,10 +1,10 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
- var _chunk5E3NJ26Lcjs = require('./chunk-5E3NJ26L.cjs');
5
- require('./chunk-FG6XQ26M.cjs');
4
+ var _chunkCUQLNBV5cjs = require('./chunk-CUQLNBV5.cjs');
5
+ require('./chunk-LXCK6Y4C.cjs');
6
6
  require('./chunk-YDYGZTJK.cjs');
7
7
 
8
8
 
9
9
 
10
- exports.clean = _chunk5E3NJ26Lcjs.clean; exports.cleanDirectories = _chunk5E3NJ26Lcjs.cleanDirectories;
10
+ exports.clean = _chunkCUQLNBV5cjs.clean; exports.cleanDirectories = _chunkCUQLNBV5cjs.cleanDirectories;
package/dist/clean.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  clean,
3
3
  cleanDirectories
4
- } from "./chunk-VC7N2YVM.js";
5
- import "./chunk-TPFSDZCR.js";
4
+ } from "./chunk-XGZOR6PZ.js";
5
+ import "./chunk-VWXW3RW5.js";
6
6
  import "./chunk-3GQAWCBQ.js";
7
7
  export {
8
8
  clean,
package/dist/config.cjs CHANGED
@@ -1,12 +1,12 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkY2DOCJBEcjs = require('./chunk-Y2DOCJBE.cjs');
4
- require('./chunk-V627S7QU.cjs');
3
+ var _chunkO45RUFL3cjs = require('./chunk-O45RUFL3.cjs');
4
+ require('./chunk-26OHEX55.cjs');
5
5
  require('./chunk-SHHAZOHN.cjs');
6
- require('./chunk-PSYW5YJB.cjs');
7
- require('./chunk-CF2C3GEV.cjs');
8
- require('./chunk-FG6XQ26M.cjs');
6
+ require('./chunk-KDTFDJN3.cjs');
7
+ require('./chunk-GVX7LSWK.cjs');
8
+ require('./chunk-LXCK6Y4C.cjs');
9
9
  require('./chunk-YDYGZTJK.cjs');
10
10
 
11
11
 
12
- exports.getDefaultBuildPlugins = _chunkY2DOCJBEcjs.getDefaultBuildPlugins;
12
+ exports.getDefaultBuildPlugins = _chunkO45RUFL3cjs.getDefaultBuildPlugins;