bunup 0.9.0 → 0.9.2
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 +18 -13
- package/dist/cli/index.js +13 -23
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/plugins.d.ts +1 -1
- package/dist/plugins.js +2 -2
- package/dist/shared/{chunk-ge1jevhp.js → chunk-ab3kjqce.js} +1 -1
- package/dist/shared/{chunk-cdrh2sea.js → chunk-mwk1z7nf.js} +4 -4
- package/dist/shared/{chunk-388r1g46.js → chunk-rvksjvnx.js} +49 -5
- package/dist/shared/{chunk-29mdzdnt.js → chunk-tcevarkq.js} +1 -1
- package/dist/shared/{chunk-gc7rjej4.js → chunk-v8c39y5z.js} +3 -3
- package/dist/shared/{chunk-95p7cdc9.d.ts → chunk-wpey1xte.d.ts} +47 -6
- package/dist/shared/{chunk-hb0esw52.js → chunk-xfc23vg1.js} +30 -5
- package/package.json +6 -5
package/README.md
CHANGED
|
@@ -6,31 +6,29 @@
|
|
|
6
6
|
|
|
7
7
|
<!-- markdownlint-disable-next-line no-alt-text -->
|
|
8
8
|
|
|
9
|
+
|
|
9
10
|

|
|
10
11
|
|
|
11
12
|

