Compare commits

..

1 Commits

Author SHA1 Message Date
Meghan Denny
978443fa41 fix fs.test.ts 2024-08-23 22:29:31 -07:00
829 changed files with 7088 additions and 15426 deletions

View File

@@ -52,11 +52,4 @@ for name in bun bun-profile; do
run_command mv "$name" "$dir/$name"
run_command zip -r "$dir.zip" "$dir"
source "$cwd/.buildkite/scripts/upload-artifact.sh" "$dir.zip"
# temporary disable this so CI can run
# this is failing because $name is now in $dir/$name and if changed to $dir/$name we get ENOENT reading "bun:internal-for-testing"
# if [ "$name" == "bun-profile" ]; then
# export BUN_FEATURE_FLAG_INTERNAL_FOR_TESTING="1"
# run_command "./$name" -e "require('fs').writeFileSync('./features.json', JSON.stringify(require('bun:internal-for-testing').crash_handler.getFeatureData()))"
# source "$cwd/.buildkite/scripts/upload-artifact.sh" "features.json"
# fi
done

View File

@@ -42,7 +42,7 @@ runs:
canary) release="canary";;
*) release="bun-v${{ inputs.bun-version }}";;
esac
curl -LO "${{ inputs.download-url }}/${release}/${target}.zip" --retry 5
curl -LO "${{ inputs.download-url }}/${release}/${target}.zip"
unzip ${target}.zip
mkdir -p ${{ runner.temp }}/.bun/bin
mv ${target}/bun* ${{ runner.temp }}/.bun/bin/

View File

@@ -1,29 +0,0 @@
name: format
permissions:
contents: write
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'workflow_dispatch' && inputs.run-id || github.ref }}
cancel-in-progress: true
on:
workflow_dispatch:
inputs:
run-id:
type: string
description: The workflow ID to download artifacts (skips the build step)
pull_request:
types: [opened, synchronize, reopened]
paths:
- "**.{ts,js,json,md,toml,yml,yaml,tsx,jsx,zig,cjs,mjs}"
jobs:
format:
name: Run format
uses: ./.github/workflows/run-format.yml
secrets: inherit
permissions:
contents: write
with:
zig-version: 0.13.0

View File

@@ -7,42 +7,6 @@ on:
types: [labeled]
jobs:
# on-bug:
# runs-on: ubuntu-latest
# if: github.event.label.name == 'bug' || github.event.label.name == 'crash'
# permissions:
# issues: write
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# with:
# sparse-checkout: |
# scripts
# .github
# CMakeLists.txt
# - name: Setup Bun
# uses: ./.github/actions/setup-bun
# with:
# bun-version: "1.1.24"
# - name: "categorize bug"
# id: add-labels
# env:
# GITHUB_ISSUE_BODY: ${{ github.event.issue.body }}
# GITHUB_ISSUE_TITLE: ${{ github.event.issue.title }}
# ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
# shell: bash
# run: |
# echo '{"dependencies": { "@anthropic-ai/sdk": "latest" }}' > scripts/package.json && bun install --cwd=./scripts
# LABELS=$(bun scripts/label-issue.ts)
# echo "labels=$LABELS" >> $GITHUB_OUTPUT
# - name: Add labels
# uses: actions-cool/issues-helper@v3
# if: steps.add-labels.outputs.labels != ''
# with:
# actions: "add-labels"
# token: ${{ secrets.GITHUB_TOKEN }}
# issue-number: ${{ github.event.issue.number }}
# labels: ${{ steps.add-labels.outputs.labels }}
on-labeled:
runs-on: ubuntu-latest
if: github.event.label.name == 'crash' || github.event.label.name == 'needs repro'

View File

@@ -88,9 +88,6 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# To workaround issue
ref: main
- name: Setup Bun
uses: ./.github/actions/setup-bun
with:

View File

