bun-types 1.1.44 → 1.1.45-canary.20250118T140543

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
@@ -22,6 +22,7 @@ declare module "bun" {
22
22
  PeerCertificate,
23
23
  } from "tls";
24
24
  import type { Stats } from "node:fs";
25
+ import type { X509Certificate } from "node:crypto";
25
26
  interface Env {
26
27
  NODE_ENV?: string;
27
28
  /**
@@ -2356,7 +2357,8 @@ declare module "bun" {
2356
2357
  | "import-rule"
2357
2358
  | "url-token"
2358
2359
  | "internal"
2359
- | "entry-point";
2360
+ | "entry-point-run"
2361
+ | "entry-point-build";
2360
2362
 
2361
2363
  interface Import {
2362
2364
  path: string;
@@ -5594,6 +5596,7 @@ declare module "bun" {
5594
5596
  * socket has been destroyed, `null` will be returned.
5595
5597
  */
5596
5598
  getCertificate(): PeerCertificate | object | null;
5599
+ getX509Certificate(): X509Certificate | undefined;
5597
5600
 
5598
5601
  /**
5599
5602
  * Returns an object containing information on the negotiated cipher suite.
@@ -5632,6 +5635,7 @@ declare module "bun" {
5632
5635
  * @return A certificate object.
5633
5636
  */
5634
5637
  getPeerCertificate(): PeerCertificate;
5638
+ getPeerX509Certificate(): X509Certificate;
5635
5639
 
5636
5640
  /**
5637
5641
  * See [SSL\_get\_shared\_sigalgs](https://www.openssl.org/docs/man1.1.1/man3/SSL_get_shared_sigalgs.html) for more information.
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.1.44
198
+ [fetch] > User-Agent: Bun/1.1.45-canary.20250118T140543
199
199
  [fetch] > Accept: */*
200
200
  [fetch] > Host: example.com
201
201
  [fetch] > Accept-Encoding: gzip, deflate, br
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.1.44"
113
+ console.log(text); // => "1.1.45-canary.20250118T140543"
114
114
  ```
115
115
 
116
116
  Configure the output stream by passing one of the following values to `stdout/stderr`:
@@ -137,7 +137,8 @@ Each import in the `imports` array has a `path` and `kind`. Bun categories impor
137
137
  - `import-rule`: `@import 'foo.css'`
138
138
  - `url-token`: `url('./foo.png')`
139
139
  <!-- - `internal`: `import {foo} from 'bun:internal'`
140
- - `entry-point`: `import {foo} from 'bun:entry'` -->
140
+ - `entry-point-build`: `import {foo} from 'bun:entry'`
141
+ - `entry-point-run`: `bun ./mymodule` -->
141
142
 
142
143
  ## `.scanImports()`
143
144
 
@@ -267,7 +268,8 @@ type Import = {
267
268
  // The import was injected by Bun
268
269
  | "internal" 
269
270
  // Entry point (not common)
270
- | "entry-point"
271
+ | "entry-point-build"
272
+ | "entry-point-run"
271
273
  }
272
274
 
273
275
  const transpiler = new Bun.Transpiler({ loader: "jsx" });
@@ -533,7 +533,8 @@ export type BuildManifest = {
533
533
  };
534
534
 
535
535
  export type ImportKind =
536
- | "entry-point"
536
+ | "entry-point-build"
537
+ | "entry-point-run"
537
538
  | "import-statement"
538
539
  | "require-call"
539
540
  | "dynamic-import"
@@ -152,19 +152,6 @@ export default "Hello, world!";
152
152
 
153
153
  {% /codetabs %}
154
154
 
155
- ### `wasm`
156
-
157
- **WebAssembly loader**. Default for `.wasm`.
158
-
159
- In the runtime, WebAssembly files can be directly imported. The file is read and returned as a `WebAssembly.Module`.
160
-
161
- ```ts
162
- import wasm from "./module.wasm";
163
- console.log(wasm); // => WebAssembly.Module
164
- ```
165
-
166
- In the bundler, `.wasm` files are handled using the [`file`](#file) loader.
167
-
168
155
  ### `napi`
169
156
 
170
157
  **Native addon loader**. Default for `.node`.
@@ -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.1.44 (ca7428e9)
10
+ bun publish v1.1.45-canary.20250118T140543 (ca7428e9)
11
11
 
12
12
  packed 203B package.json
13
13
  packed 224B README.md
package/docs/cli/run.md CHANGED
@@ -106,13 +106,13 @@ $ bun run clean
106
106
  Done.
107
107
  ```
108
108
 
109
- Bun executes the script command in a subshell. It checks for the following shells in order, using the first one it finds: `bash`, `sh`, `zsh`.
109
+ Bun executes the script command in a subshell. On Linux & macOS, it checks for the following shells in order, using the first one it finds: `bash`, `sh`, `zsh`. On windows, it uses [bun shell](https://bun.sh/docs/runtime/shell) to support bash-like syntax and many common commands.
110
110
 
111
111
  {% callout %}
112
112
  ⚡️ The startup time for `npm run` on Linux is roughly 170ms; with Bun it is `6ms`.
113
113
  {% /callout %}
114
114
 
115
- If there is a name conflict between a `package.json` script and a built-in `bun` command (`install`, `dev`, `upgrade`, etc.) Bun's built-in command takes precedence. In this case, use the more explicit `bun run` command to execute your package script.
115
+ Scripts can also be run with the shorter command `bun <script>`, however if there is a built-in bun command with the same name, the built-in command takes precedence. In this case, use the more explicit `bun run <script>` command to execute your package script.
116
116
 
117
117
  ```bash
118
118
  $ bun run dev
@@ -194,3 +194,14 @@ $ bun --smol run index.tsx
194
194
  ```
195
195
 
196
196
  This causes the garbage collector to run more frequently, which can slow down execution. However, it can be useful in environments with limited memory. Bun automatically adjusts the garbage collector's heap size based on the available memory (accounting for cgroups and other memory limits) with and without the `--smol` flag, so this is mostly useful for cases where you want to make the heap size grow more slowly.
197
+
198
+ ## Resolution order
199
+
200
+ Absolute paths and paths starting with `./` or `.\\` are always executed as source files. Unless using `bun run`, running a file with an allowed extension will prefer the file over a package.json script.
201
+
202
+ When there is a package.json script and a file with the same name, `bun run` prioritizes the package.json script. The full resolution order is:
203
+
204
+ 1. package.json scripts, eg `bun run build`
205
+ 2. Source files, eg `bun run src/main.js`
206
+ 3. Binaries from project packages, eg `bun add eslint && bun run eslint`
207
+ 4. (`bun run` only) System commands, eg `bun run ls`
@@ -2,11 +2,11 @@
2
2
  name: Server-side render (SSR) a React component
3
3
  ---
4
4
 
5
- To get started, install the canary version of `react` & `react-dom`:
5
+ To get started, install `react` & `react-dom`:
6
6
 
7
7
  ```sh
8
8
  # Any package manager can be used
9
- $ bun add react@canary react-dom@canary
9
+ $ bun add react react-dom
10
10
  ```
11
11
 
12
12
  ---
@@ -48,4 +48,4 @@ Bun.serve({
48
48
 
49
49
  ---
50
50
 
51
- React `19` and later includes an [SSR optimization](https://github.com/facebook/react/pull/25597) that takes advantage of Bun's "direct" `ReadableStream` implementation. If you run into an error like `export named 'renderToReadableStream' not found`, please make sure to install the canary version of `react` & `react-dom`, or import from `react-dom/server.browser` instead of `react-dom/server`. See [facebook/react#28941](https://github.com/facebook/react/issues/28941) for more information.
51
+ React `19` and later includes an [SSR optimization](https://github.com/facebook/react/pull/25597) that takes advantage of Bun's "direct" `ReadableStream` implementation. If you run into an error like `export named 'renderToReadableStream' not found`, please make sure to install version `19` of `react` & `react-dom`, or import from `react-dom/server.browser` instead of `react-dom/server`. See [facebook/react#28941](https://github.com/facebook/react/issues/28941) for more information.
@@ -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.1.44" -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.1.45-canary.20250118T140543" -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.1.44
131
+ [fetch] > User-Agent: Bun/1.1.45-canary.20250118T140543
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.1.44
173
+ [fetch] > User-Agent: Bun/1.1.45-canary.20250118T140543
174
174
  [fetch] > Accept: */*
175
175
  [fetch] > Host: example.com
176
176
  [fetch] > Accept-Encoding: gzip, deflate, br
@@ -58,6 +58,10 @@ This page is updated regularly to reflect compatibility status of the latest ver
58
58
 
59
59
  🟢 Fully implemented.
60
60
 
61
+ ### [`node:stream`](https://nodejs.org/api/stream.html)
62
+
63
+ 🟢 Fully implemented.
64
+
61
65
  ### [`node:string_decoder`](https://nodejs.org/api/string_decoder.html)
62
66
 
63
67
  🟢 Fully implemented. 100% of Node.js's test suite passes.
@@ -92,7 +96,7 @@ This page is updated regularly to reflect compatibility status of the latest ver
92
96
 
93
97
  ### [`node:crypto`](https://nodejs.org/api/crypto.html)
94
98
 
95
- 🟡 Missing `Certificate` `ECDH` `X509Certificate` `checkPrime` `checkPrimeSync` `diffieHellman` `generatePrime` `generatePrimeSync` `getCipherInfo` `getFips` `hkdf` `hkdfSync` `secureHeapUsed` `setEngine` `setFips`
99
+ 🟡 Missing `ECDH` `checkPrime` `checkPrimeSync` `generatePrime` `generatePrimeSync` `hkdf` `hkdfSync` `secureHeapUsed` `setEngine` `setFips`
96
100
 
97
101
  Some methods are not optimized yet.
98
102
 
@@ -129,10 +133,6 @@ Some methods are not optimized yet.
129
133
 
130
134
  🟡 See [`process`](#process) Global.
131
135
 
132
- ### [`node:stream`](https://nodejs.org/api/stream.html)
133
-
134
- 🟡 Missing `toWeb`
135
-
136
136
  ### [`node:sys`](https://nodejs.org/api/util.html)
137
137
 
138
138
  🟡 See [`node:util`](#node-util).
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.1.44
58
+ bun test v1.1.45-canary.20250118T140543
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.1.44",
2
+ "version": "1.1.45-canary.20250118T140543",
3
3
  "name": "bun-types",
4
4
  "license": "MIT",
5
5
  "main": "",