bunup 0.10.0 → 0.11.1
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 -4
- package/dist/cli/index.js +5 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/plugins.d.ts +6 -2
- package/dist/plugins.js +3 -3
- package/dist/shared/{chunk-66717fpt.js → bunup-q39v2kct.js} +14 -1
- package/dist/shared/{chunk-jkkyf16j.js → bunup-qnygs651.js} +1 -1
- package/dist/shared/{chunk-d8x7sy99.d.ts → bunup-rhnc0fq5.d.ts} +59 -9
- package/package.json +12 -14
package/README.md
CHANGED
|
@@ -7,13 +7,13 @@
|
|
|
7
7
|
<!-- markdownlint-disable-next-line no-alt-text -->
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-

|
|
11
11
|
|
|
12
|
-

|
|
13
13
|
|
|
14
14
|
[](https://npmjs.com/package/bunup) [](https://bun.sh) [](https://github.com/sponsors/arshad-yaseen)
|
|
15
15
|
|
|
16
|
-
Bunup is the **blazing-fast build tool** for TypeScript libraries, designed for flawless developer experience and speed, **powered by Bun**.
|
|
16
|
+
Bunup is the **blazing-fast build tool** for TypeScript libraries, designed for flawless developer experience and speed, **powered by Bun**.
|
|
17
17
|
|
|
18
18
|
</div>
|
|
19
19
|
<!-- markdownlint-restore -->
|
|
@@ -34,7 +34,7 @@ To get started, visit the [documentation](https://bunup.dev).
|
|
|
34
34
|
|
|
35
35
|
## ❤️ Contributing
|
|
36
36
|
|
|
37
|
-
For guidelines on contributing, please read the [contributing guide](
|
|
37
|
+
For guidelines on contributing, please read the [contributing guide](CONTRIBUTING.md).
|
|
38
38
|
|
|
39
39
|
We welcome contributions from the community to enhance Bunup's capabilities and make it even more powerful.
|
|
40
40
|
|
package/dist/cli/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
build,
|
|
5
5
|
createBuildOptions,
|
|
6
6
|
processLoadedConfigs
|
|
7
|
-
} from "../shared/
|
|
7
|
+
} from "../shared/bunup-qnygs651.js";
|
|
8
8
|
import {
|
|
9
9
|
BunupCLIError,
|
|
10
10
|
BunupWatchError,
|
|
@@ -18,13 +18,13 @@ import {
|
|
|
18
18
|
logger,
|
|
19
19
|
parseErrorMessage,
|
|
20
20
|
setSilent
|
|
21
|
-
} from "../shared/
|
|
21
|
+
} from "../shared/bunup-q39v2kct.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.11.1";
|
|
28
28
|
|
|
29
29
|
// src/watch.ts
|
|
30
30
|
import path from "path";
|
|
@@ -61,7 +61,8 @@ async function watch(partialOptions, rootDir) {
|
|
|
61
61
|
await build({ ...options, silent: !initial }, rootDir);
|
|
62
62
|
if (!initial) {
|
|
63
63
|
console.clear();
|
|
64
|
-
console.log(
|
|
64
|
+
console.log("");
|
|
65
|
+
console.log(`${rebuildCount > 1 ? pc.magenta(`[x${rebuildCount}] `) : ""}${pc.green(`Rebuilt in ${logTime(performance.now() - start)}`)}: ${changed}${options.name ? ` ${pc.bgBlueBright(` ${options.name} `)}` : ""} `);
|
|
65
66
|
}
|
|
66
67
|
rebuildCount++;
|
|
67
68
|
} catch (error) {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Arrayable, BuildOptions, DefineConfigItem, DefineWorkspaceItem, Plugin, WithOptional } from "./shared/
|
|
1
|
+
import { Arrayable, BuildOptions, DefineConfigItem, DefineWorkspaceItem, Plugin, WithOptional } from "./shared/bunup-rhnc0fq5";
|
|
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?: Partial<DefineConfigItem>): DefineWorkspaceItem[];
|
package/dist/index.js
CHANGED
package/dist/plugins.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BuildContext, BunupPlugin, MaybePromise, Plugin } from "./shared/
|
|
1
|
+
import { BuildContext, BunupPlugin, MaybePromise, Plugin } from "./shared/bunup-rhnc0fq5";
|
|
2
2
|
/**
|
|
3
3
|
* A plugin that copies files and directories to the output directory.
|
|
4
4
|
*
|
|
@@ -29,8 +29,12 @@ interface ExportsPluginOptions {
|
|
|
29
29
|
* @see https://bunup.dev/docs/plugins/exports
|
|
30
30
|
*/
|
|
31
31
|
declare function exports(options?: ExportsPluginOptions): BunupPlugin;
|
|
32
|
-
type InjectStylesPluginOptions = Pick<import("lightningcss").TransformOptions<import("lightningcss").CustomAtRules>, "sourceMap" | "inputSourceMap" | "targets" | "nonStandard" | "
|
|
32
|
+
type InjectStylesPluginOptions = Pick<import("lightningcss").TransformOptions<import("lightningcss").CustomAtRules>, "sourceMap" | "inputSourceMap" | "targets" | "nonStandard" | "pseudoClasses" | "unusedSymbols" | "errorRecovery" | "visitor" | "customAtRules" | "include" | "exclude" | "drafts"> & {
|
|
33
33
|
inject?: (css: string, filePath: string) => MaybePromise<string>
|
|
34
|
+
/** Whether to minify the CSS.
|
|
35
|
+
* @default true
|
|
36
|
+
*/
|
|
37
|
+
minify?: boolean
|
|
34
38
|
};
|
|
35
39
|
/**
|
|
36
40
|
* A plugin that injects styles into the document head.
|
package/dist/plugins.js
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
getPackageForPlugin,
|
|
10
10
|
isDirectoryPath,
|
|
11
11
|
logger
|
|
12
|
-
} from "./shared/
|
|
12
|
+
} from "./shared/bunup-q39v2kct.js";
|
|
13
13
|
|
|
14
14
|
// src/plugins/built-in/copy.ts
|
|
15
15
|
import { basename, join } from "path";
|
|
@@ -283,7 +283,7 @@ function injectStyles(options) {
|
|
|
283
283
|
contents: `
|
|
284
284
|
export default function injectStyle(css) {
|
|
285
285
|
if (!css || typeof document === 'undefined') return
|
|
286
|
-
|
|
286
|
+
|
|
287
287
|
const head = document.head || document.getElementsByTagName('head')[0]
|
|
288
288
|
const style = document.createElement('style')
|
|
289
289
|
head.appendChild(style)
|
|
@@ -304,7 +304,7 @@ function injectStyles(options) {
|
|
|
304
304
|
...transformOptions,
|
|
305
305
|
filename: path2.basename(args.path),
|
|
306
306
|
code: Buffer.from(source),
|
|
307
|
-
minify: transformOptions.minify ??
|
|
307
|
+
minify: transformOptions.minify ?? true
|
|
308
308
|
});
|
|
309
309
|
for (const warning of warnings) {
|
|
310
310
|
logger.warn(warning.message);
|
|
@@ -238,6 +238,19 @@ var KNOWN_ERRORS = [
|
|
|
238
238
|
logSolution: () => {
|
|
239
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.");
|
|
240
240
|
}
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
pattern: /Multiple files share the same output path/i,
|
|
244
|
+
errorType: "BUILD ERROR",
|
|
245
|
+
logSolution: () => {
|
|
246
|
+
logger.log(pc2.yellow("CSS Import Detected") + `
|
|
247
|
+
|
|
248
|
+
You're importing CSS files in JavaScript. To bundle styles properly, use the ` + pc2.green("injectStyles()") + ` plugin.
|
|
249
|
+
|
|
250
|
+
` + pc2.dim("This plugin transforms CSS imports into JavaScript that automatically ") + pc2.dim(`injects styles into the document head at runtime.
|
|
251
|
+
|
|
252
|
+
`) + "Learn more: " + pc2.blue("https://bunup.dev/docs/plugins/inject-styles"));
|
|
253
|
+
}
|
|
241
254
|
}
|
|
242
255
|
];
|
|
243
256
|
var handleError = (error, context) => {
|
|
@@ -269,7 +282,7 @@ ${pc2.red(errorType)} ${contextPrefix}${errorMessage}`);
|
|
|
269
282
|
console.log(`
|
|
270
283
|
`);
|
|
271
284
|
} else {
|
|
272
|
-
const issueUrl = new URL("https://github.com/
|
|
285
|
+
const issueUrl = new URL("https://github.com/bunup/bunup/issues/new");
|
|
273
286
|
issueUrl.searchParams.set("title", `[${errorType}] Error encountered`);
|
|
274
287
|
issueUrl.searchParams.set("body", `## Error Details
|
|
275
288
|
|
|
@@ -225,7 +225,7 @@ interface BuildOptions {
|
|
|
225
225
|
* without modification. However, bundling your server code can reduce startup times and
|
|
226
226
|
* improve running performance.
|
|
227
227
|
*
|
|
228
|
-
* All bundles generated with
|
|
228
|
+
* All bundles generated with \`target: "bun"\` are marked with a special \`// @bun\` pragma, which
|
|
229
229
|
* indicates to the Bun runtime that there's no need to re-transpile the file before execution.
|
|
230
230
|
*/
|
|
231
231
|
target?: Target;
|
|
@@ -250,7 +250,18 @@ interface BuildOptions {
|
|
|
250
250
|
* sourcemap: true // equivalent to 'inline'
|
|
251
251
|
*/
|
|
252
252
|
sourcemap?: Sourcemap;
|
|
253
|
-
|
|
253
|
+
/**
|
|
254
|
+
* Define global constants for the build
|
|
255
|
+
* These values will be replaced at build time
|
|
256
|
+
*
|
|
257
|
+
* @see https://bun.sh/docs/bundler#define
|
|
258
|
+
*
|
|
259
|
+
* @example
|
|
260
|
+
* define: {
|
|
261
|
+
* 'process.env.NODE_ENV': '"production"',
|
|
262
|
+
* 'PACKAGE_VERSION': '"1.0.0"'
|
|
263
|
+
* }
|
|
264
|
+
*/
|
|
254
265
|
define?: Define;
|
|
255
266
|
/**
|
|
256
267
|
* A callback or command to run after a successful build.
|
|
@@ -274,7 +285,14 @@ interface BuildOptions {
|
|
|
274
285
|
* }
|
|
275
286
|
*/
|
|
276
287
|
onSuccess?: OnSuccess;
|
|
277
|
-
|
|
288
|
+
/**
|
|
289
|
+
* 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.
|
|
290
|
+
*
|
|
291
|
+
* @see https://bun.sh/docs/bundler#banner
|
|
292
|
+
*
|
|
293
|
+
* @example
|
|
294
|
+
* banner: '"use client";'
|
|
295
|
+
*/
|
|
278
296
|
banner?: string;
|
|
279
297
|
/**
|
|
280
298
|
* 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.
|
|
@@ -339,12 +357,12 @@ interface BuildOptions {
|
|
|
339
357
|
* Controls how environment variables are handled during bundling.
|
|
340
358
|
*
|
|
341
359
|
* Can be one of:
|
|
342
|
-
* -
|
|
360
|
+
* - \`"inline"\`: Replaces all \`process.env.FOO\` references in your code with the actual values
|
|
343
361
|
* of those environment variables at the time the build runs.
|
|
344
|
-
* -
|
|
345
|
-
* - A string ending in
|
|
346
|
-
* For example,
|
|
347
|
-
* - An object of key-value pairs: Replaces both
|
|
362
|
+
* - \`"disable"\`: Disables environment variable injection entirely, leaving \`process.env.*\` as-is.
|
|
363
|
+
* - A string ending in \`*\`: Only inlines environment variables matching the given prefix.
|
|
364
|
+
* For example, \`"MY_PUBLIC_*"\` will inline variables like \`MY_PUBLIC_API_URL\`.
|
|
365
|
+
* - An object of key-value pairs: Replaces both \`process.env.KEY\` and \`import.meta.env.KEY\`
|
|
348
366
|
* with the provided values, regardless of the runtime environment.
|
|
349
367
|
*
|
|
350
368
|
* Note: Values are injected at build time. Secrets or private keys should be excluded
|
|
@@ -376,7 +394,39 @@ interface BuildOptions {
|
|
|
376
394
|
* Force emitting @__PURE__ annotations even if minify.whitespace is true.
|
|
377
395
|
*/
|
|
378
396
|
emitDCEAnnotations?: boolean;
|
|
379
|
-
|
|
397
|
+
/**
|
|
398
|
+
* Plugins to extend the build process functionality
|
|
399
|
+
*
|
|
400
|
+
* The Plugin type uses a discriminated union pattern with the 'type' field
|
|
401
|
+
* to support different plugin systems. Both "bun" and "bunup" plugins are supported.
|
|
402
|
+
*
|
|
403
|
+
* Each plugin type has its own specific plugin implementation:
|
|
404
|
+
* - "bun": Uses Bun's native plugin system (BunPlugin)
|
|
405
|
+
* - "bunup": Uses bunup's own plugin system with lifecycle hooks
|
|
406
|
+
*
|
|
407
|
+
* This architecture allows for extensibility as more plugin systems are added.
|
|
408
|
+
*
|
|
409
|
+
* @see https://bunup.dev/docs/advanced/plugin-development for more information on plugins
|
|
410
|
+
*
|
|
411
|
+
* @example
|
|
412
|
+
* plugins: [
|
|
413
|
+
* {
|
|
414
|
+
* type: "bun",
|
|
415
|
+
* plugin: myBunPlugin()
|
|
416
|
+
* },
|
|
417
|
+
* {
|
|
418
|
+
* type: "bunup",
|
|
419
|
+
* hooks: {
|
|
420
|
+
* onBuildStart: (options) => {
|
|
421
|
+
* console.log('Build started with options:', options)
|
|
422
|
+
* },
|
|
423
|
+
* onBuildDone: ({ options, output }) => {
|
|
424
|
+
* console.log('Build completed with output:', output)
|
|
425
|
+
* }
|
|
426
|
+
* }
|
|
427
|
+
* }
|
|
428
|
+
* ]
|
|
429
|
+
*/
|
|
380
430
|
plugins?: Plugin[];
|
|
381
431
|
}
|
|
382
432
|
type MaybePromise<T> = Promise<T> | T;
|
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.11.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist"
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
],
|
|
34
34
|
"repository": {
|
|
35
35
|
"type": "git",
|
|
36
|
-
"url": "git+https://github.com/
|
|
36
|
+
"url": "git+https://github.com/bunup/bunup.git"
|
|
37
37
|
},
|
|
38
38
|
"funding": "https://github.com/sponsors/arshad-yaseen",
|
|
39
39
|
"homepage": "https://bunup.dev",
|
|
@@ -51,15 +51,14 @@
|
|
|
51
51
|
"picocolors": "^1.1.1",
|
|
52
52
|
"tinyexec": "^1.0.1",
|
|
53
53
|
"tree-kill": "^1.2.2",
|
|
54
|
-
"typeroll": "^0.
|
|
54
|
+
"typeroll": "^0.7.2"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@biomejs/biome": "2.
|
|
57
|
+
"@biomejs/biome": "2.2.0",
|
|
58
58
|
"@types/bun": "^1.2.20",
|
|
59
|
-
"bumpp": "^10.2.
|
|
60
|
-
"husky": "^9.1.7",
|
|
59
|
+
"bumpp": "^10.2.3",
|
|
61
60
|
"lightningcss": "^1.30.1",
|
|
62
|
-
"
|
|
61
|
+
"simple-git-hooks": "^2.13.1",
|
|
63
62
|
"typescript": "^5.9.2"
|
|
64
63
|
},
|
|
65
64
|
"peerDependencies": {
|
|
@@ -83,19 +82,18 @@
|
|
|
83
82
|
"format:fix": "biome format --write .",
|
|
84
83
|
"lint": "biome check .",
|
|
85
84
|
"lint:fix": "biome check --write .",
|
|
86
|
-
"prepare": "husky",
|
|
87
85
|
"test": "bun test",
|
|
88
|
-
"test-build": "bun run --cwd tests build",
|
|
89
86
|
"tsc": "tsc --noEmit",
|
|
90
87
|
"publish:ci": "bun publish --access public --no-git-checks",
|
|
91
|
-
"release": "bumpp"
|
|
88
|
+
"release": "bumpp -r --commit --push --tag",
|
|
89
|
+
"prepare": "simple-git-hooks"
|
|
92
90
|
},
|
|
93
|
-
"
|
|
94
|
-
"
|
|
95
|
-
"src/**/*.(m|c)?(j|t)s": "bun run tsc"
|
|
91
|
+
"simple-git-hooks": {
|
|
92
|
+
"pre-commit": "bun run lint:fix && git add ."
|
|
96
93
|
},
|
|
97
94
|
"workspaces": [
|
|
98
95
|
"docs",
|
|
99
|
-
"tests"
|
|
96
|
+
"tests",
|
|
97
|
+
"examples/**"
|
|
100
98
|
]
|
|
101
99
|
}
|