bunup 0.8.53 → 0.8.55

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.
@@ -192,8 +192,8 @@ function getResolvedDefine(define, env) {
192
192
  function getResolvedSplitting(splitting, format) {
193
193
  return splitting === undefined ? format === "esm" : splitting;
194
194
  }
195
- function getResolvedDtsSplitting(splitting) {
196
- return splitting ?? true;
195
+ function getResolvedDtsSplitting(buildSplitting, dtsSplitting) {
196
+ return dtsSplitting ?? buildSplitting ?? true;
197
197
  }
198
198
  var DEFAULT_ENTRY_NAMING = "[dir]/[name].[ext]";
199
199
  function getResolvedNaming(fmt, packageType) {
@@ -331,7 +331,7 @@ async function build(partialOptions, rootDir = process.cwd()) {
331
331
  const dtsResult = await generateDts(ensureArray(entry ?? entrypoints), {
332
332
  cwd: rootDir,
333
333
  preferredTsConfigPath: options.preferredTsconfigPath,
334
- splitting: getResolvedDtsSplitting(splitting),
334
+ splitting: getResolvedDtsSplitting(options.splitting, splitting),
335
335
  ...dtsOptions
336
336
  });
337
337
  if (dtsResult.errors.length) {
@@ -2,29 +2,29 @@ import { GenerateDtsOptions } from "typeroll";
2
2
  import { BunPlugin } from "bun";
3
3
  type PackageJson = {
4
4
  /** The parsed content of the package.json file */
5
- data: Record<string, any> | null;
5
+ data: Record<string, any> | null
6
6
  /** The path to the package.json file */
7
- path: string | null;
7
+ path: string | null
8
8
  };
9
9
  /**
10
10
  * Represents a Bun plugin that can be used with Bunup
11
11
  */
12
12
  type BunupBunPlugin = {
13
13
  /** Identifies this as a native Bun plugin */
14
- type: "bun";
14
+ type: "bun"
15
15
  /** Optional name for the plugin */
16
- name?: string;
16
+ name?: string
17
17
  /** The actual Bun plugin implementation */
18
- plugin: BunPlugin;
18
+ plugin: BunPlugin
19
19
  };
20
20
  /**
21
21
  * Represents the meta data of the build
22
22
  */
23
23
  type BuildMeta = {
24
24
  /** The package.json file */
25
- packageJson: PackageJson;
25
+ packageJson: PackageJson
26
26
  /** The root directory of the build */
27
- rootDir: string;
27
+ rootDir: string
28
28
  };
29
29
  type BuildOutputFile = {
30
30
  /**
@@ -32,37 +32,37 @@ type BuildOutputFile = {
32
32
  *
33
33
  * Undefined for non-entry point files (e.g., assets, sourcemaps, chunks)
34
34
  */
35
- entrypoint: string | undefined;
35
+ entrypoint: string | undefined
36
36
  /** The kind of the file */
37
- kind: "entry-point" | "chunk" | "asset" | "sourcemap" | "bytecode";
37
+ kind: "entry-point" | "chunk" | "asset" | "sourcemap" | "bytecode"
38
38
  /** Path to the generated file */
39
- fullPath: string;
39
+ fullPath: string
40
40
  /** Path to the generated file relative to the root directory */
41
- relativePathToRootDir: string;
41
+ relativePathToRootDir: string
42
42
  /** Path to the generated file relative to the output directory */
43
- relativePathToOutputDir: string;
43
+ relativePathToOutputDir: string
44
44
  /** Whether the file is a dts file */
45
- dts: boolean;
45
+ dts: boolean
46
46
  /** The format of the output file */
47
- format: Format;
47
+ format: Format
48
48
  };
49
49
  /**
50
50
  * Represents the output of a build operation
51
51
  */
52
52
  type BuildOutput = {
53
53
  /** Array of generated files with their paths and contents */
54
- files: BuildOutputFile[];
54
+ files: BuildOutputFile[]
55
55
  };
56
56
  /**
57
57
  * Context provided to build hooks
58
58
  */
59
59
  type BuildContext = {
60
60
  /** The build options that were used */
61
- options: BuildOptions;
61
+ options: BuildOptions
62
62
  /** The output of the build */
63
- output: BuildOutput;
63
+ output: BuildOutput
64
64
  /** The meta data of the build */
65
- meta: BuildMeta;
65
+ meta: BuildMeta
66
66
  };
67
67
  /**
68
68
  * Hooks that can be implemented by Bunup plugins
@@ -72,23 +72,23 @@ type BunupPluginHooks = {
72
72
  * Called when a build is successfully completed
73
73
  * @param ctx Build context containing options and output
74
74
  */
75
- onBuildDone?: (ctx: BuildContext) => MaybePromise<void>;
75
+ onBuildDone?: (ctx: BuildContext) => MaybePromise<void>
76
76
  /**
77
77
  * Called before a build starts
78
78
  * @param options Build options that will be used
79
79
  */
80
- onBuildStart?: (options: BuildOptions) => MaybePromise<void>;
80
+ onBuildStart?: (options: BuildOptions) => MaybePromise<void>
81
81
  };
82
82
  /**
83
83
  * Represents a Bunup-specific plugin
84
84
  */
85
85
  type BunupPlugin = {
86
86
  /** Identifies this as a Bunup-specific plugin */
87
- type: "bunup";
87
+ type: "bunup"
88
88
  /** Optional name for the plugin */
89
- name?: string;
89
+ name?: string
90
90
  /** The hooks implemented by this plugin */
91
- hooks: BunupPluginHooks;
91
+ hooks: BunupPluginHooks
92
92
  };
93
93
  /**
94
94
  * Union type representing all supported plugin types
@@ -163,7 +163,7 @@ interface BuildOptions {
163
163
  * Can also be configured with DtsOptions for more control
164
164
  */
165
165
  dts?: boolean | (Pick<GenerateDtsOptions, "resolve" | "splitting" | "minify"> & {
166
- entry?: string | string[];
166
+ entry?: string | string[]
167
167
  });
168
168
  /**
169
169
  * Path to a preferred tsconfig.json file to use for declaration generation
@@ -221,6 +221,7 @@ interface BuildOptions {
221
221
  * sourcemap: true // equivalent to 'inline'
222
222
  */
223
223
  sourcemap?: Sourcemap;
224
+ /**\\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*/
224
225
  define?: Define;
225
226
  /**
226
227
  * A callback function that runs after the build process completes
@@ -232,6 +233,7 @@ interface BuildOptions {
232
233
  * @param options The build options that were used
233
234
  */
234
235
  onSuccess?: (options: Partial<BuildOptions>) => MaybePromise<void>;
236
+ /**\\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*/
235
237
  banner?: string;
236
238
  /**
237
239
  * 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.
@@ -333,6 +335,7 @@ interface BuildOptions {
333
335
  * Force emitting @__PURE__ annotations even if minify.whitespace is true.
334
336
  */
335
337
  emitDCEAnnotations?: boolean;
338
+ /**\\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*/
336
339
  plugins?: Plugin[];
337
340
  }
338
341
  type MaybePromise<T> = Promise<T> | T;
@@ -343,8 +346,8 @@ type WithOptional<
343
346
  type Arrayable<T> = T | T[];
344
347
  type DefineConfigItem = Omit<WithOptional<BuildOptions, "outDir" | "format">, "watch">;
345
348
  type DefineWorkspaceItem = {
346
- name: string;
347
- root: string;
348
- config: DefineConfigItem | DefineConfigItem[];
349
+ name: string
350
+ root: string
351
+ config: DefineConfigItem | DefineConfigItem[]
349
352
  };
350
353
  export { MaybePromise, Arrayable, DefineConfigItem, DefineWorkspaceItem, BuildContext, BunupPlugin, Plugin, BuildOptions };
package/dist/cli/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
  import {
4
4
  build,
5
5
  createBuildOptions
6
- } from "../chunk-g2khvv3w.js";
6
+ } from "../chunk-9mn5tdt7.js";
7
7
  import"../chunk-zpjpa5th.js";
8
8
  import {
9
9
  processLoadedConfigs
@@ -28,7 +28,7 @@ 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.53";
31
+ var version = "0.8.55";
32
32
 
33
33
  // src/watch.ts
34
34
  import path from "path";
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Arrayable, BuildOptions, DefineConfigItem, DefineWorkspaceItem, Plugin } from "./chunk-80rcmwcp";
1
+ import { Arrayable, BuildOptions, DefineConfigItem, DefineWorkspaceItem, Plugin } from "./chunk-w6swmckt";
2
2
  declare function build(partialOptions: Partial<BuildOptions>, rootDir?: string): Promise<void>;
3
3
  declare function defineConfig(options: Arrayable<DefineConfigItem>): Arrayable<DefineConfigItem>;
4
4
  declare function defineWorkspace(options: DefineWorkspaceItem[]): DefineWorkspaceItem[];
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  build
4
- } from "./chunk-g2khvv3w.js";
4
+ } from "./chunk-9mn5tdt7.js";
5
5
  import"./chunk-zpjpa5th.js";