@@ -14,25 +14,22 @@ jobs:
format:
name: Format
runs-on: ubuntu-latest
if: ${{ github.ref != 'refs/heads/main' }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
sparse-checkout: |
.prettierrc-ci
.github
src
scripts
packages
test
bench
package.json
bun.lockb
.vscode
- name: Setup Bun
uses: ./.github/actions/setup-bun
with:
bun-version: "1.1.25"
bun-version: "1.1.20"
- name: Setup Zig
uses: mlugg/setup-zig@v1
with:
@@ -46,6 +43,9 @@ jobs:
- name: Format Zig
run: |
bun fmt:zig
- name: Generate submodule versions
run: |
bash ./scripts/write-versions.sh
- name: Commit
uses: stefanzweifel/git-auto-commit-action@v5
with:

View File

@@ -5,6 +5,3 @@ test/js/deno
test/node.js
src/react-refresh.js
*.min.js
test/js/node/test/fixtures
test/js/node/test/common
test/snippets

View File

@@ -1,31 +0,0 @@
{
"arrowParens": "avoid",
"printWidth": 120,
"trailingComma": "all",
"useTabs": false,
"quoteProps": "preserve",
"plugins": [
"prettier-plugin-organize-imports"
],
"overrides": [
{
"files": [
".vscode/*.json"
],
"options": {
"parser": "jsonc",
"quoteProps": "preserve",
"singleQuote": false,
"trailingComma": "all"
}
},
{
"files": [
"*.md"
],
"options": {
"printWidth": 80
}
}
]
}

View File

@@ -3,8 +3,8 @@ cmake_policy(SET CMP0091 NEW)
cmake_policy(SET CMP0067 NEW)
set(CMAKE_POLICY_DEFAULT_CMP0069 NEW)
set(Bun_VERSION "1.1.27")
set(WEBKIT_TAG 147ed53838e21525677492c27099567a6cd19c6b)
set(Bun_VERSION "1.1.26")
set(WEBKIT_TAG 21fc366db3de8f30dbb7f5997b9b9f5cf422ff1e)
set(BUN_WORKDIR "${CMAKE_CURRENT_BINARY_DIR}")
message(STATUS "Configuring Bun ${Bun_VERSION} in ${BUN_WORKDIR}")

View File

@@ -63,7 +63,7 @@ Bun requires LLVM 16 (`clang` is part of LLVM). This version requirement is to m
{% codetabs %}
```bash#macOS (Homebrew)
$ brew install llvm@18
$ brew install llvm@16
```
```bash#Ubuntu/Debian

2
LATEST
View File

@@ -1 +1 @@
1.1.26
1.1.25

View File

@@ -366,7 +366,7 @@ ifeq ($(OS_NAME),linux)
endif
ifeq ($(OS_NAME),darwin)
MACOS_MIN_FLAG=-mmacos-version-min=$(MIN_MACOS_VERSION)
MACOS_MIN_FLAG=-mmacosx-version-min=$(MIN_MACOS_VERSION)
POSIX_PKG_MANAGER=brew
INCLUDE_DIRS += $(MAC_INCLUDE_DIRS)
endif

View File

@@ -24,6 +24,8 @@
## What is Bun?
> **Bun is under active development.** Use it to speed up your development workflows or run simpler production code in resource-constrained environments like serverless functions. We're working on more complete Node.js compatibility and integration with existing frameworks. Join the [Discord](https://bun.sh/discord) and watch the [GitHub repository](https://github.com/oven-sh/bun) to keep tabs on future releases.
Bun is an all-in-one toolkit for JavaScript and TypeScript apps. It ships as a single executable called `bun`.
At its core is the _Bun runtime_, a fast JavaScript runtime designed as a drop-in replacement for Node.js. It's written in Zig and powered by JavaScriptCore under the hood, dramatically reducing startup times and memory usage.
@@ -85,19 +87,16 @@ bun upgrade --canary
## Quick links
- Intro
- [What is Bun?](https://bun.sh/docs/index)
- [Installation](https://bun.sh/docs/installation)
- [Quickstart](https://bun.sh/docs/quickstart)
- [TypeScript](https://bun.sh/docs/typescript)
- Templating
- [`bun init`](https://bun.sh/docs/cli/init)
- [`bun create`](https://bun.sh/docs/cli/bun-create)
- Runtime
- [`bun run`](https://bun.sh/docs/cli/run)
- [File types](https://bun.sh/docs/runtime/loaders)
- [TypeScript](https://bun.sh/docs/runtime/typescript)
@@ -116,7 +115,6 @@ bun upgrade --canary
- [Framework API](https://bun.sh/docs/runtime/framework)
- Package manager
- [`bun install`](https://bun.sh/docs/cli/install)
- [`bun add`](https://bun.sh/docs/cli/add)
- [`bun remove`](https://bun.sh/docs/cli/remove)
@@ -132,7 +130,6 @@ bun upgrade --canary
- [Overrides and resolutions](https://bun.sh/docs/install/overrides)
- Bundler
- [`Bun.build`](https://bun.sh/docs/bundler)
- [Loaders](https://bun.sh/docs/bundler/loaders)
- [Plugins](https://bun.sh/docs/bundler/plugins)
@@ -140,7 +137,6 @@ bun upgrade --canary
- [vs esbuild](https://bun.sh/docs/bundler/vs-esbuild)
- Test runner
- [`bun test`](https://bun.sh/docs/cli/test)
- [Writing tests](https://bun.sh/docs/test/writing)
- [Watch mode](https://bun.sh/docs/test/hot)
@@ -152,11 +148,9 @@ bun upgrade --canary
- [Code coverage](https://bun.sh/docs/test/coverage)
- Package runner
- [`bunx`](https://bun.sh/docs/cli/bunx)
- API
- [HTTP server](https://bun.sh/docs/api/http)
- [WebSockets](https://bun.sh/docs/api/websockets)
- [Workers](https://bun.sh/docs/api/workers)
@@ -189,10 +183,9 @@ bun upgrade --canary
- [Building Windows](https://bun.sh/docs/project/building-windows)
- [License](https://bun.sh/docs/project/licensing)
## Guides
- Binary
## Guides
- Binary
- [Convert a Blob to a DataView](https://bun.sh/guides/binary/blob-to-dataview)
- [Convert a Blob to a ReadableStream](https://bun.sh/guides/binary/blob-to-stream)
- [Convert a Blob to a string](https://bun.sh/guides/binary/blob-to-string)
@@ -216,8 +209,7 @@ bun upgrade --canary
- [Convert an ArrayBuffer to a Uint8Array](https://bun.sh/guides/binary/arraybuffer-to-typedarray)
- [Convert an ArrayBuffer to an array of numbers](https://bun.sh/guides/binary/arraybuffer-to-array)
- Ecosystem
- Ecosystem
- [Build a frontend using Vite and Bun](https://bun.sh/guides/ecosystem/vite)
- [Build an app with Astro and Bun](https://bun.sh/guides/ecosystem/astro)
- [Build an app with Next.js and Bun](https://bun.sh/guides/ecosystem/nextjs)
@@ -244,8 +236,7 @@ bun upgrade --canary
- [Use React and JSX](https://bun.sh/guides/ecosystem/react)
- [Add Sentry to a Bun app](https://bun.sh/guides/ecosystem/sentry)
- HTTP
- HTTP
- [Common HTTP server usage](https://bun.sh/guides/http/server)
- [Configure TLS on an HTTP server](https://bun.sh/guides/http/tls)
- [fetch with unix domain sockets in Bun](https://bun.sh/guides/http/fetch-unix)
@@ -259,8 +250,7 @@ bun upgrade --canary
- [Upload files via HTTP using FormData](https://bun.sh/guides/http/file-uploads)
- [Write a simple HTTP server](https://bun.sh/guides/http/simple)
- Install
- Install
- [Add a dependency](https://bun.sh/guides/install/add)
- [Add a development dependency](https://bun.sh/guides/install/add-dev)
- [Add a Git dependency](https://bun.sh/guides/install/add-git)
@@ -278,8 +268,7 @@ bun upgrade --canary
- [Using bun install with an Azure Artifacts npm registry](https://bun.sh/guides/install/azure-artifacts)
- [Using bun install with Artifactory](https://bun.sh/guides/install/jfrog-artifactory)
- Process
- Process
- [Get the process uptime in nanoseconds](https://bun.sh/guides/process/nanoseconds)
- [Listen for CTRL+C](https://bun.sh/guides/process/ctrl-c)
- [Listen to OS signals](https://bun.sh/guides/process/os-signals)
@@ -290,8 +279,7 @@ bun upgrade --canary
- [Spawn a child process](https://bun.sh/guides/process/spawn)
- [Spawn a child process and communicate using IPC](https://bun.sh/guides/process/ipc)
- Read file
- Read file
- [Check if a file exists](https://bun.sh/guides/read-file/exists)
- [Get the MIME type of a file](https://bun.sh/guides/read-file/mime)
- [Read a file as a ReadableStream](https://bun.sh/guides/read-file/stream)
@@ -302,8 +290,7 @@ bun upgrade --canary
- [Read a JSON file](https://bun.sh/guides/read-file/json)
- [Watch a directory for changes](https://bun.sh/guides/read-file/watch)
- Runtime
- Runtime
- [Debugging Bun with the VS Code extension](https://bun.sh/guides/runtime/vscode-debugger)
- [Debugging Bun with the web debugger](https://bun.sh/guides/runtime/web-debugger)
- [Define and replace static globals & constants](https://bun.sh/guides/runtime/define-constant)
@@ -318,8 +305,7 @@ bun upgrade --canary
- [Set a time zone in Bun](https://bun.sh/guides/runtime/timezone)
- [Set environment variables](https://bun.sh/guides/runtime/set-env)
- Streams
- Streams
- [Convert a Node.js Readable to a Blob](https://bun.sh/guides/streams/node-readable-to-blob)
- [Convert a Node.js Readable to a string](https://bun.sh/guides/streams/node-readable-to-string)
- [Convert a Node.js Readable to an ArrayBuffer](https://bun.sh/guides/streams/node-readable-to-arraybuffer)
@@ -332,8 +318,7 @@ bun upgrade --canary
- [Convert a ReadableStream to an ArrayBuffer](https://bun.sh/guides/streams/to-arraybuffer)
- [Convert a ReadableStream to JSON](https://bun.sh/guides/streams/to-json)
- Test
- Test
- [Bail early with the Bun test runner](https://bun.sh/guides/test/bail)
- [Generate code coverage reports with the Bun test runner](https://bun.sh/guides/test/coverage)
- [Mark a test as a "todo" with the Bun test runner](https://bun.sh/guides/test/todo-tests)
@@ -351,8 +336,7 @@ bun upgrade --canary
- [Use snapshot testing in `bun test`](https://bun.sh/guides/test/snapshot)
- [Write browser DOM tests with Bun and happy-dom](https://bun.sh/guides/test/happy-dom)
- Util
- Util
- [Check if the current file is the entrypoint](https://bun.sh/guides/util/entrypoint)
- [Check if two objects are deeply equal](https://bun.sh/guides/util/deep-equals)
- [Compress and decompress data with DEFLATE](https://bun.sh/guides/util/deflate)
@@ -371,14 +355,13 @@ bun upgrade --canary
- [Hash a password](https://bun.sh/guides/util/hash-a-password)
- [Sleep for a fixed number of milliseconds](https://bun.sh/guides/util/sleep)
- WebSocket
- WebSocket
- [Build a publish-subscribe WebSocket server](https://bun.sh/guides/websocket/pubsub)
- [Build a simple WebSocket server](https://bun.sh/guides/websocket/simple)
- [Enable compression for WebSocket messages](https://bun.sh/guides/websocket/compression)
- [Set per-socket contextual data on a WebSocket](https://bun.sh/guides/websocket/context)
- Write file
- Write file
- [Append content to a file](https://bun.sh/guides/write-file/append)
- [Copy a file to another location](https://bun.sh/guides/write-file/file-cp)
- [Delete a file](https://bun.sh/guides/write-file/unlink)

View File

@@ -1,4 +1,4 @@
import { bench, run } from "mitata";
import { run, bench } from "mitata";
bench("sync", () => {});
bench("async", async () => {});

View File

@@ -1,4 +1,4 @@
import { bench, run } from "../node_modules/mitata/src/cli.mjs";
import { run, bench } from "../node_modules/mitata/src/cli.mjs";
bench("sync", () => {});
bench("async", async () => {});

View File

@@ -1,4 +1,4 @@
import { bench, run } from "mitata";
import { run, bench } from "mitata";
bench("sync", () => {});
bench("async", async () => {});

View File

@@ -1,5 +1,5 @@
import { copyFileSync, writeFileSync, readFileSync, statSync } from "node:fs";
import { bench, run } from "mitata";
import { copyFileSync, statSync, writeFileSync } from "node:fs";
function runner(ready) {
for (let size of [1, 10, 100, 1000, 10000, 100000, 1000000, 10000000]) {

View File

@@ -1,27 +0,0 @@
import { expect } from "bun:test";
import { bench, run } from "mitata";
const MAP_SIZE = 10_000;
function* genPairs(count) {
for (let i = 0; i < MAP_SIZE; i++) {
yield ["k" + i, "v" + i];
}
}
class CustomMap extends Map {
abc = 123;
constructor(iterable) {
super(iterable);
}
}
const a = new Map(genPairs());
const b = new Map(genPairs());
bench("deepEqual Map", () => expect(a).toEqual(b));
const x = new CustomMap(genPairs());
const y = new CustomMap(genPairs());
bench("deepEqual CustomMap", () => expect(x).toEqual(y));
await run();

View File

@@ -1,27 +0,0 @@
import { expect } from "bun:test";
import { bench, run } from "mitata";
const SET_SIZE = 10_000;
function* genValues(count) {
for (let i = 0; i < SET_SIZE; i++) {
yield "v" + i;
}
}
class CustomSet extends Set {
abc = 123;
constructor(iterable) {
super(iterable);
}
}
const a = new Set(genValues());
const b = new Set(genValues());
bench("deepEqual Set", () => expect(a).toEqual(b));
const x = new CustomSet(genValues());
const y = new CustomSet(genValues());
bench("deepEqual CustomSet", () => expect(x).toEqual(y));
await run();

View File

@@ -1,3 +1,4 @@
import EventEmitter3 from "eventemitter3";
import { group } from "mitata";
import EventEmitterNative from "node:events";

View File

@@ -1,5 +1,5 @@
// bun:test automatically rewrites this import to bun:test when run in bun
import { expect, test } from "@jest/globals";
import { test, expect } from "@jest/globals";
const N = parseInt(process.env.RUN_COUNT || "10000", 10);
if (!Number.isSafeInteger(N)) {

View File

@@ -1,4 +1,4 @@
import { expect, test } from "vitest";
import { test, expect } from "vitest";
const N = parseInt(process.env.RUN_COUNT || "10000", 10);
if (!Number.isSafeInteger(N)) {

View File

@@ -1,5 +1,5 @@
import { CString, dlopen, ptr } from "bun:ffi";
import { bench, group, run } from "mitata";
import { ptr, dlopen, CString, toBuffer } from "bun:ffi";
import { run, bench, group } from "mitata";
const { napiNoop, napiHash, napiString } = require(import.meta.dir + "/src/ffi_napi_bench.node");

View File

@@ -1,4 +1,4 @@
import { bench, group, run } from "../node_modules/mitata/src/cli.mjs";
import { run, bench, group } from "../node_modules/mitata/src/cli.mjs";
const extension = "darwin" !== Deno.build.os ? "so" : "dylib";
const path = new URL("src/target/release/libffi_napi_bench." + extension, import.meta.url).pathname;

View File

@@ -1,4 +1,4 @@
import { bench, group, run } from "mitata";
import { run, bench, group } from "mitata";
import { createRequire } from "node:module";
const require = createRequire(import.meta.url);

View File

@@ -1,5 +1,5 @@
import braces from "braces";
import { bench, group, run } from "mitata";
import { group, bench, run } from "mitata";
// const iterations = 1000;
const iterations = 100;

View File

@@ -1,6 +1,6 @@
import { run, bench, group } from "mitata";
import fg from "fast-glob";
import { fdir } from "fdir";
import { bench, group, run } from "mitata";
const normalPattern = "*.ts";
const recursivePattern = "**/*.ts";

View File

@@ -1,5 +1,5 @@
import { gunzipSync, gzipSync } from "bun";
import { bench, group, run } from "mitata";
import { run, bench, group } from "mitata";
import { gzipSync, gunzipSync } from "bun";
const data = await Bun.file(require.resolve("@babel/standalone/babel.min.js")).arrayBuffer();

View File

@@ -1,4 +1,4 @@
import { bench, run } from "../node_modules/mitata/src/cli.mjs";
import { run, bench } from "../node_modules/mitata/src/cli.mjs";
const data = new TextEncoder().encode("Hello World!".repeat(9999));

View File

@@ -1,7 +1,7 @@
import { readFileSync } from "fs";
import { bench, run } from "mitata";
import { run, bench } from "mitata";
import { gzipSync, gunzipSync } from "zlib";
import { createRequire } from "module";
import { gunzipSync, gzipSync } from "zlib";
import { readFileSync } from "fs";
const require = createRequire(import.meta.url);
const data = readFileSync(require.resolve("@babel/standalone/babel.min.js"));

View File

@@ -1,5 +1,6 @@
import ReactDOM from "react-dom";
import { Main } from "./main";
import classNames from "classnames";
import ReactDOM from "react-dom";
const Base = ({}) => {
const name = typeof location !== "undefined" ? decodeURIComponent(location.search.substring(1)) : null;

View File

@@ -4,11 +4,11 @@
* For more information, see https://remix.run/docs/en/main/file-conventions/entry.server
*/
import { PassThrough } from "node:stream";
import type { EntryContext } from "@remix-run/node";
import { Response } from "@remix-run/node";
import { RemixServer } from "@remix-run/react";
import isbot from "isbot";
import { PassThrough } from "node:stream";
import { renderToPipeableStream } from "react-dom/server";
const ABORT_DELAY = 5_000;

View File

@@ -1,21 +1,21 @@
import { bench, run } from "mitata";
import {
arch,
cpus,
endianness,
freemem,
arch,
uptime,
networkInterfaces,
getPriority,
totalmem,
freemem,
homedir,
hostname,
loadavg,
networkInterfaces,
platform,
release,
setPriority,
tmpdir,
totalmem,
type,
uptime,
userInfo,
version,
} from "node:os";

View File

@@ -1,21 +1,21 @@
import { bench, run } from "mitata";
import {
arch,
cpus,
endianness,
freemem,
arch,
uptime,
networkInterfaces,
getPriority,
totalmem,
freemem,
homedir,
hostname,
loadavg,
networkInterfaces,
platform,
release,
setPriority,
tmpdir,
totalmem,
type,
uptime,
userInfo,
version,
} from "node:os";

View File

@@ -1,5 +1,5 @@
import * as React from "https://esm.run/react";
import { renderToReadableStream } from "https://esm.run/react-dom/server";
import * as React from "https://esm.run/react";
const App = () => (
<html>

View File

@@ -1,6 +1,6 @@
// react-ssr.tsx
import React from "react";
import { renderToPipeableStream } from "react-dom/server.node";
import React from "react";
const http = require("http");
const App = () => (
<html>

View File

@@ -1,5 +1,5 @@
import type { ActionFunction, LoaderFunction } from "remix";
import { useParams } from "remix";
import type { LoaderFunction, ActionFunction } from "remix";
export const loader: LoaderFunction = async ({ params }) => {
console.log(params.postId);

View File

@@ -1,5 +1,5 @@
import { bench, group, run } from "./runner.mjs";
import * as assert from "assert";
import { bench, run } from "./runner.mjs";
bench("deepEqual", () => {
assert.deepEqual({ foo: "123", bar: "baz" }, { foo: "123", bar: "baz" });

View File

@@ -1,7 +1,7 @@
// @runtime bun,node,deno
import { Buffer } from "node:buffer";
import process from "node:process";
import { bench, run } from "./runner.mjs";
import process from "node:process";
import { Buffer } from "node:buffer";
const N = parseInt(process.env.RUN_COUNTER ?? "10000", 10);
var isBuffer = new Buffer(0);

View File

@@ -1,6 +1,6 @@
import { bench, run } from "./runner.mjs";
import { Buffer } from "node:buffer";
import crypto from "node:crypto";
import { bench, run } from "./runner.mjs";
const bigBuffer = Buffer.from("hello world".repeat(10000));
const converted = bigBuffer.toString("base64");

View File

@@ -1,6 +1,6 @@
import { allocUnsafe } from "bun";
import { readFileSync } from "fs";
import { bench, group, run } from "./runner.mjs";
import { readFileSync } from "fs";
import { allocUnsafe } from "bun";
function polyfill(chunks) {
var size = 0;

View File

@@ -1,6 +1,6 @@
// so it can run in environments without node module resolution
import crypto from "node:crypto";
import { bench, run } from "../node_modules/mitata/src/cli.mjs";
import crypto from "node:crypto";
var foo = new Uint8Array(65536);
bench("crypto.getRandomValues(65536)", () => {
crypto.getRandomValues(foo);

View File

@@ -1,5 +1,5 @@
import fastDeepEquals from "fast-deep-equal/es6/index";
import { bench, group, run } from "./runner.mjs";
import fastDeepEquals from "fast-deep-equal/es6/index";
// const Date = globalThis.Date;
function func1() {}

View File

@@ -1,5 +1,5 @@
import { dns } from "bun";
import { bench, group, run } from "./runner.mjs";
import { bench, run, group } from "./runner.mjs";
async function forEachBackend(name, fn) {
group(name, () => {

View File

@@ -1,4 +1,4 @@
import { bench, run } from "../node_modules/mitata/src/cli.mjs";
import { run, bench } from "../node_modules/mitata/src/cli.mjs";
const encoder = new TextEncoder();

View File

@@ -1,4 +1,7 @@
import { bench, group, run } from "./runner.mjs";
import { group } from "./runner.mjs";
import { bench, run } from "./runner.mjs";
import { encode as htmlEntityEncode } from "html-entities";
import { escape as heEscape } from "he";
var bunEscapeHTML = globalThis.escapeHTML || Bun.escapeHTML;

View File

@@ -1,4 +1,4 @@
import { dlopen } from "bun:ffi";
import { viewSource, dlopen, CString, ptr, toBuffer, toArrayBuffer, FFIType, callback } from "bun:ffi";
import { bench, group, run } from "./runner.mjs";
const types = {

View File

@@ -1,5 +1,5 @@
import { IncomingMessage } from "node:http";
import { bench, run } from "./runner.mjs";
import { IncomingMessage } from "node:http";
const headers = {
date: "Mon, 06 Nov 2023 05:12:49 GMT",

View File

@@ -1,6 +1,6 @@
// @runtime node, bun
import * as vm from "node:vm";
import { bench, run } from "./runner.mjs";
import * as vm from "node:vm";
const context = {
animal: "cat",

View File

@@ -24,7 +24,7 @@ const obj = {
w: 23,
};
import { bench, run } from "./runner.mjs";
import { bench, group, run } from "./runner.mjs";
var val = 0;
bench("Object.values(literal)", () => {

View File

@@ -1,4 +1,4 @@
import { pbkdf2 } from "node:crypto";
import { pbkdf2, pbkdf2Sync } from "node:crypto";
import { bench, run } from "./runner.mjs";

View File

@@ -1,5 +1,5 @@
import { peek } from "bun";
import { bench, run } from "mitata";
import { peek } from "bun";
let pending = Bun.sleep(1000);
let resolved = Promise.resolve(1);

View File

@@ -1,3 +1,4 @@
import { group } from "./runner.mjs";
import { bench, run } from "./runner.mjs";
bench("performance.now x 1000", () => {
for (let i = 0; i < 1000; i++) {

View File

@@ -1,5 +1,5 @@
import { performance } from "perf_hooks";
import { bench, run } from "./runner.mjs";
import { performance } from "perf_hooks";
bench("process.memoryUsage()", () => {
process.memoryUsage();

View File

@@ -1,6 +1,6 @@
import { renderToReadableStream as renderToReadableStreamBun } from "react-dom/server";
import { renderToReadableStream } from "react-dom/server.browser";
import { bench, group, run } from "./runner.mjs";
import { renderToReadableStream } from "react-dom/server.browser";
import { renderToReadableStream as renderToReadableStreamBun } from "react-dom/server";
const App = () => (
<div>

View File

@@ -1,7 +1,7 @@
import { createReadStream, writeFileSync } from "node:fs";
import { tmpdir } from "node:os";
import { bench, group, run } from "./runner.mjs";
import { createReadStream, writeFileSync } from "node:fs";
import { sep } from "node:path";
import { bench, run } from "./runner.mjs";
if (!Promise.withResolvers) {
Promise.withResolvers = function () {

View File

@@ -1,10 +1,10 @@
import { createHash } from "crypto";
import { readdirSync } from "fs";
import { readdirSync, readdir as readdirCb } from "fs";
import { readdir } from "fs/promises";
import { relative, resolve } from "path";
import { bench, run } from "./runner.mjs";
import { argv } from "process";
import { fileURLToPath } from "url";
import { bench, run } from "./runner.mjs";
import { relative, resolve } from "path";
import { createHash } from "crypto";
let dir = resolve(argv.length > 2 ? argv[2] : fileURLToPath(new URL("../../node_modules", import.meta.url)));
if (dir.includes(process.cwd())) {

View File

@@ -1,6 +1,6 @@
import { readFileSync } from "node:fs";
import { readFile } from "node:fs/promises";
import { bench, run } from "./runner.mjs";
import { readFileSync, existsSync } from "node:fs";
import { readFile } from "node:fs/promises";
bench(`readFileSync(/tmp/404-not-found)`, () => {
try {

View File

@@ -1,7 +1,7 @@
import { realpathSync } from "node:fs";
import { bench, run } from "./runner.mjs";
const count = parseInt(process.env.ITERATIONS || "1", 10) || 1;
const arg = process.argv[process.argv.length - 1];
import { bench, run } from "./runner.mjs";
bench("realpathSync x " + count, () => {
for (let i = 0; i < count; i++) realpathSync(arg, "utf-8");

View File

@@ -1,4 +1,4 @@
import ReactDOMServer from "react-dom/server.browser";
import decoding from "./jsx-entity-decoding";
import ReactDOMServer from "react-dom/server.browser";
console.log(ReactDOMServer.renderToString(decoding));

View File

@@ -1,6 +1,7 @@
import { spawnSync } from "child_process";
import { writeFile } from "node:fs/promises";
import { bench, run } from "./runner.mjs";
import { builtinModules } from "node:module";
import { writeFile } from "node:fs/promises";
import { spawnSync } from "child_process";
for (let builtin of builtinModules) {
const path = `/tmp/require.${builtin.replaceAll("/", "_")}.cjs`;

View File

@@ -1,5 +1,5 @@
import { existsSync, mkdirSync, promises } from "node:fs";
import { tmpdir } from "node:os";
import { promises, existsSync, mkdirSync } from "node:fs";
const count = 1024 * 12;
var queue = new Array(count);

View File

@@ -1,9 +1,9 @@
// note: this isn't done yet
// we look for `// @runtime` in the file to determine which runtimes to run the benchmark in
import { spawnSync } from "bun";
import { Database } from "bun:sqlite";
import { readdirSync, readFileSync } from "node:fs";
import { basename, extname } from "path";
import { Database } from "bun:sqlite";
import { extname, basename } from "path";
const exts = [".js", ".ts", ".mjs", ".tsx"];

View File

@@ -1,5 +1,5 @@
import process from "node:process";
import * as Mitata from "../node_modules/mitata/src/cli.mjs";
import process from "node:process";
const asJSON = !!process?.env?.BENCHMARK_RUNNER;

View File

@@ -1,4 +1,4 @@
import { deserialize, serialize } from "node:v8";
import { serialize, deserialize } from "node:v8";
import { bench, run } from "./runner.mjs";
const obj = {
"id": 1296269,

View File

@@ -1,3 +1,5 @@
import { bench, run } from "../node_modules/mitata/src/cli.mjs";
let count = 20_000_000;
const batchSize = 1_000_000;
console.time("Run");

View File

@@ -1,5 +1,5 @@
import { SHA512 } from "bun";
import { bench, run } from "./runner.mjs";
import { SHA512 } from "bun";
bench('SHA512.hash("hello world")', () => {
SHA512.hash("hello world");

View File

@@ -1,5 +1,5 @@
import { createHash } from "crypto";
import { bench, run } from "./runner.mjs";
import { createHash } from "crypto";
bench('createHash("sha256").update("hello world").digest()', () => {
createHash("sha256").update("hello world").digest();

View File

@@ -1,6 +1,6 @@
import { $ as execa$ } from "execa";
import { $ as zx } from "zx";
import { bench, group, run } from "./runner.mjs";
import { $ as execa$ } from "execa";
import { bench, run, group } from "./runner.mjs";
const execa = execa$({ stdio: "ignore", cwd: import.meta.dirname });

View File

@@ -1,6 +1,6 @@
import { statSync } from "fs";
import { argv } from "process";
import { readdirSync, statSync } from "fs";
import { bench, run } from "./runner.mjs";
import { argv } from "process";
const dir = argv.length > 2 ? argv[2] : "/tmp";

View File

@@ -1,4 +1,4 @@
import { bench, run } from "./runner.mjs";
import { run, bench } from "./runner.mjs";
var writer = globalThis.Bun ? Bun.stderr.writer() : undefined;
if (writer)

View File

@@ -1,5 +1,5 @@
import { StringDecoder } from "string_decoder";
import { bench, run } from "./runner.mjs";
import { StringDecoder } from "string_decoder";
var short = Buffer.from("Hello World!");
var shortUTF16 = Buffer.from("Hello World 💕💕💕");

View File

@@ -1,5 +1,5 @@
import npmStringWidth from "string-width";
import { bench, run } from "./runner.mjs";
import npmStringWidth from "string-width";
const bunStringWidth = globalThis?.Bun?.stringWidth;

View File

@@ -1,4 +1,4 @@
import { connect, listen } from "bun";
import { listen, connect } from "bun";
var counter = 0;
const msg = "Hello World!";

View File

@@ -1,8 +1,8 @@
import { readFileSync } from "fs";
import { createRequire } from "module";
import { dirname } from "path";
import { fileURLToPath } from "url";
import { bench, group, run } from "./runner.mjs";
import { bench, run, group } from "./runner.mjs";
import { createRequire } from "module";
const require = createRequire(import.meta.url);
const esbuild_ = require("esbuild/lib/main");
const swc_ = require("@swc/core");

View File

@@ -1,4 +1,4 @@
import { writeFileSync } from "node:fs";
import { readFileSync, writeFileSync } from "node:fs";
import { bench, run } from "./runner.mjs";
var short = "Hello World!";

View File

@@ -1,6 +1,6 @@
import { bench, run } from "./runner.mjs";
import { write } from "bun";
import { openSync } from "fs";
import { bench, run } from "./runner.mjs";
bench('write(/tmp/foo.txt, "short string")', async () => {
await write("/tmp/foo.txt", "short string");

View File

@@ -1,8 +1,9 @@
// @runtime node, bun, deno
import { Buffer } from "node:buffer";
import { openSync, writeSync as write } from "node:fs";
import { writeFile } from "node:fs/promises";
import { bench, run } from "./runner.mjs";
import { Buffer } from "node:buffer";
import { openSync } from "node:fs";
import { writeFile } from "node:fs/promises";
import { writeSync as write } from "node:fs";
bench("writeFile(/tmp/foo.txt, short string)", async () => {
await writeFile("/tmp/foo.txt", "short string", "utf8");

View File

@@ -1,4 +1,4 @@
import { bench, run } from "mitata";
import { run, bench } from "mitata";
import { createRequire } from "module";
const require = createRequire(import.meta.url);

View File

@@ -1,5 +1,5 @@
import { run, bench } from "mitata";
import { Database } from "bun:sqlite";
import { bench, run } from "mitata";
import { join } from "path";
const db = Database.open(join(import.meta.dir, "src", "northwind.sqlite"));

View File

@@ -1,5 +1,5 @@
import { Database } from "https://deno.land/x/sqlite3@0.11.1/mod.ts";
import { bench, run } from "../node_modules/mitata/src/cli.mjs";
import { run, bench } from "../node_modules/mitata/src/cli.mjs";
const db = new Database("./src/northwind.sqlite");

View File

@@ -1,6 +1,6 @@
// Run `node --experimental-sqlite bench/sqlite/node.mjs` to run the script.
// You will need `--experimental-sqlite` flag to run this script and node v22.5.0 or higher.
import { bench, run } from "mitata";
import { run, bench } from "mitata";
import { DatabaseSync as Database } from "node:sqlite";
const db = new Database("./src/northwind.sqlite");

View File

@@ -1,7 +0,0 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
// For the organize imports plugin
"jsx": "react"
}
}

View File

@@ -89,8 +89,10 @@ const BunBuildOptions = struct {
pub fn getOSVersionMin(os: OperatingSystem) ?Target.Query.OsVersion {
return switch (os) {
// bun needs macOS 12 to work properly due to icucore, but we have been
// compiling everything with 11 as the minimum.
.mac => .{
.semver = .{ .major = 13, .minor = 0, .patch = 0 },
.semver = .{ .major = 11, .minor = 0, .patch = 0 },
},
// Windows 10 1809 is the minimum supported version

BIN
bun.lockb

Binary file not shown.

View File

@@ -82,7 +82,7 @@ _bun_completions() {
declare -A PACKAGE_OPTIONS;
declare -A PM_OPTIONS;
local SUBCOMMANDS="dev bun create run install add remove upgrade completions discord help init pm x test repl update outdated link unlink build";
local SUBCOMMANDS="dev bun create run install add remove upgrade completions discord help init pm x test repl update link unlink build";
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";

View File

@@ -179,7 +179,6 @@ complete -c bun -n "__fish_use_subcommand" -a "remove" -d "Remove a dependency f
complete -c bun -n "__fish_use_subcommand" -a "add" -d "Add a dependency to package.json" -f
complete -c bun -n "__fish_use_subcommand" -a "init" -d "Initialize a Bun project in this directory" -f
complete -c bun -n "__fish_use_subcommand" -a "link" -d "Register or link a local npm package" -f
complete -c bun -n "__fish_use_subcommand" -a "unlink" -d "Unregister a local npm package" -f
complete -c bun -n "__fish_use_subcommand" -a "link" -d "Unregister a local npm package" -f
complete -c bun -n "__fish_use_subcommand" -a "pm" -d "Additional package management utilities" -f
complete -c bun -n "__fish_use_subcommand" -a "x" -d "Execute a package binary, installing if needed" -f
complete -c bun -n "__fish_use_subcommand" -a "outdated" -d "Display the latest versions of outdated dependencies" -f

View File

@@ -563,22 +563,6 @@ _bun_update_completion() {
esac
}
_bun_outdated_completion() {
_arguments -s -C \
'--cwd[Set a specific cwd]:cwd' \
'--verbose[Excessively verbose logging]' \
'--no-progress[Disable the progress bar]' \
'--help[Print this help menu]' &&
ret=0
case $state in
config)
_bun_list_bunfig_toml
;;
esac
}
_bun_test_completion() {
_arguments -s -C \
'1: :->cmd1' \
@@ -685,7 +669,6 @@ _bun() {
'add\:"Add a dependency to package.json (bun a)" '
'remove\:"Remove a dependency from package.json (bun rm)" '
'update\:"Update outdated dependencies & save to package.json" '
'outdated\:"Display the latest versions of outdated dependencies" '
'link\:"Link an npm package globally" '
'unlink\:"Globally unlink an npm package" '
'pm\:"More commands for managing packages" '
@@ -757,10 +740,6 @@ _bun() {
update)
_bun_update_completion
;;
outdated)
_bun_outdated_completion
;;
'test')
_bun_test_completion
@@ -840,10 +819,6 @@ _bun() {
update)
_bun_update_completion
;;
outdated)
_bun_outdated_completion
;;
'test')
_bun_test_completion

View File

@@ -70,116 +70,6 @@ const server = Bun.serve({
});
```
### Static routes
Use the `static` option to serve static `Response` objects by route.
```ts
// Bun v1.1.27+ required
Bun.serve({
static: {
// health-check endpoint
"/api/health-check": new Response("All good!"),
// redirect from /old-link to /new-link
"/old-link": Response.redirect("/new-link", 301),
// serve static text
"/": new Response("Hello World"),
// server a file by buffering it in memory
"/index.html": new Response(await Bun.file("./index.html").bytes(), {
headers: {
"Content-Type": "text/html",
},
}),
"/favicon.ico": new Response(await Bun.file("./favicon.ico").bytes(), {
headers: {
"Content-Type": "image/x-icon",
},
}),
// serve JSON
"/api/version.json": Response.json({ version: "1.0.0" }),
},
fetch(req) {
return new Response("404!");
},
});
```
Static routes support headers, status code, and other `Response` options.
```ts
Bun.serve({
static: {
"/api/time": new Response(new Date().toISOString(), {
headers: {
"X-Custom-Header": "Bun!",
},
}),
},
fetch(req) {
return new Response("404!");
},
});
```
Static routes can serve Response bodies faster than `fetch` handlers because they don't create `Request` objects, they don't create `AbortSignal`, they don't create additional `Response` objects. The only per-request memory allocation is the TCP/TLS socket data needed for each request.
{% note %}
`static` is experimental
{% /note %}
Static route responses are cached for the lifetime of the server object. To reload static routes, call `server.reload(options)`.
```ts
const server = Bun.serve({
static: {
"/api/time": new Response(new Date().toISOString()),
},
fetch(req) {
return new Response("404!");
},
});
// Update the time every second.
setInterval(() => {
server.reload({
static: {
"/api/time": new Response(new Date().toISOString()),
},
fetch(req) {
return new Response("404!");
},
});
}, 1000);
```
Reloading static routes only impact the next request. In-flight requests continue to use the old static routes. After in-flight requests to old static routes are finished, the old static routes are freed from memory.
To simplify error handling, static routes do not support streaming response bodies from `ReadableStream` or an `AsyncIterator`. Fortunately, you can still buffer the response in memory first:
```ts
const time = await fetch("https://api.example.com/v1/data");
// Buffer the response in memory first.
const blob = await time.blob();
const server = Bun.serve({
static: {
"/api/data": new Response(blob),
},
fetch(req) {
return new Response("404!");
},
});
```
### Changing the `port` and `hostname`
To configure which port and hostname the server will listen on, set `port` and `hostname` in the options object.
@@ -436,24 +326,7 @@ Bun.serve({
});
```
## idleTimeout
To configure the idle timeout, set the `idleTimeout` field in Bun.serve.
```ts
Bun.serve({
// 10 seconds:
idleTimeout: 10,
fetch(req) {
return new Response("Bun!");
},
});
```
This is the maximum amount of time a connection is allowed to be idle before the server closes it. A connection is idling if there is no data sent or received.
## export default syntax
## Object syntax
Thus far, the examples on this page have used the explicit `Bun.serve` API. Bun also supports an alternate syntax.

View File

@@ -419,7 +419,7 @@ const results = query.all("hello", "goodbye");
sqlite supports signed 64 bit integers, but JavaScript only supports signed 52 bit integers or arbitrary precision integers with `bigint`.
`bigint` input is supported everywhere, but by default `bun:sqlite` returns integers as `number` types. If you need to handle integers larger than 2^53, set `safeIntegers` option to `true` when creating a `Database` instance. This also validates that `bigint` passed to `bun:sqlite` do not exceed 64 bits.
`bigint` input is supported everywhere, but by default `bun:sqlite` returns integers as `number` types. If you need to handle integers larger than 2^53, set `safeInteger` option to `true` when creating a `Database` instance. This also validates that `bigint` passed to `bun:sqlite` do not exceed 64 bits.
By default, `bun:sqlite` returns integers as `number` types. If you need to handle integers larger than 2^53, you can use the `bigint` type.

View File

@@ -1,61 +0,0 @@
Use `bun outdated` to display a table of outdated dependencies with their latest versions for the current workspace:
```sh
$ bun outdated
|--------------------------------------------------------------------|
| Package | Current | Update | Latest |
|----------------------------------------|---------|--------|--------|
| @types/bun (dev) | 1.1.6 | 1.1.7 | 1.1.7 |
|----------------------------------------|---------|--------|--------|
| @types/react (dev) | 18.3.3 | 18.3.4 | 18.3.4 |
|----------------------------------------|---------|--------|--------|
| @typescript-eslint/eslint-plugin (dev) | 7.16.1 | 7.18.0 | 8.2.0 |
|----------------------------------------|---------|--------|--------|
| @typescript-eslint/parser (dev) | 7.16.1 | 7.18.0 | 8.2.0 |
|----------------------------------------|---------|--------|--------|
| esbuild (dev) | 0.21.5 | 0.21.5 | 0.23.1 |
|----------------------------------------|---------|--------|--------|
| eslint (dev) | 9.7.0 | 9.9.1 | 9.9.1 |
|----------------------------------------|---------|--------|--------|
| typescript (dev) | 5.5.3 | 5.5.4 | 5.5.4 |
|--------------------------------------------------------------------|
```
The `Update` column shows the version that would be installed if you ran `bun update [package]`. This version is the latest version that satisfies the version range specified in your `package.json`.
The `Latest` column shows the latest version available from the registry. `bun update --latest [package]` will update to this version.
Dependency names can be provided to filter the output (pattern matching is supported):
```sh
$ bun outdated "@types/*"
|------------------------------------------------|
| Package | Current | Update | Latest |
|--------------------|---------|--------|--------|
| @types/bun (dev) | 1.1.6 | 1.1.8 | 1.1.8 |
|--------------------|---------|--------|--------|
| @types/react (dev) | 18.3.3 | 18.3.4 | 18.3.4 |
|------------------------------------------------|
```
## `--filter`
The `--filter` flag can be used to select workspaces to include in the output. Workspace names or paths can be used as patterns.
```sh
$ bun outdated --filter <pattern>
```
For example, to only show outdated dependencies for workspaces in the `./apps` directory:
```sh
$ bun outdated --filter './apps/*'
```
If you want to do the same, but exclude the `./apps/api` workspace:
```sh
$ bun outdated --filter './apps/*' --filter '!./apps/api'
```

View File

@@ -16,6 +16,10 @@ $ bun test # run tests
$ bunx cowsay 'Hello, world!' # execute a package
```
{% callout type="note" %}
**Bun is still under development.** Use it to speed up your development workflows or run simpler production code in resource-constrained environments like serverless functions. We're working on more complete Node.js compatibility and integration with existing frameworks. Join the [Discord](https://bun.sh/discord) and watch the [GitHub repository](https://github.com/oven-sh/bun) to keep tabs on future releases.
{% /callout %}
Get started with one of the quick links below, or read on to learn more about Bun.
{% block className="gap-2 grid grid-flow-row grid-cols-1 md:grid-cols-2" %}

View File

@@ -27,4 +27,4 @@ To configure a private registry scoped to a particular organization:
### `.npmrc`
Bun also reads `.npmrc` files, [learn more](/docs/install/npmrc).
Bun does not currently read `.npmrc` files. For private registries, migrate your registry configuration to `bunfig.toml` as documented above.

View File

@@ -164,9 +164,6 @@ export default {
page("cli/update", "`bun update`", {
description: "Update your project's dependencies.",
}),
page("cli/outdated", "`bun outdated`", {
description: "Check for outdated dependencies.",
}),
page("cli/link", "`bun link`", {
description: "Install local packages as dependencies in your project.",
}),

View File

@@ -1,22 +0,0 @@
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
"importsNotUsedAsValues": "preserve"
},
"include": [".", "packages/bun-types/index.d.ts"],
"exclude": [
"src/test",
"src/js/out",
// "src/js/builtins",
"packages",
"bench",
"examples/*/*",
"test",
"src/deps",
"bun-webkit",
"src/bun.js/WebKit",
"src/api/demo",
"node_modules"
],
"files": ["src/js/builtins.d.ts"]
}

View File

@@ -5,10 +5,6 @@
"./packages/bun-types"
],
"devDependencies": {
"@types/bun": "^1.1.3",
"@types/react": "^18.3.3",
"@typescript-eslint/eslint-plugin": "^7.11.0",
"@typescript-eslint/parser": "^7.11.0",
"@vscode/debugadapter": "^1.65.0",
"esbuild": "^0.21.4",
"eslint": "^9.4.0",
@@ -16,11 +12,14 @@
"mitata": "^0.1.11",
"peechy": "0.4.34",
"prettier": "^3.2.5",
"prettier-plugin-organize-imports": "^4.0.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"source-map-js": "^1.2.0",
"typescript": "^5.4.5"
"typescript": "^5.4.5",
"@types/bun": "^1.1.3",
"@types/react": "^18.3.3",
"@typescript-eslint/eslint-plugin": "^7.11.0",
"@typescript-eslint/parser": "^7.11.0"
},
"resolutions": {
"bun-types": "workspace:packages/bun-types"
@@ -40,7 +39,7 @@
"build:windows": "cmake -B build -S . -G Ninja -DCMAKE_BUILD_TYPE=Debug && ninja -Cbuild",
"build:windows:release": "cmake -B build-release -S . -G Ninja -DCMAKE_BUILD_TYPE=Release && ninja -Cbuild-release",
"typecheck": "tsc --noEmit && cd test && bun run typecheck",
"fmt": "prettier --config=.prettierrc-ci --write --cache './{.vscode,src,test,bench,packages/{bun-types,bun-inspector-*,bun-vscode,bun-debug-adapter-protocol}}/**/*.{mjs,ts,tsx,js,jsx}'",
"fmt": "prettier --write --cache './{.vscode,src,test,bench,packages/{bun-types,bun-inspector-*,bun-vscode,bun-debug-adapter-protocol}}/**/*.{mjs,ts,tsx,js,jsx}'",
"fmt:zig": "zig fmt src/*.zig src/*/*.zig src/*/*/*.zig src/*/*/*/*.zig",
"lint": "eslint './**/*.d.ts' --cache",
"lint:fix": "eslint './**/*.d.ts' --cache --fix",

View File

@@ -1,3 +1,3 @@
export type * from "./src/protocol";
export * from "./src/debugger/adapter";
export * from "./src/debugger/signal";
export type * from "./src/protocol";

View File

@@ -1,6 +1,6 @@
import { spawnSync } from "node:child_process";
import { writeFileSync } from "node:fs";
import type { Protocol, Type } from "../src/protocol/schema";
import { writeFileSync } from "node:fs";
import { spawnSync } from "node:child_process";
run().catch(console.error);

View File

@@ -1,13 +1,13 @@
import type { InspectorEventMap } from "../../../bun-inspector-protocol/src/inspector";
import type { JSC } from "../../../bun-inspector-protocol/src/protocol";
import type { DAP } from "../protocol";
import type { JSC } from "../../../bun-inspector-protocol/src/protocol";
import type { InspectorEventMap } from "../../../bun-inspector-protocol/src/inspector";
// @ts-ignore
import { WebSocketInspector, remoteObjectToString } from "../../../bun-inspector-protocol/index";
import type { ChildProcess } from "node:child_process";
import { spawn } from "node:child_process";
import { EventEmitter } from "node:events";
import { WebSocketInspector, remoteObjectToString } from "../../../bun-inspector-protocol/index";
import { UnixSignal, randomUnixPath } from "./signal";
import { Location, SourceMap } from "./sourcemap";
import { EventEmitter } from "node:events";
import { UnixSignal, randomUnixPath } from "./signal";
const capabilities: DAP.Capabilities = {
supportsConfigurationDoneRequest: true,

View File

@@ -1,8 +1,8 @@
import { EventEmitter } from "node:events";
import type { Server } from "node:net";
import { createServer } from "node:net";
import { tmpdir } from "node:os";
import { join } from "node:path";
import type { Server } from "node:net";
import { createServer } from "node:net";
import { EventEmitter } from "node:events";
const isDebug = process.env.NODE_ENV === "development";

Some files were not shown because too many files have changed in this diff Show More