bunup 0.14.10 → 0.14.12
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 -2
- package/dist/cli/index.js +23 -11
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/plugins.d.ts +1 -1
- package/dist/plugins.js +10 -1
- package/dist/shared/{bunup-nsnkrmw3.js → bunup-6xvphypm.js} +36 -20
- package/dist/shared/{bunup-er5nnjqp.js → bunup-es9v2p5v.js} +45 -10
- package/dist/shared/{bunup-zenttvjh.d.ts → bunup-fwrvv30e.d.ts} +8 -8
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|

|
|
11
11
|
|
|
12
12
|
[](https://npmjs.com/package/bunup)
|
|
13
|
-
[](https://bun.
|
|
13
|
+
[](https://bun.com)
|
|
14
14
|
[](https://github.com/sponsors/arshad-yaseen)
|
|
15
15
|
|
|
16
|
-
Bunup helps you ship TypeScript/React libraries faster with great DX — built on Bun.
|
|
16
|
+
Bunup helps you ship TypeScript/React libraries faster with great DX — built on [Bun](https://bun.com)'s native bundler.
|
|
17
17
|
</div>
|
|
18
18
|
<!-- markdownlint-restore -->
|
|
19
19
|
|
|
@@ -77,6 +77,8 @@ For more, see the full documentation: https://bunup.dev
|
|
|
77
77
|
|
|
78
78
|
We welcome contributions! Please read the [contributing guide](CONTRIBUTING.md).
|
|
79
79
|
|
|
80
|
+

|
|
81
|
+
|
|
80
82
|
<div align="center">
|
|
81
83
|
|
|
82
84
|
<img src="https://cdn.jsdelivr.net/gh/arshad-yaseen/static/sponsors.svg" alt="Sponsors" />
|
package/dist/cli/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
printBuildReport,
|
|
6
6
|
processLoadedConfigs,
|
|
7
7
|
resolveBuildOptions
|
|
8
|
-
} from "../shared/bunup-
|
|
8
|
+
} from "../shared/bunup-6xvphypm.js";
|
|
9
9
|
import {
|
|
10
10
|
BunupCLIError,
|
|
11
11
|
BunupWatchError,
|
|
@@ -18,18 +18,18 @@ import {
|
|
|
18
18
|
logTime,
|
|
19
19
|
logger,
|
|
20
20
|
parseErrorMessage
|
|
21
|
-
} from "../shared/bunup-
|
|
21
|
+
} from "../shared/bunup-es9v2p5v.js";
|
|
22
22
|
|
|
23
23
|
// packages/bunup/src/cli/index.ts
|
|
24
24
|
import { loadConfig } from "coffi";
|
|
25
25
|
import pc3 from "picocolors";
|
|
26
26
|
// packages/bunup/package.json
|
|
27
|
-
var version = "0.14.
|
|
27
|
+
var version = "0.14.12";
|
|
28
28
|
|
|
29
29
|
// packages/bunup/src/watch.ts
|
|
30
30
|
import path from "path";
|
|
31
31
|
import pc from "picocolors";
|
|
32
|
-
async function watch(userOptions, rootDir) {
|
|
32
|
+
async function watch(userOptions, rootDir, configFilePath) {
|
|
33
33
|
const watchPaths = new Set;
|
|
34
34
|
const options = resolveBuildOptions(userOptions);
|
|
35
35
|
const uniqueEntries = new Set(ensureArray(options.entry));
|
|
@@ -38,6 +38,9 @@ async function watch(userOptions, rootDir) {
|
|
|
38
38
|
const parentDir = path.dirname(entryPath);
|
|
39
39
|
watchPaths.add(parentDir);
|
|
40
40
|
}
|
|
41
|
+
if (configFilePath) {
|
|
42
|
+
watchPaths.add(configFilePath);
|
|
43
|
+
}
|
|
41
44
|
const chokidar = await import("chokidar");
|
|
42
45
|
const watcher = chokidar.watch(Array.from(watchPaths), {
|
|
43
46
|
ignoreInitial: true,
|
|
@@ -70,7 +73,7 @@ async function watch(userOptions, rootDir) {
|
|
|
70
73
|
${buildCount > 1 ? pc.magentaBright(`[x${buildCount}] `) : ""}${pc.green(`Changed:`)} ${changed}${options.name ? ` ${pc.bgBlueBright(` ${options.name} `)}` : ""}`);
|
|
71
74
|
}
|
|
72
75
|
const start = performance.now();
|
|
73
|
-
const buildOutput = await build(
|
|
76
|
+
const buildOutput = await build(userOptions, rootDir);
|
|
74
77
|
await printBuildReport(buildOutput, options);
|
|
75
78
|
if (!initial) {
|
|
76
79
|
console.log(`
|
|
@@ -82,12 +85,24 @@ async function watch(userOptions, rootDir) {
|
|
|
82
85
|
isRebuilding = false;
|
|
83
86
|
}
|
|
84
87
|
};
|
|
85
|
-
watcher.on("change", (
|
|
86
|
-
|
|
88
|
+
watcher.on("change", (changedPath) => {
|
|
89
|
+
if (configFilePath && changedPath === configFilePath) {
|
|
90
|
+
console.log(pc.yellow(` Please restart watch mode to apply configuration changes.
|
|
91
|
+
`));
|
|
92
|
+
cleanup();
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
triggerRebuild(false, getShortFilePath(changedPath));
|
|
87
96
|
});
|
|
88
97
|
watcher.on("error", (error) => {
|
|
89
98
|
throw new BunupWatchError(`Watcher error: ${parseErrorMessage(error)}`);
|
|
90
99
|
});
|
|
100
|
+
const cleanup = async () => {
|
|
101
|
+
await watcher.close();
|
|
102
|
+
process.exit(0);
|
|
103
|
+
};
|
|
104
|
+
process.on("SIGINT", cleanup);
|
|
105
|
+
process.on("SIGTERM", cleanup);
|
|
91
106
|
await triggerRebuild(true);
|
|
92
107
|
}
|
|
93
108
|
|
|
@@ -193,7 +208,7 @@ async function main(args = Bun.argv.slice(2)) {
|
|
|
193
208
|
...removeCliOnlyOptions(cliOptions)
|
|
194
209
|
};
|
|
195
210
|
if (userOptions.watch) {
|
|
196
|
-
await watch(userOptions, rootDir);
|
|
211
|
+
await watch(userOptions, rootDir, filepath);
|
|
197
212
|
} else {
|
|
198
213
|
await build(userOptions, rootDir);
|
|
199
214
|
}
|
|
@@ -207,9 +222,6 @@ async function main(args = Bun.argv.slice(2)) {
|
|
|
207
222
|
const buildTimeMs = performance.now() - startTime;
|
|
208
223
|
logger.space();
|
|
209
224
|
logger.success(`Build completed in ${pc3.green(logTime(buildTimeMs))}`);
|
|
210
|
-
if (!cliOptions.watch) {
|
|
211
|
-
process.exit(process.exitCode ?? 0);
|
|
212
|
-
}
|
|
213
225
|
}
|
|
214
226
|
var CLI_ONLY_OPTIONS = ["config", "filter"];
|
|
215
227
|
function removeCliOnlyOptions(options) {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Arrayable, BuildContext, BuildMeta, BuildOptions, BuildOutput, BuildOutputFile, BunupPlugin, DefineConfigItem, DefineWorkspaceItem, WithOptional } from "./shared/bunup-
|
|
1
|
+
import { Arrayable, BuildContext, BuildMeta, BuildOptions, BuildOutput, BuildOutputFile, BunupPlugin, DefineConfigItem, DefineWorkspaceItem, WithOptional } from "./shared/bunup-fwrvv30e";
|
|
2
2
|
declare function build(userOptions: Partial<BuildOptions>, rootDir?: string): Promise<BuildOutput>;
|
|
3
3
|
declare function defineConfig(options: Arrayable<DefineConfigItem>): Arrayable<DefineConfigItem>;
|
|
4
4
|
declare function defineWorkspace(options: WithOptional<DefineWorkspaceItem, "config">[], sharedOptions?: Partial<DefineConfigItem>): DefineWorkspaceItem[];
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
build
|
|
4
|
-
} from "./shared/bunup-
|
|
5
|
-
import"./shared/bunup-
|
|
4
|
+
} from "./shared/bunup-6xvphypm.js";
|
|
5
|
+
import"./shared/bunup-es9v2p5v.js";
|
|
6
6
|
// packages/bunup/src/define.ts
|
|
7
7
|
function defineConfig(options) {
|
|
8
8
|
return options;
|
package/dist/plugins.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BuildOptions, BunupPlugin, BunupPluginHooks, exports, injectStyles, unused } from "./shared/bunup-
|
|
1
|
+
import { BuildOptions, BunupPlugin, BunupPluginHooks, exports, injectStyles, unused } from "./shared/bunup-fwrvv30e";
|
|
2
2
|
type CopyOptions = {
|
|
3
3
|
/** Whether to follow symbolic links when copying files. */
|
|
4
4
|
followSymlinks?: boolean
|
package/dist/plugins.js
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
logger,
|
|
8
8
|
shims,
|
|
9
9
|
unused
|
|
10
|
-
} from "./shared/bunup-
|
|
10
|
+
} from "./shared/bunup-es9v2p5v.js";
|
|
11
11
|
|
|
12
12
|
// packages/bunup/src/plugins/copy.ts
|
|
13
13
|
import { basename, extname, join } from "path";
|
|
@@ -60,6 +60,7 @@ class CopyBuilder {
|
|
|
60
60
|
} else {
|
|
61
61
|
destinationPath = buildOptions.outDir;
|
|
62
62
|
}
|
|
63
|
+
const activeFiles = new Set;
|
|
63
64
|
for (const pattern of this._patterns) {
|
|
64
65
|
const glob = new Bun.Glob(pattern);
|
|
65
66
|
for await (const scannedPath of glob.scan({
|
|
@@ -69,6 +70,7 @@ class CopyBuilder {
|
|
|
69
70
|
followSymlinks: this._options?.followSymlinks
|
|
70
71
|
})) {
|
|
71
72
|
const sourcePath = join(meta.rootDir, scannedPath);
|
|
73
|
+
activeFiles.add(sourcePath);
|
|
72
74
|
if (isWatchMode && watchBehavior === "changed") {
|
|
73
75
|
const stat = await Bun.file(sourcePath).stat();
|
|
74
76
|
const lastModified = stat?.mtime?.getTime() ?? 0;
|
|
@@ -93,6 +95,13 @@ class CopyBuilder {
|
|
|
93
95
|
}
|
|
94
96
|
}
|
|
95
97
|
}
|
|
98
|
+
if (isWatchMode && watchBehavior === "changed") {
|
|
99
|
+
for (const cachedPath of this._fileCache.keys()) {
|
|
100
|
+
if (!activeFiles.has(cachedPath)) {
|
|
101
|
+
this._fileCache.delete(cachedPath);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
96
105
|
}
|
|
97
106
|
};
|
|
98
107
|
}
|
|
@@ -8,20 +8,23 @@ import {
|
|
|
8
8
|
ensureObject,
|
|
9
9
|
exports,
|
|
10
10
|
formatFileSize,
|
|
11
|
+
formatListWithAnd,
|
|
11
12
|
getDefaultDtsOutputExtention,
|
|
12
13
|
getDefaultJsOutputExtension,
|
|
13
14
|
getFilesFromGlobs,
|
|
14
15
|
getPackageDeps,
|
|
15
16
|
getShortFilePath,
|
|
16
17
|
injectStyles,
|
|
18
|
+
invalidEntryPointsError,
|
|
17
19
|
isJavascriptFile,
|
|
18
20
|
isTypeScriptFile,
|
|
19
21
|
logger,
|
|
22
|
+
noEntryPointsFoundError,
|
|
20
23
|
parseErrorMessage,
|
|
21
24
|
replaceExtension,
|
|
22
25
|
shims,
|
|
23
26
|
unused
|
|
24
|
-
} from "./bunup-
|
|
27
|
+
} from "./bunup-es9v2p5v.js";
|
|
25
28
|
|
|
26
29
|
// packages/bunup/src/loaders.ts
|
|
27
30
|
import path from "path";
|
|
@@ -29,7 +32,7 @@ import { loadConfig } from "coffi";
|
|
|
29
32
|
async function processLoadedConfigs(config, cwd, filter) {
|
|
30
33
|
return Array.isArray(config) && "root" in config[0] ? config.filter((c) => filter ? filter.includes(c.name) : true).map((c) => ({
|
|
31
34
|
rootDir: path.resolve(cwd, c.root),
|
|
32
|
-
options:
|
|
35
|
+
options: setOrSuffixField(c.config, "name", c.name)
|
|
33
36
|
})) : [
|
|
34
37
|
{
|
|
35
38
|
rootDir: cwd,
|
|
@@ -37,8 +40,13 @@ async function processLoadedConfigs(config, cwd, filter) {
|
|
|
37
40
|
}
|
|
38
41
|
];
|
|
39
42
|
}
|
|
40
|
-
function
|
|
41
|
-
|
|
43
|
+
function setOrSuffixField(objectOrArray, field, prefix) {
|
|
44
|
+
const addPrefix = (obj) => {
|
|
45
|
+
const existingValue = obj[field];
|
|
46
|
+
const newValue = existingValue ? `${prefix}-${existingValue}` : prefix;
|
|
47
|
+
return { ...obj, [field]: newValue };
|
|
48
|
+
};
|
|
49
|
+
return Array.isArray(objectOrArray) ? objectOrArray.map(addPrefix) : addPrefix(objectOrArray);
|
|
42
50
|
}
|
|
43
51
|
async function loadPackageJson(cwd = process.cwd()) {
|
|
44
52
|
const { config, filepath } = await loadConfig({
|
|
@@ -192,16 +200,17 @@ ${text}`;
|
|
|
192
200
|
}
|
|
193
201
|
|
|
194
202
|
// packages/bunup/src/options.ts
|
|
203
|
+
var DEFAULT_ENTYPOINTS = [
|
|
204
|
+
"index.ts",
|
|
205
|
+
"index.tsx",
|
|
206
|
+
"src/index.ts",
|
|
207
|
+
"src/index.tsx",
|
|
208
|
+
"cli.ts",
|
|
209
|
+
"src/cli.ts",
|
|
210
|
+
"src/cli/index.ts"
|
|
211
|
+
];
|
|
195
212
|
var DEFAULT_OPTIONS = {
|
|
196
|
-
entry:
|
|
197
|
-
"index.ts",
|
|
198
|
-
"index.tsx",
|
|
199
|
-
"src/index.ts",
|
|
200
|
-
"src/index.tsx",
|
|
201
|
-
"cli.ts",
|
|
202
|
-
"src/cli.ts",
|
|
203
|
-
"src/cli/index.ts"
|
|
204
|
-
],
|
|
213
|
+
entry: DEFAULT_ENTYPOINTS,
|
|
205
214
|
format: "esm",
|
|
206
215
|
outDir: "dist",
|
|
207
216
|
target: "node",
|
|
@@ -380,10 +389,11 @@ async function printBuildReport(buildOutput, options) {
|
|
|
380
389
|
for (const file of files) {
|
|
381
390
|
let formatLabel = "";
|
|
382
391
|
if (showFormat) {
|
|
392
|
+
let plainFormatLabel = "";
|
|
383
393
|
if (file.isJs) {
|
|
384
|
-
|
|
394
|
+
plainFormatLabel = `[${file.format}] `;
|
|
385
395
|
}
|
|
386
|
-
formatLabel = pad(
|
|
396
|
+
formatLabel = pc.dim(pad(plainFormatLabel, formatLabelWidth));
|
|
387
397
|
}
|
|
388
398
|
const outDirWithSlash = `${options.outDir}/`;
|
|
389
399
|
const fileName = file.isDts ? pc.green(pc.bold(file.path)) : file.path;
|
|
@@ -441,9 +451,6 @@ async function build(userOptions, rootDir = process.cwd()) {
|
|
|
441
451
|
if (options.silent) {
|
|
442
452
|
logger.setSilent(options.silent);
|
|
443
453
|
}
|
|
444
|
-
if (!options.entry || options.entry.length === 0 || !options.outDir) {
|
|
445
|
-
throw new BunupBuildError("Nothing to build. Please make sure you have provided a proper bunup configuration or cli arguments.");
|
|
446
|
-
}
|
|
447
454
|
if (options.clean) {
|
|
448
455
|
cleanOutDir(rootDir, options.outDir);
|
|
449
456
|
}
|
|
@@ -460,10 +467,19 @@ async function build(userOptions, rootDir = process.cwd()) {
|
|
|
460
467
|
const bunupPlugins = filterBunupPlugins(allPlugins);
|
|
461
468
|
const bunPlugins = filterBunPlugins(allPlugins);
|
|
462
469
|
await runPluginBuildStartHooks(bunupPlugins, options);
|
|
463
|
-
const
|
|
470
|
+
const entryArray = ensureArray(options.entry);
|
|
471
|
+
const entrypoints = await getFilesFromGlobs(entryArray, rootDir);
|
|
464
472
|
if (!entrypoints.length) {
|
|
465
|
-
|
|
473
|
+
if (!ensureArray(userOptions.entry).length) {
|
|
474
|
+
throw new BunupBuildError(noEntryPointsFoundError(DEFAULT_ENTYPOINTS));
|
|
475
|
+
}
|
|
476
|
+
throw new BunupBuildError(invalidEntryPointsError(entryArray));
|
|
466
477
|
}
|
|
478
|
+
logger.info(`entry: ${formatListWithAnd(entrypoints)}`, {
|
|
479
|
+
identifier: options.name,
|
|
480
|
+
once: options.name,
|
|
481
|
+
muted: true
|
|
482
|
+
});
|
|
467
483
|
const buildPromises = ensureArray(options.format).flatMap(async (fmt) => {
|
|
468
484
|
const result = await Bun.build({
|
|
469
485
|
entrypoints: entrypoints.map((file) => `${rootDir}/${file}`),
|
|
@@ -31,9 +31,6 @@ class Logger {
|
|
|
31
31
|
}
|
|
32
32
|
return Logger.instance;
|
|
33
33
|
}
|
|
34
|
-
dispose() {
|
|
35
|
-
this.loggedOnceMessages.clear();
|
|
36
|
-
}
|
|
37
34
|
setSilent(value) {
|
|
38
35
|
this.silent = value ?? false;
|
|
39
36
|
}
|
|
@@ -131,6 +128,14 @@ class Logger {
|
|
|
131
128
|
console.log(...args);
|
|
132
129
|
}
|
|
133
130
|
}
|
|
131
|
+
list(items, options) {
|
|
132
|
+
return items.map((item) => {
|
|
133
|
+
const bullet = pc.cyan("-");
|
|
134
|
+
const text = options?.dim ? pc.dim(item) : item;
|
|
135
|
+
return ` ${bullet} ${text}`;
|
|
136
|
+
}).join(`
|
|
137
|
+
`);
|
|
138
|
+
}
|
|
134
139
|
}
|
|
135
140
|
function logTime(ms) {
|
|
136
141
|
return ms >= 1000 ? pc.green(`${(ms / 1000).toFixed(2)}s`) : pc.green(`${Math.round(ms)}ms`);
|
|
@@ -227,9 +232,12 @@ var handleError = (error, context) => {
|
|
|
227
232
|
errorType = "BUNUP ERROR";
|
|
228
233
|
}
|
|
229
234
|
const knownError = KNOWN_ERRORS.find((error2) => error2.pattern.test(errorMessage) && (error2.errorType === errorType || !error2.errorType));
|
|
230
|
-
if (!knownError
|
|
235
|
+
if (!knownError) {
|
|
231
236
|
console.error(`
|
|
232
|
-
${pc2.
|
|
237
|
+
${pc2.bgRed(` ${errorType} `)}
|
|
238
|
+
${contextPrefix}${errorMessage}`.split(`
|
|
239
|
+
`).map((line) => ` ${line}`).join(`
|
|
240
|
+
`));
|
|
233
241
|
}
|
|
234
242
|
if (knownError) {
|
|
235
243
|
console.log(`
|
|
@@ -249,10 +257,30 @@ ${pc2.red(errorType)} ${contextPrefix}${errorMessage}`);
|
|
|
249
257
|
|
|
250
258
|
<!-- Please provide any additional context about what you were trying to do when the error occurred -->`);
|
|
251
259
|
console.error(pc2.white(`
|
|
252
|
-
If you think this is a bug, please `) + link(issueUrl.toString(), "open an issue") + ` with details about this error
|
|
260
|
+
If you think this is a bug, please `) + link(issueUrl.toString(), "open an issue") + ` with details about this error
|
|
253
261
|
`);
|
|
254
262
|
}
|
|
255
263
|
};
|
|
264
|
+
var noEntryPointsFoundError = (defaultEntrypoints) => {
|
|
265
|
+
return `${pc2.red(pc2.bold(`
|
|
266
|
+
No entry points found`))}
|
|
267
|
+
|
|
268
|
+
` + `Looked for these default entry points:
|
|
269
|
+
|
|
270
|
+
` + logger.list(defaultEntrypoints, { dim: true }) + `
|
|
271
|
+
|
|
272
|
+
You can specify entry points via CLI like ${pc2.green("bunup lib/main.ts")}, ` + `use multiple entries like ${pc2.green("bunup components/button.tsx utils/format.ts")}, or add the entry option in your bunup config.`;
|
|
273
|
+
};
|
|
274
|
+
var invalidEntryPointsError = (userEntrypoints) => {
|
|
275
|
+
const entryPointsFormatted = logger.list(userEntrypoints, { dim: true });
|
|
276
|
+
const isMultiple = userEntrypoints.length > 1;
|
|
277
|
+
return `${pc2.red(pc2.bold(`
|
|
278
|
+
Entry ${isMultiple ? "points do not exist" : "point does not exist"}`))}
|
|
279
|
+
|
|
280
|
+
${entryPointsFormatted}
|
|
281
|
+
|
|
282
|
+
Please check that ${isMultiple ? "these paths exist and point" : "this path exists and points"} to ${isMultiple ? "valid files" : "a valid file"}.`;
|
|
283
|
+
};
|
|
256
284
|
var handleErrorAndExit = (error, context) => {
|
|
257
285
|
handleError(error, context);
|
|
258
286
|
process.exit(1);
|
|
@@ -272,7 +300,7 @@ var CSS_RE = /\.(css)$/;
|
|
|
272
300
|
|
|
273
301
|
// packages/bunup/src/utils.ts
|
|
274
302
|
function ensureArray(value) {
|
|
275
|
-
return Array.isArray(value) ? value : [value];
|
|
303
|
+
return Array.isArray(value) ? value : [value].filter(Boolean);
|
|
276
304
|
}
|
|
277
305
|
function ensureObject(value) {
|
|
278
306
|
return typeof value === "object" && value !== null ? value : {};
|
|
@@ -325,13 +353,20 @@ function getShortFilePath(filePath, maxLength = 3) {
|
|
|
325
353
|
return shortPath;
|
|
326
354
|
}
|
|
327
355
|
async function cleanOutDir(rootDir, outDir) {
|
|
356
|
+
const normalizedOutDir = path.normalize(outDir);
|
|
357
|
+
if (["/", ".", "..", "~"].includes(normalizedOutDir) || normalizedOutDir.startsWith("/") || normalizedOutDir.startsWith("~")) {
|
|
358
|
+
throw new BunupBuildError(`Invalid output directory: "${outDir}" is not allowed`);
|
|
359
|
+
}
|
|
328
360
|
const outDirPath = path.join(rootDir, outDir);
|
|
361
|
+
if (!path.normalize(outDirPath).startsWith(path.normalize(rootDir))) {
|
|
362
|
+
throw new BunupBuildError(`Output directory "${outDir}" escapes root directory`);
|
|
363
|
+
}
|
|
329
364
|
try {
|
|
330
365
|
await fs.rm(outDirPath, { recursive: true, force: true });
|
|
366
|
+
await fs.mkdir(outDirPath, { recursive: true });
|
|
331
367
|
} catch (error) {
|
|
332
|
-
throw new BunupBuildError(`Failed to
|
|
368
|
+
throw new BunupBuildError(`Failed to manage output directory: ${error}`);
|
|
333
369
|
}
|
|
334
|
-
await fs.mkdir(outDirPath, { recursive: true });
|
|
335
370
|
}
|
|
336
371
|
function cleanPath(path2) {
|
|
337
372
|
let cleaned = normalize(path2).replace(/\\/g, "/");
|
|
@@ -866,4 +901,4 @@ function unused(options = {}) {
|
|
|
866
901
|
};
|
|
867
902
|
}
|
|
868
903
|
|
|
869
|
-
export { __toESM, __require, logTime, logger, BunupBuildError, BunupDTSBuildError, BunupCLIError, BunupWatchError, parseErrorMessage, handleError, handleErrorAndExit, ensureArray, ensureObject, getDefaultJsOutputExtension, getDefaultDtsOutputExtention, getPackageDeps, formatFileSize, getShortFilePath, cleanOutDir, cleanPath, getFilesFromGlobs, isTypeScriptFile, isJavascriptFile, replaceExtension, isGlobPattern, exports, injectStyles, shims, unused };
|
|
904
|
+
export { __toESM, __require, logTime, logger, BunupBuildError, BunupDTSBuildError, BunupCLIError, BunupWatchError, parseErrorMessage, handleError, noEntryPointsFoundError, invalidEntryPointsError, handleErrorAndExit, ensureArray, ensureObject, getDefaultJsOutputExtension, getDefaultDtsOutputExtention, getPackageDeps, formatFileSize, getShortFilePath, cleanOutDir, cleanPath, formatListWithAnd, getFilesFromGlobs, isTypeScriptFile, isJavascriptFile, replaceExtension, isGlobPattern, exports, injectStyles, shims, unused };
|
|
@@ -378,7 +378,7 @@ interface BuildOptions {
|
|
|
378
378
|
* Can be 'none', 'linked', 'external', or 'inline'
|
|
379
379
|
* Can also be a boolean - when true, it will use 'inline'
|
|
380
380
|
*
|
|
381
|
-
* @see https://bun.
|
|
381
|
+
* @see https://bun.com/docs/bundler#sourcemap
|
|
382
382
|
*
|
|
383
383
|
* @default 'none'
|
|
384
384
|
*
|
|
@@ -392,7 +392,7 @@ interface BuildOptions {
|
|
|
392
392
|
* Define global constants for the build
|
|
393
393
|
* These values will be replaced at build time
|
|
394
394
|
*
|
|
395
|
-
* @see https://bun.
|
|
395
|
+
* @see https://bun.com/docs/bundler#define
|
|
396
396
|
*
|
|
397
397
|
* @example
|
|
398
398
|
* define: {
|
|
@@ -426,7 +426,7 @@ interface BuildOptions {
|
|
|
426
426
|
/**
|
|
427
427
|
* 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.
|
|
428
428
|
*
|
|
429
|
-
* @see https://bun.
|
|
429
|
+
* @see https://bun.com/docs/bundler#banner
|
|
430
430
|
*
|
|
431
431
|
* @example
|
|
432
432
|
* banner: '"use client";'
|
|
@@ -435,7 +435,7 @@ interface BuildOptions {
|
|
|
435
435
|
/**
|
|
436
436
|
* A footer to be added to the final bundle, this can be something like a comment block for a license or just a fun easter egg.
|
|
437
437
|
*
|
|
438
|
-
* @see https://bun.
|
|
438
|
+
* @see https://bun.com/docs/bundler#footer
|
|
439
439
|
*
|
|
440
440
|
* @example
|
|
441
441
|
* footer: '// built with love in SF'
|
|
@@ -444,16 +444,16 @@ interface BuildOptions {
|
|
|
444
444
|
/**
|
|
445
445
|
* Remove function calls from a bundle. For example, `drop: ["console"]` will remove all calls to `console.log`. Arguments to calls will also be removed, regardless of if those arguments may have side effects. Dropping `debugger` will remove all `debugger` statements.
|
|
446
446
|
*
|
|
447
|
-
* @see https://bun.
|
|
447
|
+
* @see https://bun.com/docs/bundler#drop
|
|
448
448
|
*
|
|
449
449
|
* @example
|
|
450
450
|
* drop: ["console", "debugger", "anyIdentifier.or.propertyAccess"]
|
|
451
451
|
*/
|
|
452
452
|
drop?: string[];
|
|
453
453
|
/**
|
|
454
|
-
* A map of file extensions to [built-in loader names](https://bun.
|
|
454
|
+
* A map of file extensions to [built-in loader names](https://bun.com/docs/bundler/loaders#built-in-loaders). This can be used to quickly customize how certain files are loaded.
|
|
455
455
|
*
|
|
456
|
-
* @see https://bun.
|
|
456
|
+
* @see https://bun.com/docs/bundler#loader
|
|
457
457
|
*
|
|
458
458
|
* @example
|
|
459
459
|
* loader: {
|
|
@@ -494,7 +494,7 @@ interface BuildOptions {
|
|
|
494
494
|
* Note: Values are injected at build time. Secrets or private keys should be excluded
|
|
495
495
|
* from inlining when targeting browser environments.
|
|
496
496
|
*
|
|
497
|
-
* @see https://bun.
|
|
497
|
+
* @see https://bun.com/docs/bundler#env to learn more about inline, disable, prefix, and object modes
|
|
498
498
|
*
|
|
499
499
|
* @example
|
|
500
500
|
* // Inline all environment variables available at build time
|
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.14.
|
|
4
|
+
"version": "0.14.12",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist"
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"bunup": "dist/cli/index.js"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@bunup/dts": "0.14.
|
|
50
|
+
"@bunup/dts": "0.14.12",
|
|
51
51
|
"chokidar": "^4.0.3",
|
|
52
52
|
"coffi": "^0.1.35",
|
|
53
53
|
"lightningcss": "^1.30.1",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"tinyexec": "^1.0.1",
|
|
56
56
|
"tree-kill": "^1.2.2",
|
|
57
57
|
"zlye": "^0.4.4",
|
|
58
|
-
"@bunup/shared": "0.14.
|
|
58
|
+
"@bunup/shared": "0.14.12"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
61
|
"typescript": ">=4.5.0"
|