bunup 0.14.8 → 0.14.10
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 +63 -21
- package/dist/cli/index.js +37 -21
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/plugins.d.ts +37 -108
- package/dist/plugins.js +55 -409
- package/dist/shared/bunup-er5nnjqp.js +869 -0
- package/dist/shared/{bunup-yt7y3w4v.js → bunup-nsnkrmw3.js} +102 -77
- package/dist/shared/{bunup-s6gfzz2v.d.ts → bunup-zenttvjh.d.ts} +148 -13
- package/package.json +3 -3
- package/dist/shared/bunup-r5agr54b.js +0 -466
package/README.md
CHANGED
|
@@ -5,42 +5,84 @@
|
|
|
5
5
|
<div align="center">
|
|
6
6
|
|
|
7
7
|
<!-- markdownlint-disable-next-line no-alt-text -->
|
|
8
|
+

|
|
8
9
|
|
|
10
|
+

|
|
9
11
|
|
|
10
|
-
](https://npmjs.com/package/bunup)
|
|
13
|
+
[](https://bun.sh)
|
|
14
|
+
[](https://github.com/sponsors/arshad-yaseen)
|
|
11
15
|
|
|
12
|
-
|
|
16
|
+
Bunup helps you ship TypeScript/React libraries faster with great DX — built on Bun.
|
|
17
|
+
</div>
|
|
18
|
+
<!-- markdownlint-restore -->
|
|
13
19
|
|
|
14
|
-
|
|
20
|
+
## Performance
|
|
15
21
|
|
|
16
|
-
|
|
22
|
+
Instant builds by design. With Bun’s native speed, builds and rebuilds are extremely quick, even in monorepos. Faster feedback loops, higher productivity, calmer flow.
|
|
17
23
|
|
|
18
|
-
|
|
19
|
-
<!-- markdownlint-restore -->
|
|
24
|
+
## 🚀 Quick Start
|
|
20
25
|
|
|
21
|
-
|
|
26
|
+
Create a TypeScript file:
|
|
22
27
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
- 🏗️ **[Workspace](https://bunup.dev/docs/guide/workspaces) Ready**: Builds multiple packages from one config and command.
|
|
28
|
+
```ts
|
|
29
|
+
// src/index.ts
|
|
30
|
+
export function greet(name: string): string {
|
|
31
|
+
return `Hello, ${name}!`;
|
|
32
|
+
}
|
|
33
|
+
```
|
|
30
34
|
|
|
31
|
-
|
|
35
|
+
Build it instantly:
|
|
32
36
|
|
|
33
|
-
|
|
37
|
+
```bash
|
|
38
|
+
bunx bunup
|
|
39
|
+
```
|
|
34
40
|
|
|
35
|
-
|
|
41
|
+
Outputs to `dist/` with ESM and `.d.ts` types.
|
|
42
|
+
|
|
43
|
+
Need CommonJS too?
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
bunx bunup --format esm,cjs
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Want to generate and sync package exports automatically?
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
bunx bunup --exports
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Scaffold
|
|
36
56
|
|
|
37
|
-
|
|
57
|
+
Spin up a modern, ready-to-publish TypeScript or React component library (or a basic starter) in ~10 seconds:
|
|
38
58
|
|
|
39
|
-
|
|
59
|
+
```bash
|
|
60
|
+
bunx @bunup/cli@latest create
|
|
61
|
+
```
|
|
40
62
|
|
|
41
|
-
|
|
63
|
+
See more in [Scaffold with Bunup](./docs/scaffold-with-bunup.md).
|
|
64
|
+
|
|
65
|
+
## Features
|
|
66
|
+
|
|
67
|
+
- ⚡ **Instant builds** — lightning-fast by default
|
|
68
|
+
- 🎨 **CSS support out of the box** — import CSS directly, with built-in CSS Modules support.
|
|
69
|
+
- 📝 **TypeScript declarations** — clean, accurate `.d.ts` files
|
|
70
|
+
- 🪓 **[Declaration splitting](https://bunup.dev/docs/guide/typescript-declarations#declaration-splitting)** — smaller, cleaner type bundles
|
|
71
|
+
- 🔋 **Batteries included** — auto-exports, unused dependency detection, and more
|
|
72
|
+
- 🏗️ **[Workspace-ready](https://bunup.dev/docs/guide/workspaces)** — build multiple packages from one config and one command
|
|
73
|
+
|
|
74
|
+
For more, see the full documentation: https://bunup.dev
|
|
75
|
+
|
|
76
|
+
## ❤️ Contributing
|
|
77
|
+
|
|
78
|
+
We welcome contributions! Please read the [contributing guide](CONTRIBUTING.md).
|
|
42
79
|
|
|
43
80
|
<div align="center">
|
|
44
81
|
|
|
45
|
-
|
|
82
|
+
<img src="https://cdn.jsdelivr.net/gh/arshad-yaseen/static/sponsors.svg" alt="Sponsors" />
|
|
83
|
+
|
|
84
|
+
<br /><br />
|
|
85
|
+
|
|
86
|
+
<img src="assets/cat-footer.svg" alt="______ 🐈⬛ _____________" />
|
|
87
|
+
|
|
46
88
|
</div>
|
package/dist/cli/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
printBuildReport,
|
|
6
6
|
processLoadedConfigs,
|
|
7
7
|
resolveBuildOptions
|
|
8
|
-
} from "../shared/bunup-
|
|
8
|
+
} from "../shared/bunup-nsnkrmw3.js";
|
|
9
9
|
import {
|
|
10
10
|
BunupCLIError,
|
|
11
11
|
BunupWatchError,
|
|
@@ -18,13 +18,13 @@ import {
|
|
|
18
18
|
logTime,
|
|
19
19
|
logger,
|
|
20
20
|
parseErrorMessage
|
|
21
|
-
} from "../shared/bunup-
|
|
21
|
+
} from "../shared/bunup-er5nnjqp.js";
|
|
22
22
|
|
|
23
23
|
// packages/bunup/src/cli/index.ts
|
|
24
24
|
import { loadConfig } from "coffi";
|
|
25
25
|
import pc3 from "picocolors";
|
|
26
26
|
// packages/bunup/package.json
|
|
27
|
-
var version = "0.14.
|
|
27
|
+
var version = "0.14.10";
|
|
28
28
|
|
|
29
29
|
// packages/bunup/src/watch.ts
|
|
30
30
|
import path from "path";
|
|
@@ -94,18 +94,19 @@ async function watch(userOptions, rootDir) {
|
|
|
94
94
|
// packages/bunup/src/cli/options.ts
|
|
95
95
|
import pc2 from "picocolors";
|
|
96
96
|
import { cli, z } from "zlye";
|
|
97
|
-
var program = cli().name("bunup").version(version).description("A blazing-fast build tool for your TypeScript/React libraries
|
|
97
|
+
var program = cli().name("bunup").version(version).description("A blazing-fast build tool for your TypeScript/React libraries - built on Bun").with({
|
|
98
98
|
ignoreOptionDefaultValue: true
|
|
99
99
|
}).example([
|
|
100
|
-
pc2.gray(`${pc2.blue("bunup
|
|
100
|
+
pc2.gray(`${pc2.blue("bunup")} # Basic build`),
|
|
101
|
+
pc2.gray(`${pc2.blue("bunup src/index.ts")} # Single entry file`),
|
|
101
102
|
pc2.gray(`${pc2.blue("bunup src/**/*.ts")} # Glob pattern for multiple files`),
|
|
102
|
-
pc2.gray(`${pc2.blue("bunup
|
|
103
|
-
pc2.gray(`${pc2.blue("bunup
|
|
104
|
-
pc2.gray(`${pc2.blue("bunup
|
|
105
|
-
pc2.gray(`${pc2.blue("bunup src/
|
|
106
|
-
pc2.gray(`${pc2.blue("bunup
|
|
107
|
-
pc2.gray(`${pc2.blue("bunup
|
|
108
|
-
]).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.string().describe("Path to configuration file").alias("c").example("./configs/custom.bunup.config.js").optional()).option("filter", z.array(z.string()).describe("Filter workspace packages 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({
|
|
103
|
+
pc2.gray(`${pc2.blue("bunup --watch")} # Watch mode`),
|
|
104
|
+
pc2.gray(`${pc2.blue("bunup --format cjs,esm")} # Multiple formats`),
|
|
105
|
+
pc2.gray(`${pc2.blue("bunup --target bun")} # Bun target`),
|
|
106
|
+
pc2.gray(`${pc2.blue("bunup src/cli.ts")} # Multiple entries`),
|
|
107
|
+
pc2.gray(`${pc2.blue("bunup --dts.splitting")} # Declaration splitting`),
|
|
108
|
+
pc2.gray(`${pc2.blue("bunup --no-clean")} # Disable cleaning output directory before build`)
|
|
109
|
+
]).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 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({
|
|
109
110
|
gzip: z.boolean().describe("Enable gzip compression size calculation").default(true),
|
|
110
111
|
brotli: z.boolean().describe("Enable brotli compression size calculation").optional(),
|
|
111
112
|
"max-bundle-size": z.number().describe("Maximum bundle size in bytes. Will warn if exceeded").optional()
|
|
@@ -127,8 +128,19 @@ var program = cli().name("bunup").version(version).description("A blazing-fast b
|
|
|
127
128
|
"text",
|
|
128
129
|
"css",
|
|
129
130
|
"html"
|
|
130
|
-
])).describe("File extension to loader mapping").example("--loader.'.css'=text --loader.'.txt'=file").optional()).option("public-path", z.string().describe("Public path prefix for assets and chunk files").example("https://cdn.example.com/").optional()).option("ignore-dce-annotations", z.boolean().describe("Ignore dead code elimination annotations (@__PURE__, sideEffects)")).option("emit-dce-annotations", z.boolean().describe("Force emit @__PURE__ annotations even with minification")).option("on-success", z.string().describe("Command to run after successful build").optional()).option("
|
|
131
|
-
|
|
131
|
+
])).describe("File extension to loader mapping").example("--loader.'.css'=text --loader.'.txt'=file").optional()).option("public-path", z.string().describe("Public path prefix for assets and chunk files").example("https://cdn.example.com/").optional()).option("ignore-dce-annotations", z.boolean().describe("Ignore dead code elimination annotations (@__PURE__, sideEffects)")).option("emit-dce-annotations", z.boolean().describe("Force emit @__PURE__ annotations even with minification")).option("on-success", z.string().describe("Command to run after successful build").optional()).option("exports", z.union(z.boolean(), z.object({
|
|
132
|
+
exclude: z.array(z.string()).describe("Entry points to exclude from exports field").optional(),
|
|
133
|
+
"exclude-css": z.boolean().describe("Whether to exclude CSS files from exports field").optional(),
|
|
134
|
+
"include-package-json": z.boolean().describe('Whether to include "./package.json" in exports field').default(true),
|
|
135
|
+
all: z.boolean().describe("Whether to add wildcard export for deep imports").optional()
|
|
136
|
+
})).describe("Configure automatic package.json exports generation").optional()).option("unused", z.union(z.boolean(), z.object({
|
|
137
|
+
level: z.string().choices(["warn", "error"]).describe("The level of reporting for unused dependencies").default("warn"),
|
|
138
|
+
ignore: z.array(z.string()).describe("Dependencies to ignore when checking for unused dependencies").optional()
|
|
139
|
+
})).describe("Detect and report unused dependencies").optional()).option("css", z.object({
|
|
140
|
+
"typed-modules": z.boolean().describe("Generate TypeScript definitions for CSS modules").default(true),
|
|
141
|
+
inject: z.union(z.boolean(), z.object({
|
|
142
|
+
minify: z.boolean().describe("Whether to minify the styles being injected").optional()
|
|
143
|
+
})).describe("Inject CSS styles into document head at runtime").optional()
|
|
132
144
|
}).optional()).rest("entries", z.string().describe("Entry point files to bundle"));
|
|
133
145
|
var parseCliOptions = (argv) => {
|
|
134
146
|
const result = program.parse(argv);
|
|
@@ -147,13 +159,17 @@ var parseCliOptions = (argv) => {
|
|
|
147
159
|
async function main(args = Bun.argv.slice(2)) {
|
|
148
160
|
const cliOptions = parseCliOptions(args);
|
|
149
161
|
const cwd = process.cwd();
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
162
|
+
let loadedConfig;
|
|
163
|
+
if (cliOptions.config !== false) {
|
|
164
|
+
loadedConfig = await loadConfig({
|
|
165
|
+
name: "bunup.config",
|
|
166
|
+
extensions: [".ts", ".js", ".mjs", ".cjs"],
|
|
167
|
+
maxDepth: 1,
|
|
168
|
+
preferredPath: typeof cliOptions.config === "string" ? cliOptions.config : undefined,
|
|
169
|
+
packageJsonProperty: "bunup"
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
const { config, filepath } = loadedConfig ?? {};
|
|
157
173
|
const configsToProcess = !config ? [{ rootDir: cwd, options: cliOptions }] : await processLoadedConfigs(config, cwd, cliOptions.filter);
|
|
158
174
|
const shouldSilent = cliOptions.watch || cliOptions.silent || configsToProcess.some((c) => ensureArray(c.options).some((o) => o.silent));
|
|
159
175
|
if (shouldSilent) {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Arrayable, BuildContext, BuildMeta, BuildOptions, BuildOutput, BuildOutputFile, BunupPlugin, DefineConfigItem, DefineWorkspaceItem, WithOptional } from "./shared/bunup-
|
|
1
|
+
import { Arrayable, BuildContext, BuildMeta, BuildOptions, BuildOutput, BuildOutputFile, BunupPlugin, DefineConfigItem, DefineWorkspaceItem, WithOptional } from "./shared/bunup-zenttvjh";
|
|
2
2
|
declare function build(userOptions: Partial<BuildOptions>, rootDir?: string): Promise<BuildOutput>;
|
|
3
3
|
declare function defineConfig(options: Arrayable<DefineConfigItem>): Arrayable<DefineConfigItem>;
|
|
4
4
|
declare function defineWorkspace(options: WithOptional<DefineWorkspaceItem, "config">[], sharedOptions?: Partial<DefineConfigItem>): DefineWorkspaceItem[];
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
build
|
|
4
|
-
} from "./shared/bunup-
|
|
5
|
-
import"./shared/bunup-
|
|
4
|
+
} from "./shared/bunup-nsnkrmw3.js";
|
|
5
|
+
import"./shared/bunup-er5nnjqp.js";
|
|
6
6
|
// packages/bunup/src/define.ts
|
|
7
7
|
function defineConfig(options) {
|
|
8
8
|
return options;
|
package/dist/plugins.d.ts
CHANGED
|
@@ -1,13 +1,40 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BuildOptions, BunupPlugin, BunupPluginHooks, exports, injectStyles, unused } from "./shared/bunup-zenttvjh";
|
|
2
2
|
type CopyOptions = {
|
|
3
3
|
/** Whether to follow symbolic links when copying files. */
|
|
4
4
|
followSymlinks?: boolean
|
|
5
5
|
/** Whether to exclude dotfiles (files starting with a dot) from being copied. */
|
|
6
6
|
excludeDotfiles?: boolean
|
|
7
|
+
/** Whether to override existing files. Default: true */
|
|
8
|
+
override?: boolean
|
|
9
|
+
/**
|
|
10
|
+
* Behavior in watch mode:
|
|
11
|
+
* - 'changed': Only copy files that have changed (default)
|
|
12
|
+
* - 'always': Always copy all files on each build
|
|
13
|
+
* - 'skip': Skip copying in watch mode
|
|
14
|
+
*/
|
|
15
|
+
watchMode?: "changed" | "always" | "skip"
|
|
16
|
+
};
|
|
17
|
+
type TransformContext = {
|
|
18
|
+
/** The file content */
|
|
19
|
+
content: string | ArrayBuffer
|
|
20
|
+
/** The source file path */
|
|
21
|
+
path: string
|
|
22
|
+
/** The destination file path */
|
|
23
|
+
destination: string
|
|
24
|
+
/** Build options */
|
|
25
|
+
options: BuildOptions
|
|
7
26
|
};
|
|
27
|
+
type TransformResult = string | ArrayBuffer | {
|
|
28
|
+
content: string | ArrayBuffer
|
|
29
|
+
filename: string
|
|
30
|
+
};
|
|
31
|
+
type TransformFunction = (context: TransformContext) => TransformResult | Promise<TransformResult>;
|
|
8
32
|
/**
|
|
9
33
|
* A plugin that copies files and directories to the output directory.
|
|
10
34
|
*
|
|
35
|
+
* @warning When copying large files or directories, this may impact build performance.
|
|
36
|
+
* Consider using symlinks for very large files when appropriate.
|
|
37
|
+
*
|
|
11
38
|
* @see https://bunup.dev/docs/builtin-plugins/copy
|
|
12
39
|
*/
|
|
13
40
|
declare function copy(pattern: string | string[]): BunupPlugin & CopyBuilder;
|
|
@@ -15,6 +42,8 @@ declare class CopyBuilder {
|
|
|
15
42
|
private _patterns;
|
|
16
43
|
private _destination?;
|
|
17
44
|
private _options?;
|
|
45
|
+
private _transform?;
|
|
46
|
+
private _fileCache;
|
|
18
47
|
constructor(pattern: string | string[]);
|
|
19
48
|
/**
|
|
20
49
|
* Sets the destination directory or file path where files will be copied.
|
|
@@ -25,118 +54,18 @@ declare class CopyBuilder {
|
|
|
25
54
|
* Sets additional options for the copy operation.
|
|
26
55
|
*/
|
|
27
56
|
with(options: CopyOptions): this;
|
|
28
|
-
get name(): string;
|
|
29
|
-
get hooks(): BunupPluginHooks;
|
|
30
|
-
}
|
|
31
|
-
type CustomExports = Record<string, string | Record<string, string | Record<string, string>>>;
|
|
32
|
-
type Exclude = ((ctx: BuildContext) => string[] | undefined) | string[];
|
|
33
|
-
interface ExportsPluginOptions {
|
|
34
|
-
/**
|
|
35
|
-
* Additional export fields to preserve alongside automatically generated exports
|
|
36
|
-
*
|
|
37
|
-
* @see https://bunup.dev/docs/builtin-plugins/exports#customexports
|
|
38
|
-
*/
|
|
39
|
-
customExports?: (ctx: BuildContext) => CustomExports | undefined;
|
|
40
57
|
/**
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* @see https://bunup.dev/docs/builtin-plugins/exports#exclude
|
|
58
|
+
* Transforms file contents during copy operation.
|
|
59
|
+
* Useful for modifying files on the fly (e.g., replacing tokens, minifying, etc.)
|
|
44
60
|
*/
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
* @default false
|
|
50
|
-
*/
|
|
51
|
-
excludeCss?: boolean;
|
|
52
|
-
/**
|
|
53
|
-
* Whether to include "./package.json": "./package.json" in the exports field
|
|
54
|
-
*
|
|
55
|
-
* @default true
|
|
56
|
-
* @see https://bunup.dev/docs/builtin-plugins/exports#includepackagejson
|
|
57
|
-
*/
|
|
58
|
-
includePackageJson?: boolean;
|
|
59
|
-
/**
|
|
60
|
-
* Whether to add a wildcard export that allows deep imports
|
|
61
|
-
*
|
|
62
|
-
* When true, adds "./*": "./*" to exports, making all files accessible
|
|
63
|
-
* When false (default), only explicit exports are accessible
|
|
64
|
-
*
|
|
65
|
-
* @default false
|
|
66
|
-
* @see https://bunup.dev/docs/builtin-plugins/exports#all
|
|
67
|
-
*/
|
|
68
|
-
all?: boolean;
|
|
61
|
+
transform(fn: TransformFunction): this;
|
|
62
|
+
get name(): string;
|
|
63
|
+
get hooks(): BunupPluginHooks;
|
|
64
|
+
private copyFileWithTransform;
|
|
69
65
|
}
|
|
70
|
-
/**
|
|
71
|
-
* A plugin that generates the exports field in the package.json file automatically.
|
|
72
|
-
*
|
|
73
|
-
* @see https://bunup.dev/docs/builtin-plugins/exports
|
|
74
|
-
*/
|
|
75
|
-
declare function exports(options?: ExportsPluginOptions): BunupPlugin;
|
|
76
66
|
import { BunPlugin } from "bun";
|
|
77
|
-
type InjectStylesPluginOptions = {
|
|
78
|
-
/**
|
|
79
|
-
* Custom function to inject CSS into the document head.
|
|
80
|
-
*
|
|
81
|
-
* By default, bunup uses its own `injectStyle` function that creates a `<style>`
|
|
82
|
-
* tag and appends it to the document head. You can provide your own injection
|
|
83
|
-
* logic to customize how styles are applied to the document.
|
|
84
|
-
*
|
|
85
|
-
* @param css - The processed CSS string (already JSON stringified)
|
|
86
|
-
* @param filePath - The original file path of the CSS file being processed
|
|
87
|
-
* @returns JavaScript code that will inject the styles when executed
|
|
88
|
-
*
|
|
89
|
-
* @example
|
|
90
|
-
* ```ts
|
|
91
|
-
* injectStyles({
|
|
92
|
-
* inject: (css, filePath) => {
|
|
93
|
-
* return `
|
|
94
|
-
* const style = document.createElement('style');
|
|
95
|
-
* style.setAttribute('data-source', '${filePath}');
|
|
96
|
-
* style.textContent = ${css};
|
|
97
|
-
* document.head.appendChild(style);
|
|
98
|
-
* `;
|
|
99
|
-
* }
|
|
100
|
-
* })
|
|
101
|
-
* ```
|
|
102
|
-
*
|
|
103
|
-
* The default injection handles cases like when `document` is undefined (e.g., server-side rendering) and compatibility with older browsers. Consider these when implementing custom injection logic.
|
|
104
|
-
*/
|
|
105
|
-
inject?: (css: string, filePath: string) => MaybePromise<string>
|
|
106
|
-
/**
|
|
107
|
-
* Whether to minify the styles being injected.
|
|
108
|
-
*
|
|
109
|
-
* @default true
|
|
110
|
-
*/
|
|
111
|
-
minify?: boolean
|
|
112
|
-
};
|
|
113
|
-
/**
|
|
114
|
-
* A plugin that injects styles into the document head at runtime instead of bundling them to the build output.
|
|
115
|
-
*
|
|
116
|
-
* @see https://bunup.dev/docs/builtin-plugins/inject-styles
|
|
117
|
-
*/
|
|
118
|
-
declare function injectStyles(options?: InjectStylesPluginOptions): BunPlugin;
|
|
119
|
-
import { BunPlugin as BunPlugin2 } from "bun";
|
|
120
67
|
/**
|
|
121
68
|
* A plugin that provides shims for Node.js globals and ESM/CJS interoperability.
|
|
122
69
|
*/
|
|
123
|
-
declare function shims():
|
|
124
|
-
interface UnusedOptions {
|
|
125
|
-
/**
|
|
126
|
-
* The level of reporting for unused dependencies
|
|
127
|
-
* @default 'warn'
|
|
128
|
-
*/
|
|
129
|
-
level?: "warn" | "error";
|
|
130
|
-
/**
|
|
131
|
-
* Dependencies to ignore when checking for unused dependencies
|
|
132
|
-
* @default []
|
|
133
|
-
*/
|
|
134
|
-
ignore?: string[];
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* A plugin that detects and reports unused dependencies.
|
|
138
|
-
*
|
|
139
|
-
* @see https://bunup.dev/docs/builtin-plugins/unused
|
|
140
|
-
*/
|
|
141
|
-
declare function unused(options?: UnusedOptions): BunupPlugin;
|
|
70
|
+
declare function shims(): BunPlugin;
|
|
142
71
|
export { unused, shims, injectStyles, exports, copy };
|