bunup 0.8.30 → 0.8.31

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/plugins.d.ts CHANGED
@@ -1,350 +1,4 @@
1
- import _Bun from "bun";
2
- type PackageJson = {
3
- /** The parsed content of the package.json file */
4
- data: Record<string, any> | null
5
- /** The path to the package.json file */
6
- path: string | null
7
- };
8
- /**
9
- * Represents a Bun plugin that can be used with Bunup
10
- */
11
- type BunupBunPlugin = {
12
- /** Identifies this as a native Bun plugin */
13
- type: "bun"
14
- /** Optional name for the plugin */
15
- name?: string
16
- /** The actual Bun plugin implementation */
17
- plugin: BunPlugin
18
- };
19
- /**
20
- * Represents the meta data of the build
21
- */
22
- type BuildMeta = {
23
- /** The package.json file */
24
- packageJson: PackageJson
25
- /** The root directory of the build */
26
- rootDir: string
27
- };
28
- type BuildOutputFile = {
29
- /** The kind of the file */
30
- kind: "entry-point" | "chunk" | "asset" | "sourcemap" | "bytecode"
31
- /** Path to the generated file */
32
- fullPath: string
33
- /** Path to the generated file relative to the root directory */
34
- relativePathToRootDir: string
35
- /** Path to the generated file relative to the output directory */
36
- relativePathToOutputDir: string
37
- /** Whether the file is a dts file */
38
- dts: boolean
39
- /** The format of the output file */
40
- format: Format
41
- };
42
- /**
43
- * Represents the output of a build operation
44
- */
45
- type BuildOutput = {
46
- /** Array of generated files with their paths and contents */
47
- files: BuildOutputFile[]
48
- };
49
- /**
50
- * Context provided to build hooks
51
- */
52
- type BuildContext = {
53
- /** The build options that were used */
54
- options: BuildOptions
55
- /** The output of the build */
56
- output: BuildOutput
57
- /** The meta data of the build */
58
- meta: BuildMeta
59
- };
60
- /**
61
- * Hooks that can be implemented by Bunup plugins
62
- */
63
- type BunupPluginHooks = {
64
- /**
65
- * Called when a build is successfully completed
66
- * @param ctx Build context containing options and output
67
- */
68
- onBuildDone?: (ctx: BuildContext) => MaybePromise<void>
69
- /**
70
- * Called before a build starts
71
- * @param options Build options that will be used
72
- */
73
- onBuildStart?: (options: BuildOptions) => MaybePromise<void>
74
- };
75
- /**
76
- * Represents a Bunup-specific plugin
77
- */
78
- type BunupPlugin = {
79
- /** Identifies this as a Bunup-specific plugin */
80
- type: "bunup"
81
- /** Optional name for the plugin */
82
- name?: string
83
- /** The hooks implemented by this plugin */
84
- hooks: BunupPluginHooks
85
- };
86
- /**
87
- * Union type representing all supported plugin types
88
- */
89
- type Plugin = BunupBunPlugin | BunupPlugin;
90
- type Loader = NonNullable<BunBuildOptions["loader"]>[string];
91
- type Define = BunBuildOptions["define"];
92
- type Sourcemap = BunBuildOptions["sourcemap"];
93
- type Format = Exclude<BunBuildOptions["format"], undefined>;
94
- type Target = BunBuildOptions["target"];
95
- type External = (string | RegExp)[];
96
- type Env = BunBuildOptions["env"] | Record<string, string>;
97
- type DtsResolve = boolean | (string | RegExp)[];
98
- type Naming = string | {
99
- entry?: string
100
- chunk?: string
101
- asset?: string
102
- };
103
- type DtsOptions = {
104
- /**
105
- * Entry point files for TypeScript declaration file generation
106
- *
107
- * If not specified, the main entry points will be used for declaration file generation.
108
- *
109
- * @see https://bunup.dev/docs/guide/typescript-declarations#custom-entry-points
110
- * @see https://bunup.dev/docs/guide/typescript-declarations#named-entries
111
- */
112
- entry?: string | string[]
113
- /**
114
- * Resolve external types used in dts files from node_modules
115
- */
116
- resolve?: DtsResolve
117
- /**
118
- * Whether to split declaration files when multiple entrypoints import the same files,
119
- * modules, or share types. When enabled, shared types will be extracted to separate
120
- * .d.ts files, and other declaration files will import these shared files.
121
- *
122
- * This helps reduce bundle size by preventing duplication of type definitions
123
- * across multiple entrypoints.
124
- *
125
- * This option is enabled by default if splitting is enabled in the Bun build config or format is esm.
126
- */
127
- splitting?: boolean
128
- };
129
- interface BuildOptions {
130
- /**
131
- * Name of the build configuration
132
- * Used for logging and identification purposes
133
- */
134
- name?: string;
135
- /**
136
- * Entry point files for the build
137
- *
138
- * This can be:
139
- * - A string path to a file
140
- * - An array of file paths
141
- *
142
- * @see https://bunup.dev/docs/#entry-points
143
- */
144
- entry: string | string[];
145
- /**
146
- * Output directory for the bundled files
147
- * Defaults to 'dist' if not specified
148
- */
149
- outDir: string;
150
- /**
151
- * Output formats for the bundle
152
- * Can include 'esm', 'cjs', and/or 'iife'
153
- * Defaults to ['cjs'] if not specified
154
- */
155
- format: Format[];
156
- /**
157
- * Whether to enable all minification options
158
- * When true, enables minifyWhitespace, minifyIdentifiers, and minifySyntax
159
- */
160
- minify?: boolean;
161
- /**
162
- * Whether to enable code splitting
163
- * Defaults to true for ESM format, false for CJS format
164
- */
165
- splitting?: boolean;
166
- naming?: Naming;
167
- /**
168
- * Whether to minify whitespace in the output
169
- * Removes unnecessary whitespace to reduce file size
170
- */
171
- minifyWhitespace?: boolean;
172
- /**
173
- * Whether to minify identifiers in the output
174
- * Renames variables and functions to shorter names
175
- */
176
- minifyIdentifiers?: boolean;
177
- /**
178
- * Whether to minify syntax in the output
179
- * Optimizes code structure for smaller file size
180
- */
181
- minifySyntax?: boolean;
182
- /**
183
- * Whether to watch for file changes and rebuild automatically
184
- */
185
- watch?: boolean;
186
- /**
187
- * Whether to generate TypeScript declaration files (.d.ts)
188
- * When set to true, generates declaration files for all entry points
189
- * Can also be configured with DtsOptions for more control
190
- */
191
- dts?: boolean | DtsOptions;
192
- /**
193
- * Path to a preferred tsconfig.json file to use for declaration generation
194
- *
195
- * If not specified, the tsconfig.json in the project root will be used.
196
- * This option allows you to use a different TypeScript configuration
197
- * specifically for declaration file generation.
198
- *
199
- * @example
200
- * preferredTsconfigPath: './tsconfig.build.json'
201
- */
202
- preferredTsconfigPath?: string;
203
- /**
204
- * External packages that should not be bundled
205
- * Useful for dependencies that should be kept as external imports
206
- */
207
- external?: External;
208
- /**
209
- * Packages that should be bundled even if they are in external
210
- * Useful for dependencies that should be included in the bundle
211
- */
212
- noExternal?: External;
213
- /**
214
- * The target environment for the bundle
215
- * Can be 'browser', 'bun', 'node', etc.
216
- * Defaults to 'node' if not specified
217
- */
218
- target?: Target;
219
- /**
220
- * Whether to clean the output directory before building
221
- * When true, removes all files in the outDir before starting a new build
222
- * Defaults to true if not specified
223
- */
224
- clean?: boolean;
225
- /**
226
- * Specifies the type of sourcemap to generate
227
- * Can be 'none', 'linked', 'external', or 'inline'
228
- * Can also be a boolean - when true, it will use 'inline'
229
- *
230
- * @see https://bun.sh/docs/bundler#sourcemap
231
- *
232
- * @default 'none'
233
- *
234
- * @example
235
- * sourcemap: 'linked'
236
- * // or
237
- * sourcemap: true // equivalent to 'inline'
238
- */
239
- sourcemap?: Sourcemap;
240
- define?: Define;
241
- /**
242
- * A callback function that runs after the build process completes
243
- * This can be used for custom post-build operations like copying files,
244
- * running additional tools, or logging build information
245
- *
246
- * If watch mode is enabled, this callback runs after each rebuild
247
- *
248
- * @param options The build options that were used
249
- */
250
- onSuccess?: (options: Partial<BuildOptions>) => MaybePromise<void>;
251
- banner?: string;
252
- /**
253
- * 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.
254
- *
255
- * @see https://bun.sh/docs/bundler#footer
256
- *
257
- * @example
258
- * footer: '// built with love in SF'
259
- */
260
- footer?: string;
261
- /**
262
- * 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.
263
- *
264
- * @see https://bun.sh/docs/bundler#drop
265
- *
266
- * @example
267
- * drop: ["console", "debugger", "anyIdentifier.or.propertyAccess"]
268
- */
269
- drop?: string[];
270
- /**
271
- * 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.
272
- *
273
- * @see https://bun.sh/docs/bundler#loader
274
- *
275
- * @example
276
- * loader: {
277
- * ".png": "dataurl",
278
- * ".txt": "file",
279
- * }
280
- */
281
- loader?: Record<string, Loader>;
282
- /**
283
- * Generate bytecode for the output. This can dramatically improve cold start times, but will make the final output larger and slightly increase memory usage.
284
- *
285
- * Bytecode is currently only supported for CommonJS (format: "cjs").
286
- *
287
- * Must be target: "bun"
288
- *
289
- * @see https://bun.sh/docs/bundler#bytecode
290
- *
291
- * @default false
292
- */
293
- bytecode?: boolean;
294
- /**
295
- * Disable logging during the build process. When set to true, no logs will be printed to the console.
296
- *
297
- * @default false
298
- */
299
- silent?: boolean;
300
- /**
301
- * You can specify a prefix to be added to specific import paths in your bundled code
302
- *
303
- * Used for assets, external modules, and chunk files when splitting is enabled
304
- *
305
- * @see https://bunup.dev/docs#public-path for more information
306
- *
307
- * @example
308
- * publicPath: 'https://cdn.example.com/'
309
- */
310
- publicPath?: string;
311
- /**
312
- * Controls how environment variables are handled during bundling.
313
- *
314
- * Can be one of:
315
- * - `"inline"`: Replaces all `process.env.FOO` references in your code with the actual values
316
- * of those environment variables at the time the build runs.
317
- * - `"disable"`: Disables environment variable injection entirely, leaving `process.env.*` as-is.
318
- * - A string ending in `*`: Only inlines environment variables matching the given prefix.
319
- * For example, `"MY_PUBLIC_*"` will inline variables like `MY_PUBLIC_API_URL`.
320
- * - An object of key-value pairs: Replaces both `process.env.KEY` and `import.meta.env.KEY`
321
- * with the provided values, regardless of the runtime environment.
322
- *
323
- * Note: Values are injected at build time. Secrets or private keys should be excluded
324
- * from inlining when targeting browser environments.
325
- *
326
- * @see https://bun.sh/docs/bundler#env to learn more about inline, disable, prefix, and object modes
327
- *
328
- * @example
329
- * // Inline all environment variables available at build time
330
- * env: "inline"
331
- *
332
- * // Disable all environment variable injection
333
- * env: "disable"
334
- *
335
- * // Only inline environment variables with a specific prefix
336
- * env: "PUBLIC_*"
337
- *
338
- * // Provide specific environment variables manually
339
- * env: { API_URL: "https://api.example.com", DEBUG: "false" }
340
- */
341
- env?: Env;
342
- plugins?: Plugin[];
343
- }
344
- type MaybePromise<T> = Promise<T> | T;
345
- type Bun = typeof _Bun;
346
- type BunBuildOptions = Parameters<Bun["build"]>[0];
347
- type BunPlugin = Exclude<BunBuildOptions["plugins"], undefined>[number];
1
+ import { BunupPlugin, MaybePromise, Plugin } from "./chunk-8sqm3fje";
348
2
  /**
349
3
  * A plugin that provides shims for Node.js globals and ESM/CJS interoperability.
350
4
  */
