bun-types 1.2.4-canary.20250225T140609 → 1.2.4-canary.20250226T140704

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
@@ -5780,8 +5780,10 @@ declare module "bun" {
5780
5780
  * },
5781
5781
  * });
5782
5782
  * ```
5783
+ *
5784
+ * @returns `this` for method chaining
5783
5785
  */
5784
- onStart(callback: OnStartCallback): void;
5786
+ onStart(callback: OnStartCallback): this;
5785
5787
  onBeforeParse(
5786
5788
  constraints: PluginConstraints,
5787
5789
  callback: {
@@ -5789,7 +5791,7 @@ declare module "bun" {
5789
5791
  symbol: string;
5790
5792
  external?: unknown | undefined;
5791
5793
  },
5792
- ): void;
5794
+ ): this;
5793
5795
  /**
5794
5796
  * Register a callback to load imports with a specific import specifier
5795
5797
  * @param constraints The constraints to apply the plugin to
@@ -5804,8 +5806,10 @@ declare module "bun" {
5804
5806
  * },
5805
5807
  * });
5806
5808
  * ```
5809
+ *
5810
+ * @returns `this` for method chaining
5807
5811
  */
5808
- onLoad(constraints: PluginConstraints, callback: OnLoadCallback): void;
5812
+ onLoad(constraints: PluginConstraints, callback: OnLoadCallback): this;
5809
5813
  /**
5810
5814
  * Register a callback to resolve imports matching a filter and/or namespace
5811
5815
  * @param constraints The constraints to apply the plugin to
@@ -5820,11 +5824,13 @@ declare module "bun" {
5820
5824
  * },
5821
5825
  * });
5822
5826
  * ```
5827
+ *
5828
+ * @returns `this` for method chaining
5823
5829
  */
5824
5830
  onResolve(
5825
5831
  constraints: PluginConstraints,
5826
5832
  callback: OnResolveCallback,
5827
- ): void;
5833
+ ): this;
5828
5834
  /**
5829
5835
  * The config object passed to `Bun.build` as is. Can be mutated.
5830
5836
  */
