@storm-software/unbuild 0.30.5 → 0.31.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.
@@ -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;