bun-types 1.2.4-canary.20250224T140621 → 1.2.4
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 +13 -5
- package/docs/api/fetch.md +1 -1
- package/docs/api/http.md +1 -1
- package/docs/api/spawn.md +1 -1
- package/docs/bundler/executables.md +59 -8
- package/docs/cli/pm.md +3 -0
- package/docs/cli/publish.md +1 -1
- package/docs/guides/ecosystem/nuxt.md +1 -1
- package/docs/guides/install/add-peer.md +2 -2
- package/docs/guides/install/from-npm-install-to-bun-install.md +1 -1
- package/docs/guides/runtime/codesign-macos-executable.md +56 -0
- package/docs/guides/runtime/set-env.md +12 -1
- package/docs/guides/test/run-tests.md +3 -3
- package/docs/guides/test/snapshot.md +3 -3
- package/docs/guides/test/update-snapshots.md +1 -1
- package/docs/guides/util/version.md +1 -1
- package/docs/installation.md +4 -4
- package/docs/runtime/debugger.md +3 -3
- package/docs/runtime/env.md +31 -1
- package/docs/test/dom.md +1 -1
- package/package.json +1 -1
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):
|
|
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
|
-
):
|
|
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):
|
|
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
|
-
):
|
|
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
|
-
):
|
|
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/
|
|
340
|
+
[fetch] > User-Agent: Bun/bun-v1.2.4
|
|
341
341
|
[fetch] > Accept: */*
|
|
342
342
|
[fetch] > Host: example.com
|
|
343
343
|
[fetch] > Accept-Encoding: gzip, deflate, br
|
package/docs/api/http.md
CHANGED
|
@@ -418,7 +418,7 @@ export interface Post {
|
|
|
418
418
|
|
|
419
419
|
### Routing performance
|
|
420
420
|
|
|
421
|
-
`Bun.serve()`'s router builds on top uWebSocket's [tree-based approach](https://github.com/oven-sh/bun/blob/0d1a00fa0f7830f8ecd99c027fce8096c9d459b6/packages/bun-uws/src/HttpRouter.h#L57-L64) to add [SIMD-accelerated route parameter decoding](https://github.com/oven-sh/bun/blob/
|
|
421
|
+
`Bun.serve()`'s router builds on top uWebSocket's [tree-based approach](https://github.com/oven-sh/bun/blob/0d1a00fa0f7830f8ecd99c027fce8096c9d459b6/packages/bun-uws/src/HttpRouter.h#L57-L64) to add [SIMD-accelerated route parameter decoding](https://github.com/oven-sh/bun/blob/main/src/bun.js/bindings/decodeURIComponentSIMD.cpp#L21-L271) and [JavaScriptCore structure caching](https://github.com/oven-sh/bun/blob/main/src/bun.js/bindings/ServerRouteList.cpp#L100-L101) to push the performance limits of what modern hardware allows.
|
|
422
422
|
|
|
423
423
|
### `fetch` request handler
|
|
424
424
|
|
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); // => "
|
|
113
|
+
console.log(text); // => "bun-v1.2.4"
|
|
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:
|
package/docs/cli/publish.md
CHANGED
|
@@ -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
|
|
12
|
+
bun install vbun-v1.2.4 (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": "^
|
|
19
|
+
+ "@types/bun": "^bun-v1.2.4"
|
|
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": "^
|
|
31
|
+
"@types/bun": "^bun-v1.2.4"
|
|
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@
|
|
100
|
+
$ bun update @types/bun@bun-v1.2.4
|
|
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.
|
|
@@ -28,10 +28,21 @@ BAR=world
|
|
|
28
28
|
|
|
29
29
|
Variables can also be set via the command line.
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
{% codetabs %}
|
|
32
|
+
|
|
33
|
+
```sh#Linux/macOS
|
|
32
34
|
$ FOO=helloworld bun run dev
|
|
33
35
|
```
|
|
34
36
|
|
|
37
|
+
```sh#Windows
|
|
38
|
+
# Using CMD
|
|
39
|
+
$ set FOO=helloworld && bun run dev
|
|
40
|
+
|
|
41
|
+
# Using PowerShell
|
|
42
|
+
$ $env:FOO="helloworld"; bun run dev
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
{% /codetabs %}
|
|
35
46
|
---
|
|
36
47
|
|
|
37
48
|
See [Docs > Runtime > Environment variables](https://bun.sh/docs/runtime/env) for more information on using environment variables with Bun.
|
|
@@ -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
|
|
24
|
+
bun test vbun-v1.2.4 (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
|
|
50
|
+
bun test vbun-v1.2.4 (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
|
|
88
|
+
bun test vbun-v1.2.4 (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
|
|
21
|
+
bun test vbun-v1.2.4 (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
|
|
64
|
+
bun test vbun-v1.2.4 (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
|
|
81
|
+
bun test vbun-v1.2.4 (9c68abdb)
|
|
82
82
|
|
|
83
83
|
test/snap.test.ts:
|
|
84
84
|
✓ snapshot [0.86ms]
|
package/docs/installation.md
CHANGED
|
@@ -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
|
|
17
|
+
$ curl -fsSL https://bun.sh/install | bash -s "bun-vbun-v1.2.4"
|
|
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
|
|
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-vbun-v1.2.4`.
|
|
193
193
|
|
|
194
194
|
```sh
|
|
195
|
-
$ curl -fsSL https://bun.sh/install | bash -s "bun-v1.2.4
|
|
195
|
+
$ curl -fsSL https://bun.sh/install | bash -s "bun-vbun-v1.2.4"
|
|
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
|
|
204
|
+
$ iex "& {$(irm https://bun.sh/install.ps1)} -Version bun-v1.2.4"
|
|
205
205
|
```
|
|
206
206
|
|
|
207
207
|
## Downloading Bun binaries directly
|
package/docs/runtime/debugger.md
CHANGED
|
@@ -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/
|
|
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.2.4" -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/
|
|
131
|
+
[fetch] > User-Agent: Bun/bun-v1.2.4
|
|
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/
|
|
173
|
+
[fetch] > User-Agent: Bun/bun-v1.2.4
|
|
174
174
|
[fetch] > Accept: */*
|
|
175
175
|
[fetch] > Host: example.com
|
|
176
176
|
[fetch] > Accept-Encoding: gzip, deflate, br
|
package/docs/runtime/env.md
CHANGED
|
@@ -15,10 +15,40 @@ BAR=world
|
|
|
15
15
|
|
|
16
16
|
Variables can also be set via the command line.
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
{% codetabs %}
|
|
19
|
+
|
|
20
|
+
```sh#Linux/macOS
|
|
19
21
|
$ FOO=helloworld bun run dev
|
|
20
22
|
```
|
|
21
23
|
|
|
24
|
+
```sh#Windows
|
|
25
|
+
# Using CMD
|
|
26
|
+
$ set FOO=helloworld && bun run dev
|
|
27
|
+
|
|
28
|
+
# Using PowerShell
|
|
29
|
+
$ $env:FOO="helloworld"; bun run dev
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
{% /codetabs %}
|
|
33
|
+
|
|
34
|
+
{% details summary="Cross-platform solution with Windows" %}
|
|
35
|
+
|
|
36
|
+
For a cross-platform solution, you can use [bun shell](https://bun.sh/docs/runtime/shell). For example, the `bun exec` command.
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
$ bun exec 'FOO=helloworld bun run dev'
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
On Windows, `package.json` scripts called with `bun run` will automatically use the **bun shell**, making the following also cross-platform.
|
|
43
|
+
|
|
44
|
+
```json#package.json
|
|
45
|
+
"scripts": {
|
|
46
|
+
"dev": "NODE_ENV=development bun --watch app.ts",
|
|
47
|
+
},
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
{% /details %}
|
|
51
|
+
|
|
22
52
|
Or programmatically by assigning a property to `process.env`.
|
|
23
53
|
|
|
24
54
|
```ts
|
package/docs/test/dom.md
CHANGED
package/package.json
CHANGED