@storm-software/workspace-tools 1.43.5 → 1.43.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -47246,8 +47246,8 @@ var require_dist2 = __commonJS({
47246
47246
  loadTsConfig: () => loadTsConfig2
47247
47247
  });
47248
47248
  module2.exports = __toCommonJS2(src_exports);
47249
- var import_path5 = __toESM2(require("path"), 1);
47250
- var import_fs5 = __toESM2(require("fs"), 1);
47249
+ var import_path3 = __toESM2(require("path"), 1);
47250
+ var import_fs3 = __toESM2(require("fs"), 1);
47251
47251
  var singleComment = Symbol("singleComment");
47252
47252
  var multiComment = Symbol("multiComment");
47253
47253
  var stripWithoutWhitespace = () => "";
@@ -47342,29 +47342,29 @@ var require_dist2 = __commonJS({
47342
47342
  }
47343
47343
  }
47344
47344
  var req = false ? createRequire(import_meta.url) : require;
47345
- var findUp = (name, startDir, stopDir = import_path5.default.parse(startDir).root) => {
47345
+ var findUp = (name, startDir, stopDir = import_path3.default.parse(startDir).root) => {
47346
47346
  let dir = startDir;
47347
47347
  while (dir !== stopDir) {
47348
- const file = import_path5.default.join(dir, name);
47349
- if (import_fs5.default.existsSync(file))
47348
+ const file = import_path3.default.join(dir, name);
47349
+ if (import_fs3.default.existsSync(file))
47350
47350
  return file;
47351
47351
  if (!file.endsWith(".json")) {
47352
47352
  const fileWithExt = file + ".json";
47353
- if (import_fs5.default.existsSync(fileWithExt))
47353
+ if (import_fs3.default.existsSync(fileWithExt))
47354
47354
  return fileWithExt;
47355
47355
  }
47356
- dir = import_path5.default.dirname(dir);
47356
+ dir = import_path3.default.dirname(dir);
47357
47357
  }
47358
47358
  return null;
47359
47359
  };
47360
47360
  var resolveTsConfigFromFile = (cwd, filename) => {
47361
- if (import_path5.default.isAbsolute(filename))
47362
- return import_fs5.default.existsSync(filename) ? filename : null;
47361
+ if (import_path3.default.isAbsolute(filename))
47362
+ return import_fs3.default.existsSync(filename) ? filename : null;
47363
47363
  return findUp(filename, cwd);
47364
47364
  };
47365
47365
  var resolveTsConfigFromExtends = (cwd, name) => {
47366
- if (import_path5.default.isAbsolute(name))
47367
- return import_fs5.default.existsSync(name) ? name : null;
47366
+ if (import_path3.default.isAbsolute(name))
47367
+ return import_fs3.default.existsSync(name) ? name : null;
47368
47368
  if (name.startsWith("."))
47369
47369
  return findUp(name, cwd);
47370
47370
  const id = req.resolve(name, { paths: [cwd] });
@@ -47372,14 +47372,14 @@ var require_dist2 = __commonJS({
47372
47372
  };
47373
47373
  var loadTsConfigInternal = (dir = process.cwd(), name = "tsconfig.json", isExtends = false) => {
47374
47374
  var _a, _b;
47375
- dir = import_path5.default.resolve(dir);
47375
+ dir = import_path3.default.resolve(dir);
47376
47376
  const id = isExtends ? resolveTsConfigFromExtends(dir, name) : resolveTsConfigFromFile(dir, name);
47377
47377
  if (!id)
47378
47378
  return null;
47379
- const data = jsoncParse(import_fs5.default.readFileSync(id, "utf-8"));
47380
- const configDir = import_path5.default.dirname(id);
47379
+ const data = jsoncParse(import_fs3.default.readFileSync(id, "utf-8"));
47380
+ const configDir = import_path3.default.dirname(id);
47381
47381
  if ((_a = data.compilerOptions) == null ? void 0 : _a.baseUrl) {
47382
- data.compilerOptions.baseUrl = import_path5.default.join(
47382
+ data.compilerOptions.baseUrl = import_path3.default.join(
47383
47383
  configDir,
47384
47384
  data.compilerOptions.baseUrl
47385
47385
  );
@@ -47461,12 +47461,12 @@ var require_dist3 = __commonJS({
47461
47461
  var import_url3 = require("url");
47462
47462
  var import_esbuild = require("esbuild");
47463
47463
  var import_load_tsconfig = require_dist2();
47464
- var import_fs5 = __toESM2(require("fs"), 1);
47465
- var import_path5 = __toESM2(require("path"), 1);
47464
+ var import_fs3 = __toESM2(require("fs"), 1);
47465
+ var import_path3 = __toESM2(require("path"), 1);
47466
47466
  var getPkgType = () => {
47467
47467
  try {
47468
47468
  const pkg = JSON.parse(
47469
- import_fs5.default.readFileSync(import_path5.default.resolve("package.json"), "utf-8")
47469
+ import_fs3.default.readFileSync(import_path3.default.resolve("package.json"), "utf-8")
47470
47470
  );
47471
47471
  return pkg.type;
47472
47472
  } catch (error) {
@@ -47475,7 +47475,7 @@ var require_dist3 = __commonJS({
47475
47475
  function guessFormat(inputFile) {
47476
47476
  if (!usingDynamicImport)
47477
47477
  return "cjs";
47478
- const ext2 = import_path5.default.extname(inputFile);
47478
+ const ext2 = import_path3.default.extname(inputFile);
47479
47479
  const type = getPkgType();
47480
47480
  if (ext2 === ".js") {
47481
47481
  return type === "module" ? "esm" : "cjs";
@@ -126441,17 +126441,17 @@ var LogLevelLabel = {
126441
126441
  };
126442
126442
 
126443
126443
  // packages/config-tools/src/utilities/find-up.ts
126444
- var import_fs = require("fs");
126445
- var import_path = require("path");
126444
+ var import_node_fs = require("node:fs");
126445
+ var import_node_path = require("node:path");
126446
126446
  var MAX_PATH_SEARCH_DEPTH = 30;
126447
126447
  var depth = 0;
126448
126448
  function findFolderUp(startPath, endFileNames) {
126449
126449
  const _startPath = startPath ?? process.cwd();
126450
- if (endFileNames.some((endFileName) => (0, import_fs.existsSync)((0, import_path.join)(_startPath, endFileName)))) {
126450
+ if (endFileNames.some((endFileName) => (0, import_node_fs.existsSync)((0, import_node_path.join)(_startPath, endFileName)))) {
126451
126451
  return _startPath;
126452
126452
  }
126453
126453
  if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
126454
- const parent = (0, import_path.join)(_startPath, "..");
126454
+ const parent = (0, import_node_path.join)(_startPath, "..");
126455
126455
  return findFolderUp(parent, endFileNames);
126456
126456
  }
126457
126457
  return void 0;
@@ -126510,8 +126510,8 @@ Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`
126510
126510
  }
126511
126511
 
126512
126512
  // packages/config-tools/src/utilities/get-default-config.ts
126513
- var import_fs2 = require("fs");
126514
- var import_path2 = require("path");
126513
+ var import_node_fs2 = require("node:fs");
126514
+ var import_node_path2 = require("node:path");
126515
126515
 
126516
126516
  // node_modules/.pnpm/zod@3.22.4/node_modules/zod/lib/index.mjs
126517
126517
  var util;
@@ -130180,8 +130180,8 @@ var getDefaultConfig = (config = {}, root) => {
130180
130180
  let license = DefaultStormConfig.license;
130181
130181
  let homepage = DefaultStormConfig.homepage;
130182
130182
  const workspaceRoot = findWorkspaceRoot(root);
130183
- if ((0, import_fs2.existsSync)((0, import_path2.join)(workspaceRoot, "package.json"))) {
130184
- const file = (0, import_fs2.readFileSync)((0, import_path2.join)(workspaceRoot, "package.json"), {
130183
+ if ((0, import_node_fs2.existsSync)((0, import_node_path2.join)(workspaceRoot, "package.json"))) {
130184
+ const file = (0, import_node_fs2.readFileSync)((0, import_node_path2.join)(workspaceRoot, "package.json"), {
130185
130185
  encoding: "utf-8"
130186
130186
  });
130187
130187
  if (file) {
@@ -130550,16 +130550,6 @@ var setConfigEnv = (config) => {
130550
130550
  }
130551
130551
  };
130552
130552
 
130553
- // packages/config-tools/src/utilities/prepare-workspace.ts
130554
- var prepareWorkspace = async () => {
130555
- const _STORM_CONFIG = getDefaultConfig({
130556
- ...await getConfigFile(),
130557
- ...getConfigEnv()
130558
- });
130559
- setConfigEnv(_STORM_CONFIG);
130560
- return _STORM_CONFIG;
130561
- };
130562
-
130563
130553
  // packages/config-tools/src/env/get-env.ts
130564
130554
  var getExtensionEnv = (extensionName) => {
130565
130555
  const prefix = `STORM_EXTENSION_${extensionName.toUpperCase()}_`;
@@ -130627,6 +130617,32 @@ var getConfigEnv = () => {
130627
130617
  }, config);
130628
130618
  };
130629
130619
 
130620
+ // packages/config-tools/src/create-storm-config.ts
130621
+ var loadStormConfig = async (workspaceRoot) => {
130622
+ let config = {};
130623
+ let _workspaceRoot = workspaceRoot;
130624
+ if (!_workspaceRoot) {
130625
+ _workspaceRoot = findWorkspaceRoot();
130626
+ }
130627
+ const configFile = await getDefaultConfig(
130628
+ {
130629
+ ...await getConfigFile(_workspaceRoot),
130630
+ ...getConfigEnv()
130631
+ },
130632
+ _workspaceRoot
130633
+ );
130634
+ if (configFile) {
130635
+ config = StormConfigSchema.parse(configFile);
130636
+ } else {
130637
+ writeWarning(
130638
+ config,
130639
+ "No Storm config file found in the current workspace. Please ensure this is the expected behavior - you can add a `storm.config.js` file to the root of your workspace if it is not."
130640
+ );
130641
+ }
130642
+ setConfigEnv(config);
130643
+ return config;
130644
+ };
130645
+
130630
130646
  // packages/workspace-tools/src/utils/get-workspace-root.ts
130631
130647
  var import_find_workspace_root2 = require("nx/src/utils/find-workspace-root.js");
130632
130648
  var getWorkspaceRoot = () => {
@@ -130765,7 +130781,7 @@ var withRunExecutor = (name, executorFn, executorOptions) => async (_options, co
130765
130781
  - projectName: ${projectName}
130766
130782
  `
130767
130783
  );
130768
- config = await prepareWorkspace();
130784
+ config = await loadStormConfig(workspaceRoot);
130769
130785
  writeTrace(
130770
130786
  config,
130771
130787
  `Loaded Storm config into env:
@@ -130853,7 +130869,7 @@ var withRunGenerator = (name, generatorFn, generatorOptions = {
130853
130869
  `Loading the Storm Config from environment variables and storm.config.js file...
130854
130870
  - workspaceRoot: ${workspaceRoot}`
130855
130871
  );
130856
- config = await prepareWorkspace();
130872
+ config = await loadStormConfig(workspaceRoot);
130857
130873
  writeTrace(
130858
130874
  config,
130859
130875
  `Loaded Storm config into env:
@@ -131413,9 +131429,9 @@ ${commentStart} ----------------------------------------------------------------
131413
131429
  };
131414
131430
 
131415
131431
  // packages/workspace-tools/src/executors/tsup/executor.ts
131416
- var import_node_fs = require("node:fs");
131432
+ var import_node_fs3 = require("node:fs");
131417
131433
  var import_promises2 = require("node:fs/promises");
131418
- var import_node_path2 = require("node:path");
131434
+ var import_node_path4 = require("node:path");
131419
131435
  var import_esbuild_decorators = __toESM(require_src2());
131420
131436
  var import_devkit3 = __toESM(require_devkit());
131421
131437
  var import_js2 = __toESM(require_src());
@@ -134026,10 +134042,10 @@ var LRUCache = class _LRUCache {
134026
134042
  };
134027
134043
 
134028
134044
  // node_modules/.pnpm/path-scurry@1.10.1/node_modules/path-scurry/dist/mjs/index.js
134029
- var import_path3 = require("path");
134045
+ var import_path = require("path");
134030
134046
  var import_url = require("url");
134031
134047
  var actualFS = __toESM(require("fs"), 1);
134032
- var import_fs3 = require("fs");
134048
+ var import_fs = require("fs");
134033
134049
  var import_promises = require("fs/promises");
134034
134050
 
134035
134051
  // node_modules/.pnpm/minipass@7.0.4/node_modules/minipass/dist/esm/index.js
@@ -134911,12 +134927,12 @@ var Minipass = class extends import_events.EventEmitter {
134911
134927
  };
134912
134928
 
134913
134929
  // node_modules/.pnpm/path-scurry@1.10.1/node_modules/path-scurry/dist/mjs/index.js
134914
- var realpathSync = import_fs3.realpathSync.native;
134930
+ var realpathSync = import_fs.realpathSync.native;
134915
134931
  var defaultFS = {
134916
- lstatSync: import_fs3.lstatSync,
134917
- readdir: import_fs3.readdir,
134918
- readdirSync: import_fs3.readdirSync,
134919
- readlinkSync: import_fs3.readlinkSync,
134932
+ lstatSync: import_fs.lstatSync,
134933
+ readdir: import_fs.readdir,
134934
+ readdirSync: import_fs.readdirSync,
134935
+ readlinkSync: import_fs.readlinkSync,
134920
134936
  realpathSync,
134921
134937
  promises: {
134922
134938
  lstat: import_promises.lstat,
@@ -135912,7 +135928,7 @@ var PathWin32 = class _PathWin32 extends PathBase {
135912
135928
  * @internal
135913
135929
  */
135914
135930
  getRootString(path3) {
135915
- return import_path3.win32.parse(path3).root;
135931
+ return import_path.win32.parse(path3).root;
135916
135932
  }
135917
135933
  /**
135918
135934
  * @internal
@@ -136552,7 +136568,7 @@ var PathScurryWin32 = class extends PathScurryBase {
136552
136568
  sep = "\\";
136553
136569
  constructor(cwd = process.cwd(), opts = {}) {
136554
136570
  const { nocase = true } = opts;
136555
- super(cwd, import_path3.win32, "\\", { ...opts, nocase });
136571
+ super(cwd, import_path.win32, "\\", { ...opts, nocase });
136556
136572
  this.nocase = nocase;
136557
136573
  for (let p = this.cwd; p; p = p.parent) {
136558
136574
  p.nocase = this.nocase;
@@ -136562,7 +136578,7 @@ var PathScurryWin32 = class extends PathScurryBase {
136562
136578
  * @internal
136563
136579
  */
136564
136580
  parseRootPath(dir) {
136565
- return import_path3.win32.parse(dir).root.toUpperCase();
136581
+ return import_path.win32.parse(dir).root.toUpperCase();
136566
136582
  }
136567
136583
  /**
136568
136584
  * @internal
@@ -136584,7 +136600,7 @@ var PathScurryPosix = class extends PathScurryBase {
136584
136600
  sep = "/";
136585
136601
  constructor(cwd = process.cwd(), opts = {}) {
136586
136602
  const { nocase = false } = opts;
136587
- super(cwd, import_path3.posix, "/", { ...opts, nocase });
136603
+ super(cwd, import_path.posix, "/", { ...opts, nocase });
136588
136604
  this.nocase = nocase;
136589
136605
  }
136590
136606
  /**
@@ -137647,13 +137663,13 @@ var import_tsup = __toESM(require_dist6());
137647
137663
  var ts = __toESM(require("typescript"));
137648
137664
 
137649
137665
  // packages/workspace-tools/src/utils/file-path-utils.ts
137650
- var import_node_path = require("node:path");
137666
+ var import_node_path3 = require("node:path");
137651
137667
  var removeExtension = (filePath) => {
137652
137668
  return filePath.lastIndexOf(".") ? filePath.substring(0, filePath.lastIndexOf(".")) : filePath;
137653
137669
  };
137654
137670
  function findFileName(filePath) {
137655
137671
  return filePath?.split(
137656
- filePath?.includes(import_node_path.sep) ? import_node_path.sep : filePath?.includes("/") ? "/" : "\\"
137672
+ filePath?.includes(import_node_path3.sep) ? import_node_path3.sep : filePath?.includes("/") ? "/" : "\\"
137657
137673
  )?.pop() ?? "";
137658
137674
  }
137659
137675
 
@@ -137724,416 +137740,405 @@ var getTypiaTransform = (program, diagnostics) => (0, import_transform.default)(
137724
137740
 
137725
137741
  // packages/workspace-tools/src/executors/tsup/executor.ts
137726
137742
  async function tsupExecutorFn(options, context, config) {
137727
- try {
137728
- writeInfo(config, "\u{1F4E6} Running Storm build executor on the workspace");
137729
- getLogLevel(config?.logLevel) >= LogLevel.TRACE && writeDebug(
137730
- config,
137731
- `\u2699\uFE0F Executor options:
137743
+ writeInfo(config, "\u{1F4E6} Running Storm build executor on the workspace");
137744
+ getLogLevel(config?.logLevel) >= LogLevel.TRACE && writeDebug(
137745
+ config,
137746
+ `\u2699\uFE0F Executor options:
137732
137747
  ${Object.keys(options).map(
137733
- (key) => `${key}: ${!options[key] || _isPrimitive(options[key]) ? options[key] : JSON.stringify(options[key])}`
137734
- ).join("\n")}
137748
+ (key) => `${key}: ${!options[key] || _isPrimitive(options[key]) ? options[key] : JSON.stringify(options[key])}`
137749
+ ).join("\n")}
137735
137750
  `
137751
+ );
137752
+ if (!context.projectsConfigurations?.projects || !context.projectName || !context.projectsConfigurations.projects[context.projectName]) {
137753
+ throw new Error(
137754
+ "The Build process failed because the context is not valid. Please run this command from a workspace."
137736
137755
  );
137737
- if (!context.projectsConfigurations?.projects || !context.projectName || !context.projectsConfigurations.projects[context.projectName]) {
137738
- throw new Error(
137739
- "The Build process failed because the context is not valid. Please run this command from a workspace."
137740
- );
137741
- }
137742
- const workspaceRoot = getWorkspaceRoot();
137743
- const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
137744
- const sourceRoot = context.projectsConfigurations.projects[context.projectName].sourceRoot;
137745
- if (options.clean !== false) {
137746
- if (getLogLevel(config?.logLevel) >= LogLevel.DEBUG) {
137747
- writeInfo(config, `\u{1F9F9} Cleaning output path: ${options.outputPath}`);
137748
- }
137749
- (0, import_fs_extra.removeSync)(options.outputPath);
137750
- }
137751
- const assets = Array.from(options.assets);
137756
+ }
137757
+ const workspaceRoot = getWorkspaceRoot();
137758
+ const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
137759
+ const sourceRoot = context.projectsConfigurations.projects[context.projectName].sourceRoot;
137760
+ if (options.clean !== false) {
137761
+ if (getLogLevel(config?.logLevel) >= LogLevel.DEBUG) {
137762
+ writeInfo(config, `\u{1F9F9} Cleaning output path: ${options.outputPath}`);
137763
+ }
137764
+ (0, import_fs_extra.removeSync)(options.outputPath);
137765
+ }
137766
+ const assets = Array.from(options.assets);
137767
+ assets.push({
137768
+ input: projectRoot,
137769
+ glob: "*.md",
137770
+ output: "/"
137771
+ });
137772
+ assets.push({
137773
+ input: "",
137774
+ glob: "LICENSE",
137775
+ output: "."
137776
+ });
137777
+ if (options.generatePackageJson === false) {
137752
137778
  assets.push({
137753
137779
  input: projectRoot,
137754
- glob: "*.md",
137755
- output: "/"
137780
+ glob: "**/package.json",
137781
+ output: "."
137756
137782
  });
137783
+ }
137784
+ if (options.includeSrc === true) {
137757
137785
  assets.push({
137758
- input: "",
137759
- glob: "LICENSE",
137760
- output: "."
137786
+ input: sourceRoot,
137787
+ glob: "**/{*.ts,*.tsx,*.js,*.jsx}",
137788
+ output: "src/"
137761
137789
  });
137762
- if (options.generatePackageJson === false) {
137763
- assets.push({
137764
- input: projectRoot,
137765
- glob: "**/package.json",
137766
- output: "."
137767
- });
137768
- }
137769
- if (options.includeSrc === true) {
137770
- assets.push({
137771
- input: sourceRoot,
137772
- glob: "**/{*.ts,*.tsx,*.js,*.jsx}",
137773
- output: "src/"
137774
- });
137775
- }
137776
- const result = await (0, import_js2.copyAssets)(
137777
- { assets, watch: options.watch, outputPath: options.outputPath },
137778
- context
137779
- );
137780
- if (!result.success) {
137781
- throw new Error("The Build process failed trying to copy assets");
137782
- }
137783
- const pathToPackageJson = (0, import_node_path2.join)(context.root, projectRoot, "package.json");
137784
- const packageJson = (0, import_fileutils.fileExists)(pathToPackageJson) ? (0, import_devkit3.readJsonFile)(pathToPackageJson) : { name: context.projectName, version: "0.0.1" };
137785
- const workspacePackageJson = (0, import_devkit3.readJsonFile)((0, import_node_path2.join)(workspaceRoot, "package.json"));
137786
- options.external = options.external || [];
137787
- if (workspacePackageJson?.dependencies) {
137788
- options.external = Object.keys(workspacePackageJson?.dependencies).reduce(
137789
- (ret, key) => {
137790
- if (!ret.includes(key)) {
137791
- ret.push(key);
137792
- }
137793
- return ret;
137794
- },
137795
- options.external
137796
- );
137797
- }
137798
- const externalDependencies = options.external.reduce(
137799
- (ret, name) => {
137800
- if (!packageJson?.devDependencies?.[name]) {
137801
- const externalNode = context.projectGraph.externalNodes[`npm:${name}`];
137802
- if (externalNode) {
137803
- ret.push({
137804
- name,
137805
- outputs: [],
137806
- node: externalNode
137807
- });
137808
- }
137790
+ }
137791
+ const result = await (0, import_js2.copyAssets)(
137792
+ { assets, watch: options.watch, outputPath: options.outputPath },
137793
+ context
137794
+ );
137795
+ if (!result.success) {
137796
+ throw new Error("The Build process failed trying to copy assets");
137797
+ }
137798
+ const pathToPackageJson = (0, import_node_path4.join)(context.root, projectRoot, "package.json");
137799
+ const packageJson = (0, import_fileutils.fileExists)(pathToPackageJson) ? (0, import_devkit3.readJsonFile)(pathToPackageJson) : { name: context.projectName, version: "0.0.1" };
137800
+ const workspacePackageJson = (0, import_devkit3.readJsonFile)((0, import_node_path4.join)(workspaceRoot, "package.json"));
137801
+ options.external = options.external || [];
137802
+ if (workspacePackageJson?.dependencies) {
137803
+ options.external = Object.keys(workspacePackageJson?.dependencies).reduce(
137804
+ (ret, key) => {
137805
+ if (!ret.includes(key)) {
137806
+ ret.push(key);
137809
137807
  }
137810
137808
  return ret;
137811
137809
  },
137812
- []
137810
+ options.external
137813
137811
  );
137814
- const implicitDependencies = context.projectsConfigurations.projects[context.projectName].implicitDependencies;
137815
- const internalDependencies = [];
137816
- const projectConfigs = await Promise.resolve(getProjectConfigurations());
137817
- if (getLogLevel(config?.logLevel) >= LogLevel.TRACE) {
137818
- writeDebug(config, "Project Configs:");
137819
- console.log(projectConfigs);
137820
- }
137821
- if (implicitDependencies && implicitDependencies.length > 0) {
137822
- options.external = implicitDependencies.reduce((ret, key) => {
137823
- if (getLogLevel(config?.logLevel) >= LogLevel.DEBUG) {
137824
- writeDebug(config, `\u26A1 Adding implicit dependency: ${key}`);
137825
- }
137826
- const projectConfig = projectConfigs[key];
137827
- if (projectConfig?.targets?.build) {
137828
- const projectPackageJson = (0, import_devkit3.readJsonFile)(projectConfig.targets?.build.options.project);
137829
- if (projectPackageJson?.name && !options.external.includes(projectPackageJson.name)) {
137830
- ret.push(projectPackageJson.name);
137831
- internalDependencies.push(projectPackageJson.name);
137832
- }
137833
- }
137834
- return ret;
137835
- }, options.external);
137836
- }
137837
- if (options.bundle === false) {
137838
- for (const thirdPartyDependency of getExternalDependencies(
137839
- context.projectName,
137840
- context.projectGraph
137841
- )) {
137842
- const packageConfig = thirdPartyDependency.node.data;
137843
- if (packageConfig?.packageName) {
137844
- options.external.push(packageConfig.packageName);
137845
- if (!packageJson?.devDependencies?.[packageConfig.packageName]) {
137846
- externalDependencies.push(thirdPartyDependency);
137847
- }
137812
+ }
137813
+ const externalDependencies = options.external.reduce(
137814
+ (ret, name) => {
137815
+ if (!packageJson?.devDependencies?.[name]) {
137816
+ const externalNode = context.projectGraph.externalNodes[`npm:${name}`];
137817
+ if (externalNode) {
137818
+ ret.push({
137819
+ name,
137820
+ outputs: [],
137821
+ node: externalNode
137822
+ });
137848
137823
  }
137849
137824
  }
137850
- }
137851
- if (getLogLevel(config?.logLevel) >= LogLevel.TRACE) {
137852
- console.log(`Building with the following dependencies marked as external:
137853
- ${externalDependencies.map((dep) => {
137854
- return `name: ${dep.name}, node: ${dep.node}, outputs: ${dep.outputs}`;
137855
- }).join("\n")}`);
137856
- }
137857
- const prettierOptions = {
137858
- plugins: ["prettier-plugin-packagejson"],
137859
- trailingComma: "none",
137860
- tabWidth: 2,
137861
- semi: true,
137862
- singleQuote: false,
137863
- quoteProps: "preserve",
137864
- insertPragma: false,
137865
- bracketSameLine: true,
137866
- printWidth: 80,
137867
- bracketSpacing: true,
137868
- arrowParens: "avoid",
137869
- endOfLine: "lf"
137870
- };
137871
- const entryPoints = [];
137872
- if (options.entry) {
137873
- entryPoints.push(options.entry);
137874
- }
137875
- if (options.emitOnAll === true) {
137876
- entryPoints.push((0, import_devkit3.joinPathFragments)(sourceRoot, "**/*.{ts,tsx}"));
137877
- }
137878
- if (options.additionalEntryPoints) {
137879
- entryPoints.push(...options.additionalEntryPoints);
137880
- }
137881
- const entry = globSync(entryPoints, {
137882
- withFileTypes: true
137883
- }).reduce((ret, filePath) => {
137884
- let formattedPath = workspaceRoot.replaceAll("\\", "/");
137885
- if (formattedPath.toUpperCase().startsWith("C:")) {
137886
- formattedPath = formattedPath.substring(2);
137887
- }
137888
- let propertyKey = (0, import_devkit3.joinPathFragments)(filePath.path, removeExtension(filePath.name)).replaceAll("\\", "/").replaceAll(formattedPath, "").replaceAll(sourceRoot, "").replaceAll(projectRoot, "");
137889
- if (propertyKey) {
137890
- while (propertyKey.startsWith("/")) {
137891
- propertyKey = propertyKey.substring(1);
137892
- }
137893
- if (getLogLevel(config?.logLevel) >= LogLevel.DEBUG) {
137894
- console.debug(
137895
- `Trying to add entry point ${propertyKey} at "${(0, import_devkit3.joinPathFragments)(
137896
- filePath.path,
137897
- filePath.name
137898
- )}"`
137899
- );
137900
- }
137901
- if (!(propertyKey in ret)) {
137902
- ret[propertyKey] = (0, import_devkit3.joinPathFragments)(filePath.path, filePath.name);
137825
+ return ret;
137826
+ },
137827
+ []
137828
+ );
137829
+ const implicitDependencies = context.projectsConfigurations.projects[context.projectName].implicitDependencies;
137830
+ const internalDependencies = [];
137831
+ const projectConfigs = await Promise.resolve(getProjectConfigurations());
137832
+ if (getLogLevel(config?.logLevel) >= LogLevel.TRACE) {
137833
+ writeDebug(config, "Project Configs:");
137834
+ console.log(projectConfigs);
137835
+ }
137836
+ if (implicitDependencies && implicitDependencies.length > 0) {
137837
+ options.external = implicitDependencies.reduce((ret, key) => {
137838
+ if (getLogLevel(config?.logLevel) >= LogLevel.DEBUG) {
137839
+ writeDebug(config, `\u26A1 Adding implicit dependency: ${key}`);
137840
+ }
137841
+ const projectConfig = projectConfigs[key];
137842
+ if (projectConfig?.targets?.build) {
137843
+ const projectPackageJson = (0, import_devkit3.readJsonFile)(projectConfig.targets?.build.options.project);
137844
+ if (projectPackageJson?.name && !options.external.includes(projectPackageJson.name)) {
137845
+ ret.push(projectPackageJson.name);
137846
+ internalDependencies.push(projectPackageJson.name);
137903
137847
  }
137904
137848
  }
137905
137849
  return ret;
137906
- }, {});
137907
- if (options.generatePackageJson !== false) {
137908
- const projectGraph = (0, import_devkit3.readCachedProjectGraph)();
137909
- packageJson.dependencies = void 0;
137910
- for (const externalDependency of externalDependencies) {
137911
- const packageConfig = externalDependency.node.data;
137912
- if (packageConfig?.packageName && !!(projectGraph.externalNodes[externalDependency.node.name]?.type === "npm")) {
137913
- const { packageName, version } = packageConfig;
137914
- if (workspacePackageJson.dependencies?.[packageName] || workspacePackageJson.devDependencies?.[packageName] || packageJson?.devDependencies?.[packageName]) {
137915
- return null;
137916
- }
137917
- packageJson.dependencies ??= {};
137918
- packageJson.dependencies[packageName] = projectGraph.nodes[externalDependency.node.name] ? "latest" : version;
137850
+ }, options.external);
137851
+ }
137852
+ if (options.bundle === false) {
137853
+ for (const thirdPartyDependency of getExternalDependencies(
137854
+ context.projectName,
137855
+ context.projectGraph
137856
+ )) {
137857
+ const packageConfig = thirdPartyDependency.node.data;
137858
+ if (packageConfig?.packageName) {
137859
+ options.external.push(packageConfig.packageName);
137860
+ if (!packageJson?.devDependencies?.[packageConfig.packageName]) {
137861
+ externalDependencies.push(thirdPartyDependency);
137919
137862
  }
137920
137863
  }
137921
- for (const packageName of internalDependencies) {
137922
- if (!packageJson?.devDependencies?.[packageName]) {
137923
- packageJson.dependencies ??= {};
137924
- packageJson.dependencies[packageName] = "latest";
137864
+ }
137865
+ }
137866
+ writeTrace(
137867
+ config,
137868
+ `Building with the following dependencies marked as external:
137869
+ ${externalDependencies.map((dep) => {
137870
+ return `name: ${dep.name}, node: ${dep.node}, outputs: ${dep.outputs}`;
137871
+ }).join("\n")}`
137872
+ );
137873
+ const prettierOptions = {
137874
+ plugins: ["prettier-plugin-packagejson"],
137875
+ trailingComma: "none",
137876
+ tabWidth: 2,
137877
+ semi: true,
137878
+ singleQuote: false,
137879
+ quoteProps: "preserve",
137880
+ insertPragma: false,
137881
+ bracketSameLine: true,
137882
+ printWidth: 80,
137883
+ bracketSpacing: true,
137884
+ arrowParens: "avoid",
137885
+ endOfLine: "lf"
137886
+ };
137887
+ const entryPoints = [];
137888
+ if (options.entry) {
137889
+ entryPoints.push(options.entry);
137890
+ }
137891
+ if (options.emitOnAll === true) {
137892
+ entryPoints.push((0, import_devkit3.joinPathFragments)(sourceRoot, "**/*.{ts,tsx}"));
137893
+ }
137894
+ if (options.additionalEntryPoints) {
137895
+ entryPoints.push(...options.additionalEntryPoints);
137896
+ }
137897
+ const entry = globSync(entryPoints, {
137898
+ withFileTypes: true
137899
+ }).reduce((ret, filePath) => {
137900
+ let formattedPath = workspaceRoot.replaceAll("\\", "/");
137901
+ if (formattedPath.toUpperCase().startsWith("C:")) {
137902
+ formattedPath = formattedPath.substring(2);
137903
+ }
137904
+ let propertyKey = (0, import_devkit3.joinPathFragments)(filePath.path, removeExtension(filePath.name)).replaceAll("\\", "/").replaceAll(formattedPath, "").replaceAll(sourceRoot, "").replaceAll(projectRoot, "");
137905
+ if (propertyKey) {
137906
+ while (propertyKey.startsWith("/")) {
137907
+ propertyKey = propertyKey.substring(1);
137908
+ }
137909
+ writeDebug(
137910
+ config,
137911
+ `Trying to add entry point ${propertyKey} at "${(0, import_devkit3.joinPathFragments)(
137912
+ filePath.path,
137913
+ filePath.name
137914
+ )}"`
137915
+ );
137916
+ if (!(propertyKey in ret)) {
137917
+ ret[propertyKey] = (0, import_devkit3.joinPathFragments)(filePath.path, filePath.name);
137918
+ }
137919
+ }
137920
+ return ret;
137921
+ }, {});
137922
+ if (options.generatePackageJson !== false) {
137923
+ const projectGraph = (0, import_devkit3.readCachedProjectGraph)();
137924
+ packageJson.dependencies = void 0;
137925
+ for (const externalDependency of externalDependencies) {
137926
+ const packageConfig = externalDependency.node.data;
137927
+ if (packageConfig?.packageName && !!(projectGraph.externalNodes[externalDependency.node.name]?.type === "npm")) {
137928
+ const { packageName, version } = packageConfig;
137929
+ if (workspacePackageJson.dependencies?.[packageName] || workspacePackageJson.devDependencies?.[packageName] || packageJson?.devDependencies?.[packageName]) {
137930
+ return null;
137925
137931
  }
137932
+ packageJson.dependencies ??= {};
137933
+ packageJson.dependencies[packageName] = projectGraph.nodes[externalDependency.node.name] ? "latest" : version;
137926
137934
  }
137927
- const distPaths = !options?.getConfig || _isFunction(options.getConfig) ? ["dist/"] : Object.keys(options.getConfig).map((key) => `${key}/`);
137928
- packageJson.type = "module";
137929
- if (distPaths.length > 0) {
137930
- packageJson.exports ??= {
137931
- ".": {
137935
+ }
137936
+ for (const packageName of internalDependencies) {
137937
+ if (!packageJson?.devDependencies?.[packageName]) {
137938
+ packageJson.dependencies ??= {};
137939
+ packageJson.dependencies[packageName] = "latest";
137940
+ }
137941
+ }
137942
+ const distPaths = !options?.getConfig || _isFunction(options.getConfig) ? ["dist/"] : Object.keys(options.getConfig).map((key) => `${key}/`);
137943
+ packageJson.type = "module";
137944
+ if (distPaths.length > 0) {
137945
+ packageJson.exports ??= {
137946
+ ".": {
137947
+ import: {
137948
+ types: `./${distPaths[0]}index.d.ts`,
137949
+ default: `./${distPaths[0]}index.js`
137950
+ },
137951
+ require: {
137952
+ types: `./${distPaths[0]}index.d.cts`,
137953
+ default: `./${distPaths[0]}index.cjs`
137954
+ },
137955
+ default: {
137956
+ types: `./${distPaths[0]}index.d.ts`,
137957
+ default: `./${distPaths[0]}index.js`
137958
+ },
137959
+ ...(options.additionalEntryPoints ?? []).map((entryPoint) => ({
137960
+ [removeExtension(entryPoint).replace(sourceRoot, "")]: {
137961
+ types: (0, import_node_path4.join)(
137962
+ `./${distPaths[0]}`,
137963
+ `${removeExtension(entryPoint.replace(sourceRoot, ""))}.d.ts`
137964
+ ),
137965
+ default: (0, import_node_path4.join)(
137966
+ `./${distPaths[0]}`,
137967
+ `${removeExtension(entryPoint.replace(sourceRoot, ""))}.js`
137968
+ )
137969
+ }
137970
+ }))
137971
+ },
137972
+ "./package.json": "./package.json"
137973
+ };
137974
+ packageJson.exports = Object.keys(entry).reduce((ret, key) => {
137975
+ let packageJsonKey = key.startsWith("./") ? key : `./${key}`;
137976
+ packageJsonKey = packageJsonKey.replaceAll("/index", "");
137977
+ if (!ret[packageJsonKey]) {
137978
+ ret[packageJsonKey] = {
137932
137979
  import: {
137933
137980
  types: `./${distPaths[0]}index.d.ts`,
137934
- default: `./${distPaths[0]}index.js`
137981
+ default: `./${distPaths[0]}${key}.js`
137935
137982
  },
137936
137983
  require: {
137937
137984
  types: `./${distPaths[0]}index.d.cts`,
137938
- default: `./${distPaths[0]}index.cjs`
137985
+ default: `./${distPaths[0]}${key}.cjs`
137939
137986
  },
137940
137987
  default: {
137941
137988
  types: `./${distPaths[0]}index.d.ts`,
137942
- default: `./${distPaths[0]}index.js`
137943
- },
137944
- ...(options.additionalEntryPoints ?? []).map((entryPoint) => ({
137945
- [removeExtension(entryPoint).replace(sourceRoot, "")]: {
137946
- types: (0, import_node_path2.join)(
137947
- `./${distPaths[0]}`,
137948
- `${removeExtension(entryPoint.replace(sourceRoot, ""))}.d.ts`
137949
- ),
137950
- default: (0, import_node_path2.join)(
137951
- `./${distPaths[0]}`,
137952
- `${removeExtension(entryPoint.replace(sourceRoot, ""))}.js`
137953
- )
137954
- }
137955
- }))
137956
- },
137957
- "./package.json": "./package.json"
137958
- };
137959
- packageJson.exports = Object.keys(entry).reduce((ret, key) => {
137960
- let packageJsonKey = key.startsWith("./") ? key : `./${key}`;
137961
- packageJsonKey = packageJsonKey.replaceAll("/index", "");
137962
- if (!ret[packageJsonKey]) {
137963
- ret[packageJsonKey] = {
137964
- import: {
137965
- types: `./${distPaths[0]}index.d.ts`,
137966
- default: `./${distPaths[0]}${key}.js`
137967
- },
137968
- require: {
137969
- types: `./${distPaths[0]}index.d.cts`,
137970
- default: `./${distPaths[0]}${key}.cjs`
137971
- },
137972
- default: {
137973
- types: `./${distPaths[0]}index.d.ts`,
137974
- default: `./${distPaths[0]}${key}.js`
137975
- }
137976
- };
137977
- }
137978
- return ret;
137979
- }, packageJson.exports);
137980
- packageJson.funding ??= workspacePackageJson.funding;
137981
- packageJson.types ??= `${distPaths.length > 1 ? distPaths[1] : distPaths[0]}index.d.ts`;
137982
- packageJson.typings ??= `${distPaths.length > 1 ? distPaths[1] : distPaths[0]}index.d.ts`;
137983
- packageJson.typescript ??= {
137984
- definition: `${distPaths.length > 1 ? distPaths[1] : distPaths[0]}index.d.ts`
137985
- };
137986
- packageJson.main ??= `${distPaths.length > 1 ? distPaths[1] : distPaths[0]}index.cjs`;
137987
- packageJson.module ??= `${distPaths.length > 1 ? distPaths[1] : distPaths[0]}index.js`;
137988
- if (options.platform && options.platform !== "node") {
137989
- packageJson.browser ??= `${distPaths[0]}index.global.js`;
137990
- }
137991
- if (options.includeSrc === true) {
137992
- let distSrc = sourceRoot.replace(projectRoot, "");
137993
- if (distSrc.startsWith("/")) {
137994
- distSrc = distSrc.substring(1);
137995
- }
137996
- packageJson.source ??= `${(0, import_node_path2.join)(distSrc, "index.ts").replaceAll("\\", "/")}`;
137997
- }
137998
- packageJson.sideEffects ??= false;
137999
- packageJson.files ??= ["dist/**/*"];
138000
- if (options.includeSrc === true && !packageJson.files.includes("src")) {
138001
- packageJson.files.push("src/**/*");
137989
+ default: `./${distPaths[0]}${key}.js`
137990
+ }
137991
+ };
138002
137992
  }
138003
- }
138004
- packageJson.publishConfig ??= {
138005
- access: "public"
138006
- };
138007
- packageJson.description ??= workspacePackageJson.description;
138008
- packageJson.homepage ??= workspacePackageJson.homepage;
138009
- packageJson.bugs ??= workspacePackageJson.bugs;
138010
- packageJson.author ??= workspacePackageJson.author;
138011
- packageJson.license ??= workspacePackageJson.license;
138012
- packageJson.keywords ??= workspacePackageJson.keywords;
138013
- packageJson.repository ??= workspacePackageJson.repository;
138014
- packageJson.repository.directory ??= projectRoot ? projectRoot : (0, import_node_path2.join)("packages", context.projectName);
138015
- const packageJsonPath = (0, import_node_path2.join)(context.root, options.outputPath, "package.json");
138016
- if (getLogLevel(config?.logLevel) >= LogLevel.DEBUG) {
138017
- writeDebug(config, `\u26A1 Writing package.json file to: ${packageJsonPath}`);
138018
- }
138019
- (0, import_node_fs.writeFileSync)(
138020
- packageJsonPath,
138021
- await (0, import_prettier.format)(JSON.stringify(packageJson), {
138022
- ...prettierOptions,
138023
- parser: "json"
138024
- })
138025
- );
138026
- }
138027
- if (options.includeSrc === true) {
138028
- const files = globSync([
138029
- (0, import_devkit3.joinPathFragments)(context.root, options.outputPath, "src/**/*.ts"),
138030
- (0, import_devkit3.joinPathFragments)(context.root, options.outputPath, "src/**/*.tsx"),
138031
- (0, import_devkit3.joinPathFragments)(context.root, options.outputPath, "src/**/*.js"),
138032
- (0, import_devkit3.joinPathFragments)(context.root, options.outputPath, "src/**/*.jsx")
138033
- ]);
138034
- await Promise.allSettled(
138035
- files.map(
138036
- async (file) => (0, import_promises2.writeFile)(
138037
- file,
138038
- await (0, import_prettier.format)(
138039
- `${options.banner ? options.banner.startsWith("//") ? options.banner : `// ${options.banner}` : ""}
138040
-
138041
- ${(0, import_node_fs.readFileSync)(file, "utf-8")}`,
138042
- {
138043
- ...prettierOptions,
138044
- parser: "typescript"
138045
- }
138046
- ),
138047
- "utf-8"
138048
- )
138049
- )
138050
- );
138051
- }
138052
- const stormEnv = Object.keys(options.env).filter((key) => key.startsWith("STORM_")).reduce((ret, key) => {
138053
- ret[key] = options.env[key];
138054
- return ret;
138055
- }, {});
138056
- options.plugins.push(
138057
- (0, import_esbuild_decorators.esbuildDecorators)({
138058
- tsconfig: options.tsConfig,
138059
- cwd: workspaceRoot
137993
+ return ret;
137994
+ }, packageJson.exports);
137995
+ packageJson.funding ??= workspacePackageJson.funding;
137996
+ packageJson.types ??= `${distPaths.length > 1 ? distPaths[1] : distPaths[0]}index.d.ts`;
137997
+ packageJson.typings ??= `${distPaths.length > 1 ? distPaths[1] : distPaths[0]}index.d.ts`;
137998
+ packageJson.typescript ??= {
137999
+ definition: `${distPaths.length > 1 ? distPaths[1] : distPaths[0]}index.d.ts`
138000
+ };
138001
+ packageJson.main ??= `${distPaths.length > 1 ? distPaths[1] : distPaths[0]}index.cjs`;
138002
+ packageJson.module ??= `${distPaths.length > 1 ? distPaths[1] : distPaths[0]}index.js`;
138003
+ if (options.platform && options.platform !== "node") {
138004
+ packageJson.browser ??= `${distPaths[0]}index.global.js`;
138005
+ }
138006
+ if (options.includeSrc === true) {
138007
+ let distSrc = sourceRoot.replace(projectRoot, "");
138008
+ if (distSrc.startsWith("/")) {
138009
+ distSrc = distSrc.substring(1);
138010
+ }
138011
+ packageJson.source ??= `${(0, import_node_path4.join)(distSrc, "index.ts").replaceAll("\\", "/")}`;
138012
+ }
138013
+ packageJson.sideEffects ??= false;
138014
+ packageJson.files ??= ["dist/**/*"];
138015
+ if (options.includeSrc === true && !packageJson.files.includes("src")) {
138016
+ packageJson.files.push("src/**/*");
138017
+ }
138018
+ }
138019
+ packageJson.publishConfig ??= {
138020
+ access: "public"
138021
+ };
138022
+ packageJson.description ??= workspacePackageJson.description;
138023
+ packageJson.homepage ??= workspacePackageJson.homepage;
138024
+ packageJson.bugs ??= workspacePackageJson.bugs;
138025
+ packageJson.author ??= workspacePackageJson.author;
138026
+ packageJson.license ??= workspacePackageJson.license;
138027
+ packageJson.keywords ??= workspacePackageJson.keywords;
138028
+ packageJson.repository ??= workspacePackageJson.repository;
138029
+ packageJson.repository.directory ??= projectRoot ? projectRoot : (0, import_node_path4.join)("packages", context.projectName);
138030
+ const packageJsonPath = (0, import_node_path4.join)(context.root, options.outputPath, "package.json");
138031
+ writeDebug(config, `\u26A1 Writing package.json file to: ${packageJsonPath}`);
138032
+ (0, import_node_fs3.writeFileSync)(
138033
+ packageJsonPath,
138034
+ await (0, import_prettier.format)(JSON.stringify(packageJson), {
138035
+ ...prettierOptions,
138036
+ parser: "json"
138060
138037
  })
138061
138038
  );
138062
- options.plugins.push(environmentPlugin(stormEnv));
138063
- const getConfigOptions = {
138064
- ...options,
138065
- define: {
138066
- __STORM_CONFIG: JSON.stringify(stormEnv)
138067
- },
138068
- env: {
138069
- __STORM_CONFIG: JSON.stringify(stormEnv),
138070
- ...stormEnv
138071
- },
138072
- dtsTsConfig: getNormalizedTsConfig(
138073
- context.root,
138074
- options.outputPath,
138075
- (0, import_tsc.createTypeScriptCompilationOptions)(
138076
- (0, import_normalize_options.normalizeOptions)(
138039
+ } else {
138040
+ writeWarning(config, "Skipping writing to package.json file");
138041
+ }
138042
+ if (options.includeSrc === true) {
138043
+ const files = globSync([
138044
+ (0, import_devkit3.joinPathFragments)(context.root, options.outputPath, "src/**/*.ts"),
138045
+ (0, import_devkit3.joinPathFragments)(context.root, options.outputPath, "src/**/*.tsx"),
138046
+ (0, import_devkit3.joinPathFragments)(context.root, options.outputPath, "src/**/*.js"),
138047
+ (0, import_devkit3.joinPathFragments)(context.root, options.outputPath, "src/**/*.jsx")
138048
+ ]);
138049
+ await Promise.allSettled(
138050
+ files.map(
138051
+ async (file) => (0, import_promises2.writeFile)(
138052
+ file,
138053
+ await (0, import_prettier.format)(
138054
+ `${options.banner ? options.banner.startsWith("//") ? options.banner : `// ${options.banner}` : ""}
138055
+
138056
+ ${(0, import_node_fs3.readFileSync)(file, "utf-8")}`,
138077
138057
  {
138078
- ...options,
138079
- watch: false,
138080
- main: options.entry,
138081
- transformers: options.skipTypia ? [] : ["typia/lib/transform"]
138082
- },
138083
- context.root,
138084
- sourceRoot,
138085
- workspaceRoot
138058
+ ...prettierOptions,
138059
+ parser: "typescript"
138060
+ }
138086
138061
  ),
138087
- context
138062
+ "utf-8"
138088
138063
  )
138089
- ),
138090
- banner: options.banner ? {
138091
- js: `${options.banner}
138064
+ )
138065
+ );
138066
+ }
138067
+ const stormEnv = Object.keys(options.env).filter((key) => key.startsWith("STORM_")).reduce((ret, key) => {
138068
+ ret[key] = options.env[key];
138069
+ return ret;
138070
+ }, {});
138071
+ options.plugins.push(
138072
+ (0, import_esbuild_decorators.esbuildDecorators)({
138073
+ tsconfig: options.tsConfig,
138074
+ cwd: workspaceRoot
138075
+ })
138076
+ );
138077
+ options.plugins.push(environmentPlugin(stormEnv));
138078
+ const getConfigOptions = {
138079
+ ...options,
138080
+ define: {
138081
+ __STORM_CONFIG: JSON.stringify(stormEnv)
138082
+ },
138083
+ env: {
138084
+ __STORM_CONFIG: JSON.stringify(stormEnv),
138085
+ ...stormEnv
138086
+ },
138087
+ dtsTsConfig: getNormalizedTsConfig(
138088
+ context.root,
138089
+ options.outputPath,
138090
+ (0, import_tsc.createTypeScriptCompilationOptions)(
138091
+ (0, import_normalize_options.normalizeOptions)(
138092
+ {
138093
+ ...options,
138094
+ watch: false,
138095
+ main: options.entry,
138096
+ transformers: options.skipTypia ? [] : ["typia/lib/transform"]
138097
+ },
138098
+ context.root,
138099
+ sourceRoot,
138100
+ workspaceRoot
138101
+ ),
138102
+ context
138103
+ )
138104
+ ),
138105
+ banner: options.banner ? {
138106
+ js: `${options.banner}
138092
138107
 
138093
138108
  `,
138094
- css: `/*
138109
+ css: `/*
138095
138110
  ${options.banner}
138096
138111
  */
138097
138112
 
138098
138113
  `
138099
- } : void 0,
138100
- outputPath: options.outputPath,
138101
- entry,
138102
- getTransform: options.skipTypia ? void 0 : getTypiaTransform
138103
- };
138104
- if (options.getConfig) {
138105
- if (getLogLevel(config?.logLevel) >= LogLevel.INFO) {
138106
- writeInfo(config, "\u26A1 Running the Build process");
138107
- }
138108
- const getConfigFns = _isFunction(options.getConfig) ? [options.getConfig] : Object.keys(options.getConfig).map((key) => options.getConfig[key]);
138109
- const tsupConfig = (0, import_tsup.defineConfig)(
138110
- getConfigFns.map(
138111
- (getConfigFn) => getConfig(context.root, projectRoot, getConfigFn, getConfigOptions)
138112
- )
138113
- );
138114
- if (_isFunction(tsupConfig)) {
138115
- await build(await Promise.resolve(tsupConfig({})), config);
138116
- } else {
138117
- await build(tsupConfig, config);
138118
- }
138119
- } else if (getLogLevel(config?.logLevel) >= LogLevel.WARN) {
138120
- writeWarning(
138121
- config,
138122
- "The Build process did not run because no `getConfig` parameter was provided"
138123
- );
138124
- }
138125
- if (getLogLevel(config?.logLevel) >= LogLevel.INFO) {
138126
- writeSuccess(config, "\u26A1 The Build process has completed successfully");
138114
+ } : void 0,
138115
+ outputPath: options.outputPath,
138116
+ entry,
138117
+ getTransform: options.skipTypia ? void 0 : getTypiaTransform
138118
+ };
138119
+ if (options.getConfig) {
138120
+ writeInfo(config, "\u26A1 Running the Build process");
138121
+ const getConfigFns = _isFunction(options.getConfig) ? [options.getConfig] : Object.keys(options.getConfig).map((key) => options.getConfig[key]);
138122
+ const tsupConfig = (0, import_tsup.defineConfig)(
138123
+ getConfigFns.map(
138124
+ (getConfigFn) => getConfig(context.root, projectRoot, getConfigFn, getConfigOptions)
138125
+ )
138126
+ );
138127
+ if (_isFunction(tsupConfig)) {
138128
+ await build(await Promise.resolve(tsupConfig({})), config);
138129
+ } else {
138130
+ await build(tsupConfig, config);
138127
138131
  }
138128
- return {
138129
- success: true
138130
- };
138131
- } catch (e) {
138132
- console.error(e);
138133
- return {
138134
- success: false
138135
- };
138132
+ } else if (getLogLevel(config?.logLevel) >= LogLevel.WARN) {
138133
+ writeWarning(
138134
+ config,
138135
+ "The Build process did not run because no `getConfig` parameter was provided"
138136
+ );
138136
138137
  }
138138
+ writeSuccess(config, "\u26A1 The Build process has completed successfully");
138139
+ return {
138140
+ success: true
138141
+ };
138137
138142
  }
138138
138143
  function getNormalizedTsConfig(workspaceRoot, outputPath, options) {
138139
138144
  const config = ts.readConfigFile(options.tsConfig, ts.sys.readFile).config;
@@ -138153,11 +138158,11 @@ function getNormalizedTsConfig(workspaceRoot, outputPath, options) {
138153
138158
  emitDeclarationOnly: true,
138154
138159
  declaration: true,
138155
138160
  declarationMap: true,
138156
- declarationDir: (0, import_node_path2.join)(workspaceRoot, "tmp", ".tsup", "declaration")
138161
+ declarationDir: (0, import_node_path4.join)(workspaceRoot, "tmp", ".tsup", "declaration")
138157
138162
  }
138158
138163
  },
138159
138164
  ts.sys,
138160
- (0, import_node_path2.dirname)(options.tsConfig)
138165
+ (0, import_node_path4.dirname)(options.tsConfig)
138161
138166
  );
138162
138167
  tsConfig.options.pathsBasePath = workspaceRoot;
138163
138168
  if (tsConfig.options.incremental && !tsConfig.options.tsBuildInfoFile) {
@@ -138483,8 +138488,8 @@ var executor_default3 = withRunExecutor(
138483
138488
 
138484
138489
  // packages/workspace-tools/src/generators/config-schema/generator.ts
138485
138490
  var import_devkit6 = __toESM(require_devkit());
138486
- var import_fs4 = require("fs");
138487
- var import_path4 = require("path");
138491
+ var import_fs2 = require("fs");
138492
+ var import_path2 = require("path");
138488
138493
 
138489
138494
  // node_modules/.pnpm/zod-to-json-schema@3.22.1_zod@3.22.4/node_modules/zod-to-json-schema/dist/esm/errorMessages.js
138490
138495
  function addErrorMessage(res, key, errorMessage, refs) {
@@ -139504,11 +139509,11 @@ async function configSchemaGeneratorFn(tree, options) {
139504
139509
  const modules = await Promise.all(
139505
139510
  Object.keys(projectConfigurations).map(async (key) => {
139506
139511
  if (projectConfigurations[key]?.config) {
139507
- const configPath = (0, import_path4.join)(
139512
+ const configPath = (0, import_path2.join)(
139508
139513
  workspaceRoot,
139509
139514
  projectConfigurations[key].config
139510
139515
  );
139511
- if ((0, import_fs4.existsSync)(configPath)) {
139516
+ if ((0, import_fs2.existsSync)(configPath)) {
139512
139517
  const mod = await import(configPath);
139513
139518
  if (mod.default) {
139514
139519
  return { name: key, schema: mod.default };
@@ -139536,7 +139541,7 @@ async function configSchemaGeneratorFn(tree, options) {
139536
139541
  );
139537
139542
  (0, import_devkit6.writeJson)(
139538
139543
  tree,
139539
- options.outputFile ? (0, import_path4.join)(workspaceRoot, options.outputFile) : (0, import_path4.join)(workspaceRoot, "storm.schema.json"),
139544
+ options.outputFile ? (0, import_path2.join)(workspaceRoot, options.outputFile) : (0, import_path2.join)(workspaceRoot, "storm.schema.json"),
139540
139545
  zodToJsonSchema(ModulesSchema, "StormConfig")
139541
139546
  );
139542
139547
  await (0, import_devkit6.formatFiles)(tree);
@@ -139835,12 +139840,12 @@ var generator_default3 = withRunGenerator(
139835
139840
  );
139836
139841
 
139837
139842
  // packages/workspace-tools/src/utils/find-cache-dir.ts
139838
- var import_node_fs2 = require("node:fs");
139839
- var import_node_path3 = require("node:path");
139843
+ var import_node_fs4 = require("node:fs");
139844
+ var import_node_path5 = require("node:path");
139840
139845
  var import_node_process = require("node:process");
139841
139846
  var isWritable2 = (path3) => {
139842
139847
  try {
139843
- (0, import_node_fs2.accessSync)(path3, import_node_fs2.constants.W_OK);
139848
+ (0, import_node_fs4.accessSync)(path3, import_node_fs4.constants.W_OK);
139844
139849
  return true;
139845
139850
  } catch {
139846
139851
  return false;
@@ -139848,13 +139853,13 @@ var isWritable2 = (path3) => {
139848
139853
  };
139849
139854
  function useDirectory(directory, { create = true }) {
139850
139855
  if (create) {
139851
- (0, import_node_fs2.mkdirSync)(directory, { recursive: true });
139856
+ (0, import_node_fs4.mkdirSync)(directory, { recursive: true });
139852
139857
  }
139853
139858
  return directory;
139854
139859
  }
139855
139860
  function getNodeModuleDirectory(workspaceRoot) {
139856
- const nodeModules = (0, import_node_path3.join)(workspaceRoot, "node_modules");
139857
- if ((0, import_node_fs2.existsSync)(nodeModules) && !isWritable2(nodeModules)) {
139861
+ const nodeModules = (0, import_node_path5.join)(workspaceRoot, "node_modules");
139862
+ if ((0, import_node_fs4.existsSync)(nodeModules) && !isWritable2(nodeModules)) {
139858
139863
  throw new Error("Cannot write to node_modules directory");
139859
139864
  }
139860
139865
  return nodeModules;
@@ -139870,10 +139875,10 @@ function findCacheDirectory({
139870
139875
  create: true
139871
139876
  }) {
139872
139877
  if (import_node_process.env.CACHE_DIR && !["true", "false", "1", "0"].includes(import_node_process.env.CACHE_DIR)) {
139873
- return useDirectory((0, import_node_path3.join)(import_node_process.env.CACHE_DIR, name, cacheName), { create });
139878
+ return useDirectory((0, import_node_path5.join)(import_node_process.env.CACHE_DIR, name, cacheName), { create });
139874
139879
  }
139875
139880
  if (import_node_process.env.STORM_CACHE_DIR && !["true", "false", "1", "0"].includes(import_node_process.env.STORM_CACHE_DIR)) {
139876
- return useDirectory((0, import_node_path3.join)(import_node_process.env.STORM_CACHE_DIR, name, cacheName), {
139881
+ return useDirectory((0, import_node_path5.join)(import_node_process.env.STORM_CACHE_DIR, name, cacheName), {
139877
139882
  create
139878
139883
  });
139879
139884
  }
@@ -139882,14 +139887,14 @@ function findCacheDirectory({
139882
139887
  throw new Error("Cannot find node_modules directory");
139883
139888
  }
139884
139889
  return useDirectory(
139885
- (0, import_node_path3.join)(workspaceRoot, "node_modules", ".cache", name, cacheName),
139890
+ (0, import_node_path5.join)(workspaceRoot, "node_modules", ".cache", name, cacheName),
139886
139891
  { create }
139887
139892
  );
139888
139893
  }
139889
139894
 
139890
139895
  // packages/workspace-tools/src/utils/workspace-storage.ts
139891
- var import_node_fs3 = require("node:fs");
139892
- var import_node_path4 = require("node:path");
139896
+ var import_node_fs5 = require("node:fs");
139897
+ var import_node_path6 = require("node:path");
139893
139898
  var WorkspaceStorage = class {
139894
139899
  constructor({
139895
139900
  cacheName,
@@ -139909,9 +139914,9 @@ var WorkspaceStorage = class {
139909
139914
  * @returns The value of the key
139910
139915
  */
139911
139916
  getItem(key) {
139912
- const cacheFile = (0, import_node_path4.join)(this.cacheDir, key);
139913
- if ((0, import_node_fs3.existsSync)(cacheFile)) {
139914
- return (0, import_node_fs3.readFileSync)(cacheFile, "utf-8");
139917
+ const cacheFile = (0, import_node_path6.join)(this.cacheDir, key);
139918
+ if ((0, import_node_fs5.existsSync)(cacheFile)) {
139919
+ return (0, import_node_fs5.readFileSync)(cacheFile, "utf-8");
139915
139920
  }
139916
139921
  return void 0;
139917
139922
  }
@@ -139922,7 +139927,7 @@ var WorkspaceStorage = class {
139922
139927
  * @param value - The value to set
139923
139928
  */
139924
139929
  setItem(key, value) {
139925
- (0, import_node_fs3.writeFileSync)((0, import_node_path4.join)(this.cacheDir, key), value, { encoding: "utf-8" });
139930
+ (0, import_node_fs5.writeFileSync)((0, import_node_path6.join)(this.cacheDir, key), value, { encoding: "utf-8" });
139926
139931
  }
139927
139932
  /**
139928
139933
  * Remove item from cache
@@ -139930,14 +139935,14 @@ var WorkspaceStorage = class {
139930
139935
  * @param key - The key to remove
139931
139936
  */
139932
139937
  removeItem(key) {
139933
- (0, import_node_fs3.rmSync)((0, import_node_path4.join)(this.cacheDir, key), { force: true, recursive: true });
139938
+ (0, import_node_fs5.rmSync)((0, import_node_path6.join)(this.cacheDir, key), { force: true, recursive: true });
139934
139939
  }
139935
139940
  /**
139936
139941
  * Clear the cache
139937
139942
  */
139938
139943
  clear() {
139939
- (0, import_node_fs3.readdirSync)(this.cacheDir).forEach((cacheFile) => {
139940
- (0, import_node_fs3.rmSync)(cacheFile, { force: true, recursive: true });
139944
+ (0, import_node_fs5.readdirSync)(this.cacheDir).forEach((cacheFile) => {
139945
+ (0, import_node_fs5.rmSync)(cacheFile, { force: true, recursive: true });
139941
139946
  });
139942
139947
  }
139943
139948
  /**
@@ -139947,7 +139952,7 @@ var WorkspaceStorage = class {
139947
139952
  * @returns The key at the index
139948
139953
  */
139949
139954
  key(index) {
139950
- const files = (0, import_node_fs3.readdirSync)(this.cacheDir);
139955
+ const files = (0, import_node_fs5.readdirSync)(this.cacheDir);
139951
139956
  if (index < files.length && index >= 0) {
139952
139957
  return files[index];
139953
139958
  }