@@ -5855,11 +5861,13 @@ declare module "bun" {
5855
5861
  * const { foo } = require("hello:world");
5856
5862
  * console.log(foo); // "bar"
5857
5863
  * ```
5864
+ *
5865
+ * @returns `this` for method chaining
5858
5866
  */
5859
5867
  module(
5860
5868
  specifier: string,
5861
5869
  callback: () => OnLoadResult | Promise<OnLoadResult>,
5862
- ): void;
5870
+ ): this;
5863
5871
  }
5864
5872
 
5865
5873
  interface BunPlugin {
package/docs/api/fetch.md CHANGED
@@ -337,7 +337,7 @@ This will print the request and response headers to your terminal:
337
337
  ```sh
338
338
  [fetch] > HTTP/1.1 GET http://example.com/
339
339
  [fetch] > Connection: keep-alive
340
- [fetch] > User-Agent: Bun/1.2.4-canary.20250225T140609
340
+ [fetch] > User-Agent: Bun/1.2.4-canary.20250226T140704
341
341
  [fetch] > Accept: */*
342
342
  [fetch] > Host: example.com
343
343
  [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); // => "1.2.4-canary.20250225T140609"
113
+ console.log(text); // => "1.2.4-canary.20250226T140704"
114
114
  ```
115
115
 
116
116
  Configure the output stream by passing one of the following values to `stdout/stderr`:
@@ -75,14 +75,16 @@ bun build --compile --target=bun-darwin-x64 ./path/to/my/app.ts --outfile myapp
75
75
 
76
76
  The order of the `--target` flag does not matter, as long as they're delimited by a `-`.
77
77
 
78
- | --target | Operating System | Architecture | Modern | Baseline |
79
- | --------------------- | ---------------- | ------------ | ------ | -------- |
80
- | bun-linux-x64 | Linux | x64 | ✅ | ✅ |
81
- | bun-linux-arm64 | Linux | arm64 | ✅ | N/A |
82
- | bun-windows-x64 | Windows | x64 | ✅ | ✅ |
83
- | ~~bun-windows-arm64~~ | Windows | arm64 | ❌ | ❌ |
84
- | bun-darwin-x64 | macOS | x64 | ✅ | ✅ |
85
- | bun-darwin-arm64 | macOS | arm64 | ✅ | N/A |
78
+ | --target | Operating System | Architecture | Modern | Baseline | Libc |
79
+ | --------------------- | ---------------- | ------------ | ------ | -------- | ----- |
80
+ | bun-linux-x64 | Linux | x64 | ✅ | ✅ | glibc |
81
+ | bun-linux-arm64 | Linux | arm64 | ✅ | N/A | glibc |
82
+ | bun-windows-x64 | Windows | x64 | ✅ | ✅ | - |
83
+ | ~~bun-windows-arm64~~ | Windows | arm64 | ❌ | ❌ | - |
84
+ | bun-darwin-x64 | macOS | x64 | ✅ | ✅ | - |
85
+ | bun-darwin-arm64 | macOS | arm64 | ✅ | N/A | - |
86
+ | bun-linux-x64-musl | Linux | x64 | ✅ | ✅ | musl |
87
+ | bun-linux-arm64-musl | Linux | arm64 | ✅ | N/A | musl |
86
88
 
87
89
  On x64 platforms, Bun uses SIMD optimizations which require a modern CPU supporting AVX2 instructions. The `-baseline` build of Bun is for older CPUs that don't support these optimizations. Normally, when you install Bun we automatically detect which version to use but this can be harder to do when cross-compiling since you might not know the target CPU. You usually don't need to worry about it on Darwin x64, but it is relevant for Windows x64 and Linux x64. If you or your users see `"Illegal instruction"` errors, you might need to use the baseline version.
88
90
 
@@ -294,6 +296,55 @@ These flags currently cannot be used when cross-compiling because they depend on
294
296
 
295
297
  {% /callout %}
296
298
 
299
+ ## Code signing on macOS
300
+
301
+ To codesign a standalone executable on macOS (which fixes Gatekeeper warnings), use the `codesign` command.
302
+
303
+ ```sh
304
+ $ codesign --deep --force -vvvv --sign "XXXXXXXXXX" ./myapp
305
+ ```
306
+
307
+ We recommend including an `entitlements.plist` file with JIT permissions.
308
+
309
+ ```xml#entitlements.plist
310
+ <?xml version="1.0" encoding="UTF-8"?>
311
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
312
+ <plist version="1.0">
313
+ <dict>
314
+ <key>com.apple.security.cs.allow-jit</key>
315
+ <true/>
316
+ <key>com.apple.security.cs.allow-unsigned-executable-memory</key>
317
+ <true/>
318
+ <key>com.apple.security.cs.disable-executable-page-protection</key>
319
+ <true/>
320
+ <key>com.apple.security.cs.allow-dyld-environment-variables</key>
321
+ <true/>
322
+ <key>com.apple.security.cs.disable-library-validation</key>
323
+ <true/>
324
+ </dict>
325
+ </plist>
326
+ ```
327
+
328
+ To codesign with JIT support, pass the `--entitlements` flag to `codesign`.
329
+
330
+ ```sh
331
+ $ codesign --deep --force -vvvv --sign "XXXXXXXXXX" --entitlements entitlements.plist ./myapp
332
+ ```
333
+
334
+ After codesigning, verify the executable:
335
+
336
+ ```sh
337
+ $ codesign -vvv --verify ./myapp
338
+ ./myapp: valid on disk
339
+ ./myapp: satisfies its Designated Requirement
340
+ ```
341
+
342
+ {% callout %}
343
+
344
+ Codesign support requires Bun v1.2.4 or newer.
345
+
346
+ {% /callout %}
347
+
297
348
  ## Unsupported CLI arguments
298
349
 
299
350
  Currently, the `--compile` flag can only accept a single entrypoint at a time and does not support the following flags:
package/docs/cli/pm.md CHANGED
@@ -12,9 +12,12 @@ Options for the `pack` command:
12
12
 
13
13
  - `--dry-run`: Perform all tasks except writing the tarball to disk.
14
14
  - `--destination`: Specify the directory where the tarball will be saved.
15
+ - `--filename`: Specify an exact file name for the tarball to be saved at.
15
16
  - `--ignore-scripts`: Skip running pre/postpack and prepare scripts.
16
17
  - `--gzip-level`: Set a custom compression level for gzip, ranging from 0 to 9 (default is 9).
17
18
 
19
+ > Note `--filename` and `--destination` cannot be used at the same time
20
+
18
21
  ## bin
19
22
 
20
23
  To print the path to the `bin` directory for the local project:
@@ -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 v1.2.4-canary.20250225T140609 (ca7428e9)
10
+ bun publish v1.2.4-canary.20250226T140704 (ca7428e9)
11
11
 
12
12
  packed 203B package.json
13
13
  packed 224B README.md
@@ -9,7 +9,7 @@ $ bunx nuxi init my-nuxt-app
9
9
  ✔ Which package manager would you like to use?
10
10
  bun
11
11
  ◐ Installing dependencies...
12
- bun install v1.2.4-canary.20250225T140609 (16b4bf34)
12
+ bun install v1.2.4-canary.20250226T140704 (16b4bf34)
13
13
  + @nuxt/devtools@0.8.2
14
14
  + nuxt@3.7.0
15
15
  785 packages installed [2.67s]
@@ -16,7 +16,7 @@ This will add the package to `peerDependencies` in `package.json`.
16
16
  ```json-diff
17
17
  {
18
18
  "peerDependencies": {
19
- + "@types/bun": "^1.2.4-canary.20250225T140609"
19
+ + "@types/bun": "^1.2.4-canary.20250226T140704"
20
20
  }
21
21
  }
22
22
  ```
@@ -28,7 +28,7 @@ Running `bun install` will install peer dependencies by default, unless marked o
28
28
  ```json-diff
29
29
  {
30
30
  "peerDependencies": {
31
- "@types/bun": "^1.2.4-canary.20250225T140609"
31
+ "@types/bun": "^1.2.4-canary.20250226T140704"
32
32
  },
33
33
  "peerDependenciesMeta": {
34
34
  + "@types/bun": {
@@ -97,7 +97,7 @@ $ bun update
97
97
  $ bun update @types/bun --latest
98
98
 
99
99
  # Update a dependency to a specific version
100
- $ bun update @types/bun@1.2.4-canary.20250225T140609
100
+ $ bun update @types/bun@1.2.4-canary.20250226T140704
101
101
 
102
102
  # Update all dependencies to the latest versions
103
103
  $ bun update --latest
@@ -0,0 +1,56 @@
1
+ ---
2
+ name: Codesign a single-file JavaScript executable on macOS
3
+ description: Fix the "can't be opened because it is from an unidentified developer" Gatekeeper warning when running your JavaScript executable.
4
+ ---
5
+
6
+ Compile your executable using the `--compile` flag.
7
+
8
+ ```sh
9
+ $ bun build --compile ./path/to/entry.ts --outfile myapp
10
+ ```
11
+
12
+ ---
13
+
14
+ List your available signing identities. One of these will be your signing identity that you pass to the `codesign` command. This command requires macOS.
15
+
16
+ ```sh
17
+ $ security find-identity -v -p codesigning
18
+ 1. XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX "Developer ID Application: Your Name (ZZZZZZZZZZ)"
19
+ 1 valid identities found
20
+ ```
21
+
22
+ ---
23
+
24
+ Optional, but recommended: create an `entitlements.plist` file with the necessary permissions for the JavaScript engine to work correctly.
25
+
26
+ ```xml#entitlements.plist
27
+ <?xml version="1.0" encoding="UTF-8"?>
28
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
29
+ <plist version="1.0">
30
+ <dict>
31
+ <key>com.apple.security.cs.allow-jit</key>
32
+ <true/>
33
+ <key>com.apple.security.cs.allow-unsigned-executable-memory</key>
34
+ <true/>
35
+ <key>com.apple.security.cs.disable-executable-page-protection</key>
36
+ <true/>
37
+ <key>com.apple.security.cs.allow-dyld-environment-variables</key>
38
+ <true/>
39
+ <key>com.apple.security.cs.disable-library-validation</key>
40
+ <true/>
41
+ </dict>
42
+ </plist>
43
+ ```
44
+
45
+ ---
46
+
47
+ Sign your executable using the `codesign` command and verify it works.
48
+
49
+ ```bash
50
+ $ codesign --entitlements entitlements.plist -vvvv --deep --sign "XXXXXXXXXX" ./myapp --force
51
+ $ codesign -vvv --verify ./myapp
52
+ ```
53
+
54
+ ---
55
+
56
+ For more information on macOS codesigning, refer to [Apple's Code Signing documentation](https://developer.apple.com/documentation/security/code_signing_services). For details about creating single-file executables with Bun, see [Standalone Executables](/docs/bundler/executables). This guide requires Bun v1.2.4 or newer.
@@ -21,7 +21,7 @@ Here's what the output of a typical test run looks like. In this case, there are
21
21
 
22
22
  ```sh
23
23
  $ bun test
24
- bun test v1.2.4-canary.20250225T140609 (9c68abdb)
24
+ bun test v1.2.4-canary.20250226T140704 (9c68abdb)
25
25
 
26
26
  test.test.js:
27
27
  ✓ add [0.87ms]
@@ -47,7 +47,7 @@ To only run certain test files, pass a positional argument to `bun test`. The ru
47
47
 
48
48
  ```sh
49
49
  $ bun test test3
50
- bun test v1.2.4-canary.20250225T140609 (9c68abdb)
50
+ bun test v1.2.4-canary.20250226T140704 (9c68abdb)
51
51
 
52
52
  test3.test.js:
53
53
  ✓ add [1.40ms]
@@ -85,7 +85,7 @@ Adding `-t add` will only run tests with "add" in the name. This works with test
85
85
 
86
86
  ```sh
87
87
  $ bun test -t add
88
- bun test v1.2.4-canary.20250225T140609 (9c68abdb)
88
+ bun test v1.2.4-canary.20250226T140704 (9c68abdb)
89
89
 
90
90
  test.test.js:
91
91
  ✓ add [1.79ms]
@@ -18,7 +18,7 @@ The first time this test is executed, Bun will evaluate the value passed into `e
18
18
 
19
19
  ```sh
20
20
  $ bun test test/snap
21
- bun test v1.2.4-canary.20250225T140609 (9c68abdb)
21
+ bun test v1.2.4-canary.20250226T140704 (9c68abdb)
22
22
 
23
23
  test/snap.test.ts:
24
24
  ✓ snapshot [1.48ms]
@@ -61,7 +61,7 @@ Later, when this test file is executed again, Bun will read the snapshot file an
61
61
 
62
62
  ```sh
63
63
  $ bun test
64
- bun test v1.2.4-canary.20250225T140609 (9c68abdb)
64
+ bun test v1.2.4-canary.20250226T140704 (9c68abdb)
65
65
 
66
66
  test/snap.test.ts:
67
67
  ✓ snapshot [1.05ms]
@@ -78,7 +78,7 @@ To update snapshots, use the `--update-snapshots` flag.
78
78
 
79
79
  ```sh
80
80
  $ bun test --update-snapshots
81
- bun test v1.2.4-canary.20250225T140609 (9c68abdb)
81
+ bun test v1.2.4-canary.20250226T140704 (9c68abdb)
82
82
 
83
83
  test/snap.test.ts:
84
84
  ✓ snapshot [0.86ms]
@@ -29,7 +29,7 @@ To regenerate snapshots, use the `--update-snapshots` flag.
29
29
 
30
30
  ```sh
31
31
  $ bun test --update-snapshots
32
- bun test v1.2.4-canary.20250225T140609 (9c68abdb)
32
+ bun test v1.2.4-canary.20250226T140704 (9c68abdb)
33
33
 
34
34
  test/snap.test.ts:
35
35
  ✓ snapshot [0.86ms]
@@ -5,7 +5,7 @@ name: Get the current Bun version
5
5
  Get the current version of Bun in a semver format.
6
6
 
7
7
  ```ts#index.ts
8
- Bun.version; // => "1.2.4-canary.20250225T140609"
8
+ Bun.version; // => "1.2.4-canary.20250226T140704"
9
9
  ```
10
10
 
11
11
  ---
@@ -14,7 +14,7 @@ Kernel version 5.6 or higher is strongly recommended, but the minimum is 5.1. Us
14
14
  ```bash#macOS/Linux_(curl)
15
15
  $ curl -fsSL https://bun.sh/install | bash # for macOS, Linux, and WSL
16
16
  # to install a specific version
17
- $ curl -fsSL https://bun.sh/install | bash -s "bun-v1.2.4-canary.20250225T140609"
17
+ $ curl -fsSL https://bun.sh/install | bash -s "bun-v1.2.4-canary.20250226T140704"
18
18
  ```
19
19
 
20
20
  ```bash#npm
@@ -189,10 +189,10 @@ Since Bun is a single binary, you can install older versions of Bun by re-runnin
189
189
 
190
190
  ### Installing a specific version of Bun on Linux/Mac
191
191
 
192
- To install a specific version of Bun, you can pass the git tag of the version you want to install to the install script, such as `bun-v1.2.0` or `bun-v1.2.4-canary.20250225T140609`.
192
+ To install a specific version of Bun, you can pass the git tag of the version you want to install to the install script, such as `bun-v1.2.0` or `bun-v1.2.4-canary.20250226T140704`.
193
193
 
194
194
  ```sh
195
- $ curl -fsSL https://bun.sh/install | bash -s "bun-v1.2.4-canary.20250225T140609"
195
+ $ curl -fsSL https://bun.sh/install | bash -s "bun-v1.2.4-canary.20250226T140704"
196
196
  ```
197
197
 
198
198
  ### Installing a specific version of Bun on Windows
@@ -201,7 +201,7 @@ On Windows, you can install a specific version of Bun by passing the version num
201
201
 
202
202
  ```sh
203
203
  # PowerShell:
204
- $ iex "& {$(irm https://bun.sh/install.ps1)} -Version 1.2.4-canary.20250225T140609"
204
+ $ iex "& {$(irm https://bun.sh/install.ps1)} -Version 1.2.4-canary.20250226T140704"
205
205
  ```
206
206
 
207
207
  ## Downloading Bun binaries directly
@@ -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/1.2.4-canary.20250225T140609" -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.4-canary.20250226T140704" -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/1.2.4-canary.20250225T140609
131
+ [fetch] > User-Agent: Bun/1.2.4-canary.20250226T140704
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/1.2.4-canary.20250225T140609
173
+ [fetch] > User-Agent: Bun/1.2.4-canary.20250226T140704
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 v1.2.4-canary.20250225T140609
58
+ bun test v1.2.4-canary.20250226T140704
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.4-canary.20250225T140609",
2
+ "version": "1.2.4-canary.20250226T140704",
3
3
  "name": "bun-types",
4
4
  "license": "MIT",
5
5
  "main": "",