6
6
  import"./chunk-gh7z7s46.js";
7
7
  import"./chunk-cakmscpb.js";
package/dist/plugins.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { BuildContext, BunupPlugin, MaybePromise, Plugin } from "./chunk-80rcmwcp";
1
+ import { BuildContext, BunupPlugin, MaybePromise, Plugin } from "./chunk-w6swmckt";
2
2
  /**
3
3
  * A plugin that copies files and directories to the output directory.
4
4
  *
@@ -30,7 +30,7 @@ interface ExportsPluginOptions {
30
30
  */
31
31
  declare function exports(options?: ExportsPluginOptions): BunupPlugin;
32
32
  type InjectStylesPluginOptions = Pick<import("lightningcss").TransformOptions<import("lightningcss").CustomAtRules>, "sourceMap" | "inputSourceMap" | "targets" | "nonStandard" | "minify" | "pseudoClasses" | "unusedSymbols" | "errorRecovery" | "visitor" | "customAtRules" | "include" | "exclude" | "drafts"> & {
33
- inject?: (css: string, filePath: string) => MaybePromise<string>;
33
+ inject?: (css: string, filePath: string) => MaybePromise<string>
34
34
  };
35
35
  /**
36
36
  * A plugin that injects styles into the document head.
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.8.53",
4
+ "version": "0.8.55",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist"
@@ -53,7 +53,7 @@
53
53
  "picocolors": "^1.1.1",
54
54
  "replace-in-file": "^8.3.0",
55
55
  "tinyexec": "^1.0.1",
56
- "typeroll": "^0.6.9"
56
+ "typeroll": "^0.6.14"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@babel/types": "^7.27.7",