bunup 0.15.12 → 0.15.13

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/dist/cli/index.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  build,
5
5
  processLoadedConfigs,
6
6
  resolveBuildOptions
7
- } from "../shared/bunup-2dnbwnp7.js";
7
+ } from "../shared/bunup-0rejsmya.js";
8
8
  import {
9
9
  BunupBuildError,
10
10
  BunupCLIError,
@@ -27,7 +27,7 @@ import {
27
27
  import { loadConfig } from "coffi";
28
28
  import pc4 from "picocolors";
29
29
  // packages/bunup/package.json
30
- var version = "0.15.12";
30
+ var version = "0.15.13";
31
31
 
32
32
  // packages/bunup/src/printer/print-build-report.ts
33
33
  import { promisify } from "util";
@@ -259,7 +259,7 @@ var program = cli().name("bunup").version(version).description("A blazing-fast b
259
259
  pc3.gray(`${pc3.blue("bunup src/cli.ts")} # Multiple entries`),
260
260
  pc3.gray(`${pc3.blue("bunup --dts.splitting")} # Declaration splitting`),
261
261
  pc3.gray(`${pc3.blue("bunup --no-clean")} # Disable cleaning output directory before build`)
262
- ]).option("entry", z.union(z.string().describe("Entry file or glob pattern"), z.array(z.string()).describe("Multiple entry files or globs")).alias("e").optional()).option("config", z.union(z.string().describe("Path to a custom configuration file").alias("c").example("./configs/custom.bunup.config.js"), z.boolean().describe("Whether to use a configuration file").default(true)).optional()).option("filter", z.array(z.string()).describe("Filter workspace packages or config array items by name").optional()).option("name", z.string().describe("Name of the build configuration (for logging and identification)").example("my-library").optional()).option("out-dir", z.string().describe("Output directory for bundled files").alias("o").default("dist")).option("format", z.union(z.string().choices(["esm", "cjs", "iife"]).describe("Single output format"), z.array(z.string().choices(["esm", "cjs", "iife"])).describe("Multiple output formats")).alias("f").default("esm")).option("minify", z.boolean().describe("Enable all minification options (whitespace, identifiers, syntax)").optional()).option("minify-whitespace", z.boolean().describe("Minify whitespace in the output to reduce file size").optional()).option("minify-identifiers", z.boolean().describe("Minify identifiers by renaming variables to shorter names").optional()).option("minify-syntax", z.boolean().describe("Minify syntax by optimizing code structure").optional()).option("watch", z.boolean().describe("Watch for file changes and rebuild automatically").optional()).option("clean", z.boolean().describe("Clean the output directory before building").default(true)).option("silent", z.boolean().describe("Disable logging during the build process").alias("q").optional()).option("splitting", z.boolean().describe("Enable code splitting").default(true, "enabled by default for ESM format")).option("conditions", z.array(z.string()).describe("Package.json export conditions for import resolution").optional()).option("target", z.string().choices(["bun", "node", "browser"]).describe("Target environment for the bundle").alias("t").default("node")).option("external", z.array(z.string()).describe("External packages that should not be bundled").optional()).option("no-external", z.array(z.string()).describe("Packages that should be bundled even if listed in external").optional()).option("shims", z.boolean().describe("Enable shims for Node.js globals and ESM/CJS interoperability").optional()).option("report", z.object({
262
+ ]).option("entry", z.union(z.string().describe("Entry file or glob pattern"), z.array(z.string()).describe("Multiple entry files or globs")).alias("e").optional()).option("config", z.union(z.string().describe("Path to a custom configuration file").alias("c").example("./configs/custom.bunup.config.js"), z.boolean().describe("Whether to use a configuration file").default(true)).optional()).option("filter", z.array(z.string()).describe("Filter workspace packages or config array items by name").optional()).option("name", z.string().describe("Name of the build configuration (for logging and identification)").example("my-library").optional()).option("out-dir", z.string().describe("Output directory for bundled files").alias("o").default("dist")).option("format", z.union(z.string().choices(["esm", "cjs", "iife"]).describe("Single output format"), z.array(z.string().choices(["esm", "cjs", "iife"])).describe("Multiple output formats")).alias("f").default("esm")).option("minify", z.boolean().describe("Enable all minification options (whitespace, identifiers, syntax)").optional()).option("minify-whitespace", z.boolean().describe("Minify whitespace in the output to reduce file size").optional()).option("minify-identifiers", z.boolean().describe("Minify identifiers by renaming variables to shorter names").optional()).option("minify-syntax", z.boolean().describe("Minify syntax by optimizing code structure").optional()).option("watch", z.boolean().describe("Watch for file changes and rebuild automatically").optional()).option("clean", z.boolean().describe("Clean the output directory before building").default(true)).option("silent", z.boolean().describe("Disable logging during the build process").alias("q").optional()).option("splitting", z.boolean().describe("Enable code splitting").default(true, "enabled by default for ESM format")).option("conditions", z.array(z.string()).describe("Package.json export conditions for import resolution").optional()).option("target", z.string().choices(["bun", "node", "browser"]).describe("Target environment for the bundle").alias("t").default("node")).option("external", z.array(z.string()).describe("External packages that should not be bundled").optional()).option("no-external", z.array(z.string()).describe("Packages that should be bundled even if listed in external").optional()).option("packages", z.string().choices(["bundle", "external"]).describe('Bundle all dependencies or externalize all dependencies. Use "bundle" to include all deps in output, or "external" to exclude all deps').optional()).option("shims", z.boolean().describe("Enable shims for Node.js globals and ESM/CJS interoperability").optional()).option("report", z.object({
263
263
  gzip: z.boolean().describe("Enable gzip compression size calculation").default(true),
264
264
  brotli: z.boolean().describe("Enable brotli compression size calculation").optional(),
265
265
  "max-bundle-size": z.number().describe("Maximum bundle size in bytes. Will warn if exceeded").optional()
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { BuildContext, BuildMeta, BuildOptions, BuildOutputFile, BuildResult, BunupPlugin, DefineConfigItem, DefineWorkspaceItem, WithOptional, WithRequired } from "./shared/bunup-sfnfcavb";
1
+ import { BuildContext, BuildMeta, BuildOptions, BuildOutputFile, BuildResult, BunupPlugin, DefineConfigItem, DefineWorkspaceItem, WithOptional, WithRequired } from "./shared/bunup-a77gk35v";
2
2
  declare function build(userOptions: Partial<BuildOptions>, rootDir?: string): Promise<BuildResult>;
3
3
  declare function defineConfig(options: DefineConfigItem | WithRequired<DefineConfigItem, "name">[]): DefineConfigItem | WithRequired<DefineConfigItem, "name">[];
4
4
  declare function defineWorkspace(options: WithOptional<DefineWorkspaceItem, "config">[], sharedOptions?: Partial<DefineConfigItem>): DefineWorkspaceItem[];
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  build
4
- } from "./shared/bunup-2dnbwnp7.js";
4
+ } from "./shared/bunup-0rejsmya.js";
5
5
  import"./shared/bunup-qb65sm3k.js";
6
6
  // packages/bunup/src/define.ts
7
7
  function defineConfig(options) {
package/dist/plugins.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Arrayable, BuildOptions, BunupPlugin, BunupPluginHooks, exports, injectStyles, unused } from "./shared/bunup-sfnfcavb";
1
+ import { Arrayable, BuildOptions, BunupPlugin, BunupPluginHooks, exports, injectStyles, unused } from "./shared/bunup-a77gk35v";
2
2
  type CopyOptions = {
3
3
  /** Whether to follow symbolic links when copying files. */
4
4
  followSymlinks?: boolean;
@@ -182,6 +182,17 @@ function matchesPattern(path2, pattern) {
182
182
  }
183
183
  function isExternalFromPackageJson(path2, options, packageJson) {
184
184
  const packageDepsPatterns = getPackageDepsPatterns(packageJson);
185
+ if (options.packages === "bundle") {
186
+ const explicitlyExternal = options.external?.some((pattern) => matchesPattern(path2, pattern));
187
+ return explicitlyExternal;
188
+ }
189
+ if (options.packages === "external") {
190
+ const explicitlyBundled = options.noExternal?.some((pattern) => matchesPattern(path2, pattern));
191
+ if (explicitlyBundled) {
192
+ return false;
193
+ }
194
+ return packageDepsPatterns.some((pattern) => pattern.test(path2));
195
+ }
185
196
  const matchesExternalPattern = packageDepsPatterns.some((pattern) => pattern.test(path2)) || options.external?.some((pattern) => matchesPattern(path2, pattern));
186
197
  const isExcludedFromExternal = options.noExternal?.some((pattern) => matchesPattern(path2, pattern));
187
198
  return matchesExternalPattern && !isExcludedFromExternal;
@@ -493,6 +504,7 @@ async function build(userOptions, rootDir = process.cwd()) {
493
504
  env: resolvedEnv,
494
505
  ignoreDCEAnnotations: options.ignoreDCEAnnotations,
495
506
  emitDCEAnnotations: options.emitDCEAnnotations,
507
+ packages: options.packages,
496
508
  jsx: options.jsx,
497
509
  compile: options.compile,
498
510
  outdir: options.compile ? path3.resolve(rootDir, options.outDir) : undefined,
@@ -447,6 +447,28 @@ interface BuildOptions {
447
447
  */
448
448
  noExternal?: External;
449
449
  /**
450
+ * Controls whether to bundle or externalize all dependencies.
451
+ *
452
+ * This option provides a convenient way to handle all dependencies at once:
453
+ * - `"bundle"`: Bundle all dependencies into the output (overrides automatic external behavior)
454
+ * - `"external"`: Externalize all dependencies (treats all as external)
455
+ *
456
+ * This option works alongside `external` and `noExternal`:
457
+ * - When set to `"bundle"`, all dependencies are bundled by default, but `external` can still mark specific packages as external
458
+ * - When set to `"external"`, all dependencies are externalized by default, but `noExternal` can still bundle specific packages
459
+ *
460
+ * @see https://bunup.dev/docs/guide/options#managing-dependencies-in-your-bundle
461
+ *
462
+ * @example
463
+ * // Bundle all dependencies
464
+ * packages: "bundle"
465
+ *
466
+ * @example
467
+ * // Externalize all dependencies
468
+ * packages: "external"
469
+ */
470
+ packages?: "bundle" | "external";
471
+ /**
450
472
  * The target environment for the bundle.
451
473
  * Can be 'browser', 'bun', 'node', etc.
452
474
  * Defaults to 'node' if not specified.
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.15.12",
4
+ "version": "0.15.13",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist"