bun-types 1.1.45 → 1.2.0-canary.20250122T140708

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.
@@ -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"
@@ -1257,30 +1258,6 @@ $ bun build ./index.tsx --outdir ./out --drop=console --drop=debugger --drop=any
1257
1258
 
1258
1259
  {% /codetabs %}
1259
1260
 
1260
- ### `experimentalCss`
1261
-
1262
- Whether to enable _experimental_ support for bundling CSS files. Defaults to `false`. In 1.2, this property will be deleted, and CSS bundling will always be enabled.
1263
-
1264
- This supports bundling CSS files imported from JS, as well as CSS entrypoints.
1265
-
1266
- {% codetabs group="a" %}
1267
-
1268
- ```ts#JavaScript
1269
- const result = await Bun.build({
1270
- entrypoints: ["./index.ts"],
1271
- experimentalCss: true,
1272
- });
1273
- // => { success: boolean, outputs: BuildArtifact[], logs: BuildMessage[] }
1274
- ```
1275
-
1276
- {% /codetabs %}
1277
-
1278
- ### `throw`
1279
-
1280
- If set to `true`, `Bun.build` will throw on build failure. See the section ["Logs and Errors"](#logs-and-errors) for more details on the error message structure.
1281
-
1282
- In 1.2, this will default to `true`, with the previous behavior as `throw: false`
1283
-
1284
1261
  ## Outputs
1285
1262
 
1286
1263
  The `Bun.build` function returns a `Promise<BuildOutput>`, defined as:
@@ -1421,7 +1398,8 @@ Refer to [Bundler > Executables](https://bun.sh/docs/bundler/executables) for co
1421
1398
  ## Logs and errors
1422
1399
 
1423
1400
  <!-- 1.2 documentation -->
1424
- <!-- On failure, `Bun.build` returns a rejected promise with an `AggregateError`. This can be logged to the console for pretty printing of the error list, or programmatically read with a `try`/`catch` block.
1401
+
1402
+ On failure, `Bun.build` returns a rejected promise with an `AggregateError`. This can be logged to the console for pretty printing of the error list, or programmatically read with a `try`/`catch` block.
1425
1403
 
1426
1404
  ```ts
1427
1405
  try {
@@ -1481,70 +1459,6 @@ if (result.logs.length > 0) {
1481
1459
  console.warn(message);
1482
1460
  }
1483
1461
  }
1484
- ``` -->
1485
-
1486
- By default, `Bun.build` only throws if invalid options are provided. Read the `success` property to determine if the build was successful; the `logs` property will contain additional details.
1487
-
1488
- ```ts
1489
- const result = await Bun.build({
1490
- entrypoints: ["./index.tsx"],
1491
- outdir: "./out",
1492
- });
1493
-
1494
- if (!result.success) {
1495
- console.error("Build failed");
1496
- for (const message of result.logs) {
1497
- // Bun will pretty print the message object
1498
- console.error(message);
1499
- }
1500
- }
1501
- ```
1502
-
1503
- Each message is either a `BuildMessage` or `ResolveMessage` object, which can be used to trace what problems happened in the build.
1504
-
1505
- ```ts
1506
- class BuildMessage {
1507
- name: string;
1508
- position?: Position;
1509
- message: string;
1510
- level: "error" | "warning" | "info" | "debug" | "verbose";
1511
- }
1512
-
1513
- class ResolveMessage extends BuildMessage {
1514
- code: string;
1515
- referrer: string;
1516
- specifier: string;
1517
- importKind: ImportKind;
1518
- }
1519
- ```
1520
-
1521
- If you want to throw an error from a failed build, consider passing the logs to an `AggregateError`. If uncaught, Bun will pretty-print the contained messages nicely.
1522
-
1523
- ```ts
1524
- if (!result.success) {
1525
- throw new AggregateError(result.logs, "Build failed");
1526
- }
1527
- ```
1528
-
1529
- In Bun 1.2, throwing an aggregate error like this will become the default beahavior. You can opt-into it early using the `throw: true` option.
1530
-
1531
- ```ts
1532
- try {
1533
- const result = await Bun.build({
1534
- entrypoints: ["./index.tsx"],
1535
- outdir: "./out",
1536
- });
1537
- } catch (e) {
1538
- // TypeScript does not allow annotations on the catch clause
1539
- const error = e as AggregateError;
1540
- console.error("Build Failed");
1541
-
1542
- // Example: Using the built-in formatter
1543
- console.error(error);
1544
-
1545
- // Example: Serializing the failure as a JSON string.
1546
- console.error(JSON.stringify(error, null, 2));
1547
- }
1548
1462
  ```
1549
1463
 
1550
1464
  ## Reference
@@ -1645,13 +1559,6 @@ interface BuildConfig {
1645
1559
  */
1646
1560
  footer?: string;
1647
1561
 
1648
- /**
1649
- * **Experimental**
1650
- *
1651
- * Enable CSS support.
1652
- */
1653
- experimentalCss?: boolean;
1654
-
1655
1562
  /**
1656
1563
  * Drop function calls to matching property accesses.
1657
1564
  */
@@ -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`.
@@ -207,13 +194,6 @@ Otherwise, the database to embed is copied into the `outdir` with a hashed filen
207
194
 
208
195
  **HTML loader**. Default for `.html` after Bun v1.2.0.
209
196
 
210
- To enable the html loader:
211
-
212
- - For `Bun.build`: set `html: true`
213
- - For `bun build`: `--experimental-html` CLI flag
214
-
215
- You most likely want to use the `html` loader in conjunction with `experimentalCss: true` or `--experimental-css`.
216
-
217
197
  The html loader processes HTML files and bundles any referenced assets. It will:
218
198
 
219
199
  - Bundle and hash referenced JavaScript files (`<script src="...">`)
@@ -95,7 +95,7 @@ disableManifest = false
95
95
  [install.lockfile]
96
96
 
97
97
  # Print a yarn v1 lockfile
98
- # Note: it does not load the lockfile, it just converts bun.lockb into a yarn.lock
98
+ # Note: it does not load the lockfile, it just converts bun.lock into a yarn.lock
99
99
  print = "yarn"
100
100
 
101
101
  # Save the lockfile to disk
@@ -170,9 +170,9 @@ Bun stores installed packages from npm in `~/.bun/install/cache/${name}@${versio
170
170
 
171
171
  When the `node_modules` folder exists, before installing, Bun checks if the `"name"` and `"version"` in `package/package.json` in the expected node_modules folder matches the expected `name` and `version`. This is how it determines whether it should install. It uses a custom JSON parser which stops parsing as soon as it finds `"name"` and `"version"`.
172
172
 
173
- When a `bun.lockb` doesn’t exist or `package.json` has changed dependencies, tarballs are downloaded & extracted eagerly while resolving.
173
+ When a `bun.lock` doesn’t exist or `package.json` has changed dependencies, tarballs are downloaded & extracted eagerly while resolving.
174
174
 
175
- When a `bun.lockb` exists and `package.json` hasn’t changed, Bun downloads missing dependencies lazily. If the package with a matching `name` & `version` already exists in the expected location within `node_modules`, Bun won’t attempt to download the tarball.
175
+ When a `bun.lock` exists and `package.json` hasn’t changed, Bun downloads missing dependencies lazily. If the package with a matching `name` & `version` already exists in the expected location within `node_modules`, Bun won’t attempt to download the tarball.
176
176
 
177
177
  ## Platform-specific dependencies?
178
178
 
@@ -184,23 +184,9 @@ Peer dependencies are handled similarly to yarn. `bun install` will automaticall
184
184
 
185
185
  ## Lockfile
186
186
 
187
- `bun.lockb` is Bun’s binary lockfile format.
187
+ `bun.lock` is Bun’s lockfile format. See [our blogpost about the text lockfile](https://bun.sh/blog/bun-lock-text-lockfile).
188
188
 
189
- ## Why is it binary?
190
-
191
- In a word: Performance. Bun’s lockfile saves & loads incredibly quickly, and saves a lot more data than what is typically inside lockfiles.
192
-
193
- ## How do I inspect it?
194
-
195
- For now, the easiest thing is to run `bun install -y`. That prints a Yarn v1-style yarn.lock file.
196
-
197
- ## What does the lockfile store?
198
-
199
- Packages, metadata for those packages, the hoisted install order, dependencies for each package, what packages those dependencies resolved to, an integrity hash (if available), what each package was resolved to and which version (or equivalent).
200
-
201
- ## Why is it fast?
202
-
203
- It uses linear arrays for all data. [Packages](https://github.com/oven-sh/bun/blob/be03fc273a487ac402f19ad897778d74b6d72963/src/install/install.zig#L1825) are referenced by an auto-incrementing integer ID or a hash of the package name. Strings longer than 8 characters are de-duplicated. Prior to saving on disk, the lockfile is garbage-collected & made deterministic by walking the package tree and cloning the packages in dependency order.
189
+ Prior to Bun 1.2, the lockfile was binary and called `bun.lockb`. Old lockfiles can be upgraded to the new format by running `bun install --save-text-lockfile --frozen-lockfile --lockfile-only`, and then deleting `bun.lockb`.
204
190
 
205
191
  ## Cache
206
192
 
@@ -33,7 +33,7 @@ Running `bun install` will:
33
33
 
34
34
  - **Install** all `dependencies`, `devDependencies`, and `optionalDependencies`. Bun will install `peerDependencies` by default.
35
35
  - **Run** your project's `{pre|post}install` and `{pre|post}prepare` scripts at the appropriate time. For security reasons Bun _does not execute_ lifecycle scripts of installed dependencies.
36
- - **Write** a `bun.lockb` lockfile to the project root.
36
+ - **Write** a `bun.lock` lockfile to the project root.
37
37
 
38
38
  ## Logging
39
39
 
@@ -136,13 +136,13 @@ To install in production mode (i.e. without `devDependencies` or `optionalDepend
136
136
  $ bun install --production
137
137
  ```
138
138
 
139
- For reproducible installs, use `--frozen-lockfile`. This will install the exact versions of each package specified in the lockfile. If your `package.json` disagrees with `bun.lockb`, Bun will exit with an error. The lockfile will not be updated.
139
+ For reproducible installs, use `--frozen-lockfile`. This will install the exact versions of each package specified in the lockfile. If your `package.json` disagrees with `bun.lock`, Bun will exit with an error. The lockfile will not be updated.
140
140
 
141
141
  ```bash
142
142
  $ bun install --frozen-lockfile
143
143
  ```
144
144
 
145
- For more information on Bun's binary lockfile `bun.lockb`, refer to [Package manager > Lockfile](https://bun.sh/docs/install/lockfile).
145
+ For more information on Bun's lockfile `bun.lock`, refer to [Package manager > Lockfile](https://bun.sh/docs/install/lockfile).
146
146
 
147
147
  ## Omitting dependencies
148
148
 
@@ -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.45 (ca7428e9)
10
+ bun publish v1.2.0-canary.20250122T140708 (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`
@@ -22,12 +22,12 @@ WORKDIR /usr/src/app
22
22
  # this will cache them and speed up future builds
23
23
  FROM base AS install
24
24
  RUN mkdir -p /temp/dev
25
- COPY package.json bun.lockb /temp/dev/
25
+ COPY package.json bun.lock /temp/dev/
26
26
  RUN cd /temp/dev && bun install --frozen-lockfile
27
27
 
28
28
  # install with --production (exclude devDependencies)
29
29
  RUN mkdir -p /temp/prod
30
- COPY package.json bun.lockb /temp/prod/
30
+ COPY package.json bun.lock /temp/prod/
31
31
  RUN cd /temp/prod && bun install --frozen-lockfile --production
32
32
 
33
33
  # copy node_modules from temp directory
@@ -53,7 +53,7 @@ app.listen(port, () => {
53
53
  Commit your changes and push to GitHub.
54
54
 
55
55
  ```sh
56
- $ git add app.ts bun.lockb package.json
56
+ $ git add app.ts bun.lock package.json
57
57
  $ git commit -m "Create simple Express app"
58
58
  $ git push origin main
59
59
  ```
@@ -7,7 +7,7 @@ name: Migrate from npm install to bun install
7
7
  We've put a lot of work into making sure that the migration path from `npm install` to `bun install` is as easy as running `bun install` instead of `npm install`.
8
8
 
9
9
  - **Designed for Node.js & Bun**: `bun install` installs a Node.js compatible `node_modules` folder. You can use it in place of `npm install` for Node.js projects without any code changes and without using Bun's runtime.
10
- - **Automatically converts `package-lock.json`** to bun's `bun.lockb` lockfile format, preserving your existing resolved dependency versions without any manual work on your part. You can secretly use `bun install` in place of `npm install` at work without anyone noticing.
10
+ - **Automatically converts `package-lock.json`** to bun's `bun.lock` lockfile format, preserving your existing resolved dependency versions without any manual work on your part. You can secretly use `bun install` in place of `npm install` at work without anyone noticing.
11
11
  - **`.npmrc` compatible**: bun install reads npm registry configuration from npm's `.npmrc`, so you can use the same configuration for both npm and Bun.
12
12
  - **Hardlinks**: On Windows and Linux, `bun install` uses hardlinks to conserve disk space and install times.
13
13
 
@@ -37,7 +37,7 @@ Once this is added, run a fresh install. Bun will re-install your dependencies a
37
37
 
38
38
  ```sh
39
39
  $ rm -rf node_modules
40
- $ rm bun.lockb
40
+ $ rm bun.lock
41
41
  $ bun install
42
42
  ```
43
43
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: Generate a human-readable lockfile
2
+ name: Generate a yarn-compatible lockfile
3
3
  ---
4
4
 
5
5
  {% callout %}
@@ -8,11 +8,7 @@ Bun v1.1.39 introduced `bun.lock`, a JSONC formatted lockfile. `bun.lock` is hum
8
8
 
9
9
  ---
10
10
 
11
- By default Bun generates a binary `bun.lockb` file when you run `bun install`. In some cases, it's preferable to generate a human-readable lockfile instead.
12
-
13
- ---
14
-
15
- Use the `--yarn` flag to generate a Yarn-compatible `yarn.lock` file (in addition to `bun.lockb`).
11
+ Use the `--yarn` flag to generate a Yarn-compatible `yarn.lock` file (in addition to `bun.lock`).
16
12
 
17
13
  ```sh
18
14
  $ bun install --yarn
@@ -29,7 +25,7 @@ print = "yarn"
29
25
 
30
26
  ---
31
27
 
32
- To print a Yarn lockfile to your console without writing it to disk, just "run" your `bun.lockb` with `bun`.
28
+ To print a Yarn lockfile to your console without writing it to disk, "run" your `bun.lockb` with `bun`.
33
29
 
34
30
  ```sh
35
31
  $ bun bun.lockb
@@ -41,7 +41,7 @@ Running `bun install` will:
41
41
 
42
42
  - **Install** all `dependencies`, `devDependencies`, and `optionalDependencies`. Bun will install `peerDependencies` by default.
43
43
  - **Run** your project's `{pre|post}install` scripts at the appropriate time. For security reasons Bun _does not execute_ lifecycle scripts of installed dependencies.
44
- - **Write** a `bun.lockb` lockfile to the project root.
44
+ - **Write** a `bun.lock` lockfile to the project root.
45
45
 
46
46
  To install in production mode (i.e. without `devDependencies`):
47
47
 
@@ -1,53 +1,10 @@
1
- Running `bun install` will create a binary lockfile called `bun.lockb`.
1
+ Running `bun install` will create a lockfile called `bun.lock`.
2
2
 
3
- #### Why is it binary?
3
+ https://bun.sh/blog/bun-lock-text-lockfile
4
4
 
5
- In a word: Performance. Bun’s lockfile saves & loads incredibly quickly, and saves a lot more data than what is typically inside lockfiles.
5
+ #### Should it be committed to git?
6
6
 
7
- #### How do I inspect Bun's lockfile?
8
-
9
- Run `bun install -y` to generate a Yarn-compatible `yarn.lock` (v1) that can be inspected more easily.
10
-
11
- #### How do I `git diff` Bun's lockfile?
12
-
13
- Add the following to your local or global `.gitattributes` file:
14
-
15
- ```
16
- *.lockb binary diff=lockb
17
- ```
18
-
19
- Then add the following to your local git config with:
20
-
21
- ```sh
22
- $ git config diff.lockb.textconv bun
23
- $ git config diff.lockb.binary true
24
- ```
25
-
26
- Or to your global git config (system-wide) with the `--global` option:
27
-
28
- ```sh
29
- $ git config --global diff.lockb.textconv bun
30
- $ git config --global diff.lockb.binary true
31
- ```
32
-
33
- **Why this works:**
34
-
35
- - `textconv` tells git to run `bun` on the file before diffing
36
- - `binary` tells git to treat the file as binary (so it doesn't try to diff it line-by-line)
37
-
38
- Running `bun` on a lockfile will print a human-readable diff. So we just need to tell `git` to run `bun` on the lockfile before diffing it.
39
-
40
- #### Platform-specific dependencies?
41
-
42
- Bun stores normalized `cpu` and `os` values from npm in the lockfile, along with the resolved packages. It skips downloading, extracting, and installing packages disabled for the current target at runtime. This means the lockfile won’t change between platforms/architectures even if the packages ultimately installed do change.
43
-
44
- #### What does Bun's lockfile store?
45
-
46
- Packages, metadata for those packages, the hoisted install order, dependencies for each package, what packages those dependencies resolved to, an integrity hash (if available), what each package was resolved to, and which version (or equivalent).
47
-
48
- #### Why is Bun's lockfile fast?
49
-
50
- It uses linear arrays for all data. [Packages](https://github.com/oven-sh/bun/blob/be03fc273a487ac402f19ad897778d74b6d72963/src/install/install.zig#L1825) are referenced by an auto-incrementing integer ID or a hash of the package name. Strings longer than 8 characters are de-duplicated. Prior to saving on disk, the lockfile is garbage-collected & made deterministic by walking the package tree and cloning the packages in dependency order.
7
+ Yes
51
8
 
52
9
  #### Generate a lockfile without installing?
53
10
 
@@ -69,7 +26,7 @@ To install without creating a lockfile:
69
26
  $ bun install --no-save
70
27
  ```
71
28
 
72
- To install a Yarn lockfile _in addition_ to `bun.lockb`.
29
+ To install a Yarn lockfile _in addition_ to `bun.lock`.
73
30
 
74
31
  {% codetabs %}
75
32
 
@@ -79,42 +36,15 @@ $ bun install --yarn
79
36
 
80
37
  ```toml#bunfig.toml
81
38
  [install.lockfile]
82
- # whether to save a non-Bun lockfile alongside bun.lockb
39
+ # whether to save a non-Bun lockfile alongside bun.lock
83
40
  # only "yarn" is supported
84
41
  print = "yarn"
85
42
  ```
86
43
 
87
44
  {% /codetabs %}
88
45
 
89
- ### Text-based lockfile
90
-
91
- Bun v1.1.39 introduced `bun.lock`, a JSONC formatted lockfile. `bun.lock` is human-readable and git-diffable without configuration, at [no cost to performance](https://bun.sh/blog/bun-lock-text-lockfile#cached-bun-install-gets-30-faster).
92
-
93
- To generate the lockfile, use `--save-text-lockfile` with `bun install`. You can do this for new projects and existing projects already using `bun.lockb` (resolutions will be preserved).
94
-
95
- ```bash
96
- $ bun install --save-text-lockfile
97
- $ head -n3 bun.lock
98
- {
99
- "lockfileVersion": 0,
100
- "workspaces": {
101
- ```
102
-
103
- Once `bun.lock` is generated, Bun will use it for all subsequent installs and updates through commands that read and modify the lockfile. If both lockfiles exist, `bun.lock` will be chosen over `bun.lockb`.
46
+ #### Text-based lockfile
104
47
 
105
- Bun v1.2.0 will switch the default lockfile format to `bun.lock`.
106
-
107
- {% details summary="Configuring lockfile" %}
108
-
109
- ```toml
110
- [install.lockfile]
111
-
112
- # whether to save the lockfile to disk
113
- save = true
114
-
115
- # whether to save a non-Bun lockfile alongside bun.lockb
116
- # only "yarn" is supported
117
- print = "yarn"
118
- ```
48
+ Bun v1.2 changed the default lockfile format to the text-based `bun.lock`. Existing binary `bun.lockb` lockfiles can be migrated to the new format by running `bun install --save-text-lockfile --frozen-lockfile --lockfile-only` and deleting `bun.lockb`.
119
49
 
120
- {% /details %}
50
+ More information about the new lockfile format can be found on [our blogpost](https://bun.sh/blog/bun-lock-text-lockfile).
@@ -6,7 +6,7 @@ It's common for a monorepo to have the following structure:
6
6
  tree
7
7
  <root>
8
8
  ├── README.md
9
- ├── bun.lockb
9
+ ├── bun.lock
10
10
  ├── package.json
11
11
  ├── tsconfig.json
12
12
  └── packages
@@ -14,7 +14,7 @@ The first time you run this script, Bun will auto-install `"foo"` and cache it.
14
14
 
15
15
  To determine which version to install, Bun follows the following algorithm:
16
16
 
17
- 1. Check for a `bun.lockb` file in the project root. If it exists, use the version specified in the lockfile.
17
+ 1. Check for a `bun.lock` file in the project root. If it exists, use the version specified in the lockfile.
18
18
  2. Otherwise, scan up the tree for a `package.json` that includes `"foo"` as a dependency. If found, use the specified semver version or version range.
19
19
  3. Otherwise, use `latest`.
20
20
 
@@ -240,13 +240,13 @@ exact = false
240
240
 
241
241
  ### `install.saveTextLockfile`
242
242
 
243
- Generate `bun.lock`, a human-readable text-based lockfile. Once generated, Bun will use this file instead of `bun.lockb`, choosing it over the binary lockfile if both are present.
243
+ If false, generate a binary `bun.lockb` instead of a text-based `bun.lock` file when running `bun install` and no lockfile is present.
244
244
 
245
- Default `false`. In Bun v1.2.0 the default lockfile format will change to `bun.lock`.
245
+ Default `true` (since Bun v1.2).
246
246
 
247
247
  ```toml
248
248
  [install]
249
- saveTextLockfile = true
249
+ saveTextLockfile = false
250
250
  ```
251
251
 
252
252
  <!--
@@ -315,7 +315,7 @@ Valid values are:
315
315
 
316
316
  ### `install.frozenLockfile`
317
317
 
318
- When true, `bun install` will not update `bun.lockb`. Default `false`. If `package.json` and the existing `bun.lockb` are not in agreement, this will error.
318
+ When true, `bun install` will not update `bun.lock`. Default `false`. If `package.json` and the existing `bun.lock` are not in agreement, this will error.
319
319
 
320
320
  ```toml
321
321
  [install]
@@ -423,7 +423,7 @@ Whether to generate a lockfile on `bun install`. Default `true`.
423
423
  save = true
424
424
  ```
425
425
 
426
- Whether to generate a non-Bun lockfile alongside `bun.lockb`. (A `bun.lockb` will always be created.) Currently `"yarn"` is the only supported value.
426
+ Whether to generate a non-Bun lockfile alongside `bun.lock`. (A `bun.lock` will always be created.) Currently `"yarn"` is the only supported value.
427
427
 
428
428
  ```toml
429
429
  [install.lockfile]
@@ -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.45" -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.0-canary.20250122T140708" -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.45
131
+ [fetch] > User-Agent: Bun/1.2.0-canary.20250122T140708
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.45
173
+ [fetch] > User-Agent: Bun/1.2.0-canary.20250122T140708
174
174
  [fetch] > Accept: */*
175
175
  [fetch] > Host: example.com
176
176
  [fetch] > Accept-Encoding: gzip, deflate, br
@@ -258,7 +258,6 @@ await Bun.build({
258
258
  conditions: ["react-server"],
259
259
  target: "bun",
260
260
  entryPoints: ["./app/foo/route.js"],
261
- throw: true,
262
261
  });
263
262
  ```
264
263
 
@@ -18,6 +18,10 @@ This page is updated regularly to reflect compatibility status of the latest ver
18
18
 
19
19
  🟢 Fully implemented.
20
20
 
21
+ ### [`node:dgram`](https://nodejs.org/api/dgram.html)
22
+
23
+ 🟢 Fully implemented. > 90% of Node.js's test suite passes.
24
+
21
25
  ### [`node:diagnostics_channel`](https://nodejs.org/api/diagnostics_channel.html)
22
26
 
23
27
  🟢 Fully implemented.
@@ -30,6 +34,10 @@ This page is updated regularly to reflect compatibility status of the latest ver
30
34
 
31
35
  🟢 Fully implemented. `EventEmitterAsyncResource` uses `AsyncResource` underneath. 100% of Node.js's test suite for EventEmitter passes.
32
36
 
37
+ ### [`node:fs`](https://nodejs.org/api/fs.html)
38
+
39
+ 🟢 Fully implemented. 92% of Node.js's test suite passes.
40
+
33
41
  ### [`node:http`](https://nodejs.org/api/http.html)
34
42
 
35
43
  🟢 Fully implemented. Outgoing client request body is currently buffered instead of streamed.
@@ -58,6 +66,10 @@ This page is updated regularly to reflect compatibility status of the latest ver
58
66
 
59
67
  🟢 Fully implemented.
60
68
 
69
+ ### [`node:stream`](https://nodejs.org/api/stream.html)
70
+
71
+ 🟢 Fully implemented.
72
+
61
73
  ### [`node:string_decoder`](https://nodejs.org/api/string_decoder.html)
62
74
 
63
75
  🟢 Fully implemented. 100% of Node.js's test suite passes.
@@ -80,7 +92,7 @@ This page is updated regularly to reflect compatibility status of the latest ver
80
92
 
81
93
  ### [`node:async_hooks`](https://nodejs.org/api/async_hooks.html)
82
94
 
83
- 🟡 `AsyncLocalStorage`, and `AsyncResource` are implemented. `AsyncResource` is missing `bind`. v8 hooks are stubbed.
95
+ 🟡 `AsyncLocalStorage`, and `AsyncResource` are implemented. v8 promise hooks are not called, and its usage is [strongly discouraged](https://nodejs.org/docs/latest/api/async_hooks.html#async-hooks).
84
96
 
85
97
  ### [`node:child_process`](https://nodejs.org/api/child_process.html)
86
98
 
@@ -92,23 +104,14 @@ This page is updated regularly to reflect compatibility status of the latest ver
92
104
 
93
105
  ### [`node:crypto`](https://nodejs.org/api/crypto.html)
94
106
 
95
- 🟡 Missing `Certificate` `ECDH` `X509Certificate` `checkPrime` `checkPrimeSync` `diffieHellman` `generatePrime` `generatePrimeSync` `getCipherInfo` `getFips` `hkdf` `hkdfSync` `secureHeapUsed` `setEngine` `setFips`
107
+ 🟡 Missing `ECDH` `checkPrime` `checkPrimeSync` `generatePrime` `generatePrimeSync` `hkdf` `hkdfSync` `secureHeapUsed` `setEngine` `setFips`
96
108
 
97
109
  Some methods are not optimized yet.
98
110
 
99
- ### [`node:dgram`](https://nodejs.org/api/dgram.html)
100
-
101
- 🟡 Missing `setBroadcast` `setTTL` `setMulticastTTL` `setMulticastLoopback` `setMulticastInterface` `addMembership` `dropMembership`
102
- `addSourceSpecificMembership` `dropSourceSpecificMembership`
103
-
104
111
  ### [`node:domain`](https://nodejs.org/api/domain.html)
105
112
 
106
113
  🟡 Missing `Domain` `active`
107
114
 
108
- ### [`node:fs`](https://nodejs.org/api/fs.html)
109
-
110
- 🟡 Missing `statfs` `statfsSync`, `opendirSync`. `Dir` is partially implemented.
111
-
112
115
  ### [`node:http2`](https://nodejs.org/api/http2.html)
113
116
 
114
117
  🟡 Client & server are implemented (95.25% of gRPC's test suite passes). Missing `options.allowHTTP1`, `options.enableConnectProtocol`, ALTSVC extension, and `http2stream.pushStream`.
@@ -129,10 +132,6 @@ Some methods are not optimized yet.
129
132
 
130
133
  🟡 See [`process`](#process) Global.
131
134
 
132
- ### [`node:stream`](https://nodejs.org/api/stream.html)
133
-
134
- 🟡 Missing `toWeb`
135
-
136
135
  ### [`node:sys`](https://nodejs.org/api/util.html)
137
136
 
138
137
  🟡 See [`node:util`](#node-util).