@storm-software/tsdown 0.22.1 → 0.22.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.
package/README.md CHANGED
@@ -21,7 +21,7 @@ This package is part of the <b>⚡Storm-Ops</b> monorepo. The Storm-Ops packages
21
21
 
22
22
  <h3 align="center">💻 Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
23
23
 
24
- [![Version](https://img.shields.io/badge/version-0.22.0-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/)&nbsp;[![Nx](https://img.shields.io/badge/Nx-17.0.2-lightgrey?style=for-the-badge&logo=nx&logoWidth=20&&color=1fb2a6)](http://nx.dev/)&nbsp;[![NextJs](https://img.shields.io/badge/Next.js-14.0.2-lightgrey?style=for-the-badge&logo=nextdotjs&logoWidth=20&color=1fb2a6)](https://nextjs.org/)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;[![documented with Fumadocs](https://img.shields.io/badge/documented_with-fumadocs-success.svg?style=for-the-badge&logo=readthedocs&color=1fb2a6)](https://fumadocs.vercel.app/)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/storm-ops/cr.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
24
+ [![Version](https://img.shields.io/badge/version-0.22.2-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/)&nbsp;[![Nx](https://img.shields.io/badge/Nx-17.0.2-lightgrey?style=for-the-badge&logo=nx&logoWidth=20&&color=1fb2a6)](http://nx.dev/)&nbsp;[![NextJs](https://img.shields.io/badge/Next.js-14.0.2-lightgrey?style=for-the-badge&logo=nextdotjs&logoWidth=20&color=1fb2a6)](https://nextjs.org/)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;[![documented with Fumadocs](https://img.shields.io/badge/documented_with-fumadocs-success.svg?style=for-the-badge&logo=readthedocs&color=1fb2a6)](https://fumadocs.vercel.app/)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/storm-ops/cr.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
25
25
 
26
26
  <!-- prettier-ignore-start -->
27
27
  <!-- markdownlint-disable -->
package/dist/build.cjs CHANGED
@@ -1,9 +1,9 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkCTOS4DYDcjs = require('./chunk-CTOS4DYD.cjs');
4
- require('./chunk-EHVHDVI3.cjs');
3
+ var _chunkZNJE4VS3cjs = require('./chunk-ZNJE4VS3.cjs');
4
+ require('./chunk-2Z7WS4H3.cjs');
5
5
  require('./chunk-5KRF6IVW.cjs');
6
6
  require('./chunk-USNT2KNT.cjs');
7
7
 
8
8
 
9
- exports.build = _chunkCTOS4DYDcjs.build;
9
+ exports.build = _chunkZNJE4VS3cjs.build;
package/dist/build.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  build
3
- } from "./chunk-KNBVJN3A.js";
4
- import "./chunk-MLTU5LTF.js";
3
+ } from "./chunk-XKKDJDDD.js";
4
+ import "./chunk-QVK624ZI.js";
5
5
  import "./chunk-UQLCBJOS.js";
6
6
  import "./chunk-SHUYVCID.js";
7
7
  export {
@@ -118,6 +118,8 @@ var ColorConfigMapSchema = _zod2.default.union([
118
118
  }),
119
119
  _zod2.default.record(_zod2.default.string(), ColorConfigSchema)
120
120
  ]);
121
+ 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.");
122
+ 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.");
121
123
  var WorkspaceBotConfigSchema = _zod2.default.object({
122
124
  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)"),
123
125
  email: _zod2.default.string().trim().email().default("bot@stormsoftware.com").describe("The email of the workspace bot")
@@ -132,11 +134,11 @@ var WorkspaceDirectoryConfigSchema = _zod2.default.object({
132
134
  }).describe("Various directories used by the workspace to store data, cache, and configuration files");
133
135
  var StormConfigSchema = _zod2.default.object({
134
136
  $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"),
135
- extends: _zod2.default.string().trim().optional().describe("The path to a base JSON file to use as a configuration preset file"),
137
+ extends: ExtendsSchema.optional(),
136
138
  name: _zod2.default.string().trim().toLowerCase().optional().describe("The name of the service/package/scope using this configuration"),
137
139
  namespace: _zod2.default.string().trim().toLowerCase().optional().describe("The namespace of the package"),
138
140
  organization: _zod2.default.string().trim().default("storm-software").describe("The organization of the workspace"),
139
- repository: _zod2.default.string().trim().url().optional().describe("The repo URL of the workspace (i.e. GitHub)"),
141
+ repository: _zod2.default.string().trim().optional().describe("The repo URL of the workspace (i.e. GitHub)"),
140
142
  license: _zod2.default.string().trim().default("Apache-2.0").describe("The license type of the package"),
141
143
  homepage: _zod2.default.string().trim().url().default(STORM_DEFAULT_HOMEPAGE).describe("The homepage of the workspace"),
142
144
  docs: _zod2.default.string().trim().url().default(STORM_DEFAULT_DOCS).describe("The base documentation site for the workspace"),
@@ -200,6 +202,7 @@ var COLOR_KEYS = [
200
202
 
201
203
  // ../config-tools/src/utilities/get-default-config.ts
202
204
  var _fs = require('fs');
205
+ var _promises = require('fs/promises');
203
206
  var _path = require('path');
204
207
 
205
208
  // ../config-tools/src/utilities/correct-paths.ts
@@ -321,17 +324,15 @@ var DEFAULT_COLOR_CONFIG = {
321
324
  "negative": "#dc2626"
322
325
  }
323
326
  };
324
- var getDefaultConfig = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (root) => {
327
+ var getDefaultConfig = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, async (root) => {
325
328
  let license = STORM_DEFAULT_LICENSE;
326
329
  let homepage = STORM_DEFAULT_HOMEPAGE;
327
- let name;
328
- let namespace;
329
- let repository;
330
+ let name = void 0;
331
+ let namespace = void 0;
332
+ let repository = void 0;
330
333
  const workspaceRoot = findWorkspaceRoot(root);
331
334
  if (_fs.existsSync.call(void 0, _path.join.call(void 0, workspaceRoot, "package.json"))) {
332
- const file = _fs.readFileSync.call(void 0, _path.join.call(void 0, workspaceRoot, "package.json"), {
333
- encoding: "utf8"
334
- });
335
+ const file = await _promises.readFile.call(void 0, joinPaths(workspaceRoot, "package.json"), "utf8");
335
336
  if (file) {
336
337
  const packageJson = JSON.parse(file);
337
338
  if (packageJson.name) {
@@ -340,8 +341,12 @@ var getDefaultConfig = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (ro
340
341
  if (packageJson.namespace) {
341
342
  namespace = packageJson.namespace;
342
343
  }
343
- if (_optionalChain([packageJson, 'access', _2 => _2.repository, 'optionalAccess', _3 => _3.url])) {
344
- repository = _optionalChain([packageJson, 'access', _4 => _4.repository, 'optionalAccess', _5 => _5.url]);
344
+ if (packageJson.repository) {
345
+ if (typeof packageJson.repository === "string") {
346
+ repository = packageJson.repository;
347
+ } else if (packageJson.repository.url) {
348
+ repository = packageJson.repository.url;
349
+ }
345
350
  }
346
351
  if (packageJson.license) {
347
352
  license = packageJson.license;
@@ -386,7 +391,7 @@ var chalkDefault = {
386
391
  };
387
392
  var getChalk = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, () => {
388
393
  let _chalk = _chalk3.default;
389
- 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])) {
394
+ 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])) {
390
395
  _chalk = chalkDefault;
391
396
  }
392
397
  return _chalk;
@@ -482,7 +487,7 @@ var isVerbose = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (label = L
482
487
 
483
488
  // ../config-tools/src/logger/console.ts
484
489
  var getLogFn = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (logLevel = LogLevel.INFO, config = {}, _chalk = getChalk()) => {
485
- 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;
490
+ 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;
486
491
  const configLogLevel = config.logLevel || process.env.STORM_LOG_LEVEL || LogLevelLabel.INFO;
487
492
  if (logLevel > getLogLevel(configLogLevel) || logLevel <= LogLevel.SILENT || getLogLevel(configLogLevel) <= LogLevel.SILENT) {
488
493
  return (_) => {
@@ -548,7 +553,6 @@ var writeWarning = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (messag
548
553
  var writeSuccess = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (message, config) => getLogFn(LogLevel.SUCCESS, config)(message), "writeSuccess");
549
554
  var writeDebug = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (message, config) => getLogFn(LogLevel.DEBUG, config)(message), "writeDebug");
550
555
  var writeTrace = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (message, config) => getLogFn(LogLevel.TRACE, config)(message), "writeTrace");
551
- var writeSystem = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (message, config) => getLogFn(LogLevel.ALL, config)(message), "writeSystem");
552
556
  var getStopwatch = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (name) => {
553
557
  const start = process.hrtime();
554
558
  return () => {
@@ -578,7 +582,7 @@ ${Object.keys(message).filter((key) => !skip.includes(key)).map((key) => ` ${pre
578
582
  }, "formatLogMessage");
579
583
  var _isFunction = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (value) => {
580
584
  try {
581
- 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]));
585
+ 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]));
582
586
  } catch (e) {
583
587
  return false;
584
588
  }
@@ -615,4 +619,4 @@ _chunkUSNT2KNTcjs.__name.call(void 0, clean, "clean");
615
619
 
616
620
 
617
621
 
618
- 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.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.writeWarning = writeWarning; exports.writeSuccess = writeSuccess; exports.writeDebug = writeDebug; exports.writeTrace = writeTrace; exports.writeSystem = writeSystem; exports.getStopwatch = getStopwatch; exports.formatLogMessage = formatLogMessage; exports.clean = clean;
622
+ 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.writeWarning = writeWarning; exports.writeSuccess = writeSuccess; exports.writeDebug = writeDebug; exports.writeTrace = writeTrace; exports.getStopwatch = getStopwatch; exports.formatLogMessage = formatLogMessage; exports.clean = clean;
@@ -118,6 +118,8 @@ var ColorConfigMapSchema = z.union([
118
118
  }),
119
119
  z.record(z.string(), ColorConfigSchema)
120
120
  ]);
121
+ 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.");
122
+ 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.");
121
123
  var WorkspaceBotConfigSchema = z.object({
122
124
  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)"),
123
125
  email: z.string().trim().email().default("bot@stormsoftware.com").describe("The email of the workspace bot")
@@ -132,11 +134,11 @@ var WorkspaceDirectoryConfigSchema = z.object({
132
134
  }).describe("Various directories used by the workspace to store data, cache, and configuration files");
133
135
  var StormConfigSchema = z.object({
134
136
  $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"),
135
- extends: z.string().trim().optional().describe("The path to a base JSON file to use as a configuration preset file"),
137
+ extends: ExtendsSchema.optional(),
136
138
  name: z.string().trim().toLowerCase().optional().describe("The name of the service/package/scope using this configuration"),
137
139
  namespace: z.string().trim().toLowerCase().optional().describe("The namespace of the package"),
138
140
  organization: z.string().trim().default("storm-software").describe("The organization of the workspace"),
139
- repository: z.string().trim().url().optional().describe("The repo URL of the workspace (i.e. GitHub)"),
141
+ repository: z.string().trim().optional().describe("The repo URL of the workspace (i.e. GitHub)"),
140
142
  license: z.string().trim().default("Apache-2.0").describe("The license type of the package"),
141
143
  homepage: z.string().trim().url().default(STORM_DEFAULT_HOMEPAGE).describe("The homepage of the workspace"),
142
144
  docs: z.string().trim().url().default(STORM_DEFAULT_DOCS).describe("The base documentation site for the workspace"),
@@ -199,7 +201,8 @@ var COLOR_KEYS = [
199
201
  ];
200
202
 
201
203
  // ../config-tools/src/utilities/get-default-config.ts
202
- import { existsSync as existsSync2, readFileSync } from "node:fs";
204
+ import { existsSync as existsSync2 } from "node:fs";
205
+ import { readFile } from "node:fs/promises";
203
206
  import { join as join2 } from "node:path";
204
207
 
205
208
  // ../config-tools/src/utilities/correct-paths.ts
@@ -321,17 +324,15 @@ var DEFAULT_COLOR_CONFIG = {
321
324
  "negative": "#dc2626"
322
325
  }
323
326
  };
324
- var getDefaultConfig = /* @__PURE__ */ __name((root) => {
327
+ var getDefaultConfig = /* @__PURE__ */ __name(async (root) => {
325
328
  let license = STORM_DEFAULT_LICENSE;
326
329
  let homepage = STORM_DEFAULT_HOMEPAGE;
327
- let name;
328
- let namespace;
329
- let repository;
330
+ let name = void 0;
331
+ let namespace = void 0;
332
+ let repository = void 0;
330
333
  const workspaceRoot = findWorkspaceRoot(root);
331
334
  if (existsSync2(join2(workspaceRoot, "package.json"))) {
332
- const file = readFileSync(join2(workspaceRoot, "package.json"), {
333
- encoding: "utf8"
334
- });
335
+ const file = await readFile(joinPaths(workspaceRoot, "package.json"), "utf8");
335
336
  if (file) {
336
337
  const packageJson = JSON.parse(file);
337
338
  if (packageJson.name) {
@@ -340,8 +341,12 @@ var getDefaultConfig = /* @__PURE__ */ __name((root) => {
340
341
  if (packageJson.namespace) {
341
342
  namespace = packageJson.namespace;
342
343
  }
343
- if (packageJson.repository?.url) {
344
- repository = packageJson.repository?.url;
344
+ if (packageJson.repository) {
345
+ if (typeof packageJson.repository === "string") {
346
+ repository = packageJson.repository;
347
+ } else if (packageJson.repository.url) {
348
+ repository = packageJson.repository.url;
349
+ }
345
350
  }
346
351
  if (packageJson.license) {
347
352
  license = packageJson.license;
@@ -548,7 +553,6 @@ var writeWarning = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel
548
553
  var writeSuccess = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.SUCCESS, config)(message), "writeSuccess");
549
554
  var writeDebug = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.DEBUG, config)(message), "writeDebug");
550
555
  var writeTrace = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.TRACE, config)(message), "writeTrace");
551
- var writeSystem = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.ALL, config)(message), "writeSystem");
552
556
  var getStopwatch = /* @__PURE__ */ __name((name) => {
553
557
  const start = process.hrtime();
554
558
  return () => {
@@ -598,6 +602,7 @@ export {
598
602
  STORM_DEFAULT_DOCS,
599
603
  STORM_DEFAULT_HOMEPAGE,
600
604
  STORM_DEFAULT_LICENSING,
605
+ StormConfigSchema,
601
606
  COLOR_KEYS,
602
607
  correctPaths,
603
608
  joinPaths,
@@ -611,7 +616,6 @@ export {
611
616
  writeSuccess,
612
617
  writeDebug,
613
618
  writeTrace,
614
- writeSystem,
615
619
  getStopwatch,
616
620
  formatLogMessage,
617
621
  clean
@@ -4,6 +4,7 @@ import {
4
4
  STORM_DEFAULT_DOCS,
5
5
  STORM_DEFAULT_HOMEPAGE,
6
6
  STORM_DEFAULT_LICENSING,
7
+ StormConfigSchema,
7
8
  clean,
8
9
  correctPaths,
9
10
  findWorkspaceRoot,
@@ -17,10 +18,9 @@ import {
17
18
  writeDebug,
18
19
  writeFatal,
19
20
  writeSuccess,
20
- writeSystem,
21
21
  writeTrace,
22
22
  writeWarning
23
- } from "./chunk-MLTU5LTF.js";
23
+ } from "./chunk-QVK624ZI.js";
24
24
  import {
25
25
  DEFAULT_BUILD_OPTIONS
26
26
  } from "./chunk-UQLCBJOS.js";
@@ -61,19 +61,19 @@ import { loadConfig } from "c12";
61
61
  import defu from "defu";
62
62
  var getConfigFileByName = /* @__PURE__ */ __name(async (fileName, filePath, options = {}) => {
63
63
  const workspacePath = filePath || findWorkspaceRoot(filePath);
64
- let config = await loadConfig({
65
- cwd: workspacePath,
66
- packageJson: true,
67
- name: fileName,
68
- envName: fileName?.toUpperCase(),
69
- jitiOptions: {
70
- debug: false,
71
- fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(process.env.STORM_CACHE_DIR || "node_modules/.cache/storm", "jiti")
72
- },
73
- ...options
74
- });
75
- if (!config || Object.keys(config).length === 0) {
76
- config = await loadConfig({
64
+ const configs = await Promise.all([
65
+ loadConfig({
66
+ cwd: workspacePath,
67
+ packageJson: true,
68
+ name: fileName,
69
+ envName: fileName?.toUpperCase(),
70
+ jitiOptions: {
71
+ debug: false,
72
+ fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(process.env.STORM_CACHE_DIR || "node_modules/.cache/storm", "jiti")
73
+ },
74
+ ...options
75
+ }),
76
+ loadConfig({
77
77
  cwd: workspacePath,
78
78
  packageJson: true,
79
79
  name: fileName,
@@ -84,9 +84,9 @@ var getConfigFileByName = /* @__PURE__ */ __name(async (fileName, filePath, opti
84
84
  },
85
85
  configFile: fileName,
86
86
  ...options
87
- });
88
- }
89
- return config;
87
+ })
88
+ ]);
89
+ return defu(configs[0] ?? {}, configs[1] ?? {});
90
90
  }, "getConfigFileByName");
91
91
  var getConfigFile = /* @__PURE__ */ __name(async (filePath, additionalFileNames = []) => {
92
92
  const workspacePath = filePath ? filePath : findWorkspaceRoot(filePath);
@@ -94,7 +94,7 @@ var getConfigFile = /* @__PURE__ */ __name(async (filePath, additionalFileNames
94
94
  let config = result.config;
95
95
  const configFile = result.configFile;
96
96
  if (config && configFile && Object.keys(config).length > 0) {
97
- writeSystem(`Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`, {
97
+ writeTrace(`Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`, {
98
98
  logLevel: "all"
99
99
  });
100
100
  }
@@ -102,7 +102,7 @@ var getConfigFile = /* @__PURE__ */ __name(async (filePath, additionalFileNames
102
102
  const results = await Promise.all(additionalFileNames.map((fileName) => getConfigFileByName(fileName, workspacePath)));
103
103
  for (const result2 of results) {
104
104
  if (result2?.config && result2?.configFile && Object.keys(result2.config).length > 0) {
105
- writeSystem(`Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`, {
105
+ writeTrace(`Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`, {
106
106
  logLevel: "all"
107
107
  });
108
108
  config = defu(result2.config ?? {}, config ?? {});
@@ -120,6 +120,16 @@ var getConfigFile = /* @__PURE__ */ __name(async (filePath, additionalFileNames
120
120
  import defu2 from "defu";
121
121
 
122
122
  // ../config-tools/src/env/get-env.ts
123
+ var getExtensionEnv = /* @__PURE__ */ __name((extensionName) => {
124
+ const prefix = `STORM_EXTENSION_${extensionName.toUpperCase()}_`;
125
+ return Object.keys(process.env).filter((key) => key.startsWith(prefix)).reduce((ret, key) => {
126
+ const name = key.replace(prefix, "").split("_").map((i) => i.length > 0 ? i.trim().charAt(0).toUpperCase() + i.trim().slice(1) : "").join("");
127
+ if (name) {
128
+ ret[name] = process.env[key];
129
+ }
130
+ return ret;
131
+ }, {});
132
+ }, "getExtensionEnv");
123
133
  var getConfigEnv = /* @__PURE__ */ __name(() => {
124
134
  const prefix = "STORM_";
125
135
  let config = {
@@ -279,7 +289,7 @@ var setExtensionEnv = /* @__PURE__ */ __name((extensionName, extension) => {
279
289
  var setConfigEnv = /* @__PURE__ */ __name((config) => {
280
290
  const prefix = "STORM_";
281
291
  if (config.extends) {
282
- process.env[`${prefix}EXTENDS`] = config.extends;
292
+ process.env[`${prefix}EXTENDS`] = Array.isArray(config.extends) ? JSON.stringify(config.extends) : config.extends;
283
293
  }
284
294
  if (config.name) {
285
295
  process.env[`${prefix}NAME`] = config.name;
@@ -509,37 +519,76 @@ var setBaseThemeColorConfigEnv = /* @__PURE__ */ __name((prefix, config) => {
509
519
  }, "setBaseThemeColorConfigEnv");
510
520
 
511
521
  // ../config-tools/src/create-storm-config.ts
522
+ var _extension_cache = /* @__PURE__ */ new WeakMap();
512
523
  var _static_cache = void 0;
513
- var loadStormConfig = /* @__PURE__ */ __name(async (workspaceRoot) => {
514
- let config = {};
515
- if (_static_cache?.data && _static_cache?.timestamp && _static_cache.timestamp >= Date.now() + 3e4) {
516
- writeTrace(`Configuration cache hit - ${_static_cache.timestamp}`, _static_cache.data);
517
- return _static_cache.data;
518
- }
519
- let _workspaceRoot = workspaceRoot;
520
- if (!_workspaceRoot) {
521
- _workspaceRoot = findWorkspaceRoot();
522
- }
523
- const configFile = await getConfigFile(_workspaceRoot);
524
- if (!configFile) {
525
- 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", {
526
- logLevel: "all"
527
- });
524
+ var createStormConfig = /* @__PURE__ */ __name(async (extensionName, schema, workspaceRoot, skipLogs = false) => {
525
+ let result;
526
+ if (!_static_cache?.data || !_static_cache?.timestamp || _static_cache.timestamp < Date.now() - 8e3) {
527
+ let _workspaceRoot = workspaceRoot;
528
+ if (!_workspaceRoot) {
529
+ _workspaceRoot = findWorkspaceRoot();
530
+ }
531
+ const configEnv = getConfigEnv();
532
+ const defaultConfig = await getDefaultConfig(_workspaceRoot);
533
+ const configFile = await getConfigFile(_workspaceRoot);
534
+ if (!configFile && !skipLogs) {
535
+ 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", {
536
+ logLevel: "all"
537
+ });
538
+ }
539
+ result = await StormConfigSchema.parseAsync(defu2(configEnv, configFile, defaultConfig));
540
+ result.workspaceRoot ??= _workspaceRoot;
541
+ } else {
542
+ result = _static_cache.data;
528
543
  }
529
- config = defu2(getConfigEnv(), configFile, getDefaultConfig(_workspaceRoot));
544
+ if (schema && extensionName) {
545
+ result.extensions = {
546
+ ...result.extensions,
547
+ [extensionName]: createConfigExtension(extensionName, schema)
548
+ };
549
+ }
550
+ _static_cache = {
551
+ timestamp: Date.now(),
552
+ data: result
553
+ };
554
+ return result;
555
+ }, "createStormConfig");
556
+ var createConfigExtension = /* @__PURE__ */ __name((extensionName, schema) => {
557
+ const extension_cache_key = {
558
+ extensionName
559
+ };
560
+ if (_extension_cache.has(extension_cache_key)) {
561
+ return _extension_cache.get(extension_cache_key);
562
+ }
563
+ let extension = getExtensionEnv(extensionName);
564
+ if (schema) {
565
+ extension = schema.parse(extension);
566
+ }
567
+ _extension_cache.set(extension_cache_key, extension);
568
+ return extension;
569
+ }, "createConfigExtension");
570
+ var loadStormConfig = /* @__PURE__ */ __name(async (workspaceRoot, skipLogs = false) => {
571
+ const config = await createStormConfig(void 0, void 0, workspaceRoot, skipLogs);
530
572
  setConfigEnv(config);
531
- writeTrace(`\u2699\uFE0F Using Storm configuration:
573
+ if (!skipLogs) {
574
+ writeTrace(`\u2699\uFE0F Using Storm configuration:
532
575
  ${formatLogMessage(config)}`, config);
576
+ }
533
577
  return config;
534
578
  }, "loadStormConfig");
535
579
 
580
+ // ../config-tools/src/get-config.ts
581
+ var getConfig = /* @__PURE__ */ __name((workspaceRoot, skipLogs = false) => {
582
+ return loadStormConfig(workspaceRoot, skipLogs);
583
+ }, "getConfig");
584
+
536
585
  // ../build-tools/src/utilities/read-nx-config.ts
537
586
  import { existsSync } from "node:fs";
538
587
  import { readFile } from "node:fs/promises";
539
588
  var readNxConfig = /* @__PURE__ */ __name(async (workspaceRoot) => {
540
589
  let rootDir = workspaceRoot;
541
590
  if (!rootDir) {
542
- const config = await loadStormConfig();
591
+ const config = await getConfig();
543
592
  rootDir = config.workspaceRoot;
544
593
  }
545
594
  const nxJsonPath = joinPaths(rootDir, "nx.json");
@@ -554,7 +603,7 @@ var readNxConfig = /* @__PURE__ */ __name(async (workspaceRoot) => {
554
603
  var copyAssets = /* @__PURE__ */ __name(async (config, assets, outputPath, projectRoot, projectName, sourceRoot, generatePackageJson2 = true, includeSrc = false, banner, footer) => {
555
604
  const pendingAssets = Array.from(assets ?? []);
556
605
  pendingAssets.push({
557
- input: projectRoot,
606
+ input: joinPaths(config.workspaceRoot, projectRoot),
558
607
  glob: "*.md",
559
608
  output: "."
560
609
  });
@@ -587,8 +636,10 @@ var copyAssets = /* @__PURE__ */ __name(async (config, assets, outputPath, proje
587
636
  if (!buildTarget) {
588
637
  throw new Error(`The Build process failed because the project does not have a valid build target in the project.json file. Check if the file exists in the root of the project at ${joinPaths(projectRoot, "project.json")}`);
589
638
  }
639
+ writeTrace(`\u{1F4DD} Copying the following assets to the output directory:
640
+ ${pendingAssets.map((pendingAsset) => typeof pendingAsset === "string" ? ` - ${pendingAsset} -> ${outputPath}` : ` - ${pendingAsset.input}/${pendingAsset.glob} -> ${joinPaths(outputPath, pendingAsset.output)}`).join("\n")}`, config);
590
641
  const result = await copyAssetsBase({
591
- assets,
642
+ assets: pendingAssets,
592
643
  watch: false,
593
644
  outputPath
594
645
  }, {
@@ -803,7 +854,7 @@ var resolveOptions = /* @__PURE__ */ __name(async (userOptions) => {
803
854
  if (!workspaceRoot) {
804
855
  throw new Error("Cannot find Nx workspace root");
805
856
  }
806
- const config = await loadStormConfig(workspaceRoot.dir);
857
+ const config = await getConfig(workspaceRoot.dir);
807
858
  writeDebug(" \u2699\uFE0F Resolving build options", config);
808
859
  const stopwatch = getStopwatch("Build options resolution");
809
860
  const projectGraph = await createProjectGraphAsync({