bun-types
Advanced tools
Comparing version
@@ -198,3 +198,3 @@ Bun implements the WHATWG `fetch` standard, with some extensions to meet the needs of server-side JavaScript. | ||
[fetch] > Connection: keep-alive | ||
[fetch] > User-Agent: Bun/bun-v1.1.44 | ||
[fetch] > User-Agent: Bun/1.1.45-canary.20250118T140543 | ||
[fetch] > Accept: */* | ||
@@ -201,0 +201,0 @@ [fetch] > Host: example.com |
@@ -113,3 +113,3 @@ Spawn child processes with `Bun.spawn` or `Bun.spawnSync`. | ||
const text = await new Response(proc.stdout).text(); | ||
console.log(text); // => "bun-v1.1.44" | ||
console.log(text); // => "1.1.45-canary.20250118T140543" | ||
``` | ||
@@ -116,0 +116,0 @@ |
@@ -140,3 +140,4 @@ Bun exposes its internal transpiler via the `Bun.Transpiler` class. To create an instance of Bun's transpiler: | ||
<!-- - `internal`: `import {foo} from 'bun:internal'` | ||
- `entry-point`: `import {foo} from 'bun:entry'` --> | ||
- `entry-point-build`: `import {foo} from 'bun:entry'` | ||
- `entry-point-run`: `bun ./mymodule` --> | ||
@@ -271,3 +272,4 @@ ## `.scanImports()` | ||
// Entry point (not common) | ||
| "entry-point" | ||
| "entry-point-build" | ||
| "entry-point-run" | ||
} | ||
@@ -274,0 +276,0 @@ |
@@ -536,3 +536,4 @@ Bun's fast native bundler is now in beta. It can be used via the `bun build` CLI command or the `Bun.build()` JavaScript API. | ||
export type ImportKind = | ||
| "entry-point" | ||
| "entry-point-build" | ||
| "entry-point-run" | ||
| "import-statement" | ||
@@ -539,0 +540,0 @@ | "require-call" |
@@ -155,15 +155,2 @@ The Bun bundler implements a set of default loaders out of the box. As a rule of thumb, the bundler and the runtime both support the same set of file types out of the box. | ||
### `wasm` | ||
**WebAssembly loader**. Default for `.wasm`. | ||
In the runtime, WebAssembly files can be directly imported. The file is read and returned as a `WebAssembly.Module`. | ||
```ts | ||
import wasm from "./module.wasm"; | ||
console.log(wasm); // => WebAssembly.Module | ||
``` | ||
In the bundler, `.wasm` files are handled using the [`file`](#file) loader. | ||
### `napi` | ||
@@ -170,0 +157,0 @@ |
@@ -10,3 +10,3 @@ Use `bun publish` to publish a package to the npm registry. | ||
## Output | ||
bun publish vbun-v1.1.44 (ca7428e9) | ||
bun publish v1.1.45-canary.20250118T140543 (ca7428e9) | ||
@@ -13,0 +13,0 @@ packed 203B package.json |
@@ -109,3 +109,3 @@ The `bun` CLI can be used to execute JavaScript/TypeScript files, `package.json` scripts, and [executable packages](https://docs.npmjs.com/cli/v9/configuring-npm/package-json#bin). | ||
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`. | ||
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. | ||
@@ -116,3 +116,3 @@ {% callout %} | ||
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. | ||
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. | ||
@@ -199,1 +199,12 @@ ```bash | ||
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. | ||
## Resolution order | ||
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. | ||
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: | ||
1. package.json scripts, eg `bun run build` | ||
2. Source files, eg `bun run src/main.js` | ||
3. Binaries from project packages, eg `bun add eslint && bun run eslint` | ||
4. (`bun run` only) System commands, eg `bun run ls` |
@@ -5,7 +5,7 @@ --- | ||
To get started, install the canary version of `react` & `react-dom`: | ||
To get started, install `react` & `react-dom`: | ||
```sh | ||
# Any package manager can be used | ||
$ bun add react@canary react-dom@canary | ||
$ bun add react react-dom | ||
``` | ||
@@ -52,2 +52,2 @@ | ||
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. | ||
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. |
@@ -127,7 +127,7 @@ --- | ||
```sh | ||
[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\"}" | ||
[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\"}" | ||
[fetch] > HTTP/1.1 POST https://example.com/ | ||
[fetch] > content-type: application/json | ||
[fetch] > Connection: keep-alive | ||
[fetch] > User-Agent: Bun/bun-v1.1.44 | ||
[fetch] > User-Agent: Bun/1.1.45-canary.20250118T140543 | ||
[fetch] > Accept: */* | ||
@@ -174,3 +174,3 @@ [fetch] > Host: example.com | ||
[fetch] > Connection: keep-alive | ||
[fetch] > User-Agent: Bun/bun-v1.1.44 | ||
[fetch] > User-Agent: Bun/1.1.45-canary.20250118T140543 | ||
[fetch] > Accept: */* | ||
@@ -177,0 +177,0 @@ [fetch] > Host: example.com |
@@ -61,2 +61,6 @@ Every day, Bun gets closer to 100% Node.js API compatibility. Today, popular frameworks like Next.js, Express, and millions of `npm` packages intended for Node just work with Bun. To ensure compatibility, we run thousands of tests from Node.js' test suite before every release of Bun. | ||
### [`node:stream`](https://nodejs.org/api/stream.html) | ||
🟢 Fully implemented. | ||
### [`node:string_decoder`](https://nodejs.org/api/string_decoder.html) | ||
@@ -96,3 +100,3 @@ | ||
🟡 Missing `Certificate` `ECDH` `X509Certificate` `checkPrime` `checkPrimeSync` `diffieHellman` `generatePrime` `generatePrimeSync` `getCipherInfo` `getFips` `hkdf` `hkdfSync` `secureHeapUsed` `setEngine` `setFips` | ||
🟡 Missing `ECDH` `checkPrime` `checkPrimeSync` `generatePrime` `generatePrimeSync` `hkdf` `hkdfSync` `secureHeapUsed` `setEngine` `setFips` | ||
@@ -134,6 +138,2 @@ Some methods are not optimized yet. | ||
### [`node:stream`](https://nodejs.org/api/stream.html) | ||
🟡 Missing `toWeb` | ||
### [`node:sys`](https://nodejs.org/api/util.html) | ||
@@ -140,0 +140,0 @@ |
@@ -58,3 +58,3 @@ Bun's test runner plays well with existing component and DOM testing libraries, including React Testing Library and [`happy-dom`](https://github.com/capricorn86/happy-dom). | ||
$ bun test | ||
bun test vbun-v1.1.44 | ||
bun test v1.1.45-canary.20250118T140543 | ||
@@ -61,0 +61,0 @@ dom.test.ts: |
{ | ||
"version": "1.1.44", | ||
"version": "1.1.45-canary.20250118T140543", | ||
"name": "bun-types", | ||
@@ -4,0 +4,0 @@ "license": "MIT", |
Sorry, the diff of this file is too big to display
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1339583
0.05%13789
0.03%1
Infinity%