New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

bun-types

Package Overview
Dependencies
Maintainers
3
Versions
801
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bun-types - npm Package Compare versions

Comparing version 1.1.44-canary.20250110T140547 to 1.1.44-canary.20250111T140551

8

docs/api/file-io.md

@@ -65,2 +65,10 @@ {% callout %}

### Deleting files (`file.delete()`)
You can delete a file by calling the `.delete()` function.
```ts
await Bun.file("logs.json").delete()
```
## Writing files (`Bun.write()`)

@@ -67,0 +75,0 @@

6

docs/cli/install.md

@@ -18,6 +18,6 @@ The `bun` CLI contains a Node.js-compatible package manager designed to be a dramatically faster replacement for `npm`, `yarn`, and `pnpm`. It's a standalone tool that will work in pre-existing Node.js projects; if your project has a `package.json`, `bun install` can help you speed up your workflow.

# If this returns a version >= 5.6, you don't need to do anything
uname -r
$ uname -r
# Install the official Ubuntu hardware enablement kernel
sudo apt install --install-recommends linux-generic-hwe-20.04
$ sudo apt install --install-recommends linux-generic-hwe-20.04
```

@@ -233,3 +233,3 @@

- name: Install bun
uses: oven-sh/setup-bun@v1
uses: oven-sh/setup-bun@v2
- name: Install dependencies

@@ -236,0 +236,0 @@ run: bun install

@@ -7,6 +7,6 @@ ---

```bash
mkdir my-bot
cd my-bot
bun init
```sh
$ mkdir my-bot
$ cd my-bot
$ bun init
```

@@ -18,4 +18,4 @@

```bash
bun add discord.js
```sh
$ bun add discord.js
```

@@ -72,3 +72,3 @@

```bash
```sh
$ bun run bot.ts

@@ -75,0 +75,0 @@ Ready! Logged in as my-bot#1234

@@ -20,3 +20,3 @@ ---

```bash
```sh
$ bun create hono myapp

@@ -34,3 +34,3 @@ ✔ Which template do you want to use? › bun

```bash
```sh
$ bun run dev

@@ -37,0 +37,0 @@ ```

@@ -11,6 +11,6 @@ ---

```bash
mkdir mongoose-app
cd mongoose-app
bun init
```sh
$ mkdir mongoose-app
$ cd mongoose-app
$ bun init
```

@@ -22,4 +22,4 @@

```bash
bun add mongoose
```sh
$ bun add mongoose
```

@@ -26,0 +26,0 @@

@@ -18,2 +18,4 @@ ---

---
You can specify a starter template using the `--example` flag.

@@ -20,0 +22,0 @@

@@ -19,5 +19,5 @@ ---

```bash
git clone git@github.com:my-github-username/myapp.git
cd myapp
```sh
$ git clone git@github.com:my-github-username/myapp.git
$ cd myapp
```

@@ -29,4 +29,4 @@

```bash
bun add express
```sh
$ bun add express
```

@@ -57,6 +57,6 @@

```bash
git add app.ts bun.lockb package.json
git commit -m "Create simple Express app"
git push origin main
```sh
$ git add app.ts bun.lockb package.json
$ git commit -m "Create simple Express app"
$ git push origin main
```

@@ -63,0 +63,0 @@

@@ -13,4 +13,4 @@ ---

```bash
bun add @sentry/bun
```sh
$ bun add @sentry/bun
```

@@ -17,0 +17,0 @@

@@ -8,3 +8,3 @@ ---

```sh
bun --hot run index.ts
$ bun --hot run index.ts
```

@@ -16,2 +16,6 @@

{% callout %}
Note that this doesn't reload the page on your browser.
{% /callout %}
```ts

@@ -21,5 +25,5 @@ Bun.serve({

fetch(req) {
return new Response(`Hello world`);
return new Response("Hello world");
},
});
```

@@ -5,8 +5,17 @@ ---

