MyGit

bun-v0.0.69

oven-sh/bun

版本发布时间: 2022-02-07 07:06:24

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

To upgrade:

bun upgrade

# If you run into problems, try this instead:
curl https://bun.sh/install | bash

bun v0.0.69

Highlights:

HTTPS client

I rewrote the TLS part of bun's https client to match Chromium's behavior.

This fixes many bugs:

bunfig.toml

bunfig.toml is bun's configuration file.

Everything in it is optional. You don't need a bunfig.toml to use bun, this exists so you don't have to pass flags to the CLI each time.

Options specific to bun install will be added in a future release.

# Set a default framework to use
# By default, bun will look for an npm package like `bun-framework-${framework}`, followed by `${framework}`
framework = "next"
logLevel = "debug"

# publicDir = "public"
# external = ["jquery"]

[macros]
# Remap any import like this:
#     import {graphql} from 'react-relay';
# To:
#     import {graphql} from 'macro:bun-macro-relay';
react-relay = { "graphql" = "bun-macro-relay" }

[bundle]
saveTo = "node_modules.bun"
# Don't need this if `framework` is set, but showing it here as an example anyway
entryPoints = ["./app/index.ts"]

[bundle.packages]
# If you're bundling packages that do not actually live in a `node_modules` folder or do not have the full package name in the file path, you can pass this 
"@bigapp/design-system" = true

[dev]
# Change the default port from 3000 to 5000
port = 5000

[define]
# Replace any usage of "process.env.bagel" with the string `lox`. 
# The values are parsed as JSON, except single-quoted strings are supported and `'undefined'` becomes `undefined` in JS.
# This will probably change in a future release to be just regular TOML instead. It is a holdover from the CLI argument parsing.
"process.env.bagel" = "'lox'"

[loaders]
# When loading a .bagel file, run the JS parser
".bagel" = "js"

TOML imports

bun now has a custom TOML 1.0 parser, which means you can import .toml files from bun.

Note that parsing dates/timestamps is not implemented yet.

import config from 'my-config-file.toml';

console.assert(config.hi === "hello");
hi = "hello"

A future version might support importing top-level properties instead of only default. I think supporting both ways would be a better DX.

bun dev

This release improves using bun for static sites. bun dev now automatically looks for .html files in the same folder as code. Previously, .html files needed to be in either public or static

You no longer need to install the react-refresh npm package to use React Fast Refresh with bun. bun embeds it into bun's binary and automatically enables it if resolving "react" (or otherwise, the JSX import source) is successful

bun sets a default favicon so you can more easily see which tab is your dev server: image

Path module

bun.js gets native support for Node's path module. This is a performance improvement, but it's also good for consistency & reliability. It means that resolving file paths in JavaScript is consistent with native code.

// Any of these work
import * as path from "node:path";
import * as path from "path";
const path = require("path");

As part of that work, a bug was fixed when generating relative file paths where, in some cases, it would cut off the first letter if the destination file path did not have any folders in common with the from file path


Misc:

Thanks to:

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

1、 bun-darwin-aarch64.dSYM.tar.gz 15.7MB

2、 bun-darwin-aarch64.zip 10.07MB

3、 bun-darwin-x64.dSYM.tar.gz 112.85MB

4、 bun-darwin-x64.zip 11.77MB

5、 bun-linux-x64.zip 23.8MB

查看:2022-02-07发行的版本