bun-types 1.2.3-canary.20250212T140603 → 1.2.3-canary.20250214T140552

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 CHANGED
@@ -1415,6 +1415,18 @@ declare module "bun" {
1415
1415
  */
1416
1416
  endpoint?: string;
1417
1417
 
1418
+ /**
1419
+ * Use virtual hosted style endpoint. default to false, when true if `endpoint` is informed it will ignore the `bucket`
1420
+ *
1421
+ * @example
1422
+ * // Using virtual hosted style
1423
+ * const file = s3("my-file.txt", {
1424
+ * virtualHostedStyle: true,
1425
+ * endpoint: "https://my-bucket.s3.us-east-1.amazonaws.com"
1426
+ * });
1427
+ */
1428
+ virtualHostedStyle?: boolean;
1429
+
1418
1430
  /**
1419
1431
  * The size of each part in multipart uploads (in bytes).
1420
1432
  * - Minimum: 5 MiB
@@ -2096,6 +2108,8 @@ declare module "bun" {
2096
2108
  max?: number;
2097
2109
  /** By default values outside i32 range are returned as strings. If this is true, values outside i32 range are returned as BigInts. */
2098
2110
  bigint?: boolean;
2111
+ /** Automatic creation of prepared statements, defaults to true */
2112
+ prepare?: boolean;
2099
2113
  };
2100
2114
 
2101
2115
  /**
@@ -2109,6 +2123,8 @@ declare module "bun" {
2109
2123
  cancelled: boolean;
2110
2124
  /** Cancels the executing query */
2111
2125
  cancel(): SQLQuery;
2126
+ /** Execute as a simple query, no parameters are allowed but can execute multiple commands separated by semicolons */
2127
+ simple(): SQLQuery;
2112
2128
  /** Executes the query */
2113
2129
  execute(): SQLQuery;
2114
2130
  /** Returns the raw query result */
package/docs/api/fetch.md CHANGED
@@ -337,7 +337,7 @@ This will print the request and response headers to your terminal:
337
337
  ```sh
338
338
  [fetch] > HTTP/1.1 GET http://example.com/
339
339
  [fetch] > Connection: keep-alive
340
- [fetch] > User-Agent: Bun/1.2.3-canary.20250212T140603
340
+ [fetch] > User-Agent: Bun/1.2.3-canary.20250214T140552
341
341
  [fetch] > Accept: */*
342
342
  [fetch] > Host: example.com
343
343
  [fetch] > Accept-Encoding: gzip, deflate, br
package/docs/api/s3.md CHANGED
@@ -181,8 +181,8 @@ const download = s3.presign("my-file.txt"); // GET, text/plain, expires in 24 ho
181
181
 
182
182
  const upload = s3.presign("my-file", {
183
183
  expiresIn: 3600, // 1 hour
184
- method: 'PUT',
185
- type: 'application/json', // No extension for inferring, so we can specify the content type to be JSON
184
+ method: "PUT",
185
+ type: "application/json", // No extension for inferring, so we can specify the content type to be JSON
186
186
  });
187
187
 
188
188
  // You can call .presign() if on a file reference, but avoid doing so
@@ -361,6 +361,56 @@ const minio = new S3Client({
361
361
  });
362
362
  ```
363
363
 
