bunup 0.8.49 → 0.8.51

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
@@ -12,7 +12,9 @@
12
12
 
13
13
  [![NPM Downloads](https://img.shields.io/npm/dm/bunup?logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjRweCIgdmlld0JveD0iMCAtOTYwIDk2MCA5NjAiIHdpZHRoPSIyNHB4IiBmaWxsPSIjMDAwMDAwIj48cGF0aCBkPSJNNDgwLTMyMCAyODAtNTIwbDU2LTU4IDEwNCAxMDR2LTMyNmg4MHYzMjZsMTA0LTEwNCA1NiA1OC0yMDAgMjAwWk0xNjAtMTYwdi0yMDBoODB2MTIwaDQ4MHYtMTIwaDgwdjIwMEgxNjBaIi8%2BPC9zdmc%2B&labelColor=ffc44e&color=212121)](https://www.npmjs.com/package/bunup) [![NPM Version](https://img.shields.io/npm/v/bunup?logo=npm&logoColor=212121&label=version&labelColor=ffc44e&color=212121)](https://npmjs.com/package/bunup) [![Built with Bun](https://img.shields.io/badge/Built_with-Bun-fbf0df?logo=bun&labelColor=212121)](https://bun.sh) [![sponsor](https://img.shields.io/badge/sponsor-EA4AAA?logo=githubsponsors&labelColor=FAFAFA)](https://github.com/sponsors/arshad-yaseen)
14
14
 
15
- Bunup is the **blazing-fast build tool** for TypeScript and JavaScript libraries, designed for flawless developer experience and speed, **powered by Bun**.
15
+ Bunup is the **blazing-fast build tool** for TypeScript and JavaScript libraries, designed for flawless developer experience and speed, **powered by Bun**.
16
+
17
+ It's the fastest library bundler out there - [see benchmarks](https://gugustinette.github.io/bundler-benchmark/).
16
18
 
17
19
  ![bunup-demo](/assets/demo.gif)
18
20
 
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  logger
3
- } from "./chunk-y0jgbvca.js";
3
+ } from "./chunk-aq91x0fe.js";
4
4
 
5
5
  // src/cli/utils.ts
6
6
  import pc from "picocolors";
@@ -1,11 +1,11 @@
1
1
  // @bun
2
2
  import {
3
3
  displayBunupGradientArt
4
- } from "./chunk-qy8akfev.js";
4
+ } from "./chunk-1y38m6th.js";
5
5
  import {
6
6
  link,
7
7
  pathExistsSync
8
- } from "./chunk-y0jgbvca.js";
8
+ } from "./chunk-aq91x0fe.js";
9
9
 
10
10
  // src/cli/new.ts
11
11
  import { renameSync } from "fs";
@@ -3,13 +3,14 @@ import {
3
3
  filterBunupPlugins,
4
4
  runPluginBuildDoneHooks,
5
5
  runPluginBuildStartHooks
6
- } from "./chunk-t9xma3m6.js";
6
+ } from "./chunk-p2gc4tkm.js";
7
7
  import {
8
8
  loadPackageJson,
9
9
  loadTsConfig
10
10
  } from "./chunk-5v78yfze.js";
11
11
  import {
12
12
  BunupBuildError,
13
+ BunupDTSBuildError,
13
14
  JS_RE,
14
15
  cleanOutDir,
15
16
  cleanPath,
@@ -30,10 +31,11 @@ import {
30
31
  link,
31
32
  logTable,
32
33
  logger,
34
+ parseErrorMessage,
33
35
  replaceExtension,
34
36
  returnPathIfExists,
35
37
  setSilent
36
- } from "./chunk-y0jgbvca.js";
38
+ } from "./chunk-aq91x0fe.js";
37
39
 
38
40
  // src/build.ts
39
41
  import path2 from "path";
@@ -106,13 +108,8 @@ function getName(node, source) {
106
108
  }
107
109
  break;
108
110
  case "TSModuleDeclaration":