package/package.json CHANGED
@@ -1,97 +1,103 @@
1
1
  {
2
- "name": "bunup",
3
- "description": "⚡ A blazing-fast build tool for your libraries built with Bun.",
4
- "version": "0.8.30",
5
- "type": "module",
6
- "files": ["dist", "bin"],
7
- "types": "./dist/index.d.cts",
8
- "module": "./dist/index.js",
9
- "main": "./dist/index.cjs",
10
- "exports": {
11
- ".": {
12
- "types": "./dist/index.d.cts",
13
- "import": "./dist/index.js",
14
- "require": "./dist/index.cjs"
15
- },
16
- "./plugins": {
17
- "types": "./dist/plugins.d.cts",
18
- "import": "./dist/plugins.js",
19
- "require": "./dist/plugins.cjs"
20
- },
21
- "./cli": {
22
- "types": "./dist/cli/index.d.cts",
23
- "import": "./dist/cli/index.js",
24
- "require": "./dist/cli/index.cjs"
25
- }
26
- },
27
- "license": "MIT",
28
- "author": "Arshad Yaseen <m@arshadyaseen.com> (https://arshadyaseen.com)",
29
- "maintainers": [
30
- {
31
- "name": "Arshad Yaseen",
32
- "email": "m@arshadyaseen.com",
33
- "url": "https://arshadyaseen.com"
34
- }
35
- ],
36
- "repository": {
37
- "type": "git",
38
- "url": "git+https://github.com/arshad-yaseen/bunup.git"
39
- },
40
- "funding": "https://github.com/sponsors/arshad-yaseen",
41
- "homepage": "https://bunup.dev",
42
- "keywords": ["bun", "bunup", "bun-bundler"],
43
- "bin": {
44
- "bunup": "bin/bunup.mjs"
45
- },
46
- "dependencies": {
47
- "@clack/prompts": "^0.10.1",
48
- "bun-dts": "^0.1.54",
49
- "chokidar": "^4.0.3",
50
- "coffi": "^0.1.31",
51
- "giget": "^2.0.0",
52
- "replace-in-file": "^8.3.0",
53
- "tinyexec": "^1.0.1"
54
- },
55
- "devDependencies": {
56
- "@biomejs/biome": "^1.9.4",
57
- "@types/bun": "^1.2.5",
58
- "bumpp": "^10.1.0",
59
- "husky": "^9.1.7",
60
- "lightningcss": "^1.30.1",
61
- "lint-staged": "^15.5.1",
62
- "typescript": "^5.8.3"
63
- },
64
- "peerDependencies": {
65
- "typescript": ">=4.5.0",
66
- "lightningcss": ">=1.17.0"
67
- },
68
- "peerDependenciesMeta": {
69
- "typescript": {
70
- "optional": true
71
- },
72
- "lightningcss": {
73
- "optional": true
74
- }
75
- },
76
- "scripts": {
77
- "build": "bunx bunup@latest",
78
- "build:docs": "bun run --cwd docs build",
79
- "dev": "bunx bunup@latest --watch",
80
- "dev:docs": "bun run --cwd docs dev",
81
- "format": "biome format .",
82
- "format:fix": "biome format --write .",
83
- "lint": "biome check .",
84
- "lint:fix": "biome check --write .",
85
- "prepare": "husky",
86
- "test": "bun test",
87
- "test-build": "bun run --cwd tests build",
88
- "tsc": "tsc --noEmit",
89
- "publish:ci": "bun publish --access public --no-git-checks",
90
- "release": "bumpp"
91
- },
92
- "lint-staged": {
93
- "*": "bun run format:fix && git add .",
94
- "src/**/*.(m|c)?(j|t)s": "bun run tsc"
95
- },
96
- "workspaces": ["docs", "tests"]
97
- }
2
+ "name": "bunup",
3
+ "description": "⚡ A blazing-fast build tool for your libraries built with Bun.",
4
+ "version": "0.8.31",
5
+ "type": "module",
6
+ "files": [
7
+ "dist",
8
+ "bin"
9
+ ],
10
+ "types": "./dist/index.d.ts",
11
+ "module": "./dist/index.js",
12
+ "exports": {
13
+ ".": {
14
+ "types": "./dist/index.d.ts",
15
+ "import": "./dist/index.js"
16
+ },
17
+ "./plugins": {
18
+ "types": "./dist/plugins.d.ts",
19
+ "import": "./dist/plugins.js"
20
+ },
21
+ "./cli": {
22
+ "import": "./dist/cli/index.js"
23
+ }
24
+ },
25
+ "main": "./dist/index.cjs",
26
+ "license": "MIT",
27
+ "author": "Arshad Yaseen <m@arshadyaseen.com> (https://arshadyaseen.com)",
28
+ "maintainers": [
29
+ {
30
+ "name": "Arshad Yaseen",
31
+ "email": "m@arshadyaseen.com",
32
+ "url": "https://arshadyaseen.com"
33
+ }
34
+ ],
35
+ "repository": {
36
+ "type": "git",
37
+ "url": "git+https://github.com/arshad-yaseen/bunup.git"
38
+ },
39
+ "funding": "https://github.com/sponsors/arshad-yaseen",
40
+ "homepage": "https://bunup.dev",
41
+ "keywords": [
42
+ "bun",
43
+ "bunup",
44
+ "bun-bundler"
45
+ ],
46
+ "bin": {
47
+ "bunup": "bin/bunup.mjs"
48
+ },
49
+ "dependencies": {
50
+ "@clack/prompts": "^0.10.1",
51
+ "bun-dts": "^0.1.54",
52
+ "chokidar": "^4.0.3",
53
+ "coffi": "^0.1.31",
54
+ "giget": "^2.0.0",
55
+ "replace-in-file": "^8.3.0",
56
+ "tinyexec": "^1.0.1"
57
+ },
58
+ "devDependencies": {
59
+ "@biomejs/biome": "^1.9.4",
60
+ "@types/bun": "^1.2.5",
61
+ "bumpp": "^10.1.0",
62
+ "husky": "^9.1.7",
63
+ "lightningcss": "^1.30.1",
64
+ "lint-staged": "^15.5.1",
65
+ "typescript": "^5.8.3"
66
+ },
67
+ "peerDependencies": {
68
+ "typescript": ">=4.5.0",
69
+ "lightningcss": ">=1.17.0"
70
+ },
71
+ "peerDependenciesMeta": {
72
+ "typescript": {
73
+ "optional": true
74
+ },
75
+ "lightningcss": {
76
+ "optional": true
77
+ }
78
+ },
79
+ "scripts": {
80
+ "build": "bunx bunup@latest",
81
+ "build:docs": "bun run --cwd docs build",
82
+ "dev": "bunx bunup@latest --watch",
83
+ "dev:docs": "bun run --cwd docs dev",
84
+ "format": "biome format .",
85
+ "format:fix": "biome format --write .",
86
+ "lint": "biome check .",
87
+ "lint:fix": "biome check --write .",
88
+ "prepare": "husky",
89
+ "test": "bun test",
90
+ "test-build": "bun run --cwd tests build",
91
+ "tsc": "tsc --noEmit",
92
+ "publish:ci": "bun publish --access public --no-git-checks",
93
+ "release": "bumpp"
94
+ },
95
+ "lint-staged": {
96
+ "*": "bun run format:fix && git add .",
97
+ "src/**/*.(m|c)?(j|t)s": "bun run tsc"
98
+ },
99
+ "workspaces": [
100
+ "docs",
101
+ "tests"
102
+ ]
103
+ }