MyGit

bun-v0.2.1

oven-sh/bun

版本发布时间: 2022-10-19 14:10:52

oven-sh/bun最新发布版本:bun-v1.1.20(2024-07-13 14:04:45)

To upgrade:

bun upgrade

To install:

curl https://bun.sh/install | bash
If you have any problems upgrading

Run the install script (you can run it multiple times):

curl https://bun.sh/install | bash

WebSocket server

Bun.serve() now has builtin support for websockets on the server

Bun.serve({
  websocket: {
    message(ws, message) {
      ws.send(message);
    },
  },

  fetch(req, server) {
    // Upgrade to a ServerWebSocket if we can
    // This automatically checks for the `Sec-WebSocket-Key` header
    // meaning you don't have to check headers, you can just call `upgrade()`
    if (server.upgrade(req))
      // When upgrading, we return undefined since we don't want to send a Response
      return;

    return new Response("Regular HTTP response");
  },
});

For more information about using websockets with Bun.serve(), see the readme

For a chat room on Linux:

image

To reproduce this benchmark on your own computer, go here

Bun's server-side websockets are powered by uWebSockets.

RegExp lookbehinds assertions fix

To address #314, Bun now includes a fallback RegExp implementation that uses the Oniguruma regex engine. Thanks to @dylan-conway!

RegExp lookbehind assertions are used by popular npm packages like Discord.js

When a RegExp literal with a lookbehind is used inside Bun's runtime, Bun's transpiler now automatically replaces it with a Bun.OnigurumaRegExp. This API isn't intended to be used outside of the transpiler and will be removed once JavaScriptCore lands native support.

When run inside Bun's JavaScript runtime, this input:

export default /\d+(?=%)/;

Transpiles to:

export default (new globalThis.Bun.OnigurumaRegExp("\\d+(?=%)"));

The RegExp polyfill is largely based on JavaScriptCore's own JSC::RegExp bindings.

More stuff

Full Changelog: https://github.com/oven-sh/bun/compare/bun-v0.2.0...bun-v0.2.1

相关地址:原始地址 下载(tar) 下载(zip)

1、 bun-darwin-aarch64-profile.zip 14.77MB

2、 bun-darwin-aarch64.zip 13.88MB

3、 bun-darwin-x64-baseline-profile.zip 17.19MB

4、 bun-darwin-x64-baseline.zip 16.27MB

5、 bun-darwin-x64-profile.zip 17.55MB

6、 bun-darwin-x64.zip 16.63MB

7、 bun-linux-aarch64-profile.zip 52.05MB

8、 bun-linux-aarch64.zip 30.18MB

9、 bun-linux-x64-baseline-profile.zip 52.74MB

10、 bun-linux-x64-baseline.zip 32.14MB

11、 bun-linux-x64-profile.zip 53.24MB

12、 bun-linux-x64.zip 32.53MB

查看:2022-10-19发行的版本