@storm-software/workspace-tools 1.43.5 → 1.43.7

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 {
@@ -126329,9 +126329,9 @@ __export(executor_exports, {
126329
126329
  tsupExecutorFn: () => tsupExecutorFn
126330
126330
  });
126331
126331
  module.exports = __toCommonJS(executor_exports);
126332
- var import_node_fs = require("node:fs");
126332
+ var import_node_fs3 = require("node:fs");
126333
126333
  var import_promises2 = require("node:fs/promises");
126334
- var import_node_path = require("node:path");
126334
+ var import_node_path3 = require("node:path");
126335
126335
  var import_esbuild_decorators = __toESM(require_src());
126336
126336
  var import_devkit2 = __toESM(require_devkit());
126337
126337
  var import_js = __toESM(require_src2());
@@ -126341,7 +126341,7 @@ var import_tsc = __toESM(require_tsc_impl());
126341
126341
  // packages/config-tools/src/config-file/get-config-file.ts
126342
126342
  var import_cosmiconfig = __toESM(require_dist(), 1);
126343
126343
  var _static_cache = void 0;
126344
- var getConfigFileName = (fileName, filePath) => (0, import_cosmiconfig.cosmiconfig)(fileName, { cache: true }).search(filePath);
126344
+ var getConfigFileName = async (fileName, filePath) => (0, import_cosmiconfig.cosmiconfig)(fileName, { cache: true }).search(filePath);
126345
126345
  var getConfigFile = async (filePath) => {
126346
126346
  if (_static_cache) {
126347
126347
  return _static_cache;
@@ -126401,17 +126401,17 @@ var LogLevelLabel = {
126401
126401
  };
126402
126402
 
126403
126403
  // packages/config-tools/src/utilities/find-up.ts
126404
- var import_fs = require("fs");
126405
- var import_path = require("path");
126404
+ var import_node_fs = require("node:fs");
126405
+ var import_node_path = require("node:path");
126406
126406
  var MAX_PATH_SEARCH_DEPTH = 30;
126407
126407
  var depth = 0;
126408
126408
  function findFolderUp(startPath, endFileNames) {
126409
126409
  const _startPath = startPath ?? process.cwd();
126410
- if (endFileNames.some((endFileName) => (0, import_fs.existsSync)((0, import_path.join)(_startPath, endFileName)))) {
126410
+ if (endFileNames.some((endFileName) => (0, import_node_fs.existsSync)((0, import_node_path.join)(_startPath, endFileName)))) {
126411
126411
  return _startPath;
126412
126412
  }
126413
126413
  if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
126414
- const parent = (0, import_path.join)(_startPath, "..");
126414
+ const parent = (0, import_node_path.join)(_startPath, "..");
126415
126415
  return findFolderUp(parent, endFileNames);
126416
126416
  }
126417
126417
  return void 0;
@@ -126470,8 +126470,8 @@ Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`
126470
126470
  }
126471
126471
 
126472
126472
  // packages/config-tools/src/utilities/get-default-config.ts
126473
- var import_fs2 = require("fs");
126474
- var import_path2 = require("path");
126473
+ var import_node_fs2 = require("node:fs");
126474
+ var import_node_path2 = require("node:path");
126475
126475
 
126476
126476
  // node_modules/.pnpm/zod@3.22.4/node_modules/zod/lib/index.mjs
126477
126477
  var util;
@@ -130140,8 +130140,8 @@ var getDefaultConfig = (config = {}, root) => {
130140
130140
  let license = DefaultStormConfig.license;
130141
130141
  let homepage = DefaultStormConfig.homepage;
130142
130142
  const workspaceRoot = findWorkspaceRoot(root);
130143
- if ((0, import_fs2.existsSync)((0, import_path2.join)(workspaceRoot, "package.json"))) {
130144
- const file = (0, import_fs2.readFileSync)((0, import_path2.join)(workspaceRoot, "package.json"), {
130143
+ if ((0, import_node_fs2.existsSync)((0, import_node_path2.join)(workspaceRoot, "package.json"))) {
130144
+ const file = (0, import_node_fs2.readFileSync)((0, import_node_path2.join)(workspaceRoot, "package.json"), {
130145
130145
  encoding: "utf-8"
130146
130146
  });
130147
130147
  if (file) {
@@ -130164,9 +130164,9 @@ var getDefaultConfig = (config = {}, root) => {
130164
130164
  }
130165
130165
  }
130166
130166
  return StormConfigSchema.parse({
130167
- ...config,
130168
130167
  ...DefaultStormConfig,
130169
- colors: { ...config.colors, ...DefaultColorConfig },
130168
+ ...config,
130169
+ colors: { ...DefaultColorConfig, ...config.colors },
130170
130170
  workspaceRoot,
130171
130171
  name,
130172
130172
  namespace,
@@ -130510,16 +130510,6 @@ var setConfigEnv = (config) => {
130510
130510
  }
130511
130511
  };
130512
130512
 
130513
- // packages/config-tools/src/utilities/prepare-workspace.ts
130514
- var prepareWorkspace = async () => {
130515
- const _STORM_CONFIG = getDefaultConfig({
130516
- ...await getConfigFile(),
130517
- ...getConfigEnv()
130518
- });
130519
- setConfigEnv(_STORM_CONFIG);
130520
- return _STORM_CONFIG;
130521
- };
130522
-
130523
130513
  // packages/config-tools/src/env/get-env.ts
130524
130514
  var getExtensionEnv = (extensionName) => {
130525
130515
  const prefix = `STORM_EXTENSION_${extensionName.toUpperCase()}_`;
@@ -130587,6 +130577,32 @@ var getConfigEnv = () => {
130587
130577
  }, config);
130588
130578
  };
130589
130579
 
130580
+ // packages/config-tools/src/create-storm-config.ts
130581
+ var loadStormConfig = async (workspaceRoot) => {
130582
+ let config = {};
130583
+ let _workspaceRoot = workspaceRoot;
130584
+ if (!_workspaceRoot) {
130585
+ _workspaceRoot = findWorkspaceRoot();
130586
+ }
130587
+ const configFile = await getDefaultConfig(
130588
+ {
130589
+ ...await getConfigFile(_workspaceRoot),
130590
+ ...getConfigEnv()
130591
+ },
130592
+ _workspaceRoot
130593
+ );
130594
+ if (configFile) {
130595
+ config = StormConfigSchema.parse(configFile);
130596
+ } else {
130597
+ writeWarning(
130598
+ config,
130599
+ "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."
130600
+ );
130601
+ }
130602
+ setConfigEnv(config);
130603
+ return config;
130604
+ };
130605
+
130590
130606
  // node_modules/.pnpm/esbuild-plugin-define@0.4.0_esbuild@0.19.5/node_modules/esbuild-plugin-define/dist/mjs/utils.js
130591
130607
  var makeKey = (...inputs) => inputs.filter((input) => !!input).join(".");
130592
130608
  function convertToDefineObject(data) {
@@ -133191,10 +133207,10 @@ var LRUCache = class _LRUCache {
133191
133207
  };
133192
133208
 
133193
133209
  // node_modules/.pnpm/path-scurry@1.10.1/node_modules/path-scurry/dist/mjs/index.js
133194
- var import_path3 = require("path");
133210
+ var import_path = require("path");
133195
133211
  var import_url = require("url");
133196
133212
  var actualFS = __toESM(require("fs"), 1);
133197
- var import_fs3 = require("fs");
133213
+ var import_fs = require("fs");
133198
133214
  var import_promises = require("fs/promises");
133199
133215
 
133200
133216
  // node_modules/.pnpm/minipass@7.0.4/node_modules/minipass/dist/esm/index.js
@@ -134076,12 +134092,12 @@ var Minipass = class extends import_events.EventEmitter {
134076
134092
  };
134077
134093
 
134078
134094
  // node_modules/.pnpm/path-scurry@1.10.1/node_modules/path-scurry/dist/mjs/index.js
134079
- var realpathSync = import_fs3.realpathSync.native;
134095
+ var realpathSync = import_fs.realpathSync.native;
134080
134096
  var defaultFS = {
134081
- lstatSync: import_fs3.lstatSync,
134082
- readdir: import_fs3.readdir,
134083
- readdirSync: import_fs3.readdirSync,
134084
- readlinkSync: import_fs3.readlinkSync,
134097
+ lstatSync: import_fs.lstatSync,
134098
+ readdir: import_fs.readdir,
134099
+ readdirSync: import_fs.readdirSync,
134100
+ readlinkSync: import_fs.readlinkSync,
134085
134101
  realpathSync,
134086
134102
  promises: {
134087
134103
  lstat: import_promises.lstat,
@@ -135077,7 +135093,7 @@ var PathWin32 = class _PathWin32 extends PathBase {
135077
135093
  * @internal
135078
135094
  */
135079
135095
  getRootString(path2) {
135080
- return import_path3.win32.parse(path2).root;
135096
+ return import_path.win32.parse(path2).root;
135081
135097
  }
135082
135098
  /**
135083
135099
  * @internal
@@ -135717,7 +135733,7 @@ var PathScurryWin32 = class extends PathScurryBase {
135717
135733
  sep = "\\";
135718
135734
  constructor(cwd = process.cwd(), opts = {}) {
135719
135735
  const { nocase = true } = opts;
135720
- super(cwd, import_path3.win32, "\\", { ...opts, nocase });
135736
+ super(cwd, import_path.win32, "\\", { ...opts, nocase });
135721
135737
  this.nocase = nocase;
135722
135738
  for (let p = this.cwd; p; p = p.parent) {
135723
135739
  p.nocase = this.nocase;
@@ -135727,7 +135743,7 @@ var PathScurryWin32 = class extends PathScurryBase {
135727
135743
  * @internal
135728
135744
  */
135729
135745
  parseRootPath(dir) {
135730
- return import_path3.win32.parse(dir).root.toUpperCase();
135746
+ return import_path.win32.parse(dir).root.toUpperCase();
135731
135747
  }
135732
135748
  /**
135733
135749
  * @internal
@@ -135749,7 +135765,7 @@ var PathScurryPosix = class extends PathScurryBase {
135749
135765
  sep = "/";
135750
135766
  constructor(cwd = process.cwd(), opts = {}) {
135751
135767
  const { nocase = false } = opts;
135752
- super(cwd, import_path3.posix, "/", { ...opts, nocase });
135768
+ super(cwd, import_path.posix, "/", { ...opts, nocase });
135753
135769
  this.nocase = nocase;
135754
135770
  }
135755
135771
  /**
@@ -136923,7 +136939,7 @@ var withRunExecutor = (name, executorFn, executorOptions) => async (_options, co
136923
136939
  - projectName: ${projectName}
136924
136940
  `
136925
136941
  );
136926
- config = await prepareWorkspace();
136942
+ config = await loadStormConfig(workspaceRoot);
136927
136943
  writeTrace(
136928
136944
  config,
136929
136945
  `Loaded Storm config into env:
@@ -137127,416 +137143,403 @@ var getTypiaTransform = (program, diagnostics) => (0, import_transform.default)(
137127
137143
 
137128
137144
  // packages/workspace-tools/src/executors/tsup/executor.ts
137129
137145
  async function tsupExecutorFn(options, context, config) {
137130
- try {
137131
- writeInfo(config, "\u{1F4E6} Running Storm build executor on the workspace");
137132
- getLogLevel(config?.logLevel) >= LogLevel.TRACE && writeDebug(
137133
- config,
137134
- `\u2699\uFE0F Executor options:
137146
+ writeInfo(config, "\u{1F4E6} Running Storm build executor on the workspace");
137147
+ getLogLevel(config?.logLevel) >= LogLevel.TRACE && writeDebug(
137148
+ config,
137149
+ `\u2699\uFE0F Executor options:
137135
137150
  ${Object.keys(options).map(
137136
- (key) => `${key}: ${!options[key] || _isPrimitive(options[key]) ? options[key] : JSON.stringify(options[key])}`
137137
- ).join("\n")}
137151
+ (key) => `${key}: ${!options[key] || _isPrimitive(options[key]) ? options[key] : JSON.stringify(options[key])}`
137152
+ ).join("\n")}
137138
137153
  `
137154
+ );
137155
+ if (!context.projectsConfigurations?.projects || !context.projectName || !context.projectsConfigurations.projects[context.projectName]) {
137156
+ throw new Error(
137157
+ "The Build process failed because the context is not valid. Please run this command from a workspace."
137139
137158
  );
137140
- if (!context.projectsConfigurations?.projects || !context.projectName || !context.projectsConfigurations.projects[context.projectName]) {
137141
- throw new Error(
137142
- "The Build process failed because the context is not valid. Please run this command from a workspace."
137143
- );
137144
- }
137145
- const workspaceRoot = getWorkspaceRoot();
137146
- const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
137147
- const sourceRoot = context.projectsConfigurations.projects[context.projectName].sourceRoot;
137148
- if (options.clean !== false) {
137149
- if (getLogLevel(config?.logLevel) >= LogLevel.DEBUG) {
137150
- writeInfo(config, `\u{1F9F9} Cleaning output path: ${options.outputPath}`);
137151
- }
137152
- (0, import_fs_extra.removeSync)(options.outputPath);
137159
+ }
137160
+ const workspaceRoot = getWorkspaceRoot();
137161
+ const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
137162
+ const sourceRoot = context.projectsConfigurations.projects[context.projectName].sourceRoot;
137163
+ if (options.clean !== false) {
137164
+ if (getLogLevel(config?.logLevel) >= LogLevel.DEBUG) {
137165
+ writeInfo(config, `\u{1F9F9} Cleaning output path: ${options.outputPath}`);
137153
137166
  }
137154
- const assets = Array.from(options.assets);
137167
+ (0, import_fs_extra.removeSync)(options.outputPath);
137168
+ }
137169
+ const assets = Array.from(options.assets);
137170
+ assets.push({
137171
+ input: projectRoot,
137172
+ glob: "*.md",
137173
+ output: "/"
137174
+ });
137175
+ assets.push({
137176
+ input: "",
137177
+ glob: "LICENSE",
137178
+ output: "."
137179
+ });
137180
+ if (options.generatePackageJson === false) {
137155
137181
  assets.push({
137156
137182
  input: projectRoot,
137157
- glob: "*.md",
137158
- output: "/"
137183
+ glob: "**/package.json",
137184
+ output: "."
137159
137185
  });
137186
+ }
137187
+ if (options.includeSrc === true) {
137160
137188
  assets.push({
137161
- input: "",
137162
- glob: "LICENSE",
137163
- output: "."
137189
+ input: sourceRoot,
137190
+ glob: "**/{*.ts,*.tsx,*.js,*.jsx}",
137191
+ output: "src/"
137164
137192
  });
137165
- if (options.generatePackageJson === false) {
137166
- assets.push({
137167
- input: projectRoot,
137168
- glob: "**/package.json",
137169
- output: "."
137170
- });
137171
- }
137172
- if (options.includeSrc === true) {
137173
- assets.push({
137174
- input: sourceRoot,
137175
- glob: "**/{*.ts,*.tsx,*.js,*.jsx}",
137176
- output: "src/"
137177
- });
137178
- }
137179
- const result = await (0, import_js.copyAssets)(
137180
- { assets, watch: options.watch, outputPath: options.outputPath },
137181
- context
137182
- );
137183
- if (!result.success) {
137184
- throw new Error("The Build process failed trying to copy assets");
137185
- }
137186
- const pathToPackageJson = (0, import_node_path.join)(context.root, projectRoot, "package.json");
137187
- const packageJson = (0, import_fileutils.fileExists)(pathToPackageJson) ? (0, import_devkit2.readJsonFile)(pathToPackageJson) : { name: context.projectName, version: "0.0.1" };
137188
- const workspacePackageJson = (0, import_devkit2.readJsonFile)((0, import_node_path.join)(workspaceRoot, "package.json"));
137189
- options.external = options.external || [];
137190
- if (workspacePackageJson?.dependencies) {
137191
- options.external = Object.keys(workspacePackageJson?.dependencies).reduce(
137192
- (ret, key) => {
137193
- if (!ret.includes(key)) {
137194
- ret.push(key);
137195
- }
137196
- return ret;
137197
- },
137198
- options.external
137199
- );
137200
- }
137201
- const externalDependencies = options.external.reduce(
137202
- (ret, name) => {
137203
- if (!packageJson?.devDependencies?.[name]) {
137204
- const externalNode = context.projectGraph.externalNodes[`npm:${name}`];
137205
- if (externalNode) {
137206
- ret.push({
137207
- name,
137208
- outputs: [],
137209
- node: externalNode
137210
- });
137211
- }
137193
+ }
137194
+ const result = await (0, import_js.copyAssets)(
137195
+ { assets, watch: options.watch, outputPath: options.outputPath },
137196
+ context
137197
+ );
137198
+ if (!result.success) {
137199
+ throw new Error("The Build process failed trying to copy assets");
137200
+ }
137201
+ const pathToPackageJson = (0, import_node_path3.join)(context.root, projectRoot, "package.json");
137202
+ const packageJson = (0, import_fileutils.fileExists)(pathToPackageJson) ? (0, import_devkit2.readJsonFile)(pathToPackageJson) : { name: context.projectName, version: "0.0.1" };
137203
+ const workspacePackageJson = (0, import_devkit2.readJsonFile)((0, import_node_path3.join)(workspaceRoot, "package.json"));
137204
+ options.external = options.external || [];
137205
+ if (workspacePackageJson?.dependencies) {
137206
+ options.external = Object.keys(workspacePackageJson?.dependencies).reduce(
137207
+ (ret, key) => {
137208
+ if (!ret.includes(key)) {
137209
+ ret.push(key);
137212
137210
  }
137213
137211
  return ret;
137214
137212
  },
137215
- []
137213
+ options.external
137216
137214
  );
137217
- const implicitDependencies = context.projectsConfigurations.projects[context.projectName].implicitDependencies;
137218
- const internalDependencies = [];
137219
- const projectConfigs = await Promise.resolve(getProjectConfigurations());
137220
- if (getLogLevel(config?.logLevel) >= LogLevel.TRACE) {
137221
- writeDebug(config, "Project Configs:");
137222
- console.log(projectConfigs);
137223
- }
137224
- if (implicitDependencies && implicitDependencies.length > 0) {
137225
- options.external = implicitDependencies.reduce((ret, key) => {
137226
- if (getLogLevel(config?.logLevel) >= LogLevel.DEBUG) {
137227
- writeDebug(config, `\u26A1 Adding implicit dependency: ${key}`);
137228
- }
137229
- const projectConfig = projectConfigs[key];
137230
- if (projectConfig?.targets?.build) {
137231
- const projectPackageJson = (0, import_devkit2.readJsonFile)(projectConfig.targets?.build.options.project);
137232
- if (projectPackageJson?.name && !options.external.includes(projectPackageJson.name)) {
137233
- ret.push(projectPackageJson.name);
137234
- internalDependencies.push(projectPackageJson.name);
137235
- }
137236
- }
137237
- return ret;
137238
- }, options.external);
137239
- }
137240
- if (options.bundle === false) {
137241
- for (const thirdPartyDependency of getExternalDependencies(
137242
- context.projectName,
137243
- context.projectGraph
137244
- )) {
137245
- const packageConfig = thirdPartyDependency.node.data;
137246
- if (packageConfig?.packageName) {
137247
- options.external.push(packageConfig.packageName);
137248
- if (!packageJson?.devDependencies?.[packageConfig.packageName]) {
137249
- externalDependencies.push(thirdPartyDependency);
137250
- }
137215
+ }
137216
+ const externalDependencies = options.external.reduce(
137217
+ (ret, name) => {
137218
+ if (!packageJson?.devDependencies?.[name]) {
137219
+ const externalNode = context.projectGraph.externalNodes[`npm:${name}`];
137220
+ if (externalNode) {
137221
+ ret.push({
137222
+ name,
137223
+ outputs: [],
137224
+ node: externalNode
137225
+ });
137251
137226
  }
137252
137227
  }
137253
- }
137254
- if (getLogLevel(config?.logLevel) >= LogLevel.TRACE) {
137255
- console.log(`Building with the following dependencies marked as external:
137256
- ${externalDependencies.map((dep) => {
137257
- return `name: ${dep.name}, node: ${dep.node}, outputs: ${dep.outputs}`;
137258
- }).join("\n")}`);
137259
- }
137260
- const prettierOptions = {
137261
- plugins: ["prettier-plugin-packagejson"],
137262
- trailingComma: "none",
137263
- tabWidth: 2,
137264
- semi: true,
137265
- singleQuote: false,
137266
- quoteProps: "preserve",
137267
- insertPragma: false,
137268
- bracketSameLine: true,
137269
- printWidth: 80,
137270
- bracketSpacing: true,
137271
- arrowParens: "avoid",
137272
- endOfLine: "lf"
137273
- };
137274
- const entryPoints = [];
137275
- if (options.entry) {
137276
- entryPoints.push(options.entry);
137277
- }
137278
- if (options.emitOnAll === true) {
137279
- entryPoints.push((0, import_devkit2.joinPathFragments)(sourceRoot, "**/*.{ts,tsx}"));
137280
- }
137281
- if (options.additionalEntryPoints) {
137282
- entryPoints.push(...options.additionalEntryPoints);
137283
- }
137284
- const entry = globSync(entryPoints, {
137285
- withFileTypes: true
137286
- }).reduce((ret, filePath) => {
137287
- let formattedPath = workspaceRoot.replaceAll("\\", "/");
137288
- if (formattedPath.toUpperCase().startsWith("C:")) {
137289
- formattedPath = formattedPath.substring(2);
137290
- }
137291
- let propertyKey = (0, import_devkit2.joinPathFragments)(filePath.path, removeExtension(filePath.name)).replaceAll("\\", "/").replaceAll(formattedPath, "").replaceAll(sourceRoot, "").replaceAll(projectRoot, "");
137292
- if (propertyKey) {
137293
- while (propertyKey.startsWith("/")) {
137294
- propertyKey = propertyKey.substring(1);
137295
- }
137296
- if (getLogLevel(config?.logLevel) >= LogLevel.DEBUG) {
137297
- console.debug(
137298
- `Trying to add entry point ${propertyKey} at "${(0, import_devkit2.joinPathFragments)(
137299
- filePath.path,
137300
- filePath.name
137301
- )}"`
137302
- );
137303
- }
137304
- if (!(propertyKey in ret)) {
137305
- ret[propertyKey] = (0, import_devkit2.joinPathFragments)(filePath.path, filePath.name);
137228
+ return ret;
137229
+ },
137230
+ []
137231
+ );
137232
+ const implicitDependencies = context.projectsConfigurations.projects[context.projectName].implicitDependencies;
137233
+ const internalDependencies = [];
137234
+ const projectConfigs = await Promise.resolve(getProjectConfigurations());
137235
+ if (getLogLevel(config?.logLevel) >= LogLevel.TRACE) {
137236
+ writeDebug(config, "Project Configs:");
137237
+ console.log(projectConfigs);
137238
+ }
137239
+ if (implicitDependencies && implicitDependencies.length > 0) {
137240
+ options.external = implicitDependencies.reduce((ret, key) => {
137241
+ writeDebug(config, `\u26A1 Adding implicit dependency: ${key}`);
137242
+ const projectConfig = projectConfigs[key];
137243
+ if (projectConfig?.targets?.build) {
137244
+ const projectPackageJson = (0, import_devkit2.readJsonFile)(projectConfig.targets?.build.options.project);
137245
+ if (projectPackageJson?.name && !options.external.includes(projectPackageJson.name)) {
137246
+ ret.push(projectPackageJson.name);
137247
+ internalDependencies.push(projectPackageJson.name);
137306
137248
  }
137307
137249
  }
137308
137250
  return ret;
137309
- }, {});
137310
- if (options.generatePackageJson !== false) {
137311
- const projectGraph = (0, import_devkit2.readCachedProjectGraph)();
137312
- packageJson.dependencies = void 0;
137313
- for (const externalDependency of externalDependencies) {
137314
- const packageConfig = externalDependency.node.data;
137315
- if (packageConfig?.packageName && !!(projectGraph.externalNodes[externalDependency.node.name]?.type === "npm")) {
137316
- const { packageName, version } = packageConfig;
137317
- if (workspacePackageJson.dependencies?.[packageName] || workspacePackageJson.devDependencies?.[packageName] || packageJson?.devDependencies?.[packageName]) {
137318
- return null;
137319
- }
137320
- packageJson.dependencies ??= {};
137321
- packageJson.dependencies[packageName] = projectGraph.nodes[externalDependency.node.name] ? "latest" : version;
137251
+ }, options.external);
137252
+ }
137253
+ if (options.bundle === false) {
137254
+ for (const thirdPartyDependency of getExternalDependencies(
137255
+ context.projectName,
137256
+ context.projectGraph
137257
+ )) {
137258
+ const packageConfig = thirdPartyDependency.node.data;
137259
+ if (packageConfig?.packageName) {
137260
+ options.external.push(packageConfig.packageName);
137261
+ if (!packageJson?.devDependencies?.[packageConfig.packageName]) {
137262
+ externalDependencies.push(thirdPartyDependency);
137322
137263
  }
137323
137264
  }
137324
- for (const packageName of internalDependencies) {
137325
- if (!packageJson?.devDependencies?.[packageName]) {
137326
- packageJson.dependencies ??= {};
137327
- packageJson.dependencies[packageName] = "latest";
137265
+ }
137266
+ }
137267
+ writeTrace(
137268
+ config,
137269
+ `Building with the following dependencies marked as external:
137270
+ ${externalDependencies.map((dep) => {
137271
+ return `name: ${dep.name}, node: ${dep.node}, outputs: ${dep.outputs}`;
137272
+ }).join("\n")}`
137273
+ );
137274
+ const prettierOptions = {
137275
+ plugins: ["prettier-plugin-packagejson"],
137276
+ trailingComma: "none",
137277
+ tabWidth: 2,
137278
+ semi: true,
137279
+ singleQuote: false,
137280
+ quoteProps: "preserve",
137281
+ insertPragma: false,
137282
+ bracketSameLine: true,
137283
+ printWidth: 80,
137284
+ bracketSpacing: true,
137285
+ arrowParens: "avoid",
137286
+ endOfLine: "lf"
137287
+ };
137288
+ const entryPoints = [];
137289
+ if (options.entry) {
137290
+ entryPoints.push(options.entry);
137291
+ }
137292
+ if (options.emitOnAll === true) {
137293
+ entryPoints.push((0, import_devkit2.joinPathFragments)(sourceRoot, "**/*.{ts,tsx}"));
137294
+ }
137295
+ if (options.additionalEntryPoints) {
137296
+ entryPoints.push(...options.additionalEntryPoints);
137297
+ }
137298
+ const entry = globSync(entryPoints, {
137299
+ withFileTypes: true
137300
+ }).reduce((ret, filePath) => {
137301
+ let formattedPath = workspaceRoot.replaceAll("\\", "/");
137302
+ if (formattedPath.toUpperCase().startsWith("C:")) {
137303
+ formattedPath = formattedPath.substring(2);
137304
+ }
137305
+ let propertyKey = (0, import_devkit2.joinPathFragments)(filePath.path, removeExtension(filePath.name)).replaceAll("\\", "/").replaceAll(formattedPath, "").replaceAll(sourceRoot, "").replaceAll(projectRoot, "");
137306
+ if (propertyKey) {
137307
+ while (propertyKey.startsWith("/")) {
137308
+ propertyKey = propertyKey.substring(1);
137309
+ }
137310
+ writeDebug(
137311
+ config,
137312
+ `Trying to add entry point ${propertyKey} at "${(0, import_devkit2.joinPathFragments)(
137313
+ filePath.path,
137314
+ filePath.name
137315
+ )}"`
137316
+ );
137317
+ if (!(propertyKey in ret)) {
137318
+ ret[propertyKey] = (0, import_devkit2.joinPathFragments)(filePath.path, filePath.name);
137319
+ }
137320
+ }
137321
+ return ret;
137322
+ }, {});
137323
+ if (options.generatePackageJson !== false) {
137324
+ const projectGraph = (0, import_devkit2.readCachedProjectGraph)();
137325
+ packageJson.dependencies = void 0;
137326
+ for (const externalDependency of externalDependencies) {
137327
+ const packageConfig = externalDependency.node.data;
137328
+ if (packageConfig?.packageName && !!(projectGraph.externalNodes[externalDependency.node.name]?.type === "npm")) {
137329
+ const { packageName, version } = packageConfig;
137330
+ if (workspacePackageJson.dependencies?.[packageName] || workspacePackageJson.devDependencies?.[packageName] || packageJson?.devDependencies?.[packageName]) {
137331
+ return null;
137328
137332
  }
137333
+ packageJson.dependencies ??= {};
137334
+ packageJson.dependencies[packageName] = projectGraph.nodes[externalDependency.node.name] ? "latest" : version;
137335
+ }
137336
+ }
137337
+ for (const packageName of internalDependencies) {
137338
+ if (!packageJson?.devDependencies?.[packageName]) {
137339
+ packageJson.dependencies ??= {};
137340
+ packageJson.dependencies[packageName] = "latest";
137329
137341
  }
137330
- const distPaths = !options?.getConfig || _isFunction(options.getConfig) ? ["dist/"] : Object.keys(options.getConfig).map((key) => `${key}/`);
137331
- packageJson.type = "module";
137332
- if (distPaths.length > 0) {
137333
- packageJson.exports ??= {
137334
- ".": {
137342
+ }
137343
+ const distPaths = !options?.getConfig || _isFunction(options.getConfig) ? ["dist/"] : Object.keys(options.getConfig).map((key) => `${key}/`);
137344
+ packageJson.type = "module";
137345
+ if (distPaths.length > 0) {
137346
+ packageJson.exports ??= {
137347
+ ".": {
137348
+ import: {
137349
+ types: `./${distPaths[0]}index.d.ts`,
137350
+ default: `./${distPaths[0]}index.js`
137351
+ },
137352
+ require: {
137353
+ types: `./${distPaths[0]}index.d.cts`,
137354
+ default: `./${distPaths[0]}index.cjs`
137355
+ },
137356
+ default: {
137357
+ types: `./${distPaths[0]}index.d.ts`,
137358
+ default: `./${distPaths[0]}index.js`
137359
+ },
137360
+ ...(options.additionalEntryPoints ?? []).map((entryPoint) => ({
137361
+ [removeExtension(entryPoint).replace(sourceRoot, "")]: {
137362
+ types: (0, import_node_path3.join)(
137363
+ `./${distPaths[0]}`,
137364
+ `${removeExtension(entryPoint.replace(sourceRoot, ""))}.d.ts`
137365
+ ),
137366
+ default: (0, import_node_path3.join)(
137367
+ `./${distPaths[0]}`,
137368
+ `${removeExtension(entryPoint.replace(sourceRoot, ""))}.js`
137369
+ )
137370
+ }
137371
+ }))
137372
+ },
137373
+ "./package.json": "./package.json"
137374
+ };
137375
+ packageJson.exports = Object.keys(entry).reduce((ret, key) => {
137376
+ let packageJsonKey = key.startsWith("./") ? key : `./${key}`;
137377
+ packageJsonKey = packageJsonKey.replaceAll("/index", "");
137378
+ if (!ret[packageJsonKey]) {
137379
+ ret[packageJsonKey] = {
137335
137380
  import: {
137336
137381
  types: `./${distPaths[0]}index.d.ts`,
137337
- default: `./${distPaths[0]}index.js`
137382
+ default: `./${distPaths[0]}${key}.js`
137338
137383
  },
137339
137384
  require: {
137340
137385
  types: `./${distPaths[0]}index.d.cts`,
137341
- default: `./${distPaths[0]}index.cjs`
137386
+ default: `./${distPaths[0]}${key}.cjs`
137342
137387
  },
137343
137388
  default: {
137344
137389
  types: `./${distPaths[0]}index.d.ts`,
137345
- default: `./${distPaths[0]}index.js`
137346
- },
137347
- ...(options.additionalEntryPoints ?? []).map((entryPoint) => ({
137348
- [removeExtension(entryPoint).replace(sourceRoot, "")]: {
137349
- types: (0, import_node_path.join)(
137350
- `./${distPaths[0]}`,
137351
- `${removeExtension(entryPoint.replace(sourceRoot, ""))}.d.ts`
137352
- ),
137353
- default: (0, import_node_path.join)(
137354
- `./${distPaths[0]}`,
137355
- `${removeExtension(entryPoint.replace(sourceRoot, ""))}.js`
137356
- )
137357
- }
137358
- }))
137359
- },
137360
- "./package.json": "./package.json"
137361
- };
137362
- packageJson.exports = Object.keys(entry).reduce((ret, key) => {
137363
- let packageJsonKey = key.startsWith("./") ? key : `./${key}`;
137364
- packageJsonKey = packageJsonKey.replaceAll("/index", "");
137365
- if (!ret[packageJsonKey]) {
137366
- ret[packageJsonKey] = {
137367
- import: {
137368
- types: `./${distPaths[0]}index.d.ts`,
137369
- default: `./${distPaths[0]}${key}.js`
137370
- },
137371
- require: {
137372
- types: `./${distPaths[0]}index.d.cts`,
137373
- default: `./${distPaths[0]}${key}.cjs`
137374
- },
137375
- default: {
137376
- types: `./${distPaths[0]}index.d.ts`,
137377
- default: `./${distPaths[0]}${key}.js`
137378
- }
137379
- };
137380
- }
137381
- return ret;
137382
- }, packageJson.exports);
137383
- packageJson.funding ??= workspacePackageJson.funding;
137384
- packageJson.types ??= `${distPaths.length > 1 ? distPaths[1] : distPaths[0]}index.d.ts`;
137385
- packageJson.typings ??= `${distPaths.length > 1 ? distPaths[1] : distPaths[0]}index.d.ts`;
137386
- packageJson.typescript ??= {
137387
- definition: `${distPaths.length > 1 ? distPaths[1] : distPaths[0]}index.d.ts`
137388
- };
137389
- packageJson.main ??= `${distPaths.length > 1 ? distPaths[1] : distPaths[0]}index.cjs`;
137390
- packageJson.module ??= `${distPaths.length > 1 ? distPaths[1] : distPaths[0]}index.js`;
137391
- if (options.platform && options.platform !== "node") {
137392
- packageJson.browser ??= `${distPaths[0]}index.global.js`;
137393
- }
137394
- if (options.includeSrc === true) {
137395
- let distSrc = sourceRoot.replace(projectRoot, "");
137396
- if (distSrc.startsWith("/")) {
137397
- distSrc = distSrc.substring(1);
137398
- }
137399
- packageJson.source ??= `${(0, import_node_path.join)(distSrc, "index.ts").replaceAll("\\", "/")}`;
137400
- }
137401
- packageJson.sideEffects ??= false;
137402
- packageJson.files ??= ["dist/**/*"];
137403
- if (options.includeSrc === true && !packageJson.files.includes("src")) {
137404
- packageJson.files.push("src/**/*");
137390
+ default: `./${distPaths[0]}${key}.js`
137391
+ }
137392
+ };
137405
137393
  }
137406
- }
137407
- packageJson.publishConfig ??= {
137408
- access: "public"
137409
- };
137410
- packageJson.description ??= workspacePackageJson.description;
137411
- packageJson.homepage ??= workspacePackageJson.homepage;
137412
- packageJson.bugs ??= workspacePackageJson.bugs;
137413
- packageJson.author ??= workspacePackageJson.author;
137414
- packageJson.license ??= workspacePackageJson.license;
137415
- packageJson.keywords ??= workspacePackageJson.keywords;
137416
- packageJson.repository ??= workspacePackageJson.repository;
137417
- packageJson.repository.directory ??= projectRoot ? projectRoot : (0, import_node_path.join)("packages", context.projectName);
137418
- const packageJsonPath = (0, import_node_path.join)(context.root, options.outputPath, "package.json");
137419
- if (getLogLevel(config?.logLevel) >= LogLevel.DEBUG) {
137420
- writeDebug(config, `\u26A1 Writing package.json file to: ${packageJsonPath}`);
137421
- }
137422
- (0, import_node_fs.writeFileSync)(
137423
- packageJsonPath,
137424
- await (0, import_prettier.format)(JSON.stringify(packageJson), {
137425
- ...prettierOptions,
137426
- parser: "json"
137427
- })
137428
- );
137429
- }
137430
- if (options.includeSrc === true) {
137431
- const files = globSync([
137432
- (0, import_devkit2.joinPathFragments)(context.root, options.outputPath, "src/**/*.ts"),
137433
- (0, import_devkit2.joinPathFragments)(context.root, options.outputPath, "src/**/*.tsx"),
137434
- (0, import_devkit2.joinPathFragments)(context.root, options.outputPath, "src/**/*.js"),
137435
- (0, import_devkit2.joinPathFragments)(context.root, options.outputPath, "src/**/*.jsx")
137436
- ]);
137437
- await Promise.allSettled(
137438
- files.map(
137439
- async (file) => (0, import_promises2.writeFile)(
137440
- file,
137441
- await (0, import_prettier.format)(
137442
- `${options.banner ? options.banner.startsWith("//") ? options.banner : `// ${options.banner}` : ""}
137443
-
137444
- ${(0, import_node_fs.readFileSync)(file, "utf-8")}`,
137445
- {
137446
- ...prettierOptions,
137447
- parser: "typescript"
137448
- }
137449
- ),
137450
- "utf-8"
137451
- )
137452
- )
137453
- );
137454
- }
137455
- const stormEnv = Object.keys(options.env).filter((key) => key.startsWith("STORM_")).reduce((ret, key) => {
137456
- ret[key] = options.env[key];
137457
- return ret;
137458
- }, {});
137459
- options.plugins.push(
137460
- (0, import_esbuild_decorators.esbuildDecorators)({
137461
- tsconfig: options.tsConfig,
137462
- cwd: workspaceRoot
137394
+ return ret;
137395
+ }, packageJson.exports);
137396
+ packageJson.funding ??= workspacePackageJson.funding;
137397
+ packageJson.types ??= `${distPaths.length > 1 ? distPaths[1] : distPaths[0]}index.d.ts`;
137398
+ packageJson.typings ??= `${distPaths.length > 1 ? distPaths[1] : distPaths[0]}index.d.ts`;
137399
+ packageJson.typescript ??= {
137400
+ definition: `${distPaths.length > 1 ? distPaths[1] : distPaths[0]}index.d.ts`
137401
+ };
137402
+ packageJson.main ??= `${distPaths.length > 1 ? distPaths[1] : distPaths[0]}index.cjs`;
137403
+ packageJson.module ??= `${distPaths.length > 1 ? distPaths[1] : distPaths[0]}index.js`;
137404
+ if (options.platform && options.platform !== "node") {
137405
+ packageJson.browser ??= `${distPaths[0]}index.global.js`;
137406
+ }
137407
+ if (options.includeSrc === true) {
137408
+ let distSrc = sourceRoot.replace(projectRoot, "");
137409
+ if (distSrc.startsWith("/")) {
137410
+ distSrc = distSrc.substring(1);
137411
+ }
137412
+ packageJson.source ??= `${(0, import_node_path3.join)(distSrc, "index.ts").replaceAll("\\", "/")}`;
137413
+ }
137414
+ packageJson.sideEffects ??= false;
137415
+ packageJson.files ??= ["dist/**/*"];
137416
+ if (options.includeSrc === true && !packageJson.files.includes("src")) {
137417
+ packageJson.files.push("src/**/*");
137418
+ }
137419
+ }
137420
+ packageJson.publishConfig ??= {
137421
+ access: "public"
137422
+ };
137423
+ packageJson.description ??= workspacePackageJson.description;
137424
+ packageJson.homepage ??= workspacePackageJson.homepage;
137425
+ packageJson.bugs ??= workspacePackageJson.bugs;
137426
+ packageJson.author ??= workspacePackageJson.author;
137427
+ packageJson.license ??= workspacePackageJson.license;
137428
+ packageJson.keywords ??= workspacePackageJson.keywords;
137429
+ packageJson.repository ??= workspacePackageJson.repository;
137430
+ packageJson.repository.directory ??= projectRoot ? projectRoot : (0, import_node_path3.join)("packages", context.projectName);
137431
+ const packageJsonPath = (0, import_node_path3.join)(context.root, options.outputPath, "package.json");
137432
+ writeDebug(config, `\u26A1 Writing package.json file to: ${packageJsonPath}`);
137433
+ (0, import_node_fs3.writeFileSync)(
137434
+ packageJsonPath,
137435
+ await (0, import_prettier.format)(JSON.stringify(packageJson), {
137436
+ ...prettierOptions,
137437
+ parser: "json"
137463
137438
  })
137464
137439
  );
137465
- options.plugins.push(environmentPlugin(stormEnv));
137466
- const getConfigOptions = {
137467
- ...options,
137468
- define: {
137469
- __STORM_CONFIG: JSON.stringify(stormEnv)
137470
- },
137471
- env: {
137472
- __STORM_CONFIG: JSON.stringify(stormEnv),
137473
- ...stormEnv
137474
- },
137475
- dtsTsConfig: getNormalizedTsConfig(
137476
- context.root,
137477
- options.outputPath,
137478
- (0, import_tsc.createTypeScriptCompilationOptions)(
137479
- (0, import_normalize_options.normalizeOptions)(
137440
+ } else {
137441
+ writeWarning(config, "Skipping writing to package.json file");
137442
+ }
137443
+ if (options.includeSrc === true) {
137444
+ const files = globSync([
137445
+ (0, import_devkit2.joinPathFragments)(context.root, options.outputPath, "src/**/*.ts"),
137446
+ (0, import_devkit2.joinPathFragments)(context.root, options.outputPath, "src/**/*.tsx"),
137447
+ (0, import_devkit2.joinPathFragments)(context.root, options.outputPath, "src/**/*.js"),
137448
+ (0, import_devkit2.joinPathFragments)(context.root, options.outputPath, "src/**/*.jsx")
137449
+ ]);
137450
+ await Promise.allSettled(
137451
+ files.map(
137452
+ async (file) => (0, import_promises2.writeFile)(
137453
+ file,
137454
+ await (0, import_prettier.format)(
137455
+ `${options.banner ? options.banner.startsWith("//") ? options.banner : `// ${options.banner}` : ""}
137456
+
137457
+ ${(0, import_node_fs3.readFileSync)(file, "utf-8")}`,
137480
137458
  {
137481
- ...options,
137482
- watch: false,
137483
- main: options.entry,
137484
- transformers: options.skipTypia ? [] : ["typia/lib/transform"]
137485
- },
137486
- context.root,
137487
- sourceRoot,
137488
- workspaceRoot
137459
+ ...prettierOptions,
137460
+ parser: "typescript"
137461
+ }
137489
137462
  ),
137490
- context
137463
+ "utf-8"
137491
137464
  )
137492
- ),
137493
- banner: options.banner ? {
137494
- js: `${options.banner}
137465
+ )
137466
+ );
137467
+ }
137468
+ const stormEnv = Object.keys(options.env).filter((key) => key.startsWith("STORM_")).reduce((ret, key) => {
137469
+ ret[key] = options.env[key];
137470
+ return ret;
137471
+ }, {});
137472
+ options.plugins.push(
137473
+ (0, import_esbuild_decorators.esbuildDecorators)({
137474
+ tsconfig: options.tsConfig,
137475
+ cwd: workspaceRoot
137476
+ })
137477
+ );
137478
+ options.plugins.push(environmentPlugin(stormEnv));
137479
+ const getConfigOptions = {
137480
+ ...options,
137481
+ define: {
137482
+ __STORM_CONFIG: JSON.stringify(stormEnv)
137483
+ },
137484
+ env: {
137485
+ __STORM_CONFIG: JSON.stringify(stormEnv),
137486
+ ...stormEnv
137487
+ },
137488
+ dtsTsConfig: getNormalizedTsConfig(
137489
+ context.root,
137490
+ options.outputPath,
137491
+ (0, import_tsc.createTypeScriptCompilationOptions)(
137492
+ (0, import_normalize_options.normalizeOptions)(
137493
+ {
137494
+ ...options,
137495
+ watch: false,
137496
+ main: options.entry,
137497
+ transformers: options.skipTypia ? [] : ["typia/lib/transform"]
137498
+ },
137499
+ context.root,
137500
+ sourceRoot,
137501
+ workspaceRoot
137502
+ ),
137503
+ context
137504
+ )
137505
+ ),
137506
+ banner: options.banner ? {
137507
+ js: `${options.banner}
137495
137508
 
137496
137509
  `,
137497
- css: `/*
137510
+ css: `/*
137498
137511
  ${options.banner}
137499
137512
  */
137500
137513
 
137501
137514
  `
137502
- } : void 0,
137503
- outputPath: options.outputPath,
137504
- entry,
137505
- getTransform: options.skipTypia ? void 0 : getTypiaTransform
137506
- };
137507
- if (options.getConfig) {
137508
- if (getLogLevel(config?.logLevel) >= LogLevel.INFO) {
137509
- writeInfo(config, "\u26A1 Running the Build process");
137510
- }
137511
- const getConfigFns = _isFunction(options.getConfig) ? [options.getConfig] : Object.keys(options.getConfig).map((key) => options.getConfig[key]);
137512
- const tsupConfig = (0, import_tsup.defineConfig)(
137513
- getConfigFns.map(
137514
- (getConfigFn) => getConfig(context.root, projectRoot, getConfigFn, getConfigOptions)
137515
- )
137516
- );
137517
- if (_isFunction(tsupConfig)) {
137518
- await build(await Promise.resolve(tsupConfig({})), config);
137519
- } else {
137520
- await build(tsupConfig, config);
137521
- }
137522
- } else if (getLogLevel(config?.logLevel) >= LogLevel.WARN) {
137523
- writeWarning(
137524
- config,
137525
- "The Build process did not run because no `getConfig` parameter was provided"
137526
- );
137527
- }
137528
- if (getLogLevel(config?.logLevel) >= LogLevel.INFO) {
137529
- writeSuccess(config, "\u26A1 The Build process has completed successfully");
137515
+ } : void 0,
137516
+ outputPath: options.outputPath,
137517
+ entry,
137518
+ getTransform: options.skipTypia ? void 0 : getTypiaTransform
137519
+ };
137520
+ if (options.getConfig) {
137521
+ writeInfo(config, "\u26A1 Running the Build process");
137522
+ const getConfigFns = _isFunction(options.getConfig) ? [options.getConfig] : Object.keys(options.getConfig).map((key) => options.getConfig[key]);
137523
+ const tsupConfig = (0, import_tsup.defineConfig)(
137524
+ getConfigFns.map(
137525
+ (getConfigFn) => getConfig(context.root, projectRoot, getConfigFn, getConfigOptions)
137526
+ )
137527
+ );
137528
+ if (_isFunction(tsupConfig)) {
137529
+ await build(await Promise.resolve(tsupConfig({})), config);
137530
+ } else {
137531
+ await build(tsupConfig, config);
137530
137532
  }
137531
- return {
137532
- success: true
137533
- };
137534
- } catch (e) {
137535
- console.error(e);
137536
- return {
137537
- success: false
137538
- };
137533
+ } else if (getLogLevel(config?.logLevel) >= LogLevel.WARN) {
137534
+ writeWarning(
137535
+ config,
137536
+ "The Build process did not run because no `getConfig` parameter was provided"
137537
+ );
137539
137538
  }
137539
+ writeSuccess(config, "\u26A1 The Build process has completed successfully");
137540
+ return {
137541
+ success: true
137542
+ };
137540
137543
  }
137541
137544
  function getNormalizedTsConfig(workspaceRoot, outputPath, options) {
137542
137545
  const config = ts.readConfigFile(options.tsConfig, ts.sys.readFile).config;
@@ -137556,11 +137559,11 @@ function getNormalizedTsConfig(workspaceRoot, outputPath, options) {
137556
137559
  emitDeclarationOnly: true,
137557
137560
  declaration: true,
137558
137561
  declarationMap: true,
137559
- declarationDir: (0, import_node_path.join)(workspaceRoot, "tmp", ".tsup", "declaration")
137562
+ declarationDir: (0, import_node_path3.join)(workspaceRoot, "tmp", ".tsup", "declaration")
137560
137563
  }
137561
137564
  },
137562
137565
  ts.sys,
137563
- (0, import_node_path.dirname)(options.tsConfig)
137566
+ (0, import_node_path3.dirname)(options.tsConfig)
137564
137567
  );
137565
137568
  tsConfig.options.pathsBasePath = workspaceRoot;
137566
137569
  if (tsConfig.options.incremental && !tsConfig.options.tsBuildInfoFile) {