bunup 0.5.16 → 0.5.17

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.
@@ -1,22 +1,14 @@
1
1
  import _Bun from "bun";
2
-
3
- //#region src/types.d.ts
4
2
  type MaybePromise<T> = Promise<T> | T;
5
3
  type Arrayable<T> = T | T[];
6
4
  type Bun = typeof _Bun;
7
5
  type BunBuildOptions = Parameters<Bun["build"]>[0];
8
6
  type BunPlugin = Exclude<BunBuildOptions["plugins"], undefined>[number];
9
-
10
- //#endregion
11
- //#region src/helpers/entry.d.ts
12
7
  type ProcessableEntry = {
13
- fullPath: string;
14
- outputBasePath: string | null;
15
- dts: boolean;
8
+ fullPath: string
9
+ outputBasePath: string | null
10
+ dts: boolean
16
11
  };
17
-
18
- //#endregion
19
- //#region src/options.d.ts
20
12
  type Loader = NonNullable<BunBuildOptions["loader"]>[string];
21
13
  type Define = BunBuildOptions["define"];
22
14
  type Sourcemap = BunBuildOptions["sourcemap"];
@@ -26,439 +18,358 @@ type External = (string | RegExp)[];
26
18
  type Env = BunBuildOptions["env"] | Record<string, string>;
27
19
  type Entry = Arrayable<string> | Record<string, string>;
28
20
  type ShimOptions = {
29
- /**
30
- * Adds __dirname and __filename shims for ESM files when used
31
- */
32
- dirnameFilename?: boolean;
33
- /**
34
- * Adds import.meta.url shims for CJS files when used
35
- */
36
- importMetaUrl?: boolean;
21
+ /**
22
+ * Adds __dirname and __filename shims for ESM files when used
23
+ */
24
+ dirnameFilename?: boolean
25
+ /**
26
+ * Adds import.meta.url shims for CJS files when used
27
+ */
28
+ importMetaUrl?: boolean
37
29
  };
38
30
  type Shims = boolean | ShimOptions;
39
31
  type DtsResolve = boolean | (string | RegExp)[];
40
32
  type DtsOptions = {
41
- /**
42
- * Entry point files for TypeScript declaration file generation
43
- *
44
- * This can be:
45
- * - A string path to a file
46
- * - An array of file paths
47
- * - An object where keys are output names and values are input file paths
48
- *
49
- * The key names are used for the generated declaration files.
50
- * For example, `{custom: 'src/index.ts'}` will generate `custom.d.ts`
51
- *
52
- * If not specified, the main entry points will be used for declaration file generation.
53
- *
54
- * If it's a string or an array of strings, the file name (without extension)
55
- * will be used as the name for the output declaration file.
56
- *
57
- * @see https://bunup.dev/docs/guide/typescript-declarations#custom-entry-points
58
- * @see https://bunup.dev/docs/guide/typescript-declarations#named-entries
59
- */
60
- entry?: Entry;
61
- /**
62
- * Resolve external types used in dts files from node_modules
63
- */
64
- resolve?: DtsResolve;
33
+ /**
34
+ * Entry point files for TypeScript declaration file generation
35
+ *
36
+ * This can be:
37
+ * - A string path to a file
38
+ * - An array of file paths
39
+ * - An object where keys are output names and values are input file paths
40
+ *
41
+ * The key names are used for the generated declaration files.
42
+ * For example, `{custom: 'src/index.ts'}` will generate `custom.d.ts`
43
+ *
44
+ * If not specified, the main entry points will be used for declaration file generation.
45
+ *
46
+ * If it's a string or an array of strings, the file name (without extension)
47
+ * will be used as the name for the output declaration file.
48
+ *
49
+ * @see https://bunup.dev/docs/guide/typescript-declarations#custom-entry-points
50
+ * @see https://bunup.dev/docs/guide/typescript-declarations#named-entries
51
+ */
52
+ entry?: Entry
53
+ /**
54
+ * Resolve external types used in dts files from node_modules
55
+ */
56
+ resolve?: DtsResolve
65
57
  };