364
+ ### Using Bun's S3Client with supabase
365
+
366
+ To use Bun's S3 client with [supabase](https://supabase.com/), set `endpoint` to the supabase endpoint in the `S3Client` constructor. The supabase endpoint includes your account ID and /storage/v1/s3 path. Make sure to set Enable connection via S3 protocol on in the supabase dashboard in https://supabase.com/dashboard/project/<account-id>/settings/storage and to set the region informed in the same section.
367
+
368
+ ```ts
369
+ import { S3Client } from "bun";
370
+
371
+ const supabase = new S3Client({
372
+ accessKeyId: "access-key",
373
+ secretAccessKey: "secret-key",
374
+ bucket: "my-bucket",
375
+ region: "us-west-1",
376
+ endpoint: "https://<account-id>.supabase.co/storage/v1/s3/storage",
377
+ });
378
+ ```
379
+
380
+ ### Using Bun's S3Client with S3 Virtual Hosted-Style endpoints
381
+
382
+ When using a S3 Virtual Hosted-Style endpoint, you need to set the `virtualHostedStyle` option to `true` and if no endpoint is provided, Bun will use region and bucket to infer the endpoint to AWS S3, if no region is provided it will use `us-east-1`. If you provide a the endpoint, there are no need to provide the bucket name.
383
+
384
+ ```ts
385
+ import { S3Client } from "bun";
386
+
387
+ // AWS S3 endpoint inferred from region and bucket
388
+ const s3 = new S3Client({
389
+ accessKeyId: "access-key",
390
+ secretAccessKey: "secret-key",
391
+ bucket: "my-bucket",
392
+ virtualHostedStyle: true,
393
+ // endpoint: "https://my-bucket.s3.us-east-1.amazonaws.com",
394
+ // region: "us-east-1",
395
+ });
396
+
397
+ // AWS S3
398
+ const s3WithEndpoint = new S3Client({
399
+ accessKeyId: "access-key",
400
+ secretAccessKey: "secret-key",
401
+ endpoint: "https://<bucket-name>.s3.<region>.amazonaws.com",
402
+ virtualHostedStyle: true,
403
+ });
404
+
405
+ // Cloudflare R2
406
+ const r2WithEndpoint = new S3Client({
407
+ accessKeyId: "access-key",
408
+ secretAccessKey: "secret-key",
409
+ endpoint: "https://<bucket-name>.<account-id>.r2.cloudflarestorage.com",
410
+ virtualHostedStyle: true,
411
+ });
412
+ ```
413
+
364
414
  ## Credentials
365
415
 
366
416
  Credentials are one of the hardest parts of using S3, and we've tried to make it as easy as possible. By default, Bun reads the following environment variables for credentials.
package/docs/api/spawn.md CHANGED
@@ -110,7 +110,7 @@ You can read results from the subprocess via the `stdout` and `stderr` propertie
110
110
  ```ts
111
111
  const proc = Bun.spawn(["bun", "--version"]);
112
112
  const text = await new Response(proc.stdout).text();
113
- console.log(text); // => "1.2.3-canary.20250212T140603"
113
+ console.log(text); // => "1.2.3-canary.20250214T140552"
114
114
  ```
115
115
 
116
116
  Configure the output stream by passing one of the following values to `stdout/stderr`:
@@ -7,7 +7,7 @@ Use `bun publish` to publish a package to the npm registry.
7
7
  $ bun publish
8
8
 
9
9
  ## Output
10
- bun publish v1.2.3-canary.20250212T140603 (ca7428e9)
10
+ bun publish v1.2.3-canary.20250214T140552 (ca7428e9)
11
11
 
12
12
  packed 203B package.json
13
13
  packed 224B README.md
@@ -9,7 +9,7 @@ $ bunx nuxi init my-nuxt-app
9
9
  ✔ Which package manager would you like to use?
10
10
  bun
11
11
  ◐ Installing dependencies...
12
- bun install v1.2.3-canary.20250212T140603 (16b4bf34)
12
+ bun install v1.2.3-canary.20250214T140552 (16b4bf34)
13
13
  + @nuxt/devtools@0.8.2
14
14
  + nuxt@3.7.0
15
15
  785 packages installed [2.67s]
@@ -16,7 +16,7 @@ This will add the package to `peerDependencies` in `package.json`.
16
16
  ```json-diff
17
17
  {
18
18
  "peerDependencies": {
19
- + "@types/bun": "^1.2.3-canary.20250212T140603"
19
+ + "@types/bun": "^1.2.3-canary.20250214T140552"
20
20
  }
21
21
  }
22
22
  ```
