bunup 0.8.60 → 0.8.62

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
@@ -23,15 +23,18 @@ Bunup is the **blazing-fast build tool** for TypeScript libraries, designed for
23
23
 
24
24
  ## Key Features
25
25
 
26
- - ⚡ **Extremely Fast**: Lightning-fast builds and rebuilds.
27
- - 🚀 **Easy to Use**: Bunup preconfigures everything you need out-of-the-box. Just focus on your code.
28
- - 📦 **[Workspace](https://bunup.dev/docs/guide/workspaces) Support**: Build multiple packages within one config file and command.
29
- - 🔄 **Tsup Familiarity**: Familiar tsup-like CLI and config.
30
- - 🎯 **Bun Target**: First-class bundling support for libraries that are intended to run on Bun.
26
+ - ⚡ **Blazing Fast**: Lightning-quick builds and instant rebuilds.
27
+ - 📝 **Best-in-Class TypeScript Declarations**: Clean, minimal and accurate `.d.ts` files generated automatically.
28
+ - 📦 **ESM by Default**: Modern ESM output by default.
29
+ - 🪓 **Declaration Splitting**: Split shared types for smaller and clean declaration bundles.
30
+ - 🔋 **Batteries Included**: Auto-generate package exports, detect unused dependencies and exports, and more.
31
+ - 🚀 **Zero-Config Simplicity**: Preconfigured for productivity—just write code and build.
32
+ - 📦 **[Workspace](https://bunup.dev/docs/guide/workspaces) Ready**: Build multiple packages from a single config and command.
33
+ - 🔄 **Tsup-Compatible**: Familiar CLI and config for easy migration from tsup.
31
34
 
32
35
  ## 📚 Documentation
33
36
 
34
- To get started, visit the [documentation](https://bunup.dev/docs).
37
+ To get started, visit the [documentation](https://bunup.dev).
35
38
 
36
39
  ## ❤️ Contributing
37
40
 
package/dist/cli/index.js CHANGED
@@ -3,11 +3,11 @@
3
3
  import {
4
4
  build,
5
5
  createBuildOptions
6
- } from "../chunk-nbap2x28.js";
7
- import"../chunk-2hw0xn1d.js";
6
+ } from "../shared/chunk-e55jtfn8.js";
7
+ import"../shared/chunk-zj5506zn.js";
8
8
  import {
9
9
  processLoadedConfigs
10
- } from "../chunk-gh7z7s46.js";
10
+ } from "../shared/chunk-295440tx.js";
11
11
  import {
12
12
  BunupCLIError,
13
13
  BunupWatchError,
@@ -21,14 +21,14 @@ import {
21
21
  logger,
22
22
  parseErrorMessage,
23
23
  setSilent
24
- } from "../chunk-nha7rah1.js";
24
+ } from "../shared/chunk-fw4fyhnc.js";
25
25
 
26
26
  // src/cli/index.ts
27
27
  import { loadConfig } from "coffi";
28
28
  import pc3 from "picocolors";
29
29
  import { exec } from "tinyexec";
30
30
  // package.json
31
- var version = "0.8.60";
31
+ var version = "0.8.62";
32
32
 
33
33
  // src/watch.ts
34
34
  import path from "path";
@@ -482,12 +482,12 @@ var parseCliOptions = (argv) => {
482
482
  async function main(args = Bun.argv.slice(2)) {
483
483
  const cliOptions = parseCliOptions(args);
484
484
  if (cliOptions.new) {
485
- const { newProject } = await import("../chunk-yqvr1jcz.js");
485
+ const { newProject } = await import("../shared/chunk-vdgwvbgq.js");
486
486
  await newProject();
487
487
  return;
488
488
  }
489
489
  if (cliOptions.init) {
490
- const { init } = await import("../chunk-rf24zdyp.js");
490
+ const { init } = await import("../shared/chunk-hraxj72e.js");
491
491
  await init();
492
492
  return;
493
493
  }
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  // @bun
2
2
  import {
3
3
  build
4
- } from "./chunk-nbap2x28.js";
5
- import"./chunk-2hw0xn1d.js";
6
- import"./chunk-gh7z7s46.js";
7
- import"./chunk-nha7rah1.js";
4
+ } from "./shared/chunk-e55jtfn8.js";
5
+ import"./shared/chunk-zj5506zn.js";
6
+ import"./shared/chunk-295440tx.js";
7
+ import"./shared/chunk-fw4fyhnc.js";
8
8
  // src/define.ts
9
9
  function defineConfig(options) {
10
10
  return options;
package/dist/plugins.d.ts CHANGED
@@ -384,4 +384,22 @@ declare function injectStyles(options?: InjectStylesPluginOptions): Plugin;
384
384
  * @see https://bunup.dev/docs/plugins/shims
385
385
  */
386
386
  declare function shims(): Plugin;
387
- export { shims, injectStyles, exports, copy };
387
+ interface UnusedOptions {
388
+ /**
389
+ * The level of reporting for unused dependencies
390
+ * @default 'warn'
391
+ */
392
+ level?: "warn" | "error";
393
+ /**
394
+ * Dependencies to ignore when checking for unused dependencies
395
+ * @default []
396
+ */
397
+ ignore?: string[];
398
+ }
399
+ /**
400
+ * A plugin that detects and reports unused dependencies.
401
+ *
402
+ * @see https://bunup.dev/docs/plugins/unused
403
+ */
404
+ declare function unused(options?: UnusedOptions): Plugin;
405
+ export { unused, shims, injectStyles, exports, copy, UnusedOptions };
package/dist/plugins.js CHANGED
@@ -1,15 +1,16 @@
1
1
  // @bun
2
2
  import {
3
3
  getPackageForPlugin
4
- } from "./chunk-2hw0xn1d.js";
4
+ } from "./shared/chunk-zj5506zn.js";
5
5
  import {
6
6
  CSS_RE,
7
7
  JS_DTS_RE,
8
8
  JS_TS_RE,
9
9
  cleanPath,
10
+ formatListWithAnd,
10
11
  isDirectoryPath,
11
12
  logger
12
- } from "./chunk-nha7rah1.js";
13
+ } from "./shared/chunk-fw4fyhnc.js";
13
14
 
14
15
  // src/plugins/built-in/copy.ts
15
16
  import { basename, join } from "path";
@@ -369,7 +370,67 @@ const importMetaUrl = pathToFileURL(__filename).href;
369
370
  }
370
371
  };
