Skip to content

Commit

Permalink
Merge branch 'main' into ffi_doc_update
Browse files Browse the repository at this point in the history
  • Loading branch information
citkane authored Jan 7, 2025
2 parents fce1096 + 7f949bf commit fe1b201
Show file tree
Hide file tree
Showing 350 changed files with 30,775 additions and 15,821 deletions.
2 changes: 1 addition & 1 deletion .lldbinit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
command script import vendor/zig/tools/lldb_pretty_printers.py
# command script import vendor/zig/tools/lldb_pretty_printers.py
command script import vendor/WebKit/Tools/lldb/lldb_webkit.py

# type summary add --summary-string "${var} | inner=${var[0-30]}, source=${var[33-64]}, tag=${var[31-32]}" "unsigned long"
28 changes: 28 additions & 0 deletions .vscode/launch.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Configuring a development environment for Bun can take 10-30 minutes depending on your internet connection and computer speed. You will need ~10GB of free disk space for the repository and build artifacts.

If you are using Windows, please refer to [this guide](/docs/project/building-windows.md)
If you are using Windows, please refer to [this guide](https://bun.sh/docs/project/building-windows)

## Install Dependencies

Expand Down
2 changes: 1 addition & 1 deletion LATEST
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.1.41
1.1.42
Binary file modified bench/bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion bench/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"execa": "^8.0.1",
"fast-glob": "3.3.1",
"fdir": "^6.1.0",
"mitata": "^1.0.10",
"mitata": "^1.0.25",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"string-width": "7.1.0",
Expand Down
27 changes: 27 additions & 0 deletions bench/snippets/byteLength.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { Buffer } from "node:buffer";
import { bench, run } from "../runner.mjs";

const variations = [
["latin1", "hello world"],
["utf16", "hello emoji 🤔"],
];

for (const [label, string] of variations) {
const big = Buffer.alloc(1000000, string).toString();
const small = Buffer.from(string).toString();
const substring = big.slice(0, big.length - 2);

bench(`${substring.length}`, () => {
return Buffer.byteLength(substring, "utf8");
});

bench(`${small.length}`, () => {
return Buffer.byteLength(small);
});

bench(`${big.length}`, () => {
return Buffer.byteLength(big);
});
}

await run();
8 changes: 1 addition & 7 deletions bench/snippets/native-overhead.mjs
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
import { noOpForTesting as noop } from "bun:internal-for-testing";
import { bench, run } from "../runner.mjs";

// These are no-op C++ functions that are exported to JS.
const lazy = globalThis[Symbol.for("Bun.lazy")];
const noop = lazy("noop");
const fn = noop.function;
const regular = noop.functionRegular;
const callback = noop.callback;

bench("C++ callback into JS", () => {
callback(() => {});
});

bench("C++ fn regular", () => {
regular();
});

bench("C++ fn", () => {
fn();
});
Expand Down
37 changes: 37 additions & 0 deletions bench/snippets/node-zlib-brotli.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { bench, run } from "../runner.mjs";
import { brotliCompress, brotliDecompress, createBrotliCompress, createBrotliDecompress } from "node:zlib";
import { promisify } from "node:util";
import { pipeline } from "node:stream/promises";
import { Readable } from "node:stream";
import { readFileSync } from "node:fs";

const brotliCompressAsync = promisify(brotliCompress);
const brotliDecompressAsync = promisify(brotliDecompress);

const testData =
process.argv.length > 2
? readFileSync(process.argv[2])
: Buffer.alloc(1024 * 1024 * 16, "abcdefghijklmnopqrstuvwxyz");
let compressed;

bench("brotli compress", async () => {
compressed = await brotliCompressAsync(testData);
});

bench("brotli decompress", async () => {
await brotliDecompressAsync(compressed);
});

bench("brotli compress stream", async () => {
const source = Readable.from([testData]);
const compress = createBrotliCompress();
await pipeline(source, compress);
});

bench("brotli decompress stream", async () => {
const source = Readable.from([compressed]);
const decompress = createBrotliDecompress();
await pipeline(source, decompress);
});

await run();
1 change: 0 additions & 1 deletion cmake/targets/BuildBun.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,6 @@ file(GLOB BUN_C_SOURCES ${CONFIGURE_DEPENDS}
)

if(WIN32)
list(APPEND BUN_C_SOURCES ${CWD}/src/bun.js/bindings/windows/musl-memmem.c)
list(APPEND BUN_CXX_SOURCES ${CWD}/src/bun.js/bindings/windows/rescle.cpp)
list(APPEND BUN_CXX_SOURCES ${CWD}/src/bun.js/bindings/windows/rescle-binding.cpp)
endif()
Expand Down
2 changes: 1 addition & 1 deletion cmake/tools/SetupWebKit.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ option(WEBKIT_VERSION "The version of WebKit to use")
option(WEBKIT_LOCAL "If a local version of WebKit should be used instead of downloading")

if(NOT WEBKIT_VERSION)
set(WEBKIT_VERSION 3845bf370ff4e9a5c0b96036255142c7904be963)
set(WEBKIT_VERSION e1a802a2287edfe7f4046a9dd8307c8b59f5d816)
endif()

if(WEBKIT_LOCAL)
Expand Down
2 changes: 1 addition & 1 deletion completions/bun.bash
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ _bun_completions() {
GLOBAL_OPTIONS[LONG_OPTIONS]="--use --cwd --bunfile --server-bunfile --config --disable-react-fast-refresh --disable-hmr --env-file --extension-order --jsx-factory --jsx-fragment --extension-order --jsx-factory --jsx-fragment --jsx-import-source --jsx-production --jsx-runtime --main-fields --no-summary --version --platform --public-dir --tsconfig-override --define --external --help --inject --loader --origin --port --dump-environment-variables --dump-limits --disable-bun-js";
GLOBAL_OPTIONS[SHORT_OPTIONS]="-c -v -d -e -h -i -l -u -p";

PACKAGE_OPTIONS[ADD_OPTIONS_LONG]="--development --optional";
PACKAGE_OPTIONS[ADD_OPTIONS_LONG]="--development --optional --peer";
PACKAGE_OPTIONS[ADD_OPTIONS_SHORT]="-d";
PACKAGE_OPTIONS[REMOVE_OPTIONS_LONG]="";
PACKAGE_OPTIONS[REMOVE_OPTIONS_SHORT]="";
Expand Down
2 changes: 2 additions & 0 deletions completions/bun.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ _bun_add_completion() {
'-D[]' \
'--development[]' \
'--optional[Add dependency to "optionalDependencies]' \
'--peer[Add dependency to "peerDependencies]' \
'--exact[Add the exact version instead of the ^range]' &&
ret=0

Expand Down Expand Up @@ -339,6 +340,7 @@ _bun_install_completion() {
'--development[]' \
'-D[]' \
'--optional[Add dependency to "optionalDependencies]' \
'--peer[Add dependency to "peerDependencies]' \
'--exact[Add the exact version instead of the ^range]' &&
ret=0

Expand Down
Loading

0 comments on commit fe1b201

Please sign in to comment.