bunup 0.8.57 → 0.8.58

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 CHANGED
@@ -12,7 +12,7 @@
12
12
 
13
13
  [![NPM Downloads](https://img.shields.io/npm/dm/bunup?logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjRweCIgdmlld0JveD0iMCAtOTYwIDk2MCA5NjAiIHdpZHRoPSIyNHB4IiBmaWxsPSIjMDAwMDAwIj48cGF0aCBkPSJNNDgwLTMyMCAyODAtNTIwbDU2LTU4IDEwNCAxMDR2LTMyNmg4MHYzMjZsMTA0LTEwNCA1NiA1OC0yMDAgMjAwWk0xNjAtMTYwdi0yMDBoODB2MTIwaDQ4MHYtMTIwaDgwdjIwMEgxNjBaIi8%2BPC9zdmc%2B&labelColor=ffc44e&color=212121)](https://www.npmjs.com/package/bunup) [![NPM Version](https://img.shields.io/npm/v/bunup?logo=npm&logoColor=212121&label=version&labelColor=ffc44e&color=212121)](https://npmjs.com/package/bunup) [![Built with Bun](https://img.shields.io/badge/Built_with-Bun-fbf0df?logo=bun&labelColor=212121)](https://bun.sh) [![sponsor](https://img.shields.io/badge/sponsor-EA4AAA?logo=githubsponsors&labelColor=FAFAFA)](https://github.com/sponsors/arshad-yaseen)
14
14
 
15
- Bunup is the **blazing-fast build tool** for TypeScript and JavaScript libraries, designed for flawless developer experience and speed, **powered by Bun**.
15
+ Bunup is the **blazing-fast build tool** for TypeScript libraries, designed for flawless developer experience and speed, **powered by Bun**.
16
16
 
17
17
  ![Bunup benchmarks](/assets/benchmarks.png)
18
18
 
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  BunupPluginError
3
- } from "./chunk-w9q3brxd.js";
3
+ } from "./chunk-2g0gpaee.js";
4
4
 
5
5
  // src/plugins/utils.ts
6
6
  import pc from "picocolors";
@@ -458,5 +458,10 @@ async function getFilesFromGlobs(patterns, cwd) {
458
458
  }
459
459
  return Array.from(includedFiles);
460
460
  }
461
+ function isTypeScriptFile(path2) {
462
+ if (!path2)
463
+ return false;
464
+ return TS_RE.test(path2);
465
+ }
461
466
 
462
- export { __toESM, __require, setSilent, logTable, link, logger, BunupBuildError, BunupDTSBuildError, BunupCLIError, BunupWatchError, BunupPluginError, parseErrorMessage, handleError, handleErrorAndExit, JS_TS_RE, JS_DTS_RE, CSS_RE, ensureArray, getDefaultOutputExtension, getDefaultDtsExtention, formatTime, getPackageDeps, formatFileSize, getShortFilePath, cleanOutDir, cleanPath, isDirectoryPath, pathExistsSync, formatListWithAnd, getFilesFromGlobs };
467
+ export { __toESM, __require, setSilent, logTable, link, logger, BunupBuildError, BunupDTSBuildError, BunupCLIError, BunupWatchError, BunupPluginError, parseErrorMessage, handleError, handleErrorAndExit, JS_TS_RE, JS_DTS_RE, CSS_RE, ensureArray, getDefaultOutputExtension, getDefaultDtsExtention, formatTime, getPackageDeps, formatFileSize, getShortFilePath, cleanOutDir, cleanPath, isDirectoryPath, pathExistsSync, formatListWithAnd, getFilesFromGlobs, isTypeScriptFile };
@@ -4,11 +4,11 @@ import {
4
4
  } from "./chunk-gh7z7s46.js";
5
5
  import {
6
6
  displayBunupGradientArt
7
- } from "./chunk-gyyqw66f.js";
7
+ } from "./chunk-qteft286.js";
8
8
  import {
9
9
  formatListWithAnd,
10
10
  link
11
- } from "./chunk-w9q3brxd.js";
11
+ } from "./chunk-2g0gpaee.js";
12
12
 