371
372
  }
373
+ // src/plugins/built-in/unused.ts
374
+ import pc from "picocolors";
375
+ function unused(options = {}) {
376
+ const { level = "warn", ignore = [] } = options;
377
+ return {
378
+ type: "bunup",
379
+ name: "unused",
380
+ hooks: {
381
+ onBuildDone: async (ctx) => {
382
+ const { options: buildOptions, output, meta } = ctx;
383
+ const transpiler = new Bun.Transpiler({
384
+ loader: "js"
385
+ });
386
+ const jsFiles = output.files.filter((file) => file.fullPath.endsWith(".js"));
387
+ const packageDependencies = typeof meta.packageJson.data?.dependencies === "object" ? meta.packageJson.data.dependencies : {};
388
+ const externals = [
389
+ ...buildOptions.external ?? [],
390
+ ...buildOptions.noExternal ?? []
391
+ ];
392
+ const allImportPaths = new Set;
393
+ for (const file of jsFiles) {
394
+ const code = await Bun.file(file.fullPath).text();
395
+ const codeWithoutShebang = code.replace(/^#!.*$/m, "");
396
+ const importPaths = transpiler.scanImports(codeWithoutShebang).map((imp) => imp.path);
397
+ for (const importPath of importPaths) {
398
+ if (externals.some((ex) => typeof ex === "string" ? importPath.startsWith(ex) : ex.test(importPath)))
399
+ continue;
400
+ if (importPath.startsWith("node:") || importPath.startsWith("bun:"))
401
+ continue;
402
+ allImportPaths.add(importPath);
403
+ }
404
+ }
405
+ const allDependencies = Object.keys(packageDependencies);
406
+ const unusedDependencies = allDependencies.filter((dependency) => {
407
+ if (ignore.includes(dependency))
408
+ return false;
409
+ return !Array.from(allImportPaths).some((importPath) => importPath === dependency || importPath.startsWith(`${dependency}/`));
410
+ });
411
+ if (unusedDependencies.length > 0) {
412
+ const count = unusedDependencies.length;
413
+ const depText = count === 1 ? "dependency" : "dependencies";
414
+ const coloredDeps = formatListWithAnd(unusedDependencies.map((dep) => pc.yellow(dep)));
415
+ const removeCommand = pc.cyan(`bun remove ${unusedDependencies.join(" ")}`);
416
+ const message = [
417
+ `
418
+ Your project has ${count} unused ${depText}: ${coloredDeps}.`,
419
+ `You can remove ${count === 1 ? "it" : "them"} with ${removeCommand}`
420
+ ].join(" ");
421
+ if (level === "error") {
422
+ console.error(pc.red(message));
423
+ process.exit(1);
424
+ } else {
425
+ console.log(message);
426
+ }
427
+ }
428
+ }
429
+ }
430
+ };
431
+ }
372
432
  export {
433
+ unused,
373
434
  shims,
374
435
  injectStyles,
375
436
  exports,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  logger
3
- } from "./chunk-nha7rah1.js";
3
+ } from "./chunk-fw4fyhnc.js";
4
4
 
5
5
  // src/cli/utils.ts
6
6
  import pc from "picocolors";