@@ -28,7 +28,7 @@ Running `bun install` will install peer dependencies by default, unless marked o
28
28
  ```json-diff
29
29
  {
30
30
  "peerDependencies": {
31
- "@types/bun": "^1.2.3-canary.20250212T140603"
31
+ "@types/bun": "^1.2.3-canary.20250214T140552"
32
32
  },
33
33
  "peerDependenciesMeta": {
34
34
  + "@types/bun": {
@@ -97,7 +97,7 @@ $ bun update
97
97
  $ bun update @types/bun --latest
98
98
 
99
99
  # Update a dependency to a specific version
100
- $ bun update @types/bun@1.2.3-canary.20250212T140603
100
+ $ bun update @types/bun@1.2.3-canary.20250214T140552
101
101
 
102
102
  # Update all dependencies to the latest versions
103
103
  $ bun update --latest
@@ -0,0 +1,37 @@
1
+ ---
2
+ name: Delete directories
3
+ ---
4
+
5
+ To recursively delete a directory and all its contents, use `rm` from `node:fs/promises`. This is like running `rm -rf` in JavaScript.
6
+
7
+ ```ts
8
+ import { rm } from "node:fs/promises";
9
+
10
+ // Delete a directory and all its contents
11
+ await rm("path/to/directory", { recursive: true, force: true });
12
+ ```
13
+
14
+ ---
15
+
16
+ These options configure the deletion behavior:
17
+
18
+ - `recursive: true` - Delete subdirectories and their contents
19
+ - `force: true` - Don't throw errors if the directory doesn't exist
20
+
21
+ You can also use it without `force` to ensure the directory exists:
22
+
23
+ ```ts
24
+ try {
25
+ await rm("path/to/directory", { recursive: true });
26
+ } catch (error) {
27
+ if (error.code === "ENOENT") {
28
+ console.log("Directory doesn't exist");
29
+ } else {
30
+ throw error;
31
+ }
32
+ }
33
+ ```
34
+
35
+ ---
36
+
37
+ See [Docs > API > FileSystem](https://bun.sh/docs/api/file-io) for more filesystem operations.
@@ -0,0 +1,19 @@
1
+ ---
2
+ name: Delete files
3
+ ---
4
+
5
+ To delete a file, use `Bun.file(path).delete()`.
6
+
7
+ ```ts
8
+ // Delete a file
9
+ const file = Bun.file("path/to/file.txt");
10
+ await file.delete();
11
+
12
+ // Now the file doesn't exist
13
+ const exists = await file.exists();
14
+ // => false
15
+ ```
16
+
17
+ ---
18
+
19
+ See [Docs > API > FileSystem](https://bun.sh/docs/api/file-io) for more filesystem operations.
@@ -0,0 +1,26 @@
1
+ ---
2
+ name: Inspect memory usage using V8 heap snapshots
3
+ ---
4
+
5
+ Bun implements V8's heap snapshot API, which allows you to create snapshots of the heap at runtime. This helps debug memory leaks in your JavaScript/TypeScript application.
6
+
7
+ ```ts#snapshot.ts
8
+ import v8 from "node:v8";
9
+
10
+ // Creates a heap snapshot file with an auto-generated name
11
+ const snapshotPath = v8.writeHeapSnapshot();
12
+ console.log(`Heap snapshot written to: ${snapshotPath}`);
13
+ ```
14
+
15
+ ---
16
+
17
+ ## Inspect memory in Chrome DevTools
18
+
19
+ To view V8 heap snapshots in Chrome DevTools:
20
+
21
+ 1. Open Chrome DevTools (F12 or right-click and select "Inspect")
22
+ 2. Go to the "Memory" tab
23
+ 3. Click the "Load" button (folder icon)
24
+ 4. Select your `.heapsnapshot` file
25
+
26
+ {% image src="/images/chrome-devtools-memory.png" alt="Chrome DevTools Memory Tab" width="100%" /%}
@@ -21,7 +21,7 @@ Here's what the output of a typical test run looks like. In this case, there are
21
21
 
22
22
  ```sh
23
23
  $ bun test
24
- bun test v1.2.3-canary.20250212T140603 (9c68abdb)
24
+ bun test v1.2.3-canary.20250214T140552 (9c68abdb)
25
25
 