13
13
  // src/cli/init.ts
14
14
  import fs from "fs";
@@ -65,10 +65,9 @@ async function initializeWorkspace(packageJsonPath) {
65
65
  async function initializeSinglePackage(packageJsonPath) {
66
66
  const entryFiles = await collectEntryFiles();
67
67
  const outputFormats = await selectOutputFormats();
68
- const shouldGenerateDts = await promptForTypeScriptDeclarations(entryFiles);
69
68
  const configMethod = await selectConfigurationMethod();
70
- await generateConfiguration(configMethod, entryFiles, outputFormats, shouldGenerateDts, packageJsonPath);
71
- await handleBuildScripts(packageJsonPath, entryFiles, outputFormats, shouldGenerateDts, configMethod);
69
+ await generateConfiguration(configMethod, entryFiles, outputFormats, packageJsonPath);
70
+ await handleBuildScripts(packageJsonPath, entryFiles, outputFormats, configMethod);
72
71
  }
73
72
  async function collectWorkspacePackages() {
74
73
  const packages = [];
@@ -98,13 +97,11 @@ async function collectWorkspacePackages() {
98
97
  });
99
98
  const entryFiles = await collectEntryFilesForPackage(packageRoot, packageName);
100
99
  const outputFormats = await selectOutputFormats();
101
- const shouldGenerateDts = await promptForTypeScriptDeclarations(entryFiles);
102
100
  packages.push({
103
101
  name: packageName,
104
102
  root: packageRoot,
105
103
  entryFiles,
106
- outputFormats,
107
- shouldGenerateDts
104
+ outputFormats
108
105
  });
109
106
  const shouldAddMore = await confirm({
110
107
  message: "Do you want to add another package?",
@@ -183,15 +180,6 @@ async function selectOutputFormats() {
183
180
  initialValues: ["esm", "cjs"]
184
181
  });
185
182
  }
186
- async function promptForTypeScriptDeclarations(entryFiles) {
187
- const hasTypeScriptFiles = entryFiles.some((file) => file.endsWith(".ts") || file.endsWith(".tsx"));
188
- if (!hasTypeScriptFiles)
189
- return false;
190
- return await confirm({
191
- message: "Generate TypeScript declarations?",
192
- initialValue: true
193
- });
194
- }
195
183
  async function selectWorkspaceConfigurationMethod() {
196
184
  return await select({
197
185
  message: "How would you like to configure your workspace?",
@@ -222,18 +210,18 @@ async function generateWorkspaceConfiguration(configMethod, workspacePackages) {
222
210
  const configContent = createWorkspaceConfigFileContent(workspacePackages);
223
211
  await Bun.write(`bunup.config.${configMethod}`, configContent);
224
212
  }
225
- async function generateConfiguration(configMethod, entryFiles, outputFormats, shouldGenerateDts, packageJsonPath) {
213
+ async function generateConfiguration(configMethod, entryFiles, outputFormats, packageJsonPath) {
226
214
  if (configMethod === "none") {
227
215
  log.info("If you need more control (such as adding plugins or customizing output), you can always create a config file later.");
228
216
  return;
229
217
  }
230
218
  if (configMethod === "ts" || configMethod === "js") {
231
- await Bun.write(`bunup.config.${configMethod}`, createConfigFileContent(entryFiles, outputFormats, shouldGenerateDts));
219
+ await Bun.write(`bunup.config.${configMethod}`, createConfigFileContent(entryFiles, outputFormats));
232
220
  } else if (configMethod === "json") {
233
221
  const { data: packageJsonConfig } = await loadPackageJson();
234
222
  const updatedConfig = {
235
223
  ...packageJsonConfig,
236
- bunup: createPackageJsonConfig(entryFiles, outputFormats, shouldGenerateDts)
224
+ bunup: createPackageJsonConfig(entryFiles, outputFormats)
237
225
  };
238
226
  await Bun.write(packageJsonPath, JSON.stringify(updatedConfig, null, 2));
239
227
  }
@@ -259,10 +247,10 @@ async function handleWorkspaceBuildScripts(packageJsonPath) {
259
247
  };
260
248
  await Bun.write(packageJsonPath, JSON.stringify(updatedConfig, null, 2));
261
249
  }
262
- async function handleBuildScripts(packageJsonPath, entryFiles, outputFormats, shouldGenerateDts, configMethod) {
250
+ async function handleBuildScripts(packageJsonPath, entryFiles, outputFormats, configMethod) {
263
251
  const { data: packageJsonConfig } = await loadPackageJson();
264
252
  const existingScripts = packageJsonConfig?.scripts ?? {};
265
- const newScripts = createBuildScripts(entryFiles, outputFormats, shouldGenerateDts, configMethod);
253
+ const newScripts = createBuildScripts(entryFiles, outputFormats, configMethod);
266
254
  const conflictingScripts = Object.keys(newScripts).filter((script) => existingScripts[script]);
267
255
  if (conflictingScripts.length > 0) {
268
256
  const shouldOverride = await confirm({
@@ -287,8 +275,7 @@ function createWorkspaceConfigFileContent(workspacePackages) {
287
275
  root: '${pkg.root}',
288
276
  config: {
289
277
  entry: [${pkg.entryFiles.map((file) => `'${file}'`).join(", ")}],
290
- format: [${pkg.outputFormats.map((format) => `'${format}'`).join(", ")}],${pkg.shouldGenerateDts ? `
291
- dts: true,` : ""}
278
+ format: [${pkg.outputFormats.map((format) => `'${format}'`).join(", ")}],
292
279
  },
293
280
  }`;
294
281
  }).join(`,
@@ -300,21 +287,19 @@ ${packagesConfig}
300
287
  ])
301
288
  `;
302
289
  }
303
- function createConfigFileContent(entryFiles, outputFormats, shouldGenerateDts) {
290
+ function createConfigFileContent(entryFiles, outputFormats) {
304
291
  return `import { defineConfig } from 'bunup'
305
292
 
306
293
  export default defineConfig({
307
294
  entry: [${entryFiles.map((file) => `'${file}'`).join(", ")}],
308
- format: [${outputFormats.map((format) => `'${format}'`).join(", ")}],${shouldGenerateDts ? `
309
- dts: true,` : ""}
295
+ format: [${outputFormats.map((format) => `'${format}'`).join(", ")}],
310
296
  })
311
297
  `;
312
298
  }
313
- function createPackageJsonConfig(entryFiles, outputFormats, shouldGenerateDts) {
299
+ function createPackageJsonConfig(entryFiles, outputFormats) {
314
300
  return {
315
301
  entry: entryFiles,
316
- format: outputFormats,
317
- ...shouldGenerateDts && { dts: true }
302
+ format: outputFormats
318
303
  };
319
304
  }
320
305
  function createWorkspaceBuildScripts() {
@@ -323,8 +308,8 @@ function createWorkspaceBuildScripts() {
323
308
  dev: "bunup --watch"
324
309
  };
325
310
  }
326
- function createBuildScripts(entryFiles, outputFormats, shouldGenerateDts, configMethod) {
327
- const cliOptions = configMethod === "none" ? ` ${entryFiles.join(" ")} --format ${outputFormats.join(",")}${shouldGenerateDts ? " --dts" : ""}` : "";
311
+ function createBuildScripts(entryFiles, outputFormats, configMethod) {
312
+ const cliOptions = configMethod === "none" ? ` ${entryFiles.join(" ")} --format ${outputFormats.join(",")}` : "";
328
313
  return {
329
314
  build: `bunup${cliOptions}`,
330
315
  dev: `bunup${cliOptions} --watch`
@@ -1,11 +1,11 @@
1
1
  // @bun
2
2
  import {
3
3
  displayBunupGradientArt
4
- } from "./chunk-gyyqw66f.js";
4
+ } from "./chunk-qteft286.js";
5
5
  import {
6
6
  link,
7
7
  pathExistsSync
8
- } from "./chunk-w9q3brxd.js";
8
+ } from "./chunk-2g0gpaee.js";
9
9
 
10
10
  // src/cli/new.ts
11
11
  import { renameSync } from "fs";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  logger
3
- } from "./chunk-w9q3brxd.js";
3
+ } from "./chunk-2g0gpaee.js";
4
4
 
5
5
  // src/cli/utils.ts
6
6
  import pc from "picocolors";
@@ -3,7 +3,7 @@ import {
3
3
  filterBunupPlugins,
4
4
  runPluginBuildDoneHooks,
5
5
  runPluginBuildStartHooks
6
- } from "./chunk-0e6rexd1.js";
6
+ } from "./chunk-0j56xynx.js";
7
7
  import {
8
8
  loadPackageJson
9
9
  } from "./chunk-gh7z7s46.js";
@@ -19,12 +19,13 @@ import {
19
19
  getFilesFromGlobs,
20
20
  getPackageDeps,
21
21
  getShortFilePath,
22
+ isTypeScriptFile,
22
23
  link,
23
24
  logTable,
24
25
  logger,
25
26
  parseErrorMessage,
26
27
  setSilent
27
- } from "./chunk-w9q3brxd.js";
28
+ } from "./chunk-2g0gpaee.js";
28
29
 
29
30
  // src/build.ts
30
31
  import path from "path";
@@ -145,7 +146,7 @@ ${text}`;
145
146
  // src/options.ts
146
147
  var DEFAULT_OPTIONS = {
147
148
  entry: ["src/index.ts"],
148
- format: ["cjs"],
149
+ format: ["esm", "cjs"],
149
150
  outDir: "dist",
150
151
  target: "node",
151
152
  clean: true
@@ -325,7 +326,7 @@ async function build(partialOptions, rootDir = process.cwd()) {
325
326
  }
326
327
  });
327
328
  await Promise.all(buildPromises);
328
- if (options.dts) {
329
+ if (options.dts ?? entrypoints.some(isTypeScriptFile)) {
329
330
  try {
330
331
  const { entry, splitting, ...dtsOptions } = typeof options.dts === "object" ? options.dts : {};
331
332
  const dtsResult = await generateDts(ensureArray(entry ?? entrypoints), {
package/dist/cli/index.js CHANGED
@@ -3,8 +3,8 @@
3
3
  import {
4
4
  build,
5
5
  createBuildOptions
6
- } from "../chunk-2hchnc6a.js";
7
- import"../chunk-0e6rexd1.js";
6
+ } from "../chunk-wav05ehp.js";
7
+ import"../chunk-0j56xynx.js";
8
8
  import {
9
9
  processLoadedConfigs
10
10
  } from "../chunk-gh7z7s46.js";
@@ -21,14 +21,14 @@ import {
21
21
  logger,
22
22
  parseErrorMessage,
23
23
  setSilent
24
- } from "../chunk-w9q3brxd.js";
24
+ } from "../chunk-2g0gpaee.js";
25
25
 
26
26
  // src/cli/index.ts
27
27
  import { loadConfig } from "coffi";
28
28
  import pc3 from "picocolors";
29
29
  import { exec } from "tinyexec";
30
30
  // package.json
31
- var version = "0.8.57";
31
+ var version = "0.8.58";
32
32
 
33
33
  // src/watch.ts
34
34
  import path from "path";
@@ -482,12 +482,12 @@ var parseCliOptions = (argv) => {
482
482
  async function main(args = Bun.argv.slice(2)) {
483
483
  const cliOptions = parseCliOptions(args);
484
484
  if (cliOptions.new) {
485
- const { newProject } = await import("../chunk-31j04536.js");
485
+ const { newProject } = await import("../chunk-kspt827v.js");
486
486
  await newProject();
487
487
  return;
488
488
  }
489
489
  if (cliOptions.init) {
490
- const { init } = await import("../chunk-whm2fp6r.js");
490
+ const { init } = await import("../chunk-8dk0fkzd.js");
491
491
  await init();
492
492
  return;
493
493
  }
package/dist/index.d.ts CHANGED
@@ -1,4 +1,355 @@
1
- import { Arrayable, BuildOptions, DefineConfigItem, DefineWorkspaceItem, Plugin } from "./chunk-w6swmckt";
1
+ import { GenerateDtsOptions } from "typeroll";
2
+ import { BunPlugin } from "bun";
3
+ type MaybePromise<T> = Promise<T> | T;
4
+ type WithOptional<
5
+ T,
6
+ K extends keyof T
7
+ > = Omit<T, K> & Partial<Pick<T, K>>;
8
+ type Arrayable<T> = T | T[];
9
+ type DefineConfigItem = Omit<WithOptional<BuildOptions, "outDir" | "format">, "watch">;
10
+ type DefineWorkspaceItem = {
11
+ name: string
12
+ root: string
13
+ config: DefineConfigItem | DefineConfigItem[]
14
+ };
15
+ type PackageJson = {
16
+ /** The parsed content of the package.json file */
17
+ data: Record<string, any> | null
18
+ /** The path to the package.json file */
19
+ path: string | null
20
+ };
21
+ /**
22
+ * Represents a Bun plugin that can be used with Bunup
23
+ */
24
+ type BunupBunPlugin = {
25
+ /** Identifies this as a native Bun plugin */
26
+ type: "bun"
27
+ /** Optional name for the plugin */
28
+ name?: string
29
+ /** The actual Bun plugin implementation */
30
+ plugin: BunPlugin
31
+ };
32
+ /**
33
+ * Represents the meta data of the build
34
+ */
35
+ type BuildMeta = {
36
+ /** The package.json file */
37
+ packageJson: PackageJson
38
+ /** The root directory of the build */
39
+ rootDir: string
40
+ };
41
+ type BuildOutputFile = {
42
+ /**
43
+ * The entry point for which this file was generated
44
+ *
45
+ * Undefined for non-entry point files (e.g., assets, sourcemaps, chunks)
46
+ */
47
+ entrypoint: string | undefined
48
+ /** The kind of the file */
49
+ kind: "entry-point" | "chunk" | "asset" | "sourcemap" | "bytecode"
50
+ /** Path to the generated file */
51
+ fullPath: string
52
+ /** Path to the generated file relative to the root directory */
53
+ relativePathToRootDir: string
54
+ /** Path to the generated file relative to the output directory */
55
+ relativePathToOutputDir: string
56
+ /** Whether the file is a dts file */
57
+ dts: boolean
58
+ /** The format of the output file */
59
+ format: Format
60
+ };
61
+ /**
62
+ * Represents the output of a build operation
63
+ */
64
+ type BuildOutput = {
65
+ /** Array of generated files with their paths and contents */
66
+ files: BuildOutputFile[]
67
+ };
68
+ /**
69
+ * Context provided to build hooks
70
+ */
71
+ type BuildContext = {
72
+ /** The build options that were used */
73
+ options: BuildOptions
74
+ /** The output of the build */
75
+ output: BuildOutput
76
+ /** The meta data of the build */
77
+ meta: BuildMeta
78
+ };
79
+ /**
80
+ * Hooks that can be implemented by Bunup plugins
81
+ */
82
+ type BunupPluginHooks = {
83
+ /**
84
+ * Called when a build is successfully completed
85
+ * @param ctx Build context containing options and output
86
+ */
87
+ onBuildDone?: (ctx: BuildContext) => MaybePromise<void>
88
+ /**
89
+ * Called before a build starts
90
+ * @param options Build options that will be used
91
+ */
92
+ onBuildStart?: (options: BuildOptions) => MaybePromise<void>
93
+ };
94
+ /**
95
+ * Represents a Bunup-specific plugin
96
+ */
97
+ type BunupPlugin = {
98
+ /** Identifies this as a Bunup-specific plugin */
99
+ type: "bunup"
100
+ /** Optional name for the plugin */
101
+ name?: string
102
+ /** The hooks implemented by this plugin */
103
+ hooks: BunupPluginHooks
104
+ };
105
+ /**
106
+ * Union type representing all supported plugin types
107
+ */
108
+ type Plugin = BunupBunPlugin | BunupPlugin;
109
+ type Loader = "js" | "jsx" | "ts" | "tsx" | "json" | "toml" | "file" | "napi" | "wasm" | "text" | "css" | "html";
110
+ type Define = Record<string, string>;
111
+ type Sourcemap = "none" | "linked" | "inline" | "external" | "linked" | boolean;
112
+ type Format = "esm" | "cjs" | "iife";
113
+ type Target = "bun" | "node" | "browser";
114
+ type External = (string | RegExp)[];
115
+ type Env = "inline" | "disable" | `${string}*` | Record<string, string>;
116
+ interface BuildOptions {
117
+ /**
118
+ * Name of the build configuration
119
+ * Used for logging and identification purposes
120
+ */
121
+ name?: string;
122
+ /**
123
+ * Entry point files for the build
124
+ *
125
+ * This can be:
126
+ * - A string path to a file
127
+ * - An array of file paths
128
+ *
129
+ * @see https://bunup.dev/docs/#entry-points
130
+ */
131
+ entry: string | string[];
132
+ /**
133
+ * Output directory for the bundled files
134
+ * Defaults to 'dist' if not specified
135
+ */
136
+ outDir: string;
137
+ /**
138
+ * Output formats for the bundle
139
+ * Can include 'esm', 'cjs', and/or 'iife'
140
+ * Defaults to ['cjs'] if not specified
141
+ */
142
+ format: Format[];
143
+ /**
144
+ * Whether to enable all minification options
145
+ * When true, enables minifyWhitespace, minifyIdentifiers, and minifySyntax
146
+ */
147
+ minify?: boolean;
148
+ /**
149
+ * Whether to enable code splitting
150
+ * Defaults to true for ESM format, false for CJS format
151
+ */
152
+ splitting?: boolean;
153
+ /**
154
+ * Whether to minify whitespace in the output
155
+ * Removes unnecessary whitespace to reduce file size
156
+ */
157
+ minifyWhitespace?: boolean;
158
+ /**
159
+ * Whether to minify identifiers in the output
160
+ * Renames variables and functions to shorter names
161
+ */
162
+ minifyIdentifiers?: boolean;
163
+ /**
164
+ * Whether to minify syntax in the output
165
+ * Optimizes code structure for smaller file size
166
+ */
167
+ minifySyntax?: boolean;
168
+ /**
169
+ * Whether to watch for file changes and rebuild automatically
170
+ */
171
+ watch?: boolean;
172
+ /**
173
+ * Whether to generate TypeScript declaration files (.d.ts)
174
+ * When set to true, generates declaration files for all entry points
175
+ * Can also be configured with DtsOptions for more control
176
+ */
177
+ dts?: boolean | (Pick<GenerateDtsOptions, "resolve" | "splitting" | "minify"> & {
178
+ entry?: string | string[]
179
+ });
180
+ /**
181
+ * Path to a preferred tsconfig.json file to use for declaration generation
182
+ *
183
+ * If not specified, the tsconfig.json in the project root will be used.
184
+ * This option allows you to use a different TypeScript configuration
185
+ * specifically for declaration file generation.
186
+ *
187
+ * @example
188
+ * preferredTsconfigPath: './tsconfig.build.json'
189
+ */
190
+ preferredTsconfigPath?: string;
191
+ /**
192
+ * External packages that should not be bundled
193
+ * Useful for dependencies that should be kept as external imports
194
+ */
195
+ external?: External;
196
+ /**
197
+ * Packages that should be bundled even if they are in external
198
+ * Useful for dependencies that should be included in the bundle
199
+ */
200
+ noExternal?: External;
201
+ /**
202
+ * The target environment for the bundle.
203
+ * Can be 'browser', 'bun', 'node', etc.
204
+ * Defaults to 'node' if not specified.
205
+ *
206
+ * Bun target is for generating bundles that are intended to be run by the Bun runtime. In many cases,
207
+ * it isn't necessary to bundle server-side code; you can directly execute the source code
208
+ * without modification. However, bundling your server code can reduce startup times and
209
+ * improve running performance.
210
+ *
211
+ * All bundles generated with `target: "bun"` are marked with a special `// @bun` pragma, which
212
+ * indicates to the Bun runtime that there's no need to re-transpile the file before execution.
213
+ */
214
+ target?: Target;
215
+ /**
216
+ * Whether to clean the output directory before building
217
+ * When true, removes all files in the outDir before starting a new build
218
+ * Defaults to true if not specified
219
+ */
220
+ clean?: boolean;
221
+ /**
222
+ * Specifies the type of sourcemap to generate
223
+ * Can be 'none', 'linked', 'external', or 'inline'
224
+ * Can also be a boolean - when true, it will use 'inline'
225
+ *
226
+ * @see https://bun.sh/docs/bundler#sourcemap
227
+ *
228
+ * @default 'none'
229
+ *
230
+ * @example
231
+ * sourcemap: 'linked'
232
+ * // or
233
+ * sourcemap: true // equivalent to 'inline'
234
+ */
235
+ sourcemap?: Sourcemap;
236
+ /**\\n\\t* Define global constants for the build\\n\\t* These values will be replaced at build time\\n\\t*\\n\\t* @see https://bun.sh/docs/bundler#define\\n\\t*\\n\\t* @example\\n\\t* define: {\\n\\t* 'process.env.NODE_ENV': '"production"',\\n\\t* 'PACKAGE_VERSION': '"1.0.0"'\\n\\t* }\\n\\t*/
237
+ define?: Define;
238
+ /**
239
+ * A callback function that runs after the build process completes
240
+ * This can be used for custom post-build operations like copying files,
241
+ * running additional tools, or logging build information
242
+ *
243
+ * If watch mode is enabled, this callback runs after each rebuild
244
+ *
245
+ * @param options The build options that were used
246
+ */
247
+ onSuccess?: (options: Partial<BuildOptions>) => MaybePromise<void>;
248
+ /**\\n\\t* 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.\\n\\t*\\n\\t* @see https://bun.sh/docs/bundler#banner\\n\\t*\\n\\t* @example\\n\\t* banner: '"use client";'\\n\\t*/
249
+ banner?: string;
250
+ /**
251
+ * 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.
252
+ *
253
+ * @see https://bun.sh/docs/bundler#footer
254
+ *
255
+ * @example
256
+ * footer: '// built with love in SF'
257
+ */
258
+ footer?: string;
259
+ /**
260
+ * 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.
261
+ *
262
+ * @see https://bun.sh/docs/bundler#drop
263
+ *
264
+ * @example
265
+ * drop: ["console", "debugger", "anyIdentifier.or.propertyAccess"]
266
+ */
267
+ drop?: string[];
268
+ /**
269
+ * A map of file extensions to [built-in loader names](https://bun.sh/docs/bundler/loaders#built-in-loaders). This can be used to quickly customize how certain files are loaded.
270
+ *
271
+ * @see https://bun.sh/docs/bundler#loader
272
+ *
273
+ * @example
274
+ * loader: {
275
+ * ".png": "dataurl",
276
+ * ".txt": "file",
277
+ * }
278
+ */
279
+ loader?: { [k in string] : Loader };
280
+ /**
281
+ * Generate bytecode for the output. This can dramatically improve cold start times, but will make the final output larger and slightly increase memory usage.
282
+ *
283
+ * Bytecode is currently only supported for CommonJS (format: "cjs").
284
+ *
285
+ * Must be target: "bun"
286
+ *
287
+ * @see https://bun.sh/docs/bundler#bytecode
288
+ *
289
+ * @default false
290
+ */
291
+ bytecode?: boolean;
292
+ /**
293
+ * Disable logging during the build process. When set to true, no logs will be printed to the console.
294
+ *
295
+ * @default false
296
+ */
297
+ silent?: boolean;
298
+ /**
299
+ * You can specify a prefix to be added to specific import paths in your bundled code
300
+ *
301
+ * Used for assets, external modules, and chunk files when splitting is enabled
302
+ *
303
+ * @see https://bunup.dev/docs#public-path for more information
304
+ *
305
+ * @example
306
+ * publicPath: 'https://cdn.example.com/'
307
+ */
308
+ publicPath?: string;
309
+ /**
310
+ * Controls how environment variables are handled during bundling.
311
+ *
312
+ * Can be one of:
313
+ * - `"inline"`: Replaces all `process.env.FOO` references in your code with the actual values
314
+ * of those environment variables at the time the build runs.
315
+ * - `"disable"`: Disables environment variable injection entirely, leaving `process.env.*` as-is.
316
+ * - A string ending in `*`: Only inlines environment variables matching the given prefix.
317
+ * For example, `"MY_PUBLIC_*"` will inline variables like `MY_PUBLIC_API_URL`.
318
+ * - An object of key-value pairs: Replaces both `process.env.KEY` and `import.meta.env.KEY`
319
+ * with the provided values, regardless of the runtime environment.
320
+ *
321
+ * Note: Values are injected at build time. Secrets or private keys should be excluded
322
+ * from inlining when targeting browser environments.
323
+ *
324
+ * @see https://bun.sh/docs/bundler#env to learn more about inline, disable, prefix, and object modes
325
+ *
326
+ * @example
327
+ * // Inline all environment variables available at build time
328
+ * env: "inline"
329
+ *
330
+ * // Disable all environment variable injection
331
+ * env: "disable"
332
+ *
333
+ * // Only inline environment variables with a specific prefix
334
+ * env: "PUBLIC_*"
335
+ *
336
+ * // Provide specific environment variables manually
337
+ * env: { API_URL: "https://api.example.com", DEBUG: "false" }
338
+ */
339
+ env?: Env;
340
+ /**
341
+ * Ignore dead code elimination/tree-shaking annotations such as @__PURE__ and package.json
342
+ * "sideEffects" fields. This should only be used as a temporary workaround for incorrect
343
+ * annotations in libraries.
344
+ */
345
+ ignoreDCEAnnotations?: boolean;
346
+ /**
347
+ * Force emitting @__PURE__ annotations even if minify.whitespace is true.
348
+ */
349
+ emitDCEAnnotations?: boolean;
350
+ /**\\n\\t* Plugins to extend the build process functionality\\n\\t*\\n\\t* The Plugin type uses a discriminated union pattern with the 'type' field\\n\\t* to support different plugin systems. Both "bun" and "bunup" plugins are supported.\\n\\t*\\n\\t* Each plugin type has its own specific plugin implementation:\\n\\t* - "bun": Uses Bun's native plugin system (BunPlugin)\\n\\t* - "bunup": Uses bunup's own plugin system with lifecycle hooks\\n\\t*\\n\\t* This architecture allows for extensibility as more plugin systems are added.\\n\\t*\\n\\t* @see https://bunup.dev/docs/advanced/plugin-development for more information on plugins\\n\\t*\\n\\t* @example\\n\\t* plugins: [\\n\\t* {\\n\\t* type: "bun",\\n\\t* plugin: myBunPlugin()\\n\\t* },\\n\\t* {\\n\\t* type: "bunup",\\n\\t* hooks: {\\n\\t* onBuildStart: (options) => {\\n\\t* console.log('Build started with options:', options)\\n\\t* },\\n\\t* onBuildDone: ({ options, output }) => {\\n\\t* console.log('Build completed with output:', output)\\n\\t* }\\n\\t* }\\n\\t* }\\n\\t* ]\\n\\t*/
351
+ plugins?: Plugin[];
352
+ }
2
353
  declare function build(partialOptions: Partial<BuildOptions>, rootDir?: string): Promise<void>;
3
354
  declare function defineConfig(options: Arrayable<DefineConfigItem>): Arrayable<DefineConfigItem>;
4
355
  declare function defineWorkspace(options: DefineWorkspaceItem[]): DefineWorkspaceItem[];
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  // @bun
2
2
  import {
3
3
  build
4
- } from "./chunk-2hchnc6a.js";
5
- import"./chunk-0e6rexd1.js";
4
+ } from "./chunk-wav05ehp.js";
5
+ import"./chunk-0j56xynx.js";
6
6
  import"./chunk-gh7z7s46.js";
7
- import"./chunk-w9q3brxd.js";
7
+ import"./chunk-2g0gpaee.js";
8
8
  // src/define.ts
9
9
  function defineConfig(options) {
10
10
  return options;