66
58
  interface BuildOptions {
67
- /**
68
- * Name of the build configuration
69
- * Used for logging and identification purposes
70
- */
71
- name?: string;
72
- /**
73
- * Entry point files for the build
74
- *
75
- * This can be:
76
- * - A string path to a file
77
- * - An array of file paths
78
- * - An object where keys are output names and values are input file paths
79
- *
80
- * The key names are used for the generated output files.
81
- * For example, `{custom: 'src/index.ts'}` will generate `custom.js`
82
- *
83
- * If it's a string or an array of strings, the file name (without extension)
84
- * will be used as the name for the output file.
85
- *
86
- * @see https://bunup.dev/docs/#entry-points
87
- */
88
- entry: Entry;
89
- /**
90
- * Output directory for the bundled files
91
- * Defaults to 'dist' if not specified
92
- */
93
- outDir: string;
94
- /**
95
- * Output formats for the bundle
96
- * Can include 'esm', 'cjs', and/or 'iife'
97
- * Defaults to ['cjs'] if not specified
98
- */
99
- format: Format[];
100
- /**
101
- * Whether to enable all minification options
102
- * When true, enables minifyWhitespace, minifyIdentifiers, and minifySyntax
103
- */
104
- minify?: boolean;
105
- /**
106
- * Whether to enable code splitting
107
- * Defaults to true for ESM format, false for CJS format
108
- */
109
- splitting?: boolean;
110
- /**
111
- * Whether to minify whitespace in the output
112
- * Removes unnecessary whitespace to reduce file size
113
- */
114
- minifyWhitespace?: boolean;
115
- /**
116
- * Whether to minify identifiers in the output
117
- * Renames variables and functions to shorter names
118
- */
119
- minifyIdentifiers?: boolean;
120
- /**
121
- * Whether to minify syntax in the output
122
- * Optimizes code structure for smaller file size
123
- */
124
- minifySyntax?: boolean;
125
- /**
126
- * Whether to watch for file changes and rebuild automatically
127
- */
128
- watch?: boolean;
129
- /**
130
- * Whether to generate TypeScript declaration files (.d.ts)
131
- * When set to true, generates declaration files for all entry points
132
- * Can also be configured with DtsOptions for more control
133
- */
134
- dts?: boolean | DtsOptions;
135
- /**
136
- * Path to a preferred tsconfig.json file to use for declaration generation
137
- *
138
- * If not specified, the tsconfig.json in the project root will be used.
139
- * This option allows you to use a different TypeScript configuration
140
- * specifically for declaration file generation.
141
- *
142
- * @example
143
- * preferredTsconfigPath: './tsconfig.build.json'
144
- */
145
- preferredTsconfigPath?: string;
146
- /**
147
- * External packages that should not be bundled
148
- * Useful for dependencies that should be kept as external imports
149
- */
150
- external?: External;
151
- /**
152
- * Packages that should be bundled even if they are in external
153
- * Useful for dependencies that should be included in the bundle
154
- */
155
- noExternal?: External;
156
- /**
157
- * The target environment for the bundle
158
- * Can be 'browser', 'bun', 'node', etc.
159
- * Defaults to 'node' if not specified
160
- */
161
- target?: Target;
162
- /**
163
- * Whether to clean the output directory before building
164
- * When true, removes all files in the outDir before starting a new build
165
- * Defaults to true if not specified
166
- */
167
- clean?: boolean;
168
- /**
169
- * Specifies the type of sourcemap to generate
170
- * Can be 'none', 'linked', 'external', or 'inline'
171
- * Can also be a boolean - when true, it will use 'inline'
172
- *
173
- * @see https://bun.sh/docs/bundler#sourcemap
174
- *
175
- * @default 'none'
176
- *
177
- * @example
178
- * sourcemap: 'linked'
179
- * // or
180
- * sourcemap: true // equivalent to 'inline'
181
- */
182
- sourcemap?: Sourcemap;
183
- /**
184
- * Define global constants for the build
185
- * These values will be replaced at build time
186
- *
187
- * @see https://bun.sh/docs/bundler#define
188
- *
189
- * @example
190
- * define: {
191
- * 'process.env.NODE_ENV': '"production"',
192
- * 'PACKAGE_VERSION': '"1.0.0"'
193
- * }
194
- */
195
- define?: Define;
196
- /**
197
- * A callback function that runs after the build process completes
198
- * This can be used for custom post-build operations like copying files,
199
- * running additional tools, or logging build information
200
- *
201
- * If watch mode is enabled, this callback runs after each rebuild
202
- *
203
- * @param options The build options that were used
204
- */
205
- onSuccess?: (options: Partial<BuildOptions>) => MaybePromise<void>;
206
- /**
207
- * 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.
208
- *
209
- * @see https://bun.sh/docs/bundler#banner
210
- *
211
- * @example
212
- * banner: '"use client";'
213
- */
214
- banner?: string;
215
- /**
216
- * 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.
217
- *
218
- * @see https://bun.sh/docs/bundler#footer
219
- *
220
- * @example
221
- * footer: '// built with love in SF'
222
- */
223
- footer?: string;
224
- /**
225
- * 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.
226
- *
227
- * @see https://bun.sh/docs/bundler#drop
228
- *
229
- * @example
230
- * drop: ["console", "debugger", "anyIdentifier.or.propertyAccess"]
231
- */
232
- drop?: string[];
233
- /**
234
- * 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.
235
- *
236
- * @see https://bun.sh/docs/bundler#loader
237
- *
238
- * @example
239
- * loader: {
240
- * ".png": "dataurl",
241
- * ".txt": "file",
242
- * }
243
- */
244
- loader?: Record<string, Loader>;
245
- /**
246
- * Generate bytecode for the output. This can dramatically improve cold start times, but will make the final output larger and slightly increase memory usage.
247
- *
248
- * Bytecode is currently only supported for CommonJS (format: "cjs").
249
- *
250
- * Must be target: "bun"
251
- *
252
- * @see https://bun.sh/docs/bundler#bytecode
253
- *
254
- * @default false
255
- */
256
- bytecode?: boolean;
257
- /**
258
- * Disable logging during the build process. When set to true, no logs will be printed to the console.
259
- *
260
- * @default false
261
- */
262
- silent?: boolean;
263
- /**
264
- * You can specify a prefix to be added to specific import paths in your bundled code
265
- *
266
- * Used for assets, external modules, and chunk files when splitting is enabled
267
- *
268
- * @see https://bunup.dev/docs#public-path for more information
269
- *
270
- * @example
271
- * publicPath: 'https://cdn.example.com/'
272
- */
273
- publicPath?: string;
274
- /**
275
- * Inject Node.js compatibility shims for ESM/CJS interoperability
276
- *
277
- * When set to true, automatically injects all shims when needed
278
- * When set to an object, only injects the specified shims
279
- *
280
- * Available shims:
281
- * - dirnameFilename: Adds __dirname and __filename for ESM files when used
282
- * - importMetaUrl: Adds import.meta.url for CJS files when used
283
- *
284
- * @example
285
- * // Enable all shims
286
- * shims: true
287
- *
288
- * // Enable only specific shims
289
- * shims: { dirnameFilename: true, importMetaUrl: true }
290
- */
291
- shims?: Shims;
292
- /**
293
- * Controls how environment variables are handled during bundling.
294
- *
295
- * Can be one of:
296
- * - `"inline"`: Replaces all `process.env.FOO` references in your code with the actual values
297
- * of those environment variables at the time the build runs.
298
- * - `"disable"`: Disables environment variable injection entirely, leaving `process.env.*` as-is.
299
- * - A string ending in `*`: Only inlines environment variables matching the given prefix.
300
- * For example, `"MY_PUBLIC_*"` will inline variables like `MY_PUBLIC_API_URL`.
301
- * - An object of key-value pairs: Replaces both `process.env.KEY` and `import.meta.env.KEY`
302
- * with the provided values, regardless of the runtime environment.
303
- *
304
- * Note: Values are injected at build time. Secrets or private keys should be excluded
305
- * from inlining when targeting browser environments.
306
- *
307
- * @see https://bun.sh/docs/bundler#env to learn more about inline, disable, prefix, and object modes
308
- *
309
- * @example
310
- * // Inline all environment variables available at build time
311
- * env: "inline"
312
- *
313
- * // Disable all environment variable injection
314
- * env: "disable"
315
- *
316
- * // Only inline environment variables with a specific prefix
317
- * env: "PUBLIC_*"
318
- *
319
- * // Provide specific environment variables manually
320
- * env: { API_URL: "https://api.example.com", DEBUG: "false" }
321
- */
322
- env?: Env;
323
- /**
324
- * Plugins to extend the build process functionality
325
- *
326
- * The Plugin type uses a discriminated union pattern with the 'type' field
327
- * to support different plugin systems. Both "bun" and "bunup" plugins are supported.
328
- *
329
- * Each plugin type has its own specific plugin implementation:
330
- * - "bun": Uses Bun's native plugin system (BunPlugin)
331
- * - "bunup": Uses bunup's own plugin system with lifecycle hooks
332
- *
333
- * This architecture allows for extensibility as more plugin systems are added.
334
- *
335
- * @see https://bunup.dev/docs/advanced/plugin-development for more information on plugins
336
- *
337
- * @example
338
- * plugins: [
339
- * {
340
- * type: "bun",
341
- * plugin: myBunPlugin()
342
- * },
343
- * {
344
- * type: "bunup",
345
- * hooks: {
346
- * onBuildStart: (options) => {
347
- * console.log('Build started with options:', options)
348
- * },
349
- * onBuildDone: ({ options, output }) => {
350
- * console.log('Build completed with output:', output)
351
- * }
352
- * }
353
- * }
354
- * ]
355
- */
356
- plugins?: Plugin[];
357
- /**
358
- * Customize the output file extension for each format.
359
- *
360
- * @param options Contains format, packageType, options, and entry information
361
- * @returns Object with js extension (including the leading dot). If dts is true, the dts file extension will be automatically derived from the js extension
362
- *
363
- * @example
364
- * outputExtension: ({ format, entry }) => ({
365
- * js: entry.outputBasePath === 'worker' ? '.worker.js' : `.${format}.js`
366
- * // For example, if js is '.worker.js', the dts will automatically be '.worker.d.ts'
367
- * })
368
- */
369
- outputExtension?: (options: {
370
- format: Format;
371
- packageType: string | undefined;
372
- options: BuildOptions;
373
- entry: ProcessableEntry;
374
- }) => {
375
- js: string;
376
- };
377
- } //#endregion
378
- //#region src/plugins/types.d.ts
379
- /**
380
- * Represents a Bun plugin that can be used with Bunup
381
- */
59
+ /**
60
+ * Name of the build configuration
61
+ * Used for logging and identification purposes
62
+ */
63
+ name?: string;
64
+ /**
65
+ * Entry point files for the build
66
+ *
67
+ * This can be:
68
+ * - A string path to a file
69
+ * - An array of file paths
70
+ * - An object where keys are output names and values are input file paths
71
+ *
72
+ * The key names are used for the generated output files.
73
+ * For example, `{custom: 'src/index.ts'}` will generate `custom.js`
74
+ *
75
+ * If it's a string or an array of strings, the file name (without extension)
76
+ * will be used as the name for the output file.
77
+ *
78
+ * @see https://bunup.dev/docs/#entry-points
79
+ */
80
+ entry: Entry;
81
+ /**
82
+ * Output directory for the bundled files
83
+ * Defaults to 'dist' if not specified
84
+ */
85
+ outDir: string;
86
+ /**
87
+ * Output formats for the bundle
88
+ * Can include 'esm', 'cjs', and/or 'iife'
89
+ * Defaults to ['cjs'] if not specified
90
+ */
91
+ format: Format[];
92
+ /**
93
+ * Whether to enable all minification options
94
+ * When true, enables minifyWhitespace, minifyIdentifiers, and minifySyntax
95
+ */
96
+ minify?: boolean;
97
+ /**
98
+ * Whether to enable code splitting
99
+ * Defaults to true for ESM format, false for CJS format
100
+ */
101
+ splitting?: boolean;
102
+ /**
103
+ * Whether to minify whitespace in the output
104
+ * Removes unnecessary whitespace to reduce file size
105
+ */
106
+ minifyWhitespace?: boolean;
107
+ /**
108
+ * Whether to minify identifiers in the output
109
+ * Renames variables and functions to shorter names
110
+ */
111
+ minifyIdentifiers?: boolean;
112
+ /**
113
+ * Whether to minify syntax in the output
114
+ * Optimizes code structure for smaller file size
115
+ */
116
+ minifySyntax?: boolean;
117
+ /**
118
+ * Whether to watch for file changes and rebuild automatically
119
+ */
120
+ watch?: boolean;
121
+ /**
122
+ * Whether to generate TypeScript declaration files (.d.ts)
123
+ * When set to true, generates declaration files for all entry points
124
+ * Can also be configured with DtsOptions for more control
125
+ */
126
+ dts?: boolean | DtsOptions;
127
+ /**
128
+ * Path to a preferred tsconfig.json file to use for declaration generation
129
+ *
130
+ * If not specified, the tsconfig.json in the project root will be used.
131
+ * This option allows you to use a different TypeScript configuration
132
+ * specifically for declaration file generation.
133
+ *
134
+ * @example
135
+ * preferredTsconfigPath: './tsconfig.build.json'
136
+ */
137
+ preferredTsconfigPath?: string;
138
+ /**
139
+ * External packages that should not be bundled
140
+ * Useful for dependencies that should be kept as external imports
141
+ */
142
+ external?: External;
143
+ /**
144
+ * Packages that should be bundled even if they are in external
145
+ * Useful for dependencies that should be included in the bundle
146
+ */
147
+ noExternal?: External;
148
+ /**
149
+ * The target environment for the bundle
150
+ * Can be 'browser', 'bun', 'node', etc.
151
+ * Defaults to 'node' if not specified
152
+ */
153
+ target?: Target;
154
+ /**
155
+ * Whether to clean the output directory before building
156
+ * When true, removes all files in the outDir before starting a new build
157
+ * Defaults to true if not specified
158
+ */
159
+ clean?: boolean;
160
+ /**
161
+ * Specifies the type of sourcemap to generate
162
+ * Can be 'none', 'linked', 'external', or 'inline'
163
+ * Can also be a boolean - when true, it will use 'inline'
164
+ *
165
+ * @see https://bun.sh/docs/bundler#sourcemap
166
+ *
167
+ * @default 'none'
168
+ *
169
+ * @example
170
+ * sourcemap: 'linked'
171
+ * // or
172
+ * sourcemap: true // equivalent to 'inline'
173
+ */
174
+ sourcemap?: Sourcemap;
175
+ define?: Define;
176
+ /**
177
+ * A callback function that runs after the build process completes
178
+ * This can be used for custom post-build operations like copying files,
179
+ * running additional tools, or logging build information
180
+ *
181
+ * If watch mode is enabled, this callback runs after each rebuild
182
+ *
183
+ * @param options The build options that were used
184
+ */
185
+ onSuccess?: (options: Partial<BuildOptions>) => MaybePromise<void>;
186
+ banner?: string;
187
+ /**
188
+ * 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.
189
+ *
190
+ * @see https://bun.sh/docs/bundler#footer
191
+ *
192
+ * @example
193
+ * footer: '// built with love in SF'
194
+ */
195
+ footer?: string;
196
+ /**
197
+ * 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.
198
+ *
199
+ * @see https://bun.sh/docs/bundler#drop
200
+ *
201
+ * @example
202
+ * drop: ["console", "debugger", "anyIdentifier.or.propertyAccess"]
203
+ */
204
+ drop?: string[];
205
+ /**
206
+ * 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.
207
+ *
208
+ * @see https://bun.sh/docs/bundler#loader
209
+ *
210
+ * @example
211
+ * loader: {
212
+ * ".png": "dataurl",
213
+ * ".txt": "file",
214
+ * }
215
+ */
216
+ loader?: Record<string, Loader>;
217
+ /**
218
+ * Generate bytecode for the output. This can dramatically improve cold start times, but will make the final output larger and slightly increase memory usage.
219
+ *
220
+ * Bytecode is currently only supported for CommonJS (format: "cjs").
221
+ *
222
+ * Must be target: "bun"
223
+ *
224
+ * @see https://bun.sh/docs/bundler#bytecode
225
+ *
226
+ * @default false
227
+ */
228
+ bytecode?: boolean;
229
+ /**
230
+ * Disable logging during the build process. When set to true, no logs will be printed to the console.
231
+ *
232
+ * @default false
233
+ */
234
+ silent?: boolean;
235
+ /**
236
+ * You can specify a prefix to be added to specific import paths in your bundled code
237
+ *
238
+ * Used for assets, external modules, and chunk files when splitting is enabled
239
+ *
240
+ * @see https://bunup.dev/docs#public-path for more information
241
+ *
242
+ * @example
243
+ * publicPath: 'https://cdn.example.com/'
244
+ */
245
+ publicPath?: string;
246
+ /**
247
+ * Inject Node.js compatibility shims for ESM/CJS interoperability
248
+ *
249
+ * When set to true, automatically injects all shims when needed
250
+ * When set to an object, only injects the specified shims
251
+ *
252
+ * Available shims:
253
+ * - dirnameFilename: Adds __dirname and __filename for ESM files when used
254
+ * - importMetaUrl: Adds import.meta.url for CJS files when used
255
+ *
256
+ * @example
257
+ * // Enable all shims
258
+ * shims: true
259
+ *
260
+ * // Enable only specific shims
261
+ * shims: { dirnameFilename: true, importMetaUrl: true }
262
+ */
263
+ shims?: Shims;
264
+ /**
265
+ * Controls how environment variables are handled during bundling.
266
+ *
267
+ * Can be one of:
268
+ * - `"inline"`: Replaces all `process.env.FOO` references in your code with the actual values
269
+ * of those environment variables at the time the build runs.
270
+ * - `"disable"`: Disables environment variable injection entirely, leaving `process.env.*` as-is.
271
+ * - A string ending in `*`: Only inlines environment variables matching the given prefix.
272
+ * For example, `"MY_PUBLIC_*"` will inline variables like `MY_PUBLIC_API_URL`.
273
+ * - An object of key-value pairs: Replaces both `process.env.KEY` and `import.meta.env.KEY`
274
+ * with the provided values, regardless of the runtime environment.
275
+ *
276
+ * Note: Values are injected at build time. Secrets or private keys should be excluded
277
+ * from inlining when targeting browser environments.
278
+ *
279
+ * @see https://bun.sh/docs/bundler#env to learn more about inline, disable, prefix, and object modes
280
+ *
281
+ * @example
282
+ * // Inline all environment variables available at build time
283
+ * env: "inline"
284
+ *
285
+ * // Disable all environment variable injection
286
+ * env: "disable"
287
+ *
288
+ * // Only inline environment variables with a specific prefix
289
+ * env: "PUBLIC_*"
290
+ *
291
+ * // Provide specific environment variables manually
292
+ * env: { API_URL: "https://api.example.com", DEBUG: "false" }
293
+ */
294
+ env?: Env;
295
+ plugins?: Plugin[];
296
+ /**
297
+ * Customize the output file extension for each format.
298
+ *
299
+ * @param options Contains format, packageType, options, and entry information
300
+ * @returns Object with js extension (including the leading dot). If dts is true, the dts file extension will be automatically derived from the js extension
301
+ *
302
+ * @example
303
+ * outputExtension: ({ format, entry }) => ({
304
+ * js: entry.outputBasePath === 'worker' ? '.worker.js' : `.${format}.js`
305
+ * // For example, if js is '.worker.js', the dts will automatically be '.worker.d.ts'
306
+ * })
307
+ */
308
+ outputExtension?: (options: {
309
+ format: Format
310
+ packageType: string | undefined
311
+ options: BuildOptions
312
+ entry: ProcessableEntry
313
+ }) => {
314
+ js: string
315
+ };
316
+ }
382
317
  type BunupBunPlugin = {
383
- /** Identifies this as a native Bun plugin */
384
- type: "bun";
385
- /** Optional name for the plugin */
386
- name?: string;
387
- /** The actual Bun plugin implementation */
388
- plugin: BunPlugin;
318
+ /** Identifies this as a native Bun plugin */
319
+ type: "bun"
320
+ /** Optional name for the plugin */
321
+ name?: string
322
+ /** The actual Bun plugin implementation */
323
+ plugin: BunPlugin
389
324
  };
