bunup 0.14.18 → 0.14.20
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 +11 -1
- package/dist/cli/index.js +11 -4
- 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-3v7q72zg.js → bunup-8meww5p0.js} +10 -1
- package/dist/shared/{bunup-t1h1xwhf.js → bunup-rqsmf79e.js} +28 -5
- package/dist/shared/{bunup-h9mcrzvs.d.ts → bunup-zqdmwaar.d.ts} +39 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -60,7 +60,7 @@ Spin up a modern, ready-to-publish TypeScript or React component library (or a b
|
|
|
60
60
|
bunx @bunup/cli@latest create
|
|
61
61
|
```
|
|
62
62
|
|
|
63
|
-
See more in [Scaffold with Bunup](
|
|
63
|
+
See more in [Scaffold with Bunup](https://bunup.dev/docs/scaffold-with-bunup).
|
|
64
64
|
|
|
65
65
|
## Features
|
|
66
66
|
|
|
@@ -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-rqsmf79e.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.20";
|
|
30
30
|
|
|
31
31
|
// packages/bunup/src/printer/print-build-report.ts
|
|
32
32
|
import { promisify } from "util";
|
|
@@ -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-rqsmf79e.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
|
@@ -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
|
}
|
|
@@ -897,4 +906,4 @@ function unused(options = {}) {
|
|
|
897
906
|
};
|
|
898
907
|
}
|
|
899
908
|
|
|
900
|
-
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 };
|
|
@@ -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";
|
|
@@ -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";
|
|
@@ -142,6 +157,9 @@ export default classes;
|
|
|
142
157
|
};
|
|
143
158
|
}
|
|
144
159
|
|
|
160
|
+
// packages/bunup/src/plugins/internal/external-option.ts
|
|
161
|
+
import { isBuiltin } from "module";
|
|
162
|
+
|
|
145
163
|
// packages/bunup/src/helpers/external.ts
|
|
146
164
|
function getPackageDepsPatterns(packageJson) {
|
|
147
165
|
return getPackageDeps(packageJson).map((dep) => new RegExp(`^${dep}($|\\/|\\\\)`));
|
|
@@ -149,7 +167,7 @@ function getPackageDepsPatterns(packageJson) {
|
|
|
149
167
|
function matchesPattern(path2, pattern) {
|
|
150
168
|
return typeof pattern === "string" ? pattern === path2 : pattern.test(path2);
|
|
151
169
|
}
|
|
152
|
-
function
|
|
170
|
+
function isExternalFromPackageJson(path2, options, packageJson) {
|
|
153
171
|
const packageDepsPatterns = getPackageDepsPatterns(packageJson);
|
|
154
172
|
const matchesExternalPattern = packageDepsPatterns.some((pattern) => pattern.test(path2)) || options.external?.some((pattern) => matchesPattern(path2, pattern));
|
|
155
173
|
const isExcludedFromExternal = options.noExternal?.some((pattern) => matchesPattern(path2, pattern));
|
|
@@ -163,7 +181,7 @@ function externalOptionPlugin(options, packageJson) {
|
|
|
163
181
|
setup(build) {
|
|
164
182
|
build.onResolve({ filter: /.*/ }, (args) => {
|
|
165
183
|
const importPath = args.path;
|
|
166
|
-
if (
|
|
184
|
+
if (isBuiltin(importPath) || isExternalFromPackageJson(importPath, options, packageJson)) {
|
|
167
185
|
return {
|
|
168
186
|
path: importPath,
|
|
169
187
|
external: true
|
|
@@ -216,11 +234,14 @@ var DEFAULT_OPTIONS = {
|
|
|
216
234
|
clean: true
|
|
217
235
|
};
|
|
218
236
|
function resolveBuildOptions(userOptions) {
|
|
219
|
-
const
|
|
237
|
+
const options = {
|
|
220
238
|
...DEFAULT_OPTIONS,
|
|
221
239
|
...userOptions
|
|
222
240
|
};
|
|
223
|
-
|
|
241
|
+
if (options.jsx) {
|
|
242
|
+
ensureBunVersion("1.2.23", "jsx option");
|
|
243
|
+
}
|
|
244
|
+
return options;
|
|
224
245
|
}
|
|
225
246
|
function resolvePlugins(options, packageJsonData) {
|
|
226
247
|
const plugins = [];
|
|
@@ -321,6 +342,7 @@ async function runPluginBuildDoneHooks(bunupPlugins, options, output, meta) {
|
|
|
321
342
|
// packages/bunup/src/build.ts
|
|
322
343
|
var ac = null;
|
|
323
344
|
async function build(userOptions, rootDir = process.cwd()) {
|
|
345
|
+
ensureMinimumBunVersion();
|
|
324
346
|
if (ac) {
|
|
325
347
|
ac.abort();
|
|
326
348
|
}
|
|
@@ -390,6 +412,7 @@ async function build(userOptions, rootDir = process.cwd()) {
|
|
|
390
412
|
env: resolvedEnv,
|
|
391
413
|
ignoreDCEAnnotations: options.ignoreDCEAnnotations,
|
|
392
414
|
emitDCEAnnotations: options.emitDCEAnnotations,
|
|
415
|
+
jsx: options.jsx,
|
|
393
416
|
throw: false,
|
|
394
417
|
plugins: bunPlugins
|
|
395
418
|
});
|
|
@@ -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;
|
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.20",
|
|
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.14",
|
|
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.14"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
61
|
"typescript": "latest"
|