bunup 0.9.3 → 0.10.0
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 +4 -6
- package/dist/cli/index.js +14 -17
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/plugins.d.ts +3 -3
- package/dist/plugins.js +10 -7
- package/dist/shared/{chunk-yrc9t3ye.js → chunk-66717fpt.js} +19 -94
- package/dist/shared/{chunk-7vsq500x.js → chunk-jkkyf16j.js} +1 -1
- package/package.json +4 -6
- /package/dist/shared/{chunk-wpey1xte.d.ts → chunk-d8x7sy99.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -20,15 +20,13 @@ Bunup is the **blazing-fast build tool** for TypeScript libraries, designed for
|
|
|
20
20
|
|
|
21
21
|
## Features
|
|
22
22
|
|
|
23
|
-
- ⚡ **
|
|
23
|
+
- ⚡ **Instant Builds**: Instant builds and rebuilds by default.
|
|
24
24
|
- 📝 **Top-Notch TypeScript Declarations**: Clean, minimal, accurate `.d.ts` files generated automatically.
|
|
25
25
|
- 📦 **ESM by Default**: Modern ESM output by default.
|
|
26
|
-
- 🪓 **Declaration Splitting**: Splits shared types for smaller, cleaner
|
|
27
|
-
- 🔥 **Declaration Minification**: Aggressively minifies and shortens type names while preserving public API
|
|
28
|
-
- 🔋 **Batteries Included**: Auto-generates package exports, detects unused dependencies
|
|
29
|
-
- 🚀 **Zero-Config Simplicity**: Preconfigured for productivity—just code and build.
|
|
26
|
+
- 🪓 **[Declaration Splitting](https://bunup.dev/docs/guide/typescript-declarations#declaration-splitting)**: Splits shared types for smaller, cleaner `.d.ts` files.
|
|
27
|
+
- 🔥 **[Declaration Minification](https://bunup.dev/docs/guide/typescript-declarations#minification)**: Aggressively minifies and shortens type names while preserving public API.
|
|
28
|
+
- 🔋 **Batteries Included**: Auto-generates package exports, detects unused dependencies, and more.
|
|
30
29
|
- 🏗️ **[Workspace](https://bunup.dev/docs/guide/workspaces) Ready**: Builds multiple packages from one config and command.
|
|
31
|
-
- 🔄 **Tsup Familiarity**: Familiar CLI and config for easy migration from tsup.
|
|
32
30
|
|
|
33
31
|
## 📚 Documentation
|
|
34
32
|
|
package/dist/cli/index.js
CHANGED
|
@@ -4,27 +4,27 @@ import {
|
|
|
4
4
|
build,
|
|
5
5
|
createBuildOptions,
|
|
6
6
|
processLoadedConfigs
|
|
7
|
-
} from "../shared/chunk-
|
|
7
|
+
} from "../shared/chunk-jkkyf16j.js";
|
|
8
8
|
import {
|
|
9
9
|
BunupCLIError,
|
|
10
10
|
BunupWatchError,
|
|
11
11
|
__require,
|
|
12
12
|
__toESM,
|
|
13
13
|
ensureArray,
|
|
14
|
-
formatTime,
|
|
15
14
|
getShortFilePath,
|
|
16
15
|
handleError,
|
|
17
16
|
handleErrorAndExit,
|
|
17
|
+
logTime,
|
|
18
18
|
logger,
|
|
19
19
|
parseErrorMessage,
|
|
20
20
|
setSilent
|
|
21
|
-
} from "../shared/chunk-
|
|
21
|
+
} from "../shared/chunk-66717fpt.js";
|
|
22
22
|
|
|
23
23
|
// src/cli/index.ts
|
|
24
24
|
import { loadConfig } from "coffi";
|
|
25
25
|
import pc3 from "picocolors";
|
|
26
26
|
// package.json
|
|
27
|
-
var version = "0.
|
|
27
|
+
var version = "0.10.0";
|
|
28
28
|
|
|
29
29
|
// src/watch.ts
|
|
30
30
|
import path from "path";
|
|
@@ -49,7 +49,8 @@ async function watch(partialOptions, rootDir) {
|
|
|
49
49
|
]
|
|
50
50
|
});
|
|
51
51
|
let isRebuilding = false;
|
|
52
|
-
|
|
52
|
+
let rebuildCount = 0;
|
|
53
|
+
const triggerRebuild = async (initial, changed) => {
|
|
53
54
|
if (isRebuilding) {
|
|
54
55
|
return;
|
|
55
56
|
}
|
|
@@ -57,20 +58,20 @@ async function watch(partialOptions, rootDir) {
|
|
|
57
58
|
try {
|
|
58
59
|
await new Promise((resolve) => setTimeout(resolve, 20));
|
|
59
60
|
const start = performance.now();
|
|
60
|
-
await build(options, rootDir);
|
|
61
|
+
await build({ ...options, silent: !initial }, rootDir);
|
|
61
62
|
if (!initial) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
});
|
|
63
|
+
console.clear();
|
|
64
|
+
console.log(`${rebuildCount > 1 ? pc.magenta(`[x${rebuildCount}] `) : ""}${pc.green(`Rebuilt in ${logTime(performance.now() - start)}`)}: ${changed}`);
|
|
65
65
|
}
|
|
66
|
+
rebuildCount++;
|
|
66
67
|
} catch (error) {
|
|
67
68
|
handleError(error);
|
|
68
69
|
} finally {
|
|
69
70
|
isRebuilding = false;
|
|
70
71
|
}
|
|
71
72
|
};
|
|
72
|
-
watcher.on("change", () => {
|
|
73
|
-
triggerRebuild();
|
|
73
|
+
watcher.on("change", (path2) => {
|
|
74
|
+
triggerRebuild(false, getShortFilePath(path2));
|
|
74
75
|
});
|
|
75
76
|
watcher.on("error", (error) => {
|
|
76
77
|
throw new BunupWatchError(`Watcher error: ${parseErrorMessage(error)}`);
|
|
@@ -512,13 +513,9 @@ async function main(args = Bun.argv.slice(2)) {
|
|
|
512
513
|
});
|
|
513
514
|
}));
|
|
514
515
|
const buildTimeMs = performance.now() - startTime;
|
|
515
|
-
|
|
516
|
-
logger.success(`Build completed in ${pc3.green(timeDisplay)}`);
|
|
516
|
+
logger.success(`Build completed in ${pc3.green(logTime(buildTimeMs))}`);
|
|
517
517
|
if (cliOptions.watch) {
|
|
518
|
-
logger.info("Watching for file changes..."
|
|
519
|
-
icon: "\uD83D\uDC40",
|
|
520
|
-
verticalSpace: true
|
|
521
|
-
});
|
|
518
|
+
logger.info(pc3.dim("Watching for file changes..."));
|
|
522
519
|
}
|
|
523
520
|
if (!cliOptions.watch) {
|
|
524
521
|
process.exit(process.exitCode ?? 0);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Arrayable, BuildOptions, DefineConfigItem, DefineWorkspaceItem, Plugin, WithOptional } from "./shared/chunk-
|
|
1
|
+
import { Arrayable, BuildOptions, DefineConfigItem, DefineWorkspaceItem, Plugin, WithOptional } from "./shared/chunk-d8x7sy99";
|
|
2
2
|
declare function build(partialOptions: Partial<BuildOptions>, rootDir?: string): Promise<void>;
|
|
3
3
|
declare function defineConfig(options: Arrayable<DefineConfigItem>): Arrayable<DefineConfigItem>;
|
|
4
|
-
declare function defineWorkspace(options: WithOptional<DefineWorkspaceItem, "config">[], sharedOptions?: DefineConfigItem): DefineWorkspaceItem[];
|
|
4
|
+
declare function defineWorkspace(options: WithOptional<DefineWorkspaceItem, "config">[], sharedOptions?: Partial<DefineConfigItem>): DefineWorkspaceItem[];
|
|
5
5
|
export { defineWorkspace, defineConfig, build, Plugin, DefineWorkspaceItem, DefineConfigItem, BuildOptions };
|
package/dist/index.js
CHANGED
package/dist/plugins.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { BuildContext, BunupPlugin, MaybePromise, Plugin } from "./shared/chunk-
|
|
1
|
+
import { BuildContext, BunupPlugin, MaybePromise, Plugin } from "./shared/chunk-d8x7sy99";
|
|
2
2
|
/**
|
|
3
3
|
* A plugin that copies files and directories to the output directory.
|
|
4
4
|
*
|
|
5
|
-
* @param
|
|
5
|
+
* @param pattern - String or array of glob patterns to match files for copying. Patterns starting with '!' exclude matching files.
|
|
6
6
|
* @param outPath - Optional output path. If not provided, uses the build output directory
|
|
7
7
|
* @see https://bunup.dev/docs/plugins/copy
|
|
8
8
|
*/
|
|
9
|
-
declare function copy(
|
|
9
|
+
declare function copy(pattern: string | string[], outPath?: string): BunupPlugin;
|
|
10
10
|
type CustomExports = Record<string, string | Record<string, string | Record<string, string>>>;
|
|
11
11
|
type Exclude = ((ctx: BuildContext) => string[] | undefined) | string[];
|
|
12
12
|
interface ExportsPluginOptions {
|
package/dist/plugins.js
CHANGED
|
@@ -4,29 +4,30 @@ import {
|
|
|
4
4
|
JS_DTS_RE,
|
|
5
5
|
JS_TS_RE,
|
|
6
6
|
cleanPath,
|
|
7
|
+
ensureArray,
|
|
7
8
|
formatListWithAnd,
|
|
8
9
|
getPackageForPlugin,
|
|
9
10
|
isDirectoryPath,
|
|
10
11
|
logger
|
|
11
|
-
} from "./shared/chunk-
|
|
12
|
+
} from "./shared/chunk-66717fpt.js";
|
|
12
13
|
|
|
13
14
|
// src/plugins/built-in/copy.ts
|
|
14
15
|
import { basename, join } from "path";
|
|
15
|
-
function copy(
|
|
16
|
+
function copy(pattern, outPath) {
|
|
16
17
|
return {
|
|
17
18
|
type: "bunup",
|
|
18
19
|
name: "copy",
|
|
19
20
|
hooks: {
|
|
20
21
|
onBuildDone: async ({ options, meta }) => {
|
|
21
22
|
const destinationPath = outPath || options.outDir;
|
|
22
|
-
for (const
|
|
23
|
-
const glob = new Bun.Glob(
|
|
23
|
+
for (const p of ensureArray(pattern)) {
|
|
24
|
+
const glob = new Bun.Glob(p);
|
|
24
25
|
for await (const filePath of glob.scan({
|
|
25
26
|
cwd: meta.rootDir,
|
|
26
27
|
dot: true
|
|
27
28
|
})) {
|
|
28
29
|
const sourceFile = Bun.file(join(meta.rootDir, filePath));
|
|
29
|
-
await Bun.write(
|
|
30
|
+
await Bun.write(isDirectoryPath(destinationPath) ? join(meta.rootDir, destinationPath, basename(filePath)) : join(meta.rootDir, destinationPath), sourceFile);
|
|
30
31
|
}
|
|
31
32
|
}
|
|
32
33
|
}
|
|
@@ -35,7 +36,6 @@ function copy(patterns, outPath) {
|
|
|
35
36
|
}
|
|
36
37
|
// src/plugins/built-in/exports.ts
|
|
37
38
|
import path from "path";
|
|
38
|
-
import equal from "fast-deep-equal";
|
|
39
39
|
function exports(options = {}) {
|
|
40
40
|
return {
|
|
41
41
|
type: "bunup",
|
|
@@ -57,7 +57,7 @@ async function processPackageJsonExports(ctx, options) {
|
|
|
57
57
|
const updatedFiles = createUpdatedFilesArray(meta.packageJson.data, buildOptions.outDir);
|
|
58
58
|
const mergedExports = mergeCustomExportsWithGenerated(exportsField, options.customExports, ctx);
|
|
59
59
|
const newPackageJson = createUpdatedPackageJson(meta.packageJson.data, entryPoints, mergedExports, updatedFiles);
|
|
60
|
-
if (
|
|
60
|
+
if (Bun.deepEquals(newPackageJson, meta.packageJson.data)) {
|
|
61
61
|
return;
|
|
62
62
|
}
|
|
63
63
|
await Bun.write(meta.packageJson.path, JSON.stringify(newPackageJson, null, 2));
|
|
@@ -384,6 +384,9 @@ function unused(options = {}) {
|
|
|
384
384
|
hooks: {
|
|
385
385
|
onBuildDone: async (ctx) => {
|
|
386
386
|
const { options: buildOptions, output, meta } = ctx;
|
|
387
|
+
if (buildOptions.watch) {
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
387
390
|
const transpiler = new Bun.Transpiler({
|
|
388
391
|
loader: "js"
|
|
389
392
|
});
|
|
@@ -141,28 +141,31 @@ function logTable(columns, data, footer) {
|
|
|
141
141
|
const pad = (str, width, align) => {
|
|
142
142
|
return align === "left" ? str.padEnd(width) : str.padStart(width);
|
|
143
143
|
};
|
|
144
|
-
const headerRow = columns.map((col) => pad(col.header, widths[col.header], col.align)).join(pc.
|
|
145
|
-
console.log(pc.
|
|
144
|
+
const headerRow = columns.map((col) => pad(col.header, widths[col.header], col.align)).join(pc.dim(" | "));
|
|
145
|
+
console.log(pc.dim(headerRow));
|
|
146
146
|
const separator = columns.map((col) => "-".repeat(widths[col.header])).join(" | ");
|
|
147
|
-
console.log(pc.
|
|
147
|
+
console.log(pc.dim(separator));
|
|
148
148
|
for (const row of data) {
|
|
149
149
|
const rowStr = columns.map((col) => {
|
|
150
150
|
const value = row[col.header] || "";
|
|
151
151
|
const padded = pad(value, widths[col.header], col.align);
|
|
152
152
|
return col.color ? col.color(padded) : padded;
|
|
153
|
-
}).join(pc.
|
|
153
|
+
}).join(pc.dim(" | "));
|
|
154
154
|
console.log(rowStr);
|
|
155
155
|
}
|
|
156
|
-
console.log(pc.
|
|
156
|
+
console.log(pc.dim(separator));
|
|
157
157
|
if (footer) {
|
|
158
158
|
const footerRow = columns.map((col) => {
|
|
159
159
|
const value = footer[col.header] || "";
|
|
160
160
|
const padded = pad(value, widths[col.header], col.align);
|
|
161
161
|
return padded;
|
|
162
|
-
}).join(pc.
|
|
162
|
+
}).join(pc.dim(" | "));
|
|
163
163
|
console.log(footerRow);
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
|
+
function logTime(ms) {
|
|
167
|
+
return ms >= 1000 ? pc.green(`${(ms / 1000).toFixed(2)}s`) : pc.green(`${Math.round(ms)}ms`);
|
|
168
|
+
}
|
|
166
169
|
var link = (url, label) => {
|
|
167
170
|
if (!label) {
|
|
168
171
|
label = url;
|
|
@@ -233,7 +236,7 @@ var KNOWN_ERRORS = [
|
|
|
233
236
|
pattern: /has already been exported. Exported identifiers must be unique./i,
|
|
234
237
|
errorType: "DTS ERROR",
|
|
235
238
|
logSolution: () => {
|
|
236
|
-
logger.log("An error occurred while bundling dts files. This issue occurs when dts splitting is enabled due to a bug in the Bun bundler. Please ping the GitHub issue to help get it fixed faster: " + link("https://github.com/oven-sh/bun/issues/5344") + ". To fix this issue for now, you can disable dts splitting by removing " + pc2.
|
|
239
|
+
logger.log("An error occurred while bundling dts files. This issue occurs when dts splitting is enabled due to a bug in the Bun bundler. Please ping the GitHub issue to help get it fixed faster: " + link("https://github.com/oven-sh/bun/issues/5344") + ". To fix this issue for now, you can disable dts splitting by removing " + pc2.dim("dts: { splitting: true }") + " from your config." + " You can re-enable it once the issue is fixed.");
|
|
237
240
|
}
|
|
238
241
|
}
|
|
239
242
|
];
|
|
@@ -290,81 +293,6 @@ var handleErrorAndExit = (error, context) => {
|
|
|
290
293
|
import fs from "fs/promises";
|
|
291
294
|
import path, { normalize } from "path";
|
|
292
295
|
|
|
293
|
-
// node_modules/std-env/dist/index.mjs
|
|
294
|
-
var r = Object.create(null);
|
|
295
|
-
var i = (e) => globalThis.process?.env || import.meta.env || globalThis.Deno?.env.toObject() || globalThis.__env__ || (e ? r : globalThis);
|
|
296
|
-
var o = new Proxy(r, { get(e, s) {
|
|
297
|
-
return i()[s] ?? r[s];
|
|
298
|
-
}, has(e, s) {
|
|
299
|
-
const E = i();
|
|
300
|
-
return s in E || s in r;
|
|
301
|
-
}, set(e, s, E) {
|
|
302
|
-
const B = i(true);
|
|
303
|
-
return B[s] = E, true;
|
|
304
|
-
}, deleteProperty(e, s) {
|
|
305
|
-
if (!s)
|
|
306
|
-
return false;
|
|
307
|
-
const E = i(true);
|
|
308
|
-
return delete E[s], true;
|
|
309
|
-
}, ownKeys() {
|
|
310
|
-
const e = i(true);
|
|
311
|
-
return Object.keys(e);
|
|
312
|
-
} });
|
|
313
|
-
var t = typeof process < "u" && process.env && "development" || "";
|
|
314
|
-
var f = [["APPVEYOR"], ["AWS_AMPLIFY", "AWS_APP_ID", { ci: true }], ["AZURE_PIPELINES", "SYSTEM_TEAMFOUNDATIONCOLLECTIONURI"], ["AZURE_STATIC", "INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN"], ["APPCIRCLE", "AC_APPCIRCLE"], ["BAMBOO", "bamboo_planKey"], ["BITBUCKET", "BITBUCKET_COMMIT"], ["BITRISE", "BITRISE_IO"], ["BUDDY", "BUDDY_WORKSPACE_ID"], ["BUILDKITE"], ["CIRCLE", "CIRCLECI"], ["CIRRUS", "CIRRUS_CI"], ["CLOUDFLARE_PAGES", "CF_PAGES", { ci: true }], ["CLOUDFLARE_WORKERS", "WORKERS_CI", { ci: true }], ["CODEBUILD", "CODEBUILD_BUILD_ARN"], ["CODEFRESH", "CF_BUILD_ID"], ["DRONE"], ["DRONE", "DRONE_BUILD_EVENT"], ["DSARI"], ["GITHUB_ACTIONS"], ["GITLAB", "GITLAB_CI"], ["GITLAB", "CI_MERGE_REQUEST_ID"], ["GOCD", "GO_PIPELINE_LABEL"], ["LAYERCI"], ["HUDSON", "HUDSON_URL"], ["JENKINS", "JENKINS_URL"], ["MAGNUM"], ["NETLIFY"], ["NETLIFY", "NETLIFY_LOCAL", { ci: false }], ["NEVERCODE"], ["RENDER"], ["SAIL", "SAILCI"], ["SEMAPHORE"], ["SCREWDRIVER"], ["SHIPPABLE"], ["SOLANO", "TDDIUM"], ["STRIDER"], ["TEAMCITY", "TEAMCITY_VERSION"], ["TRAVIS"], ["VERCEL", "NOW_BUILDER"], ["VERCEL", "VERCEL", { ci: false }], ["VERCEL", "VERCEL_ENV", { ci: false }], ["APPCENTER", "APPCENTER_BUILD_ID"], ["CODESANDBOX", "CODESANDBOX_SSE", { ci: false }], ["CODESANDBOX", "CODESANDBOX_HOST", { ci: false }], ["STACKBLITZ"], ["STORMKIT"], ["CLEAVR"], ["ZEABUR"], ["CODESPHERE", "CODESPHERE_APP_ID", { ci: true }], ["RAILWAY", "RAILWAY_PROJECT_ID"], ["RAILWAY", "RAILWAY_SERVICE_ID"], ["DENO-DEPLOY", "DENO_DEPLOYMENT_ID"], ["FIREBASE_APP_HOSTING", "FIREBASE_APP_HOSTING", { ci: true }]];
|
|
315
|
-
function b() {
|
|
316
|
-
if (globalThis.process?.env)
|
|
317
|
-
for (const e of f) {
|
|
318
|
-
const s = e[1] || e[0];
|
|
319
|
-
if (globalThis.process?.env[s])
|
|
320
|
-
return { name: e[0].toLowerCase(), ...e[2] };
|
|
321
|
-
}
|
|
322
|
-
return globalThis.process?.env?.SHELL === "/bin/jsh" && globalThis.process?.versions?.webcontainer ? { name: "stackblitz", ci: false } : { name: "", ci: false };
|
|
323
|
-
}
|
|
324
|
-
var l = b();
|
|
325
|
-
var p = l.name;
|
|
326
|
-
function n(e) {
|
|
327
|
-
return e ? e !== "false" : false;
|
|
328
|
-
}
|
|
329
|
-
var I = globalThis.process?.platform || "";
|
|
330
|
-
var T = n(o.CI) || l.ci !== false;
|
|
331
|
-
var R = n(globalThis.process?.stdout && globalThis.process?.stdout.isTTY);
|
|
332
|
-
var U = typeof window < "u";
|
|
333
|
-
var d = n(o.DEBUG);
|
|
334
|
-
var a = t === "test" || n(o.TEST);
|
|
335
|
-
var v = n(o.MINIMAL) || T || a || !R;
|
|
336
|
-
var A = /^win/i.test(I);
|
|
337
|
-
var M = /^linux/i.test(I);
|
|
338
|
-
var m = /^darwin/i.test(I);
|
|
339
|
-
var Y = !n(o.NO_COLOR) && (n(o.FORCE_COLOR) || (R || A) && o.TERM !== "dumb" || T);
|
|
340
|
-
var C = (globalThis.process?.versions?.node || "").replace(/^v/, "") || null;
|
|
341
|
-
var V = Number(C?.split(".")[0]) || null;
|
|
342
|
-
var W = globalThis.process || Object.create(null);
|
|
343
|
-
var _ = { versions: {} };
|
|
344
|
-
var y = new Proxy(W, { get(e, s) {
|
|
345
|
-
if (s === "env")
|
|
346
|
-
return o;
|
|
347
|
-
if (s in e)
|
|
348
|
-
return e[s];
|
|
349
|
-
if (s in _)
|
|
350
|
-
return _[s];
|
|
351
|
-
} });
|
|
352
|
-
var O = globalThis.process?.release?.name === "node";
|
|
353
|
-
var c = !!globalThis.Bun || !!globalThis.process?.versions?.bun;
|
|
354
|
-
var D = !!globalThis.Deno;
|
|
355
|
-
var L = !!globalThis.fastly;
|
|
356
|
-
var S = !!globalThis.Netlify;
|
|
357
|
-
var u = !!globalThis.EdgeRuntime;
|
|
358
|
-
var N = globalThis.navigator?.userAgent === "Cloudflare-Workers";
|
|
359
|
-
var F = [[S, "netlify"], [u, "edge-light"], [N, "workerd"], [L, "fastly"], [D, "deno"], [c, "bun"], [O, "node"]];
|
|
360
|
-
function G() {
|
|
361
|
-
const e = F.find((s) => s[0]);
|
|
362
|
-
if (e)
|
|
363
|
-
return { name: e[1] };
|
|
364
|
-
}
|
|
365
|
-
var P = G();
|
|
366
|
-
var K = P?.name || "";
|
|
367
|
-
|
|
368
296
|
// src/constants/re.ts
|
|
369
297
|
var JS_RE = /\.(js|jsx|cjs|mjs)$/;
|
|
370
298
|
var TS_RE = /\.(ts|tsx|mts|cts)$/;
|
|
@@ -402,9 +330,6 @@ function getDefaultDtsExtention(format, packageType, kind) {
|
|
|
402
330
|
function isModulePackage(packageType) {
|
|
403
331
|
return packageType === "module";
|
|
404
332
|
}
|
|
405
|
-
function formatTime(ms) {
|
|
406
|
-
return ms >= 1000 ? `${(ms / 1000).toFixed(2)}s` : `${Math.round(ms)}ms`;
|
|
407
|
-
}
|
|
408
333
|
function getPackageDeps(packageJson) {
|
|
409
334
|
if (!packageJson)
|
|
410
335
|
return [];
|
|
@@ -417,10 +342,10 @@ function formatFileSize(bytes) {
|
|
|
417
342
|
if (bytes === 0)
|
|
418
343
|
return "0 B";
|
|
419
344
|
const units = ["B", "KB", "MB", "GB"];
|
|
420
|
-
const
|
|
421
|
-
if (
|
|
422
|
-
return `${bytes} ${units[
|
|
423
|
-
return `${(bytes / 1024 **
|
|
345
|
+
const i = Math.floor(Math.log(bytes) / Math.log(1024));
|
|
346
|
+
if (i === 0)
|
|
347
|
+
return `${bytes} ${units[i]}`;
|
|
348
|
+
return `${(bytes / 1024 ** i).toFixed(2)} ${units[i]}`;
|
|
424
349
|
}
|
|
425
350
|
function getShortFilePath(filePath, maxLength = 3) {
|
|
426
351
|
const fileParts = filePath.split("/");
|
|
@@ -453,8 +378,8 @@ function formatListWithAnd(arr) {
|
|
|
453
378
|
}).format(arr);
|
|
454
379
|
}
|
|
455
380
|
async function getFilesFromGlobs(patterns, cwd) {
|
|
456
|
-
const includePatterns = patterns.filter((
|
|
457
|
-
const excludePatterns = patterns.filter((
|
|
381
|
+
const includePatterns = patterns.filter((p) => !p.startsWith("!"));
|
|
382
|
+
const excludePatterns = patterns.filter((p) => p.startsWith("!")).map((p) => p.slice(1));
|
|
458
383
|
const includedFiles = new Set;
|
|
459
384
|
for (const pattern of includePatterns) {
|
|
460
385
|
const glob = new Bun.Glob(pattern);
|
|
@@ -483,12 +408,12 @@ import pc3 from "picocolors";
|
|
|
483
408
|
function filterBunupBunPlugins(plugins) {
|
|
484
409
|
if (!plugins)
|
|
485
410
|
return [];
|
|
486
|
-
return plugins.filter((
|
|
411
|
+
return plugins.filter((p) => p.type === "bun");
|
|
487
412
|
}
|
|
488
413
|
function filterBunupPlugins(plugins) {
|
|
489
414
|
if (!plugins)
|
|
490
415
|
return [];
|
|
491
|
-
return plugins.filter((
|
|
416
|
+
return plugins.filter((p) => p.type === "bunup");
|
|
492
417
|
}
|
|
493
418
|
async function runPluginBuildStartHooks(bunupPlugins, options) {
|
|
494
419
|
if (!bunupPlugins)
|
|
@@ -518,4 +443,4 @@ async function getPackageForPlugin(name, pluginName) {
|
|
|
518
443
|
return pkg;
|
|
519
444
|
}
|
|
520
445
|
|
|
521
|
-
export { __toESM, __require, silent, setSilent, logTable, logger, BunupBuildError, BunupDTSBuildError, BunupCLIError, BunupWatchError, parseErrorMessage, handleError, handleErrorAndExit, JS_TS_RE, JS_DTS_RE, CSS_RE, ensureArray, getDefaultOutputExtension, getDefaultDtsExtention,
|
|
446
|
+
export { __toESM, __require, silent, setSilent, logTable, logTime, logger, BunupBuildError, BunupDTSBuildError, BunupCLIError, BunupWatchError, parseErrorMessage, handleError, handleErrorAndExit, JS_TS_RE, JS_DTS_RE, CSS_RE, ensureArray, getDefaultOutputExtension, getDefaultDtsExtention, getPackageDeps, formatFileSize, getShortFilePath, cleanOutDir, cleanPath, isDirectoryPath, formatListWithAnd, getFilesFromGlobs, isTypeScriptFile, filterBunupBunPlugins, filterBunupPlugins, runPluginBuildStartHooks, runPluginBuildDoneHooks, getPackageForPlugin };
|
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.
|
|
4
|
+
"version": "0.10.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist"
|
|
@@ -48,16 +48,14 @@
|
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"chokidar": "^4.0.3",
|
|
50
50
|
"coffi": "^0.1.31",
|
|
51
|
-
"fast-deep-equal": "^3.1.3",
|
|
52
51
|
"picocolors": "^1.1.1",
|
|
53
52
|
"tinyexec": "^1.0.1",
|
|
54
53
|
"tree-kill": "^1.2.2",
|
|
55
54
|
"typeroll": "^0.6.22"
|
|
56
55
|
},
|
|
57
56
|
"devDependencies": {
|
|
58
|
-
"@babel/types": "^7.28.2",
|
|
59
57
|
"@biomejs/biome": "2.0.0",
|
|
60
|
-
"@types/bun": "^1.2.
|
|
58
|
+
"@types/bun": "^1.2.20",
|
|
61
59
|
"bumpp": "^10.2.2",
|
|
62
60
|
"husky": "^9.1.7",
|
|
63
61
|
"lightningcss": "^1.30.1",
|
|
@@ -77,9 +75,9 @@
|
|
|
77
75
|
}
|
|
78
76
|
},
|
|
79
77
|
"scripts": {
|
|
80
|
-
"build": "
|
|
78
|
+
"build": "bun run src/cli/index.ts",
|
|
81
79
|
"build:docs": "bun run --cwd docs build",
|
|
82
|
-
"dev": "
|
|
80
|
+
"dev": "bun run src/cli/index.ts --watch",
|
|
83
81
|
"dev:docs": "bun run --cwd docs dev",
|
|
84
82
|
"format": "biome format .",
|
|
85
83
|
"format:fix": "biome format --write .",
|
|
File without changes
|