bunup 0.14.17 → 0.14.19
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 +10 -0
- package/dist/cli/index.js +13 -6
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/plugins.d.ts +1 -1
- package/dist/plugins.js +1 -1
- package/dist/shared/{bunup-jccqd6kz.js → bunup-5jz4dbz1.js} +24 -4
- package/dist/shared/{bunup-025ckbke.js → bunup-8meww5p0.js} +13 -5
- package/dist/shared/{bunup-a8zeh83z.d.ts → bunup-zqdmwaar.d.ts} +40 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -73,6 +73,16 @@ See more in [Scaffold with Bunup](./docs/scaffold-with-bunup.md).
|
|
|
73
73
|
|
|
74
74
|
For more, see the full documentation: https://bunup.dev
|
|
75
75
|
|
|
76
|
+
## 📚 Examples
|
|
77
|
+
|
|
78
|
+
Check out the [examples directory](./examples) for example usage:
|
|
79
|
+
|
|
80
|
+
- [Simple TypeScript library](./examples/basic)
|
|
81
|
+
- [Workspace with multiple packages](./examples/basic-monorepo)
|
|
82
|
+
- [React component library styled with plain CSS](./examples/react-with-pure-css)
|
|
83
|
+
- [React component library styled with CSS Modules](./examples/react-with-css-modules)
|
|
84
|
+
- [React component library styled with Tailwind CSS](./examples/react-with-tailwindcss)
|
|
85
|
+
|
|
76
86
|
## ❤️ Contributing
|
|
77
87
|
|
|
78
88
|
We welcome contributions! Please read the [contributing guide](CONTRIBUTING.md).
|
package/dist/cli/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
build,
|
|
5
5
|
processLoadedConfigs,
|
|
6
6
|
resolveBuildOptions
|
|
7
|
-
} from "../shared/bunup-
|
|
7
|
+
} from "../shared/bunup-5jz4dbz1.js";
|
|
8
8
|
import {
|
|
9
9
|
BunupCLIError,
|
|
10
10
|
BunupWatchError,
|
|
@@ -20,13 +20,13 @@ import {
|
|
|
20
20
|
logTime,
|
|
21
21
|
logger,
|
|
22
22
|
parseErrorMessage
|
|
23
|
-
} from "../shared/bunup-
|
|
23
|
+
} from "../shared/bunup-8meww5p0.js";
|
|
24
24
|
|
|
25
25
|
// packages/bunup/src/cli/index.ts
|
|
26
26
|
import { loadConfig } from "coffi";
|
|
27
27
|
import pc4 from "picocolors";
|
|
28
28
|
// packages/bunup/package.json
|
|
29
|
-
var version = "0.14.
|
|
29
|
+
var version = "0.14.19";
|
|
30
30
|
|
|
31
31
|
// packages/bunup/src/printer/print-build-report.ts
|
|
32
32
|
import { promisify } from "util";
|
|
@@ -207,8 +207,8 @@ async function watch(userOptions, rootDir, configFilePath) {
|
|
|
207
207
|
};
|
|
208
208
|
watcher.on("change", (changedPath) => {
|
|
209
209
|
if (configFilePath && changedPath === configFilePath) {
|
|
210
|
-
console.log(pc2.yellow(`
|
|
211
|
-
|
|
210
|
+
console.log(pc2.yellow(`
|
|
211
|
+
Please restart watch mode to apply configuration changes.`));
|
|
212
212
|
cleanup();
|
|
213
213
|
return;
|
|
214
214
|
}
|
|
@@ -263,7 +263,14 @@ var program = cli().name("bunup").version(version).description("A blazing-fast b
|
|
|
263
263
|
"text",
|
|
264
264
|
"css",
|
|
265
265
|
"html"
|
|
266
|
-
])).describe("File extension to loader mapping").example("--loader.'.css'=text --loader.'.txt'=file").optional()).option("public-path", z.string().describe("Public path prefix for assets and chunk files").example("https://cdn.example.com/").optional()).option("
|
|
266
|
+
])).describe("File extension to loader mapping").example("--loader.'.css'=text --loader.'.txt'=file").optional()).option("public-path", z.string().describe("Public path prefix for assets and chunk files").example("https://cdn.example.com/").optional()).option("jsx", z.object({
|
|
267
|
+
runtime: z.string().choices(["automatic", "classic"]).describe("JSX runtime mode").optional(),
|
|
268
|
+
"import-source": z.string().describe("Import source for JSX functions").optional(),
|
|
269
|
+
factory: z.string().describe("JSX factory function name").optional(),
|
|
270
|
+
fragment: z.string().describe("JSX fragment function name").optional(),
|
|
271
|
+
"side-effects": z.boolean().describe("Whether JSX functions have side effects").optional(),
|
|
272
|
+
development: z.boolean().describe("Use jsx-dev runtime for development").optional()
|
|
273
|
+
}).describe("Configure JSX transform behavior").optional()).option("ignore-dce-annotations", z.boolean().describe("Ignore dead code elimination annotations (@__PURE__, sideEffects)")).option("emit-dce-annotations", z.boolean().describe("Force emit @__PURE__ annotations even with minification")).option("on-success", z.string().describe("Command to run after successful build").optional()).option("exports", z.union(z.boolean(), z.object({
|
|
267
274
|
exclude: z.array(z.string()).describe("Entry points to exclude from exports field").optional(),
|
|
268
275
|
"exclude-css": z.boolean().describe("Whether to exclude CSS files from exports field").optional(),
|
|
269
276
|
"include-package-json": z.boolean().describe('Whether to include "./package.json" in exports field').default(true),
|
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-zqdmwaar";
|
|
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-5jz4dbz1.js";
|
|
5
|
+
import"./shared/bunup-8meww5p0.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-zqdmwaar";
|
|
2
2
|
type CopyOptions = {
|
|
3
3
|
/** Whether to follow symbolic links when copying files. */
|
|
4
4
|
followSymlinks?: boolean;
|
package/dist/plugins.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
BunupBuildError,
|
|
4
4
|
BunupDTSBuildError,
|
|
5
|
+
BunupVersionError,
|
|
5
6
|
cleanOutDir,
|
|
6
7
|
cleanPath,
|
|
7
8
|
ensureArray,
|
|
@@ -22,7 +23,7 @@ import {
|
|
|
22
23
|
replaceExtension,
|
|
23
24
|
shims,
|
|
24
25
|
unused
|
|
25
|
-
} from "./bunup-
|
|
26
|
+
} from "./bunup-8meww5p0.js";
|
|
26
27
|
|
|
27
28
|
// packages/bunup/src/loaders.ts
|
|
28
29
|
import path from "path";
|
|
@@ -30,7 +31,7 @@ import { loadConfig } from "coffi";
|
|
|
30
31
|
async function processLoadedConfigs(config, cwd, filter) {
|
|
31
32
|
return Array.isArray(config) && "root" in config[0] ? config.filter((c) => filter ? filter.includes(c.name) : true).map((c) => ({
|
|
32
33
|
rootDir: path.resolve(cwd, c.root),
|
|
33
|
-
options: setOrSuffixField(c.config, "name", c.name)
|
|
34
|
+
options: setOrSuffixField(c.config ?? {}, "name", c.name)
|
|
34
35
|
})) : [
|
|
35
36
|
{
|
|
36
37
|
rootDir: cwd,
|
|
@@ -62,6 +63,20 @@ async function loadPackageJson(cwd = process.cwd()) {
|
|
|
62
63
|
import path2 from "path";
|
|
63
64
|
import { generateDts, logIsolatedDeclarationErrors } from "@bunup/dts";
|
|
64
65
|
|
|
66
|
+
// packages/bunup/src/ensure-bun-version.ts
|
|
67
|
+
import pc from "picocolors";
|
|
68
|
+
var MINIMUM_BUN_VERSION = "1.0.11";
|
|
69
|
+
function ensureBunVersion(requiredVersion, feature) {
|
|
70
|
+
const currentVersion = Bun.version;
|
|
71
|
+
const satisfiesRequirement = Bun.semver.satisfies(currentVersion, `>=${requiredVersion}`);
|
|
72
|
+
if (!satisfiesRequirement) {
|
|
73
|
+
throw new BunupVersionError(pc.white(`Bun version ${pc.cyan(requiredVersion)} or higher is required${feature ? ` for ${feature}` : ""}. You have ${pc.yellow(currentVersion)} installed. Run ${pc.green("bun upgrade")} to update.`));
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
function ensureMinimumBunVersion() {
|
|
77
|
+
ensureBunVersion(MINIMUM_BUN_VERSION);
|
|
78
|
+
}
|
|
79
|
+
|
|
65
80
|
// packages/bunup/src/helpers/on-success.ts
|
|
66
81
|
import { exec } from "tinyexec";
|
|
67
82
|
import treeKill from "tree-kill";
|
|
@@ -216,11 +231,14 @@ var DEFAULT_OPTIONS = {
|
|
|
216
231
|
clean: true
|
|
217
232
|
};
|
|
218
233
|
function resolveBuildOptions(userOptions) {
|
|
219
|
-
const
|
|
234
|
+
const options = {
|
|
220
235
|
...DEFAULT_OPTIONS,
|
|
221
236
|
...userOptions
|
|
222
237
|
};
|
|
223
|
-
|
|
238
|
+
if (options.jsx) {
|
|
239
|
+
ensureBunVersion("1.2.23", "jsx option");
|
|
240
|
+
}
|
|
241
|
+
return options;
|
|
224
242
|
}
|
|
225
243
|
function resolvePlugins(options, packageJsonData) {
|
|
226
244
|
const plugins = [];
|
|
@@ -321,6 +339,7 @@ async function runPluginBuildDoneHooks(bunupPlugins, options, output, meta) {
|
|
|
321
339
|
// packages/bunup/src/build.ts
|
|
322
340
|
var ac = null;
|
|
323
341
|
async function build(userOptions, rootDir = process.cwd()) {
|
|
342
|
+
ensureMinimumBunVersion();
|
|
324
343
|
if (ac) {
|
|
325
344
|
ac.abort();
|
|
326
345
|
}
|
|
@@ -390,6 +409,7 @@ async function build(userOptions, rootDir = process.cwd()) {
|
|
|
390
409
|
env: resolvedEnv,
|
|
391
410
|
ignoreDCEAnnotations: options.ignoreDCEAnnotations,
|
|
392
411
|
emitDCEAnnotations: options.emitDCEAnnotations,
|
|
412
|
+
jsx: options.jsx,
|
|
393
413
|
throw: false,
|
|
394
414
|
plugins: bunPlugins
|
|
395
415
|
});
|
|
@@ -191,6 +191,13 @@ class BunupPluginError extends BunupError {
|
|
|
191
191
|
this.name = "BunupPluginError";
|
|
192
192
|
}
|
|
193
193
|
}
|
|
194
|
+
|
|
195
|
+
class BunupVersionError extends BunupError {
|
|
196
|
+
constructor(message) {
|
|
197
|
+
super(message);
|
|
198
|
+
this.name = "BunupVersionError";
|
|
199
|
+
}
|
|
200
|
+
}
|
|
194
201
|
var parseErrorMessage = (error) => {
|
|
195
202
|
if (error instanceof Error) {
|
|
196
203
|
return error.message;
|
|
@@ -228,6 +235,8 @@ var handleError = (error, context) => {
|
|
|
228
235
|
errorType = "WATCH ERROR";
|
|
229
236
|
} else if (error instanceof BunupPluginError) {
|
|
230
237
|
errorType = "PLUGIN ERROR";
|
|
238
|
+
} else if (error instanceof BunupVersionError) {
|
|
239
|
+
errorType = "VERSION ERROR";
|
|
231
240
|
} else if (error instanceof BunupError) {
|
|
232
241
|
errorType = "BUNUP ERROR";
|
|
233
242
|
}
|
|
@@ -235,6 +244,7 @@ var handleError = (error, context) => {
|
|
|
235
244
|
if (!knownError) {
|
|
236
245
|
console.error(`
|
|
237
246
|
${pc2.bgRed(` ${errorType} `)}
|
|
247
|
+
|
|
238
248
|
${contextPrefix}${errorMessage}`.split(`
|
|
239
249
|
`).map((line) => ` ${line}`).join(`
|
|
240
250
|
`));
|
|
@@ -262,8 +272,7 @@ ${contextPrefix}${errorMessage}`.split(`
|
|
|
262
272
|
}
|
|
263
273
|
};
|
|
264
274
|
var noEntryPointsFoundError = (defaultEntrypoints) => {
|
|
265
|
-
return `${pc2.red(pc2.bold(
|
|
266
|
-
No entry points found`))}
|
|
275
|
+
return `${pc2.red(pc2.bold("No entry points found"))}
|
|
267
276
|
|
|
268
277
|
` + `Looked for these default entry points:
|
|
269
278
|
|
|
@@ -274,8 +283,7 @@ You can specify entry points via CLI like ${pc2.green("bunup lib/main.ts")}, ` +
|
|
|
274
283
|
var invalidEntryPointsError = (userEntrypoints) => {
|
|
275
284
|
const entryPointsFormatted = logger.list(userEntrypoints, { dim: true });
|
|
276
285
|
const isMultiple = userEntrypoints.length > 1;
|
|
277
|
-
return `${pc2.red(pc2.bold(`
|
|
278
|
-
Entry ${isMultiple ? "points do not exist" : "point does not exist"}`))}
|
|
286
|
+
return `${pc2.red(pc2.bold(`Entry ${isMultiple ? "points do not exist" : "point does not exist"}`))}
|
|
279
287
|
|
|
280
288
|
${entryPointsFormatted}
|
|
281
289
|
|
|
@@ -898,4 +906,4 @@ function unused(options = {}) {
|
|
|
898
906
|
};
|
|
899
907
|
}
|
|
900
908
|
|
|
901
|
-
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 };
|
|
909
|
+
export { __toESM, __require, logTime, logger, BunupBuildError, BunupDTSBuildError, BunupCLIError, BunupWatchError, BunupVersionError, parseErrorMessage, handleError, noEntryPointsFoundError, invalidEntryPointsError, handleErrorAndExit, ensureArray, ensureObject, getDefaultJsOutputExtension, getDefaultDtsOutputExtention, getPackageDeps, formatFileSize, getShortFilePath, cleanOutDir, cleanPath, formatListWithAnd, getFilesFromGlobs, isTypeScriptFile, isJavascriptFile, replaceExtension, isGlobPattern, exports, injectStyles, shims, unused };
|
|
@@ -262,6 +262,41 @@ type ReportOptions = {
|
|
|
262
262
|
*/
|
|
263
263
|
maxBundleSize?: number;
|
|
264
264
|
};
|
|
265
|
+
type JSXOptions = {
|
|
266
|
+
/**
|
|
267
|
+
* JSX runtime mode
|
|
268
|
+
* @default "automatic"
|
|
269
|
+
*/
|
|
270
|
+
runtime?: "automatic" | "classic";
|
|
271
|
+
/**
|
|
272
|
+
* Import source for JSX functions
|
|
273
|
+
* @default "react"
|
|
274
|
+
* @example "preact"
|
|
275
|
+
*/
|
|
276
|
+
importSource?: string;
|
|
277
|
+
/**
|
|
278
|
+
* JSX factory function name
|
|
279
|
+
* @default "React.createElement"
|
|
280
|
+
* @example "h"
|
|
281
|
+
*/
|
|
282
|
+
factory?: string;
|
|
283
|
+
/**
|
|
284
|
+
* JSX fragment function name
|
|
285
|
+
* @default "React.Fragment"
|
|
286
|
+
* @example "Fragment"
|
|
287
|
+
*/
|
|
288
|
+
fragment?: string;
|
|
289
|
+
/**
|
|
290
|
+
* Whether JSX functions have side effects
|
|
291
|
+
* @default false
|
|
292
|
+
*/
|
|
293
|
+
sideEffects?: boolean;
|
|
294
|
+
/**
|
|
295
|
+
* Use jsx-dev runtime for development
|
|
296
|
+
* @default false
|
|
297
|
+
*/
|
|
298
|
+
development?: boolean;
|
|
299
|
+
};
|
|
265
300
|
interface BuildOptions {
|
|
266
301
|
/**
|
|
267
302
|
* Name of the build configuration
|
|
@@ -554,6 +589,10 @@ interface BuildOptions {
|
|
|
554
589
|
*/
|
|
555
590
|
plugins?: (BunupPlugin | BunPlugin2)[];
|
|
556
591
|
/**
|
|
592
|
+
* Configure JSX transform behavior. Allows fine-grained control over how JSX is compiled.
|
|
593
|
+
*/
|
|
594
|
+
jsx?: JSXOptions;
|
|
595
|
+
/**
|
|
557
596
|
* Options for CSS handling in the build process.
|
|
558
597
|
*/
|
|
559
598
|
css?: CSSOptions;
|
|
@@ -598,6 +637,6 @@ type DefineConfigItem = WithOptional<BuildOptions, "outDir" | "format" | "entry"
|
|
|
598
637
|
type DefineWorkspaceItem = {
|
|
599
638
|
name: string;
|
|
600
639
|
root: string;
|
|
601
|
-
config
|
|
640
|
+
config?: DefineConfigItem | DefineConfigItem[];
|
|
602
641
|
};
|
|
603
642
|
export { WithOptional, Arrayable, DefineConfigItem, DefineWorkspaceItem, BuildMeta, BuildOutputFile, BuildOutput, BuildContext, BunupPluginHooks, BunupPlugin, exports, injectStyles, unused, BuildOptions };
|
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.19",
|
|
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.19",
|
|
51
51
|
"chokidar": "^4.0.3",
|
|
52
52
|
"coffi": "^0.1.37",
|
|
53
53
|
"lightningcss": "^1.30.2",
|
|
@@ -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.19"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
61
|
"typescript": "latest"
|