@@ -3,10 +3,10 @@ import {
3
3
  filterBunupPlugins,
4
4
  runPluginBuildDoneHooks,
5
5
  runPluginBuildStartHooks
6
- } from "./chunk-2hw0xn1d.js";
6
+ } from "./chunk-zj5506zn.js";
7
7
  import {
8
8
  loadPackageJson
9
- } from "./chunk-gh7z7s46.js";
9
+ } from "./chunk-295440tx.js";
10
10
  import {
11
11
  BunupBuildError,
12
12
  BunupDTSBuildError,
@@ -20,51 +20,18 @@ import {
20
20
  getPackageDeps,
21
21
  getShortFilePath,
22
22
  isTypeScriptFile,
23
- link,
24
23
  logTable,
25
24
  logger,
26
25
  parseErrorMessage,
27
26
  setSilent,
28
27
  silent
29
- } from "./chunk-nha7rah1.js";
28
+ } from "./chunk-fw4fyhnc.js";
30
29
 
31
30
  // src/build.ts
32
31
  import path from "path";
33
32
  import pc2 from "picocolors";
34
33
  import { generateDts, logIsolatedDeclarationErrors } from "typeroll";
35
34
 
36
- // src/plugins/internal/linter.ts
37
- var rules = [
38
- {
39
- check: (ctx) => {
40
- const hasMinification = !!(ctx.options.minify || ctx.options.minifyWhitespace || ctx.options.minifyIdentifiers || ctx.options.minifySyntax);
41
- return hasMinification && !ctx.options.sourcemap;
42
- },
43
- message: `You are using minification without source maps. Consider enabling source maps to help with debugging minified code. Learn more: ${link("https://bunup.dev/docs/guide/options#source-maps")}`,
44
- logLevel: "recommended"
45
- }
46
- ];
47
- function linter() {
48
- return {
49
- type: "bunup",
50
- name: "linter",
51
- hooks: {
52
- onBuildDone: (ctx) => {
53
- let hasWarnings = false;
54
- for (const rule of rules) {
55
- if (rule.check(ctx)) {
56
- if (!hasWarnings) {
57
- logger.space();
58
- }
59
- logger[rule.logLevel ?? "warn"](rule.message);
60
- hasWarnings = true;
61
- }
62
- }
63
- }
64
- }
65
- };
66
- }
67
-
68
35
  // src/plugins/internal/report.ts
69
36
  import pc from "picocolors";
70
37
  function report() {
@@ -159,7 +126,7 @@ function createBuildOptions(partialOptions) {
159
126
  };
160
127
  return {
161
128
  ...options,
162
- plugins: [...options.plugins ?? [], useClient(), linter(), report()]
129
+ plugins: [...options.plugins ?? [], useClient(), report()]
163
130
  };
164
131
  }
165
132
  function getResolvedMinify(options) {
@@ -1,14 +1,14 @@
1
1
  // @bun
2
2
  import {
3
3
  loadPackageJson
4
- } from "./chunk-gh7z7s46.js";
4
+ } from "./chunk-295440tx.js";
5
5
  import {
6
6
  displayBunupGradientArt
7
- } from "./chunk-b5fbznhk.js";
7
+ } from "./chunk-22a2den8.js";
8
8
  import {
9
9
  formatListWithAnd,
10
10
  link
11
- } from "./chunk-nha7rah1.js";
11
+ } from "./chunk-fw4fyhnc.js";
12
12
 
13
13
  // src/cli/init.ts
14
14
  import fs from "fs";
@@ -1,11 +1,11 @@
1
1
  // @bun
2
2
  import {
3
3
  displayBunupGradientArt
4
- } from "./chunk-b5fbznhk.js";
4
+ } from "./chunk-22a2den8.js";
5
5
  import {
6
6
  link,
7
7
  pathExistsSync
8
- } from "./chunk-nha7rah1.js";
8
+ } from "./chunk-fw4fyhnc.js";
9
9
 
10
10
  // src/cli/new.ts
11
11
  import { renameSync } from "fs";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  BunupPluginError
3
- } from "./chunk-nha7rah1.js";
3
+ } from "./chunk-fw4fyhnc.js";
4
4
 
5
5
  // src/plugins/utils.ts
6
6
  import pc from "picocolors";
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.60",
4
+ "version": "0.8.62",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist"
@@ -56,13 +56,13 @@
56
56
  "typeroll": "^0.6.17"
57
57
  },
58
58
  "devDependencies": {
59
- "@babel/types": "^7.27.7",
59
+ "@babel/types": "^7.28.1",
60
60
  "@biomejs/biome": "2.0.0",
61
- "@types/bun": "^1.2.5",
62
- "bumpp": "^10.1.0",
61
+ "@types/bun": "^1.2.18",
62
+ "bumpp": "^10.2.0",
63
63
  "husky": "^9.1.7",
64
64
  "lightningcss": "^1.30.1",
65
- "lint-staged": "^15.5.1",
65
+ "lint-staged": "^15.5.2",
66
66
  "typescript": "^5.8.3"
67
67
  },
68
68
  "peerDependencies": {