@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.
@@ -47246,8 +47246,8 @@ var require_dist2 = __commonJS({
47246
47246
  loadTsConfig: () => loadTsConfig2
47247
47247
  });
47248
47248
  module2.exports = __toCommonJS2(src_exports);
47249
- var import_path4 = __toESM2(require("path"), 1);
47250
- var import_fs4 = __toESM2(require("fs"), 1);
47249
+ var import_path2 = __toESM2(require("path"), 1);
47250
+ var import_fs2 = __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_path4.default.parse(startDir).root) => {
47345
+ var findUp = (name, startDir, stopDir = import_path2.default.parse(startDir).root) => {
47346
47346
  let dir = startDir;
47347
47347
  while (dir !== stopDir) {
47348
- const file = import_path4.default.join(dir, name);
47349
- if (import_fs4.default.existsSync(file))
47348
+ const file = import_path2.default.join(dir, name);
47349
+ if (import_fs2.default.existsSync(file))
47350
47350
  return file;
47351
47351
  if (!file.endsWith(".json")) {
47352
47352
  const fileWithExt = file + ".json";
47353
- if (import_fs4.default.existsSync(fileWithExt))
47353
+ if (import_fs2.default.existsSync(fileWithExt))
47354
47354
  return fileWithExt;
47355
47355
  }
47356
- dir = import_path4.default.dirname(dir);
47356
+ dir = import_path2.default.dirname(dir);
47357
47357
  }
47358
47358
  return null;
47359
47359
  };
47360
47360
  var resolveTsConfigFromFile = (cwd, filename) => {
47361
- if (import_path4.default.isAbsolute(filename))
47362
- return import_fs4.default.existsSync(filename) ? filename : null;
47361
+ if (import_path2.default.isAbsolute(filename))
47362
+ return import_fs2.default.existsSync(filename) ? filename : null;
47363
47363
  return findUp(filename, cwd);
47364
47364
  };
47365
47365
  var resolveTsConfigFromExtends = (cwd, name) => {
47366
- if (import_path4.default.isAbsolute(name))
47367
- return import_fs4.default.existsSync(name) ? name : null;
47366
+ if (import_path2.default.isAbsolute(name))
47367
+ return import_fs2.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_path4.default.resolve(dir);
47375
+ dir = import_path2.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_fs4.default.readFileSync(id, "utf-8"));
47380
- const configDir = import_path4.default.dirname(id);
47379
+ const data = jsoncParse(import_fs2.default.readFileSync(id, "utf-8"));
47380
+ const configDir = import_path2.default.dirname(id);
47381
47381
  if ((_a = data.compilerOptions) == null ? void 0 : _a.baseUrl) {
47382
- data.compilerOptions.baseUrl = import_path4.default.join(
47382
+ data.compilerOptions.baseUrl = import_path2.default.join(
47383
47383
  configDir,
47384
47384
  data.compilerOptions.baseUrl
47385
47385
  );
@@ -47456,17 +47456,17 @@ var require_dist3 = __commonJS({
47456
47456
  tsconfigPathsToRegExp: () => tsconfigPathsToRegExp
47457
47457
  });
47458
47458
  module2.exports = __toCommonJS2(src_exports);
47459
- var import_fs22 = __toESM2(require("fs"), 1);
47460
- var import_path22 = __toESM2(require("path"), 1);
47459
+ var import_fs2 = __toESM2(require("fs"), 1);
47460
+ var import_path2 = __toESM2(require("path"), 1);
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_fs4 = __toESM2(require("fs"), 1);
47465
- var import_path4 = __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_fs4.default.readFileSync(import_path4.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_path4.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";
@@ -47532,7 +47532,7 @@ var require_dist3 = __commonJS({
47532
47532
  name: "bundle-require:external",
47533
47533
  setup(ctx) {
47534
47534
  ctx.onResolve({ filter: /.*/ }, async (args) => {
47535
- if (args.path[0] === "." || import_path22.default.isAbsolute(args.path)) {
47535
+ if (args.path[0] === "." || import_path2.default.isAbsolute(args.path)) {
47536
47536
  return;
47537
47537
  }
47538
47538
  if (match2(args.path, external)) {
@@ -47561,11 +47561,11 @@ var require_dist3 = __commonJS({
47561
47561
  "import.meta.url": IMPORT_META_URL_VAR_NAME
47562
47562
  };
47563
47563
  ctx.onLoad({ filter: JS_EXT_RE }, async (args) => {
47564
- const contents = await import_fs22.default.promises.readFile(args.path, "utf-8");
47564
+ const contents = await import_fs2.default.promises.readFile(args.path, "utf-8");
47565
47565
  const injectLines = [
47566
47566
  `const ${FILENAME_VAR_NAME} = ${JSON.stringify(args.path)};`,
47567
47567
  `const ${DIRNAME_VAR_NAME} = ${JSON.stringify(
47568
- import_path22.default.dirname(args.path)
47568
+ import_path2.default.dirname(args.path)
47569
47569
  )};`,
47570
47570
  `const ${IMPORT_META_URL_VAR_NAME} = ${JSON.stringify(
47571
47571
  (0, import_url3.pathToFileURL)(args.path).href
@@ -47573,7 +47573,7 @@ var require_dist3 = __commonJS({
47573
47573
  ];
47574
47574
  return {
47575
47575
  contents: injectLines.join("") + contents,
47576
- loader: inferLoader(import_path22.default.extname(args.path))
47576
+ loader: inferLoader(import_path2.default.extname(args.path))
47577
47577
  };
47578
47578
  });
47579
47579
  }
@@ -47599,7 +47599,7 @@ var require_dist3 = __commonJS({
47599
47599
  const { text } = result.outputFiles[0];
47600
47600
  const getOutputFile = options.getOutputFile || defaultGetOutputFile;
47601
47601
  const outfile = getOutputFile(options.filepath, format2);
47602
- await import_fs22.default.promises.writeFile(outfile, text, "utf8");
47602
+ await import_fs2.default.promises.writeFile(outfile, text, "utf8");
47603
47603
  let mod;
47604
47604
  const req = options.require || dynamicImport;
47605
47605
  try {
@@ -47609,7 +47609,7 @@ var require_dist3 = __commonJS({
47609
47609
  );
47610
47610
  } finally {
47611
47611
  if (!preserveTemporaryFile) {
47612
- await import_fs22.default.promises.unlink(outfile);
47612
+ await import_fs2.default.promises.unlink(outfile);
47613
47613
  }
47614
47614
  }
47615
47615
  return {
@@ -126392,17 +126392,17 @@ var LogLevelLabel = {
126392
126392
  };
126393
126393
 
126394
126394
  // packages/config-tools/src/utilities/find-up.ts
126395
- var import_fs = require("fs");
126396
- var import_path = require("path");
126395
+ var import_node_fs = require("node:fs");
126396
+ var import_node_path = require("node:path");
126397
126397
  var MAX_PATH_SEARCH_DEPTH = 30;
126398
126398
  var depth = 0;
126399
126399
  function findFolderUp(startPath, endFileNames) {
126400
126400
  const _startPath = startPath ?? process.cwd();
126401
- if (endFileNames.some((endFileName) => (0, import_fs.existsSync)((0, import_path.join)(_startPath, endFileName)))) {
126401
+ if (endFileNames.some((endFileName) => (0, import_node_fs.existsSync)((0, import_node_path.join)(_startPath, endFileName)))) {
126402
126402
  return _startPath;
126403
126403
  }
126404
126404
  if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
126405
- const parent = (0, import_path.join)(_startPath, "..");
126405
+ const parent = (0, import_node_path.join)(_startPath, "..");
126406
126406
  return findFolderUp(parent, endFileNames);
126407
126407
  }
126408
126408
  return void 0;
@@ -126461,8 +126461,8 @@ Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`
126461
126461
  }
126462
126462
 
126463
126463
  // packages/config-tools/src/utilities/get-default-config.ts
126464
- var import_fs2 = require("fs");
126465
- var import_path2 = require("path");
126464
+ var import_node_fs2 = require("node:fs");
126465
+ var import_node_path2 = require("node:path");
126466
126466
 
126467
126467
  // node_modules/.pnpm/zod@3.22.4/node_modules/zod/lib/index.mjs
126468
126468
  var util;
@@ -130131,8 +130131,8 @@ var getDefaultConfig = (config = {}, root) => {
130131
130131
  let license = DefaultStormConfig.license;
130132
130132
  let homepage = DefaultStormConfig.homepage;
130133
130133
  const workspaceRoot = findWorkspaceRoot(root);
130134
- if ((0, import_fs2.existsSync)((0, import_path2.join)(workspaceRoot, "package.json"))) {
130135
- const file = (0, import_fs2.readFileSync)((0, import_path2.join)(workspaceRoot, "package.json"), {
130134
+ if ((0, import_node_fs2.existsSync)((0, import_node_path2.join)(workspaceRoot, "package.json"))) {
130135
+ const file = (0, import_node_fs2.readFileSync)((0, import_node_path2.join)(workspaceRoot, "package.json"), {
130136
130136
  encoding: "utf-8"
130137
130137
  });
130138
130138
  if (file) {
@@ -130501,16 +130501,6 @@ var setConfigEnv = (config) => {
130501
130501
  }
130502
130502
  };
130503
130503
 
130504
- // packages/config-tools/src/utilities/prepare-workspace.ts
130505
- var prepareWorkspace = async () => {
130506
- const _STORM_CONFIG = getDefaultConfig({
130507
- ...await getConfigFile(),
130508
- ...getConfigEnv()
130509
- });
130510
- setConfigEnv(_STORM_CONFIG);
130511
- return _STORM_CONFIG;
130512
- };
130513
-
130514
130504
  // packages/config-tools/src/env/get-env.ts
130515
130505
  var getExtensionEnv = (extensionName) => {
130516
130506
  const prefix = `STORM_EXTENSION_${extensionName.toUpperCase()}_`;
@@ -130578,6 +130568,32 @@ var getConfigEnv = () => {
130578
130568
  }, config);
130579
130569
  };
130580
130570
 
130571
+ // packages/config-tools/src/create-storm-config.ts
130572
+ var loadStormConfig = async (workspaceRoot) => {
130573
+ let config = {};
130574
+ let _workspaceRoot = workspaceRoot;
130575
+ if (!_workspaceRoot) {
130576
+ _workspaceRoot = findWorkspaceRoot();
130577
+ }
130578
+ const configFile = await getDefaultConfig(
130579
+ {
130580
+ ...await getConfigFile(_workspaceRoot),
130581
+ ...getConfigEnv()
130582
+ },
130583
+ _workspaceRoot
130584
+ );
130585
+ if (configFile) {
130586
+ config = StormConfigSchema.parse(configFile);
130587
+ } else {
130588
+ writeWarning(
130589
+ config,
130590
+ "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."
130591
+ );
130592
+ }
130593
+ setConfigEnv(config);
130594
+ return config;
130595
+ };
130596
+
130581
130597
  // packages/workspace-tools/src/utils/get-workspace-root.ts
130582
130598
  var import_find_workspace_root2 = require("nx/src/utils/find-workspace-root.js");
130583
130599
  var getWorkspaceRoot = () => {
@@ -130690,7 +130706,7 @@ var withRunExecutor = (name, executorFn, executorOptions) => async (_options, co
130690
130706
  - projectName: ${projectName}
130691
130707
  `
130692
130708
  );
130693
- config = await prepareWorkspace();
130709
+ config = await loadStormConfig(workspaceRoot);
130694
130710
  writeTrace(
130695
130711
  config,
130696
130712
  `Loaded Storm config into env:
@@ -130791,9 +130807,9 @@ ${commentStart} ----------------------------------------------------------------
130791
130807
  };
130792
130808
 
130793
130809
  // packages/workspace-tools/src/executors/tsup/executor.ts
130794
- var import_node_fs = require("node:fs");
130810
+ var import_node_fs3 = require("node:fs");
130795
130811
  var import_promises2 = require("node:fs/promises");
130796
- var import_node_path = require("node:path");
130812
+ var import_node_path3 = require("node:path");
130797
130813
  var import_esbuild_decorators = __toESM(require_src());
130798
130814
  var import_devkit2 = __toESM(require_devkit());
130799
130815
  var import_js = __toESM(require_src2());
@@ -133404,10 +133420,10 @@ var LRUCache = class _LRUCache {
133404
133420
  };
133405
133421
 
133406
133422
  // node_modules/.pnpm/path-scurry@1.10.1/node_modules/path-scurry/dist/mjs/index.js
133407
- var import_path3 = require("path");
133423
+ var import_path = require("path");
133408
133424
  var import_url = require("url");
133409
133425
  var actualFS = __toESM(require("fs"), 1);
133410
- var import_fs3 = require("fs");
133426
+ var import_fs = require("fs");
133411
133427
  var import_promises = require("fs/promises");
133412
133428
 
133413
133429
  // node_modules/.pnpm/minipass@7.0.4/node_modules/minipass/dist/esm/index.js
@@ -134289,12 +134305,12 @@ var Minipass = class extends import_events.EventEmitter {
134289
134305
  };
134290
134306
 
134291
134307
  // node_modules/.pnpm/path-scurry@1.10.1/node_modules/path-scurry/dist/mjs/index.js
134292
- var realpathSync = import_fs3.realpathSync.native;
134308
+ var realpathSync = import_fs.realpathSync.native;
134293
134309
  var defaultFS = {
134294
- lstatSync: import_fs3.lstatSync,
134295
- readdir: import_fs3.readdir,
134296
- readdirSync: import_fs3.readdirSync,
134297
- readlinkSync: import_fs3.readlinkSync,
134310
+ lstatSync: import_fs.lstatSync,
134311
+ readdir: import_fs.readdir,
134312
+ readdirSync: import_fs.readdirSync,
134313
+ readlinkSync: import_fs.readlinkSync,
134298
134314
  realpathSync,
134299
134315
  promises: {
134300
134316
  lstat: import_promises.lstat,
@@ -135290,7 +135306,7 @@ var PathWin32 = class _PathWin32 extends PathBase {
135290
135306
  * @internal
135291
135307
  */
135292
135308
  getRootString(path2) {
135293
- return import_path3.win32.parse(path2).root;
135309
+ return import_path.win32.parse(path2).root;
135294
135310
  }
135295
135311
  /**
135296
135312
  * @internal
@@ -135930,7 +135946,7 @@ var PathScurryWin32 = class extends PathScurryBase {
135930
135946
  sep = "\\";
135931
135947
  constructor(cwd = process.cwd(), opts = {}) {
135932
135948
  const { nocase = true } = opts;
135933
- super(cwd, import_path3.win32, "\\", { ...opts, nocase });
135949
+ super(cwd, import_path.win32, "\\", { ...opts, nocase });
135934
135950
  this.nocase = nocase;
135935
135951
  for (let p = this.cwd; p; p = p.parent) {
135936
135952
  p.nocase = this.nocase;
@@ -135940,7 +135956,7 @@ var PathScurryWin32 = class extends PathScurryBase {
135940
135956
  * @internal
135941
135957
  */
135942
135958
  parseRootPath(dir) {
135943
- return import_path3.win32.parse(dir).root.toUpperCase();
135959
+ return import_path.win32.parse(dir).root.toUpperCase();
135944
135960
  }
135945
135961
  /**
135946
135962
  * @internal
@@ -135962,7 +135978,7 @@ var PathScurryPosix = class extends PathScurryBase {
135962
135978
  sep = "/";
135963
135979
  constructor(cwd = process.cwd(), opts = {}) {
135964
135980
  const { nocase = false } = opts;
135965
- super(cwd, import_path3.posix, "/", { ...opts, nocase });
135981
+ super(cwd, import_path.posix, "/", { ...opts, nocase });
135966
135982
  this.nocase = nocase;
135967
135983
  }
135968
135984
  /**
@@ -137158,416 +137174,405 @@ var getTypiaTransform = (program, diagnostics) => (0, import_transform.default)(
137158
137174
 
137159
137175
  // packages/workspace-tools/src/executors/tsup/executor.ts
137160
137176
  async function tsupExecutorFn(options, context, config) {
137161
- try {
137162
- writeInfo(config, "\u{1F4E6} Running Storm build executor on the workspace");
137163
- getLogLevel(config?.logLevel) >= LogLevel.TRACE && writeDebug(
137164
- config,
137165
- `\u2699\uFE0F Executor options:
137177
+ writeInfo(config, "\u{1F4E6} Running Storm build executor on the workspace");
137178
+ getLogLevel(config?.logLevel) >= LogLevel.TRACE && writeDebug(
137179
+ config,
137180
+ `\u2699\uFE0F Executor options:
137166
137181
  ${Object.keys(options).map(
137167
- (key) => `${key}: ${!options[key] || _isPrimitive(options[key]) ? options[key] : JSON.stringify(options[key])}`
137168
- ).join("\n")}
137182
+ (key) => `${key}: ${!options[key] || _isPrimitive(options[key]) ? options[key] : JSON.stringify(options[key])}`
137183
+ ).join("\n")}
137169
137184
  `
137185
+ );
137186
+ if (!context.projectsConfigurations?.projects || !context.projectName || !context.projectsConfigurations.projects[context.projectName]) {
137187
+ throw new Error(
137188
+ "The Build process failed because the context is not valid. Please run this command from a workspace."
137170
137189
  );
137171
- if (!context.projectsConfigurations?.projects || !context.projectName || !context.projectsConfigurations.projects[context.projectName]) {
137172
- throw new Error(
137173
- "The Build process failed because the context is not valid. Please run this command from a workspace."
137174
- );
137175
- }
137176
- const workspaceRoot = getWorkspaceRoot();
137177
- const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
137178
- const sourceRoot = context.projectsConfigurations.projects[context.projectName].sourceRoot;
137179
- if (options.clean !== false) {
137180
- if (getLogLevel(config?.logLevel) >= LogLevel.DEBUG) {
137181
- writeInfo(config, `\u{1F9F9} Cleaning output path: ${options.outputPath}`);
137182
- }
137183
- (0, import_fs_extra.removeSync)(options.outputPath);
137190
+ }
137191
+ const workspaceRoot = getWorkspaceRoot();
137192
+ const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
137193
+ const sourceRoot = context.projectsConfigurations.projects[context.projectName].sourceRoot;
137194
+ if (options.clean !== false) {
137195
+ if (getLogLevel(config?.logLevel) >= LogLevel.DEBUG) {
137196
+ writeInfo(config, `\u{1F9F9} Cleaning output path: ${options.outputPath}`);
137184
137197
  }
137185
- const assets = Array.from(options.assets);
137198
+ (0, import_fs_extra.removeSync)(options.outputPath);
137199
+ }
137200
+ const assets = Array.from(options.assets);
137201
+ assets.push({
137202
+ input: projectRoot,
137203
+ glob: "*.md",
137204
+ output: "/"
137205
+ });
137206
+ assets.push({
137207
+ input: "",
137208
+ glob: "LICENSE",
137209
+ output: "."
137210
+ });
137211
+ if (options.generatePackageJson === false) {
137186
137212
  assets.push({
137187
137213
  input: projectRoot,
137188
- glob: "*.md",
137189
- output: "/"
137214
+ glob: "**/package.json",
137215
+ output: "."
137190
137216
  });
137217
+ }
137218
+ if (options.includeSrc === true) {
137191
137219
  assets.push({
137192
- input: "",
137193
- glob: "LICENSE",
137194
- output: "."
137220
+ input: sourceRoot,
137221
+ glob: "**/{*.ts,*.tsx,*.js,*.jsx}",
137222
+ output: "src/"
137195
137223
  });
137196
- if (options.generatePackageJson === false) {
137197
- assets.push({
137198
- input: projectRoot,
137199
- glob: "**/package.json",
137200
- output: "."
137201
- });
137202
- }
137203
- if (options.includeSrc === true) {
137204
- assets.push({
137205
- input: sourceRoot,
137206
- glob: "**/{*.ts,*.tsx,*.js,*.jsx}",
137207
- output: "src/"
137208
- });
137209
- }
137210
- const result = await (0, import_js.copyAssets)(
137211
- { assets, watch: options.watch, outputPath: options.outputPath },
137212
- context
137213
- );
137214
- if (!result.success) {
137215
- throw new Error("The Build process failed trying to copy assets");
137216
- }
137217
- const pathToPackageJson = (0, import_node_path.join)(context.root, projectRoot, "package.json");
137218
- const packageJson = (0, import_fileutils.fileExists)(pathToPackageJson) ? (0, import_devkit2.readJsonFile)(pathToPackageJson) : { name: context.projectName, version: "0.0.1" };
137219
- const workspacePackageJson = (0, import_devkit2.readJsonFile)((0, import_node_path.join)(workspaceRoot, "package.json"));
137220
- options.external = options.external || [];
137221
- if (workspacePackageJson?.dependencies) {
137222
- options.external = Object.keys(workspacePackageJson?.dependencies).reduce(
137223
- (ret, key) => {
137224
- if (!ret.includes(key)) {
137225
- ret.push(key);
137226
- }
137227
- return ret;
137228
- },
137229
- options.external
137230
- );
137231
- }
137232
- const externalDependencies = options.external.reduce(
137233
- (ret, name) => {
137234
- if (!packageJson?.devDependencies?.[name]) {
137235
- const externalNode = context.projectGraph.externalNodes[`npm:${name}`];
137236
- if (externalNode) {
137237
- ret.push({
137238
- name,
137239
- outputs: [],
137240
- node: externalNode
137241
- });
137242
- }
137224
+ }
137225
+ const result = await (0, import_js.copyAssets)(
137226
+ { assets, watch: options.watch, outputPath: options.outputPath },
137227
+ context
137228
+ );
137229
+ if (!result.success) {
137230
+ throw new Error("The Build process failed trying to copy assets");
137231
+ }
137232
+ const pathToPackageJson = (0, import_node_path3.join)(context.root, projectRoot, "package.json");
137233
+ const packageJson = (0, import_fileutils.fileExists)(pathToPackageJson) ? (0, import_devkit2.readJsonFile)(pathToPackageJson) : { name: context.projectName, version: "0.0.1" };
137234
+ const workspacePackageJson = (0, import_devkit2.readJsonFile)((0, import_node_path3.join)(workspaceRoot, "package.json"));
137235
+ options.external = options.external || [];
137236
+ if (workspacePackageJson?.dependencies) {
137237
+ options.external = Object.keys(workspacePackageJson?.dependencies).reduce(
137238
+ (ret, key) => {
137239
+ if (!ret.includes(key)) {
137240
+ ret.push(key);
137243
137241
  }
137244
137242
  return ret;
137245
137243
  },
137246
- []
137244
+ options.external
137247
137245
  );
137248
- const implicitDependencies = context.projectsConfigurations.projects[context.projectName].implicitDependencies;
137249
- const internalDependencies = [];
137250
- const projectConfigs = await Promise.resolve(getProjectConfigurations());
137251
- if (getLogLevel(config?.logLevel) >= LogLevel.TRACE) {
137252
- writeDebug(config, "Project Configs:");
137253
- console.log(projectConfigs);
137254
- }
137255
- if (implicitDependencies && implicitDependencies.length > 0) {
137256
- options.external = implicitDependencies.reduce((ret, key) => {
137257
- if (getLogLevel(config?.logLevel) >= LogLevel.DEBUG) {
137258
- writeDebug(config, `\u26A1 Adding implicit dependency: ${key}`);
137259
- }
137260
- const projectConfig = projectConfigs[key];
137261
- if (projectConfig?.targets?.build) {
137262
- const projectPackageJson = (0, import_devkit2.readJsonFile)(projectConfig.targets?.build.options.project);
137263
- if (projectPackageJson?.name && !options.external.includes(projectPackageJson.name)) {
137264
- ret.push(projectPackageJson.name);
137265
- internalDependencies.push(projectPackageJson.name);
137266
- }
137267
- }
137268
- return ret;
137269
- }, options.external);
137270
- }
137271
- if (options.bundle === false) {
137272
- for (const thirdPartyDependency of getExternalDependencies(
137273
- context.projectName,
137274
- context.projectGraph
137275
- )) {
137276
- const packageConfig = thirdPartyDependency.node.data;
137277
- if (packageConfig?.packageName) {
137278
- options.external.push(packageConfig.packageName);
137279
- if (!packageJson?.devDependencies?.[packageConfig.packageName]) {
137280
- externalDependencies.push(thirdPartyDependency);
137281
- }
137246
+ }
137247
+ const externalDependencies = options.external.reduce(
137248
+ (ret, name) => {
137249
+ if (!packageJson?.devDependencies?.[name]) {
137250
+ const externalNode = context.projectGraph.externalNodes[`npm:${name}`];
137251
+ if (externalNode) {
137252
+ ret.push({
137253
+ name,
137254
+ outputs: [],
137255
+ node: externalNode
137256
+ });
137282
137257
  }
137283
137258
  }
137284
- }
137285
- if (getLogLevel(config?.logLevel) >= LogLevel.TRACE) {
137286
- console.log(`Building with the following dependencies marked as external:
137287
- ${externalDependencies.map((dep) => {
137288
- return `name: ${dep.name}, node: ${dep.node}, outputs: ${dep.outputs}`;
137289
- }).join("\n")}`);
137290
- }
137291
- const prettierOptions = {
137292
- plugins: ["prettier-plugin-packagejson"],
137293
- trailingComma: "none",
137294
- tabWidth: 2,
137295
- semi: true,
137296
- singleQuote: false,
137297
- quoteProps: "preserve",
137298
- insertPragma: false,
137299
- bracketSameLine: true,
137300
- printWidth: 80,
137301
- bracketSpacing: true,
137302
- arrowParens: "avoid",
137303
- endOfLine: "lf"
137304
- };
137305
- const entryPoints = [];
137306
- if (options.entry) {
137307
- entryPoints.push(options.entry);
137308
- }
137309
- if (options.emitOnAll === true) {
137310
- entryPoints.push((0, import_devkit2.joinPathFragments)(sourceRoot, "**/*.{ts,tsx}"));
137311
- }
137312
- if (options.additionalEntryPoints) {
137313
- entryPoints.push(...options.additionalEntryPoints);
137314
- }
137315
- const entry = globSync(entryPoints, {
137316
- withFileTypes: true
137317
- }).reduce((ret, filePath) => {
137318
- let formattedPath = workspaceRoot.replaceAll("\\", "/");
137319
- if (formattedPath.toUpperCase().startsWith("C:")) {
137320
- formattedPath = formattedPath.substring(2);
137321
- }
137322
- let propertyKey = (0, import_devkit2.joinPathFragments)(filePath.path, removeExtension(filePath.name)).replaceAll("\\", "/").replaceAll(formattedPath, "").replaceAll(sourceRoot, "").replaceAll(projectRoot, "");
137323
- if (propertyKey) {
137324
- while (propertyKey.startsWith("/")) {
137325
- propertyKey = propertyKey.substring(1);
137326
- }
137327
- if (getLogLevel(config?.logLevel) >= LogLevel.DEBUG) {
137328
- console.debug(
137329
- `Trying to add entry point ${propertyKey} at "${(0, import_devkit2.joinPathFragments)(
137330
- filePath.path,
137331
- filePath.name
137332
- )}"`
137333
- );
137334
- }
137335
- if (!(propertyKey in ret)) {
137336
- ret[propertyKey] = (0, import_devkit2.joinPathFragments)(filePath.path, filePath.name);
137259
+ return ret;
137260
+ },
137261
+ []
137262
+ );
137263
+ const implicitDependencies = context.projectsConfigurations.projects[context.projectName].implicitDependencies;
137264
+ const internalDependencies = [];
137265
+ const projectConfigs = await Promise.resolve(getProjectConfigurations());
137266
+ if (getLogLevel(config?.logLevel) >= LogLevel.TRACE) {
137267
+ writeDebug(config, "Project Configs:");
137268
+ console.log(projectConfigs);
137269
+ }
137270
+ if (implicitDependencies && implicitDependencies.length > 0) {
137271
+ options.external = implicitDependencies.reduce((ret, key) => {
137272
+ if (getLogLevel(config?.logLevel) >= LogLevel.DEBUG) {
137273
+ writeDebug(config, `\u26A1 Adding implicit dependency: ${key}`);
137274
+ }
137275
+ const projectConfig = projectConfigs[key];
137276
+ if (projectConfig?.targets?.build) {
137277
+ const projectPackageJson = (0, import_devkit2.readJsonFile)(projectConfig.targets?.build.options.project);
137278
+ if (projectPackageJson?.name && !options.external.includes(projectPackageJson.name)) {
137279
+ ret.push(projectPackageJson.name);
137280
+ internalDependencies.push(projectPackageJson.name);
137337
137281
  }
137338
137282
  }
137339
137283
  return ret;
137340
- }, {});
137341
- if (options.generatePackageJson !== false) {
137342
- const projectGraph = (0, import_devkit2.readCachedProjectGraph)();
137343
- packageJson.dependencies = void 0;
137344
- for (const externalDependency of externalDependencies) {
137345
- const packageConfig = externalDependency.node.data;
137346
- if (packageConfig?.packageName && !!(projectGraph.externalNodes[externalDependency.node.name]?.type === "npm")) {
137347
- const { packageName, version } = packageConfig;
137348
- if (workspacePackageJson.dependencies?.[packageName] || workspacePackageJson.devDependencies?.[packageName] || packageJson?.devDependencies?.[packageName]) {
137349
- return null;
137350
- }
137351
- packageJson.dependencies ??= {};
137352
- packageJson.dependencies[packageName] = projectGraph.nodes[externalDependency.node.name] ? "latest" : version;
137284
+ }, options.external);
137285
+ }
137286
+ if (options.bundle === false) {
137287
+ for (const thirdPartyDependency of getExternalDependencies(
137288
+ context.projectName,
137289
+ context.projectGraph
137290
+ )) {
137291
+ const packageConfig = thirdPartyDependency.node.data;
137292
+ if (packageConfig?.packageName) {
137293
+ options.external.push(packageConfig.packageName);
137294
+ if (!packageJson?.devDependencies?.[packageConfig.packageName]) {
137295
+ externalDependencies.push(thirdPartyDependency);
137353
137296
  }
137354
137297
  }
137355
- for (const packageName of internalDependencies) {
137356
- if (!packageJson?.devDependencies?.[packageName]) {
137357
- packageJson.dependencies ??= {};
137358
- packageJson.dependencies[packageName] = "latest";
137298
+ }
137299
+ }
137300
+ writeTrace(
137301
+ config,
137302
+ `Building with the following dependencies marked as external:
137303
+ ${externalDependencies.map((dep) => {
137304
+ return `name: ${dep.name}, node: ${dep.node}, outputs: ${dep.outputs}`;
137305
+ }).join("\n")}`
137306
+ );
137307
+ const prettierOptions = {
137308
+ plugins: ["prettier-plugin-packagejson"],
137309
+ trailingComma: "none",
137310
+ tabWidth: 2,
137311
+ semi: true,
137312
+ singleQuote: false,
137313
+ quoteProps: "preserve",
137314
+ insertPragma: false,
137315
+ bracketSameLine: true,
137316
+ printWidth: 80,
137317
+ bracketSpacing: true,
137318
+ arrowParens: "avoid",
137319
+ endOfLine: "lf"
137320
+ };
137321
+ const entryPoints = [];
137322
+ if (options.entry) {
137323
+ entryPoints.push(options.entry);
137324
+ }
137325
+ if (options.emitOnAll === true) {
137326
+ entryPoints.push((0, import_devkit2.joinPathFragments)(sourceRoot, "**/*.{ts,tsx}"));
137327
+ }
137328
+ if (options.additionalEntryPoints) {
137329
+ entryPoints.push(...options.additionalEntryPoints);
137330
+ }
137331
+ const entry = globSync(entryPoints, {
137332
+ withFileTypes: true
137333
+ }).reduce((ret, filePath) => {
137334
+ let formattedPath = workspaceRoot.replaceAll("\\", "/");
137335
+ if (formattedPath.toUpperCase().startsWith("C:")) {
137336
+ formattedPath = formattedPath.substring(2);
137337
+ }
137338
+ let propertyKey = (0, import_devkit2.joinPathFragments)(filePath.path, removeExtension(filePath.name)).replaceAll("\\", "/").replaceAll(formattedPath, "").replaceAll(sourceRoot, "").replaceAll(projectRoot, "");
137339
+ if (propertyKey) {
137340
+ while (propertyKey.startsWith("/")) {
137341
+ propertyKey = propertyKey.substring(1);
137342
+ }
137343
+ writeDebug(
137344
+ config,
137345
+ `Trying to add entry point ${propertyKey} at "${(0, import_devkit2.joinPathFragments)(
137346
+ filePath.path,
137347
+ filePath.name
137348
+ )}"`
137349
+ );
137350
+ if (!(propertyKey in ret)) {
137351
+ ret[propertyKey] = (0, import_devkit2.joinPathFragments)(filePath.path, filePath.name);
137352
+ }
137353
+ }
137354
+ return ret;
137355
+ }, {});
137356
+ if (options.generatePackageJson !== false) {
137357
+ const projectGraph = (0, import_devkit2.readCachedProjectGraph)();
137358
+ packageJson.dependencies = void 0;
137359
+ for (const externalDependency of externalDependencies) {
137360
+ const packageConfig = externalDependency.node.data;
137361
+ if (packageConfig?.packageName && !!(projectGraph.externalNodes[externalDependency.node.name]?.type === "npm")) {
137362
+ const { packageName, version } = packageConfig;
137363
+ if (workspacePackageJson.dependencies?.[packageName] || workspacePackageJson.devDependencies?.[packageName] || packageJson?.devDependencies?.[packageName]) {
137364
+ return null;
137359
137365
  }
137366
+ packageJson.dependencies ??= {};
137367
+ packageJson.dependencies[packageName] = projectGraph.nodes[externalDependency.node.name] ? "latest" : version;
137360
137368
  }
137361
- const distPaths = !options?.getConfig || _isFunction(options.getConfig) ? ["dist/"] : Object.keys(options.getConfig).map((key) => `${key}/`);
137362
- packageJson.type = "module";
137363
- if (distPaths.length > 0) {
137364
- packageJson.exports ??= {
137365
- ".": {
137369
+ }
137370
+ for (const packageName of internalDependencies) {
137371
+ if (!packageJson?.devDependencies?.[packageName]) {
137372
+ packageJson.dependencies ??= {};
137373
+ packageJson.dependencies[packageName] = "latest";
137374
+ }
137375
+ }
137376
+ const distPaths = !options?.getConfig || _isFunction(options.getConfig) ? ["dist/"] : Object.keys(options.getConfig).map((key) => `${key}/`);
137377
+ packageJson.type = "module";
137378
+ if (distPaths.length > 0) {
137379
+ packageJson.exports ??= {
137380
+ ".": {
137381
+ import: {
137382
+ types: `./${distPaths[0]}index.d.ts`,
137383
+ default: `./${distPaths[0]}index.js`
137384
+ },
137385
+ require: {
137386
+ types: `./${distPaths[0]}index.d.cts`,
137387
+ default: `./${distPaths[0]}index.cjs`
137388
+ },
137389
+ default: {
137390
+ types: `./${distPaths[0]}index.d.ts`,
137391
+ default: `./${distPaths[0]}index.js`
137392
+ },
137393
+ ...(options.additionalEntryPoints ?? []).map((entryPoint) => ({
137394
+ [removeExtension(entryPoint).replace(sourceRoot, "")]: {
137395
+ types: (0, import_node_path3.join)(
137396
+ `./${distPaths[0]}`,
137397
+ `${removeExtension(entryPoint.replace(sourceRoot, ""))}.d.ts`
137398
+ ),
137399
+ default: (0, import_node_path3.join)(
137400
+ `./${distPaths[0]}`,
137401
+ `${removeExtension(entryPoint.replace(sourceRoot, ""))}.js`
137402
+ )
137403
+ }
137404
+ }))
137405
+ },
137406
+ "./package.json": "./package.json"
137407
+ };
137408
+ packageJson.exports = Object.keys(entry).reduce((ret, key) => {
137409
+ let packageJsonKey = key.startsWith("./") ? key : `./${key}`;
137410
+ packageJsonKey = packageJsonKey.replaceAll("/index", "");
137411
+ if (!ret[packageJsonKey]) {
137412
+ ret[packageJsonKey] = {
137366
137413
  import: {
137367
137414
  types: `./${distPaths[0]}index.d.ts`,
137368
- default: `./${distPaths[0]}index.js`
137415
+ default: `./${distPaths[0]}${key}.js`
137369
137416
  },
137370
137417
  require: {
137371
137418
  types: `./${distPaths[0]}index.d.cts`,
137372
- default: `./${distPaths[0]}index.cjs`
137419
+ default: `./${distPaths[0]}${key}.cjs`
137373
137420
  },
137374
137421
  default: {
137375
137422
  types: `./${distPaths[0]}index.d.ts`,
137376
- default: `./${distPaths[0]}index.js`
137377
- },
137378
- ...(options.additionalEntryPoints ?? []).map((entryPoint) => ({
137379
- [removeExtension(entryPoint).replace(sourceRoot, "")]: {
137380
- types: (0, import_node_path.join)(
137381
- `./${distPaths[0]}`,
137382
- `${removeExtension(entryPoint.replace(sourceRoot, ""))}.d.ts`
137383
- ),
137384
- default: (0, import_node_path.join)(
137385
- `./${distPaths[0]}`,
137386
- `${removeExtension(entryPoint.replace(sourceRoot, ""))}.js`
137387
- )
137388
- }
137389
- }))
137390
- },
137391
- "./package.json": "./package.json"
137392
- };
137393
- packageJson.exports = Object.keys(entry).reduce((ret, key) => {
137394
- let packageJsonKey = key.startsWith("./") ? key : `./${key}`;
137395
- packageJsonKey = packageJsonKey.replaceAll("/index", "");
137396
- if (!ret[packageJsonKey]) {
137397
- ret[packageJsonKey] = {
137398
- import: {
137399
- types: `./${distPaths[0]}index.d.ts`,
137400
- default: `./${distPaths[0]}${key}.js`
137401
- },
137402
- require: {
137403
- types: `./${distPaths[0]}index.d.cts`,
137404
- default: `./${distPaths[0]}${key}.cjs`
137405
- },
137406
- default: {
137407
- types: `./${distPaths[0]}index.d.ts`,
137408
- default: `./${distPaths[0]}${key}.js`
137409
- }
137410
- };
137411
- }
137412
- return ret;
137413
- }, packageJson.exports);
137414
- packageJson.funding ??= workspacePackageJson.funding;
137415
- packageJson.types ??= `${distPaths.length > 1 ? distPaths[1] : distPaths[0]}index.d.ts`;
137416
- packageJson.typings ??= `${distPaths.length > 1 ? distPaths[1] : distPaths[0]}index.d.ts`;
137417
- packageJson.typescript ??= {
137418
- definition: `${distPaths.length > 1 ? distPaths[1] : distPaths[0]}index.d.ts`
137419
- };
137420
- packageJson.main ??= `${distPaths.length > 1 ? distPaths[1] : distPaths[0]}index.cjs`;
137421
- packageJson.module ??= `${distPaths.length > 1 ? distPaths[1] : distPaths[0]}index.js`;
137422
- if (options.platform && options.platform !== "node") {
137423
- packageJson.browser ??= `${distPaths[0]}index.global.js`;
137424
- }
137425
- if (options.includeSrc === true) {
137426
- let distSrc = sourceRoot.replace(projectRoot, "");
137427
- if (distSrc.startsWith("/")) {
137428
- distSrc = distSrc.substring(1);
137429
- }
137430
- packageJson.source ??= `${(0, import_node_path.join)(distSrc, "index.ts").replaceAll("\\", "/")}`;
137431
- }
137432
- packageJson.sideEffects ??= false;
137433
- packageJson.files ??= ["dist/**/*"];
137434
- if (options.includeSrc === true && !packageJson.files.includes("src")) {
137435
- packageJson.files.push("src/**/*");
137423
+ default: `./${distPaths[0]}${key}.js`
137424
+ }
137425
+ };
137436
137426
  }
137437
- }
137438
- packageJson.publishConfig ??= {
137439
- access: "public"
137440
- };
137441
- packageJson.description ??= workspacePackageJson.description;
137442
- packageJson.homepage ??= workspacePackageJson.homepage;
137443
- packageJson.bugs ??= workspacePackageJson.bugs;
137444
- packageJson.author ??= workspacePackageJson.author;
137445
- packageJson.license ??= workspacePackageJson.license;
137446
- packageJson.keywords ??= workspacePackageJson.keywords;
137447
- packageJson.repository ??= workspacePackageJson.repository;
137448
- packageJson.repository.directory ??= projectRoot ? projectRoot : (0, import_node_path.join)("packages", context.projectName);
137449
- const packageJsonPath = (0, import_node_path.join)(context.root, options.outputPath, "package.json");
137450
- if (getLogLevel(config?.logLevel) >= LogLevel.DEBUG) {
137451
- writeDebug(config, `\u26A1 Writing package.json file to: ${packageJsonPath}`);
137452
- }
137453
- (0, import_node_fs.writeFileSync)(
137454
- packageJsonPath,
137455
- await (0, import_prettier.format)(JSON.stringify(packageJson), {
137456
- ...prettierOptions,
137457
- parser: "json"
137458
- })
137459
- );
137460
- }
137461
- if (options.includeSrc === true) {
137462
- const files = globSync([
137463
- (0, import_devkit2.joinPathFragments)(context.root, options.outputPath, "src/**/*.ts"),
137464
- (0, import_devkit2.joinPathFragments)(context.root, options.outputPath, "src/**/*.tsx"),
137465
- (0, import_devkit2.joinPathFragments)(context.root, options.outputPath, "src/**/*.js"),
137466
- (0, import_devkit2.joinPathFragments)(context.root, options.outputPath, "src/**/*.jsx")
137467
- ]);
137468
- await Promise.allSettled(
137469
- files.map(
137470
- async (file) => (0, import_promises2.writeFile)(
137471
- file,
137472
- await (0, import_prettier.format)(
137473
- `${options.banner ? options.banner.startsWith("//") ? options.banner : `// ${options.banner}` : ""}
137474
-
137475
- ${(0, import_node_fs.readFileSync)(file, "utf-8")}`,
137476
- {
137477
- ...prettierOptions,
137478
- parser: "typescript"
137479
- }
137480
- ),
137481
- "utf-8"
137482
- )
137483
- )
137484
- );
137485
- }
137486
- const stormEnv = Object.keys(options.env).filter((key) => key.startsWith("STORM_")).reduce((ret, key) => {
137487
- ret[key] = options.env[key];
137488
- return ret;
137489
- }, {});
137490
- options.plugins.push(
137491
- (0, import_esbuild_decorators.esbuildDecorators)({
137492
- tsconfig: options.tsConfig,
137493
- cwd: workspaceRoot
137427
+ return ret;
137428
+ }, packageJson.exports);
137429
+ packageJson.funding ??= workspacePackageJson.funding;
137430
+ packageJson.types ??= `${distPaths.length > 1 ? distPaths[1] : distPaths[0]}index.d.ts`;
137431
+ packageJson.typings ??= `${distPaths.length > 1 ? distPaths[1] : distPaths[0]}index.d.ts`;
137432
+ packageJson.typescript ??= {
137433
+ definition: `${distPaths.length > 1 ? distPaths[1] : distPaths[0]}index.d.ts`
137434
+ };
137435
+ packageJson.main ??= `${distPaths.length > 1 ? distPaths[1] : distPaths[0]}index.cjs`;
137436
+ packageJson.module ??= `${distPaths.length > 1 ? distPaths[1] : distPaths[0]}index.js`;
137437
+ if (options.platform && options.platform !== "node") {
137438
+ packageJson.browser ??= `${distPaths[0]}index.global.js`;
137439
+ }
137440
+ if (options.includeSrc === true) {
137441
+ let distSrc = sourceRoot.replace(projectRoot, "");
137442
+ if (distSrc.startsWith("/")) {
137443
+ distSrc = distSrc.substring(1);
137444
+ }
137445
+ packageJson.source ??= `${(0, import_node_path3.join)(distSrc, "index.ts").replaceAll("\\", "/")}`;
137446
+ }
137447
+ packageJson.sideEffects ??= false;
137448
+ packageJson.files ??= ["dist/**/*"];
137449
+ if (options.includeSrc === true && !packageJson.files.includes("src")) {
137450
+ packageJson.files.push("src/**/*");
137451
+ }
137452
+ }
137453
+ packageJson.publishConfig ??= {
137454
+ access: "public"
137455
+ };
137456
+ packageJson.description ??= workspacePackageJson.description;
137457
+ packageJson.homepage ??= workspacePackageJson.homepage;
137458
+ packageJson.bugs ??= workspacePackageJson.bugs;
137459
+ packageJson.author ??= workspacePackageJson.author;
137460
+ packageJson.license ??= workspacePackageJson.license;
137461
+ packageJson.keywords ??= workspacePackageJson.keywords;
137462
+ packageJson.repository ??= workspacePackageJson.repository;
137463
+ packageJson.repository.directory ??= projectRoot ? projectRoot : (0, import_node_path3.join)("packages", context.projectName);
137464
+ const packageJsonPath = (0, import_node_path3.join)(context.root, options.outputPath, "package.json");
137465
+ writeDebug(config, `\u26A1 Writing package.json file to: ${packageJsonPath}`);
137466
+ (0, import_node_fs3.writeFileSync)(
137467
+ packageJsonPath,
137468
+ await (0, import_prettier.format)(JSON.stringify(packageJson), {
137469
+ ...prettierOptions,
137470
+ parser: "json"
137494
137471
  })
137495
137472
  );
137496
- options.plugins.push(environmentPlugin(stormEnv));
137497
- const getConfigOptions = {
137498
- ...options,
137499
- define: {
137500
- __STORM_CONFIG: JSON.stringify(stormEnv)
137501
- },
137502
- env: {
137503
- __STORM_CONFIG: JSON.stringify(stormEnv),
137504
- ...stormEnv
137505
- },
137506
- dtsTsConfig: getNormalizedTsConfig(
137507
- context.root,
137508
- options.outputPath,
137509
- (0, import_tsc.createTypeScriptCompilationOptions)(
137510
- (0, import_normalize_options.normalizeOptions)(
137473
+ } else {
137474
+ writeWarning(config, "Skipping writing to package.json file");
137475
+ }
137476
+ if (options.includeSrc === true) {
137477
+ const files = globSync([
137478
+ (0, import_devkit2.joinPathFragments)(context.root, options.outputPath, "src/**/*.ts"),
137479
+ (0, import_devkit2.joinPathFragments)(context.root, options.outputPath, "src/**/*.tsx"),
137480
+ (0, import_devkit2.joinPathFragments)(context.root, options.outputPath, "src/**/*.js"),
137481
+ (0, import_devkit2.joinPathFragments)(context.root, options.outputPath, "src/**/*.jsx")
137482
+ ]);
137483
+ await Promise.allSettled(
137484
+ files.map(
137485
+ async (file) => (0, import_promises2.writeFile)(
137486
+ file,
137487
+ await (0, import_prettier.format)(
137488
+ `${options.banner ? options.banner.startsWith("//") ? options.banner : `// ${options.banner}` : ""}
137489
+
137490
+ ${(0, import_node_fs3.readFileSync)(file, "utf-8")}`,
137511
137491
  {
137512
- ...options,
137513
- watch: false,
137514
- main: options.entry,
137515
- transformers: options.skipTypia ? [] : ["typia/lib/transform"]
137516
- },
137517
- context.root,
137518
- sourceRoot,
137519
- workspaceRoot
137492
+ ...prettierOptions,
137493
+ parser: "typescript"
137494
+ }
137520
137495
  ),
137521
- context
137496
+ "utf-8"
137522
137497
  )
137523
- ),
137524
- banner: options.banner ? {
137525
- js: `${options.banner}
137498
+ )
137499
+ );
137500
+ }
137501
+ const stormEnv = Object.keys(options.env).filter((key) => key.startsWith("STORM_")).reduce((ret, key) => {
137502
+ ret[key] = options.env[key];
137503
+ return ret;
137504
+ }, {});
137505
+ options.plugins.push(
137506
+ (0, import_esbuild_decorators.esbuildDecorators)({
137507
+ tsconfig: options.tsConfig,
137508
+ cwd: workspaceRoot
137509
+ })
137510
+ );
137511
+ options.plugins.push(environmentPlugin(stormEnv));
137512
+ const getConfigOptions = {
137513
+ ...options,
137514
+ define: {
137515
+ __STORM_CONFIG: JSON.stringify(stormEnv)
137516
+ },
137517
+ env: {
137518
+ __STORM_CONFIG: JSON.stringify(stormEnv),
137519
+ ...stormEnv
137520
+ },
137521
+ dtsTsConfig: getNormalizedTsConfig(
137522
+ context.root,
137523
+ options.outputPath,
137524
+ (0, import_tsc.createTypeScriptCompilationOptions)(
137525
+ (0, import_normalize_options.normalizeOptions)(
137526
+ {
137527
+ ...options,
137528
+ watch: false,
137529
+ main: options.entry,
137530
+ transformers: options.skipTypia ? [] : ["typia/lib/transform"]
137531
+ },
137532
+ context.root,
137533
+ sourceRoot,
137534
+ workspaceRoot
137535
+ ),
137536
+ context
137537
+ )
137538
+ ),
137539
+ banner: options.banner ? {
137540
+ js: `${options.banner}
137526
137541
 
137527
137542
  `,
137528
- css: `/*
137543
+ css: `/*
137529
137544
  ${options.banner}
137530
137545
  */
137531
137546
 
137532
137547
  `
137533
- } : void 0,
137534
- outputPath: options.outputPath,
137535
- entry,
137536
- getTransform: options.skipTypia ? void 0 : getTypiaTransform
137537
- };
137538
- if (options.getConfig) {
137539
- if (getLogLevel(config?.logLevel) >= LogLevel.INFO) {
137540
- writeInfo(config, "\u26A1 Running the Build process");
137541
- }
137542
- const getConfigFns = _isFunction(options.getConfig) ? [options.getConfig] : Object.keys(options.getConfig).map((key) => options.getConfig[key]);
137543
- const tsupConfig = (0, import_tsup.defineConfig)(
137544
- getConfigFns.map(
137545
- (getConfigFn) => getConfig(context.root, projectRoot, getConfigFn, getConfigOptions)
137546
- )
137547
- );
137548
- if (_isFunction(tsupConfig)) {
137549
- await build(await Promise.resolve(tsupConfig({})), config);
137550
- } else {
137551
- await build(tsupConfig, config);
137552
- }
137553
- } else if (getLogLevel(config?.logLevel) >= LogLevel.WARN) {
137554
- writeWarning(
137555
- config,
137556
- "The Build process did not run because no `getConfig` parameter was provided"
137557
- );
137558
- }
137559
- if (getLogLevel(config?.logLevel) >= LogLevel.INFO) {
137560
- writeSuccess(config, "\u26A1 The Build process has completed successfully");
137548
+ } : void 0,
137549
+ outputPath: options.outputPath,
137550
+ entry,
137551
+ getTransform: options.skipTypia ? void 0 : getTypiaTransform
137552
+ };
137553
+ if (options.getConfig) {
137554
+ writeInfo(config, "\u26A1 Running the Build process");
137555
+ const getConfigFns = _isFunction(options.getConfig) ? [options.getConfig] : Object.keys(options.getConfig).map((key) => options.getConfig[key]);
137556
+ const tsupConfig = (0, import_tsup.defineConfig)(
137557
+ getConfigFns.map(
137558
+ (getConfigFn) => getConfig(context.root, projectRoot, getConfigFn, getConfigOptions)
137559
+ )
137560
+ );
137561
+ if (_isFunction(tsupConfig)) {
137562
+ await build(await Promise.resolve(tsupConfig({})), config);
137563
+ } else {
137564
+ await build(tsupConfig, config);
137561
137565
  }
137562
- return {
137563
- success: true
137564
- };
137565
- } catch (e) {
137566
- console.error(e);
137567
- return {
137568
- success: false
137569
- };
137566
+ } else if (getLogLevel(config?.logLevel) >= LogLevel.WARN) {
137567
+ writeWarning(
137568
+ config,
137569
+ "The Build process did not run because no `getConfig` parameter was provided"
137570
+ );
137570
137571
  }
137572
+ writeSuccess(config, "\u26A1 The Build process has completed successfully");
137573
+ return {
137574
+ success: true
137575
+ };
137571
137576
  }
137572
137577
  function getNormalizedTsConfig(workspaceRoot, outputPath, options) {
137573
137578
  const config = ts.readConfigFile(options.tsConfig, ts.sys.readFile).config;
@@ -137587,11 +137592,11 @@ function getNormalizedTsConfig(workspaceRoot, outputPath, options) {
137587
137592
  emitDeclarationOnly: true,
137588
137593
  declaration: true,
137589
137594
  declarationMap: true,
137590
- declarationDir: (0, import_node_path.join)(workspaceRoot, "tmp", ".tsup", "declaration")
137595
+ declarationDir: (0, import_node_path3.join)(workspaceRoot, "tmp", ".tsup", "declaration")
137591
137596
  }
137592
137597
  },
137593
137598
  ts.sys,
137594
- (0, import_node_path.dirname)(options.tsConfig)
137599
+ (0, import_node_path3.dirname)(options.tsConfig)
137595
137600
  );
137596
137601
  tsConfig.options.pathsBasePath = workspaceRoot;
137597
137602
  if (tsConfig.options.incremental && !tsConfig.options.tsBuildInfoFile) {