@storm-software/workspace-tools 1.62.12 → 1.62.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storm-software/workspace-tools",
3
- "version": "1.62.12",
3
+ "version": "1.62.13",
4
4
  "private": false,
5
5
  "description": "⚡ A Nx plugin package that contains various executors and generators used in a Storm workspaces.",
6
6
  "keywords": [
@@ -442051,7 +442051,7 @@ ${outro}`;
442051
442051
  await promises3.mkdir(node_path.dirname(fileName), { recursive: true });
442052
442052
  return promises3.writeFile(fileName, outputFile.type === "asset" ? outputFile.source : outputFile.code);
442053
442053
  }
442054
- function defineConfig(options8) {
442054
+ function defineConfig2(options8) {
442055
442055
  return options8;
442056
442056
  }
442057
442057
  exports2.blue = blue;
@@ -442060,7 +442060,7 @@ ${outro}`;
442060
442060
  exports2.createFilter = createFilter;
442061
442061
  exports2.cyan = cyan$1;
442062
442062
  exports2.cyan$1 = cyan;
442063
- exports2.defineConfig = defineConfig;
442063
+ exports2.defineConfig = defineConfig2;
442064
442064
  exports2.ensureArray = ensureArray$1;
442065
442065
  exports2.getAugmentedNamespace = getAugmentedNamespace;
442066
442066
  exports2.getNewArray = getNewArray;
@@ -448629,7 +448629,7 @@ var require_dist6 = __commonJS({
448629
448629
  }
448630
448630
  };
448631
448631
  };
448632
- var defineConfig = (options8) => options8;
448632
+ var defineConfig2 = (options8) => options8;
448633
448633
  var isTaskkillCmdProcessNotFoundError = (err) => {
448634
448634
  return process.platform === "win32" && "cmd" in err && "code" in err && typeof err.cmd === "string" && err.cmd.startsWith("taskkill") && err.code === 128;
448635
448635
  };
@@ -448934,7 +448934,7 @@ var require_dist6 = __commonJS({
448934
448934
  );
448935
448935
  }
448936
448936
  exports2.build = build2;
448937
- exports2.defineConfig = defineConfig;
448937
+ exports2.defineConfig = defineConfig2;
448938
448938
  }
448939
448939
  });
448940
448940
 
@@ -462528,6 +462528,7 @@ async function resolveTSConfig(id = process.cwd(), options8 = {}) {
462528
462528
  }
462529
462529
 
462530
462530
  // packages/workspace-tools/src/utils/run-tsup-build.ts