109
- if (node.id) {
110
- if (node.id.type === "Identifier") {
111
- return node.id.name;
112
- }
113
- if (node.id.type === "StringLiteral" && typeof node.id.value === "string") {
114
- return node.id.value;
115
- }
111
+ if (node.id && node.id.type === "Identifier") {
112
+ return node.id.name;
116
113
  }
117
114
  break;
118
115
  case "VariableDeclaration": {
@@ -311,88 +308,79 @@ function handleNamespace(stmt) {
311
308
 
312
309
  // src/dts/logger.ts
313
310
  import pc from "picocolors";
314
-
315
- // src/constants/index.ts
316
- var BUNUP_DOCS_URL = "https://bunup.dev/docs";
317
- var UNDERSTANDING_ISOLATED_DECLARATIONS_URL = "https://github.com/arshad-yaseen/bunup/blob/main/docs/isolated-declarations.md";
318
-
319
- // src/dts/logger.ts
320
- function logIsolatedDeclarationErrors(errors) {
321
- let hasSeverityError = false;
322
- for (const error of errors) {
323
- if (error.error.severity === "Error") {
324
- hasSeverityError = true;
325
- }
326
- logSingle(error);
311
+ var SEVERITY_CONFIG = {
312
+ dev: {
313
+ Error: { color: pc.yellow, prefix: "WARN" },
314
+ Warning: { color: pc.yellow, prefix: "WARN" },
315
+ Advice: { color: pc.blue, prefix: "ADVICE" },
316
+ default: { color: pc.blue, prefix: "WARN" }
317
+ },
318
+ prod: {
319
+ Error: { color: pc.red, prefix: "Error" },
320
+ Warning: { color: pc.yellow, prefix: "Warning" },
321
+ Advice: { color: pc.blue, prefix: "Advice" },
322
+ default: { color: pc.red, prefix: "Error" }
327
323
  }
328
- if (hasSeverityError) {
329
- if (isDev()) {
330
- console.log(`
331
- ${pc.yellow("Please address the suggestions above before publishing your package.")}
332
- `);
333
- }
334
- console.log(`${pc.cyan("Why?")} ${pc.underline(UNDERSTANDING_ISOLATED_DECLARATIONS_URL)}
335
- `);
336
- if (!isDev()) {
324
+ };
325
+ var ISOLATED_DECLARATION_ERRORS = {
326
+ TS9007: `Function requires an explicit return type, e.g., \`function foo(): ${pc.green("string")} { ... }\`.`,
327
+ TS9008: `Method requires an explicit return type, e.g., \`myMethod(): ${pc.green("number")} { ... }\`.`,
328
+ TS9009: "Ensure at least one accessor (getter/setter) has an explicit return type.",
329
+ TS9010: `Variable requires an explicit type annotation, e.g., \`let name: ${pc.green("string")} = "Bob";\`.`,
330
+ TS9011: `Function parameter requires an explicit type, e.g., \`(param: ${pc.green("number")}) => {}\`.`,
331
+ TS9012: `Class property requires an explicit type, e.g., \`class MyClass { id: ${pc.green("number")}; }\`.`,
332
+ TS9013: "Expression type cannot be inferred. Add a type annotation where this expression is assigned or used.",
333
+ TS9014: "Computed property names must be simple (e.g., string/number literals or basic identifiers).",
334
+ TS9015: "Object spread properties prevent type inference. Either add an explicit type to the object or avoid spread.",
335
+ TS9016: "Object shorthand properties prevent type inference. Either add an explicit type to the object or use full `key: value` syntax.",
336
+ TS9017: `For array type inference, use \`as const\` (e.g., \`[1, 2, 3] ${pc.green("as const")}\`).`,
337
+ TS9018: "Array spread elements prevent type inference. Either add an explicit type to the array or avoid spread.",
338
+ TS9019: `Avoid direct export of destructured bindings. Instead, declare and then export, e.g., \`const { x } = obj; ${pc.green("export { x };")}\`.`,
339
+ TS9020: "Enum member initializers must be simple, constant values (like numbers or strings), not expressions or external references.",
340
+ TS9021: "The `extends` clause must refer to a direct class name, not an expression.",
341
+ TS9022: `Class expressions cannot infer types. Assign the class expression to an explicitly typed variable, e.g., \`const MyClass: ${pc.green("typeof OtherClass")} = class { ... };\`.`,
342
+ TS9023: `Properties assigned to functions must be explicitly declared on the function type/interface, e.g., \`interface MyFunc { (): void; ${pc.green("myProp: string;")} }\`.`,
343
+ TS9025: `Parameter can implicitly be \`undefined\`. Explicitly add \`| undefined\` to its type, e.g., \`param?: string\` becomes \`param: ${pc.green("string | undefined")}\`.`,
344
+ TS9037: `Default export requires an explicit type, e.g., \`const MyValue: ${pc.green("number")} = 42; export default MyValue;\`.`,
345
+ TS9038: "Computed property names in class/object literals must be simple (string/number literals or plain identifiers), not complex expressions.",
346
+ TS9039: "A type references a private class member (`{name}`). Private members cannot be part of publicly exposed types."
347
+ };
348
+ function logIsolatedDeclarationErrors(errors) {
349
+ if (!errors.length)
350
+ return;
351
+ const hasErrors = errors.some(({ error }) => error.severity === "Error");
352
+ errors.forEach(logSingle);
353
+ if (hasErrors) {
354
+ if (!isDev())
337
355
  process.exit(1);
338
- }
339
356
  }
340
357
  }
341
- function logSingle(error) {
342
- const label = error.error.labels[0];
343
- const position = label ? calculateDtsErrorLineAndColumn(error.content, label.start) : "";
344
- const shortPath = getShortFilePath(error.file);
345
- const errorMessage = `${shortPath}${position}: ${formatDtsErrorMessage(error.error.message)}`;
346
- const { color, prefix } = getSeverityFormatting(error.error.severity);
347
- const formattedMessage = `${color(prefix)} ${errorMessage}`;
348
- const codeFrame = label ? getCodeFrame(error.content, label.start, label.end) : error.error.codeframe ? error.error.codeframe : "";
349
- const helpMessage = error.error.helpMessage ? `
350
- ${pc.cyan("Help:")} ${error.error.helpMessage}` : "";
358
+ function logSingle({ error, file, content }) {
359
+ const label = error.labels?.[0];
360
+ const errorCode = extractErrorCode(error.message);
361
+ const errorMessage = ISOLATED_DECLARATION_ERRORS[errorCode];
362
+ if (!errorMessage)
363
+ return;
364
+ const position = label ? calculatePosition(content, label.start) : "";
365
+ const shortPath = getShortFilePath(file);
366
+ const { color, prefix } = getSeverityFormatting(error.severity);
367
+ const formattedMessage = `${color(prefix)} ${shortPath}${position}: ${errorCode} ${errorMessage}`;
368
+ const codeFrame = label ? generateOxcCodeFrame(content, label.start, label.end) : error.codeframe || "";
369
+ const helpMessage = error.helpMessage ? `
370
+ ${pc.cyan("Help:")} ${error.helpMessage}` : "";
351
371
  console.log(`
352
372
  ${formattedMessage}${helpMessage}
353
373
 
354
374
  ${pc.gray(codeFrame)}`);
355
375
  }
356
- function getSeverityFormatting(severity) {
357
- if (isDev()) {
358
- switch (severity) {
359
- case "Error":
360
- return {
361
- color: pc.blue,
362
- prefix: "Suggestion"
363
- };
364
- case "Warning":
365
- return { color: pc.yellow, prefix: "Suggestion" };
366
- case "Advice":
367
- return { color: pc.blue, prefix: "Advice" };
368
- default:
369
- return {
370
- color: pc.blue,
371
- prefix: "Suggestion"
372
- };
373
- }
374
- }
375
- switch (severity) {
376
- case "Error":
377
- return {
378
- color: pc.red,
379
- prefix: "ERROR"
380
- };
381
- case "Warning":
382
- return { color: pc.yellow, prefix: "WARNING" };
383
- case "Advice":
384
- return { color: pc.blue, prefix: "ADVICE" };
385
- default:
386
- return {
387
- color: pc.red,
388
- prefix: "ERROR"
389
- };
390
- }
376
+ function extractErrorCode(message) {
377
+ return message.split(":")[0];
391
378
  }
392
- function formatDtsErrorMessage(errorMessage) {
393
- return errorMessage.replace(" with --isolatedDeclarations", "").replace(" with --isolatedDeclaration", "");
379
+ function getSeverityFormatting(severity) {
380
+ const config = SEVERITY_CONFIG[isDev() ? "dev" : "prod"];
381
+ return config[severity] || config.default;
394
382
  }
395
- function calculateDtsErrorLineAndColumn(sourceText, labelStart) {
383
+ function calculatePosition(sourceText, labelStart) {
396
384
  if (labelStart === undefined)
397
385
  return "";
398
386
  const lines = sourceText.slice(0, labelStart).split(`
@@ -401,34 +389,21 @@ function calculateDtsErrorLineAndColumn(sourceText, labelStart) {
401
389
  const columnStart = lines[lines.length - 1].length + 1;
402
390
  return ` (${lineNumber}:${columnStart})`;
403
391
  }
404
- function getCodeFrame(sourceText, start, end) {
392
+ function generateOxcCodeFrame(sourceText, start, end) {
405
393
  const lines = sourceText.split(`
406
394
  `);
407
395
  const errorLine = sourceText.slice(0, start).split(`
408
396
  `).length;
409
397
  const lineContent = lines[errorLine - 1];
410
- const startCol = start - sourceText.slice(0, start).lastIndexOf(`
411
- `) - 1;
412
- const endCol = end ? Math.min(end - sourceText.slice(0, start).lastIndexOf(`
413
- `) - 1, lineContent.length) : startCol + 1;
414
- const arrowLine = " ".repeat(startCol) + pc[isDev() ? "blue" : "red"](pc.dim("\u23AF".repeat(Math.max(1, endCol - startCol))));
398
+ const lastNewlineIndex = sourceText.slice(0, start).lastIndexOf(`
399
+ `);
400
+ const startCol = start - lastNewlineIndex - 1;
401
+ const endCol = end ? Math.min(end - lastNewlineIndex - 1, lineContent.length) : startCol + 1;
402
+ const underlineLength = Math.max(1, endCol - startCol);
403
+ const arrowLine = " ".repeat(startCol) + pc.dim(pc.blue("\u23AF".repeat(underlineLength)));
415
404
  return `${lineContent}
416
405
  ${arrowLine}`;
417
406
  }
418
- function handleBunBuildLogs(logs) {
419
- for (const log of logs) {
420
- if (log.level === "error") {
421
- logger.error(`${log.message} in ${log.position?.file}`);
422
- throw new Error("Failed to generate declaration file");
423
- }
424
- if (log.level === "warning") {
425
- logger.warn(log.message);
426
- }
427
- if (log.level === "info") {
428
- logger.info(log.message);
429
- }
430
- }
431
- }
432
407
 
433
408
  // src/dts/resolver.ts
434
409
  import { dirname } from "path";
@@ -561,11 +536,16 @@ async function generateDts(entrypoints, options) {
561
536
  target: "node",
562
537
  splitting: options.splitting,
563
538
  plugins: [fakeJsPlugin],
564
- throw: false,
565
539
  packages: "external",
566
- minify: options.minify
540
+ minify: options.minify,
541
+ throw: false
567
542
  });
568
- handleBunBuildLogs(result.logs);
543
+ if (collectedErrors.length) {
544
+ logIsolatedDeclarationErrors(collectedErrors);
545
+ }
546
+ if (!result.success) {
547
+ throw new Error(`DTS bundling failed: ${result.logs}`);
548
+ }
569
549
  try {
570
550
  const outputs = result.outputs.filter((output) => output.kind === "chunk" || output.kind === "entry-point");
571
551
  const bundledFiles = [];
@@ -589,14 +569,7 @@ async function generateDts(entrypoints, options) {
589
569
  });
590
570
  }
591
571
  return {
592
- files: bundledFiles,
593
- errors: collectedErrors
594
- };
595
- } catch (error) {
596
- console.error(error);
597
- return {
598
- files: [],
599
- errors: collectedErrors
572
+ files: bundledFiles
600
573
  };
601
574
  } finally {
602
575
  await fs.rm(tempOutDir, { recursive: true, force: true });
@@ -897,38 +870,41 @@ async function build(partialOptions, rootDir = process.cwd()) {
897
870
  });
898
871
  await Promise.all(buildPromises);
899
872
  if (options.dts) {
900
- const { entry, splitting, ...dtsOptions } = typeof options.dts === "object" ? options.dts : {};
901
- const dtsResult = await generateDts(ensureArray(entry ?? entrypoints), {
902
- cwd: rootDir,
903
- preferredTsConfigPath: options.preferredTsconfigPath,
904
- splitting: getResolvedDtsSplitting(splitting),
905
- ...dtsOptions
906
- });
907
- if (dtsResult.errors.length) {
908
- logIsolatedDeclarationErrors(dtsResult.errors);
909
- }
910
- for (const fmt of options.format) {
911
- for (const file of dtsResult.files) {
912
- const dtsExtension = getDefaultDtsExtention(fmt, packageType);
913
- const relativePathToOutputDir = cleanPath(`${file.pathInfo.outputPathWithoutExtension}${dtsExtension}`);
914
- const relativePathToRootDir = cleanPath(`${options.outDir}/${relativePathToOutputDir}`);
915
- if (file.kind === "entry-point") {
916
- logger.success(`${pc3.dim(`${options.outDir}/`)}${relativePathToOutputDir}`, {
917
- identifier: options.name
873
+ try {
874
+ const { entry, splitting, ...dtsOptions } = typeof options.dts === "object" ? options.dts : {};
875
+ const dtsResult = await generateDts(ensureArray(entry ?? entrypoints), {
876
+ cwd: rootDir,
877
+ preferredTsConfigPath: options.preferredTsconfigPath,
878
+ splitting: getResolvedDtsSplitting(splitting),
879
+ ...dtsOptions
880
+ });
881
+ for (const fmt of options.format) {
882
+ for (const file of dtsResult.files) {
883
+ const dtsExtension = getDefaultDtsExtention(fmt, packageType);
884
+ const relativePathToOutputDir = cleanPath(`${file.pathInfo.outputPathWithoutExtension}${dtsExtension}`);
885
+ const relativePathToRootDir = cleanPath(`${options.outDir}/${relativePathToOutputDir}`);
886
+ if (file.kind === "entry-point") {
887
+ logger.success(`${pc3.dim(`${options.outDir}/`)}${relativePathToOutputDir}`, {
888
+ identifier: options.name
889
+ });
890
+ }
891
+ const fullPath = path2.join(rootDir, relativePathToRootDir);
892
+ await Bun.write(fullPath, file.dts);
893
+ buildOutput.files.push({
894
+ fullPath,
895
+ relativePathToRootDir,
896
+ relativePathToOutputDir,
897
+ dts: true,
898
+ format: fmt,
899
+ kind: file.kind,
900
+ entrypoint: file.entrypoint ? cleanPath(file.entrypoint) : undefined
918
901
  });
919
902
  }
920
- const fullPath = path2.join(rootDir, relativePathToRootDir);
921
- await Bun.write(fullPath, file.dts);
922
- buildOutput.files.push({
923
- fullPath,
924
- relativePathToRootDir,
925
- relativePathToOutputDir,
926
- dts: true,
927
- format: fmt,
928
- kind: file.kind,
929
- entrypoint: file.entrypoint ? cleanPath(file.entrypoint) : undefined
930
- });
931
903
  }
904
+ } catch (error) {
905
+ throw new BunupDTSBuildError(parseErrorMessage(error));
906
+ } finally {
907
+ logger.space();
932
908
  }
933
909
  }
934
910
  await runPluginBuildDoneHooks(bunupPlugins, options, buildOutput, {
@@ -946,4 +922,4 @@ function getRelativePathToOutputDir(relativePathToRootDir, outDir) {
946
922
  return cleanPath(relativePathToRootDir).replace(`${cleanPath(outDir)}/`, "");
947
923
  }
948
924
 
949
- export { BUNUP_DOCS_URL, createBuildOptions, build };
925
+ export { createBuildOptions, build };
@@ -426,4 +426,4 @@ function returnPathIfExists(path2) {
426
426
  return pathExistsSync(path2) ? path2 : null;
427
427
  }
428
428
 
429
- export { __toESM, __require, JS_RE, JS_TS_RE, JS_DTS_RE, CSS_RE, setSilent, logTable, link, logger, BunupBuildError, BunupCLIError, BunupWatchError, BunupPluginError, parseErrorMessage, handleError, handleErrorAndExit, ensureArray, getDefaultOutputExtension, getDefaultDtsExtention, getDeclarationExtensionFromJsExtension, formatTime, getPackageDeps, formatFileSize, getShortFilePath, cleanOutDir, cleanPath, isDirectoryPath, pathExistsSync, formatListWithAnd, getFilesFromGlobs, isDev, generateRandomString, isNullOrUndefined, isTypeScriptFile, getExtension, replaceExtension, deleteExtension, returnPathIfExists };
429
+ export { __toESM, __require, JS_RE, JS_TS_RE, JS_DTS_RE, CSS_RE, setSilent, logTable, link, logger, BunupBuildError, BunupDTSBuildError, BunupCLIError, BunupWatchError, BunupPluginError, parseErrorMessage, handleError, handleErrorAndExit, ensureArray, getDefaultOutputExtension, getDefaultDtsExtention, getDeclarationExtensionFromJsExtension, formatTime, getPackageDeps, formatFileSize, getShortFilePath, cleanOutDir, cleanPath, isDirectoryPath, pathExistsSync, formatListWithAnd, getFilesFromGlobs, isDev, generateRandomString, isNullOrUndefined, isTypeScriptFile, getExtension, replaceExtension, deleteExtension, returnPathIfExists };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  BunupPluginError
3
- } from "./chunk-y0jgbvca.js";
3
+ } from "./chunk-aq91x0fe.js";
4
4
 
5
5
  // src/plugins/utils.ts
6
6
  import pc from "picocolors";
@@ -1,37 +1,37 @@
1
1
  type Resolve = boolean | (string | RegExp)[];
2
2
  type GenerateDtsOptions = {
3
- preferredTsConfigPath?: string
4
- resolve?: Resolve
5
- cwd?: string
6
- splitting?: boolean
7
- minify?: boolean
3
+ preferredTsConfigPath?: string;
4
+ resolve?: Resolve;
5
+ cwd?: string;
6
+ splitting?: boolean;
7
+ minify?: boolean;
8
8
  };
9
9
  import { BunPlugin } from "bun";
10
10
  type PackageJson = {
11
11
  /** The parsed content of the package.json file */
12
- data: Record<string, any> | null
12
+ data: Record<string, any> | null;
13
13
  /** The path to the package.json file */
14
- path: string | null
14
+ path: string | null;
15
15
  };
16
16
  /**
17
17
  * Represents a Bun plugin that can be used with Bunup
18
18
  */
19
19
  type BunupBunPlugin = {
20
20
  /** Identifies this as a native Bun plugin */
21
- type: "bun"
21
+ type: "bun";
22
22
  /** Optional name for the plugin */
23
- name?: string
23
+ name?: string;
24
24
  /** The actual Bun plugin implementation */
25
- plugin: BunPlugin
25
+ plugin: BunPlugin;
26
26
  };
27
27
  /**
28
28
  * Represents the meta data of the build
29
29
  */
30
30
  type BuildMeta = {
31
31
  /** The package.json file */
32
- packageJson: PackageJson
32
+ packageJson: PackageJson;
33
33
  /** The root directory of the build */
34
- rootDir: string
34
+ rootDir: string;
35
35
  };
36
36
  type BuildOutputFile = {
37
37
  /**
@@ -39,37 +39,37 @@ type BuildOutputFile = {
39
39
  *
40
40
  * Undefined for non-entry point files (e.g., assets, sourcemaps, chunks)
41
41
  */
42
- entrypoint: string | undefined
42
+ entrypoint: string | undefined;
43
43
  /** The kind of the file */
44
- kind: "entry-point" | "chunk" | "asset" | "sourcemap" | "bytecode"
44
+ kind: "entry-point" | "chunk" | "asset" | "sourcemap" | "bytecode";
45
45
  /** Path to the generated file */
46
- fullPath: string
46
+ fullPath: string;
47
47
  /** Path to the generated file relative to the root directory */
48
- relativePathToRootDir: string
48
+ relativePathToRootDir: string;
49
49
  /** Path to the generated file relative to the output directory */
50
- relativePathToOutputDir: string
50
+ relativePathToOutputDir: string;
51
51
  /** Whether the file is a dts file */
52
- dts: boolean
52
+ dts: boolean;
53
53
  /** The format of the output file */
54
- format: Format
54
+ format: Format;
55
55
  };
56
56
  /**
57
57
  * Represents the output of a build operation
58
58
  */
59
59
  type BuildOutput = {
60
60
  /** Array of generated files with their paths and contents */
61
- files: BuildOutputFile[]
61
+ files: BuildOutputFile[];
62
62
  };
63
63
  /**
64
64
  * Context provided to build hooks
65
65
  */
66
66
  type BuildContext = {
67
67
  /** The build options that were used */
68
- options: BuildOptions
68
+ options: BuildOptions;
69
69
  /** The output of the build */
70
- output: BuildOutput
70
+ output: BuildOutput;
71
71
  /** The meta data of the build */
72
- meta: BuildMeta
72
+ meta: BuildMeta;
73
73
  };
74
74
  /**
75
75
  * Hooks that can be implemented by Bunup plugins
@@ -79,23 +79,23 @@ type BunupPluginHooks = {
79
79
  * Called when a build is successfully completed
80
80
  * @param ctx Build context containing options and output
81
81
  */
82
- onBuildDone?: (ctx: BuildContext) => MaybePromise<void>
82
+ onBuildDone?: (ctx: BuildContext) => MaybePromise<void>;
83
83
  /**
84
84
  * Called before a build starts
85
85
  * @param options Build options that will be used
86
86
  */
87
- onBuildStart?: (options: BuildOptions) => MaybePromise<void>
87
+ onBuildStart?: (options: BuildOptions) => MaybePromise<void>;
88
88
  };
89
89
  /**
90
90
  * Represents a Bunup-specific plugin
91
91
  */
92
92
  type BunupPlugin = {
93
93
  /** Identifies this as a Bunup-specific plugin */
94
- type: "bunup"
94
+ type: "bunup";
95
95
  /** Optional name for the plugin */
96
- name?: string
96
+ name?: string;
97
97
  /** The hooks implemented by this plugin */
98
- hooks: BunupPluginHooks
98
+ hooks: BunupPluginHooks;
99
99
  };
100
100
  /**
101
101
  * Union type representing all supported plugin types
@@ -170,7 +170,7 @@ interface BuildOptions {
170
170
  * Can also be configured with DtsOptions for more control
171
171
  */
172
172
  dts?: boolean | (Pick<GenerateDtsOptions, "resolve" | "splitting" | "minify"> & {
173
- entry?: string | string[]
173
+ entry?: string | string[];
174
174
  });
175
175
  /**
176
176
  * Path to a preferred tsconfig.json file to use for declaration generation
@@ -350,8 +350,8 @@ type WithOptional<
350
350
  type Arrayable<T> = T | T[];
351
351
  type DefineConfigItem = Omit<WithOptional<BuildOptions, "outDir" | "format">, "watch">;
352
352
  type DefineWorkspaceItem = {
353
- name: string
354
- root: string
355
- config: DefineConfigItem | DefineConfigItem[]
353
+ name: string;
354
+ root: string;
355
+ config: DefineConfigItem | DefineConfigItem[];
356
356
  };
357
357
  export { MaybePromise, Arrayable, DefineConfigItem, DefineWorkspaceItem, BuildContext, BunupPlugin, Plugin, BuildOptions };
@@ -4,11 +4,11 @@ import {
4
4
  } from "./chunk-5v78yfze.js";
5
5
  import {
6
6
  displayBunupGradientArt
7
- } from "./chunk-qy8akfev.js";
7
+ } from "./chunk-1y38m6th.js";
8
8
  import {
9
9
  formatListWithAnd,
10
10
  link
11
- } from "./chunk-y0jgbvca.js";
11
+ } from "./chunk-aq91x0fe.js";
12
12
 
13
13
  // src/cli/init.ts
14
14
  import fs from "fs";
package/dist/cli/index.js CHANGED
@@ -1,11 +1,10 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
3
3
  import {
4
- BUNUP_DOCS_URL,
5
4
  build,
6
5
  createBuildOptions
7
- } from "../chunk-b38k5sg1.js";
8
- import"../chunk-t9xma3m6.js";
6
+ } from "../chunk-6xsgpvht.js";
7
+ import"../chunk-p2gc4tkm.js";
9
8
  import {
10
9
  processLoadedConfigs
11
10
  } from "../chunk-5v78yfze.js";
@@ -22,14 +21,14 @@ import {
22
21
  logger,
23
22
  parseErrorMessage,
24
23
  setSilent
25
- } from "../chunk-y0jgbvca.js";
24
+ } from "../chunk-aq91x0fe.js";
26
25
 
27
26
  // src/cli/index.ts
28
27
  import { loadConfig } from "coffi";
29
28
  import pc3 from "picocolors";
30
29
  import { exec } from "tinyexec";
31
30
  // package.json
32
- var version = "0.8.49";
31
+ var version = "0.8.51";
33
32
 
34
33
  // src/watch.ts
35
34
  import path from "path";
@@ -88,6 +87,11 @@ async function watch(partialOptions, rootDir) {
88
87
 
89
88
  // src/cli/options.ts
90
89
  import pc2 from "picocolors";
90
+
91
+ // src/constants/index.ts
92
+ var BUNUP_DOCS_URL = "https://bunup.dev/docs";
93
+
94
+ // src/cli/options.ts
91
95
  var createHandlers = () => ({
92
96
  boolean: (key) => (value, options) => {
93
97
  options[key] = value === true || value === "true";
@@ -481,12 +485,12 @@ var parseCliOptions = (argv) => {
481
485
  async function main(args = Bun.argv.slice(2)) {
482
486
  const cliOptions = parseCliOptions(args);
483
487
  if (cliOptions.new) {
484
- const { newProject } = await import("../chunk-63s8ht8p.js");
488
+ const { newProject } = await import("../chunk-4wtd9wfc.js");
485
489
  await newProject();
486
490
  return;
487
491
  }
488
492
  if (cliOptions.init) {
489
- const { init } = await import("../chunk-htbpffg4.js");
493
+ const { init } = await import("../chunk-tamy0g3r.js");
490
494
  await init();
491
495
  return;
492
496
  }
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Arrayable, BuildOptions, DefineConfigItem, DefineWorkspaceItem, Plugin } from "./chunk-nsmdhpdd";
1
+ import { Arrayable, BuildOptions, DefineConfigItem, DefineWorkspaceItem, Plugin } from "./chunk-p2wczz52";
2
2
  declare function build(partialOptions: Partial<BuildOptions>, rootDir?: string): Promise<void>;
3
3
  declare function defineConfig(options: Arrayable<DefineConfigItem>): Arrayable<DefineConfigItem>;
4
4
  declare function defineWorkspace(options: DefineWorkspaceItem[]): DefineWorkspaceItem[];
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  // @bun
2
2
  import {
3
3
  build
4
- } from "./chunk-b38k5sg1.js";
5
- import"./chunk-t9xma3m6.js";
4
+ } from "./chunk-6xsgpvht.js";
5
+ import"./chunk-p2gc4tkm.js";
6
6
  import"./chunk-5v78yfze.js";
7
- import"./chunk-y0jgbvca.js";
7
+ import"./chunk-aq91x0fe.js";
8
8
  // src/define.ts
9
9
  function defineConfig(options) {
10
10
  return options;
package/dist/plugins.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { BuildContext, BunupPlugin, MaybePromise, Plugin } from "./chunk-nsmdhpdd";
1
+ import { BuildContext, BunupPlugin, MaybePromise, Plugin } from "./chunk-p2wczz52";
2
2
  /**
3
3
  * A plugin that copies files and directories to the output directory.
4
4
  *
@@ -30,7 +30,7 @@ interface ExportsPluginOptions {
30
30
  */
31
31
  declare function exports(options?: ExportsPluginOptions): BunupPlugin;
32
32
  type InjectStylesPluginOptions = Pick<import("lightningcss").TransformOptions<import("lightningcss").CustomAtRules>, "sourceMap" | "inputSourceMap" | "targets" | "nonStandard" | "minify" | "pseudoClasses" | "unusedSymbols" | "errorRecovery" | "visitor" | "customAtRules" | "include" | "exclude" | "drafts"> & {
33
- inject?: (css: string, filePath: string) => MaybePromise<string>
33
+ inject?: (css: string, filePath: string) => MaybePromise<string>;
34
34
  };
35
35
  /**
36
36
  * A plugin that injects styles into the document head.
package/dist/plugins.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  getPackageForPlugin
4
- } from "./chunk-t9xma3m6.js";
4
+ } from "./chunk-p2gc4tkm.js";
5
5
  import {
6
6
  CSS_RE,
7
7
  JS_DTS_RE,
@@ -9,7 +9,7 @@ import {
9
9
  cleanPath,
10
10
  isDirectoryPath,
11
11
  logger
12
- } from "./chunk-y0jgbvca.js";
12
+ } from "./chunk-aq91x0fe.js";
13
13
 
14
14
  // src/plugins/built-in/copy.ts
15
15
  import { basename, join } from "path";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bunup",
3
3
  "description": "⚡ A blazing-fast build tool for your libraries built with Bun.",
4
- "version": "0.8.49",
4
+ "version": "0.8.51",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist"