bun-types 1.2.0 → 1.2.1-canary.20250127T140607

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
@@ -1468,6 +1468,28 @@ declare module "bun" {
1468
1468
  */
1469
1469
  type?: string;
1470
1470
 
1471
+ /**
1472
+ * By default, Amazon S3 uses the STANDARD Storage Class to store newly created objects.
1473
+ *
1474
+ * @example
1475
+ * // Setting explicit Storage class
1476
+ * const file = s3("my-file.json", {
1477
+ * storageClass: "STANDARD_IA"
1478
+ * });
1479
+ */
1480
+ storageClass?:
1481
+ | "STANDARD"
1482
+ | "DEEP_ARCHIVE"
1483
+ | "EXPRESS_ONEZONE"
1484
+ | "GLACIER"
1485
+ | "GLACIER_IR"
1486
+ | "INTELLIGENT_TIERING"
1487
+ | "ONEZONE_IA"
1488
+ | "OUTPOSTS"
1489
+ | "REDUCED_REDUNDANCY"
1490
+ | "SNOW"
1491
+ | "STANDARD_IA";
1492
+
1471
1493
  /**
1472
1494
  * @deprecated The size of the internal buffer in bytes. Defaults to 5 MiB. use `partSize` and `queueSize` instead.
1473
1495
  */
@@ -3835,7 +3857,7 @@ declare module "bun" {
3835
3857
  port?: string | number;
3836
3858
 
3837
3859
  /**
3838
- * If the `SO_REUSEPORT` flag should be set.
3860
+ * Whether the `SO_REUSEPORT` flag should be set.
3839
3861
  *
3840
3862
  * This allows multiple processes to bind to the same port, which is useful for load balancing.
3841
3863
  *
@@ -3843,6 +3865,12 @@ declare module "bun" {
3843
3865
  */
3844
3866
  reusePort?: boolean;
3845
3867
 
3868
+ /**
3869
+ * Whether the `IPV6_V6ONLY` flag should be set.
3870
+ * @default false
3871
+ */
3872
+ ipv6Only?: boolean;
3873
+
3846
3874
  /**
3847
3875
  * What hostname should the server listen on?
3848
3876
  *
@@ -7220,7 +7248,7 @@ declare module "bun" {
7220
7248
  * Types for `bun.lock`
7221
7249
  */
7222
7250
  type BunLockFile = {
7223
- lockfileVersion: 0;
7251
+ lockfileVersion: 0 | 1;
7224
7252
  workspaces: {
7225
7253
  [workspace: string]: BunLockFileWorkspacePackage;
7226
7254
  };
@@ -7232,10 +7260,11 @@ declare module "bun" {
7232
7260
  * ```
7233
7261
  * INFO = { prod/dev/optional/peer dependencies, os, cpu, libc (TODO), bin, binDir }
7234
7262
  *
7263
+ * // first index is resolution for each type of package
7235
7264
  * npm -> [ "name@version", registry (TODO: remove if default), INFO, integrity]
7236
7265
  * symlink -> [ "name@link:path", INFO ]
7237
7266
  * folder -> [ "name@file:path", INFO ]
7238
- * workspace -> [ "name@workspace:path", INFO ]
7267
+ * workspace -> [ "name@workspace:path" ] // workspace is only path
7239
7268
  * tarball -> [ "name@tarball", INFO ]
7240
7269
  * root -> [ "name@root:", { bin, binDir } ]
7241
7270
  * git -> [ "name@git+repo", INFO, .bun-tag string (TODO: remove this) ]
@@ -7253,6 +7282,8 @@ declare module "bun" {
7253
7282
  optionalDependencies?: Record<string, string>;
7254
7283
  peerDependencies?: Record<string, string>;
7255
7284
  optionalPeers?: string[];
7285
+ bin?: string | Record<string, string>;
7286
+ binDir?: string;
7256
7287
  };
7257
7288
 
7258
7289
  type BunLockFileWorkspacePackage = BunLockFileBasePackageInfo & {
@@ -7263,8 +7294,6 @@ declare module "bun" {
7263
7294
  type BunLockFilePackageInfo = BunLockFileBasePackageInfo & {
7264
7295
  os?: string | string[];
7265
7296
  cpu?: string | string[];
7266
- bin?: Record<string, string>;
7267
- binDir?: string;
7268
7297
  bundled?: true;
7269
7298
  };
7270
7299
 
@@ -7277,10 +7306,12 @@ declare module "bun" {
7277
7306
  info: BunLockFilePackageInfo,
7278
7307
  integrity: string,
7279
7308
  ]
7280
- /** symlink, folder, tarball, workspace */
7309
+ /** symlink, folder, tarball */
7281
7310
  | [pkg: string, info: BunLockFilePackageInfo]
7311
+ /** workspace */
7312
+ | [pkg: string]
7282
7313
  /** git, github */
7283
7314
  | [pkg: string, info: BunLockFilePackageInfo, bunTag: string]
7284
7315
  /** root */
7285
- | [pkg: string, info: Pick<BunLockFilePackageInfo, "bin" | "binDir">];
7316
+ | [pkg: string, info: Pick<BunLockFileBasePackageInfo, "bin" | "binDir">];
7286
7317
  }
package/docs/api/fetch.md CHANGED
@@ -195,7 +195,7 @@ This will print the request and response headers to your terminal:
195
195
  ```sh
196
196
  [fetch] > HTTP/1.1 GET http://example.com/
197
197
  [fetch] > Connection: keep-alive
198
- [fetch] > User-Agent: Bun/bun-v1.2.0
198
+ [fetch] > User-Agent: Bun/1.2.1-canary.20250127T140607
199
199
  [fetch] > Accept: */*
200
200
  [fetch] > Host: example.com
201
201
  [fetch] > Accept-Encoding: gzip, deflate, br
package/docs/api/s3.md CHANGED
@@ -171,11 +171,24 @@ When your production service needs to let users upload files to your server, it'
171
171
 
172
172
  To facilitate this, you can presign URLs for S3 files. This generates a URL with a signature that allows a user to securely upload that specific file to S3, without exposing your credentials or granting them unnecessary access to your bucket.
173
173
 
174
+ The default behaviour is to generate a `GET` URL that expires in 24 hours. Bun attempts to infer the content type from the file extension. If inference is not possible, it will default to `application/octet-stream`.
175
+
174
176
  ```ts
175
177
  import { s3 } from "bun";
176
178
 
177
179
  // Generate a presigned URL that expires in 24 hours (default)
178
- const url = s3.presign("my-file.txt", {
180
+ const download = s3.presign("my-file.txt"); // GET, text/plain, expires in 24 hours
181
+
182
+ const upload = s3.presign("my-file", {
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
186
+ });
187
+
188
+ // You can call .presign() if on a file reference, but avoid doing so
189
+ // unless you already have a reference (to avoid memory usage).
190
+ const myFile = s3.file("my-file.txt");
191
+ const presignedFile = myFile.presign({
179
192
  expiresIn: 3600, // 1 hour
180
193
  });
181
194
  ```
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); // => "bun-v1.2.0"
113
+ console.log(text); // => "1.2.1-canary.20250127T140607"
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 vbun-v1.2.0 (ca7428e9)
10
+ bun publish v1.2.1-canary.20250127T140607 (ca7428e9)
11
11
 
12
12
  packed 203B package.json
13
13
  packed 224B README.md
@@ -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/bun-v1.2.0" -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.1-canary.20250127T140607" -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/bun-v1.2.0
131
+ [fetch] > User-Agent: Bun/1.2.1-canary.20250127T140607
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/bun-v1.2.0
173
+ [fetch] > User-Agent: Bun/1.2.1-canary.20250127T140607
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 vbun-v1.2.0
58
+ bun test v1.2.1-canary.20250127T140607
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.0",
2
+ "version": "1.2.1-canary.20250127T140607",
3
3
  "name": "bun-types",
4
4
  "license": "MIT",
5
5
  "main": "",