|
|
12
13
|
|
|
13
|
-
[](https://npmjs.com/package/bunup) [](https://bun.sh) [](https://github.com/sponsors/arshad-yaseen)
|
|
14
15
|
|
|
15
16
|
Bunup is the **blazing-fast build tool** for TypeScript libraries, designed for flawless developer experience and speed, **powered by Bun**.
|
|
16
17
|
|
|
17
|
-

|
|
18
|
-
|
|
19
|
-
*For detailed information on the benchmark, visit [here](https://gugustinette.github.io/bundler-benchmark/)*
|
|
20
|
-
|
|
21
18
|
</div>
|
|
22
19
|
<!-- markdownlint-restore -->
|
|
23
20
|
|
|
24
|
-
##
|
|
21
|
+
## Features
|
|
25
22
|
|
|
26
|
-
- ⚡ **Blazing Fast**: Lightning-
|
|
27
|
-
- 📝 **
|
|
23
|
+
- ⚡ **Blazing Fast**: Lightning-fast builds and instant rebuilds.
|
|
24
|
+
- 📝 **Top-Notch TypeScript Declarations**: Clean, minimal, accurate `.d.ts` files generated automatically.
|
|
28
25
|
- 📦 **ESM by Default**: Modern ESM output by default.
|
|
29
|
-
- 🪓 **Declaration Splitting**:
|
|
30
|
-
-
|
|
31
|
-
-
|
|
32
|
-
-
|
|
33
|
-
-
|
|
26
|
+
- 🪓 **Declaration Splitting**: Splits shared types for smaller, cleaner declaration bundles.
|
|
27
|
+
- 🔥 **Declaration Minification**: Aggressively minifies and shortens type names while preserving public API—like code bundling for TypeScript declarations.
|
|
28
|
+
- 🔋 **Batteries Included**: Auto-generates package exports, detects unused dependencies and exports, and more.
|
|
29
|
+
- 🚀 **Zero-Config Simplicity**: Preconfigured for productivity—just code and build.
|
|
30
|
+
- 🏗️ **[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.
|
|
34
32
|
|
|
35
33
|
## 📚 Documentation
|
|
36
34
|
|
|
@@ -41,3 +39,10 @@ To get started, visit the [documentation](https://bunup.dev).
|
|
|
41
39
|
For guidelines on contributing, please read the [contributing guide](../../CONTRIBUTING.md).
|
|
42
40
|
|
|
43
41
|
We welcome contributions from the community to enhance Bunup's capabilities and make it even more powerful.
|
|
42
|
+
|
|
43
|
+

|
|
44
|
+
|
|
45
|
+
<div align="center">
|
|
46
|
+
|
|
47
|
+

|
|
48
|
+
</div>
|
package/dist/cli/index.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
import {
|
|
4
4
|
build,
|
|
5
5
|
createBuildOptions
|
|
6
|
-
} from "../shared/chunk-
|
|
7
|
-
import"../shared/chunk-
|
|
6
|
+
} from "../shared/chunk-rvksjvnx.js";
|
|
7
|
+
import"../shared/chunk-ab3kjqce.js";
|
|
8
8
|
import {
|
|
9
9
|
processLoadedConfigs
|
|
10
10
|
} from "../shared/chunk-295440tx.js";
|
|
@@ -21,14 +21,13 @@ import {
|
|
|
21
21
|
logger,
|
|
22
22
|
parseErrorMessage,
|
|
23
23
|
setSilent
|
|
24
|
-
} from "../shared/chunk-
|
|
24
|
+
} from "../shared/chunk-xfc23vg1.js";
|
|
25
25
|
|
|
26
26
|
// src/cli/index.ts
|
|
27
27
|
import { loadConfig } from "coffi";
|
|
28
28
|
import pc3 from "picocolors";
|
|
29
|
-
import { exec } from "tinyexec";
|
|
30
29
|
// package.json
|
|
31
|
-
var version = "0.9.
|
|
30
|
+
var version = "0.9.2";
|
|
32
31
|
|
|
33
32
|
// src/watch.ts
|
|
34
33
|
import path from "path";
|
|
@@ -325,13 +324,6 @@ var OPTION_DEFINITIONS = {
|
|
|
325
324
|
type: "string",
|
|
326
325
|
category: "build"
|
|
327
326
|
},
|
|
328
|
-
onSuccess: {
|
|
329
|
-
flags: ["onSuccess"],
|
|
330
|
-
handler: handlers.string("onSuccess"),
|
|
331
|
-
description: "Command to execute after a successful build",
|
|
332
|
-
type: "string",
|
|
333
|
-
category: "development"
|
|
334
|
-
},
|
|
335
327
|
filter: {
|
|
336
328
|
flags: ["filter"],
|
|
337
329
|
handler: handlers.array("filter"),
|
|
@@ -367,6 +359,13 @@ var OPTION_DEFINITIONS = {
|
|
|
367
359
|
type: "string|boolean",
|
|
368
360
|
category: "development"
|
|
369
361
|
},
|
|
362
|
+
onSuccess: {
|
|
363
|
+
flags: ["onSuccess"],
|
|
364
|
+
handler: handlers.string("onSuccess"),
|
|
365
|
+
description: "Command to run after the build process completes",
|
|
366
|
+
type: "string",
|
|
367
|
+
category: "utility"
|
|
368
|
+
},
|
|
370
369
|
help: {
|
|
371
370
|
flags: ["h", "help"],
|
|
372
371
|
handler: handlers.showHelp,
|
|
@@ -482,12 +481,12 @@ var parseCliOptions = (argv) => {
|
|
|
482
481
|
async function main(args = Bun.argv.slice(2)) {
|
|
483
482
|
const cliOptions = parseCliOptions(args);
|
|
484
483
|
if (cliOptions.new) {
|
|
485
|
-
const { newProject } = await import("../shared/chunk-
|
|
484
|
+
const { newProject } = await import("../shared/chunk-mwk1z7nf.js");
|
|
486
485
|
await newProject();
|
|
487
486
|
return;
|
|
488
487
|
}
|
|
489
488
|
if (cliOptions.init) {
|
|
490
|
-
const { init } = await import("../shared/chunk-
|
|
489
|
+
const { init } = await import("../shared/chunk-v8c39y5z.js");
|
|
491
490
|
await init();
|
|
492
491
|
return;
|
|
493
492
|
}
|
|
@@ -534,14 +533,6 @@ async function main(args = Bun.argv.slice(2)) {
|
|
|
534
533
|
verticalSpace: true
|
|
535
534
|
});
|
|
536
535
|
}
|
|
537
|
-
if (cliOptions.onSuccess) {
|
|
538
|
-
logger.info(`Running command: ${cliOptions.onSuccess}`, {
|
|
539
|
-
muted: true
|
|
540
|
-
});
|
|
541
|
-
await exec(cliOptions.onSuccess, [], {
|
|
542
|
-
nodeOptions: { shell: true, stdio: "inherit" }
|
|
543
|
-
});
|
|
544
|
-
}
|
|
545
536
|
if (!cliOptions.watch) {
|
|
546
537
|
process.exit(process.exitCode ?? 0);
|
|
547
538
|
}
|
|
@@ -549,7 +540,6 @@ async function main(args = Bun.argv.slice(2)) {
|
|
|
549
540
|
function removeCliOnlyOptions(options) {
|
|
550
541
|
return {
|
|
551
542
|
...options,
|
|
552
|
-
onSuccess: undefined,
|
|
553
543
|
config: undefined,
|
|
554
544
|
filter: undefined,
|
|
555
545
|
new: undefined,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Arrayable, BuildOptions, DefineConfigItem, DefineWorkspaceItem, Plugin, WithOptional } from "./shared/chunk-
|
|
1
|
+
import { Arrayable, BuildOptions, DefineConfigItem, DefineWorkspaceItem, Plugin, WithOptional } from "./shared/chunk-wpey1xte";
|
|
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: WithOptional<DefineWorkspaceItem, "config">[], sharedOptions?: DefineConfigItem): DefineWorkspaceItem[];
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
build
|
|
4
|
-
} from "./shared/chunk-
|
|
5
|
-
import"./shared/chunk-
|
|
4
|
+
} from "./shared/chunk-rvksjvnx.js";
|
|
5
|
+
import"./shared/chunk-ab3kjqce.js";
|
|
6
6
|
import"./shared/chunk-295440tx.js";
|
|
7
|
-
import"./shared/chunk-
|
|
7
|
+
import"./shared/chunk-xfc23vg1.js";
|
|
8
8
|
// src/define.ts
|
|
9
9
|
function defineConfig(options) {
|
|
10
10
|
return options;
|
package/dist/plugins.d.ts
CHANGED
package/dist/plugins.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
getPackageForPlugin
|
|
4
|
-
} from "./shared/chunk-
|
|
4
|
+
} from "./shared/chunk-ab3kjqce.js";
|
|
5
5
|
import {
|
|
6
6
|
CSS_RE,
|
|
7
7
|
JS_DTS_RE,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
formatListWithAnd,
|
|
11
11
|
isDirectoryPath,
|
|
12
12
|
logger
|
|
13
|
-
} from "./shared/chunk-
|
|
13
|
+
} from "./shared/chunk-xfc23vg1.js";
|
|
14
14
|
|
|
15
15
|
// src/plugins/built-in/copy.ts
|
|
16
16
|
import { basename, join } from "path";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
displayBunupGradientArt
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-tcevarkq.js";
|
|
5
5
|
import {
|
|
6
6
|
link,
|
|
7
7
|
pathExistsSync
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-xfc23vg1.js";
|
|
9
9
|
|
|
10
10
|
// src/cli/new.ts
|
|
11
11
|
import { renameSync } from "fs";
|
|
@@ -32,7 +32,7 @@ var TEMPLATES = [
|
|
|
32
32
|
{
|
|
33
33
|
type: "typescript",
|
|
34
34
|
defaultName: "my-ts-lib",
|
|
35
|
-
name: "
|
|
35
|
+
name: "TypeScript Library",
|
|
36
36
|
dir: "ts-lib",
|
|
37
37
|
monorepoDir: "ts-lib-monorepo"
|
|
38
38
|
},
|
|
@@ -143,7 +143,7 @@ async function newProject() {
|
|
|
143
143
|
${pc.cyan("bun run dev")}${pc.dim(" (watch mode for development)")}${template.type === "react" ? `
|
|
144
144
|
${pc.cyan("bun run dev:test")} ${pc.dim("(preview components in a test Next.js app)")} ` : ""}
|
|
145
145
|
|
|
146
|
-
${pc.dim("Learn more:")} ${link("https://bunup.dev/
|
|
146
|
+
${pc.dim("Learn more:")} ${link("https://bunup.dev/")}
|
|
147
147
|
|
|
148
148
|
${pc.yellow("Happy coding!")} \uD83D\uDE80
|
|
149
149
|
`);
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
filterBunupPlugins,
|
|
4
4
|
runPluginBuildDoneHooks,
|
|
5
5
|
runPluginBuildStartHooks
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-ab3kjqce.js";
|
|
7
7
|
import {
|
|
8
8
|
loadPackageJson
|
|
9
9
|
} from "./chunk-295440tx.js";
|
|
@@ -25,13 +25,52 @@ import {
|
|
|
25
25
|
parseErrorMessage,
|
|
26
26
|
setSilent,
|
|
27
27
|
silent
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-xfc23vg1.js";
|
|
29
29
|
|
|
30
30
|
// src/build.ts
|
|
31
31
|
import path from "path";
|
|
32
32
|
import pc2 from "picocolors";
|
|
33
33
|
import { generateDts, logIsolatedDeclarationErrors } from "typeroll";
|
|
34
34
|
|
|
35
|
+
// src/helpers/on-success.ts
|
|
36
|
+
import { exec } from "tinyexec";
|
|
37
|
+
import treeKill from "tree-kill";
|
|
38
|
+
async function executeOnSuccess(onSuccess, options, signal) {
|
|
39
|
+
if (typeof onSuccess === "function") {
|
|
40
|
+
const result = await onSuccess(options);
|
|
41
|
+
if (typeof result === "function") {
|
|
42
|
+
signal.addEventListener("abort", () => {
|
|
43
|
+
result();
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
} else {
|
|
47
|
+
const command = typeof onSuccess === "string" ? onSuccess : onSuccess.cmd;
|
|
48
|
+
const spawnOptions = typeof onSuccess === "object" && "options" in onSuccess ? onSuccess.options : {};
|
|
49
|
+
logger.info(`Running command: ${command}`, {
|
|
50
|
+
muted: true
|
|
51
|
+
});
|
|
52
|
+
const proc = exec(command, [], {
|
|
53
|
+
timeout: spawnOptions?.timeout,
|
|
54
|
+
nodeOptions: {
|
|
55
|
+
shell: true,
|
|
56
|
+
stdio: "inherit",
|
|
57
|
+
env: spawnOptions?.env,
|
|
58
|
+
cwd: spawnOptions?.cwd
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
proc.then(({ exitCode }) => {
|
|
62
|
+
if (exitCode) {
|
|
63
|
+
process.exitCode = exitCode;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
signal.addEventListener("abort", () => {
|
|
67
|
+
if (typeof proc.pid === "number") {
|
|
68
|
+
treeKill(proc.pid, spawnOptions?.killSignal ?? "SIGTERM");
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
35
74
|
// src/plugins/internal/report.ts
|
|
36
75
|
import pc from "picocolors";
|
|
37
76
|
function report() {
|
|
@@ -165,8 +204,8 @@ function getResolvedDefine(define, env) {
|
|
|
165
204
|
function getResolvedSplitting(splitting, format) {
|
|
166
205
|
return splitting === undefined ? format === "esm" : splitting;
|
|
167
206
|
}
|
|
168
|
-
function getResolvedDtsSplitting(
|
|
169
|
-
return dtsSplitting
|
|
207
|
+
function getResolvedDtsSplitting(_buildSplitting, dtsSplitting) {
|
|
208
|
+
return !!dtsSplitting;
|
|
170
209
|
}
|
|
171
210
|
var DEFAULT_ENTRY_NAMING = "[dir]/[name].[ext]";
|
|
172
211
|
function getDefaultChunkNaming(name) {
|
|
@@ -217,7 +256,12 @@ function externalOptionPlugin(options, packageJson) {
|
|
|
217
256
|
}
|
|
218
257
|
|
|
219
258
|
// src/build.ts
|
|
259
|
+
var ac = null;
|
|
220
260
|
async function build(partialOptions, rootDir = process.cwd()) {
|
|
261
|
+
if (ac) {
|
|
262
|
+
ac.abort();
|
|
263
|
+
}
|
|
264
|
+
ac = new AbortController;
|
|
221
265
|
const buildOutput = {
|
|
222
266
|
files: []
|
|
223
267
|
};
|
|
@@ -351,7 +395,7 @@ async function build(partialOptions, rootDir = process.cwd()) {
|
|
|
351
395
|
rootDir
|
|
352
396
|
});
|
|
353
397
|
if (options.onSuccess) {
|
|
354
|
-
await options.onSuccess
|
|
398
|
+
await executeOnSuccess(options.onSuccess, options, ac.signal);
|
|
355
399
|
}
|
|
356
400
|
}
|
|
357
401
|
function getRelativePathToRootDir(filePath, rootDir) {
|
|
@@ -4,11 +4,11 @@ import {
|
|
|
4
4
|
} from "./chunk-295440tx.js";
|
|
5
5
|
import {
|
|
6
6
|
displayBunupGradientArt
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-tcevarkq.js";
|
|
8
8
|
import {
|
|
9
9
|
formatListWithAnd,
|
|
10
10
|
link
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-xfc23vg1.js";
|
|
12
12
|
|
|
13
13
|
// src/cli/init.ts
|
|
14
14
|
import fs from "fs";
|
|
@@ -326,7 +326,7 @@ function showSuccessOutro(isWorkspace) {
|
|
|
326
326
|
${devCommand}${isWorkspace ? `
|
|
327
327
|
${filterCommand}` : ""}
|
|
328
328
|
|
|
329
|
-
${pc.dim("Learn more:")} ${link("https://bunup.dev/
|
|
329
|
+
${pc.dim("Learn more:")} ${link("https://bunup.dev/")}
|
|
330
330
|
|
|
331
331
|
${pc.yellow("Happy building!")} \uD83D\uDE80
|
|
332
332
|
`);
|
|
@@ -101,6 +101,35 @@ type Format = "esm" | "cjs" | "iife";
|
|
|
101
101
|
type Target = "bun" | "node" | "browser";
|
|
102
102
|
type External = (string | RegExp)[];
|
|
103
103
|
type Env = "inline" | "disable" | `${string}*` | Record<string, string>;
|
|
104
|
+
type OnSuccess = ((options: Partial<BuildOptions>) => MaybePromise<void> | (() => void)) | string | {
|
|
105
|
+
/**
|
|
106
|
+
* The shell command to execute after a successful build
|
|
107
|
+
*/
|
|
108
|
+
cmd: string
|
|
109
|
+
/**
|
|
110
|
+
* Additional options for the command execution
|
|
111
|
+
*/
|
|
112
|
+
options?: {
|
|
113
|
+
/**
|
|
114
|
+
* Working directory for the command
|
|
115
|
+
*/
|
|
116
|
+
cwd?: string
|
|
117
|
+
/**
|
|
118
|
+
* Environment variables to pass to the command
|
|
119
|
+
* @default process.env
|
|
120
|
+
*/
|
|
121
|
+
env?: Record<string, string | undefined>
|
|
122
|
+
/**
|
|
123
|
+
* Maximum time in milliseconds the command is allowed to run
|
|
124
|
+
*/
|
|
125
|
+
timeout?: number
|
|
126
|
+
/**
|
|
127
|
+
* Signal to use when killing the process
|
|
128
|
+
* @default 'SIGTERM'
|
|
129
|
+
*/
|
|
130
|
+
killSignal?: NodeJS.Signals | number
|
|
131
|
+
}
|
|
132
|
+
};
|
|
104
133
|
interface BuildOptions {
|
|
105
134
|
/**
|
|
106
135
|
* Name of the build configuration
|
|
@@ -224,15 +253,27 @@ interface BuildOptions {
|
|
|
224
253
|
/**\\n\\t* Define global constants for the build\\n\\t* These values will be replaced at build time\\n\\t*\\n\\t* @see https://bun.sh/docs/bundler#define\\n\\t*\\n\\t* @example\\n\\t* define: {\\n\\t* 'process.env.NODE_ENV': '"production"',\\n\\t* 'PACKAGE_VERSION': '"1.0.0"'\\n\\t* }\\n\\t*/
|
|
225
254
|
define?: Define;
|
|
226
255
|
/**
|
|
227
|
-
* A callback
|
|
228
|
-
*
|
|
229
|
-
*
|
|
256
|
+
* A callback or command to run after a successful build.
|
|
257
|
+
*
|
|
258
|
+
* If a function is provided, it can optionally return a cleanup function
|
|
259
|
+
* that will be called when the operation is cancelled.
|
|
230
260
|
*
|
|
231
|
-
*
|
|
261
|
+
* @example
|
|
262
|
+
* onSuccess: (options) => {
|
|
263
|
+
* const server = startServer();
|
|
264
|
+
* return () => server.close();
|
|
265
|
+
* }
|
|
266
|
+
*
|
|
267
|
+
* @example
|
|
268
|
+
* onSuccess: "echo Build completed!"
|
|
232
269
|
*
|
|
233
|
-
* @
|
|
270
|
+
* @example
|
|
271
|
+
* onSuccess: {
|
|
272
|
+
* cmd: "bun run dist/server.js",
|
|
273
|
+
* options: { env: { ...process.env, FOO: "bar" } }
|
|
274
|
+
* }
|
|
234
275
|
*/
|
|
235
|
-
onSuccess?:
|
|
276
|
+
onSuccess?: OnSuccess;
|
|
236
277
|
/**\\n\\t* A banner to be added to the final bundle, this can be a directive like "use client" for react or a comment block such as a license for the code.\\n\\t*\\n\\t* @see https://bun.sh/docs/bundler#banner\\n\\t*\\n\\t* @example\\n\\t* banner: '"use client";'\\n\\t*/
|
|
237
278
|
banner?: string;
|
|
238
279
|
/**
|
|
@@ -163,7 +163,12 @@ function logTable(columns, data, footer) {
|
|
|
163
163
|
console.log(footerRow);
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
|
-
var link = (url) =>
|
|
166
|
+
var link = (url, label) => {
|
|
167
|
+
if (!label) {
|
|
168
|
+
label = url;
|
|
169
|
+
}
|
|
170
|
+
return `\x1B]8;;${url}\x07${pc.underline(pc.cyan(label))}\x1B]8;;\x07`;
|
|
171
|
+
};
|
|
167
172
|
var logger = Logger.getInstance();
|
|
168
173
|
|
|
169
174
|
// src/errors.ts
|
|
@@ -220,8 +225,15 @@ var KNOWN_ERRORS = [
|
|
|
220
225
|
pattern: /Could not resolve: "bun"/i,
|
|
221
226
|
errorType: "BUILD ERROR",
|
|
222
227
|
logSolution: () => {
|
|
223
|
-
logger.
|
|
224
|
-
`
|
|
228
|
+
logger.log("You're trying to build a project that uses Bun. " + "Please set the target option to " + pc2.cyan("`bun`") + `.
|
|
229
|
+
` + "Example: " + pc2.green("`bunup --target bun`") + " or in config: " + pc2.green("{ target: 'bun' }"));
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
pattern: /has already been exported. Exported identifiers must be unique./i,
|
|
234
|
+
errorType: "DTS ERROR",
|
|
235
|
+
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.gray("dts: { splitting: true }") + " from your config." + " You can re-enable it once the issue is fixed.");
|
|
225
237
|
}
|
|
226
238
|
}
|
|
227
239
|
];
|
|
@@ -244,7 +256,8 @@ var handleError = (error, context) => {
|
|
|
244
256
|
}
|
|
245
257
|
const knownError = KNOWN_ERRORS.find((error2) => error2.pattern.test(errorMessage) && (error2.errorType === errorType || !error2.errorType));
|
|
246
258
|
if (!knownError && errorType) {
|
|
247
|
-
console.error(
|
|
259
|
+
console.error(`
|
|
260
|
+
${pc2.red(errorType)} ${contextPrefix}${errorMessage}`);
|
|
248
261
|
}
|
|
249
262
|
if (knownError) {
|
|
250
263
|
console.log(`
|
|
@@ -253,7 +266,19 @@ var handleError = (error, context) => {
|
|
|
253
266
|
console.log(`
|
|
254
267
|
`);
|
|
255
268
|
} else {
|
|
256
|
-
|
|
269
|
+
const issueUrl = new URL("https://github.com/arshad-yaseen/bunup/issues/new");
|
|
270
|
+
issueUrl.searchParams.set("title", `[${errorType}] Error encountered`);
|
|
271
|
+
issueUrl.searchParams.set("body", `## Error Details
|
|
272
|
+
|
|
273
|
+
**Error Type:** ${errorType}
|
|
274
|
+
**Error Message:** ${errorMessage}
|
|
275
|
+
|
|
276
|
+
## Additional Context
|
|
277
|
+
|
|
278
|
+
<!-- Please provide any additional context about what you were trying to do when the error occurred -->`);
|
|
279
|
+
console.error(pc2.white(`
|
|
280
|
+
If you think this is a bug, please `) + link(issueUrl.toString(), "open an issue") + ` with details about this error
|
|
281
|
+
`);
|
|
257
282
|
}
|
|
258
283
|
};
|
|
259
284
|
var handleErrorAndExit = (error, context) => {
|
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.9.
|
|
4
|
+
"version": "0.9.2",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist"
|
|
@@ -54,17 +54,18 @@
|
|
|
54
54
|
"picocolors": "^1.1.1",
|
|
55
55
|
"replace-in-file": "^8.3.0",
|
|
56
56
|
"tinyexec": "^1.0.1",
|
|
57
|
-
"
|
|
57
|
+
"tree-kill": "^1.2.2",
|
|
58
|
+
"typeroll": "^0.6.22"
|
|
58
59
|
},
|
|
59
60
|
"devDependencies": {
|
|
60
|
-
"@babel/types": "^7.28.
|
|
61
|
+
"@babel/types": "^7.28.2",
|
|
61
62
|
"@biomejs/biome": "2.0.0",
|
|
62
63
|
"@types/bun": "^1.2.19",
|
|
63
|
-
"bumpp": "^10.2.
|
|
64
|
+
"bumpp": "^10.2.2",
|
|
64
65
|
"husky": "^9.1.7",
|
|
65
66
|
"lightningcss": "^1.30.1",
|
|
66
67
|
"lint-staged": "^15.5.2",
|
|
67
|
-
"typescript": "^5.
|
|
68
|
+
"typescript": "^5.9.2"
|
|
68
69
|
},
|
|
69
70
|
"peerDependencies": {
|
|
70
71
|
"typescript": ">=4.5.0",
|