@storm-software/unbuild 0.41.21 → 0.41.22

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.
Files changed (40) hide show
  1. package/README.md +1 -1
  2. package/bin/unbuild.cjs +798 -412
  3. package/bin/unbuild.js +826 -420
  4. package/dist/build.cjs +8 -8
  5. package/dist/build.js +7 -7
  6. package/dist/{chunk-3GQAWCBQ.js → chunk-3RG5ZIWI.js} +0 -3
  7. package/dist/{chunk-HZNOKNKE.js → chunk-4KHUAP4R.js} +13 -10
  8. package/dist/{chunk-BFBEOACU.cjs → chunk-ALGMIE4E.cjs} +471 -257
  9. package/dist/{chunk-5FQ2QYFQ.js → chunk-ATN45QRM.js} +418 -204
  10. package/dist/{chunk-F4MPFQDI.cjs → chunk-FAW45G3E.cjs} +13 -10
  11. package/dist/{chunk-3BXXHK3F.cjs → chunk-MO3MUSJO.cjs} +7 -15
  12. package/dist/chunk-OBGZSXTJ.cjs +10 -0
  13. package/dist/{chunk-DUDE4LYM.js → chunk-PCGRQKDH.js} +2 -10
  14. package/dist/{chunk-PWE7CANF.cjs → chunk-Q2G4VMOW.cjs} +198 -130
  15. package/dist/{chunk-ITHOVA3D.cjs → chunk-Q3NBYYR4.cjs} +4 -12
  16. package/dist/{chunk-ZB2JWLJS.cjs → chunk-Q4VUCJPK.cjs} +51 -16
  17. package/dist/chunk-WQLDD6CA.js +106 -0
  18. package/dist/{chunk-3BDIPKMO.js → chunk-XQLLOGJZ.js} +197 -129
  19. package/dist/{chunk-SMAV5VSP.js → chunk-XWLZOFQ4.js} +6 -14
  20. package/dist/clean.cjs +4 -4
  21. package/dist/clean.js +3 -3
  22. package/dist/index.cjs +9 -9
  23. package/dist/index.js +8 -8
  24. package/dist/plugins/analyze.cjs +4 -4
  25. package/dist/plugins/analyze.js +3 -3
  26. package/dist/plugins/on-error.cjs +4 -4
  27. package/dist/plugins/on-error.js +3 -3
  28. package/dist/plugins/swc.cjs +5 -8
  29. package/dist/plugins/swc.js +4 -7
  30. package/dist/plugins/tsc.cjs +4 -4
  31. package/dist/plugins/tsc.js +3 -3
  32. package/dist/plugins/type-definitions.cjs +9 -6
  33. package/dist/plugins/type-definitions.js +9 -6
  34. package/dist/types.cjs +1 -1
  35. package/dist/types.js +1 -1
  36. package/package.json +1 -1
  37. package/dist/chunk-BGYQAVKQ.cjs +0 -13
  38. package/dist/chunk-XXRSY6EE.js +0 -71
  39. /package/dist/{chunk-OULCUN6I.js → chunk-GGNOJ77I.js} +0 -0
  40. /package/dist/{chunk-ORA4UQMU.cjs → chunk-SFZRYJZ2.cjs} +0 -0
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  cleanDirectories
3
- } from "./chunk-DUDE4LYM.js";
3
+ } from "./chunk-PCGRQKDH.js";
4
4
  import {
5
5
  analyzePlugin
6
- } from "./chunk-SMAV5VSP.js";
6
+ } from "./chunk-XWLZOFQ4.js";
7
7
  import {
8
8
  onErrorPlugin
9
- } from "./chunk-HZNOKNKE.js";
9
+ } from "./chunk-4KHUAP4R.js";
10
10
  import {
11
11
  loadConfig,
12
12
  tscPlugin
13
- } from "./chunk-XXRSY6EE.js";
13
+ } from "./chunk-WQLDD6CA.js";
14
14
  import {
15
15
  COLOR_KEYS,
16
16
  LogLevel,
@@ -33,13 +33,14 @@ import {
33
33
  writeSuccess,
34
34
  writeTrace,
35
35
  writeWarning
36
- } from "./chunk-3BDIPKMO.js";
37
- import {
38
- __name
39
- } from "./chunk-3GQAWCBQ.js";
36
+ } from "./chunk-XQLLOGJZ.js";
40
37
 
41
38
  // src/build.ts
42
- import { createProjectGraphAsync as createProjectGraphAsync2, readCachedProjectGraph as readCachedProjectGraph2, writeJsonFile } from "@nx/devkit";
39
+ import {
40
+ createProjectGraphAsync as createProjectGraphAsync2,
41
+ readCachedProjectGraph as readCachedProjectGraph2,
42
+ writeJsonFile
43
+ } from "@nx/devkit";
43
44
  import { getHelperDependency, HelperDependency } from "@nx/js";
44
45
  import { calculateProjectBuildableDependencies as calculateProjectBuildableDependencies2 } from "@nx/js/src/utils/buildable-libs-utils";
45
46
 
@@ -60,7 +61,7 @@ import { relative } from "path";
60
61
  import { CopyAssetsHandler } from "@nx/js/src/utils/assets/copy-assets-handler";
61
62
  import { glob } from "glob";
62
63
  import { readFile, writeFile } from "node:fs/promises";