26
26
  test.test.js:
27
27
  ✓ add [0.87ms]
@@ -47,7 +47,7 @@ To only run certain test files, pass a positional argument to `bun test`. The ru
47
47
 
48
48
  ```sh
49
49
  $ bun test test3
50
- bun test v1.2.3-canary.20250212T140603 (9c68abdb)
50
+ bun test v1.2.3-canary.20250214T140552 (9c68abdb)
51
51
 
52
52
  test3.test.js:
53
53
  ✓ add [1.40ms]
@@ -85,7 +85,7 @@ Adding `-t add` will only run tests with "add" in the name. This works with test
85
85
 
86
86
  ```sh
87
87
  $ bun test -t add
88
- bun test v1.2.3-canary.20250212T140603 (9c68abdb)
88
+ bun test v1.2.3-canary.20250214T140552 (9c68abdb)
89
89
 
90
90
  test.test.js:
91
91
  ✓ add [1.79ms]
@@ -18,7 +18,7 @@ The first time this test is executed, Bun will evaluate the value passed into `e
18
18
 
19
19
  ```sh
20
20
  $ bun test test/snap
21
- bun test v1.2.3-canary.20250212T140603 (9c68abdb)
21
+ bun test v1.2.3-canary.20250214T140552 (9c68abdb)
22
22
 
23
23
  test/snap.test.ts:
24
24
  ✓ snapshot [1.48ms]
@@ -61,7 +61,7 @@ Later, when this test file is executed again, Bun will read the snapshot file an
61
61
 
62
62
  ```sh
63
63
  $ bun test
64
- bun test v1.2.3-canary.20250212T140603 (9c68abdb)
64
+ bun test v1.2.3-canary.20250214T140552 (9c68abdb)
65
65
 
66
66
  test/snap.test.ts:
67
67
  ✓ snapshot [1.05ms]
@@ -78,7 +78,7 @@ To update snapshots, use the `--update-snapshots` flag.
78
78
 
79
79
  ```sh
80
80
  $ bun test --update-snapshots
81
- bun test v1.2.3-canary.20250212T140603 (9c68abdb)
81
+ bun test v1.2.3-canary.20250214T140552 (9c68abdb)
82
82
 
83
83
  test/snap.test.ts:
84
84
  ✓ snapshot [0.86ms]
@@ -29,7 +29,7 @@ To regenerate snapshots, use the `--update-snapshots` flag.
29
29
 
30
30
  ```sh
31
31
  $ bun test --update-snapshots
32
- bun test v1.2.3-canary.20250212T140603 (9c68abdb)
32
+ bun test v1.2.3-canary.20250214T140552 (9c68abdb)
33
33
 
34
34
  test/snap.test.ts:
35
35
  ✓ snapshot [0.86ms]
@@ -5,7 +5,7 @@ name: Get the current Bun version
5
5
  Get the current version of Bun in a semver format.
6
6
 
7
7
  ```ts#index.ts
8
- Bun.version; // => "1.2.3-canary.20250212T140603"
8
+ Bun.version; // => "1.2.3-canary.20250214T140552"
9
9
  ```
10
10
 
11
11
  ---
@@ -14,7 +14,7 @@ Kernel version 5.6 or higher is strongly recommended, but the minimum is 5.1. Us
14
14
  ```bash#macOS/Linux_(curl)
15
15
  $ curl -fsSL https://bun.sh/install | bash # for macOS, Linux, and WSL
16
16
  # to install a specific version
17
- $ curl -fsSL https://bun.sh/install | bash -s "bun-v1.2.3-canary.20250212T140603"
17
+ $ curl -fsSL https://bun.sh/install | bash -s "bun-v1.2.3-canary.20250214T140552"
18
18
  ```
19
19
 
20
20
  ```bash#npm
@@ -188,10 +188,10 @@ Since Bun is a single binary, you can install older versions of Bun by re-runnin
188
188
 
189
189
  ### Installing a specific version of Bun on Linux/Mac
190
190
 