390
- /**
391
- * Represents the output of a build operation
392
- */
393
325
  type BuildOutput = {
394
- /** Array of generated files with their paths and contents */
395
- files: Array<{
396
- /** Path to the generated file */
397
- fullPath: string;
398
- /** Path to the generated file relative to the root directory */
399
- relativePathToRootDir: string;
400
- }>;
326
+ /** Array of generated files with their paths and contents */
327
+ files: Array<{
328
+ /** Path to the generated file */
329
+ fullPath: string
330
+ /** Path to the generated file relative to the root directory */
331
+ relativePathToRootDir: string
332
+ }>
401
333
  };
402
- /**
403
- * Context provided to build hooks
404
- */
405
334
  type BuildContext = {
406
- /** The build options that were used */
407
- options: BuildOptions;
408
- /** The output of the build */
409
- output: BuildOutput;
335
+ /** The build options that were used */
336
+ options: BuildOptions
337
+ /** The output of the build */
338
+ output: BuildOutput
410
339
  };
411
- /**
412
- * Hooks that can be implemented by Bunup plugins
413
- */
414
340
  type BunupPluginHooks = {
415
- /**
416
- * Called when a build is successfully completed
417
- * @param ctx Build context containing options and output
418
- */
419
- onBuildDone?: (ctx: BuildContext) => MaybePromise<void>;
420
- /**
421
- * Called before a build starts
422
- * @param options Build options that will be used
423
- */
424
- onBuildStart?: (options: BuildOptions) => MaybePromise<void>;
341
+ /**
342
+ * Called when a build is successfully completed
343
+ * @param ctx Build context containing options and output
344
+ */
345
+ onBuildDone?: (ctx: BuildContext) => MaybePromise<void>
346
+ /**
347
+ * Called before a build starts
348
+ * @param options Build options that will be used
349
+ */
350
+ onBuildStart?: (options: BuildOptions) => MaybePromise<void>
425
351
  };