63
- var copyAssets = /* @__PURE__ */ __name(async (config, assets, outputPath, projectRoot, sourceRoot, generatePackageJson2 = true, includeSrc = false, banner, footer) => {
64
+ var copyAssets = async (config, assets, outputPath, projectRoot, sourceRoot, generatePackageJson2 = true, includeSrc = false, banner, footer) => {
64
65
  const pendingAssets = Array.from(assets ?? []);
65
66
  pendingAssets.push({
66
67
  input: projectRoot,
@@ -86,8 +87,11 @@ var copyAssets = /* @__PURE__ */ __name(async (config, assets, outputPath, proje
86
87
  output: "src/"
87
88
  });
88
89
  }
89
- writeTrace(`\u{1F4DD} Copying the following assets to the output directory:
90
- ${pendingAssets.map((pendingAsset) => typeof pendingAsset === "string" ? ` - ${pendingAsset} -> ${outputPath}` : ` - ${pendingAsset.input}/${pendingAsset.glob} -> ${joinPaths(outputPath, pendingAsset.output)}`).join("\n")}`, config);
90
+ writeTrace(
91
+ `\u{1F4DD} Copying the following assets to the output directory:
92
+ ${pendingAssets.map((pendingAsset) => typeof pendingAsset === "string" ? ` - ${pendingAsset} -> ${outputPath}` : ` - ${pendingAsset.input}/${pendingAsset.glob} -> ${joinPaths(outputPath, pendingAsset.output)}`).join("\n")}`,
93
+ config
94
+ );
91
95
  const assetHandler = new CopyAssetsHandler({
92
96
  projectDir: projectRoot,
93
97
  rootDir: config.workspaceRoot,
@@ -96,28 +100,45 @@ ${pendingAssets.map((pendingAsset) => typeof pendingAsset === "string" ? ` - ${p
96
100
  });
97
101
  await assetHandler.processAllAssetsOnce();
98
102
  if (includeSrc === true) {
99
- writeDebug(`\u{1F4DD} Adding banner and writing source files: ${joinPaths(outputPath, "src")}`, config);
103
+ writeDebug(
104
+ `\u{1F4DD} Adding banner and writing source files: ${joinPaths(
105
+ outputPath,
106
+ "src"
107
+ )}`,
108
+ config
109
+ );
100
110
  const files = await glob([
101
111
  joinPaths(config.workspaceRoot, outputPath, "src/**/*.ts"),
102
112
  joinPaths(config.workspaceRoot, outputPath, "src/**/*.tsx"),
103
113
  joinPaths(config.workspaceRoot, outputPath, "src/**/*.js"),
104
114
  joinPaths(config.workspaceRoot, outputPath, "src/**/*.jsx")
105
115
  ]);
106
- await Promise.allSettled(files.map(async (file) => writeFile(file, `${banner && typeof banner === "string" ? banner.startsWith("//") ? banner : `// ${banner}` : ""}
116
+ await Promise.allSettled(
117
+ files.map(
118
+ async (file) => writeFile(
119
+ file,
120
+ `${banner && typeof banner === "string" ? banner.startsWith("//") ? banner : `// ${banner}` : ""}
107
121
 
108
122
  ${await readFile(file, "utf8")}
109
123
 
110
- ${footer && typeof footer === "string" ? footer.startsWith("//") ? footer : `// ${footer}` : ""}`)));
124
+ ${footer && typeof footer === "string" ? footer.startsWith("//") ? footer : `// ${footer}` : ""}`
125
+ )
126
+ )
127
+ );
111
128
  }
112
- }, "copyAssets");
129
+ };
113
130
 
114
131
  // ../build-tools/src/utilities/generate-package-json.ts
115
132
  import { calculateProjectBuildableDependencies } from "@nx/js/src/utils/buildable-libs-utils";
116
133
  import { Glob } from "glob";
117
134
  import { existsSync, readFileSync } from "node:fs";
118
135
  import { readFile as readFile2 } from "node:fs/promises";
119
- import { createProjectGraphAsync, readCachedProjectGraph, readProjectsConfigurationFromProjectGraph } from "nx/src/project-graph/project-graph";
120
- var addPackageDependencies = /* @__PURE__ */ __name(async (workspaceRoot, projectRoot, projectName, packageJson) => {
136
+ import {
137
+ createProjectGraphAsync,
138
+ readCachedProjectGraph,
139
+ readProjectsConfigurationFromProjectGraph
140
+ } from "nx/src/project-graph/project-graph";
141
+ var addPackageDependencies = async (workspaceRoot, projectRoot, projectName, packageJson) => {
121
142
  let projectGraph;
122
143
  try {
123
144
  projectGraph = readCachedProjectGraph();
@@ -126,16 +147,35 @@ var addPackageDependencies = /* @__PURE__ */ __name(async (workspaceRoot, projec
126
147
  projectGraph = readCachedProjectGraph();
127
148
  }
128
149
  if (!projectGraph) {
129
- throw new Error("The Build process failed because the project graph is not available. Please run the build command again.");
130
- }
131
- const projectDependencies = calculateProjectBuildableDependencies(void 0, projectGraph, workspaceRoot, projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
150
+ throw new Error(
151
+ "The Build process failed because the project graph is not available. Please run the build command again."
152
+ );
153
+ }
154
+ const projectDependencies = calculateProjectBuildableDependencies(
155
+ void 0,
156
+ projectGraph,
157
+ workspaceRoot,
158
+ projectName,
159
+ process.env.NX_TASK_TARGET_TARGET || "build",
160
+ process.env.NX_TASK_TARGET_CONFIGURATION || "production",
161
+ true
162
+ );
132
163
  const localPackages = [];
133
- for (const project of projectDependencies.dependencies.filter((dep) => dep.node.type === "lib" && dep.node.data?.root !== projectRoot && dep.node.data?.root !== workspaceRoot)) {
164
+ for (const project of projectDependencies.dependencies.filter(
165
+ (dep) => dep.node.type === "lib" && dep.node.data?.root !== projectRoot && dep.node.data?.root !== workspaceRoot
166
+ )) {
134
167
  const projectNode = project.node;
135
168
  if (projectNode.data.root) {
136
- const projectPackageJsonPath = joinPaths(workspaceRoot, projectNode.data.root, "package.json");
169
+ const projectPackageJsonPath = joinPaths(
170
+ workspaceRoot,
171
+ projectNode.data.root,
172
+ "package.json"
173
+ );
137
174
  if (existsSync(projectPackageJsonPath)) {
138
- const projectPackageJsonContent = await readFile2(projectPackageJsonPath, "utf8");
175
+ const projectPackageJsonContent = await readFile2(
176
+ projectPackageJsonPath,
177
+ "utf8"
178
+ );
139
179
  const projectPackageJson = JSON.parse(projectPackageJsonContent);
140
180
  if (projectPackageJson.private !== true) {
141
181
  localPackages.push(projectPackageJson);
@@ -144,19 +184,33 @@ var addPackageDependencies = /* @__PURE__ */ __name(async (workspaceRoot, projec
144
184
  }
145
185
  }
146
186
  if (localPackages.length > 0) {
147
- writeTrace(`\u{1F4E6} Adding local packages to package.json: ${localPackages.map((p) => p.name).join(", ")}`);
148
- const projectJsonFile = await readFile2(joinPaths(projectRoot, "project.json"), "utf8");
187
+ writeTrace(
188
+ `\u{1F4E6} Adding local packages to package.json: ${localPackages.map((p) => p.name).join(", ")}`
189
+ );
190
+ const projectJsonFile = await readFile2(
191
+ joinPaths(projectRoot, "project.json"),
192
+ "utf8"
193
+ );
149
194
  const projectJson = JSON.parse(projectJsonFile);
150
195
  const projectName2 = projectJson.name;
151
196
  const projectConfigurations = readProjectsConfigurationFromProjectGraph(projectGraph);
152
197
  if (!projectConfigurations?.projects?.[projectName2]) {
153
- 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.");
198
+ throw new Error(
199
+ "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."
200
+ );
154
201
  }
155
202
  const implicitDependencies = projectConfigurations.projects?.[projectName2].implicitDependencies?.reduce((ret, dep) => {
156
203
  if (projectConfigurations.projects?.[dep]) {
157
- const depPackageJsonPath = joinPaths(workspaceRoot, projectConfigurations.projects[dep].root, "package.json");
204
+ const depPackageJsonPath = joinPaths(
205
+ workspaceRoot,
206
+ projectConfigurations.projects[dep].root,
207
+ "package.json"
208
+ );
158
209
  if (existsSync(depPackageJsonPath)) {
159
- const depPackageJsonContent = readFileSync(depPackageJsonPath, "utf8");
210
+ const depPackageJsonContent = readFileSync(
211
+ depPackageJsonPath,
212
+ "utf8"
213
+ );
160
214
  const depPackageJson = JSON.parse(depPackageJsonContent);
161
215
  if (depPackageJson.private !== true && !ret.includes(depPackageJson.name)) {
162
216
  ret.push(depPackageJson.name);
@@ -181,10 +235,13 @@ var addPackageDependencies = /* @__PURE__ */ __name(async (workspaceRoot, projec
181
235
  writeTrace("\u{1F4E6} No local packages dependencies to add to package.json");
182
236
  }
183
237
  return packageJson;
184
- }, "addPackageDependencies");
185
- var addWorkspacePackageJsonFields = /* @__PURE__ */ __name(async (workspaceConfig, projectRoot, sourceRoot, projectName, includeSrc = false, packageJson) => {
238
+ };
239
+ var addWorkspacePackageJsonFields = async (workspaceConfig, projectRoot, sourceRoot, projectName, includeSrc = false, packageJson) => {
186
240
  const workspaceRoot = workspaceConfig.workspaceRoot ? workspaceConfig.workspaceRoot : findWorkspaceRoot();
187
- const workspacePackageJsonContent = await readFile2(joinPaths(workspaceRoot, "package.json"), "utf8");
241
+ const workspacePackageJsonContent = await readFile2(
242
+ joinPaths(workspaceRoot, "package.json"),
243
+ "utf8"
244
+ );
188
245
  const workspacePackageJson = JSON.parse(workspacePackageJsonContent);
189
246
  packageJson.type ??= "module";
190
247
  packageJson.sideEffects ??= false;
@@ -195,9 +252,7 @@ var addWorkspacePackageJsonFields = /* @__PURE__ */ __name(async (workspaceConfi
195
252
  }
196
253
  packageJson.source ??= `${joinPaths(distSrc, "index.ts").replaceAll("\\", "/")}`;
197
254
  }
198
- packageJson.files ??= [
199
- "dist/**/*"
200
- ];
255
+ packageJson.files ??= ["dist/**/*"];
201
256
  if (includeSrc === true && !packageJson.files.includes("src")) {
202
257
  packageJson.files.push("src/**/*");
203
258
  }
@@ -213,25 +268,21 @@ var addWorkspacePackageJsonFields = /* @__PURE__ */ __name(async (workspaceConfi
213
268
  packageJson.author ??= workspacePackageJson.author;
214
269
  packageJson.maintainers ??= workspacePackageJson.maintainers;
215
270
  if (!packageJson.maintainers && packageJson.author) {
216
- packageJson.maintainers = [
217
- packageJson.author
218
- ];
271
+ packageJson.maintainers = [packageJson.author];
219
272
  }
220
273
  packageJson.contributors ??= workspacePackageJson.contributors;
221
274
  if (!packageJson.contributors && packageJson.author) {
222
- packageJson.contributors = [
223
- packageJson.author
224
- ];
275
+ packageJson.contributors = [packageJson.author];
225
276
  }
226
277
  packageJson.repository ??= workspacePackageJson.repository;
227
278
  packageJson.repository.directory ??= projectRoot ? projectRoot : joinPaths("packages", projectName);
228
279
  return packageJson;
229
- }, "addWorkspacePackageJsonFields");
280
+ };
230
281
 
231
282
  // ../config-tools/src/config-file/get-config-file.ts
232
283
  import { loadConfig as loadConfig2 } from "c12";
233
284
  import defu from "defu";
234
- var getConfigFileByName = /* @__PURE__ */ __name(async (fileName, filePath, options = {}) => {
285
+ var getConfigFileByName = async (fileName, filePath, options = {}) => {
235
286
  const workspacePath = filePath || findWorkspaceRoot(filePath);
236
287
  const configs = await Promise.all([
237
288
  loadConfig2({
@@ -241,7 +292,10 @@ var getConfigFileByName = /* @__PURE__ */ __name(async (fileName, filePath, opti
241
292
  envName: fileName?.toUpperCase(),
242
293
  jitiOptions: {
243
294
  debug: false,
244
- fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(process.env.STORM_CACHE_DIR || "node_modules/.cache/storm", "jiti")
295
+ fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(
296
+ process.env.STORM_CACHE_DIR || "node_modules/.cache/storm",
297
+ "jiti"
298
+ )
245
299
  },
246
300
  ...options
247
301
  }),
@@ -252,32 +306,45 @@ var getConfigFileByName = /* @__PURE__ */ __name(async (fileName, filePath, opti
252
306
  envName: fileName?.toUpperCase(),
253
307
  jitiOptions: {
254
308
  debug: false,
255
- fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(process.env.STORM_CACHE_DIR || "node_modules/.cache/storm", "jiti")
309
+ fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(
310
+ process.env.STORM_CACHE_DIR || "node_modules/.cache/storm",
311
+ "jiti"
312
+ )
256
313
  },
257
314
  configFile: fileName,
258
315
  ...options
259
316
  })
260
317
  ]);
261
318
  return defu(configs[0] ?? {}, configs[1] ?? {});
262
- }, "getConfigFileByName");
263
- var getConfigFile = /* @__PURE__ */ __name(async (filePath, additionalFileNames = []) => {
319
+ };
320
+ var getConfigFile = async (filePath, additionalFileNames = []) => {
264
321
  const workspacePath = filePath ? filePath : findWorkspaceRoot(filePath);
265
322
  const result = await getConfigFileByName("storm-workspace", workspacePath);
266
323
  let config = result.config;
267
324
  const configFile = result.configFile;
268
325
  if (config && configFile && Object.keys(config).length > 0 && !config.skipConfigLogging) {
269
- writeTrace(`Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`, {
270
- logLevel: "all"
271
- });
326
+ writeTrace(
327
+ `Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`,
328
+ {
329
+ logLevel: "all"
330
+ }
331
+ );
272
332
  }
273
333
  if (additionalFileNames && additionalFileNames.length > 0) {
274
- const results = await Promise.all(additionalFileNames.map((fileName) => getConfigFileByName(fileName, workspacePath)));
334
+ const results = await Promise.all(
335
+ additionalFileNames.map(
336
+ (fileName) => getConfigFileByName(fileName, workspacePath)
337
+ )
338
+ );
275
339
  for (const result2 of results) {
276
340
  if (result2?.config && result2?.configFile && Object.keys(result2.config).length > 0) {
277
341
  if (!config.skipConfigLogging && !result2.config.skipConfigLogging) {
278
- writeTrace(`Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`, {
279
- logLevel: "all"
280
- });
342
+ writeTrace(
343
+ `Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`,
344
+ {
345
+ logLevel: "all"
346
+ }
347
+ );
281
348
  }
282
349
  config = defu(result2.config ?? {}, config ?? {});
283
350
  }
@@ -288,23 +355,25 @@ var getConfigFile = /* @__PURE__ */ __name(async (filePath, additionalFileNames
288
355
  }
289
356
  config.configFile = configFile;
290
357
  return config;
291
- }, "getConfigFile");
358
+ };
292
359
 
293
360
  // ../config-tools/src/create-storm-config.ts
294
361
  import defu2 from "defu";
295
362
 
296
363
  // ../config-tools/src/env/get-env.ts
297
- var getExtensionEnv = /* @__PURE__ */ __name((extensionName) => {
364
+ var getExtensionEnv = (extensionName) => {
298
365
  const prefix = `STORM_EXTENSION_${extensionName.toUpperCase()}_`;
299
366
  return Object.keys(process.env).filter((key) => key.startsWith(prefix)).reduce((ret, key) => {
300
- const name = key.replace(prefix, "").split("_").map((i) => i.length > 0 ? i.trim().charAt(0).toUpperCase() + i.trim().slice(1) : "").join("");
367
+ const name = key.replace(prefix, "").split("_").map(
368
+ (i) => i.length > 0 ? i.trim().charAt(0).toUpperCase() + i.trim().slice(1) : ""
369
+ ).join("");
301
370
  if (name) {
302
371
  ret[name] = process.env[key];
303
372
  }
304
373
  return ret;
305
374
  }, {});
306
- }, "getExtensionEnv");
307
- var getConfigEnv = /* @__PURE__ */ __name(() => {
375
+ };
376
+ var getConfigEnv = () => {
308
377
  const prefix = "STORM_";
309
378
  let config = {
310
379
  extends: process.env[`${prefix}EXTENDS`] || void 0,
@@ -372,14 +441,25 @@ var getConfigEnv = /* @__PURE__ */ __name(() => {
372
441
  cyclone: process.env[`${prefix}REGISTRY_CYCLONE`] || void 0,
373
442
  container: process.env[`${prefix}REGISTRY_CONTAINER`] || void 0
374
443
  },
375
- 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`])) ? getLogLevelLabel(Number.parseInt(process.env[`${prefix}LOG_LEVEL`])) : process.env[`${prefix}LOG_LEVEL`] : void 0,
444
+ logLevel: process.env[`${prefix}LOG_LEVEL`] !== null && process.env[`${prefix}LOG_LEVEL`] !== void 0 ? process.env[`${prefix}LOG_LEVEL`] && Number.isSafeInteger(
445
+ Number.parseInt(process.env[`${prefix}LOG_LEVEL`])
446
+ ) ? getLogLevelLabel(
447
+ Number.parseInt(process.env[`${prefix}LOG_LEVEL`])
448
+ ) : process.env[`${prefix}LOG_LEVEL`] : void 0,
376
449
  skipConfigLogging: process.env[`${prefix}SKIP_CONFIG_LOGGING`] !== void 0 ? Boolean(process.env[`${prefix}SKIP_CONFIG_LOGGING`]) : void 0
377
450
  };
378
- const themeNames = Object.keys(process.env).filter((envKey) => envKey.startsWith(`${prefix}COLOR_`) && COLOR_KEYS.every((colorKey) => !envKey.startsWith(`${prefix}COLOR_LIGHT_${colorKey}`) && !envKey.startsWith(`${prefix}COLOR_DARK_${colorKey}`)));
379
- config.colors = themeNames.length > 0 ? themeNames.reduce((ret, themeName) => {
380
- ret[themeName] = getThemeColorConfigEnv(prefix, themeName);
381
- return ret;
382
- }, {}) : getThemeColorConfigEnv(prefix);
451
+ const themeNames = Object.keys(process.env).filter(
452
+ (envKey) => envKey.startsWith(`${prefix}COLOR_`) && COLOR_KEYS.every(
453
+ (colorKey) => !envKey.startsWith(`${prefix}COLOR_LIGHT_${colorKey}`) && !envKey.startsWith(`${prefix}COLOR_DARK_${colorKey}`)
454
+ )
455
+ );
456
+ config.colors = themeNames.length > 0 ? themeNames.reduce(
457
+ (ret, themeName) => {
458
+ ret[themeName] = getThemeColorConfigEnv(prefix, themeName);
459
+ return ret;
460
+ },
461
+ {}
462
+ ) : getThemeColorConfigEnv(prefix);
383
463
  if (config.docs === STORM_DEFAULT_DOCS) {
384
464
  if (config.homepage === STORM_DEFAULT_HOMEPAGE) {
385
465
  config.docs = `${STORM_DEFAULT_HOMEPAGE}/projects/${config.name}/docs`;
@@ -400,23 +480,17 @@ var getConfigEnv = /* @__PURE__ */ __name(() => {
400
480
  config = {
401
481
  ...config,
402
482
  ...parsed,
403
- colors: {
404
- ...config.colors,
405
- ...parsed.colors
406
- },
407
- extensions: {
408
- ...config.extensions,
409
- ...parsed.extensions
410
- }
483
+ colors: { ...config.colors, ...parsed.colors },
484
+ extensions: { ...config.extensions, ...parsed.extensions }
411
485
  };
412
486
  }
413
487
  return config;
414
- }, "getConfigEnv");
415
- var getThemeColorConfigEnv = /* @__PURE__ */ __name((prefix, theme) => {
488
+ };
489
+ var getThemeColorConfigEnv = (prefix, theme) => {
416
490
  const themeName = `COLOR_${theme && theme !== "base" ? `${theme}_` : ""}`.toUpperCase();
417
491
  return process.env[`${prefix}${themeName}LIGHT_BRAND`] || process.env[`${prefix}${themeName}DARK_BRAND`] ? getMultiThemeColorConfigEnv(prefix + themeName) : getSingleThemeColorConfigEnv(prefix + themeName);
418
- }, "getThemeColorConfigEnv");
419
- var getSingleThemeColorConfigEnv = /* @__PURE__ */ __name((prefix) => {
492
+ };
493
+ var getSingleThemeColorConfigEnv = (prefix) => {
420
494
  return {
421
495
  dark: process.env[`${prefix}DARK`],
422
496
  light: process.env[`${prefix}LIGHT`],
@@ -433,14 +507,16 @@ var getSingleThemeColorConfigEnv = /* @__PURE__ */ __name((prefix) => {
433
507
  positive: process.env[`${prefix}POSITIVE`],
434
508
  negative: process.env[`${prefix}NEGATIVE`]
435
509
  };
436
- }, "getSingleThemeColorConfigEnv");
437
- var getMultiThemeColorConfigEnv = /* @__PURE__ */ __name((prefix) => {
510
+ };
511
+ var getMultiThemeColorConfigEnv = (prefix) => {
438
512
  return {
439
- light: getBaseThemeColorConfigEnv(`${prefix}_LIGHT_`),
513
+ light: getBaseThemeColorConfigEnv(
514
+ `${prefix}_LIGHT_`
515
+ ),
440
516
  dark: getBaseThemeColorConfigEnv(`${prefix}_DARK_`)
441
517
  };
442
- }, "getMultiThemeColorConfigEnv");
443
- var getBaseThemeColorConfigEnv = /* @__PURE__ */ __name((prefix) => {
518
+ };
519
+ var getBaseThemeColorConfigEnv = (prefix) => {
444
520
  return {
445
521
  foreground: process.env[`${prefix}FOREGROUND`],
446
522
  background: process.env[`${prefix}BACKGROUND`],
@@ -457,13 +533,16 @@ var getBaseThemeColorConfigEnv = /* @__PURE__ */ __name((prefix) => {
457
533
  positive: process.env[`${prefix}POSITIVE`],
458
534
  negative: process.env[`${prefix}NEGATIVE`]
459
535
  };
460
- }, "getBaseThemeColorConfigEnv");
536
+ };
461
537
 
462
538
  // ../config-tools/src/env/set-env.ts
463
- var setExtensionEnv = /* @__PURE__ */ __name((extensionName, extension) => {
539
+ var setExtensionEnv = (extensionName, extension) => {
464
540
  for (const key of Object.keys(extension ?? {})) {
465
541
  if (extension[key]) {
466
- const result = key?.replace(/([A-Z])+/g, (input) => input ? input[0]?.toUpperCase() + input.slice(1) : "").split(/(?=[A-Z])|[.\-\s_]/).map((x) => x.toLowerCase()) ?? [];
542
+ const result = key?.replace(
543
+ /([A-Z])+/g,
544
+ (input) => input ? input[0]?.toUpperCase() + input.slice(1) : ""
545
+ ).split(/(?=[A-Z])|[.\-\s_]/).map((x) => x.toLowerCase()) ?? [];
467
546
  let extensionKey;
468
547
  if (result.length === 0) {
469
548
  return;
@@ -478,8 +557,8 @@ var setExtensionEnv = /* @__PURE__ */ __name((extensionName, extension) => {
478
557
  process.env[`STORM_EXTENSION_${extensionName.toUpperCase()}_${extensionKey.toUpperCase()}`] = extension[key];
479
558
  }
480
559
  }
481
- }, "setExtensionEnv");
482
- var setConfigEnv = /* @__PURE__ */ __name((config) => {
560
+ };
561
+ var setConfigEnv = (config) => {
483
562
  const prefix = "STORM_";
484
563
  if (config.extends) {
485
564
  process.env[`${prefix}EXTENDS`] = Array.isArray(config.extends) ? JSON.stringify(config.extends) : config.extends;
@@ -568,7 +647,9 @@ var setConfigEnv = /* @__PURE__ */ __name((config) => {
568
647
  }
569
648
  if (config.directories) {
570
649
  if (!config.skipCache && config.directories.cache) {
571
- process.env[`${prefix}CACHE_DIR`] = correctPaths(config.directories.cache);
650
+ process.env[`${prefix}CACHE_DIR`] = correctPaths(
651
+ config.directories.cache
652
+ );
572
653
  process.env[`${prefix}CACHE_DIRECTORY`] = process.env[`${prefix}CACHE_DIR`];
573
654
  }
574
655
  if (config.directories.data) {
@@ -576,7 +657,9 @@ var setConfigEnv = /* @__PURE__ */ __name((config) => {
576
657
  process.env[`${prefix}DATA_DIRECTORY`] = process.env[`${prefix}DATA_DIR`];
577
658
  }
578
659
  if (config.directories.config) {
579
- process.env[`${prefix}CONFIG_DIR`] = correctPaths(config.directories.config);
660
+ process.env[`${prefix}CONFIG_DIR`] = correctPaths(
661
+ config.directories.config
662
+ );
580
663
  process.env[`${prefix}CONFIG_DIRECTORY`] = process.env[`${prefix}CONFIG_DIR`];
581
664
  }
582
665
  if (config.directories.temp) {
@@ -588,7 +671,9 @@ var setConfigEnv = /* @__PURE__ */ __name((config) => {
588
671
  process.env[`${prefix}LOG_DIRECTORY`] = process.env[`${prefix}LOG_DIR`];
589
672
  }
590
673
  if (config.directories.build) {
591
- process.env[`${prefix}BUILD_DIR`] = correctPaths(config.directories.build);
674
+ process.env[`${prefix}BUILD_DIR`] = correctPaths(
675
+ config.directories.build
676
+ );
592
677
  process.env[`${prefix}BUILD_DIRECTORY`] = process.env[`${prefix}BUILD_DIR`];
593
678
  }
594
679
  }
@@ -609,7 +694,10 @@ var setConfigEnv = /* @__PURE__ */ __name((config) => {
609
694
  setThemeColorConfigEnv(`${prefix}COLOR_${key}_`, config.colors[key]);
610
695
  }
611
696
  } else {
612
- setThemeColorConfigEnv(`${prefix}COLOR_`, config.colors);
697
+ setThemeColorConfigEnv(
698
+ `${prefix}COLOR_`,
699
+ config.colors
700
+ );
613
701
  }
614
702
  if (config.repository) {
615
703
  process.env[`${prefix}REPOSITORY`] = config.repository;
@@ -621,7 +709,9 @@ var setConfigEnv = /* @__PURE__ */ __name((config) => {
621
709
  process.env[`${prefix}PRE_ID`] = String(config.preid);
622
710
  }
623
711
  if (config.externalPackagePatterns) {
624
- process.env[`${prefix}EXTERNAL_PACKAGE_PATTERNS`] = JSON.stringify(config.externalPackagePatterns);
712
+ process.env[`${prefix}EXTERNAL_PACKAGE_PATTERNS`] = JSON.stringify(
713
+ config.externalPackagePatterns
714
+ );
625
715
  }
626
716
  if (config.registry) {
627
717
  if (config.registry.github) {
@@ -634,20 +724,28 @@ var setConfigEnv = /* @__PURE__ */ __name((config) => {
634
724
  process.env[`${prefix}REGISTRY_CARGO`] = String(config.registry.cargo);
635
725
  }
636
726
  if (config.registry.cyclone) {
637
- process.env[`${prefix}REGISTRY_CYCLONE`] = String(config.registry.cyclone);
727
+ process.env[`${prefix}REGISTRY_CYCLONE`] = String(
728
+ config.registry.cyclone
729
+ );
638
730
  }
639
731
  if (config.registry.container) {
640
- process.env[`${prefix}REGISTRY_CONTAINER`] = String(config.registry.container);
732
+ process.env[`${prefix}REGISTRY_CONTAINER`] = String(
733
+ config.registry.container
734
+ );
641
735
  }
642
736
  }
643
737
  if (config.logLevel) {
644
738
  process.env[`${prefix}LOG_LEVEL`] = String(config.logLevel);
645
739
  process.env.LOG_LEVEL = String(config.logLevel);
646
- process.env.NX_VERBOSE_LOGGING = String(getLogLevel(config.logLevel) >= LogLevel.DEBUG ? true : false);
740
+ process.env.NX_VERBOSE_LOGGING = String(
741
+ getLogLevel(config.logLevel) >= LogLevel.DEBUG ? true : false
742
+ );
647
743
  process.env.RUST_BACKTRACE = getLogLevel(config.logLevel) >= LogLevel.DEBUG ? "full" : "none";
648
744
  }
649
745
  if (config.skipConfigLogging !== void 0) {
650
- process.env[`${prefix}SKIP_CONFIG_LOGGING`] = String(config.skipConfigLogging);
746
+ process.env[`${prefix}SKIP_CONFIG_LOGGING`] = String(
747
+ config.skipConfigLogging
748
+ );
651
749
  }
652
750
  process.env[`${prefix}CONFIG`] = JSON.stringify(config);
653
751
  for (const key of Object.keys(config.extensions ?? {})) {
@@ -655,11 +753,11 @@ var setConfigEnv = /* @__PURE__ */ __name((config) => {
655
753
  setExtensionEnv(key, config.extensions[key]);
656
754
  }
657
755
  }
658
- }, "setConfigEnv");
659
- var setThemeColorConfigEnv = /* @__PURE__ */ __name((prefix, config) => {
756
+ };
757
+ var setThemeColorConfigEnv = (prefix, config) => {
660
758
  return config?.light?.brand || config?.dark?.brand ? setMultiThemeColorConfigEnv(prefix, config) : setSingleThemeColorConfigEnv(prefix, config);
661
- }, "setThemeColorConfigEnv");
662
- var setSingleThemeColorConfigEnv = /* @__PURE__ */ __name((prefix, config) => {
759
+ };
760
+ var setSingleThemeColorConfigEnv = (prefix, config) => {
663
761
  if (config.dark) {
664
762
  process.env[`${prefix}DARK`] = config.dark;
665
763
  }
@@ -702,14 +800,14 @@ var setSingleThemeColorConfigEnv = /* @__PURE__ */ __name((prefix, config) => {
702
800
  if (config.negative) {
703
801
  process.env[`${prefix}NEGATIVE`] = config.negative;
704
802
  }
705
- }, "setSingleThemeColorConfigEnv");
706
- var setMultiThemeColorConfigEnv = /* @__PURE__ */ __name((prefix, config) => {
803
+ };
804
+ var setMultiThemeColorConfigEnv = (prefix, config) => {
707
805
  return {
708
806
  light: setBaseThemeColorConfigEnv(`${prefix}LIGHT_`, config.light),
709
807
  dark: setBaseThemeColorConfigEnv(`${prefix}DARK_`, config.dark)
710
808
  };
711
- }, "setMultiThemeColorConfigEnv");
712
- var setBaseThemeColorConfigEnv = /* @__PURE__ */ __name((prefix, config) => {
809
+ };
810
+ var setBaseThemeColorConfigEnv = (prefix, config) => {
713
811
  if (config.foreground) {
714
812
  process.env[`${prefix}FOREGROUND`] = config.foreground;
715
813
  }
@@ -752,12 +850,12 @@ var setBaseThemeColorConfigEnv = /* @__PURE__ */ __name((prefix, config) => {
752
850
  if (config.negative) {
753
851
  process.env[`${prefix}NEGATIVE`] = config.negative;
754
852
  }
755
- }, "setBaseThemeColorConfigEnv");
853
+ };
756
854
 
757
855
  // ../config-tools/src/create-storm-config.ts
758
856
  var _extension_cache = /* @__PURE__ */ new WeakMap();
759
857
  var _static_cache = void 0;
760
- var createStormWorkspaceConfig = /* @__PURE__ */ __name(async (extensionName, schema, workspaceRoot, skipLogs = false, useDefault = true) => {
858
+ var createStormWorkspaceConfig = async (extensionName, schema, workspaceRoot, skipLogs = false, useDefault = true) => {
761
859
  let result;
762
860
  if (!_static_cache?.data || !_static_cache?.timestamp || _static_cache.timestamp < Date.now() - 8e3) {
763
861
  let _workspaceRoot = workspaceRoot;
@@ -768,16 +866,19 @@ var createStormWorkspaceConfig = /* @__PURE__ */ __name(async (extensionName, sc
768
866
  const configFile = await getConfigFile(_workspaceRoot);
769
867
  if (!configFile) {
770
868
  if (!skipLogs) {
771
- writeWarning("No Storm Workspace configuration file found in the current repository. Please ensure this is the expected behavior - you can add a `storm-workspace.json` file to the root of your workspace if it is not.\n", {
772
- logLevel: "all"
773
- });
869
+ writeWarning(
870
+ "No Storm Workspace configuration file found in the current repository. Please ensure this is the expected behavior - you can add a `storm-workspace.json` file to the root of your workspace if it is not.\n",
871
+ { logLevel: "all" }
872
+ );
774
873
  }
775
874
  if (useDefault === false) {
776
875
  return void 0;
777
876
  }
778
877
  }
779
878
  const defaultConfig = await getDefaultConfig(_workspaceRoot);
780
- result = await stormWorkspaceConfigSchema.parseAsync(defu2(configEnv, configFile, defaultConfig));
879
+ result = await stormWorkspaceConfigSchema.parseAsync(
880
+ defu2(configEnv, configFile, defaultConfig)
881
+ );
781
882
  result.workspaceRoot ??= _workspaceRoot;
782
883
  } else {
783
884
  result = _static_cache.data;
@@ -793,11 +894,9 @@ var createStormWorkspaceConfig = /* @__PURE__ */ __name(async (extensionName, sc
793
894
  data: result
794
895
  };
795
896
  return result;
796
- }, "createStormWorkspaceConfig");
797
- var createConfigExtension = /* @__PURE__ */ __name((extensionName, schema) => {
798
- const extension_cache_key = {
799
- extensionName
800
- };
897
+ };
898
+ var createConfigExtension = (extensionName, schema) => {
899
+ const extension_cache_key = { extensionName };
801
900
  if (_extension_cache.has(extension_cache_key)) {
802
901
  return _extension_cache.get(extension_cache_key);
803
902
  }
@@ -807,21 +906,30 @@ var createConfigExtension = /* @__PURE__ */ __name((extensionName, schema) => {
807
906
  }
808
907
  _extension_cache.set(extension_cache_key, extension);
809
908
  return extension;
810
- }, "createConfigExtension");
811
- var loadStormWorkspaceConfig = /* @__PURE__ */ __name(async (workspaceRoot, skipLogs = false) => {
812
- const config = await createStormWorkspaceConfig(void 0, void 0, workspaceRoot, skipLogs, true);
909
+ };
910
+ var loadStormWorkspaceConfig = async (workspaceRoot, skipLogs = false) => {
911
+ const config = await createStormWorkspaceConfig(
912
+ void 0,
913
+ void 0,
914
+ workspaceRoot,
915
+ skipLogs,
916
+ true
917
+ );
813
918
  setConfigEnv(config);
814
919
  if (!skipLogs && !config.skipConfigLogging) {
815
- writeTrace(`\u2699\uFE0F Using Storm Workspace configuration:
816
- ${formatLogMessage(config)}`, config);
920
+ writeTrace(
921
+ `\u2699\uFE0F Using Storm Workspace configuration:
922
+ ${formatLogMessage(config)}`,
923
+ config
924
+ );
817
925
  }
818
926
  return config;
819
- }, "loadStormWorkspaceConfig");
927
+ };
820
928
 
821
929
  // ../config-tools/src/get-config.ts
822
- var getConfig = /* @__PURE__ */ __name((workspaceRoot, skipLogs = false) => {
930
+ var getConfig = (workspaceRoot, skipLogs = false) => {
823
931
  return loadStormWorkspaceConfig(workspaceRoot, skipLogs);
824
- }, "getConfig");
932
+ };
825
933
 
826
934
  // ../build-tools/src/utilities/get-entry-points.ts
827
935
  import { glob as glob2 } from "glob";
@@ -831,7 +939,10 @@ import { existsSync as existsSync2 } from "node:fs";
831
939
  import { readFile as readFile3 } from "node:fs/promises";
832
940
 
833
941
  // ../build-tools/src/utilities/task-graph.ts
834
- import { createTaskGraph, mapTargetDefaultsToDependencies } from "nx/src/tasks-runner/create-task-graph";
942
+ import {
943
+ createTaskGraph,
944
+ mapTargetDefaultsToDependencies
945
+ } from "nx/src/tasks-runner/create-task-graph";
835
946
 
836
947
  // src/build.ts
837
948
  import defu3 from "defu";
@@ -840,7 +951,9 @@ import { existsSync as existsSync3 } from "node:fs";
840
951
  import { readFile as readFile4 } from "node:fs/promises";
841
952
  import { relative as relative2 } from "node:path";
842
953
  import { findWorkspaceRoot as findWorkspaceRoot2 } from "nx/src/utils/find-workspace-root";
843
- import { build as unbuild } from "unbuild";
954
+ import {
955
+ build as unbuild
956
+ } from "unbuild";
844
957
  async function resolveOptions(options, config) {
845
958
  writeDebug(" \u2699\uFE0F Resolving build options", config);
846
959
  const stopwatch = getStopwatch("Build options resolution");
@@ -859,16 +972,26 @@ async function resolveOptions(options, config) {
859
972
  projectGraph = readCachedProjectGraph2();
860
973
  }
861
974
  if (!projectGraph) {
862
- throw new Error("The build process failed because the project graph is not available. Please run the build command again.");
863
- }
864
- const projectJsonPath = joinPaths(config.workspaceRoot, options.projectRoot, "project.json");
975
+ throw new Error(
976
+ "The build process failed because the project graph is not available. Please run the build command again."
977
+ );
978
+ }
979
+ const projectJsonPath = joinPaths(
980
+ config.workspaceRoot,
981
+ options.projectRoot,
982
+ "project.json"
983
+ );
865
984
  if (!existsSync3(projectJsonPath)) {
866
985
  throw new Error("Cannot find project.json configuration");
867
986
  }
868
987
  const projectJsonContent = await readFile4(projectJsonPath, "utf8");
869
988
  const projectJson = JSON.parse(projectJsonContent);
870
989
  const projectName = projectJson.name;
871
- const packageJsonPath = joinPaths(config.workspaceRoot, options.projectRoot, "package.json");
990
+ const packageJsonPath = joinPaths(
991
+ config.workspaceRoot,
992
+ options.projectRoot,
993
+ "package.json"
994
+ );
872
995
  if (!existsSync3(packageJsonPath)) {
873
996
  throw new Error("Cannot find package.json configuration");
874
997
  }
@@ -891,17 +1014,31 @@ async function resolveOptions(options, config) {
891
1014
  if (!existsSync3(sourceRoot)) {
892
1015
  throw new Error("Cannot find sourceRoot directory");
893
1016
  }
894
- const result = calculateProjectBuildableDependencies2(void 0, projectGraph, config.workspaceRoot, projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
1017
+ const result = calculateProjectBuildableDependencies2(
1018
+ void 0,
1019
+ projectGraph,
1020
+ config.workspaceRoot,
1021
+ projectName,
1022
+ process.env.NX_TASK_TARGET_TARGET || "build",
1023
+ process.env.NX_TASK_TARGET_CONFIGURATION || "production",
1024
+ true
1025
+ );
895
1026
  let dependencies = result.dependencies;
896
- const tsLibDependency = getHelperDependency(HelperDependency.tsc, tsconfig, dependencies, projectGraph, true);
1027
+ const tsLibDependency = getHelperDependency(
1028
+ HelperDependency.tsc,
1029
+ tsconfig,
1030
+ dependencies,
1031
+ projectGraph,
1032
+ true
1033
+ );
897
1034
  if (tsLibDependency) {
898
- dependencies = dependencies.filter((deps) => deps.name !== tsLibDependency.name);
1035
+ dependencies = dependencies.filter(
1036
+ (deps) => deps.name !== tsLibDependency.name
1037
+ );
899
1038
  dependencies.push(tsLibDependency);
900
1039
  }
901
1040
  const name = options.name || projectName;
902
- const entries = options.entry ?? [
903
- sourceRoot
904
- ];
1041
+ const entries = options.entry ?? [sourceRoot];
905
1042
  const resolvedOptions = {
906
1043
  ...options,
907
1044
  name,
@@ -921,7 +1058,14 @@ async function resolveOptions(options, config) {
921
1058
  while (entryPath.startsWith("/")) {
922
1059
  entryPath = entryPath.substring(1);
923
1060
  }
924
- const outDir = joinPaths(relative2(joinPaths(config.workspaceRoot, options.projectRoot), config.workspaceRoot), outputPath, "dist");
1061
+ const outDir = joinPaths(
1062
+ relative2(
1063
+ joinPaths(config.workspaceRoot, options.projectRoot),
1064
+ config.workspaceRoot
1065
+ ),
1066
+ outputPath,
1067
+ "dist"
1068
+ );
925
1069
  ret.push({
926
1070
  name: `${name}-esm`,
927
1071
  builder: "mkdist",
@@ -999,7 +1143,9 @@ async function resolveOptions(options, config) {
999
1143
  }
1000
1144
  }
1001
1145
  };
1002
- dependencies = dependencies.filter((dep) => dep.node.type === "npm" || dep.node.type === "lib" || dep.node.type === "app");
1146
+ dependencies = dependencies.filter(
1147
+ (dep) => dep.node.type === "npm" || dep.node.type === "lib" || dep.node.type === "app"
1148
+ );
1003
1149
  if (dependencies.length > 0) {
1004
1150
  resolvedOptions.dependencies = dependencies.map((dep) => dep.name);
1005
1151
  }
@@ -1007,7 +1153,9 @@ async function resolveOptions(options, config) {
1007
1153
  resolvedOptions.devDependencies = Object.keys(packageJson.devDependencies);
1008
1154
  }
1009
1155
  if (packageJson.peerDependencies) {
1010
- resolvedOptions.peerDependencies = Object.keys(packageJson.peerDependencies);
1156
+ resolvedOptions.peerDependencies = Object.keys(
1157
+ packageJson.peerDependencies
1158
+ );
1011
1159
  }
1012
1160
  if (options.rollup) {
1013
1161
  let rollup = {};
@@ -1022,38 +1170,45 @@ async function resolveOptions(options, config) {
1022
1170
  resolvedOptions.rollup = defu3(resolvedOptions.rollup ?? {}, rollup);
1023
1171
  }
1024
1172
  resolvedOptions.hooks = {
1025
- "rollup:options": /* @__PURE__ */ __name(async (ctx, opts) => {
1173
+ "rollup:options": async (ctx, opts) => {
1026
1174
  if (options.plugins && options.plugins.length > 0) {
1027
- writeDebug(` \u{1F9E9} Found ${options.plugins.length} plugins in provided build options`, config);
1175
+ writeDebug(
1176
+ ` \u{1F9E9} Found ${options.plugins.length} plugins in provided build options`,
1177
+ config
1178
+ );
1028
1179
  opts.plugins = options.plugins;
1029
1180
  } else {
1030
- writeDebug(` \u{1F9E9} No plugins found in provided build options, using default plugins`, config);
1181
+ writeDebug(
1182
+ ` \u{1F9E9} No plugins found in provided build options, using default plugins`,
1183
+ config
1184
+ );
1031
1185
  opts.plugins = await Promise.all([
1032
1186
  analyzePlugin(resolvedOptions),
1033
1187
  tscPlugin(resolvedOptions),
1034
1188
  onErrorPlugin(resolvedOptions)
1035
1189
  ]);
1036
1190
  }
1037
- }, "rollup:options"),
1038
- "mkdist:entry:options": /* @__PURE__ */ __name(async (ctx, entry, opts) => {
1191
+ },
1192
+ "mkdist:entry:options": async (ctx, entry, opts) => {
1039
1193
  opts.esbuild ||= {};
1040
1194
  opts.esbuild.platform ??= resolvedOptions.platform;
1041
1195
  opts.esbuild.minify ??= resolvedOptions.minify ?? !resolvedOptions.debug;
1042
1196
  opts.esbuild.sourcemap ??= resolvedOptions.sourcemap ?? !!options.debug;
1043
1197
  if (options.loaders) {
1044
1198
  if (typeof options.loaders === "function") {
1045
- opts.loaders = await Promise.resolve(options.loaders(ctx, entry, opts));
1199
+ opts.loaders = await Promise.resolve(
1200
+ options.loaders(ctx, entry, opts)
1201
+ );
1046
1202
  } else {
1047
1203
  opts.loaders = options.loaders;
1048
1204
  }
1049
1205
  }
1050
- }, "mkdist:entry:options")
1206
+ }
1051
1207
  };
1052
1208
  stopwatch();
1053
1209
  return resolvedOptions;
1054
1210
  }
1055
- __name(resolveOptions, "resolveOptions");
1056
- var addPackageJsonExport = /* @__PURE__ */ __name((file, type = "module", sourceRoot, projectRoot) => {
1211
+ var addPackageJsonExport = (file, type = "module", sourceRoot, projectRoot) => {
1057
1212
  let root = sourceRoot.replace(projectRoot, "");
1058
1213
  while (root.startsWith(".")) {
1059
1214
  root = root.substring(1);
@@ -1082,7 +1237,7 @@ var addPackageJsonExport = /* @__PURE__ */ __name((file, type = "module", source
1082
1237
  default: type === "commonjs" ? `./dist/${entry}.cjs` : `./dist/${entry}.mjs`
1083
1238
  }
1084
1239
  };
1085
- }, "addPackageJsonExport");
1240
+ };
1086
1241
  async function generatePackageJson(options) {
1087
1242
  if (options.generatePackageJson !== false && existsSync3(joinPaths(options.projectRoot, "package.json"))) {
1088
1243
  writeDebug(" \u270D\uFE0F Writing package.json file", options.config);
@@ -1091,100 +1246,154 @@ async function generatePackageJson(options) {
1091
1246
  if (!existsSync3(packageJsonPath)) {
1092
1247
  throw new Error("Cannot find package.json configuration");
1093
1248
  }
1094
- const packageJsonContent = await readFile4(joinPaths(options.config.workspaceRoot, options.projectRoot, "package.json"), "utf8");
1249
+ const packageJsonContent = await readFile4(
1250
+ joinPaths(
1251
+ options.config.workspaceRoot,
1252
+ options.projectRoot,
1253
+ "package.json"
1254
+ ),
1255
+ "utf8"
1256
+ );
1095
1257
  if (!packageJsonContent) {
1096
1258
  throw new Error("Cannot find package.json configuration file");
1097
1259
  }
1098
1260
  let packageJson = JSON.parse(packageJsonContent);
1099
- packageJson = await addPackageDependencies(options.config.workspaceRoot, options.projectRoot, options.projectName, packageJson);
1100
- packageJson = await addWorkspacePackageJsonFields(options.config, options.projectRoot, options.sourceRoot, options.projectName, false, packageJson);
1261
+ packageJson = await addPackageDependencies(
1262
+ options.config.workspaceRoot,
1263
+ options.projectRoot,
1264
+ options.projectName,
1265
+ packageJson
1266
+ );
1267
+ packageJson = await addWorkspacePackageJsonFields(
1268
+ options.config,
1269
+ options.projectRoot,
1270
+ options.sourceRoot,
1271
+ options.projectName,
1272
+ false,
1273
+ packageJson
1274
+ );
1101
1275
  packageJson.exports ??= {};
1102
- await Promise.all(options.entries.reduce((ret, entry) => {
1103
- let entryPath = typeof entry === "string" ? entry : entry.input;
1104
- entryPath = entryPath.replaceAll("\\", "/");
1105
- while (entryPath.startsWith(".")) {
1106
- entryPath = entryPath.substring(1);
1107
- }
1108
- while (entryPath.startsWith("/")) {
1109
- entryPath = entryPath.substring(1);
1110
- }
1111
- entryPath = `./${joinPaths(options.projectRoot, entryPath)}`;
1112
- if (!ret.includes(entryPath)) {
1113
- ret.push(entryPath);
1114
- }
1115
- return ret;
1116
- }, []).map(async (entryPath) => {
1117
- const files = await new Glob2("**/*.{ts,tsx}", {
1118
- absolute: false,
1119
- cwd: entryPath,
1120
- root: entryPath
1121
- }).walk();
1122
- files.forEach((file) => {
1123
- addPackageJsonExport(file, packageJson.type, options.sourceRoot, options.projectRoot);
1124
- const split = file.split(".");
1125
- split.pop();
1126
- const entry = split.join(".").replaceAll("\\", "/");
1127
- packageJson.exports[`./${entry}`] ??= addPackageJsonExport(entry, packageJson.type, options.sourceRoot, options.projectRoot);
1128
- });
1129
- }));
1276
+ await Promise.all(
1277
+ options.entries.reduce((ret, entry) => {
1278
+ let entryPath = typeof entry === "string" ? entry : entry.input;
1279
+ entryPath = entryPath.replaceAll("\\", "/");
1280
+ while (entryPath.startsWith(".")) {
1281
+ entryPath = entryPath.substring(1);
1282
+ }
1283
+ while (entryPath.startsWith("/")) {
1284
+ entryPath = entryPath.substring(1);
1285
+ }
1286
+ entryPath = `./${joinPaths(options.projectRoot, entryPath)}`;
1287
+ if (!ret.includes(entryPath)) {
1288
+ ret.push(entryPath);
1289
+ }
1290
+ return ret;
1291
+ }, []).map(async (entryPath) => {
1292
+ const files = await new Glob2("**/*.{ts,tsx}", {
1293
+ absolute: false,
1294
+ cwd: entryPath,
1295
+ root: entryPath
1296
+ }).walk();
1297
+ files.forEach((file) => {
1298
+ addPackageJsonExport(
1299
+ file,
1300
+ packageJson.type,
1301
+ options.sourceRoot,
1302
+ options.projectRoot
1303
+ );
1304
+ const split = file.split(".");
1305
+ split.pop();
1306
+ const entry = split.join(".").replaceAll("\\", "/");
1307
+ packageJson.exports[`./${entry}`] ??= addPackageJsonExport(
1308
+ entry,
1309
+ packageJson.type,
1310
+ options.sourceRoot,
1311
+ options.projectRoot
1312
+ );
1313
+ });
1314
+ })
1315
+ );
1130
1316
  packageJson.main ??= "./dist/index.cjs";
1131
1317
  packageJson.module ??= "./dist/index.mjs";
1132
1318
  packageJson.types ??= "./dist/index.d.ts";
1133
1319
  packageJson.exports ??= {};
1134
- packageJson.exports = Object.keys(packageJson.exports).reduce((ret, key) => {
1135
- if (key.endsWith("/index") && !ret[key.replace("/index", "")]) {
1136
- ret[key.replace("/index", "")] = packageJson.exports[key];
1137
- }
1138
- return ret;
1139
- }, packageJson.exports);
1320
+ packageJson.exports = Object.keys(packageJson.exports).reduce(
1321
+ (ret, key) => {
1322
+ if (key.endsWith("/index") && !ret[key.replace("/index", "")]) {
1323
+ ret[key.replace("/index", "")] = packageJson.exports[key];
1324
+ }
1325
+ return ret;
1326
+ },
1327
+ packageJson.exports
1328
+ );
1140
1329
  packageJson.exports["./package.json"] ??= "./package.json";
1141
- packageJson.exports["."] ??= addPackageJsonExport("index", packageJson.type, options.sourceRoot, options.projectRoot);
1330
+ packageJson.exports["."] ??= addPackageJsonExport(
1331
+ "index",
1332
+ packageJson.type,
1333
+ options.sourceRoot,
1334
+ options.projectRoot
1335
+ );
1142
1336
  await writeJsonFile(joinPaths(options.outDir, "package.json"), packageJson);
1143
1337
  stopwatch();
1144
1338
  }
1145
1339
  return options;
1146
1340
  }
1147
- __name(generatePackageJson, "generatePackageJson");
1148
1341
  async function executeUnbuild(options) {
1149
- writeDebug(` \u{1F680} Running ${options.name} (${options.projectRoot}) build`, options.config);
1150
- const stopwatch = getStopwatch(`${options.name} (${options.projectRoot}) build`);
1342
+ writeDebug(
1343
+ ` \u{1F680} Running ${options.name} (${options.projectRoot}) build`,
1344
+ options.config
1345
+ );
1346
+ const stopwatch = getStopwatch(
1347
+ `${options.name} (${options.projectRoot}) build`
1348
+ );
1151
1349
  try {
1152
1350
  const config = {
1153
1351
  ...options,
1154
1352
  config: null,
1155
1353
  rootDir: joinPaths(options.config.workspaceRoot, options.projectRoot)
1156
1354
  };
1157
- writeTrace(`Running with unbuild configuration:
1158
- ${formatLogMessage({
1159
- ...config,
1160
- env: "<Hidden>"
1161
- })}
1162
- `, options.config);
1355
+ writeTrace(
1356
+ `Running with unbuild configuration:
1357
+ ${formatLogMessage({ ...config, env: "<Hidden>" })}
1358
+ `,
1359
+ options.config
1360
+ );
1163
1361
  await unbuild(options.projectRoot, false, config);
1164
1362
  } finally {
1165
1363
  stopwatch();
1166
1364
  }
1167
1365
  return options;
1168
1366
  }
1169
- __name(executeUnbuild, "executeUnbuild");
1170
1367
  async function copyBuildAssets(options) {
1171
- writeDebug(` \u{1F4CB} Copying asset files to output directory: ${options.outDir}`, options.config);
1368
+ writeDebug(
1369
+ ` \u{1F4CB} Copying asset files to output directory: ${options.outDir}`,
1370
+ options.config
1371
+ );
1172
1372
  const stopwatch = getStopwatch(`${options.name} asset copy`);
1173
- await copyAssets(options.config, options.assets ?? [], options.outDir, options.projectRoot, options.sourceRoot, options.generatePackageJson, options.includeSrc);
1373
+ await copyAssets(
1374
+ options.config,
1375
+ options.assets ?? [],
1376
+ options.outDir,
1377
+ options.projectRoot,
1378
+ options.sourceRoot,
1379
+ options.generatePackageJson,
1380
+ options.includeSrc
1381
+ );
1174
1382
  stopwatch();
1175
1383
  return options;
1176
1384
  }
1177
- __name(copyBuildAssets, "copyBuildAssets");
1178
1385
  async function cleanOutputPath(options) {
1179
1386
  if (options.clean !== false && options.outDir) {
1180
- writeDebug(` \u{1F9F9} Cleaning ${options.name} output path: ${options.outDir}`, options.config);
1387
+ writeDebug(
1388
+ ` \u{1F9F9} Cleaning ${options.name} output path: ${options.outDir}`,
1389
+ options.config
1390
+ );
1181
1391
  const stopwatch = getStopwatch(`${options.name} output clean`);
1182
1392
  await cleanDirectories(options.name, options.outDir, options.config);
1183
1393
  stopwatch();
1184
1394
  }
1185
1395
  return options;
1186
1396
  }
1187
- __name(cleanOutputPath, "cleanOutputPath");
1188
1397
  async function build(options) {
1189
1398
  const projectRoot = options.projectRoot;
1190
1399
  if (!projectRoot) {
@@ -1208,15 +1417,20 @@ async function build(options) {
1208
1417
  if (options.buildOnly !== true) {
1209
1418
  await copyBuildAssets(resolvedOptions);
1210
1419
  }
1211
- writeSuccess(` \u{1F3C1} The ${resolvedOptions.name} build completed successfully`, config);
1420
+ writeSuccess(
1421
+ ` \u{1F3C1} The ${resolvedOptions.name} build completed successfully`,
1422
+ config
1423
+ );
1212
1424
  } catch (error) {
1213
- writeFatal("Fatal errors that the build process could not recover from have occured. The build process has been terminated.", config);
1425
+ writeFatal(
1426
+ "Fatal errors that the build process could not recover from have occured. The build process has been terminated.",
1427
+ config
1428
+ );
1214
1429
  throw error;
1215
1430
  } finally {
1216
1431
  stopwatch();
1217
1432
  }
1218
1433
  }
1219
- __name(build, "build");
1220
1434
 
1221
1435
  export {
1222
1436
  resolveOptions,