You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please let me know though if it doesn't work and you're on bun v0.0.69. bun v0.0.61 - v0.0.68 had issues with the HTTP client
Highlights:
More reliable bun install: numerous bug fixes to linking, serialization, deserialization, extracting files. It probably works in many projects now. There are still a couple bugs that need to be fixed and git/github dependencies don't work yet
"Copy as markdown" for error messages
Macros can now be used like regular JavaScript, with automatic conversion of primitives & objects to Bun's AST
bun pm hash returns a hash of the resolved all package@version in your lockfile
bun install --global lets you globally install npm packages with bun!
bug fixes to bun dev & bun run
TextEncoder, TextDecoder, process.exit, crypto.randomUUID, crypto.randomBytes are now available in bun.js
setTimeout, setInterval, clearTimeout, clearInterval are stubbed in to bun.js. They do not actually work yet, but at least code that calls it won't error anymore
Better support for Next.js v12.1
# Install a package globally with bun install> bun install -g typescript
# "bun i" is shorthand for bun install> bun i -g typescript
# It symlinks into your $BUN_INSTALL/bin folder> which tsc
/Users/jarred/.bun/bin/tsc
# print the path of the global bin> bun pm -g bin
/Users/jarred/.bun/bin
Lowlights:
Breaking changes to bun install lockfile format change means your next bun install will invalidate existing ones. The changes improve the reliability of saving and loading the lockfile
"Copy as markdown" button for error messages
Before this release, bun dev did not support displaying runtime errors. It only showed errors for build/ssr 🙈
Use macros like regular JavaScript
Now you can move code from runtime to build-time by writing ordinary javascript.
Input:
// This line is removed at build timeimport{weatherIn}from'macro:./weather'// This function call is replaced with the value of `weatherIn(94609)` at build-timeconst{current_condition: [temp_f: degrees]}=weatherIn(94609);exportdefault`It is ${degrees} in Oakland, California`
const{current_condition: [{temp_F: degrees}]}={current_condition: [{temp_F: "42"}]};// once bun gets a minifier, this line would be all that remainsexportdefault`It is ${degrees} in Oakland, California`;
Normally, this 48 KB of JSON would be fetched client-side
Fixed a number of whitespace/formatting bugs with the printer
bun install reliability
This release brings bun install much closer to something you can use daily. It's not there yet, but it is close.
Somewhat controversially, bun install uses a binary lockfile format. One thing several people asked for: a hash. So I added a hash.
> bun pm hash
1A0FF3DFFE05333A-b20fd0e1259d2de5-9E3B657EA8BD4436-9f3132e0eb95a60e
This is a SHA512/256 hash of the following string. The string is created by looping through all the resolved packages in the lockfile, sorting alphabetically, then sorting any packages with multiple duplicate versions.
bun pm is a new subcommand for "miscellaneous package manager things"
> bun pm
bun pm - package manager related commands
bun pm bin print the path to bin folder
bun pm -g bin print the global path to bin folder
bun pm hash generate & print the hash of the current lockfile
bun pm hash-string print the string used to hash the lockfile
bun pm hash-print print the hash stored in the current lockfile
When using bun install -y, the hash is inserted into the saved yarn.lock:
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.# yarn lockfile v1# bun ./bun.lockb --hash: 3982DAEC20B10CF8-4da4f73e6f1d3ab1-77B62BB40B50C631-a7674fe7d3217550
You can now configure bun install with bunfig.toml. it will search for bunfig.toml in $XDG_CONFIG_HOME/bunfig.toml and $HOME/bunfig.toml, in addition to ./bunfig.toml
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
To upgrade:
Having trouble?
Please let me know though if it doesn't work and you're on bun v0.0.69. bun v0.0.61 - v0.0.68 had issues with the HTTP client
Highlights:
bun install
: numerous bug fixes to linking, serialization, deserialization, extracting files. It probably works in many projects now. There are still a couple bugs that need to be fixed andgit
/github
dependencies don't work yetbun pm hash
returns a hash of the resolved all package@version in your lockfilebun install --global
lets you globally install npm packages with bun!TextEncoder
,TextDecoder
,process.exit
,crypto.randomUUID
,crypto.randomBytes
are now available in bun.jssetTimeout
,setInterval
,clearTimeout
,clearInterval
are stubbed in to bun.js. They do not actually work yet, but at least code that calls it won't error anymoreLowlights:
bun install
lockfile format change means your nextbun install
will invalidate existing ones. The changes improve the reliability of saving and loading the lockfile"Copy as markdown" button for error messages
Before this release,
bun dev
did not support displaying runtime errors. It only showed errors for build/ssr 🙈Use macros like regular JavaScript
Now you can move code from runtime to build-time by writing ordinary javascript.
Input:
weather.js:
Output:
Normally, this 48 KB of JSON would be fetched client-side
JavaScript Parser reliability
I ported some of esbuild's tests to bun's testing library and that led to uncovering & fixing some parser bugs
New features
type
inside of import clauses is now supported. This is a TypeScript feature.Import assertions are now parsed by bun. Currently, they're removed from the final output
Fixed a number of whitespace/formatting bugs with the printer
bun install reliability
This release brings
bun install
much closer to something you can use daily. It's not there yet, but it is close.Somewhat controversially,
bun install
uses a binary lockfile format. One thing several people asked for: a hash. So I added a hash.This is a SHA512/256 hash of the following string. The string is created by looping through all the resolved packages in the lockfile, sorting alphabetically, then sorting any packages with multiple duplicate versions.
bun pm
is a new subcommand for "miscellaneous package manager things"When using
bun install -y
, the hash is inserted into the saved yarn.lock:You can now configure
bun install
withbunfig.toml
. it will search forbunfig.toml
in$XDG_CONFIG_HOME/bunfig.toml
and$HOME/bunfig.toml
, in addition to./bunfig.toml
bun install bugfixes
bun run
bun bun
bun dev
Open-in-editor is now implemented
Bun.js
ShadowRealm
supportTextEncoder
andTextDecoder
implementationprocess.exit(exitCode)
is now implementedcrypto.randomUUID
andcrypto.randomBytes()
Other
try running
bun wiptest
in a project that uses jestit'll probably throw a not implemented error, but it might work
This discussion was created from the release bun v0.0.71.
Beta Was this translation helpful? Give feedback.
All reactions