@storm-software/tsdown 0.28.22 → 0.28.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -21,7 +21,7 @@ This package is part of the <b>⚡Storm-Ops</b> monorepo. The Storm-Ops packages
21
21
 
22
22
  <h3 align="center">💻 Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
23
23
 
24
- [![Version](https://img.shields.io/badge/version-0.28.21-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/)&nbsp;[![Nx](https://img.shields.io/badge/Nx-17.0.2-lightgrey?style=for-the-badge&logo=nx&logoWidth=20&&color=1fb2a6)](http://nx.dev/)&nbsp;[![NextJs](https://img.shields.io/badge/Next.js-14.0.2-lightgrey?style=for-the-badge&logo=nextdotjs&logoWidth=20&color=1fb2a6)](https://nextjs.org/)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;[![documented with Fumadocs](https://img.shields.io/badge/documented_with-fumadocs-success.svg?style=for-the-badge&logo=readthedocs&color=1fb2a6)](https://fumadocs.vercel.app/)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/storm-ops/cr.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
24
+ [![Version](https://img.shields.io/badge/version-0.28.23-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/)&nbsp;[![Nx](https://img.shields.io/badge/Nx-17.0.2-lightgrey?style=for-the-badge&logo=nx&logoWidth=20&&color=1fb2a6)](http://nx.dev/)&nbsp;[![NextJs](https://img.shields.io/badge/Next.js-14.0.2-lightgrey?style=for-the-badge&logo=nextdotjs&logoWidth=20&color=1fb2a6)](https://nextjs.org/)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;[![documented with Fumadocs](https://img.shields.io/badge/documented_with-fumadocs-success.svg?style=for-the-badge&logo=readthedocs&color=1fb2a6)](https://fumadocs.vercel.app/)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/storm-ops/cr.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
25
25
 
26
26
  <!-- prettier-ignore-start -->
27
27
  <!-- markdownlint-disable -->
package/bin/tsdown.cjs CHANGED
@@ -5,7 +5,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
9
8
  var __copyProps = (to, from, except, desc) => {
10
9
  if (from && typeof from === "object" || typeof from === "function") {
11
10
  for (let key of __getOwnPropNames(from))
@@ -55,7 +54,6 @@ function isPlainObject(value) {
55
54
  }
56
55
  return true;
57
56
  }
58
- __name(isPlainObject, "isPlainObject");
59
57
  function _defu(baseObject, defaults, namespace = ".", merger) {
60
58
  if (!isPlainObject(defaults)) {
61
59
  return _defu(baseObject, {}, namespace, merger);
@@ -87,14 +85,12 @@ function _defu(baseObject, defaults, namespace = ".", merger) {
87
85
  }
88
86
  return object;
89
87
  }
90
- __name(_defu, "_defu");
91
88
  function createDefu(merger) {
92
89
  return (...arguments_) => (
93
90
  // eslint-disable-next-line unicorn/no-array-reduce
94
91
  arguments_.reduce((p, c) => _defu(p, c, "", merger), {})
95
92
  );
96
93
  }
97
- __name(createDefu, "createDefu");
98
94
  var defu = createDefu();
99
95
  var defuFn = createDefu((object, key, currentValue) => {
100
96
  if (object[key] !== void 0 && typeof currentValue === "function") {
@@ -124,29 +120,19 @@ async function clean(name = "TSDown", directory, config) {
124
120
  await cleanDirectories(name, directory, config);
125
121
  stopwatch();
126
122
  }
127
- __name(clean, "clean");
128
123
  async function cleanDirectories(name = "TSDown", directory, config) {
129
- await (0, import_promises.rm)(directory, {
130
- recursive: true,
131
- force: true
132
- });
124
+ await (0, import_promises.rm)(directory, { recursive: true, force: true });
133
125
  }
134
- __name(cleanDirectories, "cleanDirectories");
135
126
 
136
127
  // src/config.ts
137
128
  var DEFAULT_BUILD_OPTIONS = {
138
129
  platform: "node",
139
130
  target: "node22",
140
- format: [
141
- "esm",
142
- "cjs"
143
- ],
131
+ format: ["esm", "cjs"],
144
132
  tsconfig: "tsconfig.json",
145
133
  mode: "production",
146
134
  globalName: "globalThis",
147
- unused: {
148
- level: "error"
149
- },
135
+ unused: { level: "error" },
150
136
  injectShims: true,
151
137
  watch: false,
152
138
  bundle: true,
@@ -156,7 +142,7 @@ var DEFAULT_BUILD_OPTIONS = {
156
142
  };
157
143
 
158
144
  // src/build.ts
159
- var resolveOptions = /* @__PURE__ */ __name(async (userOptions) => {
145
+ var resolveOptions = async (userOptions) => {
160
146
  const projectRoot = userOptions.projectRoot;
161
147
  const workspaceRoot = (0, import_find_workspace_root.findWorkspaceRoot)(projectRoot);
162
148
  if (!workspaceRoot) {
@@ -168,7 +154,11 @@ var resolveOptions = /* @__PURE__ */ __name(async (userOptions) => {
168
154
  const projectGraph = await (0, import_devkit.createProjectGraphAsync)({
169
155
  exitOnError: true
170
156
  });
171
- const projectJsonPath = (0, import_correct_paths.joinPaths)(workspaceRoot.dir, projectRoot, "project.json");
157
+ const projectJsonPath = (0, import_correct_paths.joinPaths)(
158
+ workspaceRoot.dir,
159
+ projectRoot,
160
+ "project.json"
161
+ );
172
162
  if (!(0, import_node_fs.existsSync)(projectJsonPath)) {
173
163
  throw new Error("Cannot find project.json configuration");
174
164
  }
@@ -177,12 +167,18 @@ var resolveOptions = /* @__PURE__ */ __name(async (userOptions) => {
177
167
  const projectName = projectJson.name;
178
168
  const projectConfigurations = (0, import_devkit.readProjectsConfigurationFromProjectGraph)(projectGraph);
179
169
  if (!projectConfigurations?.projects?.[projectName]) {
180
- throw new Error("The Build process failed because the project does not have a valid configuration in the project.json file. Check if the file exists in the root of the project.");
170
+ throw new Error(
171
+ "The Build process failed because the project does not have a valid configuration in the project.json file. Check if the file exists in the root of the project."
172
+ );
181
173
  }
182
174
  const options = defu(userOptions, DEFAULT_BUILD_OPTIONS);
183
175
  options.name ??= `${projectName}-${options.format}`;
184
176
  options.target ??= import_build_tools.DEFAULT_TARGET;
185
- const packageJsonPath = (0, import_correct_paths.joinPaths)(workspaceRoot.dir, options.projectRoot, "package.json");
177
+ const packageJsonPath = (0, import_correct_paths.joinPaths)(
178
+ workspaceRoot.dir,
179
+ options.projectRoot,
180
+ "package.json"
181
+ );
186
182
  if (!(0, import_node_fs.existsSync)(packageJsonPath)) {
187
183
  throw new Error("Cannot find package.json configuration");
188
184
  }
@@ -191,11 +187,18 @@ var resolveOptions = /* @__PURE__ */ __name(async (userOptions) => {
191
187
  ...options,
192
188
  config,
193
189
  ...userOptions,
194
- tsconfig: (0, import_correct_paths.joinPaths)(projectRoot, userOptions.tsconfig ? userOptions.tsconfig.replace(projectRoot, "") : "tsconfig.json"),
190
+ tsconfig: (0, import_correct_paths.joinPaths)(
191
+ projectRoot,
192
+ userOptions.tsconfig ? userOptions.tsconfig.replace(projectRoot, "") : "tsconfig.json"
193
+ ),
195
194
  format: options.format || "cjs",
196
- entryPoints: await (0, import_build_tools.getEntryPoints)(config, projectRoot, projectJson.sourceRoot, userOptions.entry || [
197
- "./src/index.ts"
198
- ], userOptions.emitOnAll),
195
+ entryPoints: await (0, import_build_tools.getEntryPoints)(
196
+ config,
197
+ projectRoot,
198
+ projectJson.sourceRoot,
199
+ userOptions.entry || ["./src/index.ts"],
200
+ userOptions.emitOnAll
201
+ ),
199
202
  outdir: userOptions.outputPath || (0, import_correct_paths.joinPaths)("dist", projectRoot),
200
203
  plugins: [],
201
204
  name: userOptions.name || projectName,
@@ -210,9 +213,7 @@ var resolveOptions = /* @__PURE__ */ __name(async (userOptions) => {
210
213
  generatePackageJson: userOptions.generatePackageJson !== false,
211
214
  clean: userOptions.clean !== false,
212
215
  emitOnAll: userOptions.emitOnAll === true,
213
- dts: userOptions.dts === true ? {
214
- transformer: "oxc"
215
- } : userOptions.dts,
216
+ dts: userOptions.dts === true ? { transformer: "oxc" } : userOptions.dts,
216
217
  bundleDts: userOptions.dts,
217
218
  assets: userOptions.assets ?? [],
218
219
  shims: userOptions.injectShims !== true,
@@ -236,7 +237,7 @@ var resolveOptions = /* @__PURE__ */ __name(async (userOptions) => {
236
237
  };
237
238
  stopwatch();
238
239
  return result;
239
- }, "resolveOptions");
240
+ };
240
241
  async function generatePackageJson(options) {
241
242
  if (options.generatePackageJson !== false && (0, import_node_fs.existsSync)((0, import_correct_paths.joinPaths)(options.projectRoot, "package.json"))) {
242
243
  (0, import_console2.writeDebug)(" \u270D\uFE0F Writing package.json file", options.config);
@@ -245,51 +246,74 @@ async function generatePackageJson(options) {
245
246
  if (!(0, import_node_fs.existsSync)(packageJsonPath)) {
246
247
  throw new Error("Cannot find package.json configuration");
247
248
  }
248
- const packageJsonFile = await import_promises2.default.readFile((0, import_correct_paths.joinPaths)(options.config.workspaceRoot, options.projectRoot, "package.json"), "utf8");
249
+ const packageJsonFile = await import_promises2.default.readFile(
250
+ (0, import_correct_paths.joinPaths)(
251
+ options.config.workspaceRoot,
252
+ options.projectRoot,
253
+ "package.json"
254
+ ),
255
+ "utf8"
256
+ );
249
257
  if (!packageJsonFile) {
250
258
  throw new Error("Cannot find package.json configuration file");
251
259
  }
252
260
  let packageJson = JSON.parse(packageJsonFile);
253
- packageJson = await (0, import_build_tools.addPackageDependencies)(options.config.workspaceRoot, options.projectRoot, options.projectName, packageJson);
254
- packageJson = await (0, import_build_tools.addWorkspacePackageJsonFields)(options.config, options.projectRoot, options.sourceRoot, options.projectName, false, packageJson);
261
+ packageJson = await (0, import_build_tools.addPackageDependencies)(
262
+ options.config.workspaceRoot,
263
+ options.projectRoot,
264
+ options.projectName,
265
+ packageJson
266
+ );
267
+ packageJson = await (0, import_build_tools.addWorkspacePackageJsonFields)(
268
+ options.config,
269
+ options.projectRoot,
270
+ options.sourceRoot,
271
+ options.projectName,
272
+ false,
273
+ packageJson
274
+ );
255
275
  packageJson.exports ??= {};
256
276
  packageJson.exports["./package.json"] ??= "./package.json";
257
- packageJson.exports["."] ??= (0, import_build_tools.addPackageJsonExport)("index", packageJson.type, options.sourceRoot);
258
- let entryPoints = [
259
- {
260
- in: "./src/index.ts",
261
- out: "./src/index.ts"
262
- }
263
- ];
277
+ packageJson.exports["."] ??= (0, import_build_tools.addPackageJsonExport)(
278
+ "index",
279
+ packageJson.type,
280
+ options.sourceRoot
281
+ );
282
+ let entryPoints = [{ in: "./src/index.ts", out: "./src/index.ts" }];
264
283
  if (options.entryPoints) {
265
284
  if (Array.isArray(options.entryPoints)) {
266
- entryPoints = options.entryPoints.map((entryPoint) => typeof entryPoint === "string" ? {
267
- in: entryPoint,
268
- out: entryPoint
269
- } : entryPoint);
285
+ entryPoints = options.entryPoints.map(
286
+ (entryPoint) => typeof entryPoint === "string" ? { in: entryPoint, out: entryPoint } : entryPoint
287
+ );
270
288
  }
271
289
  for (const entryPoint of entryPoints) {
272
290
  const split = entryPoint.out.split(".");
273
291
  split.pop();
274
292
  const entry = split.join(".").replaceAll("\\", "/");
275
- packageJson.exports[`./${entry}`] ??= (0, import_build_tools.addPackageJsonExport)(entry, packageJson.type, options.sourceRoot);
293
+ packageJson.exports[`./${entry}`] ??= (0, import_build_tools.addPackageJsonExport)(
294
+ entry,
295
+ packageJson.type,
296
+ options.sourceRoot
297
+ );
276
298
  }
277
299
  }
278
300
  packageJson.main = packageJson.type === "commonjs" ? "./dist/index.js" : "./dist/index.cjs";
279
301
  packageJson.module = packageJson.type === "module" ? "./dist/index.js" : "./dist/index.mjs";
280
302
  packageJson.types = "./dist/index.d.ts";
281
- packageJson.exports = Object.keys(packageJson.exports).reduce((ret, key) => {
282
- if (key.endsWith("/index") && !ret[key.replace("/index", "")]) {
283
- ret[key.replace("/index", "")] = packageJson.exports[key];
284
- }
285
- return ret;
286
- }, packageJson.exports);
303
+ packageJson.exports = Object.keys(packageJson.exports).reduce(
304
+ (ret, key) => {
305
+ if (key.endsWith("/index") && !ret[key.replace("/index", "")]) {
306
+ ret[key.replace("/index", "")] = packageJson.exports[key];
307
+ }
308
+ return ret;
309
+ },
310
+ packageJson.exports
311
+ );
287
312
  await (0, import_devkit.writeJsonFile)((0, import_correct_paths.joinPaths)(options.outdir, "package.json"), packageJson);
288
313
  stopwatch();
289
314
  }
290
315
  return options;
291
316
  }
292
- __name(generatePackageJson, "generatePackageJson");
293
317
  async function executeTSDown(options) {
294
318
  (0, import_console2.writeDebug)(` \u{1F680} Running ${options.name} build`, options.config);
295
319
  const stopwatch = (0, import_console2.getStopwatch)(`${options.name} build`);
@@ -302,60 +326,78 @@ async function executeTSDown(options) {
302
326
  stopwatch();
303
327
  return options;
304
328
  }
305
- __name(executeTSDown, "executeTSDown");
306
329
  async function copyBuildAssets(options) {
307
- (0, import_console2.writeDebug)(` \u{1F4CB} Copying asset files to output directory: ${options.outdir}`, options.config);
330
+ (0, import_console2.writeDebug)(
331
+ ` \u{1F4CB} Copying asset files to output directory: ${options.outdir}`,
332
+ options.config
333
+ );
308
334
  const stopwatch = (0, import_console2.getStopwatch)(`${options.name} asset copy`);
309
- await (0, import_build_tools.copyAssets)(options.config, options.assets ?? [], options.outdir, options.projectRoot, options.sourceRoot, true, false);
335
+ await (0, import_build_tools.copyAssets)(
336
+ options.config,
337
+ options.assets ?? [],
338
+ options.outdir,
339
+ options.projectRoot,
340
+ options.sourceRoot,
341
+ true,
342
+ false
343
+ );
310
344
  stopwatch();
311
345
  return options;
312
346
  }
313
- __name(copyBuildAssets, "copyBuildAssets");
314
347
  async function reportResults(options) {
315
- (0, import_console2.writeSuccess)(` \u{1F4E6} The ${options.name} build completed successfully`, options.config);
348
+ (0, import_console2.writeSuccess)(
349
+ ` \u{1F4E6} The ${options.name} build completed successfully`,
350
+ options.config
351
+ );
316
352
  }
317
- __name(reportResults, "reportResults");
318
353
  async function cleanOutputPath(options) {
319
354
  if (options.clean !== false && options.outdir) {
320
- (0, import_console2.writeDebug)(` \u{1F9F9} Cleaning ${options.name} output path: ${options.outdir}`, options.config);
355
+ (0, import_console2.writeDebug)(
356
+ ` \u{1F9F9} Cleaning ${options.name} output path: ${options.outdir}`,
357
+ options.config
358
+ );
321
359
  const stopwatch = (0, import_console2.getStopwatch)(`${options.name} output clean`);
322
360
  await cleanDirectories(options.name, options.outdir, options.config);
323
361
  stopwatch();
324
362
  }
325
363
  return options;
326
364
  }
327
- __name(cleanOutputPath, "cleanOutputPath");
328
365
  async function build(options) {
329
366
  (0, import_console2.writeDebug)(` \u26A1 Executing Storm TSDown pipeline`);
330
367
  const stopwatch = (0, import_console2.getStopwatch)("TSDown pipeline");
331
368
  try {
332
- const opts = Array.isArray(options) ? options : [
333
- options
334
- ];
369
+ const opts = Array.isArray(options) ? options : [options];
335
370
  if (opts.length === 0) {
336
371
  throw new Error("No build options were provided");
337
372
  }
338
- const resolved = await Promise.all(opts.map(async (opt) => await resolveOptions(opt)));
373
+ const resolved = await Promise.all(
374
+ opts.map(async (opt) => await resolveOptions(opt))
375
+ );
339
376
  if (resolved.length > 0) {
340
377
  await cleanOutputPath(resolved[0]);
341
378
  await generatePackageJson(resolved[0]);
342
- await Promise.all(resolved.map(async (opt) => {
343
- await executeTSDown(opt);
344
- await copyBuildAssets(opt);
345
- await reportResults(opt);
346
- }));
379
+ await Promise.all(
380
+ resolved.map(async (opt) => {
381
+ await executeTSDown(opt);
382
+ await copyBuildAssets(opt);
383
+ await reportResults(opt);
384
+ })
385
+ );
347
386
  } else {
348
- (0, import_console2.writeWarning)(" \u{1F6A7} No options were passed to TSBuild. Please check the parameters passed to the `build` function.");
387
+ (0, import_console2.writeWarning)(
388
+ " \u{1F6A7} No options were passed to TSBuild. Please check the parameters passed to the `build` function."
389
+ );
349
390
  }
350
391
  (0, import_console2.writeSuccess)(" \u{1F3C1} TSDown pipeline build completed successfully");
351
392
  } catch (error) {
352
- (0, import_console2.writeFatal)("Fatal errors that the build process could not recover from have occured. The build process has been terminated.");
393
+ (0, import_console2.writeFatal)(
394
+ "Fatal errors that the build process could not recover from have occured. The build process has been terminated."
395
+ );
353
396
  throw error;
354
397
  } finally {
355
398
  stopwatch();
356
399
  }
357
400
  }
358
- __name(build, "build");
359
401
 
360
402
  // bin/tsdown.ts
361
403
  async function createProgram(config) {
@@ -370,34 +412,57 @@ async function createProgram(config) {
370
412
  const program = new import_commander.Command("storm-tsdown");
371
413
  program.version("1.0.0", "-v --version", "display CLI version");
372
414
  program.description("\u26A1 Run the Storm TSDown pipeline").showHelpAfterError().showSuggestionAfterError();
373
- const projectRootOption = new import_commander.Option("-p --project-root <path>", "The path to the root of the project to build. This path is defined relative to the workspace root.").makeOptionMandatory(true);
374
- const sourceRootOption = new import_commander.Option("-s --source-root <path>", "The path of the project's source folder to build");
375
- const nameOption = new import_commander.Option("-n --name <value>", "The name of the project to build");
376
- const outputPathOption = new import_commander.Option("-o --output-path <path>", "The path of the project's source folder to build").default("dist/{projectRoot}");
377
- const platformOption = new import_commander.Option("-p --platform <value>", "The platform to build the distribution for").choices([
378
- "node",
379
- "neutral",
380
- "browser"
381
- ]).default("node");
382
- const formatOption = new import_commander.Option("-f, --format <value...>", "The format to build the distribution in").choices([
383
- "esm",
384
- "cjs",
385
- "iife"
386
- ]).argParser((value, previous) => {
415
+ const projectRootOption = new import_commander.Option(
416
+ "-p --project-root <path>",
417
+ "The path to the root of the project to build. This path is defined relative to the workspace root."
418
+ ).makeOptionMandatory(true);
419
+ const sourceRootOption = new import_commander.Option(
420
+ "-s --source-root <path>",
421
+ "The path of the project's source folder to build"
422
+ );
423
+ const nameOption = new import_commander.Option(
424
+ "-n --name <value>",
425
+ "The name of the project to build"
426
+ );
427
+ const outputPathOption = new import_commander.Option(
428
+ "-o --output-path <path>",
429
+ "The path of the project's source folder to build"
430
+ ).default("dist/{projectRoot}");
431
+ const platformOption = new import_commander.Option(
432
+ "-p --platform <value>",
433
+ "The platform to build the distribution for"
434
+ ).choices(["node", "neutral", "browser"]).default("node");
435
+ const formatOption = new import_commander.Option(
436
+ "-f, --format <value...>",
437
+ "The format to build the distribution in"
438
+ ).choices(["esm", "cjs", "iife"]).argParser((value, previous) => {
387
439
  if (previous === void 0) {
388
- return [
389
- value
390
- ];
440
+ return [value];
391
441
  } else if (!previous.includes(value)) {
392
442
  previous.push(value);
393
443
  }
394
444
  return previous;
395
445
  }).default("esm");
396
- const cleanOption = new import_commander.Option("-c --clean", "Should the output directory be cleaned before building").default(true);
397
- const noCleanOption = new import_commander.Option("--no-clean", "Should the output directory be cleaned before building").default(false);
398
- const bundleOption = new import_commander.Option("-b --bundle", "Should the output be bundled").default(true);
399
- const noBundleOption = new import_commander.Option("--no-bundle", "Should the output be bundled").default(false);
400
- const targetOption = new import_commander.Option("-t --target <value>", "The target to build the distribution for").choices([
446
+ const cleanOption = new import_commander.Option(
447
+ "-c --clean",
448
+ "Should the output directory be cleaned before building"
449
+ ).default(true);
450
+ const noCleanOption = new import_commander.Option(
451
+ "--no-clean",
452
+ "Should the output directory be cleaned before building"
453
+ ).default(false);
454
+ const bundleOption = new import_commander.Option(
455
+ "-b --bundle",
456
+ "Should the output be bundled"
457
+ ).default(true);
458
+ const noBundleOption = new import_commander.Option(
459
+ "--no-bundle",
460
+ "Should the output be bundled"
461
+ ).default(false);
462
+ const targetOption = new import_commander.Option(
463
+ "-t --target <value>",
464
+ "The target to build the distribution for"
465
+ ).choices([
401
466
  "ESNext",
402
467
  "ES2015",
403
468
  "ES2016",
@@ -409,52 +474,104 @@ async function createProgram(config) {
409
474
  "ES2022",
410
475
  "ES2023"
411
476
  ]).default("ESNext");
412
- const watchOption = new import_commander.Option("-w --watch", "Should the build process watch for changes").default(false);
413
- const debugOption = new import_commander.Option("-d --debug", "Should the build process run in debug mode").default(false);
414
- const bannerOption = new import_commander.Option("--banner <value>", "The banner to prepend to the output");
415
- const footerOption = new import_commander.Option("--footer <value>", "The footer to prepend to the output");
416
- const splittingOption = new import_commander.Option("--splitting", "Should the output be split into multiple files").default(true);
417
- const treeShakingOption = new import_commander.Option("--tree-shaking", "Should tree shaking be enabled").default(true);
418
- const generatePackageJsonOption = new import_commander.Option("--generate-package-json", "Should a package.json be generated for the output").default(true);
419
- const emitOnAllOption = new import_commander.Option("--emit-on-all", "Should the output be emitted on all platforms").default(false);
420
- const metafileOption = new import_commander.Option("--metafile", "Should a metafile be generated for the output").default(true);
421
- const minifyOption = new import_commander.Option("--minify", "Should the output be minified").default(true);
422
- const includeSrcOption = new import_commander.Option("--include-src", "Should the source files be included in the output").default(false);
423
- const verboseOption = new import_commander.Option("--verbose", "Should the build process be verbose").default(false);
424
- const injectShimsOption = new import_commander.Option("--inject-shims", "Should shims be injected into the output").default(true);
425
- const dtsOption = new import_commander.Option("--emit-types", "Should types be emitted for the output").default(true);
426
- program.command("build", {
427
- isDefault: true
428
- }).alias("bundle").description("Run a TypeScript build using TSDown, API-Extractor, and TSC (for type generation).").addOption(nameOption).addOption(projectRootOption).addOption(sourceRootOption).addOption(outputPathOption).addOption(platformOption).addOption(formatOption).addOption(targetOption).addOption(bundleOption).addOption(noBundleOption).addOption(cleanOption).addOption(noCleanOption).addOption(watchOption).addOption(debugOption).addOption(bannerOption).addOption(footerOption).addOption(splittingOption).addOption(treeShakingOption).addOption(generatePackageJsonOption).addOption(emitOnAllOption).addOption(metafileOption).addOption(minifyOption).addOption(includeSrcOption).addOption(verboseOption).addOption(injectShimsOption).addOption(dtsOption).action(buildAction(config));
429
- program.command("clean").alias("clear").description("Clean the output directory of the project. This command will remove the 'dist' folder.").addOption(nameOption).action(cleanAction(config));
477
+ const watchOption = new import_commander.Option(
478
+ "-w --watch",
479
+ "Should the build process watch for changes"
480
+ ).default(false);
481
+ const debugOption = new import_commander.Option(
482
+ "-d --debug",
483
+ "Should the build process run in debug mode"
484
+ ).default(false);
485
+ const bannerOption = new import_commander.Option(
486
+ "--banner <value>",
487
+ "The banner to prepend to the output"
488
+ );
489
+ const footerOption = new import_commander.Option(
490
+ "--footer <value>",
491
+ "The footer to prepend to the output"
492
+ );
493
+ const splittingOption = new import_commander.Option(
494
+ "--splitting",
495
+ "Should the output be split into multiple files"
496
+ ).default(true);
497
+ const treeShakingOption = new import_commander.Option(
498
+ "--tree-shaking",
499
+ "Should tree shaking be enabled"
500
+ ).default(true);
501
+ const generatePackageJsonOption = new import_commander.Option(
502
+ "--generate-package-json",
503
+ "Should a package.json be generated for the output"
504
+ ).default(true);
505
+ const emitOnAllOption = new import_commander.Option(
506
+ "--emit-on-all",
507
+ "Should the output be emitted on all platforms"
508
+ ).default(false);
509
+ const metafileOption = new import_commander.Option(
510
+ "--metafile",
511
+ "Should a metafile be generated for the output"
512
+ ).default(true);
513
+ const minifyOption = new import_commander.Option(
514
+ "--minify",
515
+ "Should the output be minified"
516
+ ).default(true);
517
+ const includeSrcOption = new import_commander.Option(
518
+ "--include-src",
519
+ "Should the source files be included in the output"
520
+ ).default(false);
521
+ const verboseOption = new import_commander.Option(
522
+ "--verbose",
523
+ "Should the build process be verbose"
524
+ ).default(false);
525
+ const injectShimsOption = new import_commander.Option(
526
+ "--inject-shims",
527
+ "Should shims be injected into the output"
528
+ ).default(true);
529
+ const dtsOption = new import_commander.Option(
530
+ "--emit-types",
531
+ "Should types be emitted for the output"
532
+ ).default(true);
533
+ program.command("build", { isDefault: true }).alias("bundle").description(
534
+ "Run a TypeScript build using TSDown, API-Extractor, and TSC (for type generation)."
535
+ ).addOption(nameOption).addOption(projectRootOption).addOption(sourceRootOption).addOption(outputPathOption).addOption(platformOption).addOption(formatOption).addOption(targetOption).addOption(bundleOption).addOption(noBundleOption).addOption(cleanOption).addOption(noCleanOption).addOption(watchOption).addOption(debugOption).addOption(bannerOption).addOption(footerOption).addOption(splittingOption).addOption(treeShakingOption).addOption(generatePackageJsonOption).addOption(emitOnAllOption).addOption(metafileOption).addOption(minifyOption).addOption(includeSrcOption).addOption(verboseOption).addOption(injectShimsOption).addOption(dtsOption).action(buildAction(config));
536
+ program.command("clean").alias("clear").description(
537
+ "Clean the output directory of the project. This command will remove the 'dist' folder."
538
+ ).addOption(nameOption).action(cleanAction(config));
430
539
  return program;
431
540
  } catch (e) {
432
- (0, import_console3.writeFatal)(`A fatal error occurred while running the program: ${e.message}`, config);
541
+ (0, import_console3.writeFatal)(
542
+ `A fatal error occurred while running the program: ${e.message}`,
543
+ config
544
+ );
433
545
  process.exit(1);
434
546
  }
435
547
  }
436
- __name(createProgram, "createProgram");
437
- var buildAction = /* @__PURE__ */ __name((config) => async (options) => {
548
+ var buildAction = (config) => async (options) => {
438
549
  try {
439
550
  await build({
440
551
  ...options,
441
552
  format: options.format
442
553
  });
443
554
  } catch (e) {
444
- (0, import_console3.writeFatal)(`A fatal error occurred while cleaning the TSDown output directory: ${e.message}`, config);
555
+ (0, import_console3.writeFatal)(
556
+ `A fatal error occurred while cleaning the TSDown output directory: ${e.message}`,
557
+ config
558
+ );
445
559
  (0, import_process_handler.exitWithError)(config);
446
560
  process.exit(1);
447
561
  }
448
- }, "buildAction");
449
- var cleanAction = /* @__PURE__ */ __name((config) => async (options) => {
562
+ };
563
+ var cleanAction = (config) => async (options) => {
450
564
  try {
451
565
  await clean(options.name, options.output, config);
452
566
  } catch (e) {
453
- (0, import_console3.writeFatal)(`A fatal error occurred while cleaning the TSDown output directory: ${e.message}`, config);
567
+ (0, import_console3.writeFatal)(
568
+ `A fatal error occurred while cleaning the TSDown output directory: ${e.message}`,
569
+ config
570
+ );
454
571
  (0, import_process_handler.exitWithError)(config);
455
572
  process.exit(1);
456
573
  }
457
- }, "cleanAction");
574
+ };
458
575
  void (async () => {
459
576
  const config = await (0, import_get_config2.getConfig)();
460
577
  const stopwatch = (0, import_console3.getStopwatch)("Storm TSDown executable");
@@ -462,12 +579,18 @@ void (async () => {
462
579
  (0, import_process_handler.handleProcess)(config);
463
580
  const program = await createProgram(config);
464
581
  await program.parseAsync(process.argv);
465
- (0, import_console3.writeSuccess)(`\u{1F389} Storm TSDown executable has completed successfully!`, config);
582
+ (0, import_console3.writeSuccess)(
583
+ `\u{1F389} Storm TSDown executable has completed successfully!`,
584
+ config
585
+ );
466
586
  (0, import_process_handler.exitWithSuccess)(config);
467
587
  } catch (error) {
468
- (0, import_console3.writeFatal)(`A fatal error occurred while running Storm TSDown executable:
588
+ (0, import_console3.writeFatal)(
589
+ `A fatal error occurred while running Storm TSDown executable:
469
590
 
470
- ${error.message}`, config);
591
+ ${error.message}`,
592
+ config
593
+ );
471
594
  (0, import_process_handler.exitWithError)(config);
472
595
  process.exit(1);
473
596
  } finally {
package/dist/build.cjs CHANGED
@@ -1,11 +1,10 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
- var _chunk3RXXV65Rcjs = require('./chunk-3RXXV65R.cjs');
5
- require('./chunk-2G7S4JNP.cjs');
6
- require('./chunk-DEWYQH4B.cjs');
7
- require('./chunk-USNT2KNT.cjs');
4
+ var _chunkGBBMOENPcjs = require('./chunk-GBBMOENP.cjs');
5
+ require('./chunk-IUFIA7M2.cjs');
6
+ require('./chunk-65E5RX7I.cjs');
8
7
 
9
8
 
10
9
 
11
- exports.build = _chunk3RXXV65Rcjs.build; exports.cleanOutputPath = _chunk3RXXV65Rcjs.cleanOutputPath;
10
+ exports.build = _chunkGBBMOENPcjs.build; exports.cleanOutputPath = _chunkGBBMOENPcjs.cleanOutputPath;
package/dist/build.js CHANGED
@@ -1,10 +1,9 @@
1
1
  import {
2
2
  build,
3
3
  cleanOutputPath
4
- } from "./chunk-X56SYHGK.js";
5
- import "./chunk-2WT22RMQ.js";
6
- import "./chunk-PR5HLZXS.js";
7
- import "./chunk-SHUYVCID.js";
4
+ } from "./chunk-IUBNNUNA.js";
5
+ import "./chunk-J4T3BYOA.js";
6
+ import "./chunk-2YE3GBQH.js";
8
7
  export {
9
8
  build,
10
9
  cleanOutputPath
@@ -2,16 +2,11 @@
2
2
  var DEFAULT_BUILD_OPTIONS = {
3
3
  platform: "node",
4
4
  target: "node22",
5
- format: [
6
- "esm",
7
- "cjs"
8
- ],
5
+ format: ["esm", "cjs"],
9
6
  tsconfig: "tsconfig.json",
10
7
  mode: "production",
11
8
  globalName: "globalThis",
12
- unused: {
13
- level: "error"
14
- },
9
+ unused: { level: "error" },
15
10
  injectShims: true,
16
11
  watch: false,
17
12
  bundle: true,