@storm-software/unbuild 0.30.5 → 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.
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.30.4-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.30.5-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/bin/unbuild.cjs CHANGED
@@ -118,6 +118,8 @@ var ColorConfigMapSchema = import_zod.default.union([
118
118
  }),
119
119
  import_zod.default.record(import_zod.default.string(), ColorConfigSchema)
120
120
  ]);
121
+ var ExtendsItemSchema = import_zod.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(import_zod.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 = import_zod.default.object({
122
124
  name: import_zod.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: import_zod.default.string().trim().email().default("bot@stormsoftware.com").describe("The email of the workspace bot")
@@ -132,11 +134,11 @@ var WorkspaceDirectoryConfigSchema = import_zod.default.object({
132
134
  }).describe("Various directories used by the workspace to store data, cache, and configuration files");
133
135
  var StormConfigSchema = import_zod.default.object({
134
136
  $schema: import_zod.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: import_zod.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: import_zod.default.string().trim().toLowerCase().optional().describe("The name of the service/package/scope using this configuration"),
137
139
  namespace: import_zod.default.string().trim().toLowerCase().optional().describe("The namespace of the package"),
138
140
  organization: import_zod.default.string().trim().default("storm-software").describe("The organization of the workspace"),
139
- repository: import_zod.default.string().trim().url().optional().describe("The repo URL of the workspace (i.e. GitHub)"),
141
+ repository: import_zod.default.string().trim().optional().describe("The repo URL of the workspace (i.e. GitHub)"),
140
142
  license: import_zod.default.string().trim().default("Apache-2.0").describe("The license type of the package"),
141
143
  homepage: import_zod.default.string().trim().url().default(STORM_DEFAULT_HOMEPAGE).describe("The homepage of the workspace"),
142
144
  docs: import_zod.default.string().trim().url().default(STORM_DEFAULT_DOCS).describe("The base documentation site for the workspace"),
@@ -231,6 +233,7 @@ var COLOR_KEYS = [
231
233
 
232
234
  // ../config-tools/src/utilities/get-default-config.ts
233
235
  var import_node_fs2 = require("fs");
236
+ var import_promises = require("fs/promises");
234
237
  var import_node_path2 = require("path");
235
238
 
236
239
  // ../config-tools/src/utilities/correct-paths.ts
@@ -352,17 +355,15 @@ var DEFAULT_COLOR_CONFIG = {
352
355
  "negative": "#dc2626"
353
356
  }
354
357
  };
355
- var getDefaultConfig = /* @__PURE__ */ __name((root) => {
358
+ var getDefaultConfig = /* @__PURE__ */ __name(async (root) => {
356
359
  let license = STORM_DEFAULT_LICENSE;
357
360
  let homepage = STORM_DEFAULT_HOMEPAGE;
358
- let name;
359
- let namespace;
360
- let repository;
361
+ let name = void 0;
362
+ let namespace = void 0;
363
+ let repository = void 0;
361
364
  const workspaceRoot = findWorkspaceRoot(root);
362
365
  if ((0, import_node_fs2.existsSync)((0, import_node_path2.join)(workspaceRoot, "package.json"))) {
363
- const file = (0, import_node_fs2.readFileSync)((0, import_node_path2.join)(workspaceRoot, "package.json"), {
364
- encoding: "utf8"
365
- });
366
+ const file = await (0, import_promises.readFile)(joinPaths(workspaceRoot, "package.json"), "utf8");
366
367
  if (file) {
367
368
  const packageJson = JSON.parse(file);
368
369
  if (packageJson.name) {
@@ -371,8 +372,12 @@ var getDefaultConfig = /* @__PURE__ */ __name((root) => {
371
372
  if (packageJson.namespace) {
372
373
  namespace = packageJson.namespace;
373
374
  }
374
- if (packageJson.repository?.url) {
375
- repository = packageJson.repository?.url;
375
+ if (packageJson.repository) {
376
+ if (typeof packageJson.repository === "string") {
377
+ repository = packageJson.repository;
378
+ } else if (packageJson.repository.url) {
379
+ repository = packageJson.repository.url;
380
+ }
376
381
  }
377
382
  if (packageJson.license) {
378
383
  license = packageJson.license;
@@ -581,7 +586,6 @@ var writeInfo = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.IN
581
586
  var writeSuccess = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.SUCCESS, config)(message), "writeSuccess");
582
587
  var writeDebug = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.DEBUG, config)(message), "writeDebug");
583
588
  var writeTrace = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.TRACE, config)(message), "writeTrace");
584
- var writeSystem = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.ALL, config)(message), "writeSystem");
585
589
  var getStopwatch = /* @__PURE__ */ __name((name) => {
586
590
  const start = process.hrtime();
587
591
  return () => {
@@ -654,19 +658,19 @@ Stacktrace: ${error.stack}`, config);
654
658
  // ../config-tools/src/config-file/get-config-file.ts
655
659
  var getConfigFileByName = /* @__PURE__ */ __name(async (fileName, filePath, options = {}) => {
656
660
  const workspacePath = filePath || findWorkspaceRoot(filePath);
657
- let config = await (0, import_c12.loadConfig)({
658
- cwd: workspacePath,
659
- packageJson: true,
660
- name: fileName,
661
- envName: fileName?.toUpperCase(),
662
- jitiOptions: {
663
- debug: false,
664
- fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(process.env.STORM_CACHE_DIR || "node_modules/.cache/storm", "jiti")
665
- },
666
- ...options
667
- });
668
- if (!config || Object.keys(config).length === 0) {
669
- config = await (0, import_c12.loadConfig)({
661
+ const configs = await Promise.all([
662
+ (0, import_c12.loadConfig)({
663
+ cwd: workspacePath,
664
+ packageJson: true,
665
+ name: fileName,
666
+ envName: fileName?.toUpperCase(),
667
+ jitiOptions: {
668
+ debug: false,
669
+ fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(process.env.STORM_CACHE_DIR || "node_modules/.cache/storm", "jiti")
670
+ },
671
+ ...options
672
+ }),
673
+ (0, import_c12.loadConfig)({
670
674
  cwd: workspacePath,
671
675
  packageJson: true,
672
676
  name: fileName,
@@ -677,9 +681,9 @@ var getConfigFileByName = /* @__PURE__ */ __name(async (fileName, filePath, opti
677
681
  },
678
682
  configFile: fileName,
679
683
  ...options
680
- });
681
- }
682
- return config;
684
+ })
685
+ ]);
686
+ return (0, import_defu.default)(configs[0] ?? {}, configs[1] ?? {});
683
687
  }, "getConfigFileByName");
684
688
  var getConfigFile = /* @__PURE__ */ __name(async (filePath, additionalFileNames = []) => {
685
689
  const workspacePath = filePath ? filePath : findWorkspaceRoot(filePath);
@@ -687,7 +691,7 @@ var getConfigFile = /* @__PURE__ */ __name(async (filePath, additionalFileNames
687
691
  let config = result.config;
688
692
  const configFile = result.configFile;
689
693
  if (config && configFile && Object.keys(config).length > 0) {
690
- writeSystem(`Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`, {
694
+ writeTrace(`Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`, {
691
695
  logLevel: "all"
692
696
  });
693
697
  }
@@ -695,7 +699,7 @@ var getConfigFile = /* @__PURE__ */ __name(async (filePath, additionalFileNames
695
699
  const results = await Promise.all(additionalFileNames.map((fileName) => getConfigFileByName(fileName, workspacePath)));
696
700
  for (const result2 of results) {
697
701
  if (result2?.config && result2?.configFile && Object.keys(result2.config).length > 0) {
698
- writeSystem(`Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`, {
702
+ writeTrace(`Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`, {
699
703
  logLevel: "all"
700
704
  });
701
705
  config = (0, import_defu.default)(result2.config ?? {}, config ?? {});
@@ -710,6 +714,16 @@ var getConfigFile = /* @__PURE__ */ __name(async (filePath, additionalFileNames
710
714
  }, "getConfigFile");
711
715
 
712
716
  // ../config-tools/src/env/get-env.ts
717
+ var getExtensionEnv = /* @__PURE__ */ __name((extensionName) => {
718
+ const prefix = `STORM_EXTENSION_${extensionName.toUpperCase()}_`;
719
+ return Object.keys(process.env).filter((key) => key.startsWith(prefix)).reduce((ret, key) => {
720
+ const name = key.replace(prefix, "").split("_").map((i) => i.length > 0 ? i.trim().charAt(0).toUpperCase() + i.trim().slice(1) : "").join("");
721
+ if (name) {
722
+ ret[name] = process.env[key];
723
+ }
724
+ return ret;
725
+ }, {});
726
+ }, "getExtensionEnv");
713
727
  var getConfigEnv = /* @__PURE__ */ __name(() => {
714
728
  const prefix = "STORM_";
715
729
  let config = {
@@ -869,7 +883,7 @@ var setExtensionEnv = /* @__PURE__ */ __name((extensionName, extension) => {
869
883
  var setConfigEnv = /* @__PURE__ */ __name((config) => {
870
884
  const prefix = "STORM_";
871
885
  if (config.extends) {
872
- process.env[`${prefix}EXTENDS`] = config.extends;
886
+ process.env[`${prefix}EXTENDS`] = Array.isArray(config.extends) ? JSON.stringify(config.extends) : config.extends;
873
887
  }
874
888
  if (config.name) {
875
889
  process.env[`${prefix}NAME`] = config.name;
@@ -1099,30 +1113,69 @@ var setBaseThemeColorConfigEnv = /* @__PURE__ */ __name((prefix, config) => {
1099
1113
  }, "setBaseThemeColorConfigEnv");
1100
1114
 
1101
1115
  // ../config-tools/src/create-storm-config.ts
1116
+ var _extension_cache = /* @__PURE__ */ new WeakMap();
1102
1117
  var _static_cache = void 0;
1103
- var loadStormConfig = /* @__PURE__ */ __name(async (workspaceRoot) => {
1104
- let config = {};
1105
- if (_static_cache?.data && _static_cache?.timestamp && _static_cache.timestamp >= Date.now() + 3e4) {
1106
- writeTrace(`Configuration cache hit - ${_static_cache.timestamp}`, _static_cache.data);
1107
- return _static_cache.data;
1108
- }
1109
- let _workspaceRoot = workspaceRoot;
1110
- if (!_workspaceRoot) {
1111
- _workspaceRoot = findWorkspaceRoot();
1112
- }
1113
- const configFile = await getConfigFile(_workspaceRoot);
1114
- if (!configFile) {
1115
- 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", {
1116
- logLevel: "all"
1117
- });
1118
+ var createStormConfig = /* @__PURE__ */ __name(async (extensionName, schema, workspaceRoot, skipLogs = false) => {
1119
+ let result;
1120
+ if (!_static_cache?.data || !_static_cache?.timestamp || _static_cache.timestamp < Date.now() - 8e3) {
1121
+ let _workspaceRoot = workspaceRoot;
1122
+ if (!_workspaceRoot) {
1123
+ _workspaceRoot = findWorkspaceRoot();
1124
+ }
1125
+ const configEnv = getConfigEnv();
1126
+ const defaultConfig = await getDefaultConfig(_workspaceRoot);
1127
+ const configFile = await getConfigFile(_workspaceRoot);
1128
+ if (!configFile && !skipLogs) {
1129
+ 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", {
1130
+ logLevel: "all"
1131
+ });
1132
+ }
1133
+ result = await StormConfigSchema.parseAsync((0, import_defu2.default)(configEnv, configFile, defaultConfig));
1134
+ result.workspaceRoot ??= _workspaceRoot;
1135
+ } else {
1136
+ result = _static_cache.data;
1137
+ }
1138
+ if (schema && extensionName) {
1139
+ result.extensions = {
1140
+ ...result.extensions,
1141
+ [extensionName]: createConfigExtension(extensionName, schema)
1142
+ };
1118
1143
  }
1119
- config = (0, import_defu2.default)(getConfigEnv(), configFile, getDefaultConfig(_workspaceRoot));
1144
+ _static_cache = {
1145
+ timestamp: Date.now(),
1146
+ data: result
1147
+ };
1148
+ return result;
1149
+ }, "createStormConfig");
1150
+ var createConfigExtension = /* @__PURE__ */ __name((extensionName, schema) => {
1151
+ const extension_cache_key = {
1152
+ extensionName
1153
+ };
1154
+ if (_extension_cache.has(extension_cache_key)) {
1155
+ return _extension_cache.get(extension_cache_key);
1156
+ }
1157
+ let extension = getExtensionEnv(extensionName);
1158
+ if (schema) {
1159
+ extension = schema.parse(extension);
1160
+ }
1161
+ _extension_cache.set(extension_cache_key, extension);
1162
+ return extension;
1163
+ }, "createConfigExtension");
1164
+ var loadStormConfig = /* @__PURE__ */ __name(async (workspaceRoot, skipLogs = false) => {
1165
+ const config = await createStormConfig(void 0, void 0, workspaceRoot, skipLogs);
1120
1166
  setConfigEnv(config);
1121
- writeTrace(`\u2699\uFE0F Using Storm configuration:
1167
+ if (!skipLogs) {
1168
+ writeTrace(`\u2699\uFE0F Using Storm configuration:
1122
1169
  ${formatLogMessage(config)}`, config);
1170
+ }
1123
1171
  return config;
1124
1172
  }, "loadStormConfig");
1125
1173
 
1174
+ // ../config-tools/src/get-config.ts
1175
+ var getConfig = /* @__PURE__ */ __name((workspaceRoot, skipLogs = false) => {
1176
+ return loadStormConfig(workspaceRoot, skipLogs);
1177
+ }, "getConfig");
1178
+
1126
1179
  // bin/unbuild.ts
1127
1180
  var import_commander = require("commander");
1128
1181
 
@@ -1148,22 +1201,22 @@ var import_path = require("path");
1148
1201
  var import_devkit3 = require("@nx/devkit");
1149
1202
  var import_js = require("@nx/js");
1150
1203
  var import_glob = require("glob");
1151
- var import_promises2 = require("fs/promises");
1204
+ var import_promises3 = require("fs/promises");
1152
1205
 
1153
1206
  // ../build-tools/src/utilities/read-nx-config.ts
1154
1207
  var import_node_fs4 = require("fs");
1155
- var import_promises = require("fs/promises");
1208
+ var import_promises2 = require("fs/promises");
1156
1209
  var readNxConfig = /* @__PURE__ */ __name(async (workspaceRoot) => {
1157
1210
  let rootDir = workspaceRoot;
1158
1211
  if (!rootDir) {
1159
- const config = await loadStormConfig();
1212
+ const config = await getConfig();
1160
1213
  rootDir = config.workspaceRoot;
1161
1214
  }
1162
1215
  const nxJsonPath = joinPaths(rootDir, "nx.json");
1163
1216
  if (!(0, import_node_fs4.existsSync)(nxJsonPath)) {
1164
1217
  throw new Error("Cannot find project.json configuration");
1165
1218
  }
1166
- const configContent = await (0, import_promises.readFile)(nxJsonPath, "utf8");
1219
+ const configContent = await (0, import_promises2.readFile)(nxJsonPath, "utf8");
1167
1220
  return JSON.parse(configContent);
1168
1221
  }, "readNxConfig");
1169
1222
 
@@ -1171,7 +1224,7 @@ var readNxConfig = /* @__PURE__ */ __name(async (workspaceRoot) => {
1171
1224
  var copyAssets = /* @__PURE__ */ __name(async (config, assets, outputPath, projectRoot, projectName, sourceRoot, generatePackageJson2 = true, includeSrc = false, banner, footer) => {
1172
1225
  const pendingAssets = Array.from(assets ?? []);
1173
1226
  pendingAssets.push({
1174
- input: projectRoot,
1227
+ input: joinPaths(config.workspaceRoot, projectRoot),
1175
1228
  glob: "*.md",
1176
1229
  output: "."
1177
1230
  });
@@ -1232,9 +1285,9 @@ ${pendingAssets.map((pendingAsset) => typeof pendingAsset === "string" ? ` - ${p
1232
1285
  joinPaths(config.workspaceRoot, outputPath, "src/**/*.js"),
1233
1286
  joinPaths(config.workspaceRoot, outputPath, "src/**/*.jsx")
1234
1287
  ]);
1235
- await Promise.allSettled(files.map(async (file) => (0, import_promises2.writeFile)(file, `${banner && typeof banner === "string" ? banner.startsWith("//") ? banner : `// ${banner}` : ""}
1288
+ await Promise.allSettled(files.map(async (file) => (0, import_promises3.writeFile)(file, `${banner && typeof banner === "string" ? banner.startsWith("//") ? banner : `// ${banner}` : ""}
1236
1289
 
1237
- ${await (0, import_promises2.readFile)(file, "utf8")}
1290
+ ${await (0, import_promises3.readFile)(file, "utf8")}
1238
1291
 
1239
1292
  ${footer && typeof footer === "string" ? footer.startsWith("//") ? footer : `// ${footer}` : ""}`)));
1240
1293
  }
@@ -1244,7 +1297,7 @@ ${footer && typeof footer === "string" ? footer.startsWith("//") ? footer : `//
1244
1297
  var import_buildable_libs_utils = require("@nx/js/src/utils/buildable-libs-utils");
1245
1298
  var import_glob2 = require("glob");
1246
1299
  var import_node_fs5 = require("fs");
1247
- var import_promises3 = require("fs/promises");
1300
+ var import_promises4 = require("fs/promises");
1248
1301
  var import_project_graph = require("nx/src/project-graph/project-graph");
1249
1302
  var addPackageDependencies = /* @__PURE__ */ __name(async (workspaceRoot, projectRoot, projectName, packageJson) => {
1250
1303
  const projectDependencies = (0, import_buildable_libs_utils.calculateProjectBuildableDependencies)(void 0, (0, import_project_graph.readCachedProjectGraph)(), workspaceRoot, projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
@@ -1254,7 +1307,7 @@ var addPackageDependencies = /* @__PURE__ */ __name(async (workspaceRoot, projec
1254
1307
  if (projectNode.data.root) {
1255
1308
  const projectPackageJsonPath = joinPaths(workspaceRoot, projectNode.data.root, "package.json");
1256
1309
  if ((0, import_node_fs5.existsSync)(projectPackageJsonPath)) {
1257
- const projectPackageJsonContent = await (0, import_promises3.readFile)(projectPackageJsonPath, "utf8");
1310
+ const projectPackageJsonContent = await (0, import_promises4.readFile)(projectPackageJsonPath, "utf8");
1258
1311
  const projectPackageJson = JSON.parse(projectPackageJsonContent);
1259
1312
  if (projectPackageJson.private !== false) {
1260
1313
  localPackages.push(projectPackageJson);
@@ -1291,7 +1344,7 @@ var addPackageDependencies = /* @__PURE__ */ __name(async (workspaceRoot, projec
1291
1344
  }, "addPackageDependencies");
1292
1345
  var addWorkspacePackageJsonFields = /* @__PURE__ */ __name(async (config, projectRoot, sourceRoot, projectName, includeSrc = false, packageJson) => {
1293
1346
  const workspaceRoot = config.workspaceRoot ? config.workspaceRoot : findWorkspaceRoot();
1294
- const workspacePackageJsonContent = await (0, import_promises3.readFile)(joinPaths(workspaceRoot, "package.json"), "utf8");
1347
+ const workspacePackageJsonContent = await (0, import_promises4.readFile)(joinPaths(workspaceRoot, "package.json"), "utf8");
1295
1348
  const workspacePackageJson = JSON.parse(workspacePackageJsonContent);
1296
1349
  packageJson.type ??= "module";
1297
1350
  packageJson.sideEffects ??= false;
@@ -1345,7 +1398,7 @@ var import_create_task_graph = require("nx/src/tasks-runner/create-task-graph");
1345
1398
  var import_defu5 = __toESM(require("defu"), 1);
1346
1399
  var import_glob4 = require("glob");
1347
1400
  var import_node_fs8 = require("fs");
1348
- var import_promises7 = require("fs/promises");
1401
+ var import_promises8 = require("fs/promises");
1349
1402
  var import_node_path6 = require("path");
1350
1403
  var import_find_workspace_root5 = require("nx/src/utils/find-workspace-root");
1351
1404
 
@@ -1359,7 +1412,7 @@ var import_defu3 = require("defu");
1359
1412
  var import_hookable = require("hookable");
1360
1413
  var import_pretty_bytes = __toESM(require("pretty-bytes"), 1);
1361
1414
  var import_tinyglobby = require("tinyglobby");
1362
- var import_promises4 = __toESM(require("fs/promises"), 1);
1415
+ var import_promises5 = __toESM(require("fs/promises"), 1);
1363
1416
  var import_jiti = require("jiti");
1364
1417
  var import_rollup = require("rollup");
1365
1418
  var import_rollup_plugin_dts = __toESM(require("rollup-plugin-dts"), 1);
@@ -1493,7 +1546,7 @@ var getEntrypointPaths = /* @__PURE__ */ __name((path2) => {
1493
1546
  return segments.map((_, index) => segments.slice(index).join("/")).filter(Boolean);
1494
1547
  }, "getEntrypointPaths");
1495
1548
  async function ensuredir(path2) {
1496
- await import_promises4.default.mkdir((0, import_pathe.dirname)(path2), { recursive: true });
1549
+ await import_promises5.default.mkdir((0, import_pathe.dirname)(path2), { recursive: true });
1497
1550
  }
1498
1551
  __name(ensuredir, "ensuredir");
1499
1552
  function warn(ctx, message) {
@@ -1507,10 +1560,10 @@ __name(warn, "warn");
1507
1560
  async function symlink(from, to, force = true) {
1508
1561
  await ensuredir(to);
1509
1562
  if (force) {
1510
- await import_promises4.default.unlink(to).catch(() => {
1563
+ await import_promises5.default.unlink(to).catch(() => {
1511
1564
  });
1512
1565
  }
1513
- await import_promises4.default.symlink(from, to, "junction");
1566
+ await import_promises5.default.symlink(from, to, "junction");
1514
1567
  }
1515
1568
  __name(symlink, "symlink");
1516
1569
  function dumpObject(obj) {
@@ -1523,9 +1576,9 @@ function getpkg(id = "") {
1523
1576
  }
1524
1577
  __name(getpkg, "getpkg");
1525
1578
  async function rmdir(dir) {
1526
- await import_promises4.default.unlink(dir).catch(() => {
1579
+ await import_promises5.default.unlink(dir).catch(() => {
1527
1580
  });
1528
- await import_promises4.default.rm(dir, { recursive: true, force: true }).catch(() => {
1581
+ await import_promises5.default.rm(dir, { recursive: true, force: true }).catch(() => {
1529
1582
  });
1530
1583
  }
1531
1584
  __name(rmdir, "rmdir");
@@ -2129,7 +2182,7 @@ async function rollupStub(ctx) {
2129
2182
  const resolvedEntryForTypeImport = isESM ? `${resolvedEntry.replace(/(\.m?)(ts)$/, "$1js")}` : resolvedEntryWithoutExt;
2130
2183
  const code = await import_node_fs6.promises.readFile(resolvedEntry, "utf8");
2131
2184
  const shebang = getShebang(code);
2132
- await (0, import_promises4.mkdir)((0, import_pathe.dirname)(output), { recursive: true });
2185
+ await (0, import_promises5.mkdir)((0, import_pathe.dirname)(output), { recursive: true });
2133
2186
  if (ctx.options.rollup.emitCJS) {
2134
2187
  const jitiCJSPath = (0, import_pathe.relative)(
2135
2188
  (0, import_pathe.dirname)(output),
@@ -2138,7 +2191,7 @@ async function rollupStub(ctx) {
2138
2191
  conditions: ["node", "require"]
2139
2192
  })
2140
2193
  );
2141
- await (0, import_promises4.writeFile)(
2194
+ await (0, import_promises5.writeFile)(
2142
2195
  output + ".cjs",
2143
2196
  shebang + [
2144
2197
  `const { createJiti } = require(${JSON.stringify(jitiCJSPath)})`,
@@ -2172,7 +2225,7 @@ async function rollupStub(ctx) {
2172
2225
  conditions: ["node", "import"]
2173
2226
  })
2174
2227
  );
2175
- await (0, import_promises4.writeFile)(
2228
+ await (0, import_promises5.writeFile)(
2176
2229
  output + ".mjs",
2177
2230
  shebang + [
2178
2231
  `import { createJiti } from ${JSON.stringify(jitiESMPath)};`,
@@ -2195,10 +2248,10 @@ async function rollupStub(ctx) {
2195
2248
  `export * from ${JSON.stringify(resolvedEntryForTypeImport)};`,
2196
2249
  hasDefaultExport ? `export { default } from ${JSON.stringify(resolvedEntryForTypeImport)};` : ""
2197
2250
  ].join("\n");
2198
- await (0, import_promises4.writeFile)(output + ".d.cts", dtsContent);
2199
- await (0, import_promises4.writeFile)(output + ".d.mts", dtsContent);
2251
+ await (0, import_promises5.writeFile)(output + ".d.cts", dtsContent);
2252
+ await (0, import_promises5.writeFile)(output + ".d.mts", dtsContent);
2200
2253
  if (ctx.options.declaration === "compatible" || ctx.options.declaration === true) {
2201
- await (0, import_promises4.writeFile)(output + ".d.ts", dtsContent);
2254
+ await (0, import_promises5.writeFile)(output + ".d.ts", dtsContent);
2202
2255
  }
2203
2256
  }
2204
2257
  if (shebang) {
@@ -2374,7 +2427,7 @@ async function typesBuild(ctx) {
2374
2427
  await ctx.hooks.callHook("untyped:entry:outputs", ctx, entry, outputs);
2375
2428
  for (const output of Object.values(outputs)) {
2376
2429
  if (!output) continue;
2377
- await (0, import_promises4.writeFile)(
2430
+ await (0, import_promises5.writeFile)(
2378
2431
  (0, import_pathe.resolve)(distDir, output.fileName),
2379
2432
  output.contents,
2380
2433
  "utf8"
@@ -2761,7 +2814,7 @@ var import_defu4 = require("defu");
2761
2814
  var import_hookable2 = require("hookable");
2762
2815
  var import_pretty_bytes2 = require("pretty-bytes");
2763
2816
  var import_tinyglobby2 = require("tinyglobby");
2764
- var import_promises5 = require("fs/promises");
2817
+ var import_promises6 = require("fs/promises");
2765
2818
  var import_jiti2 = require("jiti");
2766
2819
  var import_rollup2 = require("rollup");
2767
2820
  var import_rollup_plugin_dts2 = require("rollup-plugin-dts");
@@ -2781,7 +2834,7 @@ var import_scule2 = require("scule");
2781
2834
  var import_mkdist2 = require("mkdist");
2782
2835
 
2783
2836
  // src/clean.ts
2784
- var import_promises6 = require("fs/promises");
2837
+ var import_promises7 = require("fs/promises");
2785
2838
  async function clean(name = "Unbuild", directory, config) {
2786
2839
  writeDebug(` \u{1F9F9} Cleaning ${name} output path: ${directory}`, config);
2787
2840
  const stopwatch = getStopwatch(`${name} output clean`);
@@ -2790,7 +2843,7 @@ async function clean(name = "Unbuild", directory, config) {
2790
2843
  }
2791
2844
  __name(clean, "clean");
2792
2845
  async function cleanDirectories(name = "Unbuild", directory, config) {
2793
- await (0, import_promises6.rm)(directory, {
2846
+ await (0, import_promises7.rm)(directory, {
2794
2847
  recursive: true,
2795
2848
  force: true
2796
2849
  });
@@ -2949,14 +3002,14 @@ async function resolveOptions(options, config) {
2949
3002
  if (!(0, import_node_fs8.existsSync)(projectJsonPath)) {
2950
3003
  throw new Error("Cannot find project.json configuration");
2951
3004
  }
2952
- const projectJsonContent = await (0, import_promises7.readFile)(projectJsonPath, "utf8");
3005
+ const projectJsonContent = await (0, import_promises8.readFile)(projectJsonPath, "utf8");
2953
3006
  const projectJson = JSON.parse(projectJsonContent);
2954
3007
  const projectName = projectJson.name;
2955
3008
  const packageJsonPath = joinPaths(config.workspaceRoot, options.projectRoot, "package.json");
2956
3009
  if (!(0, import_node_fs8.existsSync)(packageJsonPath)) {
2957
3010
  throw new Error("Cannot find package.json configuration");
2958
3011
  }
2959
- const packageJsonContent = await (0, import_promises7.readFile)(packageJsonPath, "utf8");
3012
+ const packageJsonContent = await (0, import_promises8.readFile)(packageJsonPath, "utf8");
2960
3013
  const packageJson = JSON.parse(packageJsonContent);
2961
3014
  let tsconfig = options.tsconfig;
2962
3015
  if (!tsconfig) {
@@ -3145,7 +3198,7 @@ async function generatePackageJson(options) {
3145
3198
  if (!(0, import_node_fs8.existsSync)(packageJsonPath)) {
3146
3199
  throw new Error("Cannot find package.json configuration");
3147
3200
  }
3148
- let packageJsonContent = await (0, import_promises7.readFile)(joinPaths(options.config.workspaceRoot, options.projectRoot, "package.json"), "utf8");
3201
+ let packageJsonContent = await (0, import_promises8.readFile)(joinPaths(options.config.workspaceRoot, options.projectRoot, "package.json"), "utf8");
3149
3202
  if (!packageJsonContent) {
3150
3203
  throw new Error("Cannot find package.json configuration file");
3151
3204
  }
@@ -3245,7 +3298,7 @@ async function build2(options) {
3245
3298
  if (!workspaceRoot) {
3246
3299
  throw new Error("Cannot find workspace root");
3247
3300
  }
3248
- const config = await loadStormConfig(workspaceRoot.dir);
3301
+ const config = await getConfig(workspaceRoot.dir);
3249
3302
  writeDebug(` \u26A1 Executing Storm Unbuild pipeline`, config);
3250
3303
  const stopwatch = getStopwatch("Unbuild pipeline");
3251
3304
  try {
@@ -3396,7 +3449,7 @@ var cleanAction = /* @__PURE__ */ __name((config) => async (options) => {
3396
3449
  }
3397
3450
  }, "cleanAction");
3398
3451
  void (async () => {
3399
- const config = await loadStormConfig();
3452
+ const config = await getConfig();
3400
3453
  const stopwatch = getStopwatch("Storm ESBuild executable");
3401
3454
  try {
3402
3455
  handleProcess(config);