462531
+ var import_tsup = __toESM(require_dist6());
462531
462532
  var applyDefaultOptions = (options8) => {
462532
462533
  options8.entry ??= "{sourceRoot}/index.ts";
462533
462534
  options8.outputPath ??= "dist/{projectRoot}";
@@ -462562,8 +462563,7 @@ var applyDefaultOptions = (options8) => {
462562
462563
  return options8;
462563
462564
  };
462564
462565
  var runTsupBuild = async (context, config, options8) => {
462565
- const { writeInfo, writeWarning, findWorkspaceRoot } = await import("@storm-software/config-tools");
462566
- const { build: tsup, defineConfig } = await Promise.resolve().then(() => __toESM(require_dist6()));
462566
+ const { writeInfo, writeDebug, writeWarning, findWorkspaceRoot } = await import("@storm-software/config-tools");
462567
462567
  const workspaceRoot = config?.workspaceRoot ?? findWorkspaceRoot();
462568
462568
  const stormEnv = Object.keys(options8.env ?? {}).filter((key2) => key2.startsWith("STORM_")).reduce((ret, key2) => {
462569
462569
  ret[key2] = options8.env?.[key2];
@@ -462576,6 +462576,13 @@ var runTsupBuild = async (context, config, options8) => {
462576
462576
  })
462577
462577
  );
462578
462578
  options8.plugins?.push(environmentPlugin(stormEnv));
462579
+ let tsconfig = await readTSConfig(options8.tsConfig);
462580
+ if (!tsconfig) {
462581
+ tsconfig = await readTSConfig(context.projectRoot);
462582
+ if (!tsconfig) {
462583
+ throw new Error("No tsconfig file found");
462584
+ }
462585
+ }
462579
462586
  const getConfigOptions = {
462580
462587
  ...options8,
462581
462588
  entry: {
@@ -462590,8 +462597,8 @@ var runTsupBuild = async (context, config, options8) => {
462590
462597
  __STORM_CONFIG: JSON.stringify(stormEnv),
462591
462598
  ...stormEnv
462592
462599
  },
462593
- dtsTsConfig: await getNormalizedTsConfig(
462594
- context,
462600
+ dtsTsConfig: getNormalizedTsConfig(
462601
+ tsconfig,
462595
462602
  workspaceRoot,
462596
462603
  options8.outputPath,
462597
462604
  createTypeScriptCompilationOptions(
@@ -462625,17 +462632,18 @@ ${options8.banner}
462625
462632
  };
462626
462633
  if (options8.getConfig) {
462627
462634
  writeInfo(config, "\u26A1 Running the Build process");
462635
+ writeDebug(config, JSON.stringify(getConfigOptions));
462628
462636
  const getConfigFns = [options8.getConfig];
462629
- const tsupConfig = defineConfig(
462637
+ const tsupConfig = (0, import_tsup.defineConfig)(
462630
462638
  getConfigFns.map(
462631
462639
  (getConfigFn) => getConfig(workspaceRoot, context.projectRoot, getConfigFn, getConfigOptions)
462632
462640
  )
462633
462641
  );
462634
462642
  if (_isFunction2(tsupConfig)) {
462635
462643
  const tsupOptions = await Promise.resolve(tsupConfig({}));
462636
- await build(tsup, tsupOptions, config);
462644
+ await build(tsupOptions, config);
462637
462645
  } else {
462638
- await build(tsup, tsupConfig, config);
462646
+ await build(tsupConfig, config);
462639
462647
  }
462640
462648
  } else {
462641
462649
  writeWarning(
@@ -462644,14 +462652,7 @@ ${options8.banner}
462644
462652
  );
462645
462653
  }
462646
462654
  };
462647
- async function getNormalizedTsConfig(context, workspaceRoot, outputPath, options8) {
462648
- let config = await readTSConfig(options8.tsConfig);
462649
- if (!config) {
462650
- config = await readTSConfig(context.projectRoot);
462651
- if (!config) {
462652
- throw new Error("No tsconfig file found");
462653
- }
462654
- }
462655
+ function getNormalizedTsConfig(config, workspaceRoot, outputPath, options8) {
462655
462656
  const tsConfig = (0, import_typescript.parseJsonConfigFileContent)(
462656
462657
  {
462657
462658
  ...config,
@@ -462678,10 +462679,10 @@ async function getNormalizedTsConfig(context, workspaceRoot, outputPath, options
462678
462679
  }
462679
462680
  return tsConfig;
462680
462681
  }
462681
- var build = async (tsup, options8, config) => {
462682
+ var build = async (options8, config) => {
462682
462683
  const { writeDebug } = await import("@storm-software/config-tools");
462683
462684
  if (Array.isArray(options8)) {
462684
- await Promise.all(options8.map((buildOptions) => build(tsup, buildOptions, config)));
462685
+ await Promise.all(options8.map((buildOptions) => build(buildOptions, config)));
462685
462686
  } else {
462686
462687
  let tsupOptions = options8;
462687
462688
  if (_isFunction2(tsupOptions)) {
@@ -462695,7 +462696,7 @@ ${!_isFunction2(tsupOptions) ? Object.keys(tsupOptions).map(
462695
462696
  ).join("\n") : "<function>"}
462696
462697
  `
462697
462698
  );
462698
- await tsup(tsupOptions);
462699
+ await (0, import_tsup.build)(tsupOptions);
462699
462700
  }
462700
462701
  };
462701
462702
  var _isPrimitive = (value) => {
@@ -429911,7 +429911,7 @@ ${outro}`;
429911
429911
  await promises3.mkdir(node_path.dirname(fileName), { recursive: true });
429912
429912
  return promises3.writeFile(fileName, outputFile.type === "asset" ? outputFile.source : outputFile.code);
429913
429913
  }
429914
- function defineConfig(options8) {
429914
+ function defineConfig2(options8) {
429915
429915
  return options8;
429916
429916
  }
429917
429917
  exports2.blue = blue;
@@ -429920,7 +429920,7 @@ ${outro}`;
429920
429920
  exports2.createFilter = createFilter;
429921
429921
  exports2.cyan = cyan$1;
429922
429922
  exports2.cyan$1 = cyan;
429923
- exports2.defineConfig = defineConfig;
429923
+ exports2.defineConfig = defineConfig2;
429924
429924
  exports2.ensureArray = ensureArray$1;
429925
429925
  exports2.getAugmentedNamespace = getAugmentedNamespace;
429926
429926
  exports2.getNewArray = getNewArray;
@@ -436489,7 +436489,7 @@ var require_dist6 = __commonJS({
436489
436489
  }
436490
436490
  };
436491
436491
  };
436492
- var defineConfig = (options8) => options8;
436492
+ var defineConfig2 = (options8) => options8;
436493
436493
  var isTaskkillCmdProcessNotFoundError = (err) => {
436494
436494
  return process.platform === "win32" && "cmd" in err && "code" in err && typeof err.cmd === "string" && err.cmd.startsWith("taskkill") && err.code === 128;
436495
436495
  };
@@ -436794,7 +436794,7 @@ var require_dist6 = __commonJS({
436794
436794
  );
436795
436795
  }
436796
436796
  exports2.build = build2;
436797
- exports2.defineConfig = defineConfig;
436797
+ exports2.defineConfig = defineConfig2;
436798
436798
  }
436799
436799
  });
436800
436800
 
@@ -456344,6 +456344,7 @@ async function resolveTSConfig(id = process.cwd(), options8 = {}) {
456344
456344
  }
456345
456345
 
456346
456346
  // packages/workspace-tools/src/utils/run-tsup-build.ts
456347
+ var import_tsup = __toESM(require_dist6());
456347
456348
  var applyDefaultOptions = (options8) => {
456348
456349
  options8.entry ??= "{sourceRoot}/index.ts";
456349
456350
  options8.outputPath ??= "dist/{projectRoot}";
@@ -456378,8 +456379,7 @@ var applyDefaultOptions = (options8) => {
456378
456379
  return options8;
456379
456380
  };
456380
456381
  var runTsupBuild = async (context, config, options8) => {
456381
- const { writeInfo, writeWarning, findWorkspaceRoot } = await import("@storm-software/config-tools");
456382
- const { build: tsup, defineConfig } = await Promise.resolve().then(() => __toESM(require_dist6()));
456382
+ const { writeInfo, writeDebug, writeWarning, findWorkspaceRoot } = await import("@storm-software/config-tools");
456383
456383
  const workspaceRoot = config?.workspaceRoot ?? findWorkspaceRoot();
456384
456384
  const stormEnv = Object.keys(options8.env ?? {}).filter((key2) => key2.startsWith("STORM_")).reduce((ret, key2) => {
456385
456385
  ret[key2] = options8.env?.[key2];
@@ -456392,6 +456392,13 @@ var runTsupBuild = async (context, config, options8) => {
456392
456392
  })
456393
456393
  );
456394
456394
  options8.plugins?.push(environmentPlugin(stormEnv));
456395
+ let tsconfig = await readTSConfig(options8.tsConfig);
456396
+ if (!tsconfig) {
456397
+ tsconfig = await readTSConfig(context.projectRoot);
456398
+ if (!tsconfig) {
456399
+ throw new Error("No tsconfig file found");
456400
+ }
456401
+ }
456395
456402
  const getConfigOptions = {
456396
456403
  ...options8,
456397
456404
  entry: {
@@ -456406,8 +456413,8 @@ var runTsupBuild = async (context, config, options8) => {
456406
456413
  __STORM_CONFIG: JSON.stringify(stormEnv),
456407
456414
  ...stormEnv
456408
456415
  },
456409
- dtsTsConfig: await getNormalizedTsConfig(
456410
- context,
456416
+ dtsTsConfig: getNormalizedTsConfig(
456417
+ tsconfig,
456411
456418
  workspaceRoot,
456412
456419
  options8.outputPath,
456413
456420
  createTypeScriptCompilationOptions(
@@ -456441,17 +456448,18 @@ ${options8.banner}
456441
456448
  };
456442
456449
  if (options8.getConfig) {
456443
456450
  writeInfo(config, "\u26A1 Running the Build process");
456451
+ writeDebug(config, JSON.stringify(getConfigOptions));
456444
456452
  const getConfigFns = [options8.getConfig];
456445
- const tsupConfig = defineConfig(
456453
+ const tsupConfig = (0, import_tsup.defineConfig)(
456446
456454
  getConfigFns.map(
456447
456455
  (getConfigFn) => getConfig(workspaceRoot, context.projectRoot, getConfigFn, getConfigOptions)
456448
456456
  )
456449
456457
  );
456450
456458
  if (_isFunction2(tsupConfig)) {
456451
456459
  const tsupOptions = await Promise.resolve(tsupConfig({}));
456452
- await build(tsup, tsupOptions, config);
456460
+ await build(tsupOptions, config);
456453
456461
  } else {
456454
- await build(tsup, tsupConfig, config);
456462
+ await build(tsupConfig, config);
456455
456463
  }
456456
456464
  } else {
456457
456465
  writeWarning(
@@ -456460,14 +456468,7 @@ ${options8.banner}
456460
456468
  );
456461
456469
  }
456462
456470
  };
456463
- async function getNormalizedTsConfig(context, workspaceRoot, outputPath, options8) {
456464
- let config = await readTSConfig(options8.tsConfig);
456465
- if (!config) {
456466
- config = await readTSConfig(context.projectRoot);
456467
- if (!config) {
456468
- throw new Error("No tsconfig file found");
456469
- }
456470
- }
456471
+ function getNormalizedTsConfig(config, workspaceRoot, outputPath, options8) {
456471
456472
  const tsConfig = (0, import_typescript.parseJsonConfigFileContent)(
456472
456473
  {
456473
456474
  ...config,
@@ -456494,10 +456495,10 @@ async function getNormalizedTsConfig(context, workspaceRoot, outputPath, options
456494
456495
  }
456495
456496
  return tsConfig;
456496
456497
  }
456497
- var build = async (tsup, options8, config) => {
456498
+ var build = async (options8, config) => {
456498
456499
  const { writeDebug } = await import("@storm-software/config-tools");
456499
456500
  if (Array.isArray(options8)) {
456500
- await Promise.all(options8.map((buildOptions) => build(tsup, buildOptions, config)));
456501
+ await Promise.all(options8.map((buildOptions) => build(buildOptions, config)));
456501
456502
  } else {
456502
456503
  let tsupOptions = options8;
456503
456504
  if (_isFunction2(tsupOptions)) {
@@ -456511,7 +456512,7 @@ ${!_isFunction2(tsupOptions) ? Object.keys(tsupOptions).map(
456511
456512
  ).join("\n") : "<function>"}
456512
456513
  `
456513
456514
  );
456514
- await tsup(tsupOptions);
456515
+ await (0, import_tsup.build)(tsupOptions);
456515
456516
  }
456516
456517
  };
456517
456518
  var _isPrimitive = (value) => {
@@ -429911,7 +429911,7 @@ ${outro}`;
429911
429911
  await promises3.mkdir(node_path.dirname(fileName), { recursive: true });
429912
429912
  return promises3.writeFile(fileName, outputFile.type === "asset" ? outputFile.source : outputFile.code);
429913
429913
  }
429914
- function defineConfig(options8) {
429914
+ function defineConfig2(options8) {
429915
429915
  return options8;
429916
429916
  }
429917
429917
  exports2.blue = blue;
@@ -429920,7 +429920,7 @@ ${outro}`;
429920
429920
  exports2.createFilter = createFilter;
429921
429921
  exports2.cyan = cyan$1;
429922
429922
  exports2.cyan$1 = cyan;
429923
- exports2.defineConfig = defineConfig;
429923
+ exports2.defineConfig = defineConfig2;
429924
429924
  exports2.ensureArray = ensureArray$1;
429925
429925
  exports2.getAugmentedNamespace = getAugmentedNamespace;
429926
429926
  exports2.getNewArray = getNewArray;
@@ -436489,7 +436489,7 @@ var require_dist6 = __commonJS({
436489
436489
  }
436490
436490
  };
436491
436491
  };
436492
- var defineConfig = (options8) => options8;
436492
+ var defineConfig2 = (options8) => options8;
436493
436493
  var isTaskkillCmdProcessNotFoundError = (err) => {
436494
436494
  return process.platform === "win32" && "cmd" in err && "code" in err && typeof err.cmd === "string" && err.cmd.startsWith("taskkill") && err.code === 128;
436495
436495
  };
@@ -436794,7 +436794,7 @@ var require_dist6 = __commonJS({
436794
436794
  );
436795
436795
  }
436796
436796
  exports2.build = build2;
436797
- exports2.defineConfig = defineConfig;
436797
+ exports2.defineConfig = defineConfig2;
436798
436798
  }
436799
436799
  });
436800
436800
 
@@ -456344,6 +456344,7 @@ async function resolveTSConfig(id = process.cwd(), options8 = {}) {
456344
456344
  }
456345
456345
 
456346
456346
  // packages/workspace-tools/src/utils/run-tsup-build.ts
456347
+ var import_tsup = __toESM(require_dist6());
456347
456348
  var applyDefaultOptions = (options8) => {
456348
456349
  options8.entry ??= "{sourceRoot}/index.ts";
456349
456350
  options8.outputPath ??= "dist/{projectRoot}";
@@ -456378,8 +456379,7 @@ var applyDefaultOptions = (options8) => {
456378
456379
  return options8;
456379
456380
  };
456380
456381
  var runTsupBuild = async (context, config, options8) => {
456381
- const { writeInfo, writeWarning, findWorkspaceRoot } = await import("@storm-software/config-tools");
456382
- const { build: tsup, defineConfig } = await Promise.resolve().then(() => __toESM(require_dist6()));
456382
+ const { writeInfo, writeDebug, writeWarning, findWorkspaceRoot } = await import("@storm-software/config-tools");
456383
456383
  const workspaceRoot = config?.workspaceRoot ?? findWorkspaceRoot();
456384
456384
  const stormEnv = Object.keys(options8.env ?? {}).filter((key2) => key2.startsWith("STORM_")).reduce((ret, key2) => {
456385
456385
  ret[key2] = options8.env?.[key2];
@@ -456392,6 +456392,13 @@ var runTsupBuild = async (context, config, options8) => {
456392
456392
  })
456393
456393
  );
456394
456394
  options8.plugins?.push(environmentPlugin(stormEnv));
456395
+ let tsconfig = await readTSConfig(options8.tsConfig);
456396
+ if (!tsconfig) {
456397
+ tsconfig = await readTSConfig(context.projectRoot);
456398
+ if (!tsconfig) {
456399
+ throw new Error("No tsconfig file found");
456400
+ }
456401
+ }
456395
456402
  const getConfigOptions = {
456396
456403
  ...options8,
456397
456404
  entry: {
@@ -456406,8 +456413,8 @@ var runTsupBuild = async (context, config, options8) => {
456406
456413
  __STORM_CONFIG: JSON.stringify(stormEnv),
456407
456414
  ...stormEnv
456408
456415
  },
456409
- dtsTsConfig: await getNormalizedTsConfig(
456410
- context,
456416
+ dtsTsConfig: getNormalizedTsConfig(
456417
+ tsconfig,
456411
456418
  workspaceRoot,
456412
456419
  options8.outputPath,
456413
456420
  createTypeScriptCompilationOptions(
@@ -456441,17 +456448,18 @@ ${options8.banner}
456441
456448
  };
456442
456449
  if (options8.getConfig) {
456443
456450
  writeInfo(config, "\u26A1 Running the Build process");
456451
+ writeDebug(config, JSON.stringify(getConfigOptions));
456444
456452
  const getConfigFns = [options8.getConfig];
456445
- const tsupConfig = defineConfig(
456453
+ const tsupConfig = (0, import_tsup.defineConfig)(
456446
456454
  getConfigFns.map(
456447
456455
  (getConfigFn) => getConfig(workspaceRoot, context.projectRoot, getConfigFn, getConfigOptions)
456448
456456
  )
456449
456457
  );
456450
456458
  if (_isFunction2(tsupConfig)) {
456451
456459
  const tsupOptions = await Promise.resolve(tsupConfig({}));
456452
- await build(tsup, tsupOptions, config);
456460
+ await build(tsupOptions, config);
456453
456461
  } else {
456454
- await build(tsup, tsupConfig, config);
456462
+ await build(tsupConfig, config);
456455
456463
  }
456456
456464
  } else {
456457
456465
  writeWarning(
@@ -456460,14 +456468,7 @@ ${options8.banner}
456460
456468
  );
456461
456469
  }
456462
456470
  };
456463
- async function getNormalizedTsConfig(context, workspaceRoot, outputPath, options8) {
456464
- let config = await readTSConfig(options8.tsConfig);
456465
- if (!config) {
456466
- config = await readTSConfig(context.projectRoot);
456467
- if (!config) {
456468
- throw new Error("No tsconfig file found");
456469
- }
456470
- }
456471
+ function getNormalizedTsConfig(config, workspaceRoot, outputPath, options8) {
456471
456472
  const tsConfig = (0, import_typescript.parseJsonConfigFileContent)(
456472
456473
  {
456473
456474
  ...config,
@@ -456494,10 +456495,10 @@ async function getNormalizedTsConfig(context, workspaceRoot, outputPath, options
456494
456495
  }
456495
456496
  return tsConfig;
456496
456497
  }
456497
- var build = async (tsup, options8, config) => {
456498
+ var build = async (options8, config) => {
456498
456499
  const { writeDebug } = await import("@storm-software/config-tools");
456499
456500
  if (Array.isArray(options8)) {
456500
- await Promise.all(options8.map((buildOptions) => build(tsup, buildOptions, config)));
456501
+ await Promise.all(options8.map((buildOptions) => build(buildOptions, config)));
456501
456502
  } else {
456502
456503
  let tsupOptions = options8;
456503
456504
  if (_isFunction2(tsupOptions)) {
@@ -456511,7 +456512,7 @@ ${!_isFunction2(tsupOptions) ? Object.keys(tsupOptions).map(
456511
456512
  ).join("\n") : "<function>"}
456512
456513
  `
456513
456514
  );
456514
- await tsup(tsupOptions);
456515
+ await (0, import_tsup.build)(tsupOptions);
456515
456516
  }
456516
456517
  };
456517
456518
  var _isPrimitive = (value) => {
@@ -429911,7 +429911,7 @@ ${outro}`;
429911
429911
  await promises3.mkdir(node_path.dirname(fileName), { recursive: true });
429912
429912
  return promises3.writeFile(fileName, outputFile.type === "asset" ? outputFile.source : outputFile.code);
429913
429913
  }
429914
- function defineConfig(options8) {
429914
+ function defineConfig2(options8) {
429915
429915
  return options8;
429916
429916
  }
429917
429917
  exports2.blue = blue;
@@ -429920,7 +429920,7 @@ ${outro}`;
429920
429920
  exports2.createFilter = createFilter;
429921
429921
  exports2.cyan = cyan$1;
429922
429922
  exports2.cyan$1 = cyan;
429923
- exports2.defineConfig = defineConfig;
429923
+ exports2.defineConfig = defineConfig2;
429924
429924
  exports2.ensureArray = ensureArray$1;
429925
429925
  exports2.getAugmentedNamespace = getAugmentedNamespace;
429926
429926
  exports2.getNewArray = getNewArray;
@@ -436489,7 +436489,7 @@ var require_dist6 = __commonJS({
436489
436489
  }
436490
436490
  };
436491
436491
  };
436492
- var defineConfig = (options8) => options8;
436492
+ var defineConfig2 = (options8) => options8;
436493
436493
  var isTaskkillCmdProcessNotFoundError = (err) => {
436494
436494
  return process.platform === "win32" && "cmd" in err && "code" in err && typeof err.cmd === "string" && err.cmd.startsWith("taskkill") && err.code === 128;
436495
436495
  };
@@ -436794,7 +436794,7 @@ var require_dist6 = __commonJS({
436794
436794
  );
436795
436795
  }
436796
436796
  exports2.build = build2;
436797
- exports2.defineConfig = defineConfig;
436797
+ exports2.defineConfig = defineConfig2;
436798
436798
  }
436799
436799
  });
436800
436800
 
@@ -456344,6 +456344,7 @@ async function resolveTSConfig(id = process.cwd(), options8 = {}) {
456344
456344
  }
456345
456345
 
456346
456346
  // packages/workspace-tools/src/utils/run-tsup-build.ts
456347
+ var import_tsup = __toESM(require_dist6());
456347
456348
  var applyDefaultOptions = (options8) => {
456348
456349
  options8.entry ??= "{sourceRoot}/index.ts";
456349
456350
  options8.outputPath ??= "dist/{projectRoot}";
@@ -456378,8 +456379,7 @@ var applyDefaultOptions = (options8) => {
456378
456379
  return options8;
456379
456380
  };
456380
456381
  var runTsupBuild = async (context, config, options8) => {
456381
- const { writeInfo, writeWarning, findWorkspaceRoot } = await import("@storm-software/config-tools");
456382
- const { build: tsup, defineConfig } = await Promise.resolve().then(() => __toESM(require_dist6()));
456382
+ const { writeInfo, writeDebug, writeWarning, findWorkspaceRoot } = await import("@storm-software/config-tools");
456383
456383
  const workspaceRoot = config?.workspaceRoot ?? findWorkspaceRoot();
456384
456384
  const stormEnv = Object.keys(options8.env ?? {}).filter((key2) => key2.startsWith("STORM_")).reduce((ret, key2) => {
456385
456385
  ret[key2] = options8.env?.[key2];
@@ -456392,6 +456392,13 @@ var runTsupBuild = async (context, config, options8) => {
456392
456392
  })
456393
456393
  );
456394
456394
  options8.plugins?.push(environmentPlugin(stormEnv));
456395
+ let tsconfig = await readTSConfig(options8.tsConfig);
456396
+ if (!tsconfig) {
456397
+ tsconfig = await readTSConfig(context.projectRoot);
456398
+ if (!tsconfig) {
456399
+ throw new Error("No tsconfig file found");
456400
+ }
456401
+ }
456395
456402
  const getConfigOptions = {
456396
456403
  ...options8,
456397
456404
  entry: {
@@ -456406,8 +456413,8 @@ var runTsupBuild = async (context, config, options8) => {
456406
456413
  __STORM_CONFIG: JSON.stringify(stormEnv),
456407
456414
  ...stormEnv
456408
456415
  },
456409
- dtsTsConfig: await getNormalizedTsConfig(
456410
- context,
456416
+ dtsTsConfig: getNormalizedTsConfig(
456417
+ tsconfig,
456411
456418
  workspaceRoot,
456412
456419
  options8.outputPath,
456413
456420
  createTypeScriptCompilationOptions(
@@ -456441,17 +456448,18 @@ ${options8.banner}
456441
456448
  };
456442
456449
  if (options8.getConfig) {
456443
456450
  writeInfo(config, "\u26A1 Running the Build process");
456451
+ writeDebug(config, JSON.stringify(getConfigOptions));
456444
456452
  const getConfigFns = [options8.getConfig];
456445
- const tsupConfig = defineConfig(
456453
+ const tsupConfig = (0, import_tsup.defineConfig)(
456446
456454
  getConfigFns.map(
456447
456455
  (getConfigFn) => getConfig(workspaceRoot, context.projectRoot, getConfigFn, getConfigOptions)
456448
456456
  )
456449
456457
  );
456450
456458
  if (_isFunction2(tsupConfig)) {
456451
456459
  const tsupOptions = await Promise.resolve(tsupConfig({}));
456452
- await build(tsup, tsupOptions, config);
456460
+ await build(tsupOptions, config);
456453
456461
  } else {
456454
- await build(tsup, tsupConfig, config);
456462
+ await build(tsupConfig, config);
456455
456463
  }
456456
456464
  } else {
456457
456465
  writeWarning(
@@ -456460,14 +456468,7 @@ ${options8.banner}
456460
456468
  );
456461
456469
  }
456462
456470
  };
456463
- async function getNormalizedTsConfig(context, workspaceRoot, outputPath, options8) {
456464
- let config = await readTSConfig(options8.tsConfig);
456465
- if (!config) {
456466
- config = await readTSConfig(context.projectRoot);
456467
- if (!config) {
456468
- throw new Error("No tsconfig file found");
456469
- }
456470
- }
456471
+ function getNormalizedTsConfig(config, workspaceRoot, outputPath, options8) {
456471
456472
  const tsConfig = (0, import_typescript.parseJsonConfigFileContent)(
456472
456473
  {
456473
456474
  ...config,
@@ -456494,10 +456495,10 @@ async function getNormalizedTsConfig(context, workspaceRoot, outputPath, options
456494
456495
  }
456495
456496
  return tsConfig;
456496
456497
  }
456497
- var build = async (tsup, options8, config) => {
456498
+ var build = async (options8, config) => {
456498
456499
  const { writeDebug } = await import("@storm-software/config-tools");
456499
456500
  if (Array.isArray(options8)) {
456500
- await Promise.all(options8.map((buildOptions) => build(tsup, buildOptions, config)));
456501
+ await Promise.all(options8.map((buildOptions) => build(buildOptions, config)));
456501
456502
  } else {
456502
456503
  let tsupOptions = options8;
456503
456504
  if (_isFunction2(tsupOptions)) {
@@ -456511,7 +456512,7 @@ ${!_isFunction2(tsupOptions) ? Object.keys(tsupOptions).map(
456511
456512
  ).join("\n") : "<function>"}
456512
456513
  `
456513
456514
  );
456514
- await tsup(tsupOptions);
456515
+ await (0, import_tsup.build)(tsupOptions);
456515
456516
  }
456516
456517
  };
456517
456518
  var _isPrimitive = (value) => {