426
- /**
427
- * Represents a Bunup-specific plugin
428
- */
429
352
  type BunupPlugin = {
430
- /** Identifies this as a Bunup-specific plugin */
431
- type: "bunup";
432
- /** Optional name for the plugin */
433
- name?: string;
434
- /** The hooks implemented by this plugin */
435
- hooks: BunupPluginHooks;
353
+ /** Identifies this as a Bunup-specific plugin */
354
+ type: "bunup"
355
+ /** Optional name for the plugin */
356
+ name?: string
357
+ /** The hooks implemented by this plugin */
358
+ hooks: BunupPluginHooks
436
359
  };
437
- /**
438
- * Union type representing all supported plugin types
439
- */
440
360
  type Plugin = BunupBunPlugin | BunupPlugin;
441
-
442
- //#endregion
443
- //#region src/plugins/built-in/report.d.ts
444
361
  type ReportPluginOptions = {
445
- /**
446
- * The maximum bundle size in bytes.
447
- * If the bundle size exceeds this limit, a error will be logged without failing the build.
448
- */
449
- maxBundleSize?: number;
450
- /**
451
- * Whether to show gzip sizes in the report.
452
- * When enabled, the report will include an additional column with the gzip size of each file.
453
- * @default true
454
- */
455
- gzip?: boolean;
362
+ /**
363
+ * The maximum bundle size in bytes.
364
+ * If the bundle size exceeds this limit, a error will be logged without failing the build.
365
+ */
366
+ maxBundleSize?: number
367
+ /**
368
+ * Whether to show gzip sizes in the report.
369
+ * When enabled, the report will include an additional column with the gzip size of each file.
370
+ * @default true
371
+ */
372
+ gzip?: boolean
456
373
  };
457
- /**
458
- * A plugin that logs a report of the bundle size.
459
- * @param options - The options for the report plugin.
460
- */
461
374
  declare function report(options?: ReportPluginOptions): BunupPlugin;
462
-
463
- //#endregion
464
- export { report };
375
+ export { report };