bunup 0.8.61 → 0.8.63
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 +2 -2
- package/dist/cli/index.js +2 -2
- package/dist/index.js +1 -1
- package/dist/plugins.d.ts +19 -1
- package/dist/plugins.js +61 -0
- package/dist/shared/{chunk-qsy6j4kg.js → chunk-e55jtfn8.js} +1 -34
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ Bunup is the **blazing-fast build tool** for TypeScript libraries, designed for
|
|
|
26
26
|
- ⚡ **Blazing Fast**: Lightning-quick builds and instant rebuilds.
|
|
27
27
|
- 📝 **Best-in-Class TypeScript Declarations**: Clean, minimal and accurate `.d.ts` files generated automatically.
|
|
28
28
|
- 📦 **ESM by Default**: Modern ESM output by default.
|
|
29
|
-
- 🪓 **Declaration Splitting**:
|
|
29
|
+
- 🪓 **Declaration Splitting**: Split shared types for smaller and clean declaration bundles.
|
|
30
30
|
- 🔋 **Batteries Included**: Auto-generate package exports, detect unused dependencies and exports, and more.
|
|
31
31
|
- 🚀 **Zero-Config Simplicity**: Preconfigured for productivity—just write code and build.
|
|
32
32
|
- 📦 **[Workspace](https://bunup.dev/docs/guide/workspaces) Ready**: Build multiple packages from a single config and command.
|
|
@@ -34,7 +34,7 @@ Bunup is the **blazing-fast build tool** for TypeScript libraries, designed for
|
|
|
34
34
|
|
|
35
35
|
## 📚 Documentation
|
|
36
36
|
|
|
37
|
-
To get started, visit the [documentation](https://bunup.dev
|
|
37
|
+
To get started, visit the [documentation](https://bunup.dev).
|
|
38
38
|
|
|
39
39
|
## ❤️ Contributing
|
|
40
40
|
|
package/dist/cli/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import {
|
|
4
4
|
build,
|
|
5
5
|
createBuildOptions
|
|
6
|
-
} from "../shared/chunk-
|
|
6
|
+
} from "../shared/chunk-e55jtfn8.js";
|
|
7
7
|
import"../shared/chunk-zj5506zn.js";
|
|
8
8
|
import {
|
|
9
9
|
processLoadedConfigs
|
|
@@ -28,7 +28,7 @@ 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.
|
|
31
|
+
var version = "0.8.63";
|
|
32
32
|
|
|
33
33
|
// src/watch.ts
|
|
34
34
|
import path from "path";
|
package/dist/index.js
CHANGED
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
|
-
|
|
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
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
JS_DTS_RE,
|
|
8
8
|
JS_TS_RE,
|
|
9
9
|
cleanPath,
|
|
10
|
+
formatListWithAnd,
|
|
10
11
|
isDirectoryPath,
|
|
11
12
|
logger
|
|
12
13
|
} from "./shared/chunk-fw4fyhnc.js";
|
|
@@ -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,
|
|
@@ -20,7 +20,6 @@ import {
|
|
|
20
20
|
getPackageDeps,
|
|
21
21
|
getShortFilePath,
|
|
22
22
|
isTypeScriptFile,
|
|
23
|
-
link,
|
|
24
23
|
logTable,
|
|
25
24
|
logger,
|
|
26
25
|
parseErrorMessage,
|
|
@@ -33,38 +32,6 @@ 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(),
|
|
129
|
+
plugins: [...options.plugins ?? [], useClient(), report()]
|
|
163
130
|
};
|
|
164
131
|
}
|
|
165
132
|
function getResolvedMinify(options) {
|
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.
|
|
4
|
+
"version": "0.8.63",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist"
|
|
@@ -53,12 +53,12 @@
|
|
|
53
53
|
"picocolors": "^1.1.1",
|
|
54
54
|
"replace-in-file": "^8.3.0",
|
|
55
55
|
"tinyexec": "^1.0.1",
|
|
56
|
-
"typeroll": "^0.6.
|
|
56
|
+
"typeroll": "^0.6.20"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@babel/types": "^7.28.1",
|
|
60
60
|
"@biomejs/biome": "2.0.0",
|
|
61
|
-
"@types/bun": "^1.2.
|
|
61
|
+
"@types/bun": "^1.2.19",
|
|
62
62
|
"bumpp": "^10.2.0",
|
|
63
63
|
"husky": "^9.1.7",
|
|
64
64
|
"lightningcss": "^1.30.1",
|