bun-types 1.3.3-canary.20251114T140703 → 1.3.3-canary.20251116T140533
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/bun.d.ts +1 -1
- package/docs/bundler/executables.mdx +37 -3
- package/docs/bundler/index.mdx +1 -1
- package/docs/guides/ecosystem/nextjs.mdx +81 -35
- package/docs/guides/ecosystem/tanstack-start.mdx +726 -88
- package/docs/guides/html-rewriter/extract-links.mdx +5 -6
- package/docs/guides/http/file-uploads.mdx +2 -2
- package/docs/guides/install/add-peer.mdx +2 -2
- package/docs/guides/read-file/watch.mdx +2 -2
- package/docs/guides/runtime/cicd.mdx +6 -6
- package/docs/guides/runtime/define-constant.mdx +4 -4
- package/docs/guides/test/concurrent-test-glob.mdx +143 -0
- package/docs/guides/test/spy-on.mdx +2 -2
- package/docs/guides/websocket/context.mdx +8 -3
- package/docs/guides/websocket/pubsub.mdx +4 -1
- package/docs/guides/websocket/simple.mdx +4 -1
- package/docs/pm/cli/info.mdx +70 -0
- package/docs/pm/cli/install.mdx +123 -4
- package/docs/pm/cli/link.mdx +13 -0
- package/docs/pm/cli/publish.mdx +8 -0
- package/docs/pm/overrides.mdx +6 -6
- package/docs/pm/workspaces.mdx +13 -5
- package/docs/project/contributing.mdx +60 -15
- package/docs/quickstart.mdx +8 -3
- package/docs/runtime/bunfig.mdx +53 -1
- package/docs/runtime/html-rewriter.mdx +13 -20
- package/docs/runtime/http/routing.mdx +1 -1
- package/docs/runtime/http/websockets.mdx +8 -2
- package/docs/runtime/module-resolution.mdx +23 -0
- package/docs/runtime/redis.mdx +1 -0
- package/docs/runtime/utils.mdx +2 -2
- package/docs/test/configuration.mdx +47 -0
- package/docs/test/reporters.mdx +9 -0
- package/package.json +1 -1
package/bun.d.ts
CHANGED
|
@@ -1788,7 +1788,7 @@ declare module "bun" {
|
|
|
1788
1788
|
* @see {@link outdir} required for `"linked"` maps
|
|
1789
1789
|
* @see {@link publicPath} to customize the base url of linked source maps
|
|
1790
1790
|
*/
|
|
1791
|
-
sourcemap?: "none" | "linked" | "inline" | "external" |
|
|
1791
|
+
sourcemap?: "none" | "linked" | "inline" | "external" | boolean;
|
|
1792
1792
|
|
|
1793
1793
|
/**
|
|
1794
1794
|
* package.json `exports` conditions used when resolving imports
|
|
@@ -90,7 +90,7 @@ The order of the `--target` flag does not matter, as long as they're delimited b
|
|
|
90
90
|
| bun-linux-x64 | Linux | x64 | ✅ | ✅ | glibc |
|
|
91
91
|
| bun-linux-arm64 | Linux | arm64 | ✅ | N/A | glibc |
|
|
92
92
|
| bun-windows-x64 | Windows | x64 | ✅ | ✅ | - |
|
|
93
|
-
| ~~bun-windows-arm64~~ | Windows
|
|
93
|
+
| ~~bun-windows-arm64~~ | ~~Windows~~ | ~~arm64~~ | ❌ | ❌ | - |
|
|
94
94
|
| bun-darwin-x64 | macOS | x64 | ✅ | ✅ | - |
|
|
95
95
|
| bun-darwin-arm64 | macOS | arm64 | ✅ | N/A | - |
|
|
96
96
|
| bun-linux-x64-musl | Linux | x64 | ✅ | ✅ | musl |
|
|
@@ -524,12 +524,46 @@ codesign -vvv --verify ./myapp
|
|
|
524
524
|
|
|
525
525
|
---
|
|
526
526
|
|
|
527
|
+
## Code splitting
|
|
528
|
+
|
|
529
|
+
Standalone executables support code splitting. Use `--compile` with `--splitting` to create an executable that loads code-split chunks at runtime.
|
|
530
|
+
|
|
531
|
+
```bash
|
|
532
|
+
bun build --compile --splitting ./src/entry.ts --outdir ./build
|
|
533
|
+
```
|
|
534
|
+
|
|
535
|
+
<CodeGroup>
|
|
536
|
+
|
|
537
|
+
```ts src/entry.ts icon="/icons/typescript.svg"
|
|
538
|
+
console.log("Entrypoint loaded");
|
|
539
|
+
const lazy = await import("./lazy.ts");
|
|
540
|
+
lazy.hello();
|
|
541
|
+
```
|
|
542
|
+
|
|
543
|
+
```ts src/lazy.ts icon="/icons/typescript.svg"
|
|
544
|
+
export function hello() {
|
|
545
|
+
console.log("Lazy module loaded");
|
|
546
|
+
}
|
|
547
|
+
```
|
|
548
|
+
|
|
549
|
+
</CodeGroup>
|
|
550
|
+
|
|
551
|
+
```bash terminal icon="terminal"
|
|
552
|
+
./build/entry
|
|
553
|
+
```
|
|
554
|
+
|
|
555
|
+
```txt
|
|
556
|
+
Entrypoint loaded
|
|
557
|
+
Lazy module loaded
|
|
558
|
+
```
|
|
559
|
+
|
|
560
|
+
---
|
|
561
|
+
|
|
527
562
|
## Unsupported CLI arguments
|
|
528
563
|
|
|
529
564
|
Currently, the `--compile` flag can only accept a single entrypoint at a time and does not support the following flags:
|
|
530
565
|
|
|
531
|
-
- `--outdir` — use `outfile` instead.
|
|
532
|
-
- `--splitting`
|
|
566
|
+
- `--outdir` — use `outfile` instead (except when using with `--splitting`).
|
|
533
567
|
- `--public-path`
|
|
534
568
|
- `--target=node` or `--target=browser`
|
|
535
569
|
- `--no-bundle` - we always bundle everything into the executable.
|
package/docs/bundler/index.mdx
CHANGED
|
@@ -1376,7 +1376,7 @@ interface BuildConfig {
|
|
|
1376
1376
|
publicPath?: string;
|
|
1377
1377
|
define?: Record<string, string>;
|
|
1378
1378
|
loader?: { [k in string]: Loader };
|
|
1379
|
-
sourcemap?: "none" | "linked" | "inline" | "external" |
|
|
1379
|
+
sourcemap?: "none" | "linked" | "inline" | "external" | boolean; // default: "none", true -> "inline"
|
|
1380
1380
|
/**
|
|
1381
1381
|
* package.json `exports` conditions used when resolving imports
|
|
1382
1382
|
*
|
|
@@ -4,54 +4,100 @@ sidebarTitle: Next.js with Bun
|
|
|
4
4
|
mode: center
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
```sh terminal icon="terminal"
|
|
10
|
-
bun create next-app
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
```txt
|
|
14
|
-
✔ What is your project named? … my-app
|
|
15
|
-
✔ Would you like to use TypeScript with this project? … No / Yes
|
|
16
|
-
✔ Would you like to use ESLint with this project? … No / Yes
|
|
17
|
-
✔ Would you like to use Tailwind CSS? ... No / Yes
|
|
18
|
-
✔ Would you like to use `src/` directory with this project? … No / Yes
|
|
19
|
-
✔ Would you like to use App Router? (recommended) ... No / Yes
|
|
20
|
-
✔ What import alias would you like configured? … @/*
|
|
21
|
-
Creating a new Next.js app in /path/to/my-app.
|
|
22
|
-
```
|
|
7
|
+
[Next.js](https://nextjs.org/) is a React framework for building full-stack web applications. It supports server-side rendering, static site generation, API routes, and more. Bun provides fast package installation and can run Next.js development and production servers.
|
|
23
8
|
|
|
24
9
|
---
|
|
25
10
|
|
|
26
|
-
|
|
11
|
+
<Steps>
|
|
12
|
+
<Step title="Create a new Next.js app">
|
|
13
|
+
Use the interactive CLI to create a new Next.js app. This will scaffold a new Next.js project and automatically install dependencies.
|
|
27
14
|
|
|
28
|
-
```sh
|
|
29
|
-
bun create next-app
|
|
30
|
-
```
|
|
15
|
+
```sh terminal icon="terminal"
|
|
16
|
+
bun create next-app@latest my-bun-app
|
|
17
|
+
```
|
|
31
18
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
19
|
+
</Step>
|
|
20
|
+
<Step title="Start the dev server">
|
|
21
|
+
Change to the project directory and run the dev server with Bun.
|
|
22
|
+
|
|
23
|
+
```sh terminal icon="terminal"
|
|
24
|
+
cd my-bun-app
|
|
25
|
+
bun --bun run dev
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
This starts the Next.js dev server with Bun's runtime.
|
|
29
|
+
|
|
30
|
+
Open [`http://localhost:3000`](http://localhost:3000) with your browser to see the result. Any changes you make to `app/page.tsx` will be hot-reloaded in the browser.
|
|
31
|
+
|
|
32
|
+
</Step>
|
|
33
|
+
<Step title="Update scripts in package.json">
|
|
34
|
+
Modify the scripts field in your `package.json` by prefixing the Next.js CLI commands with `bun --bun`. This ensures that Bun executes the Next.js CLI for common tasks like `dev`, `build`, and `start`.
|
|
35
|
+
|
|
36
|
+
```json package.json icon="file-json"
|
|
37
|
+
{
|
|
38
|
+
"scripts": {
|
|
39
|
+
"dev": "bun --bun next dev", // [!code ++]
|
|
40
|
+
"build": "bun --bun next build", // [!code ++]
|
|
41
|
+
"start": "bun --bun next start", // [!code ++]
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
</Step>
|
|
47
|
+
</Steps>
|
|
36
48
|
|
|
37
49
|
---
|
|
38
50
|
|
|
39
|
-
|
|
51
|
+
## Hosting
|
|
52
|
+
|
|
53
|
+
Next.js applications on Bun can be deployed to various platforms.
|
|
40
54
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
55
|
+
<Columns cols={3}>
|
|
56
|
+
<Card title="Vercel" href="/guides/deployment/vercel" icon="/icons/ecosystem/vercel.svg">
|
|
57
|
+
Deploy on Vercel
|
|
58
|
+
</Card>
|
|
59
|
+
<Card title="Railway" href="/guides/deployment/railway" icon="/icons/ecosystem/railway.svg">
|
|
60
|
+
Deploy on Railway
|
|
61
|
+
</Card>
|
|
62
|
+
<Card title="DigitalOcean" href="/guides/deployment/digital-ocean" icon="/icons/ecosystem/digitalocean.svg">
|
|
63
|
+
Deploy on DigitalOcean
|
|
64
|
+
</Card>
|
|
65
|
+
<Card title="AWS Lambda" href="/guides/deployment/aws-lambda" icon="/icons/ecosystem/aws.svg">
|
|
66
|
+
Deploy on AWS Lambda
|
|
67
|
+
</Card>
|
|
68
|
+
<Card title="Google Cloud Run" href="/guides/deployment/google-cloud-run" icon="/icons/ecosystem/gcp.svg">
|
|
69
|
+
Deploy on Google Cloud Run
|
|
70
|
+
</Card>
|
|
71
|
+
<Card title="Render" href="/guides/deployment/render" icon="/icons/ecosystem/render.svg">
|
|
72
|
+
Deploy on Render
|
|
73
|
+
</Card>
|
|
74
|
+
</Columns>
|
|
45
75
|
|
|
46
76
|
---
|
|
47
77
|
|
|
48
|
-
|
|
78
|
+
## Templates
|
|
49
79
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
80
|
+
<Columns cols={2}>
|
|
81
|
+
<Card
|
|
82
|
+
title="Bun + Next.js Basic Starter"
|
|
83
|
+
img="/images/templates/bun-nextjs-basic.png"
|
|
84
|
+
href="https://github.com/bun-templates/bun-nextjs-basic"
|
|
85
|
+
arrow="true"
|
|
86
|
+
cta="Go to template"
|
|
87
|
+
>
|
|
88
|
+
A simple App Router starter with Bun, Next.js, and Tailwind CSS.
|
|
89
|
+
</Card>
|
|
90
|
+
<Card
|
|
91
|
+
title="Todo App with Next.js + Bun"
|
|
92
|
+
img="/images/templates/bun-nextjs-todo.png"
|
|
93
|
+
href="https://github.com/bun-templates/bun-nextjs-todo"
|
|
94
|
+
arrow="true"
|
|
95
|
+
cta="Go to template"
|
|
96
|
+
>
|
|
97
|
+
A full-stack todo application built with Bun, Next.js, and PostgreSQL.
|
|
98
|
+
</Card>
|
|
99
|
+
</Columns>
|
|
54
100
|
|
|
55
101
|
---
|
|
56
102
|
|
|
57
|
-
|
|
103
|
+
[→ See Next.js's official documentation](https://nextjs.org/docs) for more information on building and deploying Next.js applications.
|