To add an npm package as a peer dependency, directly modify the `peerDependencies` object in your package.json. Running `bun install` will install peer dependencies by default, unless marked optional in `peerDependenciesMeta`.
To add an npm package as a peer dependency, use the `--peer` flag.
```sh
$ bun add @types/bun --peer
```
---
This will add the package to `peerDependencies` in `package.json`.
```json-diff
{
"peerDependencies": {
+ "zod": "^3.0.0"
+ "@types/bun": "^1.0.0"
}

@@ -18,2 +27,20 @@ }

Running `bun install` will install peer dependencies by default, unless marked optional in `peerDependenciesMeta`.
```json-diff
{
"peerDependencies": {
"@types/bun": "^1.0.0"
},
"peerDependenciesMeta": {
+ "@types/bun": {
+ "optional": true
+ }
}
}
```
---
See [Docs > Package manager](https://bun.sh/docs/cli/install) for complete documentation of Bun's package manager.

@@ -25,3 +25,3 @@ ---

To "pin" to the `latest` version of the package, use `--exact`. This will add the package to `dependencies` without the `^`, pinning your project to the exact version you installed.
To "pin" to an exact version of the package, use `--exact`. This will add the package to `dependencies` without the `^`, pinning your project to the exact version you installed.

@@ -28,0 +28,0 @@ ```sh

@@ -16,3 +16,3 @@ ---

- uses: actions/checkout@v4
+ - uses: oven-sh/setup-bun@v1
+ - uses: oven-sh/setup-bun@v2

@@ -35,5 +35,5 @@ # run any `bun` or `bunx` command

# ...
- uses: oven-sh/setup-bun@v1
- uses: oven-sh/setup-bun@v2
+ with:
+ version: 0.7.0 # or "canary"
+ version: "latest" # or "canary"
```

@@ -40,0 +40,0 @@

@@ -5,2 +5,8 @@ ---

{% callout %}
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. [**Learn more.**](https://bun.sh/docs/install/lockfile#text-based-lockfile)
{% /callout %}
---
To teach `git` how to generate a human-readable diff of Bun's binary lockfile format (`.lockb`), add the following to your local or global `.gitattributes` file:

@@ -7,0 +13,0 @@

@@ -26,4 +26,2 @@ ---

<!-- Bun maintains an allow-list of popular packages containing `postinstall` scripts that are known to be safe. To run lifecycle scripts for packages that aren't on this list, add the package to `trustedDependencies` in your package.json. -->
```json-diff