191
- To install a specific version of Bun, you can pass the git tag of the version you want to install to the install script, such as `bun-v1.2.0` or `bun-v1.2.3-canary.20250212T140603`.
191
+ To install a specific version of Bun, you can pass the git tag of the version you want to install to the install script, such as `bun-v1.2.0` or `bun-v1.2.3-canary.20250214T140552`.
192
192
 
193
193
  ```sh
194
- $ curl -fsSL https://bun.sh/install | bash -s "bun-v1.2.3-canary.20250212T140603"
194
+ $ curl -fsSL https://bun.sh/install | bash -s "bun-v1.2.3-canary.20250214T140552"
195
195
  ```
196
196
 
197
197
  ### Installing a specific version of Bun on Windows
@@ -200,7 +200,7 @@ On Windows, you can install a specific version of Bun by passing the version num
200
200
 
201
201
  ```sh
202
202
  # PowerShell:
203
- $ iex "& {$(irm https://bun.sh/install.ps1)} -Version 1.2.3-canary.20250212T140603"
203
+ $ iex "& {$(irm https://bun.sh/install.ps1)} -Version 1.2.3-canary.20250214T140552"
204
204
  ```
205
205
 
206
206
  ## Downloading Bun binaries directly
@@ -124,11 +124,11 @@ await fetch("https://example.com", {
124
124
  This prints the `fetch` request as a single-line `curl` command to let you copy-paste into your terminal to replicate the request.
125
125
 
126
126
  ```sh
127
- [fetch] $ curl --http1.1 "https://example.com/" -X POST -H "content-type: application/json" -H "Connection: keep-alive" -H "User-Agent: Bun/1.2.3-canary.20250212T140603" -H "Accept: */*" -H "Host: example.com" -H "Accept-Encoding: gzip, deflate, br" --compressed -H "Content-Length: 13" --data-raw "{\"foo\":\"bar\"}"
127
+ [fetch] $ curl --http1.1 "https://example.com/" -X POST -H "content-type: application/json" -H "Connection: keep-alive" -H "User-Agent: Bun/1.2.3-canary.20250214T140552" -H "Accept: */*" -H "Host: example.com" -H "Accept-Encoding: gzip, deflate, br" --compressed -H "Content-Length: 13" --data-raw "{\"foo\":\"bar\"}"
128
128
  [fetch] > HTTP/1.1 POST https://example.com/
129
129
  [fetch] > content-type: application/json
130
130
  [fetch] > Connection: keep-alive
131
- [fetch] > User-Agent: Bun/1.2.3-canary.20250212T140603
131
+ [fetch] > User-Agent: Bun/1.2.3-canary.20250214T140552
132
132
  [fetch] > Accept: */*
133
133
  [fetch] > Host: example.com
134
134
  [fetch] > Accept-Encoding: gzip, deflate, br
@@ -170,7 +170,7 @@ This prints the following to the console:
170
170
  [fetch] > HTTP/1.1 POST https://example.com/
171
171
  [fetch] > content-type: application/json
172
172
  [fetch] > Connection: keep-alive
173
- [fetch] > User-Agent: Bun/1.2.3-canary.20250212T140603
173
+ [fetch] > User-Agent: Bun/1.2.3-canary.20250214T140552
174
174
  [fetch] > Accept: */*
175
175
  [fetch] > Host: example.com
176
176
  [fetch] > Accept-Encoding: gzip, deflate, br
package/docs/test/dom.md CHANGED
@@ -55,7 +55,7 @@ Let's run this test with `bun test`:
55
55
 
56
56
  ```bash
57
57
  $ bun test
58
- bun test v1.2.3-canary.20250212T140603
58
+ bun test v1.2.3-canary.20250214T140552
59
59
 
60
60
  dom.test.ts:
61
61
  ✓ dom test [0.82ms]
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.2.3-canary.20250212T140603",
2
+ "version": "1.2.3-canary.20250214T140552",
3
3
  "name": "bun-types",
4
4
  "license": "MIT",
5
5
  "main": "",