@storm-software/tsdown 0.22.2 → 0.22.4

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.
@@ -20,7 +20,7 @@
20
20
 
21
21
 
22
22
 
23
- var _chunkEHVHDVI3cjs = require('./chunk-EHVHDVI3.cjs');
23
+ var _chunk2Z7WS4H3cjs = require('./chunk-2Z7WS4H3.cjs');
24
24
 
25
25
 
26
26
  var _chunk5KRF6IVWcjs = require('./chunk-5KRF6IVW.cjs');
@@ -51,50 +51,214 @@ var _resolve2 = require('resolve'); var _resolve3 = _interopRequireDefault(_reso
51
51
 
52
52
 
53
53
  // ../build-tools/src/utilities/copy-assets.ts
54
-
55
- var _js = require('@nx/js');
54
+ var _copyassetshandler = require('@nx/js/src/utils/assets/copy-assets-handler');
56
55
  var _glob = require('glob');
57
56
  var _promises = require('fs/promises');
57
+ var copyAssets = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, async (config, assets, outputPath, projectRoot, sourceRoot, generatePackageJson2 = true, includeSrc = false, banner, footer) => {
58
+ const pendingAssets = Array.from(_nullishCoalesce(assets, () => ( [])));
59
+ pendingAssets.push({
60
+ input: projectRoot,
61
+ glob: "*.md",
62
+ output: "."
63
+ });
64
+ pendingAssets.push({
65
+ input: ".",
66
+ glob: "LICENSE",
67
+ output: "."
68
+ });
69
+ if (generatePackageJson2 === false) {
70
+ pendingAssets.push({
71
+ input: projectRoot,
72
+ glob: "package.json",
73
+ output: "."
74
+ });
75
+ }
76
+ if (includeSrc === true) {
77
+ pendingAssets.push({
78
+ input: sourceRoot,
79
+ glob: "**/{*.ts,*.tsx,*.js,*.jsx}",
80
+ output: "src/"
81
+ });
82
+ }
83
+ _chunk2Z7WS4H3cjs.writeTrace.call(void 0, `\u{1F4DD} Copying the following assets to the output directory:
84
+ ${pendingAssets.map((pendingAsset) => typeof pendingAsset === "string" ? ` - ${pendingAsset} -> ${outputPath}` : ` - ${pendingAsset.input}/${pendingAsset.glob} -> ${_chunk2Z7WS4H3cjs.joinPaths.call(void 0, outputPath, pendingAsset.output)}`).join("\n")}`, config);
85
+ const assetHandler = new (0, _copyassetshandler.CopyAssetsHandler)({
86
+ projectDir: projectRoot,
87
+ rootDir: config.workspaceRoot,
88
+ outputDir: outputPath,
89
+ assets: pendingAssets
90
+ });
91
+ await assetHandler.processAllAssetsOnce();
92
+ if (includeSrc === true) {
93
+ _chunk2Z7WS4H3cjs.writeDebug.call(void 0, `\u{1F4DD} Adding banner and writing source files: ${_chunk2Z7WS4H3cjs.joinPaths.call(void 0, outputPath, "src")}`, config);
94
+ const files = await _glob.glob.call(void 0, [
95
+ _chunk2Z7WS4H3cjs.joinPaths.call(void 0, config.workspaceRoot, outputPath, "src/**/*.ts"),
96
+ _chunk2Z7WS4H3cjs.joinPaths.call(void 0, config.workspaceRoot, outputPath, "src/**/*.tsx"),
97
+ _chunk2Z7WS4H3cjs.joinPaths.call(void 0, config.workspaceRoot, outputPath, "src/**/*.js"),
98
+ _chunk2Z7WS4H3cjs.joinPaths.call(void 0, config.workspaceRoot, outputPath, "src/**/*.jsx")
99
+ ]);
100
+ await Promise.allSettled(files.map(async (file) => _promises.writeFile.call(void 0, file, `${banner && typeof banner === "string" ? banner.startsWith("//") ? banner : `// ${banner}` : ""}
101
+
102
+ ${await _promises.readFile.call(void 0, file, "utf8")}
103
+
104
+ ${footer && typeof footer === "string" ? footer.startsWith("//") ? footer : `// ${footer}` : ""}`)));
105
+ }
106
+ }, "copyAssets");
107
+
108
+ // ../build-tools/src/utilities/generate-package-json.ts
109
+ var _buildablelibsutils = require('@nx/js/src/utils/buildable-libs-utils');
110
+
111
+
112
+
113
+ var _projectgraph = require('nx/src/project-graph/project-graph');
114
+ var addPackageDependencies = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, async (workspaceRoot, projectRoot, projectName, packageJson) => {
115
+ const projectDependencies = _buildablelibsutils.calculateProjectBuildableDependencies.call(void 0, void 0, _projectgraph.readCachedProjectGraph.call(void 0, ), workspaceRoot, projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
116
+ const localPackages = [];
117
+ for (const project of projectDependencies.dependencies.filter((dep) => dep.node.type === "lib" && dep.node.data.root !== projectRoot && dep.node.data.root !== workspaceRoot)) {
118
+ const projectNode = project.node;
119
+ if (projectNode.data.root) {
120
+ const projectPackageJsonPath = _chunk2Z7WS4H3cjs.joinPaths.call(void 0, workspaceRoot, projectNode.data.root, "package.json");
121
+ if (_fs.existsSync.call(void 0, projectPackageJsonPath)) {
122
+ const projectPackageJsonContent = await _promises.readFile.call(void 0, projectPackageJsonPath, "utf8");
123
+ const projectPackageJson = JSON.parse(projectPackageJsonContent);
124
+ if (projectPackageJson.private !== false) {
125
+ localPackages.push(projectPackageJson);
126
+ }
127
+ }
128
+ }
129
+ }
130
+ if (localPackages.length > 0) {
131
+ _chunk2Z7WS4H3cjs.writeTrace.call(void 0, `\u{1F4E6} Adding local packages to package.json: ${localPackages.map((p) => p.name).join(", ")}`);
132
+ packageJson.peerDependencies = localPackages.reduce((ret, localPackage) => {
133
+ if (!ret[localPackage.name]) {
134
+ ret[localPackage.name] = `>=${localPackage.version || "0.0.1"}`;
135
+ }
136
+ return ret;
137
+ }, _nullishCoalesce(packageJson.peerDependencies, () => ( {})));
138
+ packageJson.peerDependenciesMeta = localPackages.reduce((ret, localPackage) => {
139
+ if (!ret[localPackage.name]) {
140
+ ret[localPackage.name] = {
141
+ optional: false
142
+ };
143
+ }
144
+ return ret;
145
+ }, _nullishCoalesce(packageJson.peerDependenciesMeta, () => ( {})));
146
+ packageJson.devDependencies = localPackages.reduce((ret, localPackage) => {
147
+ if (!ret[localPackage.name]) {
148
+ ret[localPackage.name] = localPackage.version || "0.0.1";
149
+ }
150
+ return ret;
151
+ }, _nullishCoalesce(packageJson.peerDependencies, () => ( {})));
152
+ } else {
153
+ _chunk2Z7WS4H3cjs.writeTrace.call(void 0, "\u{1F4E6} No local packages dependencies to add to package.json");
154
+ }
155
+ return packageJson;
156
+ }, "addPackageDependencies");
157
+ var addWorkspacePackageJsonFields = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, async (config, projectRoot, sourceRoot, projectName, includeSrc = false, packageJson) => {
158
+ const workspaceRoot = config.workspaceRoot ? config.workspaceRoot : _chunk2Z7WS4H3cjs.findWorkspaceRoot.call(void 0, );
159
+ const workspacePackageJsonContent = await _promises.readFile.call(void 0, _chunk2Z7WS4H3cjs.joinPaths.call(void 0, workspaceRoot, "package.json"), "utf8");
160
+ const workspacePackageJson = JSON.parse(workspacePackageJsonContent);
161
+ packageJson.type ??= "module";
162
+ packageJson.sideEffects ??= false;
163
+ if (includeSrc === true) {
164
+ let distSrc = sourceRoot.replace(projectRoot, "");
165
+ if (distSrc.startsWith("/")) {
166
+ distSrc = distSrc.substring(1);
167
+ }
168
+ packageJson.source ??= `${_chunk2Z7WS4H3cjs.joinPaths.call(void 0, distSrc, "index.ts").replaceAll("\\", "/")}`;
169
+ }
170
+ packageJson.files ??= [
171
+ "dist/**/*"
172
+ ];
173
+ if (includeSrc === true && !packageJson.files.includes("src")) {
174
+ packageJson.files.push("src/**/*");
175
+ }
176
+ packageJson.publishConfig ??= {
177
+ access: "public"
178
+ };
179
+ packageJson.description ??= workspacePackageJson.description;
180
+ packageJson.homepage ??= workspacePackageJson.homepage;
181
+ packageJson.bugs ??= workspacePackageJson.bugs;
182
+ packageJson.license ??= workspacePackageJson.license;
183
+ packageJson.keywords ??= workspacePackageJson.keywords;
184
+ packageJson.funding ??= workspacePackageJson.funding;
185
+ packageJson.author ??= workspacePackageJson.author;
186
+ packageJson.maintainers ??= workspacePackageJson.maintainers;
187
+ if (!packageJson.maintainers && packageJson.author) {
188
+ packageJson.maintainers = [
189
+ packageJson.author
190
+ ];
191
+ }
192
+ packageJson.contributors ??= workspacePackageJson.contributors;
193
+ if (!packageJson.contributors && packageJson.author) {
194
+ packageJson.contributors = [
195
+ packageJson.author
196
+ ];
197
+ }
198
+ packageJson.repository ??= workspacePackageJson.repository;
199
+ packageJson.repository.directory ??= projectRoot ? projectRoot : _chunk2Z7WS4H3cjs.joinPaths.call(void 0, "packages", projectName);
200
+ return packageJson;
201
+ }, "addWorkspacePackageJsonFields");
202
+ var addPackageJsonExport = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (file, type = "module", sourceRoot) => {
203
+ let entry = file.replaceAll("\\", "/");
204
+ if (sourceRoot) {
205
+ entry = entry.replace(sourceRoot, "");
206
+ }
207
+ return {
208
+ "import": {
209
+ "types": `./dist/${entry}.d.${type === "module" ? "ts" : "mts"}`,
210
+ "default": `./dist/${entry}.${type === "module" ? "js" : "mjs"}`
211
+ },
212
+ "require": {
213
+ "types": `./dist/${entry}.d.${type === "commonjs" ? "ts" : "cts"}`,
214
+ "default": `./dist/${entry}.${type === "commonjs" ? "js" : "cjs"}`
215
+ },
216
+ "default": {
217
+ "types": `./dist/${entry}.d.ts`,
218
+ "default": `./dist/${entry}.js`
219
+ }
220
+ };
221
+ }, "addPackageJsonExport");
58
222
 
59
223
  // ../config-tools/src/config-file/get-config-file.ts
60
224
  var _c12 = require('c12');
61
225
  var _defu = require('defu'); var _defu2 = _interopRequireDefault(_defu);
62
226
  var getConfigFileByName = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, async (fileName, filePath, options = {}) => {
63
- const workspacePath = filePath || _chunkEHVHDVI3cjs.findWorkspaceRoot.call(void 0, filePath);
64
- let config = await _c12.loadConfig.call(void 0, {
65
- cwd: workspacePath,
66
- packageJson: true,
67
- name: fileName,
68
- envName: _optionalChain([fileName, 'optionalAccess', _ => _.toUpperCase, 'call', _2 => _2()]),
69
- jitiOptions: {
70
- debug: false,
71
- fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : _chunkEHVHDVI3cjs.joinPaths.call(void 0, 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 _c12.loadConfig.call(void 0, {
227
+ const workspacePath = filePath || _chunk2Z7WS4H3cjs.findWorkspaceRoot.call(void 0, filePath);
228
+ const configs = await Promise.all([
229
+ _c12.loadConfig.call(void 0, {
230
+ cwd: workspacePath,
231
+ packageJson: true,
232
+ name: fileName,
233
+ envName: _optionalChain([fileName, 'optionalAccess', _ => _.toUpperCase, 'call', _2 => _2()]),
234
+ jitiOptions: {
235
+ debug: false,
236
+ fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : _chunk2Z7WS4H3cjs.joinPaths.call(void 0, process.env.STORM_CACHE_DIR || "node_modules/.cache/storm", "jiti")
237
+ },
238
+ ...options
239
+ }),
240
+ _c12.loadConfig.call(void 0, {
77
241
  cwd: workspacePath,
78
242
  packageJson: true,
79
243
  name: fileName,
80
244
  envName: _optionalChain([fileName, 'optionalAccess', _3 => _3.toUpperCase, 'call', _4 => _4()]),
81
245
  jitiOptions: {
82
246
  debug: false,
83
- fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : _chunkEHVHDVI3cjs.joinPaths.call(void 0, process.env.STORM_CACHE_DIR || "node_modules/.cache/storm", "jiti")
247
+ fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : _chunk2Z7WS4H3cjs.joinPaths.call(void 0, process.env.STORM_CACHE_DIR || "node_modules/.cache/storm", "jiti")
84
248
  },
85
249
  configFile: fileName,
86
250
  ...options
87
- });
88
- }
89
- return config;
251
+ })
252
+ ]);
253
+ return _defu2.default.call(void 0, _nullishCoalesce(configs[0], () => ( {})), _nullishCoalesce(configs[1], () => ( {})));
90
254
  }, "getConfigFileByName");
91
255
  var getConfigFile = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, async (filePath, additionalFileNames = []) => {
92
- const workspacePath = filePath ? filePath : _chunkEHVHDVI3cjs.findWorkspaceRoot.call(void 0, filePath);
256
+ const workspacePath = filePath ? filePath : _chunk2Z7WS4H3cjs.findWorkspaceRoot.call(void 0, filePath);
93
257
  const result = await getConfigFileByName("storm", workspacePath);
94
258
  let config = result.config;
95
259
  const configFile = result.configFile;
96
260
  if (config && configFile && Object.keys(config).length > 0) {
97
- _chunkEHVHDVI3cjs.writeSystem.call(void 0, `Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`, {
261
+ _chunk2Z7WS4H3cjs.writeTrace.call(void 0, `Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`, {
98
262
  logLevel: "all"
99
263
  });
100
264
  }
@@ -102,7 +266,7 @@ var getConfigFile = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, async
102
266
  const results = await Promise.all(additionalFileNames.map((fileName) => getConfigFileByName(fileName, workspacePath)));
103
267
  for (const result2 of results) {
104
268
  if (_optionalChain([result2, 'optionalAccess', _5 => _5.config]) && _optionalChain([result2, 'optionalAccess', _6 => _6.configFile]) && Object.keys(result2.config).length > 0) {
105
- _chunkEHVHDVI3cjs.writeSystem.call(void 0, `Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`, {
269
+ _chunk2Z7WS4H3cjs.writeTrace.call(void 0, `Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`, {
106
270
  logLevel: "all"
107
271
  });
108
272
  config = _defu2.default.call(void 0, _nullishCoalesce(result2.config, () => ( {})), _nullishCoalesce(config, () => ( {})));
@@ -120,6 +284,16 @@ var getConfigFile = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, async
120
284
 
121
285
 
122
286
  // ../config-tools/src/env/get-env.ts
287
+ var getExtensionEnv = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (extensionName) => {
288
+ const prefix = `STORM_EXTENSION_${extensionName.toUpperCase()}_`;
289
+ return Object.keys(process.env).filter((key) => key.startsWith(prefix)).reduce((ret, key) => {
290
+ const name = key.replace(prefix, "").split("_").map((i) => i.length > 0 ? i.trim().charAt(0).toUpperCase() + i.trim().slice(1) : "").join("");
291
+ if (name) {
292
+ ret[name] = process.env[key];
293
+ }
294
+ return ret;
295
+ }, {});
296
+ }, "getExtensionEnv");
123
297
  var getConfigEnv = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, () => {
124
298
  const prefix = "STORM_";
125
299
  let config = {
@@ -139,15 +313,15 @@ var getConfigEnv = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, () => {
139
313
  licensing: process.env[`${prefix}LICENSING`] || void 0,
140
314
  timezone: process.env[`${prefix}TIMEZONE`] || process.env.TZ || void 0,
141
315
  locale: process.env[`${prefix}LOCALE`] || process.env.LOCALE || void 0,
142
- configFile: process.env[`${prefix}CONFIG_FILE`] ? _chunkEHVHDVI3cjs.correctPaths.call(void 0, process.env[`${prefix}CONFIG_FILE`]) : void 0,
143
- workspaceRoot: process.env[`${prefix}WORKSPACE_ROOT`] ? _chunkEHVHDVI3cjs.correctPaths.call(void 0, process.env[`${prefix}WORKSPACE_ROOT`]) : void 0,
316
+ configFile: process.env[`${prefix}CONFIG_FILE`] ? _chunk2Z7WS4H3cjs.correctPaths.call(void 0, process.env[`${prefix}CONFIG_FILE`]) : void 0,
317
+ workspaceRoot: process.env[`${prefix}WORKSPACE_ROOT`] ? _chunk2Z7WS4H3cjs.correctPaths.call(void 0, process.env[`${prefix}WORKSPACE_ROOT`]) : void 0,
144
318
  directories: {
145
- cache: process.env[`${prefix}CACHE_DIR`] ? _chunkEHVHDVI3cjs.correctPaths.call(void 0, process.env[`${prefix}CACHE_DIR`]) : void 0,
146
- data: process.env[`${prefix}DATA_DIR`] ? _chunkEHVHDVI3cjs.correctPaths.call(void 0, process.env[`${prefix}DATA_DIR`]) : void 0,
147
- config: process.env[`${prefix}CONFIG_DIR`] ? _chunkEHVHDVI3cjs.correctPaths.call(void 0, process.env[`${prefix}CONFIG_DIR`]) : void 0,
148
- temp: process.env[`${prefix}TEMP_DIR`] ? _chunkEHVHDVI3cjs.correctPaths.call(void 0, process.env[`${prefix}TEMP_DIR`]) : void 0,
149
- log: process.env[`${prefix}LOG_DIR`] ? _chunkEHVHDVI3cjs.correctPaths.call(void 0, process.env[`${prefix}LOG_DIR`]) : void 0,
150
- build: process.env[`${prefix}BUILD_DIR`] ? _chunkEHVHDVI3cjs.correctPaths.call(void 0, process.env[`${prefix}BUILD_DIR`]) : void 0
319
+ cache: process.env[`${prefix}CACHE_DIR`] ? _chunk2Z7WS4H3cjs.correctPaths.call(void 0, process.env[`${prefix}CACHE_DIR`]) : void 0,
320
+ data: process.env[`${prefix}DATA_DIR`] ? _chunk2Z7WS4H3cjs.correctPaths.call(void 0, process.env[`${prefix}DATA_DIR`]) : void 0,
321
+ config: process.env[`${prefix}CONFIG_DIR`] ? _chunk2Z7WS4H3cjs.correctPaths.call(void 0, process.env[`${prefix}CONFIG_DIR`]) : void 0,
322
+ temp: process.env[`${prefix}TEMP_DIR`] ? _chunk2Z7WS4H3cjs.correctPaths.call(void 0, process.env[`${prefix}TEMP_DIR`]) : void 0,
323
+ log: process.env[`${prefix}LOG_DIR`] ? _chunk2Z7WS4H3cjs.correctPaths.call(void 0, process.env[`${prefix}LOG_DIR`]) : void 0,
324
+ build: process.env[`${prefix}BUILD_DIR`] ? _chunk2Z7WS4H3cjs.correctPaths.call(void 0, process.env[`${prefix}BUILD_DIR`]) : void 0
151
325
  },
152
326
  skipCache: process.env[`${prefix}SKIP_CACHE`] !== void 0 ? Boolean(process.env[`${prefix}SKIP_CACHE`]) : void 0,
153
327
  env: (_nullishCoalesce(_nullishCoalesce(process.env[`${prefix}ENV`], () => ( process.env.NODE_ENV)), () => ( process.env.ENVIRONMENT))) || void 0,
@@ -170,23 +344,23 @@ var getConfigEnv = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, () => {
170
344
  cyclone: process.env[`${prefix}REGISTRY_CYCLONE`] || void 0,
171
345
  container: process.env[`${prefix}REGISTRY_CONTAINER`] || void 0
172
346
  },
173
- logLevel: process.env[`${prefix}LOG_LEVEL`] !== null && process.env[`${prefix}LOG_LEVEL`] !== void 0 ? process.env[`${prefix}LOG_LEVEL`] && Number.isSafeInteger(Number.parseInt(process.env[`${prefix}LOG_LEVEL`])) ? _chunkEHVHDVI3cjs.getLogLevelLabel.call(void 0, Number.parseInt(process.env[`${prefix}LOG_LEVEL`])) : process.env[`${prefix}LOG_LEVEL`] : void 0
347
+ logLevel: process.env[`${prefix}LOG_LEVEL`] !== null && process.env[`${prefix}LOG_LEVEL`] !== void 0 ? process.env[`${prefix}LOG_LEVEL`] && Number.isSafeInteger(Number.parseInt(process.env[`${prefix}LOG_LEVEL`])) ? _chunk2Z7WS4H3cjs.getLogLevelLabel.call(void 0, Number.parseInt(process.env[`${prefix}LOG_LEVEL`])) : process.env[`${prefix}LOG_LEVEL`] : void 0
174
348
  };
175
- const themeNames = Object.keys(process.env).filter((envKey) => envKey.startsWith(`${prefix}COLOR_`) && _chunkEHVHDVI3cjs.COLOR_KEYS.every((colorKey) => !envKey.startsWith(`${prefix}COLOR_LIGHT_${colorKey}`) && !envKey.startsWith(`${prefix}COLOR_DARK_${colorKey}`)));
349
+ const themeNames = Object.keys(process.env).filter((envKey) => envKey.startsWith(`${prefix}COLOR_`) && _chunk2Z7WS4H3cjs.COLOR_KEYS.every((colorKey) => !envKey.startsWith(`${prefix}COLOR_LIGHT_${colorKey}`) && !envKey.startsWith(`${prefix}COLOR_DARK_${colorKey}`)));
176
350
  config.colors = themeNames.length > 0 ? themeNames.reduce((ret, themeName) => {
177
351
  ret[themeName] = getThemeColorConfigEnv(prefix, themeName);
178
352
  return ret;
179
353
  }, {}) : getThemeColorConfigEnv(prefix);
180
- if (config.docs === _chunkEHVHDVI3cjs.STORM_DEFAULT_DOCS) {
181
- if (config.homepage === _chunkEHVHDVI3cjs.STORM_DEFAULT_HOMEPAGE) {
182
- config.docs = `${_chunkEHVHDVI3cjs.STORM_DEFAULT_HOMEPAGE}/projects/${config.name}/docs`;
354
+ if (config.docs === _chunk2Z7WS4H3cjs.STORM_DEFAULT_DOCS) {
355
+ if (config.homepage === _chunk2Z7WS4H3cjs.STORM_DEFAULT_HOMEPAGE) {
356
+ config.docs = `${_chunk2Z7WS4H3cjs.STORM_DEFAULT_HOMEPAGE}/projects/${config.name}/docs`;
183
357
  } else {
184
358
  config.docs = `${config.homepage}/docs`;
185
359
  }
186
360
  }
187
- if (config.licensing === _chunkEHVHDVI3cjs.STORM_DEFAULT_LICENSING) {
188
- if (config.homepage === _chunkEHVHDVI3cjs.STORM_DEFAULT_HOMEPAGE) {
189
- config.licensing = `${_chunkEHVHDVI3cjs.STORM_DEFAULT_HOMEPAGE}/projects/${config.name}/licensing`;
361
+ if (config.licensing === _chunk2Z7WS4H3cjs.STORM_DEFAULT_LICENSING) {
362
+ if (config.homepage === _chunk2Z7WS4H3cjs.STORM_DEFAULT_HOMEPAGE) {
363
+ config.licensing = `${_chunk2Z7WS4H3cjs.STORM_DEFAULT_HOMEPAGE}/projects/${config.name}/licensing`;
190
364
  } else {
191
365
  config.licensing = `${config.homepage}/docs`;
192
366
  }
@@ -279,7 +453,7 @@ var setExtensionEnv = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (ext
279
453
  var setConfigEnv = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (config) => {
280
454
  const prefix = "STORM_";
281
455
  if (config.extends) {
282
- process.env[`${prefix}EXTENDS`] = config.extends;
456
+ process.env[`${prefix}EXTENDS`] = Array.isArray(config.extends) ? JSON.stringify(config.extends) : config.extends;
283
457
  }
284
458
  if (config.name) {
285
459
  process.env[`${prefix}NAME`] = config.name;
@@ -324,31 +498,31 @@ var setConfigEnv = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (config
324
498
  process.env.LANG = config.locale ? `${config.locale.replaceAll("-", "_")}.UTF-8` : "en_US.UTF-8";
325
499
  }
326
500
  if (config.configFile) {
327
- process.env[`${prefix}CONFIG_FILE`] = _chunkEHVHDVI3cjs.correctPaths.call(void 0, config.configFile);
501
+ process.env[`${prefix}CONFIG_FILE`] = _chunk2Z7WS4H3cjs.correctPaths.call(void 0, config.configFile);
328
502
  }
329
503
  if (config.workspaceRoot) {
330
- process.env[`${prefix}WORKSPACE_ROOT`] = _chunkEHVHDVI3cjs.correctPaths.call(void 0, config.workspaceRoot);
331
- process.env.NX_WORKSPACE_ROOT = _chunkEHVHDVI3cjs.correctPaths.call(void 0, config.workspaceRoot);
332
- process.env.NX_WORKSPACE_ROOT_PATH = _chunkEHVHDVI3cjs.correctPaths.call(void 0, config.workspaceRoot);
504
+ process.env[`${prefix}WORKSPACE_ROOT`] = _chunk2Z7WS4H3cjs.correctPaths.call(void 0, config.workspaceRoot);
505
+ process.env.NX_WORKSPACE_ROOT = _chunk2Z7WS4H3cjs.correctPaths.call(void 0, config.workspaceRoot);
506
+ process.env.NX_WORKSPACE_ROOT_PATH = _chunk2Z7WS4H3cjs.correctPaths.call(void 0, config.workspaceRoot);
333
507
  }
334
508
  if (config.directories) {
335
509
  if (!config.skipCache && config.directories.cache) {
336
- process.env[`${prefix}CACHE_DIR`] = _chunkEHVHDVI3cjs.correctPaths.call(void 0, config.directories.cache);
510
+ process.env[`${prefix}CACHE_DIR`] = _chunk2Z7WS4H3cjs.correctPaths.call(void 0, config.directories.cache);
337
511
  }
338
512
  if (config.directories.data) {
339
- process.env[`${prefix}DATA_DIR`] = _chunkEHVHDVI3cjs.correctPaths.call(void 0, config.directories.data);
513
+ process.env[`${prefix}DATA_DIR`] = _chunk2Z7WS4H3cjs.correctPaths.call(void 0, config.directories.data);
340
514
  }
341
515
  if (config.directories.config) {
342
- process.env[`${prefix}CONFIG_DIR`] = _chunkEHVHDVI3cjs.correctPaths.call(void 0, config.directories.config);
516
+ process.env[`${prefix}CONFIG_DIR`] = _chunk2Z7WS4H3cjs.correctPaths.call(void 0, config.directories.config);
343
517
  }
344
518
  if (config.directories.temp) {
345
- process.env[`${prefix}TEMP_DIR`] = _chunkEHVHDVI3cjs.correctPaths.call(void 0, config.directories.temp);
519
+ process.env[`${prefix}TEMP_DIR`] = _chunk2Z7WS4H3cjs.correctPaths.call(void 0, config.directories.temp);
346
520
  }
347
521
  if (config.directories.log) {
348
- process.env[`${prefix}LOG_DIR`] = _chunkEHVHDVI3cjs.correctPaths.call(void 0, config.directories.log);
522
+ process.env[`${prefix}LOG_DIR`] = _chunk2Z7WS4H3cjs.correctPaths.call(void 0, config.directories.log);
349
523
  }
350
524
  if (config.directories.build) {
351
- process.env[`${prefix}BUILD_DIR`] = _chunkEHVHDVI3cjs.correctPaths.call(void 0, config.directories.build);
525
+ process.env[`${prefix}BUILD_DIR`] = _chunk2Z7WS4H3cjs.correctPaths.call(void 0, config.directories.build);
352
526
  }
353
527
  }
354
528
  if (config.skipCache !== void 0) {
@@ -402,8 +576,8 @@ var setConfigEnv = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (config
402
576
  if (config.logLevel) {
403
577
  process.env[`${prefix}LOG_LEVEL`] = String(config.logLevel);
404
578
  process.env.LOG_LEVEL = String(config.logLevel);
405
- process.env.NX_VERBOSE_LOGGING = String(_chunkEHVHDVI3cjs.getLogLevel.call(void 0, config.logLevel) >= _chunkEHVHDVI3cjs.LogLevel.DEBUG ? true : false);
406
- process.env.RUST_BACKTRACE = _chunkEHVHDVI3cjs.getLogLevel.call(void 0, config.logLevel) >= _chunkEHVHDVI3cjs.LogLevel.DEBUG ? "full" : "none";
579
+ process.env.NX_VERBOSE_LOGGING = String(_chunk2Z7WS4H3cjs.getLogLevel.call(void 0, config.logLevel) >= _chunk2Z7WS4H3cjs.LogLevel.DEBUG ? true : false);
580
+ process.env.RUST_BACKTRACE = _chunk2Z7WS4H3cjs.getLogLevel.call(void 0, config.logLevel) >= _chunk2Z7WS4H3cjs.LogLevel.DEBUG ? "full" : "none";
407
581
  }
408
582
  process.env[`${prefix}CONFIG`] = JSON.stringify(config);
409
583
  for (const key of Object.keys(_nullishCoalesce(config.extensions, () => ( {})))) {
@@ -509,239 +683,73 @@ var setBaseThemeColorConfigEnv = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(v
509
683
  }, "setBaseThemeColorConfigEnv");
510
684
 
511
685
  // ../config-tools/src/create-storm-config.ts
686
+ var _extension_cache = /* @__PURE__ */ new WeakMap();
512
687
  var _static_cache = void 0;
513
- var loadStormConfig = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, async (workspaceRoot) => {
514
- let config = {};
515
- if (_optionalChain([_static_cache, 'optionalAccess', _29 => _29.data]) && _optionalChain([_static_cache, 'optionalAccess', _30 => _30.timestamp]) && _static_cache.timestamp >= Date.now() + 3e4) {
516
- _chunkEHVHDVI3cjs.writeTrace.call(void 0, `Configuration cache hit - ${_static_cache.timestamp}`, _static_cache.data);
517
- return _static_cache.data;
518
- }
519
- let _workspaceRoot = workspaceRoot;
520
- if (!_workspaceRoot) {
521
- _workspaceRoot = _chunkEHVHDVI3cjs.findWorkspaceRoot.call(void 0, );
522
- }
523
- const configFile = await getConfigFile(_workspaceRoot);
524
- if (!configFile) {
525
- _chunkEHVHDVI3cjs.writeWarning.call(void 0, "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
- });
528
- }
529
- config = _defu2.default.call(void 0, getConfigEnv(), configFile, _chunkEHVHDVI3cjs.getDefaultConfig.call(void 0, _workspaceRoot));
530
- setConfigEnv(config);
531
- _chunkEHVHDVI3cjs.writeTrace.call(void 0, `\u2699\uFE0F Using Storm configuration:
532
- ${_chunkEHVHDVI3cjs.formatLogMessage.call(void 0, config)}`, config);
533
- return config;
534
- }, "loadStormConfig");
535
-
536
- // ../build-tools/src/utilities/read-nx-config.ts
537
-
538
-
539
- var readNxConfig = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, async (workspaceRoot) => {
540
- let rootDir = workspaceRoot;
541
- if (!rootDir) {
542
- const config = await loadStormConfig();
543
- rootDir = config.workspaceRoot;
544
- }
545
- const nxJsonPath = _chunkEHVHDVI3cjs.joinPaths.call(void 0, rootDir, "nx.json");
546
- if (!_fs.existsSync.call(void 0, nxJsonPath)) {
547
- throw new Error("Cannot find project.json configuration");
548
- }
549
- const configContent = await _promises.readFile.call(void 0, nxJsonPath, "utf8");
550
- return JSON.parse(configContent);
551
- }, "readNxConfig");
552
-
553
- // ../build-tools/src/utilities/copy-assets.ts
554
- var copyAssets = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, async (config, assets, outputPath, projectRoot, projectName, sourceRoot, generatePackageJson2 = true, includeSrc = false, banner, footer) => {
555
- const pendingAssets = Array.from(_nullishCoalesce(assets, () => ( [])));
556
- pendingAssets.push({
557
- input: projectRoot,
558
- glob: "*.md",
559
- output: "."
560
- });
561
- pendingAssets.push({
562
- input: config.workspaceRoot,
563
- glob: "LICENSE",
564
- output: "."
565
- });
566
- if (generatePackageJson2 === false) {
567
- pendingAssets.push({
568
- input: projectRoot,
569
- glob: "package.json",
570
- output: "."
571
- });
572
- }
573
- if (includeSrc === true) {
574
- pendingAssets.push({
575
- input: sourceRoot,
576
- glob: "**/{*.ts,*.tsx,*.js,*.jsx}",
577
- output: "src/"
578
- });
579
- }
580
- const nxJson = readNxConfig(config.workspaceRoot);
581
- const projectGraph = _devkit.readCachedProjectGraph.call(void 0, );
582
- const projectsConfigurations = _devkit.readProjectsConfigurationFromProjectGraph.call(void 0, projectGraph);
583
- if (!_optionalChain([projectsConfigurations, 'optionalAccess', _31 => _31.projects, 'optionalAccess', _32 => _32[projectName]])) {
584
- throw new Error("The Build process failed because the project does not have a valid configuration in the project.json file. Check if the file exists in the root of the project.");
585
- }
586
- const buildTarget = _optionalChain([projectsConfigurations, 'access', _33 => _33.projects, 'access', _34 => _34[projectName], 'access', _35 => _35.targets, 'optionalAccess', _36 => _36.build]);
587
- if (!buildTarget) {
588
- 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 ${_chunkEHVHDVI3cjs.joinPaths.call(void 0, projectRoot, "project.json")}`);
589
- }
590
- _chunkEHVHDVI3cjs.writeTrace.call(void 0, `\u{1F4DD} Copying the following assets to the output directory:
591
- ${pendingAssets.map((pendingAsset) => typeof pendingAsset === "string" ? ` - ${pendingAsset} -> ${outputPath}` : ` - ${pendingAsset.input}/${pendingAsset.glob} -> ${_chunkEHVHDVI3cjs.joinPaths.call(void 0, outputPath, pendingAsset.output)}`).join("\n")}`, config);
592
- const result = await _js.copyAssets.call(void 0, {
593
- assets: pendingAssets,
594
- watch: false,
595
- outputPath
596
- }, {
597
- root: config.workspaceRoot,
598
- targetName: "build",
599
- target: buildTarget,
600
- projectName,
601
- projectGraph,
602
- projectsConfigurations,
603
- nxJsonConfiguration: nxJson,
604
- cwd: config.workspaceRoot,
605
- isVerbose: _chunkEHVHDVI3cjs.isVerbose.call(void 0, config.logLevel)
606
- });
607
- if (!result.success) {
608
- throw new Error("The Build process failed trying to copy assets");
609
- }
610
- if (includeSrc === true) {
611
- _chunkEHVHDVI3cjs.writeDebug.call(void 0, `\u{1F4DD} Adding banner and writing source files: ${_chunkEHVHDVI3cjs.joinPaths.call(void 0, outputPath, "src")}`, config);
612
- const files = await _glob.glob.call(void 0, [
613
- _chunkEHVHDVI3cjs.joinPaths.call(void 0, config.workspaceRoot, outputPath, "src/**/*.ts"),
614
- _chunkEHVHDVI3cjs.joinPaths.call(void 0, config.workspaceRoot, outputPath, "src/**/*.tsx"),
615
- _chunkEHVHDVI3cjs.joinPaths.call(void 0, config.workspaceRoot, outputPath, "src/**/*.js"),
616
- _chunkEHVHDVI3cjs.joinPaths.call(void 0, config.workspaceRoot, outputPath, "src/**/*.jsx")
617
- ]);
618
- await Promise.allSettled(files.map(async (file) => _promises.writeFile.call(void 0, file, `${banner && typeof banner === "string" ? banner.startsWith("//") ? banner : `// ${banner}` : ""}
619
-
620
- ${await _promises.readFile.call(void 0, file, "utf8")}
621
-
622
- ${footer && typeof footer === "string" ? footer.startsWith("//") ? footer : `// ${footer}` : ""}`)));
623
- }
624
- }, "copyAssets");
625
-
626
- // ../build-tools/src/utilities/generate-package-json.ts
627
- var _buildablelibsutils = require('@nx/js/src/utils/buildable-libs-utils');
628
-
629
-
630
-
631
- var _projectgraph = require('nx/src/project-graph/project-graph');
632
- var addPackageDependencies = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, async (workspaceRoot, projectRoot, projectName, packageJson) => {
633
- const projectDependencies = _buildablelibsutils.calculateProjectBuildableDependencies.call(void 0, void 0, _projectgraph.readCachedProjectGraph.call(void 0, ), workspaceRoot, projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
634
- const localPackages = [];
635
- for (const project of projectDependencies.dependencies.filter((dep) => dep.node.type === "lib" && dep.node.data.root !== projectRoot && dep.node.data.root !== workspaceRoot)) {
636
- const projectNode = project.node;
637
- if (projectNode.data.root) {
638
- const projectPackageJsonPath = _chunkEHVHDVI3cjs.joinPaths.call(void 0, workspaceRoot, projectNode.data.root, "package.json");
639
- if (_fs.existsSync.call(void 0, projectPackageJsonPath)) {
640
- const projectPackageJsonContent = await _promises.readFile.call(void 0, projectPackageJsonPath, "utf8");
641
- const projectPackageJson = JSON.parse(projectPackageJsonContent);
642
- if (projectPackageJson.private !== false) {
643
- localPackages.push(projectPackageJson);
644
- }
645
- }
688
+ var createStormConfig = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, async (extensionName, schema, workspaceRoot, skipLogs = false) => {
689
+ let result;
690
+ if (!_optionalChain([_static_cache, 'optionalAccess', _29 => _29.data]) || !_optionalChain([_static_cache, 'optionalAccess', _30 => _30.timestamp]) || _static_cache.timestamp < Date.now() - 8e3) {
691
+ let _workspaceRoot = workspaceRoot;
692
+ if (!_workspaceRoot) {
693
+ _workspaceRoot = _chunk2Z7WS4H3cjs.findWorkspaceRoot.call(void 0, );
646
694
  }
647
- }
648
- if (localPackages.length > 0) {
649
- _chunkEHVHDVI3cjs.writeTrace.call(void 0, `\u{1F4E6} Adding local packages to package.json: ${localPackages.map((p) => p.name).join(", ")}`);
650
- packageJson.peerDependencies = localPackages.reduce((ret, localPackage) => {
651
- if (!ret[localPackage.name]) {
652
- ret[localPackage.name] = `>=${localPackage.version || "0.0.1"}`;
653
- }
654
- return ret;
655
- }, _nullishCoalesce(packageJson.peerDependencies, () => ( {})));
656
- packageJson.peerDependenciesMeta = localPackages.reduce((ret, localPackage) => {
657
- if (!ret[localPackage.name]) {
658
- ret[localPackage.name] = {
659
- optional: false
660
- };
661
- }
662
- return ret;
663
- }, _nullishCoalesce(packageJson.peerDependenciesMeta, () => ( {})));
664
- packageJson.devDependencies = localPackages.reduce((ret, localPackage) => {
665
- if (!ret[localPackage.name]) {
666
- ret[localPackage.name] = localPackage.version || "0.0.1";
667
- }
668
- return ret;
669
- }, _nullishCoalesce(packageJson.peerDependencies, () => ( {})));
670
- } else {
671
- _chunkEHVHDVI3cjs.writeTrace.call(void 0, "\u{1F4E6} No local packages dependencies to add to package.json");
672
- }
673
- return packageJson;
674
- }, "addPackageDependencies");
675
- var addWorkspacePackageJsonFields = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, async (config, projectRoot, sourceRoot, projectName, includeSrc = false, packageJson) => {
676
- const workspaceRoot = config.workspaceRoot ? config.workspaceRoot : _chunkEHVHDVI3cjs.findWorkspaceRoot.call(void 0, );
677
- const workspacePackageJsonContent = await _promises.readFile.call(void 0, _chunkEHVHDVI3cjs.joinPaths.call(void 0, workspaceRoot, "package.json"), "utf8");
678
- const workspacePackageJson = JSON.parse(workspacePackageJsonContent);
679
- packageJson.type ??= "module";
680
- packageJson.sideEffects ??= false;
681
- if (includeSrc === true) {
682
- let distSrc = sourceRoot.replace(projectRoot, "");
683
- if (distSrc.startsWith("/")) {
684
- distSrc = distSrc.substring(1);
695
+ const configEnv = getConfigEnv();
696
+ const defaultConfig = await _chunk2Z7WS4H3cjs.getDefaultConfig.call(void 0, _workspaceRoot);
697
+ const configFile = await getConfigFile(_workspaceRoot);
698
+ if (!configFile && !skipLogs) {
699
+ _chunk2Z7WS4H3cjs.writeWarning.call(void 0, "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", {
700
+ logLevel: "all"
701
+ });
685
702
  }
686
- packageJson.source ??= `${_chunkEHVHDVI3cjs.joinPaths.call(void 0, distSrc, "index.ts").replaceAll("\\", "/")}`;
703
+ result = await _chunk2Z7WS4H3cjs.StormConfigSchema.parseAsync(_defu2.default.call(void 0, configEnv, configFile, defaultConfig));
704
+ result.workspaceRoot ??= _workspaceRoot;
705
+ } else {
706
+ result = _static_cache.data;
687
707
  }
688
- packageJson.files ??= [
689
- "dist/**/*"
690
- ];
691
- if (includeSrc === true && !packageJson.files.includes("src")) {
692
- packageJson.files.push("src/**/*");
708
+ if (schema && extensionName) {
709
+ result.extensions = {
710
+ ...result.extensions,
711
+ [extensionName]: createConfigExtension(extensionName, schema)
712
+ };
693
713
  }
694
- packageJson.publishConfig ??= {
695
- access: "public"
714
+ _static_cache = {
715
+ timestamp: Date.now(),
716
+ data: result
696
717
  };
697
- packageJson.description ??= workspacePackageJson.description;
698
- packageJson.homepage ??= workspacePackageJson.homepage;
699
- packageJson.bugs ??= workspacePackageJson.bugs;
700
- packageJson.license ??= workspacePackageJson.license;
701
- packageJson.keywords ??= workspacePackageJson.keywords;
702
- packageJson.funding ??= workspacePackageJson.funding;
703
- packageJson.author ??= workspacePackageJson.author;
704
- packageJson.maintainers ??= workspacePackageJson.maintainers;
705
- if (!packageJson.maintainers && packageJson.author) {
706
- packageJson.maintainers = [
707
- packageJson.author
708
- ];
709
- }
710
- packageJson.contributors ??= workspacePackageJson.contributors;
711
- if (!packageJson.contributors && packageJson.author) {
712
- packageJson.contributors = [
713
- packageJson.author
714
- ];
715
- }
716
- packageJson.repository ??= workspacePackageJson.repository;
717
- packageJson.repository.directory ??= projectRoot ? projectRoot : _chunkEHVHDVI3cjs.joinPaths.call(void 0, "packages", projectName);
718
- return packageJson;
719
- }, "addWorkspacePackageJsonFields");
720
- var addPackageJsonExport = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (file, type = "module", sourceRoot) => {
721
- let entry = file.replaceAll("\\", "/");
722
- if (sourceRoot) {
723
- entry = entry.replace(sourceRoot, "");
724
- }
725
- return {
726
- "import": {
727
- "types": `./dist/${entry}.d.${type === "module" ? "ts" : "mts"}`,
728
- "default": `./dist/${entry}.${type === "module" ? "js" : "mjs"}`
729
- },
730
- "require": {
731
- "types": `./dist/${entry}.d.${type === "commonjs" ? "ts" : "cts"}`,
732
- "default": `./dist/${entry}.${type === "commonjs" ? "js" : "cjs"}`
733
- },
734
- "default": {
735
- "types": `./dist/${entry}.d.ts`,
736
- "default": `./dist/${entry}.js`
737
- }
718
+ return result;
719
+ }, "createStormConfig");
720
+ var createConfigExtension = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (extensionName, schema) => {
721
+ const extension_cache_key = {
722
+ extensionName
738
723
  };
739
- }, "addPackageJsonExport");
724
+ if (_extension_cache.has(extension_cache_key)) {
725
+ return _extension_cache.get(extension_cache_key);
726
+ }
727
+ let extension = getExtensionEnv(extensionName);
728
+ if (schema) {
729
+ extension = schema.parse(extension);
730
+ }
731
+ _extension_cache.set(extension_cache_key, extension);
732
+ return extension;
733
+ }, "createConfigExtension");
734
+ var loadStormConfig = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, async (workspaceRoot, skipLogs = false) => {
735
+ const config = await createStormConfig(void 0, void 0, workspaceRoot, skipLogs);
736
+ setConfigEnv(config);
737
+ if (!skipLogs) {
738
+ _chunk2Z7WS4H3cjs.writeTrace.call(void 0, `\u2699\uFE0F Using Storm configuration:
739
+ ${_chunk2Z7WS4H3cjs.formatLogMessage.call(void 0, config)}`, config);
740
+ }
741
+ return config;
742
+ }, "loadStormConfig");
743
+
744
+ // ../config-tools/src/get-config.ts
745
+ var getConfig = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (workspaceRoot, skipLogs = false) => {
746
+ return loadStormConfig(workspaceRoot, skipLogs);
747
+ }, "getConfig");
740
748
 
741
749
  // ../build-tools/src/utilities/get-entry-points.ts
742
750
 
743
751
  var getEntryPoints = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, async (config, projectRoot, sourceRoot, entry, emitOnAll = false) => {
744
- const workspaceRoot = config.workspaceRoot ? config.workspaceRoot : _chunkEHVHDVI3cjs.findWorkspaceRoot.call(void 0, );
752
+ const workspaceRoot = config.workspaceRoot ? config.workspaceRoot : _chunk2Z7WS4H3cjs.findWorkspaceRoot.call(void 0, );
745
753
  const entryPoints = [];
746
754
  if (entry) {
747
755
  if (Array.isArray(entry)) {
@@ -753,7 +761,7 @@ var getEntryPoints = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, async
753
761
  }
754
762
  }
755
763
  if (emitOnAll) {
756
- entryPoints.push(_chunkEHVHDVI3cjs.joinPaths.call(void 0, workspaceRoot, sourceRoot || projectRoot, "**/*.{ts,tsx}"));
764
+ entryPoints.push(_chunk2Z7WS4H3cjs.joinPaths.call(void 0, workspaceRoot, sourceRoot || projectRoot, "**/*.{ts,tsx}"));
757
765
  }
758
766
  const results = [];
759
767
  for (const entryPoint in entryPoints) {
@@ -762,9 +770,9 @@ var getEntryPoints = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, async
762
770
  withFileTypes: true
763
771
  });
764
772
  results.push(...files.reduce((ret, filePath) => {
765
- const result = _chunkEHVHDVI3cjs.correctPaths.call(void 0, _chunkEHVHDVI3cjs.joinPaths.call(void 0, filePath.path, filePath.name).replaceAll(_chunkEHVHDVI3cjs.correctPaths.call(void 0, workspaceRoot), "").replaceAll(_chunkEHVHDVI3cjs.correctPaths.call(void 0, projectRoot), ""));
773
+ const result = _chunk2Z7WS4H3cjs.correctPaths.call(void 0, _chunk2Z7WS4H3cjs.joinPaths.call(void 0, filePath.path, filePath.name).replaceAll(_chunk2Z7WS4H3cjs.correctPaths.call(void 0, workspaceRoot), "").replaceAll(_chunk2Z7WS4H3cjs.correctPaths.call(void 0, projectRoot), ""));
766
774
  if (result) {
767
- _chunkEHVHDVI3cjs.writeDebug.call(void 0, `Trying to add entry point ${result} at "${_chunkEHVHDVI3cjs.joinPaths.call(void 0, filePath.path, filePath.name)}"`, config);
775
+ _chunk2Z7WS4H3cjs.writeDebug.call(void 0, `Trying to add entry point ${result} at "${_chunk2Z7WS4H3cjs.joinPaths.call(void 0, filePath.path, filePath.name)}"`, config);
768
776
  if (!results.includes(result)) {
769
777
  results.push(result);
770
778
  }
@@ -792,6 +800,10 @@ var getEnv = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (builder, opt
792
800
  };
793
801
  }, "getEnv");
794
802
 
803
+ // ../build-tools/src/utilities/read-nx-config.ts
804
+
805
+
806
+
795
807
  // ../build-tools/src/utilities/task-graph.ts
796
808
  var _createtaskgraph = require('nx/src/tasks-runner/create-task-graph');
797
809
 
@@ -805,26 +817,26 @@ var resolveOptions = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, async
805
817
  if (!workspaceRoot) {
806
818
  throw new Error("Cannot find Nx workspace root");
807
819
  }
808
- const config = await loadStormConfig(workspaceRoot.dir);
809
- _chunkEHVHDVI3cjs.writeDebug.call(void 0, " \u2699\uFE0F Resolving build options", config);
810
- const stopwatch = _chunkEHVHDVI3cjs.getStopwatch.call(void 0, "Build options resolution");
820
+ const config = await getConfig(workspaceRoot.dir);
821
+ _chunk2Z7WS4H3cjs.writeDebug.call(void 0, " \u2699\uFE0F Resolving build options", config);
822
+ const stopwatch = _chunk2Z7WS4H3cjs.getStopwatch.call(void 0, "Build options resolution");
811
823
  const projectGraph = await _devkit.createProjectGraphAsync.call(void 0, {
812
824
  exitOnError: true
813
825
  });
814
- const projectJsonPath = _chunkEHVHDVI3cjs.joinPaths.call(void 0, workspaceRoot.dir, projectRoot, "project.json");
826
+ const projectJsonPath = _chunk2Z7WS4H3cjs.joinPaths.call(void 0, workspaceRoot.dir, projectRoot, "project.json");
815
827
  if (!await _node.hfs.isFile(projectJsonPath)) {
816
828
  throw new Error("Cannot find project.json configuration");
817
829
  }
818
830
  const projectJson = await _node.hfs.json(projectJsonPath);
819
831
  const projectName = projectJson.name;
820
832
  const projectConfigurations = _devkit.readProjectsConfigurationFromProjectGraph.call(void 0, projectGraph);
821
- if (!_optionalChain([projectConfigurations, 'optionalAccess', _37 => _37.projects, 'optionalAccess', _38 => _38[projectName]])) {
833
+ if (!_optionalChain([projectConfigurations, 'optionalAccess', _31 => _31.projects, 'optionalAccess', _32 => _32[projectName]])) {
822
834
  throw new Error("The Build process failed because the project does not have a valid configuration in the project.json file. Check if the file exists in the root of the project.");
823
835
  }
824
836
  const options = _defu2.default.call(void 0, userOptions, _chunk5KRF6IVWcjs.DEFAULT_BUILD_OPTIONS);
825
837
  options.name ??= `${projectName}-${options.format}`;
826
838
  options.target ??= DEFAULT_TARGET;
827
- const packageJsonPath = _chunkEHVHDVI3cjs.joinPaths.call(void 0, workspaceRoot.dir, options.projectRoot, "package.json");
839
+ const packageJsonPath = _chunk2Z7WS4H3cjs.joinPaths.call(void 0, workspaceRoot.dir, options.projectRoot, "package.json");
828
840
  if (!await _node.hfs.isFile(packageJsonPath)) {
829
841
  throw new Error("Cannot find package.json configuration");
830
842
  }
@@ -833,20 +845,20 @@ var resolveOptions = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, async
833
845
  ...options,
834
846
  config,
835
847
  ...userOptions,
836
- tsconfig: _chunkEHVHDVI3cjs.joinPaths.call(void 0, projectRoot, userOptions.tsconfig ? userOptions.tsconfig.replace(projectRoot, "") : "tsconfig.json"),
848
+ tsconfig: _chunk2Z7WS4H3cjs.joinPaths.call(void 0, projectRoot, userOptions.tsconfig ? userOptions.tsconfig.replace(projectRoot, "") : "tsconfig.json"),
837
849
  format: options.format || "cjs",
838
850
  entryPoints: await getEntryPoints(config, projectRoot, projectJson.sourceRoot, userOptions.entry || [
839
851
  "./src/index.ts"
840
852
  ], userOptions.emitOnAll),
841
- outdir: userOptions.outputPath || _chunkEHVHDVI3cjs.joinPaths.call(void 0, "dist", projectRoot),
853
+ outdir: userOptions.outputPath || _chunk2Z7WS4H3cjs.joinPaths.call(void 0, "dist", projectRoot),
842
854
  plugins: [],
843
855
  name: userOptions.name || projectName,
844
856
  projectConfigurations,
845
857
  projectName,
846
858
  projectGraph,
847
- sourceRoot: userOptions.sourceRoot || projectJson.sourceRoot || _chunkEHVHDVI3cjs.joinPaths.call(void 0, projectRoot, "src"),
859
+ sourceRoot: userOptions.sourceRoot || projectJson.sourceRoot || _chunk2Z7WS4H3cjs.joinPaths.call(void 0, projectRoot, "src"),
848
860
  minify: userOptions.minify || !userOptions.debug,
849
- verbose: userOptions.verbose || _chunkEHVHDVI3cjs.isVerbose.call(void 0, ) || userOptions.debug === true,
861
+ verbose: userOptions.verbose || _chunk2Z7WS4H3cjs.isVerbose.call(void 0, ) || userOptions.debug === true,
850
862
  includeSrc: userOptions.includeSrc === true,
851
863
  metafile: userOptions.metafile !== false,
852
864
  generatePackageJson: userOptions.generatePackageJson !== false,
@@ -880,14 +892,14 @@ var resolveOptions = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, async
880
892
  return result;
881
893
  }, "resolveOptions");
882
894
  async function generatePackageJson(options) {
883
- if (options.generatePackageJson !== false && await _node.hfs.isFile(_chunkEHVHDVI3cjs.joinPaths.call(void 0, options.projectRoot, "package.json"))) {
884
- _chunkEHVHDVI3cjs.writeDebug.call(void 0, " \u270D\uFE0F Writing package.json file", options.config);
885
- const stopwatch = _chunkEHVHDVI3cjs.getStopwatch.call(void 0, "Write package.json file");
886
- const packageJsonPath = _chunkEHVHDVI3cjs.joinPaths.call(void 0, options.projectRoot, "project.json");
895
+ if (options.generatePackageJson !== false && await _node.hfs.isFile(_chunk2Z7WS4H3cjs.joinPaths.call(void 0, options.projectRoot, "package.json"))) {
896
+ _chunk2Z7WS4H3cjs.writeDebug.call(void 0, " \u270D\uFE0F Writing package.json file", options.config);
897
+ const stopwatch = _chunk2Z7WS4H3cjs.getStopwatch.call(void 0, "Write package.json file");
898
+ const packageJsonPath = _chunk2Z7WS4H3cjs.joinPaths.call(void 0, options.projectRoot, "project.json");
887
899
  if (!await _node.hfs.isFile(packageJsonPath)) {
888
900
  throw new Error("Cannot find package.json configuration");
889
901
  }
890
- let packageJson = await _node.hfs.json(_chunkEHVHDVI3cjs.joinPaths.call(void 0, options.config.workspaceRoot, options.projectRoot, "package.json"));
902
+ let packageJson = await _node.hfs.json(_chunk2Z7WS4H3cjs.joinPaths.call(void 0, options.config.workspaceRoot, options.projectRoot, "package.json"));
891
903
  if (!packageJson) {
892
904
  throw new Error("Cannot find package.json configuration file");
893
905
  }
@@ -925,15 +937,15 @@ async function generatePackageJson(options) {
925
937
  }
926
938
  return ret;
927
939
  }, packageJson.exports);
928
- await _devkit.writeJsonFile.call(void 0, _chunkEHVHDVI3cjs.joinPaths.call(void 0, options.outdir, "package.json"), packageJson);
940
+ await _devkit.writeJsonFile.call(void 0, _chunk2Z7WS4H3cjs.joinPaths.call(void 0, options.outdir, "package.json"), packageJson);
929
941
  stopwatch();
930
942
  }
931
943
  return options;
932
944
  }
933
945
  _chunkUSNT2KNTcjs.__name.call(void 0, generatePackageJson, "generatePackageJson");
934
946
  async function executeTSDown(options) {
935
- _chunkEHVHDVI3cjs.writeDebug.call(void 0, ` \u{1F680} Running ${options.name} build`, options.config);
936
- const stopwatch = _chunkEHVHDVI3cjs.getStopwatch.call(void 0, `${options.name} build`);
947
+ _chunk2Z7WS4H3cjs.writeDebug.call(void 0, ` \u{1F680} Running ${options.name} build`, options.config);
948
+ const stopwatch = _chunk2Z7WS4H3cjs.getStopwatch.call(void 0, `${options.name} build`);
937
949
  await _tsdown.build.call(void 0, {
938
950
  ...options,
939
951
  entry: options.entryPoints,
@@ -945,27 +957,27 @@ async function executeTSDown(options) {
945
957
  }
946
958
  _chunkUSNT2KNTcjs.__name.call(void 0, executeTSDown, "executeTSDown");
947
959
  async function copyBuildAssets(options) {
948
- _chunkEHVHDVI3cjs.writeDebug.call(void 0, ` \u{1F4CB} Copying asset files to output directory: ${options.outdir}`, options.config);
949
- const stopwatch = _chunkEHVHDVI3cjs.getStopwatch.call(void 0, `${options.name} asset copy`);
950
- await copyAssets(options.config, _nullishCoalesce(options.assets, () => ( [])), options.outdir, options.projectRoot, options.projectName, options.sourceRoot, true, false);
960
+ _chunk2Z7WS4H3cjs.writeDebug.call(void 0, ` \u{1F4CB} Copying asset files to output directory: ${options.outdir}`, options.config);
961
+ const stopwatch = _chunk2Z7WS4H3cjs.getStopwatch.call(void 0, `${options.name} asset copy`);
962
+ await copyAssets(options.config, _nullishCoalesce(options.assets, () => ( [])), options.outdir, options.projectRoot, options.sourceRoot, true, false);
951
963
  stopwatch();
952
964
  return options;
953
965
  }
954
966
  _chunkUSNT2KNTcjs.__name.call(void 0, copyBuildAssets, "copyBuildAssets");
955
967
  async function reportResults(options) {
956
- _chunkEHVHDVI3cjs.writeSuccess.call(void 0, ` \u{1F4E6} The ${options.name} build completed successfully`, options.config);
968
+ _chunk2Z7WS4H3cjs.writeSuccess.call(void 0, ` \u{1F4E6} The ${options.name} build completed successfully`, options.config);
957
969
  }
958
970
  _chunkUSNT2KNTcjs.__name.call(void 0, reportResults, "reportResults");
959
971
  async function cleanOutputPath(options) {
960
972
  if (options.clean !== false && options.outdir) {
961
- await _chunkEHVHDVI3cjs.clean.call(void 0, options.name, options.outdir, options.config);
973
+ await _chunk2Z7WS4H3cjs.clean.call(void 0, options.name, options.outdir, options.config);
962
974
  }
963
975
  return options;
964
976
  }
965
977
  _chunkUSNT2KNTcjs.__name.call(void 0, cleanOutputPath, "cleanOutputPath");
966
978
  async function build(options) {
967
- _chunkEHVHDVI3cjs.writeDebug.call(void 0, ` \u26A1 Executing Storm TSDown pipeline`);
968
- const stopwatch = _chunkEHVHDVI3cjs.getStopwatch.call(void 0, "TSDown pipeline");
979
+ _chunk2Z7WS4H3cjs.writeDebug.call(void 0, ` \u26A1 Executing Storm TSDown pipeline`);
980
+ const stopwatch = _chunk2Z7WS4H3cjs.getStopwatch.call(void 0, "TSDown pipeline");
969
981
  try {
970
982
  const opts = Array.isArray(options) ? options : [
971
983
  options
@@ -983,11 +995,11 @@ async function build(options) {
983
995
  await reportResults(opt);
984
996
  }));
985
997
  } else {
986
- _chunkEHVHDVI3cjs.writeWarning.call(void 0, " \u{1F6A7} No options were passed to TSBuild. Please check the parameters passed to the `build` function.");
998
+ _chunk2Z7WS4H3cjs.writeWarning.call(void 0, " \u{1F6A7} No options were passed to TSBuild. Please check the parameters passed to the `build` function.");
987
999
  }
988
- _chunkEHVHDVI3cjs.writeSuccess.call(void 0, " \u{1F3C1} TSDown pipeline build completed successfully");
1000
+ _chunk2Z7WS4H3cjs.writeSuccess.call(void 0, " \u{1F3C1} TSDown pipeline build completed successfully");
989
1001
  } catch (error) {
990
- _chunkEHVHDVI3cjs.writeFatal.call(void 0, " \u274C Fatal errors occurred during the build that could not be recovered from. The build process has been terminated.");
1002
+ _chunk2Z7WS4H3cjs.writeFatal.call(void 0, " \u274C Fatal errors occurred during the build that could not be recovered from. The build process has been terminated.");
991
1003
  throw error;
992
1004
  } finally {
993
1005
  stopwatch();