@@ -30,0 +28,0 @@ {

@@ -5,2 +5,8 @@ ---

{% callout %}
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. [**Learn more.**](https://bun.sh/docs/install/lockfile#text-based-lockfile)
{% /callout %}
---
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.

@@ -7,0 +13,0 @@

@@ -47,5 +47,7 @@ ---

---
then it outputs
```
```sh
$ bun run cli.ts --flag1 --flag2 value

@@ -52,0 +54,0 @@ {

@@ -7,5 +7,5 @@ ---

```ts
bun --define process.env.NODE_ENV="'production'" src/index.ts # Runtime
bun build --define process.env.NODE_ENV="'production'" src/index.ts # Build
```sh
$ bun --define process.env.NODE_ENV="'production'" src/index.ts # Runtime
$ bun build --define process.env.NODE_ENV="'production'" src/index.ts # Build
```

@@ -29,8 +29,8 @@

```ts
if ("production" === "production") {
console.log("Production mode");
} else {
console.log("Development mode");
}
```ts-diff
+ if ("production" === "production") {
console.log("Production mode");
} else {
console.log("Development mode");
}
```

@@ -44,8 +44,8 @@

```ts
if (true) {
console.log("Production mode");
} else {
console.log("Development mode");
}
```ts-diff
+ if (true) {
console.log("Production mode");
} else {
console.log("Development mode");
}
```

@@ -52,0 +52,0 @@

@@ -5,9 +5,9 @@ ---

To synchronously delete a file with Bun, use the `unlinkSync` function from the [`node:fs`](https://nodejs.org/api/fs.html#fs_fs_unlink_path_callback) module. (Currently, there is no `Bun` API for deleting files.)
The `Bun.file()` function accepts a path and returns a `BunFile` instance. Use the `.delete()` method to delete the file.
```ts
import { unlinkSync } from "node:fs";
const path = "/path/to/file.txt";
const file = Bun.file(path);
const path = "/path/to/file.txt";
unlinkSync(path);
await file.delete();
```

@@ -17,9 +17,2 @@

To remove a file asynchronously, use the `unlink` function from the [`node:fs/promises`](https://nodejs.org/api/fs.html#fs_fspromises_unlink_path) module.
```ts
import { unlink } from "node:fs/promises";
const path = "/path/to/file.txt";
await unlink(path);
```
See [Docs > API > File I/O](https://bun.sh/docs/api/file-io#reading-files-bun-file) for complete documentation of `Bun.file()`.

@@ -18,2 +18,4 @@ All packages downloaded from the registry are stored in a global cache at `~/.bun/install/cache`, or the path defined by the environment variable `BUN_INSTALL_CACHE_DIR`. They are stored in subdirectories named like `${name}@${version}`, so multiple versions of a package can be cached.

{% /details %}
## Minimizing re-downloads

@@ -37,3 +39,3 @@

Since Bun uses hardlinks to "copy" a module into a project's `node_modules` directory on Linux, the contents of the package only exist in a single location on disk, greatly reducing the amount of disk space dedicated to `node_modules`.
Since Bun uses hardlinks to "copy" a module into a project's `node_modules` directory on Linux and Windows, the contents of the package only exist in a single location on disk, greatly reducing the amount of disk space dedicated to `node_modules`.

@@ -45,3 +47,3 @@ This benefit also applies to macOS, but there are exceptions. It uses `clonefile` which is copy-on-write, meaning it will not occupy disk space, but it will count towards drive's limit. This behavior is useful if something attempts to patch `node_modules/*`, so it's impossible to affect other installations.

- **`hardlink`**: Default on Linux.
- **`hardlink`**: Default on Linux and Windows.
- **`clonefile`** Default on macOS.

@@ -48,0 +50,0 @@ - **`clonefile_each_dir`**: Similar to `clonefile`, except it clones each file individually per directory. It is only available on macOS and tends to perform slower than `clonefile`.

@@ -62,3 +62,3 @@ Running `bun install` will create a binary lockfile called `bun.lockb`.

**Note** - using `--lockfile-only` will still populate the global install cache with registry metadata and git/tarball dependencies.
{% endcallout %}
{% /callout %}

@@ -65,0 +65,0 @@ #### Can I opt out?

@@ -33,5 +33,5 @@ Bun reads your `.env` files automatically and provides idiomatic ways to read and write your environment variables programmatically. Plus, some aspects of Bun's runtime behavior can be configured with Bun-specific environment variables.

```sh
bun --env-file=.env.1 src/index.ts
$ bun --env-file=.env.1 src/index.ts
bun --env-file=.env.abc --env-file=.env.def run build
$ bun --env-file=.env.abc --env-file=.env.def run build
```

@@ -38,0 +38,0 @@

@@ -53,3 +53,3 @@ declare namespace HTMLRewriterTypes {

tagName: string;
readonly attributes: IterableIterator<string[]>;
readonly attributes: IterableIterator<[string, string]>;
readonly removed: boolean;

@@ -56,0 +56,0 @@ /** Whether the element is explicitly self-closing, e.g. `<foo />` */

{
"version": "1.1.44-canary.20250110T140547",
"version": "1.1.44-canary.20250111T140551",
"name": "bun-types",

@@ -4,0 +4,0 @@ "license": "MIT",

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc